@shumai-one/shumai 0.4.2 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/chunk-071x515q.js +4 -0
- package/bin/{chunk-adekdctx.css → chunk-0ccg9ddn.css} +1 -1
- package/bin/chunk-0cmx7k4c.js +1 -0
- package/bin/chunk-0qaq0sp8.js +5 -0
- package/bin/chunk-0qjfahk9.js +2 -0
- package/bin/chunk-0zv3bks2.js +2 -0
- package/bin/chunk-16xax8kk.js +1 -0
- package/bin/chunk-1gvscz88.js +5 -0
- package/bin/chunk-1j27fzy1.js +2 -0
- package/bin/chunk-1t167cvj.js +11 -0
- package/bin/chunk-1xh34aew.js +2 -0
- package/bin/chunk-1zwajpwf.js +8 -0
- package/bin/chunk-2w5xqhjm.js +1 -0
- package/bin/chunk-3tedzb2j.js +54 -0
- package/bin/chunk-3ttrhqy3.js +2 -0
- package/bin/chunk-3zkasqb8.js +1 -0
- package/bin/chunk-453ykvaw.js +2 -0
- package/bin/chunk-4991gz3y.js +13 -0
- package/bin/chunk-4hkkdm2q.js +2 -0
- package/bin/chunk-4mjywsj8.js +3 -0
- package/bin/chunk-4v41a1r9.js +6 -0
- package/bin/chunk-4wy87hwd.js +3 -0
- package/bin/chunk-579e4wv4.js +3 -0
- package/bin/chunk-5adsx8x4.js +2 -0
- package/bin/chunk-5hg6kcfz.js +45 -0
- package/bin/chunk-5nm2jvg5.js +32 -0
- package/bin/chunk-5tcdwep5.js +11 -0
- package/bin/chunk-5vzrpz50.js +2 -0
- package/bin/chunk-6ghcj4a9.js +3 -0
- package/bin/chunk-77fmkpdz.js +10 -0
- package/bin/chunk-7bcxj1jd.js +2 -0
- package/bin/chunk-7gmdnsdg.js +2 -0
- package/bin/chunk-7jtmwt5a.js +3 -0
- package/bin/chunk-7kjgvxqa.js +2 -0
- package/bin/chunk-7pw1550a.js +2 -0
- package/bin/chunk-7rhz2gze.js +211 -0
- package/bin/chunk-837fky18.js +3 -0
- package/bin/chunk-84as6x83.js +1 -0
- package/bin/chunk-8e28hcny.js +2 -0
- package/bin/chunk-914bp49r.js +4 -0
- package/bin/chunk-97f2af6d.js +12 -0
- package/bin/chunk-98715kc3.js +2 -0
- package/bin/chunk-9ccw540k.js +2 -0
- package/bin/chunk-9t8n2des.js +2 -0
- package/bin/chunk-9ybt6vbm.js +1 -0
- package/bin/chunk-a6gx7f5q.js +1 -0
- package/bin/chunk-avwgktxb.js +2 -0
- package/bin/chunk-bkr5zm4h.js +2 -0
- package/bin/chunk-cbgq517y.js +2 -0
- package/bin/chunk-d27mm390.js +1 -0
- package/bin/chunk-dj92fss9.js +2 -0
- package/bin/chunk-dqxeztfa.js +2 -0
- package/bin/chunk-drepsbb4.js +2 -0
- package/bin/chunk-f6svp4dp.js +2 -0
- package/bin/chunk-fahk9h62.js +8 -0
- package/bin/chunk-fb40xxz3.js +3 -0
- package/bin/chunk-fnmwksnb.js +3 -0
- package/bin/chunk-fpc4p0j8.js +3 -0
- package/bin/chunk-fsyzs0tf.js +1 -0
- package/bin/chunk-fxecgp5k.js +1 -0
- package/bin/chunk-g3fpmyyn.js +3 -0
- package/bin/chunk-gc5sbfa5.js +2 -0
- package/bin/chunk-gdm6yfqq.js +2 -0
- package/bin/chunk-gk2q9a3f.js +2 -0
- package/bin/chunk-gt4csat6.js +3 -0
- package/bin/chunk-gye8gabk.js +2 -0
- package/bin/chunk-hk5rc6cd.js +24 -0
- package/bin/chunk-hm0dkzed.js +3 -0
- package/bin/chunk-hmpwg5za.js +16 -0
- package/bin/chunk-j1tkmcae.js +3 -0
- package/bin/chunk-j2bvj2yn.js +2 -0
- package/bin/chunk-jffktpqg.js +1 -0
- package/bin/chunk-jgs8an3h.js +18 -0
- package/bin/chunk-jmpb5633.js +2 -0
- package/bin/chunk-jrjnqx78.js +2 -0
- package/bin/chunk-k2k9vjq6.js +1 -0
- package/bin/chunk-kpgfqkp0.js +3 -0
- package/bin/chunk-ks8xzc95.js +3 -0
- package/bin/chunk-kswvyqq1.js +2 -0
- package/bin/chunk-m9pr03kn.js +2 -0
- package/bin/chunk-mfn9qjm4.js +2 -0
- package/bin/chunk-msfw3jmc.js +3 -0
- package/bin/chunk-mz0yjra0.js +5 -0
- package/bin/chunk-nbdw8fen.js +1 -0
- package/bin/chunk-nkdk229f.js +2 -0
- package/bin/chunk-nr20tvnw.js +3 -0
- package/bin/chunk-pazjhrnf.js +12 -0
- package/bin/chunk-q806pqeh.js +1 -0
- package/bin/chunk-qka4mkmj.js +2 -0
- package/bin/chunk-qsr1a0rp.js +2 -0
- package/bin/chunk-rchsme43.js +3 -0
- package/bin/chunk-reyxk4bw.js +2 -0
- package/bin/chunk-rhvv1vvk.js +3 -0
- package/bin/chunk-rq0n0vcc.js +2 -0
- package/bin/chunk-rqf7999q.js +42 -0
- package/bin/chunk-rssgmj7x.js +2 -0
- package/bin/chunk-ryzz5fht.js +2 -0
- package/bin/chunk-s2fnfyn9.js +2 -0
- package/bin/chunk-s2k4qntr.js +3 -0
- package/bin/chunk-snhsjs4x.js +299 -0
- package/bin/chunk-t2hy6tj9.js +2 -0
- package/bin/chunk-t7nsgg5k.js +4 -0
- package/bin/chunk-tm7f32c7.js +14 -0
- package/bin/chunk-trveq4wg.js +3 -0
- package/bin/chunk-vap4k11j.js +20 -0
- package/bin/chunk-vm5fx7td.js +3 -0
- package/bin/chunk-vy8gntez.js +1 -0
- package/bin/chunk-vyzptrea.js +2 -0
- package/bin/chunk-w4ghe71n.js +2 -0
- package/bin/chunk-wdsf44hs.js +2 -0
- package/bin/chunk-wjyaezs7.js +2 -0
- package/bin/chunk-wndm3px3.js +1 -0
- package/bin/chunk-x5jwwvs0.js +1 -0
- package/bin/chunk-x92cq59c.js +1 -0
- package/bin/chunk-xa18z1py.js +3 -0
- package/bin/chunk-xarsrs08.js +2 -0
- package/bin/chunk-xtf3c29c.css +1 -0
- package/bin/chunk-xx337zcw.js +2 -0
- package/bin/chunk-xz6713tj.js +2 -0
- package/bin/chunk-yfnem6se.js +2 -0
- package/bin/chunk-ytdwk2fq.js +2 -0
- package/bin/chunk-ze20rm02.js +7 -0
- package/bin/chunk-zw86wnwe.js +7 -0
- package/bin/chunk-zxk7q0zk.js +2 -0
- package/bin/{pdf.worker.min-szxdj13d.mjs → pdf.worker.min-vf48er29.mjs} +14423 -13889
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +841 -678
- package/package.json +18 -18
- package/prisma/migrations/20260904022457_add_agent_id_to_assets_and_audit_logs/migration.sql +17 -0
- package/prisma/migrations/20260906081230_default_denied_tools_delete_asset/migration.sql +15 -0
- package/prisma/migrations/20260907021754_add_asset_upload_id/migration.sql +2 -0
- package/prisma/schema.prisma +10 -0
- package/bin/chunk-07h4b77v.js +0 -2
- package/bin/chunk-0t4n4d5w.js +0 -4
- package/bin/chunk-1611z9jg.js +0 -2
- package/bin/chunk-1phqxp6z.js +0 -3
- package/bin/chunk-23hckrrz.js +0 -2
- package/bin/chunk-30z44j1g.js +0 -2
- package/bin/chunk-3j463k1g.js +0 -1
- package/bin/chunk-4181tdds.js +0 -14
- package/bin/chunk-480jtqng.js +0 -4
- package/bin/chunk-4c3g146q.js +0 -2
- package/bin/chunk-4ca0zt5e.js +0 -1
- package/bin/chunk-4d9bgmf2.js +0 -2
- package/bin/chunk-4ev56fss.js +0 -9
- package/bin/chunk-4gk52tjq.js +0 -45
- package/bin/chunk-4mdqkj4d.js +0 -1
- package/bin/chunk-4r91fggc.js +0 -2
- package/bin/chunk-50fb1x3w.js +0 -1
- package/bin/chunk-59gj1njz.js +0 -1
- package/bin/chunk-5pr0t7fb.js +0 -2
- package/bin/chunk-5vewxmz7.js +0 -3
- package/bin/chunk-62zx96pe.js +0 -2
- package/bin/chunk-63y0eb07.js +0 -2
- package/bin/chunk-6d5xrgfx.js +0 -2
- package/bin/chunk-6gbtz5bf.js +0 -67
- package/bin/chunk-6gjg5egq.js +0 -3
- package/bin/chunk-6m4jz9s1.js +0 -44
- package/bin/chunk-6s4x525w.js +0 -2
- package/bin/chunk-6w2wmvqs.js +0 -3
- package/bin/chunk-77d23vcn.js +0 -2
- package/bin/chunk-77m5p188.js +0 -2
- package/bin/chunk-7bvx087f.js +0 -1
- package/bin/chunk-7pfjfrjg.js +0 -5
- package/bin/chunk-7q10s127.js +0 -4
- package/bin/chunk-7thx8ctx.js +0 -3
- package/bin/chunk-8t4s91gh.js +0 -2
- package/bin/chunk-98ey5p2e.js +0 -3
- package/bin/chunk-9amndcyh.js +0 -6
- package/bin/chunk-9bk23g9x.js +0 -1
- package/bin/chunk-9mkcfy43.js +0 -1
- package/bin/chunk-9t3nsq5n.js +0 -2
- package/bin/chunk-9tjq99ds.js +0 -2
- package/bin/chunk-9wm9rwh1.js +0 -2
- package/bin/chunk-ab16fyg4.js +0 -4
- package/bin/chunk-arv0g2av.js +0 -1
- package/bin/chunk-aytj4zxg.js +0 -3
- package/bin/chunk-b1ypjqgp.js +0 -2
- package/bin/chunk-bdjv0ykq.js +0 -2
- package/bin/chunk-c1k86mfa.js +0 -10
- package/bin/chunk-caa96dgd.js +0 -2
- package/bin/chunk-ce4v2yjy.js +0 -1
- package/bin/chunk-cqh60y54.js +0 -3
- package/bin/chunk-cvq7zgw7.js +0 -1
- package/bin/chunk-d9mjbtp2.js +0 -2
- package/bin/chunk-dn7sbjws.js +0 -3
- package/bin/chunk-dxyq9h8n.js +0 -3
- package/bin/chunk-e3cabksx.js +0 -3
- package/bin/chunk-egcrbj94.js +0 -2
- package/bin/chunk-ev17v1mv.js +0 -2
- package/bin/chunk-evtpwg71.js +0 -2
- package/bin/chunk-f3e0nsv2.js +0 -2
- package/bin/chunk-f40gjqpq.js +0 -2
- package/bin/chunk-fe7822ak.js +0 -299
- package/bin/chunk-g8tkhw9j.js +0 -2
- package/bin/chunk-g9r0p4t8.js +0 -2
- package/bin/chunk-gbjyh9ms.js +0 -1
- package/bin/chunk-gtbsb39v.js +0 -3
- package/bin/chunk-gytz1q13.js +0 -13
- package/bin/chunk-h0fxysxs.js +0 -7
- package/bin/chunk-h8bdvsqt.js +0 -2
- package/bin/chunk-hag024w8.js +0 -2
- package/bin/chunk-hc6w5nw4.js +0 -7
- package/bin/chunk-j69dqc48.js +0 -2
- package/bin/chunk-jbtw1zym.js +0 -8
- package/bin/chunk-jc1vb7rj.js +0 -5
- package/bin/chunk-jdv78w9r.js +0 -2
- package/bin/chunk-jjs70y9v.js +0 -3
- package/bin/chunk-jmdar2gz.js +0 -2
- package/bin/chunk-jvwz10n4.js +0 -2
- package/bin/chunk-k47md1g4.js +0 -2
- package/bin/chunk-k4v0brcb.js +0 -2
- package/bin/chunk-k6n7c07e.js +0 -1
- package/bin/chunk-kk2cstsg.js +0 -2
- package/bin/chunk-knz4h56q.js +0 -12
- package/bin/chunk-kqqtt6bd.js +0 -3
- package/bin/chunk-kvyp1t4j.js +0 -7
- package/bin/chunk-kxskpgsq.js +0 -5
- package/bin/chunk-m6srbjcs.js +0 -2
- package/bin/chunk-mcc1scxs.js +0 -12
- package/bin/chunk-mq83a0kk.js +0 -2
- package/bin/chunk-mxm8g4q0.js +0 -1
- package/bin/chunk-nhpgdqq5.js +0 -2
- package/bin/chunk-nne496aa.js +0 -2
- package/bin/chunk-nqpb0r9h.js +0 -11
- package/bin/chunk-ns0zww9g.js +0 -2
- package/bin/chunk-ps4xfp23.js +0 -2
- package/bin/chunk-pz2ec6xt.js +0 -2
- package/bin/chunk-q163k309.js +0 -2
- package/bin/chunk-q1da61ps.js +0 -1
- package/bin/chunk-qrf0ady6.js +0 -68
- package/bin/chunk-qy28f25e.js +0 -2
- package/bin/chunk-r7s4ypw1.js +0 -2
- package/bin/chunk-ran23vm9.js +0 -1
- package/bin/chunk-rfvdc4n0.js +0 -2
- package/bin/chunk-rgthkvgx.js +0 -3
- package/bin/chunk-s39n3yw3.js +0 -2
- package/bin/chunk-s7wdd0g7.js +0 -8
- package/bin/chunk-s88ha5kx.js +0 -3
- package/bin/chunk-sf91bt9m.js +0 -2
- package/bin/chunk-sjwbjf9j.js +0 -2
- package/bin/chunk-t62076pv.js +0 -1
- package/bin/chunk-tbbwss3v.js +0 -3
- package/bin/chunk-tjcc7a6y.js +0 -24
- package/bin/chunk-tp6ab26e.js +0 -2
- package/bin/chunk-v2wxk9p5.js +0 -4
- package/bin/chunk-vbk6y4hk.js +0 -2
- package/bin/chunk-vfgfg5fk.js +0 -2
- package/bin/chunk-vm6c3xx9.js +0 -2
- package/bin/chunk-vsx96mt6.js +0 -3
- package/bin/chunk-wbyw1shz.js +0 -6
- package/bin/chunk-whh2vh50.css +0 -1
- package/bin/chunk-wjkcq65s.js +0 -2
- package/bin/chunk-wkefwkfp.js +0 -41
- package/bin/chunk-x7bsnk1e.js +0 -2
- package/bin/chunk-xbhw6bpz.js +0 -3
- package/bin/chunk-xg5yrcj5.js +0 -2
- package/bin/chunk-xg9xscqz.js +0 -1
- package/bin/chunk-xw2gpcsh.js +0 -3
- package/bin/chunk-ycq8ank7.js +0 -2
- package/bin/chunk-yp9hvkc5.js +0 -73
- package/bin/chunk-ytypyfkc.js +0 -65
- package/bin/chunk-z1kjmf60.js +0 -2
- package/bin/chunk-z36bx86r.js +0 -2
- package/bin/chunk-z7hdnecp.js +0 -3
- package/bin/chunk-zeby1cq7.js +0 -2
- package/bin/chunk-zs5e8z1w.js +0 -1
- package/bin/chunk-zxnyefg5.js +0 -2
- /package/bin/{chunk-24ke0th1.css → chunk-kegybs91.css} +0 -0
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import{Cs,Fa,xt,q,D,wc,N,St,h,Nu,ln,Ge,O,w,u,Es,C,B,t,o,K,Z,U,ut,Kn,qa,ol,Is,sl,al,il,zu,Ts,ll,ju,A,T,cr,L,Me,be,Gr,pt,vt,Fn,fe,ve,E,S,bn,wn,vn,xn,Ee,Ie,Te,ge,Ae,ye,W,Qr,Gt,ke,s0,od,Wa,I0,k0,P0,at,Wm,Ym,gr,P_,N_,Cf,U_,Y_,Ti,Pf,Hb,$b,dd,Lw,Uw,Fw,hl,zv,Jv,cx,bl,Xx,uS,tp,MS,ag,wC,KC,yp,ME,hI,Dp,Lp,Je,Xe,et,tt,rt,nt,ot,st,pe,ue,me,de,H,ie,Pt,Mt,wo,vo,Vr,En,ua,gt,At,yt,V,xo,Ls,jd,Qt,Do,le}from"./chunk-7rhz2gze.js";import{Zo,Zs,Or,hs,Bs}from"./chunk-7kjgvxqa.js";import{Ul}from"./chunk-914bp49r.js";import{xa,tn,Us}from"./chunk-77fmkpdz.js";import{Sa,In,lu,cu,uu}from"./chunk-m9pr03kn.js";import{Rr}from"./chunk-0zv3bks2.js";import{z,v,Oe}from"./chunk-fnmwksnb.js";var So=v(function(AH,S4){var H0;if(typeof window<"u")H0=window;else if(typeof global<"u")H0=global;else if(typeof self<"u")H0=self;else H0={};S4.exports=H0});var yw=v(function(CH,x4){var _4=Array.prototype.slice;x4.exports=Pj;function Pj(e,n){if(!("length"in e))e=[e];e=_4.call(e);while(e.length){var i=e.shift(),s=n(i);if(s)return s;if(i.childNodes&&i.childNodes.length)e=_4.call(i.childNodes).concat(e)}}});var T4=v(function(jH,k4){k4.exports=_f;function _f(e,n){if(!(this instanceof _f))return new _f(e,n);this.data=e,this.nodeValue=e,this.length=e.length,this.ownerDocument=n||null}_f.prototype.nodeType=8;_f.prototype.nodeName="#comment";_f.prototype.toString=function(){return"[object Comment]"}});var C4=v(function(EH,A4){A4.exports=qc;function qc(e,n){if(!(this instanceof qc))return new qc(e);this.data=e||"",this.length=this.data.length,this.ownerDocument=n||null}qc.prototype.type="DOMTextNode";qc.prototype.nodeType=3;qc.prototype.nodeName="#text";qc.prototype.toString=function(){return this.data};qc.prototype.replaceData=function(n,i,s){var a=this.data,r=a.substring(0,n),l=a.substring(n+i,a.length);this.data=r+s+l,this.length=this.data.length}});var vw=v(function(qH,j4){j4.exports=Bj;function Bj(e){var n=this,i=e.type;if(!e.target)e.target=n;if(!n.listeners)n.listeners={};var s=n.listeners[i];if(s)return s.forEach(function(a){if(e.currentTarget=n,typeof a==="function")a(e);else a.handleEvent(e)});if(n.parentNode)n.parentNode.dispatchEvent(e)}});var Sw=v(function(DH,E4){E4.exports=Lj;function Lj(e,n){var i=this;if(!i.listeners)i.listeners={};if(!i.listeners[e])i.listeners[e]=[];if(i.listeners[e].indexOf(n)===-1)i.listeners[e].push(n)}});var _w=v(function(IH,q4){q4.exports=Hj;function Hj(e,n){var i=this;if(!i.listeners)return;if(!i.listeners[e])return;var s=i.listeners[e],a=s.indexOf(n);if(a!==-1)s.splice(a,1)}});var R4=v(function(MH,M4){M4.exports=D4;var Uj=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];function D4(e){switch(e.nodeType){case 3:return xw(e.data);case 8:return"<!--"+e.data+"-->";default:return zj(e)}}function zj(e){var n=[],i=e.tagName;if(e.namespaceURI==="http://www.w3.org/1999/xhtml")i=i.toLowerCase();if(n.push("<"+i+Wj(e)+Xj(e)),Uj.indexOf(i)>-1)n.push(" />");else{if(n.push(">"),e.childNodes.length)n.push.apply(n,e.childNodes.map(D4));else if(e.textContent||e.innerText)n.push(xw(e.textContent||e.innerText));else if(e.innerHTML)n.push(e.innerHTML);n.push("</"+i+">")}return n.join("")}function Gj(e,n){var i=typeof e[n];if(n==="style"&&Object.keys(e.style).length>0)return!0;return e.hasOwnProperty(n)&&(i==="string"||i==="boolean"||i==="number")&&n!=="nodeName"&&n!=="className"&&n!=="tagName"&&n!=="textContent"&&n!=="innerText"&&n!=="namespaceURI"&&n!=="innerHTML"}function Vj(e){if(typeof e==="string")return e;var n="";return Object.keys(e).forEach(function(i){var s=e[i];i=i.replace(/[A-Z]/g,function(a){return"-"+a.toLowerCase()}),n+=i+":"+s+";"}),n}function Xj(e){var n=e.dataset,i=[];for(var s in n)i.push({name:"data-"+s,value:n[s]});return i.length?I4(i):""}function I4(e){var n=[];return e.forEach(function(i){var{name:s,value:a}=i;if(s==="style")a=Vj(a);n.push(s+'="'+Kj(a)+'"')}),n.length?" "+n.join(" "):""}function Wj(e){var n=[];for(var i in e)if(Gj(e,i))n.push({name:i,value:e[i]});for(var s in e._attributes)for(var a in e._attributes[s]){var r=e._attributes[s][a],l=(r.prefix?r.prefix+":":"")+a;n.push({name:l,value:r.value})}if(e.className)n.push({name:"class",value:e.className});return n.length?I4(n):""}function xw(e){var n="";if(typeof e==="string")n=e;else if(e)n=e.toString();return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Kj(e){return xw(e).replace(/"/g,""")}});var Tw=v(function(RH,F4){var kw=yw(),$j=vw(),Yj=Sw(),Qj=_w(),Jj=R4(),O4="http://www.w3.org/1999/xhtml";F4.exports=yi;function yi(e,n,i){if(!(this instanceof yi))return new yi(e);var s=i===void 0?O4:i||null;if(this.tagName=s===O4?String(e).toUpperCase():e,this.nodeName=this.tagName,this.className="",this.dataset={},this.childNodes=[],this.parentNode=null,this.style={},this.ownerDocument=n||null,this.namespaceURI=s,this._attributes={},this.tagName==="INPUT")this.type="text"}yi.prototype.type="DOMElement";yi.prototype.nodeType=1;yi.prototype.appendChild=function(n){if(n.parentNode)n.parentNode.removeChild(n);return this.childNodes.push(n),n.parentNode=this,n};yi.prototype.replaceChild=function(n,i){if(n.parentNode)n.parentNode.removeChild(n);var s=this.childNodes.indexOf(i);return i.parentNode=null,this.childNodes[s]=n,n.parentNode=this,i};yi.prototype.removeChild=function(n){var i=this.childNodes.indexOf(n);return this.childNodes.splice(i,1),n.parentNode=null,n};yi.prototype.insertBefore=function(n,i){if(n.parentNode)n.parentNode.removeChild(n);var s=i===null||i===void 0?-1:this.childNodes.indexOf(i);if(s>-1)this.childNodes.splice(s,0,n);else this.childNodes.push(n);return n.parentNode=this,n};yi.prototype.setAttributeNS=function(n,i,s){var a=null,r=i,l=i.indexOf(":");if(l>-1)a=i.substr(0,l),r=i.substr(l+1);if(this.tagName==="INPUT"&&i==="type")this.type=s;else{var c=this._attributes[n]||(this._attributes[n]={});c[r]={value:s,prefix:a}}};yi.prototype.getAttributeNS=function(n,i){var s=this._attributes[n],a=s&&s[i]&&s[i].value;if(this.tagName==="INPUT"&&i==="type")return this.type;if(typeof a!=="string")return null;return a};yi.prototype.removeAttributeNS=function(n,i){if(!Object.prototype.hasOwnProperty.call(this._attributes,n))return;var s=this._attributes[n];if(s&&Object.prototype.hasOwnProperty.call(s,i))delete s[i]};yi.prototype.hasAttributeNS=function(n,i){var s=this._attributes[n];return!!s&&i in s};yi.prototype.setAttribute=function(n,i){return this.setAttributeNS(null,n,i)};yi.prototype.getAttribute=function(n){return this.getAttributeNS(null,n)};yi.prototype.removeAttribute=function(n){return this.removeAttributeNS(null,n)};yi.prototype.hasAttribute=function(n){return this.hasAttributeNS(null,n)};yi.prototype.removeEventListener=Qj;yi.prototype.addEventListener=Yj;yi.prototype.dispatchEvent=$j;yi.prototype.focus=function(){return};yi.prototype.toString=function(){return Jj(this)};yi.prototype.getElementsByClassName=function(n){var i=n.split(" "),s=[];return kw(this,function(a){if(a.nodeType===1){var r=a.className||"",l=r.split(" ");if(i.every(function(c){return l.indexOf(c)!==-1}))s.push(a)}}),s};yi.prototype.getElementsByTagName=function(n){n=n.toLowerCase();var i=[];return kw(this.childNodes,function(s){if(s.nodeType===1&&(n==="*"||s.tagName.toLowerCase()===n))i.push(s)}),i};yi.prototype.contains=function(n){return kw(this,function(i){return n===i})||!1}});var P4=v(function(OH,N4){var Aw=Tw();N4.exports=_o;function _o(e){if(!(this instanceof _o))return new _o;this.childNodes=[],this.parentNode=null,this.ownerDocument=e||null}_o.prototype.type="DocumentFragment";_o.prototype.nodeType=11;_o.prototype.nodeName="#document-fragment";_o.prototype.appendChild=Aw.prototype.appendChild;_o.prototype.replaceChild=Aw.prototype.replaceChild;_o.prototype.removeChild=Aw.prototype.removeChild;_o.prototype.toString=function(){return this.childNodes.map(function(n){return String(n)}).join("")}});var L4=v(function(FH,B4){B4.exports=Cw;function Cw(e){}Cw.prototype.initEvent=function(n,i,s){this.type=n,this.bubbles=i,this.cancelable=s};Cw.prototype.preventDefault=function(){}});var U4=v(function(NH,H4){var Zj=yw(),eE=T4(),tE=C4(),U0=Tw(),nE=P4(),iE=L4(),sE=vw(),aE=Sw(),rE=_w();H4.exports=Xg;function Xg(){if(!(this instanceof Xg))return new Xg;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}var Za=Xg.prototype;Za.createTextNode=function(n){return new tE(n,this)};Za.createElementNS=function(n,i){var s=n===null?null:String(n);return new U0(i,this,s)};Za.createElement=function(n){return new U0(n,this)};Za.createDocumentFragment=function(){return new nE(this)};Za.createEvent=function(n){return new iE(n)};Za.createComment=function(n){return new eE(n,this)};Za.getElementById=function(n){n=String(n);var i=Zj(this.childNodes,function(s){if(String(s.id)===n)return s});return i||null};Za.getElementsByClassName=U0.prototype.getElementsByClassName;Za.getElementsByTagName=U0.prototype.getElementsByTagName;Za.contains=U0.prototype.contains;Za.removeEventListener=rE;Za.addEventListener=aE;Za.dispatchEvent=sE});var G4=v(function(PH,z4){var oE=U4();z4.exports=new oE});var jw=v(function(BH,X4){var V4=typeof global<"u"?global:typeof window<"u"?window:{},lE=G4(),z0;if(typeof document<"u")z0=document;else if(z0=V4["__GLOBAL_DOCUMENT_CACHE@4"],!z0)z0=V4["__GLOBAL_DOCUMENT_CACHE@4"]=lE;X4.exports=z0});var W4=v(function(LH,kl){function Ew(){return kl.exports=Ew=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},kl.exports.__esModule=!0,kl.exports.default=kl.exports,Ew.apply(null,arguments)}kl.exports=Ew,kl.exports.__esModule=!0,kl.exports.default=kl.exports});var $4=v(function(HH,K4){K4.exports=uE;var cE=Object.prototype.toString;function uE(e){if(!e)return!1;var n=cE.call(e);return n==="[object Function]"||typeof e==="function"&&n!=="[object RegExp]"||typeof window<"u"&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)}});var J4=v(function(UH,Q4){function hE(e,n){var i=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=fE(e))||n&&e&&typeof e.length==="number"){if(i)e=i;var s=0;return function(){if(s>=e.length)return{done:!0};return{done:!1,value:e[s++]}}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fE(e,n){if(!e)return;if(typeof e==="string")return Y4(e,n);var i=Object.prototype.toString.call(e).slice(8,-1);if(i==="Object"&&e.constructor)i=e.constructor.name;if(i==="Map"||i==="Set")return Array.from(e);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Y4(e,n)}function Y4(e,n){if(n==null||n>e.length)n=e.length;for(var i=0,s=Array(n);i<n;i++)s[i]=e[i];return s}var dE=function(){function e(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var n=e.prototype;return n.getIsEnabled=function(){return this.enabled_},n.enable=function(){this.enabled_=!0},n.disable=function(){this.enabled_=!1},n.reset=function(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1},n.addInterceptor=function(s,a){if(!this.typeToInterceptorsMap_.has(s))this.typeToInterceptorsMap_.set(s,new Set);var r=this.typeToInterceptorsMap_.get(s);if(r.has(a))return!1;return r.add(a),!0},n.removeInterceptor=function(s,a){var r=this.typeToInterceptorsMap_.get(s);if(r&&r.has(a))return r.delete(a),!0;return!1},n.clearInterceptorsByType=function(s){var a=this.typeToInterceptorsMap_.get(s);if(!a)return!1;return this.typeToInterceptorsMap_.delete(s),this.typeToInterceptorsMap_.set(s,new Set),!0},n.clear=function(){if(!this.typeToInterceptorsMap_.size)return!1;return this.typeToInterceptorsMap_=new Map,!0},n.getForType=function(s){return this.typeToInterceptorsMap_.get(s)||new Set},n.execute=function(s,a){var r=this.getForType(s);for(var l=hE(r),c;!(c=l()).done;){var p=c.value;try{a=p(a)}catch(m){}}return a},e}();Q4.exports=dE});var e6=v(function(zH,Z4){var pE=function(){function e(){this.maxAttempts_=1,this.delayFactor_=0.1,this.fuzzFactor_=0.1,this.initialDelay_=1000,this.enabled_=!1}var n=e.prototype;return n.getIsEnabled=function(){return this.enabled_},n.enable=function(){this.enabled_=!0},n.disable=function(){this.enabled_=!1},n.reset=function(){this.maxAttempts_=1,this.delayFactor_=0.1,this.fuzzFactor_=0.1,this.initialDelay_=1000,this.enabled_=!1},n.getMaxAttempts=function(){return this.maxAttempts_},n.setMaxAttempts=function(s){this.maxAttempts_=s},n.getDelayFactor=function(){return this.delayFactor_},n.setDelayFactor=function(s){this.delayFactor_=s},n.getFuzzFactor=function(){return this.fuzzFactor_},n.setFuzzFactor=function(s){this.fuzzFactor_=s},n.getInitialDelay=function(){return this.initialDelay_},n.setInitialDelay=function(s){this.initialDelay_=s},n.createRetry=function(s){var a=s===void 0?{}:s,{maxAttempts:r,delayFactor:l,fuzzFactor:c,initialDelay:p}=a;return new mE({maxAttempts:r||this.maxAttempts_,delayFactor:l||this.delayFactor_,fuzzFactor:c||this.fuzzFactor_,initialDelay:p||this.initialDelay_})},e}(),mE=function(){function e(i){this.maxAttempts_=i.maxAttempts,this.delayFactor_=i.delayFactor,this.fuzzFactor_=i.fuzzFactor,this.currentDelay_=i.initialDelay,this.currentAttempt_=1}var n=e.prototype;return n.moveToNextAttempt=function(){this.currentAttempt_++;var s=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+s},n.shouldRetry=function(){return this.currentAttempt_<this.maxAttempts_},n.getCurrentDelay=function(){return this.currentDelay_},n.getCurrentMinPossibleDelay=function(){return(1-this.fuzzFactor_)*this.currentDelay_},n.getCurrentMaxPossibleDelay=function(){return(1+this.fuzzFactor_)*this.currentDelay_},n.getCurrentFuzzedDelay=function(){var s=this.getCurrentMinPossibleDelay(),a=this.getCurrentMaxPossibleDelay();return s+Math.random()*(a-s)},e}();Z4.exports=pE});var n6=v(function(GH,t6){var gE=So(),bE=function(n,i){if(i===void 0)i=!1;return function(s,a,r){if(s){n(s);return}if(a.statusCode>=400&&a.statusCode<=599){var l=r;if(i)if(gE.TextDecoder){var c=wE(a.headers&&a.headers["content-type"]);try{l=new TextDecoder(c).decode(r)}catch(p){}}else l=String.fromCharCode.apply(null,new Uint8Array(r));n({cause:l});return}n(null,r)}};function wE(e){if(e===void 0)e="";return e.toLowerCase().split(";").reduce(function(n,i){var s=i.split("="),a=s[0],r=s[1];if(a.trim()==="charset")return r.trim();return n},"utf-8")}t6.exports=bE});var r6=v(function(VH,Dw){var i6=So(),yE=W4(),vE=$4(),s6=J4(),SE=e6();Wi.httpHandler=n6();Wi.requestInterceptorsStorage=new s6;Wi.responseInterceptorsStorage=new s6;Wi.retryManager=new SE;var _E=function(n){var i={};if(!n)return i;return n.trim().split(`
|
|
3
|
+
`).forEach(function(s){var a=s.indexOf(":"),r=s.slice(0,a).trim().toLowerCase(),l=s.slice(a+1).trim();if(typeof i[r]>"u")i[r]=l;else if(Array.isArray(i[r]))i[r].push(l);else i[r]=[i[r],l]}),i};Dw.exports=Wi;Dw.exports.default=Wi;Wi.XMLHttpRequest=i6.XMLHttpRequest||AE;Wi.XDomainRequest="withCredentials"in new Wi.XMLHttpRequest?Wi.XMLHttpRequest:i6.XDomainRequest;xE(["get","put","post","patch","head","delete"],function(e){Wi[e==="delete"?"del":e]=function(n,i,s){return i=a6(n,i,s),i.method=e.toUpperCase(),qw(i)}});function xE(e,n){for(var i=0;i<e.length;i++)n(e[i])}function kE(e){for(var n in e)if(e.hasOwnProperty(n))return!1;return!0}function a6(e,n,i){var s=e;if(vE(n)){if(i=n,typeof e==="string")s={uri:e}}else s=yE({},n,{uri:e});return s.callback=i,s}function Wi(e,n,i){return n=a6(e,n,i),qw(n)}function qw(e){if(typeof e.callback>"u")throw Error("callback argument missing");if(e.requestType&&Wi.requestInterceptorsStorage.getIsEnabled()){var n={uri:e.uri||e.url,headers:e.headers||{},body:e.body,metadata:e.metadata||{},retry:e.retry,timeout:e.timeout},i=Wi.requestInterceptorsStorage.execute(e.requestType,n);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,a=function(se,oe,he){if(!s)s=!0,e.callback(se,oe,he)};function r(){if(m.readyState===4&&!Wi.responseInterceptorsStorage.getIsEnabled())setTimeout(p,0)}function l(){var ae=void 0;if(m.response)ae=m.response;else ae=m.responseText||TE(m);if(Y)try{ae=JSON.parse(ae)}catch(se){}return ae}function c(ae){if(clearTimeout(J),clearTimeout(e.retryTimeout),!(ae instanceof Error))ae=Error(""+(ae||"Unknown XMLHttpRequest Error"));if(ae.statusCode=0,!y&&Wi.retryManager.getIsEnabled()&&e.retry&&e.retry.shouldRetry()){e.retryTimeout=setTimeout(function(){e.retry.moveToNextAttempt(),e.xhr=m,qw(e)},e.retry.getCurrentFuzzedDelay());return}if(e.requestType&&Wi.responseInterceptorsStorage.getIsEnabled()){var se={headers:ne.headers||{},body:ne.body,responseUrl:m.responseURL,responseType:m.responseType},oe=Wi.responseInterceptorsStorage.execute(e.requestType,se);ne.body=oe.body,ne.headers=oe.headers}return a(ae,ne)}function p(){if(y)return;var ae;if(clearTimeout(J),clearTimeout(e.retryTimeout),e.useXDR&&m.status===void 0)ae=200;else ae=m.status===1223?204:m.status;var se=ne,oe=null;if(ae!==0){if(se={body:l(),statusCode:ae,method:j,headers:{},url:x,rawRequest:m},m.getAllResponseHeaders)se.headers=_E(m.getAllResponseHeaders())}else oe=Error("Internal XMLHttpRequest Error");if(e.requestType&&Wi.responseInterceptorsStorage.getIsEnabled()){var he={headers:se.headers||{},body:se.body,responseUrl:m.responseURL,responseType:m.responseType},we=Wi.responseInterceptorsStorage.execute(e.requestType,he);se.body=we.body,se.headers=we.headers}return a(oe,se,se.body)}var m=e.xhr||null;if(!m)if(e.cors||e.useXDR)m=new Wi.XDomainRequest;else m=new Wi.XMLHttpRequest;var g,y,x=m.url=e.uri||e.url,j=m.method=e.method||"GET",I=e.body||e.data,P=m.headers=e.headers||{},X=!!e.sync,Y=!1,J,ne={body:void 0,headers:{},statusCode:0,method:j,url:x,rawRequest:m};if("json"in e&&e.json!==!1){if(Y=!0,P.accept||P.Accept||(P.Accept="application/json"),j!=="GET"&&j!=="HEAD")P["content-type"]||P["Content-Type"]||(P["Content-Type"]="application/json"),I=JSON.stringify(e.json===!0?I:e.json)}if(m.onreadystatechange=r,m.onload=p,m.onerror=c,m.onprogress=function(){},m.onabort=function(){y=!0,clearTimeout(e.retryTimeout)},m.ontimeout=c,m.open(j,x,!X,e.username,e.password),!X)m.withCredentials=!!e.withCredentials;if(!X&&e.timeout>0)J=setTimeout(function(){if(y)return;y=!0,m.abort("timeout");var ae=Error("XMLHttpRequest timeout");ae.code="ETIMEDOUT",c(ae)},e.timeout);if(m.setRequestHeader){for(g in P)if(P.hasOwnProperty(g))m.setRequestHeader(g,P[g])}else if(e.headers&&!kE(e.headers))throw Error("Headers cannot be set on an XDomainRequest object");if("responseType"in e)m.responseType=e.responseType;if("beforeSend"in e&&typeof e.beforeSend==="function")e.beforeSend(m);return m.send(I||null),m}function TE(e){try{if(e.responseType==="document")return e.responseXML;var n=e.responseXML&&e.responseXML.documentElement.nodeName==="parsererror";if(e.responseType===""&&!n)return e.responseXML}catch(i){}return null}function AE(){}});var d6=v(function(XH,f6){var o6=jw(),Mw=Object.create||function(){function e(){}return function(n){if(arguments.length!==1)throw Error("Object.create shim only accepts one parameter.");return e.prototype=n,new e}}();function er(e,n){this.name="ParsingError",this.code=e.code,this.message=n||e.message}er.prototype=Mw(Error.prototype);er.prototype.constructor=er;er.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function Rw(e){function n(s,a,r,l){return(s|0)*3600+(a|0)*60+(r|0)+(l|0)/1000}var i=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);if(!i)return null;if(i[3])return n(i[1],i[2],i[3].replace(":",""),i[4]);else if(i[1]>59)return n(i[1],i[2],0,i[4]);else return n(0,i[1],i[2],i[4])}function V0(){this.values=Mw(null)}V0.prototype={set:function(e,n){if(!this.get(e)&&n!=="")this.values[e]=n},get:function(e,n,i){if(i)return this.has(e)?this.values[e]:n[i];return this.has(e)?this.values[e]:n},has:function(e){return e in this.values},alt:function(e,n,i){for(var s=0;s<i.length;++s)if(n===i[s]){this.set(e,n);break}},integer:function(e,n){if(/^-?\d+$/.test(n))this.set(e,parseInt(n,10))},percent:function(e,n){var i;if(i=n.match(/^([\d]{1,3})(\.[\d]*)?%$/)){if(n=parseFloat(n),n>=0&&n<=100)return this.set(e,n),!0}return!1}};function G0(e,n,i,s){var a=s?e.split(s):[e];for(var r in a){if(typeof a[r]!=="string")continue;var l=a[r].split(i);if(l.length!==2)continue;var c=l[0].trim(),p=l[1].trim();n(c,p)}}function CE(e,n,i){var s=e;function a(){var c=Rw(e);if(c===null)throw new er(er.Errors.BadTimeStamp,"Malformed timestamp: "+s);return e=e.replace(/^[^\sa-zA-Z-]+/,""),c}function r(c,p){var m=new V0;G0(c,function(g,y){switch(g){case"region":for(var x=i.length-1;x>=0;x--)if(i[x].id===y){m.set(g,i[x].region);break}break;case"vertical":m.alt(g,y,["rl","lr"]);break;case"line":var j=y.split(","),I=j[0];if(m.integer(g,I),m.percent(g,I)&&m.set("snapToLines",!1),m.alt(g,I,["auto"]),j.length===2)m.alt("lineAlign",j[1],["start","center","end"]);break;case"position":if(j=y.split(","),m.percent(g,j[0]),j.length===2)m.alt("positionAlign",j[1],["start","center","end"]);break;case"size":m.percent(g,y);break;case"align":m.alt(g,y,["start","center","end","left","right"]);break}},/:/,/\s/),p.region=m.get("region",null),p.vertical=m.get("vertical","");try{p.line=m.get("line","auto")}catch(g){}p.lineAlign=m.get("lineAlign","start"),p.snapToLines=m.get("snapToLines",!0),p.size=m.get("size",100);try{p.align=m.get("align","center")}catch(g){p.align=m.get("align","middle")}try{p.position=m.get("position","auto")}catch(g){p.position=m.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},p.align)}p.positionAlign=m.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},p.align)}function l(){e=e.replace(/^\s+/,"")}if(l(),n.startTime=a(),l(),e.substr(0,3)!=="-->")throw new er(er.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+s);e=e.substr(3),l(),n.endTime=a(),l(),r(e,n)}var Iw=o6.createElement&&o6.createElement("textarea"),jE={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},l6={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)"},EE={v:"title",lang:"lang"},c6={rt:"ruby"};function h6(e,n){function i(){if(!n)return null;function I(X){return n=n.substr(X.length),X}var P=n.match(/^([^<]*)(<[^>]*>?)?/);return I(P[1]?P[1]:P[2])}function s(I){return Iw.innerHTML=I,I=Iw.textContent,Iw.textContent="",I}function a(I,P){return!c6[P.localName]||c6[P.localName]===I.localName}function r(I,P){var X=jE[I];if(!X)return null;var Y=e.document.createElement(X),J=EE[I];if(J&&P)Y[J]=P.trim();return Y}var l=e.document.createElement("div"),c=l,p,m=[];while((p=i())!==null){if(p[0]==="<"){if(p[1]==="/"){if(m.length&&m[m.length-1]===p.substr(2).replace(">",""))m.pop(),c=c.parentNode;continue}var g=Rw(p.substr(1,p.length-2)),y;if(g){y=e.document.createProcessingInstruction("timestamp",g),c.appendChild(y);continue}var x=p.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!x)continue;if(y=r(x[1],x[3]),!y)continue;if(!a(c,y))continue;if(x[2]){var j=x[2].split(".");j.forEach(function(I){var P=/^bg_/.test(I),X=P?I.slice(3):I;if(l6.hasOwnProperty(X)){var Y=P?"background-color":"color",J=l6[X];y.style[Y]=J}}),y.className=j.join(" ")}m.push(x[1]),c.appendChild(y),c=y;continue}c.appendChild(e.document.createTextNode(s(p)))}return l}var u6=[[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 qE(e){for(var n=0;n<u6.length;n++){var i=u6[n];if(e>=i[0]&&e<=i[1])return!0}return!1}function DE(e){var n=[],i="",s;if(!e||!e.childNodes)return"ltr";function a(c,p){for(var m=p.childNodes.length-1;m>=0;m--)c.push(p.childNodes[m])}function r(c){if(!c||!c.length)return null;var p=c.pop(),m=p.textContent||p.innerText;if(m){var g=m.match(/^.*(\n|\r)/);if(g)return c.length=0,g[0];return m}if(p.tagName==="ruby")return r(c);if(p.childNodes)return a(c,p),r(c)}a(n,e);while(i=r(n))for(var l=0;l<i.length;l++)if(s=i.charCodeAt(l),qE(s))return"rtl";return"ltr"}function IE(e){if(typeof e.line==="number"&&(e.snapToLines||e.line>=0&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;var n=e.track,i=n.textTrackList,s=0;for(var a=0;a<i.length&&i[a]!==n;a++)if(i[a].mode==="showing")s++;return++s*-1}function Kg(){}Kg.prototype.applyStyles=function(e,n){n=n||this.div;for(var i in e)if(e.hasOwnProperty(i))n.style[i]=e[i]};Kg.prototype.formatStyle=function(e,n){return e===0?0:e+n};function Wg(e,n,i){Kg.call(this),this.cue=n,this.cueDiv=h6(e,n.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:n.vertical===""?"horizontal-tb":n.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(s,this.cueDiv),this.div=e.document.createElement("div"),s={direction:DE(this.cueDiv),writingMode:n.vertical===""?"horizontal-tb":n.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:n.align==="middle"?"center":n.align,font:i.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(s),this.div.appendChild(this.cueDiv);var a=0;switch(n.positionAlign){case"start":case"line-left":a=n.position;break;case"center":a=n.position-n.size/2;break;case"end":case"line-right":a=n.position-n.size;break}if(n.vertical==="")this.applyStyles({left:this.formatStyle(a,"%"),width:this.formatStyle(n.size,"%")});else this.applyStyles({top:this.formatStyle(a,"%"),height:this.formatStyle(n.size,"%")});this.move=function(r){this.applyStyles({top:this.formatStyle(r.top,"px"),bottom:this.formatStyle(r.bottom,"px"),left:this.formatStyle(r.left,"px"),right:this.formatStyle(r.right,"px"),height:this.formatStyle(r.height,"px"),width:this.formatStyle(r.width,"px")})}}Wg.prototype=Mw(Kg.prototype);Wg.prototype.constructor=Wg;function oa(e){var n,i,s,a;if(e.div){i=e.div.offsetHeight,s=e.div.offsetWidth,a=e.div.offsetTop;var r=(r=e.div.childNodes)&&(r=r[0])&&r.getClientRects&&r.getClientRects();e=e.div.getBoundingClientRect(),n=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||a,this.height=e.height||i,this.bottom=e.bottom||a+(e.height||i),this.width=e.width||s,this.lineHeight=n!==void 0?n:e.lineHeight}oa.prototype.move=function(e,n){switch(n=n!==void 0?n:this.lineHeight,e){case"+x":this.left+=n,this.right+=n;break;case"-x":this.left-=n,this.right-=n;break;case"+y":this.top+=n,this.bottom+=n;break;case"-y":this.top-=n,this.bottom-=n;break}};oa.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top};oa.prototype.overlapsAny=function(e){for(var n=0;n<e.length;n++)if(this.overlaps(e[n]))return!0;return!1};oa.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right};oa.prototype.overlapsOppositeAxis=function(e,n){switch(n){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}};oa.prototype.intersectPercentage=function(e){var n=Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left)),i=Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top)),s=n*i;return s/(this.height*this.width)};oa.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}};oa.getSimpleBoxPosition=function(e){var n=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;e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e;var a={left:e.left,right:e.right,top:e.top||s,height:e.height||n,bottom:e.bottom||s+(e.height||n),width:e.width||i};return a};function RE(e,n,i,s){function a(X,Y){var J,ne=new oa(X),ae=1;for(var se=0;se<Y.length;se++){while(X.overlapsOppositeAxis(i,Y[se])||X.within(i)&&X.overlapsAny(s))X.move(Y[se]);if(X.within(i))return X;var oe=X.intersectPercentage(i);if(ae>oe)J=new oa(X),ae=oe;X=new oa(ne)}return J||ne}var r=new oa(n),l=n.cue,c=IE(l),p=[];if(l.snapToLines){var m;switch(l.vertical){case"":p=["+y","-y"],m="height";break;case"rl":p=["+x","-x"],m="width";break;case"lr":p=["-x","+x"],m="width";break}var g=r.lineHeight,y=g*Math.round(c),x=i[m]+g,j=p[0];if(Math.abs(y)>x)y=y<0?-1:1,y*=Math.ceil(x/g)*g;if(c<0)y+=l.vertical===""?i.height:i.width,p=p.reverse();r.move(j,y)}else{var I=r.lineHeight/i.height*100;switch(l.lineAlign){case"center":c-=I/2;break;case"end":c-=I;break}switch(l.vertical){case"":n.applyStyles({top:n.formatStyle(c,"%")});break;case"rl":n.applyStyles({left:n.formatStyle(c,"%")});break;case"lr":n.applyStyles({right:n.formatStyle(c,"%")});break}p=["+y","-x","+x","-y"],r=new oa(n)}var P=a(r,p);n.move(P.toCSSCompatValues(i))}function xf(){}xf.StringDecoder=function(){return{decode:function(e){if(!e)return"";if(typeof e!=="string")throw Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}};xf.convertCueToDOMTree=function(e,n){if(!e||!n)return null;return h6(e,n)};var OE=0.05,FE="sans-serif",NE="1.5%";xf.processCues=function(e,n,i){if(!e||!n||!i)return null;while(i.firstChild)i.removeChild(i.firstChild);var s=e.document.createElement("div");s.style.position="absolute",s.style.left="0",s.style.right="0",s.style.top="0",s.style.bottom="0",s.style.margin=NE,i.appendChild(s);function a(g){for(var y=0;y<g.length;y++)if(g[y].hasBeenReset||!g[y].displayState)return!0;return!1}if(!a(n)){for(var r=0;r<n.length;r++)s.appendChild(n[r].displayState);return}var l=[],c=oa.getSimpleBoxPosition(s),p=Math.round(c.height*OE*100)/100,m={font:p+"px "+FE};(function(){var g,y;for(var x=0;x<n.length;x++)y=n[x],g=new Wg(e,y,m),s.appendChild(g.div),RE(e,g,c,l),y.displayState=g.div,l.push(oa.getSimpleBoxPosition(g))})()};xf.Parser=function(e,n,i){if(!i)i=n,n={};if(!n)n={};this.window=e,this.vttjs=n,this.state="INITIAL",this.buffer="",this.decoder=i||new TextDecoder("utf8"),this.regionList=[]};xf.Parser.prototype={reportOrThrowError:function(e){if(e instanceof er)this.onparsingerror&&this.onparsingerror(e);else throw e},parse:function(e){var n=this;if(e)n.buffer+=n.decoder.decode(e,{stream:!0});function i(){var g=n.buffer,y=0;while(y<g.length&&g[y]!=="\r"&&g[y]!==`
|
|
4
|
+
`)++y;var x=g.substr(0,y);if(g[y]==="\r")++y;if(g[y]===`
|
|
5
|
+
`)++y;return n.buffer=g.substr(y),x}function s(g){var y=new V0;if(G0(g,function(j,I){switch(j){case"id":y.set(j,I);break;case"width":y.percent(j,I);break;case"lines":y.integer(j,I);break;case"regionanchor":case"viewportanchor":var P=I.split(",");if(P.length!==2)break;var X=new V0;if(X.percent("x",P[0]),X.percent("y",P[1]),!X.has("x")||!X.has("y"))break;y.set(j+"X",X.get("x")),y.set(j+"Y",X.get("y"));break;case"scroll":y.alt(j,I,["up"]);break}},/=/,/\s/),y.has("id")){var x=new(n.vttjs.VTTRegion||n.window.VTTRegion);x.width=y.get("width",100),x.lines=y.get("lines",3),x.regionAnchorX=y.get("regionanchorX",0),x.regionAnchorY=y.get("regionanchorY",100),x.viewportAnchorX=y.get("viewportanchorX",0),x.viewportAnchorY=y.get("viewportanchorY",100),x.scroll=y.get("scroll",""),n.onregion&&n.onregion(x),n.regionList.push({id:y.get("id"),region:x})}}function a(g){var y=new V0;G0(g,function(x,j){switch(x){case"MPEGT":y.integer(x+"S",j);break;case"LOCA":y.set(x+"L",Rw(j));break}},/[^\d]:/,/,/),n.ontimestampmap&&n.ontimestampmap({MPEGTS:y.get("MPEGTS"),LOCAL:y.get("LOCAL")})}function r(g){if(g.match(/X-TIMESTAMP-MAP/))G0(g,function(y,x){switch(y){case"X-TIMESTAMP-MAP":a(x);break}},/=/);else G0(g,function(y,x){switch(y){case"Region":s(x);break}},/:/)}try{var l;if(n.state==="INITIAL"){if(!/\r\n|\n/.test(n.buffer))return this;l=i();var c=l.match(/^WEBVTT([ \t].*)?$/);if(!c||!c[0])throw new er(er.Errors.BadSignature);n.state="HEADER"}var p=!1;while(n.buffer){if(!/\r\n|\n/.test(n.buffer))return this;if(!p)l=i();else p=!1;switch(n.state){case"HEADER":if(/:/.test(l))r(l);else if(!l)n.state="ID";continue;case"NOTE":if(!l)n.state="ID";continue;case"ID":if(/^NOTE($|[ \t])/.test(l)){n.state="NOTE";break}if(!l)continue;n.cue=new(n.vttjs.VTTCue||n.window.VTTCue)(0,0,"");try{n.cue.align="center"}catch(g){n.cue.align="middle"}if(n.state="CUE",l.indexOf("-->")===-1){n.cue.id=l;continue}case"CUE":try{CE(l,n.cue,n.regionList)}catch(g){n.reportOrThrowError(g),n.cue=null,n.state="BADCUE";continue}n.state="CUETEXT";continue;case"CUETEXT":var m=l.indexOf("-->")!==-1;if(!l||m&&(p=!0)){n.oncue&&n.oncue(n.cue),n.cue=null,n.state="ID";continue}if(n.cue.text)n.cue.text+=`
|
|
6
|
+
`;n.cue.text+=l.replace(/\u2028/g,`
|
|
7
|
+
`).replace(/u2029/g,`
|
|
8
|
+
`);continue;case"BADCUE":if(!l)n.state="ID";continue}}}catch(g){if(n.reportOrThrowError(g),n.state==="CUETEXT"&&n.cue&&n.oncue)n.oncue(n.cue);n.cue=null,n.state=n.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var e=this;try{if(e.buffer+=e.decoder.decode(),e.cue||e.state==="HEADER")e.buffer+=`
|
|
9
|
+
|
|
10
|
+
`,e.parse();if(e.state==="INITIAL")throw new er(er.Errors.BadSignature)}catch(n){e.reportOrThrowError(n)}return e.onflush&&e.onflush(),this}};f6.exports=xf});var g6=v(function(WH,m6){var PE="auto",BE={"":1,lr:1,rl:1},LE={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function HE(e){if(typeof e!=="string")return!1;var n=BE[e.toLowerCase()];return n?e.toLowerCase():!1}function Ow(e){if(typeof e!=="string")return!1;var n=LE[e.toLowerCase()];return n?e.toLowerCase():!1}function p6(e,n,i){this.hasBeenReset=!1;var s="",a=!1,r=e,l=n,c=i,p=null,m="",g=!0,y="auto",x="start",j="auto",I="auto",P=100,X="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return s},set:function(Y){s=""+Y}},pauseOnExit:{enumerable:!0,get:function(){return a},set:function(Y){a=!!Y}},startTime:{enumerable:!0,get:function(){return r},set:function(Y){if(typeof Y!=="number")throw TypeError("Start time must be set to a number.");r=Y,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return l},set:function(Y){if(typeof Y!=="number")throw TypeError("End time must be set to a number.");l=Y,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return c},set:function(Y){c=""+Y,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return p},set:function(Y){p=Y,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return m},set:function(Y){var J=HE(Y);if(J===!1)throw SyntaxError("Vertical: an invalid or illegal direction string was specified.");m=J,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return g},set:function(Y){g=!!Y,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return y},set:function(Y){if(typeof Y!=="number"&&Y!==PE)throw SyntaxError("Line: an invalid number or illegal string was specified.");y=Y,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return x},set:function(Y){var J=Ow(Y);if(!J)console.warn("lineAlign: an invalid or illegal string was specified.");else x=J,this.hasBeenReset=!0}},position:{enumerable:!0,get:function(){return j},set:function(Y){if(Y<0||Y>100)throw Error("Position must be between 0 and 100.");j=Y,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return I},set:function(Y){var J=Ow(Y);if(!J)console.warn("positionAlign: an invalid or illegal string was specified.");else I=J,this.hasBeenReset=!0}},size:{enumerable:!0,get:function(){return P},set:function(Y){if(Y<0||Y>100)throw Error("Size must be between 0 and 100.");P=Y,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return X},set:function(Y){var J=Ow(Y);if(!J)throw SyntaxError("align: an invalid or illegal alignment string was specified.");X=J,this.hasBeenReset=!0}}}),this.displayState=void 0}p6.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};m6.exports=p6});var w6=v(function(KH,b6){var UE={"":!0,up:!0};function zE(e){if(typeof e!=="string")return!1;var n=UE[e.toLowerCase()];return n?e.toLowerCase():!1}function X0(e){return typeof e==="number"&&(e>=0&&e<=100)}function GE(){var e=100,n=3,i=0,s=100,a=0,r=100,l="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(c){if(!X0(c))throw Error("Width must be between 0 and 100.");e=c}},lines:{enumerable:!0,get:function(){return n},set:function(c){if(typeof c!=="number")throw TypeError("Lines must be set to a number.");n=c}},regionAnchorY:{enumerable:!0,get:function(){return s},set:function(c){if(!X0(c))throw Error("RegionAnchorX must be between 0 and 100.");s=c}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(c){if(!X0(c))throw Error("RegionAnchorY must be between 0 and 100.");i=c}},viewportAnchorY:{enumerable:!0,get:function(){return r},set:function(c){if(!X0(c))throw Error("ViewportAnchorY must be between 0 and 100.");r=c}},viewportAnchorX:{enumerable:!0,get:function(){return a},set:function(c){if(!X0(c))throw Error("ViewportAnchorX must be between 0 and 100.");a=c}},scroll:{enumerable:!0,get:function(){return l},set:function(c){var p=zE(c);if(p===!1)console.warn("Scroll: an invalid or illegal string was specified.");else l=p}}})}b6.exports=GE});var v6=v(function($H,y6){var Tl=So(),Qu=y6.exports={WebVTT:d6(),VTTCue:g6(),VTTRegion:w6()};Tl.vttjs=Qu;Tl.WebVTT=Qu.WebVTT;var{VTTCue:VE,VTTRegion:XE}=Qu,{VTTCue:WE,VTTRegion:KE}=Tl;Qu.shim=function(){Tl.VTTCue=VE,Tl.VTTRegion=XE};Qu.restore=function(){Tl.VTTCue=WE,Tl.VTTRegion=KE};if(!Tl.VTTCue)Qu.shim()});var jf=v(function(uq){function oq(e,n,i){if(i===void 0)i=Array.prototype;if(e&&typeof i.find==="function")return i.find.call(e,n);for(var s=0;s<e.length;s++)if(Object.prototype.hasOwnProperty.call(e,s)){var a=e[s];if(n.call(void 0,a,s,e))return a}}function Jw(e,n){if(n===void 0)n=Object;return n&&typeof n.freeze==="function"?n.freeze(e):e}function lq(e,n){if(e===null||typeof e!=="object")throw TypeError("target is not an object");for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i))e[i]=n[i];return e}var I6=Jw({HTML:"text/html",isHTML:function(e){return e===I6.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),M6=Jw({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===M6.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),Jg=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,Qw=new RegExp("[\\-\\.0-9"+Jg.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),cq=new RegExp("^"+Jg.source+Qw.source+"*(?::"+Jg.source+Qw.source+"*)?$");uq.assign=lq;uq.find=oq;uq.freeze=Jw;uq.MIME_TYPE=I6;uq.NAMESPACE=M6;uq.nameStartChar=Jg;uq.nameChar=Qw;uq.tagNamePattern=cq});var uy=v(function(Mq){var Zw=jf(),{find:ko,NAMESPACE:$0,tagNamePattern:Ef}=Zw;function yq(e){return e!==""}function vq(e){return e?e.split(/[\t\n\f\r ]+/).filter(yq):[]}function Sq(e,n){if(!e.hasOwnProperty(n))e[n]=!0;return e}function R6(e){if(!e)return[];var n=vq(e);return Object.keys(n.reduce(Sq,{}))}function _q(e){return function(n){return e&&e.indexOf(n)!==-1}}function Q0(e,n){for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i))n[i]=e[i]}function Ea(e,n){var i=e.prototype;if(!(i instanceof n)){let a=function(){};var s=a;a.prototype=n.prototype,a=new a,Q0(i,a),e.prototype=i=a}if(i.constructor!=e){if(typeof e!="function")console.error("unknown Class:"+e);i.constructor=e}}var Da={},xr=Da.ELEMENT_NODE=1,qf=Da.ATTRIBUTE_NODE=2,K0=Da.TEXT_NODE=3,U6=Da.CDATA_SECTION_NODE=4,z6=Da.ENTITY_REFERENCE_NODE=5,xq=Da.ENTITY_NODE=6,ey=Da.PROCESSING_INSTRUCTION_NODE=7,ty=Da.COMMENT_NODE=8,G6=Da.DOCUMENT_NODE=9,V6=Da.DOCUMENT_TYPE_NODE=10,Al=Da.DOCUMENT_FRAGMENT_NODE=11,kq=Da.NOTATION_NODE=12,Ys={},vs={},uU=Ys.INDEX_SIZE_ERR=(vs[1]="Index size error",1),hU=Ys.DOMSTRING_SIZE_ERR=(vs[2]="DOMString size error",2),ja=Ys.HIERARCHY_REQUEST_ERR=(vs[3]="Hierarchy request error",3),fU=Ys.WRONG_DOCUMENT_ERR=(vs[4]="Wrong document",4),O6=Ys.INVALID_CHARACTER_ERR=(vs[5]="Invalid character",5),dU=Ys.NO_DATA_ALLOWED_ERR=(vs[6]="No data allowed",6),pU=Ys.NO_MODIFICATION_ALLOWED_ERR=(vs[7]="No modification allowed",7),X6=Ys.NOT_FOUND_ERR=(vs[8]="Not found",8),mU=Ys.NOT_SUPPORTED_ERR=(vs[9]="Not supported",9),F6=Ys.INUSE_ATTRIBUTE_ERR=(vs[10]="Attribute in use",10),$r=Ys.INVALID_STATE_ERR=(vs[11]="Invalid state",11),gU=Ys.SYNTAX_ERR=(vs[12]="Syntax error",12),bU=Ys.INVALID_MODIFICATION_ERR=(vs[13]="Invalid modification",13),wU=Ys.NAMESPACE_ERR=(vs[14]="Invalid namespace",14),yU=Ys.INVALID_ACCESS_ERR=(vs[15]="Invalid access",15);function Ln(e,n){if(n instanceof Error)var i=n;else if(i=this,Error.call(this,vs[e]),this.message=vs[e],Error.captureStackTrace)Error.captureStackTrace(this,Ln);if(i.code=e,n)this.message=this.message+": "+n;return i}Ln.prototype=Error.prototype;Q0(Ys,Ln);function Cl(){}Cl.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e,n,i){var s=!!i&&!!i.requireWellFormed;for(var a=[],r=0;r<this.length;r++)cy(this[r],a,e,n,null,s);return a.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}};function Df(e,n){this._node=e,this._refresh=n,ny(this)}function ny(e){var n=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==n){var i=e._refresh(e._node);if(av(e,"length",i.length),!e.$$length||i.length<e.$$length){for(var s=i.length;s in e;s++)if(Object.prototype.hasOwnProperty.call(e,s))delete e[s]}Q0(i,e),e._inc=n}}Df.prototype.item=function(e){return ny(this),this[e]||null};Ea(Df,Cl);function e1(){this._nameIndex=Object.create(null)}function W6(e,n){var i=e.length;while(i--)if(e[i]===n)return i}function Tq(e,n){e._nameIndex[n.nodeName]=n}function K6(e,n){if(e._nameIndex[n.nodeName]===n)delete e._nameIndex[n.nodeName]}function N6(e,n,i,s){if(s)n[W6(n,s)]=i,K6(n,s);else n[n.length++]=i;if(Tq(n,i),e){i.ownerElement=e;var a=e.ownerDocument;if(a)s&&Q6(a,e,s),Aq(a,e,i)}}function P6(e,n,i){var s=W6(n,i);if(s>=0){var a=n.length-1;while(s<a)n[s]=n[++s];if(n.length=a,K6(n,i),e){var r=e.ownerDocument;if(r)Q6(r,e,i),i.ownerElement=null}}else throw new Ln(X6,Error(e.tagName+"@"+i))}e1.prototype={length:0,item:Cl.prototype.item,getNamedItem:function(e){var n=this.length;while(n--){var i=this[n];if(i.nodeName==e)return i}},setNamedItem:function(e){var n=e.ownerElement;if(n&&n!=this._ownerElement)throw new Ln(F6);var i=this._nameIndex[e.nodeName];return N6(this._ownerElement,this,e,i),i},setNamedItemNS:function(e){var n=e.ownerElement,i;if(n&&n!=this._ownerElement)throw new Ln(F6);return i=this.getNamedItemNS(e.namespaceURI,e.localName),N6(this._ownerElement,this,e,i),i},removeNamedItem:function(e){var n=this.getNamedItem(e);return P6(this._ownerElement,this,n),n},removeNamedItemNS:function(e,n){var i=this.getNamedItemNS(e,n);return P6(this._ownerElement,this,i),i},getNamedItemNS:function(e,n){var i=this.length;while(i--){var s=this[i];if(s.localName==n&&s.namespaceURI==e)return s}return null}};function $6(){}$6.prototype={hasFeature:function(e,n){return!0},createDocument:function(e,n,i){var s=new J0;if(s.implementation=this,s.childNodes=new Cl,s.doctype=i||null,i)s.appendChild(i);if(n){var a=s.createElementNS(e,n);s.appendChild(a)}return s},createDocumentType:function(e,n,i){var s=new a1;return s.name=e,s.nodeName=e,s.publicId=n||"",s.systemId=i||"",s}};function ii(){}ii.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,n){return n1(this,e,n)},replaceChild:function(e,n){if(n1(this,e,n,Z6),n)this.removeChild(n)},removeChild:function(e){return J6(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(e){return sv(this.ownerDocument||this,this,e)},normalize:function(){ys(this,null,{enter:function(e){var n=e.firstChild;while(n){var i=n.nextSibling;if(i!==null&&i.nodeType===K0&&n.nodeType===K0){var s=[],a=i;while(a!==null&&a.nodeType===K0)s.push(a.data),a=a.nextSibling;var r=n.nextSibling;while(r!==a){var l=r.nextSibling;r.parentNode=null,r.previousSibling=null,r.nextSibling=null,r=l}if(n.nextSibling=a,a!==null)a.previousSibling=n;else e.lastChild=n;n.appendData(s.join("")),s1(e.ownerDocument,e),n=a}else n=i}return!0}})},isSupported:function(e,n){return this.ownerDocument.implementation.hasFeature(e,n)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){var n=this;while(n){var i=n._nsMap;if(i){for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&i[s]===e)return s}n=n.nodeType==qf?n.ownerDocument:n.parentNode}return null},lookupNamespaceURI:function(e){var n=this;while(n){var i=n._nsMap;if(i){if(Object.prototype.hasOwnProperty.call(i,e))return i[e]}n=n.nodeType==qf?n.ownerDocument:n.parentNode}return null},isDefaultNamespace:function(e){var n=this.lookupPrefix(e);return n==null}};function Y6(e){return e=="<"&&"<"||e==">"&&">"||e=="&"&&"&"||e=='"'&&"""||"&#"+e.charCodeAt()+";"}Q0(Da,ii);Q0(Da,ii.prototype);function t1(e,n){return ys(e,null,{enter:function(i){return n(i)?ys.STOP:!0}})===ys.STOP}function ys(e,n,i){var s=[{node:e,context:n,phase:ys.ENTER}];while(s.length>0){var a=s.pop();if(a.phase===ys.ENTER){var r=i.enter(a.node,a.context);if(r===ys.STOP)return ys.STOP;if(s.push({node:a.node,context:r,phase:ys.EXIT}),r===null||r===void 0)continue;var l=a.node.lastChild;while(l)s.push({node:l,context:r,phase:ys.ENTER}),l=l.previousSibling}else if(i.exit)i.exit(a.node,a.context)}}ys.STOP=Symbol("walkDOM.STOP");ys.ENTER=0;ys.EXIT=1;function J0(){this.ownerDocument=this}function Aq(e,n,i){e&&e._inc++;var s=i.namespaceURI;if(s===$0.XMLNS)n._nsMap[i.prefix?i.localName:""]=i.value}function Q6(e,n,i,s){e&&e._inc++;var a=i.namespaceURI;if(a===$0.XMLNS)delete n._nsMap[i.prefix?i.localName:""]}function s1(e,n,i){if(e&&e._inc){e._inc++;var s=n.childNodes;if(i)s[s.length++]=i;else{var a=n.firstChild,r=0;while(a)s[r++]=a,a=a.nextSibling;s.length=r,delete s[s.length]}}}function J6(e,n){var{previousSibling:i,nextSibling:s}=n;if(i)i.nextSibling=s;else e.firstChild=s;if(s)s.previousSibling=i;else e.lastChild=i;return n.parentNode=null,n.previousSibling=null,n.nextSibling=null,s1(e.ownerDocument,e),n}function Cq(e){return e&&(e.nodeType===ii.DOCUMENT_NODE||e.nodeType===ii.DOCUMENT_FRAGMENT_NODE||e.nodeType===ii.ELEMENT_NODE)}function jq(e){return e&&(To(e)||iy(e)||jl(e)||e.nodeType===ii.DOCUMENT_FRAGMENT_NODE||e.nodeType===ii.COMMENT_NODE||e.nodeType===ii.PROCESSING_INSTRUCTION_NODE)}function jl(e){return e&&e.nodeType===ii.DOCUMENT_TYPE_NODE}function To(e){return e&&e.nodeType===ii.ELEMENT_NODE}function iy(e){return e&&e.nodeType===ii.TEXT_NODE}function B6(e,n){var i=e.childNodes||[];if(ko(i,To)||jl(n))return!1;var s=ko(i,jl);return!(n&&s&&i.indexOf(s)>i.indexOf(n))}function L6(e,n){var i=e.childNodes||[];function s(r){return To(r)&&r!==n}if(ko(i,s))return!1;var a=ko(i,jl);return!(n&&a&&i.indexOf(a)>i.indexOf(n))}function Eq(e,n,i){if(!Cq(e))throw new Ln(ja,"Unexpected parent node type "+e.nodeType);if(i&&i.parentNode!==e)throw new Ln(X6,"child not in parent");if(!jq(n)||jl(n)&&e.nodeType!==ii.DOCUMENT_NODE)throw new Ln(ja,"Unexpected node type "+n.nodeType+" for parent node type "+e.nodeType)}function qq(e,n,i){var s=e.childNodes||[],a=n.childNodes||[];if(n.nodeType===ii.DOCUMENT_FRAGMENT_NODE){var r=a.filter(To);if(r.length>1||ko(a,iy))throw new Ln(ja,"More than one element or text in fragment");if(r.length===1&&!B6(e,i))throw new Ln(ja,"Element in fragment can not be inserted before doctype")}if(To(n)){if(!B6(e,i))throw new Ln(ja,"Only one element can be added and only after doctype")}if(jl(n)){if(ko(s,jl))throw new Ln(ja,"Only one doctype is allowed");var l=ko(s,To);if(i&&s.indexOf(l)<s.indexOf(i))throw new Ln(ja,"Doctype can only be inserted before an element");if(!i&&l)throw new Ln(ja,"Doctype can not be appended since element is present")}}function Z6(e,n,i){var s=e.childNodes||[],a=n.childNodes||[];if(n.nodeType===ii.DOCUMENT_FRAGMENT_NODE){var r=a.filter(To);if(r.length>1||ko(a,iy))throw new Ln(ja,"More than one element or text in fragment");if(r.length===1&&!L6(e,i))throw new Ln(ja,"Element in fragment can not be inserted before doctype")}if(To(n)){if(!L6(e,i))throw new Ln(ja,"Only one element can be added and only after doctype")}if(jl(n)){let p=function(m){return jl(m)&&m!==i};var c=p;if(ko(s,p))throw new Ln(ja,"Only one doctype is allowed");var l=ko(s,To);if(i&&s.indexOf(l)<s.indexOf(i))throw new Ln(ja,"Doctype can only be inserted before an element")}}function n1(e,n,i,s){if(Eq(e,n,i),e.nodeType===ii.DOCUMENT_NODE)(s||qq)(e,n,i);var a=n.parentNode;if(a)a.removeChild(n);if(n.nodeType===Al){var r=n.firstChild;if(r==null)return n;var l=n.lastChild}else r=l=n;var c=i?i.previousSibling:e.lastChild;if(r.previousSibling=c,l.nextSibling=i,c)c.nextSibling=r;else e.firstChild=r;if(i==null)e.lastChild=l;else i.previousSibling=l;do{r.parentNode=e;var p=e.ownerDocument||e;Y0(r,p)}while(r!==l&&(r=r.nextSibling));if(s1(e.ownerDocument||e,e),n.nodeType==Al)n.firstChild=n.lastChild=null;return n}function Y0(e,n){if(e.ownerDocument===n)return;if(e.ownerDocument=n,e.nodeType===xr&&e.attributes)for(var i=0;i<e.attributes.length;i++){var s=e.attributes.item(i);if(s)s.ownerDocument=n}var a=e.firstChild;while(a)Y0(a,n),a=a.nextSibling}function Dq(e,n){if(n.parentNode)n.parentNode.removeChild(n);if(n.parentNode=e,n.previousSibling=e.lastChild,n.nextSibling=null,n.previousSibling)n.previousSibling.nextSibling=n;else e.firstChild=n;e.lastChild=n,s1(e.ownerDocument,e,n);var i=e.ownerDocument||e;return Y0(n,i),n}J0.prototype={nodeName:"#document",nodeType:G6,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,n){if(e.nodeType==Al){var i=e.firstChild;while(i){var s=i.nextSibling;this.insertBefore(i,n),i=s}return e}if(n1(this,e,n),Y0(e,this),this.documentElement===null&&e.nodeType===xr)this.documentElement=e;return e},removeChild:function(e){if(this.documentElement==e)this.documentElement=null;return J6(this,e)},replaceChild:function(e,n){if(n1(this,e,n,Z6),Y0(e,this),n)this.removeChild(n);if(To(e))this.documentElement=e},importNode:function(e,n){return Iq(this,e,n)},getElementById:function(e){var n=null;return t1(this.documentElement,function(i){if(i.nodeType==xr){if(i.getAttribute("id")==e)return n=i,!0}}),n},getElementsByClassName:function(e){var n=R6(e);return new Df(this,function(i){var s=[];if(n.length>0)t1(i.documentElement,function(a){if(a!==i&&a.nodeType===xr){var r=a.getAttribute("class");if(r){var l=e===r;if(!l){var c=R6(r);l=n.every(_q(c))}if(l)s.push(a)}}});return s})},createElement:function(e){var n=new th;n.ownerDocument=this,n.nodeName=e,n.tagName=e,n.localName=e,n.childNodes=new Cl;var i=n.attributes=new e1;return i._ownerElement=n,n},createDocumentFragment:function(){var e=new r1;return e.ownerDocument=this,e.childNodes=new Cl,e},createTextNode:function(e){var n=new sy;return n.ownerDocument=this,n.appendData(e),n},createComment:function(e){var n=new ay;return n.ownerDocument=this,n.appendData(e),n},createCDATASection:function(e){if(e.indexOf("]]>")!==-1)throw new Ln(O6,'data contains "]]>"');var n=new ry;return n.ownerDocument=this,n.appendData(e),n},createProcessingInstruction:function(e,n){var i=new ly;return i.ownerDocument=this,i.tagName=i.nodeName=i.target=e,i.nodeValue=i.data=n,i},createAttribute:function(e){var n=new i1;return n.ownerDocument=this,n.name=e,n.nodeName=e,n.localName=e,n.specified=!0,n},createEntityReference:function(e){if(!Ef.test(e))throw new Ln(O6,'not a valid xml name "'+e+'"');var n=new oy;return n.ownerDocument=this,n.nodeName=e,n},createElementNS:function(e,n){var i=new th,s=n.split(":"),a=i.attributes=new e1;if(i.childNodes=new Cl,i.ownerDocument=this,i.nodeName=n,i.tagName=n,i.namespaceURI=e,s.length==2)i.prefix=s[0],i.localName=s[1];else i.localName=n;return a._ownerElement=i,i},createAttributeNS:function(e,n){var i=new i1,s=n.split(":");if(i.ownerDocument=this,i.nodeName=n,i.name=n,i.namespaceURI=e,i.specified=!0,s.length==2)i.prefix=s[0],i.localName=s[1];else i.localName=n;return i}};Ea(J0,ii);function th(){this._nsMap={}}th.prototype={nodeType:xr,hasAttribute:function(e){return this.getAttributeNode(e)!=null},getAttribute:function(e){var n=this.getAttributeNode(e);return n&&n.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,n){var i=this.ownerDocument.createAttribute(e);i.value=i.nodeValue=""+n,this.setAttributeNode(i)},removeAttribute:function(e){var n=this.getAttributeNode(e);n&&this.removeAttributeNode(n)},appendChild:function(e){if(e.nodeType===Al)return this.insertBefore(e,null);else return Dq(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,n){var i=this.getAttributeNodeNS(e,n);i&&this.removeAttributeNode(i)},hasAttributeNS:function(e,n){return this.getAttributeNodeNS(e,n)!=null},getAttributeNS:function(e,n){var i=this.getAttributeNodeNS(e,n);return i&&i.value||""},setAttributeNS:function(e,n,i){var s=this.ownerDocument.createAttributeNS(e,n);s.value=s.nodeValue=""+i,this.setAttributeNode(s)},getAttributeNodeNS:function(e,n){return this.attributes.getNamedItemNS(e,n)},getElementsByTagName:function(e){return new Df(this,function(n){var i=[];return t1(n,function(s){if(s!==n&&s.nodeType==xr&&(e==="*"||s.tagName==e))i.push(s)}),i})},getElementsByTagNameNS:function(e,n){return new Df(this,function(i){var s=[];return t1(i,function(a){if(a!==i&&a.nodeType===xr&&(e==="*"||a.namespaceURI===e)&&(n==="*"||a.localName==n))s.push(a)}),s})}};J0.prototype.getElementsByTagName=th.prototype.getElementsByTagName;J0.prototype.getElementsByTagNameNS=th.prototype.getElementsByTagNameNS;Ea(th,ii);function i1(){}i1.prototype.nodeType=qf;Ea(i1,ii);function Z0(){}Z0.prototype={data:"",substringData:function(e,n){return this.data.substring(e,e+n)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,n){this.replaceData(e,0,n)},appendChild:function(e){throw Error(vs[ja])},deleteData:function(e,n){this.replaceData(e,n,"")},replaceData:function(e,n,i){var s=this.data.substring(0,e),a=this.data.substring(e+n);i=s+i+a,this.nodeValue=this.data=i,this.length=i.length}};Ea(Z0,ii);function sy(){}sy.prototype={nodeName:"#text",nodeType:K0,splitText:function(e){var n=this.data,i=n.substring(e);n=n.substring(0,e),this.data=this.nodeValue=n,this.length=n.length;var s=this.ownerDocument.createTextNode(i);if(this.parentNode)this.parentNode.insertBefore(s,this.nextSibling);return s}};Ea(sy,Z0);function ay(){}ay.prototype={nodeName:"#comment",nodeType:ty};Ea(ay,Z0);function ry(){}ry.prototype={nodeName:"#cdata-section",nodeType:U6};Ea(ry,Z0);function a1(){}a1.prototype.nodeType=V6;Ea(a1,ii);function ev(){}ev.prototype.nodeType=kq;Ea(ev,ii);function tv(){}tv.prototype.nodeType=xq;Ea(tv,ii);function oy(){}oy.prototype.nodeType=z6;Ea(oy,ii);function r1(){}r1.prototype.nodeName="#document-fragment";r1.prototype.nodeType=Al;Ea(r1,ii);function ly(){}ly.prototype.nodeType=ey;Ea(ly,ii);function nv(){}nv.prototype.serializeToString=function(e,n,i,s){return iv.call(e,n,i,s)};ii.prototype.toString=iv;function iv(e,n,i){var s=!!i&&!!i.requireWellFormed,a=[],r=this.nodeType==9&&this.documentElement||this,{prefix:l,namespaceURI:c}=r;if(c&&l==null){var l=r.lookupPrefix(c);if(l==null)var p=[{namespace:c,prefix:null}]}return cy(this,a,e,n,p,s),a.join("")}function H6(e,n,i){var s=e.prefix||"",a=e.namespaceURI;if(!a)return!1;if(s==="xml"&&a===$0.XML||a===$0.XMLNS)return!1;var r=i.length;while(r--){var l=i[r];if(l.prefix===s)return l.namespace!==a}return!0}function Zg(e,n,i,s){if(s&&!Ef.test(n))throw new Ln($r,'The attribute name "'+n+'" is not a valid XML QName');e.push(" ",n,'="',i.replace(/[<>&"\t\n\r]/g,Y6),'"')}function cy(e,n,i,s,a,r){if(!a)a=[];ys(e,{ns:a,isHTML:i},{enter:function(l,c){var{ns:p,isHTML:m}=c;if(s)if(l=s(l),l){if(typeof l=="string")return n.push(l),null}else return null;switch(l.nodeType){case xr:var g=l.attributes,y=g.length,x=l.tagName;m=$0.isHTML(l.namespaceURI)||m;var j=x;if(!m&&!l.prefix&&l.namespaceURI){var I;for(var P=0;P<g.length;P++)if(g.item(P).name==="xmlns"){I=g.item(P).value;break}if(!I)for(var X=p.length-1;X>=0;X--){var Y=p[X];if(Y.prefix===""&&Y.namespace===l.namespaceURI){I=Y.namespace;break}}if(I!==l.namespaceURI)for(var X=p.length-1;X>=0;X--){var Y=p[X];if(Y.namespace===l.namespaceURI){if(Y.prefix)j=Y.prefix+":"+x;break}}}if(r&&!Ef.test(j))throw new Ln($r,'The element name "'+j+'" is not a valid XML QName');n.push("<",j);var J=p.slice();for(var ne=0;ne<y;ne++){var ae=g.item(ne);if(ae.prefix=="xmlns")J.push({prefix:ae.localName,namespace:ae.value});else if(ae.nodeName=="xmlns")J.push({prefix:"",namespace:ae.value})}for(var ne=0;ne<y;ne++){var ae=g.item(ne);if(H6(ae,m,J)){var se=ae.prefix||"",oe=ae.namespaceURI;Zg(n,se?"xmlns:"+se:"xmlns",oe,r),J.push({prefix:se,namespace:oe})}var he=s?s(ae):ae;if(he)if(typeof he==="string")n.push(he);else Zg(n,he.name,he.value,r)}if(x===j&&H6(l,m,J)){var we=l.prefix||"",oe=l.namespaceURI;Zg(n,we?"xmlns:"+we:"xmlns",oe,r),J.push({prefix:we,namespace:oe})}var Ce=l.firstChild;if(Ce||m&&!/^(?:meta|link|img|br|hr|input)$/i.test(x)){if(n.push(">"),m&&/^script$/i.test(x)){while(Ce){if(Ce.data)n.push(Ce.data);else cy(Ce,n,m,s,J.slice(),r);Ce=Ce.nextSibling}return n.push("</",x,">"),null}return{ns:J,isHTML:m,tag:j}}else return n.push("/>"),null;case G6:case Al:return{ns:p.slice(),isHTML:m,tag:null};case qf:return Zg(n,l.name,l.value,r),null;case K0:return n.push(l.data.replace(/[<&>]/g,Y6)),null;case U6:if(r&&l.data.indexOf("]]>")!==-1)throw new Ln($r,'The CDATASection data contains "]]>"');return n.push("<![CDATA[",l.data.replace(/]]>/g,"]]]]><![CDATA[>"),"]]>"),null;case ty:if(r&&l.data.indexOf("-->")!==-1)throw new Ln($r,'The comment node data contains "-->"');return n.push("<!--",l.data,"-->"),null;case V6:if(r){if(!Ef.test(l.name))throw new Ln($r,'The doctype name "'+l.name+'" is not a valid XML Name');if(l.publicId&&!/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(l.publicId))throw new Ln($r,"DocumentType publicId is not a valid PubidLiteral");if(l.systemId&&!/^("[^"]*"|'[^']*')$/.test(l.systemId))throw new Ln($r,"DocumentType systemId is not a valid SystemLiteral");if(l.internalSubset&&l.internalSubset.indexOf("]>")!==-1)throw new Ln($r,'DocumentType internalSubset contains "]>"')}var Ne=l.publicId,Pe=l.systemId;if(n.push("<!DOCTYPE ",l.name),Ne){if(n.push(" PUBLIC ",Ne),Pe&&Pe!=".")n.push(" ",Pe);n.push(">")}else if(Pe&&Pe!=".")n.push(" SYSTEM ",Pe,">");else{var Ue=l.internalSubset;if(Ue)n.push(" [",Ue,"]");n.push(">")}return null;case ey:if(r){if(!Ef.test(l.target)||l.target.indexOf(":")!==-1||l.target.toLowerCase()==="xml")throw new Ln($r,'The processing instruction target "'+l.target+'" is not a valid XML NCName or is reserved');if(l.data.indexOf("?>")!==-1)throw new Ln($r,'The ProcessingInstruction data contains "?>"')}return n.push("<?",l.target," ",l.data,"?>"),null;case z6:if(r&&!Ef.test(l.nodeName))throw new Ln($r,'The entity reference name "'+l.nodeName+'" is not a valid XML Name');return n.push("&",l.nodeName,";"),null;default:return n.push("??",l.nodeName),null}},exit:function(l,c){if(c&&c.tag)n.push("</",c.tag,">")}})}function Iq(e,n,i){var s;return ys(n,null,{enter:function(a,r){var l=a.cloneNode(!1);if(l.ownerDocument=e,l.parentNode=null,r===null)s=l;else r.appendChild(l);var c=a.nodeType===qf||i;return c?l:null}}),s}function sv(e,n,i){var s;return ys(n,null,{enter:function(a,r){var l=new a.constructor;for(var c in a)if(Object.prototype.hasOwnProperty.call(a,c)){var p=a[c];if(typeof p!="object"){if(p!=l[c])l[c]=p}}if(a.childNodes)l.childNodes=new Cl;l.ownerDocument=e;var m=i;switch(l.nodeType){case xr:var g=a.attributes,y=l.attributes=new e1,x=g.length;y._ownerElement=l;for(var j=0;j<x;j++)l.setAttributeNode(sv(e,g.item(j),!0));break;case qf:m=!0}if(r!==null)r.appendChild(l);else s=l;return m?l:null}}),s}function av(e,n,i){e[n]=i}try{if(Object.defineProperty)Object.defineProperty(Df.prototype,"length",{get:function(){return ny(this),this.$$length}}),Object.defineProperty(ii.prototype,"textContent",{get:function(){if(this.nodeType===xr||this.nodeType===Al){var e=[];return ys(this,null,{enter:function(n){if(n.nodeType===xr||n.nodeType===Al)return!0;if(n.nodeType===ey||n.nodeType===ty)return null;e.push(n.nodeValue)}}),e.join("")}return this.nodeValue},set:function(e){switch(this.nodeType){case xr:case Al:while(this.firstChild)this.removeChild(this.firstChild);if(e||String(e))this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),av=function(e,n,i){e["$$"+n]=i}}catch(e){}Mq.DocumentType=a1;Mq.DOMException=Ln;Mq.DOMImplementation=$6;Mq.Element=th;Mq.Node=ii;Mq.NodeList=Cl;Mq.walkDOM=ys;Mq.XMLSerializer=nv});var lv=v(function(Uq){var rv=jf().freeze;Uq.XML_ENTITIES=rv({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});Uq.HTML_ENTITIES=rv({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"\uD835\uDD04",afr:"\uD835\uDD1E",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"\uD835\uDD38",aopf:"\uD835\uDD52",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"\uD835\uDC9C",ascr:"\uD835\uDCB6",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"\uD835\uDD05",bfr:"\uD835\uDD1F",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"\uD835\uDD39",bopf:"\uD835\uDD53",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"\uD835\uDCB7",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"\uD835\uDD20",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"\uD835\uDD54",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"\uD835\uDC9E",cscr:"\uD835\uDCB8",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"\uD835\uDD07",dfr:"\uD835\uDD21",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"\uD835\uDD3B",dopf:"\uD835\uDD55",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"\uD835\uDC9F",dscr:"\uD835\uDCB9",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"\uD835\uDD08",efr:"\uD835\uDD22",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"\uD835\uDD3C",eopf:"\uD835\uDD56",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"\uD835\uDD09",ffr:"\uD835\uDD23",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"\uD835\uDD3D",fopf:"\uD835\uDD57",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"\uD835\uDCBB",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"\uD835\uDD0A",gfr:"\uD835\uDD24",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"\uD835\uDD3E",gopf:"\uD835\uDD58",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"\uD835\uDCA2",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"\uD835\uDD25",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"\uD835\uDD59",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"\uD835\uDCBD",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"\uD835\uDD26",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"\uD835\uDD40",iopf:"\uD835\uDD5A",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"\uD835\uDCBE",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"\uD835\uDD0D",jfr:"\uD835\uDD27",jmath:"ȷ",Jopf:"\uD835\uDD41",jopf:"\uD835\uDD5B",Jscr:"\uD835\uDCA5",jscr:"\uD835\uDCBF",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"\uD835\uDD0E",kfr:"\uD835\uDD28",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"\uD835\uDD42",kopf:"\uD835\uDD5C",Kscr:"\uD835\uDCA6",kscr:"\uD835\uDCC0",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"\uD835\uDD0F",lfr:"\uD835\uDD29",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"\uD835\uDD43",lopf:"\uD835\uDD5D",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"\uD835\uDCC1",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"\uD835\uDD10",mfr:"\uD835\uDD2A",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"\uD835\uDD44",mopf:"\uD835\uDD5E",mp:"∓",Mscr:"ℳ",mscr:"\uD835\uDCC2",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
|
|
11
|
+
`,nexist:"∄",nexists:"∄",Nfr:"\uD835\uDD11",nfr:"\uD835\uDD2B",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"\uD835\uDD5F",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"\uD835\uDCA9",nscr:"\uD835\uDCC3",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"\uD835\uDD12",ofr:"\uD835\uDD2C",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"\uD835\uDD46",oopf:"\uD835\uDD60",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"\uD835\uDCAA",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"\uD835\uDD13",pfr:"\uD835\uDD2D",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"\uD835\uDD61",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"\uD835\uDCAB",pscr:"\uD835\uDCC5",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"\uD835\uDD14",qfr:"\uD835\uDD2E",qint:"⨌",Qopf:"ℚ",qopf:"\uD835\uDD62",qprime:"⁗",Qscr:"\uD835\uDCAC",qscr:"\uD835\uDCC6",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"\uD835\uDD2F",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"\uD835\uDD63",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"\uD835\uDCC7",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"\uD835\uDD16",sfr:"\uD835\uDD30",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"\uD835\uDD4A",sopf:"\uD835\uDD64",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"\uD835\uDCAE",sscr:"\uD835\uDCC8",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"\uD835\uDD17",tfr:"\uD835\uDD31",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"\uD835\uDD4B",topf:"\uD835\uDD65",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"\uD835\uDCAF",tscr:"\uD835\uDCC9",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"\uD835\uDD18",ufr:"\uD835\uDD32",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"\uD835\uDD4C",uopf:"\uD835\uDD66",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"\uD835\uDCB0",uscr:"\uD835\uDCCA",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"\uD835\uDD19",vfr:"\uD835\uDD33",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"\uD835\uDD4D",vopf:"\uD835\uDD67",vprop:"∝",vrtri:"⊳",Vscr:"\uD835\uDCB1",vscr:"\uD835\uDCCB",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"\uD835\uDD1A",wfr:"\uD835\uDD34",Wopf:"\uD835\uDD4E",wopf:"\uD835\uDD68",wp:"℘",wr:"≀",wreath:"≀",Wscr:"\uD835\uDCB2",wscr:"\uD835\uDCCC",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"\uD835\uDD1B",xfr:"\uD835\uDD35",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"\uD835\uDD4F",xopf:"\uD835\uDD69",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"\uD835\uDCB3",xscr:"\uD835\uDCCD",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"\uD835\uDD1C",yfr:"\uD835\uDD36",YIcy:"Ї",yicy:"ї",Yopf:"\uD835\uDD50",yopf:"\uD835\uDD6A",Yscr:"\uD835\uDCB4",yscr:"\uD835\uDCCE",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"\uD835\uDD37",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"\uD835\uDD6B",Zscr:"\uD835\uDCB5",zscr:"\uD835\uDCCF",zwj:"",zwnj:""});Uq.entityMap=Uq.HTML_ENTITIES});var dv=v(function(Zq){var ip=jf().NAMESPACE,hy=jf().tagNamePattern,If=0,Ic=1,Mf=2,ep=3,Rf=4,Of=5,np=6,o1=7;function Ff(e,n){if(this.message=e,this.locator=n,Error.captureStackTrace)Error.captureStackTrace(this,Ff)}Ff.prototype=Error();Ff.prototype.name=Ff.name;function hv(){}hv.prototype={parse:function(e,n,i){var s=this.domBuilder;s.startDocument(),$q(n,n={}),Vq(e,n,i,s,this.errorHandler),s.endDocument()}};function Vq(e,n,i,s,a){function r(Fe){if(Fe>65535){Fe-=65536;var bt=55296+(Fe>>10),Ve=56320+(Fe&1023);return String.fromCharCode(bt,Ve)}else return String.fromCharCode(Fe)}function l(Fe){var bt=Fe.slice(1,-1);if(Object.hasOwnProperty.call(i,bt))return i[bt];else if(bt.charAt(0)==="#")return r(parseInt(bt.substr(1).replace("x","0x")));else return a.error("entity not found:"+Fe),Fe}function c(Fe){if(Fe>P){var bt=e.substring(P,Fe).replace(/&#?\w+;/g,l);x&&p(P),s.characters(bt,0,Fe-P),P=Fe}}function p(Fe,bt){while(Fe>=g&&(bt=y.exec(e)))m=bt.index,g=m+bt[0].length,x.lineNumber++;x.columnNumber=Fe-m+1}var m=0,g=0,y=/.*(?:\r\n?|\n)|.*$/g,x=s.locator,j=[{currentNSMap:n}],I={},P=0;while(!0){try{var X=e.indexOf("<",P);if(X<0){if(!e.substr(P).match(/^\s*$/)){var Y=s.doc,J=Y.createTextNode(e.substr(P));Y.appendChild(J),s.currentElement=J}return}if(X>P)c(X);switch(e.charAt(X+1)){case"/":var Pe=e.indexOf(">",X+3),ne=e.substring(X+2,Pe).replace(/^([\s\S]*?[^ \t\n\r])?[ \t\n\r]*$/,"$1"),ae=j.pop();if(Pe<0)ne=e.substring(X+2).replace(/[\s<].*/,""),a.error("end tag name: "+ne+" is not complete:"+ae.tagName),Pe=X+1+ne.length;else if(ne.match(/\s</))ne=ne.replace(/[\s<].*/,""),a.error("end tag name: "+ne+" maybe not complete"),Pe=X+1+ne.length;else if(/[ \t\n\r]/.test(ne)&&hy.test(ne.split(/[ \t\n\r]/)[0]))a.error('end tag name is followed by whitespace and trailing content: "'+ne+'"');var se=ae.localNSMap,oe=ae.tagName==ne,he=oe||ae.tagName&&ae.tagName.toLowerCase()==ne.toLowerCase();if(he){if(s.endElement(ae.uri,ae.localName,ne),se){for(var we in se)if(Object.prototype.hasOwnProperty.call(se,we))s.endPrefixMapping(we)}if(!oe)a.fatalError("end tag name: "+ne+" is not match the current start tagName:"+ae.tagName)}else j.push(ae);Pe++;break;case"?":x&&p(X),Pe=Qq(e,X,s);break;case"!":x&&p(X),Pe=Yq(e,X,s,a);break;default:x&&p(X);var Ce=new fv,Ne=j[j.length-1].currentNSMap,Pe=Xq(e,X,Ce,Ne,l,a),Ue=Ce.length;if(!Ce.closed&&Kq(e,Pe,Ce.tagName,I)){if(Ce.closed=!0,!i.nbsp)a.warning("unclosed xml attribute")}if(x&&Ue){var ze=cv(x,{});for(var He=0;He<Ue;He++){var De=Ce[He];p(De.offset),De.locator=cv(x,{})}if(s.locator=ze,uv(Ce,s,Ne))j.push(Ce);s.locator=x}else if(uv(Ce,s,Ne))j.push(Ce);if(ip.isHTML(Ce.uri)&&!Ce.closed)Pe=Wq(e,Pe,Ce.tagName,l,s);else Pe++}}catch(Fe){if(Fe instanceof Ff)throw Fe;a.error("element parse error: "+Fe),Pe=-1}if(Pe>P)P=Pe;else c(Math.max(X,P)+1)}}function cv(e,n){return n.lineNumber=e.lineNumber,n.columnNumber=e.columnNumber,n}function Xq(e,n,i,s,a,r){function l(j,I,P){if(i.attributeNames.hasOwnProperty(j))r.fatalError("Attribute "+j+" redefined");i.addValue(j,I.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,a),P)}var c,p,m=++n,g=If;while(!0){var y=e.charAt(m);if(g===If&&y==="<")throw Error("unexpected < in tag name: "+e.slice(n,m));switch(y){case"=":if(g===Ic)c=e.slice(n,m),g=ep;else if(g===Mf)g=ep;else throw Error("attribute equal must after attrName");break;case"'":case'"':if(g===ep||g===Ic){if(g===Ic)r.warning('attribute value must after "="'),c=e.slice(n,m);if(n=m+1,m=e.indexOf(y,n),m>0)p=e.slice(n,m),l(c,p,n-1),g=Of;else throw Error("attribute value no end '"+y+"' match")}else if(g==Rf)p=e.slice(n,m),l(c,p,n),r.warning('attribute "'+c+'" missed start quot('+y+")!!"),n=m+1,g=Of;else throw Error('attribute value must after "="');break;case"/":switch(g){case If:i.setTagName(e.slice(n,m));case Of:case np:case o1:g=o1,i.closed=!0;case Rf:case Ic:break;case Mf:i.closed=!0;break;default:throw Error("attribute invalid close char('/')")}break;case"":if(r.error("unexpected end of input"),g==If)i.setTagName(e.slice(n,m));return m;case">":switch(g){case If:i.setTagName(e.slice(n,m));case Of:case np:case o1:break;case Rf:case Ic:if(p=e.slice(n,m),p.slice(-1)==="/")i.closed=!0,p=p.slice(0,-1);case Mf:if(g===Mf)p=c;if(g==Rf)r.warning('attribute "'+p+'" missed quot(")!'),l(c,p,n);else{if(!ip.isHTML(s[""])||!p.match(/^(?:disabled|checked|selected)$/i))r.warning('attribute "'+p+'" missed value!! "'+p+'" instead!!');l(p,p,n)}break;case ep:throw Error("attribute value missed!!")}return m;case"":y=" ";default:if(y<=" ")switch(g){case If:i.setTagName(e.slice(n,m)),g=np;break;case Ic:c=e.slice(n,m),g=Mf;break;case Rf:var p=e.slice(n,m);r.warning('attribute "'+p+'" missed quot(")!!'),l(c,p,n);case Of:g=np;break}else switch(g){case Mf:var x=i.tagName;if(!ip.isHTML(s[""])||!c.match(/^(?:disabled|checked|selected)$/i))r.warning('attribute "'+c+'" missed value!! "'+c+'" instead2!!');l(c,c,n),n=m,g=Ic;break;case Of:r.warning('attribute space is required"'+c+'"!!');case np:g=Ic,n=m;break;case ep:g=Rf,n=m;break;case o1:throw Error("elements closed character '/' and '>' must be connected to")}}m++}}function uv(e,n,i){var s=e.tagName,a=null,y=e.length;while(y--){var r=e[y],l=r.qName,c=r.value,x=l.indexOf(":");if(x>0)var p=r.prefix=l.slice(0,x),m=l.slice(x+1),g=p==="xmlns"&&m;else m=l,p=null,g=l==="xmlns"&&"";if(r.localName=m,g!==!1){if(a==null)a={},i=Object.create(i);i[g]=a[g]=c,r.uri=ip.XMLNS,n.startPrefixMapping(g,c)}}var y=e.length;while(y--){r=e[y];var p=r.prefix;if(p){if(p==="xml")r.uri=ip.XML;if(p!=="xmlns")r.uri=i[p||""]}}var x=s.indexOf(":");if(x>0)p=e.prefix=s.slice(0,x),m=e.localName=s.slice(x+1);else p=null,m=e.localName=s;var j=e.uri=i[p||""];if(n.startElement(j,m,s,e),e.closed){if(n.endElement(j,m,s),a){for(p in a)if(Object.prototype.hasOwnProperty.call(a,p))n.endPrefixMapping(p)}}else return e.currentNSMap=i,e.localNSMap=a,!0}function Wq(e,n,i,s,a){if(/^(?:script|textarea)$/i.test(i)){var r=e.indexOf("</"+i+">",n),l=e.substring(n+1,r);if(/[&<]/.test(l)){if(/^script$/i.test(i))return a.characters(l,0,l.length),r;return l=l.replace(/&#?\w+;/g,s),a.characters(l,0,l.length),r}}return n+1}function Kq(e,n,i,s){var a=s[i];if(a==null){if(a=e.lastIndexOf("</"+i+">"),a<n)a=e.lastIndexOf("</"+i);s[i]=a}return a<n}function $q(e,n){for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i))n[i]=e[i]}function Yq(e,n,i,s){var a=e.charAt(n+2);switch(a){case"-":if(e.charAt(n+3)==="-"){var r=e.indexOf("-->",n+4);if(r>n)return i.comment(e,n+4,r-n-4),r+3;else return s.error("Unclosed comment"),-1}else return-1;default:if(e.substr(n+3,6)=="CDATA["){var r=e.indexOf("]]>",n+9);return i.startCDATA(),i.characters(e,n+9,r-n-9),i.endCDATA(),r+3}var l=Jq(e,n),c=l.length;if(c>1&&/!doctype/i.test(l[0][0])){var p=l[1][0],m=!1,g=!1;if(c>3){if(/^public$/i.test(l[2][0]))m=l[3][0],g=c>4&&l[4][0];else if(/^system$/i.test(l[2][0]))g=l[3][0]}var y=l[c-1];return i.startDTD(p,m,g),i.endDTD(),y.index+y[0].length}}return-1}function Qq(e,n,i){var s=e.indexOf("?>",n);if(s){var a=e.substring(n,s).match(/^<\?(\S*)\s*([\s\S]*?)$/);if(a){var r=a[0].length;return i.processingInstruction(a[1],a[2]),s+2}else return-1}return-1}function fv(){this.attributeNames={}}fv.prototype={setTagName:function(e){if(!hy.test(e))throw Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,n,i){if(!hy.test(e))throw Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:n,offset:i}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};function Jq(e,n){var i,s=[],a=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;a.lastIndex=n,a.exec(e);while(i=a.exec(e))if(s.push(i),i[1])return s}Zq.XMLReader=hv;Zq.ParseError=Ff});var vv=v(function(lD){var nD=jf(),iD=uy(),pv=lv(),bv=dv(),sD=iD.DOMImplementation,mv=nD.NAMESPACE,{ParseError:aD,XMLReader:rD}=bv;function wv(e){return e.replace(/\r[\n\u0085]/g,`
|
|
12
|
+
`).replace(/[\r\u0085\u2028]/g,`
|
|
13
|
+
`)}function yv(e){this.options=e||{locator:{}}}yv.prototype.parseFromString=function(e,n){var i=this.options,s=new rD,a=i.domBuilder||new sp,{errorHandler:r,locator:l}=i,c=i.xmlns||{},p=/\/x?html?$/.test(n),m=p?pv.HTML_ENTITIES:pv.XML_ENTITIES;if(l)a.setDocumentLocator(l);if(s.errorHandler=oD(r,a,l),s.domBuilder=i.domBuilder||a,p)c[""]=mv.HTML;c.xml=c.xml||mv.XML;var g=i.normalizeLineEndings||wv;if(e&&typeof e==="string")s.parse(g(e),c,m);else s.errorHandler.error("invalid doc source");return a.doc};function oD(e,n,i){if(!e){if(n instanceof sp)return n;e=n}var s={},a=e instanceof Function;i=i||{};function r(l){var c=e[l];if(!c&&a)c=e.length==2?function(p){e(l,p)}:e;s[l]=c&&function(p){c("[xmldom "+l+"]\t"+p+fy(i))}||function(){}}return r("warning"),r("error"),r("fatalError"),s}function sp(){this.cdata=!1}function Nf(e,n){n.lineNumber=e.lineNumber,n.columnNumber=e.columnNumber}sp.prototype={startDocument:function(){if(this.doc=new sD().createDocument(null,null,null),this.locator)this.doc.documentURI=this.locator.systemId},startElement:function(e,n,i,s){var a=this.doc,r=a.createElementNS(e,i||n),l=s.length;l1(this,r),this.currentElement=r,this.locator&&Nf(this.locator,r);for(var c=0;c<l;c++){var e=s.getURI(c),p=s.getValue(c),i=s.getQName(c),m=a.createAttributeNS(e,i);this.locator&&Nf(s.getLocator(c),m),m.value=m.nodeValue=p,r.setAttributeNode(m)}},endElement:function(e,n,i){var s=this.currentElement,a=s.tagName;this.currentElement=s.parentNode},startPrefixMapping:function(e,n){},endPrefixMapping:function(e){},processingInstruction:function(e,n){var i=this.doc.createProcessingInstruction(e,n);this.locator&&Nf(this.locator,i),l1(this,i)},ignorableWhitespace:function(e,n,i){},characters:function(e,n,i){if(e=gv.apply(this,arguments),e){if(this.cdata)var s=this.doc.createCDATASection(e);else var s=this.doc.createTextNode(e);if(this.currentElement)this.currentElement.appendChild(s);else if(/^\s*$/.test(e))this.doc.appendChild(s);this.locator&&Nf(this.locator,s)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){if(this.locator=e)e.lineNumber=0},comment:function(e,n,i){e=gv.apply(this,arguments);var s=this.doc.createComment(e);this.locator&&Nf(this.locator,s),l1(this,s)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,n,i){var s=this.doc.implementation;if(s&&s.createDocumentType){var a=s.createDocumentType(e,n,i);this.locator&&Nf(this.locator,a),l1(this,a),this.doc.doctype=a}},warning:function(e){console.warn("[xmldom warning]\t"+e,fy(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,fy(this.locator))},fatalError:function(e){throw new aD(e,this.locator)}};function fy(e){if(e)return`
|
|
14
|
+
@`+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function gv(e,n,i){if(typeof e=="string")return e.substr(n,i);else{if(e.length>=n+i||n)return new java.lang.String(e,n,i)+"";return e}}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){sp.prototype[e]=function(){return null}});function l1(e,n){if(!e.currentElement)e.doc.appendChild(n);else e.currentElement.appendChild(n)}lD.__DOMHandler=sp;lD.normalizeLineEndings=wv;lD.DOMParser=yv});var Bv=v(function(qU,Pv){var Nv=Math.pow(2,32),rI=function(e){var n=new DataView(e.buffer,e.byteOffset,e.byteLength),i;if(n.getBigUint64){if(i=n.getBigUint64(0),i<Number.MAX_SAFE_INTEGER)return Number(i);return i}return n.getUint32(0)*Nv+n.getUint32(4)};Pv.exports={getUint64:rI,MAX_UINT32:Nv}});var Uv=v(function(DU,Hv){var Lv=Bv().getUint64,oI=function(e){var n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:n.getUint32(4),timescale:n.getUint32(8)},s=12;if(i.version===0)i.earliestPresentationTime=n.getUint32(s),i.firstOffset=n.getUint32(s+4),s+=8;else i.earliestPresentationTime=Lv(e.subarray(s)),i.firstOffset=Lv(e.subarray(s+8)),s+=16;s+=2;var a=n.getUint16(s);s+=2;for(;a>0;s+=12,a--)i.references.push({referenceType:(e[s]&128)>>>7,referencedSize:n.getUint32(s)&2147483647,subsegmentDuration:n.getUint32(s+4),startsWithSap:!!(e[s+8]&128),sapType:(e[s+8]&112)>>>4,sapDeltaTime:n.getUint32(s+8)&268435455});return i};Hv.exports=oI});var s8=v(function(tz,i8){var _y=90000,xy,ky,d1,Ty,e8,t8,n8;xy=function(e){return e*_y};ky=function(e,n){return e*n};d1=function(e){return e/_y};Ty=function(e,n){return e/n};e8=function(e,n){return xy(Ty(e,n))};t8=function(e,n){return ky(d1(e),n)};n8=function(e,n,i){return d1(i?e:e-n)};i8.exports={ONE_SECOND_IN_TS:_y,secondsToVideoTs:xy,secondsToAudioTs:ky,videoTsToSeconds:d1,audioTsToSeconds:Ty,audioTsToVideoTs:e8,videoTsToAudioTs:t8,metadataTsToSeconds:n8}});var Zx=v(function(y$,Kp){C();ju();Kp.exports=function(e){function n(f,d,b,k){return new je(f,d,b,k)}function i(){}function s(f){var d="https://react.dev/errors/"+f;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)d+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+f+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(f){var d=f,b=f;if(f.alternate)for(;d.return;)d=d.return;else{f=d;do d=f,(d.flags&4098)!==0&&(b=d.return),f=d.return;while(f)}return d.tag===3?b:null}function r(f){if(a(f)!==f)throw Error(s(188))}function l(f){var d=f.alternate;if(!d){if(d=a(f),d===null)throw Error(s(188));return d!==f?null:f}for(var b=f,k=d;;){var G=b.return;if(G===null)break;var ee=G.alternate;if(ee===null){if(k=G.return,k!==null){b=k;continue}break}if(G.child===ee.child){for(ee=G.child;ee;){if(ee===b)return r(G),f;if(ee===k)return r(G),d;ee=ee.sibling}throw Error(s(188))}if(b.return!==k.return)b=G,k=ee;else{for(var re=!1,Re=G.child;Re;){if(Re===b){re=!0,b=G,k=ee;break}if(Re===k){re=!0,k=G,b=ee;break}Re=Re.sibling}if(!re){for(Re=ee.child;Re;){if(Re===b){re=!0,b=ee,k=G;break}if(Re===k){re=!0,k=ee,b=G;break}Re=Re.sibling}if(!re)throw Error(s(189))}}if(b.alternate!==k)throw Error(s(190))}if(b.tag!==3)throw Error(s(188));return b.stateNode.current===b?f:d}function c(f){var d=f.tag;if(d===5||d===26||d===27||d===6)return f;for(f=f.child;f!==null;){if(d=c(f),d!==null)return d;f=f.sibling}return null}function p(f){var d=f.tag;if(d===5||d===26||d===27||d===6)return f;for(f=f.child;f!==null;){if(f.tag!==4&&(d=p(f),d!==null))return d;f=f.sibling}return null}function m(f){if(f===null||typeof f!=="object")return null;return f=P9&&f[P9]||f["@@iterator"],typeof f==="function"?f:null}function g(f){if(f==null)return null;if(typeof f==="function")return f.$$typeof===NA?null:f.displayName||f.name||null;if(typeof f==="string")return f;switch(f){case ef:return"Fragment";case B2:return"Profiler";case F9:return"StrictMode";case H2:return"Suspense";case U2:return"SuspenseList";case G2:return"Activity"}if(typeof f==="object")switch(f.$$typeof){case Zh:return"Portal";case bc:return f.displayName||"Context";case N9:return(f._context.displayName||"Context")+".Consumer";case L2:var d=f.render;return f=f.displayName,f||(f=d.displayName||d.name||"",f=f!==""?"ForwardRef("+f+")":"ForwardRef"),f;case z2:return d=f.displayName||null,d!==null?d:g(f.type)||"Memo";case yc:d=f._payload,f=f._init;try{return g(f(d))}catch(b){}}return null}function y(f){return{current:f}}function x(f){0>sf||(f.current=Y2[sf],Y2[sf]=null,sf--)}function j(f,d){sf++,Y2[sf]=f.current,f.current=d}function I(f){return f>>>=0,f===0?32:31-(dj(f)/pj|0)|0}function P(f){var d=f&42;if(d!==0)return d;switch(f&-f){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return f&261888;case 262144:case 524288:case 1048576:case 2097152:return f&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return f&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return f}}function X(f,d,b){var k=f.pendingLanes;if(k===0)return 0;var G=0,ee=f.suspendedLanes,re=f.pingedLanes;f=f.warmLanes;var Re=k&134217727;return Re!==0?(k=Re&~ee,k!==0?G=P(k):(re&=Re,re!==0?G=P(re):b||(b=Re&~f,b!==0&&(G=P(b))))):(Re=k&~ee,Re!==0?G=P(Re):re!==0?G=P(re):b||(b=k&~f,b!==0&&(G=P(b)))),G===0?0:d!==0&&d!==G&&(d&ee)===0&&(ee=G&-G,b=d&-d,ee>=b||ee===32&&(b&4194048)!==0)?d:G}function Y(f,d){return(f.pendingLanes&~(f.suspendedLanes&~f.pingedLanes)&d)===0}function J(f,d){switch(f){case 1:case 2:case 4:case 8:case 64:return d+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return d+5000;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ne(){var f=xg;return xg<<=1,(xg&62914560)===0&&(xg=4194304),f}function ae(f){for(var d=[],b=0;31>b;b++)d.push(f);return d}function se(f,d){f.pendingLanes|=d,d!==268435456&&(f.suspendedLanes=0,f.pingedLanes=0,f.warmLanes=0)}function oe(f,d,b,k,G,ee){var re=f.pendingLanes;f.pendingLanes=b,f.suspendedLanes=0,f.pingedLanes=0,f.warmLanes=0,f.expiredLanes&=b,f.entangledLanes&=b,f.errorRecoveryDisabledLanes&=b,f.shellSuspendCounter=0;var{entanglements:Re,expirationTimes:lt,hiddenUpdates:kt}=f;for(b=re&~b;0<b;){var Ot=31-Xa(b),qt=1<<Ot;Re[Ot]=0,lt[Ot]=-1;var Lt=kt[Ot];if(Lt!==null)for(kt[Ot]=null,Ot=0;Ot<Lt.length;Ot++){var _n=Lt[Ot];_n!==null&&(_n.lane&=-536870913)}b&=~qt}k!==0&&he(f,k,0),ee!==0&&G===0&&f.tag!==0&&(f.suspendedLanes|=ee&~(re&~d))}function he(f,d,b){f.pendingLanes|=d,f.suspendedLanes&=~d;var k=31-Xa(d);f.entangledLanes|=d,f.entanglements[k]=f.entanglements[k]|1073741824|b&261930}function we(f,d){var b=f.entangledLanes|=d;for(f=f.entanglements;b;){var k=31-Xa(b),G=1<<k;G&d|f[k]&d&&(f[k]|=d),b&=~G}}function Ce(f,d){var b=d&-d;return b=(b&42)!==0?1:Ne(b),(b&(f.suspendedLanes|d))!==0?0:b}function Ne(f){switch(f){case 2:f=1;break;case 8:f=4;break;case 32:f=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:f=128;break;case 268435456:f=134217728;break;default:f=0}return f}function Pe(f){return f&=-f,2<f?8<f?(f&134217727)!==0?32:268435456:8:2}function Ue(f){if(typeof yj==="function"&&vj(f),Ka&&typeof Ka.setStrictMode==="function")try{Ka.setStrictMode(C0,f)}catch(d){}}function ze(f,d){return f===d&&(f!==0||1/f===1/d)||f!==f&&d!==d}function He(f){if(Z2===void 0)try{throw Error()}catch(b){var d=b.stack.trim().match(/\n( *(at )?)/);Z2=d&&d[1]||"",u4=-1<b.stack.indexOf(`
|
|
15
|
+
at`)?" (<anonymous>)":-1<b.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
16
|
+
`+Z2+f+u4}function De(f,d){if(!f||ew)return"";ew=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var k={DetermineComponentFrameRoot:function(){try{if(d){var qt=function(){throw Error()};if(Object.defineProperty(qt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==="object"&&Reflect.construct){try{Reflect.construct(qt,[])}catch(_n){var Lt=_n}Reflect.construct(f,[],qt)}else{try{qt.call()}catch(_n){Lt=_n}f.call(qt.prototype)}}else{try{throw Error()}catch(_n){Lt=_n}(qt=f())&&typeof qt.catch==="function"&&qt.catch(function(){})}}catch(_n){if(_n&&Lt&&typeof _n.stack==="string")return[_n.stack,Lt.stack]}return[null,null]}};k.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var G=Object.getOwnPropertyDescriptor(k.DetermineComponentFrameRoot,"name");G&&G.configurable&&Object.defineProperty(k.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var ee=k.DetermineComponentFrameRoot(),re=ee[0],Re=ee[1];if(re&&Re){var lt=re.split(`
|
|
17
|
+
`),kt=Re.split(`
|
|
18
|
+
`);for(G=k=0;k<lt.length&&!lt[k].includes("DetermineComponentFrameRoot");)k++;for(;G<kt.length&&!kt[G].includes("DetermineComponentFrameRoot");)G++;if(k===lt.length||G===kt.length)for(k=lt.length-1,G=kt.length-1;1<=k&&0<=G&<[k]!==kt[G];)G--;for(;1<=k&&0<=G;k--,G--)if(lt[k]!==kt[G]){if(k!==1||G!==1)do if(k--,G--,0>G||lt[k]!==kt[G]){var Ot=`
|
|
19
|
+
`+lt[k].replace(" at new "," at ");return f.displayName&&Ot.includes("<anonymous>")&&(Ot=Ot.replace("<anonymous>",f.displayName)),Ot}while(1<=k&&0<=G);break}}}finally{ew=!1,Error.prepareStackTrace=b}return(b=f?f.displayName||f.name:"")?He(b):""}function Fe(f,d){switch(f.tag){case 26:case 27:case 5:return He(f.type);case 16:return He("Lazy");case 13:return f.child!==d&&d!==null?He("Suspense Fallback"):He("Suspense");case 19:return He("SuspenseList");case 0:case 15:return De(f.type,!1);case 11:return De(f.type.render,!1);case 1:return De(f.type,!0);case 31:return He("Activity");default:return""}}function bt(f){try{var d="",b=null;do d+=Fe(f,b),b=f,f=f.return;while(f);return d}catch(k){return`
|
|
20
|
+
Error generating stack: `+k.message+`
|
|
21
|
+
`+k.stack}}function Ve(f,d){if(typeof f==="object"&&f!==null){var b=h4.get(f);if(b!==void 0)return b;return d={value:f,source:d,stack:bt(d)},h4.set(f,d),d}return{value:f,source:d,stack:bt(d)}}function $e(f,d){rf[of++]=j0,rf[of++]=Tg,Tg=f,j0=d}function Ct(f,d,b){wr[yr++]=bo,wr[yr++]=yo,wr[yr++]=vc,vc=f;var k=bo;f=yo;var G=32-Xa(k)-1;k&=~(1<<G),b+=1;var ee=32-Xa(d)+G;if(30<ee){var re=G-G%5;ee=(k&(1<<re)-1).toString(32),k>>=re,G-=re,bo=1<<32-Xa(d)+G|b<<G|k,yo=ee+f}else bo=1<<ee|b<<G|k,yo=f}function ct(f){f.return!==null&&($e(f,1),Ct(f,1,0))}function Ze(f){for(;f===Tg;)Tg=rf[--of],rf[of]=null,j0=rf[--of],rf[of]=null;for(;f===vc;)vc=wr[--yr],wr[yr]=null,yo=wr[--yr],wr[yr]=null,bo=wr[--yr],wr[yr]=null}function mt(f,d){wr[yr++]=bo,wr[yr++]=yo,wr[yr++]=vc,bo=d.id,yo=d.overflow,vc=f}function Xt(f,d){j(Sc,d),j(E0,f),j(Ms,null),f=LA(d),x(Ms),j(Ms,f)}function hn(){x(Ms),x(E0),x(Sc)}function nn(f){f.memoizedState!==null&&j(Ag,f);var d=Ms.current,b=HA(d,f.type);d!==b&&(j(E0,f),j(Ms,b))}function Zt(f){E0.current===f&&(x(Ms),x(E0)),Ag.current===f&&(x(Ag),gl?Hu._currentValue=tf:Hu._currentValue2=tf)}function Rn(f){var d=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw zi(Ve(d,f)),tw}function Zn(f,d){if(!$s)throw Error(s(175));UC(f.stateNode,f.type,f.memoizedProps,d,f)||Rn(f,!0)}function Ni(f){for(Rs=f.return;Rs;)switch(Rs.tag){case 5:case 31:case 13:vr=!1;return;case 27:case 3:vr=!0;return;default:Rs=Rs.return}}function ri(f){if(!$s||f!==Rs)return!1;if(!Bn)return Ni(f),Bn=!0,!1;var d=f.tag;if(is?d!==3&&d!==27&&(d!==5||Q9(f.type)&&!vg(f.type,f.memoizedProps))&&Ei&&Rn(f):d!==3&&(d!==5||Q9(f.type)&&!vg(f.type,f.memoizedProps))&&Ei&&Rn(f),Ni(f),d===13){if(!$s)throw Error(s(316));if(f=f.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(s(317));Ei=WC(f)}else if(d===31){if(f=f.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(s(317));Ei=XC(f)}else Ei=is&&d===27?IC(f.type,Ei):Rs?Y9(f.stateNode):null;return!0}function Ai(){$s&&(Ei=Rs=null,Bn=!1)}function Vs(){var f=_c;return f!==null&&(Ca===null?Ca=f:Ca.push.apply(Ca,f),_c=null),f}function zi(f){_c===null?_c=[f]:_c.push(f)}function Ht(f,d,b){gl?(j(Cg,d._currentValue),d._currentValue=b):(j(Cg,d._currentValue2),d._currentValue2=b)}function $t(f){var d=Cg.current;gl?f._currentValue=d:f._currentValue2=d,x(Cg)}function cn(f,d,b){for(;f!==null;){var k=f.alternate;if((f.childLanes&d)!==d?(f.childLanes|=d,k!==null&&(k.childLanes|=d)):k!==null&&(k.childLanes&d)!==d&&(k.childLanes|=d),f===b)break;f=f.return}}function pn(f,d,b,k){var G=f.child;G!==null&&(G.return=f);for(;G!==null;){var ee=G.dependencies;if(ee!==null){var re=G.child;ee=ee.firstContext;e:for(;ee!==null;){var Re=ee;ee=G;for(var lt=0;lt<d.length;lt++)if(Re.context===d[lt]){ee.lanes|=b,Re=ee.alternate,Re!==null&&(Re.lanes|=b),cn(ee.return,b,f),k||(re=null);break e}ee=Re.next}}else if(G.tag===18){if(re=G.return,re===null)throw Error(s(341));re.lanes|=b,ee=re.alternate,ee!==null&&(ee.lanes|=b),cn(re,b,f),re=null}else re=G.child;if(re!==null)re.return=G;else for(re=G;re!==null;){if(re===f){re=null;break}if(G=re.sibling,G!==null){G.return=re.return,re=G;break}re=re.return}G=re}}function oi(f,d,b,k){f=null;for(var G=d,ee=!1;G!==null;){if(!ee){if((G.flags&524288)!==0)ee=!0;else if((G.flags&262144)!==0)break}if(G.tag===10){var re=G.alternate;if(re===null)throw Error(s(387));if(re=re.memoizedProps,re!==null){var Re=G.type;$a(G.pendingProps.value,re.value)||(f!==null?f.push(Re):f=[Re])}}else if(G===Ag.current){if(re=G.alternate,re===null)throw Error(s(387));re.memoizedState.memoizedState!==G.memoizedState.memoizedState&&(f!==null?f.push(Hu):f=[Hu])}G=G.return}f!==null&&pn(d,f,b,k),d.flags|=262144}function fn(f){for(f=f.firstContext;f!==null;){var d=f.context;if(!$a(gl?d._currentValue:d._currentValue2,f.memoizedValue))return!0;f=f.next}return!1}function Si(f){Uu=f,yl=null,f=f.dependencies,f!==null&&(f.firstContext=null)}function Cn(f){return lr(Uu,f)}function ta(f,d){return Uu===null&&Si(f),lr(f,d)}function lr(f,d){var b=gl?d._currentValue:d._currentValue2;if(d={context:d,memoizedValue:b,next:null},yl===null){if(f===null)throw Error(s(308));yl=d,f.dependencies={lanes:0,firstContext:d},f.flags|=524288}else yl=yl.next=d;return b}function os(){return{controller:new _j,data:new Map,refCount:0}}function ls(f){f.refCount--,f.refCount===0&&xj(kj,function(){f.controller.abort()})}function na(){}function Pi(f){f!==lf&&f.next===null&&(lf===null?jg=lf=f:lf=lf.next=f),Eg=!0,nw||(nw=!0,Xl())}function cs(f,d){if(!iw&&Eg){iw=!0;do{var b=!1;for(var k=jg;k!==null;){if(!d)if(f!==0){var G=k.pendingLanes;if(G===0)var ee=0;else{var re=k.suspendedLanes,Re=k.pingedLanes;ee=(1<<31-Xa(42|f)+1)-1,ee&=G&~(re&~Re),ee=ee&201326741?ee&201326741|1:ee?ee|2:0}ee!==0&&(b=!0,ur(k,ee))}else ee=Nn,ee=X(k,k===fi?ee:0,k.cancelPendingCommit!==null||k.timeoutHandle!==Lu),(ee&3)===0||Y(k,ee)||(b=!0,ur(k,ee));k=k.next}}while(b);iw=!1}}function Pr(){Br()}function Br(){Eg=nw=!1;var f=0;Gu!==0&&YA()&&(f=Gu);for(var d=Ta(),b=null,k=jg;k!==null;){var G=k.next,ee=zn(k,d);if(ee===0)k.next=null,b===null?jg=G:b.next=G,G===null&&(lf=b);else if(b=k,f!==0||(ee&3)!==0)Eg=!0;k=G}ss!==0&&ss!==5||cs(f,!1),Gu!==0&&(Gu=0)}function zn(f,d){for(var{suspendedLanes:b,pingedLanes:k,expirationTimes:G}=f,ee=f.pendingLanes&-62914561;0<ee;){var re=31-Xa(ee),Re=1<<re,lt=G[re];if(lt===-1){if((Re&b)===0||(Re&k)!==0)G[re]=J(Re,d)}else lt<=d&&(f.expiredLanes|=Re);ee&=~Re}if(d=fi,b=Nn,b=X(f,f===d?b:0,f.cancelPendingCommit!==null||f.timeoutHandle!==Lu),k=f.callbackNode,b===0||f===d&&(ni===2||ni===9)||f.cancelPendingCommit!==null)return k!==null&&k!==null&&Q2(k),f.callbackNode=null,f.callbackPriority=0;if((b&3)===0||Y(f,b)){if(d=b&-b,d===f.callbackPriority)return d;switch(k!==null&&Q2(k),Pe(b)){case 2:case 8:b=bj;break;case 32:b=J2;break;case 268435456:b=wj;break;default:b=J2}return k=ma.bind(null,f),b=kg(b,k),f.callbackPriority=d,f.callbackNode=b,d}return k!==null&&k!==null&&Q2(k),f.callbackPriority=2,f.callbackNode=null,2}function ma(f,d){if(ss!==0&&ss!==5)return f.callbackNode=null,f.callbackPriority=0,null;var b=f.callbackNode;if(ml()&&f.callbackNode!==b)return null;var k=Nn;if(k=X(f,f===fi?k:0,f.cancelPendingCommit!==null||f.timeoutHandle!==Lu),k===0)return null;return S0(f,k,d),zn(f,Ta()),f.callbackNode!=null&&f.callbackNode===b?ma.bind(null,f):null}function ur(f,d){if(ml())return null;S0(f,d,!0)}function Xl(){iC?sC(function(){(qn&6)!==0?kg(l4,Pr):Br()}):kg(l4,Pr)}function ao(){if(Gu===0){var f=cf;f===0&&(f=Sg,Sg<<=1,(Sg&261888)===0&&(Sg=256)),Gu=f}return Gu}function Wl(f,d){if(q0===null){var b=q0=[];sw=0,cf=ao(),uf={status:"pending",value:void 0,then:function(k){b.push(k)}}}return sw++,d.then(ro,ro),d}function ro(){if(--sw===0&&q0!==null){uf!==null&&(uf.status="fulfilled");var f=q0;q0=null,cf=0,uf=null;for(var d=0;d<f.length;d++)(0,f[d])()}}function Ut(f,d){var b=[],k={status:"pending",value:null,reason:null,then:function(G){b.push(G)}};return f.then(function(){k.status="fulfilled",k.value=d;for(var G=0;G<b.length;G++)(0,b[G])(d)},function(G){k.status="rejected",k.reason=G;for(G=0;G<b.length;G++)(0,b[G])(void 0)}),k}function Yt(){var f=Vu.current;return f!==null?f:fi.pooledCache}function ei(f,d){d===null?j(Vu,Vu.current):j(Vu,d.pool)}function Ki(){var f=Yt();return f===null?null:{parent:gl?qi._currentValue:qi._currentValue2,pool:f}}function Et(f,d){if($a(f,d))return!0;if(typeof f!=="object"||f===null||typeof d!=="object"||d===null)return!1;var b=Object.keys(f),k=Object.keys(d);if(b.length!==k.length)return!1;for(k=0;k<b.length;k++){var G=b[k];if(!Sj.call(d,G)||!$a(f[G],d[G]))return!1}return!0}function Ft(f){return f=f.status,f==="fulfilled"||f==="rejected"}function Wt(f,d,b){switch(b=f[b],b===void 0?f.push(d):b!==d&&(d.then(na,na),d=b),d.status){case"fulfilled":return d.value;case"rejected":throw f=d.reason,gi(f),f;default:if(typeof d.status==="string")d.then(na,na);else{if(f=fi,f!==null&&100<f.shellSuspendCounter)throw Error(s(482));f=d,f.status="pending",f.then(function(k){if(d.status==="pending"){var G=d;G.status="fulfilled",G.value=k}},function(k){if(d.status==="pending"){var G=d;G.status="rejected",G.reason=k}})}switch(d.status){case"fulfilled":return d.value;case"rejected":throw f=d.reason,gi(f),f}throw Xu=d,hf}}function Kt(f){try{var d=f._init;return d(f._payload)}catch(b){if(b!==null&&typeof b==="object"&&typeof b.then==="function")throw Xu=b,hf;throw b}}function Ci(){if(Xu===null)throw Error(s(459));var f=Xu;return Xu=null,f}function gi(f){if(f===hf||f===qg)throw Error(s(483))}function hr(f){var d=D0;return D0+=1,ff===null&&(ff=[]),Wt(ff,f,d)}function Ko(f,d){d=d.props.ref,f.ref=d!==void 0?d:null}function Dh(f,d){if(d.$$typeof===OA)throw Error(s(525));throw f=Object.prototype.toString.call(d),Error(s(31,f==="[object Object]"?"object with keys {"+Object.keys(d).join(", ")+"}":f))}function Nd(f){function d(Ye,We){if(f){var it=Ye.deletions;it===null?(Ye.deletions=[We],Ye.flags|=16):it.push(We)}}function b(Ye,We){if(!f)return null;for(;We!==null;)d(Ye,We),We=We.sibling;return null}function k(Ye){for(var We=new Map;Ye!==null;)Ye.key!==null?We.set(Ye.key,Ye):We.set(Ye.index,Ye),Ye=Ye.sibling;return We}function G(Ye,We){return Ye=Qe(Ye,We),Ye.index=0,Ye.sibling=null,Ye}function ee(Ye,We,it){if(Ye.index=it,!f)return Ye.flags|=1048576,We;if(it=Ye.alternate,it!==null)return it=it.index,it<We?(Ye.flags|=67108866,We):it;return Ye.flags|=67108866,We}function re(Ye){return f&&Ye.alternate===null&&(Ye.flags|=67108866),Ye}function Re(Ye,We,it,Dt){if(We===null||We.tag!==6)return We=rn(it,Ye.mode,Dt),We.return=Ye,We;return We=G(We,it),We.return=Ye,We}function lt(Ye,We,it,Dt){var an=it.type;if(an===ef)return Ot(Ye,We,it.props.children,Dt,it.key);if(We!==null&&(We.elementType===an||typeof an==="object"&&an!==null&&an.$$typeof===yc&&Kt(an)===We.type))return We=G(We,it.props),Ko(We,it),We.return=Ye,We;return We=ft(it.type,it.key,it.props,null,Ye.mode,Dt),Ko(We,it),We.return=Ye,We}function kt(Ye,We,it,Dt){if(We===null||We.tag!==4||We.stateNode.containerInfo!==it.containerInfo||We.stateNode.implementation!==it.implementation)return We=Ds(it,Ye.mode,Dt),We.return=Ye,We;return We=G(We,it.children||[]),We.return=Ye,We}function Ot(Ye,We,it,Dt,an){if(We===null||We.tag!==7)return We=zt(it,Ye.mode,Dt,an),We.return=Ye,We;return We=G(We,it),We.return=Ye,We}function qt(Ye,We,it){if(typeof We==="string"&&We!==""||typeof We==="number"||typeof We==="bigint")return We=rn(""+We,Ye.mode,it),We.return=Ye,We;if(typeof We==="object"&&We!==null){switch(We.$$typeof){case wg:return it=ft(We.type,We.key,We.props,null,Ye.mode,it),Ko(it,We),it.return=Ye,it;case Zh:return We=Ds(We,Ye.mode,it),We.return=Ye,We;case yc:return We=Kt(We),qt(Ye,We,it)}if(yg(We)||m(We))return We=zt(We,Ye.mode,it,null),We.return=Ye,We;if(typeof We.then==="function")return qt(Ye,hr(We),it);if(We.$$typeof===bc)return qt(Ye,ta(Ye,We),it);Dh(Ye,We)}return null}function Lt(Ye,We,it,Dt){var an=We!==null?We.key:null;if(typeof it==="string"&&it!==""||typeof it==="number"||typeof it==="bigint")return an!==null?null:Re(Ye,We,""+it,Dt);if(typeof it==="object"&&it!==null){switch(it.$$typeof){case wg:return it.key===an?lt(Ye,We,it,Dt):null;case Zh:return it.key===an?kt(Ye,We,it,Dt):null;case yc:return it=Kt(it),Lt(Ye,We,it,Dt)}if(yg(it)||m(it))return an!==null?null:Ot(Ye,We,it,Dt,null);if(typeof it.then==="function")return Lt(Ye,We,hr(it),Dt);if(it.$$typeof===bc)return Lt(Ye,We,ta(Ye,it),Dt);Dh(Ye,it)}return null}function _n(Ye,We,it,Dt,an){if(typeof Dt==="string"&&Dt!==""||typeof Dt==="number"||typeof Dt==="bigint")return Ye=Ye.get(it)||null,Re(We,Ye,""+Dt,an);if(typeof Dt==="object"&&Dt!==null){switch(Dt.$$typeof){case wg:return Ye=Ye.get(Dt.key===null?it:Dt.key)||null,lt(We,Ye,Dt,an);case Zh:return Ye=Ye.get(Dt.key===null?it:Dt.key)||null,kt(We,Ye,Dt,an);case yc:return Dt=Kt(Dt),_n(Ye,We,it,Dt,an)}if(yg(Dt)||m(Dt))return Ye=Ye.get(it)||null,Ot(We,Ye,Dt,an,null);if(typeof Dt.then==="function")return _n(Ye,We,it,hr(Dt),an);if(Dt.$$typeof===bc)return _n(Ye,We,it,ta(We,Dt),an);Dh(We,Dt)}return null}function Os(Ye,We,it,Dt){for(var an=null,Di=null,un=We,Gn=We=0,ws=null;un!==null&&Gn<it.length;Gn++){un.index>Gn?(ws=un,un=null):ws=un.sibling;var Vn=Lt(Ye,un,it[Gn],Dt);if(Vn===null){un===null&&(un=ws);break}f&&un&&Vn.alternate===null&&d(Ye,un),We=ee(Vn,We,Gn),Di===null?an=Vn:Di.sibling=Vn,Di=Vn,un=ws}if(Gn===it.length)return b(Ye,un),Bn&&$e(Ye,Gn),an;if(un===null){for(;Gn<it.length;Gn++)un=qt(Ye,it[Gn],Dt),un!==null&&(We=ee(un,We,Gn),Di===null?an=un:Di.sibling=un,Di=un);return Bn&&$e(Ye,Gn),an}for(un=k(un);Gn<it.length;Gn++)ws=_n(un,Ye,Gn,it[Gn],Dt),ws!==null&&(f&&ws.alternate!==null&&un.delete(ws.key===null?Gn:ws.key),We=ee(ws,We,Gn),Di===null?an=ws:Di.sibling=ws,Di=ws);return f&&un.forEach(function(jc){return d(Ye,jc)}),Bn&&$e(Ye,Gn),an}function L0(Ye,We,it,Dt){if(it==null)throw Error(s(151));for(var an=null,Di=null,un=We,Gn=We=0,ws=null,Vn=it.next();un!==null&&!Vn.done;Gn++,Vn=it.next()){un.index>Gn?(ws=un,un=null):ws=un.sibling;var jc=Lt(Ye,un,Vn.value,Dt);if(jc===null){un===null&&(un=ws);break}f&&un&&jc.alternate===null&&d(Ye,un),We=ee(jc,We,Gn),Di===null?an=jc:Di.sibling=jc,Di=jc,un=ws}if(Vn.done)return b(Ye,un),Bn&&$e(Ye,Gn),an;if(un===null){for(;!Vn.done;Gn++,Vn=it.next())Vn=qt(Ye,Vn.value,Dt),Vn!==null&&(We=ee(Vn,We,Gn),Di===null?an=Vn:Di.sibling=Vn,Di=Vn);return Bn&&$e(Ye,Gn),an}for(un=k(un);!Vn.done;Gn++,Vn=it.next())Vn=_n(un,Ye,Gn,Vn.value,Dt),Vn!==null&&(f&&Vn.alternate!==null&&un.delete(Vn.key===null?Gn:Vn.key),We=ee(Vn,We,Gn),Di===null?an=Vn:Di.sibling=Vn,Di=Vn);return f&&un.forEach(function(jj){return d(Ye,jj)}),Bn&&$e(Ye,Gn),an}function Yu(Ye,We,it,Dt){if(typeof it==="object"&&it!==null&&it.type===ef&&it.key===null&&(it=it.props.children),typeof it==="object"&&it!==null){switch(it.$$typeof){case wg:e:{for(var an=it.key;We!==null;){if(We.key===an){if(an=it.type,an===ef){if(We.tag===7){b(Ye,We.sibling),Dt=G(We,it.props.children),Dt.return=Ye,Ye=Dt;break e}}else if(We.elementType===an||typeof an==="object"&&an!==null&&an.$$typeof===yc&&Kt(an)===We.type){b(Ye,We.sibling),Dt=G(We,it.props),Ko(Dt,it),Dt.return=Ye,Ye=Dt;break e}b(Ye,We);break}else d(Ye,We);We=We.sibling}it.type===ef?(Dt=zt(it.props.children,Ye.mode,Dt,it.key),Dt.return=Ye,Ye=Dt):(Dt=ft(it.type,it.key,it.props,null,Ye.mode,Dt),Ko(Dt,it),Dt.return=Ye,Ye=Dt)}return re(Ye);case Zh:e:{for(an=it.key;We!==null;){if(We.key===an)if(We.tag===4&&We.stateNode.containerInfo===it.containerInfo&&We.stateNode.implementation===it.implementation){b(Ye,We.sibling),Dt=G(We,it.children||[]),Dt.return=Ye,Ye=Dt;break e}else{b(Ye,We);break}else d(Ye,We);We=We.sibling}Dt=Ds(it,Ye.mode,Dt),Dt.return=Ye,Ye=Dt}return re(Ye);case yc:return it=Kt(it),Yu(Ye,We,it,Dt)}if(yg(it))return Os(Ye,We,it,Dt);if(m(it)){if(an=m(it),typeof an!=="function")throw Error(s(150));return it=an.call(it),L0(Ye,We,it,Dt)}if(typeof it.then==="function")return Yu(Ye,We,hr(it),Dt);if(it.$$typeof===bc)return Yu(Ye,We,ta(Ye,it),Dt);Dh(Ye,it)}return typeof it==="string"&&it!==""||typeof it==="number"||typeof it==="bigint"?(it=""+it,We!==null&&We.tag===6?(b(Ye,We.sibling),Dt=G(We,it),Dt.return=Ye,Ye=Dt):(b(Ye,We),Dt=rn(it,Ye.mode,Dt),Dt.return=Ye,Ye=Dt),re(Ye)):b(Ye,We)}return function(Ye,We,it,Dt){try{D0=0;var an=Yu(Ye,We,it,Dt);return ff=null,an}catch(un){if(un===hf||un===qg)throw un;var Di=n(29,un,null,Ye.mode);return Di.lanes=Dt,Di.return=Ye,Di}finally{}}}function Kl(){for(var f=df,d=rw=df=0;d<f;){var b=Sr[d];Sr[d++]=null;var k=Sr[d];Sr[d++]=null;var G=Sr[d];Sr[d++]=null;var ee=Sr[d];if(Sr[d++]=null,k!==null&&G!==null){var re=k.pending;re===null?G.next=G:(G.next=re.next,re.next=G),k.pending=G}ee!==0&&gm(b,G,ee)}}function $o(f,d,b,k){Sr[df++]=f,Sr[df++]=d,Sr[df++]=b,Sr[df++]=k,rw|=k,f.lanes|=k,f=f.alternate,f!==null&&(f.lanes|=k)}function us(f,d,b,k){return $o(f,d,b,k),Qo(f)}function Yo(f,d){return $o(f,null,null,d),Qo(f)}function gm(f,d,b){f.lanes|=b;var k=f.alternate;k!==null&&(k.lanes|=b);for(var G=!1,ee=f.return;ee!==null;)ee.childLanes|=b,k=ee.alternate,k!==null&&(k.childLanes|=b),ee.tag===22&&(f=ee.stateNode,f===null||f._visibility&1||(G=!0)),f=ee,ee=ee.return;return f.tag===3?(ee=f.stateNode,G&&d!==null&&(G=31-Xa(b),f=ee.hiddenUpdates,k=f[G],k===null?f[G]=[d]:k.push(d),d.lane=b|536870912),ee):null}function Qo(f){if(50<B0)throw B0=0,ww=null,Error(s(185));for(var d=f.return;d!==null;)f=d,d=f.return;return f.tag===3?f.stateNode:null}function Ha(f){f.updateQueue={baseState:f.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $l(f,d){f=f.updateQueue,d.updateQueue===f&&(d.updateQueue={baseState:f.baseState,firstBaseUpdate:f.firstBaseUpdate,lastBaseUpdate:f.lastBaseUpdate,shared:f.shared,callbacks:null})}function On(f){return{lane:f,tag:0,payload:null,callback:null,next:null}}function oo(f,d,b){var k=f.updateQueue;if(k===null)return null;if(k=k.shared,(qn&2)!==0){var G=k.pending;return G===null?d.next=d:(d.next=G.next,G.next=d),k.pending=d,d=Qo(f),gm(f,null,b),d}return $o(f,k,d,b),Qo(f)}function lo(f,d,b){if(d=d.updateQueue,d!==null&&(d=d.shared,(b&4194048)!==0)){var k=d.lanes;k&=f.pendingLanes,b|=k,d.lanes=b,we(f,b)}}function Yl(f,d){var b=f.updateQueue,k=f.alternate;if(k!==null&&(k=k.updateQueue,b===k)){var G=null,ee=null;if(b=b.firstBaseUpdate,b!==null){do{var re={lane:b.lane,tag:b.tag,payload:b.payload,callback:null,next:null};ee===null?G=ee=re:ee=ee.next=re,b=b.next}while(b!==null);ee===null?G=ee=d:ee=ee.next=d}else G=ee=d;b={baseState:k.baseState,firstBaseUpdate:G,lastBaseUpdate:ee,shared:k.shared,callbacks:k.callbacks},f.updateQueue=b;return}f=b.lastBaseUpdate,f===null?b.firstBaseUpdate=d:f.next=d,b.lastBaseUpdate=d}function tu(){if(ow){var f=uf;if(f!==null)throw f}}function Ua(f,d,b,k){ow=!1;var G=f.updateQueue;xc=!1;var{firstBaseUpdate:ee,lastBaseUpdate:re}=G,Re=G.shared.pending;if(Re!==null){G.shared.pending=null;var lt=Re,kt=lt.next;lt.next=null,re===null?ee=kt:re.next=kt,re=lt;var Ot=f.alternate;Ot!==null&&(Ot=Ot.updateQueue,Re=Ot.lastBaseUpdate,Re!==re&&(Re===null?Ot.firstBaseUpdate=kt:Re.next=kt,Ot.lastBaseUpdate=lt))}if(ee!==null){var qt=G.baseState;re=0,Ot=kt=lt=null,Re=ee;do{var Lt=Re.lane&-536870913,_n=Lt!==Re.lane;if(_n?(Nn&Lt)===Lt:(k&Lt)===Lt){Lt!==0&&Lt===cf&&(ow=!0),Ot!==null&&(Ot=Ot.next={lane:0,tag:Re.tag,payload:Re.payload,callback:null,next:null});e:{var Os=f,L0=Re;Lt=d;var Yu=b;switch(L0.tag){case 1:if(Os=L0.payload,typeof Os==="function"){qt=Os.call(Yu,qt,Lt);break e}qt=Os;break e;case 3:Os.flags=Os.flags&-65537|128;case 0:if(Os=L0.payload,Lt=typeof Os==="function"?Os.call(Yu,qt,Lt):Os,Lt===null||Lt===void 0)break e;qt=ra({},qt,Lt);break e;case 2:xc=!0}}Lt=Re.callback,Lt!==null&&(f.flags|=64,_n&&(f.flags|=8192),_n=G.callbacks,_n===null?G.callbacks=[Lt]:_n.push(Lt))}else _n={lane:Lt,tag:Re.tag,payload:Re.payload,callback:Re.callback,next:null},Ot===null?(kt=Ot=_n,lt=qt):Ot=Ot.next=_n,re|=Lt;if(Re=Re.next,Re===null)if(Re=G.shared.pending,Re===null)break;else _n=Re,Re=_n.next,_n.next=null,G.lastBaseUpdate=_n,G.shared.pending=null}while(1);Ot===null&&(lt=qt),G.baseState=lt,G.firstBaseUpdate=kt,G.lastBaseUpdate=Ot,ee===null&&(G.shared.lanes=0),Tc|=re,f.lanes=re,f.memoizedState=qt}}function hi(f,d){if(typeof f!=="function")throw Error(s(191,f));f.call(d)}function Pd(f,d){var b=f.callbacks;if(b!==null)for(f.callbacks=null,f=0;f<b.length;f++)hi(b[f],d)}function iu(f,d){f=_l,j(Ig,f),j(pf,d),_l=f|d.baseLanes}function Bd(){j(Ig,_l),j(pf,pf.current)}function Ld(){_l=Ig.current,x(pf),x(Ig)}function co(f){var d=f.alternate;j(Xi,Xi.current&1),j(Ya,f),_r===null&&(d===null||pf.current!==null?_r=f:d.memoizedState!==null&&(_r=f))}function Ih(f){j(Xi,Xi.current),j(Ya,f),_r===null&&(_r=f)}function Mh(f){f.tag===22?(j(Xi,Xi.current),j(Ya,f),_r===null&&(_r=f)):fr(f)}function fr(){j(Xi,Xi.current),j(Ya,Ya.current)}function Xs(f){x(Ya),_r===f&&(_r=null),x(Xi)}function Rh(f){for(var d=f;d!==null;){if(d.tag===13){var b=d.memoizedState;if(b!==null&&(b=b.dehydrated,b===null||W2(b)||K2(b)))return d}else if(d.tag===19&&(d.memoizedProps.revealOrder==="forwards"||d.memoizedProps.revealOrder==="backwards"||d.memoizedProps.revealOrder==="unstable_legacy-backwards"||d.memoizedProps.revealOrder==="together")){if((d.flags&128)!==0)return d}else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===f)break;for(;d.sibling===null;){if(d.return===null||d.return===f)return null;d=d.return}d.sibling.return=d.return,d=d.sibling}return null}function _i(){throw Error(s(321))}function Ql(f,d){if(d===null)return!1;for(var b=0;b<d.length&&b<f.length;b++)if(!$a(f[b],d[b]))return!1;return!0}function Jl(f,d,b,k,G,ee){return vl=ee,Tn=d,d.memoizedState=null,d.updateQueue=null,d.lanes=0,sn.H=f===null||f.memoizedState===null?p4:lw,Ku=!1,ee=b(k,G),Ku=!1,mf&&(ee=ec(d,b,k,G)),Hd(f),ee}function Hd(f){sn.H=R0;var d=li!==null&&li.next!==null;if(vl=0,Yi=li=Tn=null,Mg=!1,M0=0,gf=null,d)throw Error(s(300));f===null||Qi||(f=f.dependencies,f!==null&&fn(f)&&(Qi=!0))}function ec(f,d,b,k){Tn=f;var G=0;do{if(mf&&(gf=null),M0=0,mf=!1,25<=G)throw Error(s(301));if(G+=1,Yi=li=null,f.updateQueue!=null){var ee=f.updateQueue;ee.lastEffect=null,ee.events=null,ee.stores=null,ee.memoCache!=null&&(ee.memoCache.index=0)}sn.H=m4,ee=d(b,k)}while(mf);return ee}function su(){var f=sn.H,d=f.useState()[0];return d=typeof d.then==="function"?ga(d):d,f=f.useState()[0],(li!==null?li.memoizedState:null)!==f&&(Tn.flags|=1024),d}function Jo(){var f=Rg!==0;return Rg=0,f}function el(f,d,b){d.updateQueue=f.updateQueue,d.flags&=-2053,f.lanes&=~b}function Ud(f){if(Mg){for(f=f.memoizedState;f!==null;){var d=f.queue;d!==null&&(d.pending=null),f=f.next}Mg=!1}vl=0,Yi=li=Tn=null,mf=!1,M0=Rg=0,gf=null}function ds(){var f={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Yi===null?Tn.memoizedState=Yi=f:Yi=Yi.next=f,Yi}function ji(){if(li===null){var f=Tn.alternate;f=f!==null?f.memoizedState:null}else f=li.next;var d=Yi===null?Tn.memoizedState:Yi.next;if(d!==null)Yi=d,li=f;else{if(f===null){if(Tn.alternate===null)throw Error(s(467));throw Error(s(310))}li=f,f={memoizedState:li.memoizedState,baseState:li.baseState,baseQueue:li.baseQueue,queue:li.queue,next:null},Yi===null?Tn.memoizedState=Yi=f:Yi=Yi.next=f}return Yi}function Oh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ga(f){var d=M0;return M0+=1,gf===null&&(gf=[]),f=Wt(gf,f,d),d=Tn,(Yi===null?d.memoizedState:Yi.next)===null&&(d=d.alternate,sn.H=d===null||d.memoizedState===null?p4:lw),f}function tl(f){if(f!==null&&typeof f==="object"){if(typeof f.then==="function")return ga(f);if(f.$$typeof===bc)return Cn(f)}throw Error(s(438,String(f)))}function zd(f){var d=null,b=Tn.updateQueue;if(b!==null&&(d=b.memoCache),d==null){var k=Tn.alternate;k!==null&&(k=k.updateQueue,k!==null&&(k=k.memoCache,k!=null&&(d={data:k.data.map(function(G){return G.slice()}),index:0})))}if(d==null&&(d={data:[],index:0}),b===null&&(b=Oh(),Tn.updateQueue=b),b.memoCache=d,b=d.data[d.index],b===void 0)for(b=d.data[d.index]=Array(f),k=0;k<f;k++)b[k]=FA;return d.index++,b}function za(f,d){return typeof d==="function"?d(f):d}function tc(f){var d=ji();return ia(d,li,f)}function ia(f,d,b){var k=f.queue;if(k===null)throw Error(s(311));k.lastRenderedReducer=b;var G=f.baseQueue,ee=k.pending;if(ee!==null){if(G!==null){var re=G.next;G.next=ee.next,ee.next=re}d.baseQueue=G=ee,k.pending=null}if(ee=f.baseState,G===null)f.memoizedState=ee;else{d=G.next;var Re=re=null,lt=null,kt=d,Ot=!1;do{var qt=kt.lane&-536870913;if(qt!==kt.lane?(Nn&qt)===qt:(vl&qt)===qt){var Lt=kt.revertLane;if(Lt===0)lt!==null&&(lt=lt.next={lane:0,revertLane:0,gesture:null,action:kt.action,hasEagerState:kt.hasEagerState,eagerState:kt.eagerState,next:null}),qt===cf&&(Ot=!0);else if((vl&Lt)===Lt){kt=kt.next,Lt===cf&&(Ot=!0);continue}else qt={lane:0,revertLane:kt.revertLane,gesture:null,action:kt.action,hasEagerState:kt.hasEagerState,eagerState:kt.eagerState,next:null},lt===null?(Re=lt=qt,re=ee):lt=lt.next=qt,Tn.lanes|=Lt,Tc|=Lt;qt=kt.action,Ku&&b(ee,qt),ee=kt.hasEagerState?kt.eagerState:b(ee,qt)}else Lt={lane:qt,revertLane:kt.revertLane,gesture:kt.gesture,action:kt.action,hasEagerState:kt.hasEagerState,eagerState:kt.eagerState,next:null},lt===null?(Re=lt=Lt,re=ee):lt=lt.next=Lt,Tn.lanes|=qt,Tc|=qt;kt=kt.next}while(kt!==null&&kt!==d);if(lt===null?re=ee:lt.next=Re,!$a(ee,f.memoizedState)&&(Qi=!0,Ot&&(b=uf,b!==null)))throw b;f.memoizedState=ee,f.baseState=re,f.baseQueue=lt,k.lastRenderedState=ee}return G===null&&(k.lanes=0),[f.memoizedState,k.dispatch]}function Gd(f){var d=ji(),b=d.queue;if(b===null)throw Error(s(311));b.lastRenderedReducer=f;var{dispatch:k,pending:G}=b,ee=d.memoizedState;if(G!==null){b.pending=null;var re=G=G.next;do ee=f(ee,re.action),re=re.next;while(re!==G);$a(ee,d.memoizedState)||(Qi=!0),d.memoizedState=ee,d.baseQueue===null&&(d.baseState=ee),b.lastRenderedState=ee}return[ee,k]}function au(f,d,b){var k=Tn,G=ji(),ee=Bn;if(ee){if(b===void 0)throw Error(s(407));b=b()}else b=d();var re=!$a((li||G).memoizedState,b);if(re&&(G.memoizedState=b,Qi=!0),G=G.queue,Nh(nl.bind(null,k,G,f),[f]),G.getSnapshot!==d||re||Yi!==null&&Yi.memoizedState.tag&1){if(k.flags|=2048,ic(9,{destroy:void 0},hu.bind(null,k,G,b,d),null),fi===null)throw Error(s(349));ee||(vl&127)!==0||nc(k,d,b)}return b}function nc(f,d,b){f.flags|=16384,f={getSnapshot:d,value:b},d=Tn.updateQueue,d===null?(d=Oh(),Tn.updateQueue=d,d.stores=[f]):(b=d.stores,b===null?d.stores=[f]:b.push(f))}function hu(f,d,b,k){d.value=b,d.getSnapshot=k,Fh(d)&&Vd(f)}function nl(f,d,b){return b(function(){Fh(d)&&Vd(f)})}function Fh(f){var d=f.getSnapshot;f=f.value;try{var b=d();return!$a(f,b)}catch(k){return!0}}function Vd(f){var d=Yo(f,2);d!==null&&ms(d,f,2)}function fu(f){var d=ds();if(typeof f==="function"){var b=f;if(f=b(),Ku){Ue(!0);try{b()}finally{Ue(!1)}}}return d.memoizedState=d.baseState=f,d.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:za,lastRenderedState:f},d}function bm(f,d,b,k){return f.baseState=b,ia(f,li,typeof k==="function"?k:za)}function M2(f,d,b,k,G){if(rl(f))throw Error(s(485));if(f=d.action,f!==null){var ee={payload:G,action:f,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(re){ee.listeners.push(re)}};sn.T!==null?b(!0):ee.isTransition=!1,k(ee),b=d.pending,b===null?(ee.next=d.pending=ee,wm(d,ee)):(ee.next=b.next,d.pending=b.next=ee)}}function wm(f,d){var{action:b,payload:k}=d,G=f.state;if(d.isTransition){var ee=sn.T,re={};sn.T=re;try{var Re=b(G,k),lt=sn.S;lt!==null&<(re,Re),du(f,d,Re)}catch(kt){Wd(f,d,kt)}finally{ee!==null&&re.types!==null&&(ee.types=re.types),sn.T=ee}}else try{ee=b(G,k),du(f,d,ee)}catch(kt){Wd(f,d,kt)}}function du(f,d,b){b!==null&&typeof b==="object"&&typeof b.then==="function"?b.then(function(k){Xd(f,d,k)},function(k){return Wd(f,d,k)}):Xd(f,d,b)}function Xd(f,d,b){d.status="fulfilled",d.value=b,Kd(d),f.state=b,d=f.pending,d!==null&&(b=d.next,b===d?f.pending=null:(b=b.next,d.next=b,wm(f,b)))}function Wd(f,d,b){var k=f.pending;if(f.pending=null,k!==null){k=k.next;do d.status="rejected",d.reason=b,Kd(d),d=d.next;while(d!==k)}f.action=null}function Kd(f){f=f.listeners;for(var d=0;d<f.length;d++)(0,f[d])()}function ym(f,d){return d}function $d(f,d){if(Bn){var b=fi.formState;if(b!==null){e:{var k=Tn;if(Bn){if(Ei){var G=qC(Ei,vr);if(G){Ei=Y9(G),k=DC(G);break e}}Rn(k)}k=!1}k&&(d=b[0])}}b=ds(),b.memoizedState=b.baseState=d,k={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ym,lastRenderedState:d},b.queue=k,b=_u.bind(null,Tn,k),k.dispatch=b,k=fu(!1);var ee=Ga.bind(null,Tn,!1,k.queue);return k=ds(),G={state:d,dispatch:null,action:f,pending:null},k.queue=G,b=M2.bind(null,Tn,G,ee,b),G.dispatch=b,k.memoizedState=f,[d,b,!1]}function vm(f){var d=ji();return pu(d,li,f)}function pu(f,d,b){if(d=ia(f,d,ym)[0],f=tc(za)[0],typeof d==="object"&&d!==null&&typeof d.then==="function")try{var k=ga(d)}catch(re){if(re===hf)throw qg;throw re}else k=d;d=ji();var G=d.queue,ee=G.dispatch;return b!==d.memoizedState&&(Tn.flags|=2048,ic(9,{destroy:void 0},mu.bind(null,G,b),null)),[k,ee,f]}function mu(f,d){f.action=d}function Yd(f){var d=ji(),b=li;if(b!==null)return pu(d,b,f);ji(),d=d.memoizedState,b=ji();var k=b.queue.dispatch;return b.memoizedState=f,[d,k,!1]}function ic(f,d,b,k){return f={tag:f,create:b,deps:k,inst:d,next:null},d=Tn.updateQueue,d===null&&(d=Oh(),Tn.updateQueue=d),b=d.lastEffect,b===null?d.lastEffect=f.next=f:(k=b.next,b.next=f,f.next=k,d.lastEffect=f),f}function Sm(){return ji().memoizedState}function gu(f,d,b,k){var G=ds();Tn.flags|=f,G.memoizedState=ic(1|d,{destroy:void 0},b,k===void 0?null:k)}function bu(f,d,b,k){var G=ji();k=k===void 0?null:k;var ee=G.memoizedState.inst;li!==null&&k!==null&&Ql(k,li.memoizedState.deps)?G.memoizedState=ic(d,ee,b,k):(Tn.flags|=f,G.memoizedState=ic(1|d,ee,b,k))}function _m(f,d){gu(8390656,8,f,d)}function Nh(f,d){bu(2048,8,f,d)}function R2(f){Tn.flags|=4;var d=Tn.updateQueue;if(d===null)d=Oh(),Tn.updateQueue=d,d.events=[f];else{var b=d.events;b===null?d.events=[f]:b.push(f)}}function xm(f){var d=ji().memoizedState;return R2({ref:d,nextImpl:f}),function(){if((qn&2)!==0)throw Error(s(440));return d.impl.apply(void 0,arguments)}}function km(f,d){return bu(4,2,f,d)}function Tm(f,d){return bu(4,4,f,d)}function Am(f,d){if(typeof d==="function"){f=f();var b=d(f);return function(){typeof b==="function"?b():d(null)}}if(d!==null&&d!==void 0)return f=f(),d.current=f,function(){d.current=null}}function Cm(f,d,b){b=b!==null&&b!==void 0?b.concat([f]):null,bu(4,4,Am.bind(null,d,f),b)}function wu(){}function jm(f,d){var b=ji();d=d===void 0?null:d;var k=b.memoizedState;if(d!==null&&Ql(d,k[1]))return k[0];return b.memoizedState=[f,d],f}function Qd(f,d){var b=ji();d=d===void 0?null:d;var k=b.memoizedState;if(d!==null&&Ql(d,k[1]))return k[0];if(k=f(),Ku){Ue(!0);try{f()}finally{Ue(!1)}}return b.memoizedState=[k,d],k}function sc(f,d,b){if(b===void 0||(vl&1073741824)!==0&&(Nn&261930)===0)return f.memoizedState=d;return f.memoizedState=b,f=v0(),Tn.lanes|=f,Tc|=f,b}function Em(f,d,b,k){if($a(b,d))return b;if(pf.current!==null)return f=sc(f,b,k),$a(f,d)||(Qi=!0),f;if((vl&42)===0||(vl&1073741824)!==0&&(Nn&261930)===0)return Qi=!0,f.memoizedState=b;return f=v0(),Tn.lanes|=f,Tc|=f,d}function qm(f,d,b,k,G){var ee=wl();gs(ee!==0&&8>ee?ee:8);var re=sn.T,Re={};sn.T=Re,Ga(f,!1,d,b);try{var lt=G(),kt=sn.S;if(kt!==null&&kt(Re,lt),lt!==null&&typeof lt==="object"&&typeof lt.then==="function"){var Ot=Ut(lt,k);js(f,d,Ot,ka(f))}else js(f,d,k,ka(f))}catch(qt){js(f,d,{then:function(){},status:"rejected",reason:qt},ka())}finally{gs(ee),re!==null&&Re.types!==null&&(re.types=Re.types),sn.T=re}}function Dm(f){var d=f.memoizedState;if(d!==null)return d;d={memoizedState:tf,baseState:tf,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:za,lastRenderedState:tf},next:null};var b={};return d.next={memoizedState:b,baseState:b,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:za,lastRenderedState:b},next:null},f.memoizedState=d,f=f.alternate,f!==null&&(f.memoizedState=d),d}function Jd(){return Cn(Hu)}function Im(){return ji().memoizedState}function yu(){return ji().memoizedState}function vu(f){for(var d=f.return;d!==null;){switch(d.tag){case 24:case 3:var b=ka();f=On(b);var k=oo(d,f,b);k!==null&&(ms(k,d,b),lo(k,d,b)),d={cache:os()},f.payload=d;return}d=d.return}}function Su(f,d,b){var k=ka();b={lane:k,revertLane:0,gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null},rl(f)?Zd(d,b):(b=us(f,d,b,k),b!==null&&(ms(b,f,k),Mm(b,d,k)))}function _u(f,d,b){var k=ka();js(f,d,b,k)}function js(f,d,b,k){var G={lane:k,revertLane:0,gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null};if(rl(f))Zd(d,G);else{var ee=f.alternate;if(f.lanes===0&&(ee===null||ee.lanes===0)&&(ee=d.lastRenderedReducer,ee!==null))try{var re=d.lastRenderedState,Re=ee(re,b);if(G.hasEagerState=!0,G.eagerState=Re,$a(Re,re))return $o(f,d,G,0),fi===null&&Kl(),!1}catch(lt){}finally{}if(b=us(f,d,G,k),b!==null)return ms(b,f,k),Mm(b,d,k),!0}return!1}function Ga(f,d,b,k){if(k={lane:2,revertLane:ao(),gesture:null,action:k,hasEagerState:!1,eagerState:null,next:null},rl(f)){if(d)throw Error(s(479))}else d=us(f,b,k,2),d!==null&&ms(d,f,2)}function rl(f){var d=f.alternate;return f===Tn||d!==null&&d===Tn}function Zd(f,d){mf=Mg=!0;var b=f.pending;b===null?d.next=d:(d.next=b.next,b.next=d),f.pending=d}function Mm(f,d,b){if((b&4194048)!==0){var k=d.lanes;k&=f.pendingLanes,b|=k,d.lanes=b,we(f,b)}}function e0(f,d,b,k){d=f.memoizedState,b=b(k,d),b=b===null||b===void 0?d:ra({},d,b),f.memoizedState=b,f.lanes===0&&(f.updateQueue.baseState=b)}function Rm(f,d,b,k,G,ee,re){return f=f.stateNode,typeof f.shouldComponentUpdate==="function"?f.shouldComponentUpdate(k,ee,re):d.prototype&&d.prototype.isPureReactComponent?!Et(b,k)||!Et(G,ee):!0}function Om(f,d,b,k){f=d.state,typeof d.componentWillReceiveProps==="function"&&d.componentWillReceiveProps(b,k),typeof d.UNSAFE_componentWillReceiveProps==="function"&&d.UNSAFE_componentWillReceiveProps(b,k),d.state!==f&&cw.enqueueReplaceState(d,d.state,null)}function Lr(f,d){var b=d;if("ref"in d){b={};for(var k in d)k!=="ref"&&(b[k]=d[k])}if(f=f.defaultProps){b===d&&(b=ra({},b));for(var G in f)b[G]===void 0&&(b[G]=f[G])}return b}function ac(f,d){try{var b=f.onUncaughtError;b(d.value,{componentStack:d.stack})}catch(k){setTimeout(function(){throw k})}}function rc(f,d,b){try{var k=f.onCaughtError;k(b.value,{componentStack:b.stack,errorBoundary:d.tag===1?d.stateNode:null})}catch(G){setTimeout(function(){throw G})}}function uo(f,d,b){return b=On(b),b.tag=3,b.payload={element:null},b.callback=function(){ac(f,d)},b}function xu(f){return f=On(f),f.tag=3,f}function ho(f,d,b,k){var G=b.type.getDerivedStateFromError;if(typeof G==="function"){var ee=k.value;f.payload=function(){return G(ee)},f.callback=function(){rc(d,b,k)}}var re=b.stateNode;re!==null&&typeof re.componentDidCatch==="function"&&(f.callback=function(){rc(d,b,k),typeof G!=="function"&&(Ac===null?Ac=new Set([this]):Ac.add(this));var Re=k.stack;this.componentDidCatch(k.value,{componentStack:Re!==null?Re:""})})}function O2(f,d,b,k,G){if(b.flags|=32768,k!==null&&typeof k==="object"&&typeof k.then==="function"){if(d=b.alternate,d!==null&&oi(d,b,G,!0),b=Ya.current,b!==null){switch(b.tag){case 31:case 13:return _r===null?Pu():b.alternate===null&&Li===0&&(Li=3),b.flags&=-257,b.flags|=65536,b.lanes=G,k===Dg?b.flags|=16384:(d=b.updateQueue,d===null?b.updateQueue=new Set([k]):d.add(k),F(f,k,G)),!1;case 22:return b.flags|=65536,k===Dg?b.flags|=16384:(d=b.updateQueue,d===null?(d={transitions:null,markerInstances:null,retryQueue:new Set([k])},b.updateQueue=d):(b=d.retryQueue,b===null?d.retryQueue=new Set([k]):b.add(k)),F(f,k,G)),!1}throw Error(s(435,b.tag))}return F(f,k,G),Pu(),!1}if(Bn)return d=Ya.current,d!==null?((d.flags&65536)===0&&(d.flags|=256),d.flags|=65536,d.lanes=G,k!==tw&&(f=Error(s(422),{cause:k}),zi(Ve(f,b)))):(k!==tw&&(d=Error(s(423),{cause:k}),zi(Ve(d,b))),f=f.current.alternate,f.flags|=65536,G&=-G,f.lanes|=G,k=Ve(k,b),G=uo(f.stateNode,k,G),Yl(f,G),Li!==4&&(Li=2)),!1;var ee=Error(s(520),{cause:k});if(ee=Ve(ee,b),F0===null?F0=[ee]:F0.push(ee),Li!==4&&(Li=2),d===null)return!0;k=Ve(k,b),b=d;do{switch(b.tag){case 3:return b.flags|=65536,f=G&-G,b.lanes|=f,f=uo(b.stateNode,k,f),Yl(b,f),!1;case 1:if(d=b.type,ee=b.stateNode,(b.flags&128)===0&&(typeof d.getDerivedStateFromError==="function"||ee!==null&&typeof ee.componentDidCatch==="function"&&(Ac===null||!Ac.has(ee))))return b.flags|=65536,G&=-G,b.lanes|=G,G=xu(G),ho(G,f,b,k),Yl(b,G),!1}b=b.return}while(b!==null);return!1}function $i(f,d,b,k){d.child=f===null?d4(d,null,b,k):Wu(d,f.child,b,k)}function t0(f,d,b,k,G){b=b.render;var ee=d.ref;if("ref"in k){var re={};for(var Re in k)Re!=="ref"&&(re[Re]=k[Re])}else re=k;if(Si(d),k=Jl(f,d,b,re,ee,G),Re=Jo(),f!==null&&!Qi)return el(f,d,G),dr(f,d,G);return Bn&&Re&&ct(d),d.flags|=1,$i(f,d,k,G),d.child}function Ph(f,d,b,k,G){if(f===null){var ee=b.type;if(typeof ee==="function"&&!Le(ee)&&ee.defaultProps===void 0&&b.compare===null)return d.tag=15,d.type=ee,Fm(f,d,ee,k,G);return f=ft(b.type,null,k,d,d.mode,G),f.ref=d.ref,f.return=d,d.child=f}if(ee=f.child,!r0(f,G)){var re=ee.memoizedProps;if(b=b.compare,b=b!==null?b:Et,b(re,k)&&f.ref===d.ref)return dr(f,d,G)}return d.flags|=1,f=Qe(ee,k),f.ref=d.ref,f.return=d,d.child=f}function Fm(f,d,b,k,G){if(f!==null){var ee=f.memoizedProps;if(Et(ee,k)&&f.ref===d.ref)if(Qi=!1,d.pendingProps=k=ee,r0(f,G))(f.flags&131072)!==0&&(Qi=!0);else return d.lanes=f.lanes,dr(f,d,G)}return Uh(f,d,b,k,G)}function Nm(f,d,b,k){var G=k.children,ee=f!==null?f.memoizedState:null;if(f===null&&d.stateNode===null&&(d.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),k.mode==="hidden"){if((d.flags&128)!==0){if(ee=ee!==null?ee.baseLanes|b:b,f!==null){k=d.child=f.child;for(G=0;k!==null;)G=G|k.lanes|k.childLanes,k=k.sibling;k=G&~ee}else k=0,d.child=null;return Tu(f,d,ee,b,k)}if((b&536870912)!==0)d.memoizedState={baseLanes:0,cachePool:null},f!==null&&ei(d,ee!==null?ee.cachePool:null),ee!==null?iu(d,ee):Bd(),Mh(d);else return k=d.lanes=536870912,Tu(f,d,ee!==null?ee.baseLanes|b:b,b,k)}else ee!==null?(ei(d,ee.cachePool),iu(d,ee),fr(d),d.memoizedState=null):(f!==null&&ei(d,null),Bd(),fr(d));return $i(f,d,G,b),d.child}function ku(f,d){return f!==null&&f.tag===22||d.stateNode!==null||(d.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.sibling}function Tu(f,d,b,k,G){var ee=Yt();return ee=ee===null?null:{parent:gl?qi._currentValue:qi._currentValue2,pool:ee},d.memoizedState={baseLanes:b,cachePool:ee},f!==null&&ei(d,null),Bd(),Mh(d),f!==null&&oi(f,d,k,!0),d.childLanes=G,null}function Bh(f,d){return d=qu({mode:d.mode,children:d.children},f.mode),d.ref=f.ref,f.child=d,d.return=f,d}function Lh(f,d,b){return Wu(d,f.child,null,b),f=Bh(d,d.pendingProps),f.flags|=2,Xs(d),d.memoizedState=null,f}function F2(f,d,b){var k=d.pendingProps,G=(d.flags&128)!==0;if(d.flags&=-129,f===null){if(Bn){if(k.mode==="hidden")return f=Bh(d,k),d.lanes=536870912,ku(null,f);if(Ih(d),(f=Ei)?(f=LC(f,vr),f!==null&&(d.memoizedState={dehydrated:f,treeContext:vc!==null?{id:bo,overflow:yo}:null,retryLane:536870912,hydrationErrors:null},b=Vi(f),b.return=d,d.child=b,Rs=d,Ei=null)):f=null,f===null)throw Rn(d);return d.lanes=536870912,null}return Bh(d,k)}var ee=f.memoizedState;if(ee!==null){var re=ee.dehydrated;if(Ih(d),G)if(d.flags&256)d.flags&=-257,d=Lh(f,d,b);else if(d.memoizedState!==null)d.child=f.child,d.flags|=128,d=null;else throw Error(s(558));else if(Qi||oi(f,d,b,!1),G=(b&f.childLanes)!==0,Qi||G){if(k=fi,k!==null&&(re=Ce(k,b),re!==0&&re!==ee.retryLane))throw ee.retryLane=re,Yo(f,re),ms(k,f,re),uw;Pu(),d=Lh(f,d,b)}else f=ee.treeContext,$s&&(Ei=OC(re),Rs=d,Bn=!0,_c=null,vr=!1,f!==null&&mt(d,f)),d=Bh(d,k),d.flags|=4096;return d}return f=Qe(f.child,{mode:k.mode,children:k.children}),f.ref=d.ref,d.child=f,f.return=d,f}function Hh(f,d){var b=d.ref;if(b===null)f!==null&&f.ref!==null&&(d.flags|=4194816);else{if(typeof b!=="function"&&typeof b!=="object")throw Error(s(284));if(f===null||f.ref!==b)d.flags|=4194816}}function Uh(f,d,b,k,G){if(Si(d),b=Jl(f,d,b,k,void 0,G),k=Jo(),f!==null&&!Qi)return el(f,d,G),dr(f,d,G);return Bn&&k&&ct(d),d.flags|=1,$i(f,d,b,G),d.child}function Au(f,d,b,k,G,ee){if(Si(d),d.updateQueue=null,b=ec(d,k,b,G),Hd(f),k=Jo(),f!==null&&!Qi)return el(f,d,ee),dr(f,d,ee);return Bn&&k&&ct(d),d.flags|=1,$i(f,d,b,ee),d.child}function Pm(f,d,b,k,G){if(Si(d),d.stateNode===null){var ee=af,re=b.contextType;typeof re==="object"&&re!==null&&(ee=Cn(re)),ee=new b(k,ee),d.memoizedState=ee.state!==null&&ee.state!==void 0?ee.state:null,ee.updater=cw,d.stateNode=ee,ee._reactInternals=d,ee=d.stateNode,ee.props=k,ee.state=d.memoizedState,ee.refs={},Ha(d),re=b.contextType,ee.context=typeof re==="object"&&re!==null?Cn(re):af,ee.state=d.memoizedState,re=b.getDerivedStateFromProps,typeof re==="function"&&(e0(d,b,re,k),ee.state=d.memoizedState),typeof b.getDerivedStateFromProps==="function"||typeof ee.getSnapshotBeforeUpdate==="function"||typeof ee.UNSAFE_componentWillMount!=="function"&&typeof ee.componentWillMount!=="function"||(re=ee.state,typeof ee.componentWillMount==="function"&&ee.componentWillMount(),typeof ee.UNSAFE_componentWillMount==="function"&&ee.UNSAFE_componentWillMount(),re!==ee.state&&cw.enqueueReplaceState(ee,ee.state,null),Ua(d,k,ee,G),tu(),ee.state=d.memoizedState),typeof ee.componentDidMount==="function"&&(d.flags|=4194308),k=!0}else if(f===null){ee=d.stateNode;var Re=d.memoizedProps,lt=Lr(b,Re);ee.props=lt;var kt=ee.context,Ot=b.contextType;re=af,typeof Ot==="object"&&Ot!==null&&(re=Cn(Ot));var qt=b.getDerivedStateFromProps;Ot=typeof qt==="function"||typeof ee.getSnapshotBeforeUpdate==="function",Re=d.pendingProps!==Re,Ot||typeof ee.UNSAFE_componentWillReceiveProps!=="function"&&typeof ee.componentWillReceiveProps!=="function"||(Re||kt!==re)&&Om(d,ee,k,re),xc=!1;var Lt=d.memoizedState;ee.state=Lt,Ua(d,k,ee,G),tu(),kt=d.memoizedState,Re||Lt!==kt||xc?(typeof qt==="function"&&(e0(d,b,qt,k),kt=d.memoizedState),(lt=xc||Rm(d,b,lt,k,Lt,kt,re))?(Ot||typeof ee.UNSAFE_componentWillMount!=="function"&&typeof ee.componentWillMount!=="function"||(typeof ee.componentWillMount==="function"&&ee.componentWillMount(),typeof ee.UNSAFE_componentWillMount==="function"&&ee.UNSAFE_componentWillMount()),typeof ee.componentDidMount==="function"&&(d.flags|=4194308)):(typeof ee.componentDidMount==="function"&&(d.flags|=4194308),d.memoizedProps=k,d.memoizedState=kt),ee.props=k,ee.state=kt,ee.context=re,k=lt):(typeof ee.componentDidMount==="function"&&(d.flags|=4194308),k=!1)}else{ee=d.stateNode,$l(f,d),re=d.memoizedProps,Ot=Lr(b,re),ee.props=Ot,qt=d.pendingProps,Lt=ee.context,kt=b.contextType,lt=af,typeof kt==="object"&&kt!==null&&(lt=Cn(kt)),Re=b.getDerivedStateFromProps,(kt=typeof Re==="function"||typeof ee.getSnapshotBeforeUpdate==="function")||typeof ee.UNSAFE_componentWillReceiveProps!=="function"&&typeof ee.componentWillReceiveProps!=="function"||(re!==qt||Lt!==lt)&&Om(d,ee,k,lt),xc=!1,Lt=d.memoizedState,ee.state=Lt,Ua(d,k,ee,G),tu();var _n=d.memoizedState;re!==qt||Lt!==_n||xc||f!==null&&f.dependencies!==null&&fn(f.dependencies)?(typeof Re==="function"&&(e0(d,b,Re,k),_n=d.memoizedState),(Ot=xc||Rm(d,b,Ot,k,Lt,_n,lt)||f!==null&&f.dependencies!==null&&fn(f.dependencies))?(kt||typeof ee.UNSAFE_componentWillUpdate!=="function"&&typeof ee.componentWillUpdate!=="function"||(typeof ee.componentWillUpdate==="function"&&ee.componentWillUpdate(k,_n,lt),typeof ee.UNSAFE_componentWillUpdate==="function"&&ee.UNSAFE_componentWillUpdate(k,_n,lt)),typeof ee.componentDidUpdate==="function"&&(d.flags|=4),typeof ee.getSnapshotBeforeUpdate==="function"&&(d.flags|=1024)):(typeof ee.componentDidUpdate!=="function"||re===f.memoizedProps&&Lt===f.memoizedState||(d.flags|=4),typeof ee.getSnapshotBeforeUpdate!=="function"||re===f.memoizedProps&&Lt===f.memoizedState||(d.flags|=1024),d.memoizedProps=k,d.memoizedState=_n),ee.props=k,ee.state=_n,ee.context=lt,k=Ot):(typeof ee.componentDidUpdate!=="function"||re===f.memoizedProps&&Lt===f.memoizedState||(d.flags|=4),typeof ee.getSnapshotBeforeUpdate!=="function"||re===f.memoizedProps&&Lt===f.memoizedState||(d.flags|=1024),k=!1)}return ee=k,Hh(f,d),k=(d.flags&128)!==0,ee||k?(ee=d.stateNode,b=k&&typeof b.getDerivedStateFromError!=="function"?null:ee.render(),d.flags|=1,f!==null&&k?(d.child=Wu(d,f.child,null,G),d.child=Wu(d,null,b,G)):$i(f,d,b,G),d.memoizedState=ee.state,f=d.child):f=dr(f,d,G),f}function Bm(f,d,b,k){return Ai(),d.flags|=256,$i(f,d,b,k),d.child}function n0(f){return{baseLanes:f,cachePool:Ki()}}function Cu(f,d,b){return f=f!==null?f.childLanes&~b:0,d&&(f|=Ja),f}function Lm(f,d,b){var k=d.pendingProps,G=!1,ee=(d.flags&128)!==0,re;if((re=ee)||(re=f!==null&&f.memoizedState===null?!1:(Xi.current&2)!==0),re&&(G=!0,d.flags&=-129),re=(d.flags&32)!==0,d.flags&=-33,f===null){if(Bn){if(G?co(d):fr(d),(f=Ei)?(f=HC(f,vr),f!==null&&(d.memoizedState={dehydrated:f,treeContext:vc!==null?{id:bo,overflow:yo}:null,retryLane:536870912,hydrationErrors:null},b=Vi(f),b.return=d,d.child=b,Rs=d,Ei=null)):f=null,f===null)throw Rn(d);return K2(f)?d.lanes=32:d.lanes=536870912,null}var Re=k.children;if(k=k.fallback,G)return fr(d),G=d.mode,Re=qu({mode:"hidden",children:Re},G),k=zt(k,G,b,null),Re.return=d,k.return=d,Re.sibling=k,d.child=Re,k=d.child,k.memoizedState=n0(b),k.childLanes=Cu(f,re,b),d.memoizedState=hw,ku(null,k);return co(d),Eu(d,Re)}var lt=f.memoizedState;if(lt!==null&&(Re=lt.dehydrated,Re!==null)){if(ee)d.flags&256?(co(d),d.flags&=-257,d=i0(f,d,b)):d.memoizedState!==null?(fr(d),d.child=f.child,d.flags|=128,d=null):(fr(d),Re=k.fallback,G=d.mode,k=qu({mode:"visible",children:k.children},G),Re=zt(Re,G,b,null),Re.flags|=2,k.return=d,Re.return=d,k.sibling=Re,d.child=k,Wu(d,f.child,null,b),k=d.child,k.memoizedState=n0(b),k.childLanes=Cu(f,re,b),d.memoizedState=hw,d=ku(null,k));else if(co(d),K2(Re))re=jC(Re).digest,k=Error(s(419)),k.stack="",k.digest=re,zi({value:k,source:null,stack:null}),d=i0(f,d,b);else if(Qi||oi(f,d,b,!1),re=(b&f.childLanes)!==0,Qi||re){if(re=fi,re!==null&&(k=Ce(re,b),k!==0&&k!==lt.retryLane))throw lt.retryLane=k,Yo(f,k),ms(re,f,k),uw;W2(Re)||Pu(),d=i0(f,d,b)}else W2(Re)?(d.flags|=192,d.child=f.child,d=null):(f=lt.treeContext,$s&&(Ei=FC(Re),Rs=d,Bn=!0,_c=null,vr=!1,f!==null&&mt(d,f)),d=Eu(d,k.children),d.flags|=4096);return d}if(G)return fr(d),Re=k.fallback,G=d.mode,lt=f.child,ee=lt.sibling,k=Qe(lt,{mode:"hidden",children:k.children}),k.subtreeFlags=lt.subtreeFlags&65011712,ee!==null?Re=Qe(ee,Re):(Re=zt(Re,G,b,null),Re.flags|=2),Re.return=d,k.return=d,k.sibling=Re,d.child=k,ku(null,k),k=d.child,Re=f.child.memoizedState,Re===null?Re=n0(b):(G=Re.cachePool,G!==null?(lt=gl?qi._currentValue:qi._currentValue2,G=G.parent!==lt?{parent:lt,pool:lt}:G):G=Ki(),Re={baseLanes:Re.baseLanes|b,cachePool:G}),k.memoizedState=Re,k.childLanes=Cu(f,re,b),d.memoizedState=hw,ku(f.child,k);return co(d),b=f.child,f=b.sibling,b=Qe(b,{mode:"visible",children:k.children}),b.return=d,b.sibling=null,f!==null&&(re=d.deletions,re===null?(d.deletions=[f],d.flags|=16):re.push(f)),d.child=b,d.memoizedState=null,b}function Eu(f,d){return d=qu({mode:"visible",children:d},f.mode),d.return=f,f.child=d}function qu(f,d){return f=n(22,f,null,d),f.lanes=0,f}function i0(f,d,b){return Wu(d,f.child,null,b),f=Eu(d,d.pendingProps.children),f.flags|=2,d.memoizedState=null,f}function Hm(f,d,b){f.lanes|=d;var k=f.alternate;k!==null&&(k.lanes|=d),cn(f.return,d,b)}function a0(f,d,b,k,G,ee){var re=f.memoizedState;re===null?f.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:k,tail:b,tailMode:G,treeForkCount:ee}:(re.isBackwards=d,re.rendering=null,re.renderingStartTime=0,re.last=k,re.tail=b,re.tailMode=G,re.treeForkCount=ee)}function Um(f,d,b){var k=d.pendingProps,G=k.revealOrder,ee=k.tail;k=k.children;var re=Xi.current,Re=(re&2)!==0;if(Re?(re=re&1|2,d.flags|=128):re&=1,j(Xi,re),$i(f,d,k,b),k=Bn?j0:0,!Re&&f!==null&&(f.flags&128)!==0)e:for(f=d.child;f!==null;){if(f.tag===13)f.memoizedState!==null&&Hm(f,b,d);else if(f.tag===19)Hm(f,b,d);else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===d)break e;for(;f.sibling===null;){if(f.return===null||f.return===d)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}switch(G){case"forwards":b=d.child;for(G=null;b!==null;)f=b.alternate,f!==null&&Rh(f)===null&&(G=b),b=b.sibling;b=G,b===null?(G=d.child,d.child=null):(G=b.sibling,b.sibling=null),a0(d,!1,G,b,ee,k);break;case"backwards":case"unstable_legacy-backwards":b=null,G=d.child;for(d.child=null;G!==null;){if(f=G.alternate,f!==null&&Rh(f)===null){d.child=G;break}f=G.sibling,G.sibling=b,b=G,G=f}a0(d,!0,b,null,ee,k);break;case"together":a0(d,!1,null,null,void 0,k);break;default:d.memoizedState=null}return d.child}function dr(f,d,b){if(f!==null&&(d.dependencies=f.dependencies),Tc|=d.lanes,(b&d.childLanes)===0)if(f!==null){if(oi(f,d,b,!1),(b&d.childLanes)===0)return null}else return null;if(f!==null&&d.child!==f.child)throw Error(s(153));if(d.child!==null){f=d.child,b=Qe(f,f.pendingProps),d.child=b;for(b.return=d;f.sibling!==null;)f=f.sibling,b=b.sibling=Qe(f,f.pendingProps),b.return=d;b.sibling=null}return d.child}function r0(f,d){if((f.lanes&d)!==0)return!0;return f=f.dependencies,f!==null&&fn(f)?!0:!1}function zm(f,d,b){switch(d.tag){case 3:Xt(d,d.stateNode.containerInfo),Ht(d,qi,f.memoizedState.cache),Ai();break;case 27:case 5:nn(d);break;case 4:Xt(d,d.stateNode.containerInfo);break;case 10:Ht(d,d.type,d.memoizedProps.value);break;case 31:if(d.memoizedState!==null)return d.flags|=128,Ih(d),null;break;case 13:var k=d.memoizedState;if(k!==null){if(k.dehydrated!==null)return co(d),d.flags|=128,null;if((b&d.child.childLanes)!==0)return Lm(f,d,b);return co(d),f=dr(f,d,b),f!==null?f.sibling:null}co(d);break;case 19:var G=(f.flags&128)!==0;if(k=(b&d.childLanes)!==0,k||(oi(f,d,b,!1),k=(b&d.childLanes)!==0),G){if(k)return Um(f,d,b);d.flags|=128}if(G=d.memoizedState,G!==null&&(G.rendering=null,G.tail=null,G.lastEffect=null),j(Xi,Xi.current),k)break;else return null;case 22:return d.lanes=0,Nm(f,d,b,d.pendingProps);case 24:Ht(d,qi,f.memoizedState.cache)}return dr(f,d,b)}function Gm(f,d,b){if(f!==null)if(f.memoizedProps!==d.pendingProps)Qi=!0;else{if(!r0(f,b)&&(d.flags&128)===0)return Qi=!1,zm(f,d,b);Qi=(f.flags&131072)!==0?!0:!1}else Qi=!1,Bn&&(d.flags&1048576)!==0&&Ct(d,j0,d.index);switch(d.lanes=0,d.tag){case 16:e:{var k=d.pendingProps;if(f=Kt(d.elementType),d.type=f,typeof f==="function")Le(f)?(k=Lr(f,k),d.tag=1,d=Pm(null,d,f,k,b)):(d.tag=0,d=Uh(null,d,f,k,b));else{if(f!==void 0&&f!==null){var G=f.$$typeof;if(G===L2){d.tag=11,d=t0(null,d,f,k,b);break e}else if(G===z2){d.tag=14,d=Ph(null,d,f,k,b);break e}}throw d=g(f)||f,Error(s(306,d,""))}}return d;case 0:return Uh(f,d,d.type,d.pendingProps,b);case 1:return k=d.type,G=Lr(k,d.pendingProps),Pm(f,d,k,G,b);case 3:e:{if(Xt(d,d.stateNode.containerInfo),f===null)throw Error(s(387));var ee=d.pendingProps;G=d.memoizedState,k=G.element,$l(f,d),Ua(d,ee,null,b);var re=d.memoizedState;if(ee=re.cache,Ht(d,qi,ee),ee!==G.cache&&pn(d,[qi],b,!0),tu(),ee=re.element,$s&&G.isDehydrated)if(G={element:ee,isDehydrated:!1,cache:re.cache},d.updateQueue.baseState=G,d.memoizedState=G,d.flags&256){d=Bm(f,d,ee,b);break e}else if(ee!==k){k=Ve(Error(s(424)),d),zi(k),d=Bm(f,d,ee,b);break e}else for($s&&(Ei=RC(d.stateNode.containerInfo),Rs=d,Bn=!0,_c=null,vr=!0),b=d4(d,null,ee,b),d.child=b;b;)b.flags=b.flags&-3|4096,b=b.sibling;else{if(Ai(),ee===k){d=dr(f,d,b);break e}$i(f,d,ee,b)}d=d.child}return d;case 26:if(zr)return Hh(f,d),f===null?(b=Z9(d.type,null,d.pendingProps,null))?d.memoizedState=b:Bn||(d.stateNode=lj(d.type,d.pendingProps,Sc.current,d)):d.memoizedState=Z9(d.type,f.memoizedProps,d.pendingProps,f.memoizedState),null;case 27:if(is)return nn(d),f===null&&is&&Bn&&(k=d.stateNode=a4(d.type,d.pendingProps,Sc.current,Ms.current,!1),Rs=d,vr=!0,Ei=NC(d.type,k,Ei)),$i(f,d,d.pendingProps.children,b),Hh(f,d),f===null&&(d.flags|=4194304),d.child;case 5:if(f===null&&Bn){if(aj(d.type,d.pendingProps,Ms.current),G=k=Ei)k=PC(k,d.type,d.pendingProps,vr),k!==null?(d.stateNode=k,Rs=d,Ei=MC(k),vr=!1,G=!0):G=!1;G||Rn(d)}return nn(d),G=d.type,ee=d.pendingProps,re=f!==null?f.memoizedProps:null,k=ee.children,vg(G,ee)?k=null:re!==null&&vg(G,re)&&(d.flags|=32),d.memoizedState!==null&&(G=Jl(f,d,su,null,null,b),gl?Hu._currentValue=G:Hu._currentValue2=G),Hh(f,d),$i(f,d,k,b),d.child;case 6:if(f===null&&Bn){if(rj(d.pendingProps,Ms.current),f=b=Ei)b=BC(b,d.pendingProps,vr),b!==null?(d.stateNode=b,Rs=d,Ei=null,f=!0):f=!1;f||Rn(d)}return null;case 13:return Lm(f,d,b);case 4:return Xt(d,d.stateNode.containerInfo),k=d.pendingProps,f===null?d.child=Wu(d,null,k,b):$i(f,d,k,b),d.child;case 11:return t0(f,d,d.type,d.pendingProps,b);case 7:return $i(f,d,d.pendingProps,b),d.child;case 8:return $i(f,d,d.pendingProps.children,b),d.child;case 12:return $i(f,d,d.pendingProps.children,b),d.child;case 10:return k=d.pendingProps,Ht(d,d.type,k.value),$i(f,d,k.children,b),d.child;case 9:return G=d.type._context,k=d.pendingProps.children,Si(d),G=Cn(G),k=k(G),d.flags|=1,$i(f,d,k,b),d.child;case 14:return Ph(f,d,d.type,d.pendingProps,b);case 15:return Fm(f,d,d.type,d.pendingProps,b);case 19:return Um(f,d,b);case 31:return F2(f,d,b);case 22:return Nm(f,d,b,d.pendingProps);case 24:return Si(d),k=Cn(qi),f===null?(G=Yt(),G===null&&(G=fi,ee=os(),G.pooledCache=ee,ee.refCount++,ee!==null&&(G.pooledCacheLanes|=b),G=ee),d.memoizedState={parent:k,cache:G},Ha(d),Ht(d,qi,G)):((f.lanes&b)!==0&&($l(f,d),Ua(d,null,null,b),tu()),G=f.memoizedState,ee=d.memoizedState,G.parent!==k?(G={parent:k,cache:k},d.memoizedState=G,d.lanes===0&&(d.memoizedState=d.updateQueue.baseState=G),Ht(d,qi,k)):(k=ee.cache,Ht(d,qi,k),k!==G.cache&&pn(d,[qi],b,!0))),$i(f,d,d.pendingProps.children,b),d.child;case 29:throw d.pendingProps}throw Error(s(156,d.tag))}function wa(f){f.flags|=4}function Gi(f){go&&(f.flags|=8)}function zh(f,d){if(f!==null&&f.child===d.child)return!1;if((d.flags&16)!==0)return!0;for(f=d.child;f!==null;){if((f.flags&8218)!==0||(f.subtreeFlags&8218)!==0)return!0;f=f.sibling}return!1}function Ws(f,d,b,k){if(Ks)for(b=d.child;b!==null;){if(b.tag===5||b.tag===6)V2(f,b.stateNode);else if(!(b.tag===4||is&&b.tag===27)&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===d)break;for(;b.sibling===null;){if(b.return===null||b.return===d)return;b=b.return}b.sibling.return=b.return,b=b.sibling}else if(go)for(var G=d.child;G!==null;){if(G.tag===5){var ee=G.stateNode;b&&k&&(ee=K9(ee,G.type,G.memoizedProps)),V2(f,ee)}else if(G.tag===6)ee=G.stateNode,b&&k&&(ee=$9(ee,G.memoizedProps)),V2(f,ee);else if(G.tag!==4){if(G.tag===22&&G.memoizedState!==null)ee=G.child,ee!==null&&(ee.return=G),Ws(f,G,!0,!0);else if(G.child!==null){G.child.return=G,G=G.child;continue}}if(G===d)break;for(;G.sibling===null;){if(G.return===null||G.return===d)return;G=G.return}G.sibling.return=G.return,G=G.sibling}}function oc(f,d,b,k){var G=!1;if(go)for(var ee=d.child;ee!==null;){if(ee.tag===5){var re=ee.stateNode;b&&k&&(re=K9(re,ee.type,ee.memoizedProps)),X9(f,re)}else if(ee.tag===6)re=ee.stateNode,b&&k&&(re=$9(re,ee.memoizedProps)),X9(f,re);else if(ee.tag!==4){if(ee.tag===22&&ee.memoizedState!==null)G=ee.child,G!==null&&(G.return=ee),oc(f,ee,!0,!0),G=!0;else if(ee.child!==null){ee.child.return=ee,ee=ee.child;continue}}if(ee===d)break;for(;ee.sibling===null;){if(ee.return===null||ee.return===d)return G;ee=ee.return}ee.sibling.return=ee.return,ee=ee.sibling}return G}function Vm(f,d){if(go&&zh(f,d)){f=d.stateNode;var b=f.containerInfo,k=V9();oc(k,d,!1,!1),f.pendingChildren=k,wa(d),CC(b,k)}}function o0(f,d,b,k){if(Ks)f.memoizedProps!==k&&wa(d);else if(go){var G=f.stateNode,ee=f.memoizedProps;if((f=zh(f,d))||ee!==k){var re=Ms.current;ee=AC(G,b,ee,k,!f,null),ee===G?d.stateNode=G:(Gi(d),L9(ee,b,k,re)&&wa(d),d.stateNode=ee,f&&Ws(ee,d,!1,!1))}else d.stateNode=G}}function pr(f,d,b,k,G){if((f.mode&32)!==0&&(b===null?JA(d,k):ZA(d,b,k))){if(f.flags|=16777216,(G&335544128)===G||X2(d,k))if(U9(f.stateNode,d,k))f.flags|=8192;else if(Qh())f.flags|=8192;else throw Xu=Dg,aw}else f.flags&=-16777217}function l0(f,d){if(uj(d)){if(f.flags|=16777216,!s4(d))if(Qh())f.flags|=8192;else throw Xu=Dg,aw}else f.flags&=-16777217}function Gh(f,d){d!==null&&(f.flags|=4),f.flags&16384&&(d=f.tag!==22?ne():536870912,f.lanes|=d,yf|=d)}function Du(f,d){if(!Bn)switch(f.tailMode){case"hidden":d=f.tail;for(var b=null;d!==null;)d.alternate!==null&&(b=d),d=d.sibling;b===null?f.tail=null:b.sibling=null;break;case"collapsed":b=f.tail;for(var k=null;b!==null;)b.alternate!==null&&(k=b),b=b.sibling;k===null?d||f.tail===null?f.tail=null:f.tail.sibling=null:k.sibling=null}}function $n(f){var d=f.alternate!==null&&f.alternate.child===f.child,b=0,k=0;if(d)for(var G=f.child;G!==null;)b|=G.lanes|G.childLanes,k|=G.subtreeFlags&65011712,k|=G.flags&65011712,G.return=f,G=G.sibling;else for(G=f.child;G!==null;)b|=G.lanes|G.childLanes,k|=G.subtreeFlags,k|=G.flags,G.return=f,G=G.sibling;return f.subtreeFlags|=k,f.childLanes=b,d}function N2(f,d,b){var k=d.pendingProps;switch(Ze(d),d.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $n(d),null;case 1:return $n(d),null;case 3:if(b=d.stateNode,k=null,f!==null&&(k=f.memoizedState.cache),d.memoizedState.cache!==k&&(d.flags|=2048),$t(qi),hn(),b.pendingContext&&(b.context=b.pendingContext,b.pendingContext=null),f===null||f.child===null)ri(d)?wa(d):f===null||f.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,Vs());return Vm(f,d),$n(d),null;case 26:if(zr){var{type:G,memoizedState:ee}=d;return f===null?(wa(d),ee!==null?($n(d),l0(d,ee)):($n(d),pr(d,G,null,k,b))):ee?ee!==f.memoizedState?(wa(d),$n(d),l0(d,ee)):($n(d),d.flags&=-16777217):(ee=f.memoizedProps,Ks?ee!==k&&wa(d):o0(f,d,G,k),$n(d),pr(d,G,ee,k,b)),null}case 27:if(is){if(Zt(d),b=Sc.current,G=d.type,f!==null&&d.stateNode!=null)Ks?f.memoizedProps!==k&&wa(d):o0(f,d,G,k);else{if(!k){if(d.stateNode===null)throw Error(s(166));return $n(d),null}f=Ms.current,ri(d)?Zn(d,f):(f=a4(G,k,b,f,!0),d.stateNode=f,wa(d))}return $n(d),null}case 5:if(Zt(d),G=d.type,f!==null&&d.stateNode!=null)o0(f,d,G,k);else{if(!k){if(d.stateNode===null)throw Error(s(166));return $n(d),null}if(ee=Ms.current,ri(d))Zn(d,ee),ZC(d.stateNode,G,k,ee)&&(d.flags|=64);else{var re=GA(G,k,Sc.current,ee,d);Gi(d),Ws(re,d,!1,!1),d.stateNode=re,L9(re,G,k,ee)&&wa(d)}}return $n(d),pr(d,d.type,f===null?null:f.memoizedProps,d.pendingProps,b),null;case 6:if(f&&d.stateNode!=null)b=f.memoizedProps,Ks?b!==k&&wa(d):go&&(b!==k?(f=Sc.current,b=Ms.current,Gi(d),d.stateNode=H9(k,f,b,d)):d.stateNode=f.stateNode);else{if(typeof k!=="string"&&d.stateNode===null)throw Error(s(166));if(f=Sc.current,b=Ms.current,ri(d)){if(!$s)throw Error(s(176));if(f=d.stateNode,b=d.memoizedProps,k=null,G=Rs,G!==null)switch(G.tag){case 27:case 5:k=G.memoizedProps}zC(f,b,d,k)||Rn(d,!0)}else Gi(d),d.stateNode=H9(k,f,b,d)}return $n(d),null;case 31:if(b=d.memoizedState,f===null||f.memoizedState!==null){if(k=ri(d),b!==null){if(f===null){if(!k)throw Error(s(318));if(!$s)throw Error(s(556));if(f=d.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(s(557));GC(f,d)}else Ai(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;$n(d),f=!1}else b=Vs(),f!==null&&f.memoizedState!==null&&(f.memoizedState.hydrationErrors=b),f=!0;if(!f){if(d.flags&256)return Xs(d),d;return Xs(d),null}if((d.flags&128)!==0)throw Error(s(558))}return $n(d),null;case 13:if(k=d.memoizedState,f===null||f.memoizedState!==null&&f.memoizedState.dehydrated!==null){if(G=ri(d),k!==null&&k.dehydrated!==null){if(f===null){if(!G)throw Error(s(318));if(!$s)throw Error(s(344));if(G=d.memoizedState,G=G!==null?G.dehydrated:null,!G)throw Error(s(317));VC(G,d)}else Ai(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;$n(d),G=!1}else G=Vs(),f!==null&&f.memoizedState!==null&&(f.memoizedState.hydrationErrors=G),G=!0;if(!G){if(d.flags&256)return Xs(d),d;return Xs(d),null}}if(Xs(d),(d.flags&128)!==0)return d.lanes=b,d;return b=k!==null,f=f!==null&&f.memoizedState!==null,b&&(k=d.child,G=null,k.alternate!==null&&k.alternate.memoizedState!==null&&k.alternate.memoizedState.cachePool!==null&&(G=k.alternate.memoizedState.cachePool.pool),ee=null,k.memoizedState!==null&&k.memoizedState.cachePool!==null&&(ee=k.memoizedState.cachePool.pool),ee!==G&&(k.flags|=2048)),b!==f&&b&&(d.child.flags|=8192),Gh(d,d.updateQueue),$n(d),null;case 4:return hn(),Vm(f,d),f===null&&KA(d.stateNode.containerInfo),$n(d),null;case 10:return $t(d.type),$n(d),null;case 19:if(x(Xi),k=d.memoizedState,k===null)return $n(d),null;if(G=(d.flags&128)!==0,ee=k.rendering,ee===null)if(G)Du(k,!1);else{if(Li!==0||f!==null&&(f.flags&128)!==0)for(f=d.child;f!==null;){if(ee=Rh(f),ee!==null){d.flags|=128,Du(k,!1),f=ee.updateQueue,d.updateQueue=f,Gh(d,f),d.subtreeFlags=0,f=b;for(b=d.child;b!==null;)Rt(b,f),b=b.sibling;return j(Xi,Xi.current&1|2),Bn&&$e(d,k.treeForkCount),d.child}f=f.sibling}k.tail!==null&&Ta()>N0&&(d.flags|=128,G=!0,Du(k,!1),d.lanes=4194304)}else{if(!G)if(f=Rh(ee),f!==null){if(d.flags|=128,G=!0,f=f.updateQueue,d.updateQueue=f,Gh(d,f),Du(k,!0),k.tail===null&&k.tailMode==="hidden"&&!ee.alternate&&!Bn)return $n(d),null}else 2*Ta()-k.renderingStartTime>N0&&b!==536870912&&(d.flags|=128,G=!0,Du(k,!1),d.lanes=4194304);k.isBackwards?(ee.sibling=d.child,d.child=ee):(f=k.last,f!==null?f.sibling=ee:d.child=ee,k.last=ee)}if(k.tail!==null)return f=k.tail,k.rendering=f,k.tail=f.sibling,k.renderingStartTime=Ta(),f.sibling=null,b=Xi.current,j(Xi,G?b&1|2:b&1),Bn&&$e(d,k.treeForkCount),f;return $n(d),null;case 22:case 23:return Xs(d),Ld(),k=d.memoizedState!==null,f!==null?f.memoizedState!==null!==k&&(d.flags|=8192):k&&(d.flags|=8192),k?(b&536870912)!==0&&(d.flags&128)===0&&($n(d),d.subtreeFlags&6&&(d.flags|=8192)):$n(d),b=d.updateQueue,b!==null&&Gh(d,b.retryQueue),b=null,f!==null&&f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(b=f.memoizedState.cachePool.pool),k=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(k=d.memoizedState.cachePool.pool),k!==b&&(d.flags|=2048),f!==null&&x(Vu),null;case 24:return b=null,f!==null&&(b=f.memoizedState.cache),d.memoizedState.cache!==b&&(d.flags|=2048),$t(qi),$n(d),null;case 25:return null;case 30:return null}throw Error(s(156,d.tag))}function P2(f,d){switch(Ze(d),d.tag){case 1:return f=d.flags,f&65536?(d.flags=f&-65537|128,d):null;case 3:return $t(qi),hn(),f=d.flags,(f&65536)!==0&&(f&128)===0?(d.flags=f&-65537|128,d):null;case 26:case 27:case 5:return Zt(d),null;case 31:if(d.memoizedState!==null){if(Xs(d),d.alternate===null)throw Error(s(340));Ai()}return f=d.flags,f&65536?(d.flags=f&-65537|128,d):null;case 13:if(Xs(d),f=d.memoizedState,f!==null&&f.dehydrated!==null){if(d.alternate===null)throw Error(s(340));Ai()}return f=d.flags,f&65536?(d.flags=f&-65537|128,d):null;case 19:return x(Xi),null;case 4:return hn(),null;case 10:return $t(d.type),null;case 22:case 23:return Xs(d),Ld(),f!==null&&x(Vu),f=d.flags,f&65536?(d.flags=f&-65537|128,d):null;case 24:return $t(qi),null;case 25:return null;default:return null}}function Xm(f,d){switch(Ze(d),d.tag){case 3:$t(qi),hn();break;case 26:case 27:case 5:Zt(d);break;case 4:hn();break;case 31:d.memoizedState!==null&&Xs(d);break;case 13:Xs(d);break;case 19:x(Xi);break;case 10:$t(d.type);break;case 22:case 23:Xs(d),Ld(),f!==null&&x(Vu);break;case 24:$t(qi)}}function Iu(f,d){try{var b=d.updateQueue,k=b!==null?b.lastEffect:null;if(k!==null){var G=k.next;b=G;do{if((b.tag&f)===f){k=void 0;var ee=b.create,re=b.inst;k=ee(),re.destroy=k}b=b.next}while(b!==G)}}catch(Re){R(d,d.return,Re)}}function Hr(f,d,b){try{var k=d.updateQueue,G=k!==null?k.lastEffect:null;if(G!==null){var ee=G.next;k=ee;do{if((k.tag&f)===f){var re=k.inst,Re=re.destroy;if(Re!==void 0){re.destroy=void 0,G=d;var lt=b,kt=Re;try{kt()}catch(Ot){R(G,lt,Ot)}}}k=k.next}while(k!==ee)}}catch(Ot){R(d,d.return,Ot)}}function Km(f){var d=f.updateQueue;if(d!==null){var b=f.stateNode;try{Pd(d,b)}catch(k){R(f,f.return,k)}}}function lc(f,d,b){b.props=Lr(f.type,f.memoizedProps),b.state=f.memoizedState;try{b.componentWillUnmount()}catch(k){R(f,d,k)}}function cc(f,d){try{var b=f.ref;if(b!==null){switch(f.tag){case 26:case 27:case 5:var k=x0(f.stateNode);break;case 30:k=f.stateNode;break;default:k=f.stateNode}typeof b==="function"?f.refCleanup=b(k):b.current=k}}catch(G){R(f,d,G)}}function sa(f,d){var b=f.ref,k=f.refCleanup;if(b!==null)if(typeof k==="function")try{k()}catch(G){R(f,d,G)}finally{f.refCleanup=null,f=f.alternate,f!=null&&(f.refCleanup=null)}else if(typeof b==="function")try{b(null)}catch(G){R(f,d,G)}else b.current=null}function uc(f){var{type:d,memoizedProps:b,stateNode:k}=f;try{pC(k,d,b,f)}catch(G){R(f,f.return,G)}}function wi(f,d,b){try{mC(f.stateNode,f.type,b,d,f)}catch(k){R(f,f.return,k)}}function cl(f){return f.tag===5||f.tag===3||(zr?f.tag===26:!1)||(is?f.tag===27&&nf(f.type):!1)||f.tag===4}function Mu(f){e:for(;;){for(;f.sibling===null;){if(f.return===null||cl(f.return))return null;f=f.return}f.sibling.return=f.return;for(f=f.sibling;f.tag!==5&&f.tag!==6&&f.tag!==18;){if(is&&f.tag===27&&nf(f.type))continue e;if(f.flags&2)continue e;if(f.child===null||f.tag===4)continue e;else f.child.return=f,f=f.child}if(!(f.flags&2))return f.stateNode}}function c0(f,d,b){var k=f.tag;if(k===5||k===6)f=f.stateNode,d?bC(b,f,d):fC(b,f);else if(k!==4&&(is&&k===27&&nf(f.type)&&(b=f.stateNode,d=null),f=f.child,f!==null))for(c0(f,d,b),f=f.sibling;f!==null;)c0(f,d,b),f=f.sibling}function Vh(f,d,b){var k=f.tag;if(k===5||k===6)f=f.stateNode,d?gC(b,f,d):hC(b,f);else if(k!==4&&(is&&k===27&&nf(f.type)&&(b=f.stateNode),f=f.child,f!==null))for(Vh(f,d,b),f=f.sibling;f!==null;)Vh(f,d,b),f=f.sibling}function $m(f,d,b){f=f.containerInfo;try{W9(f,b)}catch(k){R(d,d.return,k)}}function Qm(f){var{stateNode:d,memoizedProps:b}=f;try{fj(f.type,b,d,f)}catch(k){R(f,f.return,k)}}function Jm(f,d){UA(f.containerInfo);for(bs=d;bs!==null;)if(f=bs,d=f.child,(f.subtreeFlags&1028)!==0&&d!==null)d.return=f,bs=d;else for(;bs!==null;){f=bs;var b=f.alternate;switch(d=f.flags,f.tag){case 0:if((d&4)!==0&&(d=f.updateQueue,d=d!==null?d.events:null,d!==null))for(var k=0;k<d.length;k++){var G=d[k];G.ref.impl=G.nextImpl}break;case 11:case 15:break;case 1:if((d&1024)!==0&&b!==null){d=void 0,k=f,G=b.memoizedProps,b=b.memoizedState;var ee=k.stateNode;try{var re=Lr(k.type,G);d=ee.getSnapshotBeforeUpdate(re,b),ee.__reactInternalSnapshotBeforeUpdate=d}catch(Re){R(k,k.return,Re)}}break;case 3:(d&1024)!==0&&Ks&&TC(f.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((d&1024)!==0)throw Error(s(163))}if(d=f.sibling,d!==null){d.return=f.return,bs=d;break}bs=f.return}}function u0(f,d,b){var k=b.flags;switch(b.tag){case 0:case 11:case 15:Ur(f,b),k&4&&Iu(5,b);break;case 1:if(Ur(f,b),k&4)if(f=b.stateNode,d===null)try{f.componentDidMount()}catch(re){R(b,b.return,re)}else{var G=Lr(b.type,d.memoizedProps);d=d.memoizedState;try{f.componentDidUpdate(G,d,f.__reactInternalSnapshotBeforeUpdate)}catch(re){R(b,b.return,re)}}k&64&&Km(b),k&512&&cc(b,b.return);break;case 3:if(Ur(f,b),k&64&&(k=b.updateQueue,k!==null)){if(f=null,b.child!==null)switch(b.child.tag){case 27:case 5:f=x0(b.child.stateNode);break;case 1:f=b.child.stateNode}try{Pd(k,f)}catch(re){R(b,b.return,re)}}break;case 27:is&&d===null&&k&4&&Qm(b);case 26:case 5:if(Ur(f,b),d===null){if(k&4)uc(b);else if(k&64){f=b.type,d=b.memoizedProps,G=b.stateNode;try{$C(G,f,d,b)}catch(re){R(b,b.return,re)}}}k&512&&cc(b,b.return);break;case 12:Ur(f,b);break;case 31:Ur(f,b),k&4&&Wh(f,b);break;case 13:Ur(f,b),k&4&&f0(f,b),k&64&&(k=b.memoizedState,k!==null&&(k=k.dehydrated,k!==null&&(b=ce.bind(null,b),EC(k,b))));break;case 22:if(k=b.memoizedState!==null||Sl,!k){d=d!==null&&d.memoizedState!==null||Ji,G=Sl;var ee=Ji;Sl=k,(Ji=d)&&!ee?mr(f,b,(b.subtreeFlags&8772)!==0):Ur(f,b),Sl=G,Ji=ee}break;case 30:break;default:Ur(f,b)}}function h0(f){var d=f.alternate;d!==null&&(f.alternate=null,h0(d)),f.child=null,f.deletions=null,f.sibling=null,f.tag===5&&(d=f.stateNode,d!==null&&QA(d)),f.stateNode=null,f.return=null,f.dependencies=null,f.memoizedProps=null,f.memoizedState=null,f.pendingProps=null,f.stateNode=null,f.updateQueue=null}function va(f,d,b){for(b=b.child;b!==null;)Xh(f,d,b),b=b.sibling}function Xh(f,d,b){if(Ka&&typeof Ka.onCommitFiberUnmount==="function")try{Ka.onCommitFiberUnmount(C0,b)}catch(ee){}switch(b.tag){case 26:if(zr){Ji||sa(b,d),va(f,d,b),b.memoizedState?t4(b.memoizedState):b.stateNode&&i4(b.stateNode);break}case 27:if(is){Ji||sa(b,d);var k=es,G=Aa;nf(b.type)&&(es=b.stateNode,Aa=!1),va(f,d,b),r4(b.stateNode),es=k,Aa=G;break}case 5:Ji||sa(b,d);case 6:if(Ks){if(k=es,G=Aa,es=null,va(f,d,b),es=k,Aa=G,es!==null)if(Aa)try{vC(es,b.stateNode)}catch(ee){R(b,d,ee)}else try{yC(es,b.stateNode)}catch(ee){R(b,d,ee)}}else va(f,d,b);break;case 18:Ks&&es!==null&&(Aa?nj(es,b.stateNode):tj(es,b.stateNode));break;case 4:Ks?(k=es,G=Aa,es=b.stateNode.containerInfo,Aa=!0,va(f,d,b),es=k,Aa=G):(go&&$m(b.stateNode,b,V9()),va(f,d,b));break;case 0:case 11:case 14:case 15:Hr(2,b,d),Ji||Hr(4,b,d),va(f,d,b);break;case 1:Ji||(sa(b,d),k=b.stateNode,typeof k.componentWillUnmount==="function"&&lc(b,d,k)),va(f,d,b);break;case 21:va(f,d,b);break;case 22:Ji=(k=Ji)||b.memoizedState!==null,va(f,d,b),Ji=k;break;default:va(f,d,b)}}function Wh(f,d){if($s&&d.memoizedState===null&&(f=d.alternate,f!==null&&(f=f.memoizedState,f!==null))){f=f.dehydrated;try{QC(f)}catch(b){R(d,d.return,b)}}}function f0(f,d){if($s&&d.memoizedState===null&&(f=d.alternate,f!==null&&(f=f.memoizedState,f!==null&&(f=f.dehydrated,f!==null))))try{JC(f)}catch(b){R(d,d.return,b)}}function d0(f){switch(f.tag){case 31:case 13:case 19:var d=f.stateNode;return d===null&&(d=f.stateNode=new g4),d;case 22:return f=f.stateNode,d=f._retryCache,d===null&&(d=f._retryCache=new g4),d;default:throw Error(s(435,f.tag))}}function Kh(f,d){var b=d0(f);d.forEach(function(k){if(!b.has(k)){b.add(k);var G=Se.bind(null,f,k);k.then(G,G)}})}function Bi(f,d){var b=d.deletions;if(b!==null)for(var k=0;k<b.length;k++){var G=b[k],ee=f,re=d;if(Ks){var Re=re;e:for(;Re!==null;){switch(Re.tag){case 27:if(is){if(nf(Re.type)){es=Re.stateNode,Aa=!1;break e}break}case 5:es=Re.stateNode,Aa=!1;break e;case 3:case 4:es=Re.stateNode.containerInfo,Aa=!0;break e}Re=Re.return}if(es===null)throw Error(s(160));Xh(ee,re,G),es=null,Aa=!1}else Xh(ee,re,G);ee=G.alternate,ee!==null&&(ee.return=null),G.return=null}if(d.subtreeFlags&13886)for(d=d.child;d!==null;)Zm(d,f),d=d.sibling}function Zm(f,d){var b=f.alternate,k=f.flags;switch(f.tag){case 0:case 11:case 14:case 15:Bi(d,f),ps(f),k&4&&(Hr(3,f,f.return),Iu(3,f),Hr(5,f,f.return));break;case 1:Bi(d,f),ps(f),k&512&&(Ji||b===null||sa(b,b.return)),k&64&&Sl&&(f=f.updateQueue,f!==null&&(k=f.callbacks,k!==null&&(b=f.shared.hiddenCallbacks,f.shared.hiddenCallbacks=b===null?k:b.concat(k))));break;case 26:if(zr){var G=Xr;if(Bi(d,f),ps(f),k&512&&(Ji||b===null||sa(b,b.return)),k&4){k=b!==null?b.memoizedState:null;var ee=f.memoizedState;b===null?ee===null?f.stateNode===null?f.stateNode=oj(G,f.type,f.memoizedProps,f):n4(G,f.type,f.stateNode):f.stateNode=e4(G,ee,f.memoizedProps):k!==ee?(k===null?b.stateNode!==null&&i4(b.stateNode):t4(k),ee===null?n4(G,f.type,f.stateNode):e4(G,ee,f.memoizedProps)):ee===null&&f.stateNode!==null&&wi(f,f.memoizedProps,b.memoizedProps)}break}case 27:if(is){Bi(d,f),ps(f),k&512&&(Ji||b===null||sa(b,b.return)),b!==null&&k&4&&wi(f,f.memoizedProps,b.memoizedProps);break}case 5:if(Bi(d,f),ps(f),k&512&&(Ji||b===null||sa(b,b.return)),Ks){if(f.flags&32){G=f.stateNode;try{G9(G)}catch(qt){R(f,f.return,qt)}}k&4&&f.stateNode!=null&&(G=f.memoizedProps,wi(f,G,b!==null?b.memoizedProps:G)),k&1024&&(fw=!0)}else go&&f.alternate!==null&&(f.alternate.stateNode=f.stateNode);break;case 6:if(Bi(d,f),ps(f),k&4&&Ks){if(f.stateNode===null)throw Error(s(162));k=f.memoizedProps,b=b!==null?b.memoizedProps:k,G=f.stateNode;try{dC(G,b,k)}catch(qt){R(f,f.return,qt)}}break;case 3:if(zr?(cj(),G=Xr,Xr=$2(d.containerInfo),Bi(d,f),Xr=G):Bi(d,f),ps(f),k&4){if(Ks&&$s&&b!==null&&b.memoizedState.isDehydrated)try{YC(d.containerInfo)}catch(qt){R(f,f.return,qt)}if(go){k=d.containerInfo,b=d.pendingChildren;try{W9(k,b)}catch(qt){R(f,f.return,qt)}}}fw&&(fw=!1,p0(f));break;case 4:zr?(b=Xr,Xr=$2(f.stateNode.containerInfo),Bi(d,f),ps(f),Xr=b):(Bi(d,f),ps(f)),k&4&&go&&$m(f.stateNode,f,f.stateNode.pendingChildren);break;case 12:Bi(d,f),ps(f);break;case 31:Bi(d,f),ps(f),k&4&&(k=f.updateQueue,k!==null&&(f.updateQueue=null,Kh(f,k)));break;case 13:Bi(d,f),ps(f),f.child.flags&8192&&f.memoizedState!==null!==(b!==null&&b.memoizedState!==null)&&(Lg=Ta()),k&4&&(k=f.updateQueue,k!==null&&(f.updateQueue=null,Kh(f,k)));break;case 22:G=f.memoizedState!==null;var re=b!==null&&b.memoizedState!==null,Re=Sl,lt=Ji;if(Sl=Re||G,Ji=lt||re,Bi(d,f),Ji=lt,Sl=Re,ps(f),k&8192&&(d=f.stateNode,d._visibility=G?d._visibility&-2:d._visibility|1,G&&(b===null||re||Sl||Ji||ul(f)),Ks)){e:if(b=null,Ks)for(d=f;;){if(d.tag===5||zr&&d.tag===26){if(b===null){re=b=d;try{ee=re.stateNode,G?SC(ee):xC(re.stateNode,re.memoizedProps)}catch(qt){R(re,re.return,qt)}}}else if(d.tag===6){if(b===null){re=d;try{var kt=re.stateNode;G?_C(kt):kC(kt,re.memoizedProps)}catch(qt){R(re,re.return,qt)}}}else if(d.tag===18){if(b===null){re=d;try{var Ot=re.stateNode;G?ij(Ot):sj(re.stateNode)}catch(qt){R(re,re.return,qt)}}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===f)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===f)break e;for(;d.sibling===null;){if(d.return===null||d.return===f)break e;b===d&&(b=null),d=d.return}b===d&&(b=null),d.sibling.return=d.return,d=d.sibling}}k&4&&(k=f.updateQueue,k!==null&&(b=k.retryQueue,b!==null&&(k.retryQueue=null,Kh(f,b))));break;case 19:Bi(d,f),ps(f),k&4&&(k=f.updateQueue,k!==null&&(f.updateQueue=null,Kh(f,k)));break;case 30:break;case 21:break;default:Bi(d,f),ps(f)}}function ps(f){var d=f.flags;if(d&2){try{for(var b,k=f.return;k!==null;){if(cl(k)){b=k;break}k=k.return}if(Ks){if(b==null)throw Error(s(160));switch(b.tag){case 27:if(is){var G=b.stateNode,ee=Mu(f);Vh(f,ee,G);break}case 5:var re=b.stateNode;b.flags&32&&(G9(re),b.flags&=-33);var Re=Mu(f);Vh(f,Re,re);break;case 3:case 4:var lt=b.stateNode.containerInfo,kt=Mu(f);c0(f,kt,lt);break;default:throw Error(s(161))}}}catch(Ot){R(f,f.return,Ot)}f.flags&=-3}d&4096&&(f.flags&=-4097)}function p0(f){if(f.subtreeFlags&1024)for(f=f.child;f!==null;){var d=f;p0(d),d.tag===5&&d.flags&1024&&nC(d.stateNode),f=f.sibling}}function Ur(f,d){if(d.subtreeFlags&8772)for(d=d.child;d!==null;)u0(f,d.alternate,d),d=d.sibling}function ul(f){for(f=f.child;f!==null;){var d=f;switch(d.tag){case 0:case 11:case 14:case 15:Hr(4,d,d.return),ul(d);break;case 1:sa(d,d.return);var b=d.stateNode;typeof b.componentWillUnmount==="function"&&lc(d,d.return,b),ul(d);break;case 27:is&&r4(d.stateNode);case 26:case 5:sa(d,d.return),ul(d);break;case 22:d.memoizedState===null&&ul(d);break;case 30:ul(d);break;default:ul(d)}f=f.sibling}}function mr(f,d,b){b=b&&(d.subtreeFlags&8772)!==0;for(d=d.child;d!==null;){var k=d.alternate,G=f,ee=d,re=ee.flags;switch(ee.tag){case 0:case 11:case 15:mr(G,ee,b),Iu(4,ee);break;case 1:if(mr(G,ee,b),k=ee,G=k.stateNode,typeof G.componentDidMount==="function")try{G.componentDidMount()}catch(kt){R(k,k.return,kt)}if(k=ee,G=k.updateQueue,G!==null){var Re=k.stateNode;try{var lt=G.shared.hiddenCallbacks;if(lt!==null)for(G.shared.hiddenCallbacks=null,G=0;G<lt.length;G++)hi(lt[G],Re)}catch(kt){R(k,k.return,kt)}}b&&re&64&&Km(ee),cc(ee,ee.return);break;case 27:is&&Qm(ee);case 26:case 5:mr(G,ee,b),b&&k===null&&re&4&&uc(ee),cc(ee,ee.return);break;case 12:mr(G,ee,b);break;case 31:mr(G,ee,b),b&&re&4&&Wh(G,ee);break;case 13:mr(G,ee,b),b&&re&4&&f0(G,ee);break;case 22:ee.memoizedState===null&&mr(G,ee,b),cc(ee,ee.return);break;case 30:break;default:mr(G,ee,b)}d=d.sibling}}function m0(f,d){var b=null;f!==null&&f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(b=f.memoizedState.cachePool.pool),f=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(f=d.memoizedState.cachePool.pool),f!==b&&(f!=null&&f.refCount++,b!=null&&ls(b))}function g0(f,d){f=null,d.alternate!==null&&(f=d.alternate.memoizedState.cache),d=d.memoizedState.cache,d!==f&&(d.refCount++,f!=null&&ls(f))}function aa(f,d,b,k){if(d.subtreeFlags&10256)for(d=d.child;d!==null;)eg(f,d,b,k),d=d.sibling}function eg(f,d,b,k){var G=d.flags;switch(d.tag){case 0:case 11:case 15:aa(f,d,b,k),G&2048&&Iu(9,d);break;case 1:aa(f,d,b,k);break;case 3:aa(f,d,b,k),G&2048&&(f=null,d.alternate!==null&&(f=d.alternate.memoizedState.cache),d=d.memoizedState.cache,d!==f&&(d.refCount++,f!=null&&ls(f)));break;case 12:if(G&2048){aa(f,d,b,k),f=d.stateNode;try{var ee=d.memoizedProps,re=ee.id,Re=ee.onPostCommit;typeof Re==="function"&&Re(re,d.alternate===null?"mount":"update",f.passiveEffectDuration,-0)}catch(lt){R(d,d.return,lt)}}else aa(f,d,b,k);break;case 31:aa(f,d,b,k);break;case 13:aa(f,d,b,k);break;case 23:break;case 22:ee=d.stateNode,re=d.alternate,d.memoizedState!==null?ee._visibility&2?aa(f,d,b,k):Ru(f,d):ee._visibility&2?aa(f,d,b,k):(ee._visibility|=2,hc(f,d,b,k,(d.subtreeFlags&10256)!==0||!1)),G&2048&&m0(re,d);break;case 24:aa(f,d,b,k),G&2048&&g0(d.alternate,d);break;default:aa(f,d,b,k)}}function hc(f,d,b,k,G){G=G&&((d.subtreeFlags&10256)!==0||!1);for(d=d.child;d!==null;){var ee=f,re=d,Re=b,lt=k,kt=re.flags;switch(re.tag){case 0:case 11:case 15:hc(ee,re,Re,lt,G),Iu(8,re);break;case 23:break;case 22:var Ot=re.stateNode;re.memoizedState!==null?Ot._visibility&2?hc(ee,re,Re,lt,G):Ru(ee,re):(Ot._visibility|=2,hc(ee,re,Re,lt,G)),G&&kt&2048&&m0(re.alternate,re);break;case 24:hc(ee,re,Re,lt,G),G&&kt&2048&&g0(re.alternate,re);break;default:hc(ee,re,Re,lt,G)}d=d.sibling}}function Ru(f,d){if(d.subtreeFlags&10256)for(d=d.child;d!==null;){var b=f,k=d,G=k.flags;switch(k.tag){case 22:Ru(b,k),G&2048&&m0(k.alternate,k);break;case 24:Ru(b,k),G&2048&&g0(k.alternate,k);break;default:Ru(b,k)}d=d.sibling}}function fl(f,d,b){if(f.subtreeFlags&bf)for(f=f.child;f!==null;)tg(f,d,b),f=f.sibling}function tg(f,d,b){switch(f.tag){case 26:if(fl(f,d,b),f.flags&bf)if(f.memoizedState!==null)hj(b,Xr,f.memoizedState,f.memoizedProps);else{var k=f.stateNode,G=f.type;f=f.memoizedProps,((d&335544128)===d||X2(G,f))&&z9(b,k,G,f)}break;case 5:fl(f,d,b),f.flags&bf&&(k=f.stateNode,G=f.type,f=f.memoizedProps,((d&335544128)===d||X2(G,f))&&z9(b,k,G,f));break;case 3:case 4:zr?(k=Xr,Xr=$2(f.stateNode.containerInfo),fl(f,d,b),Xr=k):fl(f,d,b);break;case 22:f.memoizedState===null&&(k=f.alternate,k!==null&&k.memoizedState!==null?(k=bf,bf=16777216,fl(f,d,b),bf=k):fl(f,d,b));break;default:fl(f,d,b)}}function ng(f){var d=f.alternate;if(d!==null&&(f=d.child,f!==null)){d.child=null;do d=f.sibling,f.sibling=null,f=d;while(f!==null)}}function Ou(f){var d=f.deletions;if((f.flags&16)!==0){if(d!==null)for(var b=0;b<d.length;b++){var k=d[b];bs=k,sg(k,f)}ng(f)}if(f.subtreeFlags&10256)for(f=f.child;f!==null;)ig(f),f=f.sibling}function ig(f){switch(f.tag){case 0:case 11:case 15:Ou(f),f.flags&2048&&Hr(9,f,f.return);break;case 3:Ou(f);break;case 12:Ou(f);break;case 22:var d=f.stateNode;f.memoizedState!==null&&d._visibility&2&&(f.return===null||f.return.tag!==13)?(d._visibility&=-3,$h(f)):Ou(f);break;default:Ou(f)}}function $h(f){var d=f.deletions;if((f.flags&16)!==0){if(d!==null)for(var b=0;b<d.length;b++){var k=d[b];bs=k,sg(k,f)}ng(f)}for(f=f.child;f!==null;){switch(d=f,d.tag){case 0:case 11:case 15:Hr(8,d,d.return),$h(d);break;case 22:b=d.stateNode,b._visibility&2&&(b._visibility&=-3,$h(d));break;default:$h(d)}f=f.sibling}}function sg(f,d){for(;bs!==null;){var b=bs;switch(b.tag){case 0:case 11:case 15:Hr(8,b,d);break;case 23:case 22:if(b.memoizedState!==null&&b.memoizedState.cachePool!==null){var k=b.memoizedState.cachePool.pool;k!=null&&k.refCount++}break;case 24:ls(b.memoizedState.cache)}if(k=b.child,k!==null)k.return=b,bs=k;else e:for(b=f;bs!==null;){k=bs;var G=k.sibling,ee=k.return;if(h0(k),k===b){bs=null;break e}if(G!==null){G.return=ee,bs=G;break e}bs=ee}}}function b0(f){var d=WA(f);if(d!=null){if(typeof d.memoizedProps["data-testname"]!=="string")throw Error(s(364));return d}if(f=aC(f),f===null)throw Error(s(362));return f.stateNode.current}function br(f,d){var b=f.tag;switch(d.$$typeof){case Og:if(f.type===d.value)return!0;break;case Fg:e:{d=d.value,f=[f,0];for(b=0;b<f.length;){var k=f[b++],G=k.tag,ee=f[b++],re=d[ee];if(G!==5&&G!==26&&G!==27||!A0(k)){for(;re!=null&&br(k,re);)ee++,re=d[ee];if(ee===d.length){d=!0;break e}else for(k=k.child;k!==null;)f.push(k,ee),k=k.sibling}}d=!1}return d;case Ng:if((b===5||b===26||b===27)&&lC(f.stateNode,d.value))return!0;break;case Bg:if(b===5||b===6||b===26||b===27){if(f=oC(f),f!==null&&0<=f.indexOf(d.value))return!0}break;case Pg:if(b===5||b===26||b===27){if(f=f.memoizedProps["data-testname"],typeof f==="string"&&f.toLowerCase()===d.value.toLowerCase())return!0}break;default:throw Error(s(365))}return!1}function w0(f){switch(f.$$typeof){case Og:return"<"+(g(f.value)||"Unknown")+">";case Fg:return":has("+(w0(f)||"")+")";case Ng:return'[role="'+f.value+'"]';case Bg:return'"'+f.value+'"';case Pg:return'[data-testname="'+f.value+'"]';default:throw Error(s(365))}}function rg(f,d){var b=[];f=[f,0];for(var k=0;k<f.length;){var G=f[k++],ee=G.tag,re=f[k++],Re=d[re];if(ee!==5&&ee!==26&&ee!==27||!A0(G)){for(;Re!=null&&br(G,Re);)re++,Re=d[re];if(re===d.length)b.push(G);else for(G=G.child;G!==null;)f.push(G,re),G=G.sibling}}return b}function y0(f,d){if(!T0)throw Error(s(363));f=b0(f),f=rg(f,d),d=[],f=Array.from(f);for(var b=0;b<f.length;){var k=f[b++],G=k.tag;if(G===5||G===26||G===27)A0(k)||d.push(k.stateNode);else for(k=k.child;k!==null;)f.push(k),k=k.sibling}return d}function ka(){return(qn&2)!==0&&Nn!==0?Nn&-Nn:sn.T!==null?ao():$A()}function v0(){if(Ja===0)if((Nn&536870912)===0||Bn){var f=_g;_g<<=1,(_g&3932160)===0&&(_g=262144),Ja=f}else Ja=536870912;return f=Ya.current,f!==null&&(f.flags|=32),Ja}function ms(f,d,b){if(f===fi&&(ni===2||ni===9)||f.cancelPendingCommit!==null)fc(f,0),fo(f,Nn,Ja,!1);if(se(f,b),(qn&2)===0||f!==fi)f===fi&&((qn&2)===0&&($u|=b),Li===4&&fo(f,Nn,Ja,!1)),Pi(f)}function S0(f,d,b){if((qn&6)!==0)throw Error(s(327));var k=!b&&(d&127)===0&&(d&f.expiredLanes)===0||Y(f,d),G=k?dl(f,d):po(f,d,!0),ee=k;do{if(G===0){wf&&!k&&fo(f,d,0,!1);break}else{if(b=f.current.alternate,ee&&!Yh(b)){G=po(f,d,!1),ee=!1;continue}if(G===2){if(ee=d,f.errorRecoveryDisabledLanes&ee)var re=0;else re=f.pendingLanes&-536870913,re=re!==0?re:re&536870912?536870912:0;if(re!==0){d=re;e:{var Re=f;G=F0;var lt=$s&&Re.current.memoizedState.isDehydrated;if(lt&&(fc(Re,re).flags|=256),re=po(Re,re,!1),re!==2){if(dw&&!lt){Re.errorRecoveryDisabledLanes|=ee,$u|=ee,G=4;break e}ee=Ca,Ca=G,ee!==null&&(Ca===null?Ca=ee:Ca.push.apply(Ca,ee))}G=re}if(ee=!1,G!==2)continue}}if(G===1){fc(f,0),fo(f,d,0,!0);break}e:{switch(k=f,ee=G,ee){case 0:case 1:throw Error(s(345));case 4:if((d&4194048)!==d)break;case 6:fo(k,d,Ja,!kc);break e;case 2:Ca=null;break;case 3:case 5:break;default:throw Error(s(329))}if((d&62914560)===d&&(G=Lg+300-Ta(),10<G)){if(fo(k,d,Ja,!kc),X(k,0,!0)!==0)break e;xl=d,k.timeoutHandle=VA(Fu.bind(null,k,b,Ca,Hg,mw,d,Ja,$u,yf,kc,ee,"Throttled",-0,0),G);break e}Fu(k,b,Ca,Hg,mw,d,Ja,$u,yf,kc,ee,null,-0,0)}}break}while(1);Pi(f)}function Fu(f,d,b,k,G,ee,re,Re,lt,kt,Ot,qt,Lt,_n){if(f.timeoutHandle=Lu,qt=d.subtreeFlags,qt&8192||(qt&16785408)===16785408){qt=eC(),tg(d,ee,qt);var Os=(ee&62914560)===ee?Lg-Ta():(ee&4194048)===ee?b4-Ta():0;if(Os=tC(qt,Os),Os!==null){xl=ee,f.cancelPendingCommit=Os(dg.bind(null,f,d,ee,b,k,G,re,Re,lt,Ot,qt,null,Lt,_n)),fo(f,ee,re,!kt);return}}dg(f,d,ee,b,k,G,re,Re,lt)}function Yh(f){for(var d=f;;){var b=d.tag;if((b===0||b===11||b===15)&&d.flags&16384&&(b=d.updateQueue,b!==null&&(b=b.stores,b!==null)))for(var k=0;k<b.length;k++){var G=b[k],ee=G.getSnapshot;G=G.value;try{if(!$a(ee(),G))return!1}catch(re){return!1}}if(b=d.child,d.subtreeFlags&16384&&b!==null)b.return=d,d=b;else{if(d===f)break;for(;d.sibling===null;){if(d.return===null||d.return===f)return!0;d=d.return}d.sibling.return=d.return,d=d.sibling}}return!0}function fo(f,d,b,k){d&=~pw,d&=~$u,f.suspendedLanes|=d,f.pingedLanes&=~d,k&&(f.warmLanes|=d),k=f.expirationTimes;for(var G=d;0<G;){var ee=31-Xa(G),re=1<<ee;k[ee]=-1,G&=~re}b!==0&&he(f,b,d)}function og(){return(qn&6)===0?(cs(0,!1),!1):!0}function _0(){if(Dn!==null){if(ni===0)var f=Dn.return;else f=Dn,yl=Uu=null,Ud(f),ff=null,D0=0,f=Dn;for(;f!==null;)Xm(f.alternate,f),f=f.return;Dn=null}}function fc(f,d){var b=f.timeoutHandle;b!==Lu&&(f.timeoutHandle=Lu,XA(b)),b=f.cancelPendingCommit,b!==null&&(f.cancelPendingCommit=null,b()),xl=0,_0(),fi=f,Dn=b=Qe(f.current,null),Nn=d,ni=0,Qa=null,kc=!1,wf=Y(f,d),dw=!1,yf=Ja=pw=$u=Tc=Li=0,Ca=F0=null,mw=!1,(d&8)!==0&&(d|=d&32);var k=f.entangledLanes;if(k!==0)for(f=f.entanglements,k&=d;0<k;){var G=31-Xa(k),ee=1<<G;d|=f[G],k&=~ee}return _l=d,Kl(),b}function lg(f,d){Tn=null,sn.H=R0,d===hf||d===qg?(d=Ci(),ni=3):d===aw?(d=Ci(),ni=4):ni=d===uw?8:d!==null&&typeof d==="object"&&typeof d.then==="function"?6:1,Qa=d,Dn===null&&(Li=1,ac(f,Ve(d,f.current)))}function Qh(){var f=Ya.current;return f===null?!0:(Nn&4194048)===Nn?_r===null?!0:!1:(Nn&62914560)===Nn||(Nn&536870912)!==0?f===_r:!1}function cg(){var f=sn.H;return sn.H=R0,f===null?R0:f}function ug(){var f=sn.A;return sn.A=Aj,f}function Pu(){Li=4,kc||(Nn&4194048)!==Nn&&Ya.current!==null||(wf=!0),(Tc&134217727)===0&&($u&134217727)===0||fi===null||fo(fi,Nn,Ja,!1)}function po(f,d,b){var k=qn;qn|=2;var G=cg(),ee=ug();if(fi!==f||Nn!==d)Hg=null,fc(f,d);d=!1;var re=Li;e:do try{if(ni!==0&&Dn!==null){var Re=Dn,lt=Qa;switch(ni){case 8:_0(),re=6;break e;case 3:case 2:case 9:case 6:Ya.current===null&&(d=!0);var kt=ni;if(ni=0,Qa=null,pl(f,Re,lt,kt),b&&wf){re=0;break e}break;default:kt=ni,ni=0,Qa=null,pl(f,Re,lt,kt)}}Xn(),re=Li;break}catch(Ot){lg(f,Ot)}while(1);return d&&f.shellSuspendCounter++,yl=Uu=null,qn=k,sn.H=G,sn.A=ee,Dn===null&&(fi=null,Nn=0,Kl()),re}function Xn(){for(;Dn!==null;)Va(Dn)}function dl(f,d){var b=qn;qn|=2;var k=cg(),G=ug();fi!==f||Nn!==d?(Hg=null,N0=Ta()+500,fc(f,d)):wf=Y(f,d);e:do try{if(ni!==0&&Dn!==null){d=Dn;var ee=Qa;t:switch(ni){case 1:ni=0,Qa=null,pl(f,d,ee,1);break;case 2:case 9:if(Ft(ee)){ni=0,Qa=null,hg(d);break}d=function(){ni!==2&&ni!==9||fi!==f||(ni=7),Pi(f)},ee.then(d,d);break e;case 3:ni=7;break e;case 4:ni=5;break e;case 7:Ft(ee)?(ni=0,Qa=null,hg(d)):(ni=0,Qa=null,pl(f,d,ee,7));break;case 5:var re=null;switch(Dn.tag){case 26:re=Dn.memoizedState;case 5:case 27:var Re=Dn,{type:lt,pendingProps:kt}=Re;if(re?s4(re):U9(Re.stateNode,lt,kt)){ni=0,Qa=null;var Ot=Re.sibling;if(Ot!==null)Dn=Ot;else{var qt=Re.return;qt!==null?(Dn=qt,Jh(qt)):Dn=null}break t}}ni=0,Qa=null,pl(f,d,ee,5);break;case 6:ni=0,Qa=null,pl(f,d,ee,6);break;case 8:_0(),Li=6;break e;default:throw Error(s(462))}}qs();break}catch(Lt){lg(f,Lt)}while(1);if(yl=Uu=null,sn.H=k,sn.A=G,qn=b,Dn!==null)return 0;return fi=null,Nn=0,Kl(),Li}function qs(){for(;Dn!==null&&!mj();)Va(Dn)}function Va(f){var d=Gm(f.alternate,f,_l);f.memoizedProps=f.pendingProps,d===null?Jh(f):Dn=d}function hg(f){var d=f,b=d.alternate;switch(d.tag){case 15:case 0:d=Au(b,d,d.pendingProps,d.type,void 0,Nn);break;case 11:d=Au(b,d,d.pendingProps,d.type.render,d.ref,Nn);break;case 5:Ud(d);default:Xm(b,d),d=Dn=Rt(d,_l),d=Gm(b,d,_l)}f.memoizedProps=f.pendingProps,d===null?Jh(f):Dn=d}function pl(f,d,b,k){yl=Uu=null,Ud(d),ff=null,D0=0;var G=d.return;try{if(O2(f,G,d,b,Nn)){Li=1,ac(f,Ve(b,f.current)),Dn=null;return}}catch(ee){if(G!==null)throw Dn=G,ee;Li=1,ac(f,Ve(b,f.current)),Dn=null;return}if(d.flags&32768){if(Bn||k===1)f=!0;else if(wf||(Nn&536870912)!==0)f=!1;else if(kc=f=!0,k===2||k===9||k===3||k===6)k=Ya.current,k!==null&&k.tag===13&&(k.flags|=16384);fg(d,f)}else Jh(d)}function Jh(f){var d=f;do{if((d.flags&32768)!==0){fg(d,kc);return}f=d.return;var b=N2(d.alternate,d,_l);if(b!==null){Dn=b;return}if(d=d.sibling,d!==null){Dn=d;return}Dn=d=f}while(d!==null);Li===0&&(Li=5)}function fg(f,d){do{var b=P2(f.alternate,f);if(b!==null){b.flags&=32767,Dn=b;return}if(b=f.return,b!==null&&(b.flags|=32768,b.subtreeFlags=0,b.deletions=null),!d&&(f=f.sibling,f!==null)){Dn=f;return}Dn=f=b}while(f!==null);Li=6,Dn=null}function dg(f,d,b,k,G,ee,re,Re,lt){f.cancelPendingCommit=null;do ml();while(ss!==0);if((qn&6)!==0)throw Error(s(327));if(d!==null){if(d===f.current)throw Error(s(177));if(ee=d.lanes|d.childLanes,ee|=rw,oe(f,b,ee,re,Re,lt),f===fi&&(Dn=fi=null,Nn=0),vf=d,Cc=f,xl=b,gw=ee,bw=G,w4=k,(d.subtreeFlags&10256)!==0||(d.flags&10256)!==0?(f.callbackNode=null,f.callbackPriority=0,xe(J2,function(){return _(),null})):(f.callbackNode=null,f.callbackPriority=0),k=(d.flags&13878)!==0,(d.subtreeFlags&13878)!==0||k){k=sn.T,sn.T=null,G=wl(),gs(2),re=qn,qn|=4;try{Jm(f,d,b)}finally{qn=re,gs(G),sn.T=k}}ss=1,pg(),mg(),gg()}}function pg(){if(ss===1){ss=0;var f=Cc,d=vf,b=(d.flags&13878)!==0;if((d.subtreeFlags&13878)!==0||b){b=sn.T,sn.T=null;var k=wl();gs(2);var G=qn;qn|=4;try{Zm(d,f),zA(f.containerInfo)}finally{qn=G,gs(k),sn.T=b}}f.current=d,ss=2}}function mg(){if(ss===2){ss=0;var f=Cc,d=vf,b=(d.flags&8772)!==0;if((d.subtreeFlags&8772)!==0||b){b=sn.T,sn.T=null;var k=wl();gs(2);var G=qn;qn|=4;try{u0(f,d.alternate,d)}finally{qn=G,gs(k),sn.T=b}}ss=3}}function gg(){if(ss===4||ss===3){ss=0,gj();var f=Cc,d=vf,b=xl,k=w4;(d.subtreeFlags&10256)!==0||(d.flags&10256)!==0?ss=5:(ss=0,vf=Cc=null,bg(f,f.pendingLanes));var G=f.pendingLanes;if(G===0&&(Ac=null),Pe(b),d=d.stateNode,Ka&&typeof Ka.onCommitFiberRoot==="function")try{Ka.onCommitFiberRoot(C0,d,void 0,(d.current.flags&128)===128)}catch(lt){}if(k!==null){d=sn.T,G=wl(),gs(2),sn.T=null;try{for(var ee=f.onRecoverableError,re=0;re<k.length;re++){var Re=k[re];ee(Re.value,{componentStack:Re.stack})}}finally{sn.T=d,gs(G)}}(xl&3)!==0&&ml(),Pi(f),G=f.pendingLanes,(b&261930)!==0&&(G&42)!==0?f===ww?B0++:(B0=0,ww=f):B0=0,$s&&ej(),cs(0,!1)}}function bg(f,d){(f.pooledCacheLanes&=d)===0&&(d=f.pooledCache,d!=null&&(f.pooledCache=null,ls(d)))}function ml(){return pg(),mg(),gg(),_()}function _(){if(ss!==5)return!1;var f=Cc,d=gw;gw=0;var b=Pe(xl),k=32>b?32:b;b=sn.T;var G=wl();try{gs(k),sn.T=null,k=bw,bw=null;var ee=Cc,re=xl;if(ss=0,vf=Cc=null,xl=0,(qn&6)!==0)throw Error(s(331));var Re=qn;if(qn|=4,ig(ee.current),eg(ee,ee.current,re,k),qn=Re,cs(0,!1),Ka&&typeof Ka.onPostCommitFiberRoot==="function")try{Ka.onPostCommitFiberRoot(C0,ee)}catch(lt){}return!0}finally{gs(G),sn.T=b,bg(f,d)}}function M(f,d,b){d=Ve(b,d),d=uo(f.stateNode,d,2),f=oo(f,d,2),f!==null&&(se(f,2),Pi(f))}function R(f,d,b){if(f.tag===3)M(f,f,b);else for(;d!==null;){if(d.tag===3){M(d,f,b);break}else if(d.tag===1){var k=d.stateNode;if(typeof d.type.getDerivedStateFromError==="function"||typeof k.componentDidCatch==="function"&&(Ac===null||!Ac.has(k))){f=Ve(b,f),b=xu(2),k=oo(d,b,2),k!==null&&(ho(b,k,d,f),se(k,2),Pi(k));break}}d=d.return}}function F(f,d,b){var k=f.pingCache;if(k===null){k=f.pingCache=new Cj;var G=new Set;k.set(d,G)}else G=k.get(d),G===void 0&&(G=new Set,k.set(d,G));G.has(b)||(dw=!0,G.add(b),f=Q.bind(null,f,d,b),d.then(f,f))}function Q(f,d,b){var k=f.pingCache;k!==null&&k.delete(d),f.pingedLanes|=f.suspendedLanes&b,f.warmLanes&=~b,fi===f&&(Nn&b)===b&&(Li===4||Li===3&&(Nn&62914560)===Nn&&300>Ta()-Lg?(qn&2)===0&&fc(f,0):pw|=b,yf===Nn&&(yf=0)),Pi(f)}function te(f,d){d===0&&(d=ne()),f=Yo(f,d),f!==null&&(se(f,d),Pi(f))}function ce(f){var d=f.memoizedState,b=0;d!==null&&(b=d.retryLane),te(f,b)}function Se(f,d){var b=0;switch(f.tag){case 31:case 13:var{stateNode:k,memoizedState:G}=f;G!==null&&(b=G.retryLane);break;case 19:k=f.stateNode;break;case 22:k=f.stateNode._retryCache;break;default:throw Error(s(314))}k!==null&&k.delete(d),te(f,b)}function xe(f,d){return kg(f,d)}function je(f,d,b,k){this.tag=f,this.key=b,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=k,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Le(f){return f=f.prototype,!(!f||!f.isReactComponent)}function Qe(f,d){var b=f.alternate;return b===null?(b=n(f.tag,d,f.key,f.mode),b.elementType=f.elementType,b.type=f.type,b.stateNode=f.stateNode,b.alternate=f,f.alternate=b):(b.pendingProps=d,b.type=f.type,b.flags=0,b.subtreeFlags=0,b.deletions=null),b.flags=f.flags&65011712,b.childLanes=f.childLanes,b.lanes=f.lanes,b.child=f.child,b.memoizedProps=f.memoizedProps,b.memoizedState=f.memoizedState,b.updateQueue=f.updateQueue,d=f.dependencies,b.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},b.sibling=f.sibling,b.index=f.index,b.ref=f.ref,b.refCleanup=f.refCleanup,b}function Rt(f,d){f.flags&=65011714;var b=f.alternate;return b===null?(f.childLanes=0,f.lanes=d,f.child=null,f.subtreeFlags=0,f.memoizedProps=null,f.memoizedState=null,f.updateQueue=null,f.dependencies=null,f.stateNode=null):(f.childLanes=b.childLanes,f.lanes=b.lanes,f.child=b.child,f.subtreeFlags=0,f.deletions=null,f.memoizedProps=b.memoizedProps,f.memoizedState=b.memoizedState,f.updateQueue=b.updateQueue,f.type=b.type,d=b.dependencies,f.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext}),f}function ft(f,d,b,k,G,ee){var re=0;if(k=f,typeof f==="function")Le(f)&&(re=1);else if(typeof f==="string")re=zr&&is?J9(f,b,Ms.current)?26:o4(f)?27:5:zr?J9(f,b,Ms.current)?26:5:is?o4(f)?27:5:5;else e:switch(f){case G2:return f=n(31,b,d,G),f.elementType=G2,f.lanes=ee,f;case ef:return zt(b.children,G,ee,d);case F9:re=8,G|=24;break;case B2:return f=n(12,b,d,G|2),f.elementType=B2,f.lanes=ee,f;case H2:return f=n(13,b,d,G),f.elementType=H2,f.lanes=ee,f;case U2:return f=n(19,b,d,G),f.elementType=U2,f.lanes=ee,f;default:if(typeof f==="object"&&f!==null)switch(f.$$typeof){case bc:re=10;break e;case N9:re=9;break e;case L2:re=11;break e;case z2:re=14;break e;case yc:re=16,k=null;break e}re=29,b=Error(s(130,f===null?"null":typeof f,"")),k=null}return d=n(re,b,d,G),d.elementType=f,d.type=k,d.lanes=ee,d}function zt(f,d,b,k){return f=n(7,f,k,d),f.lanes=b,f}function rn(f,d,b){return f=n(6,f,null,d),f.lanes=b,f}function Vi(f){var d=n(18,null,null,0);return d.stateNode=f,d}function Ds(f,d,b){return d=n(4,f.children!==null?f.children:[],f.key,d),d.lanes=b,d.stateNode={containerInfo:f.containerInfo,pendingChildren:null,implementation:f.implementation},d}function mo(f,d,b,k,G,ee,re,Re,lt){this.tag=1,this.containerInfo=f,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Lu,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ae(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ae(0),this.hiddenUpdates=ae(null),this.identifierPrefix=k,this.onUncaughtError=G,this.onCaughtError=ee,this.onRecoverableError=re,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=lt,this.incompleteTransitions=new Map}function dc(f,d,b,k,G,ee,re,Re,lt,kt,Ot,qt){return f=new mo(f,d,b,re,lt,kt,Ot,qt,Re),d=1,ee===!0&&(d|=24),ee=n(3,null,null,d),f.current=ee,ee.stateNode=f,d=os(),d.refCount++,f.pooledCache=d,d.refCount++,ee.memoizedState={element:k,isDehydrated:b,cache:d},Ha(ee),f}function pc(f){if(!f)return af;return f=af,f}function mc(f){var d=f._reactInternals;if(d===void 0){if(typeof f.render==="function")throw Error(s(188));throw f=Object.keys(f).join(","),Error(s(268,f))}return f=l(d),f=f!==null?c(f):null,f===null?null:x0(f.stateNode)}function gc(f,d,b,k,G,ee){G=pc(G),k.context===null?k.context=G:k.pendingContext=G,k=On(d),k.payload={element:b},ee=ee===void 0?null:ee,ee!==null&&(k.callback=ee),b=oo(f,k,d),b!==null&&(ms(b,f,d),lo(b,f,d))}function Bu(f,d){if(f=f.memoizedState,f!==null&&f.dehydrated!==null){var b=f.retryLane;f.retryLane=b!==0&&b<d?b:d}}function ti(f,d){Bu(f,d),(f=f.alternate)&&Bu(f,d)}var Sn={},ra=Object.assign,OA=Symbol.for("react.element"),wg=Symbol.for("react.transitional.element"),Zh=Symbol.for("react.portal"),ef=Symbol.for("react.fragment"),F9=Symbol.for("react.strict_mode"),B2=Symbol.for("react.profiler"),N9=Symbol.for("react.consumer"),bc=Symbol.for("react.context"),L2=Symbol.for("react.forward_ref"),H2=Symbol.for("react.suspense"),U2=Symbol.for("react.suspense_list"),z2=Symbol.for("react.memo"),yc=Symbol.for("react.lazy"),G2=Symbol.for("react.activity"),FA=Symbol.for("react.memo_cache_sentinel"),P9=Symbol.iterator,NA=Symbol.for("react.client.reference"),yg=Array.isArray,sn=Fa,{rendererVersion:PA,rendererPackageName:BA,extraDevToolsConfig:B9,getPublicInstance:x0,getRootHostContext:LA,getChildHostContext:HA,prepareForCommit:UA,resetAfterCommit:zA,createInstance:GA}=e;e.cloneMutableInstance;var{appendInitialChild:V2,finalizeInitialChildren:L9,shouldSetTextContent:vg,createTextInstance:H9}=e;e.cloneMutableTextInstance;var{scheduleTimeout:VA,cancelTimeout:XA,noTimeout:Lu,isPrimaryRenderer:gl}=e;e.warnsIfNotActing;var{supportsMutation:Ks,supportsPersistence:go,supportsHydration:$s,getInstanceFromNode:WA}=e;e.beforeActiveInstanceBlur;var KA=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var{setCurrentUpdatePriority:gs,getCurrentUpdatePriority:wl,resolveUpdatePriority:$A}=e;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var{shouldAttemptEagerTransition:YA,detachDeletedInstance:QA}=e;e.requestPostPaintCallback;var{maySuspendCommit:JA,maySuspendCommitOnUpdate:ZA,maySuspendCommitInSyncRender:X2,preloadInstance:U9,startSuspendingCommit:eC,suspendInstance:z9}=e;e.suspendOnActiveViewTransition;var tC=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var{NotPendingTransition:tf,HostTransitionContext:Hu,resetFormInstance:nC}=e;e.bindToConsole;var{supportsMicrotasks:iC,scheduleMicrotask:sC,supportsTestSelectors:T0,findFiberRoot:aC,getBoundingRect:rC,getTextContent:oC,isHiddenSubtree:A0,matchAccessibilityRole:lC,setFocusIfFocusable:cC,setupIntersectionObserver:uC,appendChild:hC,appendChildToContainer:fC,commitTextUpdate:dC,commitMount:pC,commitUpdate:mC,insertBefore:gC,insertInContainerBefore:bC,removeChild:yC,removeChildFromContainer:vC,resetTextContent:G9,hideInstance:SC,hideTextInstance:_C,unhideInstance:xC,unhideTextInstance:kC}=e;e.cancelViewTransitionName,e.cancelRootViewTransitionName,e.restoreRootViewTransitionName,e.cloneRootViewTransitionContainer,e.removeRootViewTransitionClone,e.measureClonedInstance,e.hasInstanceChanged,e.hasInstanceAffectedParent,e.startViewTransition,e.startGestureTransition,e.stopViewTransition,e.getCurrentGestureOffset,e.createViewTransitionInstance;var TC=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var{cloneInstance:AC,createContainerChildSet:V9,appendChildToContainerChildSet:X9,finalizeContainerChildren:CC,replaceContainerChildren:W9,cloneHiddenInstance:K9,cloneHiddenTextInstance:$9,isSuspenseInstancePending:W2,isSuspenseInstanceFallback:K2,getSuspenseInstanceFallbackErrorDetails:jC,registerSuspenseInstanceRetry:EC,canHydrateFormStateMarker:qC,isFormStateMarkerMatching:DC,getNextHydratableSibling:Y9,getNextHydratableSiblingAfterSingleton:IC,getFirstHydratableChild:MC,getFirstHydratableChildWithinContainer:RC,getFirstHydratableChildWithinActivityInstance:OC,getFirstHydratableChildWithinSuspenseInstance:FC,getFirstHydratableChildWithinSingleton:NC,canHydrateInstance:PC,canHydrateTextInstance:BC,canHydrateActivityInstance:LC,canHydrateSuspenseInstance:HC,hydrateInstance:UC,hydrateTextInstance:zC,hydrateActivityInstance:GC,hydrateSuspenseInstance:VC,getNextHydratableInstanceAfterActivityInstance:XC,getNextHydratableInstanceAfterSuspenseInstance:WC,commitHydratedInstance:$C,commitHydratedContainer:YC,commitHydratedActivityInstance:QC,commitHydratedSuspenseInstance:JC,finalizeHydratedChildren:ZC,flushHydrationEvents:ej}=e;e.clearActivityBoundary;var tj=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var{clearSuspenseBoundaryFromContainer:nj,hideDehydratedBoundary:ij,unhideDehydratedBoundary:sj,shouldDeleteUnhydratedTailInstances:Q9}=e;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var{validateHydratableInstance:aj,validateHydratableTextInstance:rj,supportsResources:zr,isHostHoistableType:J9,getHoistableRoot:$2,getResource:Z9,acquireResource:e4,releaseResource:t4,hydrateHoistable:oj,mountHoistable:n4,unmountHoistable:i4,createHoistableInstance:lj,prepareToCommitHoistables:cj,mayResourceSuspendCommit:uj,preloadResource:s4,suspendResource:hj,supportsSingletons:is,resolveSingletonInstance:a4,acquireSingletonInstance:fj,releaseSingletonInstance:r4,isHostSingletonType:o4,isSingletonScope:nf}=e,Y2=[],sf=-1,af={},Xa=Math.clz32?Math.clz32:I,{log:dj,LN2:pj}=Math,Sg=256,_g=262144,xg=4194304,kg=Ts,Q2=al,mj=ll,gj=il,Ta=Kn,l4=ol,bj=sl,J2=Is,wj=qa,yj=void 0,vj=void 0,C0=null,Ka=null,$a=typeof Object.is==="function"?Object.is:ze,c4=typeof reportError==="function"?reportError:function(f){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var d=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof f==="object"&&f!==null&&typeof f.message==="string"?String(f.message):String(f),error:f});if(!window.dispatchEvent(d))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",f);return}console.error(f)},Sj=Object.prototype.hasOwnProperty,Z2,u4,ew=!1,h4=new WeakMap,rf=[],of=0,Tg=null,j0=0,wr=[],yr=0,vc=null,bo=1,yo="",Ms=y(null),E0=y(null),Sc=y(null),Ag=y(null),Rs=null,Ei=null,Bn=!1,_c=null,vr=!1,tw=Error(s(519)),Cg=y(null),Uu=null,yl=null,_j=typeof AbortController<"u"?AbortController:function(){var f=[],d=this.signal={aborted:!1,addEventListener:function(b,k){f.push(k)}};this.abort=function(){d.aborted=!0,f.forEach(function(b){return b()})}},xj=Ts,kj=Is,qi={$$typeof:bc,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},jg=null,lf=null,nw=!1,Eg=!1,iw=!1,Gu=0,q0=null,sw=0,cf=0,uf=null,f4=sn.S;sn.S=function(f,d){b4=Ta(),typeof d==="object"&&d!==null&&typeof d.then==="function"&&Wl(f,d),f4!==null&&f4(f,d)};var Vu=y(null),hf=Error(s(460)),aw=Error(s(474)),qg=Error(s(542)),Dg={then:function(){}},Xu=null,ff=null,D0=0,Wu=Nd(!0),d4=Nd(!1),Sr=[],df=0,rw=0,xc=!1,ow=!1,pf=y(null),Ig=y(0),Ya=y(null),_r=null,Xi=y(0),vl=0,Tn=null,li=null,Yi=null,Mg=!1,mf=!1,Ku=!1,Rg=0,M0=0,gf=null,Tj=0,R0={readContext:Cn,use:tl,useCallback:_i,useContext:_i,useEffect:_i,useImperativeHandle:_i,useLayoutEffect:_i,useInsertionEffect:_i,useMemo:_i,useReducer:_i,useRef:_i,useState:_i,useDebugValue:_i,useDeferredValue:_i,useTransition:_i,useSyncExternalStore:_i,useId:_i,useHostTransitionStatus:_i,useFormState:_i,useActionState:_i,useOptimistic:_i,useMemoCache:_i,useCacheRefresh:_i};R0.useEffectEvent=_i;var p4={readContext:Cn,use:tl,useCallback:function(f,d){return ds().memoizedState=[f,d===void 0?null:d],f},useContext:Cn,useEffect:_m,useImperativeHandle:function(f,d,b){b=b!==null&&b!==void 0?b.concat([f]):null,gu(4194308,4,Am.bind(null,d,f),b)},useLayoutEffect:function(f,d){return gu(4194308,4,f,d)},useInsertionEffect:function(f,d){gu(4,2,f,d)},useMemo:function(f,d){var b=ds();d=d===void 0?null:d;var k=f();if(Ku){Ue(!0);try{f()}finally{Ue(!1)}}return b.memoizedState=[k,d],k},useReducer:function(f,d,b){var k=ds();if(b!==void 0){var G=b(d);if(Ku){Ue(!0);try{b(d)}finally{Ue(!1)}}}else G=d;return k.memoizedState=k.baseState=G,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:f,lastRenderedState:G},k.queue=f,f=f.dispatch=Su.bind(null,Tn,f),[k.memoizedState,f]},useRef:function(f){var d=ds();return f={current:f},d.memoizedState=f},useState:function(f){f=fu(f);var d=f.queue,b=_u.bind(null,Tn,d);return d.dispatch=b,[f.memoizedState,b]},useDebugValue:wu,useDeferredValue:function(f,d){var b=ds();return sc(b,f,d)},useTransition:function(){var f=fu(!1);return f=qm.bind(null,Tn,f.queue,!0,!1),ds().memoizedState=f,[!1,f]},useSyncExternalStore:function(f,d,b){var k=Tn,G=ds();if(Bn){if(b===void 0)throw Error(s(407));b=b()}else{if(b=d(),fi===null)throw Error(s(349));(Nn&127)!==0||nc(k,d,b)}G.memoizedState=b;var ee={value:b,getSnapshot:d};return G.queue=ee,_m(nl.bind(null,k,ee,f),[f]),k.flags|=2048,ic(9,{destroy:void 0},hu.bind(null,k,ee,b,d),null),b},useId:function(){var f=ds(),d=fi.identifierPrefix;if(Bn){var b=yo,k=bo;b=(k&~(1<<32-Xa(k)-1)).toString(32)+b,d="_"+d+"R_"+b,b=Rg++,0<b&&(d+="H"+b.toString(32)),d+="_"}else b=Tj++,d="_"+d+"r_"+b.toString(32)+"_";return f.memoizedState=d},useHostTransitionStatus:Jd,useFormState:$d,useActionState:$d,useOptimistic:function(f){var d=ds();d.memoizedState=d.baseState=f;var b={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return d.queue=b,d=Ga.bind(null,Tn,!0,b),b.dispatch=d,[f,d]},useMemoCache:zd,useCacheRefresh:function(){return ds().memoizedState=vu.bind(null,Tn)},useEffectEvent:function(f){var d=ds(),b={impl:f};return d.memoizedState=b,function(){if((qn&2)!==0)throw Error(s(440));return b.impl.apply(void 0,arguments)}}},lw={readContext:Cn,use:tl,useCallback:jm,useContext:Cn,useEffect:Nh,useImperativeHandle:Cm,useInsertionEffect:km,useLayoutEffect:Tm,useMemo:Qd,useReducer:tc,useRef:Sm,useState:function(){return tc(za)},useDebugValue:wu,useDeferredValue:function(f,d){var b=ji();return Em(b,li.memoizedState,f,d)},useTransition:function(){var f=tc(za)[0],d=ji().memoizedState;return[typeof f==="boolean"?f:ga(f),d]},useSyncExternalStore:au,useId:Im,useHostTransitionStatus:Jd,useFormState:vm,useActionState:vm,useOptimistic:function(f,d){var b=ji();return bm(b,li,f,d)},useMemoCache:zd,useCacheRefresh:yu};lw.useEffectEvent=xm;var m4={readContext:Cn,use:tl,useCallback:jm,useContext:Cn,useEffect:Nh,useImperativeHandle:Cm,useInsertionEffect:km,useLayoutEffect:Tm,useMemo:Qd,useReducer:Gd,useRef:Sm,useState:function(){return Gd(za)},useDebugValue:wu,useDeferredValue:function(f,d){var b=ji();return li===null?sc(b,f,d):Em(b,li.memoizedState,f,d)},useTransition:function(){var f=Gd(za)[0],d=ji().memoizedState;return[typeof f==="boolean"?f:ga(f),d]},useSyncExternalStore:au,useId:Im,useHostTransitionStatus:Jd,useFormState:Yd,useActionState:Yd,useOptimistic:function(f,d){var b=ji();if(li!==null)return bm(b,li,f,d);return b.baseState=f,[f,b.queue.dispatch]},useMemoCache:zd,useCacheRefresh:yu};m4.useEffectEvent=xm;var cw={enqueueSetState:function(f,d,b){f=f._reactInternals;var k=ka(),G=On(k);G.payload=d,b!==void 0&&b!==null&&(G.callback=b),d=oo(f,G,k),d!==null&&(ms(d,f,k),lo(d,f,k))},enqueueReplaceState:function(f,d,b){f=f._reactInternals;var k=ka(),G=On(k);G.tag=1,G.payload=d,b!==void 0&&b!==null&&(G.callback=b),d=oo(f,G,k),d!==null&&(ms(d,f,k),lo(d,f,k))},enqueueForceUpdate:function(f,d){f=f._reactInternals;var b=ka(),k=On(b);k.tag=2,d!==void 0&&d!==null&&(k.callback=d),d=oo(f,k,b),d!==null&&(ms(d,f,b),lo(d,f,b))}},uw=Error(s(461)),Qi=!1,hw={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},Sl=!1,Ji=!1,fw=!1,g4=typeof WeakSet==="function"?WeakSet:Set,bs=null,es=null,Aa=!1,Xr=null,bf=8192,Aj={getCacheForType:function(f){var d=Cn(qi),b=d.data.get(f);return b===void 0&&(b=f(),d.data.set(f,b)),b},cacheSignal:function(){return Cn(qi).controller.signal}},Og=0,Fg=1,Ng=2,Pg=3,Bg=4;if(typeof Symbol==="function"&&Symbol.for){var O0=Symbol.for;Og=O0("selector.component"),Fg=O0("selector.has_pseudo_class"),Ng=O0("selector.role"),Pg=O0("selector.test_id"),Bg=O0("selector.text")}var Cj=typeof WeakMap==="function"?WeakMap:Map,qn=0,fi=null,Dn=null,Nn=0,ni=0,Qa=null,kc=!1,wf=!1,dw=!1,_l=0,Li=0,Tc=0,$u=0,pw=0,Ja=0,yf=0,F0=null,Ca=null,mw=!1,Lg=0,b4=0,N0=1/0,Hg=null,Ac=null,ss=0,Cc=null,vf=null,xl=0,gw=0,bw=null,w4=null,B0=0,ww=null;return Sn.attemptContinuousHydration=function(f){if(f.tag===13||f.tag===31){var d=Yo(f,67108864);d!==null&&ms(d,f,67108864),ti(f,67108864)}},Sn.attemptHydrationAtCurrentPriority=function(f){if(f.tag===13||f.tag===31){var d=ka();d=Ne(d);var b=Yo(f,d);b!==null&&ms(b,f,d),ti(f,d)}},Sn.attemptSynchronousHydration=function(f){switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var d=P(f.pendingLanes);if(d!==0){f.pendingLanes|=2;for(f.entangledLanes|=2;d;){var b=1<<31-Xa(d);f.entanglements[1]|=b,d&=~b}Pi(f),(qn&6)===0&&(N0=Ta()+500,cs(0,!1))}}break;case 31:case 13:d=Yo(f,2),d!==null&&ms(d,f,2),og(),ti(f,2)}},Sn.batchedUpdates=function(f,d){return f(d)},Sn.createComponentSelector=function(f){return{$$typeof:Og,value:f}},Sn.createContainer=function(f,d,b,k,G,ee,re,Re,lt,kt){return dc(f,d,!1,null,b,k,ee,null,re,Re,lt,kt)},Sn.createHasPseudoClassSelector=function(f){return{$$typeof:Fg,value:f}},Sn.createHydrationContainer=function(f,d,b,k,G,ee,re,Re,lt,kt,Ot,qt,Lt,_n){return f=dc(b,k,!0,f,G,ee,Re,_n,lt,kt,Ot,qt),f.context=pc(null),b=f.current,k=ka(),k=Ne(k),G=On(k),G.callback=d!==void 0&&d!==null?d:null,oo(b,G,k),d=k,f.current.lanes=d,se(f,d),Pi(f),f},Sn.createPortal=function(f,d,b){var k=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Zh,key:k==null?null:""+k,children:f,containerInfo:d,implementation:b}},Sn.createRoleSelector=function(f){return{$$typeof:Ng,value:f}},Sn.createTestNameSelector=function(f){return{$$typeof:Pg,value:f}},Sn.createTextSelector=function(f){return{$$typeof:Bg,value:f}},Sn.defaultOnCaughtError=function(f){console.error(f)},Sn.defaultOnRecoverableError=function(f){c4(f)},Sn.defaultOnUncaughtError=function(f){c4(f)},Sn.deferredUpdates=function(f){var d=sn.T,b=wl();try{return gs(32),sn.T=null,f()}finally{gs(b),sn.T=d}},Sn.discreteUpdates=function(f,d,b,k,G){var ee=sn.T,re=wl();try{return gs(2),sn.T=null,f(d,b,k,G)}finally{gs(re),sn.T=ee,qn===0&&(N0=Ta()+500)}},Sn.findAllNodes=y0,Sn.findBoundingRects=function(f,d){if(!T0)throw Error(s(363));d=y0(f,d),f=[];for(var b=0;b<d.length;b++)f.push(rC(d[b]));for(d=f.length-1;0<d;d--){b=f[d];for(var k=b.x,G=k+b.width,ee=b.y,re=ee+b.height,Re=d-1;0<=Re;Re--)if(d!==Re){var lt=f[Re],kt=lt.x,Ot=kt+lt.width,qt=lt.y,Lt=qt+lt.height;if(k>=kt&&ee>=qt&&G<=Ot&&re<=Lt){f.splice(d,1);break}else if(!(k!==kt||b.width!==lt.width||Lt<ee||qt>re)){qt>ee&&(lt.height+=qt-ee,lt.y=ee),Lt<re&&(lt.height=re-qt),f.splice(d,1);break}else if(!(ee!==qt||b.height!==lt.height||Ot<k||kt>G)){kt>k&&(lt.width+=kt-k,lt.x=k),Ot<G&&(lt.width=G-kt),f.splice(d,1);break}}}return f},Sn.findHostInstance=mc,Sn.findHostInstanceWithNoPortals=function(f){return f=l(f),f=f!==null?p(f):null,f===null?null:x0(f.stateNode)},Sn.findHostInstanceWithWarning=function(f){return mc(f)},Sn.flushPassiveEffects=ml,Sn.flushSyncFromReconciler=function(f){var d=qn;qn|=1;var b=sn.T,k=wl();try{if(gs(2),sn.T=null,f)return f()}finally{gs(k),sn.T=b,qn=d,(qn&6)===0&&cs(0,!1)}},Sn.flushSyncWork=og,Sn.focusWithin=function(f,d){if(!T0)throw Error(s(363));f=b0(f),d=rg(f,d),d=Array.from(d);for(f=0;f<d.length;){var b=d[f++],k=b.tag;if(!A0(b)){if((k===5||k===26||k===27)&&cC(b.stateNode))return!0;for(b=b.child;b!==null;)d.push(b),b=b.sibling}}return!1},Sn.getFindAllNodesFailureDescription=function(f,d){if(!T0)throw Error(s(363));var b=0,k=[];f=[b0(f),0];for(var G=0;G<f.length;){var ee=f[G++],re=ee.tag,Re=f[G++],lt=d[Re];if(re!==5&&re!==26&&re!==27||!A0(ee)){if(br(ee,lt)&&(k.push(w0(lt)),Re++,Re>b&&(b=Re)),Re<d.length)for(ee=ee.child;ee!==null;)f.push(ee,Re),ee=ee.sibling}}if(b<d.length){for(f=[];b<d.length;b++)f.push(w0(d[b]));return`findAllNodes was able to match part of the selector:
|
|
22
|
+
`+(k.join(" > ")+`
|
|
23
|
+
|
|
24
|
+
No matching component was found for:
|
|
25
|
+
`)+f.join(" > ")}return null},Sn.getPublicRootInstance=function(f){if(f=f.current,!f.child)return null;switch(f.child.tag){case 27:case 5:return x0(f.child.stateNode);default:return f.child.stateNode}},Sn.injectIntoDevTools=function(){var f={bundleType:0,version:PA,rendererPackageName:BA,currentDispatcherRef:sn,reconcilerVersion:"19.2.0"};if(B9!==null&&(f.rendererConfig=B9),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")f=!1;else{var d=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(d.isDisabled||!d.supportsFiber)f=!0;else{try{C0=d.inject(f),Ka=d}catch(b){}f=d.checkDCE?!0:!1}}return f},Sn.isAlreadyRendering=function(){return(qn&6)!==0},Sn.observeVisibleRects=function(f,d,b,k){if(!T0)throw Error(s(363));f=y0(f,d);var G=uC(f,b,k).disconnect;return{disconnect:function(){G()}}},Sn.shouldError=function(){return null},Sn.shouldSuspend=function(){return!1},Sn.startHostTransition=function(f,d,b,k){if(f.tag!==5)throw Error(s(476));var G=Dm(f).queue;qm(f,G,d,tf,b===null?i:function(){var ee=Dm(f);return ee.next===null&&(ee=f.alternate.memoizedState),js(f,ee.next.queue,{},ka()),b(k)})},Sn.updateContainer=function(f,d,b,k){var G=d.current,ee=ka();return gc(G,ee,f,d,b,k),ee},Sn.updateContainerSync=function(f,d,b,k){return gc(d.current,2,f,d,b,k),2},Sn};Kp.exports.default=Kp.exports;Object.defineProperty(Kp.exports,"__esModule",{value:!0})});var bk=v(function(H$,gk){C();gk.exports=function(n,i,s){let a=w("loading"),r=w(),[l,c]=u(0),p=w(),m=w(),g=w();if(p.current!==n||m.current!==i||g.current!==s)a.current="loading",r.current=void 0,p.current=n,m.current=i,g.current=s;return Ge(function(){if(!n)return;var y=document.createElement("img");function x(){y.decode().catch(()=>{}).finally(()=>{a.current="loaded",r.current=y,c(Math.random())})}function j(){a.current="failed",r.current=void 0,c(Math.random())}return y.addEventListener("load",x),y.addEventListener("error",j),i&&(y.crossOrigin=i),s&&(y.referrerPolicy=s),y.src=n,function(){y.removeEventListener("load",x),y.removeEventListener("error",j)}},[n,i,s]),[r.current,a.current]}});function Zl(e){if(!e||e.length<2)return null;let n=[...e].sort((i,s)=>s.version-i.version);return{left:n[0],right:n[1]}}function y4(e,n){return Math.max(0,Math.min(e,Math.max(0,n-1)))}C();var Ej=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],ya=T("maximize",Ej);var qj=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],_a=T("minimize",qj);var Dj=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Ug=T("pause",Dj);var Ij=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Ec=T("play",Ij);var Mj=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],zg=T("repeat",Mj);var Rj=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Gg=T("volume-2",Rj);var Oj=[["path",{d:"M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z",key:"1p7khw"}],["path",{d:"m16.5 14.5 5-5",key:"cul3yw"}],["path",{d:"m16.5 9.5 5 5",key:"1akey5"}]],Vg=T("volume-x",Oj);C();var Fj=(e)=>o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[t("circle",{cx:"12",cy:"12",r:"10"}),t("path",{d:"m9 12 2 2 4-4"})]}),Nj=(e)=>o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",...e,children:[t("circle",{cx:"12",cy:"12",r:"10"}),t("path",{d:"m9 12 2 2 4-4",fill:"none",stroke:"white",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),v4={__CHAT__:"Generating...",__AUTOFILL__:"Autofilling metadata...",__EMBEDDING__:"Generating embeddings...",__RUNNING__:"Generating..."},Zi=({teamId:e,message:n,isReply:i,hasReplies:s,isLastReply:a,getUser:r,onReply:l,isSelected:c,onSelect:p,frameRate:m,startTimecode:g,formatTimestamp:y})=>{let x=n,j=!!x.annotations&&Array.isArray(x.annotations)&&x.annotations.length>0,I=x.creator,P=!!x.sessionId&&!!x.message&&x.message in v4,X=x.message&&v4[x.message]||"Generating...",[Y,J]=u(!1),[ne,ae]=u(null),{videoTimeDisplayMode:se}=Qt(),oe=O(()=>{if(x.second===null||x.second===void 0)return"";if(y)return y(x.second);if(!m)return"";let $e=Math.round(x.second*m);return In($e,m,se,g)},[x.second,m,se,g,y]),{data:he}=Z({queryKey:["teams",e,"me"],queryFn:async()=>{let $e=await A.api.teams[":teamId"].me.$get({param:{teamId:e}});if(!$e.ok)throw Error("Failed to fetch current member info");return await $e.json()},enabled:!!e,staleTime:300000}),we=he?.role==="owner",Ce=K(),{mutate:Ne}=U({mutationFn:async()=>{let $e=await A.api.comments[":commentId"].complete.$post({param:{commentId:x.id},json:{isCompleted:!x.isCompleted}});if(!$e.ok)throw Error("Failed to update comment completion status");return await $e.json()},onSuccess:()=>{Ce.invalidateQueries({predicate:($e)=>$e.queryKey.includes("comments")})}}),[Pe,Ue]=u(!1),{mutate:ze,isPending:He}=U({mutationFn:async()=>{let $e=await A.api.comments[":commentId"].$delete({param:{commentId:x.id}});if(!$e.ok)throw Error("Failed to delete comment");return await $e.json()},onSuccess:()=>{Ce.invalidateQueries({predicate:($e)=>$e.queryKey.includes("comments")}),Ue(!1)}}),De=O(()=>{if(!he)return!1;if(he.role==="owner")return!0;if(x.creator?.id===he.id)return!0;return!1},[he,x.creator?.id]),Fe=($e)=>$e.split(/(<@[a-zA-Z0-9_-]+>)/g).map((ct,Ze)=>{if(ct.match(/^<@[a-zA-Z0-9_-]+>$/)){let mt=ct.slice(2,-1),Xt=x.mentions?.find((hn)=>hn.id===mt)||r(mt);return o("span",{className:"text-primary font-medium hover:underline cursor-pointer",children:["@",Xt?.name||"Unknown"]},Ze)}return t("span",{children:ct},Ze)}),bt=($e)=>$e.replace(/<@([a-zA-Z0-9_-]+)>/g,"@$1").replace(/^\[([^\]]+)\]:/gm,"\\[$1\\]:"),Ve=()=>{l(x)};return o("div",{onClick:p,className:`relative flex gap-4 ${i?"mt-[-1px]":"mt-3"} mr-3 group p-3 py-4 border transition-all duration-200 cursor-pointer ${i?a?"rounded-b-xl rounded-t-none":"rounded-none":s?"rounded-t-xl rounded-b-none":"rounded-xl"} ${c?"z-20 border-blue-500/40 dark:border-blue-400/40 bg-blue-500/10 dark:bg-blue-400/10 shadow-sm":"z-10 border-transparent bg-foreground/2 dark:bg-foreground/10 hover:bg-foreground/4 dark:hover:bg-foreground/15"}`,children:[o("div",{className:"flex flex-col items-center shrink-0 w-8 relative",children:[i&&t("div",{className:"absolute top-[-1rem] h-8 w-0.5 bg-foreground/10 left-1/2 -translate-x-1/2 z-0"}),(s&&!i||i&&!a)&&t("div",{className:"absolute top-4 bottom-[-1rem] w-0.5 bg-foreground/10 left-1/2 -translate-x-1/2 z-0"}),o(Ee,{className:"z-10 relative",children:[I?.image&&t(Ie,{src:I.image,alt:I.name||"",className:"object-cover"}),t(Te,{className:"bg-rose-400 text-black",children:I?.name?.[0]?.toUpperCase()||"U"})]})]}),o("div",{className:"flex-1 min-w-0",children:[o("div",{className:"flex items-center justify-between w-full mb-1",children:[o("div",{className:"flex items-center gap-2",children:[t("span",{className:"font-semibold text-sm",children:I?.name||"Unknown"}),t("span",{className:"text-xs text-gray-400",children:new Date(x.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),De&&t("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:t(S,{size:"icon-xs",variant:"ghost",className:"h-6 w-6 cursor-pointer",onClick:($e)=>$e.stopPropagation(),children:t(cr,{className:"h-4 w-4 text-foreground/70"})})}),t(ye,{align:"end",onClick:($e)=>$e.stopPropagation(),children:o(W,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:($e)=>{$e.stopPropagation(),Ue(!0)},children:[t(ve,{className:"mr-2 h-4 w-4"}),t("span",{children:at()})]})})]})})]}),o("div",{className:"flow-root mt-1",children:[x.second!==null&&x.second!==void 0&&m&&t("div",{className:"float-left select-none bg-blue-100 dark:bg-blue-900/40 text-blue-600 dark:text-blue-300 px-2.5 py-1 mt-[2px] mr-2 rounded-sm text-xs leading-none font-mono font-bold flex items-center gap-1",children:oe}),j&&t("div",{className:"float-left select-none bg-blue-100 dark:bg-blue-900/40 text-blue-600 dark:text-blue-300 px-1 py-1 mt-[2px] mr-2 rounded-sm text-xs leading-none font-bold flex items-center gap-1",title:"Contains drawing annotations",children:t(ua,{className:"w-3.5 h-3.5"})}),P?o("div",{className:"space-y-2",children:[t(le,{className:"h-4 w-3/4"}),t(le,{className:"h-4 w-1/2"}),t("span",{className:"text-xs text-muted-foreground animate-pulse",children:X})]}):x.sessionId?t("div",{className:"text-sm leading-[1.8] prose prose-sm dark:prose-invert max-w-none break-words",children:t(xo,{children:bt(x.message)})}):t("div",{className:"text-sm leading-[1.8] whitespace-pre-wrap break-words text-wrap break-all",children:Fe(x.message)})]}),x.attachments&&x.attachments.length>0&&t("div",{className:"flex flex-col gap-1.5 mt-3 w-full max-w-full overflow-hidden",children:x.attachments.map(($e)=>{let Ct=$e.url?.split("/").pop()?.split("?")[0]||"file",ct=decodeURIComponent(Ct),Ze=Ls(ct);return o("div",{className:`group relative flex items-center w-full max-w-full rounded-lg border border-border bg-card hover:bg-muted/40 transition-colors overflow-hidden ${Ze?"h-18 p-1.5 gap-2.5 cursor-pointer":"h-9 px-2.5 gap-2.5"}`,onClick:()=>{if(Ze)ae({url:$e.url,name:ct});else window.open($e.url,"_blank","noreferrer")},children:[Ze?t("div",{className:"h-full aspect-square rounded-md overflow-hidden bg-muted/40 shrink-0",children:t("img",{src:$e.url,alt:ct,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-200"})}):t(Fn,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t("div",{className:"min-w-0 flex-1 overflow-hidden",children:t("p",{className:"text-xs font-medium text-foreground truncate block w-full",title:ct,children:ct})}),t("a",{href:$e.url,target:"_blank",rel:"noreferrer",download:ct,className:"p-1 text-muted-foreground hover:text-foreground shrink-0 rounded-md hover:bg-muted transition-colors opacity-0 group-hover:opacity-100",onClick:(mt)=>mt.stopPropagation(),title:gr(),children:t(vt,{className:"w-3.5 h-3.5"})})]},$e.id)})}),x.sessionId&&o("div",{className:"mt-3 pt-2 border-t border-foreground/5 flex items-center justify-between text-xs text-muted-foreground/60",children:[t("span",{className:"flex items-center gap-1.5 font-medium text-muted-foreground/80",children:"Created by Agent"}),we&&t(S,{variant:"outline",size:"xs",onClick:()=>J(!0),className:"cursor-pointer border-violet-500/20 text-violet-600 dark:text-violet-400 hover:bg-violet-500/10 hover:text-violet-700 hover:border-violet-500/30 font-semibold",children:"Logs"})]}),o("div",{className:"mt-2 flex items-center justify-between w-full",children:[t("button",{onClick:Ve,className:"text-xs font-medium text-gray-500 hover:text-blue-600 flex items-center gap-1 cursor-pointer",children:wC()}),t(bn,{children:o(wn,{children:[t(vn,{asChild:!0,children:t("button",{onClick:($e)=>{$e.stopPropagation(),Ne()},className:`flex items-center justify-center p-1 rounded-full transition-colors cursor-pointer ${x.isCompleted?"text-green-500 hover:text-green-600 hover:bg-green-500/10":"text-gray-400 hover:text-green-500 hover:bg-green-500/10"}`,children:x.isCompleted?t(Nj,{className:"w-5 h-5"}):t(Fj,{className:"w-5 h-5"})})}),t(xn,{children:x.isCompleted?Fw():Uw()})]})})]})]}),t(Ul,{sessionId:x.sessionId,open:Y,onOpenChange:J}),t(Je,{open:Pe,onOpenChange:Ue,children:o(Xe,{onClick:($e)=>$e.stopPropagation(),children:[o(et,{children:[t(rt,{children:Wm()}),t(nt,{children:Ym()})]}),o(tt,{children:[t(st,{disabled:He,onClick:($e)=>{$e.stopPropagation(),Ue(!1)},children:ke()}),t(ot,{className:"bg-destructive hover:bg-destructive/90 text-white",disabled:He,onClick:($e)=>{$e.stopPropagation(),ze()},children:at()})]})]})}),t(pe,{open:!!ne,onOpenChange:($e)=>!$e&&ae(null),children:o(ue,{className:"w-auto max-w-[80vw] sm:max-w-[80vw] max-h-[80vh] p-2 sm:p-3 bg-background/95 backdrop-blur-sm border-border flex flex-col items-center justify-center overflow-hidden",onClick:($e)=>$e.stopPropagation(),children:[t(me,{className:"sr-only",children:t(de,{children:ne?.name||"Image Preview"})}),ne&&o("div",{className:"flex flex-col items-center justify-center max-w-[80vw] max-h-[80vh] overflow-hidden",children:[t("img",{src:ne.url,alt:ne.name,className:"max-w-[80vw] max-h-[calc(80vh-2.5rem)] w-auto h-auto object-contain rounded-md"}),t("p",{className:"text-xs text-muted-foreground truncate max-w-full px-2 pt-1.5 text-center",children:ne.name})]})]})})]})};C();function ou({isOpen:e,onClose:n,onSuccess:i,children:s}){let[a,r]=u(""),[l,c]=u(""),[p,m]=u(!1),[g,y]=u(null);return o(gt,{open:e,onOpenChange:(j)=>!j&&n(),children:[t(At,{asChild:!0,children:s}),t(yt,{className:"w-80",align:"end",side:"top",children:o("form",{onSubmit:async(j)=>{j.preventDefault(),m(!0),y(null);try{let I=await A.api.identify.$post({json:{username:a,email:l}});if(!I.ok){let X=await I.json();throw Error(X.error||"Failed to identify")}let{id:P}=await I.json();localStorage.setItem("guest_user_id",P),i(P),n()}catch(I){y(I.message)}finally{m(!1)}},className:"space-y-4",children:[o("div",{className:"space-y-2",children:[t("h4",{className:"font-medium leading-none",children:Y_()}),t("p",{className:"text-sm text-muted-foreground",children:MS()})]}),o("div",{className:"grid gap-2",children:[o("div",{className:"grid gap-1",children:[t(V,{htmlFor:"name",children:hl()}),t(H,{id:"name",value:a,onChange:(j)=>r(j.target.value),placeholder:zv(),size:32,required:!0})]}),o("div",{className:"grid gap-1",children:[t(V,{htmlFor:"email",children:Cf()}),t(H,{id:"email",type:"email",value:l,onChange:(j)=>c(j.target.value),placeholder:U_(),required:!0})]}),g&&t("p",{className:"text-xs text-destructive",children:g})]}),o("div",{className:"flex justify-end gap-2",children:[t(S,{type:"button",variant:"outline",size:"sm",onClick:n,children:ke()}),o(S,{type:"submit",size:"sm",disabled:p,children:[p&&t(L,{className:"mr-2 h-3 w-3 animate-spin"}),Wa()]})]})]})})]})}C();var qe=z(So()),jt=z(jw()),d5=z(r6()),Hy=z(v6());function Ii(){return Ii=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},Ii.apply(null,arguments)}var kf=z(So()),S6="https://example.com",$E=function(n,i){if(/^[a-z]+:/i.test(i))return i;if(/^data:/.test(n))n=kf.default.location&&kf.default.location.href||"";var s=/^\/\//.test(n),a=!kf.default.location&&!/\/\//i.test(n);n=new kf.default.URL(n,kf.default.location||S6);var r=new URL(i,n);if(a)return r.href.slice(S6.length);else if(s)return r.href.slice(r.protocol.length);return r.href},Tf=$E;var $g=function(){function e(){this.listeners={}}var n=e.prototype;return n.on=function(s,a){if(!this.listeners[s])this.listeners[s]=[];this.listeners[s].push(a)},n.off=function(s,a){if(!this.listeners[s])return!1;var r=this.listeners[s].indexOf(a);return this.listeners[s]=this.listeners[s].slice(0),this.listeners[s].splice(r,1),r>-1},n.trigger=function(s){var a=this.listeners[s];if(!a)return;if(arguments.length===2){var r=a.length;for(var l=0;l<r;++l)a[l].call(this,arguments[1])}else{var c=Array.prototype.slice.call(arguments,1),p=a.length;for(var m=0;m<p;++m)a[m].apply(this,c)}},n.dispose=function(){this.listeners={}},n.pipe=function(s){this.on("data",function(a){s.push(a)})},e}();var Nw=z(So()),YE=function(n){return Nw.default.atob?Nw.default.atob(n):Buffer.from(n,"base64").toString("binary")};function W0(e){var n=YE(e),i=new Uint8Array(n.length);for(var s=0;s<n.length;s++)i[s]=n.charCodeAt(s);return i}/*! @name m3u8-parser @version 7.2.0 @license Apache-2.0 */class x6 extends $g{constructor(){super();this.buffer=""}push(e){let n;this.buffer+=e,n=this.buffer.indexOf(`
|
|
26
|
+
`);for(;n>-1;n=this.buffer.indexOf(`
|
|
27
|
+
`))this.trigger("data",this.buffer.substring(0,n)),this.buffer=this.buffer.substring(n+1)}}var QE=String.fromCharCode(9),Pw=function(e){let n=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),i={};if(n[1])i.length=parseInt(n[1],10);if(n[2])i.offset=parseInt(n[2],10);return i},JE=function(){return new RegExp("(?:^|,)("+'(?:[^=]*)=(?:"[^"]*"|[^,]*)'+")")},la=function(e){let n={};if(!e)return n;let i=e.split(JE()),s=i.length,a;while(s--){if(i[s]==="")continue;a=/([^=]*)=(.*)/.exec(i[s]).slice(1),a[0]=a[0].replace(/^\s+|\s+$/g,""),a[1]=a[1].replace(/^\s+|\s+$/g,""),a[1]=a[1].replace(/^['"](.*)['"]$/g,"$1"),n[a[0]]=a[1]}return n},_6=(e)=>{let n=e.split("x"),i={};if(n[0])i.width=parseInt(n[0],10);if(n[1])i.height=parseInt(n[1],10);return i};class k6 extends $g{constructor(){super();this.customParsers=[],this.tagMappers=[]}push(e){let n,i;if(e=e.trim(),e.length===0)return;if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((a,r)=>{let l=r(e);if(l===e)return a;return a.concat([l])},[e]).forEach((a)=>{for(let r=0;r<this.customParsers.length;r++)if(this.customParsers[r].call(this,a))return;if(a.indexOf("#EXT")!==0){this.trigger("data",{type:"comment",text:a.slice(1)});return}if(a=a.replace("\r",""),n=/^#EXTM3U/.exec(a),n){this.trigger("data",{type:"tag",tagType:"m3u"});return}if(n=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(a),n){if(i={type:"tag",tagType:"inf"},n[1])i.duration=parseFloat(n[1]);if(n[2])i.title=n[2];this.trigger("data",i);return}if(n=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(a),n){if(i={type:"tag",tagType:"targetduration"},n[1])i.duration=parseInt(n[1],10);this.trigger("data",i);return}if(n=/^#EXT-X-VERSION:([0-9.]*)?/.exec(a),n){if(i={type:"tag",tagType:"version"},n[1])i.version=parseInt(n[1],10);this.trigger("data",i);return}if(n=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(a),n){if(i={type:"tag",tagType:"media-sequence"},n[1])i.number=parseInt(n[1],10);this.trigger("data",i);return}if(n=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(a),n){if(i={type:"tag",tagType:"discontinuity-sequence"},n[1])i.number=parseInt(n[1],10);this.trigger("data",i);return}if(n=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(a),n){if(i={type:"tag",tagType:"playlist-type"},n[1])i.playlistType=n[1];this.trigger("data",i);return}if(n=/^#EXT-X-BYTERANGE:(.*)?$/.exec(a),n){i=Ii(Pw(n[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",i);return}if(n=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(a),n){if(i={type:"tag",tagType:"allow-cache"},n[1])i.allowed=!/NO/.test(n[1]);this.trigger("data",i);return}if(n=/^#EXT-X-MAP:(.*)$/.exec(a),n){if(i={type:"tag",tagType:"map"},n[1]){let r=la(n[1]);if(r.URI)i.uri=r.URI;if(r.BYTERANGE)i.byterange=Pw(r.BYTERANGE)}this.trigger("data",i);return}if(n=/^#EXT-X-STREAM-INF:(.*)$/.exec(a),n){if(i={type:"tag",tagType:"stream-inf"},n[1]){if(i.attributes=la(n[1]),i.attributes.RESOLUTION)i.attributes.RESOLUTION=_6(i.attributes.RESOLUTION);if(i.attributes.BANDWIDTH)i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10);if(i.attributes["FRAME-RATE"])i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"]);if(i.attributes["PROGRAM-ID"])i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10)}this.trigger("data",i);return}if(n=/^#EXT-X-MEDIA:(.*)$/.exec(a),n){if(i={type:"tag",tagType:"media"},n[1])i.attributes=la(n[1]);this.trigger("data",i);return}if(n=/^#EXT-X-ENDLIST/.exec(a),n){this.trigger("data",{type:"tag",tagType:"endlist"});return}if(n=/^#EXT-X-DISCONTINUITY/.exec(a),n){this.trigger("data",{type:"tag",tagType:"discontinuity"});return}if(n=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(a),n){if(i={type:"tag",tagType:"program-date-time"},n[1])i.dateTimeString=n[1],i.dateTimeObject=new Date(n[1]);this.trigger("data",i);return}if(n=/^#EXT-X-KEY:(.*)$/.exec(a),n){if(i={type:"tag",tagType:"key"},n[1]){if(i.attributes=la(n[1]),i.attributes.IV){if(i.attributes.IV.substring(0,2).toLowerCase()==="0x")i.attributes.IV=i.attributes.IV.substring(2);i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV)}}this.trigger("data",i);return}if(n=/^#EXT-X-START:(.*)$/.exec(a),n){if(i={type:"tag",tagType:"start"},n[1])i.attributes=la(n[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE);this.trigger("data",i);return}if(n=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(a),n){if(i={type:"tag",tagType:"cue-out-cont"},n[1])i.data=n[1];else i.data="";this.trigger("data",i);return}if(n=/^#EXT-X-CUE-OUT:(.*)?$/.exec(a),n){if(i={type:"tag",tagType:"cue-out"},n[1])i.data=n[1];else i.data="";this.trigger("data",i);return}if(n=/^#EXT-X-CUE-IN:?(.*)?$/.exec(a),n){if(i={type:"tag",tagType:"cue-in"},n[1])i.data=n[1];else i.data="";this.trigger("data",i);return}if(n=/^#EXT-X-SKIP:(.*)$/.exec(a),n&&n[1]){if(i={type:"tag",tagType:"skip"},i.attributes=la(n[1]),i.attributes.hasOwnProperty("SKIPPED-SEGMENTS"))i.attributes["SKIPPED-SEGMENTS"]=parseInt(i.attributes["SKIPPED-SEGMENTS"],10);if(i.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES"))i.attributes["RECENTLY-REMOVED-DATERANGES"]=i.attributes["RECENTLY-REMOVED-DATERANGES"].split(QE);this.trigger("data",i);return}if(n=/^#EXT-X-PART:(.*)$/.exec(a),n&&n[1]){if(i={type:"tag",tagType:"part"},i.attributes=la(n[1]),["DURATION"].forEach(function(r){if(i.attributes.hasOwnProperty(r))i.attributes[r]=parseFloat(i.attributes[r])}),["INDEPENDENT","GAP"].forEach(function(r){if(i.attributes.hasOwnProperty(r))i.attributes[r]=/YES/.test(i.attributes[r])}),i.attributes.hasOwnProperty("BYTERANGE"))i.attributes.byterange=Pw(i.attributes.BYTERANGE);this.trigger("data",i);return}if(n=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(a),n&&n[1]){i={type:"tag",tagType:"server-control"},i.attributes=la(n[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(r){if(i.attributes.hasOwnProperty(r))i.attributes[r]=parseFloat(i.attributes[r])}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(r){if(i.attributes.hasOwnProperty(r))i.attributes[r]=/YES/.test(i.attributes[r])}),this.trigger("data",i);return}if(n=/^#EXT-X-PART-INF:(.*)$/.exec(a),n&&n[1]){i={type:"tag",tagType:"part-inf"},i.attributes=la(n[1]),["PART-TARGET"].forEach(function(r){if(i.attributes.hasOwnProperty(r))i.attributes[r]=parseFloat(i.attributes[r])}),this.trigger("data",i);return}if(n=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(a),n&&n[1]){i={type:"tag",tagType:"preload-hint"},i.attributes=la(n[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(r){if(i.attributes.hasOwnProperty(r)){i.attributes[r]=parseInt(i.attributes[r],10);let l=r==="BYTERANGE-LENGTH"?"length":"offset";i.attributes.byterange=i.attributes.byterange||{},i.attributes.byterange[l]=i.attributes[r],delete i.attributes[r]}}),this.trigger("data",i);return}if(n=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(a),n&&n[1]){i={type:"tag",tagType:"rendition-report"},i.attributes=la(n[1]),["LAST-MSN","LAST-PART"].forEach(function(r){if(i.attributes.hasOwnProperty(r))i.attributes[r]=parseInt(i.attributes[r],10)}),this.trigger("data",i);return}if(n=/^#EXT-X-DATERANGE:(.*)$/.exec(a),n&&n[1]){i={type:"tag",tagType:"daterange"},i.attributes=la(n[1]),["ID","CLASS"].forEach(function(l){if(i.attributes.hasOwnProperty(l))i.attributes[l]=String(i.attributes[l])}),["START-DATE","END-DATE"].forEach(function(l){if(i.attributes.hasOwnProperty(l))i.attributes[l]=new Date(i.attributes[l])}),["DURATION","PLANNED-DURATION"].forEach(function(l){if(i.attributes.hasOwnProperty(l))i.attributes[l]=parseFloat(i.attributes[l])}),["END-ON-NEXT"].forEach(function(l){if(i.attributes.hasOwnProperty(l))i.attributes[l]=/YES/i.test(i.attributes[l])}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(l){if(i.attributes.hasOwnProperty(l))i.attributes[l]=i.attributes[l].toString(16)});let r=/^X-([A-Z]+-)+[A-Z]+$/;for(let l in i.attributes){if(!r.test(l))continue;let c=/[0-9A-Fa-f]{6}/g.test(i.attributes[l]),p=/^\d+(\.\d+)?$/.test(i.attributes[l]);i.attributes[l]=c?i.attributes[l].toString(16):p?parseFloat(i.attributes[l]):String(i.attributes[l])}this.trigger("data",i);return}if(n=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(a),n){this.trigger("data",{type:"tag",tagType:"independent-segments"});return}if(n=/^#EXT-X-I-FRAMES-ONLY/.exec(a),n){this.trigger("data",{type:"tag",tagType:"i-frames-only"});return}if(n=/^#EXT-X-CONTENT-STEERING:(.*)$/.exec(a),n){i={type:"tag",tagType:"content-steering"},i.attributes=la(n[1]),this.trigger("data",i);return}if(n=/^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(a),n){if(i={type:"tag",tagType:"i-frame-playlist"},i.attributes=la(n[1]),i.attributes.URI)i.uri=i.attributes.URI;if(i.attributes.BANDWIDTH)i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10);if(i.attributes.RESOLUTION)i.attributes.RESOLUTION=_6(i.attributes.RESOLUTION);if(i.attributes["AVERAGE-BANDWIDTH"])i.attributes["AVERAGE-BANDWIDTH"]=parseInt(i.attributes["AVERAGE-BANDWIDTH"],10);if(i.attributes["FRAME-RATE"])i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"]);this.trigger("data",i);return}if(n=/^#EXT-X-DEFINE:(.*)$/.exec(a),n){i={type:"tag",tagType:"define"},i.attributes=la(n[1]),this.trigger("data",i);return}this.trigger("data",{type:"tag",data:a.slice(4)})})}addParser({expression:e,customType:n,dataParser:i,segment:s}){if(typeof i!=="function")i=(a)=>a;this.customParsers.push((a)=>{if(e.exec(a))return this.trigger("data",{type:"custom",data:i(a),customType:n,segment:s}),!0})}addTagMapper({expression:e,map:n}){let i=(s)=>{if(e.test(s))return n(s);return s};this.tagMappers.push(i)}}var ZE=(e)=>e.toLowerCase().replace(/-(\w)/g,(n)=>n[1].toUpperCase()),Dc=function(e){let n={};return Object.keys(e).forEach(function(i){n[ZE(i)]=e[i]}),n},Bw=function(e){let{serverControl:n,targetDuration:i,partTargetDuration:s}=e;if(!n)return;let a="#EXT-X-SERVER-CONTROL",r="holdBack",l="partHoldBack",c=i&&i*3,p=s&&s*2;if(i&&!n.hasOwnProperty(r))n[r]=c,this.trigger("info",{message:`${a} defaulting HOLD-BACK to targetDuration * 3 (${c}).`});if(c&&n[r]<c)this.trigger("warn",{message:`${a} clamping HOLD-BACK (${n[r]}) to targetDuration * 3 (${c})`}),n[r]=c;if(s&&!n.hasOwnProperty(l))n[l]=s*3,this.trigger("info",{message:`${a} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${n[l]}).`});if(s&&n[l]<p)this.trigger("warn",{message:`${a} clamping PART-HOLD-BACK (${n[l]}) to partTargetDuration * 2 (${p}).`}),n[l]=p};class Hw extends $g{constructor(e={}){super();this.lineStream=new x6,this.parseStream=new k6,this.lineStream.pipe(this.parseStream),this.mainDefinitions=e.mainDefinitions||{},this.params=new URL(e.uri,"https://a.com").searchParams,this.lastProgramDateTime=null;let n=this,i=[],s={},a,r,l=!1,c=function(){},p={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},m="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",g=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};let y=0,x=0,j={};this.on("end",()=>{if(s.uri||!s.parts&&!s.preloadHints)return;if(!s.map&&a)s.map=a;if(!s.key&&r)s.key=r;if(!s.timeline&&typeof g==="number")s.timeline=g;this.manifest.preloadSegment=s}),this.parseStream.on("data",function(I){let P,X;if(n.manifest.definitions)for(let Y in n.manifest.definitions){if(I.uri)I.uri=I.uri.replace(`{$${Y}}`,n.manifest.definitions[Y]);if(I.attributes){for(let J in I.attributes)if(typeof I.attributes[J]==="string")I.attributes[J]=I.attributes[J].replace(`{$${Y}}`,n.manifest.definitions[Y])}}({tag(){({version(){if(I.version)this.manifest.version=I.version},"allow-cache"(){if(this.manifest.allowCache=I.allowed,!("allowed"in I))this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0},byterange(){let Y={};if("length"in I){if(s.byterange=Y,Y.length=I.length,!("offset"in I))I.offset=y}if("offset"in I)s.byterange=Y,Y.offset=I.offset;y=Y.offset+Y.length},endlist(){this.manifest.endList=!0},inf(){if(!("mediaSequence"in this.manifest))this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"});if(!("discontinuitySequence"in this.manifest))this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"});if(I.title)s.title=I.title;if(I.duration>0)s.duration=I.duration;if(I.duration===0)s.duration=0.01,this.trigger("info",{message:"updating zero segment duration to a small value"});this.manifest.segments=i},key(){if(!I.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(I.attributes.METHOD==="NONE"){r=null;return}if(!I.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(I.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:I.attributes};return}if(I.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:I.attributes.URI};return}if(I.attributes.KEYFORMAT===m){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(I.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(I.attributes.METHOD==="SAMPLE-AES-CENC")this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"});if(I.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(I.attributes.KEYID&&I.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:I.attributes.KEYFORMAT,keyId:I.attributes.KEYID.substring(2)},pssh:W0(I.attributes.URI.split(",")[1])};return}if(!I.attributes.METHOD)this.trigger("warn",{message:"defaulting key method to AES-128"});if(r={method:I.attributes.METHOD||"AES-128",uri:I.attributes.URI},typeof I.attributes.IV<"u")r.iv=I.attributes.IV},"media-sequence"(){if(!isFinite(I.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+I.number});return}this.manifest.mediaSequence=I.number},"discontinuity-sequence"(){if(!isFinite(I.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+I.number});return}this.manifest.discontinuitySequence=I.number,g=I.number},"playlist-type"(){if(!/VOD|EVENT/.test(I.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+I.playlist});return}this.manifest.playlistType=I.playlistType},map(){if(a={},I.uri)a.uri=I.uri;if(I.byterange)a.byterange=I.byterange;if(r)a.key=r},"stream-inf"(){if(this.manifest.playlists=i,this.manifest.mediaGroups=this.manifest.mediaGroups||p,!I.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}if(!s.attributes)s.attributes={};Ii(s.attributes,I.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||p,!(I.attributes&&I.attributes.TYPE&&I.attributes["GROUP-ID"]&&I.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}let Y=this.manifest.mediaGroups[I.attributes.TYPE];if(Y[I.attributes["GROUP-ID"]]=Y[I.attributes["GROUP-ID"]]||{},P=Y[I.attributes["GROUP-ID"]],X={default:/yes/i.test(I.attributes.DEFAULT)},X.default)X.autoselect=!0;else X.autoselect=/yes/i.test(I.attributes.AUTOSELECT);if(I.attributes.LANGUAGE)X.language=I.attributes.LANGUAGE;if(I.attributes.URI)X.uri=I.attributes.URI;if(I.attributes["INSTREAM-ID"])X.instreamId=I.attributes["INSTREAM-ID"];if(I.attributes.CHARACTERISTICS)X.characteristics=I.attributes.CHARACTERISTICS;if(I.attributes.FORCED)X.forced=/yes/i.test(I.attributes.FORCED);P[I.attributes.NAME]=X},discontinuity(){g+=1,s.discontinuity=!0,this.manifest.discontinuityStarts.push(i.length)},"program-date-time"(){if(typeof this.manifest.dateTimeString>"u")this.manifest.dateTimeString=I.dateTimeString,this.manifest.dateTimeObject=I.dateTimeObject;s.dateTimeString=I.dateTimeString,s.dateTimeObject=I.dateTimeObject;let{lastProgramDateTime:Y}=this;if(this.lastProgramDateTime=new Date(I.dateTimeString).getTime(),Y===null)this.manifest.segments.reduceRight((J,ne)=>(ne.programDateTime=J-ne.duration*1000,ne.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(I.duration)||I.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+I.duration});return}this.manifest.targetDuration=I.duration,Bw.call(this,this.manifest)},start(){if(!I.attributes||isNaN(I.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:I.attributes["TIME-OFFSET"],precise:I.attributes.PRECISE}},"cue-out"(){s.cueOut=I.data},"cue-out-cont"(){s.cueOutCont=I.data},"cue-in"(){s.cueIn=I.data},skip(){this.manifest.skip=Dc(I.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",I.attributes,["SKIPPED-SEGMENTS"])},part(){l=!0;let Y=this.manifest.segments.length,J=Dc(I.attributes);if(s.parts=s.parts||[],s.parts.push(J),J.byterange){if(!J.byterange.hasOwnProperty("offset"))J.byterange.offset=x;x=J.byterange.offset+J.byterange.length}let ne=s.parts.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PART #${ne} for segment #${Y}`,I.attributes,["URI","DURATION"]),this.manifest.renditionReports)this.manifest.renditionReports.forEach((ae,se)=>{if(!ae.hasOwnProperty("lastPart"))this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${se} lacks required attribute(s): LAST-PART`})})},"server-control"(){let Y=this.manifest.serverControl=Dc(I.attributes);if(!Y.hasOwnProperty("canBlockReload"))Y.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"});if(Bw.call(this,this.manifest),Y.canSkipDateranges&&!Y.hasOwnProperty("canSkipUntil"))this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){let Y=this.manifest.segments.length,J=Dc(I.attributes),ne=J.type&&J.type==="PART";if(s.preloadHints=s.preloadHints||[],s.preloadHints.push(J),J.byterange){if(!J.byterange.hasOwnProperty("offset")){if(J.byterange.offset=ne?x:0,ne)x=J.byterange.offset+J.byterange.length}}let ae=s.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${ae} for segment #${Y}`,I.attributes,["TYPE","URI"]),!J.type)return;for(let se=0;se<s.preloadHints.length-1;se++){let oe=s.preloadHints[se];if(!oe.type)continue;if(oe.type===J.type)this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${ae} for segment #${Y} has the same TYPE ${J.type} as preload hint #${se}`})}},"rendition-report"(){let Y=Dc(I.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(Y);let J=this.manifest.renditionReports.length-1,ne=["LAST-MSN","URI"];if(l)ne.push("LAST-PART");this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${J}`,I.attributes,ne)},"part-inf"(){if(this.manifest.partInf=Dc(I.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",I.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget)this.manifest.partTargetDuration=this.manifest.partInf.partTarget;Bw.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(Dc(I.attributes));let Y=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${Y}`,I.attributes,["ID","START-DATE"]);let J=this.manifest.dateRanges[Y];if(J.endDate&&J.startDate&&new Date(J.endDate)<new Date(J.startDate))this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"});if(J.duration&&J.duration<0)this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"});if(J.plannedDuration&&J.plannedDuration<0)this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});let ne=!!J.endOnNext;if(ne&&!J.class)this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"});if(ne&&(J.duration||J.endDate))this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"});if(J.duration&&J.endDate){let se=J.startDate.getTime()+J.duration*1000;this.manifest.dateRanges[Y].endDate=new Date(se)}if(!j[J.id])j[J.id]=J;else{for(let se in j[J.id])if(!!J[se]&&JSON.stringify(j[J.id][se])!==JSON.stringify(J[se])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}let ae=this.manifest.dateRanges.findIndex((se)=>se.id===J.id);this.manifest.dateRanges[ae]=Ii(this.manifest.dateRanges[ae],J),j[J.id]=Ii(j[J.id],J),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=Dc(I.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",I.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};let Y=(J,ne)=>{if(J in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${J}`});return}this.manifest.definitions[J]=ne};if("QUERYPARAM"in I.attributes){if("NAME"in I.attributes||"IMPORT"in I.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}let J=this.params.get(I.attributes.QUERYPARAM);if(!J){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${I.attributes.QUERYPARAM}`});return}Y(I.attributes.QUERYPARAM,decodeURIComponent(J));return}if("NAME"in I.attributes){if("IMPORT"in I.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in I.attributes)||typeof I.attributes.VALUE!=="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${I.attributes.NAME}`});return}Y(I.attributes.NAME,I.attributes.VALUE);return}if("IMPORT"in I.attributes){if(!this.mainDefinitions[I.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${I.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}Y(I.attributes.IMPORT,this.mainDefinitions[I.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:I.attributes,uri:I.uri,timeline:g}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",I.attributes,["BANDWIDTH","URI"])}}[I.tagType]||c).call(n)},uri(){if(s.uri=I.uri,i.push(s),this.manifest.targetDuration&&!("duration"in s))this.trigger("warn",{message:"defaulting segment duration to the target duration"}),s.duration=this.manifest.targetDuration;if(r)s.key=r;if(s.timeline=g,a)s.map=a;if(x=0,this.lastProgramDateTime!==null)s.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=s.duration*1000;s={}},comment(){},custom(){if(I.segment)s.custom=s.custom||{},s.custom[I.customType]=I.data;else this.manifest.custom=this.manifest.custom||{},this.manifest.custom[I.customType]=I.data}})[I.type].call(n)})}requiredCompatibilityversion(e,n){if(e<n||!e)this.trigger("warn",{message:`manifest must be at least version ${n}`})}warnOnMissingAttributes_(e,n,i){let s=[];if(i.forEach(function(a){if(!n.hasOwnProperty(a))s.push(a)}),s.length)this.trigger("warn",{message:`${e} lacks required attribute(s): ${s.join(", ")}`})}push(e){this.lineStream.push(e)}end(){if(this.lineStream.push(`
|
|
28
|
+
`),this.manifest.dateRanges.length&&this.lastProgramDateTime===null)this.trigger("warn",{message:"A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"});this.lastProgramDateTime=null,this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}var Ju=z(So()),Zu={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},eq=["video","audio","text"],T6=["Video","Audio","Text"],zw=function(n){if(!n)return n;return n.replace(/avc1\.(\d+)\.(\d+)/i,function(i,s,a){var r=("00"+Number(s).toString(16)).slice(-2),l=("00"+Number(a).toString(16)).slice(-2);return"avc1."+r+"00"+l})};var Kr=function(n){if(n===void 0)n="";var i=n.split(","),s=[];return i.forEach(function(a){a=a.trim();var r;if(eq.forEach(function(l){var c=Zu[l].exec(a.toLowerCase());if(!c||c.length<=1)return;r=l;var p=a.substring(0,c[1].length),m=a.replace(p,"");s.push({type:p,details:m,mediaType:l})}),!r)s.push({type:a,details:"",mediaType:"unknown"})}),s},A6=function(n,i){if(!n.mediaGroups.AUDIO||!i)return null;var s=n.mediaGroups.AUDIO[i];if(!s)return null;for(var a in s){var r=s[a];if(r.default&&r.playlists)return Kr(r.playlists[0].attributes.CODECS)}return null};var Gw=function(n){if(n===void 0)n="";return Zu.audio.test(n.trim().toLowerCase())},tq=function(n){if(n===void 0)n="";return Zu.text.test(n.trim().toLowerCase())},eh=function(n){if(!n||typeof n!=="string")return;var i=n.toLowerCase().split(",").map(function(r){return zw(r.trim())}),s="video";if(i.length===1&&Gw(i[0]))s="audio";else if(i.length===1&&tq(i[0]))s="application";var a="mp4";if(i.every(function(r){return Zu.mp4.test(r)}))a="mp4";else if(i.every(function(r){return Zu.webm.test(r)}))a="webm";else if(i.every(function(r){return Zu.ogg.test(r)}))a="ogg";return s+"/"+a+';codecs="'+n+'"'},Af=function(n,i){if(n===void 0)n="";if(i===void 0)i=!1;return Ju.default.MediaSource&&Ju.default.MediaSource.isTypeSupported&&Ju.default.MediaSource.isTypeSupported(eh(n))||i&&Ju.default.ManagedMediaSource&&Ju.default.ManagedMediaSource.isTypeSupported&&Ju.default.ManagedMediaSource.isTypeSupported(eh(n))||!1},Yg=function(n){if(n===void 0)n="";return n.toLowerCase().split(",").every(function(i){i=i.trim();for(var s=0;s<T6.length;s++){var a=T6[s];if(Zu["muxer"+a].test(i))return!0}return!1})},Vw="mp4a.40.2",C6="avc1.4d400d";var nq=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,iq=/^application\/dash\+xml/i,Xw=function(n){if(nq.test(n))return"hls";if(iq.test(n))return"dash";if(n==="application/vnd.videojs.vhs+json")return"vhs-json";return null};var j6=z(So());var sq=function(n){return n.toString(2).length},aq=function(n){return Math.ceil(sq(n)/8)};var Kw=function(n){if(ArrayBuffer.isView==="function")return ArrayBuffer.isView(n);return n&&n.buffer instanceof ArrayBuffer},rq=function(n){return Kw(n)},Vt=function(n){if(n instanceof Uint8Array)return n;if(!Array.isArray(n)&&!rq(n)&&!(n instanceof ArrayBuffer))if(typeof n!=="number"||typeof n==="number"&&n!==n)n=0;else n=[n];return new Uint8Array(n&&n.buffer||n,n&&n.byteOffset||0,n&&n.byteLength||0)};var Fs=j6.default.BigInt||Number,Ww=[Fs("0x1"),Fs("0x100"),Fs("0x10000"),Fs("0x1000000"),Fs("0x100000000"),Fs("0x10000000000"),Fs("0x1000000000000"),Fs("0x100000000000000"),Fs("0x10000000000000000")],rU=function(){var e=new Uint16Array([65484]),n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(n[0]===255)return"big";if(n[0]===204)return"little";return"unknown"}();var $w=function(n,i){var s=i===void 0?{}:i,a=s.signed,r=a===void 0?!1:a,l=s.le,c=l===void 0?!1:l;n=Vt(n);var p=c?"reduce":"reduceRight",m=n[p]?n[p]:Array.prototype[p],g=m.call(n,function(x,j,I){var P=c?I:Math.abs(I+1-n.length);return x+Fs(j)*Ww[P]},Fs(0));if(r){var y=Ww[n.length]/Fs(2)-Fs(1);if(g=Fs(g),g>y)g-=y,g-=y,g-=Fs(2)}return Number(g)},E6=function(n,i){var s=i===void 0?{}:i,a=s.le,r=a===void 0?!1:a;if(typeof n!=="bigint"&&typeof n!=="number"||typeof n==="number"&&n!==n)n=0;n=Fs(n);var l=aq(n),c=new Uint8Array(new ArrayBuffer(l));for(var p=0;p<l;p++){var m=r?p:Math.abs(p+1-c.length);if(c[m]=Number(n/Ww[p]&Fs(255)),n<0)c[m]=Math.abs(~c[m]),c[m]-=p===0?1:2}return c},Yw=function(n){if(!n)return"";n=Array.prototype.slice.call(n);var i=String.fromCharCode.apply(null,Vt(n));try{return decodeURIComponent(escape(i))}catch(s){}return i},Qg=function(n,i){if(typeof n!=="string"&&n&&typeof n.toString==="function")n=n.toString();if(typeof n!=="string")return new Uint8Array;if(!i)n=unescape(encodeURIComponent(n));var s=new Uint8Array(n.length);for(var a=0;a<n.length;a++)s[a]=n.charCodeAt(a);return s},q6=function(){for(var n=arguments.length,i=Array(n),s=0;s<n;s++)i[s]=arguments[s];if(i=i.filter(function(c){return c&&(c.byteLength||c.length)&&typeof c!=="string"}),i.length<=1)return Vt(i[0]);var a=i.reduce(function(c,p,m){return c+(p.byteLength||p.length)},0),r=new Uint8Array(a),l=0;return i.forEach(function(c){c=Vt(c),r.set(c,l),l+=c.byteLength}),r},Yn=function(n,i,s){var a=s===void 0?{}:s,r=a.offset,l=r===void 0?0:r,c=a.mask,p=c===void 0?[]:c;n=Vt(n),i=Vt(i);var m=i.every?i.every:Array.prototype.every;return i.length&&n.length-l>=i.length&&m.call(i,function(g,y){var x=p[y]?p[y]&n[l+y]:n[l+y];return g===x})};var ca=z(So());var D6=function(n,i,s){i.forEach(function(a){for(var r in n.mediaGroups[a])for(var l in n.mediaGroups[a][r]){var c=n.mediaGroups[a][r][l];s(c,a,r,l)}})};var Sv=uy();var{DOMImplementation:fD,XMLSerializer:dD}=Sv,dy=vv().DOMParser;/*! @name mpd-parser @version 1.4.0 @license Apache-2.0 */var _v=(e)=>!!e&&typeof e==="object",Ss=(...e)=>e.reduce((n,i)=>{if(typeof i!=="object")return n;return Object.keys(i).forEach((s)=>{if(Array.isArray(n[s])&&Array.isArray(i[s]))n[s]=n[s].concat(i[s]);else if(_v(n[s])&&_v(i[s]))n[s]=Ss(n[s],i[s]);else n[s]=i[s]}),n},{}),Ev=(e)=>Object.keys(e).map((n)=>e[n]),pD=(e,n)=>{let i=[];for(let s=e;s<n;s++)i.push(s);return i},Lf=(e)=>e.reduce((n,i)=>n.concat(i),[]),qv=(e)=>{if(!e.length)return[];let n=[];for(let i=0;i<e.length;i++)n.push(e[i]);return n},mD=(e,n)=>e.reduce((i,s,a)=>{if(s[n])i.push(a);return i},[]),gD=(e,n)=>Ev(e.reduce((i,s)=>(s.forEach((a)=>{i[n(a)]=a}),i),{})),Hf={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",INVALID_NUMBER_OF_CONTENT_STEERING:"INVALID_NUMBER_OF_CONTENT_STEERING",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"},ap=({baseUrl:e="",source:n="",range:i="",indexRange:s=""})=>{let a={uri:n,resolvedUri:Tf(e||"",n)};if(i||s){let l=(i?i:s).split("-"),c=ca.default.BigInt?ca.default.BigInt(l[0]):parseInt(l[0],10),p=ca.default.BigInt?ca.default.BigInt(l[1]):parseInt(l[1],10);if(c<Number.MAX_SAFE_INTEGER&&typeof c==="bigint")c=Number(c);if(p<Number.MAX_SAFE_INTEGER&&typeof p==="bigint")p=Number(p);let m;if(typeof p==="bigint"||typeof c==="bigint")m=ca.default.BigInt(p)-ca.default.BigInt(c)+ca.default.BigInt(1);else m=p-c+1;if(typeof m==="bigint"&&m<Number.MAX_SAFE_INTEGER)m=Number(m);a.byterange={length:m,offset:c}}return a},bD=(e)=>{let n;if(typeof e.offset==="bigint"||typeof e.length==="bigint")n=ca.default.BigInt(e.offset)+ca.default.BigInt(e.length)-ca.default.BigInt(1);else n=e.offset+e.length-1;return`${e.offset}-${n}`},xv=(e)=>{if(e&&typeof e!=="number")e=parseInt(e,10);if(isNaN(e))return null;return e},wD={static(e){let{duration:n,timescale:i=1,sourceDuration:s,periodDuration:a}=e,r=xv(e.endNumber),l=n/i;if(typeof r==="number")return{start:0,end:r};if(typeof a==="number")return{start:0,end:a/l};return{start:0,end:s/l}},dynamic(e){let{NOW:n,clientOffset:i,availabilityStartTime:s,timescale:a=1,duration:r,periodStart:l=0,minimumUpdatePeriod:c=0,timeShiftBufferDepth:p=1/0}=e,m=xv(e.endNumber),g=(n+i)/1000,y=s+l,j=g+c-y,I=Math.ceil(j*a/r),P=Math.floor((g-y-p)*a/r),X=Math.floor((g-y)*a/r);return{start:Math.max(0,P),end:typeof m==="number"?m:Math.min(I,X)}}},yD=(e)=>(n)=>{let{duration:i,timescale:s=1,periodStart:a,startNumber:r=1}=e;return{number:r+n,duration:i/s,timeline:a,time:n*i}},my=(e)=>{let{type:n,duration:i,timescale:s=1,periodDuration:a,sourceDuration:r}=e,{start:l,end:c}=wD[n](e),p=pD(l,c).map(yD(e));if(n==="static"){let m=p.length-1,g=typeof a==="number"?a:r;p[m].duration=g-i/s*m}return p},Dv=(e)=>{let{baseUrl:n,initialization:i={},sourceDuration:s,indexRange:a="",periodStart:r,presentationTime:l,number:c=0,duration:p}=e;if(!n)throw Error(Hf.NO_BASE_URL);let m=ap({baseUrl:n,source:i.sourceURL,range:i.range}),g=ap({baseUrl:n,source:n,indexRange:a});if(g.map=m,p){let y=my(e);if(y.length)g.duration=y[0].duration,g.timeline=y[0].timeline}else if(s)g.duration=s,g.timeline=r;return g.presentationTime=l||r,g.number=c,[g]},c1=(e,n,i)=>{let s=e.sidx.map?e.sidx.map:null,a=e.sidx.duration,r=e.timeline||0,l=e.sidx.byterange,c=l.offset+l.length,p=n.timescale,m=n.references.filter((X)=>X.referenceType!==1),g=[],y=e.endList?"static":"dynamic",x=e.sidx.timeline,j=x,I=e.mediaSequence||0,P;if(typeof n.firstOffset==="bigint")P=ca.default.BigInt(c)+n.firstOffset;else P=c+n.firstOffset;for(let X=0;X<m.length;X++){let Y=n.references[X],{referencedSize:J,subsegmentDuration:ne}=Y,ae;if(typeof P==="bigint")ae=P+ca.default.BigInt(J)-ca.default.BigInt(1);else ae=P+J-1;let se=`${P}-${ae}`,he=Dv({baseUrl:i,timescale:p,timeline:r,periodStart:x,presentationTime:j,number:I,duration:ne,sourceDuration:a,indexRange:se,type:y})[0];if(s)he.map=s;if(g.push(he),typeof P==="bigint")P+=ca.default.BigInt(J);else P+=J;j+=ne/p,I++}return e.segments=g,e},vD=["AUDIO","SUBTITLES"],SD=0.016666666666666666,Iv=(e)=>gD(e,({timeline:n})=>n).sort((n,i)=>n.timeline>i.timeline?1:-1),_D=(e,n)=>{for(let i=0;i<e.length;i++)if(e[i].attributes.NAME===n)return e[i];return null},kv=(e)=>{let n=[];return D6(e,vD,(i,s,a,r)=>{n=n.concat(i.playlists||[])}),n},Tv=({playlist:e,mediaSequence:n})=>{e.mediaSequence=n,e.segments.forEach((i,s)=>{i.number=e.mediaSequence+s})},xD=({oldPlaylists:e,newPlaylists:n,timelineStarts:i})=>{n.forEach((s)=>{s.discontinuitySequence=i.findIndex(function({timeline:p}){return p===s.timeline});let a=_D(e,s.attributes.NAME);if(!a)return;if(s.sidx)return;let r=s.segments[0],l=a.segments.findIndex(function(p){return Math.abs(p.presentationTime-r.presentationTime)<SD});if(l===-1){if(Tv({playlist:s,mediaSequence:a.mediaSequence+a.segments.length}),s.segments[0].discontinuity=!0,s.discontinuityStarts.unshift(0),!a.segments.length&&s.timeline>a.timeline||a.segments.length&&s.timeline>a.segments[a.segments.length-1].timeline)s.discontinuitySequence--;return}if(a.segments[l].discontinuity&&!r.discontinuity)r.discontinuity=!0,s.discontinuityStarts.unshift(0),s.discontinuitySequence--;Tv({playlist:s,mediaSequence:a.segments[l].number})})},kD=({oldManifest:e,newManifest:n})=>{let i=e.playlists.concat(kv(e)),s=n.playlists.concat(kv(n));return n.timelineStarts=Iv([e.timelineStarts,n.timelineStarts]),xD({oldPlaylists:i,newPlaylists:s,timelineStarts:n.timelineStarts}),n},rp=(e)=>e&&e.uri+"-"+bD(e.byterange),py=(e)=>{let n=e.reduce(function(s,a){if(!s[a.attributes.baseUrl])s[a.attributes.baseUrl]=[];return s[a.attributes.baseUrl].push(a),s},{}),i=[];return Object.values(n).forEach((s)=>{let a=Ev(s.reduce((r,l)=>{let c=l.attributes.id+(l.attributes.lang||"");if(!r[c])r[c]=l,r[c].attributes.timelineStarts=[];else{if(l.segments){if(l.segments[0])l.segments[0].discontinuity=!0;r[c].segments.push(...l.segments)}if(l.attributes.contentProtection)r[c].attributes.contentProtection=l.attributes.contentProtection}return r[c].attributes.timelineStarts.push({start:l.attributes.periodStart,timeline:l.attributes.periodStart}),r},{}));i=i.concat(a)}),i.map((s)=>(s.discontinuityStarts=mD(s.segments||[],"discontinuity"),s))},gy=(e,n)=>{let i=rp(e.sidx),s=i&&n[i]&&n[i].sidx;if(s)c1(e,s,e.sidx.resolvedUri);return e},TD=(e,n={})=>{if(!Object.keys(n).length)return e;for(let i in e)e[i]=gy(e[i],n);return e},AD=({attributes:e,segments:n,sidx:i,mediaSequence:s,discontinuitySequence:a,discontinuityStarts:r},l)=>{let c={attributes:{NAME:e.id,BANDWIDTH:e.bandwidth,CODECS:e.codecs,["PROGRAM-ID"]:1},uri:"",endList:e.type==="static",timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuitySequence:a,discontinuityStarts:r,timelineStarts:e.timelineStarts,mediaSequence:s,segments:n};if(e.contentProtection)c.contentProtection=e.contentProtection;if(e.serviceLocation)c.attributes.serviceLocation=e.serviceLocation;if(i)c.sidx=i;if(l)c.attributes.AUDIO="audio",c.attributes.SUBTITLES="subs";return c},CD=({attributes:e,segments:n,mediaSequence:i,discontinuityStarts:s,discontinuitySequence:a})=>{if(typeof n>"u")n=[{uri:e.baseUrl,timeline:e.periodStart,resolvedUri:e.baseUrl||"",duration:e.sourceDuration,number:0}],e.duration=e.sourceDuration;let r={NAME:e.id,BANDWIDTH:e.bandwidth,["PROGRAM-ID"]:1};if(e.codecs)r.CODECS=e.codecs;let l={attributes:r,uri:"",endList:e.type==="static",timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,timelineStarts:e.timelineStarts,discontinuityStarts:s,discontinuitySequence:a,mediaSequence:i,segments:n};if(e.serviceLocation)l.attributes.serviceLocation=e.serviceLocation;return l},jD=(e,n={},i=!1)=>{let s,a=e.reduce((r,l)=>{let c=l.attributes.role&&l.attributes.role.value||"",p=l.attributes.lang||"",m=l.attributes.label||"main";if(p&&!l.attributes.label){let y=c?` (${c})`:"";m=`${l.attributes.lang}${y}`}if(!r[m])r[m]={language:p,autoselect:!0,default:c==="main",playlists:[],uri:""};let g=gy(AD(l,i),n);if(r[m].playlists.push(g),typeof s>"u"&&c==="main")s=l,s.default=!0;return r},{});if(!s){let r=Object.keys(a)[0];a[r].default=!0}return a},ED=(e,n={})=>e.reduce((i,s)=>{let a=s.attributes.label||s.attributes.lang||"text",r=s.attributes.lang||"und";if(!i[a])i[a]={language:r,default:!1,autoselect:!1,playlists:[],uri:""};return i[a].playlists.push(gy(CD(s),n)),i},{}),qD=(e)=>e.reduce((n,i)=>{if(!i)return n;return i.forEach((s)=>{let{channel:a,language:r}=s;if(n[r]={autoselect:!1,default:!1,instreamId:a,language:r},s.hasOwnProperty("aspectRatio"))n[r].aspectRatio=s.aspectRatio;if(s.hasOwnProperty("easyReader"))n[r].easyReader=s.easyReader;if(s.hasOwnProperty("3D"))n[r]["3D"]=s["3D"]}),n},{}),DD=({attributes:e,segments:n,sidx:i,discontinuityStarts:s})=>{let a={attributes:{NAME:e.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:e.width,height:e.height},CODECS:e.codecs,BANDWIDTH:e.bandwidth,["PROGRAM-ID"]:1},uri:"",endList:e.type==="static",timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuityStarts:s,timelineStarts:e.timelineStarts,segments:n};if(e.frameRate)a.attributes["FRAME-RATE"]=e.frameRate;if(e.qualityRanking!==void 0)a.attributes.SCORE=1/(e.qualityRanking+1);if(e.contentProtection)a.contentProtection=e.contentProtection;if(e.serviceLocation)a.attributes.serviceLocation=e.serviceLocation;if(i)a.sidx=i;return a},ID=({attributes:e})=>e.mimeType==="video/mp4"||e.mimeType==="video/webm"||e.contentType==="video",MD=({attributes:e})=>e.mimeType==="audio/mp4"||e.mimeType==="audio/webm"||e.contentType==="audio",RD=({attributes:e})=>e.mimeType==="text/vtt"||e.contentType==="text",OD=(e,n)=>{e.forEach((i)=>{if(i.mediaSequence=0,i.discontinuitySequence=n.findIndex(function({timeline:s}){return s===i.timeline}),!i.segments)return;i.segments.forEach((s,a)=>{s.number=a})})},Av=(e)=>{if(!e)return[];return Object.keys(e).reduce((n,i)=>{let s=e[i];return n.concat(s.playlists)},[])},FD=({dashPlaylists:e,locations:n,contentSteering:i,sidxMapping:s={},previousManifest:a,eventStream:r})=>{if(!e.length)return{};let{sourceDuration:l,type:c,suggestedPresentationDelay:p,minimumUpdatePeriod:m}=e[0].attributes,g=py(e.filter(ID)).map(DD),y=py(e.filter(MD)),x=py(e.filter(RD)),j=e.map((ae)=>ae.attributes.captionServices).filter(Boolean),I={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},["CLOSED-CAPTIONS"]:{},SUBTITLES:{}},uri:"",duration:l,playlists:TD(g,s)};if(m>=0)I.minimumUpdatePeriod=m*1000;if(n)I.locations=n;if(i)I.contentSteering=i;if(c==="dynamic")I.suggestedPresentationDelay=p;if(r&&r.length>0)I.eventStream=r;let P=I.playlists.length===0,X=y.length?jD(y,s,P):null,Y=x.length?ED(x,s):null,J=g.concat(Av(X),Av(Y)),ne=J.map(({timelineStarts:ae})=>ae);if(I.timelineStarts=Iv(ne),OD(J,I.timelineStarts),X)I.mediaGroups.AUDIO.audio=X;if(Y)I.mediaGroups.SUBTITLES.subs=Y;if(j.length)I.mediaGroups["CLOSED-CAPTIONS"].cc=qD(j);if(a)return kD({oldManifest:a,newManifest:I});return I},ND=(e,n,i)=>{let{NOW:s,clientOffset:a,availabilityStartTime:r,timescale:l=1,periodStart:c=0,minimumUpdatePeriod:p=0}=e,m=(s+a)/1000,g=r+c,x=m+p-g;return Math.ceil((x*l-n)/i)},Mv=(e,n)=>{let{type:i,minimumUpdatePeriod:s=0,media:a="",sourceDuration:r,timescale:l=1,startNumber:c=1,periodStart:p}=e,m=[],g=-1;for(let y=0;y<n.length;y++){let x=n[y],j=x.d,I=x.r||0,P=x.t||0;if(g<0)g=P;if(P&&P>g)g=P;let X;if(I<0){let ne=y+1;if(ne===n.length)if(i==="dynamic"&&s>0&&a.indexOf("$Number$")>0)X=ND(e,g,j);else X=(r*l-g)/j;else X=(n[ne].t-g)/j}else X=I+1;let Y=c+m.length+X,J=c+m.length;while(J<Y)m.push({number:J,duration:j/l,time:g,timeline:p}),g+=j,J++}return m},PD=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,BD=(e)=>(n,i,s,a)=>{if(n==="$$")return"$";if(typeof e[i]>"u")return n;let r=""+e[i];if(i==="RepresentationID")return r;if(!s)a=1;else a=parseInt(a,10);if(r.length>=a)return r;return`${Array(a-r.length+1).join("0")}${r}`},Cv=(e,n)=>e.replace(PD,BD(n)),LD=(e,n)=>{if(!e.duration&&!n)return[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}];if(e.duration)return my(e);return Mv(e,n)},HD=(e,n)=>{let i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},{initialization:s={sourceURL:"",range:""}}=e,a=ap({baseUrl:e.baseUrl,source:Cv(s.sourceURL,i),range:s.range});return LD(e,n).map((l)=>{i.Number=l.number,i.Time=l.time;let c=Cv(e.media||"",i),p=e.timescale||1,m=e.presentationTimeOffset||0,g=e.periodStart+(l.time-m)/p;return{uri:c,timeline:l.timeline,duration:l.duration,resolvedUri:Tf(e.baseUrl||"",c),map:a,number:l.number,presentationTime:g}})},UD=(e,n)=>{let{baseUrl:i,initialization:s={}}=e,a=ap({baseUrl:i,source:s.sourceURL,range:s.range}),r=ap({baseUrl:i,source:n.media,range:n.mediaRange});return r.map=a,r},zD=(e,n)=>{let{duration:i,segmentUrls:s=[],periodStart:a}=e;if(!i&&!n||i&&n)throw Error(Hf.SEGMENT_TIME_UNSPECIFIED);let r=s.map((p)=>UD(e,p)),l;if(i)l=my(e);if(n)l=Mv(e,n);return l.map((p,m)=>{if(r[m]){let g=r[m],y=e.timescale||1,x=e.presentationTimeOffset||0;return g.timeline=p.timeline,g.duration=p.duration,g.number=p.number,g.presentationTime=a+(p.time-x)/y,g}}).filter((p)=>p)},GD=({attributes:e,segmentInfo:n})=>{let i,s;if(n.template)s=HD,i=Ss(e,n.template);else if(n.base)s=Dv,i=Ss(e,n.base);else if(n.list)s=zD,i=Ss(e,n.list);let a={attributes:e};if(!s)return a;let r=s(i,n.segmentTimeline);if(i.duration){let{duration:l,timescale:c=1}=i;i.duration=l/c}else if(r.length)i.duration=r.reduce((l,c)=>Math.max(l,Math.ceil(c.duration)),0);else i.duration=0;if(a.attributes=i,a.segments=r,n.base&&i.indexRange)a.sidx=r[0],a.segments=[];return a},VD=(e)=>e.map(GD),xi=(e,n)=>qv(e.childNodes).filter(({tagName:i})=>i===n),op=(e)=>e.textContent.trim(),XD=(e)=>parseFloat(e.split("/").reduce((n,i)=>n/i)),Bf=(e)=>{let c=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!c)return 0;let[p,m,g,y,x,j]=c.slice(1);return parseFloat(p||0)*31536000+parseFloat(m||0)*2592000+parseFloat(g||0)*86400+parseFloat(y||0)*3600+parseFloat(x||0)*60+parseFloat(j||0)},WD=(e)=>{if(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e))e+="Z";return Date.parse(e)},jv={mediaPresentationDuration(e){return Bf(e)},availabilityStartTime(e){return WD(e)/1000},minimumUpdatePeriod(e){return Bf(e)},suggestedPresentationDelay(e){return Bf(e)},type(e){return e},timeShiftBufferDepth(e){return Bf(e)},start(e){return Bf(e)},width(e){return parseInt(e,10)},height(e){return parseInt(e,10)},bandwidth(e){return parseInt(e,10)},frameRate(e){return XD(e)},startNumber(e){return parseInt(e,10)},timescale(e){return parseInt(e,10)},presentationTimeOffset(e){return parseInt(e,10)},duration(e){let n=parseInt(e,10);if(isNaN(n))return Bf(e);return n},d(e){return parseInt(e,10)},t(e){return parseInt(e,10)},r(e){return parseInt(e,10)},presentationTime(e){return parseInt(e,10)},qualityRanking(e){return parseInt(e,10)},qualityranking(e){return parseInt(e,10)},DEFAULT(e){return e}},KD={qualityranking:"qualityRanking"},ts=(e)=>{if(!(e&&e.attributes))return{};return qv(e.attributes).reduce((n,i)=>{let s=jv[i.name]||jv.DEFAULT,a=KD[i.name]||i.name;return n[a]=s(i.value),n},{})},$D={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime","urn:mpeg:dash:mp4protection:2011":"mp4protection"},u1=(e,n)=>{if(!n.length)return e;return Lf(e.map(function(i){return n.map(function(s){let a=op(s),r=Tf(i.baseUrl,a),l=Ss(ts(s),{baseUrl:r});if(r!==a&&!l.serviceLocation&&i.serviceLocation)l.serviceLocation=i.serviceLocation;return l})}))},by=(e)=>{let n=xi(e,"SegmentTemplate")[0],i=xi(e,"SegmentList")[0],s=i&&xi(i,"SegmentURL").map((y)=>Ss({tag:"SegmentURL"},ts(y))),a=xi(e,"SegmentBase")[0],r=i||n,l=r&&xi(r,"SegmentTimeline")[0],c=i||a||n,p=c&&xi(c,"Initialization")[0],m=n&&ts(n);if(m&&p)m.initialization=p&&ts(p);else if(m&&m.initialization)m.initialization={sourceURL:m.initialization};let g={template:m,segmentTimeline:l&&xi(l,"S").map((y)=>ts(y)),list:i&&Ss(ts(i),{segmentUrls:s,initialization:ts(p)}),base:a&&Ss(ts(a),{initialization:ts(p)})};return Object.keys(g).forEach((y)=>{if(!g[y])delete g[y]}),g},YD=(e,n,i)=>(s)=>{let a=xi(s,"BaseURL"),r=u1(n,a),l=Ss(e,ts(s)),c=by(s);return r.map((p)=>({segmentInfo:Ss(i,c),attributes:Ss(l,p)}))},QD=(e)=>e.reduce((n,i)=>{let s=ts(i);if(s.schemeIdUri)s.schemeIdUri=s.schemeIdUri.toLowerCase();let a=$D[s.schemeIdUri];if(a){n[a]={attributes:s};let r=xi(i,"cenc:pssh")[0];if(r){let l=op(r);n[a].pssh=l&&W0(l)}}return n},{}),JD=(e)=>{if(e.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof e.value!=="string"?[]:e.value.split(";")).map((i)=>{let s,a;if(a=i,/^CC\d=/.test(i))[s,a]=i.split("=");else if(/^CC\d$/.test(i))s=i;return{channel:s,language:a}});else if(e.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof e.value!=="string"?[]:e.value.split(";")).map((i)=>{let s={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(i)){let[a,r=""]=i.split("=");s.channel=a,s.language=i,r.split(",").forEach((l)=>{let[c,p]=l.split(":");if(c==="lang")s.language=p;else if(c==="er")s.easyReader=Number(p);else if(c==="war")s.aspectRatio=Number(p);else if(c==="3D")s["3D"]=Number(p)})}else s.language=i;if(s.channel)s.channel="SERVICE"+s.channel;return s})},ZD=(e)=>Lf(xi(e.node,"EventStream").map((n)=>{let i=ts(n),s=i.schemeIdUri;return xi(n,"Event").map((a)=>{let r=ts(a),l=r.presentationTime||0,c=i.timescale||1,p=r.duration||0,m=l/c+e.attributes.start;return{schemeIdUri:s,value:i.value,id:r.id,start:m,end:m+p/c,messageData:op(a)||r.messageData,contentEncoding:i.contentEncoding,presentationTimeOffset:i.presentationTimeOffset||0}})})),eI=(e,n,i)=>(s)=>{let a=ts(s),r=u1(n,xi(s,"BaseURL")),l=xi(s,"Role")[0],c={role:ts(l)},p=Ss(e,a,c),m=xi(s,"Accessibility")[0],g=JD(ts(m));if(g)p=Ss(p,{captionServices:g});let y=xi(s,"Label")[0];if(y&&y.childNodes.length){let X=y.childNodes[0].nodeValue.trim();p=Ss(p,{label:X})}let x=QD(xi(s,"ContentProtection"));if(Object.keys(x).length)p=Ss(p,{contentProtection:x});let j=by(s),I=xi(s,"Representation"),P=Ss(i,j);return Lf(I.map(YD(p,r,P)))},tI=(e,n)=>(i,s)=>{let a=u1(n,xi(i.node,"BaseURL")),r=Ss(e,{periodStart:i.attributes.start});if(typeof i.attributes.duration==="number")r.periodDuration=i.attributes.duration;let l=xi(i.node,"AdaptationSet"),c=by(i.node);return Lf(l.map(eI(r,a,c)))},nI=(e,n)=>{if(e.length>1)n({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"});if(!e.length)return null;let i=Ss({serverURL:op(e[0])},ts(e[0]));return i.queryBeforeStart=i.queryBeforeStart==="true",i},iI=({attributes:e,priorPeriodAttributes:n,mpdType:i})=>{if(typeof e.start==="number")return e.start;if(n&&typeof n.start==="number"&&typeof n.duration==="number")return n.start+n.duration;if(!n&&i==="static")return 0;return null},sI=(e,n={})=>{let{manifestUri:i="",NOW:s=Date.now(),clientOffset:a=0,eventHandler:r=function(){}}=n,l=xi(e,"Period");if(!l.length)throw Error(Hf.INVALID_NUMBER_OF_PERIOD);let c=xi(e,"Location"),p=ts(e),m=u1([{baseUrl:i}],xi(e,"BaseURL")),g=xi(e,"ContentSteering");if(p.type=p.type||"static",p.sourceDuration=p.mediaPresentationDuration||0,p.NOW=s,p.clientOffset=a,c.length)p.locations=c.map(op);let y=[];return l.forEach((x,j)=>{let I=ts(x),P=y[j-1];I.start=iI({attributes:I,priorPeriodAttributes:P?P.attributes:null,mpdType:p.type}),y.push({node:x,attributes:I})}),{locations:p.locations,contentSteeringInfo:nI(g,r),representationInfo:Lf(y.map(tI(p,m))),eventStream:Lf(y.map(ZD))}},Rv=(e)=>{if(e==="")throw Error(Hf.DASH_EMPTY_MANIFEST);let n=new dy,i,s;try{i=n.parseFromString(e,"application/xml"),s=i&&i.documentElement.tagName==="MPD"?i.documentElement:null}catch(a){}if(!s||s&&s.getElementsByTagName("parsererror").length>0)throw Error(Hf.DASH_INVALID_XML);return s},aI=(e)=>{let n=xi(e,"UTCTiming")[0];if(!n)return null;let i=ts(n);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw Error(Hf.UNSUPPORTED_UTC_TIMING_SCHEME)}return i};var Ov=(e,n={})=>{let i=sI(Rv(e),n),s=VD(i.representationInfo);return FD({dashPlaylists:s,locations:i.locations,contentSteering:i.contentSteeringInfo,sidxMapping:n.sidxMapping,previousManifest:n.previousManifest,eventStream:i.eventStream})},Fv=(e)=>aI(Rv(e));var K8=z(Uv());var lI=Vt([73,68,51]),cI=function(n,i){if(i===void 0)i=0;n=Vt(n);var s=n[i+5],a=n[i+6]<<21|n[i+7]<<14|n[i+8]<<7|n[i+9],r=(s&16)>>4;if(r)return a+20;return a+10},nh=function e(n,i){if(i===void 0)i=0;if(n=Vt(n),n.length-i<10||!Yn(n,lI,{offset:i}))return i;return i+=cI(n,i),e(n,i)};var NU=new Uint8Array([79,112,117,115,72,101,97,100]);var Vv=function(n){if(typeof n==="string")return Qg(n);if(typeof n==="number")return n;return n},mI=function(n){if(!Array.isArray(n))return[Vv(n)];return n.map(function(i){return Vv(i)})},wy,Xv=function(n){n=Vt(n);var i=[],s=0;while(n.length>s){var a=n[s],r=0,l=0;l++;var c=n[l];l++;while(c&128)r=(c&127)<<7,c=n[l],l++;r+=c&127;for(var p=0;p<wy.length;p++){var m=wy[p],{id:g,parser:y}=m;if(a===g){i.push(y(n.subarray(l,l+r)));break}}s+=r+l}return i};wy=[{id:3,parser:function(n){var i={tag:3,id:n[0]<<8|n[1],flags:n[2],size:3,dependsOnEsId:0,ocrEsId:0,descriptors:[],url:""};if(i.flags&128)i.dependsOnEsId=n[i.size]<<8|n[i.size+1],i.size+=2;if(i.flags&64){var s=n[i.size];i.url=Yw(n.subarray(i.size+1,i.size+1+s)),i.size+=s}if(i.flags&32)i.ocrEsId=n[i.size]<<8|n[i.size+1],i.size+=2;return i.descriptors=Xv(n.subarray(i.size))||[],i}},{id:4,parser:function(n){var i={tag:4,oti:n[0],streamType:n[1],bufferSize:n[2]<<16|n[3]<<8|n[4],maxBitrate:n[5]<<24|n[6]<<16|n[7]<<8|n[8],avgBitrate:n[9]<<24|n[10]<<16|n[11]<<8|n[12],descriptors:Xv(n.subarray(13))};return i}},{id:5,parser:function(n){return{tag:5,bytes:n}}},{id:6,parser:function(n){return{tag:6,bytes:n}}}];var Wv=function e(n,i,s){if(s===void 0)s=!1;i=mI(i),n=Vt(n);var a=[];if(!i.length)return a;var r=0;while(r<n.length){var l=(n[r]<<24|n[r+1]<<16|n[r+2]<<8|n[r+3])>>>0,c=n.subarray(r+4,r+8);if(l===0)break;var p=r+l;if(p>n.length){if(s)break;p=n.length}var m=n.subarray(r+8,p);if(Yn(c,i[0]))if(i.length===1)a.push(m);else a.push.apply(a,e(m,i.slice(1),s));r=p}return a};var lp={EBML:Vt([26,69,223,163]),DocType:Vt([66,130]),Segment:Vt([24,83,128,103]),SegmentInfo:Vt([21,73,169,102]),Tracks:Vt([22,84,174,107]),Track:Vt([174]),TrackNumber:Vt([215]),DefaultDuration:Vt([35,227,131]),TrackEntry:Vt([174]),TrackType:Vt([131]),FlagDefault:Vt([136]),CodecID:Vt([134]),CodecPrivate:Vt([99,162]),VideoTrack:Vt([224]),AudioTrack:Vt([225]),Cluster:Vt([31,67,182,117]),Timestamp:Vt([231]),TimestampScale:Vt([42,215,177]),BlockGroup:Vt([160]),BlockDuration:Vt([155]),Block:Vt([161]),SimpleBlock:Vt([163])},yy=[128,64,32,16,8,4,2,1],gI=function(n){var i=1;for(var s=0;s<yy.length;s++){if(n&yy[s])break;i++}return i},h1=function(n,i,s,a){if(s===void 0)s=!0;if(a===void 0)a=!1;var r=gI(n[i]),l=n.subarray(i,i+r);if(s)l=Array.prototype.slice.call(n,i,i+r),l[0]^=yy[r-1];return{length:r,value:$w(l,{signed:a}),bytes:l}},Kv=function e(n){if(typeof n==="string")return n.match(/.{1,2}/g).map(function(i){return e(i)});if(typeof n==="number")return E6(n);return n},bI=function(n){if(!Array.isArray(n))return[Kv(n)];return n.map(function(i){return Kv(i)})},wI=function e(n,i,s){if(s>=i.length)return i.length;var a=h1(i,s,!1);if(Yn(n.bytes,a.bytes))return s;var r=h1(i,s+a.length);return e(n,i,s+r.length+r.value+a.length)},vy=function e(n,i){i=bI(i),n=Vt(n);var s=[];if(!i.length)return s;var a=0;while(a<n.length){var r=h1(n,a,!1),l=h1(n,a+r.length),c=a+r.length+l.length;if(l.value===127){if(l.value=wI(r,n,c),l.value!==n.length)l.value-=c}var p=c+l.value>n.length?n.length:c+l.value,m=n.subarray(c,p);if(Yn(i[0],r.bytes))if(i.length===1)s.push(m);else s=s.concat(e(m,i.slice(1)));var g=r.length+l.length+m.length;a+=g}return s};var yI=Vt([0,0,0,1]),vI=Vt([0,0,1]),SI=Vt([0,0,3]),_I=function(n){var i=[],s=1;while(s<n.length-2){if(Yn(n.subarray(s,s+3),SI))i.push(s+2),s++;s++}if(i.length===0)return n;var a=n.length-i.length,r=new Uint8Array(a),l=0;for(s=0;s<a;l++,s++){if(l===i[0])l++,i.shift();r[s]=n[l]}return r},$v=function(n,i,s,a){if(a===void 0)a=1/0;n=Vt(n),s=[].concat(s);var r=0,l,c=0;while(r<n.length&&(c<a||l)){var p=void 0;if(Yn(n.subarray(r),yI))p=4;else if(Yn(n.subarray(r),vI))p=3;if(!p){r++;continue}if(c++,l)return _I(n.subarray(l,r));var m=void 0;if(i==="h264")m=n[r+p]&31;else if(i==="h265")m=n[r+p]>>1&63;if(s.indexOf(m)!==-1)l=r+p;r+=p+(i==="h264"?1:2)}return n.subarray(0,0)},Yv=function(n,i,s){return $v(n,"h264",i,s)},Qv=function(n,i,s){return $v(n,"h265",i,s)};var Qs={webm:Vt([119,101,98,109]),matroska:Vt([109,97,116,114,111,115,107,97]),flac:Vt([102,76,97,67]),ogg:Vt([79,103,103,83]),ac3:Vt([11,119]),riff:Vt([82,73,70,70]),avi:Vt([65,86,73]),wav:Vt([87,65,86,69]),"3gp":Vt([102,116,121,112,51,103]),mp4:Vt([102,116,121,112]),fmp4:Vt([115,116,121,112]),mov:Vt([102,116,121,112,113,116]),moov:Vt([109,111,111,118]),moof:Vt([109,111,111,102]),vtt:Vt([87,69,66,86,84,84])},Uf={aac:function(n){var i=nh(n);return Yn(n,[255,16],{offset:i,mask:[255,22]})},mp3:function(n){var i=nh(n);return Yn(n,[255,2],{offset:i,mask:[255,6]})},webm:function(n){var i=vy(n,[lp.EBML,lp.DocType])[0];return Yn(i,Qs.webm)},mkv:function(n){var i=vy(n,[lp.EBML,lp.DocType])[0];return Yn(i,Qs.matroska)},mp4:function(n){if(Uf["3gp"](n)||Uf.mov(n))return!1;if(Yn(n,Qs.mp4,{offset:4})||Yn(n,Qs.fmp4,{offset:4}))return!0;if(Yn(n,Qs.moof,{offset:4})||Yn(n,Qs.moov,{offset:4}))return!0},mov:function(n){return Yn(n,Qs.mov,{offset:4})},"3gp":function(n){return Yn(n,Qs["3gp"],{offset:4})},ac3:function(n){var i=nh(n);return Yn(n,Qs.ac3,{offset:i})},vtt:function(n){return Yn(n,Qs.vtt)},ts:function(n){if(n.length<189&&n.length>=1)return n[0]===71;var i=0;while(i+188<n.length&&i<188){if(n[i]===71&&n[i+188]===71)return!0;i+=1}return!1},flac:function(n){var i=nh(n);return Yn(n,Qs.flac,{offset:i})},ogg:function(n){return Yn(n,Qs.ogg)},avi:function(n){return Yn(n,Qs.riff)&&Yn(n,Qs.avi,{offset:8})},wav:function(n){return Yn(n,Qs.riff)&&Yn(n,Qs.wav,{offset:8})},h264:function(n){return Yv(n,7,3).length},h265:function(n){return Qv(n,[32,33],3).length}},Sy=Object.keys(Uf).filter(function(e){return e!=="ts"&&e!=="h264"&&e!=="h265"}).concat(["ts","h264","h265"]);Sy.forEach(function(e){var n=Uf[e];Uf[e]=function(i){return n(Vt(i))}});var xI=Uf,f1=function(n){n=Vt(n);for(var i=0;i<Sy.length;i++){var s=Sy[i];if(xI[s](n))return s}return""},Zv=function(n){return Wv(n,["moof"]).length>0};var Nc=z(s8()),Uy="8.24.0",ql={},Lc=function(e,n){if(ql[e]=ql[e]||[],n)ql[e]=ql[e].concat(n);return ql[e]},kI=function(e,n){Lc(e,n)},$8=function(e,n){let i=Lc(e).indexOf(n);if(i<=-1)return!1;return ql[e]=ql[e].slice(),ql[e].splice(i,1),!0},TI=function(e,n){Lc(e,[].concat(n).map((i)=>{let s=(...a)=>($8(e,s),i(...a));return s}))},S1={prefixed:!0},w1=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],a8=w1[0],fp;for(let e=0;e<w1.length;e++)if(w1[e][1]in jt.default){fp=w1[e];break}if(fp){for(let e=0;e<fp.length;e++)S1[a8[e]]=fp[e];S1.prefixed=fp[0]!==a8[0]}var Ia=[],AI=(e,n,i)=>(s,a,r)=>{let l=n.levels[a],c=new RegExp(`^(${l})$`),p=e;if(s!=="log")r.unshift(s.toUpperCase()+":");if(i)p=`%c${e}`,r.unshift(i);if(r.unshift(p+":"),Ia){Ia.push([].concat(r));let g=Ia.length-1000;Ia.splice(0,g>0?g:0)}if(!qe.default.console)return;let m=qe.default.console[s];if(!m&&s==="debug")m=qe.default.console.info||qe.default.console.log;if(!m||!l||!c.test(s))return;m[Array.isArray(r)?"apply":"call"](qe.default.console,r)};function zy(e,n=":",i=""){let s="info",a;function r(...l){a("log",s,l)}return a=AI(e,r,i),r.createLogger=(l,c,p)=>{let m=c!==void 0?c:n,g=p!==void 0?p:i,y=`${e} ${m} ${l}`;return zy(y,m,g)},r.createNewLogger=(l,c,p)=>zy(l,c,p),r.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:s},r.level=(l)=>{if(typeof l==="string"){if(!r.levels.hasOwnProperty(l))throw Error(`"${l}" in not a valid log level`);s=l}return s},r.history=()=>Ia?[].concat(Ia):[],r.history.filter=(l)=>(Ia||[]).filter((c)=>new RegExp(`.*${l}.*`).test(c[0])),r.history.clear=()=>{if(Ia)Ia.length=0},r.history.disable=()=>{if(Ia!==null)Ia.length=0,Ia=null},r.history.enable=()=>{if(Ia===null)Ia=[]},r.error=(...l)=>a("error",s,l),r.warn=(...l)=>a("warn",s,l),r.debug=(...l)=>a("debug",s,l),r}var An=zy("VIDEOJS"),Y8=An.createLogger,CI=Object.prototype.toString,Q8=function(e){return Mo(e)?Object.keys(e):[]};function Wf(e,n){Q8(e).forEach((i)=>n(e[i],i))}function J8(e,n,i=0){return Q8(e).reduce((s,a)=>n(s,e[a],a),i)}function Mo(e){return!!e&&typeof e==="object"}function td(e){return Mo(e)&&CI.call(e)==="[object Object]"&&e.constructor===Object}function ci(...e){let n={};return e.forEach((i)=>{if(!i)return;Wf(i,(s,a)=>{if(!td(s)){n[a]=s;return}if(!td(n[a]))n[a]={};n[a]=ci(n[a],s)})}),n}function Z8(e={}){let n=[];for(let i in e)if(e.hasOwnProperty(i)){let s=e[i];n.push(s)}return n}function U1(e,n,i,s=!0){let a=(l)=>Object.defineProperty(e,n,{value:l,enumerable:!0,writable:!0}),r={configurable:!0,enumerable:!0,get(){let l=i();return a(l),l}};if(s)r.set=a;return Object.defineProperty(e,n,r)}var jI=Object.freeze({__proto__:null,each:Wf,reduce:J8,isObject:Mo,isPlain:td,merge:ci,values:Z8,defineLazyProperty:U1}),p5=!1,e7=null,Jr=!1,t7,n7=!1,Pc=!1,Kf=!1,Ro=!1,m5=null,z1=null,EI=Boolean(qe.default.cast&&qe.default.cast.framework&&qe.default.cast.framework.CastReceiverContext),i7=null,_1=!1,G1=!1,x1=!1,V1=!1,k1=!1,T1=!1,A1=!1,vp=Boolean(rd()&&(("ontouchstart"in qe.default)||qe.default.navigator.maxTouchPoints||qe.default.DocumentTouch&&qe.default.document instanceof qe.default.DocumentTouch)),Mc=qe.default.navigator&&qe.default.navigator.userAgentData;if(Mc&&Mc.platform&&Mc.brands)Jr=Mc.platform==="Android",Pc=Boolean(Mc.brands.find((e)=>e.brand==="Microsoft Edge")),Kf=Boolean(Mc.brands.find((e)=>e.brand==="Chromium")),Ro=!Pc&&Kf,m5=z1=(Mc.brands.find((e)=>e.brand==="Chromium")||{}).version||null,G1=Mc.platform==="Windows";if(!Kf){let e=qe.default.navigator&&qe.default.navigator.userAgent||"";p5=/iPod/i.test(e),e7=function(){let n=e.match(/OS (\d+)_/i);if(n&&n[1])return n[1];return null}(),Jr=/Android/i.test(e),t7=function(){let n=e.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!n)return null;let i=n[1]&&parseFloat(n[1]),s=n[2]&&parseFloat(n[2]);if(i&&s)return parseFloat(n[1]+"."+n[2]);else if(i)return i;return null}(),n7=/Firefox/i.test(e),Pc=/Edg/i.test(e),Kf=/Chrome/i.test(e)||/CriOS/i.test(e),Ro=!Pc&&Kf,m5=z1=function(){let n=e.match(/(Chrome|CriOS)\/(\d+)/);if(n&&n[2])return parseFloat(n[2]);return null}(),i7=function(){let n=/MSIE\s(\d+)\.\d/.exec(e),i=n&&parseFloat(n[1]);if(!i&&/Trident\/7.0/i.test(e)&&/rv:11.0/.test(e))i=11;return i}(),k1=/Tizen/i.test(e),T1=/Web0S/i.test(e),A1=k1||T1,_1=/Safari/i.test(e)&&!Ro&&!Jr&&!Pc&&!A1,G1=/Windows/i.test(e),x1=/iPad/i.test(e)||_1&&vp&&!/iPhone/i.test(e),V1=/iPhone/i.test(e)&&!x1}var Js=V1||x1||p5,X1=(_1||Js)&&!Ro,s7=Object.freeze({__proto__:null,get IS_IPOD(){return p5},get IOS_VERSION(){return e7},get IS_ANDROID(){return Jr},get ANDROID_VERSION(){return t7},get IS_FIREFOX(){return n7},get IS_EDGE(){return Pc},get IS_CHROMIUM(){return Kf},get IS_CHROME(){return Ro},get CHROMIUM_VERSION(){return m5},get CHROME_VERSION(){return z1},IS_CHROMECAST_RECEIVER:EI,get IE_VERSION(){return i7},get IS_SAFARI(){return _1},get IS_WINDOWS(){return G1},get IS_IPAD(){return x1},get IS_IPHONE(){return V1},get IS_TIZEN(){return k1},get IS_WEBOS(){return T1},get IS_SMART_TV(){return A1},TOUCH_ENABLED:vp,IS_IOS:Js,IS_ANY_SAFARI:X1});function r8(e){return typeof e==="string"&&Boolean(e.trim())}function qI(e){if(e.indexOf(" ")>=0)throw Error("class has illegal whitespace characters")}function rd(){return jt.default===qe.default.document}function ld(e){return Mo(e)&&e.nodeType===1}function a7(){try{return qe.default.parent!==qe.default.self}catch(e){return!0}}function r7(e){return function(n,i){if(!r8(n))return jt.default[e](null);if(r8(i))i=jt.default.querySelector(i);let s=ld(i)?i:jt.default;return s[e]&&s[e](n)}}function on(e="div",n={},i={},s){let a=jt.default.createElement(e);if(Object.getOwnPropertyNames(n).forEach(function(r){let l=n[r];if(r==="textContent")zc(a,l);else if(a[r]!==l||r==="tabIndex")a[r]=l}),Object.getOwnPropertyNames(i).forEach(function(r){a.setAttribute(r,i[r])}),s)g5(a,s);return a}function zc(e,n){if(typeof e.textContent>"u")e.innerText=n;else e.textContent=n;return e}function Gy(e,n){if(n.firstChild)n.insertBefore(e,n.firstChild);else n.appendChild(e)}function pp(e,n){return qI(n),e.classList.contains(n)}function lh(e,...n){return e.classList.add(...n.reduce((i,s)=>i.concat(s.split(/\s+/)),[])),e}function W1(e,...n){if(!e)return An.warn("removeClass was called with an element that doesn't exist"),null;return e.classList.remove(...n.reduce((i,s)=>i.concat(s.split(/\s+/)),[])),e}function o7(e,n,i){if(typeof i==="function")i=i(e,n);if(typeof i!=="boolean")i=void 0;return n.split(/\s+/).forEach((s)=>e.classList.toggle(s,i)),e}function l7(e,n){Object.getOwnPropertyNames(n).forEach(function(i){let s=n[i];if(s===null||typeof s>"u"||s===!1)e.removeAttribute(i);else e.setAttribute(i,s===!0?"":s)})}function Oc(e){let n={},i=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(e&&e.attributes&&e.attributes.length>0){let s=e.attributes;for(let a=s.length-1;a>=0;a--){let r=s[a].name,l=s[a].value;if(i.includes(r))l=l!==null?!0:!1;n[r]=l}}return n}function c7(e,n){return e.getAttribute(n)}function nd(e,n,i){e.setAttribute(n,i)}function K1(e,n){e.removeAttribute(n)}function u7(){jt.default.body.focus(),jt.default.onselectstart=function(){return!1}}function h7(){jt.default.onselectstart=function(){return!0}}function id(e){if(e&&e.getBoundingClientRect&&e.parentNode){let n=e.getBoundingClientRect(),i={};if(["bottom","height","left","right","top","width"].forEach((s)=>{if(n[s]!==void 0)i[s]=n[s]}),!i.height)i.height=parseFloat(sd(e,"height"));if(!i.width)i.width=parseFloat(sd(e,"width"));return i}}function Sp(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};let n=e.offsetWidth,i=e.offsetHeight,s=0,a=0;while(e.offsetParent&&e!==jt.default[S1.fullscreenElement])s+=e.offsetLeft,a+=e.offsetTop,e=e.offsetParent;return{left:s,top:a,width:n,height:i}}function $1(e,n){let i={x:0,y:0};if(Js){let g=e;while(g&&g.nodeName.toLowerCase()!=="html"){let y=sd(g,"transform");if(/^matrix/.test(y)){let x=y.slice(7,-1).split(/,\s/).map(Number);i.x+=x[4],i.y+=x[5]}else if(/^matrix3d/.test(y)){let x=y.slice(9,-1).split(/,\s/).map(Number);i.x+=x[12],i.y+=x[13]}if(g.assignedSlot&&g.assignedSlot.parentElement&&qe.default.WebKitCSSMatrix){let x=qe.default.getComputedStyle(g.assignedSlot.parentElement).transform,j=new qe.default.WebKitCSSMatrix(x);i.x+=j.m41,i.y+=j.m42}g=g.parentNode||g.host}}let s={},a=Sp(n.target),r=Sp(e),{width:l,height:c}=r,p=n.offsetY-(r.top-a.top),m=n.offsetX-(r.left-a.left);if(n.changedTouches){if(m=n.changedTouches[0].pageX-r.left,p=n.changedTouches[0].pageY+r.top,Js)m-=i.x,p-=i.y}return s.y=1-Math.max(0,Math.min(1,p/c)),s.x=Math.max(0,Math.min(1,m/l)),s}function f7(e){return Mo(e)&&e.nodeType===3}function Y1(e){while(e.firstChild)e.removeChild(e.firstChild);return e}function d7(e){if(typeof e==="function")e=e();return(Array.isArray(e)?e:[e]).map((n)=>{if(typeof n==="function")n=n();if(ld(n)||f7(n))return n;if(typeof n==="string"&&/\S/.test(n))return jt.default.createTextNode(n)}).filter((n)=>n)}function g5(e,n){return d7(n).forEach((i)=>e.appendChild(i)),e}function p7(e,n){return g5(Y1(e),n)}function _p(e){if(e.button===void 0&&e.buttons===void 0)return!0;if(e.button===0&&e.buttons===void 0)return!0;if(e.type==="mouseup"&&e.button===0&&e.buttons===0)return!0;if(e.type==="mousedown"&&e.button===0&&e.buttons===0)return!0;if(e.button!==0||e.buttons!==1)return!1;return!0}var Hc=r7("querySelector"),m7=r7("querySelectorAll");function sd(e,n){if(!e||!n)return"";if(typeof qe.default.getComputedStyle==="function"){let i;try{i=qe.default.getComputedStyle(e)}catch(s){return""}return i?i.getPropertyValue(n)||i[n]:""}return""}function g7(e){[...jt.default.styleSheets].forEach((n)=>{try{let i=[...n.cssRules].map((a)=>a.cssText).join(""),s=jt.default.createElement("style");s.textContent=i,e.document.head.appendChild(s)}catch(i){let s=jt.default.createElement("link");s.rel="stylesheet",s.type=n.type,s.media=n.media.mediaText,s.href=n.href,e.document.head.appendChild(s)}})}var b7=Object.freeze({__proto__:null,isReal:rd,isEl:ld,isInFrame:a7,createEl:on,textContent:zc,prependTo:Gy,hasClass:pp,addClass:lh,removeClass:W1,toggleClass:o7,setAttributes:l7,getAttributes:Oc,getAttribute:c7,setAttribute:nd,removeAttribute:K1,blockTextSelection:u7,unblockTextSelection:h7,getBoundingClientRect:id,findPosition:Sp,getPointerPosition:$1,isTextNode:f7,emptyEl:Y1,normalizeContent:d7,appendContent:g5,insertContent:p7,isSingleLeftClick:_p,$:Hc,$$:m7,computedStyle:sd,copyStyleSheetsToWindow:g7}),w7=!1,Vy,DI=function(){if(Vy.options.autoSetup===!1)return;let e=Array.prototype.slice.call(jt.default.getElementsByTagName("video")),n=Array.prototype.slice.call(jt.default.getElementsByTagName("audio")),i=Array.prototype.slice.call(jt.default.getElementsByTagName("video-js")),s=e.concat(n,i);if(s&&s.length>0)for(let a=0,r=s.length;a<r;a++){let l=s[a];if(l&&l.getAttribute){if(l.player===void 0){if(l.getAttribute("data-setup")!==null)Vy(l)}}else{Xy(1);break}}else if(!w7)Xy(1)};function Xy(e,n){if(!rd())return;if(n)Vy=n;qe.default.setTimeout(DI,e)}function Wy(){w7=!0,qe.default.removeEventListener("load",Wy)}if(rd())if(jt.default.readyState==="complete")Wy();else qe.default.addEventListener("load",Wy);var y7=function(e){let n=jt.default.createElement("style");return n.className=e,n},v7=function(e,n){if(e.styleSheet)e.styleSheet.cssText=n;else e.textContent=n},fa=new WeakMap,II=3,MI=II;function Ar(){return MI++}function o8(e,n){if(!fa.has(e))return;let i=fa.get(e);if(i.handlers[n].length===0){if(delete i.handlers[n],e.removeEventListener)e.removeEventListener(n,i.dispatcher,!1);else if(e.detachEvent)e.detachEvent("on"+n,i.dispatcher)}if(Object.getOwnPropertyNames(i.handlers).length<=0)delete i.handlers,delete i.dispatcher,delete i.disabled;if(Object.getOwnPropertyNames(i).length===0)fa.delete(e)}function b5(e,n,i,s){i.forEach(function(a){e(n,a,s)})}function Q1(e){if(e.fixed_)return e;function n(){return!0}function i(){return!1}if(!e||!e.isPropagationStopped||!e.isImmediatePropagationStopped){let s=e||qe.default.event;e={};let a=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(let r in s)if(!a.includes(r)){if(!(r==="returnValue"&&s.preventDefault))e[r]=s[r]}if(!e.target)e.target=e.srcElement||jt.default;if(!e.relatedTarget)e.relatedTarget=e.fromElement===e.target?e.toElement:e.fromElement;if(e.preventDefault=function(){if(s.preventDefault)s.preventDefault();e.returnValue=!1,s.returnValue=!1,e.defaultPrevented=!0},e.defaultPrevented=!1,e.stopPropagation=function(){if(s.stopPropagation)s.stopPropagation();e.cancelBubble=!0,s.cancelBubble=!0,e.isPropagationStopped=n},e.isPropagationStopped=i,e.stopImmediatePropagation=function(){if(s.stopImmediatePropagation)s.stopImmediatePropagation();e.isImmediatePropagationStopped=n,e.stopPropagation()},e.isImmediatePropagationStopped=i,e.clientX!==null&&e.clientX!==void 0){let r=jt.default.documentElement,l=jt.default.body;e.pageX=e.clientX+(r&&r.scrollLeft||l&&l.scrollLeft||0)-(r&&r.clientLeft||l&&l.clientLeft||0),e.pageY=e.clientY+(r&&r.scrollTop||l&&l.scrollTop||0)-(r&&r.clientTop||l&&l.clientTop||0)}if(e.which=e.charCode||e.keyCode,e.button!==null&&e.button!==void 0)e.button=e.button&1?0:e.button&4?1:e.button&2?2:0}return e.fixed_=!0,e}var p1,RI=function(){if(typeof p1!=="boolean"){p1=!1;try{let e=Object.defineProperty({},"passive",{get(){p1=!0}});qe.default.addEventListener("test",null,e),qe.default.removeEventListener("test",null,e)}catch(e){}}return p1},OI=["touchstart","touchmove"];function ir(e,n,i){if(Array.isArray(n))return b5(ir,e,n,i);if(!fa.has(e))fa.set(e,{});let s=fa.get(e);if(!s.handlers)s.handlers={};if(!s.handlers[n])s.handlers[n]=[];if(!i.guid)i.guid=Ar();if(s.handlers[n].push(i),!s.dispatcher)s.disabled=!1,s.dispatcher=function(a,r){if(s.disabled)return;a=Q1(a);let l=s.handlers[a.type];if(l){let c=l.slice(0);for(let p=0,m=c.length;p<m;p++)if(a.isImmediatePropagationStopped())break;else try{c[p].call(e,a,r)}catch(g){An.error(g)}}};if(s.handlers[n].length===1){if(e.addEventListener){let a=!1;if(RI()&&OI.indexOf(n)>-1)a={passive:!0};e.addEventListener(n,s.dispatcher,a)}else if(e.attachEvent)e.attachEvent("on"+n,s.dispatcher)}}function ea(e,n,i){if(!fa.has(e))return;let s=fa.get(e);if(!s.handlers)return;if(Array.isArray(n))return b5(ea,e,n,i);let a=function(l,c){s.handlers[c]=[],o8(l,c)};if(n===void 0){for(let l in s.handlers)if(Object.prototype.hasOwnProperty.call(s.handlers||{},l))a(e,l);return}let r=s.handlers[n];if(!r)return;if(!i){a(e,n);return}if(i.guid){for(let l=0;l<r.length;l++)if(r[l].guid===i.guid)r.splice(l--,1)}o8(e,n)}function cd(e,n,i){let s=fa.has(e)?fa.get(e):{},a=e.parentNode||e.ownerDocument;if(typeof n==="string")n={type:n,target:e};else if(!n.target)n.target=e;if(n=Q1(n),s.dispatcher)s.dispatcher.call(e,n,i);if(a&&!n.isPropagationStopped()&&n.bubbles===!0)cd.call(null,a,n,i);else if(!a&&!n.defaultPrevented&&n.target&&n.target[n.type]){if(!fa.has(n.target))fa.set(n.target,{});let r=fa.get(n.target);if(n.target[n.type]){if(r.disabled=!0,typeof n.target[n.type]==="function")n.target[n.type]();r.disabled=!1}}return!n.defaultPrevented}function J1(e,n,i){if(Array.isArray(n))return b5(J1,e,n,i);let s=function(){ea(e,n,s),i.apply(this,arguments)};s.guid=i.guid=i.guid||Ar(),ir(e,n,s)}function w5(e,n,i){let s=function(){ea(e,n,s),i.apply(this,arguments)};s.guid=i.guid=i.guid||Ar(),ir(e,n,s)}var FI=Object.freeze({__proto__:null,fixEvent:Q1,on:ir,off:ea,trigger:cd,one:J1,any:w5}),Cr=30,di=function(e,n,i){if(!n.guid)n.guid=Ar();let s=n.bind(e);return s.guid=i?i+"_"+n.guid:n.guid,s},Oo=function(e,n){let i=qe.default.performance.now();return function(...a){let r=qe.default.performance.now();if(r-i>=n)e(...a),i=r}},S7=function(e,n,i,s=qe.default){let a,r=()=>{s.clearTimeout(a),a=null},l=function(){let c=this,p=arguments,m=function(){if(a=null,m=null,!i)e.apply(c,p)};if(!a&&i)e.apply(c,p);s.clearTimeout(a),a=s.setTimeout(m,n)};return l.cancel=r,l},NI=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Cr,bind_:di,throttle:Oo,debounce:S7}),cp;class Na{on(e,n){let i=this.addEventListener;this.addEventListener=()=>{},ir(this,e,n),this.addEventListener=i}off(e,n){ea(this,e,n)}one(e,n){let i=this.addEventListener;this.addEventListener=()=>{},J1(this,e,n),this.addEventListener=i}any(e,n){let i=this.addEventListener;this.addEventListener=()=>{},w5(this,e,n),this.addEventListener=i}trigger(e){let n=e.type||e;if(typeof e==="string")e={type:n};if(e=Q1(e),this.allowedEvents_[n]&&this["on"+n])this["on"+n](e);cd(this,e)}queueTrigger(e){if(!cp)cp=new Map;let n=e.type||e,i=cp.get(this);if(!i)i=new Map,cp.set(this,i);let s=i.get(n);i.delete(n),qe.default.clearTimeout(s);let a=qe.default.setTimeout(()=>{if(i.delete(n),i.size===0)i=null,cp.delete(this);this.trigger(e)},0);i.set(n,a)}}Na.prototype.allowedEvents_={};Na.prototype.addEventListener=Na.prototype.on;Na.prototype.removeEventListener=Na.prototype.off;Na.prototype.dispatchEvent=Na.prototype.trigger;var Z1=(e)=>{if(typeof e.name==="function")return e.name();if(typeof e.name==="string")return e.name;if(e.name_)return e.name_;if(e.constructor&&e.constructor.name)return e.constructor.name;return typeof e},Il=(e)=>e instanceof Na||!!e.eventBusEl_&&["on","one","off","trigger"].every((n)=>typeof e[n]==="function"),PI=(e,n)=>{if(Il(e))n();else{if(!e.eventedCallbacks)e.eventedCallbacks=[];e.eventedCallbacks.push(n)}},Ky=(e)=>typeof e==="string"&&/\S/.test(e)||Array.isArray(e)&&!!e.length,C1=(e,n,i)=>{if(!e||!e.nodeName&&!Il(e))throw Error(`Invalid target for ${Z1(n)}#${i}; must be a DOM node or evented object.`)},_7=(e,n,i)=>{if(!Ky(e))throw Error(`Invalid event type for ${Z1(n)}#${i}; must be a non-empty string or array.`)},x7=(e,n,i)=>{if(typeof e!=="function")throw Error(`Invalid listener for ${Z1(n)}#${i}; must be a function.`)},Ay=(e,n,i)=>{let s=n.length<3||n[0]===e||n[0]===e.eventBusEl_,a,r,l;if(s){if(a=e.eventBusEl_,n.length>=3)n.shift();[r,l]=n}else a=n[0],r=n[1],l=n[2];return C1(a,e,i),_7(r,e,i),x7(l,e,i),l=di(e,l),{isTargetingSelf:s,target:a,type:r,listener:l}},ih=(e,n,i,s)=>{if(C1(e,e,n),e.nodeName)FI[n](e,i,s);else e[n](i,s)},BI={on(...e){let{isTargetingSelf:n,target:i,type:s,listener:a}=Ay(this,e,"on");if(ih(i,"on",s,a),!n){let r=()=>this.off(i,s,a);r.guid=a.guid;let l=()=>this.off("dispose",r);l.guid=a.guid,ih(this,"on","dispose",r),ih(i,"on","dispose",l)}},one(...e){let{isTargetingSelf:n,target:i,type:s,listener:a}=Ay(this,e,"one");if(n)ih(i,"one",s,a);else{let r=(...l)=>{this.off(i,s,r),a.apply(null,l)};r.guid=a.guid,ih(i,"one",s,r)}},any(...e){let{isTargetingSelf:n,target:i,type:s,listener:a}=Ay(this,e,"any");if(n)ih(i,"any",s,a);else{let r=(...l)=>{this.off(i,s,r),a.apply(null,l)};r.guid=a.guid,ih(i,"any",s,r)}},off(e,n,i){if(!e||Ky(e))ea(this.eventBusEl_,e,n);else{let s=e,a=n;if(C1(s,this,"off"),_7(a,this,"off"),x7(i,this,"off"),i=di(this,i),this.off("dispose",i),s.nodeName)ea(s,a,i),ea(s,"dispose",i);else if(Il(s))s.off(a,i),s.off("dispose",i)}},trigger(e,n){C1(this.eventBusEl_,this,"trigger");let i=e&&typeof e!=="string"?e.type:e;if(!Ky(i))throw Error(`Invalid event type for ${Z1(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return cd(this.eventBusEl_,e,n)}};function y5(e,n={}){let{eventBusKey:i}=n;if(i){if(!e[i].nodeName)throw Error(`The eventBusKey "${i}" does not refer to an element.`);e.eventBusEl_=e[i]}else e.eventBusEl_=on("span",{className:"vjs-event-bus"});if(Object.assign(e,BI),e.eventedCallbacks)e.eventedCallbacks.forEach((s)=>{s()});return e.on("dispose",()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach(function(s){if(s&&fa.has(s))fa.delete(s)}),qe.default.setTimeout(()=>{e.eventBusEl_=null},0)}),e}var LI={state:{},setState(e){if(typeof e==="function")e=e();let n;if(Wf(e,(i,s)=>{if(this.state[s]!==i)n=n||{},n[s]={from:this.state[s],to:i};this.state[s]=i}),n&&Il(this))this.trigger({changes:n,type:"statechanged"});return n}};function k7(e,n){if(Object.assign(e,LI),e.state=Object.assign({},e.state,n),typeof e.handleStateChanged==="function"&&Il(e))e.on("statechanged",e.handleStateChanged);return e}var mp=function(e){if(typeof e!=="string")return e;return e.replace(/./,(n)=>n.toLowerCase())},Hi=function(e){if(typeof e!=="string")return e;return e.replace(/./,(n)=>n.toUpperCase())},T7=function(e,n){return Hi(e)===Hi(n)},HI=Object.freeze({__proto__:null,toLowerCase:mp,toTitleCase:Hi,titleCaseEquals:T7});class ht{constructor(e,n,i){if(!e&&this.play)this.player_=e=this;else this.player_=e;if(this.isDisposed_=!1,this.parentComponent_=null,this.options_=ci({},this.options_),n=this.options_=ci(this.options_,n),this.id_=n.id||n.el&&n.el.id,!this.id_){let s=e&&e.id&&e.id()||"no_player";this.id_=`${s}_component_${Ar()}`}if(this.name_=n.name||null,n.el)this.el_=n.el;else if(n.createEl!==!1)this.el_=this.createEl();if(n.className&&this.el_)n.className.split(" ").forEach((s)=>this.addClass(s));if(["on","off","one","any","trigger"].forEach((s)=>{this[s]=void 0}),n.evented!==!1)y5(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange);if(k7(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,n.initChildren!==!1)this.initChildren();if(this.ready(i),n.reportTouchActivity!==!1)this.enableTouchActivity()}dispose(e={}){if(this.isDisposed_)return;if(this.readyQueue_)this.readyQueue_.length=0;if(this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_){for(let n=this.children_.length-1;n>=0;n--)if(this.children_[n].dispose)this.children_[n].dispose()}if(this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_){if(this.el_.parentNode)if(e.restoreEl)this.el_.parentNode.replaceChild(e.restoreEl,this.el_);else this.el_.parentNode.removeChild(this.el_);this.el_=null}this.player_=null}isDisposed(){return Boolean(this.isDisposed_)}player(){return this.player_}options(e){if(!e)return this.options_;return this.options_=ci(this.options_,e),this.options_}el(){return this.el_}createEl(e,n,i){return on(e,n,i)}localize(e,n,i=e){let s=this.player_.language&&this.player_.language(),a=this.player_.languages&&this.player_.languages(),r=a&&a[s],l=s&&s.split("-")[0],c=a&&a[l],p=i;if(r&&r[e])p=r[e];else if(c&&c[e])p=c[e];if(n)p=p.replace(/\{(\d+)\}/g,function(m,g){let y=n[g-1],x=y;if(typeof y>"u")x=m;return x});return p}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(!e)return;return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((i,s)=>i.concat(s),[]);let n=this;for(let i=0;i<e.length;i++)if(n=n.getChild(e[i]),!n||!n.getChild)return;return n}setIcon(e,n=this.el()){if(!this.player_.options_.experimentalSvgIcons)return;let i="http://www.w3.org/2000/svg",s=on("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),a=jt.default.createElementNS(i,"svg");a.setAttributeNS(null,"viewBox","0 0 512 512");let r=jt.default.createElementNS(i,"use");if(a.appendChild(r),r.setAttributeNS(null,"href",`#vjs-icon-${e}`),s.appendChild(a),this.iconIsSet_)n.replaceChild(s,n.querySelector(".vjs-icon-placeholder"));else n.appendChild(s);return this.iconIsSet_=!0,s}addChild(e,n={},i=this.children_.length){let s,a;if(typeof e==="string"){a=Hi(e);let r=n.componentClass||a;n.name=a;let l=ht.getComponent(r);if(!l)throw Error(`Component ${r} does not exist`);if(typeof l!=="function")return null;s=new l(this.player_||this,n)}else s=e;if(s.parentComponent_)s.parentComponent_.removeChild(s);if(this.children_.splice(i,0,s),s.parentComponent_=this,typeof s.id==="function")this.childIndex_[s.id()]=s;if(a=a||s.name&&Hi(s.name()),a)this.childNameIndex_[a]=s,this.childNameIndex_[mp(a)]=s;if(typeof s.el==="function"&&s.el()){let r=null;if(this.children_[i+1]){if(this.children_[i+1].el_)r=this.children_[i+1].el_;else if(ld(this.children_[i+1]))r=this.children_[i+1]}this.contentEl().insertBefore(s.el(),r)}return s}removeChild(e){if(typeof e==="string")e=this.getChild(e);if(!e||!this.children_)return;let n=!1;for(let s=this.children_.length-1;s>=0;s--)if(this.children_[s]===e){n=!0,this.children_.splice(s,1);break}if(!n)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[Hi(e.name())]=null,this.childNameIndex_[mp(e.name())]=null;let i=e.el();if(i&&i.parentNode===this.contentEl())this.contentEl().removeChild(e.el())}initChildren(){let e=this.options_.children;if(e){let n=this.options_,i=(r)=>{let{name:l,opts:c}=r;if(n[l]!==void 0)c=n[l];if(c===!1)return;if(c===!0)c={};c.playerOptions=this.options_.playerOptions;let p=this.addChild(l,c);if(p)this[l]=p},s,a=ht.getComponent("Tech");if(Array.isArray(e))s=e;else s=Object.keys(e);s.concat(Object.keys(this.options_).filter(function(r){return!s.some(function(l){if(typeof l==="string")return r===l;return r===l.name})})).map((r)=>{let l,c;if(typeof r==="string")l=r,c=e[l]||this.options_[l]||{};else l=r.name,c=r;return{name:l,opts:c}}).filter((r)=>{let l=ht.getComponent(r.opts.componentClass||Hi(r.name));return l&&!a.isTech(l)}).forEach(i)}}buildCSSClass(){return""}ready(e,n=!1){if(!e)return;if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}if(n)e.call(this);else this.setTimeout(e,1)}triggerReady(){this.isReady_=!0,this.setTimeout(function(){let e=this.readyQueue_;if(this.readyQueue_=[],e&&e.length>0)e.forEach(function(n){n.call(this)},this);this.trigger("ready")},1)}$(e,n){return Hc(e,n||this.contentEl())}$$(e,n){return m7(e,n||this.contentEl())}hasClass(e){return pp(this.el_,e)}addClass(...e){lh(this.el_,...e)}removeClass(...e){W1(this.el_,...e)}toggleClass(e,n){o7(this.el_,e,n)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return c7(this.el_,e)}setAttribute(e,n){nd(this.el_,e,n)}removeAttribute(e){K1(this.el_,e)}width(e,n){return this.dimension("width",e,n)}height(e,n){return this.dimension("height",e,n)}dimensions(e,n){this.width(e,!0),this.height(n)}dimension(e,n,i){if(n!==void 0){if(n===null||n!==n)n=0;if((""+n).indexOf("%")!==-1||(""+n).indexOf("px")!==-1)this.el_.style[e]=n;else if(n==="auto")this.el_.style[e]="";else this.el_.style[e]=n+"px";if(!i)this.trigger("componentresize");return}if(!this.el_)return 0;let s=this.el_.style[e],a=s.indexOf("px");if(a!==-1)return parseInt(s.slice(0,a),10);return parseInt(this.el_["offset"+Hi(e)],10)}currentDimension(e){let n=0;if(e!=="width"&&e!=="height")throw Error("currentDimension only accepts width or height value");if(n=sd(this.el_,e),n=parseFloat(n),n===0||isNaN(n)){let i=`offset${Hi(e)}`;n=this.el_[i]}return n}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){let e=this.el_.getBoundingClientRect(),n={x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},i={x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2};return{boundingClientRect:n,center:i}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){if(this.player_){if(e.key!=="Tab"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled))e.stopPropagation();this.player_.handleKeyDown(e)}}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,n=null,i=10,s=200,a;this.on("touchstart",function(l){if(l.touches.length===1)n={pageX:l.touches[0].pageX,pageY:l.touches[0].pageY},e=qe.default.performance.now(),a=!0}),this.on("touchmove",function(l){if(l.touches.length>1)a=!1;else if(n){let c=l.touches[0].pageX-n.pageX,p=l.touches[0].pageY-n.pageY;if(Math.sqrt(c*c+p*p)>i)a=!1}});let r=function(){a=!1};this.on("touchleave",r),this.on("touchcancel",r),this.on("touchend",function(l){if(n=null,a===!0){if(qe.default.performance.now()-e<s)l.preventDefault(),this.trigger("tap")}})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;let e=di(this.player(),this.player().reportUserActivity),n;this.on("touchstart",function(){e(),this.clearInterval(n),n=this.setInterval(e,250)});let i=function(s){e(),this.clearInterval(n)};this.on("touchmove",e),this.on("touchend",i),this.on("touchcancel",i)}setTimeout(e,n){var i;return e=di(this,e),this.clearTimersOnDispose_(),i=qe.default.setTimeout(()=>{if(this.setTimeoutIds_.has(i))this.setTimeoutIds_.delete(i);e()},n),this.setTimeoutIds_.add(i),i}clearTimeout(e){if(this.setTimeoutIds_.has(e))this.setTimeoutIds_.delete(e),qe.default.clearTimeout(e);return e}setInterval(e,n){e=di(this,e),this.clearTimersOnDispose_();let i=qe.default.setInterval(e,n);return this.setIntervalIds_.add(i),i}clearInterval(e){if(this.setIntervalIds_.has(e))this.setIntervalIds_.delete(e),qe.default.clearInterval(e);return e}requestAnimationFrame(e){this.clearTimersOnDispose_();var n;return e=di(this,e),n=qe.default.requestAnimationFrame(()=>{if(this.rafIds_.has(n))this.rafIds_.delete(n);e()}),this.rafIds_.add(n),n}requestNamedAnimationFrame(e,n){if(this.namedRafs_.has(e))this.cancelNamedAnimationFrame(e);this.clearTimersOnDispose_(),n=di(this,n);let i=this.requestAnimationFrame(()=>{if(n(),this.namedRafs_.has(e))this.namedRafs_.delete(e)});return this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){if(!this.namedRafs_.has(e))return;this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e)}cancelAnimationFrame(e){if(this.rafIds_.has(e))this.rafIds_.delete(e),qe.default.cancelAnimationFrame(e);return e}clearTimersOnDispose_(){if(this.clearingTimersOnDispose_)return;this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,n])=>{this[e].forEach((i,s)=>this[n](s))}),this.clearingTimersOnDispose_=!1})}getIsDisabled(){return Boolean(this.el_.disabled)}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function n(a){let r=qe.default.getComputedStyle(a,null),l=r.getPropertyValue("visibility");return r.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(l)}function i(a){if(!n(a.parentElement))return!1;if(!n(a)||a.style.opacity==="0"||qe.default.getComputedStyle(a).height==="0px"||qe.default.getComputedStyle(a).width==="0px")return!1;return!0}function s(a){if(a.offsetWidth+a.offsetHeight+a.getBoundingClientRect().height+a.getBoundingClientRect().width===0)return!1;let r={x:a.getBoundingClientRect().left+a.offsetWidth/2,y:a.getBoundingClientRect().top+a.offsetHeight/2};if(r.x<0)return!1;if(r.x>(jt.default.documentElement.clientWidth||qe.default.innerWidth))return!1;if(r.y<0)return!1;if(r.y>(jt.default.documentElement.clientHeight||qe.default.innerHeight))return!1;let l=jt.default.elementFromPoint(r.x,r.y);while(l){if(l===a)return!0;if(l.parentNode)l=l.parentNode;else return!1}}if(!e)e=this.el();if(s(e)&&i(e)&&(!e.parentElement||e.tabIndex>=0))return!0;return!1}static registerComponent(e,n){if(typeof e!=="string"||!e)throw Error(`Illegal component name, "${e}"; must be a non-empty string.`);let i=ht.getComponent("Tech"),s=i&&i.isTech(n),a=ht===n||ht.prototype.isPrototypeOf(n.prototype);if(s||!a){let l;if(s)l="techs must be registered using Tech.registerTech()";else l="must be a Component subclass";throw Error(`Illegal component, "${e}"; ${l}.`)}if(e=Hi(e),!ht.components_)ht.components_={};let r=ht.getComponent("Player");if(e==="Player"&&r&&r.players){let l=r.players,c=Object.keys(l);if(l&&c.length>0){for(let p=0;p<c.length;p++)if(l[c[p]]!==null)throw Error("Can not register Player component after player has been created.")}}return ht.components_[e]=n,ht.components_[mp(e)]=n,n}static getComponent(e){if(!e||!ht.components_)return;return ht.components_[e]}}ht.registerComponent("Component",ht);function UI(e,n,i){if(typeof n!=="number"||n<0||n>i)throw Error(`Failed to execute '${e}' on 'TimeRanges': The index provided (${n}) is non-numeric or out of bounds (0-${i}).`)}function l8(e,n,i,s){return UI(e,s,i.length-1),i[s][n]}function Cy(e){let n;if(e===void 0||e.length===0)n={length:0,start(){throw Error("This TimeRanges object is empty")},end(){throw Error("This TimeRanges object is empty")}};else n={length:e.length,start:l8.bind(null,"start",0,e),end:l8.bind(null,"end",1,e)};if(qe.default.Symbol&&qe.default.Symbol.iterator)n[qe.default.Symbol.iterator]=()=>(e||[]).values();return n}function Yr(e,n){if(Array.isArray(e))return Cy(e);else if(e===void 0||n===void 0)return Cy();return Cy([[e,n]])}var A7=function(e,n){e=e<0?0:e;let i=Math.floor(e%60),s=Math.floor(e/60%60),a=Math.floor(e/3600),r=Math.floor(n/60%60),l=Math.floor(n/3600);if(isNaN(e)||e===1/0)a=s=i="-";return a=a>0||l>0?a+":":"",s=((a||r>=10)&&s<10?"0"+s:s)+":",i=i<10?"0"+i:i,a+s+i},v5=A7;function C7(e){v5=e}function j7(){v5=A7}function hh(e,n=e){return v5(e,n)}var zI=Object.freeze({__proto__:null,createTimeRanges:Yr,createTimeRange:Yr,setFormatTime:C7,resetFormatTime:j7,formatTime:hh});function E7(e,n){let i=0,s,a;if(!n)return 0;if(!e||!e.length)e=Yr(0,0);for(let r=0;r<e.length;r++){if(s=e.start(r),a=e.end(r),a>n)a=n;i+=a-s}return i/n}function Ri(e){if(e instanceof Ri)return e;if(typeof e==="number")this.code=e;else if(typeof e==="string")this.message=e;else if(Mo(e)){if(typeof e.code==="number")this.code=e.code;Object.assign(this,e)}if(!this.message)this.message=Ri.defaultMessages[this.code]||""}Ri.prototype.code=0;Ri.prototype.message="";Ri.prototype.status=null;Ri.prototype.metadata=null;Ri.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];Ri.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};Ri.MEDIA_ERR_CUSTOM=0;Ri.prototype.MEDIA_ERR_CUSTOM=0;Ri.MEDIA_ERR_ABORTED=1;Ri.prototype.MEDIA_ERR_ABORTED=1;Ri.MEDIA_ERR_NETWORK=2;Ri.prototype.MEDIA_ERR_NETWORK=2;Ri.MEDIA_ERR_DECODE=3;Ri.prototype.MEDIA_ERR_DECODE=3;Ri.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Ri.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Ri.MEDIA_ERR_ENCRYPTED=5;Ri.prototype.MEDIA_ERR_ENCRYPTED=5;function gp(e){return e!==void 0&&e!==null&&typeof e.then==="function"}function jo(e){if(gp(e))e.then(null,(n)=>{})}var $y=function(e){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((i,s,a)=>{if(e[s])i[s]=e[s];return i},{cues:e.cues&&Array.prototype.map.call(e.cues,function(i){return{startTime:i.startTime,endTime:i.endTime,text:i.text,id:i.id}})})},GI=function(e){let n=e.$$("track"),i=Array.prototype.map.call(n,(a)=>a.track);return Array.prototype.map.call(n,function(a){let r=$y(a.track);if(a.src)r.src=a.src;return r}).concat(Array.prototype.filter.call(e.textTracks(),function(a){return i.indexOf(a)===-1}).map($y))},VI=function(e,n){return e.forEach(function(i){let s=n.addRemoteTextTrack(i).track;if(!i.src&&i.cues)i.cues.forEach((a)=>s.addCue(a))}),n.textTracks()},Yy={textTracksToJson:GI,jsonToTextTracks:VI,trackToJson:$y},jy="vjs-modal-dialog";class fh extends ht{constructor(e,n){super(e,n);this.handleKeyDown_=(i)=>this.handleKeyDown(i),this.close_=(i)=>this.close(i),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=on("div",{className:`${jy}-content`},{role:"document"}),this.descEl_=on("p",{className:`${jy}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),zc(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${jy} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");if(this.closeable())e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.");return e}open(){if(this.opened_){if(this.options_.fillAlways)this.fill();return}let e=this.player();if(this.trigger("beforemodalopen"),this.opened_=!0,this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)this.fill();if(this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_)e.pause();this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(e){if(typeof e==="boolean")this[e?"open":"close"]();return this.opened_}close(){if(!this.opened_)return;let e=this.player();if(this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen)e.play();if(this.off("keydown",this.handleKeyDown_),this.hadControls_)e.controls(!0);if(this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary)this.dispose()}closeable(e){if(typeof e==="boolean"){let n=this.closeable_=!!e,i=this.getChild("closeButton");if(n&&!i){let s=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=s,this.on(i,"close",this.close_)}if(!n&&i)this.off(i,"close",this.close_),this.removeChild(i),i.dispose()}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){let n=this.contentEl(),{parentNode:i,nextSibling:s}=n;if(this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(n),this.empty(),p7(n,e),this.trigger("modalfill"),s)i.insertBefore(n,s);else i.appendChild(n);let a=this.getChild("closeButton");if(a)i.appendChild(a.el_);this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),Y1(this.contentEl()),this.trigger("modalempty")}content(e){if(typeof e<"u")this.content_=e;return this.content_}conditionalFocus_(){let e=jt.default.activeElement,n=this.player_.el_;if(this.previouslyActiveEl_=null,n.contains(e)||n===e)this.previouslyActiveEl_=e,this.focus()}conditionalBlur_(){if(this.previouslyActiveEl_)this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null}handleKeyDown(e){if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),e.key==="Escape"&&this.closeable()){e.preventDefault(),this.close();return}if(e.key!=="Tab")return;let n=this.focusableEls_(),i=this.el_.querySelector(":focus"),s;for(let a=0;a<n.length;a++)if(i===n[a]){s=a;break}if(jt.default.activeElement===this.el_)s=0;if(e.shiftKey&&s===0)n[n.length-1].focus(),e.preventDefault();else if(!e.shiftKey&&s===n.length-1)n[0].focus(),e.preventDefault()}focusableEls_(){let e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,(n)=>(n instanceof qe.default.HTMLAnchorElement||n instanceof qe.default.HTMLAreaElement)&&n.hasAttribute("href")||(n instanceof qe.default.HTMLInputElement||n instanceof qe.default.HTMLSelectElement||n instanceof qe.default.HTMLTextAreaElement||n instanceof qe.default.HTMLButtonElement)&&!n.hasAttribute("disabled")||n instanceof qe.default.HTMLIFrameElement||n instanceof qe.default.HTMLObjectElement||n instanceof qe.default.HTMLEmbedElement||n.hasAttribute("tabindex")&&n.getAttribute("tabindex")!==-1||n.hasAttribute("contenteditable"))}}fh.prototype.options_={pauseOnOpen:!0,temporary:!0};ht.registerComponent("ModalDialog",fh);class Uc extends Na{constructor(e=[]){super();this.tracks_=[];for(let n=0;n<e.length;n++)this.addTrack(e[n])}get length(){return this.tracks_.length}addTrack(e){let n=this.tracks_.length;if(!(""+n in this))Object.defineProperty(this,n,{get(){return this.tracks_[n]}});if(this.tracks_.indexOf(e)===-1)this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this});if(e.labelchange_=()=>{this.trigger({track:e,type:"labelchange",target:this})},Il(e))e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let n;for(let i=0,s=this.length;i<s;i++)if(this[i]===e){if(n=this[i],n.off)n.off();this.tracks_.splice(i,1);break}if(!n)return;this.trigger({track:n,type:"removetrack",target:this})}getTrackById(e){let n=null;for(let i=0,s=this.length;i<s;i++){let a=this[i];if(a.id===e){n=a;break}}return n}}Uc.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(let e in Uc.prototype.allowedEvents_)Uc.prototype["on"+e]=null;var Ey=function(e,n){for(let i=0;i<e.length;i++){if(!Object.keys(e[i]).length||n.id===e[i].id)continue;e[i].enabled=!1}};class S5 extends Uc{constructor(e=[]){for(let n=e.length-1;n>=0;n--)if(e[n].enabled){Ey(e,e[n]);break}super(e);this.changing_=!1}addTrack(e){if(e.enabled)Ey(this,e);if(super.addTrack(e),!e.addEventListener)return;e.enabledChange_=()=>{if(this.changing_)return;this.changing_=!0,Ey(this,e),this.changing_=!1,this.trigger("change")},e.addEventListener("enabledchange",e.enabledChange_)}removeTrack(e){if(super.removeTrack(e),e.removeEventListener&&e.enabledChange_)e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null}}var qy=function(e,n){for(let i=0;i<e.length;i++){if(!Object.keys(e[i]).length||n.id===e[i].id)continue;e[i].selected=!1}};class _5 extends Uc{constructor(e=[]){for(let n=e.length-1;n>=0;n--)if(e[n].selected){qy(e,e[n]);break}super(e);this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let n=0;n<this.length;n++)if(this[n].selected)return n;return-1},set(){}})}addTrack(e){if(e.selected)qy(this,e);if(super.addTrack(e),!e.addEventListener)return;e.selectedChange_=()=>{if(this.changing_)return;this.changing_=!0,qy(this,e),this.changing_=!1,this.trigger("change")},e.addEventListener("selectedchange",e.selectedChange_)}removeTrack(e){if(super.removeTrack(e),e.removeEventListener&&e.selectedChange_)e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null}}class eb extends Uc{addTrack(e){if(super.addTrack(e),!this.queueChange_)this.queueChange_=()=>this.queueTrigger("change");if(!this.triggerSelectedlanguagechange)this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange");if(e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1)e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){if(super.removeTrack(e),e.removeEventListener){if(this.queueChange_)e.removeEventListener("modechange",this.queueChange_);if(this.selectedlanguagechange_)e.removeEventListener("modechange",this.triggerSelectedlanguagechange_)}}toJSON(){return this.tracks_.map((e)=>e.toJSON())}}class q7{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let n=0,i=e.length;n<i;n++)this.addTrackElement_(e[n])}addTrackElement_(e){let n=this.trackElements_.length;if(!(""+n in this))Object.defineProperty(this,n,{get(){return this.trackElements_[n]}});if(this.trackElements_.indexOf(e)===-1)this.trackElements_.push(e)}getTrackElementByTrack_(e){let n;for(let i=0,s=this.trackElements_.length;i<s;i++)if(e===this.trackElements_[i].track){n=this.trackElements_[i];break}return n}removeTrackElement_(e){for(let n=0,i=this.trackElements_.length;n<i;n++)if(e===this.trackElements_[n]){if(this.trackElements_[n].track&&typeof this.trackElements_[n].track.off==="function")this.trackElements_[n].track.off();if(typeof this.trackElements_[n].off==="function")this.trackElements_[n].off();this.trackElements_.splice(n,1);break}}}class j1{constructor(e){j1.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){let n=this.length||0,i=0,s=e.length;this.cues_=e,this.length_=e.length;let a=function(r){if(!(""+r in this))Object.defineProperty(this,""+r,{get(){return this.cues_[r]}})};if(n<s){i=n;for(;i<s;i++)a.call(this,i)}}getCueById(e){let n=null;for(let i=0,s=this.length;i<s;i++){let a=this[i];if(a.id===e){n=a;break}}return n}}var XI={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},WI={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},KI={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},c8={disabled:"disabled",hidden:"hidden",showing:"showing"};class tb extends Na{constructor(e={}){super();let n={id:e.id||"vjs_track_"+Ar(),kind:e.kind||"",language:e.language||""},i=e.label||"";for(let s in n)Object.defineProperty(this,s,{get(){return n[s]},set(){}});Object.defineProperty(this,"label",{get(){return i},set(s){if(s!==i)i=s,this.trigger("labelchange")}})}}var x5=function(e){return new URL(e,jt.default.baseURI)},D7=function(e){return new URL(e,jt.default.baseURI).href},k5=function(e){if(typeof e==="string"){let i=e.split("?")[0].replace(/\/+$/,"").match(/\.([^.\/]+)$/);return i?i[1].toLowerCase():""}return""},nb=function(e,n=qe.default.location){return x5(e).origin!==n.origin},$I=Object.freeze({__proto__:null,parseUrl:x5,getAbsoluteURL:D7,getFileExtension:k5,isCrossOrigin:nb}),u8=function(e,n){let i=new qe.default.WebVTT.Parser(qe.default,qe.default.vttjs,qe.default.WebVTT.StringDecoder()),s=[];if(i.oncue=function(a){n.addCue(a)},i.onparsingerror=function(a){s.push(a)},i.onflush=function(){n.trigger({type:"loadeddata",target:n})},i.parse(e),s.length>0){if(qe.default.console&&qe.default.console.groupCollapsed)qe.default.console.groupCollapsed(`Text Track parsing errors for ${n.src}`);if(s.forEach((a)=>An.error(a)),qe.default.console&&qe.default.console.groupEnd)qe.default.console.groupEnd()}i.flush()},h8=function(e,n){let i={uri:e},s=nb(e);if(s)i.cors=s;let a=n.tech_.crossOrigin()==="use-credentials";if(a)i.withCredentials=a;d5.default(i,di(this,function(r,l,c){if(r)return An.error(r,l);if(n.loaded_=!0,typeof qe.default.WebVTT!=="function"){if(n.tech_)n.tech_.any(["vttjsloaded","vttjserror"],(p)=>{if(p.type==="vttjserror"){An.error(`vttjs failed to load, stopping trying to process ${n.src}`);return}return u8(c,n)})}else u8(c,n)}))};class ud extends tb{constructor(e={}){if(!e.tech)throw Error("A tech was not provided.");let n=ci(e,{kind:KI[e.kind]||"subtitles",language:e.language||e.srclang||""}),i=c8[n.mode]||"disabled",s=n.default;if(n.kind==="metadata"||n.kind==="chapters")i="hidden";super(n);this.tech_=n.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;let a=new j1(this.cues_),r=new j1(this.activeCues_),l=!1;this.timeupdateHandler=di(this,function(p={}){if(this.tech_.isDisposed())return;if(!this.tech_.isReady_){if(p.type!=="timeupdate")this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler);return}if(this.activeCues=this.activeCues,l)this.trigger("cuechange"),l=!1;if(p.type!=="timeupdate")this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)});let c=()=>{this.stopTracking()};if(this.tech_.one("dispose",c),i!=="disabled")this.startTracking();if(Object.defineProperties(this,{default:{get(){return s},set(){}},mode:{get(){return i},set(p){if(!c8[p])return;if(i===p)return;if(i=p,!this.preload_&&i!=="disabled"&&this.cues.length===0)h8(this.src,this);if(this.stopTracking(),i!=="disabled")this.startTracking();this.trigger("modechange")}},cues:{get(){if(!this.loaded_)return null;return a},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return r;let p=this.tech_.currentTime(),m=[];for(let g=0,y=this.cues.length;g<y;g++){let x=this.cues[g];if(x.startTime<=p&&x.endTime>=p)m.push(x)}if(l=!1,m.length!==this.activeCues_.length)l=!0;else for(let g=0;g<m.length;g++)if(this.activeCues_.indexOf(m[g])===-1)l=!0;return this.activeCues_=m,r.setCues_(this.activeCues_),r},set(){}}}),n.src){if(this.src=n.src,!this.preload_)this.loaded_=!0;if(this.preload_||n.kind!=="subtitles"&&n.kind!=="captions")h8(this.src,this)}else this.loaded_=!0}startTracking(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)}stopTracking(){if(this.rvf_)this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0;this.tech_.off("timeupdate",this.timeupdateHandler)}addCue(e){let n=e;if(!("getCueAsHTML"in n)){n=new qe.default.vttjs.VTTCue(e.startTime,e.endTime,e.text);for(let s in e)if(!(s in n))n[s]=e[s];n.id=e.id,n.originalCue_=e}let i=this.tech_.textTracks();for(let s=0;s<i.length;s++)if(i[s]!==this)i[s].removeCue(n);this.cues_.push(n),this.cues.setCues_(this.cues_)}toJSON(){return Yy.trackToJson(this)}removeCue(e){let n=this.cues_.length;while(n--){let i=this.cues_[n];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(n,1),this.cues.setCues_(this.cues_);break}}}}ud.prototype.allowedEvents_={cuechange:"cuechange"};class T5 extends tb{constructor(e={}){let n=ci(e,{kind:WI[e.kind]||""});super(n);let i=!1;if(Object.defineProperty(this,"enabled",{get(){return i},set(s){if(typeof s!=="boolean"||s===i)return;i=s,this.trigger("enabledchange")}}),n.enabled)this.enabled=n.enabled;this.loaded_=!0}}class A5 extends tb{constructor(e={}){let n=ci(e,{kind:XI[e.kind]||""});super(n);let i=!1;if(Object.defineProperty(this,"selected",{get(){return i},set(s){if(typeof s!=="boolean"||s===i)return;i=s,this.trigger("selectedchange")}}),n.selected)this.selected=n.selected}}class Ml extends Na{constructor(e={}){super();let n,i=new ud(e);this.kind=i.kind,this.src=i.src,this.srclang=i.language,this.label=i.label,this.default=i.default,Object.defineProperties(this,{readyState:{get(){return n}},track:{get(){return i}}}),n=Ml.NONE,i.addEventListener("loadeddata",()=>{n=Ml.LOADED,this.trigger({type:"load",target:this})})}}Ml.prototype.allowedEvents_={load:"load"};Ml.NONE=0;Ml.LOADING=1;Ml.LOADED=2;Ml.ERROR=3;var Tr={audio:{ListClass:S5,TrackClass:T5,capitalName:"Audio"},video:{ListClass:_5,TrackClass:A5,capitalName:"Video"},text:{ListClass:eb,TrackClass:ud,capitalName:"Text"}};Object.keys(Tr).forEach(function(e){Tr[e].getterName=`${e}Tracks`,Tr[e].privateName=`${e}Tracks_`});var ad={remoteText:{ListClass:eb,TrackClass:ud,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:q7,TrackClass:Ml,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},ha=Object.assign({},Tr,ad);ad.names=Object.keys(ad);Tr.names=Object.keys(Tr);ha.names=[].concat(ad.names).concat(Tr.names);function YI(e,n,i,s,a={}){let r=e.textTracks();if(a.kind=n,i)a.label=i;if(s)a.language=s;a.tech=e;let l=new ha.text.TrackClass(a);return r.addTrack(l),l}class kn extends ht{constructor(e={},n=function(){}){e.reportTouchActivity=!1;super(null,e,n);if(this.onDurationChange_=(i)=>this.onDurationChange(i),this.trackProgress_=(i)=>this.trackProgress(i),this.trackCurrentTime_=(i)=>this.trackCurrentTime(i),this.stopTrackingCurrentTime_=(i)=>this.stopTrackingCurrentTime(i),this.disposeSourceHandler_=(i)=>this.disposeSourceHandler(i),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),ha.names.forEach((i)=>{let s=ha[i];if(e&&e[s.getterName])this[s.privateName]=e[s.getterName]}),!this.featuresProgressEvents)this.manualProgressOn();if(!this.featuresTimeupdateEvents)this.manualTimeUpdatesOn();if(["Text","Audio","Video"].forEach((i)=>{if(e[`native${i}Tracks`]===!1)this[`featuresNative${i}Tracks`]=!1}),e.nativeCaptions===!1||e.nativeTextTracks===!1)this.featuresNativeTextTracks=!1;else if(e.nativeCaptions===!0||e.nativeTextTracks===!0)this.featuresNativeTextTracks=!0;if(!this.featuresNativeTextTracks)this.emulateTextTracks();if(this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new ha.text.ListClass,this.initTrackListeners(),!e.nativeControlsForTouch)this.emitTapEvents();if(this.constructor)this.name_=this.constructor.name||"Unknown Tech"}triggerSourceset(e){if(!this.isReady_)this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1));this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(di(this,function(){let n=this.bufferedPercent();if(this.bufferedPercent_!==n)this.trigger("progress");if(this.bufferedPercent_=n,n===1)this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Yr(0,0)}bufferedPercent(){return E7(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){if(this.currentTimeInterval)this.stopTrackingCurrentTime();this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){if(this.clearTracks(Tr.names),this.manualProgress)this.manualProgressOff();if(this.manualTimeUpdates)this.manualTimeUpdatesOff();super.dispose()}clearTracks(e){e=[].concat(e),e.forEach((n)=>{let i=this[`${n}Tracks`]()||[],s=i.length;while(s--){let a=i[s];if(n==="text")this.removeRemoteTextTrack(a);i.removeTrack(a)}})}cleanupAutoTextTracks(){let e=this.autoRemoteTextTracks_||[],n=e.length;while(n--){let i=e[n];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){if(e!==void 0)this.error_=new Ri(e),this.trigger("error");return this.error_}played(){if(this.hasStarted_)return Yr(0,0);return Yr()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){if(this.manualTimeUpdates)this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Tr.names.forEach((e)=>{let n=Tr[e],i=()=>{this.trigger(`${e}trackchange`)},s=this[n.getterName]();s.addEventListener("removetrack",i),s.addEventListener("addtrack",i),this.on("dispose",()=>{s.removeEventListener("removetrack",i),s.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(qe.default.WebVTT)return;if(jt.default.body.contains(this.el())){if(!this.options_["vtt.js"]&&td(Hy.default)&&Object.keys(Hy.default).length>0){this.trigger("vttjsloaded");return}let e=jt.default.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),qe.default.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){let e=this.textTracks(),n=this.remoteTextTracks(),i=(l)=>e.addTrack(l.track),s=(l)=>e.removeTrack(l.track);n.on("addtrack",i),n.on("removetrack",s),this.addWebVttScript_();let a=()=>this.trigger("texttrackchange"),r=()=>{a();for(let l=0;l<e.length;l++){let c=e[l];if(c.removeEventListener("cuechange",a),c.mode==="showing")c.addEventListener("cuechange",a)}};r(),e.addEventListener("change",r),e.addEventListener("addtrack",r),e.addEventListener("removetrack",r),this.on("dispose",function(){n.off("addtrack",i),n.off("removetrack",s),e.removeEventListener("change",r),e.removeEventListener("addtrack",r),e.removeEventListener("removetrack",r);for(let l=0;l<e.length;l++)e[l].removeEventListener("cuechange",a)})}addTextTrack(e,n,i){if(!e)throw Error("TextTrack kind is required but was not provided");return YI(this,e,n,i)}createRemoteTextTrack(e){let n=ci(e,{tech:this});return new ad.remoteTextEl.TrackClass(n)}addRemoteTextTrack(e={},n){let i=this.createRemoteTextTrack(e);if(typeof n!=="boolean")n=!1;if(this.remoteTextTrackEls().addTrackElement_(i),this.remoteTextTracks().addTrack(i.track),n===!1)this.ready(()=>this.autoRemoteTextTracks_.addTrack(i.track));return i}removeRemoteTextTrack(e){let n=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(n),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){let n=Ar();if(!this.isReady_||this.paused())this.queuedHanders_.add(n),this.one("playing",()=>{if(this.queuedHanders_.has(n))this.queuedHanders_.delete(n),e()});else this.requestNamedAnimationFrame(n,e);return n}cancelVideoFrameCallback(e){if(this.queuedHanders_.has(e))this.queuedHanders_.delete(e);else this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,n){return kn.canPlayType(e.type)}static isTech(e){return e.prototype instanceof kn||e instanceof kn||e===kn}static registerTech(e,n){if(!kn.techs_)kn.techs_={};if(!kn.isTech(n))throw Error(`Tech ${e} must be a Tech`);if(!kn.canPlayType)throw Error("Techs must have a static canPlayType method on them");if(!kn.canPlaySource)throw Error("Techs must have a static canPlaySource method on them");if(e=Hi(e),kn.techs_[e]=n,kn.techs_[mp(e)]=n,e!=="Tech")kn.defaultTechOrder_.push(e);return n}static getTech(e){if(!e)return;if(kn.techs_&&kn.techs_[e])return kn.techs_[e];if(e=Hi(e),qe.default&&qe.default.videojs&&qe.default.videojs[e])return An.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),qe.default.videojs[e]}}ha.names.forEach(function(e){let n=ha[e];kn.prototype[n.getterName]=function(){return this[n.privateName]=this[n.privateName]||new n.ListClass,this[n.privateName]}});kn.prototype.featuresVolumeControl=!0;kn.prototype.featuresMuteControl=!0;kn.prototype.featuresFullscreenResize=!1;kn.prototype.featuresPlaybackRate=!1;kn.prototype.featuresProgressEvents=!1;kn.prototype.featuresSourceset=!1;kn.prototype.featuresTimeupdateEvents=!1;kn.prototype.featuresNativeTextTracks=!1;kn.prototype.featuresVideoFrameCallback=!1;kn.withSourceHandlers=function(e){e.registerSourceHandler=function(i,s){let a=e.sourceHandlers;if(!a)a=e.sourceHandlers=[];if(s===void 0)s=a.length;a.splice(s,0,i)},e.canPlayType=function(i){let s=e.sourceHandlers||[],a;for(let r=0;r<s.length;r++)if(a=s[r].canPlayType(i),a)return a;return""},e.selectSourceHandler=function(i,s){let a=e.sourceHandlers||[],r;for(let l=0;l<a.length;l++)if(r=a[l].canHandleSource(i,s),r)return a[l];return null},e.canPlaySource=function(i,s){let a=e.selectSourceHandler(i,s);if(a)return a.canHandleSource(i,s);return""},["seekable","seeking","duration"].forEach(function(i){let s=this[i];if(typeof s!=="function")return;this[i]=function(){if(this.sourceHandler_&&this.sourceHandler_[i])return this.sourceHandler_[i].apply(this.sourceHandler_,arguments);return s.apply(this,arguments)}},e.prototype),e.prototype.setSource=function(i){let s=e.selectSourceHandler(i,this.options_);if(!s)if(e.nativeSourceHandler)s=e.nativeSourceHandler;else An.error("No source handler found for the current source.");if(this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),s!==e.nativeSourceHandler)this.currentSource_=i;this.sourceHandler_=s.handleSource(i,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},e.prototype.disposeSourceHandler=function(){if(this.currentSource_)this.clearTracks(["audio","video"]),this.currentSource_=null;if(this.cleanupAutoTextTracks(),this.sourceHandler_){if(this.sourceHandler_.dispose)this.sourceHandler_.dispose();this.sourceHandler_=null}}};ht.registerComponent("Tech",kn);kn.registerTech("Tech",kn);kn.defaultTechOrder_=[];var ch={},E1={},q1={};function QI(e,n){ch[e]=ch[e]||[],ch[e].push(n)}function JI(e,n,i){e.setTimeout(()=>sh(n,ch[n.type],i,e),1)}function ZI(e,n){e.forEach((i)=>i.setTech&&i.setTech(n))}function eM(e,n,i){return e.reduceRight(C5(i),n[i]())}function tM(e,n,i,s){return n[i](e.reduce(C5(i),s))}function f8(e,n,i,s=null){let a="call"+Hi(i),r=e.reduce(C5(a),s),l=r===q1,c=l?null:n[i](r);return sM(e,i,c,l),c}var nM={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},iM={setCurrentTime:1,setMuted:1,setVolume:1},d8={play:1,pause:1};function C5(e){return(n,i)=>{if(n===q1)return q1;if(i[e])return i[e](n);return n}}function sM(e,n,i,s){for(let a=e.length-1;a>=0;a--){let r=e[a];if(r[n])r[n](s,i)}}function aM(e){if(E1.hasOwnProperty(e.id()))delete E1[e.id()]}function rM(e,n){let i=E1[e.id()],s=null;if(i===void 0||i===null)return s=n(e),E1[e.id()]=[[n,s]],s;for(let a=0;a<i.length;a++){let[r,l]=i[a];if(r!==n)continue;s=l}if(s===null)s=n(e),i.push([n,s]);return s}function sh(e={},n=[],i,s,a=[],r=!1){let[l,...c]=n;if(typeof l==="string")sh(e,ch[l],i,s,a,r);else if(l){let p=rM(s,l);if(!p.setSource)return a.push(p),sh(e,c,i,s,a,r);p.setSource(Object.assign({},e),function(m,g){if(m)return sh(e,c,i,s,a,r);a.push(p),sh(g,e.type===g.type?c:ch[g.type],i,s,a,r)})}else if(c.length)sh(e,c,i,s,a,r);else if(r)i(e,a);else sh(e,ch["*"],i,s,a,!0)}var oM={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},D1=function(e=""){let n=k5(e);return oM[n.toLowerCase()]||""},lM=(e,n)=>{if(!n)return"";if(e.cache_.source.src===n&&e.cache_.source.type)return e.cache_.source.type;let i=e.cache_.sources.filter((a)=>a.src===n);if(i.length)return i[0].type;let s=e.$$("source");for(let a=0;a<s.length;a++){let r=s[a];if(r.type&&r.src&&r.src===n)return r.type}return D1(n)},I7=function(e){if(Array.isArray(e)){let n=[];e.forEach(function(i){if(i=I7(i),Array.isArray(i))n=n.concat(i);else if(Mo(i))n.push(i)}),e=n}else if(typeof e==="string"&&e.trim())e=[p8({src:e})];else if(Mo(e)&&typeof e.src==="string"&&e.src&&e.src.trim())e=[p8(e)];else e=[];return e};function p8(e){if(!e.type){let n=D1(e.src);if(n)e.type=n}return e}var cM=`<svg xmlns="http://www.w3.org/2000/svg">
|
|
29
|
+
<defs>
|
|
30
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-play">
|
|
31
|
+
<path d="M16 10v28l22-14z"></path>
|
|
32
|
+
</symbol>
|
|
33
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-pause">
|
|
34
|
+
<path d="M12 38h8V10h-8v28zm16-28v28h8V10h-8z"></path>
|
|
35
|
+
</symbol>
|
|
36
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-audio">
|
|
37
|
+
<path d="M24 2C14.06 2 6 10.06 6 20v14c0 3.31 2.69 6 6 6h6V24h-8v-4c0-7.73 6.27-14 14-14s14 6.27 14 14v4h-8v16h6c3.31 0 6-2.69 6-6V20c0-9.94-8.06-18-18-18z"></path>
|
|
38
|
+
</symbol>
|
|
39
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-captions">
|
|
40
|
+
<path d="M38 8H10c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h28c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM22 22h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2zm14 0h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2z"></path>
|
|
41
|
+
</symbol>
|
|
42
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-subtitles">
|
|
43
|
+
<path d="M40 8H8c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h32c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM8 24h8v4H8v-4zm20 12H8v-4h20v4zm12 0h-8v-4h8v4zm0-8H20v-4h20v4z"></path>
|
|
44
|
+
</symbol>
|
|
45
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-enter">
|
|
46
|
+
<path d="M14 28h-4v10h10v-4h-6v-6zm-4-8h4v-6h6v-4H10v10zm24 14h-6v4h10V28h-4v6zm-6-24v4h6v6h4V10H28z"></path>
|
|
47
|
+
</symbol>
|
|
48
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-exit">
|
|
49
|
+
<path d="M10 32h6v6h4V28H10v4zm6-16h-6v4h10V10h-4v6zm12 22h4v-6h6v-4H28v10zm4-22v-6h-4v10h10v-4h-6z"></path>
|
|
50
|
+
</symbol>
|
|
51
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-play-circle">
|
|
52
|
+
<path d="M20 33l12-9-12-9v18zm4-29C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"></path>
|
|
53
|
+
</symbol>
|
|
54
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-volume-mute">
|
|
55
|
+
<path d="M33 24c0-3.53-2.04-6.58-5-8.05v4.42l4.91 4.91c.06-.42.09-.85.09-1.28zm5 0c0 1.88-.41 3.65-1.08 5.28l3.03 3.03C41.25 29.82 42 27 42 24c0-8.56-5.99-15.72-14-17.54v4.13c5.78 1.72 10 7.07 10 13.41zM8.55 6L6 8.55 15.45 18H6v12h8l10 10V26.55l8.51 8.51c-1.34 1.03-2.85 1.86-4.51 2.36v4.13a17.94 17.94 0 0 0 7.37-3.62L39.45 42 42 39.45l-18-18L8.55 6zM24 8l-4.18 4.18L24 16.36V8z"></path>
|
|
56
|
+
</symbol>
|
|
57
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-volume-low">
|
|
58
|
+
<path d="M14 18v12h8l10 10V8L22 18h-8z"></path>
|
|
59
|
+
</symbol>
|
|
60
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-volume-medium">
|
|
61
|
+
<path d="M37 24c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zm-27-6v12h8l10 10V8L18 18h-8z"></path>
|
|
62
|
+
</symbol>
|
|
63
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-volume-high">
|
|
64
|
+
<path d="M6 18v12h8l10 10V8L14 18H6zm27 6c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zM28 6.46v4.13c5.78 1.72 10 7.07 10 13.41s-4.22 11.69-10 13.41v4.13c8.01-1.82 14-8.97 14-17.54S36.01 8.28 28 6.46z"></path>
|
|
65
|
+
</symbol>
|
|
66
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-spinner">
|
|
67
|
+
<path d="M18.8 21l9.53-16.51C26.94 4.18 25.49 4 24 4c-4.8 0-9.19 1.69-12.64 4.51l7.33 12.69.11-.2zm24.28-3c-1.84-5.85-6.3-10.52-11.99-12.68L23.77 18h19.31zm.52 2H28.62l.58 1 9.53 16.5C41.99 33.94 44 29.21 44 24c0-1.37-.14-2.71-.4-4zm-26.53 4l-7.8-13.5C6.01 14.06 4 18.79 4 24c0 1.37.14 2.71.4 4h14.98l-2.31-4zM4.92 30c1.84 5.85 6.3 10.52 11.99 12.68L24.23 30H4.92zm22.54 0l-7.8 13.51c1.4.31 2.85.49 4.34.49 4.8 0 9.19-1.69 12.64-4.51L29.31 26.8 27.46 30z"></path>
|
|
68
|
+
</symbol>
|
|
69
|
+
<symbol viewBox="0 0 24 24" id="vjs-icon-hd">
|
|
70
|
+
<path d="M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-8 12H9.5v-2h-2v2H6V9h1.5v2.5h2V9H11v6zm2-6h4c.55 0 1 .45 1 1v4c0 .55-.45 1-1 1h-4V9zm1.5 4.5h2v-3h-2v3z"></path>
|
|
71
|
+
</symbol>
|
|
72
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-chapters">
|
|
73
|
+
<path d="M6 26h4v-4H6v4zm0 8h4v-4H6v4zm0-16h4v-4H6v4zm8 8h28v-4H14v4zm0 8h28v-4H14v4zm0-20v4h28v-4H14z"></path>
|
|
74
|
+
</symbol>
|
|
75
|
+
<symbol viewBox="0 0 40 40" id="vjs-icon-downloading">
|
|
76
|
+
<path d="M18.208 36.875q-3.208-.292-5.979-1.729-2.771-1.438-4.812-3.729-2.042-2.292-3.188-5.229-1.146-2.938-1.146-6.23 0-6.583 4.334-11.416 4.333-4.834 10.833-5.5v3.166q-5.167.75-8.583 4.646Q6.25 14.75 6.25 19.958q0 5.209 3.396 9.104 3.396 3.896 8.562 4.646zM20 28.417L11.542 20l2.083-2.083 4.917 4.916v-11.25h2.916v11.25l4.875-4.916L28.417 20zm1.792 8.458v-3.167q1.833-.25 3.541-.958 1.709-.708 3.167-1.875l2.333 2.292q-1.958 1.583-4.25 2.541-2.291.959-4.791 1.167zm6.791-27.792q-1.541-1.125-3.25-1.854-1.708-.729-3.541-1.021V3.042q2.5.25 4.77 1.208 2.271.958 4.271 2.5zm4.584 21.584l-2.25-2.25q1.166-1.5 1.854-3.209.687-1.708.937-3.541h3.209q-.292 2.5-1.229 4.791-.938 2.292-2.521 4.209zm.541-12.417q-.291-1.833-.958-3.562-.667-1.73-1.833-3.188l2.375-2.208q1.541 1.916 2.458 4.208.917 2.292 1.167 4.75z"></path>
|
|
77
|
+
</symbol>
|
|
78
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-file-download">
|
|
79
|
+
<path d="M10.8 40.55q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h26.35v-7.7h3.4v7.7q0 1.4-1 2.4t-2.4 1zM24 32.1L13.9 22.05l2.45-2.45 5.95 5.95V7.15h3.4v18.4l5.95-5.95 2.45 2.45z"></path>
|
|
80
|
+
</symbol>
|
|
81
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-file-download-done">
|
|
82
|
+
<path d="M9.8 40.5v-3.45h28.4v3.45zm9.2-9.05L7.4 19.85l2.45-2.35L19 26.65l19.2-19.2 2.4 2.4z"></path>
|
|
83
|
+
</symbol>
|
|
84
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-file-download-off">
|
|
85
|
+
<path d="M4.9 4.75L43.25 43.1 41 45.3l-4.75-4.75q-.05.05-.075.025-.025-.025-.075-.025H10.8q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h22.05l-7-7-1.85 1.8L13.9 21.9l1.85-1.85L2.7 7zm26.75 14.7l2.45 2.45-3.75 3.8-2.45-2.5zM25.7 7.15V21.1l-3.4-3.45V7.15z"></path>
|
|
86
|
+
</symbol>
|
|
87
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-share">
|
|
88
|
+
<path d="M36 32.17c-1.52 0-2.89.59-3.93 1.54L17.82 25.4c.11-.45.18-.92.18-1.4s-.07-.95-.18-1.4l14.1-8.23c1.07 1 2.5 1.62 4.08 1.62 3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6c0 .48.07.95.18 1.4l-14.1 8.23c-1.07-1-2.5-1.62-4.08-1.62-3.31 0-6 2.69-6 6s2.69 6 6 6c1.58 0 3.01-.62 4.08-1.62l14.25 8.31c-.1.42-.16.86-.16 1.31A5.83 5.83 0 1 0 36 32.17z"></path>
|
|
89
|
+
</symbol>
|
|
90
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-cog">
|
|
91
|
+
<path d="M38.86 25.95c.08-.64.14-1.29.14-1.95s-.06-1.31-.14-1.95l4.23-3.31c.38-.3.49-.84.24-1.28l-4-6.93c-.25-.43-.77-.61-1.22-.43l-4.98 2.01c-1.03-.79-2.16-1.46-3.38-1.97L29 4.84c-.09-.47-.5-.84-1-.84h-8c-.5 0-.91.37-.99.84l-.75 5.3a14.8 14.8 0 0 0-3.38 1.97L9.9 10.1a1 1 0 0 0-1.22.43l-4 6.93c-.25.43-.14.97.24 1.28l4.22 3.31C9.06 22.69 9 23.34 9 24s.06 1.31.14 1.95l-4.22 3.31c-.38.3-.49.84-.24 1.28l4 6.93c.25.43.77.61 1.22.43l4.98-2.01c1.03.79 2.16 1.46 3.38 1.97l.75 5.3c.08.47.49.84.99.84h8c.5 0 .91-.37.99-.84l.75-5.3a14.8 14.8 0 0 0 3.38-1.97l4.98 2.01a1 1 0 0 0 1.22-.43l4-6.93c.25-.43.14-.97-.24-1.28l-4.22-3.31zM24 31c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"></path>
|
|
92
|
+
</symbol>
|
|
93
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-square">
|
|
94
|
+
<path d="M36 8H12c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h24c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zm0 28H12V12h24v24z"></path>
|
|
95
|
+
</symbol>
|
|
96
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-circle">
|
|
97
|
+
<circle cx="24" cy="24" r="20"></circle>
|
|
98
|
+
</symbol>
|
|
99
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-circle-outline">
|
|
100
|
+
<path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"></path>
|
|
101
|
+
</symbol>
|
|
102
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-circle-inner-circle">
|
|
103
|
+
<path d="M24 4C12.97 4 4 12.97 4 24s8.97 20 20 20 20-8.97 20-20S35.03 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16zm6-16c0 3.31-2.69 6-6 6s-6-2.69-6-6 2.69-6 6-6 6 2.69 6 6z"></path>
|
|
104
|
+
</symbol>
|
|
105
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-cancel">
|
|
106
|
+
<path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm10 27.17L31.17 34 24 26.83 16.83 34 14 31.17 21.17 24 14 16.83 16.83 14 24 21.17 31.17 14 34 16.83 26.83 24 34 31.17z"></path>
|
|
107
|
+
</symbol>
|
|
108
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-replay">
|
|
109
|
+
<path d="M24 10V2L14 12l10 10v-8c6.63 0 12 5.37 12 12s-5.37 12-12 12-12-5.37-12-12H8c0 8.84 7.16 16 16 16s16-7.16 16-16-7.16-16-16-16z"></path>
|
|
110
|
+
</symbol>
|
|
111
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-repeat">
|
|
112
|
+
<path d="M14 14h20v6l8-8-8-8v6H10v12h4v-8zm20 20H14v-6l-8 8 8 8v-6h24V26h-4v8z"></path>
|
|
113
|
+
</symbol>
|
|
114
|
+
<symbol viewBox="0 96 48 48" id="vjs-icon-replay-5">
|
|
115
|
+
<path d="M17.689 98l-8.697 8.696 8.697 8.697 2.486-2.485-4.32-4.319h1.302c4.93 0 9.071 1.722 12.424 5.165 3.352 3.443 5.029 7.638 5.029 12.584h3.55c0-2.958-.553-5.73-1.658-8.313-1.104-2.583-2.622-4.841-4.555-6.774-1.932-1.932-4.19-3.45-6.773-4.555-2.584-1.104-5.355-1.657-8.313-1.657H15.5l4.615-4.615zm-8.08 21.659v13.861h11.357v5.008H9.609V143h12.7c.834 0 1.55-.298 2.146-.894.596-.597.895-1.31.895-2.145v-7.781c0-.835-.299-1.55-.895-2.147a2.929 2.929 0 0 0-2.147-.894h-8.227v-5.096H25.35v-4.384z"></path>
|
|
116
|
+
</symbol>
|
|
117
|
+
<symbol viewBox="0 96 48 48" id="vjs-icon-replay-10">
|
|
118
|
+
<path d="M42.315 125.63c0-4.997-1.694-9.235-5.08-12.713-3.388-3.479-7.571-5.218-12.552-5.218h-1.315l4.363 4.363-2.51 2.51-8.787-8.786L25.221 97l2.45 2.45-4.662 4.663h1.375c2.988 0 5.788.557 8.397 1.673 2.61 1.116 4.892 2.65 6.844 4.602 1.953 1.953 3.487 4.234 4.602 6.844 1.116 2.61 1.674 5.41 1.674 8.398zM8.183 142v-19.657H3.176V117.8h9.643V142zm13.63 0c-1.156 0-2.127-.393-2.912-1.178-.778-.778-1.168-1.746-1.168-2.902v-16.04c0-1.156.393-2.127 1.178-2.912.779-.779 1.746-1.168 2.902-1.168h7.696c1.156 0 2.126.392 2.911 1.177.779.78 1.168 1.747 1.168 2.903v16.04c0 1.156-.392 2.127-1.177 2.912-.779.779-1.746 1.168-2.902 1.168zm.556-4.636h6.583v-15.02H22.37z"></path>
|
|
119
|
+
</symbol>
|
|
120
|
+
<symbol viewBox="0 96 48 48" id="vjs-icon-replay-30">
|
|
121
|
+
<path d="M26.047 97l-8.733 8.732 8.733 8.733 2.496-2.494-4.336-4.338h1.307c4.95 0 9.108 1.73 12.474 5.187 3.367 3.458 5.051 7.668 5.051 12.635h3.565c0-2.97-.556-5.751-1.665-8.346-1.109-2.594-2.633-4.862-4.574-6.802-1.94-1.941-4.208-3.466-6.803-4.575-2.594-1.109-5.375-1.664-8.345-1.664H23.85l4.634-4.634zM2.555 117.531v4.688h10.297v5.25H5.873v4.687h6.979v5.156H2.555V142H13.36c1.061 0 1.95-.395 2.668-1.186.718-.79 1.076-1.772 1.076-2.94v-16.218c0-1.168-.358-2.149-1.076-2.94-.717-.79-1.607-1.185-2.668-1.185zm22.482.14c-1.149 0-2.11.39-2.885 1.165-.78.78-1.172 1.744-1.172 2.893v15.943c0 1.149.388 2.11 1.163 2.885.78.78 1.745 1.172 2.894 1.172h7.649c1.148 0 2.11-.388 2.884-1.163.78-.78 1.17-1.745 1.17-2.894v-15.943c0-1.15-.386-2.111-1.16-2.885-.78-.78-1.746-1.172-2.894-1.172zm.553 4.518h6.545v14.93H25.59z"></path>
|
|
122
|
+
</symbol>
|
|
123
|
+
<symbol viewBox="0 96 48 48" id="vjs-icon-forward-5">
|
|
124
|
+
<path d="M29.508 97l-2.431 2.43 4.625 4.625h-1.364c-2.965 0-5.742.554-8.332 1.66-2.589 1.107-4.851 2.629-6.788 4.566-1.937 1.937-3.458 4.2-4.565 6.788-1.107 2.59-1.66 5.367-1.66 8.331h3.557c0-4.957 1.68-9.16 5.04-12.611 3.36-3.45 7.51-5.177 12.451-5.177h1.304l-4.326 4.33 2.49 2.49 8.715-8.716zm-9.783 21.61v13.89h11.382v5.018H19.725V142h12.727a2.93 2.93 0 0 0 2.15-.896 2.93 2.93 0 0 0 .896-2.15v-7.798c0-.837-.299-1.554-.896-2.152a2.93 2.93 0 0 0-2.15-.896h-8.245V123h11.29v-4.392z"></path>
|
|
125
|
+
</symbol>
|
|
126
|
+
<symbol viewBox="0 96 48 48" id="vjs-icon-forward-10">
|
|
127
|
+
<path d="M23.119 97l-2.386 2.383 4.538 4.538h-1.339c-2.908 0-5.633.543-8.173 1.63-2.54 1.085-4.76 2.577-6.66 4.478-1.9 1.9-3.392 4.12-4.478 6.66-1.085 2.54-1.629 5.264-1.629 8.172h3.49c0-4.863 1.648-8.986 4.944-12.372 3.297-3.385 7.368-5.078 12.216-5.078h1.279l-4.245 4.247 2.443 2.442 8.55-8.55zm-9.52 21.45v4.42h4.871V142h4.513v-23.55zm18.136 0c-1.125 0-2.066.377-2.824 1.135-.764.764-1.148 1.709-1.148 2.834v15.612c0 1.124.38 2.066 1.139 2.824.764.764 1.708 1.145 2.833 1.145h7.489c1.125 0 2.066-.378 2.824-1.136.764-.764 1.145-1.709 1.145-2.833v-15.612c0-1.125-.378-2.067-1.136-2.825-.764-.764-1.708-1.145-2.833-1.145zm.54 4.42h6.408v14.617h-6.407z"></path>
|
|
128
|
+
</symbol>
|
|
129
|
+
<symbol viewBox="0 96 48 48" id="vjs-icon-forward-30">
|
|
130
|
+
<path d="M25.549 97l-2.437 2.434 4.634 4.635H26.38c-2.97 0-5.753.555-8.347 1.664-2.594 1.109-4.861 2.633-6.802 4.574-1.94 1.94-3.465 4.207-4.574 6.802-1.109 2.594-1.664 5.377-1.664 8.347h3.565c0-4.967 1.683-9.178 5.05-12.636 3.366-3.458 7.525-5.187 12.475-5.187h1.307l-4.335 4.338 2.495 2.494 8.732-8.732zm-11.553 20.53v4.689h10.297v5.249h-6.978v4.688h6.978v5.156H13.996V142h10.808c1.06 0 1.948-.395 2.666-1.186.718-.79 1.077-1.771 1.077-2.94v-16.217c0-1.169-.36-2.15-1.077-2.94-.718-.79-1.605-1.186-2.666-1.186zm21.174.168c-1.149 0-2.11.389-2.884 1.163-.78.78-1.172 1.745-1.172 2.894v15.942c0 1.15.388 2.11 1.162 2.885.78.78 1.745 1.17 2.894 1.17h7.649c1.149 0 2.11-.386 2.885-1.16.78-.78 1.17-1.746 1.17-2.895v-15.942c0-1.15-.387-2.11-1.161-2.885-.78-.78-1.745-1.172-2.894-1.172zm.552 4.516h6.542v14.931h-6.542z"></path>
|
|
131
|
+
</symbol>
|
|
132
|
+
<symbol viewBox="0 0 512 512" id="vjs-icon-audio-description">
|
|
133
|
+
<g fill-rule="evenodd"><path d="M227.29 381.351V162.993c50.38-1.017 89.108-3.028 117.631 17.126 27.374 19.342 48.734 56.965 44.89 105.325-4.067 51.155-41.335 94.139-89.776 98.475-24.085 2.155-71.972 0-71.972 0s-.84-1.352-.773-2.568m48.755-54.804c31.43 1.26 53.208-16.633 56.495-45.386 4.403-38.51-21.188-63.552-58.041-60.796v103.612c-.036 1.466.575 2.22 1.546 2.57"></path><path d="M383.78 381.328c13.336 3.71 17.387-11.06 23.215-21.408 12.722-22.571 22.294-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.226 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894"></path><path d="M425.154 381.328c13.336 3.71 17.384-11.061 23.215-21.408 12.721-22.571 22.291-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.511c-.586 3.874 2.226 7.315 3.866 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894"></path><path d="M466.26 381.328c13.337 3.71 17.385-11.061 23.216-21.408 12.722-22.571 22.292-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.225 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894M4.477 383.005H72.58l18.573-28.484 64.169-.135s.065 19.413.065 28.62h48.756V160.307h-58.816c-5.653 9.537-140.85 222.697-140.85 222.697zm152.667-145.282v71.158l-40.453-.27 40.453-70.888z"></path></g>
|
|
134
|
+
</symbol>
|
|
135
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-next-item">
|
|
136
|
+
<path d="M12 36l17-12-17-12v24zm20-24v24h4V12h-4z"></path>
|
|
137
|
+
</symbol>
|
|
138
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-previous-item">
|
|
139
|
+
<path d="M12 12h4v24h-4zm7 12l17 12V12z"></path>
|
|
140
|
+
</symbol>
|
|
141
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-shuffle">
|
|
142
|
+
<path d="M21.17 18.34L10.83 8 8 10.83l10.34 10.34 2.83-2.83zM29 8l4.09 4.09L8 37.17 10.83 40l25.09-25.09L40 19V8H29zm.66 18.83l-2.83 2.83 6.26 6.26L29 40h11V29l-4.09 4.09-6.25-6.26z"></path>
|
|
143
|
+
</symbol>
|
|
144
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-cast">
|
|
145
|
+
<path d="M42 6H6c-2.21 0-4 1.79-4 4v6h4v-6h36v28H28v4h14c2.21 0 4-1.79 4-4V10c0-2.21-1.79-4-4-4zM2 36v6h6c0-3.31-2.69-6-6-6zm0-8v4c5.52 0 10 4.48 10 10h4c0-7.73-6.27-14-14-14zm0-8v4c9.94 0 18 8.06 18 18h4c0-12.15-9.85-22-22-22z"></path>
|
|
146
|
+
</symbol>
|
|
147
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-picture-in-picture-enter">
|
|
148
|
+
<path d="M38 22H22v11.99h16V22zm8 16V9.96C46 7.76 44.2 6 42 6H6C3.8 6 2 7.76 2 9.96V38c0 2.2 1.8 4 4 4h36c2.2 0 4-1.8 4-4zm-4 .04H6V9.94h36v28.1z"></path>
|
|
149
|
+
</symbol>
|
|
150
|
+
<symbol viewBox="0 0 22 18" id="vjs-icon-picture-in-picture-exit">
|
|
151
|
+
<path d="M18 4H4v10h14V4zm4 12V1.98C22 .88 21.1 0 20 0H2C.9 0 0 .88 0 1.98V16c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H2V1.97h18v14.05z"></path>
|
|
152
|
+
<path fill="none" d="M-1-3h24v24H-1z"></path>
|
|
153
|
+
</symbol>
|
|
154
|
+
<symbol viewBox="0 0 1792 1792" id="vjs-icon-facebook">
|
|
155
|
+
<path d="M1343 12v264h-157q-86 0-116 36t-30 108v189h293l-39 296h-254v759H734V905H479V609h255V391q0-186 104-288.5T1115 0q147 0 228 12z"></path>
|
|
156
|
+
</symbol>
|
|
157
|
+
<symbol viewBox="0 0 1792 1792" id="vjs-icon-linkedin">
|
|
158
|
+
<path d="M477 625v991H147V625h330zm21-306q1 73-50.5 122T312 490h-2q-82 0-132-49t-50-122q0-74 51.5-122.5T314 148t133 48.5T498 319zm1166 729v568h-329v-530q0-105-40.5-164.5T1168 862q-63 0-105.5 34.5T999 982q-11 30-11 81v553H659q2-399 2-647t-1-296l-1-48h329v144h-2q20-32 41-56t56.5-52 87-43.5T1285 602q171 0 275 113.5t104 332.5z"></path>
|
|
159
|
+
</symbol>
|
|
160
|
+
<symbol viewBox="0 0 1200 1227" id="vjs-icon-twitter">
|
|
161
|
+
<path d="M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z"/>
|
|
162
|
+
</symbol>
|
|
163
|
+
<symbol viewBox="0 0 1792 1792" id="vjs-icon-tumblr">
|
|
164
|
+
<path d="M1328 1329l80 237q-23 35-111 66t-177 32q-104 2-190.5-26T787 1564t-95-106-55.5-120-16.5-118V676H452V461q72-26 129-69.5t91-90 58-102 34-99T779 12q1-5 4.5-8.5T791 0h244v424h333v252h-334v518q0 30 6.5 56t22.5 52.5 49.5 41.5 81.5 14q78-2 134-29z"></path>
|
|
165
|
+
</symbol>
|
|
166
|
+
<symbol viewBox="0 0 1792 1792" id="vjs-icon-pinterest">
|
|
167
|
+
<path d="M1664 896q0 209-103 385.5T1281.5 1561 896 1664q-111 0-218-32 59-93 78-164 9-34 54-211 20 39 73 67.5t114 28.5q121 0 216-68.5t147-188.5 52-270q0-114-59.5-214T1180 449t-255-63q-105 0-196 29t-154.5 77-109 110.5-67 129.5T377 866q0 104 40 183t117 111q30 12 38-20 2-7 8-31t8-30q6-23-11-43-51-61-51-151 0-151 104.5-259.5T904 517q151 0 235.5 82t84.5 213q0 170-68.5 289T980 1220q-61 0-98-43.5T859 1072q8-35 26.5-93.5t30-103T927 800q0-50-27-83t-77-33q-62 0-105 57t-43 142q0 73 25 122l-99 418q-17 70-13 177-206-91-333-281T128 896q0-209 103-385.5T510.5 231 896 128t385.5 103T1561 510.5 1664 896z"></path>
|
|
168
|
+
</symbol>
|
|
169
|
+
</defs>
|
|
170
|
+
</svg>`;var m8=k1?10009:T1?461:8,zf={codes:{play:415,pause:19,ff:417,rw:412,back:m8},names:{415:"play",19:"pause",417:"ff",412:"rw",[m8]:"back"},isEventKey(e,n){if(n=n.toLowerCase(),this.names[e.keyCode]&&this.names[e.keyCode]===n)return!0;return!1},getEventName(e){if(this.names[e.keyCode])return this.names[e.keyCode];else if(this.codes[e.code]){let n=this.codes[e.code];return this.names[n]}return null}},g8=5;class M7 extends Na{constructor(e){super();this.player_=e,this.focusableComponents=[],this.isListening_=!1,this.isPaused_=!1,this.onKeyDown_=this.onKeyDown_.bind(this),this.lastFocusedComponent_=null}start(){if(this.isListening_)return;if(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",()=>{this.focus(this.updateFocusableComponents()[0])}),this.player_.on("modalclose",()=>{this.refocusComponent()}),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0,this.player_.errorDisplay)this.player_.errorDisplay.on("aftermodalfill",()=>{if(this.updateFocusableComponents(),this.focusableComponents.length)if(this.focusableComponents.length>1)this.focusableComponents[1].focus();else this.focusableComponents[0].focus()})}stop(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}onKeyDown_(e){let n=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(n.key)){if(this.isPaused_)return;n.preventDefault();let i=n.key.substring(5).toLowerCase();this.move(i)}else if(zf.isEventKey(n,"play")||zf.isEventKey(n,"pause")||zf.isEventKey(n,"ff")||zf.isEventKey(n,"rw")){n.preventDefault();let i=zf.getEventName(n);this.performMediaAction_(i)}else if(zf.isEventKey(n,"Back")&&e.target&&typeof e.target.closeable==="function"&&e.target.closeable())n.preventDefault(),e.target.close()}performMediaAction_(e){if(this.player_)switch(e){case"play":if(this.player_.paused())this.player_.play();break;case"pause":if(!this.player_.paused())this.player_.pause();break;case"ff":this.userSeek_(this.player_.currentTime()+g8);break;case"rw":this.userSeek_(this.player_.currentTime()-g8);break}}userSeek_(e){if(this.player_.liveTracker&&this.player_.liveTracker.isLive())this.player_.liveTracker.nextSeekedFromUser();this.player_.currentTime(e)}pause(){this.isPaused_=!0}resume(){this.isPaused_=!1}handlePlayerBlur_(e){let n=e.relatedTarget,i=null,s=this.getCurrentComponent(e.target);if(n){if(i=Boolean(n.closest(".video-js")),n.classList.contains("vjs-text-track-settings")&&!this.isPaused_)this.searchForTrackSelect_()}if(!e.currentTarget.contains(e.relatedTarget)&&!i||!n){if(s&&s.name()==="CloseButton")this.refocusComponent();else if(this.pause(),s&&s.el())this.lastFocusedComponent_=s}}handlePlayerFocus_(){if(this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable())this.resume()}updateFocusableComponents(){let e=this.player_,n=[];function i(s){for(let a of s){if(a.hasOwnProperty("el_")&&a.getIsFocusable()&&a.getIsAvailableToBeFocused(a.el()))n.push(a);if(a.hasOwnProperty("children_")&&a.children_.length>0)i(a.children_)}}return e.children_.forEach((s)=>{if(s.hasOwnProperty("el_")){if(s.getIsFocusable&&s.getIsAvailableToBeFocused&&s.getIsFocusable()&&s.getIsAvailableToBeFocused(s.el())){n.push(s);return}else if(s.hasOwnProperty("children_")&&s.children_.length>0)i(s.children_);else if(s.hasOwnProperty("items")&&s.items.length>0)i(s.items);else if(this.findSuitableDOMChild(s))n.push(s)}if(s.name_==="ErrorDisplay"&&s.opened_){let a=s.el_.querySelector(".vjs-errors-ok-button-container");if(a)a.querySelectorAll("button").forEach((l,c)=>{n.push({name:()=>"ModalButton"+(c+1),el:()=>l,getPositions:()=>{let p=l.getBoundingClientRect(),m={x:p.x,y:p.y,width:p.width,height:p.height,top:p.top,right:p.right,bottom:p.bottom,left:p.left},g={x:p.left+p.width/2,y:p.top+p.height/2,width:0,height:0,top:p.top+p.height/2,right:p.left+p.width/2,bottom:p.top+p.height/2,left:p.left+p.width/2};return{boundingClientRect:m,center:g}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:(p)=>!0,focus:()=>l.focus()})})}}),this.focusableComponents=n,this.focusableComponents}findSuitableDOMChild(e){function n(i){if(e.getIsFocusable(i)&&e.getIsAvailableToBeFocused(i))return i;for(let s=0;s<i.children.length;s++){let a=i.children[s],r=n(a);if(r)return r}return null}if(e.el())return n(e.el());return null}getCurrentComponent(e){this.updateFocusableComponents();let n=e||document.activeElement;if(this.focusableComponents.length){for(let i of this.focusableComponents)if(i.el()===n)return i}}add(e){let n=[...this.focusableComponents];if(e.hasOwnProperty("el_")&&e.getIsFocusable()&&e.getIsAvailableToBeFocused(e.el()))n.push(e);this.focusableComponents=n,this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents})}remove(e){for(let n=0;n<this.focusableComponents.length;n++)if(this.focusableComponents[n].name()===e.name()){this.focusableComponents.splice(n,1),this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents});return}}clear(){if(this.focusableComponents.length>0)this.focusableComponents=[],this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents})}move(e){let n=this.getCurrentComponent();if(!n)return;let i=n.getPositions(),s=this.focusableComponents.filter((r)=>r!==n&&this.isInDirection_(i.boundingClientRect,r.getPositions().boundingClientRect,e)),a=this.findBestCandidate_(i.center,s,e);if(a)this.focus(a);else this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:n})}findBestCandidate_(e,n,i){let s=1/0,a=null;for(let r of n){let l=r.getPositions().center,c=this.calculateDistance_(e,l,i);if(c<s)s=c,a=r}return a}isInDirection_(e,n,i){switch(i){case"right":return n.left>=e.right;case"left":return n.right<=e.left;case"down":return n.top>=e.bottom;case"up":return n.bottom<=e.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){if(!this.player_.userActive())this.player_.userActive(!0);this.updateFocusableComponents();for(let e=0;e<this.focusableComponents.length;e++)if(this.focusableComponents[e].name()===this.lastFocusedComponent_.name()){this.focus(this.focusableComponents[e]);return}}else this.focus(this.updateFocusableComponents()[0])}focus(e){if(typeof e!=="object")return;if(e.getIsAvailableToBeFocused(e.el()))e.focus();else if(this.findSuitableDOMChild(e))this.findSuitableDOMChild(e).focus()}calculateDistance_(e,n,i){let s=Math.abs(e.x-n.x),a=Math.abs(e.y-n.y),r;switch(i){case"right":case"left":r=s+a*100;break;case"up":r=a*2+s*0.5;break;case"down":r=a*5+s;break;default:r=s+a}return r}searchForTrackSelect_(){let e=this;for(let n of e.updateFocusableComponents())if(n.constructor.name==="TextTrackSelect"){e.focus(n);break}}}class R7 extends ht{constructor(e,n,i){let s=ci({createEl:!1},n);super(e,s,i);if(!n.playerOptions.sources||n.playerOptions.sources.length===0)for(let a=0,r=n.playerOptions.techOrder;a<r.length;a++){let l=Hi(r[a]),c=kn.getTech(l);if(!l)c=ht.getComponent(l);if(c&&c.isSupported()){e.loadTech_(l);break}}else e.src(n.playerOptions.sources)}}ht.registerComponent("MediaLoader",R7);class Tp extends ht{constructor(e,n){super(e,n);if(this.options_.controlText)this.controlText(this.options_.controlText);this.handleMouseOver_=(i)=>this.handleMouseOver(i),this.handleMouseOut_=(i)=>this.handleMouseOut(i),this.handleClick_=(i)=>this.handleClick(i),this.handleKeyDown_=(i)=>this.handleKeyDown(i),this.emitTapEvents(),this.enable()}createEl(e="div",n={},i={}){if(n=Object.assign({className:this.buildCSSClass(),tabIndex:0},n),e==="button")An.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`);i=Object.assign({role:"button"},i),this.tabIndex_=n.tabIndex;let s=on(e,n,i);if(!this.player_.options_.experimentalSvgIcons)s.appendChild(on("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0}));return this.createControlTextEl(s),s}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){if(this.controlTextEl_=on("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e)e.appendChild(this.controlTextEl_);return this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,n=this.el()){if(e===void 0)return this.controlText_||"Need Text";let i=this.localize(e);if(this.controlText_=e,zc(this.controlTextEl_,i),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes)n.setAttribute("title",i)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){if(!this.enabled_){if(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"u")this.el_.setAttribute("tabIndex",this.tabIndex_);this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_)}}disable(){if(this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),typeof this.tabIndex_<"u")this.el_.removeAttribute("tabIndex");this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){if(this.options_.clickHandler)this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){if(e.key===" "||e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.trigger("click");else super.handleKeyDown(e)}}ht.registerComponent("ClickableComponent",Tp);class I1 extends Tp{constructor(e,n){super(e,n);let{mainContent:i}=n&&n.playerOptions||{};this.isMainContent=i,this.update(),this.update_=(s)=>this.update(s),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return on("div",{className:"vjs-poster"})}crossOrigin(e){if(typeof e>"u"){if(this.$("img"))return this.$("img").crossOrigin;else if(this.player_.tech_&&this.player_.tech_.isReady_)return this.player_.crossOrigin();return this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null}if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}if(this.$("img"))this.$("img").crossOrigin=e;return}update(e){let n=this.player().poster();if(this.setSrc(n),n)this.show();else this.hide()}setSrc(e){if(!e){this.el_.textContent="";return}if(!this.$("img"))this.el_.appendChild(on("picture",{className:"vjs-poster",tabIndex:-1},{},on("img",{loading:this.isMainContent?"eager":"lazy",fetchPriority:this.isMainContent?"high":"auto",crossOrigin:this.crossOrigin()},{alt:""})));this.$("img").src=e}handleClick(e){if(!this.player_.controls())return;let n=this.player_.getChild("controlBar"),i=n&&n.getChild("playToggle");if(Pc)(i||this.player_).focus();else if(this.player_.tech(!0))this.player_.tech(!0).focus();if(this.player_.paused())jo(this.player_.play());else this.player_.pause()}}I1.prototype.crossorigin=I1.prototype.crossOrigin;ht.registerComponent("PosterImage",I1);var kr="#222",b8="#ccc",uM={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function Dy(e,n){let i;if(e.length===4)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else if(e.length===7)i=e.slice(1);else throw Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+n+")"}function Ao(e,n,i){try{e.style[n]=i}catch(s){return}}function w8(e){return e?`${e}px`:""}class O7 extends ht{constructor(e,n,i){super(e,n,i);let s=(r)=>this.updateDisplay(r),a=(r)=>{this.updateDisplayOverlay(),this.updateDisplay(r)};e.on("loadstart",(r)=>this.toggleDisplay(r)),e.on("useractive",s),e.on("userinactive",s),e.on("texttrackchange",s),e.on("loadedmetadata",(r)=>{this.updateDisplayOverlay(),this.preselectTrack(r)}),e.ready(di(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",a),e.on("playerresize",a);let r=qe.default.screen.orientation||qe.default,l=qe.default.screen.orientation?"change":"orientationchange";r.addEventListener(l,a),e.on("dispose",()=>r.removeEventListener(l,a));let c=this.options_.playerOptions.tracks||[];for(let p=0;p<c.length;p++)this.player_.addRemoteTextTrack(c[p],!0);this.preselectTrack()}))}preselectTrack(){let e={captions:1,subtitles:1},n=this.player_.textTracks(),i=this.player_.cache_.selectedLanguage,s,a,r;for(let l=0;l<n.length;l++){let c=n[l];if(i&&i.enabled&&i.language&&i.language===c.language&&c.kind in e){if(c.kind===i.kind)r=c;else if(!r)r=c}else if(i&&!i.enabled)r=null,s=null,a=null;else if(c.default){if(c.kind==="descriptions"&&!s)s=c;else if(c.kind in e&&!a)a=c}}if(r)r.mode="showing";else if(a)a.mode="showing";else if(s)s.mode="showing"}toggleDisplay(){if(this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks)this.hide();else this.show()}createEl(){return super.createEl("div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})}clearDisplay(){if(typeof qe.default.WebVTT==="function")qe.default.WebVTT.processCues(qe.default,[],this.el_)}updateDisplay(){let e=this.player_.textTracks(),n=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),n){let r=[];for(let l=0;l<e.length;++l){let c=e[l];if(c.mode!=="showing")continue;r.push(c)}this.updateForTrack(r);return}let i=null,s=null,a=e.length;while(a--){let r=e[a];if(r.mode==="showing")if(r.kind==="descriptions")i=r;else s=r}if(s){if(this.getAttribute("aria-live")!=="off")this.setAttribute("aria-live","off");this.updateForTrack(s)}else if(i){if(this.getAttribute("aria-live")!=="assertive")this.setAttribute("aria-live","assertive");this.updateForTrack(i)}if(!(qe.default.CSS!==void 0&&qe.default.CSS.supports("inset","10px"))){let r=this.el_,l=r.querySelectorAll(".vjs-text-track-cue"),c=this.player_.controlBar.el_.getBoundingClientRect().height,p=this.player_.el_.getBoundingClientRect().height;if(r.style="",Ao(r,"position","relative"),Ao(r,"height",p-c+"px"),Ao(r,"top","unset"),A1)Ao(r,"bottom",p+"px");else Ao(r,"bottom","0px");if(l.length>0)l.forEach((m)=>{if(m.style.inset){let g=m.style.inset.split(" ");if(g.length===3)Object.assign(m.style,{top:g[0],right:g[1],bottom:g[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!(qe.default.CSS!==void 0&&qe.default.CSS.supports("inset-inline: 10px")))return;let e=this.player_.currentWidth(),n=this.player_.currentHeight(),i=e/n,s=this.player_.videoWidth()/this.player_.videoHeight(),a=0,r=0;if(Math.abs(i-s)>0.1)if(i>s)a=Math.round((e-n*s)/2);else r=Math.round((n-e/s)/2);Ao(this.el_,"insetInline",w8(a)),Ao(this.el_,"insetBlock",w8(r))}updateDisplayState(e){let n=this.player_.textTrackSettings.getValues(),i=e.activeCues,s=i.length;while(s--){let a=i[s];if(!a)continue;let r=a.displayState;if(n.color)r.firstChild.style.color=n.color;if(n.textOpacity)Ao(r.firstChild,"color",Dy(n.color||"#fff",n.textOpacity));if(n.backgroundColor)r.firstChild.style.backgroundColor=n.backgroundColor;if(n.backgroundOpacity)Ao(r.firstChild,"backgroundColor",Dy(n.backgroundColor||"#000",n.backgroundOpacity));if(n.windowColor)if(n.windowOpacity)Ao(r,"backgroundColor",Dy(n.windowColor,n.windowOpacity));else r.style.backgroundColor=n.windowColor;if(n.edgeStyle){if(n.edgeStyle==="dropshadow")r.firstChild.style.textShadow=`2px 2px 3px ${kr}, 2px 2px 4px ${kr}, 2px 2px 5px ${kr}`;else if(n.edgeStyle==="raised")r.firstChild.style.textShadow=`1px 1px ${kr}, 2px 2px ${kr}, 3px 3px ${kr}`;else if(n.edgeStyle==="depressed")r.firstChild.style.textShadow=`1px 1px ${b8}, 0 1px ${b8}, -1px -1px ${kr}, 0 -1px ${kr}`;else if(n.edgeStyle==="uniform")r.firstChild.style.textShadow=`0 0 4px ${kr}, 0 0 4px ${kr}, 0 0 4px ${kr}, 0 0 4px ${kr}`}if(n.fontPercent&&n.fontPercent!==1){let l=qe.default.parseFloat(r.style.fontSize);r.style.fontSize=l*n.fontPercent+"px",r.style.height="auto",r.style.top="auto"}if(n.fontFamily&&n.fontFamily!=="default")if(n.fontFamily==="small-caps")r.firstChild.style.fontVariant="small-caps";else r.firstChild.style.fontFamily=uM[n.fontFamily]}}updateForTrack(e){if(!Array.isArray(e))e=[e];if(typeof qe.default.WebVTT!=="function"||e.every((i)=>!i.activeCues))return;let n=[];for(let i=0;i<e.length;++i){let s=e[i];for(let a=0;a<s.activeCues.length;++a)n.push(s.activeCues[a])}qe.default.WebVTT.processCues(qe.default,n,this.el_);for(let i=0;i<e.length;++i){let s=e[i];for(let a=0;a<s.activeCues.length;++a){let r=s.activeCues[a].displayState;if(lh(r,"vjs-text-track-cue","vjs-text-track-cue-"+(s.language?s.language:i)),s.language)nd(r,"lang",s.language)}if(this.player_.textTrackSettings)this.updateDisplayState(s)}}}ht.registerComponent("TextTrackDisplay",O7);class F7 extends ht{createEl(){let e=this.player_.isAudio(),n=this.localize(e?"Audio Player":"Video Player"),i=on("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[n])}),s=super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"});return s.appendChild(i),s}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}ht.registerComponent("LoadingSpinner",F7);class Ns extends Tp{createEl(e,n={},i={}){e="button",n=Object.assign({className:this.buildCSSClass()},n),i=Object.assign({type:"button"},i);let s=on(e,n,i);if(!this.player_.options_.experimentalSvgIcons)s.appendChild(on("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0}));return this.createControlTextEl(s),s}addChild(e,n={}){let i=this.constructor.name;return An.warn(`Adding an actionable (user controllable) child to a Button (${i}) is not supported; use a ClickableComponent instead.`),ht.prototype.addChild.call(this,e,n)}enable(){super.enable(),this.el_.removeAttribute("disabled")}disable(){super.disable(),this.el_.setAttribute("disabled","disabled")}handleKeyDown(e){if(e.key===" "||e.key==="Enter"){e.stopPropagation();return}super.handleKeyDown(e)}}ht.registerComponent("Button",Ns);class j5 extends Ns{constructor(e,n){super(e,n);this.mouseused_=!1,this.setIcon("play"),this.on("mousedown",(i)=>this.handleMouseDown(i))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){let n=this.player_.play(),i=this.player_.getChild("controlBar"),s=i&&i.getChild("playToggle");if(e.type==="tap"||this.mouseused_&&"clientX"in e&&"clientY"in e){if(jo(n),Pc)(s||this.player_).focus();else if(this.player_.tech(!0))this.player_.tech(!0).focus();return}if(!s){this.player_.tech(!0).focus();return}let a=()=>s.focus();if(gp(n))n.then(a,()=>{});else this.setTimeout(a,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}j5.prototype.controlText_="Play Video";ht.registerComponent("BigPlayButton",j5);class N7 extends Ns{constructor(e,n){super(e,n);this.setIcon("cancel"),this.controlText(n&&n.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){if(e.key==="Escape")e.preventDefault(),e.stopPropagation(),this.trigger("click");else super.handleKeyDown(e)}}ht.registerComponent("CloseButton",N7);class E5 extends Ns{constructor(e,n={}){super(e,n);if(n.replay=n.replay===void 0||n.replay,this.setIcon("play"),this.on(e,"play",(i)=>this.handlePlay(i)),this.on(e,"pause",(i)=>this.handlePause(i)),n.replay)this.on(e,"ended",(i)=>this.handleEnded(i))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){if(this.player_.paused())jo(this.player_.play());else this.player_.pause()}handleSeeked(e){if(this.removeClass("vjs-ended"),this.player_.paused())this.handlePause(e);else this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",(n)=>this.handleSeeked(n))}}E5.prototype.controlText_="Play";ht.registerComponent("PlayToggle",E5);class dh extends ht{constructor(e,n){super(e,n);this.on(e,["timeupdate","ended","seeking"],(i)=>this.update(i)),this.updateTextNode_()}createEl(){let e=this.buildCSSClass(),n=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),i=on("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return n.appendChild(i),this.contentEl_=on("span",{className:`${e}-display`},{role:"presentation"}),n.appendChild(this.contentEl_),n}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(e){if(!this.player_.options_.enableSmoothSeeking&&e.type==="seeking")return;this.updateContent(e)}updateTextNode_(e=0){if(e=hh(e),this.formattedTime_===e)return;this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let n=this.textNode_;if(n&&this.contentEl_.firstChild!==n)n=null,An.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.");if(this.textNode_=jt.default.createTextNode(this.formattedTime_),!this.textNode_)return;if(n)this.contentEl_.replaceChild(this.textNode_,n);else this.contentEl_.appendChild(this.textNode_)})}updateContent(e){}}dh.prototype.labelText_="Time";dh.prototype.controlText_="Time";ht.registerComponent("TimeDisplay",dh);class ib extends dh{buildCSSClass(){return"vjs-current-time"}updateContent(e){let n;if(this.player_.ended())n=this.player_.duration();else if(e&&e.target&&typeof e.target.pendingSeekTime==="function"&&e.target.pendingSeekTime()!==null)n=e.target.pendingSeekTime();else n=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();this.updateTextNode_(n)}}ib.prototype.labelText_="Current Time";ib.prototype.controlText_="Current Time";ht.registerComponent("CurrentTimeDisplay",ib);class sb extends dh{constructor(e,n){super(e,n);let i=(s)=>this.updateContent(s);this.on(e,"durationchange",i),this.on(e,"loadstart",i),this.on(e,"loadedmetadata",i)}buildCSSClass(){return"vjs-duration"}updateContent(e){let n=this.player_.duration();this.updateTextNode_(n)}}sb.prototype.labelText_="Duration";sb.prototype.controlText_="Duration";ht.registerComponent("DurationDisplay",sb);class P7 extends ht{createEl(){let e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),n=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return n.appendChild(i),e.appendChild(n),e}}ht.registerComponent("TimeDivider",P7);class ab extends dh{constructor(e,n){super(e,n);this.on(e,"durationchange",(i)=>this.updateContent(i))}buildCSSClass(){return"vjs-remaining-time"}createEl(){let e=super.createEl();if(this.options_.displayNegative!==!1)e.insertBefore(on("span",{},{"aria-hidden":!0},"-"),this.contentEl_);return e}updateContent(e){if(typeof this.player_.duration()!=="number")return;let n;if(this.player_.ended())n=0;else if(this.player_.remainingTimeDisplay)n=this.player_.remainingTimeDisplay();else n=this.player_.remainingTime();this.updateTextNode_(n)}}ab.prototype.labelText_="Remaining Time";ab.prototype.controlText_="Remaining Time";ht.registerComponent("RemainingTimeDisplay",ab);class B7 extends ht{constructor(e,n){super(e,n);this.updateShowing(),this.on(this.player(),"durationchange",(i)=>this.updateShowing(i))}createEl(){let e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=on("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(on("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(jt.default.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){if(this.player().duration()===1/0)this.show();else this.hide()}}ht.registerComponent("LiveDisplay",B7);class q5 extends Ns{constructor(e,n){super(e,n);if(this.updateLiveEdgeStatus(),this.player_.liveTracker)this.updateLiveEdgeStatusHandler_=(i)=>this.updateLiveEdgeStatus(i),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_)}createEl(){let e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=on("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){if(!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge())this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live");else this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live")}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){if(this.player_.liveTracker)this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_);this.textEl_=null,super.dispose()}}q5.prototype.controlText_="Seek to live, currently playing live";ht.registerComponent("SeekToLive",q5);function Ap(e,n,i){return e=Number(e),Math.min(i,Math.max(n,isNaN(e)?n:e))}var hM=Object.freeze({__proto__:null,clamp:Ap});class rb extends ht{constructor(e,n){super(e,n);this.handleMouseDown_=(i)=>this.handleMouseDown(i),this.handleMouseUp_=(i)=>this.handleMouseUp(i),this.handleKeyDown_=(i)=>this.handleKeyDown(i),this.handleClick_=(i)=>this.handleClick(i),this.handleMouseMove_=(i)=>this.handleMouseMove(i),this.update_=(i)=>this.update(i),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){if(this.enabled())return;if(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent)this.on(this.player_,this.playerEvent,this.update);this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0}disable(){if(!this.enabled())return;let e=this.bar.el_.ownerDocument;if(this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent)this.off(this.player_,this.playerEvent,this.update);this.enabled_=!1}createEl(e,n={},i={}){return n.className=n.className+" vjs-slider",n=Object.assign({tabIndex:0},n),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,n,i)}handleMouseDown(e){let n=this.bar.el_.ownerDocument;if(e.type==="mousedown")e.preventDefault();if(e.type==="touchstart"&&!Ro)e.preventDefault();u7(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(n,"mousemove",this.handleMouseMove_),this.on(n,"mouseup",this.handleMouseUp_),this.on(n,"touchmove",this.handleMouseMove_),this.on(n,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){let n=this.bar.el_.ownerDocument;h7(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(n,"mousemove",this.handleMouseMove_),this.off(n,"mouseup",this.handleMouseUp_),this.off(n,"touchmove",this.handleMouseMove_),this.off(n,"touchend",this.handleMouseUp_),this.update()}update(){if(!this.el_||!this.bar)return;let e=this.getProgress();if(e===this.progress_)return e;return this.progress_=e,this.requestNamedAnimationFrame("Slider#update",()=>{let n=this.vertical()?"height":"width";this.bar.el().style[n]=(e*100).toFixed(2)+"%"}),e}getProgress(){return Number(Ap(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){let n=$1(this.el_,e);if(this.vertical())return n.y;return n.x}handleKeyDown(e){let n=this.options_.playerOptions.spatialNavigation,i=n&&n.enabled,s=n&&n.horizontalSeek;if(i)if(s&&e.key==="ArrowLeft"||!s&&e.key==="ArrowDown")e.preventDefault(),e.stopPropagation(),this.stepBack();else if(s&&e.key==="ArrowRight"||!s&&e.key==="ArrowUp")e.preventDefault(),e.stopPropagation(),this.stepForward();else{if(this.pendingSeekTime())this.pendingSeekTime(null),this.userSeek_(this.player_.currentTime());super.handleKeyDown(e)}else if(e.key==="ArrowLeft"||e.key==="ArrowDown")e.preventDefault(),e.stopPropagation(),this.stepBack();else if(e.key==="ArrowUp"||e.key==="ArrowRight")e.preventDefault(),e.stopPropagation(),this.stepForward();else super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(e===void 0)return this.vertical_||!1;if(this.vertical_=!!e,this.vertical_)this.addClass("vjs-slider-vertical");else this.addClass("vjs-slider-horizontal")}}ht.registerComponent("Slider",rb);var Iy=(e,n)=>Ap(e/n*100,0,100).toFixed(2)+"%";class L7 extends ht{constructor(e,n){super(e,n);this.partEls_=[],this.on(e,"progress",(i)=>this.update(i))}createEl(){let e=super.createEl("div",{className:"vjs-load-progress"}),n=on("span",{className:"vjs-control-text"}),i=on("span",{textContent:this.localize("Loaded")}),s=jt.default.createTextNode(": ");return this.percentageEl_=on("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(n),n.appendChild(i),n.appendChild(s),n.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{let n=this.player_.liveTracker,i=this.player_.buffered(),s=n&&n.isLive()?n.seekableEnd():this.player_.duration(),a=this.player_.bufferedEnd(),r=this.partEls_,l=Iy(a,s);if(this.percent_!==l)this.el_.style.width=l,zc(this.percentageEl_,l),this.percent_=l;for(let c=0;c<i.length;c++){let p=i.start(c),m=i.end(c),g=r[c];if(!g)g=this.el_.appendChild(on()),r[c]=g;if(g.dataset.start===p&&g.dataset.end===m)continue;g.dataset.start=p,g.dataset.end=m,g.style.left=Iy(p,a),g.style.width=Iy(m-p,a)}for(let c=r.length;c>i.length;c--)this.el_.removeChild(r[c-1]);r.length=i.length})}}ht.registerComponent("LoadProgressBar",L7);class H7 extends ht{constructor(e,n){super(e,n);this.update=Oo(di(this,this.update),Cr)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,n,i){let s=Sp(this.el_),a=id(this.player_.el()),r=e.width*n;if(!a||!s)return;let l=e.left-a.left+r,c=e.width-r+(a.right-e.right);if(!c)c=e.width-r,l=r;let p=s.width/2;if(l<p)p+=p-l;else if(c<p)p=c;if(p<0)p=0;else if(p>s.width)p=s.width;p=Math.round(p),this.el_.style.right=`-${p}px`,this.write(i)}write(e){zc(this.el_,e)}updateTime(e,n,i,s){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let a,r=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){let l=this.player_.liveTracker.liveWindow(),c=l-n*l;a=(c<1?"":"-")+hh(c,l)}else a=hh(i,r);if(this.update(e,n,a),s)s()})}}ht.registerComponent("TimeTooltip",H7);class ob extends ht{constructor(e,n){super(e,n);this.setIcon("circle"),this.update=Oo(di(this,this.update),Cr)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,n,i){let s=this.getChild("timeTooltip");if(!s)return;let a=i&&i.target&&typeof i.target.pendingSeekTime==="function"?i.target.pendingSeekTime():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();s.updateTime(e,n,a)}}ob.prototype.options_={children:[]};if(!Js&&!Jr)ob.prototype.options_.children.push("timeTooltip");ht.registerComponent("PlayProgressBar",ob);class D5 extends ht{constructor(e,n){super(e,n);this.update=Oo(di(this,this.update),Cr)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,n){let i=n*this.player_.duration();this.getChild("timeTooltip").updateTime(e,n,i,()=>{this.el_.style.left=`${e.width*n}px`})}}D5.prototype.options_={children:["timeTooltip"]};ht.registerComponent("MouseTimeDisplay",D5);class lb extends rb{constructor(e,n){n=ci(lb.prototype.options_,n),n.children=[...n.children];let i=e.options_.disableSeekWhileScrubbingOnMobile&&(Js||Jr)||e.options_.disableSeekWhileScrubbingOnSTV;if(!Js&&!Jr||i)n.children.splice(1,0,"mouseTimeDisplay");super(e,n);this.shouldDisableSeekWhileScrubbing_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){if(this.update_=di(this,this.update),this.update=Oo(this.update_,Cr),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],this.update_),this.player_.liveTracker)this.on(this.player_.liveTracker,"liveedgechange",this.update);if(this.updateInterval=null,this.enableIntervalHandler_=(e)=>this.enableInterval_(e),this.disableIntervalHandler_=(e)=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in jt.default&&"visibilityState"in jt.default)this.on(jt.default,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){if(jt.default.visibilityState==="hidden")this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e);else{if(!this.player_.ended()&&!this.player_.paused())this.enableInterval_();this.update()}}enableInterval_(){if(this.updateInterval)return;this.updateInterval=this.setInterval(this.update,Cr)}disableInterval_(e){if(this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&e.type!=="ended")return;if(!this.updateInterval)return;this.clearInterval(this.updateInterval),this.updateInterval=null}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if(jt.default.visibilityState==="hidden")return;let n=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{let i=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),s=this.player_.liveTracker,a=this.player_.duration();if(s&&s.isLive())a=this.player_.liveTracker.liveCurrentTime();if(this.percent_!==n)this.el_.setAttribute("aria-valuenow",(n*100).toFixed(2)),this.percent_=n;if(this.currentTime_!==i||this.duration_!==a)this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[hh(i,a),hh(a,a)],"{1} of {2}")),this.currentTime_=i,this.duration_=a;if(this.bar)this.bar.update(id(this.el()),this.getProgress(),e)}),n}userSeek_(e){if(this.player_.liveTracker&&this.player_.liveTracker.isLive())this.player_.liveTracker.nextSeekedFromUser();this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}pendingSeekTime(e){if(e!==void 0)if(e!==null){let n=this.player_.duration();this.pendingSeekTime_=Math.max(0,Math.min(e,n))}else this.pendingSeekTime_=null;return this.pendingSeekTime_}getPercent(){if(this.pendingSeekTime()!==null)return this.pendingSeekTime()/this.player_.duration();let e=this.getCurrentTime_(),n,i=this.player_.liveTracker;if(i&&i.isLive()){if(n=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge())n=1}else n=e/this.player_.duration();return n}handleMouseDown(e){if(!_p(e))return;if(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),!this.shouldDisableSeekWhileScrubbing_)this.player_.pause();super.handleMouseDown(e)}handleMouseMove(e,n=!1){if(!_p(e)||isNaN(this.player_.duration()))return;if(!n&&!this.player_.scrubbing())this.player_.scrubbing(!0);let i,s=this.calculateDistance(e),a=this.player_.liveTracker;if(!a||!a.isLive()){if(i=s*this.player_.duration(),i===this.player_.duration())i=i-0.1}else{if(s>=0.99){a.seekToLiveEdge();return}let r=a.seekableStart(),l=a.liveCurrentTime();if(i=r+s*a.liveWindow(),i>=l)i=l;if(i<=r)i=r+0.1;if(i===1/0)return}if(this.shouldDisableSeekWhileScrubbing_)this.pendingSeekTime(i);else this.userSeek_(i);if(this.player_.options_.enableSmoothSeeking)this.update()}enable(){super.enable();let e=this.getChild("mouseTimeDisplay");if(!e)return;e.show()}disable(){super.disable();let e=this.getChild("mouseTimeDisplay");if(!e)return;e.hide()}handleMouseUp(e){if(super.handleMouseUp(e),e)e.stopPropagation();if(this.player_.scrubbing(!1),this.pendingSeekTime()!==null)this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null);if(this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying)jo(this.player_.play());else this.update_()}handlePendingSeek_(e){if(!this.player_.paused())this.player_.pause();let n=this.pendingSeekTime()!==null?this.pendingSeekTime():this.player_.currentTime();this.pendingSeekTime(n+e),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}stepForward(){if(this.shouldDisableSeekWhileScrubbing_)this.handlePendingSeek_(this.options().stepSeconds);else this.userSeek_(this.player_.currentTime()+this.options().stepSeconds)}stepBack(){if(this.shouldDisableSeekWhileScrubbing_)this.handlePendingSeek_(-this.options().stepSeconds);else this.userSeek_(this.player_.currentTime()-this.options().stepSeconds)}handleAction(e){if(this.pendingSeekTime()!==null)this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null);if(this.player_.paused())this.player_.play();else this.player_.pause()}handleKeyDown(e){let n=this.player_.liveTracker;if(e.key===" "||e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(e.key==="Home")e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(e.key==="End")if(e.preventDefault(),e.stopPropagation(),n&&n.isLive())this.userSeek_(n.liveCurrentTime());else this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(e.key)){e.preventDefault(),e.stopPropagation();let i=parseInt(e.key,10)*0.1;if(n&&n.isLive())this.userSeek_(n.seekableStart()+n.liveWindow()*i);else this.userSeek_(this.player_.duration()*i)}else if(e.key==="PageDown")e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-this.options().stepSeconds*this.options().pageMultiplier);else if(e.key==="PageUp")e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+this.options().stepSeconds*this.options().pageMultiplier);else super.handleKeyDown(e)}dispose(){if(this.disableInterval_(),this.off(this.player_,["durationchange","timeupdate"],this.update),this.off(this.player_,["ended"],this.update_),this.player_.liveTracker)this.off(this.player_.liveTracker,"liveedgechange",this.update);if(this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in jt.default&&"visibilityState"in jt.default)this.off(jt.default,"visibilitychange",this.toggleVisibility_);super.dispose()}}lb.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar",stepSeconds:5,pageMultiplier:12};ht.registerComponent("SeekBar",lb);class I5 extends ht{constructor(e,n){super(e,n);this.handleMouseMove=Oo(di(this,this.handleMouseMove),Cr),this.throttledHandleMouseSeek=Oo(di(this,this.handleMouseSeek),Cr),this.handleMouseUpHandler_=(i)=>this.handleMouseUp(i),this.handleMouseDownHandler_=(i)=>this.handleMouseDown(i),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){let n=this.getChild("seekBar");if(!n)return;let i=n.getChild("playProgressBar"),s=n.getChild("mouseTimeDisplay");if(!i&&!s)return;let a=n.el(),r=Sp(a),l=$1(a,e).x;if(l=Ap(l,0,1),s)s.update(r,l);if(i)i.update(r,n.getProgress())}handleMouseSeek(e){let n=this.getChild("seekBar");if(n)n.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach((e)=>e.disable&&e.disable()),!this.enabled())return;if(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing()){let e=this.getChild("seekBar");if(this.player_.scrubbing(!1),e.videoWasPlaying)jo(this.player_.play())}}enable(){if(this.children().forEach((e)=>e.enable&&e.enable()),this.enabled())return;this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0}removeListenersAddedOnMousedownAndTouchstart(){let e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){let n=this.el_.ownerDocument,i=this.getChild("seekBar");if(i)i.handleMouseDown(e);this.on(n,"mousemove",this.throttledHandleMouseSeek),this.on(n,"touchmove",this.throttledHandleMouseSeek),this.on(n,"mouseup",this.handleMouseUpHandler_),this.on(n,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){let n=this.getChild("seekBar");if(n)n.handleMouseUp(e);this.removeListenersAddedOnMousedownAndTouchstart()}}I5.prototype.options_={children:["seekBar"]};ht.registerComponent("ProgressControl",I5);class M5 extends Ns{constructor(e,n){super(e,n);this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],(i)=>this.handlePictureInPictureChange(i)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],(i)=>this.handlePictureInPictureEnabledChange(i)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!(this.player_.currentType().substring(0,5)==="audio"||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}if(this.player_.isInPictureInPicture())this.player_.exitPictureInPicture();this.hide()}handlePictureInPictureEnabledChange(){if(jt.default.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in qe.default)this.enable();else this.disable()}handlePictureInPictureChange(e){if(this.player_.isInPictureInPicture())this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture");else this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture");this.handlePictureInPictureEnabledChange()}handleClick(e){if(!this.player_.isInPictureInPicture())this.player_.requestPictureInPicture();else this.player_.exitPictureInPicture()}show(){if(typeof jt.default.exitPictureInPicture!=="function")return;super.show()}}M5.prototype.controlText_="Picture-in-Picture";ht.registerComponent("PictureInPictureToggle",M5);class R5 extends Ns{constructor(e,n){super(e,n);if(this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",(i)=>this.handleFullscreenChange(i)),jt.default[e.fsApi_.fullscreenEnabled]===!1)this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(e){if(this.player_.isFullscreen())this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit");else this.controlText("Fullscreen"),this.setIcon("fullscreen-enter")}handleClick(e){if(!this.player_.isFullscreen())this.player_.requestFullscreen();else this.player_.exitFullscreen()}}R5.prototype.controlText_="Fullscreen";ht.registerComponent("FullscreenToggle",R5);var fM=function(e,n){if(n.tech_&&!n.tech_.featuresVolumeControl)e.addClass("vjs-hidden");e.on(n,"loadstart",function(){if(!n.tech_.featuresVolumeControl)e.addClass("vjs-hidden");else e.removeClass("vjs-hidden")})};class U7 extends ht{createEl(){let e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}ht.registerComponent("VolumeLevel",U7);class z7 extends ht{constructor(e,n){super(e,n);this.update=Oo(di(this,this.update),Cr)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,n,i,s){if(!i){let a=id(this.el_),r=id(this.player_.el()),l=e.width*n;if(!r||!a)return;let c=e.left-r.left+l,p=e.width-l+(r.right-e.right),m=a.width/2;if(c<m)m+=m-c;else if(p<m)m=p;if(m<0)m=0;else if(m>a.width)m=a.width;this.el_.style.right=`-${m}px`}this.write(`${s}%`)}write(e){zc(this.el_,e)}updateVolume(e,n,i,s,a){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{if(this.update(e,n,i,s.toFixed(0)),a)a()})}}ht.registerComponent("VolumeLevelTooltip",z7);class O5 extends ht{constructor(e,n){super(e,n);this.update=Oo(di(this,this.update),Cr)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,n,i){let s=100*n;this.getChild("volumeLevelTooltip").updateVolume(e,n,i,s,()=>{if(i)this.el_.style.bottom=`${e.height*n}px`;else this.el_.style.left=`${e.width*n}px`})}}O5.prototype.options_={children:["volumeLevelTooltip"]};ht.registerComponent("MouseVolumeLevelDisplay",O5);class Cp extends rb{constructor(e,n){super(e,n);this.on("slideractive",(i)=>this.updateLastVolume_(i)),this.on(e,"volumechange",(i)=>this.updateARIAAttributes(i)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){if(!_p(e))return;super.handleMouseDown(e)}handleMouseMove(e){let n=this.getChild("mouseVolumeLevelDisplay");if(n){let i=this.el(),s=id(i),a=this.vertical(),r=$1(i,e);r=a?r.y:r.x,r=Ap(r,0,1),n.update(s,r,a)}if(!_p(e))return;this.checkMuted(),this.player_.volume(this.calculateDistance(e))}checkMuted(){if(this.player_.muted())this.player_.muted(!1)}getPercent(){if(this.player_.muted())return 0;return this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+0.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-0.1)}updateARIAAttributes(e){let n=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",n),this.el_.setAttribute("aria-valuetext",n+"%")}volumeAsPercentage_(){return Math.round(this.player_.volume()*100)}updateLastVolume_(){let e=this.player_.volume();this.one("sliderinactive",()=>{if(this.player_.volume()===0)this.player_.lastVolume_(e)})}}Cp.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};if(!Js&&!Jr)Cp.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");Cp.prototype.playerEvent="volumechange";ht.registerComponent("VolumeBar",Cp);class F5 extends ht{constructor(e,n={}){if(n.vertical=n.vertical||!1,typeof n.volumeBar>"u"||td(n.volumeBar))n.volumeBar=n.volumeBar||{},n.volumeBar.vertical=n.vertical;super(e,n);fM(this,e),this.throttledHandleMouseMove=Oo(di(this,this.handleMouseMove),Cr),this.handleMouseUpHandler_=(i)=>this.handleMouseUp(i),this.on("mousedown",(i)=>this.handleMouseDown(i)),this.on("touchstart",(i)=>this.handleMouseDown(i)),this.on("mousemove",(i)=>this.handleMouseMove(i)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";if(this.options_.vertical)e="vjs-volume-vertical";return super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){let n=this.el_.ownerDocument;this.on(n,"mousemove",this.throttledHandleMouseMove),this.on(n,"touchmove",this.throttledHandleMouseMove),this.on(n,"mouseup",this.handleMouseUpHandler_),this.on(n,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){let n=this.el_.ownerDocument;this.off(n,"mousemove",this.throttledHandleMouseMove),this.off(n,"touchmove",this.throttledHandleMouseMove),this.off(n,"mouseup",this.handleMouseUpHandler_),this.off(n,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}F5.prototype.options_={children:["volumeBar"]};ht.registerComponent("VolumeControl",F5);var dM=function(e,n){if(n.tech_&&!n.tech_.featuresMuteControl)e.addClass("vjs-hidden");e.on(n,"loadstart",function(){if(!n.tech_.featuresMuteControl)e.addClass("vjs-hidden");else e.removeClass("vjs-hidden")})};class N5 extends Ns{constructor(e,n){super(e,n);dM(this,e),this.on(e,["loadstart","volumechange"],(i)=>this.update(i))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){let n=this.player_.volume(),i=this.player_.lastVolume_();if(n===0){let s=i<0.1?0.1:i;this.player_.volume(s),this.player_.muted(!1)}else this.player_.muted(this.player_.muted()?!1:!0)}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){let e=this.player_.volume(),n=3;if(this.setIcon("volume-high"),Js&&this.player_.tech_&&this.player_.tech_.el_)this.player_.muted(this.player_.tech_.el_.muted);if(e===0||this.player_.muted())this.setIcon("volume-mute"),n=0;else if(e<0.33)this.setIcon("volume-low"),n=1;else if(e<0.67)this.setIcon("volume-medium"),n=2;W1(this.el_,[0,1,2,3].reduce((i,s)=>i+`${s?" ":""}vjs-vol-${s}`,"")),lh(this.el_,`vjs-vol-${n}`)}updateControlText_(){let n=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";if(this.controlText()!==n)this.controlText(n)}}N5.prototype.controlText_="Mute";ht.registerComponent("MuteToggle",N5);class P5 extends ht{constructor(e,n={}){if(typeof n.inline<"u")n.inline=n.inline;else n.inline=!0;if(typeof n.volumeControl>"u"||td(n.volumeControl))n.volumeControl=n.volumeControl||{},n.volumeControl.vertical=!n.inline;super(e,n);this.handleKeyPressHandler_=(i)=>this.handleKeyPress(i),this.on(e,["loadstart"],(i)=>this.volumePanelState_(i)),this.on(this.muteToggle,"keyup",(i)=>this.handleKeyPress(i)),this.on(this.volumeControl,"keyup",(i)=>this.handleVolumeControlKeyUp(i)),this.on("keydown",(i)=>this.handleKeyPress(i)),this.on("mouseover",(i)=>this.handleMouseOver(i)),this.on("mouseout",(i)=>this.handleMouseOut(i)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){if(this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden"))this.addClass("vjs-hidden");if(this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden"))this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";if(!this.options_.inline)e="vjs-volume-panel-vertical";return super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){if(e.key==="Escape")this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),ir(jt.default,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),ea(jt.default,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){if(e.key==="Escape")this.handleMouseOut()}}P5.prototype.options_={children:["muteToggle","volumeControl"]};ht.registerComponent("VolumePanel",P5);class B5 extends Ns{constructor(e,n){super(e,n);if(this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime))this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show();else this.hide()}getSkipForwardTime(){let e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){if(isNaN(this.player_.duration()))return;let n=this.player_.currentTime(),i=this.player_.liveTracker,s=i&&i.isLive()?i.seekableEnd():this.player_.duration(),a;if(n+this.skipTime<=s)a=n+this.skipTime;else a=s;this.player_.currentTime(a)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}B5.prototype.controlText_="Skip Forward";ht.registerComponent("SkipForward",B5);class L5 extends Ns{constructor(e,n){super(e,n);if(this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime))this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show();else this.hide()}getSkipBackwardTime(){let e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){let n=this.player_.currentTime(),i=this.player_.liveTracker,s=i&&i.isLive()&&i.seekableStart(),a;if(s&&n-this.skipTime<=s)a=s;else if(n>=this.skipTime)a=n-this.skipTime;else a=0;this.player_.currentTime(a)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}L5.prototype.controlText_="Skip Backward";ht.registerComponent("SkipBackward",L5);class H5 extends ht{constructor(e,n){super(e,n);if(n)this.menuButton_=n.menuButton;this.focusedChild_=-1,this.on("keydown",(i)=>this.handleKeyDown(i)),this.boundHandleBlur_=(i)=>this.handleBlur(i),this.boundHandleTapClick_=(i)=>this.handleTapClick(i)}addEventListenerForItem(e){if(!(e instanceof ht))return;this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_)}removeEventListenerForItem(e){if(!(e instanceof ht))return;this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_)}removeChild(e){if(typeof e==="string")e=this.getChild(e);this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){let n=this.addChild(e);if(n)this.addEventListenerForItem(n)}createEl(){let e=this.options_.contentElType||"ul";this.contentEl_=on(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");let n=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return n.appendChild(this.contentEl_),ir(n,"click",function(i){i.preventDefault(),i.stopImmediatePropagation()}),n}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){let n=e.relatedTarget||jt.default.activeElement;if(!this.children().some((i)=>i.el()===n)){let i=this.menuButton_;if(i&&i.buttonPressed_&&n!==i.el().firstChild)i.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();let n=this.children();if(!Array.isArray(n))return;let i=n.filter((s)=>s.el()===e.target)[0];if(!i)return;if(i.name()!=="CaptionSettingsMenuItem")this.menuButton_.focus()}}handleKeyDown(e){if(e.key==="ArrowLeft"||e.key==="ArrowDown")e.preventDefault(),e.stopPropagation(),this.stepForward();else if(e.key==="ArrowRight"||e.key==="ArrowUp")e.preventDefault(),e.stopPropagation(),this.stepBack()}stepForward(){let e=0;if(this.focusedChild_!==void 0)e=this.focusedChild_+1;this.focus(e)}stepBack(){let e=0;if(this.focusedChild_!==void 0)e=this.focusedChild_-1;this.focus(e)}focus(e=0){let n=this.children().slice();if(n.length&&n[0].hasClass("vjs-menu-title"))n.shift();if(n.length>0){if(e<0)e=0;else if(e>=n.length)e=n.length-1;this.focusedChild_=e,n[e].el_.focus()}}}ht.registerComponent("Menu",H5);class cb extends ht{constructor(e,n={}){super(e,n);this.menuButton_=new Ns(e,n),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");let i=Ns.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+i,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;let s=(a)=>this.handleClick(a);this.handleMenuKeyUp_=(a)=>this.handleMenuKeyUp(a),this.on(this.menuButton_,"tap",s),this.on(this.menuButton_,"click",s),this.on(this.menuButton_,"keydown",(a)=>this.handleKeyDown(a)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),ir(jt.default,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",(a)=>this.handleMouseLeave(a)),this.on("keydown",(a)=>this.handleSubmenuKeyDown(a))}update(){let e=this.createMenu();if(this.menu)this.menu.dispose(),this.removeChild(this.menu);if(this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_)this.hide(),this.menu.contentEl_.removeAttribute("role");else this.show(),this.menu.contentEl_.setAttribute("role","menu")}createMenu(){let e=new H5(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){let n=on("li",{className:"vjs-menu-title",textContent:Hi(this.options_.title),tabIndex:-1}),i=new ht(this.player_,{el:n});e.addItem(i)}if(this.items=this.createItems(),this.items)for(let n=0;n<this.items.length;n++)e.addItem(this.items[n]);return e}createItems(){}createEl(){return super.createEl("div",{className:this.buildWrapperCSSClass()},{})}setIcon(e){return super.setIcon(e,this.menuButton_.el_)}buildWrapperCSSClass(){let e="vjs-menu-button";if(this.options_.inline===!0)e+="-inline";else e+="-popup";let n=Ns.prototype.buildCSSClass();return`vjs-menu-button ${e} ${n} ${super.buildCSSClass()}`}buildCSSClass(){let e="vjs-menu-button";if(this.options_.inline===!0)e+="-inline";else e+="-popup";return`vjs-menu-button ${e} ${super.buildCSSClass()}`}controlText(e,n=this.menuButton_.el()){return this.menuButton_.controlText(e,n)}dispose(){this.handleMouseLeave(),super.dispose()}handleClick(e){if(this.buttonPressed_)this.unpressButton();else this.pressButton()}handleMouseLeave(e){this.removeClass("vjs-hover"),ea(jt.default,"keyup",this.handleMenuKeyUp_)}focus(){this.menuButton_.focus()}blur(){this.menuButton_.blur()}handleKeyDown(e){if(e.key==="Escape"||e.key==="Tab"){if(this.buttonPressed_)this.unpressButton();if(!e.key==="Tab")e.preventDefault(),this.menuButton_.focus()}else if(e.key==="Up"||e.key==="Down"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)){if(!this.buttonPressed_)e.preventDefault(),this.pressButton()}}handleMenuKeyUp(e){if(e.key==="Escape"||e.key==="Tab")this.removeClass("vjs-hover")}handleSubmenuKeyPress(e){this.handleSubmenuKeyDown(e)}handleSubmenuKeyDown(e){if(e.key==="Escape"||e.key==="Tab"){if(this.buttonPressed_)this.unpressButton();if(!e.key==="Tab")e.preventDefault(),this.menuButton_.focus()}}pressButton(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),Js&&a7())return;this.menu.focus()}}unpressButton(){if(this.enabled_)this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false")}disable(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()}enable(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()}}ht.registerComponent("MenuButton",cb);class ub extends cb{constructor(e,n){let i=n.tracks;super(e,n);if(this.items.length<=1)this.hide();if(!i)return;this.updateHandler_=di(this,this.update),this.cleanupHandler_=di(this,this.cleanupTrackListeners_),i.addEventListener("removetrack",this.updateHandler_),i.addEventListener("addtrack",this.updateHandler_),i.addEventListener("labelchange",this.updateHandler_),this.player_.on("ready",this.updateHandler_),this.player_.on("dispose",this.cleanupHandler_)}cleanupTrackListeners_(){if(!this.updateHandler_)return;let e=this.options_.tracks;if(e)e.removeEventListener("removetrack",this.updateHandler_),e.removeEventListener("addtrack",this.updateHandler_),e.removeEventListener("labelchange",this.updateHandler_);if(this.player_)this.player_.off("ready",this.updateHandler_),this.player_.off("dispose",this.cleanupHandler_);this.updateHandler_=null,this.cleanupHandler_=null}dispose(){this.cleanupTrackListeners_(),super.dispose()}}ht.registerComponent("TrackButton",ub);class hd extends Tp{constructor(e,n){super(e,n);if(this.selectable=n.selectable,this.isSelected_=n.selected||!1,this.multiSelectable=n.multiSelectable,this.selected(this.isSelected_),this.selectable)if(this.multiSelectable)this.el_.setAttribute("role","menuitemcheckbox");else this.el_.setAttribute("role","menuitemradio");else this.el_.setAttribute("role","menuitem")}createEl(e,n,i){this.nonIconControl=!0;let s=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},n),i),a=on("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)});if(this.player_.options_.experimentalSvgIcons)s.appendChild(a);else s.replaceChild(a,s.querySelector(".vjs-icon-placeholder"));return s}handleKeyDown(e){if(!["Tab","Escape","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"].includes(e.key))super.handleKeyDown(e)}handleClick(e){this.selected(!0)}selected(e){if(this.selectable)if(e)this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0;else this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1}}ht.registerComponent("MenuItem",hd);class fd extends hd{constructor(e,n){let i=n.track,s=e.textTracks();n.label=i.label||i.language||"Unknown",n.selected=i.mode==="showing";super(e,n);this.track=i,this.kinds=(n.kinds||[n.kind||this.track.kind]).filter(Boolean);let a=(...l)=>{this.handleTracksChange.apply(this,l)},r=(...l)=>{this.handleSelectedLanguageChange.apply(this,l)};if(e.on(["loadstart","texttrackchange"],a),s.addEventListener("change",a),s.addEventListener("selectedlanguagechange",r),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],a),s.removeEventListener("change",a),s.removeEventListener("selectedlanguagechange",r)}),s.onchange===void 0){let l;this.on(["tap","click"],function(){if(typeof qe.default.Event!=="object")try{l=new qe.default.Event("change")}catch(c){}if(!l)l=jt.default.createEvent("Event"),l.initEvent("change",!0,!0);s.dispatchEvent(l)})}this.handleTracksChange()}handleClick(e){let n=this.track,i=this.player_.textTracks();if(super.handleClick(e),!i)return;for(let s=0;s<i.length;s++){let a=i[s];if(this.kinds.indexOf(a.kind)===-1)continue;if(a===n){if(a.mode!=="showing")a.mode="showing"}else if(a.mode!=="disabled")a.mode="disabled"}}handleTracksChange(e){let n=this.track.mode==="showing";if(n!==this.isSelected_)this.selected(n)}handleSelectedLanguageChange(e){if(this.track.mode==="showing"){let n=this.player_.cache_.selectedLanguage;if(n&&n.enabled&&n.language===this.track.language&&n.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}}dispose(){this.track=null,super.dispose()}}ht.registerComponent("TextTrackMenuItem",fd);class U5 extends fd{constructor(e,n){if(n.track={player:e,kind:n.kind,kinds:n.kinds,default:!1,mode:"disabled"},!n.kinds)n.kinds=[n.kind];if(n.label)n.track.label=n.label;else n.track.label=n.kinds.join(" and ")+" off";n.selectable=!0,n.multiSelectable=!1;super(e,n)}handleTracksChange(e){let n=this.player().textTracks(),i=!0;for(let s=0,a=n.length;s<a;s++){let r=n[s];if(this.options_.kinds.indexOf(r.kind)>-1&&r.mode==="showing"){i=!1;break}}if(i!==this.isSelected_)this.selected(i)}handleSelectedLanguageChange(e){let n=this.player().textTracks(),i=!0;for(let s=0,a=n.length;s<a;s++){let r=n[s];if(["captions","descriptions","subtitles"].indexOf(r.kind)>-1&&r.mode==="showing"){i=!1;break}}if(i)this.player_.cache_.selectedLanguage={enabled:!1}}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}ht.registerComponent("OffTextTrackMenuItem",U5);class ph extends ub{constructor(e,n={}){n.tracks=e.textTracks();super(e,n)}createItems(e=[],n=fd){let i;if(this.label_)i=`${this.label_} off`;e.push(new U5(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;let s=this.player_.textTracks();if(!Array.isArray(this.kinds_))this.kinds_=[this.kind_];for(let a=0;a<s.length;a++){let r=s[a];if(this.kinds_.indexOf(r.kind)>-1){let l=new n(this.player_,{track:r,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});l.addClass(`vjs-${r.kind}-menu-item`),e.push(l)}}return e}}ht.registerComponent("TextTrackButton",ph);class z5 extends hd{constructor(e,n){let{track:i,cue:s}=n,a=e.currentTime();n.selectable=!0,n.multiSelectable=!1,n.label=s.text,n.selected=s.startTime<=a&&a<s.endTime;super(e,n);this.track=i,this.cue=s}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}ht.registerComponent("ChaptersTrackMenuItem",z5);class hb extends ph{constructor(e,n,i){super(e,n,i);this.setIcon("chapters"),this.selectCurrentItem_=()=>{this.items.forEach((s)=>{s.selected(this.track_.activeCues[0]===s.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&e.track.kind!=="chapters")return;let n=this.findChaptersTrack();if(n!==this.track_)this.setTrack(n),super.update();else if(!this.items||n&&n.cues&&n.cues.length!==this.items.length)super.update()}setTrack(e){if(this.track_===e)return;if(!this.updateHandler_)this.updateHandler_=this.update.bind(this);if(this.track_){let n=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);if(n)n.removeEventListener("load",this.updateHandler_);this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";let n=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);if(n)n.addEventListener("load",this.updateHandler_);this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}findChaptersTrack(){let e=this.player_.textTracks()||[];for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.kind===this.kind_)return i}}getMenuCaption(){if(this.track_&&this.track_.label)return this.track_.label;return this.localize(Hi(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){let e=[];if(!this.track_)return e;let n=this.track_.cues;if(!n)return e;for(let i=0,s=n.length;i<s;i++){let a=n[i],r=new z5(this.player_,{track:this.track_,cue:a});e.push(r)}return e}}hb.prototype.kind_="chapters";hb.prototype.controlText_="Chapters";ht.registerComponent("ChaptersButton",hb);class fb extends ph{constructor(e,n,i){super(e,n,i);this.setIcon("audio-description");let s=e.textTracks(),a=di(this,this.handleTracksChange);s.addEventListener("change",a),this.on("dispose",function(){s.removeEventListener("change",a)})}handleTracksChange(e){let n=this.player().textTracks(),i=!1;for(let s=0,a=n.length;s<a;s++){let r=n[s];if(r.kind!==this.kind_&&r.mode==="showing"){i=!0;break}}if(i)this.disable();else this.enable()}buildCSSClass(){return`vjs-descriptions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-descriptions-button ${super.buildWrapperCSSClass()}`}}fb.prototype.kind_="descriptions";fb.prototype.controlText_="Descriptions";ht.registerComponent("DescriptionsButton",fb);class db extends ph{constructor(e,n,i){super(e,n,i);this.setIcon("subtitles")}buildCSSClass(){return`vjs-subtitles-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subtitles-button ${super.buildWrapperCSSClass()}`}}db.prototype.kind_="subtitles";db.prototype.controlText_="Subtitles";ht.registerComponent("SubtitlesButton",db);class pb extends fd{constructor(e,n){n.track={player:e,kind:n.kind,label:n.kind+" settings",selectable:!1,default:!1,mode:"disabled"},n.selectable=!1,n.name="CaptionSettingsMenuItem";super(e,n);this.addClass("vjs-texttrack-settings"),this.controlText(", opens "+n.kind+" settings dialog")}handleClick(e){this.player().getChild("textTrackSettings").open()}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.kind+" settings"),super.handleLanguagechange()}}ht.registerComponent("CaptionSettingsMenuItem",pb);class mb extends ph{constructor(e,n,i){super(e,n,i);this.setIcon("captions")}buildCSSClass(){return`vjs-captions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-captions-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];if(!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings"))e.push(new pb(this.player_,{kind:this.kind_})),this.hideThreshold_+=1;return super.createItems(e)}}mb.prototype.kind_="captions";mb.prototype.controlText_="Captions";ht.registerComponent("CaptionsButton",mb);class G5 extends fd{createEl(e,n,i){let s=super.createEl(e,n,i),a=s.querySelector(".vjs-menu-item-text");if(this.options_.track.kind==="captions"){if(this.player_.options_.experimentalSvgIcons)this.setIcon("captions",s);else a.appendChild(on("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0}));a.appendChild(on("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))}return s}}ht.registerComponent("SubsCapsMenuItem",G5);class gb extends ph{constructor(e,n={}){super(e,n);if(this.label_="subtitles",this.setIcon("subtitles"),["en","en-us","en-ca","fr-ca"].indexOf(this.player_.language_)>-1)this.label_="captions",this.setIcon("captions");this.menuButton_.controlText(Hi(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];if(!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings"))e.push(new pb(this.player_,{kind:this.label_})),this.hideThreshold_+=1;return e=super.createItems(e,G5),e}}gb.prototype.kinds_=["captions","subtitles"];gb.prototype.controlText_="Subtitles";ht.registerComponent("SubsCapsButton",gb);class V5 extends hd{constructor(e,n){let i=n.track,s=e.audioTracks();n.label=i.label||i.language||"Unknown",n.selected=i.enabled;super(e,n);this.track=i,this.addClass(`vjs-${i.kind}-menu-item`);let a=(...r)=>{this.handleTracksChange.apply(this,r)};s.addEventListener("change",a),this.on("dispose",()=>{s.removeEventListener("change",a)})}createEl(e,n,i){let s=super.createEl(e,n,i),a=s.querySelector(".vjs-menu-item-text");if(["main-desc","descriptions","description"].indexOf(this.options_.track.kind)>=0)a.appendChild(on("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),a.appendChild(on("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}));return s}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){let n=this.player_.audioTracks();for(let i=0;i<n.length;i++){let s=n[i];if(s===this.track)continue;s.enabled=s===this.track}}}handleTracksChange(e){this.selected(this.track.enabled)}}ht.registerComponent("AudioTrackMenuItem",V5);class X5 extends ub{constructor(e,n={}){n.tracks=e.audioTracks();super(e,n);this.setIcon("audio")}buildCSSClass(){return`vjs-audio-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-audio-button ${super.buildWrapperCSSClass()}`}createItems(e=[]){this.hideThreshold_=1;let n=this.player_.audioTracks();for(let i=0;i<n.length;i++){let s=n[i];e.push(new V5(this.player_,{track:s,selectable:!0,multiSelectable:!1}))}return e}}X5.prototype.controlText_="Audio Track";ht.registerComponent("AudioTrackButton",X5);class bb extends hd{constructor(e,n){let i=n.rate,s=parseFloat(i,10);n.label=i,n.selected=s===e.playbackRate(),n.selectable=!0,n.multiSelectable=!1;super(e,n);this.label=i,this.rate=s,this.on(e,"ratechange",(a)=>this.update(a))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}bb.prototype.contentElType="button";ht.registerComponent("PlaybackRateMenuItem",bb);class W5 extends cb{constructor(e,n){super(e,n);this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",(i)=>this.updateVisibility(i)),this.on(e,"ratechange",(i)=>this.updateLabel(i)),this.on(e,"playbackrateschange",(i)=>this.handlePlaybackRateschange(i))}createEl(){let e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=on("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){let e=this.playbackRates(),n=[];for(let i=e.length-1;i>=0;i--)n.push(new bb(this.player(),{rate:e[i]+"x"}));return n}handlePlaybackRateschange(e){this.update()}playbackRates(){let e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){if(this.playbackRateSupported())this.removeClass("vjs-hidden");else this.addClass("vjs-hidden")}updateLabel(e){if(this.playbackRateSupported())this.labelEl_.textContent=this.player().playbackRate()+"x"}}W5.prototype.controlText_="Playback Rate";ht.registerComponent("PlaybackRateMenuButton",W5);class K5 extends ht{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",n={},i={}){if(!n.className)n.className=this.buildCSSClass();return super.createEl(e,n,i)}}ht.registerComponent("Spacer",K5);class G7 extends K5{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}ht.registerComponent("CustomControlSpacer",G7);class $5 extends ht{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}$5.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};ht.registerComponent("ControlBar",$5);class Y5 extends fh{constructor(e,n){super(e,n);this.on(e,"error",(i)=>{this.open(i)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){let e=this.player().error();return e?this.localize(e.message):""}}Y5.prototype.options_=Object.assign({},fh.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});ht.registerComponent("ErrorDisplay",Y5);class Q5 extends ht{constructor(e,n={}){super(e,n);this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),on("select",{id:this.options_.id},{},this.options_.SelectOptions.map((n)=>{let i=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${Ar()}`)+"-"+n[1].replace(/\W+/g,""),s=on("option",{id:i,value:this.localize(n[0]),textContent:this.localize(n[1])});return s.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${i}`),s}))}}ht.registerComponent("TextTrackSelect",Q5);class Bc extends ht{constructor(e,n={}){super(e,n);let i=on("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(i);let s=this.options_.selects;for(let a of s){let r=this.options_.selectConfigs[a],l=r.className,c=r.id.replace("%s",this.options_.id_),p=null,m=`vjs_select_${Ar()}`;if(this.options_.type==="colors"){p=on("span",{className:l});let y=on("label",{id:c,className:"vjs-label",textContent:this.localize(r.label)});y.setAttribute("for",m),p.appendChild(y)}let g=new Q5(e,{SelectOptions:r.options,legendId:this.options_.legendId,id:m,labelId:c});if(this.addChild(g),this.options_.type==="colors")p.appendChild(g.el()),this.el().appendChild(p)}}createEl(){return on("fieldset",{className:this.options_.className})}}ht.registerComponent("TextTrackFieldset",Bc);class J5 extends ht{constructor(e,n={}){super(e,n);let i=this.options_.textTrackComponentid,s=new Bc(e,{id_:i,legendId:`captions-text-legend-${i}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(s);let a=new Bc(e,{id_:i,legendId:`captions-background-${i}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(a);let r=new Bc(e,{id_:i,legendId:`captions-window-${i}`,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(r)}createEl(){return on("div",{className:"vjs-track-settings-colors"})}}ht.registerComponent("TextTrackSettingsColors",J5);class Z5 extends ht{constructor(e,n={}){super(e,n);let i=this.options_.textTrackComponentid,s=new Bc(e,{id_:i,legendId:`captions-font-size-${i}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(s);let a=new Bc(e,{id_:i,legendId:`captions-edge-style-${i}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(a);let r=new Bc(e,{id_:i,legendId:`captions-font-family-${i}`,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(r)}createEl(){return on("div",{className:"vjs-track-settings-font"})}}ht.registerComponent("TextTrackSettingsFont",Z5);class e3 extends ht{constructor(e,n={}){super(e,n);let i=new Ns(e,{controlText:this.localize("restore all settings to the default values"),className:"vjs-default-button"});i.el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Reset"),this.addChild(i);let s=this.localize("Done"),a=new Ns(e,{controlText:s,className:"vjs-done-button"});a.el().classList.remove("vjs-control","vjs-button"),a.el().textContent=s,this.addChild(a)}createEl(){return on("div",{className:"vjs-track-settings-controls"})}}ht.registerComponent("TrackSettingsControls",e3);var My="vjs-text-track-settings",y8=["#000","Black"],v8=["#00F","Blue"],S8=["#0FF","Cyan"],_8=["#0F0","Green"],x8=["#F0F","Magenta"],k8=["#F00","Red"],T8=["#FFF","White"],A8=["#FF0","Yellow"],Ry=["1","Opaque"],Oy=["0.5","Semi-Transparent"],C8=["0","Transparent"],Fc={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[y8,T8,k8,_8,v8,A8,x8,S8],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[Ry,Oy,C8],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[T8,y8,k8,_8,v8,A8,x8,S8],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:(e)=>e==="1.00"?null:Number(e)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[Ry,Oy],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[C8,Oy,Ry],className:"vjs-window-opacity vjs-opacity"}};Fc.windowColor.options=Fc.backgroundColor.options;function V7(e,n){if(n)e=n(e);if(e&&e!=="none")return e}function pM(e,n){let i=e.options[e.options.selectedIndex].value;return V7(i,n)}function mM(e,n,i){if(!n)return;for(let s=0;s<e.options.length;s++)if(V7(e.options[s].value,i)===n){e.selectedIndex=s;break}}class X7 extends fh{constructor(e,n){n.temporary=!1;super(e,n);if(this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.renderModalComponents(e),this.endDialog=on("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),n.persistTextTrackSettings===void 0)this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings;if(this.bindFunctionsToSelectsAndButtons(),this.options_.persistTextTrackSettings)this.restoreSettings()}renderModalComponents(e){let n=new J5(e,{textTrackComponentid:this.id_,selectConfigs:Fc,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(n);let i=new Z5(e,{textTrackComponentid:this.id_,selectConfigs:Fc,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(i);let s=new e3(e);this.addChild(s)}bindFunctionsToSelectsAndButtons(){this.on(this.$(".vjs-done-button"),["click","tap"],()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],()=>{this.setDefaults(),this.updateDisplay()}),Wf(Fc,(e)=>{this.on(this.$(e.selector),"change",this.updateDisplay)})}dispose(){this.endDialog=null,super.dispose()}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return J8(Fc,(e,n,i)=>{let s=pM(this.$(n.selector),n.parser);if(s!==void 0)e[i]=s;return e},{})}setValues(e){Wf(Fc,(n,i)=>{mM(this.$(n.selector),e[i],n.parser)})}setDefaults(){Wf(Fc,(e)=>{let n=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=n})}restoreSettings(){let e;try{e=JSON.parse(qe.default.localStorage.getItem(My))}catch(n){An.warn(n)}if(e)this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;let e=this.getValues();try{if(Object.keys(e).length)qe.default.localStorage.setItem(My,JSON.stringify(e));else qe.default.localStorage.removeItem(My)}catch(n){An.warn(n)}}updateDisplay(){let e=this.player_.getChild("textTrackDisplay");if(e)e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}ht.registerComponent("TextTrackSettings",X7);class W7 extends ht{constructor(e,n){let i=n.ResizeObserver||qe.default.ResizeObserver;if(n.ResizeObserver===null)i=!1;let s=ci({createEl:!i,reportTouchActivity:!1},n);super(e,s);if(this.ResizeObserver=n.ResizeObserver||qe.default.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=S7(()=>{this.resizeHandler()},100,!1,this),i)this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el());else this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;let a=this.debouncedHandler_,r=this.unloadListener_=function(){ea(this,"resize",a),ea(this,"unload",r),r=null};ir(this.el_.contentWindow,"unload",r),ir(this.el_.contentWindow,"resize",a)},this.one("load",this.loadListener_)}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){if(!this.player_||!this.player_.trigger)return;this.player_.trigger("playerresize")}dispose(){if(this.debouncedHandler_)this.debouncedHandler_.cancel();if(this.resizeObserver_){if(this.player_.el())this.resizeObserver_.unobserve(this.player_.el());this.resizeObserver_.disconnect()}if(this.loadListener_)this.off("load",this.loadListener_);if(this.el_&&this.el_.contentWindow&&this.unloadListener_)this.unloadListener_.call(this.el_.contentWindow);this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}ht.registerComponent("ResizeManager",W7);var gM={trackingThreshold:20,liveTolerance:15};class K7 extends ht{constructor(e,n){let i=ci(gM,n,{createEl:!1});super(e,i);this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=(s)=>this.handlePlay(s),this.handleFirstTimeupdate_=(s)=>this.handleFirstTimeupdate(s),this.handleSeeked_=(s)=>this.handleSeeked(s),this.seekToLiveEdge_=(s)=>this.seekToLiveEdge(s),this.reset_(),this.on(this.player_,"durationchange",(s)=>this.handleDurationchange(s)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){let e=this.player_.seekable();if(!e||!e.length)return;let n=Number(qe.default.performance.now().toFixed(4)),i=this.lastTime_===-1?0:(n-this.lastTime_)/1000;this.lastTime_=n,this.pastSeekEnd_=this.pastSeekEnd()+i;let s=this.liveCurrentTime(),a=this.player_.currentTime(),r=this.player_.paused()||this.seekedBehindLive_||Math.abs(s-a)>this.options_.liveTolerance;if(!this.timeupdateSeen_||s===1/0)r=!1;if(r!==this.behindLiveEdge_)this.behindLiveEdge_=r,this.trigger("liveedgechange")}handleDurationchange(){this.toggleTracking()}toggleTracking(){if(this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold){if(this.player_.options_.liveui)this.player_.addClass("vjs-liveui");this.startTracking()}else this.player_.removeClass("vjs-liveui"),this.stopTracking()}startTracking(){if(this.isTracking())return;if(!this.timeupdateSeen_)this.timeupdateSeen_=this.player_.hasStarted();if(this.trackingInterval_=this.setInterval(this.trackLiveHandler_,Cr),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),!this.timeupdateSeen_)this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_);else this.on(this.player_,"seeked",this.handleSeeked_)}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){let e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){if(!this.isTracking())return;this.reset_(),this.trigger("liveedgechange")}seekableEnd(){let e=this.player_.seekable(),n=[],i=e?e.length:0;while(i--)n.push(e.end(i));return n.length?n.sort()[n.length-1]:1/0}seekableStart(){let e=this.player_.seekable(),n=[],i=e?e.length:0;while(i--)n.push(e.start(i));return n.length?n.sort()[0]:0}liveWindow(){let e=this.liveCurrentTime();if(e===1/0)return 0;return e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){let e=this.seekableEnd();if(this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_)this.pastSeekEnd_=0;return this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return typeof this.trackingInterval_==="number"}seekToLiveEdge(){if(this.seekedBehindLive_=!1,this.atLiveEdge())return;this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime())}dispose(){this.stopTracking(),super.dispose()}}ht.registerComponent("LiveTracker",K7);class $7 extends ht{constructor(e,n){super(e,n);this.on("statechanged",(i)=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:on("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Ar()}`}),description:on("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Ar()}`})},on("div",{className:"vjs-title-bar"},{},Z8(this.els))}updateDom_(){let e=this.player_.tech_,n=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};if(["title","description"].forEach((s)=>{let a=this.state[s],r=this.els[s],l=i[s];if(Y1(r),a)zc(r,a);if(n){if(n.removeAttribute(l),a)n.setAttribute(l,r.id)}}),this.state.title||this.state.description)this.show();else this.hide()}update(e){this.setState(e)}dispose(){let e=this.player_.tech_,n=e&&e.el_;if(n)n.removeAttribute("aria-labelledby"),n.removeAttribute("aria-describedby");super.dispose(),this.els=null}}ht.registerComponent("TitleBar",$7);var bM={initialDisplay:4000,position:[],takeFocus:!1};class Y7 extends Ns{constructor(e,n){n=ci(bM,n);super(e,n);this.controlText(n.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],(i)=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map((e)=>`vjs-${e}`).join(" ")}`}createEl(){let e=on("button",{},{type:"button",class:this.buildCSSClass()},on("span"));return this.controlTextEl_=e.querySelector("span"),e}show(){if(super.show(),this.addClass("force-display"),this.options_.takeFocus)this.el().focus({preventScroll:!0});this.forceDisplayTimeout=this.player_.setTimeout(()=>{this.removeClass("force-display")},this.options_.initialDisplay)}hide(){this.removeClass("force-display"),super.hide()}dispose(){this.player_.clearTimeout(this.forceDisplayTimeout),super.dispose()}}ht.registerComponent("TransientButton",Y7);var Qy=(e)=>{let n=e.el();if(n.hasAttribute("src"))return e.triggerSourceset(n.src),!0;let i=e.$$("source"),s=[],a="";if(!i.length)return!1;for(let r=0;r<i.length;r++){let l=i[r].src;if(l&&s.indexOf(l)===-1)s.push(l)}if(!s.length)return!1;if(s.length===1)a=s[0];return e.triggerSourceset(a),!0},wM=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(e){let n=jt.default.createElement(this.nodeName.toLowerCase());n.innerHTML=e;let i=jt.default.createDocumentFragment();while(n.childNodes.length)i.appendChild(n.childNodes[0]);return this.innerText="",qe.default.Element.prototype.appendChild.call(this,i),this.innerHTML}}),Q7=(e,n)=>{let i={};for(let s=0;s<e.length;s++)if(i=Object.getOwnPropertyDescriptor(e[s],n),i&&i.set&&i.get)break;return i.enumerable=!0,i.configurable=!0,i},yM=(e)=>Q7([e.el(),qe.default.HTMLMediaElement.prototype,qe.default.Element.prototype,wM],"innerHTML"),j8=function(e){let n=e.el();if(n.resetSourceWatch_)return;let i={},s=yM(e),a=(r)=>(...l)=>{let c=r.apply(n,l);return Qy(e),c};["append","appendChild","insertAdjacentHTML"].forEach((r)=>{if(!n[r])return;i[r]=n[r],n[r]=a(i[r])}),Object.defineProperty(n,"innerHTML",ci(s,{set:a(s.set)})),n.resetSourceWatch_=()=>{n.resetSourceWatch_=null,Object.keys(i).forEach((r)=>{n[r]=i[r]}),Object.defineProperty(n,"innerHTML",s)},e.one("sourceset",n.resetSourceWatch_)},vM=Object.defineProperty({},"src",{get(){if(this.hasAttribute("src"))return D7(qe.default.Element.prototype.getAttribute.call(this,"src"));return""},set(e){return qe.default.Element.prototype.setAttribute.call(this,"src",e),e}}),SM=(e)=>Q7([e.el(),qe.default.HTMLMediaElement.prototype,vM],"src"),_M=function(e){if(!e.featuresSourceset)return;let n=e.el();if(n.resetSourceset_)return;let i=SM(e),{setAttribute:s,load:a}=n;if(Object.defineProperty(n,"src",ci(i,{set:(r)=>{let l=i.set.call(n,r);return e.triggerSourceset(n.src),l}})),n.setAttribute=(r,l)=>{let c=s.call(n,r,l);if(/src/i.test(r))e.triggerSourceset(n.src);return c},n.load=()=>{let r=a.call(n);if(!Qy(e))e.triggerSourceset(""),j8(e);return r},n.currentSrc)e.triggerSourceset(n.currentSrc);else if(!Qy(e))j8(e);n.resetSourceset_=()=>{if(n.resetSourceset_=null,n.load=a,n.setAttribute=s,Object.defineProperty(n,"src",i),n.resetSourceWatch_)n.resetSourceWatch_()}};class Bt extends kn{constructor(e,n){super(e,n);let i=e.source,s=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",i&&(this.el_.currentSrc!==i.src||e.tag&&e.tag.initNetworkState_===3))this.setSource(i);else this.handleLateInit_(this.el_);if(e.enableSourceset)this.setupSourcesetHandling_();if(this.isScrubbing_=!1,this.el_.hasChildNodes()){let a=this.el_.childNodes,r=a.length,l=[];while(r--){let c=a[r];if(c.nodeName.toLowerCase()==="track"){if(!this.featuresNativeTextTracks)l.push(c);else if(this.remoteTextTrackEls().addTrackElement_(c),this.remoteTextTracks().addTrack(c.track),this.textTracks().addTrack(c.track),!s&&!this.el_.hasAttribute("crossorigin")&&nb(c.src))s=!0}}for(let c=0;c<l.length;c++)this.el_.removeChild(l[c])}if(this.proxyNativeTracks_(),this.featuresNativeTextTracks&&s)An.warn(`Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.
|
|
171
|
+
This may prevent text tracks from loading.`);if(this.restoreMetadataTracksInIOSNativePlayer_(),(vp||V1)&&e.nativeControlsForTouch===!0)this.setControls(!0);this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){if(this.el_&&this.el_.resetSourceset_)this.el_.resetSourceset_();Bt.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){_M(this)}restoreMetadataTracksInIOSNativePlayer_(){let e=this.textTracks(),n,i=()=>{n=[];for(let a=0;a<e.length;a++){let r=e[a];if(r.kind==="metadata")n.push({track:r,storedMode:r.mode})}};i(),e.addEventListener("change",i),this.on("dispose",()=>e.removeEventListener("change",i));let s=()=>{for(let a=0;a<n.length;a++){let r=n[a];if(r.track.mode==="disabled"&&r.track.mode!==r.storedMode)r.track.mode=r.storedMode}e.removeEventListener("change",s)};this.on("webkitbeginfullscreen",()=>{e.removeEventListener("change",i),e.removeEventListener("change",s),e.addEventListener("change",s)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",i),e.addEventListener("change",i),e.removeEventListener("change",s)})}overrideNative_(e,n){if(n!==this[`featuresNative${e}Tracks`])return;let i=e.toLowerCase();if(this[`${i}TracksListeners_`])Object.keys(this[`${i}TracksListeners_`]).forEach((s)=>{this.el()[`${i}Tracks`].removeEventListener(s,this[`${i}TracksListeners_`][s])});this[`featuresNative${e}Tracks`]=!n,this[`${i}TracksListeners_`]=null,this.proxyNativeTracksForType_(i)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){let n=Tr[e],i=this.el()[n.getterName],s=this[n.getterName]();if(!this[`featuresNative${n.capitalName}Tracks`]||!i||!i.addEventListener)return;let a={change:(l)=>{let c={type:"change",target:s,currentTarget:s,srcElement:s};if(s.trigger(c),e==="text")this[ad.remoteText.getterName]().trigger(c)},addtrack(l){s.addTrack(l.track)},removetrack(l){s.removeTrack(l.track)}},r=function(){let l=[];for(let c=0;c<s.length;c++){let p=!1;for(let m=0;m<i.length;m++)if(i[m]===s[c]){p=!0;break}if(!p)l.push(s[c])}while(l.length)s.removeTrack(l.shift())};this[n.getterName+"Listeners_"]=a,Object.keys(a).forEach((l)=>{let c=a[l];i.addEventListener(l,c),this.on("dispose",(p)=>i.removeEventListener(l,c))}),this.on("loadstart",r),this.on("dispose",(l)=>this.off("loadstart",r))}proxyNativeTracks_(){Tr.names.forEach((e)=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){let i=e.cloneNode(!0);if(e.parentNode)e.parentNode.insertBefore(i,e);Bt.disposeMediaElement(e),e=i}else{e=jt.default.createElement("video");let i=this.options_.tag&&Oc(this.options_.tag),s=ci({},i);if(!vp||this.options_.nativeControlsForTouch!==!0)delete s.controls;l7(e,Object.assign(s,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}if(typeof this.options_.preload<"u")nd(e,"preload",this.options_.preload);if(this.options_.disablePictureInPicture!==void 0)e.disablePictureInPicture=this.options_.disablePictureInPicture;let n=["loop","muted","playsinline","autoplay"];for(let i=0;i<n.length;i++){let s=n[i],a=this.options_[s];if(typeof a<"u"){if(a)nd(e,s,s);else K1(e,s);e[s]=a}}return e}handleLateInit_(e){if(e.networkState===0||e.networkState===3)return;if(e.readyState===0){let i=!1,s=function(){i=!0};this.on("loadstart",s);let a=function(){if(!i)this.trigger("loadstart")};this.on("loadedmetadata",a),this.ready(function(){if(this.off("loadstart",s),this.off("loadedmetadata",a),!i)this.trigger("loadstart")});return}let n=["loadstart"];if(n.push("loadedmetadata"),e.readyState>=2)n.push("loadeddata");if(e.readyState>=3)n.push("canplay");if(e.readyState>=4)n.push("canplaythrough");this.ready(function(){n.forEach(function(i){this.trigger(i)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{if(this.isScrubbing_&&this.el_.fastSeek&&X1)this.el_.fastSeek(e);else this.el_.currentTime=e}catch(n){An(n,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&Jr&&Ro&&this.el_.currentTime===0){let e=()=>{if(this.el_.currentTime>0){if(this.el_.duration===1/0)this.trigger("durationchange");this.off("timeupdate",e)}};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;let e=function(){if(this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls())this.el_.controls=!1},n=function(){if("webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture")this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0})};this.on("webkitbeginfullscreen",n),this.on("dispose",()=>{this.off("webkitbeginfullscreen",n),this.off("webkitendfullscreen",e)})}supportsFullScreen(){return typeof this.el_.webkitEnterFullScreen==="function"}enterFullScreen(){let e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)jo(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(n){this.trigger("fullscreenerror",n)}},0);else try{e.webkitEnterFullScreen()}catch(n){this.trigger("fullscreenerror",n)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){if(this.featuresVideoFrameCallback&&!this.el_.webkitKeys)return this.el_.requestVideoFrameCallback(e);return super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){if(this.featuresVideoFrameCallback&&!this.el_.webkitKeys)this.el_.cancelVideoFrameCallback(e);else super.cancelVideoFrameCallback(e)}src(e){if(e===void 0)return this.el_.src;this.setSrc(e)}addSourceElement(e,n){if(!e)return An.error("Invalid source URL."),!1;let i={src:e};if(n)i.type=n;let s=on("source",{},i);return this.el_.appendChild(s),!0}removeSourceElement(e){if(!e)return An.error("Source URL is required to remove the source element."),!1;let n=this.el_.querySelectorAll("source");for(let i of n)if(i.src===e)return this.el_.removeChild(i),!0;return An.warn(`No matching source element found with src: ${e}`),!1}reset(){Bt.resetMediaElement(this.el_)}currentSrc(){if(this.currentSource_)return this.currentSource_.src;return this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,n,i){if(!this.featuresNativeTextTracks)return super.addTextTrack(e,n,i);return this.el_.addTextTrack(e,n,i)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);let n=jt.default.createElement("track");if(e.kind)n.kind=e.kind;if(e.label)n.label=e.label;if(e.language||e.srclang)n.srclang=e.language||e.srclang;if(e.default)n.default=e.default;if(e.id)n.id=e.id;if(e.src)n.src=e.src;return n}addRemoteTextTrack(e,n){let i=super.addRemoteTextTrack(e,n);if(this.featuresNativeTextTracks)this.el().appendChild(i);return i}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){let n=this.$$("track"),i=n.length;while(i--)if(e===n[i]||e===n[i].track)this.el().removeChild(n[i])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality==="function")return this.el().getVideoPlaybackQuality();let e={};if(typeof this.el().webkitDroppedFrameCount<"u"&&typeof this.el().webkitDecodedFrameCount<"u")e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount;if(qe.default.performance)e.creationTime=qe.default.performance.now();return e}}U1(Bt,"TEST_VID",function(){if(!rd())return;let e=jt.default.createElement("video"),n=jt.default.createElement("track");return n.kind="captions",n.srclang="en",n.label="English",e.appendChild(n),e});Bt.isSupported=function(){try{Bt.TEST_VID.volume=0.5}catch(e){return!1}return!!(Bt.TEST_VID&&Bt.TEST_VID.canPlayType)};Bt.canPlayType=function(e){return Bt.TEST_VID.canPlayType(e)};Bt.canPlaySource=function(e,n){return Bt.canPlayType(e.type)};Bt.canControlVolume=function(){try{let e=Bt.TEST_VID.volume;Bt.TEST_VID.volume=e/2+0.1;let n=e!==Bt.TEST_VID.volume;if(n&&Js)return qe.default.setTimeout(()=>{if(Bt&&Bt.prototype)Bt.prototype.featuresVolumeControl=e!==Bt.TEST_VID.volume}),!1;return n}catch(e){return!1}};Bt.canMuteVolume=function(){try{let e=Bt.TEST_VID.muted;if(Bt.TEST_VID.muted=!e,Bt.TEST_VID.muted)nd(Bt.TEST_VID,"muted","muted");else K1(Bt.TEST_VID,"muted","muted");return e!==Bt.TEST_VID.muted}catch(e){return!1}};Bt.canControlPlaybackRate=function(){if(Jr&&Ro&&z1<58)return!1;try{let e=Bt.TEST_VID.playbackRate;return Bt.TEST_VID.playbackRate=e/2+0.1,e!==Bt.TEST_VID.playbackRate}catch(e){return!1}};Bt.canOverrideAttributes=function(){try{let e=()=>{};Object.defineProperty(jt.default.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(jt.default.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(jt.default.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(jt.default.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0};Bt.supportsNativeTextTracks=function(){return X1||Js&&Ro};Bt.supportsNativeVideoTracks=function(){return!!(Bt.TEST_VID&&Bt.TEST_VID.videoTracks)};Bt.supportsNativeAudioTracks=function(){return!!(Bt.TEST_VID&&Bt.TEST_VID.audioTracks)};Bt.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([e,n]){U1(Bt.prototype,e,()=>Bt[n](),!0)});Bt.prototype.featuresVolumeControl=Bt.canControlVolume();Bt.prototype.movingMediaElementInDOM=!Js;Bt.prototype.featuresFullscreenResize=!0;Bt.prototype.featuresProgressEvents=!0;Bt.prototype.featuresTimeupdateEvents=!0;Bt.prototype.featuresVideoFrameCallback=!!(Bt.TEST_VID&&Bt.TEST_VID.requestVideoFrameCallback);Bt.disposeMediaElement=function(e){if(!e)return;if(e.parentNode)e.parentNode.removeChild(e);while(e.hasChildNodes())e.removeChild(e.firstChild);if(e.removeAttribute("src"),typeof e.load==="function")(function(){try{e.load()}catch(n){}})()};Bt.resetMediaElement=function(e){if(!e)return;let n=e.querySelectorAll("source"),i=n.length;while(i--)e.removeChild(n[i]);if(e.removeAttribute("src"),typeof e.load==="function")(function(){try{e.load()}catch(s){}})()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){Bt.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(e){Bt.prototype["set"+Hi(e)]=function(n){if(this.el_[e]=n,n)this.el_.setAttribute(e,e);else this.el_.removeAttribute(e)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(e){Bt.prototype[e]=function(){return this.el_[e]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(e){Bt.prototype["set"+Hi(e)]=function(n){this.el_[e]=n}});["pause","load","play"].forEach(function(e){Bt.prototype[e]=function(){return this.el_[e]()}});kn.withSourceHandlers(Bt);Bt.nativeSourceHandler={};Bt.nativeSourceHandler.canPlayType=function(e){try{return Bt.TEST_VID.canPlayType(e)}catch(n){return""}};Bt.nativeSourceHandler.canHandleSource=function(e,n){if(e.type)return Bt.nativeSourceHandler.canPlayType(e.type);else if(e.src){let i=k5(e.src);return Bt.nativeSourceHandler.canPlayType(`video/${i}`)}return""};Bt.nativeSourceHandler.handleSource=function(e,n,i){n.setSrc(e.src)};Bt.nativeSourceHandler.dispose=function(){};Bt.registerSourceHandler(Bt.nativeSourceHandler);kn.registerTech("Html5",Bt);var J7=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Fy={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Jy=["tiny","xsmall","small","medium","large","xlarge","huge"],y1={};Jy.forEach((e)=>{let n=e.charAt(0)==="x"?`x-${e.substring(1)}`:e;y1[e]=`vjs-layout-${n}`});var xM={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class Qn extends ht{constructor(e,n,i){if(e.id=e.id||n.id||`vjs_video_${Ar()}`,n=Object.assign(Qn.getTagSettings(e),n),n.initChildren=!1,n.createEl=!1,n.evented=!1,n.reportTouchActivity=!1,!n.language){let r=e.closest("[lang]");if(r)n.language=r.getAttribute("lang")}super(null,n,i);if(this.boundDocumentFullscreenChange_=(r)=>this.documentFullscreenChange_(r),this.boundFullWindowOnEscKey_=(r)=>this.fullWindowOnEscKey(r),this.boundUpdateStyleEl_=(r)=>this.updateStyleEl_(r),this.boundApplyInitTime_=(r)=>this.applyInitTime_(r),this.boundUpdateCurrentBreakpoint_=(r)=>this.updateCurrentBreakpoint_(r),this.boundHandleTechClick_=(r)=>this.handleTechClick_(r),this.boundHandleTechDoubleClick_=(r)=>this.handleTechDoubleClick_(r),this.boundHandleTechTouchStart_=(r)=>this.handleTechTouchStart_(r),this.boundHandleTechTouchMove_=(r)=>this.handleTechTouchMove_(r),this.boundHandleTechTouchEnd_=(r)=>this.handleTechTouchEnd_(r),this.boundHandleTechTap_=(r)=>this.handleTechTap_(r),this.boundUpdatePlayerHeightOnAudioOnlyMode_=(r)=>this.updatePlayerHeightOnAudioOnlyMode_(r),this.isFullscreen_=!1,this.log=Y8(this.id_),this.fsApi_=S1,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={controlBarHeight:null,playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&Oc(e),this.language(this.options_.language),n.languages){let r={};Object.getOwnPropertyNames(n.languages).forEach(function(l){r[l.toLowerCase()]=n.languages[l]}),this.languages_=r}else this.languages_=Qn.prototype.options_.languages;if(this.resetCache_(),this.poster_=n.poster||"",this.controls_=!!n.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay"))this.autoplay(!0);else this.autoplay(this.options_.autoplay);if(n.plugins)Object.keys(n.plugins).forEach((r)=>{if(typeof this[r]!=="function")throw Error(`plugin "${r}" does not exist`)});if(this.scrubbing_=!1,this.el_=this.createEl(),y5(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen)ir(jt.default,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_);if(this.fluid_)this.on(["playerreset","resize"],this.boundUpdateStyleEl_);let s=ci(this.options_);if(n.plugins)Object.keys(n.plugins).forEach((r)=>{this[r](n.plugins[r])});if(n.debug)this.debug(!0);if(this.options_.playerOptions=s,this.middleware_=[],this.playbackRates(n.playbackRates),n.experimentalSvgIcons){let l=new qe.default.DOMParser().parseFromString(cM,"image/svg+xml");if(l.querySelector("parsererror"))An.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{let p=l.documentElement;p.style.display="none",this.el_.appendChild(p),this.addClass("vjs-svg-icons-enabled")}}if(this.initChildren(),this.isAudio(e.nodeName.toLowerCase()==="audio"),this.controls())this.addClass("vjs-controls-enabled");else this.addClass("vjs-controls-disabled");if(this.el_.setAttribute("role","region"),this.isAudio())this.el_.setAttribute("aria-label",this.localize("Audio Player"));else this.el_.setAttribute("aria-label",this.localize("Video Player"));if(this.isAudio())this.addClass("vjs-audio");if(n.spatialNavigation&&n.spatialNavigation.enabled)this.spatialNavigation=new M7(this),this.addClass("vjs-spatial-navigation-enabled");if(vp)this.addClass("vjs-touch-enabled");if(!Js)this.addClass("vjs-workinghover");Qn.players[this.id_]=this;let a=Uy.split(".")[0];this.addClass(`vjs-v${a}`),this.userActive(!0),this.reportUserActivity(),this.one("play",(r)=>this.listenForUserActivity_(r)),this.on("keydown",(r)=>this.handleKeyDown(r)),this.on("languagechange",(r)=>this.handleLanguagechange(r)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){if(this.trigger("dispose"),this.off("dispose"),ea(jt.default,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),ea(jt.default,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode)this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null;if(Qn.players[this.id_]=null,this.tag&&this.tag.player)this.tag.player=null;if(this.el_&&this.el_.player)this.el_.player=null;if(this.tech_)this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_="";if(this.playerElIngest_)this.playerElIngest_=null;if(this.tag)this.tag=null;aM(this),ha.names.forEach((e)=>{let n=ha[e],i=this[n.getterName]();if(i&&i.off)i.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,n,i=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player"),s=this.tag.tagName.toLowerCase()==="video-js";if(i)n=this.el_=e.parentNode;else if(!s)n=this.el_=super.createEl("div");let a=Oc(e);if(s){n=this.el_=e,e=this.tag=jt.default.createElement("video");while(n.children.length)e.appendChild(n.firstChild);if(!pp(n,"video-js"))lh(n,"video-js");n.appendChild(e),i=this.playerElIngest_=n,Object.keys(n).forEach((c)=>{try{e[c]=n[c]}catch(p){}})}if(e.setAttribute("tabindex","-1"),a.tabindex="-1",Ro&&G1)e.setAttribute("role","application"),a.role="application";if(e.removeAttribute("width"),e.removeAttribute("height"),"width"in a)delete a.width;if("height"in a)delete a.height;Object.getOwnPropertyNames(a).forEach(function(c){if(!(s&&c==="class"))n.setAttribute(c,a[c]);if(s)e.setAttribute(c,a[c])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=n.player=this,this.addClass("vjs-paused");let r=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter((c)=>s7[c]).map((c)=>"vjs-device-"+c.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...r),qe.default.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=y7("vjs-styles-dimensions");let c=Hc(".vjs-styles-defaults"),p=Hc("head");p.insertBefore(this.styleEl_,c?c.nextSibling:p.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);let l=e.getElementsByTagName("a");for(let c=0;c<l.length;c++){let p=l.item(c);lh(p,"vjs-hidden"),p.setAttribute("hidden","hidden")}if(e.initNetworkState_=e.networkState,e.parentNode&&!i)e.parentNode.insertBefore(n,e);return Gy(e,n),this.children_.unshift(e),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=n,n}crossOrigin(e){if(typeof e>"u")return this.techGet_("crossOrigin");if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){An.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}if(this.techCall_("setCrossOrigin",e),this.posterImage)this.posterImage.crossOrigin(e);return}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,n){let i=e+"_";if(n===void 0)return this[i]||0;if(n===""||n==="auto"){this[i]=void 0,this.updateStyleEl_();return}let s=parseFloat(n);if(isNaN(s)){An.error(`Improper value "${n}" supplied for for ${e}`);return}this[i]=s,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;if(this.fluid_=!!e,Il(this))this.off(["playerreset","resize"],this.boundUpdateStyleEl_);if(e)this.addClass("vjs-fluid"),this.fill(!1),PI(this,()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)});else this.removeClass("vjs-fluid");this.updateStyleEl_()}fill(e){if(e===void 0)return!!this.fill_;if(this.fill_=!!e,e)this.addClass("vjs-fill"),this.fluid(!1);else this.removeClass("vjs-fill")}aspectRatio(e){if(e===void 0)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(qe.default.VIDEOJS_NO_DYNAMIC_STYLE===!0){let l=typeof this.width_==="number"?this.width_:this.options_.width,c=typeof this.height_==="number"?this.height_:this.options_.height,p=this.tech_&&this.tech_.el();if(p){if(l>=0)p.width=l;if(c>=0)p.height=c}return}let e,n,i,s;if(this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto")i=this.aspectRatio_;else if(this.videoWidth()>0)i=this.videoWidth()+":"+this.videoHeight();else i="16:9";let a=i.split(":"),r=a[1]/a[0];if(this.width_!==void 0)e=this.width_;else if(this.height_!==void 0)e=this.height_/r;else e=this.videoWidth()||300;if(this.height_!==void 0)n=this.height_;else n=e*r;if(/^[^a-zA-Z]/.test(this.id()))s="dimensions-"+this.id();else s=this.id()+"-dimensions";this.addClass(s),v7(this.styleEl_,`
|
|
172
|
+
.${s} {
|
|
173
|
+
width: ${e}px;
|
|
174
|
+
height: ${n}px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.${s}.vjs-fluid:not(.vjs-audio-only-mode) {
|
|
178
|
+
padding-top: ${r*100}%;
|
|
179
|
+
}
|
|
180
|
+
`)}loadTech_(e,n){if(this.tech_)this.unloadTech_();let i=Hi(e),s=e.charAt(0).toLowerCase()+e.slice(1);if(i!=="Html5"&&this.tag)kn.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null;this.techName_=i,this.isReady_=!1;let a=this.autoplay();if(typeof this.autoplay()==="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)a=!1;let r={source:n,autoplay:a,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${s}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};if(ha.names.forEach((c)=>{let p=ha[c];r[p.getterName]=this[p.privateName]}),Object.assign(r,this.options_[i]),Object.assign(r,this.options_[s]),Object.assign(r,this.options_[e.toLowerCase()]),this.tag)r.tag=this.tag;if(n&&n.src===this.cache_.src&&this.cache_.currentTime>0)r.startTime=this.cache_.currentTime;let l=kn.getTech(e);if(!l)throw Error(`No Tech named '${i}' exists! '${i}' should be registered using videojs.registerTech()'`);if(this.tech_=new l(r),this.tech_.ready(di(this,this.handleTechReady_),!0),Yy.jsonToTextTracks(this.textTracksJson_||[],this.tech_),J7.forEach((c)=>{this.on(this.tech_,c,(p)=>this[`handleTech${Hi(c)}_`](p))}),Object.keys(Fy).forEach((c)=>{this.on(this.tech_,c,(p)=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${Fy[c]}_`].bind(this),event:p});return}this[`handleTech${Fy[c]}_`](p)})}),this.on(this.tech_,"loadstart",(c)=>this.handleTechLoadStart_(c)),this.on(this.tech_,"sourceset",(c)=>this.handleTechSourceset_(c)),this.on(this.tech_,"waiting",(c)=>this.handleTechWaiting_(c)),this.on(this.tech_,"ended",(c)=>this.handleTechEnded_(c)),this.on(this.tech_,"seeking",(c)=>this.handleTechSeeking_(c)),this.on(this.tech_,"play",(c)=>this.handleTechPlay_(c)),this.on(this.tech_,"pause",(c)=>this.handleTechPause_(c)),this.on(this.tech_,"durationchange",(c)=>this.handleTechDurationChange_(c)),this.on(this.tech_,"fullscreenchange",(c,p)=>this.handleTechFullscreenChange_(c,p)),this.on(this.tech_,"fullscreenerror",(c,p)=>this.handleTechFullscreenError_(c,p)),this.on(this.tech_,"enterpictureinpicture",(c)=>this.handleTechEnterPictureInPicture_(c)),this.on(this.tech_,"leavepictureinpicture",(c)=>this.handleTechLeavePictureInPicture_(c)),this.on(this.tech_,"error",(c)=>this.handleTechError_(c)),this.on(this.tech_,"posterchange",(c)=>this.handleTechPosterChange_(c)),this.on(this.tech_,"textdata",(c)=>this.handleTechTextData_(c)),this.on(this.tech_,"ratechange",(c)=>this.handleTechRateChange_(c)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls())this.addTechControlsListeners_();if(this.tech_.el().parentNode!==this.el()&&(i!=="Html5"||!this.tag))Gy(this.tech_.el(),this.el());if(this.tag)this.tag.player=null,this.tag=null}unloadTech_(){if(ha.names.forEach((e)=>{let n=ha[e];this[n.privateName]=this[n.getterName]()}),this.textTracksJson_=Yy.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_)this.poster_="",this.trigger("posterchange");this.isPosterFromTech_=!1}tech(e){if(e===void 0)An.warn(`Using the tech directly can be dangerous. I hope you know what you're doing.
|
|
181
|
+
See https://github.com/videojs/video.js/issues/2617 for more info.
|
|
182
|
+
`);return this.tech_}version(){return{"video.js":Uy}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){if(this.triggerReady(),this.cache_.volume)this.techCall_("setVolume",this.cache_.volume);this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){if(this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),!this.paused())this.trigger("loadstart");else this.hasStarted(!1),this.trigger("loadstart");this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||typeof e!=="string")return;let n=()=>{let s=this.muted();this.muted(!0);let a=()=>{this.muted(s)};this.playTerminatedQueue_.push(a);let r=this.play();if(!gp(r))return;return r.catch((l)=>{throw a(),Error(`Rejection at manualAutoplay. Restoring muted value. ${l?l:""}`)})},i;if(e==="any"&&!this.muted()){if(i=this.play(),gp(i))i=i.catch(n)}else if(e==="muted"&&!this.muted())i=n();else i=this.play();if(!gp(i))return;return i.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let n=e,i="";if(typeof n!=="string")n=e.src,i=e.type;if(this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],n&&!i)i=lM(this,n);this.cache_.source=ci({},e,{src:n,type:i});let s=this.cache_.sources.filter((c)=>c.src&&c.src===n),a=[],r=this.$$("source"),l=[];for(let c=0;c<r.length;c++){let p=Oc(r[c]);if(a.push(p),p.src&&p.src===n)l.push(p.src)}if(l.length&&!s.length)this.cache_.sources=a;else if(!s.length)this.cache_.sources=[this.cache_.source];this.cache_.src=n}handleTechSourceset_(e){if(!this.changingSrc_){let n=(a)=>this.updateSourceCaches_(a),i=this.currentSource().src,s=e.src;if(i&&!/^blob:/.test(i)&&/^blob:/.test(s)){if(!this.lastSource_||this.lastSource_.tech!==s&&this.lastSource_.player!==i)n=()=>{}}if(n(s),!e.src)this.tech_.any(["sourceset","loadstart"],(a)=>{if(a.type==="sourceset")return;let r=this.techGet_("currentSrc");this.lastSource_.tech=r,this.updateSourceCaches_(r)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(e===void 0)return this.hasStarted_;if(e===this.hasStarted_)return;if(this.hasStarted_=e,this.hasStarted_)this.addClass("vjs-has-started");else this.removeClass("vjs-has-started")}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){if(this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0)this.queuedCallbacks_.forEach((e)=>e.callback(e.event)),this.queuedCallbacks_=[];this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");let e=this.currentTime(),n=()=>{if(e!==this.currentTime())this.removeClass("vjs-waiting"),this.off("timeupdate",n)};this.on("timeupdate",n)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){if(this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop)this.currentTime(0),this.play();else if(!this.paused())this.pause();this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){if(!this.controls_)return;if(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)if(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click==="function")this.options_.userActions.click.call(this,e);else if(this.paused())jo(this.play());else this.pause()}handleTechDoubleClick_(e){if(!this.controls_)return;if(!Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),(i)=>i.contains(e.target))){if(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)if(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick==="function")this.options_.userActions.doubleClick.call(this,e);else if(this.isInPictureInPicture()&&!jt.default.pictureInPictureElement)this.exitPictureInPicture();else if(this.isFullscreen())this.exitFullscreen();else this.requestFullscreen()}}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){if(this.userWasActive)this.reportUserActivity()}handleTechTouchEnd_(e){if(e.cancelable)e.preventDefault()}toggleFullscreenClass_(){if(this.isFullscreen())this.addClass("vjs-fullscreen");else this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){let n=e.target.player;if(n&&n!==this)return;let i=this.el(),s=jt.default[this.fsApi_.fullscreenElement]===i;if(!s&&i.matches)s=i.matches(":"+this.fsApi_.fullscreen);this.isFullscreen(s)}handleTechFullscreenChange_(e,n){if(n){if(n.nativeIOSFullscreen)this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")});this.isFullscreen(n.isFullscreen)}}handleTechFullscreenError_(e,n){this.trigger("fullscreenerror",n)}togglePictureInPictureClass_(){if(this.isInPictureInPicture())this.addClass("vjs-picture-in-picture");else this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){let e=this.tech_.error();if(e)this.error(e)}handleTechTextData_(){let e=null;if(arguments.length>1)e=arguments[1];this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,n){this.ready(function(){if(e in iM)return tM(this.middleware_,this.tech_,e,n);else if(e in d8)return f8(this.middleware_,this.tech_,e,n);try{if(this.tech_)this.tech_[e](n)}catch(i){throw An(i),i}},!0)}techGet_(e){if(!this.tech_||!this.tech_.isReady_)return;if(e in nM)return eM(this.middleware_,this.tech_,e);else if(e in d8)return f8(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(n){if(this.tech_[e]===void 0)throw An(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,n),n;if(n.name==="TypeError")throw An(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,n),this.tech_.isReady_=!1,n;throw An(n),n}}play(){return new Promise((e)=>{this.play_(e)})}play_(e=jo){this.playCallbacks_.push(e);let n=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),i=Boolean(X1||Js);if(this.waitToPlay_)this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null;if(!this.isReady_||!n){if(this.waitToPlay_=(r)=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!n&&i)this.load();return}let s=this.techGet_("play");if(i&&this.hasClass("vjs-ended"))this.resetProgressBar_();if(s===null)this.runPlayTerminatedQueue_();else this.runPlayCallbacks_(s)}runPlayTerminatedQueue_(){let e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(n){n()})}runPlayCallbacks_(e){let n=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],n.forEach(function(i){i(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")===!1?!1:!0}played(){return this.techGet_("played")||Yr(0,0)}scrubbing(e){if(typeof e>"u")return this.scrubbing_;if(this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e)this.addClass("vjs-scrubbing");else this.removeClass("vjs-scrubbing")}currentTime(e){if(e===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0)e=0;if(!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}if(this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e))this.cache_.currentTime=Number(e)}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;if(e=parseFloat(e),e<0)e=1/0;if(e!==this.cache_.duration){if(this.cache_.duration=e,e===1/0)this.addClass("vjs-live");else this.removeClass("vjs-live");if(!isNaN(e))this.trigger("durationchange")}}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");if(!e||!e.length)e=Yr(0,0);return e}seekable(){let e=this.techGet_("seekable");if(!e||!e.length)e=Yr(0,0);return e}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return E7(this.buffered(),this.duration())}bufferedEnd(){let e=this.buffered(),n=this.duration(),i=e.end(e.length-1);if(i>n)i=n;return i}volume(e){let n;if(e!==void 0){if(n=Math.max(0,Math.min(1,e)),this.cache_.volume=n,this.techCall_("setVolume",n),n>0)this.lastVolume_(n);return}return n=parseFloat(this.techGet_("volume")),isNaN(n)?1:n}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){if(e!==void 0)this.techCall_("setDefaultMuted",e);return this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){let n=this.isFullscreen_;if(this.isFullscreen_=Boolean(e),this.isFullscreen_!==n&&this.fsApi_.prefixed)this.trigger("fullscreenchange");this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){if(this.isInPictureInPicture())this.exitPictureInPicture();let n=this;return new Promise((i,s)=>{function a(){n.off("fullscreenerror",l),n.off("fullscreenchange",r)}function r(){a(),i()}function l(p,m){a(),s(m)}n.one("fullscreenchange",r),n.one("fullscreenerror",l);let c=n.requestFullscreenHelper_(e);if(c)c.then(a,a),c.then(i,s)})}requestFullscreenHelper_(e){let n;if(!this.fsApi_.prefixed){if(n=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0)n=e}if(this.fsApi_.requestFullscreen){let i=this.el_[this.fsApi_.requestFullscreen](n);if(i)i.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1));return i}else if(this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow===!0)this.techCall_("enterFullScreen");else this.enterFullWindow()}exitFullscreen(){let e=this;return new Promise((n,i)=>{function s(){e.off("fullscreenerror",r),e.off("fullscreenchange",a)}function a(){s(),n()}function r(c,p){s(),i(p)}e.one("fullscreenchange",a),e.one("fullscreenerror",r);let l=e.exitFullscreenHelper_();if(l)l.then(s,s),l.then(n,i)})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){let e=jt.default[this.fsApi_.exitFullscreen]();if(e)jo(e.then(()=>this.isFullscreen(!1)));return e}else if(this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow===!0)this.techCall_("exitFullScreen");else this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=jt.default.documentElement.style.overflow,ir(jt.default,"keydown",this.boundFullWindowOnEscKey_),jt.default.documentElement.style.overflow="hidden",lh(jt.default.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){if(e.key==="Escape"){if(this.isFullscreen()===!0)if(!this.isFullWindow)this.exitFullscreen();else this.exitFullWindow()}}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,ea(jt.default,"keydown",this.boundFullWindowOnEscKey_),jt.default.documentElement.style.overflow=this.docOrigOverflow,W1(jt.default.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(e===void 0)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(e!==void 0){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&qe.default.documentPictureInPicture){let e=jt.default.createElement(this.el().tagName);if(e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage)e.appendChild(this.posterImage.el().cloneNode(!0));if(this.titleBar)e.appendChild(this.titleBar.el().cloneNode(!0));return e.appendChild(on("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),qe.default.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then((n)=>(g7(n),this.el_.parentNode.insertBefore(e,this.el_),n.document.body.appendChild(this.el_),n.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:n}),n.addEventListener("pagehide",(i)=>{let s=i.target.querySelector(".video-js");e.parentNode.replaceChild(s,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),n))}if("pictureInPictureEnabled"in jt.default&&this.disablePictureInPicture()===!1)return this.techGet_("requestPictureInPicture");return Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(qe.default.documentPictureInPicture&&qe.default.documentPictureInPicture.window)return qe.default.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in jt.default)return jt.default.exitPictureInPicture()}handleKeyDown(e){let{userActions:n}=this.options_;if(!n||!n.hotkeys)return;if(((s)=>{let a=s.tagName.toLowerCase();if(s.isContentEditable)return!0;let r=["button","checkbox","hidden","radio","reset","submit"];if(a==="input")return r.indexOf(s.type)===-1;return["textarea"].indexOf(a)!==-1})(this.el_.ownerDocument.activeElement))return;if(typeof n.hotkeys==="function")n.hotkeys.call(this,e);else this.handleHotkeys(e)}handleHotkeys(e){let n=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:i=(r)=>e.key.toLowerCase()==="f",muteKey:s=(r)=>e.key.toLowerCase()==="m",playPauseKey:a=(r)=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=n;if(i.call(this,e)){e.preventDefault(),e.stopPropagation();let r=ht.getComponent("FullscreenToggle");if(jt.default[this.fsApi_.fullscreenEnabled]!==!1)r.prototype.handleClick.call(this,e)}else if(s.call(this,e))e.preventDefault(),e.stopPropagation(),ht.getComponent("MuteToggle").prototype.handleClick.call(this,e);else if(a.call(this,e))e.preventDefault(),e.stopPropagation(),ht.getComponent("PlayToggle").prototype.handleClick.call(this,e)}canPlayType(e){let n;for(let i=0,s=this.options_.techOrder;i<s.length;i++){let a=s[i],r=kn.getTech(a);if(!r)r=ht.getComponent(a);if(!r){An.error(`The "${a}" tech is undefined. Skipped browser support check for that tech.`);continue}if(r.isSupported()){if(n=r.canPlayType(e),n)return n}}return""}selectSource(e){let n=this.options_.techOrder.map((l)=>[l,kn.getTech(l)]).filter(([l,c])=>{if(c)return c.isSupported();return An.error(`The "${l}" tech is undefined. Skipped browser support check for that tech.`),!1}),i=function(l,c,p){let m;return l.some((g)=>c.some((y)=>{if(m=p(g,y),m)return!0})),m},s,a=(l)=>(c,p)=>l(p,c),r=([l,c],p)=>{if(c.canPlaySource(p,this.options_[l.toLowerCase()]))return{source:p,tech:l}};if(this.options_.sourceOrder)s=i(e,n,a(r));else s=i(n,e,r);return s||!1}handleSrc_(e,n){if(typeof e>"u")return this.cache_.src||"";if(this.resetRetryOnError_)this.resetRetryOnError_();let i=I7(e);if(!i.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,!n)this.cache_.sources=i;if(this.updateSourceCaches_(i[0]),JI(this,i[0],(s,a)=>{if(this.middleware_=a,!n)this.cache_.sources=i;if(this.updateSourceCaches_(s),this.src_(s)){if(i.length>1)return this.handleSrc_(i.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}ZI(a,this.tech_)}),i.length>1){let s=()=>{this.error(null),this.handleSrc_(i.slice(1),!0)},a=()=>{this.off("error",s)};this.one("error",s),this.one("playing",a),this.resetRetryOnError_=()=>{this.off("error",s),this.off("playing",a)}}}src(e){return this.handleSrc_(e,!1)}src_(e){let n=this.selectSource([e]);if(!n)return!0;if(!T7(n.tech,this.techName_))return this.changingSrc_=!0,this.loadTech_(n.tech,n.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1;return this.ready(function(){if(this.tech_.constructor.prototype.hasOwnProperty("setSource"))this.techCall_("setSource",e);else this.techCall_("src",e.src);this.changingSrc_=!1},!0),!1}addSourceElement(e,n){if(!this.tech_)return!1;return this.tech_.addSourceElement(e,n)}removeSourceElement(e){if(!this.tech_)return!1;return this.tech_.removeSourceElement(e)}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{let e=this.play();jo(e.then(()=>this.doReset_()))}}doReset_(){if(this.tech_)this.tech_.clearTracks("text");if(this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar)this.titleBar.update({title:void 0,description:void 0});if(Il(this))this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);let{currentTimeDisplay:e,durationDisplay:n,progressControl:i,remainingTimeDisplay:s}=this.controlBar||{},{seekBar:a}=i||{};if(e)e.updateContent();if(n)n.updateContent();if(s)s.updateContent();if(a){if(a.update(),a.loadProgressBar)a.loadProgressBar.update()}}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){let e=this.currentSource(),n=[];if(Object.keys(e).length!==0)n.push(e);return this.cache_.sources||n}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(e!==void 0){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){if(e===void 0)return this.options_.autoplay||!1;let n;if(typeof e==="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay)this.options_.autoplay=e,this.manualAutoplay_(typeof e==="string"?e:"play"),n=!1;else if(!e)this.options_.autoplay=!1;else this.options_.autoplay=!0;if(n=typeof n>"u"?this.options_.autoplay:n,this.tech_)this.techCall_("setAutoplay",n)}playsinline(e){if(e!==void 0)this.techCall_("setPlaysinline",e),this.options_.playsinline=e;return this.techGet_("playsinline")}loop(e){if(e!==void 0){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")}poster(e){if(e===void 0)return this.poster_;if(!e)e="";if(e===this.poster_)return;this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange")}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){let e=this.tech_.poster()||"";if(e!==this.poster_)this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange")}}controls(e){if(e===void 0)return!!this.controls_;if(e=!!e,this.controls_===e)return;if(this.controls_=e,this.usingNativeControls())this.techCall_("setControls",e);if(this.controls_){if(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),!this.usingNativeControls())this.addTechControlsListeners_()}else if(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),!this.usingNativeControls())this.removeTechControlsListeners_()}usingNativeControls(e){if(e===void 0)return!!this.usingNativeControls_;if(e=!!e,this.usingNativeControls_===e)return;if(this.usingNativeControls_=e,this.usingNativeControls_)this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols");else this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")}error(e){if(e===void 0)return this.error_||null;if(Lc("beforeerror").forEach((n)=>{let i=n(this,e);if(!(Mo(i)&&!Array.isArray(i)||typeof i==="string"||typeof i==="number"||i===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=i}),this.options_.suppressNotSupportedError&&e&&e.code===4){let n=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],n),this.one("loadstart",function(){this.off(["click","touchstart"],n)});return}if(e===null){if(this.error_=null,this.removeClass("vjs-error"),this.errorDisplay)this.errorDisplay.close();return}this.error_=new Ri(e),this.addClass("vjs-error"),An.error(`(CODE:${this.error_.code} ${Ri.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),Lc("error").forEach((n)=>n(this,this.error_));return}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e===this.userActive_)return;if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}if(this.tech_)this.tech_.one("mousemove",function(n){n.stopPropagation(),n.preventDefault()});this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}listenForUserActivity_(){let e,n,i,s=di(this,this.reportUserActivity),a=function(g){if(g.screenX!==n||g.screenY!==i)n=g.screenX,i=g.screenY,s()},r=function(){s(),this.clearInterval(e),e=this.setInterval(s,250)},l=function(g){s(),this.clearInterval(e)};this.on("mousedown",r),this.on("mousemove",a),this.on("mouseup",l),this.on("mouseleave",l);let c=this.getChild("controlBar");if(c&&!Js&&!Jr)c.on("mouseenter",function(g){if(this.player().options_.inactivityTimeout!==0)this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout;this.player().options_.inactivityTimeout=0}),c.on("mouseleave",function(g){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout});this.on("keydown",s),this.on("keyup",s);let p,m=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(p);let g=this.options_.inactivityTimeout;if(g<=0)return;p=this.setTimeout(function(){if(!this.userActivity_)this.userActive(!1)},g)};this.setInterval(m,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}if(this.tech_&&this.tech_.featuresPlaybackRate)return this.cache_.lastPlaybackRate||this.techGet_("playbackRate");return 1}defaultPlaybackRate(e){if(e!==void 0)return this.techCall_("setDefaultPlaybackRate",e);if(this.tech_&&this.tech_.featuresPlaybackRate)return this.techGet_("defaultPlaybackRate");return 1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}updatePlayerHeightOnAudioOnlyMode_(){let e=this.getChild("ControlBar");if(!e||this.audioOnlyCache_.controlBarHeight===e.currentHeight())return;this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight)}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");let e=this.children(),n=this.getChild("ControlBar"),i=n&&n.currentHeight();e.forEach((s)=>{if(s===n)return;if(s.el_&&!s.hasClass("vjs-hidden"))s.hide(),this.audioOnlyCache_.hiddenChildren.push(s)}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=i,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach((e)=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!=="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){let n=[];if(this.isInPictureInPicture())n.push(this.exitPictureInPicture());if(this.isFullscreen())n.push(this.exitFullscreen());if(this.audioPosterMode())n.push(this.audioPosterMode(!1));return Promise.all(n).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){if(typeof e!=="boolean"||e===this.audioPosterMode_)return this.audioPosterMode_;if(this.audioPosterMode_=e,e){if(this.audioOnlyMode())return this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()});return Promise.resolve().then(()=>{this.enablePosterModeUI_()})}return Promise.resolve().then(()=>{this.disablePosterModeUI_()})}addTextTrack(e,n,i){if(this.tech_)return this.tech_.addTextTrack(e,n,i)}addRemoteTextTrack(e,n){if(this.tech_)return this.tech_.addRemoteTextTrack(e,n)}removeRemoteTextTrack(e={}){let{track:n}=e;if(!n)n=e;if(this.tech_)return this.tech_.removeRemoteTextTrack(n)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;if(this.language_!==String(e).toLowerCase()){if(this.language_=String(e).toLowerCase(),Il(this))this.trigger("languagechange")}}languages(){return ci(Qn.prototype.options_.languages,this.languages_)}toJSON(){let e=ci(this.options_),n=e.tracks;e.tracks=[];for(let i=0;i<n.length;i++){let s=n[i];s=ci(s),s.player=void 0,e.tracks[i]=s}return e}createModal(e,n){n=n||{},n.content=e||"";let i=new fh(this,n);return this.addChild(i),i.on("dispose",()=>{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(!this.responsive())return;let e=this.currentBreakpoint(),n=this.currentWidth();for(let i=0;i<Jy.length;i++){let s=Jy[i],a=this.breakpoints_[s];if(n<=a){if(e===s)return;if(e)this.removeClass(y1[e]);this.addClass(y1[s]),this.breakpoint_=s;break}}}removeCurrentBreakpoint_(){let e=this.currentBreakpointClass();if(this.breakpoint_="",e)this.removeClass(e)}breakpoints(e){if(e===void 0)return Object.assign(this.breakpoints_);return this.removeCurrentBreakpoint_(),this.breakpoints_=Object.assign({},xM,e),this.updateCurrentBreakpoint_(),Object.assign(this.breakpoints_)}responsive(e){if(e===void 0)return this.responsive_;e=Boolean(e);let n=this.responsive_;if(e===n)return;if(this.responsive_=e,e)this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_();else this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_();return e}currentBreakpoint(){return this.breakpoint_}currentBreakpointClass(){return y1[this.breakpoint_]||""}loadMedia(e,n){if(!e||typeof e!=="object")return;let i=this.crossOrigin();this.reset(),this.cache_.media=ci(e);let{artist:s,artwork:a,description:r,poster:l,src:c,textTracks:p,title:m}=this.cache_.media;if(!a&&l)this.cache_.media.artwork=[{src:l,type:D1(l)}];if(i)this.crossOrigin(i);if(c)this.src(c);if(l)this.poster(l);if(Array.isArray(p))p.forEach((g)=>this.addRemoteTextTrack(g,!1));if(this.titleBar)this.titleBar.update({title:m,description:r||s||""});this.ready(n)}getMedia(){if(!this.cache_.media){let e=this.poster(),n=this.currentSources(),i=Array.prototype.map.call(this.remoteTextTracks(),(a)=>({kind:a.kind,label:a.label,language:a.language,src:a.src})),s={src:n,textTracks:i};if(e)s.poster=e,s.artwork=[{src:s.poster,type:D1(s.poster)}];return s}return ci(this.cache_.media)}static getTagSettings(e){let n={sources:[],tracks:[]},i=Oc(e),s=i["data-setup"];if(pp(e,"vjs-fill"))i.fill=!0;if(pp(e,"vjs-fluid"))i.fluid=!0;if(s!==null)try{Object.assign(i,JSON.parse(s||"{}"))}catch(a){An.error("data-setup",a)}if(Object.assign(n,i),e.hasChildNodes()){let a=e.childNodes;for(let r=0,l=a.length;r<l;r++){let c=a[r],p=c.nodeName.toLowerCase();if(p==="source")n.sources.push(Oc(c));else if(p==="track")n.tracks.push(Oc(c))}}return n}debug(e){if(e===void 0)return this.debugEnabled_;if(e)this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0;else this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1}playbackRates(e){if(e===void 0)return this.cache_.playbackRates;if(!Array.isArray(e))return;if(!e.every((n)=>typeof n==="number"))return;this.cache_.playbackRates=e,this.trigger("playbackrateschange")}}Qn.prototype.videoTracks=()=>{};Qn.prototype.audioTracks=()=>{};Qn.prototype.textTracks=()=>{};Qn.prototype.remoteTextTracks=()=>{};Qn.prototype.remoteTextTrackEls=()=>{};ha.names.forEach(function(e){let n=ha[e];Qn.prototype[n.getterName]=function(){if(this.tech_)return this.tech_[n.getterName]();return this[n.privateName]=this[n.privateName]||new n.ListClass,this[n.privateName]}});Qn.prototype.crossorigin=Qn.prototype.crossOrigin;Qn.players={};var up=qe.default.navigator;Qn.prototype.options_={techOrder:kn.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2000,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:up&&(up.languages&&up.languages[0]||up.userLanguage||up.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1,disableSeekWhileScrubbingOnMobile:!1,disableSeekWhileScrubbingOnSTV:!1};J7.forEach(function(e){Qn.prototype[`handleTech${Hi(e)}_`]=function(){return this.trigger(e)}});ht.registerComponent("Player",Qn);var M1="plugin",$f="activePlugins_",Vf={},R1=(e)=>Vf.hasOwnProperty(e),v1=(e)=>R1(e)?Vf[e]:void 0,Z7=(e,n)=>{e[$f]=e[$f]||{},e[$f][n]=!0},O1=(e,n,i)=>{let s=(i?"before":"")+"pluginsetup";e.trigger(s,n),e.trigger(s+":"+n.name,n)},kM=function(e,n){let i=function(){O1(this,{name:e,plugin:n,instance:null},!0);let s=n.apply(this,arguments);return Z7(this,e),O1(this,{name:e,plugin:n,instance:s}),s};return Object.keys(n).forEach(function(s){i[s]=n[s]}),i},E8=(e,n)=>(n.prototype.name=e,function(...i){O1(this,{name:e,plugin:n,instance:null},!0);let s=new n(...[this,...i]);return this[e]=()=>s,O1(this,s.getEventHash()),s});class Oa{constructor(e){if(this.constructor===Oa)throw Error("Plugin must be sub-classed; not directly instantiated.");if(this.player=e,!this.log)this.log=this.player.log.createLogger(this.name);y5(this),delete this.trigger,k7(this,this.constructor.defaultState),Z7(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,n={}){return cd(this.eventBusEl_,e,this.getEventHash(n))}handleStateChanged(e){}dispose(){let{name:e,player:n}=this;this.trigger("dispose"),this.off(),n.off("dispose",this.dispose),n[$f][e]=!1,this.player=this.state=null,n[e]=E8(e,Vf[e])}static isBasic(e){let n=typeof e==="string"?v1(e):e;return typeof n==="function"&&!Oa.prototype.isPrototypeOf(n.prototype)}static registerPlugin(e,n){if(typeof e!=="string")throw Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(R1(e))An.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Qn.prototype.hasOwnProperty(e))throw Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof n!=="function")throw Error(`Illegal plugin for "${e}", must be a function, was ${typeof n}.`);if(Vf[e]=n,e!==M1)if(Oa.isBasic(n))Qn.prototype[e]=kM(e,n);else Qn.prototype[e]=E8(e,n);return n}static deregisterPlugin(e){if(e===M1)throw Error("Cannot de-register base plugin.");if(R1(e))delete Vf[e],delete Qn.prototype[e]}static getPlugins(e=Object.keys(Vf)){let n;return e.forEach((i)=>{let s=v1(i);if(s)n=n||{},n[i]=s}),n}static getPluginVersion(e){let n=v1(e);return n&&n.VERSION||""}}Oa.getPlugin=v1;Oa.BASE_PLUGIN_NAME=M1;Oa.registerPlugin(M1,Oa);Qn.prototype.usingPlugin=function(e){return!!this[$f]&&this[$f][e]===!0};Qn.prototype.hasPlugin=function(e){return!!R1(e)};function TM(e,n){let i=!1;return function(...s){if(!i)An.warn(e);return i=!0,n.apply(this,s)}}function Zr(e,n,i,s){return TM(`${n} is deprecated and will be removed in ${e}.0; please use ${i} instead.`,s)}var AM={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"},eS=(e)=>e.indexOf("#")===0?e.slice(1):e;function Ke(e,n,i){let s=Ke.getPlayer(e);if(s){if(n)An.warn(`Player "${e}" is already initialised. Options will not be applied.`);if(i)s.ready(i);return s}let a=typeof e==="string"?Hc("#"+eS(e)):e;if(!ld(a))throw TypeError("The element or ID supplied is not valid. (videojs)");let l=("getRootNode"in a?a.getRootNode()instanceof qe.default.ShadowRoot:!1)?a.getRootNode():a.ownerDocument.body;if(!a.ownerDocument.defaultView||!l.contains(a))An.warn("The element supplied is not included in the DOM");if(n=n||{},n.restoreEl===!0)n.restoreEl=(a.parentNode&&a.parentNode.hasAttribute&&a.parentNode.hasAttribute("data-vjs-player")?a.parentNode:a).cloneNode(!0);return Lc("beforesetup").forEach((p)=>{let m=p(a,ci(n));if(!Mo(m)||Array.isArray(m)){An.error("please return an object in beforesetup hooks");return}n=ci(n,m)}),s=new(ht.getComponent("Player"))(a,n,i),Lc("setup").forEach((p)=>p(s)),s}Ke.hooks_=ql;Ke.hooks=Lc;Ke.hook=kI;Ke.hookOnce=TI;Ke.removeHook=$8;if(qe.default.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&rd()){let e=Hc(".vjs-styles-defaults");if(!e){e=y7("vjs-styles-defaults");let n=Hc("head");if(n)n.insertBefore(e,n.firstChild);v7(e,`
|
|
183
|
+
.video-js {
|
|
184
|
+
width: 300px;
|
|
185
|
+
height: 150px;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.vjs-fluid:not(.vjs-audio-only-mode) {
|
|
189
|
+
padding-top: 56.25%
|
|
190
|
+
}
|
|
191
|
+
`)}}Xy(1,Ke);Ke.VERSION=Uy;Ke.options=Qn.prototype.options_;Ke.getPlayers=()=>Qn.players;Ke.getPlayer=(e)=>{let n=Qn.players,i;if(typeof e==="string"){let s=eS(e),a=n[s];if(a)return a;i=Hc("#"+s)}else i=e;if(ld(i)){let{player:s,playerId:a}=i;if(s||n[a])return s||n[a]}};Ke.getAllPlayers=()=>Object.keys(Qn.players).map((e)=>Qn.players[e]).filter(Boolean);Ke.players=Qn.players;Ke.getComponent=ht.getComponent;Ke.registerComponent=(e,n)=>{if(kn.isTech(n))An.warn(`The ${e} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`);return ht.registerComponent.call(ht,e,n)};Ke.getTech=kn.getTech;Ke.registerTech=kn.registerTech;Ke.use=QI;Object.defineProperty(Ke,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(Ke.middleware,"TERMINATOR",{value:q1,writeable:!1,enumerable:!0});Ke.browser=s7;Ke.obj=jI;Ke.mergeOptions=Zr(9,"videojs.mergeOptions","videojs.obj.merge",ci);Ke.defineLazyProperty=Zr(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",U1);Ke.bind=Zr(9,"videojs.bind","native Function.prototype.bind",di);Ke.registerPlugin=Oa.registerPlugin;Ke.deregisterPlugin=Oa.deregisterPlugin;Ke.plugin=(e,n)=>(An.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Oa.registerPlugin(e,n));Ke.getPlugins=Oa.getPlugins;Ke.getPlugin=Oa.getPlugin;Ke.getPluginVersion=Oa.getPluginVersion;Ke.addLanguage=function(e,n){return e=(""+e).toLowerCase(),Ke.options.languages=ci(Ke.options.languages,{[e]:n}),Ke.options.languages[e]};Ke.log=An;Ke.createLogger=Y8;Ke.time=zI;Ke.createTimeRange=Zr(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Yr);Ke.createTimeRanges=Zr(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Yr);Ke.formatTime=Zr(9,"videojs.formatTime","videojs.time.formatTime",hh);Ke.setFormatTime=Zr(9,"videojs.setFormatTime","videojs.time.setFormatTime",C7);Ke.resetFormatTime=Zr(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",j7);Ke.parseUrl=Zr(9,"videojs.parseUrl","videojs.url.parseUrl",x5);Ke.isCrossOrigin=Zr(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",nb);Ke.EventTarget=Na;Ke.any=w5;Ke.on=ir;Ke.one=J1;Ke.off=ea;Ke.trigger=cd;Ke.xhr=d5.default;Ke.TrackList=Uc;Ke.TextTrack=ud;Ke.TextTrackList=eb;Ke.AudioTrack=T5;Ke.AudioTrackList=S5;Ke.VideoTrack=A5;Ke.VideoTrackList=_5;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach((e)=>{Ke[e]=function(){return An.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),b7[e].apply(null,arguments)}});Ke.computedStyle=Zr(9,"videojs.computedStyle","videojs.dom.computedStyle",sd);Ke.dom=b7;Ke.fn=NI;Ke.num=hM;Ke.str=HI;Ke.url=$I;Ke.Error=AM;/*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */class tS{constructor(e){let n=this;return n.id=e.id,n.label=n.id,n.width=e.width,n.height=e.height,n.bitrate=e.bandwidth,n.frameRate=e.frameRate,n.enabled_=e.enabled,Object.defineProperty(n,"enabled",{get(){return n.enabled_()},set(i){n.enabled_(i)}}),n}}class xp extends Ke.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}}),Object.defineProperty(e,"length",{get(){return e.levels_.length}}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let n=this.getQualityLevelById(e.id);if(n)return n;let i=this.levels_.length;if(n=new tS(e),!(""+i in this))Object.defineProperty(this,i,{get(){return this.levels_[i]}});return this.levels_.push(n),this.trigger({qualityLevel:n,type:"addqualitylevel"}),n}removeQualityLevel(e){let n=null;for(let i=0,s=this.length;i<s;i++)if(this[i]===e){if(n=this.levels_.splice(i,1)[0],this.selectedIndex_===i)this.selectedIndex_=-1;else if(this.selectedIndex_>i)this.selectedIndex_--;break}if(n)this.trigger({qualityLevel:e,type:"removequalitylevel"});return n}getQualityLevelById(e){for(let n=0,i=this.length;n<i;n++){let s=this[n];if(s.id===e)return s}return null}dispose(){this.selectedIndex_=-1,this.levels_.length=0}}xp.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(let e in xp.prototype.allowedEvents_)xp.prototype["on"+e]=null;var nS="4.1.0",CM=function(e,n){let i=e.qualityLevels,s=new xp,a=function(){s.dispose(),e.qualityLevels=i,e.off("dispose",a)};return e.on("dispose",a),e.qualityLevels=()=>s,e.qualityLevels.VERSION=nS,s},iS=function(e){return CM(this,Ke.obj.merge({},e))};Ke.registerPlugin("qualityLevels",iS);iS.VERSION=nS;/*! @name @videojs/http-streaming @version 3.17.5 @license Apache-2.0 */var Ma=Tf,F1=(e,n)=>{if(n&&n.responseURL&&e!==n.responseURL)return n.responseURL;return e},jr=(e)=>{if(Ke.log.debug)return Ke.log.debug.bind(Ke,"VHS:",`${e} >`);return function(){}};function Jn(...e){let n=Ke.obj||Ke;return(n.merge||n.mergeOptions).apply(n,e)}function xs(...e){let n=Ke.time||Ke;return(n.createTimeRanges||n.createTimeRanges).apply(n,e)}function jM(e){if(e.length===0)return"Buffered Ranges are empty";let n=`Buffered Ranges:
|
|
192
|
+
`;for(let i=0;i<e.length;i++){let s=e.start(i),a=e.end(i);n+=`${s} --> ${a}. Duration (${a-s})
|
|
193
|
+
`}return n}var Eo=0.03333333333333333,qo=Eo*3,sS=function(e,n){let i=[],s;if(e&&e.length){for(s=0;s<e.length;s++)if(n(e.start(s),e.end(s)))i.push([e.start(s),e.end(s)])}return xs(i)},Xf=function(e,n){return sS(e,function(i,s){return i-qo<=n&&s+qo>=n})},m1=function(e,n){return sS(e,function(i){return i-Eo>=n})},EM=function(e){if(e.length<2)return xs();let n=[];for(let i=1;i<e.length;i++){let s=e.end(i-1),a=e.start(i);n.push([s,a])}return xs(n)},qM=function(e,n){let i=null,s=null,a=0,r=[],l=[];if(!e||!e.length||!n||!n.length)return xs();let c=e.length;while(c--)r.push({time:e.start(c),type:"start"}),r.push({time:e.end(c),type:"end"});c=n.length;while(c--)r.push({time:n.start(c),type:"start"}),r.push({time:n.end(c),type:"end"});r.sort(function(p,m){return p.time-m.time});for(c=0;c<r.length;c++){if(r[c].type==="start"){if(a++,a===2)i=r[c].time}else if(r[c].type==="end"){if(a--,a===1)s=r[c].time}if(i!==null&&s!==null)l.push([i,s]),i=null,s=null}return xs(l)},aS=(e)=>{let n=[];if(!e||!e.length)return"";for(let i=0;i<e.length;i++)n.push(e.start(i)+" => "+e.end(i));return n.join(", ")},DM=function(e,n,i=1){return((e.length?e.end(e.length-1):0)-n)/i},rh=(e)=>{let n=[];for(let i=0;i<e.length;i++)n.push({start:e.start(i),end:e.end(i)});return n},IM=function(e,n){if(e===n)return!1;if(!e&&n||!n&&e)return!0;if(e.length!==n.length)return!0;for(let i=0;i<e.length;i++)if(e.start(i)!==n.start(i)||e.end(i)!==n.end(i))return!0;return!1},Ny=function(e){if(!e||!e.length||!e.end)return;return e.end(e.length-1)},t3=function(e,n){let i=0;if(!e||!e.length)return i;for(let s=0;s<e.length;s++){let a=e.start(s),r=e.end(s);if(n>r)continue;if(n>a&&n<=r){i+=r-n;continue}i+=r-a}return i},n3=(e,n)=>{if(!n.preload)return n.duration;let i=0;return(n.parts||[]).forEach(function(s){i+=s.duration}),(n.preloadHints||[]).forEach(function(s){if(s.type==="PART")i+=e.partTargetDuration}),i},Zy=(e)=>(e.segments||[]).reduce((n,i,s)=>{if(i.parts)i.parts.forEach(function(a,r){n.push({duration:a.duration,segmentIndex:s,partIndex:r,part:a,segment:i})});else n.push({duration:i.duration,segmentIndex:s,partIndex:null,segment:i,part:null});return n},[]),rS=(e)=>{let n=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return n&&n.parts||[]},oS=({preloadSegment:e})=>{if(!e)return;let{parts:n,preloadHints:i}=e,s=(i||[]).reduce((a,r)=>a+(r.type==="PART"?1:0),0);return s+=n&&n.length?n.length:0,s},lS=(e,n)=>{if(n.endList)return 0;if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay;let i=rS(n).length>0;if(i&&n.serverControl&&n.serverControl.partHoldBack)return n.serverControl.partHoldBack;else if(i&&n.partTargetDuration)return n.partTargetDuration*3;else if(n.serverControl&&n.serverControl.holdBack)return n.serverControl.holdBack;else if(n.targetDuration)return n.targetDuration*3;return 0},MM=function(e,n){let i=0,s=n-e.mediaSequence,a=e.segments[s];if(a){if(typeof a.start<"u")return{result:a.start,precise:!0};if(typeof a.end<"u")return{result:a.end-a.duration,precise:!0}}while(s--){if(a=e.segments[s],typeof a.end<"u")return{result:i+a.end,precise:!0};if(i+=n3(e,a),typeof a.start<"u")return{result:i+a.start,precise:!0}}return{result:i,precise:!1}},RM=function(e,n){let i=0,s,a=n-e.mediaSequence;for(;a<e.segments.length;a++){if(s=e.segments[a],typeof s.start<"u")return{result:s.start-i,precise:!0};if(i+=n3(e,s),typeof s.end<"u")return{result:s.end-i,precise:!0}}return{result:-1,precise:!1}},cS=function(e,n,i){if(typeof n>"u")n=e.mediaSequence+e.segments.length;if(n<e.mediaSequence)return 0;let s=MM(e,n);if(s.precise)return s.result;let a=RM(e,n);if(a.precise)return a.result;return s.result+i},hS=function(e,n,i){if(!e)return 0;if(typeof i!=="number")i=0;if(typeof n>"u"){if(e.totalDuration)return e.totalDuration;if(!e.endList)return qe.default.Infinity}return cS(e,n,i)},bp=function({defaultDuration:e,durationList:n,startIndex:i,endIndex:s}){let a=0;if(i>s)[i,s]=[s,i];if(i<0){for(let r=i;r<Math.min(0,s);r++)a+=e;i=0}for(let r=i;r<s;r++)a+=n[r].duration;return a},fS=function(e,n,i,s){if(!e||!e.segments)return null;if(e.endList)return hS(e);if(n===null)return null;n=n||0;let a=cS(e,e.mediaSequence+e.segments.length,n);if(i)s=typeof s==="number"?s:lS(null,e),a-=s;return Math.max(0,a)},OM=function(e,n,i){let a=n||0,r=fS(e,n,!0,i);if(r===null)return xs();if(r<a)r=a;return xs(a,r)},FM=function({playlist:e,currentTime:n,startingSegmentIndex:i,startingPartIndex:s,startTime:a,exactManifestTimings:r}){let l=n-a,c=Zy(e),p=0;for(let m=0;m<c.length;m++){let g=c[m];if(i!==g.segmentIndex)continue;if(typeof s==="number"&&typeof g.partIndex==="number"&&s!==g.partIndex)continue;p=m;break}if(l<0){if(p>0)for(let m=p-1;m>=0;m--){let g=c[m];if(l+=g.duration,r){if(l<0)continue}else if(l+Eo<=0)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:a-bp({defaultDuration:e.targetDuration,durationList:c,startIndex:p,endIndex:m})}}return{partIndex:c[0]&&c[0].partIndex||null,segmentIndex:c[0]&&c[0].segmentIndex||0,startTime:n}}if(p<0){for(let m=p;m<0;m++)if(l-=e.targetDuration,l<0)return{partIndex:c[0]&&c[0].partIndex||null,segmentIndex:c[0]&&c[0].segmentIndex||0,startTime:n};p=0}for(let m=p;m<c.length;m++){let g=c[m];l-=g.duration;let y=g.duration>Eo,x=l===0,j=y&&l+Eo>=0;if(x||j){if(m!==c.length-1)continue}if(r){if(l>0)continue}else if(l-Eo>=0)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:a+bp({defaultDuration:e.targetDuration,durationList:c,startIndex:p,endIndex:m})}}return{segmentIndex:c[c.length-1].segmentIndex,partIndex:c[c.length-1].partIndex,startTime:n}},dS=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()},i3=function(e){return e.excludeUntil&&e.excludeUntil===1/0},wb=function(e){let n=dS(e);return!e.disabled&&!n},NM=function(e){return e.disabled},PM=function(e){for(let n=0;n<e.segments.length;n++)if(e.segments[n].key)return!0;return!1},pS=function(e,n){return n.attributes&&n.attributes[e]},BM=function(e,n,i,s=0){if(!pS("BANDWIDTH",i))return NaN;return(e*i.attributes.BANDWIDTH-s*8)/n},e5=(e,n)=>{if(e.playlists.length===1)return!0;let i=n.attributes.BANDWIDTH||Number.MAX_VALUE;return e.playlists.filter((s)=>{if(!wb(s))return!1;return(s.attributes.BANDWIDTH||0)<i}).length===0},s3=(e,n)=>{if(!e&&!n||!e&&n||e&&!n)return!1;if(e===n)return!0;if(e.id&&n.id&&e.id===n.id)return!0;if(e.resolvedUri&&n.resolvedUri&&e.resolvedUri===n.resolvedUri)return!0;if(e.uri&&n.uri&&e.uri===n.uri)return!0;return!1},q8=function(e,n){let i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{},s=!1;for(let a in i){for(let r in i[a])if(s=n(i[a][r]),s)break;if(s)break}return!!s},jp=(e)=>{if(!e||!e.playlists||!e.playlists.length)return q8(e,(i)=>i.playlists&&i.playlists.length||i.uri);for(let n=0;n<e.playlists.length;n++){let i=e.playlists[n],s=i.attributes&&i.attributes.CODECS;if(s&&s.split(",").every((r)=>Gw(r)))continue;if(q8(e,(r)=>s3(i,r)))continue;return!1}return!0},Ra={liveEdgeDelay:lS,duration:hS,seekable:OM,getMediaInfoForTime:FM,isEnabled:wb,isDisabled:NM,isExcluded:dS,isIncompatible:i3,playlistEnd:fS,isAes:PM,hasAttribute:pS,estimateSegmentRequestTime:BM,isLowestEnabledRendition:e5,isAudioOnly:jp,playlistMatch:s3,segmentDurationWithParts:n3},{log:mS}=Ke,Yf=(e,n)=>`${e}-${n}`,gS=(e,n,i)=>`placeholder-uri-${e}-${n}-${i}`,LM=({onwarn:e,oninfo:n,manifestString:i,customTagParsers:s=[],customTagMappers:a=[],llhls:r})=>{let l=new Hw;if(e)l.on("warn",e);if(n)l.on("info",n);s.forEach((m)=>l.addParser(m)),a.forEach((m)=>l.addTagMapper(m)),l.push(i),l.end();let c=l.manifest;if(!r){if(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(m){if(c.hasOwnProperty(m))delete c[m]}),c.segments)c.segments.forEach(function(m){["parts","preloadHints"].forEach(function(g){if(m.hasOwnProperty(g))delete m[g]})})}if(!c.targetDuration){let m=10;if(c.segments&&c.segments.length)m=c.segments.reduce((g,y)=>Math.max(g,y.duration),0);if(e)e({message:`manifest has no targetDuration defaulting to ${m}`});c.targetDuration=m}let p=rS(c);if(p.length&&!c.partTargetDuration){let m=p.reduce((g,y)=>Math.max(g,y.duration),0);if(e)e({message:`manifest has no partTargetDuration defaulting to ${m}`}),mS.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.");c.partTargetDuration=m}return c},pd=(e,n)=>{if(!e.mediaGroups)return;["AUDIO","SUBTITLES"].forEach((i)=>{if(!e.mediaGroups[i])return;for(let s in e.mediaGroups[i])for(let a in e.mediaGroups[i][s]){let r=e.mediaGroups[i][s][a];n(r,i,s,a)}})},bS=({playlist:e,uri:n,id:i})=>{if(e.id=i,e.playlistErrors_=0,n)e.uri=n;e.attributes=e.attributes||{}},HM=(e)=>{let n=e.playlists.length;while(n--){let i=e.playlists[n];if(bS({playlist:i,id:Yf(n,i.uri)}),i.resolvedUri=Ma(e.uri,i.uri),e.playlists[i.id]=i,e.playlists[i.uri]=i,!i.attributes.BANDWIDTH)mS.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},UM=(e)=>{pd(e,(n)=>{if(n.uri)n.resolvedUri=Ma(e.uri,n.uri)})},zM=(e,n)=>{let i=Yf(0,n),s={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:qe.default.location.href,resolvedUri:qe.default.location.href,playlists:[{uri:n,id:i,resolvedUri:n,attributes:{}}]};return s.playlists[i]=s.playlists[0],s.playlists[n]=s.playlists[0],s},wS=(e,n,i=gS)=>{e.uri=n;for(let a=0;a<e.playlists.length;a++)if(!e.playlists[a].uri){let r=`placeholder-uri-${a}`;e.playlists[a].uri=r}let s=jp(e);pd(e,(a,r,l,c)=>{if(!a.playlists||!a.playlists.length){if(s&&r==="AUDIO"&&!a.uri)for(let p=0;p<e.playlists.length;p++){let m=e.playlists[p];if(m.attributes&&m.attributes.AUDIO&&m.attributes.AUDIO===l)return}a.playlists=[Ii({},a)]}a.playlists.forEach(function(p,m){let g=i(r,l,c,p),y=Yf(m,g);if(p.uri)p.resolvedUri=p.resolvedUri||Ma(e.uri,p.uri);else p.uri=m===0?g:y,p.resolvedUri=p.uri;p.id=p.id||y,p.attributes=p.attributes||{},e.playlists[p.id]=p,e.playlists[p.uri]=p})}),HM(e),UM(e)};class t5{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){if(this.offset_!==null)return;if(!e.length)return;let[n]=e;if(n.programDateTime===void 0)return;this.offset_=n.programDateTime/1000}setPendingDateRanges(e=[]){if(!e.length)return;let[n]=e,i=n.startDate.getTime();this.trimProcessedDateRanges_(i),this.pendingDateRanges_=e.reduce((s,a)=>(s.set(a.id,a),s),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];let e={},n=[];this.pendingDateRanges_.forEach((i,s)=>{if(this.processedDateRanges_.has(s))return;if(i.startTime=i.startDate.getTime()/1000-this.offset_,i.processDateRange=()=>this.processDateRange(i),n.push(i),!i.class)return;if(e[i.class]){let a=e[i.class].push(i);i.classListIndex=a-1}else e[i.class]=[i],i.classListIndex=0});for(let i of n){let s=e[i.class]||[];if(i.endDate)i.endTime=i.endDate.getTime()/1000-this.offset_;else if(i.endOnNext&&s[i.classListIndex+1])i.endTime=s[i.classListIndex+1].startTime;else if(i.duration)i.endTime=i.startTime+i.duration;else if(i.plannedDuration)i.endTime=i.startTime+i.plannedDuration;else i.endTime=i.startTime}return n}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((i,s)=>{if(i.startDate.getTime()<e)this.processedDateRanges_.delete(s)})}}var yS=22,uh=({requestType:e,request:n,error:i,parseFailure:s})=>{let a=n.status<200||n.status>299,r=n.status>=400&&n.status<=499,l={uri:n.uri,requestType:e},c=a&&!r||s;if(i&&r)l.error=Ii({},i),l.errorType=Ke.Error.NetworkRequestFailed;else if(n.aborted)l.errorType=Ke.Error.NetworkRequestAborted;else if(n.timedout)l.errorType=Ke.Error.NetworkRequestTimeout;else if(c){let p=s?Ke.Error.NetworkBodyParserFailed:Ke.Error.NetworkBadStatus;l.errorType=p,l.status=n.status,l.headers=n.headers}return l},GM=jr("CodecUtils"),vS=function(e){let n=e.attributes||{};if(n.CODECS)return Kr(n.CODECS)},SS=(e,n)=>{let i=n.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&i.AUDIO&&e.mediaGroups.AUDIO[i.AUDIO]},VM=(e,n)=>{if(!SS(e,n))return!0;let i=n.attributes||{},s=e.mediaGroups.AUDIO[i.AUDIO];for(let a in s)if(!s[a].uri&&!s[a].playlists)return!0;return!1},kp=function(e){let n={};return e.forEach(({mediaType:i,type:s,details:a})=>{n[i]=n[i]||[],n[i].push(zw(`${s}${a}`))}),Object.keys(n).forEach(function(i){if(n[i].length>1){GM(`multiple ${i} codecs found as attributes: ${n[i].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),n[i]=null;return}n[i]=n[i][0]}),n},D8=function(e){let n=0;if(e.audio)n++;if(e.video)n++;return n},wp=function(e,n){let i=n.attributes||{},s=kp(vS(n)||[]);if(SS(e,n)&&!s.audio){if(!VM(e,n)){let a=kp(A6(e,i.AUDIO)||[]);if(a.audio)s.audio=a.audio}}return s},{EventTarget:XM}=Ke,WM=(e,n)=>{if(n.endList||!n.serverControl)return e;let i={};if(n.serverControl.canBlockReload){let{preloadSegment:s}=n,a=n.mediaSequence+n.segments.length;if(s){let r=s.parts||[],l=oS(n)-1;if(l>-1&&l!==r.length-1)i._HLS_part=l;if(l>-1||r.length)a--}i._HLS_msn=a}if(n.serverControl&&n.serverControl.canSkipUntil)i._HLS_skip=n.serverControl.canSkipDateranges?"v2":"YES";if(Object.keys(i).length){let s=new qe.default.URL(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(a){if(!i.hasOwnProperty(a))return;s.searchParams.set(a,i[a])}),e=s.toString()}return e},KM=(e,n)=>{if(!e)return n;let i=Jn(e,n);if(e.preloadHints&&!n.preloadHints)delete i.preloadHints;if(e.parts&&!n.parts)delete i.parts;else if(e.parts&&n.parts){for(let s=0;s<n.parts.length;s++)if(e.parts&&e.parts[s])i.parts[s]=Jn(e.parts[s],n.parts[s])}if(!e.skipped&&n.skipped)i.skipped=!1;if(e.preload&&!n.preload)i.preload=!1;return i},$M=(e,n,i)=>{let s=e.slice(),a=n.slice();i=i||0;let r=[],l;for(let c=0;c<a.length;c++){let p=s[c+i],m=a[c];if(p)l=p.map||l,r.push(KM(p,m));else{if(l&&!m.map)m.map=l;r.push(m)}}return r},_S=(e,n)=>{if(!e.resolvedUri&&e.uri)e.resolvedUri=Ma(n,e.uri);if(e.key&&!e.key.resolvedUri)e.key.resolvedUri=Ma(n,e.key.uri);if(e.map&&!e.map.resolvedUri)e.map.resolvedUri=Ma(n,e.map.uri);if(e.map&&e.map.key&&!e.map.key.resolvedUri)e.map.key.resolvedUri=Ma(n,e.map.key.uri);if(e.parts&&e.parts.length)e.parts.forEach((i)=>{if(i.resolvedUri)return;i.resolvedUri=Ma(n,i.uri)});if(e.preloadHints&&e.preloadHints.length)e.preloadHints.forEach((i)=>{if(i.resolvedUri)return;i.resolvedUri=Ma(n,i.uri)})},xS=function(e){let n=e.segments||[],i=e.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints){for(let s=0;s<i.preloadHints.length;s++)if(i.preloadHints[s].type==="MAP")return n}i.duration=e.targetDuration,i.preload=!0,n.push(i)}return n},kS=(e,n)=>e===n||e.segments&&n.segments&&e.segments.length===n.segments.length&&e.endList===n.endList&&e.mediaSequence===n.mediaSequence&&e.preloadSegment===n.preloadSegment,n5=(e,n,i=kS)=>{let s=Jn(e,{}),a=s.playlists[n.id];if(!a)return null;if(i(a,n))return null;n.segments=xS(n);let r=Jn(a,n);if(r.preloadSegment&&!n.preloadSegment)delete r.preloadSegment;if(a.segments){if(n.skip){n.segments=n.segments||[];for(let l=0;l<n.skip.skippedSegments;l++)n.segments.unshift({skipped:!0})}r.segments=$M(a.segments,n.segments,n.mediaSequence-a.mediaSequence)}r.segments.forEach((l)=>{_S(l,r.resolvedUri)});for(let l=0;l<s.playlists.length;l++)if(s.playlists[l].id===n.id)s.playlists[l]=r;return s.playlists[n.id]=r,s.playlists[n.uri]=r,pd(e,(l,c,p,m)=>{if(!l.playlists)return;for(let g=0;g<l.playlists.length;g++)if(n.id===l.playlists[g].id)l.playlists[g]=r}),s},i5=(e,n)=>{let i=e.segments||[],s=i[i.length-1],a=s&&s.parts&&s.parts[s.parts.length-1],r=a&&a.duration||s&&s.duration;if(n&&r)return r*1000;return(e.partTargetDuration||e.targetDuration||10)*500},I8=(e,n,i)=>{if(!e)return;let s=[];return e.forEach((a)=>{if(!a.attributes)return;let{BANDWIDTH:r,RESOLUTION:l,CODECS:c}=a.attributes;s.push({id:a.id,bandwidth:r,resolution:l,codecs:c})}),{type:n,isLive:i,renditions:s}};class oh extends XM{constructor(e,n,i={}){super();if(!e)throw Error("A non-empty playlist URL or object is required");this.logger_=jr("PlaylistLoader");let{withCredentials:s=!1}=i;this.src=e,this.vhs_=n,this.withCredentials=s,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack;let a=n.options_;this.customTagParsers=a&&a.customTagParsers||[],this.customTagMappers=a&&a.customTagMappers||[],this.llhls=a&&a.llhls,this.dateRangesStorage_=new t5,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){let e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);let n=this.dateRangesStorage_.getDateRangesToProcess();if(!n.length||!this.addDateRangesToTextTrack_)return;this.addDateRangesToTextTrack_(n)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;let e=this.media(),n=Ma(this.main.uri,e.uri);if(this.llhls)n=WM(n,e);this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:n,withCredentials:this.withCredentials,requestType:"hls-playlist"},(i,s)=>{if(!this.request)return;if(i)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})})}playlistRequestError(e,n,i){let{uri:s,id:a}=n;if(this.request=null,i)this.state=i;this.error={playlist:this.main.playlists[a],status:e.status,message:`HLS playlist request error at URL: ${s}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:uh({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:n}){try{let i=LM({onwarn:({message:s})=>this.logger_(`m3u8-parser warn for ${e}: ${s}`),oninfo:({message:s})=>this.logger_(`m3u8-parser info for ${e}: ${s}`),manifestString:n,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls});if(!i.playlists||!i.playlists.length)return i;return this.excludeAudioOnlyVariants(i.playlists),i}catch(i){this.error=i,this.error.metadata={errorType:Ke.Error.StreamingHlsPlaylistParserError,error:i}}}excludeAudioOnlyVariants(e){let n=(i)=>{let s=i.attributes||{},{width:a,height:r}=s.RESOLUTION||{};if(a&&r)return!0;let l=vS(i)||[],c=kp(l);return Boolean(c.video)};if(e.some(n))e.forEach((i)=>{if(!n(i))i.excludeUntil=1/0})}haveMetadata({playlistString:e,playlistObject:n,url:i,id:s}){this.request=null,this.state="HAVE_METADATA";let a={playlistInfo:{type:"media",uri:i}};this.trigger({type:"playlistparsestart",metadata:a});let r=n||this.parseManifest_({url:i,manifestString:e});r.lastRequest=Date.now(),bS({playlist:r,uri:i,id:s});let l=n5(this.main,r);if(this.targetDuration=r.partTargetDuration||r.targetDuration,this.pendingMedia_=null,l)this.main=l,this.media_=this.main.playlists[s];else this.trigger("playlistunchanged");this.updateMediaUpdateTimeout_(i5(this.media(),!!l)),a.parsedPlaylist=I8(this.main.playlists,a.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:a}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),qe.default.clearTimeout(this.mediaUpdateTimeout),qe.default.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new t5,this.off()}stopRequest(){if(this.request){let e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,n){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw Error("Cannot switch media playlist from "+this.state);if(typeof e==="string"){if(!this.main.playlists[e])throw Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(qe.default.clearTimeout(this.finalRenditionTimeout),n){let l=(e.partTargetDuration||e.targetDuration)/2*1000||5000;this.finalRenditionTimeout=qe.default.setTimeout(this.media.bind(this,e,!1),l);return}let i=this.state,s=!this.media_||e.id!==this.media_.id,a=this.main.playlists[e.id];if(a&&a.endList||e.endList&&e.segments.length){if(this.request)this.request.onreadystatechange=null,this.request.abort(),this.request=null;if(this.state="HAVE_METADATA",this.media_=e,s)if(this.trigger("mediachanging"),i==="HAVE_MAIN_MANIFEST")this.trigger("loadedmetadata");else this.trigger("mediachange");return}if(this.updateMediaUpdateTimeout_(i5(e,!0)),!s)return;if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}if(this.media_)this.trigger("mediachanging");this.pendingMedia_=e;let r={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:r}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(l,c)=>{if(!this.request)return;if(e.lastRequest=Date.now(),e.resolvedUri=F1(e.resolvedUri,c),l)return this.playlistRequestError(this.request,e,i);if(this.trigger({type:"playlistrequestcomplete",metadata:r}),this.haveMetadata({playlistString:c.responseText,url:e.uri,id:e.id}),i==="HAVE_MAIN_MANIFEST")this.trigger("loadedmetadata");else this.trigger("mediachange")})}pause(){if(this.mediaUpdateTimeout)qe.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;if(this.stopRequest(),this.state==="HAVE_NOTHING")this.started=!1;if(this.state==="SWITCHING_MEDIA")if(this.media_)this.state="HAVE_METADATA";else this.state="HAVE_MAIN_MANIFEST";else if(this.state==="HAVE_CURRENT_METADATA")this.state="HAVE_METADATA"}load(e){if(this.mediaUpdateTimeout)qe.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;let n=this.media();if(e){let i=n?(n.partTargetDuration||n.targetDuration)/2*1000:5000;this.mediaUpdateTimeout=qe.default.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},i);return}if(!this.started){this.start();return}if(n&&!n.endList)this.trigger("mediaupdatetimeout");else this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){if(this.mediaUpdateTimeout)qe.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;if(!this.media()||this.media().endList)return;this.mediaUpdateTimeout=qe.default.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e)}start(){if(this.started=!0,typeof this.src==="object"){if(!this.src.uri)this.src.uri=qe.default.location.href;this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}let e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(n,i)=>{if(!this.request)return;if(this.request=null,n){if(this.error={status:i.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:i.responseText,code:2,metadata:uh({requestType:i.requestType,request:i,error:n})},this.state==="HAVE_NOTHING")this.started=!1;return this.trigger("error")}this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=F1(this.src,i),this.trigger({type:"playlistparsestart",metadata:e});let s=this.parseManifest_({manifestString:i.responseText,url:this.src});e.parsedPlaylist=I8(s.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(s)})}srcUri(){return typeof this.src==="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){if(this.main=e,wS(this.main,this.srcUri()),e.playlists.forEach((i)=>{i.segments=xS(i),i.segments.forEach((s)=>{_S(s,i.resolvedUri)})}),this.trigger("loadedplaylist"),!this.request)this.media(this.main.playlists[0]);return}let n=this.srcUri()||qe.default.location.href;this.main=zM(e,n),this.haveMetadata({playlistObject:e,url:n,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,n){let i=this.main,s=e.ID,a=i.playlists.length;while(a--){let r=i.playlists[a];if(r.attributes["PATHWAY-ID"]===s){let{resolvedUri:l,id:c}=r;if(n){let p=this.createCloneURI_(r.resolvedUri,e),m=Yf(s,p),g=this.createCloneAttributes_(s,r.attributes),y=this.createClonePlaylist_(r,m,e,g);i.playlists[a]=y,i.playlists[m]=y,i.playlists[p]=y}else i.playlists.splice(a,1);delete i.playlists[c],delete i.playlists[l]}}this.updateOrDeleteCloneMedia(e,n)}updateOrDeleteCloneMedia(e,n){let i=this.main,s=e.ID;if(["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((a)=>{if(!i.mediaGroups[a]||!i.mediaGroups[a][s])return;for(let r in i.mediaGroups[a])if(r===s){for(let l in i.mediaGroups[a][r])i.mediaGroups[a][r][l].playlists.forEach((p,m)=>{let g=i.playlists[p.id],{id:y,resolvedUri:x}=g;delete i.playlists[y],delete i.playlists[x]});delete i.mediaGroups[a][r]}}),n)this.createClonedMediaGroups_(e)}addClonePathway(e,n={}){let i=this.main,s=i.playlists.length,a=this.createCloneURI_(n.resolvedUri,e),r=Yf(e.ID,a),l=this.createCloneAttributes_(e.ID,n.attributes),c=this.createClonePlaylist_(n,r,e,l);i.playlists[s]=c,i.playlists[r]=c,i.playlists[a]=c,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){let n=e.ID,i=e["BASE-ID"],s=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((a)=>{if(!s.mediaGroups[a]||s.mediaGroups[a][n])return;for(let r in s.mediaGroups[a]){if(r===i)s.mediaGroups[a][n]={};else continue;for(let l in s.mediaGroups[a][r]){let c=s.mediaGroups[a][r][l];s.mediaGroups[a][n][l]=Ii({},c);let p=s.mediaGroups[a][n][l],m=this.createCloneURI_(c.resolvedUri,e);p.resolvedUri=m,p.uri=m,p.playlists=[],c.playlists.forEach((g,y)=>{let x=s.playlists[g.id],j=gS(a,n,l),I=Yf(n,j);if(x&&!s.playlists[I]){let P=this.createClonePlaylist_(x,I,e),X=P.resolvedUri;s.playlists[I]=P,s.playlists[X]=P}p.playlists[y]=this.createClonePlaylist_(g,I,e)})}}})}createClonePlaylist_(e,n,i,s){let a=this.createCloneURI_(e.resolvedUri,i),r={resolvedUri:a,uri:a,id:n};if(e.segments)r.segments=[];if(s)r.attributes=s;return Jn(e,r)}createCloneURI_(e,n){let i=new URL(e);i.hostname=n["URI-REPLACEMENT"].HOST;let s=n["URI-REPLACEMENT"].PARAMS;for(let a of Object.keys(s))i.searchParams.set(a,s[a]);return i.href}createCloneAttributes_(e,n){let i={["PATHWAY-ID"]:e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((s)=>{if(n[s])i[s]=e}),i}getKeyIdSet(e){let n=new Set;if(!e||!e.contentProtection)return n;for(let i in e.contentProtection)if(e.contentProtection[i]&&e.contentProtection[i].attributes&&e.contentProtection[i].attributes.keyId){let s=e.contentProtection[i].attributes.keyId;n.add(s.toLowerCase())}return n}}var s5=function(e,n,i,s){let a=e.responseType==="arraybuffer"?e.response:e.responseText;if(!n&&a){if(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=a.byteLength||a.length,!e.bandwidth)e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1000)}if(i.headers)e.responseHeaders=i.headers;if(n&&n.code==="ETIMEDOUT")e.timedout=!0;if(!n&&!e.aborted&&i.statusCode!==200&&i.statusCode!==206&&i.statusCode!==0)n=Error("XHR Failed with a response of: "+(e&&(a||e.responseText)));s(n,e)},YM=(e,n)=>{if(!e||!e.size)return;let i=n;return e.forEach((s)=>{i=s(i)}),i},QM=(e,n,i,s)=>{if(!e||!e.size)return;e.forEach((a)=>{a(n,i,s)})},TS=function(){let e=function n(i,s){i=Jn({timeout:45000},i);let a=n.beforeRequest||Ke.Vhs.xhr.beforeRequest,r=n._requestCallbackSet||Ke.Vhs.xhr._requestCallbackSet||new Set,l=n._responseCallbackSet||Ke.Vhs.xhr._responseCallbackSet;if(a&&typeof a==="function")Ke.log.warn("beforeRequest is deprecated, use onRequest instead."),r.add(a);let c=Ke.Vhs.xhr.original===!0?Ke.xhr:Ke.Vhs.xhr,p=YM(r,i);r.delete(a);let m=c(p||i,function(y,x){return QM(l,m,y,x),s5(m,y,x,s)}),g=m.abort;return m.abort=function(){return m.aborted=!0,g.apply(m,arguments)},m.uri=i.uri,m.requestType=i.requestType,m.requestTime=Date.now(),m};return e.original=!0,e},JM=function(e){let n,i=e.offset;if(typeof e.offset==="bigint"||typeof e.length==="bigint")n=qe.default.BigInt(e.offset)+qe.default.BigInt(e.length)-qe.default.BigInt(1);else n=e.offset+e.length-1;return"bytes="+i+"-"+n},a5=function(e){let n={};if(e.byterange)n.Range=JM(e.byterange);return n},ZM=function(e,n){return e.start(n)+"-"+e.end(n)},eR=function(e,n){let i=e.toString(16);return"00".substring(0,2-i.length)+i+(n%2?" ":"")},tR=function(e){if(e>=32&&e<126)return String.fromCharCode(e);return"."},AS=function(e){let n={};return Object.keys(e).forEach((i)=>{let s=e[i];if(Kw(s))n[i]={bytes:s.buffer,byteOffset:s.byteOffset,byteLength:s.byteLength};else n[i]=s}),n},N1=function(e){let n=e.byterange||{length:1/0,offset:0};return[n.length,n.offset,e.resolvedUri].join(",")},CS=function(e){return e.resolvedUri},jS=(e)=>{let n=Array.prototype.slice.call(e),i=16,s="",a,r;for(let l=0;l<n.length/16;l++)a=n.slice(l*16,l*16+16).map(eR).join(""),r=n.slice(l*16,l*16+16).map(tR).join(""),s+=a+" "+r+`
|
|
194
|
+
`;return s},nR=({bytes:e})=>jS(e),iR=(e)=>{let n="",i;for(i=0;i<e.length;i++)n+=ZM(e,i)+" ";return n},sR=Object.freeze({__proto__:null,createTransferableMessage:AS,initSegmentId:N1,segmentKeyId:CS,hexDump:jS,tagDump:nR,textRanges:iR}),ES=0.25,aR=(e,n)=>{if(!n.dateTimeObject)return null;let i=n.videoTimingInfo.transmuxerPrependedSeconds,a=n.videoTimingInfo.transmuxedPresentationStart+i,r=e-a;return new Date(n.dateTimeObject.getTime()+r*1000)},rR=(e)=>e.transmuxedPresentationEnd-e.transmuxedPresentationStart-e.transmuxerPrependedSeconds,oR=(e,n)=>{let i;try{i=new Date(e)}catch(p){return null}if(!n||!n.segments||n.segments.length===0)return null;let s=n.segments[0];if(i<new Date(s.dateTimeObject))return null;for(let p=0;p<n.segments.length-1;p++){s=n.segments[p];let m=new Date(n.segments[p+1].dateTimeObject);if(i<m)break}let a=n.segments[n.segments.length-1],r=a.dateTimeObject,l=a.videoTimingInfo?rR(a.videoTimingInfo):a.duration+a.duration*ES,c=new Date(r.getTime()+l*1000);if(i>c)return null;if(i>new Date(r))s=a;return{segment:s,estimatedStart:s.videoTimingInfo?s.videoTimingInfo.transmuxedPresentationStart:Ra.duration(n,n.mediaSequence+n.segments.indexOf(s)),type:s.videoTimingInfo?"accurate":"estimate"}},lR=(e,n)=>{if(!n||!n.segments||n.segments.length===0)return null;let i=0,s;for(let r=0;r<n.segments.length;r++)if(s=n.segments[r],i=s.videoTimingInfo?s.videoTimingInfo.transmuxedPresentationEnd:i+s.duration,e<=i)break;let a=n.segments[n.segments.length-1];if(a.videoTimingInfo&&a.videoTimingInfo.transmuxedPresentationEnd<e)return null;if(e>i){if(e>i+a.duration*ES)return null;s=a}return{segment:s,estimatedStart:s.videoTimingInfo?s.videoTimingInfo.transmuxedPresentationStart:i-s.duration,type:s.videoTimingInfo?"accurate":"estimate"}},cR=(e,n)=>{let i,s;try{i=new Date(e),s=new Date(n)}catch(l){}let a=i.getTime();return(s.getTime()-a)/1000},uR=(e)=>{if(!e.segments||e.segments.length===0)return!1;for(let n=0;n<e.segments.length;n++)if(!e.segments[n].dateTimeObject)return!1;return!0},hR=({playlist:e,time:n=void 0,callback:i})=>{if(!i)throw Error("getProgramTime: callback must be provided");if(!e||n===void 0)return i({message:"getProgramTime: playlist and time must be provided"});let s=lR(n,e);if(!s)return i({message:"valid programTime was not found"});if(s.type==="estimate")return i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:s.estimatedStart});let a={mediaSeconds:n},r=aR(n,s.segment);if(r)a.programDateTime=r.toISOString();return i(null,a)},qS=({programTime:e,playlist:n,retryCount:i=2,seekTo:s,pauseAfterSeek:a=!0,tech:r,callback:l})=>{if(!l)throw Error("seekToProgramTime: callback must be provided");if(typeof e>"u"||!n||!s)return l({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!n.endList&&!r.hasStarted_)return l({message:"player must be playing a live stream to start buffering"});if(!uR(n))return l({message:"programDateTime tags must be provided in the manifest "+n.resolvedUri});let c=oR(e,n);if(!c)return l({message:`${e} was not found in the stream`});let p=c.segment,m=cR(p.dateTimeObject,e);if(c.type==="estimate"){if(i===0)return l({message:`${e} is not buffered yet. Try again`});s(c.estimatedStart+m),r.one("seeked",()=>{qS({programTime:e,playlist:n,retryCount:i-1,seekTo:s,pauseAfterSeek:a,tech:r,callback:l})});return}let g=p.start+m,y=()=>l(null,r.currentTime());if(r.one("seeked",y),a)r.pause();s(g)},Py=(e,n)=>{if(e.readyState===4)return n();return},fR=(e,n,i,s)=>{let a=[],r,l=!1,c=function(y,x,j,I){return x.abort(),l=!0,i(y,x,j,I)},p=function(y,x){if(l)return;if(y)return y.metadata=uh({requestType:s,request:x,error:y}),c(y,x,"",a);let j=x.responseText.substring(a&&a.byteLength||0,x.responseText.length);if(a=q6(a,Qg(j,!0)),r=r||nh(a),a.length<10||r&&a.length<r+2)return Py(x,()=>c(y,x,"",a));let I=f1(a);if(I==="ts"&&a.length<188)return Py(x,()=>c(y,x,"",a));if(!I&&a.length<376)return Py(x,()=>c(y,x,"",a));return c(null,x,I,a)},g=n({uri:e,beforeSend(y){y.overrideMimeType("text/plain; charset=x-user-defined"),y.addEventListener("progress",function({total:x,loaded:j}){return s5(y,null,{statusCode:y.status},p)})}},function(y,x){return s5(g,y,x,p)});return g},{EventTarget:dR}=Ke,M8=function(e,n){if(!kS(e,n))return!1;if(e.sidx&&n.sidx&&(e.sidx.offset!==n.sidx.offset||e.sidx.length!==n.sidx.length))return!1;else if(!e.sidx&&n.sidx||e.sidx&&!n.sidx)return!1;if(e.segments&&!n.segments||!e.segments&&n.segments)return!1;if(!e.segments&&!n.segments)return!0;for(let i=0;i<e.segments.length;i++){let s=e.segments[i],a=n.segments[i];if(s.uri!==a.uri)return!1;if(!s.byterange&&!a.byterange)continue;let r=s.byterange,l=a.byterange;if(r&&!l||!r&&l)return!1;if(r.offset!==l.offset||r.length!==l.length)return!1}return!0},pR=(e,n,i,s)=>{let a=s.attributes.NAME||i;return`placeholder-uri-${e}-${n}-${a}`},mR=({mainXml:e,srcUrl:n,clientOffset:i,sidxMapping:s,previousManifest:a})=>{let r=Ov(e,{manifestUri:n,clientOffset:i,sidxMapping:s,previousManifest:a});return wS(r,n,pR),r},gR=(e,n)=>{pd(e,(i,s,a,r)=>{if(!n.mediaGroups[s][a]||!(r in n.mediaGroups[s][a]))delete e.mediaGroups[s][a][r]})},bR=(e,n,i)=>{let s=!0,a=Jn(e,{duration:n.duration,minimumUpdatePeriod:n.minimumUpdatePeriod,timelineStarts:n.timelineStarts});for(let r=0;r<n.playlists.length;r++){let l=n.playlists[r];if(l.sidx){let p=rp(l.sidx);if(i&&i[p]&&i[p].sidx)c1(l,i[p].sidx,l.sidx.resolvedUri)}let c=n5(a,l,M8);if(c)a=c,s=!1}if(pd(n,(r,l,c,p)=>{if(r.playlists&&r.playlists.length){let m=r.playlists[0].id,g=n5(a,r.playlists[0],M8);if(g){if(a=g,!(p in a.mediaGroups[l][c]))a.mediaGroups[l][c][p]=r;a.mediaGroups[l][c][p].playlists[0]=a.playlists[m],s=!1}}}),gR(a,n),n.minimumUpdatePeriod!==e.minimumUpdatePeriod)s=!1;if(s)return null;return a},wR=(e,n)=>(Boolean(!e.map&&!n.map)||Boolean(e.map&&n.map&&e.map.byterange.offset===n.map.byterange.offset&&e.map.byterange.length===n.map.byterange.length))&&e.uri===n.uri&&e.byterange.offset===n.byterange.offset&&e.byterange.length===n.byterange.length,R8=(e,n)=>{let i={};for(let s in e){let r=e[s].sidx;if(r){let l=rp(r);if(!n[l])break;let c=n[l].sidxInfo;if(wR(c,r))i[l]=n[l]}}return i},yR=(e,n)=>{let s=R8(e.playlists,n);return pd(e,(a,r,l,c)=>{if(a.playlists&&a.playlists.length){let p=a.playlists;s=Jn(s,R8(p,n))}}),s};class P1 extends dR{constructor(e,n,i={},s){super();if(this.isPaused_=!0,this.mainPlaylistLoader_=s||this,!s)this.isMain_=!0;let{withCredentials:a=!1}=i;if(this.vhs_=n,this.withCredentials=a,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw Error("A non-empty playlist URL or object is required");if(this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=jr("DashPlaylistLoader"),this.isMain_)this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={};else this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,n,i){if(!this.request)return!0;if(this.request=null,e){if(this.error=typeof e==="object"&&!(e instanceof Error)?e:{status:n.status,message:"DASH request error at URL: "+n.uri,response:n.response,code:2,metadata:e.metadata},i)this.state=i;return this.trigger("error"),!0}}addSidxSegments_(e,n,i){let s=e.sidx&&rp(e.sidx);if(!e.sidx||!s||this.mainPlaylistLoader_.sidxMapping_[s]){qe.default.clearTimeout(this.mediaRequest_),this.mediaRequest_=qe.default.setTimeout(()=>i(!1),0);return}let a=F1(e.sidx.resolvedUri),r=(c,p)=>{if(this.requestErrored_(c,p,n))return;let m=this.mainPlaylistLoader_.sidxMapping_,{requestType:g}=p,y;try{y=K8.default(Vt(p.response).subarray(8))}catch(x){x.metadata=uh({requestType:g,request:p,parseFailure:!0}),this.requestErrored_(x,p,n);return}return m[s]={sidxInfo:e.sidx,sidx:y},c1(e,y,e.sidx.resolvedUri),i(!0)},l="dash-sidx";this.request=fR(a,this.vhs_.xhr,(c,p,m,g)=>{if(c)return r(c,p);if(!m||m!=="mp4"){let j=m||"unknown";return r({status:p.status,message:`Unsupported ${j} container type for sidx segment at URL: ${a}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},p)}let{offset:y,length:x}=e.sidx.byterange;if(g.length>=x+y)return r(c,{response:g.subarray(y,y+x),status:p.status,uri:p.uri});this.request=this.vhs_.xhr({uri:a,responseType:"arraybuffer",requestType:"dash-sidx",headers:a5({byterange:e.sidx.byterange})},r)},l)}dispose(){if(this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},qe.default.clearTimeout(this.minimumUpdatePeriodTimeout_),qe.default.clearTimeout(this.mediaRequest_),qe.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_)this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null;this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){let e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw Error("Cannot switch media playlist from "+this.state);let n=this.state;if(typeof e==="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}let i=!this.media_||e.id!==this.media_.id;if(i&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){if(this.state="HAVE_METADATA",this.media_=e,i)this.trigger("mediachanging"),this.trigger("mediachange");return}if(!i)return;if(this.media_)this.trigger("mediachanging");this.addSidxSegments_(e,n,(s)=>{this.haveMetadata({startingState:n,playlist:e})})}haveMetadata({startingState:e,playlist:n}){if(this.state="HAVE_METADATA",this.loadedPlaylists_[n.id]=n,qe.default.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(n.id),e==="HAVE_MAIN_MANIFEST")this.trigger("loadedmetadata");else this.trigger("mediachange")}pause(){if(this.isPaused_=!0,this.mainPlaylistLoader_.createMupOnMedia_)this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null;if(this.stopRequest(),qe.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_)qe.default.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null;if(this.state==="HAVE_NOTHING")this.started=!1}load(e){this.isPaused_=!1,qe.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;let n=this.media();if(e){let i=n?n.targetDuration/2*1000:5000;this.mediaUpdateTimeout=qe.default.setTimeout(()=>this.load(),i);return}if(!this.started){this.start();return}if(n&&!n.endList){if(this.isMain_&&!this.minimumUpdatePeriodTimeout_)this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_();this.trigger("mediaupdatetimeout")}else this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){qe.default.clearTimeout(this.mediaRequest_),this.mediaRequest_=qe.default.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,n)=>{if(this.haveMain_(),!this.hasPendingRequest()&&!this.media_)this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){let n={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:n}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(i,s)=>{if(i){let{requestType:r}=s;i.metadata=uh({requestType:r,request:s,error:i})}if(this.requestErrored_(i,s)){if(this.state==="HAVE_NOTHING")this.started=!1;return}this.trigger({type:"manifestrequestcomplete",metadata:n});let a=s.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=s.responseText,s.responseHeaders&&s.responseHeaders.date)this.mainLoaded_=Date.parse(s.responseHeaders.date);else this.mainLoaded_=Date.now();if(this.mainPlaylistLoader_.srcUrl=F1(this.mainPlaylistLoader_.srcUrl,s),a){this.handleMain_(),this.syncClientServerClock_(()=>e(s,a));return}return e(s,a)})}syncClientServerClock_(e){let n=Fv(this.mainPlaylistLoader_.mainXml_);if(n===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(n.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=n.value-Date.now(),e();this.request=this.vhs_.xhr({uri:Ma(this.mainPlaylistLoader_.srcUrl,n.value),method:n.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(i,s)=>{if(!this.request)return;if(i){let{requestType:r}=s;return this.error.metadata=uh({requestType:r,request:s,error:i}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let a;if(n.method==="HEAD")if(!s.responseHeaders||!s.responseHeaders.date)a=this.mainLoaded_;else a=Date.parse(s.responseHeaders.date);else a=Date.parse(s.responseText);this.mainPlaylistLoader_.clientOffset_=a-Date.now(),e()})}haveMain_(){if(this.state="HAVE_MAIN_MANIFEST",this.isMain_)this.trigger("loadedplaylist");else if(!this.media_)this.media(this.childPlaylist_)}handleMain_(){qe.default.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;let e=this.mainPlaylistLoader_.main,n={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:n});let i;try{i=mR({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(a){this.error=a,this.error.metadata={errorType:Ke.Error.StreamingDashManifestParserError,error:a},this.trigger("error")}if(e)i=bR(e,i,this.mainPlaylistLoader_.sidxMapping_);this.mainPlaylistLoader_.main=i?i:e;let s=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(s&&s!==this.mainPlaylistLoader_.srcUrl)this.mainPlaylistLoader_.srcUrl=s;if(!e||i&&i.minimumUpdatePeriod!==e.minimumUpdatePeriod)this.updateMinimumUpdatePeriodTimeout_();if(this.addEventStreamToMetadataTrack_(i),i){let{duration:a,endList:r}=i,l=[];i.playlists.forEach((p)=>{l.push({id:p.id,bandwidth:p.attributes.BANDWIDTH,resolution:p.attributes.RESOLUTION,codecs:p.attributes.CODECS})});let c={duration:a,isLive:!r,renditions:l};n.parsedManifest=c,this.trigger({type:"manifestparsecomplete",metadata:n})}return Boolean(i)}updateMinimumUpdatePeriodTimeout_(){let e=this.mainPlaylistLoader_;if(e.createMupOnMedia_)e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null;if(e.minimumUpdatePeriodTimeout_)qe.default.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null;let n=e.main&&e.main.minimumUpdatePeriod;if(n===0)if(e.media())n=e.media().targetDuration*1000;else e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_);if(typeof n!=="number"||n<=0){if(n<0)this.logger_(`found invalid minimumUpdatePeriod of ${n}, not setting a timeout`);return}this.createMUPTimeout_(n)}createMUPTimeout_(e){let n=this.mainPlaylistLoader_;n.minimumUpdatePeriodTimeout_=qe.default.setTimeout(()=>{n.minimumUpdatePeriodTimeout_=null,n.trigger("minimumUpdatePeriod"),n.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,n)=>{if(!n)return;if(this.media_)this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id];this.mainPlaylistLoader_.sidxMapping_=yR(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,(i)=>{this.refreshMedia_(this.media().id)})})}refreshMedia_(e){if(!e)throw Error("refreshMedia_ must take a media id");if(this.media_&&this.isMain_)this.handleMain_();let n=this.mainPlaylistLoader_.main.playlists,i=!this.media_||this.media_!==n[e];if(i)this.media_=n[e];else this.trigger("playlistunchanged");if(!this.mediaUpdateTimeout){let s=()=>{if(this.media().endList)return;this.mediaUpdateTimeout=qe.default.setTimeout(()=>{this.trigger("mediaupdatetimeout"),s()},i5(this.media(),Boolean(i)))};s()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){let n=this.mainPlaylistLoader_.main.eventStream.map((i)=>({cueTime:i.start,frames:[{data:i.messageData}]}));this.addMetadataToTextTrack("EventStream",n,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){let n=new Set;for(let i in e.contentProtection){let s=e.contentProtection[i].attributes["cenc:default_KID"];if(s)n.add(s.replace(/-/g,"").toLowerCase())}return n}}}var _s={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30},vR=(e)=>{let n=new Uint8Array(new ArrayBuffer(e.length));for(let i=0;i<e.length;i++)n[i]=e.charCodeAt(i);return n.buffer},DS=function(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e},SR=function(e){try{return URL.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch(n){let i=new BlobBuilder;return i.append(e),URL.createObjectURL(i.getBlob())}},IS=function(e){return function(){let n=SR(e),i=DS(new Worker(n));i.objURL=n;let s=i.terminate;return i.on=i.addEventListener,i.off=i.removeEventListener,i.terminate=function(){return URL.revokeObjectURL(n),s.call(this)},i}},RS=function(e){return`var browserWorkerPolyFill = ${DS.toString()};
|
|
195
|
+
browserWorkerPolyFill(self);
|
|
196
|
+
`+e},OS=function(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)},_R=RS(OS(function(){var e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=function(){this.init=function(){var _={};this.on=function(M,R){if(!_[M])_[M]=[];_[M]=_[M].concat(R)},this.off=function(M,R){var F;if(!_[M])return!1;return F=_[M].indexOf(R),_[M]=_[M].slice(),_[M].splice(F,1),F>-1},this.trigger=function(M){var R,F,Q,te;if(R=_[M],!R)return;if(arguments.length===2){Q=R.length;for(F=0;F<Q;++F)R[F].call(this,arguments[1])}else{te=[],F=arguments.length;for(F=1;F<arguments.length;++F)te.push(arguments[F]);Q=R.length;for(F=0;F<Q;++F)R[F].apply(this,te)}},this.dispose=function(){_={}}}};n.prototype.pipe=function(_){return this.on("data",function(M){_.push(M)}),this.on("done",function(M){_.flush(M)}),this.on("partialdone",function(M){_.partialFlush(M)}),this.on("endedtimeline",function(M){_.endTimeline(M)}),this.on("reset",function(M){_.reset(M)}),_},n.prototype.push=function(_){this.trigger("data",_)},n.prototype.flush=function(_){this.trigger("done",_)},n.prototype.partialFlush=function(_){this.trigger("partialdone",_)},n.prototype.endTimeline=function(_){this.trigger("endedtimeline",_)},n.prototype.reset=function(_){this.trigger("reset",_)};var i=n,s=Math.pow(2,32),a=function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength),R;if(M.getBigUint64){if(R=M.getBigUint64(0),R<Number.MAX_SAFE_INTEGER)return Number(R);return R}return M.getUint32(0)*s+M.getUint32(4)},r={getUint64:a,MAX_UINT32:s},l=r.MAX_UINT32,c,p,m,g,y,x,j,I,P,X,Y,J,ne,ae,se,oe,he,we,Ce,Ne,Pe,Ue,ze,He,De,Fe,bt,Ve,$e,Ct,ct,Ze,mt,Xt,hn,nn;(function(){var _;if(ze={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},typeof Uint8Array>"u")return;for(_ in ze)if(ze.hasOwnProperty(_))ze[_]=[_.charCodeAt(0),_.charCodeAt(1),_.charCodeAt(2),_.charCodeAt(3)];He=new Uint8Array([105,115,111,109]),Fe=new Uint8Array([97,118,99,49]),De=new Uint8Array([0,0,0,1]),bt=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),Ve=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),$e={video:bt,audio:Ve},Ze=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),ct=new Uint8Array([0,0,0,0,0,0,0,0]),mt=new Uint8Array([0,0,0,0,0,0,0,0]),Xt=mt,hn=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),nn=mt,Ct=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])})(),c=function(_){var M=[],R=0,F,Q,te;for(F=1;F<arguments.length;F++)M.push(arguments[F]);F=M.length;while(F--)R+=M[F].byteLength;Q=new Uint8Array(R+8),te=new DataView(Q.buffer,Q.byteOffset,Q.byteLength),te.setUint32(0,Q.byteLength),Q.set(_,4);for(F=0,R=8;F<M.length;F++)Q.set(M[F],R),R+=M[F].byteLength;return Q},p=function(){return c(ze.dinf,c(ze.dref,Ze))},m=function(_){return c(ze.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,_.audioobjecttype<<3|_.samplingfrequencyindex>>>1,_.samplingfrequencyindex<<7|_.channelcount<<3,6,1,2]))},g=function(){return c(ze.ftyp,He,De,He,Fe)},oe=function(_){return c(ze.hdlr,$e[_])},y=function(_){return c(ze.mdat,_)},se=function(_){var M=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,_.duration>>>24&255,_.duration>>>16&255,_.duration>>>8&255,_.duration&255,85,196,0,0]);if(_.samplerate)M[12]=_.samplerate>>>24&255,M[13]=_.samplerate>>>16&255,M[14]=_.samplerate>>>8&255,M[15]=_.samplerate&255;return c(ze.mdhd,M)},ae=function(_){return c(ze.mdia,se(_),oe(_.type),j(_))},x=function(_){return c(ze.mfhd,new Uint8Array([0,0,0,0,(_&4278190080)>>24,(_&16711680)>>16,(_&65280)>>8,_&255]))},j=function(_){return c(ze.minf,_.type==="video"?c(ze.vmhd,Ct):c(ze.smhd,ct),p(),we(_))},I=function(_,M){var R=[],F=M.length;while(F--)R[F]=Ne(M[F]);return c.apply(null,[ze.moof,x(_)].concat(R))},P=function(_){var M=_.length,R=[];while(M--)R[M]=J(_[M]);return c.apply(null,[ze.moov,Y(4294967295)].concat(R).concat(X(_)))},X=function(_){var M=_.length,R=[];while(M--)R[M]=Pe(_[M]);return c.apply(null,[ze.mvex].concat(R))},Y=function(_){var M=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(_&4278190080)>>24,(_&16711680)>>16,(_&65280)>>8,_&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return c(ze.mvhd,M)},he=function(_){var M=_.samples||[],R=new Uint8Array(4+M.length),F,Q;for(Q=0;Q<M.length;Q++)F=M[Q].flags,R[Q+4]=F.dependsOn<<4|F.isDependedOn<<2|F.hasRedundancy;return c(ze.sdtp,R)},we=function(_){return c(ze.stbl,Ce(_),c(ze.stts,nn),c(ze.stsc,Xt),c(ze.stsz,hn),c(ze.stco,mt))},function(){var _,M;Ce=function(R){return c(ze.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),R.type==="video"?_(R):M(R))},_=function(R){var F=R.sps||[],Q=R.pps||[],te=[],ce=[],Se,xe;for(Se=0;Se<F.length;Se++)te.push((F[Se].byteLength&65280)>>>8),te.push(F[Se].byteLength&255),te=te.concat(Array.prototype.slice.call(F[Se]));for(Se=0;Se<Q.length;Se++)ce.push((Q[Se].byteLength&65280)>>>8),ce.push(Q[Se].byteLength&255),ce=ce.concat(Array.prototype.slice.call(Q[Se]));if(xe=[ze.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(R.width&65280)>>8,R.width&255,(R.height&65280)>>8,R.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),c(ze.avcC,new Uint8Array([1,R.profileIdc,R.profileCompatibility,R.levelIdc,255].concat([F.length],te,[Q.length],ce))),c(ze.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],R.sarRatio){var je=R.sarRatio[0],Le=R.sarRatio[1];xe.push(c(ze.pasp,new Uint8Array([(je&4278190080)>>24,(je&16711680)>>16,(je&65280)>>8,je&255,(Le&4278190080)>>24,(Le&16711680)>>16,(Le&65280)>>8,Le&255])))}return c.apply(null,xe)},M=function(R){return c(ze.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(R.channelcount&65280)>>8,R.channelcount&255,(R.samplesize&65280)>>8,R.samplesize&255,0,0,0,0,(R.samplerate&65280)>>8,R.samplerate&255,0,0]),m(R))}}(),ne=function(_){var M=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(_.id&4278190080)>>24,(_.id&16711680)>>16,(_.id&65280)>>8,_.id&255,0,0,0,0,(_.duration&4278190080)>>24,(_.duration&16711680)>>16,(_.duration&65280)>>8,_.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(_.width&65280)>>8,_.width&255,0,0,(_.height&65280)>>8,_.height&255,0,0]);return c(ze.tkhd,M)},Ne=function(_){var M,R,F,Q,te,ce,Se;if(M=c(ze.tfhd,new Uint8Array([0,0,0,58,(_.id&4278190080)>>24,(_.id&16711680)>>16,(_.id&65280)>>8,_.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),ce=Math.floor(_.baseMediaDecodeTime/l),Se=Math.floor(_.baseMediaDecodeTime%l),R=c(ze.tfdt,new Uint8Array([1,0,0,0,ce>>>24&255,ce>>>16&255,ce>>>8&255,ce&255,Se>>>24&255,Se>>>16&255,Se>>>8&255,Se&255])),te=92,_.type==="audio")return F=Ue(_,te),c(ze.traf,M,R,F);return Q=he(_),F=Ue(_,Q.length+te),c(ze.traf,M,R,F,Q)},J=function(_){return _.duration=_.duration||4294967295,c(ze.trak,ne(_),ae(_))},Pe=function(_){var M=new Uint8Array([0,0,0,0,(_.id&4278190080)>>24,(_.id&16711680)>>16,(_.id&65280)>>8,_.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);if(_.type!=="video")M[M.length-1]=0;return c(ze.trex,M)},function(){var _,M,R;R=function(F,Q){var te=0,ce=0,Se=0,xe=0;if(F.length){if(F[0].duration!==void 0)te=1;if(F[0].size!==void 0)ce=2;if(F[0].flags!==void 0)Se=4;if(F[0].compositionTimeOffset!==void 0)xe=8}return[0,0,te|ce|Se|xe,1,(F.length&4278190080)>>>24,(F.length&16711680)>>>16,(F.length&65280)>>>8,F.length&255,(Q&4278190080)>>>24,(Q&16711680)>>>16,(Q&65280)>>>8,Q&255]},M=function(F,Q){var te,ce,Se,xe,je,Le;xe=F.samples||[],Q+=20+16*xe.length,Se=R(xe,Q),ce=new Uint8Array(Se.length+xe.length*16),ce.set(Se),te=Se.length;for(Le=0;Le<xe.length;Le++)je=xe[Le],ce[te++]=(je.duration&4278190080)>>>24,ce[te++]=(je.duration&16711680)>>>16,ce[te++]=(je.duration&65280)>>>8,ce[te++]=je.duration&255,ce[te++]=(je.size&4278190080)>>>24,ce[te++]=(je.size&16711680)>>>16,ce[te++]=(je.size&65280)>>>8,ce[te++]=je.size&255,ce[te++]=je.flags.isLeading<<2|je.flags.dependsOn,ce[te++]=je.flags.isDependedOn<<6|je.flags.hasRedundancy<<4|je.flags.paddingValue<<1|je.flags.isNonSyncSample,ce[te++]=je.flags.degradationPriority&61440,ce[te++]=je.flags.degradationPriority&15,ce[te++]=(je.compositionTimeOffset&4278190080)>>>24,ce[te++]=(je.compositionTimeOffset&16711680)>>>16,ce[te++]=(je.compositionTimeOffset&65280)>>>8,ce[te++]=je.compositionTimeOffset&255;return c(ze.trun,ce)},_=function(F,Q){var te,ce,Se,xe,je,Le;xe=F.samples||[],Q+=20+8*xe.length,Se=R(xe,Q),te=new Uint8Array(Se.length+xe.length*8),te.set(Se),ce=Se.length;for(Le=0;Le<xe.length;Le++)je=xe[Le],te[ce++]=(je.duration&4278190080)>>>24,te[ce++]=(je.duration&16711680)>>>16,te[ce++]=(je.duration&65280)>>>8,te[ce++]=je.duration&255,te[ce++]=(je.size&4278190080)>>>24,te[ce++]=(je.size&16711680)>>>16,te[ce++]=(je.size&65280)>>>8,te[ce++]=je.size&255;return c(ze.trun,te)},Ue=function(F,Q){if(F.type==="audio")return _(F,Q);return M(F,Q)}}();var Zt={ftyp:g,mdat:y,moof:I,moov:P,initSegment:function(_){var M=g(),R=P(_),F;return F=new Uint8Array(M.byteLength+R.byteLength),F.set(M),F.set(R,M.byteLength),F}},Rn=function(_){var M,R,F=[],Q=[];Q.byteLength=0,Q.nalCount=0,Q.duration=0,F.byteLength=0;for(M=0;M<_.length;M++)if(R=_[M],R.nalUnitType==="access_unit_delimiter_rbsp"){if(F.length)F.duration=R.dts-F.dts,Q.byteLength+=F.byteLength,Q.nalCount+=F.length,Q.duration+=F.duration,Q.push(F);F=[R],F.byteLength=R.data.byteLength,F.pts=R.pts,F.dts=R.dts}else{if(R.nalUnitType==="slice_layer_without_partitioning_rbsp_idr")F.keyFrame=!0;F.duration=R.dts-F.dts,F.byteLength+=R.data.byteLength,F.push(R)}if(Q.length&&(!F.duration||F.duration<=0))F.duration=Q[Q.length-1].duration;return Q.byteLength+=F.byteLength,Q.nalCount+=F.length,Q.duration+=F.duration,Q.push(F),Q},Zn=function(_){var M,R,F=[],Q=[];F.byteLength=0,F.nalCount=0,F.duration=0,F.pts=_[0].pts,F.dts=_[0].dts,Q.byteLength=0,Q.nalCount=0,Q.duration=0,Q.pts=_[0].pts,Q.dts=_[0].dts;for(M=0;M<_.length;M++)if(R=_[M],R.keyFrame){if(F.length)Q.push(F),Q.byteLength+=F.byteLength,Q.nalCount+=F.nalCount,Q.duration+=F.duration;F=[R],F.nalCount=R.length,F.byteLength=R.byteLength,F.pts=R.pts,F.dts=R.dts,F.duration=R.duration}else F.duration+=R.duration,F.nalCount+=R.length,F.byteLength+=R.byteLength,F.push(R);if(Q.length&&F.duration<=0)F.duration=Q[Q.length-1].duration;return Q.byteLength+=F.byteLength,Q.nalCount+=F.nalCount,Q.duration+=F.duration,Q.push(F),Q},Ni=function(_){var M;if(!_[0][0].keyFrame&&_.length>1)M=_.shift(),_.byteLength-=M.byteLength,_.nalCount-=M.nalCount,_[0][0].dts=M.dts,_[0][0].pts=M.pts,_[0][0].duration+=M.duration;return _},ri=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Ai=function(_,M){var R=ri();if(R.dataOffset=M,R.compositionTimeOffset=_.pts-_.dts,R.duration=_.duration,R.size=4*_.length,R.size+=_.byteLength,_.keyFrame)R.flags.dependsOn=2,R.flags.isNonSyncSample=0;return R},Vs=function(_,M){var R,F,Q,te,ce,Se=M||0,xe=[];for(R=0;R<_.length;R++){te=_[R];for(F=0;F<te.length;F++)ce=te[F],Q=Ai(ce,Se),Se+=Q.size,xe.push(Q)}return xe},zi=function(_){var M,R,F,Q,te,ce,Se=0,{byteLength:xe,nalCount:je}=_,Le=xe+4*je,Qe=new Uint8Array(Le),Rt=new DataView(Qe.buffer);for(M=0;M<_.length;M++){Q=_[M];for(R=0;R<Q.length;R++){te=Q[R];for(F=0;F<te.length;F++)ce=te[F],Rt.setUint32(Se,ce.data.byteLength),Se+=4,Qe.set(ce.data,Se),Se+=ce.data.byteLength}}return Qe},Ht=function(_,M){var R,F=M||0,Q=[];return R=Ai(_,F),Q.push(R),Q},$t=function(_){var M,R,F=0,{byteLength:Q,length:te}=_,ce=Q+4*te,Se=new Uint8Array(ce),xe=new DataView(Se.buffer);for(M=0;M<_.length;M++)R=_[M],xe.setUint32(F,R.data.byteLength),F+=4,Se.set(R.data,F),F+=R.data.byteLength;return Se},cn={groupNalsIntoFrames:Rn,groupFramesIntoGops:Zn,extendFirstKeyFrame:Ni,generateSampleTable:Vs,concatenateNalData:zi,generateSampleTableForFrame:Ht,concatenateNalDataForFrame:$t},pn=[33,16,5,32,164,27],oi=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],fn=function(_){var M=[];while(_--)M.push(0);return M},Si=function(_){return Object.keys(_).reduce(function(M,R){return M[R]=new Uint8Array(_[R].reduce(function(F,Q){return F.concat(Q)},[])),M},{})},Cn,ta=function(){if(!Cn){var _={96000:[pn,[227,64],fn(154),[56]],88200:[pn,[231],fn(170),[56]],64000:[pn,[248,192],fn(240),[56]],48000:[pn,[255,192],fn(268),[55,148,128],fn(54),[112]],44100:[pn,[255,192],fn(268),[55,163,128],fn(84),[112]],32000:[pn,[255,192],fn(268),[55,234],fn(226),[112]],24000:[pn,[255,192],fn(268),[55,255,128],fn(268),[111,112],fn(126),[224]],16000:[pn,[255,192],fn(268),[55,255,128],fn(268),[111,255],fn(269),[223,108],fn(195),[1,192]],12000:[oi,fn(268),[3,127,248],fn(268),[6,255,240],fn(268),[13,255,224],fn(268),[27,253,128],fn(259),[56]],11025:[oi,fn(268),[3,127,248],fn(268),[6,255,240],fn(268),[13,255,224],fn(268),[27,255,192],fn(268),[55,175,128],fn(108),[112]],8000:[oi,fn(268),[3,121,16],fn(47),[7]]};Cn=Si(_)}return Cn},lr=90000,os,ls,na,Pi,cs,Pr,Br;os=function(_){return _*lr},ls=function(_,M){return _*M},na=function(_){return _/lr},Pi=function(_,M){return _/M},cs=function(_,M){return os(Pi(_,M))},Pr=function(_,M){return ls(na(_),M)},Br=function(_,M,R){return na(R?_:_-M)};var zn={ONE_SECOND_IN_TS:lr,secondsToVideoTs:os,secondsToAudioTs:ls,videoTsToSeconds:na,audioTsToSeconds:Pi,audioTsToVideoTs:cs,videoTsToAudioTs:Pr,metadataTsToSeconds:Br},ma=ta,ur=zn,Xl=function(_){var M,R,F=0;for(M=0;M<_.length;M++)R=_[M],F+=R.data.byteLength;return F},ao=function(_,M,R,F){var Q,te=0,ce=0,Se=0,xe=0,je,Le,Qe;if(!M.length)return;if(Q=ur.audioTsToVideoTs(_.baseMediaDecodeTime,_.samplerate),te=Math.ceil(ur.ONE_SECOND_IN_TS/(_.samplerate/1024)),R&&F)ce=Q-Math.max(R,F),Se=Math.floor(ce/te),xe=Se*te;if(Se<1||xe>ur.ONE_SECOND_IN_TS/2)return;if(je=ma()[_.samplerate],!je)je=M[0].data;for(Le=0;Le<Se;Le++)Qe=M[0],M.splice(0,0,{data:je,dts:Qe.dts-te,pts:Qe.pts-te});return _.baseMediaDecodeTime-=Math.floor(ur.videoTsToAudioTs(xe,_.samplerate)),xe},Wl=function(_,M,R){if(M.minSegmentDts>=R)return _;return M.minSegmentDts=1/0,_.filter(function(F){if(F.dts>=R)return M.minSegmentDts=Math.min(M.minSegmentDts,F.dts),M.minSegmentPts=M.minSegmentDts,!0;return!1})},ro=function(_){var M,R,F=[];for(M=0;M<_.length;M++)R=_[M],F.push({size:R.data.byteLength,duration:1024});return F},Ut=function(_){var M,R,F=0,Q=new Uint8Array(Xl(_));for(M=0;M<_.length;M++)R=_[M],Q.set(R.data,F),F+=R.data.byteLength;return Q},Yt={prefixWithSilence:ao,trimAdtsFramesByEarliestDts:Wl,generateSampleTable:ro,concatenateFrameData:Ut},ei=zn.ONE_SECOND_IN_TS,Ki=function(_,M){if(typeof M.pts==="number"){if(_.timelineStartInfo.pts===void 0)_.timelineStartInfo.pts=M.pts;if(_.minSegmentPts===void 0)_.minSegmentPts=M.pts;else _.minSegmentPts=Math.min(_.minSegmentPts,M.pts);if(_.maxSegmentPts===void 0)_.maxSegmentPts=M.pts;else _.maxSegmentPts=Math.max(_.maxSegmentPts,M.pts)}if(typeof M.dts==="number"){if(_.timelineStartInfo.dts===void 0)_.timelineStartInfo.dts=M.dts;if(_.minSegmentDts===void 0)_.minSegmentDts=M.dts;else _.minSegmentDts=Math.min(_.minSegmentDts,M.dts);if(_.maxSegmentDts===void 0)_.maxSegmentDts=M.dts;else _.maxSegmentDts=Math.max(_.maxSegmentDts,M.dts)}},Et=function(_){delete _.minSegmentDts,delete _.maxSegmentDts,delete _.minSegmentPts,delete _.maxSegmentPts},Ft=function(_,M){var R,F,Q=_.minSegmentDts;if(!M)Q-=_.timelineStartInfo.dts;if(R=_.timelineStartInfo.baseMediaDecodeTime,R+=Q,R=Math.max(0,R),_.type==="audio")F=_.samplerate/ei,R*=F,R=Math.floor(R);return R},Wt={clearDtsInfo:Et,calculateTrackBaseMediaDecodeTime:Ft,collectDtsInfo:Ki},Kt=4,Ci=128,gi=function(_){var M=0,R={payloadType:-1,payloadSize:0},F=0,Q=0;while(M<_.byteLength){if(_[M]===Ci)break;while(_[M]===255)F+=255,M++;F+=_[M++];while(_[M]===255)Q+=255,M++;if(Q+=_[M++],!R.payload&&F===Kt){var te=String.fromCharCode(_[M+3],_[M+4],_[M+5],_[M+6]);if(te==="GA94"){R.payloadType=F,R.payloadSize=Q,R.payload=_.subarray(M,M+Q);break}else R.payload=void 0}M+=Q,F=0,Q=0}return R},hr=function(_){if(_.payload[0]!==181)return null;if((_.payload[1]<<8|_.payload[2])!==49)return null;if(String.fromCharCode(_.payload[3],_.payload[4],_.payload[5],_.payload[6])!=="GA94")return null;if(_.payload[7]!==3)return null;return _.payload.subarray(8,_.payload.length-1)},Ko=function(_,M){var R=[],F,Q,te,ce;if(!(M[0]&64))return R;Q=M[0]&31;for(F=0;F<Q;F++)if(te=F*3,ce={type:M[te+2]&3,pts:_},M[te+2]&4)ce.ccData=M[te+3]<<8|M[te+4],R.push(ce);return R},Dh=function(_){var M=_.byteLength,R=[],F=1,Q,te;while(F<M-2)if(_[F]===0&&_[F+1]===0&&_[F+2]===3)R.push(F+2),F+=2;else F++;if(R.length===0)return _;Q=M-R.length,te=new Uint8Array(Q);var ce=0;for(F=0;F<Q;ce++,F++){if(ce===R[0])ce++,R.shift();te[F]=_[ce]}return te},Nd={parseSei:gi,parseUserData:hr,parseCaptionPackets:Ko,discardEmulationPreventionBytes:Dh,USER_DATA_REGISTERED_ITU_T_T35:Kt},Kl=i,$o=Nd,us=function(_){if(_=_||{},us.prototype.init.call(this),this.parse708captions_=typeof _.parse708captions==="boolean"?_.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new hi(0,0),new hi(0,1),new hi(1,0),new hi(1,1)],this.parse708captions_)this.cc708Stream_=new On({captionServices:_.captionServices});if(this.reset(),this.ccStreams_.forEach(function(M){M.on("data",this.trigger.bind(this,"data")),M.on("partialdone",this.trigger.bind(this,"partialdone")),M.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_)this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done"))};us.prototype=new Kl,us.prototype.push=function(_){var M,R,F;if(_.nalUnitType!=="sei_rbsp")return;if(M=$o.parseSei(_.escapedRBSP),!M.payload)return;if(M.payloadType!==$o.USER_DATA_REGISTERED_ITU_T_T35)return;if(R=$o.parseUserData(M),!R)return;if(_.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(_.dts===this.latestDts_&&this.ignoreNextEqualDts_){if(this.numSameDts_--,!this.numSameDts_)this.ignoreNextEqualDts_=!1;return}if(F=$o.parseCaptionPackets(_.pts,R),this.captionPackets_=this.captionPackets_.concat(F),this.latestDts_!==_.dts)this.numSameDts_=0;this.numSameDts_++,this.latestDts_=_.dts},us.prototype.flushCCStreams=function(_){this.ccStreams_.forEach(function(M){return _==="flush"?M.flush():M.partialFlush()},this)},us.prototype.flushStream=function(_){if(!this.captionPackets_.length){this.flushCCStreams(_);return}this.captionPackets_.forEach(function(M,R){M.presortIndex=R}),this.captionPackets_.sort(function(M,R){if(M.pts===R.pts)return M.presortIndex-R.presortIndex;return M.pts-R.pts}),this.captionPackets_.forEach(function(M){if(M.type<2)this.dispatchCea608Packet(M);else this.dispatchCea708Packet(M)},this),this.captionPackets_.length=0,this.flushCCStreams(_)},us.prototype.flush=function(){return this.flushStream("flush")},us.prototype.partialFlush=function(){return this.flushStream("partialFlush")},us.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(_){_.reset()})},us.prototype.dispatchCea608Packet=function(_){if(this.setsTextOrXDSActive(_))this.activeCea608Channel_[_.type]=null;else if(this.setsChannel1Active(_))this.activeCea608Channel_[_.type]=0;else if(this.setsChannel2Active(_))this.activeCea608Channel_[_.type]=1;if(this.activeCea608Channel_[_.type]===null)return;this.ccStreams_[(_.type<<1)+this.activeCea608Channel_[_.type]].push(_)},us.prototype.setsChannel1Active=function(_){return(_.ccData&30720)===4096},us.prototype.setsChannel2Active=function(_){return(_.ccData&30720)===6144},us.prototype.setsTextOrXDSActive=function(_){return(_.ccData&28928)===256||(_.ccData&30974)===4138||(_.ccData&30974)===6186},us.prototype.dispatchCea708Packet=function(_){if(this.parse708captions_)this.cc708Stream_.push(_)};var Yo={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},gm=function(_){var M=Yo[_]||_;if(_&4096&&_===M)return"";return String.fromCharCode(M)},Qo=function(_){return 32<=_&&_<=127||160<=_&&_<=255},Ha=function(_){this.windowNum=_,this.reset()};Ha.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},Ha.prototype.getText=function(){return this.rows.join(`
|
|
197
|
+
`)},Ha.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},Ha.prototype.newLine=function(_){if(this.rows.length>=this.virtualRowCount&&typeof this.beforeRowOverflow==="function")this.beforeRowOverflow(_);if(this.rows.length>0)this.rows.push(""),this.rowIdx++;while(this.rows.length>this.virtualRowCount)this.rows.shift(),this.rowIdx--},Ha.prototype.isEmpty=function(){if(this.rows.length===0)return!0;else if(this.rows.length===1)return this.rows[0]==="";return!1},Ha.prototype.addText=function(_){this.rows[this.rowIdx]+=_},Ha.prototype.backspace=function(){if(!this.isEmpty()){var _=this.rows[this.rowIdx];this.rows[this.rowIdx]=_.substr(0,_.length-1)}};var $l=function(_,M,R){if(this.serviceNum=_,this.text="",this.currentWindow=new Ha(-1),this.windows=[],this.stream=R,typeof M==="string")this.createTextDecoder(M)};$l.prototype.init=function(_,M){this.startPts=_;for(var R=0;R<8;R++)if(this.windows[R]=new Ha(R),typeof M==="function")this.windows[R].beforeRowOverflow=M},$l.prototype.setCurrentWindow=function(_){this.currentWindow=this.windows[_]},$l.prototype.createTextDecoder=function(_){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(_)}catch(M){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+_+" encoding. "+M})}};var On=function(_){_=_||{},On.prototype.init.call(this);var M=this,R=_.captionServices||{},F={},Q;Object.keys(R).forEach((te)=>{if(Q=R[te],/^SERVICE/.test(te))F[te]=Q.encoding}),this.serviceEncodings=F,this.current708Packet=null,this.services={},this.push=function(te){if(te.type===3)M.new708Packet(),M.add708Bytes(te);else{if(M.current708Packet===null)M.new708Packet();M.add708Bytes(te)}}};On.prototype=new Kl,On.prototype.new708Packet=function(){if(this.current708Packet!==null)this.push708Packet();this.current708Packet={data:[],ptsVals:[]}},On.prototype.add708Bytes=function(_){var M=_.ccData,R=M>>>8,F=M&255;this.current708Packet.ptsVals.push(_.pts),this.current708Packet.data.push(R),this.current708Packet.data.push(F)},On.prototype.push708Packet=function(){var _=this.current708Packet,M=_.data,R=null,F=null,Q=0,te=M[Q++];_.seq=te>>6,_.sizeCode=te&63;for(;Q<M.length;Q++){if(te=M[Q++],R=te>>5,F=te&31,R===7&&F>0)te=M[Q++],R=te;if(this.pushServiceBlock(R,Q,F),F>0)Q+=F-1}},On.prototype.pushServiceBlock=function(_,M,R){var F,Q=M,te=this.current708Packet.data,ce=this.services[_];if(!ce)ce=this.initService(_,Q);for(;Q<M+R&&Q<te.length;Q++)if(F=te[Q],Qo(F))Q=this.handleText(Q,ce);else if(F===24)Q=this.multiByteCharacter(Q,ce);else if(F===16)Q=this.extendedCommands(Q,ce);else if(128<=F&&F<=135)Q=this.setCurrentWindow(Q,ce);else if(152<=F&&F<=159)Q=this.defineWindow(Q,ce);else if(F===136)Q=this.clearWindows(Q,ce);else if(F===140)Q=this.deleteWindows(Q,ce);else if(F===137)Q=this.displayWindows(Q,ce);else if(F===138)Q=this.hideWindows(Q,ce);else if(F===139)Q=this.toggleWindows(Q,ce);else if(F===151)Q=this.setWindowAttributes(Q,ce);else if(F===144)Q=this.setPenAttributes(Q,ce);else if(F===145)Q=this.setPenColor(Q,ce);else if(F===146)Q=this.setPenLocation(Q,ce);else if(F===143)ce=this.reset(Q,ce);else if(F===8)ce.currentWindow.backspace();else if(F===12)ce.currentWindow.clearText();else if(F===13)ce.currentWindow.pendingNewLine=!0;else if(F===14)ce.currentWindow.clearText();else if(F===141)Q++},On.prototype.extendedCommands=function(_,M){var R=this.current708Packet.data,F=R[++_];if(Qo(F))_=this.handleText(_,M,{isExtended:!0});return _},On.prototype.getPts=function(_){return this.current708Packet.ptsVals[Math.floor(_/2)]},On.prototype.initService=function(_,M){var F="SERVICE"+_,R=this,F,Q;if(F in this.serviceEncodings)Q=this.serviceEncodings[F];return this.services[_]=new $l(_,Q,R),this.services[_].init(this.getPts(M),function(te){R.flushDisplayed(te,R.services[_])}),this.services[_]},On.prototype.handleText=function(_,M,R){var F=R&&R.isExtended,Q=R&&R.isMultiByte,te=this.current708Packet.data,ce=F?4096:0,Se=te[_],xe=te[_+1],je=M.currentWindow,Le,Qe;function Rt(ft){return ft.map((zt)=>("0"+(zt&255).toString(16)).slice(-2)).join("")}if(Q)Qe=[Se,xe],_++;else Qe=[Se];if(M.textDecoder_&&!F)Le=M.textDecoder_.decode(new Uint8Array(Qe));else if(Q){let ft=Rt(Qe);Le=String.fromCharCode(parseInt(ft,16))}else Le=gm(ce|Se);if(je.pendingNewLine&&!je.isEmpty())je.newLine(this.getPts(_));return je.pendingNewLine=!1,je.addText(Le),_},On.prototype.multiByteCharacter=function(_,M){var R=this.current708Packet.data,F=R[_+1],Q=R[_+2];if(Qo(F)&&Qo(Q))_=this.handleText(++_,M,{isMultiByte:!0});return _},On.prototype.setCurrentWindow=function(_,M){var R=this.current708Packet.data,F=R[_],Q=F&7;return M.setCurrentWindow(Q),_},On.prototype.defineWindow=function(_,M){var R=this.current708Packet.data,F=R[_],Q=F&7;M.setCurrentWindow(Q);var te=M.currentWindow;return F=R[++_],te.visible=(F&32)>>5,te.rowLock=(F&16)>>4,te.columnLock=(F&8)>>3,te.priority=F&7,F=R[++_],te.relativePositioning=(F&128)>>7,te.anchorVertical=F&127,F=R[++_],te.anchorHorizontal=F,F=R[++_],te.anchorPoint=(F&240)>>4,te.rowCount=F&15,F=R[++_],te.columnCount=F&63,F=R[++_],te.windowStyle=(F&56)>>3,te.penStyle=F&7,te.virtualRowCount=te.rowCount+1,_},On.prototype.setWindowAttributes=function(_,M){var R=this.current708Packet.data,F=R[_],Q=M.currentWindow.winAttr;return F=R[++_],Q.fillOpacity=(F&192)>>6,Q.fillRed=(F&48)>>4,Q.fillGreen=(F&12)>>2,Q.fillBlue=F&3,F=R[++_],Q.borderType=(F&192)>>6,Q.borderRed=(F&48)>>4,Q.borderGreen=(F&12)>>2,Q.borderBlue=F&3,F=R[++_],Q.borderType+=(F&128)>>5,Q.wordWrap=(F&64)>>6,Q.printDirection=(F&48)>>4,Q.scrollDirection=(F&12)>>2,Q.justify=F&3,F=R[++_],Q.effectSpeed=(F&240)>>4,Q.effectDirection=(F&12)>>2,Q.displayEffect=F&3,_},On.prototype.flushDisplayed=function(_,M){var R=[];for(var F=0;F<8;F++)if(M.windows[F].visible&&!M.windows[F].isEmpty())R.push(M.windows[F].getText());M.endPts=_,M.text=R.join(`
|
|
198
|
+
|
|
199
|
+
`),this.pushCaption(M),M.startPts=_},On.prototype.pushCaption=function(_){if(_.text!=="")this.trigger("data",{startPts:_.startPts,endPts:_.endPts,text:_.text,stream:"cc708_"+_.serviceNum}),_.text="",_.startPts=_.endPts},On.prototype.displayWindows=function(_,M){var R=this.current708Packet.data,F=R[++_],Q=this.getPts(_);this.flushDisplayed(Q,M);for(var te=0;te<8;te++)if(F&1<<te)M.windows[te].visible=1;return _},On.prototype.hideWindows=function(_,M){var R=this.current708Packet.data,F=R[++_],Q=this.getPts(_);this.flushDisplayed(Q,M);for(var te=0;te<8;te++)if(F&1<<te)M.windows[te].visible=0;return _},On.prototype.toggleWindows=function(_,M){var R=this.current708Packet.data,F=R[++_],Q=this.getPts(_);this.flushDisplayed(Q,M);for(var te=0;te<8;te++)if(F&1<<te)M.windows[te].visible^=1;return _},On.prototype.clearWindows=function(_,M){var R=this.current708Packet.data,F=R[++_],Q=this.getPts(_);this.flushDisplayed(Q,M);for(var te=0;te<8;te++)if(F&1<<te)M.windows[te].clearText();return _},On.prototype.deleteWindows=function(_,M){var R=this.current708Packet.data,F=R[++_],Q=this.getPts(_);this.flushDisplayed(Q,M);for(var te=0;te<8;te++)if(F&1<<te)M.windows[te].reset();return _},On.prototype.setPenAttributes=function(_,M){var R=this.current708Packet.data,F=R[_],Q=M.currentWindow.penAttr;return F=R[++_],Q.textTag=(F&240)>>4,Q.offset=(F&12)>>2,Q.penSize=F&3,F=R[++_],Q.italics=(F&128)>>7,Q.underline=(F&64)>>6,Q.edgeType=(F&56)>>3,Q.fontStyle=F&7,_},On.prototype.setPenColor=function(_,M){var R=this.current708Packet.data,F=R[_],Q=M.currentWindow.penColor;return F=R[++_],Q.fgOpacity=(F&192)>>6,Q.fgRed=(F&48)>>4,Q.fgGreen=(F&12)>>2,Q.fgBlue=F&3,F=R[++_],Q.bgOpacity=(F&192)>>6,Q.bgRed=(F&48)>>4,Q.bgGreen=(F&12)>>2,Q.bgBlue=F&3,F=R[++_],Q.edgeRed=(F&48)>>4,Q.edgeGreen=(F&12)>>2,Q.edgeBlue=F&3,_},On.prototype.setPenLocation=function(_,M){var R=this.current708Packet.data,F=R[_],Q=M.currentWindow.penLoc;return M.currentWindow.pendingNewLine=!0,F=R[++_],Q.row=F&15,F=R[++_],Q.column=F&63,_},On.prototype.reset=function(_,M){var R=this.getPts(_);return this.flushDisplayed(R,M),this.initService(M.serviceNum,_)};var oo={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},lo=function(_){if(_===null)return"";return _=oo[_]||_,String.fromCharCode(_)},Yl=14,tu=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Ua=function(){var _=[],M=Yl+1;while(M--)_.push({text:"",indent:0,offset:0});return _},hi=function(_,M){hi.prototype.init.call(this),this.field_=_||0,this.dataChannel_=M||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(R){var F,Q,te,ce,Se;if(F=R.ccData&32639,F===this.lastControlCode_){this.lastControlCode_=null;return}if((F&61440)===4096)this.lastControlCode_=F;else if(F!==this.PADDING_)this.lastControlCode_=null;if(te=F>>>8,ce=F&255,F===this.PADDING_)return;else if(F===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(F===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(R.pts),this.flushDisplayed(R.pts),Q=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=Q,this.startPts_=R.pts;else if(F===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(R.pts);else if(F===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(R.pts);else if(F===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(R.pts);else if(F===this.CARRIAGE_RETURN_)this.clearFormatting(R.pts),this.flushDisplayed(R.pts),this.shiftRowsUp_(),this.startPts_=R.pts;else if(F===this.BACKSPACE_)if(this.mode_==="popOn")this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1);else this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(F===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(R.pts),this.displayed_=Ua();else if(F===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Ua();else if(F===this.RESUME_DIRECT_CAPTIONING_){if(this.mode_!=="paintOn")this.flushDisplayed(R.pts),this.displayed_=Ua();this.mode_="paintOn",this.startPts_=R.pts}else if(this.isSpecialCharacter(te,ce))te=(te&3)<<8,Se=lo(te|ce),this[this.mode_](R.pts,Se),this.column_++;else if(this.isExtCharacter(te,ce)){if(this.mode_==="popOn")this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1);else this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);te=(te&3)<<8,Se=lo(te|ce),this[this.mode_](R.pts,Se),this.column_++}else if(this.isMidRowCode(te,ce)){if(this.clearFormatting(R.pts),this[this.mode_](R.pts," "),this.column_++,(ce&14)===14)this.addFormatting(R.pts,["i"]);if((ce&1)===1)this.addFormatting(R.pts,["u"])}else if(this.isOffsetControlCode(te,ce)){let je=ce&3;this.nonDisplayed_[this.row_].offset=je,this.column_+=je}else if(this.isPAC(te,ce)){var xe=tu.indexOf(F&7968);if(this.mode_==="rollUp"){if(xe-this.rollUpRows_+1<0)xe=this.rollUpRows_-1;this.setRollUp(R.pts,xe)}if(xe!==this.row_&&xe>=0&&xe<=14)this.clearFormatting(R.pts),this.row_=xe;if(ce&1&&this.formatting_.indexOf("u")===-1)this.addFormatting(R.pts,["u"]);if((F&16)===16){let je=(F&14)>>1;this.column_=je*4,this.nonDisplayed_[this.row_].indent+=je}if(this.isColorPAC(ce)){if((ce&14)===14)this.addFormatting(R.pts,["i"])}}else if(this.isNormalChar(te)){if(ce===0)ce=null;Se=lo(te),Se+=lo(ce),this[this.mode_](R.pts,Se),this.column_+=Se.length}}};hi.prototype=new Kl,hi.prototype.flushDisplayed=function(_){let M=(F)=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+F+"."})},R=[];if(this.displayed_.forEach((F,Q)=>{if(F&&F.text&&F.text.length){try{F.text=F.text.trim()}catch(te){M(Q)}if(F.text.length)R.push({text:F.text,line:Q+1,position:10+Math.min(70,F.indent*10)+F.offset*2.5})}else if(F===void 0||F===null)M(Q)}),R.length)this.trigger("data",{startPts:this.startPts_,endPts:_,content:R,stream:this.name_})},hi.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Ua(),this.nonDisplayed_=Ua(),this.lastControlCode_=null,this.column_=0,this.row_=Yl,this.rollUpRows_=2,this.formatting_=[]},hi.prototype.setConstants=function(){if(this.dataChannel_===0)this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23;else if(this.dataChannel_===1)this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31;this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},hi.prototype.isSpecialCharacter=function(_,M){return _===this.EXT_&&M>=48&&M<=63},hi.prototype.isExtCharacter=function(_,M){return(_===this.EXT_+1||_===this.EXT_+2)&&M>=32&&M<=63},hi.prototype.isMidRowCode=function(_,M){return _===this.EXT_&&M>=32&&M<=47},hi.prototype.isOffsetControlCode=function(_,M){return _===this.OFFSET_&&M>=33&&M<=35},hi.prototype.isPAC=function(_,M){return _>=this.BASE_&&_<this.BASE_+8&&M>=64&&M<=127},hi.prototype.isColorPAC=function(_){return _>=64&&_<=79||_>=96&&_<=127},hi.prototype.isNormalChar=function(_){return _>=32&&_<=127},hi.prototype.setRollUp=function(_,M){if(this.mode_!=="rollUp")this.row_=Yl,this.mode_="rollUp",this.flushDisplayed(_),this.nonDisplayed_=Ua(),this.displayed_=Ua();if(M!==void 0&&M!==this.row_)for(var R=0;R<this.rollUpRows_;R++)this.displayed_[M-R]=this.displayed_[this.row_-R],this.displayed_[this.row_-R]={text:"",indent:0,offset:0};if(M===void 0)M=this.row_;this.topRow_=M-this.rollUpRows_+1},hi.prototype.addFormatting=function(_,M){this.formatting_=this.formatting_.concat(M);var R=M.reduce(function(F,Q){return F+"<"+Q+">"},"");this[this.mode_](_,R)},hi.prototype.clearFormatting=function(_){if(!this.formatting_.length)return;var M=this.formatting_.reverse().reduce(function(R,F){return R+"</"+F+">"},"");this.formatting_=[],this[this.mode_](_,M)},hi.prototype.popOn=function(_,M){var R=this.nonDisplayed_[this.row_].text;R+=M,this.nonDisplayed_[this.row_].text=R},hi.prototype.rollUp=function(_,M){var R=this.displayed_[this.row_].text;R+=M,this.displayed_[this.row_].text=R},hi.prototype.shiftRowsUp_=function(){var _;for(_=0;_<this.topRow_;_++)this.displayed_[_]={text:"",indent:0,offset:0};for(_=this.row_+1;_<Yl+1;_++)this.displayed_[_]={text:"",indent:0,offset:0};for(_=this.topRow_;_<this.row_;_++)this.displayed_[_]=this.displayed_[_+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},hi.prototype.paintOn=function(_,M){var R=this.displayed_[this.row_].text;R+=M,this.displayed_[this.row_].text=R};var Pd={CaptionStream:us,Cea608Stream:hi,Cea708Stream:On},iu={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Bd=i,Ld=8589934592,co=4294967296,Ih="shared",Mh=function(_,M){var R=1;if(_>M)R=-1;while(Math.abs(M-_)>co)_+=R*Ld;return _},fr=function(_){var M,R;fr.prototype.init.call(this),this.type_=_||Ih,this.push=function(F){if(F.type==="metadata"){this.trigger("data",F);return}if(this.type_!==Ih&&F.type!==this.type_)return;if(R===void 0)R=F.dts;F.dts=Mh(F.dts,R),F.pts=Mh(F.pts,R),M=F.dts,this.trigger("data",F)},this.flush=function(){R=M,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){R=void 0,M=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};fr.prototype=new Bd;var Xs={TimestampRolloverStream:fr,handleRollover:Mh},Rh=(_,M,R)=>{if(!_)return-1;var F=R;for(;F<_.length;F++)if(_[F]===M)return F;return-1},_i={typedArrayIndexOf:Rh},Ql=_i.typedArrayIndexOf,Jl={Iso88591:0,Utf16:1,Utf16be:2,Utf8:3},Hd=function(_,M,R){var F,Q="";for(F=M;F<R;F++)Q+="%"+("00"+_[F].toString(16)).slice(-2);return Q},ec=function(_,M,R){return decodeURIComponent(Hd(_,M,R))},su=function(_,M,R){return unescape(Hd(_,M,R))},Jo=function(_){return _[0]<<21|_[1]<<14|_[2]<<7|_[3]},el={APIC:function(_){var M=1,R,F,Q="-->";if(_.data[0]!==Jl.Utf8)return;if(R=Ql(_.data,0,M),R<0)return;if(_.mimeType=su(_.data,M,R),M=R+1,_.pictureType=_.data[M],M++,F=Ql(_.data,0,M),F<0)return;if(_.description=ec(_.data,M,F),M=F+1,_.mimeType===Q)_.url=su(_.data,M,_.data.length);else _.pictureData=_.data.subarray(M,_.data.length)},"T*":function(_){if(_.data[0]!==Jl.Utf8)return;_.value=ec(_.data,1,_.data.length).replace(/\0*$/,""),_.values=_.value.split("\x00")},TXXX:function(_){var M;if(_.data[0]!==Jl.Utf8)return;if(M=Ql(_.data,0,1),M===-1)return;_.description=ec(_.data,1,M),_.value=ec(_.data,M+1,_.data.length).replace(/\0*$/,""),_.data=_.value},"W*":function(_){_.url=su(_.data,0,_.data.length).replace(/\0.*$/,"")},WXXX:function(_){var M;if(_.data[0]!==Jl.Utf8)return;if(M=Ql(_.data,0,1),M===-1)return;_.description=ec(_.data,1,M),_.url=su(_.data,M+1,_.data.length).replace(/\0.*$/,"")},PRIV:function(_){var M;for(M=0;M<_.data.length;M++)if(_.data[M]===0){_.owner=su(_.data,0,M);break}_.privateData=_.data.subarray(M+1),_.data=_.privateData}},Ud=function(_){var M,R,F=10,Q=0,te=[];if(_.length<10||_[0]!==73||_[1]!==68||_[2]!==51)return;Q=Jo(_.subarray(6,10)),Q+=10;var ce=_[5]&64;if(ce)F+=4,F+=Jo(_.subarray(10,14)),Q-=Jo(_.subarray(16,20));do{if(M=Jo(_.subarray(F+4,F+8)),M<1)break;R=String.fromCharCode(_[F],_[F+1],_[F+2],_[F+3]);var Se={id:R,data:_.subarray(F+10,F+M+10)};if(Se.key=Se.id,el[Se.id])el[Se.id](Se);else if(Se.id[0]==="T")el["T*"](Se);else if(Se.id[0]==="W")el["W*"](Se);te.push(Se),F+=10,F+=M}while(F<Q);return te},ds={parseId3Frames:Ud,parseSyncSafeInteger:Jo,frameParsers:el},ji=i,Oh=iu,ga=ds,tl;tl=function(_){var M={descriptor:_&&_.descriptor},R=0,F=[],Q=0,te;if(tl.prototype.init.call(this),this.dispatchType=Oh.METADATA_STREAM_TYPE.toString(16),M.descriptor)for(te=0;te<M.descriptor.length;te++)this.dispatchType+=("00"+M.descriptor[te].toString(16)).slice(-2);this.push=function(ce){var Se,xe,je,Le,Qe,Rt;if(ce.type!=="timed-metadata")return;if(ce.dataAlignmentIndicator)Q=0,F.length=0;if(F.length===0&&(ce.data.length<10||ce.data[0]!==73||ce.data[1]!==68||ce.data[2]!==51)){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}if(F.push(ce),Q+=ce.data.byteLength,F.length===1)R=ga.parseSyncSafeInteger(ce.data.subarray(6,10)),R+=10;if(Q<R)return;Se={data:new Uint8Array(R),frames:[],pts:F[0].pts,dts:F[0].dts};for(Qe=0;Qe<R;)Se.data.set(F[0].data.subarray(0,R-Qe),Qe),Qe+=F[0].data.byteLength,Q-=F[0].data.byteLength,F.shift();if(xe=10,Se.data[5]&64)xe+=4,xe+=ga.parseSyncSafeInteger(Se.data.subarray(10,14)),R-=ga.parseSyncSafeInteger(Se.data.subarray(16,20));do{if(je=ga.parseSyncSafeInteger(Se.data.subarray(xe+4,xe+8)),je<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(Rt=String.fromCharCode(Se.data[xe],Se.data[xe+1],Se.data[xe+2],Se.data[xe+3]),Le={id:Rt,data:Se.data.subarray(xe+10,xe+je+10)},Le.key=Le.id,ga.frameParsers[Le.id])ga.frameParsers[Le.id](Le);else if(Le.id[0]==="T")ga.frameParsers["T*"](Le);else if(Le.id[0]==="W")ga.frameParsers["W*"](Le);if(Le.owner==="com.apple.streaming.transportStreamTimestamp"){var ft=Le.data,zt=(ft[3]&1)<<30|ft[4]<<22|ft[5]<<14|ft[6]<<6|ft[7]>>>2;if(zt*=4,zt+=ft[7]&3,Le.timeStamp=zt,Se.pts===void 0&&Se.dts===void 0)Se.pts=Le.timeStamp,Se.dts=Le.timeStamp;this.trigger("timestamp",Le)}Se.frames.push(Le),xe+=10,xe+=je}while(xe<R);this.trigger("data",Se)}},tl.prototype=new ji;var zd=tl,za=i,tc=Pd,ia=iu,Gd=Xs.TimestampRolloverStream,au,nc,hu,nl=188,Fh=71;au=function(){var _=new Uint8Array(nl),M=0;au.prototype.init.call(this),this.push=function(R){var F=0,Q=nl,te;if(M)te=new Uint8Array(R.byteLength+M),te.set(_.subarray(0,M)),te.set(R,M),M=0;else te=R;while(Q<te.byteLength){if(te[F]===Fh&&te[Q]===Fh){this.trigger("data",te.subarray(F,Q)),F+=nl,Q+=nl;continue}F++,Q++}if(F<te.byteLength)_.set(te.subarray(F),0),M=te.byteLength-F},this.flush=function(){if(M===nl&&_[0]===Fh)this.trigger("data",_),M=0;this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){M=0,this.trigger("reset")}},au.prototype=new za,nc=function(){var _,M,R,F;nc.prototype.init.call(this),F=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,_=function(Q,te){var ce=0;if(te.payloadUnitStartIndicator)ce+=Q[ce]+1;if(te.type==="pat")M(Q.subarray(ce),te);else R(Q.subarray(ce),te)},M=function(Q,te){te.section_number=Q[7],te.last_section_number=Q[8],F.pmtPid=(Q[10]&31)<<8|Q[11],te.pmtPid=F.pmtPid},R=function(Q,te){var ce,Se,xe,je;if(!(Q[5]&1))return;F.programMapTable={video:null,audio:null,"timed-metadata":{}},ce=(Q[1]&15)<<8|Q[2],Se=3+ce-4,xe=(Q[10]&15)<<8|Q[11],je=12+xe;while(je<Se){var Le=Q[je],Qe=(Q[je+1]&31)<<8|Q[je+2];if(Le===ia.H264_STREAM_TYPE&&F.programMapTable.video===null)F.programMapTable.video=Qe;else if(Le===ia.ADTS_STREAM_TYPE&&F.programMapTable.audio===null)F.programMapTable.audio=Qe;else if(Le===ia.METADATA_STREAM_TYPE)F.programMapTable["timed-metadata"][Qe]=Le;je+=((Q[je+3]&15)<<8|Q[je+4])+5}te.programMapTable=F.programMapTable},this.push=function(Q){var te={},ce=4;if(te.payloadUnitStartIndicator=!!(Q[1]&64),te.pid=Q[1]&31,te.pid<<=8,te.pid|=Q[2],(Q[3]&48)>>>4>1)ce+=Q[ce]+1;if(te.pid===0)te.type="pat",_(Q.subarray(ce),te),this.trigger("data",te);else if(te.pid===this.pmtPid){te.type="pmt",_(Q.subarray(ce),te),this.trigger("data",te);while(this.packetsWaitingForPmt.length)this.processPes_.apply(this,this.packetsWaitingForPmt.shift())}else if(this.programMapTable===void 0)this.packetsWaitingForPmt.push([Q,ce,te]);else this.processPes_(Q,ce,te)},this.processPes_=function(Q,te,ce){if(ce.pid===this.programMapTable.video)ce.streamType=ia.H264_STREAM_TYPE;else if(ce.pid===this.programMapTable.audio)ce.streamType=ia.ADTS_STREAM_TYPE;else ce.streamType=this.programMapTable["timed-metadata"][ce.pid];ce.type="pes",ce.data=Q.subarray(te),this.trigger("data",ce)}},nc.prototype=new za,nc.STREAM_TYPES={h264:27,adts:15},hu=function(){var _=this,M=!1,R={data:[],size:0},F={data:[],size:0},Q={data:[],size:0},te,ce=function(xe,je){var Le;let Qe=xe[0]<<16|xe[1]<<8|xe[2];if(je.data=new Uint8Array,Qe!==1)return;if(je.packetLength=6+(xe[4]<<8|xe[5]),je.dataAlignmentIndicator=(xe[6]&4)!==0,Le=xe[7],Le&192){if(je.pts=(xe[9]&14)<<27|(xe[10]&255)<<20|(xe[11]&254)<<12|(xe[12]&255)<<5|(xe[13]&254)>>>3,je.pts*=4,je.pts+=(xe[13]&6)>>>1,je.dts=je.pts,Le&64)je.dts=(xe[14]&14)<<27|(xe[15]&255)<<20|(xe[16]&254)<<12|(xe[17]&255)<<5|(xe[18]&254)>>>3,je.dts*=4,je.dts+=(xe[18]&6)>>>1}je.data=xe.subarray(9+xe[8])},Se=function(xe,je,Le){var Qe=new Uint8Array(xe.size),Rt={type:je},ft=0,zt=0,rn=!1,Vi;if(!xe.data.length||xe.size<9)return;Rt.trackId=xe.data[0].pid;for(ft=0;ft<xe.data.length;ft++)Vi=xe.data[ft],Qe.set(Vi.data,zt),zt+=Vi.data.byteLength;if(ce(Qe,Rt),rn=je==="video"||Rt.packetLength<=xe.size,Le||rn)xe.size=0,xe.data.length=0;if(rn)_.trigger("data",Rt)};hu.prototype.init.call(this),this.push=function(xe){({pat:function(){},pes:function(){var je,Le;switch(xe.streamType){case ia.H264_STREAM_TYPE:je=R,Le="video";break;case ia.ADTS_STREAM_TYPE:je=F,Le="audio";break;case ia.METADATA_STREAM_TYPE:je=Q,Le="timed-metadata";break;default:return}if(xe.payloadUnitStartIndicator)Se(je,Le,!0);je.data.push(xe),je.size+=xe.data.byteLength},pmt:function(){var je={type:"metadata",tracks:[]};if(te=xe.programMapTable,te.video!==null)je.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+te.video,codec:"avc",type:"video"});if(te.audio!==null)je.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+te.audio,codec:"adts",type:"audio"});M=!0,_.trigger("data",je)}})[xe.type]()},this.reset=function(){R.size=0,R.data.length=0,F.size=0,F.data.length=0,this.trigger("reset")},this.flushStreams_=function(){Se(R,"video"),Se(F,"audio"),Se(Q,"timed-metadata")},this.flush=function(){if(!M&&te){var xe={type:"metadata",tracks:[]};if(te.video!==null)xe.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+te.video,codec:"avc",type:"video"});if(te.audio!==null)xe.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+te.audio,codec:"adts",type:"audio"});_.trigger("data",xe)}M=!1,this.flushStreams_(),this.trigger("done")}},hu.prototype=new za;var Vd={PAT_PID:0,MP2T_PACKET_LENGTH:nl,TransportPacketStream:au,TransportParseStream:nc,ElementaryStream:hu,TimestampRolloverStream:Gd,CaptionStream:tc.CaptionStream,Cea608Stream:tc.Cea608Stream,Cea708Stream:tc.Cea708Stream,MetadataStream:zd};for(var fu in ia)if(ia.hasOwnProperty(fu))Vd[fu]=ia[fu];var bm=Vd,M2=i,wm=zn.ONE_SECOND_IN_TS,du,Xd=[96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000,7350];du=function(_){var M,R=0;du.prototype.init.call(this),this.skipWarn_=function(F,Q){this.trigger("log",{level:"warn",message:`adts skiping bytes ${F} to ${Q} in frame ${R} outside syncword`})},this.push=function(F){var Q=0,te,ce,Se,xe,je;if(!_)R=0;if(F.type!=="audio")return;if(M&&M.length)Se=M,M=new Uint8Array(Se.byteLength+F.data.byteLength),M.set(Se),M.set(F.data,Se.byteLength);else M=F.data;var Le;while(Q+7<M.length){if(M[Q]!==255||(M[Q+1]&246)!==240){if(typeof Le!=="number")Le=Q;Q++;continue}if(typeof Le==="number")this.skipWarn_(Le,Q),Le=null;if(ce=(~M[Q+1]&1)*2,te=(M[Q+3]&3)<<11|M[Q+4]<<3|(M[Q+5]&224)>>5,xe=((M[Q+6]&3)+1)*1024,je=xe*wm/Xd[(M[Q+2]&60)>>>2],M.byteLength-Q<te)break;this.trigger("data",{pts:F.pts+R*je,dts:F.dts+R*je,sampleCount:xe,audioobjecttype:(M[Q+2]>>>6&3)+1,channelcount:(M[Q+2]&1)<<2|(M[Q+3]&192)>>>6,samplerate:Xd[(M[Q+2]&60)>>>2],samplingfrequencyindex:(M[Q+2]&60)>>>2,samplesize:16,data:M.subarray(Q+7+ce,Q+te)}),R++,Q+=te}if(typeof Le==="number")this.skipWarn_(Le,Q),Le=null;M=M.subarray(Q)},this.flush=function(){R=0,this.trigger("done")},this.reset=function(){M=void 0,this.trigger("reset")},this.endTimeline=function(){M=void 0,this.trigger("endedtimeline")}},du.prototype=new M2;var Wd=du,Kd;Kd=function(_){var M=_.byteLength,R=0,F=0;this.length=function(){return 8*M},this.bitsAvailable=function(){return 8*M+F},this.loadWord=function(){var Q=_.byteLength-M,te=new Uint8Array(4),ce=Math.min(4,M);if(ce===0)throw Error("no bytes available");te.set(_.subarray(Q,Q+ce)),R=new DataView(te.buffer).getUint32(0),F=ce*8,M-=ce},this.skipBits=function(Q){var te;if(F>Q)R<<=Q,F-=Q;else Q-=F,te=Math.floor(Q/8),Q-=te*8,M-=te,this.loadWord(),R<<=Q,F-=Q},this.readBits=function(Q){var te=Math.min(F,Q),ce=R>>>32-te;if(F-=te,F>0)R<<=te;else if(M>0)this.loadWord();if(te=Q-te,te>0)return ce<<te|this.readBits(te);return ce},this.skipLeadingZeros=function(){var Q;for(Q=0;Q<F;++Q)if((R&2147483648>>>Q)!==0)return R<<=Q,F-=Q,Q;return this.loadWord(),Q+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var Q=this.skipLeadingZeros();return this.readBits(Q+1)-1},this.readExpGolomb=function(){var Q=this.readUnsignedExpGolomb();if(1&Q)return 1+Q>>>1;return-1*(Q>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var ym=Kd,$d=i,vm=ym,pu,mu,Yd;mu=function(){var _=0,M,R;mu.prototype.init.call(this),this.push=function(F){var Q;if(!R)R=F.data;else Q=new Uint8Array(R.byteLength+F.data.byteLength),Q.set(R),Q.set(F.data,R.byteLength),R=Q;var te=R.byteLength;for(;_<te-3;_++)if(R[_+2]===1){M=_+5;break}while(M<te)switch(R[M]){case 0:if(R[M-1]!==0){M+=2;break}else if(R[M-2]!==0){M++;break}if(_+3!==M-2)this.trigger("data",R.subarray(_+3,M-2));do M++;while(R[M]!==1&&M<te);_=M-2,M+=3;break;case 1:if(R[M-1]!==0||R[M-2]!==0){M+=3;break}this.trigger("data",R.subarray(_+3,M-2)),_=M-2,M+=3;break;default:M+=3;break}R=R.subarray(_),M-=_,_=0},this.reset=function(){R=null,_=0,this.trigger("reset")},this.flush=function(){if(R&&R.byteLength>3)this.trigger("data",R.subarray(_+3));R=null,_=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},mu.prototype=new $d,Yd={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},pu=function(){var _=new mu,M,R,F,Q,te,ce,Se;pu.prototype.init.call(this),M=this,this.push=function(xe){if(xe.type!=="video")return;R=xe.trackId,F=xe.pts,Q=xe.dts,_.push(xe)},_.on("data",function(xe){var je={trackId:R,pts:F,dts:Q,data:xe,nalUnitTypeCode:xe[0]&31};switch(je.nalUnitTypeCode){case 5:je.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:je.nalUnitType="sei_rbsp",je.escapedRBSP=te(xe.subarray(1));break;case 7:je.nalUnitType="seq_parameter_set_rbsp",je.escapedRBSP=te(xe.subarray(1)),je.config=ce(je.escapedRBSP);break;case 8:je.nalUnitType="pic_parameter_set_rbsp";break;case 9:je.nalUnitType="access_unit_delimiter_rbsp";break}M.trigger("data",je)}),_.on("done",function(){M.trigger("done")}),_.on("partialdone",function(){M.trigger("partialdone")}),_.on("reset",function(){M.trigger("reset")}),_.on("endedtimeline",function(){M.trigger("endedtimeline")}),this.flush=function(){_.flush()},this.partialFlush=function(){_.partialFlush()},this.reset=function(){_.reset()},this.endTimeline=function(){_.endTimeline()},Se=function(xe,je){var Le=8,Qe=8,Rt,ft;for(Rt=0;Rt<xe;Rt++){if(Qe!==0)ft=je.readExpGolomb(),Qe=(Le+ft+256)%256;Le=Qe===0?Le:Qe}},te=function(xe){var je=xe.byteLength,Le=[],Qe=1,Rt,ft;while(Qe<je-2)if(xe[Qe]===0&&xe[Qe+1]===0&&xe[Qe+2]===3)Le.push(Qe+2),Qe+=2;else Qe++;if(Le.length===0)return xe;Rt=je-Le.length,ft=new Uint8Array(Rt);var zt=0;for(Qe=0;Qe<Rt;zt++,Qe++){if(zt===Le[0])zt++,Le.shift();ft[Qe]=xe[zt]}return ft},ce=function(xe){var je=0,Le=0,Qe=0,Rt=0,ft,zt,rn,Vi,Ds,mo,dc,pc,mc,gc,Bu,ti=[1,1],Sn,ra;if(ft=new vm(xe),zt=ft.readUnsignedByte(),Vi=ft.readUnsignedByte(),rn=ft.readUnsignedByte(),ft.skipUnsignedExpGolomb(),Yd[zt]){if(Ds=ft.readUnsignedExpGolomb(),Ds===3)ft.skipBits(1);if(ft.skipUnsignedExpGolomb(),ft.skipUnsignedExpGolomb(),ft.skipBits(1),ft.readBoolean()){Bu=Ds!==3?8:12;for(ra=0;ra<Bu;ra++)if(ft.readBoolean())if(ra<6)Se(16,ft);else Se(64,ft)}}if(ft.skipUnsignedExpGolomb(),mo=ft.readUnsignedExpGolomb(),mo===0)ft.readUnsignedExpGolomb();else if(mo===1){ft.skipBits(1),ft.skipExpGolomb(),ft.skipExpGolomb(),dc=ft.readUnsignedExpGolomb();for(ra=0;ra<dc;ra++)ft.skipExpGolomb()}if(ft.skipUnsignedExpGolomb(),ft.skipBits(1),pc=ft.readUnsignedExpGolomb(),mc=ft.readUnsignedExpGolomb(),gc=ft.readBits(1),gc===0)ft.skipBits(1);if(ft.skipBits(1),ft.readBoolean())je=ft.readUnsignedExpGolomb(),Le=ft.readUnsignedExpGolomb(),Qe=ft.readUnsignedExpGolomb(),Rt=ft.readUnsignedExpGolomb();if(ft.readBoolean()){if(ft.readBoolean()){switch(Sn=ft.readUnsignedByte(),Sn){case 1:ti=[1,1];break;case 2:ti=[12,11];break;case 3:ti=[10,11];break;case 4:ti=[16,11];break;case 5:ti=[40,33];break;case 6:ti=[24,11];break;case 7:ti=[20,11];break;case 8:ti=[32,11];break;case 9:ti=[80,33];break;case 10:ti=[18,11];break;case 11:ti=[15,11];break;case 12:ti=[64,33];break;case 13:ti=[160,99];break;case 14:ti=[4,3];break;case 15:ti=[3,2];break;case 16:ti=[2,1];break;case 255:{ti=[ft.readUnsignedByte()<<8|ft.readUnsignedByte(),ft.readUnsignedByte()<<8|ft.readUnsignedByte()];break}}if(ti)ti[0]/ti[1]}}return{profileIdc:zt,levelIdc:rn,profileCompatibility:Vi,width:(pc+1)*16-je*2-Le*2,height:(2-gc)*(mc+1)*16-Qe*2-Rt*2,sarRatio:ti}}},pu.prototype=new $d;var ic={H264Stream:pu,NalByteStream:mu},Sm=[96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000,7350],gu=function(_,M){var R=_[M+6]<<21|_[M+7]<<14|_[M+8]<<7|_[M+9],F=_[M+5],Q=(F&16)>>4;if(R=R>=0?R:0,Q)return R+20;return R+10},bu=function(_,M){if(_.length-M<10||_[M]!==73||_[M+1]!==68||_[M+2]!==51)return M;return M+=gu(_,M),bu(_,M)},_m=function(_){var M=bu(_,0);return _.length>=M+2&&(_[M]&255)===255&&(_[M+1]&240)===240&&(_[M+1]&22)===16},Nh=function(_){return _[0]<<21|_[1]<<14|_[2]<<7|_[3]},R2=function(_,M,R){var F,Q="";for(F=M;F<R;F++)Q+="%"+("00"+_[F].toString(16)).slice(-2);return Q},xm=function(_,M,R){return unescape(R2(_,M,R))},km=function(_,M){var R=(_[M+5]&224)>>5,F=_[M+4]<<3,Q=_[M+3]&6144;return Q|F|R},Tm=function(_,M){if(_[M]===73&&_[M+1]===68&&_[M+2]===51)return"timed-metadata";else if(_[M]&!0&&(_[M+1]&240)===240)return"audio";return null},Am=function(_){var M=0;while(M+5<_.length){if(_[M]!==255||(_[M+1]&246)!==240){M++;continue}return Sm[(_[M+2]&60)>>>2]}return null},Cm=function(_){var M,R,F,Q;if(M=10,_[5]&64)M+=4,M+=Nh(_.subarray(10,14));do{if(R=Nh(_.subarray(M+4,M+8)),R<1)return null;if(Q=String.fromCharCode(_[M],_[M+1],_[M+2],_[M+3]),Q==="PRIV"){F=_.subarray(M+10,M+R+10);for(var te=0;te<F.byteLength;te++)if(F[te]===0){var ce=xm(F,0,te);if(ce==="com.apple.streaming.transportStreamTimestamp"){var Se=F.subarray(te+1),xe=(Se[3]&1)<<30|Se[4]<<22|Se[5]<<14|Se[6]<<6|Se[7]>>>2;return xe*=4,xe+=Se[7]&3,xe}break}}M+=10,M+=R}while(M<_.byteLength);return null},wu={isLikelyAacData:_m,parseId3TagSize:gu,parseAdtsSize:km,parseType:Tm,parseSampleRate:Am,parseAacTimestamp:Cm},jm=i,Qd=wu,sc;sc=function(){var _=new Uint8Array,M=0;sc.prototype.init.call(this),this.setTimestamp=function(R){M=R},this.push=function(R){var F=0,Q=0,te,ce,Se,xe;if(_.length)xe=_.length,_=new Uint8Array(R.byteLength+xe),_.set(_.subarray(0,xe)),_.set(R,xe);else _=R;while(_.length-Q>=3){if(_[Q]===73&&_[Q+1]===68&&_[Q+2]===51){if(_.length-Q<10)break;if(F=Qd.parseId3TagSize(_,Q),Q+F>_.length)break;ce={type:"timed-metadata",data:_.subarray(Q,Q+F)},this.trigger("data",ce),Q+=F;continue}else if((_[Q]&255)===255&&(_[Q+1]&240)===240){if(_.length-Q<7)break;if(F=Qd.parseAdtsSize(_,Q),Q+F>_.length)break;Se={type:"audio",data:_.subarray(Q,Q+F),pts:M,dts:M},this.trigger("data",Se),Q+=F;continue}Q++}if(te=_.length-Q,te>0)_=_.subarray(Q);else _=new Uint8Array},this.reset=function(){_=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){_=new Uint8Array,this.trigger("endedtimeline")}},sc.prototype=new jm;var Em=sc,qm=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Dm=qm,Jd=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Im=Jd,yu=i,vu=Zt,Su=cn,_u=Yt,js=Wt,Ga=bm,rl=zn,Zd=Wd,Mm=ic.H264Stream,e0=Em,Rm=wu.isLikelyAacData,Om=zn.ONE_SECOND_IN_TS,Lr=Dm,ac=Im,rc,uo,xu,ho,O2=function(_,M){M.stream=_,this.trigger("log",M)},$i=function(_,M){var R=Object.keys(M);for(var F=0;F<R.length;F++){var Q=R[F];if(Q==="headOfPipeline"||!M[Q].on)continue;M[Q].on("log",O2.bind(_,Q))}},t0=function(_,M){var R;if(_.length!==M.length)return!1;for(R=0;R<_.length;R++)if(_[R]!==M[R])return!1;return!0},Ph=function(_,M,R,F,Q,te){var ce=R-M,Se=F-M,xe=Q-R;return{start:{dts:_,pts:_+ce},end:{dts:_+Se,pts:_+xe},prependedContentDuration:te,baseMediaDecodeTime:_}};uo=function(_,M){var R=[],F,Q=0,te=0,ce=1/0;M=M||{},F=M.firstSequenceNumber||0,uo.prototype.init.call(this),this.push=function(Se){if(js.collectDtsInfo(_,Se),_)Lr.forEach(function(xe){_[xe]=Se[xe]});R.push(Se)},this.setEarliestDts=function(Se){Q=Se},this.setVideoBaseMediaDecodeTime=function(Se){ce=Se},this.setAudioAppendStart=function(Se){te=Se},this.flush=function(){var Se,xe,je,Le,Qe,Rt,ft;if(R.length===0){this.trigger("done","AudioSegmentStream");return}if(Se=_u.trimAdtsFramesByEarliestDts(R,_,Q),_.baseMediaDecodeTime=js.calculateTrackBaseMediaDecodeTime(_,M.keepOriginalTimestamps),ft=_u.prefixWithSilence(_,Se,te,ce),_.samples=_u.generateSampleTable(Se),je=vu.mdat(_u.concatenateFrameData(Se)),R=[],xe=vu.moof(F,[_]),Le=new Uint8Array(xe.byteLength+je.byteLength),F++,Le.set(xe),Le.set(je,xe.byteLength),js.clearDtsInfo(_),Qe=Math.ceil(Om*1024/_.samplerate),Se.length)Rt=Se.length*Qe,this.trigger("segmentTimingInfo",Ph(rl.audioTsToVideoTs(_.baseMediaDecodeTime,_.samplerate),Se[0].dts,Se[0].pts,Se[0].dts+Rt,Se[0].pts+Rt,ft||0)),this.trigger("timingInfo",{start:Se[0].pts,end:Se[0].pts+Rt});this.trigger("data",{track:_,boxes:Le}),this.trigger("done","AudioSegmentStream")},this.reset=function(){js.clearDtsInfo(_),R=[],this.trigger("reset")}},uo.prototype=new yu,rc=function(_,M){var R,F=[],Q=[],te,ce;M=M||{},R=M.firstSequenceNumber||0,rc.prototype.init.call(this),delete _.minPTS,this.gopCache_=[],this.push=function(Se){if(js.collectDtsInfo(_,Se),Se.nalUnitType==="seq_parameter_set_rbsp"&&!te)te=Se.config,_.sps=[Se.data],ac.forEach(function(xe){_[xe]=te[xe]},this);if(Se.nalUnitType==="pic_parameter_set_rbsp"&&!ce)ce=Se.data,_.pps=[Se.data];F.push(Se)},this.flush=function(){var Se,xe,je,Le,Qe,Rt,ft=0,zt,rn;while(F.length){if(F[0].nalUnitType==="access_unit_delimiter_rbsp")break;F.shift()}if(F.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(Se=Su.groupNalsIntoFrames(F),je=Su.groupFramesIntoGops(Se),!je[0][0].keyFrame)if(xe=this.getGopForFusion_(F[0],_),xe)ft=xe.duration,je.unshift(xe),je.byteLength+=xe.byteLength,je.nalCount+=xe.nalCount,je.pts=xe.pts,je.dts=xe.dts,je.duration+=xe.duration;else je=Su.extendFirstKeyFrame(je);if(Q.length){var Vi;if(M.alignGopsAtEnd)Vi=this.alignGopsAtEnd_(je);else Vi=this.alignGopsAtStart_(je);if(!Vi){this.gopCache_.unshift({gop:je.pop(),pps:_.pps,sps:_.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),F=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}js.clearDtsInfo(_),je=Vi}js.collectDtsInfo(_,je),_.samples=Su.generateSampleTable(je),Qe=vu.mdat(Su.concatenateNalData(je)),_.baseMediaDecodeTime=js.calculateTrackBaseMediaDecodeTime(_,M.keepOriginalTimestamps),this.trigger("processedGopsInfo",je.map(function(Ds){return{pts:Ds.pts,dts:Ds.dts,byteLength:Ds.byteLength}})),zt=je[0],rn=je[je.length-1],this.trigger("segmentTimingInfo",Ph(_.baseMediaDecodeTime,zt.dts,zt.pts,rn.dts+rn.duration,rn.pts+rn.duration,ft)),this.trigger("timingInfo",{start:je[0].pts,end:je[je.length-1].pts+je[je.length-1].duration}),this.gopCache_.unshift({gop:je.pop(),pps:_.pps,sps:_.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),F=[],this.trigger("baseMediaDecodeTime",_.baseMediaDecodeTime),this.trigger("timelineStartInfo",_.timelineStartInfo),Le=vu.moof(R,[_]),Rt=new Uint8Array(Le.byteLength+Qe.byteLength),R++,Rt.set(Le),Rt.set(Qe,Le.byteLength),this.trigger("data",{track:_,boxes:Rt}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),F=[],this.gopCache_.length=0,Q.length=0,this.trigger("reset")},this.resetStream_=function(){js.clearDtsInfo(_),te=void 0,ce=void 0},this.getGopForFusion_=function(Se){var xe=45000,je=1e4,Le=1/0,Qe,Rt,ft,zt,rn;for(rn=0;rn<this.gopCache_.length;rn++){if(zt=this.gopCache_[rn],ft=zt.gop,!(_.pps&&t0(_.pps[0],zt.pps[0]))||!(_.sps&&t0(_.sps[0],zt.sps[0])))continue;if(ft.dts<_.timelineStartInfo.dts)continue;if(Qe=Se.dts-ft.dts-ft.duration,Qe>=-je&&Qe<=xe){if(!Rt||Le>Qe)Rt=zt,Le=Qe}}if(Rt)return Rt.gop;return null},this.alignGopsAtStart_=function(Se){var xe,je,Le,Qe,Rt,ft,zt,rn;Rt=Se.byteLength,ft=Se.nalCount,zt=Se.duration,xe=je=0;while(xe<Q.length&&je<Se.length){if(Le=Q[xe],Qe=Se[je],Le.pts===Qe.pts)break;if(Qe.pts>Le.pts){xe++;continue}je++,Rt-=Qe.byteLength,ft-=Qe.nalCount,zt-=Qe.duration}if(je===0)return Se;if(je===Se.length)return null;return rn=Se.slice(je),rn.byteLength=Rt,rn.duration=zt,rn.nalCount=ft,rn.pts=rn[0].pts,rn.dts=rn[0].dts,rn},this.alignGopsAtEnd_=function(Se){var xe,je,Le,Qe,Rt,ft;xe=Q.length-1,je=Se.length-1,Rt=null,ft=!1;while(xe>=0&&je>=0){if(Le=Q[xe],Qe=Se[je],Le.pts===Qe.pts){ft=!0;break}if(Le.pts>Qe.pts){xe--;continue}if(xe===Q.length-1)Rt=je;je--}if(!ft&&Rt===null)return null;var zt;if(ft)zt=je;else zt=Rt;if(zt===0)return Se;var rn=Se.slice(zt),Vi=rn.reduce(function(Ds,mo){return Ds.byteLength+=mo.byteLength,Ds.duration+=mo.duration,Ds.nalCount+=mo.nalCount,Ds},{byteLength:0,duration:0,nalCount:0});return rn.byteLength=Vi.byteLength,rn.duration=Vi.duration,rn.nalCount=Vi.nalCount,rn.pts=rn[0].pts,rn.dts=rn[0].dts,rn},this.alignGopsWith=function(Se){Q=Se}},rc.prototype=new yu,ho=function(_,M){if(this.numberOfTracks=0,this.metadataStream=M,_=_||{},typeof _.remux<"u")this.remuxTracks=!!_.remux;else this.remuxTracks=!0;if(typeof _.keepOriginalTimestamps==="boolean")this.keepOriginalTimestamps=_.keepOriginalTimestamps;else this.keepOriginalTimestamps=!1;this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,ho.prototype.init.call(this),this.push=function(R){if(R.content||R.text)return this.pendingCaptions.push(R);if(R.frames)return this.pendingMetadata.push(R);if(this.pendingTracks.push(R.track),this.pendingBytes+=R.boxes.byteLength,R.track.type==="video")this.videoTrack=R.track,this.pendingBoxes.push(R.boxes);if(R.track.type==="audio")this.audioTrack=R.track,this.pendingBoxes.unshift(R.boxes)}},ho.prototype=new yu,ho.prototype.flush=function(_){var M=0,R={captions:[],captionStreams:{},metadata:[],info:{}},F,Q,te,ce=0,Se;if(this.pendingTracks.length<this.numberOfTracks){if(_!=="VideoSegmentStream"&&_!=="AudioSegmentStream")return;else if(this.remuxTracks)return;else if(this.pendingTracks.length===0){if(this.emittedTracks++,this.emittedTracks>=this.numberOfTracks)this.trigger("done"),this.emittedTracks=0;return}}if(this.videoTrack)ce=this.videoTrack.timelineStartInfo.pts,ac.forEach(function(xe){R.info[xe]=this.videoTrack[xe]},this);else if(this.audioTrack)ce=this.audioTrack.timelineStartInfo.pts,Lr.forEach(function(xe){R.info[xe]=this.audioTrack[xe]},this);if(this.videoTrack||this.audioTrack){if(this.pendingTracks.length===1)R.type=this.pendingTracks[0].type;else R.type="combined";this.emittedTracks+=this.pendingTracks.length,te=vu.initSegment(this.pendingTracks),R.initSegment=new Uint8Array(te.byteLength),R.initSegment.set(te),R.data=new Uint8Array(this.pendingBytes);for(Se=0;Se<this.pendingBoxes.length;Se++)R.data.set(this.pendingBoxes[Se],M),M+=this.pendingBoxes[Se].byteLength;for(Se=0;Se<this.pendingCaptions.length;Se++)F=this.pendingCaptions[Se],F.startTime=rl.metadataTsToSeconds(F.startPts,ce,this.keepOriginalTimestamps),F.endTime=rl.metadataTsToSeconds(F.endPts,ce,this.keepOriginalTimestamps),R.captionStreams[F.stream]=!0,R.captions.push(F);for(Se=0;Se<this.pendingMetadata.length;Se++)Q=this.pendingMetadata[Se],Q.cueTime=rl.metadataTsToSeconds(Q.pts,ce,this.keepOriginalTimestamps),R.metadata.push(Q);R.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",R);for(Se=0;Se<R.captions.length;Se++)F=R.captions[Se],this.trigger("caption",F);for(Se=0;Se<R.metadata.length;Se++)Q=R.metadata[Se],this.trigger("id3Frame",Q)}if(this.emittedTracks>=this.numberOfTracks)this.trigger("done"),this.emittedTracks=0},ho.prototype.setRemux=function(_){this.remuxTracks=_},xu=function(_){var M=this,R=!0,F,Q;xu.prototype.init.call(this),_=_||{},this.baseMediaDecodeTime=_.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var te={};this.transmuxPipeline_=te,te.type="aac",te.metadataStream=new Ga.MetadataStream,te.aacStream=new e0,te.audioTimestampRolloverStream=new Ga.TimestampRolloverStream("audio"),te.timedMetadataTimestampRolloverStream=new Ga.TimestampRolloverStream("timed-metadata"),te.adtsStream=new Zd,te.coalesceStream=new ho(_,te.metadataStream),te.headOfPipeline=te.aacStream,te.aacStream.pipe(te.audioTimestampRolloverStream).pipe(te.adtsStream),te.aacStream.pipe(te.timedMetadataTimestampRolloverStream).pipe(te.metadataStream).pipe(te.coalesceStream),te.metadataStream.on("timestamp",function(ce){te.aacStream.setTimestamp(ce.timeStamp)}),te.aacStream.on("data",function(ce){if(ce.type!=="timed-metadata"&&ce.type!=="audio"||te.audioSegmentStream)return;Q=Q||{timelineStartInfo:{baseMediaDecodeTime:M.baseMediaDecodeTime},codec:"adts",type:"audio"},te.coalesceStream.numberOfTracks++,te.audioSegmentStream=new uo(Q,_),te.audioSegmentStream.on("log",M.getLogTrigger_("audioSegmentStream")),te.audioSegmentStream.on("timingInfo",M.trigger.bind(M,"audioTimingInfo")),te.adtsStream.pipe(te.audioSegmentStream).pipe(te.coalesceStream),M.trigger("trackinfo",{hasAudio:!!Q,hasVideo:!!F})}),te.coalesceStream.on("data",this.trigger.bind(this,"data")),te.coalesceStream.on("done",this.trigger.bind(this,"done")),$i(this,te)},this.setupTsPipeline=function(){var te={};this.transmuxPipeline_=te,te.type="ts",te.metadataStream=new Ga.MetadataStream,te.packetStream=new Ga.TransportPacketStream,te.parseStream=new Ga.TransportParseStream,te.elementaryStream=new Ga.ElementaryStream,te.timestampRolloverStream=new Ga.TimestampRolloverStream,te.adtsStream=new Zd,te.h264Stream=new Mm,te.captionStream=new Ga.CaptionStream(_),te.coalesceStream=new ho(_,te.metadataStream),te.headOfPipeline=te.packetStream,te.packetStream.pipe(te.parseStream).pipe(te.elementaryStream).pipe(te.timestampRolloverStream),te.timestampRolloverStream.pipe(te.h264Stream),te.timestampRolloverStream.pipe(te.adtsStream),te.timestampRolloverStream.pipe(te.metadataStream).pipe(te.coalesceStream),te.h264Stream.pipe(te.captionStream).pipe(te.coalesceStream),te.elementaryStream.on("data",function(ce){var Se;if(ce.type==="metadata"){Se=ce.tracks.length;while(Se--)if(!F&&ce.tracks[Se].type==="video")F=ce.tracks[Se],F.timelineStartInfo.baseMediaDecodeTime=M.baseMediaDecodeTime;else if(!Q&&ce.tracks[Se].type==="audio")Q=ce.tracks[Se],Q.timelineStartInfo.baseMediaDecodeTime=M.baseMediaDecodeTime;if(F&&!te.videoSegmentStream)te.coalesceStream.numberOfTracks++,te.videoSegmentStream=new rc(F,_),te.videoSegmentStream.on("log",M.getLogTrigger_("videoSegmentStream")),te.videoSegmentStream.on("timelineStartInfo",function(xe){if(Q&&!_.keepOriginalTimestamps)Q.timelineStartInfo=xe,te.audioSegmentStream.setEarliestDts(xe.dts-M.baseMediaDecodeTime)}),te.videoSegmentStream.on("processedGopsInfo",M.trigger.bind(M,"gopInfo")),te.videoSegmentStream.on("segmentTimingInfo",M.trigger.bind(M,"videoSegmentTimingInfo")),te.videoSegmentStream.on("baseMediaDecodeTime",function(xe){if(Q)te.audioSegmentStream.setVideoBaseMediaDecodeTime(xe)}),te.videoSegmentStream.on("timingInfo",M.trigger.bind(M,"videoTimingInfo")),te.h264Stream.pipe(te.videoSegmentStream).pipe(te.coalesceStream);if(Q&&!te.audioSegmentStream)te.coalesceStream.numberOfTracks++,te.audioSegmentStream=new uo(Q,_),te.audioSegmentStream.on("log",M.getLogTrigger_("audioSegmentStream")),te.audioSegmentStream.on("timingInfo",M.trigger.bind(M,"audioTimingInfo")),te.audioSegmentStream.on("segmentTimingInfo",M.trigger.bind(M,"audioSegmentTimingInfo")),te.adtsStream.pipe(te.audioSegmentStream).pipe(te.coalesceStream);M.trigger("trackinfo",{hasAudio:!!Q,hasVideo:!!F})}}),te.coalesceStream.on("data",this.trigger.bind(this,"data")),te.coalesceStream.on("id3Frame",function(ce){ce.dispatchType=te.metadataStream.dispatchType,M.trigger("id3Frame",ce)}),te.coalesceStream.on("caption",this.trigger.bind(this,"caption")),te.coalesceStream.on("done",this.trigger.bind(this,"done")),$i(this,te)},this.setBaseMediaDecodeTime=function(te){var ce=this.transmuxPipeline_;if(!_.keepOriginalTimestamps)this.baseMediaDecodeTime=te;if(Q){if(Q.timelineStartInfo.dts=void 0,Q.timelineStartInfo.pts=void 0,js.clearDtsInfo(Q),ce.audioTimestampRolloverStream)ce.audioTimestampRolloverStream.discontinuity()}if(F){if(ce.videoSegmentStream)ce.videoSegmentStream.gopCache_=[];F.timelineStartInfo.dts=void 0,F.timelineStartInfo.pts=void 0,js.clearDtsInfo(F),ce.captionStream.reset()}if(ce.timestampRolloverStream)ce.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(te){if(Q)this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(te)},this.setRemux=function(te){var ce=this.transmuxPipeline_;if(_.remux=te,ce&&ce.coalesceStream)ce.coalesceStream.setRemux(te)},this.alignGopsWith=function(te){if(F&&this.transmuxPipeline_.videoSegmentStream)this.transmuxPipeline_.videoSegmentStream.alignGopsWith(te)},this.getLogTrigger_=function(te){var ce=this;return function(Se){Se.stream=te,ce.trigger("log",Se)}},this.push=function(te){if(R){var ce=Rm(te);if(ce&&this.transmuxPipeline_.type!=="aac")this.setupAacPipeline();else if(!ce&&this.transmuxPipeline_.type!=="ts")this.setupTsPipeline();R=!1}this.transmuxPipeline_.headOfPipeline.push(te)},this.flush=function(){R=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){if(this.transmuxPipeline_.headOfPipeline)this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){if(this.transmuxPipeline_.captionStream)this.transmuxPipeline_.captionStream.reset()}},xu.prototype=new yu;var Fm={Transmuxer:xu,VideoSegmentStream:rc,AudioSegmentStream:uo,AUDIO_PROPERTIES:Lr,VIDEO_PROPERTIES:ac,generateSegmentTimingInfo:Ph},Nm=function(_){return _>>>0},ku=function(_){return("00"+_.toString(16)).slice(-2)},Tu={toUnsigned:Nm,toHexString:ku},Bh=function(_){var M="";return M+=String.fromCharCode(_[0]),M+=String.fromCharCode(_[1]),M+=String.fromCharCode(_[2]),M+=String.fromCharCode(_[3]),M},Lh=Bh,F2=Tu.toUnsigned,Hh=Lh,Uh=function(_,M){var R=[],F,Q,te,ce,Se;if(!M.length)return null;for(F=0;F<_.byteLength;){if(Q=F2(_[F]<<24|_[F+1]<<16|_[F+2]<<8|_[F+3]),te=Hh(_.subarray(F+4,F+8)),ce=Q>1?F+Q:_.byteLength,te===M[0]){if(M.length===1)R.push(_.subarray(F+8,ce));else if(Se=Uh(_.subarray(F+8,ce),M.slice(1)),Se.length)R=R.concat(Se)}F=ce}return R},Au=Uh,Pm=Tu.toUnsigned,Bm=r.getUint64,n0=function(_){var M={version:_[0],flags:new Uint8Array(_.subarray(1,4))};if(M.version===1)M.baseMediaDecodeTime=Bm(_.subarray(4));else M.baseMediaDecodeTime=Pm(_[4]<<24|_[5]<<16|_[6]<<8|_[7]);return M},Cu=n0,Lm=function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength),R={version:_[0],flags:new Uint8Array(_.subarray(1,4)),trackId:M.getUint32(4)},F=R.flags[2]&1,Q=R.flags[2]&2,te=R.flags[2]&8,ce=R.flags[2]&16,Se=R.flags[2]&32,xe=R.flags[0]&65536,je=R.flags[0]&131072,Le;if(Le=8,F)Le+=4,R.baseDataOffset=M.getUint32(12),Le+=4;if(Q)R.sampleDescriptionIndex=M.getUint32(Le),Le+=4;if(te)R.defaultSampleDuration=M.getUint32(Le),Le+=4;if(ce)R.defaultSampleSize=M.getUint32(Le),Le+=4;if(Se)R.defaultSampleFlags=M.getUint32(Le);if(xe)R.durationIsEmpty=!0;if(!F&&je)R.baseDataOffsetIsMoof=!0;return R},Eu=Lm,qu=r.getUint64,i0=function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength),R={version:_[0],flags:new Uint8Array(_.subarray(1,4)),references:[],referenceId:M.getUint32(4),timescale:M.getUint32(8)},F=12;if(R.version===0)R.earliestPresentationTime=M.getUint32(F),R.firstOffset=M.getUint32(F+4),F+=8;else R.earliestPresentationTime=qu(_.subarray(F)),R.firstOffset=qu(_.subarray(F+8)),F+=16;F+=2;var Q=M.getUint16(F);F+=2;for(;Q>0;F+=12,Q--)R.references.push({referenceType:(_[F]&128)>>>7,referencedSize:M.getUint32(F)&2147483647,subsegmentDuration:M.getUint32(F+4),startsWithSap:!!(_[F+8]&128),sapType:(_[F+8]&112)>>>4,sapDeltaTime:M.getUint32(F+8)&268435455});return R},Hm=i0,a0=function(_){return{isLeading:(_[0]&12)>>>2,dependsOn:_[0]&3,isDependedOn:(_[1]&192)>>>6,hasRedundancy:(_[1]&48)>>>4,paddingValue:(_[1]&14)>>>1,isNonSyncSample:_[1]&1,degradationPriority:_[2]<<8|_[3]}},Um=a0,dr=Um,r0=function(_){var M={version:_[0],flags:new Uint8Array(_.subarray(1,4)),samples:[]},R=new DataView(_.buffer,_.byteOffset,_.byteLength),F=M.flags[2]&1,Q=M.flags[2]&4,te=M.flags[1]&1,ce=M.flags[1]&2,Se=M.flags[1]&4,xe=M.flags[1]&8,je=R.getUint32(4),Le=8,Qe;if(F)M.dataOffset=R.getInt32(Le),Le+=4;if(Q&&je){if(Qe={flags:dr(_.subarray(Le,Le+4))},Le+=4,te)Qe.duration=R.getUint32(Le),Le+=4;if(ce)Qe.size=R.getUint32(Le),Le+=4;if(xe){if(M.version===1)Qe.compositionTimeOffset=R.getInt32(Le);else Qe.compositionTimeOffset=R.getUint32(Le);Le+=4}M.samples.push(Qe),je--}while(je--){if(Qe={},te)Qe.duration=R.getUint32(Le),Le+=4;if(ce)Qe.size=R.getUint32(Le),Le+=4;if(Se)Qe.flags=dr(_.subarray(Le,Le+4)),Le+=4;if(xe){if(M.version===1)Qe.compositionTimeOffset=R.getInt32(Le);else Qe.compositionTimeOffset=R.getUint32(Le);Le+=4}M.samples.push(Qe)}return M},zm=r0,Gm=r,wa=Gm.getUint64,Gi,zh,Ws=function(_){return new Date(_*1000-2082844800000)},oc=Lh,Vm=Au,o0=function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength),R=[],F,Q;for(F=0;F+4<_.length;F+=Q){if(Q=M.getUint32(F),F+=4,Q<=0){R.push("<span style='color:red;'>MALFORMED DATA</span>");continue}switch(_[F]&31){case 1:R.push("slice_layer_without_partitioning_rbsp");break;case 5:R.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:R.push("sei_rbsp");break;case 7:R.push("seq_parameter_set_rbsp");break;case 8:R.push("pic_parameter_set_rbsp");break;case 9:R.push("access_unit_delimiter_rbsp");break;default:R.push("UNKNOWN NAL - "+_[F]&31);break}}return R},pr={avc1:function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength);return{dataReferenceIndex:M.getUint16(6),width:M.getUint16(24),height:M.getUint16(26),horizresolution:M.getUint16(28)+M.getUint16(30)/16,vertresolution:M.getUint16(32)+M.getUint16(34)/16,frameCount:M.getUint16(40),depth:M.getUint16(74),config:Gi(_.subarray(78,_.byteLength))}},avcC:function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength),R={configurationVersion:_[0],avcProfileIndication:_[1],profileCompatibility:_[2],avcLevelIndication:_[3],lengthSizeMinusOne:_[4]&3,sps:[],pps:[]},F=_[5]&31,Q,te,ce,Se;ce=6;for(Se=0;Se<F;Se++)te=M.getUint16(ce),ce+=2,R.sps.push(new Uint8Array(_.subarray(ce,ce+te))),ce+=te;Q=_[ce],ce++;for(Se=0;Se<Q;Se++)te=M.getUint16(ce),ce+=2,R.pps.push(new Uint8Array(_.subarray(ce,ce+te))),ce+=te;return R},btrt:function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength);return{bufferSizeDB:M.getUint32(0),maxBitrate:M.getUint32(4),avgBitrate:M.getUint32(8)}},edts:function(M){return{boxes:Gi(M)}},elst:function(M){var R=new DataView(M.buffer,M.byteOffset,M.byteLength),F={version:R.getUint8(0),flags:new Uint8Array(M.subarray(1,4)),edits:[]},Q=R.getUint32(4),te;for(te=8;Q;Q--)if(F.version===0)F.edits.push({segmentDuration:R.getUint32(te),mediaTime:R.getInt32(te+4),mediaRate:R.getUint16(te+8)+R.getUint16(te+10)/65536}),te+=12;else F.edits.push({segmentDuration:wa(M.subarray(te)),mediaTime:wa(M.subarray(te+8)),mediaRate:R.getUint16(te+16)+R.getUint16(te+18)/65536}),te+=20;return F},esds:function(_){return{version:_[0],flags:new Uint8Array(_.subarray(1,4)),esId:_[6]<<8|_[7],streamPriority:_[8]&31,decoderConfig:{objectProfileIndication:_[11],streamType:_[12]>>>2&63,bufferSize:_[13]<<16|_[14]<<8|_[15],maxBitrate:_[16]<<24|_[17]<<16|_[18]<<8|_[19],avgBitrate:_[20]<<24|_[21]<<16|_[22]<<8|_[23],decoderConfigDescriptor:{tag:_[24],length:_[25],audioObjectType:_[26]>>>3&31,samplingFrequencyIndex:(_[26]&7)<<1|_[27]>>>7&1,channelConfiguration:_[27]>>>3&15}}}},ftyp:function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength),R={majorBrand:oc(_.subarray(0,4)),minorVersion:M.getUint32(4),compatibleBrands:[]},F=8;while(F<_.byteLength)R.compatibleBrands.push(oc(_.subarray(F,F+4))),F+=4;return R},dinf:function(_){return{boxes:Gi(_)}},dref:function(_){return{version:_[0],flags:new Uint8Array(_.subarray(1,4)),dataReferences:Gi(_.subarray(8))}},hdlr:function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength),R={version:M.getUint8(0),flags:new Uint8Array(_.subarray(1,4)),handlerType:oc(_.subarray(8,12)),name:""},F=8;for(F=24;F<_.byteLength;F++){if(_[F]===0){F++;break}R.name+=String.fromCharCode(_[F])}return R.name=decodeURIComponent(escape(R.name)),R},mdat:function(_){return{byteLength:_.byteLength,nals:o0(_)}},mdhd:function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength),R=4,F,Q={version:M.getUint8(0),flags:new Uint8Array(_.subarray(1,4)),language:""};if(Q.version===1)R+=4,Q.creationTime=Ws(M.getUint32(R)),R+=8,Q.modificationTime=Ws(M.getUint32(R)),R+=4,Q.timescale=M.getUint32(R),R+=8,Q.duration=M.getUint32(R);else Q.creationTime=Ws(M.getUint32(R)),R+=4,Q.modificationTime=Ws(M.getUint32(R)),R+=4,Q.timescale=M.getUint32(R),R+=4,Q.duration=M.getUint32(R);return R+=4,F=M.getUint16(R),Q.language+=String.fromCharCode((F>>10)+96),Q.language+=String.fromCharCode(((F&992)>>5)+96),Q.language+=String.fromCharCode((F&31)+96),Q},mdia:function(_){return{boxes:Gi(_)}},mfhd:function(_){return{version:_[0],flags:new Uint8Array(_.subarray(1,4)),sequenceNumber:_[4]<<24|_[5]<<16|_[6]<<8|_[7]}},minf:function(_){return{boxes:Gi(_)}},mp4a:function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength),R={dataReferenceIndex:M.getUint16(6),channelcount:M.getUint16(16),samplesize:M.getUint16(18),samplerate:M.getUint16(24)+M.getUint16(26)/65536};if(_.byteLength>28)R.streamDescriptor=Gi(_.subarray(28))[0];return R},moof:function(_){return{boxes:Gi(_)}},moov:function(_){return{boxes:Gi(_)}},mvex:function(_){return{boxes:Gi(_)}},mvhd:function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength),R=4,F={version:M.getUint8(0),flags:new Uint8Array(_.subarray(1,4))};if(F.version===1)R+=4,F.creationTime=Ws(M.getUint32(R)),R+=8,F.modificationTime=Ws(M.getUint32(R)),R+=4,F.timescale=M.getUint32(R),R+=8,F.duration=M.getUint32(R);else F.creationTime=Ws(M.getUint32(R)),R+=4,F.modificationTime=Ws(M.getUint32(R)),R+=4,F.timescale=M.getUint32(R),R+=4,F.duration=M.getUint32(R);return R+=4,F.rate=M.getUint16(R)+M.getUint16(R+2)/16,R+=4,F.volume=M.getUint8(R)+M.getUint8(R+1)/8,R+=2,R+=2,R+=8,F.matrix=new Uint32Array(_.subarray(R,R+36)),R+=36,R+=24,F.nextTrackId=M.getUint32(R),F},pdin:function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength);return{version:M.getUint8(0),flags:new Uint8Array(_.subarray(1,4)),rate:M.getUint32(4),initialDelay:M.getUint32(8)}},sdtp:function(_){var M={version:_[0],flags:new Uint8Array(_.subarray(1,4)),samples:[]},R;for(R=4;R<_.byteLength;R++)M.samples.push({dependsOn:(_[R]&48)>>4,isDependedOn:(_[R]&12)>>2,hasRedundancy:_[R]&3});return M},sidx:Hm,smhd:function(_){return{version:_[0],flags:new Uint8Array(_.subarray(1,4)),balance:_[4]+_[5]/256}},stbl:function(_){return{boxes:Gi(_)}},ctts:function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength),R={version:M.getUint8(0),flags:new Uint8Array(_.subarray(1,4)),compositionOffsets:[]},F=M.getUint32(4),Q;for(Q=8;F;Q+=8,F--)R.compositionOffsets.push({sampleCount:M.getUint32(Q),sampleOffset:M[R.version===0?"getUint32":"getInt32"](Q+4)});return R},stss:function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength),R={version:M.getUint8(0),flags:new Uint8Array(_.subarray(1,4)),syncSamples:[]},F=M.getUint32(4),Q;for(Q=8;F;Q+=4,F--)R.syncSamples.push(M.getUint32(Q));return R},stco:function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength),R={version:_[0],flags:new Uint8Array(_.subarray(1,4)),chunkOffsets:[]},F=M.getUint32(4),Q;for(Q=8;F;Q+=4,F--)R.chunkOffsets.push(M.getUint32(Q));return R},stsc:function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength),R=M.getUint32(4),F={version:_[0],flags:new Uint8Array(_.subarray(1,4)),sampleToChunks:[]},Q;for(Q=8;R;Q+=12,R--)F.sampleToChunks.push({firstChunk:M.getUint32(Q),samplesPerChunk:M.getUint32(Q+4),sampleDescriptionIndex:M.getUint32(Q+8)});return F},stsd:function(_){return{version:_[0],flags:new Uint8Array(_.subarray(1,4)),sampleDescriptions:Gi(_.subarray(8))}},stsz:function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength),R={version:_[0],flags:new Uint8Array(_.subarray(1,4)),sampleSize:M.getUint32(4),entries:[]},F;for(F=12;F<_.byteLength;F+=4)R.entries.push(M.getUint32(F));return R},stts:function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength),R={version:_[0],flags:new Uint8Array(_.subarray(1,4)),timeToSamples:[]},F=M.getUint32(4),Q;for(Q=8;F;Q+=8,F--)R.timeToSamples.push({sampleCount:M.getUint32(Q),sampleDelta:M.getUint32(Q+4)});return R},styp:function(_){return pr.ftyp(_)},tfdt:Cu,tfhd:Eu,tkhd:function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength),R=4,F={version:M.getUint8(0),flags:new Uint8Array(_.subarray(1,4))};if(F.version===1)R+=4,F.creationTime=Ws(M.getUint32(R)),R+=8,F.modificationTime=Ws(M.getUint32(R)),R+=4,F.trackId=M.getUint32(R),R+=4,R+=8,F.duration=M.getUint32(R);else F.creationTime=Ws(M.getUint32(R)),R+=4,F.modificationTime=Ws(M.getUint32(R)),R+=4,F.trackId=M.getUint32(R),R+=4,R+=4,F.duration=M.getUint32(R);return R+=4,R+=8,F.layer=M.getUint16(R),R+=2,F.alternateGroup=M.getUint16(R),R+=2,F.volume=M.getUint8(R)+M.getUint8(R+1)/8,R+=2,R+=2,F.matrix=new Uint32Array(_.subarray(R,R+36)),R+=36,F.width=M.getUint16(R)+M.getUint16(R+2)/65536,R+=4,F.height=M.getUint16(R)+M.getUint16(R+2)/65536,F},traf:function(_){return{boxes:Gi(_)}},trak:function(_){return{boxes:Gi(_)}},trex:function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength);return{version:_[0],flags:new Uint8Array(_.subarray(1,4)),trackId:M.getUint32(4),defaultSampleDescriptionIndex:M.getUint32(8),defaultSampleDuration:M.getUint32(12),defaultSampleSize:M.getUint32(16),sampleDependsOn:_[20]&3,sampleIsDependedOn:(_[21]&192)>>6,sampleHasRedundancy:(_[21]&48)>>4,samplePaddingValue:(_[21]&14)>>1,sampleIsDifferenceSample:!!(_[21]&1),sampleDegradationPriority:M.getUint16(22)}},trun:zm,"url ":function(_){return{version:_[0],flags:new Uint8Array(_.subarray(1,4))}},vmhd:function(_){var M=new DataView(_.buffer,_.byteOffset,_.byteLength);return{version:_[0],flags:new Uint8Array(_.subarray(1,4)),graphicsmode:M.getUint16(4),opcolor:new Uint16Array([M.getUint16(6),M.getUint16(8),M.getUint16(10)])}}};Gi=function(_){var M=0,R=[],F,Q,te,ce,Se,xe=new ArrayBuffer(_.length),je=new Uint8Array(xe);for(var Le=0;Le<_.length;++Le)je[Le]=_[Le];F=new DataView(xe);while(M<_.byteLength)Q=F.getUint32(M),te=oc(_.subarray(M+4,M+8)),ce=Q>1?M+Q:_.byteLength,Se=(pr[te]||function(Qe){return{data:Qe}})(_.subarray(M+8,ce)),Se.size=Q,Se.type=te,R.push(Se),M=ce;return R},zh=function(_,M){var R;return M=M||0,R=Array(M*2+1).join(" "),_.map(function(F,Q){return R+F.type+`
|
|
200
|
+
`+Object.keys(F).filter(function(te){return te!=="type"&&te!=="boxes"}).map(function(te){var ce=R+" "+te+": ",Se=F[te];if(Se instanceof Uint8Array||Se instanceof Uint32Array){var xe=Array.prototype.slice.call(new Uint8Array(Se.buffer,Se.byteOffset,Se.byteLength)).map(function(je){return" "+("00"+je.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);if(!xe)return ce+"<>";if(xe.length===1)return ce+"<"+xe.join("").slice(1)+">";return ce+`<
|
|
201
|
+
`+xe.map(function(je){return R+" "+je}).join(`
|
|
202
|
+
`)+`
|
|
203
|
+
`+R+" >"}return ce+JSON.stringify(Se,null,2).split(`
|
|
204
|
+
`).map(function(je,Le){if(Le===0)return je;return R+" "+je}).join(`
|
|
205
|
+
`)}).join(`
|
|
206
|
+
`)+(F.boxes?`
|
|
207
|
+
`+zh(F.boxes,M+1):"")}).join(`
|
|
208
|
+
`)};var l0={inspect:Gi,textify:zh,parseType:oc,findBox:Vm,parseTraf:pr.traf,parseTfdt:pr.tfdt,parseHdlr:pr.hdlr,parseTfhd:pr.tfhd,parseTrun:pr.trun,parseSidx:pr.sidx},Gh=function(_){var M=0,R=String.fromCharCode(_[M]),F="";while(R!=="\x00")F+=R,M++,R=String.fromCharCode(_[M]);return F+=R,F},Du={uint8ToCString:Gh},$n=Du.uint8ToCString,N2=r.getUint64,P2=function(_){var M=4,R=_[0],F,Q,te,ce,Se,xe,je,Le;if(R===0){F=$n(_.subarray(M)),M+=F.length,Q=$n(_.subarray(M)),M+=Q.length;var Qe=new DataView(_.buffer);te=Qe.getUint32(M),M+=4,Se=Qe.getUint32(M),M+=4,xe=Qe.getUint32(M),M+=4,je=Qe.getUint32(M),M+=4}else if(R===1){var Qe=new DataView(_.buffer);te=Qe.getUint32(M),M+=4,ce=N2(_.subarray(M)),M+=8,xe=Qe.getUint32(M),M+=4,je=Qe.getUint32(M),M+=4,F=$n(_.subarray(M)),M+=F.length,Q=$n(_.subarray(M)),M+=Q.length}Le=new Uint8Array(_.subarray(M,_.byteLength));var Rt={scheme_id_uri:F,value:Q,timescale:te?te:1,presentation_time:ce,presentation_time_delta:Se,event_duration:xe,id:je,message_data:Le};return Iu(R,Rt)?Rt:void 0},Xm=function(_,M,R,F){return _||_===0?_/M:F+R/M},Iu=function(_,M){var R=M.scheme_id_uri!=="\x00",F=_===0&&Hr(M.presentation_time_delta)&&R,Q=_===1&&Hr(M.presentation_time)&&R;return!(_>1)&&F||Q},Hr=function(_){return _!==void 0||_!==null},Km={parseEmsgBox:P2,scaleTime:Xm},lc;if(typeof window<"u")lc=window;else if(typeof e<"u")lc=e;else if(typeof self<"u")lc=self;else lc={};var cc=lc,{toUnsigned:sa,toHexString:uc}=Tu,wi=Au,cl=Lh,Mu=Km,c0=Eu,Vh=zm,$m=Cu,Qm=r.getUint64,Jm,u0,h0,va,Xh,Wh,f0,d0=cc,Kh=ds.parseId3Frames;Jm=function(_){var M={},R=wi(_,["moov","trak"]);return R.reduce(function(F,Q){var te,ce,Se,xe,je;if(te=wi(Q,["tkhd"])[0],!te)return null;if(ce=te[0],Se=ce===0?12:20,xe=sa(te[Se]<<24|te[Se+1]<<16|te[Se+2]<<8|te[Se+3]),je=wi(Q,["mdia","mdhd"])[0],!je)return null;return ce=je[0],Se=ce===0?12:20,F[xe]=sa(je[Se]<<24|je[Se+1]<<16|je[Se+2]<<8|je[Se+3]),F},M)},u0=function(_,M){var R=wi(M,["moof","traf"]),F=R.reduce(function(Q,te){var ce=wi(te,["tfhd"])[0],Se=sa(ce[4]<<24|ce[5]<<16|ce[6]<<8|ce[7]),xe=_[Se]||90000,je=wi(te,["tfdt"])[0],Le=new DataView(je.buffer,je.byteOffset,je.byteLength),Qe;if(je[0]===1)Qe=Qm(je.subarray(4,12));else Qe=Le.getUint32(4);let Rt;if(typeof Qe==="bigint")Rt=Qe/d0.BigInt(xe);else if(typeof Qe==="number"&&!isNaN(Qe))Rt=Qe/xe;if(Rt<Number.MAX_SAFE_INTEGER)Rt=Number(Rt);if(Rt<Q)Q=Rt;return Q},1/0);return typeof F==="bigint"||isFinite(F)?F:0},h0=function(_,M){var R=wi(M,["moof","traf"]),F=0,Q=0,te;if(R&&R.length){var ce=wi(R[0],["tfhd"])[0],Se=wi(R[0],["trun"])[0],xe=wi(R[0],["tfdt"])[0];if(ce){var je=c0(ce);te=je.trackId}if(xe){var Le=$m(xe);F=Le.baseMediaDecodeTime}if(Se){var Qe=Vh(Se);if(Qe.samples&&Qe.samples.length)Q=Qe.samples[0].compositionTimeOffset||0}}var Rt=_[te]||90000;if(typeof F==="bigint")Q=d0.BigInt(Q),Rt=d0.BigInt(Rt);var ft=(F+Q)/Rt;if(typeof ft==="bigint"&&ft<Number.MAX_SAFE_INTEGER)ft=Number(ft);return ft},va=function(_){var M=wi(_,["moov","trak"]),R=[];return M.forEach(function(F){var Q=wi(F,["mdia","hdlr"]),te=wi(F,["tkhd"]);Q.forEach(function(ce,Se){var xe=cl(ce.subarray(8,12)),je=te[Se],Le,Qe,Rt;if(xe==="vide")Le=new DataView(je.buffer,je.byteOffset,je.byteLength),Qe=Le.getUint8(0),Rt=Qe===0?Le.getUint32(12):Le.getUint32(20),R.push(Rt)})}),R},Wh=function(_){var M=_[0],R=M===0?12:20;return sa(_[R]<<24|_[R+1]<<16|_[R+2]<<8|_[R+3])},Xh=function(_){var M=wi(_,["moov","trak"]),R=[];return M.forEach(function(F){var Q={},te=wi(F,["tkhd"])[0],ce,Se;if(te)ce=new DataView(te.buffer,te.byteOffset,te.byteLength),Se=ce.getUint8(0),Q.id=Se===0?ce.getUint32(12):ce.getUint32(20);var xe=wi(F,["mdia","hdlr"])[0];if(xe){var je=cl(xe.subarray(8,12));if(je==="vide")Q.type="video";else if(je==="soun")Q.type="audio";else Q.type=je}var Le=wi(F,["mdia","minf","stbl","stsd"])[0];if(Le){var Qe=Le.subarray(8);Q.codec=cl(Qe.subarray(4,8));var Rt=wi(Qe,[Q.codec])[0],ft,zt;if(Rt)if(/^[asm]vc[1-9]$/i.test(Q.codec))if(ft=Rt.subarray(78),zt=cl(ft.subarray(4,8)),zt==="avcC"&&ft.length>11)Q.codec+=".",Q.codec+=uc(ft[9]),Q.codec+=uc(ft[10]),Q.codec+=uc(ft[11]);else Q.codec="avc1.4d400d";else if(/^mp4[a,v]$/i.test(Q.codec))if(ft=Rt.subarray(28),zt=cl(ft.subarray(4,8)),zt==="esds"&&ft.length>20&&ft[19]!==0)Q.codec+="."+uc(ft[19]),Q.codec+="."+uc(ft[20]>>>2&63).replace(/^0/,"");else Q.codec="mp4a.40.2";else Q.codec=Q.codec.toLowerCase()}var rn=wi(F,["mdia","mdhd"])[0];if(rn)Q.timescale=Wh(rn);R.push(Q)}),R},f0=function(_,M=0){var R=wi(_,["emsg"]);return R.map((F)=>{var Q=Mu.parseEmsgBox(new Uint8Array(F)),te=Kh(Q.message_data);return{cueTime:Mu.scaleTime(Q.presentation_time,Q.timescale,Q.presentation_time_delta,M),duration:Mu.scaleTime(Q.event_duration,Q.timescale),frames:te}})};var Bi={findBox:wi,parseType:cl,timescale:Jm,startTime:u0,compositionStartTime:h0,videoTrackIds:va,tracks:Xh,getTimescaleFromMediaHeader:Wh,getEmsgID3:f0};let{parseTrun:Zm}=l0,{findBox:ps}=Bi;var p0=cc,Ur=function(_){var M=ps(_,["moof","traf"]),R=ps(_,["mdat"]),F=[];return R.forEach(function(Q,te){var ce=M[te];F.push({mdat:Q,traf:ce})}),F},ul=function(_,M,R){var F=M,Q=R.defaultSampleDuration||0,te=R.defaultSampleSize||0,ce=R.trackId,Se=[];return _.forEach(function(xe){var je=Zm(xe),Le=je.samples;Le.forEach(function(Qe){if(Qe.duration===void 0)Qe.duration=Q;if(Qe.size===void 0)Qe.size=te;if(Qe.trackId=ce,Qe.dts=F,Qe.compositionTimeOffset===void 0)Qe.compositionTimeOffset=0;if(typeof F==="bigint")Qe.pts=F+p0.BigInt(Qe.compositionTimeOffset),F+=p0.BigInt(Qe.duration);else Qe.pts=F+Qe.compositionTimeOffset,F+=Qe.duration}),Se=Se.concat(Le)}),Se},mr={getMdatTrafPairs:Ur,parseSamples:ul},m0=Nd.discardEmulationPreventionBytes,g0=Pd.CaptionStream,aa=Au,eg=Cu,hc=Eu,{getMdatTrafPairs:Ru,parseSamples:fl}=mr,tg=function(_,M){var R=_;for(var F=0;F<M.length;F++){var Q=M[F];if(R<Q.size)return Q;R-=Q.size}return null},ng=function(_,M,R){var F=new DataView(_.buffer,_.byteOffset,_.byteLength),Q={logs:[],seiNals:[]},te,ce,Se,xe;for(ce=0;ce+4<_.length;ce+=Se){if(Se=F.getUint32(ce),ce+=4,Se<=0)continue;switch(_[ce]&31){case 6:var je=_.subarray(ce+1,ce+1+Se),Le=tg(ce,M);if(te={nalUnitType:"sei_rbsp",size:Se,data:je,escapedRBSP:m0(je),trackId:R},Le)te.pts=Le.pts,te.dts=Le.dts,xe=Le;else if(xe)te.pts=xe.pts,te.dts=xe.dts;else{Q.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+ce+" for trackId "+R+". See mux.js#223."});break}Q.seiNals.push(te);break}}return Q},Ou=function(_,M){var R={},F=Ru(_);return F.forEach(function(Q){var{mdat:te,traf:ce}=Q,Se=aa(ce,["tfhd"]),xe=hc(Se[0]),je=xe.trackId,Le=aa(ce,["tfdt"]),Qe=Le.length>0?eg(Le[0]).baseMediaDecodeTime:0,Rt=aa(ce,["trun"]),ft,zt;if(M===je&&Rt.length>0){if(ft=fl(Rt,Qe,xe),zt=ng(te,ft,je),!R[je])R[je]={seiNals:[],logs:[]};R[je].seiNals=R[je].seiNals.concat(zt.seiNals),R[je].logs=R[je].logs.concat(zt.logs)}}),R},ig=function(_,M,R){var F;if(M===null)return null;F=Ou(_,M);var Q=F[M]||{};return{seiNals:Q.seiNals,logs:Q.logs,timescale:R}},$h=function(){var _=!1,M,R,F,Q,te,ce;this.isInitialized=function(){return _},this.init=function(Se){M=new g0,_=!0,ce=Se?Se.isPartial:!1,M.on("data",function(xe){xe.startTime=xe.startPts/Q,xe.endTime=xe.endPts/Q,te.captions.push(xe),te.captionStreams[xe.stream]=!0}),M.on("log",function(xe){te.logs.push(xe)})},this.isNewInit=function(Se,xe){if(Se&&Se.length===0||xe&&typeof xe==="object"&&Object.keys(xe).length===0)return!1;return F!==Se[0]||Q!==xe[F]},this.parse=function(Se,xe,je){var Le;if(!this.isInitialized())return null;else if(!xe||!je)return null;else if(this.isNewInit(xe,je))F=xe[0],Q=je[F];else if(F===null||!Q)return R.push(Se),null;while(R.length>0){var Qe=R.shift();this.parse(Qe,xe,je)}if(Le=ig(Se,F,Q),Le&&Le.logs)te.logs=te.logs.concat(Le.logs);if(Le===null||!Le.seiNals){if(te.logs.length)return{logs:te.logs,captions:[],captionStreams:[]};return null}return this.pushNals(Le.seiNals),this.flushStream(),te},this.pushNals=function(Se){if(!this.isInitialized()||!Se||Se.length===0)return null;Se.forEach(function(xe){M.push(xe)})},this.flushStream=function(){if(!this.isInitialized())return null;if(!ce)M.flush();else M.partialFlush()},this.clearParsedCaptions=function(){te.captions=[],te.captionStreams={},te.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;M.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){if(R=[],F=null,Q=null,!te)te={captions:[],captionStreams:{},logs:[]};else this.clearParsedCaptions();this.resetCaptionStream()},this.reset()},sg=$h;let{parseTfdt:b0}=l0,br=Au,{getTimescaleFromMediaHeader:w0}=Bi,{parseSamples:rg,getMdatTrafPairs:y0}=mr;var v0=function(){let _=90000;this.init=function(M){let R=br(M,["moov","trak","mdia","mdhd"])[0];if(R)_=w0(R)},this.parseSegment=function(M){let R=[],F=y0(M),Q=0;return F.forEach(function(te){let{mdat:ce,traf:Se}=te,xe=br(Se,["tfdt"])[0],je=br(Se,["tfhd"])[0],Le=br(Se,["trun"]);if(xe)Q=b0(xe).baseMediaDecodeTime;if(Le.length&&je){let Qe=rg(Le,Q,je),Rt=0;Qe.forEach(function(ft){let rn=new TextDecoder("utf-8"),Vi=ce.slice(Rt,Rt+ft.size);if(br(Vi,["vtte"])[0]){Rt+=ft.size;return}br(Vi,["vttc"]).forEach(function(dc){let pc=br(dc,["payl"])[0],mc=br(dc,["sttg"])[0],gc=ft.pts/_,Bu=(ft.pts+ft.duration)/_,ti,Sn;if(pc)try{ti=rn.decode(pc)}catch(ra){console.error(ra)}if(mc)try{Sn=rn.decode(mc)}catch(ra){console.error(ra)}if(ft.duration&&ti)R.push({cueText:ti,start:gc,end:Bu,settings:Sn})}),Rt+=ft.size})}}),R}},ms=iu,S0=function(_){var M=_[1]&31;return M<<=8,M|=_[2],M},Fu=function(_){return!!(_[1]&64)},Yh=function(_){var M=0;if((_[3]&48)>>>4>1)M+=_[4]+1;return M},fo=function(_,M){var R=S0(_);if(R===0)return"pat";else if(R===M)return"pmt";else if(M)return"pes";return null},og=function(_){var M=Fu(_),R=4+Yh(_);if(M)R+=_[R]+1;return(_[R+10]&31)<<8|_[R+11]},_0=function(_){var M={},R=Fu(_),F=4+Yh(_);if(R)F+=_[F]+1;if(!(_[F+5]&1))return;var Q,te,ce;Q=(_[F+1]&15)<<8|_[F+2],te=3+Q-4,ce=(_[F+10]&15)<<8|_[F+11];var Se=12+ce;while(Se<te){var xe=F+Se;M[(_[xe+1]&31)<<8|_[xe+2]]=_[xe],Se+=((_[xe+3]&15)<<8|_[xe+4])+5}return M},fc=function(_,M){var R=S0(_),F=M[R];switch(F){case ms.H264_STREAM_TYPE:return"video";case ms.ADTS_STREAM_TYPE:return"audio";case ms.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},lg=function(_){var M=Fu(_);if(!M)return null;var R=4+Yh(_);if(R>=_.byteLength)return null;var F=null,Q;if(Q=_[R+7],Q&192){if(F={},F.pts=(_[R+9]&14)<<27|(_[R+10]&255)<<20|(_[R+11]&254)<<12|(_[R+12]&255)<<5|(_[R+13]&254)>>>3,F.pts*=4,F.pts+=(_[R+13]&6)>>>1,F.dts=F.pts,Q&64)F.dts=(_[R+14]&14)<<27|(_[R+15]&255)<<20|(_[R+16]&254)<<12|(_[R+17]&255)<<5|(_[R+18]&254)>>>3,F.dts*=4,F.dts+=(_[R+18]&6)>>>1}return F},Qh=function(_){switch(_){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},cg=function(_){var M=4+Yh(_),R=_.subarray(M),F=0,Q=0,te=!1,ce;for(;Q<R.byteLength-3;Q++)if(R[Q+2]===1){F=Q+5;break}while(F<R.byteLength)switch(R[F]){case 0:if(R[F-1]!==0){F+=2;break}else if(R[F-2]!==0){F++;break}if(Q+3!==F-2){if(ce=Qh(R[Q+3]&31),ce==="slice_layer_without_partitioning_rbsp_idr")te=!0}do F++;while(R[F]!==1&&F<R.length);Q=F-2,F+=3;break;case 1:if(R[F-1]!==0||R[F-2]!==0){F+=3;break}if(ce=Qh(R[Q+3]&31),ce==="slice_layer_without_partitioning_rbsp_idr")te=!0;Q=F-2,F+=3;break;default:F+=3;break}if(R=R.subarray(Q),F-=Q,Q=0,R&&R.byteLength>3){if(ce=Qh(R[Q+3]&31),ce==="slice_layer_without_partitioning_rbsp_idr")te=!0}return te},ug={parseType:fo,parsePat:og,parsePmt:_0,parsePayloadUnitStartIndicator:Fu,parsePesType:fc,parsePesTime:lg,videoPacketContainsKeyFrame:cg},Pu=iu,po=Xs.handleRollover,Xn={};Xn.ts=ug,Xn.aac=wu;var dl=zn.ONE_SECOND_IN_TS,qs=188,Va=71,hg=function(_,M){var R=0,F=qs,Q,te;while(F<_.byteLength){if(_[R]===Va&&_[F]===Va){switch(Q=_.subarray(R,F),te=Xn.ts.parseType(Q,M.pid),te){case"pat":M.pid=Xn.ts.parsePat(Q);break;case"pmt":var ce=Xn.ts.parsePmt(Q);M.table=M.table||{},Object.keys(ce).forEach(function(Se){M.table[Se]=ce[Se]});break}R+=qs,F+=qs;continue}R++,F++}},pl=function(_,M,R){var F=0,Q=qs,te,ce,Se,xe,je,Le=!1;while(Q<=_.byteLength){if(_[F]===Va&&(_[Q]===Va||Q===_.byteLength)){switch(te=_.subarray(F,Q),ce=Xn.ts.parseType(te,M.pid),ce){case"pes":if(Se=Xn.ts.parsePesType(te,M.table),xe=Xn.ts.parsePayloadUnitStartIndicator(te),Se==="audio"&&xe){if(je=Xn.ts.parsePesTime(te),je)je.type="audio",R.audio.push(je),Le=!0}break}if(Le)break;F+=qs,Q+=qs;continue}F++,Q++}Q=_.byteLength,F=Q-qs,Le=!1;while(F>=0){if(_[F]===Va&&(_[Q]===Va||Q===_.byteLength)){switch(te=_.subarray(F,Q),ce=Xn.ts.parseType(te,M.pid),ce){case"pes":if(Se=Xn.ts.parsePesType(te,M.table),xe=Xn.ts.parsePayloadUnitStartIndicator(te),Se==="audio"&&xe){if(je=Xn.ts.parsePesTime(te),je)je.type="audio",R.audio.push(je),Le=!0}break}if(Le)break;F-=qs,Q-=qs;continue}F--,Q--}},Jh=function(_,M,R){var F=0,Q=qs,te,ce,Se,xe,je,Le,Qe,Rt,ft=!1,zt={data:[],size:0};while(Q<_.byteLength){if(_[F]===Va&&_[Q]===Va){switch(te=_.subarray(F,Q),ce=Xn.ts.parseType(te,M.pid),ce){case"pes":if(Se=Xn.ts.parsePesType(te,M.table),xe=Xn.ts.parsePayloadUnitStartIndicator(te),Se==="video"){if(xe&&!ft){if(je=Xn.ts.parsePesTime(te),je)je.type="video",R.video.push(je),ft=!0}if(!R.firstKeyFrame){if(xe){if(zt.size!==0){Le=new Uint8Array(zt.size),Qe=0;while(zt.data.length)Rt=zt.data.shift(),Le.set(Rt,Qe),Qe+=Rt.byteLength;if(Xn.ts.videoPacketContainsKeyFrame(Le)){var rn=Xn.ts.parsePesTime(Le);if(rn)R.firstKeyFrame=rn,R.firstKeyFrame.type="video";else console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}zt.size=0}}zt.data.push(te),zt.size+=te.byteLength}}break}if(ft&&R.firstKeyFrame)break;F+=qs,Q+=qs;continue}F++,Q++}Q=_.byteLength,F=Q-qs,ft=!1;while(F>=0){if(_[F]===Va&&_[Q]===Va){switch(te=_.subarray(F,Q),ce=Xn.ts.parseType(te,M.pid),ce){case"pes":if(Se=Xn.ts.parsePesType(te,M.table),xe=Xn.ts.parsePayloadUnitStartIndicator(te),Se==="video"&&xe){if(je=Xn.ts.parsePesTime(te),je)je.type="video",R.video.push(je),ft=!0}break}if(ft)break;F-=qs,Q-=qs;continue}F--,Q--}},fg=function(_,M){if(_.audio&&_.audio.length){var R=M;if(typeof R>"u"||isNaN(R))R=_.audio[0].dts;_.audio.forEach(function(te){te.dts=po(te.dts,R),te.pts=po(te.pts,R),te.dtsTime=te.dts/dl,te.ptsTime=te.pts/dl})}if(_.video&&_.video.length){var F=M;if(typeof F>"u"||isNaN(F))F=_.video[0].dts;if(_.video.forEach(function(te){te.dts=po(te.dts,F),te.pts=po(te.pts,F),te.dtsTime=te.dts/dl,te.ptsTime=te.pts/dl}),_.firstKeyFrame){var Q=_.firstKeyFrame;Q.dts=po(Q.dts,F),Q.pts=po(Q.pts,F),Q.dtsTime=Q.dts/dl,Q.ptsTime=Q.pts/dl}}},dg=function(_){var M=!1,R=0,F=null,Q=null,te=0,ce=0,Se;while(_.length-ce>=3){var xe=Xn.aac.parseType(_,ce);switch(xe){case"timed-metadata":if(_.length-ce<10){M=!0;break}if(te=Xn.aac.parseId3TagSize(_,ce),te>_.length){M=!0;break}if(Q===null)Se=_.subarray(ce,ce+te),Q=Xn.aac.parseAacTimestamp(Se);ce+=te;break;case"audio":if(_.length-ce<7){M=!0;break}if(te=Xn.aac.parseAdtsSize(_,ce),te>_.length){M=!0;break}if(F===null)Se=_.subarray(ce,ce+te),F=Xn.aac.parseSampleRate(Se);R++,ce+=te;break;default:ce++;break}if(M)return null}if(F===null||Q===null)return null;var je=dl/F,Le={audio:[{type:"audio",dts:Q,pts:Q},{type:"audio",dts:Q+R*1024*je,pts:Q+R*1024*je}]};return Le},pg=function(_){var M={pid:null,table:null},R={};hg(_,M);for(var F in M.table)if(M.table.hasOwnProperty(F)){var Q=M.table[F];switch(Q){case Pu.H264_STREAM_TYPE:if(R.video=[],Jh(_,M,R),R.video.length===0)delete R.video;break;case Pu.ADTS_STREAM_TYPE:if(R.audio=[],pl(_,M,R),R.audio.length===0)delete R.audio;break}}return R},mg=function(_,M){var R=Xn.aac.isLikelyAacData(_),F;if(R)F=dg(_);else F=pg(_);if(!F||!F.audio&&!F.video)return null;return fg(F,M),F},gg={inspect:mg,parseAudioPes_:pl};let bg=function(_,M){M.on("data",function(R){let F=R.initSegment;R.initSegment={data:F.buffer,byteOffset:F.byteOffset,byteLength:F.byteLength};let Q=R.data;R.data=Q.buffer,_.postMessage({action:"data",segment:R,byteOffset:Q.byteOffset,byteLength:Q.byteLength},[R.data])}),M.on("done",function(R){_.postMessage({action:"done"})}),M.on("gopInfo",function(R){_.postMessage({action:"gopInfo",gopInfo:R})}),M.on("videoSegmentTimingInfo",function(R){let F={start:{decode:zn.videoTsToSeconds(R.start.dts),presentation:zn.videoTsToSeconds(R.start.pts)},end:{decode:zn.videoTsToSeconds(R.end.dts),presentation:zn.videoTsToSeconds(R.end.pts)},baseMediaDecodeTime:zn.videoTsToSeconds(R.baseMediaDecodeTime)};if(R.prependedContentDuration)F.prependedContentDuration=zn.videoTsToSeconds(R.prependedContentDuration);_.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:F})}),M.on("audioSegmentTimingInfo",function(R){let F={start:{decode:zn.videoTsToSeconds(R.start.dts),presentation:zn.videoTsToSeconds(R.start.pts)},end:{decode:zn.videoTsToSeconds(R.end.dts),presentation:zn.videoTsToSeconds(R.end.pts)},baseMediaDecodeTime:zn.videoTsToSeconds(R.baseMediaDecodeTime)};if(R.prependedContentDuration)F.prependedContentDuration=zn.videoTsToSeconds(R.prependedContentDuration);_.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:F})}),M.on("id3Frame",function(R){_.postMessage({action:"id3Frame",id3Frame:R})}),M.on("caption",function(R){_.postMessage({action:"caption",caption:R})}),M.on("trackinfo",function(R){_.postMessage({action:"trackinfo",trackInfo:R})}),M.on("audioTimingInfo",function(R){_.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:zn.videoTsToSeconds(R.start),end:zn.videoTsToSeconds(R.end)}})}),M.on("videoTimingInfo",function(R){_.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:zn.videoTsToSeconds(R.start),end:zn.videoTsToSeconds(R.end)}})}),M.on("log",function(R){_.postMessage({action:"log",log:R})})};class ml{constructor(_,M){this.options=M||{},this.self=_,this.init()}init(){if(this.transmuxer)this.transmuxer.dispose();this.transmuxer=new Fm.Transmuxer(this.options),bg(this.self,this.transmuxer)}pushMp4Captions(_){if(!this.captionParser)this.captionParser=new sg,this.captionParser.init();let M=new Uint8Array(_.data,_.byteOffset,_.byteLength),R=this.captionParser.parse(M,_.trackIds,_.timescales);this.self.postMessage({action:"mp4Captions",captions:R&&R.captions||[],logs:R&&R.logs||[],data:M.buffer},[M.buffer])}initMp4WebVttParser(_){if(!this.webVttParser)this.webVttParser=new v0;let M=new Uint8Array(_.data,_.byteOffset,_.byteLength);this.webVttParser.init(M)}getMp4WebVttText(_){if(!this.webVttParser)this.webVttParser=new v0;let M=new Uint8Array(_.data,_.byteOffset,_.byteLength),R=this.webVttParser.parseSegment(M);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:R||[],data:M.buffer},[M.buffer])}probeMp4StartTime({timescales:_,data:M}){let R=Bi.startTime(_,M);this.self.postMessage({action:"probeMp4StartTime",startTime:R,data:M},[M.buffer])}probeMp4Tracks({data:_}){let M=Bi.tracks(_);this.self.postMessage({action:"probeMp4Tracks",tracks:M,data:_},[_.buffer])}probeEmsgID3({data:_,offset:M}){let R=Bi.getEmsgID3(_,M);this.self.postMessage({action:"probeEmsgID3",id3Frames:R,emsgData:_},[_.buffer])}probeTs({data:_,baseStartTime:M}){let R=typeof M==="number"&&!isNaN(M)?M*zn.ONE_SECOND_IN_TS:void 0,F=gg.inspect(_,R),Q=null;if(F){if(Q={hasVideo:F.video&&F.video.length===2||!1,hasAudio:F.audio&&F.audio.length===2||!1},Q.hasVideo)Q.videoStart=F.video[0].ptsTime;if(Q.hasAudio)Q.audioStart=F.audio[0].ptsTime}this.self.postMessage({action:"probeTs",result:Q,data:_},[_.buffer])}clearAllMp4Captions(){if(this.captionParser)this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){if(this.captionParser)this.captionParser.clearParsedCaptions()}push(_){let M=new Uint8Array(_.data,_.byteOffset,_.byteLength);this.transmuxer.push(M)}reset(){this.transmuxer.reset()}setTimestampOffset(_){let M=_.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(zn.secondsToVideoTs(M)))}setAudioAppendStart(_){this.transmuxer.setAudioAppendStart(Math.ceil(zn.secondsToVideoTs(_.appendStart)))}setRemux(_){this.transmuxer.setRemux(_.remux)}flush(_){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(_){this.transmuxer.alignGopsWith(_.gopsToAlignWith.slice())}}self.onmessage=function(_){if(_.data.action==="init"&&_.data.options){this.messageHandlers=new ml(self,_.data.options);return}if(!this.messageHandlers)this.messageHandlers=new ml(self);if(_.data&&_.data.action&&_.data.action!=="init"){if(this.messageHandlers[_.data.action])this.messageHandlers[_.data.action](_.data)}}}));var xR=IS(_R),kR=(e,n,i)=>{let{type:s,initSegment:a,captions:r,captionStreams:l,metadata:c,videoFrameDtsTime:p,videoFramePtsTime:m}=e.data.segment;n.buffer.push({captions:r,captionStreams:l,metadata:c});let g=e.data.segment.boxes||{data:e.data.segment.data},y={type:s,data:new Uint8Array(g.data,g.data.byteOffset,g.data.byteLength),initSegment:new Uint8Array(a.data,a.byteOffset,a.byteLength)};if(typeof p<"u")y.videoFrameDtsTime=p;if(typeof m<"u")y.videoFramePtsTime=m;i(y)},TR=({transmuxedData:e,callback:n})=>{e.buffer=[],n(e)},AR=(e,n)=>{n.gopInfo=e.data.gopInfo},FS=(e)=>{let{transmuxer:n,bytes:i,audioAppendStart:s,gopsToAlignWith:a,remux:r,onData:l,onTrackInfo:c,onAudioTimingInfo:p,onVideoTimingInfo:m,onVideoSegmentTimingInfo:g,onAudioSegmentTimingInfo:y,onId3:x,onCaptions:j,onDone:I,onEndedTimeline:P,onTransmuxerLog:X,isEndOfTimeline:Y,segment:J,triggerSegmentEventFn:ne}=e,ae={buffer:[]},se=Y,oe=(we)=>{if(n.currentTransmux!==e)return;if(we.data.action==="data")kR(we,ae,l);if(we.data.action==="trackinfo")c(we.data.trackInfo);if(we.data.action==="gopInfo")AR(we,ae);if(we.data.action==="audioTimingInfo")p(we.data.audioTimingInfo);if(we.data.action==="videoTimingInfo")m(we.data.videoTimingInfo);if(we.data.action==="videoSegmentTimingInfo")g(we.data.videoSegmentTimingInfo);if(we.data.action==="audioSegmentTimingInfo")y(we.data.audioSegmentTimingInfo);if(we.data.action==="id3Frame")x([we.data.id3Frame],we.data.id3Frame.dispatchType);if(we.data.action==="caption")j(we.data.caption);if(we.data.action==="endedtimeline")se=!1,P();if(we.data.action==="log")X(we.data.log);if(we.data.type!=="transmuxed")return;if(se)return;n.onmessage=null,TR({transmuxedData:ae,callback:I}),NS(n)},he=()=>{let we={message:"Received an error message from the transmuxer worker",metadata:{errorType:Ke.Error.StreamingFailedToTransmuxSegment,segmentInfo:ah({segment:J})}};I(null,we)};if(n.onmessage=oe,n.onerror=he,s)n.postMessage({action:"setAudioAppendStart",appendStart:s});if(Array.isArray(a))n.postMessage({action:"alignGopsWith",gopsToAlignWith:a});if(typeof r<"u")n.postMessage({action:"setRemux",remux:r});if(i.byteLength){let we=i instanceof ArrayBuffer?i:i.buffer,Ce=i instanceof ArrayBuffer?0:i.byteOffset;ne({type:"segmenttransmuxingstart",segment:J}),n.postMessage({action:"push",data:we,byteOffset:Ce,byteLength:i.byteLength},[we])}if(Y)n.postMessage({action:"endTimeline"});n.postMessage({action:"flush"})},NS=(e)=>{if(e.currentTransmux=null,e.transmuxQueue.length)if(e.currentTransmux=e.transmuxQueue.shift(),typeof e.currentTransmux==="function")e.currentTransmux();else FS(e.currentTransmux)},O8=(e,n)=>{e.postMessage({action:n}),NS(e)},PS=(e,n)=>{if(!n.currentTransmux){n.currentTransmux=e,O8(n,e);return}n.transmuxQueue.push(O8.bind(null,n,e))},CR=(e)=>{PS("reset",e)},jR=(e)=>{PS("endTimeline",e)},BS=(e)=>{if(!e.transmuxer.currentTransmux){e.transmuxer.currentTransmux=e,FS(e);return}e.transmuxer.transmuxQueue.push(e)},ER=(e)=>{let n=new xR;n.currentTransmux=null,n.transmuxQueue=[];let i=n.terminate;return n.terminate=()=>(n.currentTransmux=null,n.transmuxQueue.length=0,i.call(n)),n.postMessage({action:"init",options:e}),n},By={reset:CR,endTimeline:jR,transmux:BS,createTransmuxer:ER},Qf=function(e){let n=e.transmuxer,i=e.endAction||e.action,s=e.callback,a=Ii({},e,{endAction:null,transmuxer:null,callback:null}),r=(l)=>{if(l.data.action!==i)return;if(n.removeEventListener("message",r),l.data.data){if(l.data.data=new Uint8Array(l.data.data,e.byteOffset||0,e.byteLength||l.data.data.byteLength),e.data)e.data=l.data.data}s(l.data)};if(n.addEventListener("message",r),e.data){let l=e.data instanceof ArrayBuffer;a.byteOffset=l?0:e.data.byteOffset,a.byteLength=e.data.byteLength;let c=[l?e.data:e.data.buffer];n.postMessage(a,c)}else n.postMessage(a)},Io={FAILURE:2,TIMEOUT:-101,ABORTED:-102},LS="wvtt",r5=(e)=>{e.forEach((n)=>{n.abort()})},qR=(e)=>({bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}),DR=(e)=>{let n=e.target,s={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-n.requestTime||0};return s.bytesReceived=e.loaded,s.bandwidth=Math.floor(s.bytesReceived/s.roundTripTime*8*1000),s},a3=(e,n)=>{let{requestType:i}=n,s=uh({requestType:i,request:n,error:e});if(n.timedout)return{status:n.status,message:"HLS request timed-out at URL: "+n.uri,code:Io.TIMEOUT,xhr:n,metadata:s};if(n.aborted)return{status:n.status,message:"HLS request aborted at URL: "+n.uri,code:Io.ABORTED,xhr:n,metadata:s};if(e)return{status:n.status,message:"HLS request errored at URL: "+n.uri,code:Io.FAILURE,xhr:n,metadata:s};if(n.responseType==="arraybuffer"&&n.response.byteLength===0)return{status:n.status,message:"Empty HLS response at URL: "+n.uri,code:Io.FAILURE,xhr:n,metadata:s};return null},F8=(e,n,i,s)=>(a,r)=>{let l=r.response,c=a3(a,r);if(c)return i(c,e);if(l.byteLength!==16)return i({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:Io.FAILURE,xhr:r},e);let p=new DataView(l),m=new Uint32Array([p.getUint32(0),p.getUint32(4),p.getUint32(8),p.getUint32(12)]);for(let y=0;y<n.length;y++)n[y].bytes=m;let g={uri:r.uri};return s({type:"segmentkeyloadcomplete",segment:e,keyInfo:g}),i(null,e)},IR=(e,n)=>{if(n===LS)e.transmuxer.postMessage({action:"initMp4WebVttParser",data:e.map.bytes})},MR=(e,n,i)=>{if(n===LS)Qf({action:"getMp4WebVttText",data:e.bytes,transmuxer:e.transmuxer,callback:({data:s,mp4VttCues:a})=>{e.bytes=s,i(null,e,{mp4VttCues:a})}})},HS=(e,n)=>{let i=f1(e.map.bytes);if(i!=="mp4"){let s=e.map.resolvedUri||e.map.uri,a=i||"unknown";return n({internal:!0,message:`Found unsupported ${a} container for initialization segment at URL: ${s}`,code:Io.FAILURE,metadata:{mediaType:a}})}Qf({action:"probeMp4Tracks",data:e.map.bytes,transmuxer:e.transmuxer,callback:({tracks:s,data:a})=>(e.map.bytes=a,s.forEach(function(r){if(e.map.tracks=e.map.tracks||{},e.map.tracks[r.type])return;if(e.map.tracks[r.type]=r,typeof r.id==="number"&&r.timescale)e.map.timescales=e.map.timescales||{},e.map.timescales[r.id]=r.timescale;if(r.type==="text")IR(e,r.codec)}),n(null))})},RR=({segment:e,finishProcessingFn:n,triggerSegmentEventFn:i})=>(s,a)=>{let r=a3(s,a);if(r)return n(r,e);let l=new Uint8Array(a.response);if(i({type:"segmentloaded",segment:e}),e.map.key)return e.map.encryptedBytes=l,n(null,e);e.map.bytes=l,HS(e,function(c){if(c)return c.xhr=a,c.status=a.status,n(c,e);n(null,e)})},OR=({segment:e,finishProcessingFn:n,responseType:i,triggerSegmentEventFn:s})=>(a,r)=>{let l=a3(a,r);if(l)return n(l,e);s({type:"segmentloaded",segment:e});let c=i==="arraybuffer"||!r.responseText?r.response:vR(r.responseText.substring(e.lastReachedChar||0));if(e.stats=qR(r),e.key)e.encryptedBytes=new Uint8Array(c);else e.bytes=new Uint8Array(c);return n(null,e)},FR=({segment:e,bytes:n,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:r,id3Fn:l,captionsFn:c,isEndOfTimeline:p,endedTimelineFn:m,dataFn:g,doneFn:y,onTransmuxerLog:x,triggerSegmentEventFn:j})=>{let I=e.map&&e.map.tracks||{},P=Boolean(I.audio&&I.video),X=s.bind(null,e,"audio","start"),Y=s.bind(null,e,"audio","end"),J=s.bind(null,e,"video","start"),ne=s.bind(null,e,"video","end"),ae=()=>BS({bytes:n,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,remux:P,onData:(se)=>{se.type=se.type==="combined"?"video":se.type,g(e,se)},onTrackInfo:(se)=>{if(i){if(P)se.isMuxed=!0;i(e,se)}},onAudioTimingInfo:(se)=>{if(X&&typeof se.start<"u")X(se.start),X=null;if(Y&&typeof se.end<"u")Y(se.end)},onVideoTimingInfo:(se)=>{if(J&&typeof se.start<"u")J(se.start),J=null;if(ne&&typeof se.end<"u")ne(se.end)},onVideoSegmentTimingInfo:(se)=>{let oe={pts:{start:se.start.presentation,end:se.end.presentation},dts:{start:se.start.decode,end:se.end.decode}};j({type:"segmenttransmuxingtiminginfoavailable",segment:e,timingInfo:oe}),a(se)},onAudioSegmentTimingInfo:(se)=>{let oe={pts:{start:se.start.pts,end:se.end.pts},dts:{start:se.start.dts,end:se.end.dts}};j({type:"segmenttransmuxingtiminginfoavailable",segment:e,timingInfo:oe}),r(se)},onId3:(se,oe)=>{l(e,se,oe)},onCaptions:(se)=>{c(e,[se])},isEndOfTimeline:p,onEndedTimeline:()=>{m()},onTransmuxerLog:x,onDone:(se,oe)=>{if(!y)return;se.type=se.type==="combined"?"video":se.type,j({type:"segmenttransmuxingcomplete",segment:e}),y(oe,e,se)},segment:e,triggerSegmentEventFn:j});Qf({action:"probeTs",transmuxer:e.transmuxer,data:n,baseStartTime:e.baseStartTime,callback:(se)=>{e.bytes=n=se.data;let oe=se.result;if(oe)i(e,{hasAudio:oe.hasAudio,hasVideo:oe.hasVideo,isMuxed:P}),i=null;ae()}})},US=({segment:e,bytes:n,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:r,id3Fn:l,captionsFn:c,isEndOfTimeline:p,endedTimelineFn:m,dataFn:g,doneFn:y,onTransmuxerLog:x,triggerSegmentEventFn:j})=>{let I=new Uint8Array(n);if(Zv(I)){e.isFmp4=!0;let{tracks:P}=e.map;if(P.text&&(!P.audio||!P.video)){g(e,{data:I,type:"text"}),MR(e,P.text.codec,y);return}let Y={isFmp4:!0,hasVideo:!!P.video,hasAudio:!!P.audio};if(P.audio&&P.audio.codec&&P.audio.codec!=="enca")Y.audioCodec=P.audio.codec;if(P.video&&P.video.codec&&P.video.codec!=="encv")Y.videoCodec=P.video.codec;if(P.video&&P.audio)Y.isMuxed=!0;i(e,Y);let J=(ne,ae)=>{if(g(e,{data:I,type:Y.hasAudio&&!Y.isMuxed?"audio":"video"}),ae&&ae.length)l(e,ae);if(ne&&ne.length)c(e,ne);y(null,e,{})};Qf({action:"probeMp4StartTime",timescales:e.map.timescales,data:I,transmuxer:e.transmuxer,callback:({data:ne,startTime:ae})=>{if(n=ne.buffer,e.bytes=I=ne,Y.hasAudio&&!Y.isMuxed)s(e,"audio","start",ae);if(Y.hasVideo)s(e,"video","start",ae);Qf({action:"probeEmsgID3",data:I,transmuxer:e.transmuxer,offset:ae,callback:({emsgData:se,id3Frames:oe})=>{if(n=se.buffer,e.bytes=I=se,!P.video||!se.byteLength||!e.transmuxer){J(void 0,oe);return}Qf({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:e.transmuxer,data:I,timescales:e.map.timescales,trackIds:[P.video.id],callback:(he)=>{n=he.data.buffer,e.bytes=I=he.data,he.logs.forEach(function(we){x(Jn(we,{stream:"mp4CaptionParser"}))}),J(he.captions,oe)}})}})}});return}if(!e.transmuxer){y(null,e,{});return}if(typeof e.container>"u")e.container=f1(I);if(e.container!=="ts"&&e.container!=="aac"){i(e,{hasAudio:!1,hasVideo:!1}),y(null,e,{});return}FR({segment:e,bytes:n,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:r,id3Fn:l,captionsFn:c,isEndOfTimeline:p,endedTimelineFn:m,dataFn:g,doneFn:y,onTransmuxerLog:x,triggerSegmentEventFn:j})},zS=function({id:e,key:n,encryptedBytes:i,decryptionWorker:s,segment:a,doneFn:r},l){let c=(m)=>{if(m.data.source===e){s.removeEventListener("message",c);let g=m.data.decrypted;l(new Uint8Array(g.bytes,g.byteOffset,g.byteLength))}};s.onerror=()=>{let g=ah({segment:a}),y={message:"An error occurred in the decryption worker",metadata:{error:Error("An error occurred in the decryption worker"),errorType:Ke.Error.StreamingFailedToDecryptSegment,segmentInfo:g,keyInfo:{uri:a.key.resolvedUri||a.map.key.resolvedUri}}};r(y,a)},s.addEventListener("message",c);let p;if(n.bytes.slice)p=n.bytes.slice();else p=new Uint32Array(Array.prototype.slice.call(n.bytes));s.postMessage(AS({source:e,encrypted:i,key:p,iv:n.iv}),[i.buffer,p.buffer])},NR=({decryptionWorker:e,segment:n,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:r,id3Fn:l,captionsFn:c,isEndOfTimeline:p,endedTimelineFn:m,dataFn:g,doneFn:y,onTransmuxerLog:x,triggerSegmentEventFn:j})=>{j({type:"segmentdecryptionstart"}),zS({id:n.requestId,key:n.key,encryptedBytes:n.encryptedBytes,decryptionWorker:e,segment:n,doneFn:y},(I)=>{n.bytes=I,j({type:"segmentdecryptioncomplete",segment:n}),US({segment:n,bytes:n.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:r,id3Fn:l,captionsFn:c,isEndOfTimeline:p,endedTimelineFn:m,dataFn:g,doneFn:y,onTransmuxerLog:x,triggerSegmentEventFn:j})})},PR=({activeXhrs:e,decryptionWorker:n,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:r,id3Fn:l,captionsFn:c,isEndOfTimeline:p,endedTimelineFn:m,dataFn:g,doneFn:y,onTransmuxerLog:x,triggerSegmentEventFn:j})=>{let I=0,P=!1;return(X,Y)=>{if(P)return;if(X)return P=!0,r5(e),y(X,Y);if(I+=1,I===e.length){let J=function(){if(Y.encryptedBytes)return NR({decryptionWorker:n,segment:Y,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:r,id3Fn:l,captionsFn:c,isEndOfTimeline:p,endedTimelineFn:m,dataFn:g,doneFn:y,onTransmuxerLog:x,triggerSegmentEventFn:j});US({segment:Y,bytes:Y.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:r,id3Fn:l,captionsFn:c,isEndOfTimeline:p,endedTimelineFn:m,dataFn:g,doneFn:y,onTransmuxerLog:x,triggerSegmentEventFn:j})};if(Y.endOfAllRequests=Date.now(),Y.map&&Y.map.encryptedBytes&&!Y.map.bytes)return j({type:"segmentdecryptionstart",segment:Y}),zS({decryptionWorker:n,id:Y.requestId+"-init",encryptedBytes:Y.map.encryptedBytes,key:Y.map.key,segment:Y,doneFn:y},(ne)=>{Y.map.bytes=ne,j({type:"segmentdecryptioncomplete",segment:Y}),HS(Y,(ae)=>{if(ae)return r5(e),y(ae,Y);J()})});J()}}},BR=({loadendState:e,abortFn:n})=>(i)=>{if(i.target.aborted&&n&&!e.calledAbortFn)n(),e.calledAbortFn=!0},LR=({segment:e,progressFn:n,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:r,id3Fn:l,captionsFn:c,isEndOfTimeline:p,endedTimelineFn:m,dataFn:g})=>(y)=>{if(y.target.aborted)return;if(e.stats=Jn(e.stats,DR(y)),!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived)e.stats.firstBytesReceivedAt=Date.now();return n(y,e)},HR=({xhr:e,xhrOptions:n,decryptionWorker:i,segment:s,abortFn:a,progressFn:r,trackInfoFn:l,timingInfoFn:c,videoSegmentTimingInfoFn:p,audioSegmentTimingInfoFn:m,id3Fn:g,captionsFn:y,isEndOfTimeline:x,endedTimelineFn:j,dataFn:I,doneFn:P,onTransmuxerLog:X,triggerSegmentEventFn:Y})=>{let J=[],ne=PR({activeXhrs:J,decryptionWorker:i,trackInfoFn:l,timingInfoFn:c,videoSegmentTimingInfoFn:p,audioSegmentTimingInfoFn:m,id3Fn:g,captionsFn:y,isEndOfTimeline:x,endedTimelineFn:j,dataFn:I,doneFn:P,onTransmuxerLog:X,triggerSegmentEventFn:Y});if(s.key&&!s.key.bytes){let we=[s.key];if(s.map&&!s.map.bytes&&s.map.key&&s.map.key.resolvedUri===s.key.resolvedUri)we.push(s.map.key);let Ce=Jn(n,{uri:s.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),Ne=F8(s,we,ne,Y),Pe={uri:s.key.resolvedUri};Y({type:"segmentkeyloadstart",segment:s,keyInfo:Pe});let Ue=e(Ce,Ne);J.push(Ue)}if(s.map&&!s.map.bytes){if(s.map.key&&(!s.key||s.key.resolvedUri!==s.map.key.resolvedUri)){let Ue=Jn(n,{uri:s.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),ze=F8(s,[s.map.key],ne,Y),He={uri:s.map.key.resolvedUri};Y({type:"segmentkeyloadstart",segment:s,keyInfo:He});let De=e(Ue,ze);J.push(De)}let Ce=Jn(n,{uri:s.map.resolvedUri,responseType:"arraybuffer",headers:a5(s.map),requestType:"segment-media-initialization"}),Ne=RR({segment:s,finishProcessingFn:ne,triggerSegmentEventFn:Y});Y({type:"segmentloadstart",segment:s});let Pe=e(Ce,Ne);J.push(Pe)}let ae=Jn(n,{uri:s.part&&s.part.resolvedUri||s.resolvedUri,responseType:"arraybuffer",headers:a5(s),requestType:"segment"}),se=OR({segment:s,finishProcessingFn:ne,responseType:ae.responseType,triggerSegmentEventFn:Y});Y({type:"segmentloadstart",segment:s});let oe=e(ae,se);oe.addEventListener("progress",LR({segment:s,progressFn:r,trackInfoFn:l,timingInfoFn:c,videoSegmentTimingInfoFn:p,audioSegmentTimingInfoFn:m,id3Fn:g,captionsFn:y,isEndOfTimeline:x,endedTimelineFn:j,dataFn:I})),J.push(oe);let he={};return J.forEach((we)=>{we.addEventListener("loadend",BR({loadendState:he,abortFn:a}))}),()=>r5(J)},g1=jr("PlaylistSelector"),N8=function(e){if(!e||!e.playlist)return;let n=e.playlist;return JSON.stringify({id:n.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:n.attributes&&n.attributes.CODECS||""})},Jf=function(e,n){if(!e)return"";let i=qe.default.getComputedStyle(e);if(!i)return"";return i[n]},Zf=function(e,n){let i=e.slice();e.sort(function(s,a){let r=n(s,a);if(r===0)return i.indexOf(s)-i.indexOf(a);return r})},r3=function(e,n){let i,s;if(e.attributes.BANDWIDTH)i=e.attributes.BANDWIDTH;if(i=i||qe.default.Number.MAX_VALUE,n.attributes.BANDWIDTH)s=n.attributes.BANDWIDTH;return s=s||qe.default.Number.MAX_VALUE,i-s},UR=function(e,n){let i,s;if(e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width)i=e.attributes.RESOLUTION.width;if(i=i||qe.default.Number.MAX_VALUE,n.attributes.RESOLUTION&&n.attributes.RESOLUTION.width)s=n.attributes.RESOLUTION.width;if(s=s||qe.default.Number.MAX_VALUE,i===s&&e.attributes.BANDWIDTH&&n.attributes.BANDWIDTH)return e.attributes.BANDWIDTH-n.attributes.BANDWIDTH;return i-s},GS=function(e){let{main:n,bandwidth:i,playerWidth:s,playerHeight:a,playerObjectFit:r,limitRenditionByPlayerDimensions:l,playlistController:c}=e;if(!n)return;let p={bandwidth:i,width:s,height:a,limitRenditionByPlayerDimensions:l},m=n.playlists;if(Ra.isAudioOnly(n))m=c.getAudioTrackPlaylists_(),p.audioOnly=!0;let g=m.map((he)=>{let we,Ce=he.attributes&&he.attributes.RESOLUTION&&he.attributes.RESOLUTION.width,Ne=he.attributes&&he.attributes.RESOLUTION&&he.attributes.RESOLUTION.height;return we=he.attributes&&he.attributes.BANDWIDTH,we=we||qe.default.Number.MAX_VALUE,{bandwidth:we,width:Ce,height:Ne,playlist:he}});Zf(g,(he,we)=>he.bandwidth-we.bandwidth),g=g.filter((he)=>!Ra.isIncompatible(he.playlist));let y=g.filter((he)=>Ra.isEnabled(he.playlist));if(!y.length)y=g.filter((he)=>!Ra.isDisabled(he.playlist));let x=y.filter((he)=>he.bandwidth*_s.BANDWIDTH_VARIANCE<i),j=x[x.length-1],I=x.filter((he)=>he.bandwidth===j.bandwidth)[0];if(l===!1){let he=I||y[0]||g[0];if(he&&he.playlist){let we="sortedPlaylistReps";if(I)we="bandwidthBestRep";if(y[0])we="enabledPlaylistReps";return g1(`choosing ${N8(he)} using ${we} with options`,p),he.playlist}return g1("could not choose a playlist with options",p),null}let P=x.filter((he)=>he.width&&he.height);Zf(P,(he,we)=>he.width-we.width);let X=P.filter((he)=>he.width===s&&he.height===a);j=X[X.length-1];let Y=X.filter((he)=>he.bandwidth===j.bandwidth)[0],J,ne,ae;if(!Y)J=P.filter((he)=>{if(r==="cover")return he.width>s&&he.height>a;return he.width>s||he.height>a}),ne=J.filter((he)=>he.width===J[0].width&&he.height===J[0].height),j=ne[ne.length-1],ae=ne.filter((he)=>he.bandwidth===j.bandwidth)[0];let se;if(c.leastPixelDiffSelector){let he=P.map((we)=>(we.pixelDiff=Math.abs(we.width-s)+Math.abs(we.height-a),we));Zf(he,(we,Ce)=>{if(we.pixelDiff===Ce.pixelDiff)return Ce.bandwidth-we.bandwidth;return we.pixelDiff-Ce.pixelDiff}),se=he[0]}let oe=se||ae||Y||I||y[0]||g[0];if(oe&&oe.playlist){let he="sortedPlaylistReps";if(se)he="leastPixelDiffRep";else if(ae)he="resolutionPlusOneRep";else if(Y)he="resolutionBestRep";else if(I)he="bandwidthBestRep";else if(y[0])he="enabledPlaylistReps";return g1(`choosing ${N8(oe)} using ${he} with options`,p),oe.playlist}return g1("could not choose a playlist with options",p),null},P8=function(){let e=this.useDevicePixelRatio?qe.default.devicePixelRatio||1:1;if(!isNaN(this.customPixelRatio))e=this.customPixelRatio;return GS({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(Jf(this.tech_.el(),"width"),10)*e,playerHeight:parseInt(Jf(this.tech_.el(),"height"),10)*e,playerObjectFit:this.usePlayerObjectFit?Jf(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},zR=function(e){let n=-1,i=-1;if(e<0||e>1)throw Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let s=this.useDevicePixelRatio?qe.default.devicePixelRatio||1:1;if(!isNaN(this.customPixelRatio))s=this.customPixelRatio;if(n<0)n=this.systemBandwidth,i=this.systemBandwidth;if(this.systemBandwidth>0&&this.systemBandwidth!==i)n=e*this.systemBandwidth+(1-e)*n,i=this.systemBandwidth;return GS({main:this.playlists.main,bandwidth:n,playerWidth:parseInt(Jf(this.tech_.el(),"width"),10)*s,playerHeight:parseInt(Jf(this.tech_.el(),"height"),10)*s,playerObjectFit:this.usePlayerObjectFit?Jf(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},GR=function(e){let{main:n,currentTime:i,bandwidth:s,duration:a,segmentDuration:r,timeUntilRebuffer:l,currentTimeline:c,syncController:p}=e,m=n.playlists.filter((I)=>!Ra.isIncompatible(I)),g=m.filter(Ra.isEnabled);if(!g.length)g=m.filter((I)=>!Ra.isDisabled(I));let x=g.filter(Ra.hasAttribute.bind(null,"BANDWIDTH")).map((I)=>{let X=p.getSyncPoint(I,a,c,i)?1:2,J=Ra.estimateSegmentRequestTime(r,s,I)*X-l;return{playlist:I,rebufferingImpact:J}}),j=x.filter((I)=>I.rebufferingImpact<=0);if(Zf(j,(I,P)=>r3(P.playlist,I.playlist)),j.length)return j[0];return Zf(x,(I,P)=>I.rebufferingImpact-P.rebufferingImpact),x[0]||null},VR=function(){let e=this.playlists.main.playlists.filter(Ra.isEnabled);return Zf(e,(i,s)=>r3(i,s)),e.filter((i)=>!!wp(this.playlists.main,i).video)[0]||null},XR=(e)=>{let n=0,i;if(e.bytes)i=new Uint8Array(e.bytes),e.segments.forEach((s)=>{i.set(s,n),n+=s.byteLength});return i};function VS(e){try{return new URL(e).pathname.split("/").slice(-2).join("/")}catch(n){return""}}var WR=function(e,n,i){if(!e[i]){n.trigger({type:"usage",name:"vhs-608"});let s=i;if(/^cc708_/.test(i))s="SERVICE"+i.split("_")[1];let a=n.textTracks().getTrackById(s);if(a)e[i]=a;else{let r=n.options_.vhs&&n.options_.vhs.captionServices||{},l=i,c=i,p=!1,m=r[s];if(m)l=m.label,c=m.language,p=m.default;e[i]=n.addRemoteTextTrack({kind:"captions",id:s,default:p,label:l,language:c},!1).track}}},KR=function({inbandTextTracks:e,captionArray:n,timestampOffset:i}){if(!n)return;let s=qe.default.WebKitDataCue||qe.default.VTTCue;n.forEach((a)=>{let r=a.stream;if(a.content)a.content.forEach((l)=>{let c=new s(a.startTime+i,a.endTime+i,l.text);c.line=l.line,c.align="left",c.position=l.position,c.positionAlign="line-left",e[r].addCue(c)});else e[r].addCue(new s(a.startTime+i,a.endTime+i,a.text))})},$R=function(e){Object.defineProperties(e.frame,{id:{get(){return Ke.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get(){return Ke.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get(){return Ke.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}})},YR=({inbandTextTracks:e,metadataArray:n,timestampOffset:i,videoDuration:s})=>{if(!n)return;let a=qe.default.WebKitDataCue||qe.default.VTTCue,r=e.metadataTrack_;if(!r)return;if(n.forEach((g)=>{let y=g.cueTime+i;if(typeof y!=="number"||qe.default.isNaN(y)||y<0||!(y<1/0))return;if(!g.frames||!g.frames.length)return;g.frames.forEach((x)=>{let j=new a(y,y,x.value||x.url||x.data||"");j.frame=x,j.value=x,$R(j),r.addCue(j)})}),!r.cues||!r.cues.length)return;let l=r.cues,c=[];for(let g=0;g<l.length;g++)if(l[g])c.push(l[g]);let p=c.reduce((g,y)=>{let x=g[y.startTime]||[];return x.push(y),g[y.startTime]=x,g},{}),m=Object.keys(p).sort((g,y)=>Number(g)-Number(y));m.forEach((g,y)=>{let x=p[g],j=isFinite(s)?s:g,I=Number(m[y+1])||j;x.forEach((P)=>{P.endTime=I})})},QR={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},JR=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),ZR=({inbandTextTracks:e,dateRanges:n})=>{let i=e.metadataTrack_;if(!i)return;let s=qe.default.WebKitDataCue||qe.default.VTTCue;n.forEach((a)=>{for(let r of Object.keys(a)){if(JR.has(r))continue;let l=new s(a.startTime,a.endTime,"");if(l.id=a.id,l.type="com.apple.quicktime.HLS",l.value={key:QR[r],data:a[r]},r==="scte35Out"||r==="scte35In")l.value.data=new Uint8Array(l.value.data.match(/[\da-f]{2}/gi)).buffer;i.addCue(l)}a.processDateRange()})},B8=(e,n,i)=>{if(e.metadataTrack_)return;if(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,!Ke.browser.IS_ANY_SAFARI)e.metadataTrack_.inBandMetadataTrackDispatchType=n},dp=function(e,n,i){let s,a;if(!i)return;if(!i.cues)return;s=i.cues.length;while(s--)if(a=i.cues[s],a.startTime>=e&&a.endTime<=n)i.removeCue(a)},eO=function(e){let n=e.cues;if(!n)return;let i={};for(let s=n.length-1;s>=0;s--){let a=n[s],r=`${a.startTime}-${a.endTime}-${a.text}`;if(i[r])e.removeCue(a);else i[r]=a}},tO=(e,n,i)=>{if(typeof n>"u"||n===null||!e.length)return[];let s=Math.ceil((n-i+3)*Nc.ONE_SECOND_IN_TS),a;for(a=0;a<e.length;a++)if(e[a].pts>s)break;return e.slice(a)},nO=(e,n,i)=>{if(!n.length)return e;if(i)return n.slice();let s=n[0].pts,a=0;for(a;a<e.length;a++)if(e[a].pts>=s)break;return e.slice(0,a).concat(n)},iO=(e,n,i,s)=>{let a=Math.ceil((n-s)*Nc.ONE_SECOND_IN_TS),r=Math.ceil((i-s)*Nc.ONE_SECOND_IN_TS),l=e.slice(),c=e.length;while(c--)if(e[c].pts<=r)break;if(c===-1)return l;let p=c+1;while(p--)if(e[p].pts<=a)break;return p=Math.max(p,0),l.splice(p,c-p+1),l},sO=function(e,n){if(!e&&!n||!e&&n||e&&!n)return!1;if(e===n)return!0;let i=Object.keys(e).sort(),s=Object.keys(n).sort();if(i.length!==s.length)return!1;for(let a=0;a<i.length;a++){let r=i[a];if(r!==s[a])return!1;if(e[r]!==n[r])return!1}return!0},aO=function(e,n,i){n=n||[];let s=[],a=0;for(let r=0;r<n.length;r++){let l=n[r];if(e===l.timeline){if(s.push(r),a+=l.duration,a>i)return r}}if(s.length===0)return 0;return s[s.length-1]},hp=1,rO=500,L8=(e)=>typeof e==="number"&&isFinite(e),b1=0.016666666666666666,oO=(e,n,i)=>{if(e!=="main"||!n||!i)return null;if(!i.hasAudio&&!i.hasVideo)return"Neither audio nor video found in segment.";if(n.hasVideo&&!i.hasVideo)return"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.";if(!n.hasVideo&&i.hasVideo)return"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.";return null},lO=(e,n,i)=>{let s=n-_s.BACK_BUFFER_LENGTH;if(e.length)s=Math.max(s,e.start(0));let a=n-i;return Math.min(a,s)},Gf=(e)=>{let{startOfSegment:n,duration:i,segment:s,part:a,playlist:{mediaSequence:r,id:l,segments:c=[]},mediaIndex:p,partIndex:m,timeline:g}=e,y=c.length-1,x="mediaIndex/partIndex increment";if(e.getMediaInfoForTime)x=`getMediaInfoForTime (${e.getMediaInfoForTime})`;else if(e.isSyncRequest)x="getSyncSegmentCandidate (isSyncRequest)";if(e.independent)x+=` with independent ${e.independent}`;let j=typeof m==="number",I=e.segment.uri?"segment":"pre-segment",P=j?oS({preloadSegment:s})-1:0;return`${I} [${r+p}/${r+y}]`+(j?` part [${m}/${P}]`:"")+` segment start/end [${s.start} => ${s.end}]`+(j?` part start/end [${a.start} => ${a.end}]`:"")+` startOfSegment [${n}] duration [${i}] timeline [${g}] selected by [${x}] playlist [${l}]`},H8=(e)=>`${e}TimingInfo`,cO=({segmentTimeline:e,currentTimeline:n,startOfSegment:i,buffered:s,overrideCheck:a})=>{if(!a&&e===n)return null;if(e<n)return i;return s.length?s.end(s.length-1):i},o5=({timelineChangeController:e,currentTimeline:n,segmentTimeline:i,loaderType:s,audioDisabled:a})=>{if(n===i)return!1;if(s==="audio"){let r=e.lastTimelineChange({type:"main"});return!r||r.to!==i}if(s==="main"&&a){let r=e.pendingTimelineChange({type:"audio"});if(r&&r.to===i)return!1;return!0}return!1},uO=(e)=>{if(!e)return!1;let n=e.pendingTimelineChange({type:"audio"}),i=e.pendingTimelineChange({type:"main"}),s=n&&i,a=s&&n.to!==i.to;if(s&&n.from!==-1&&i.from!==-1&&a)return!0;return!1},hO=(e)=>{let n=e.timelineChangeController_.pendingTimelineChange({type:"audio"}),i=e.timelineChangeController_.pendingTimelineChange({type:"main"});return n&&i&&n.to<i.to},Rc=(e)=>{let n=e.pendingSegment_;if(!n)return;if(o5({timelineChangeController:e.timelineChangeController_,currentTimeline:e.currentTimeline_,segmentTimeline:n.timeline,loaderType:e.loaderType_,audioDisabled:e.audioDisabled_})&&uO(e.timelineChangeController_)){if(hO(e)){e.timelineChangeController_.trigger("audioTimelineBehind");return}e.timelineChangeController_.trigger("fixBadTimelineChange")}},fO=(e)=>{let n=0;if(["video","audio"].forEach(function(i){let s=e[`${i}TimingInfo`];if(!s)return;let{start:a,end:r}=s,l;if(typeof a==="bigint"||typeof r==="bigint")l=qe.default.BigInt(r)-qe.default.BigInt(a);else if(typeof a==="number"&&typeof r==="number")l=r-a;if(typeof l<"u"&&l>n)n=l}),typeof n==="bigint"&&n<Number.MAX_SAFE_INTEGER)n=Number(n);return n},U8=({segmentDuration:e,maxDuration:n})=>{if(!e)return!1;return Math.round(e)>n+Eo},dO=(e,n)=>{if(n!=="hls")return null;let i=fO({audioTimingInfo:e.audioTimingInfo,videoTimingInfo:e.videoTimingInfo});if(!i)return null;let s=e.playlist.targetDuration,a=U8({segmentDuration:i,maxDuration:s*2}),r=U8({segmentDuration:i,maxDuration:s}),l=`Segment with index ${e.mediaIndex} from playlist ${e.playlist.id} has a duration of ${i} when the reported duration is ${e.duration} and the target duration is ${s}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;if(a||r)return{severity:a?"warn":"info",message:l};return null},ah=({type:e,segment:n})=>{if(!n)return;let i=Boolean(n.key||n.map&&n.map.ke),s=Boolean(n.map&&!n.map.bytes),a=n.startOfSegment===void 0?n.start:n.startOfSegment;return{type:e||n.type,uri:n.resolvedUri||n.uri,start:a,duration:n.duration,isEncrypted:i,isMediaInitialization:s}};class B1 extends Ke.EventTarget{constructor(e,n={}){super();if(!e)throw TypeError("Initialization settings are required");if(typeof e.currentTime!=="function")throw TypeError("No currentTime getter specified");if(!e.mediaSource)throw TypeError("No MediaSource specified");if(this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{if(!this.isEndOfStream_())this.ended_=!1}),this.fetchAtBuffer_=!1,this.logger_=jr(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(i){if(i!==this.state_)this.logger_(`${this.state_} -> ${i}`),this.state_=i,this.trigger("statechange")}}),this.sourceUpdater_.on("ready",()=>{if(this.hasEnoughInfoToAppend_())this.processCallQueue_();else Rc(this)}),this.sourceUpdater_.on("codecschange",(i)=>{this.trigger(Ii({type:"codecschange"},i))}),this.loaderType_==="main")this.timelineChangeController_.on("pendingtimelinechange",()=>{if(this.hasEnoughInfoToAppend_())this.processCallQueue_();else Rc(this)});if(this.loaderType_==="audio")this.timelineChangeController_.on("timelinechange",(i)=>{if(this.trigger(Ii({type:"timelinechange"},i)),this.hasEnoughInfoToLoad_())this.processLoadQueue_();else Rc(this);if(this.hasEnoughInfoToAppend_())this.processCallQueue_();else Rc(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return By.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){if(this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_)this.transmuxer_.terminate();if(this.resetStats_(),this.checkBufferTimeout_)qe.default.clearTimeout(this.checkBufferTimeout_);if(this.syncController_&&this.triggerSyncInfoUpdate_)this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_);this.off()}setAudio(e){if(this.audioDisabled_=!e,e)this.appendInitSegment_.audio=!0;else this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){if(this.state!=="WAITING"){if(this.pendingSegment_)this.pendingSegment_=null;this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);return}if(this.abort_(),this.state="READY",!this.paused())this.monitorBuffer_()}abort_(){if(this.pendingSegment_&&this.pendingSegment_.abortRequests)this.pendingSegment_.abortRequests();this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,qe.default.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){if(this.state==="APPENDING"&&!this.pendingSegment_)return this.state="READY",!0;if(!this.pendingSegment_||this.pendingSegment_.requestId!==e)return!0;return!1}error(e){if(typeof e<"u")this.logger_("error occurred:",e),this.error_=e;return this.pendingSegment_=null,this.error_}endOfStream(){if(this.ended_=!0,this.transmuxer_)By.reset(this.transmuxer_);this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){let e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return xs();if(this.loaderType_==="main"){let{hasAudio:n,hasVideo:i,isMuxed:s}=e;if(i&&n&&!this.audioDisabled_&&!s)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,n=!1){if(!e)return null;let i=N1(e),s=this.initSegments_[i];if(n&&!s&&e.bytes)this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales};return s||e}segmentKey(e,n=!1){if(!e)return null;let i=CS(e),s=this.keyCache_[i];if(this.cacheEncryptionKeys_&&n&&!s&&e.bytes)this.keyCache_[i]=s={resolvedUri:e.resolvedUri,bytes:e.bytes};let a={resolvedUri:(s||e).resolvedUri};if(s)a.bytes=s.bytes;return a}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),!this.playlist_)return;if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT")return;this.state="READY"}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,n={}){if(!e)return;if(this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;let i=this.playlist_,s=this.pendingSegment_;if(this.playlist_=e,this.xhrOptions_=n,this.state==="INIT"){if(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main")this.syncController_.setDateTimeMappingForStart(e)}let a=null;if(i){if(i.id)a=i.id;else if(i.uri)a=i.uri}if(this.logger_(`playlist update [${a} => ${e.id||e.uri}]`),this.mediaSequenceSync_)this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:
|
|
209
|
+
currentTime: ${this.currentTime_()}
|
|
210
|
+
bufferedEnd: ${Ny(this.buffered_())}
|
|
211
|
+
`,this.mediaSequenceSync_.diagnostics);if(this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri){if(this.mediaIndex!==null)if(!e.endList&&typeof e.partTargetDuration==="number")this.resetLoader();else this.resyncLoader();this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}let r=e.mediaSequence-i.mediaSequence;if(this.logger_(`live window shift [${r}]`),this.mediaIndex!==null)if(this.mediaIndex-=r,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{let l=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!l.parts||!l.parts.length||!l.parts[this.partIndex])){let c=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=c}}if(s)if(s.mediaIndex-=r,s.mediaIndex<0)s.mediaIndex=null,s.partIndex=null;else{if(s.mediaIndex>=0)s.segment=e.segments[s.mediaIndex];if(s.partIndex>=0&&s.segment.parts)s.part=s.segment.parts[s.partIndex]}this.syncController_.saveExpiredSegmentInfo(i,e)}pause(){if(this.checkBufferTimeout_)qe.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null}paused(){return this.checkBufferTimeout_===null}resetEverything(e){if(this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_)this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"})}resetLoader(){if(this.fetchAtBuffer_=!1,this.mediaSequenceSync_)this.mediaSequenceSync_.resetAppendedStatus();this.resyncLoader()}resyncLoader(){if(this.transmuxer_)By.reset(this.transmuxer_);this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;let e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;if(this.sourceType_==="hls"&&!e)this.shouldForceTimestampOffsetAfterResync_=!0;if(this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_)this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,n,i=()=>{},s=!1){if(n===1/0)n=this.duration_();if(n<=e){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}let a=1,r=()=>{if(a--,a===0)i()};if(s||!this.audioDisabled_)a++,this.sourceUpdater_.removeAudio(e,n,r);if(s||this.loaderType_==="main")this.gopBuffer_=iO(this.gopBuffer_,e,n,this.timeMapping_),a++,this.sourceUpdater_.removeVideo(e,n,r);for(let l in this.inbandTextTracks_)dp(e,n,this.inbandTextTracks_[l]);dp(e,n,this.segmentMetadataTrack_),r()}monitorBuffer_(){if(this.checkBufferTimeout_)qe.default.clearTimeout(this.checkBufferTimeout_);this.checkBufferTimeout_=qe.default.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){if(this.state==="READY")this.fillBuffer_();if(this.checkBufferTimeout_)qe.default.clearTimeout(this.checkBufferTimeout_);this.checkBufferTimeout_=qe.default.setTimeout(this.monitorBufferTick_.bind(this),rO)}fillBuffer_(){if(this.sourceUpdater_.updating())return;let e=this.chooseNextRequest_();if(!e)return;let n={segmentInfo:ah({type:this.loaderType_,segment:e})};if(this.trigger({type:"segmentselected",metadata:n}),typeof e.timestampOffset==="number")this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline});this.loadSegment_(e)}isEndOfStream_(e=this.mediaIndex,n=this.playlist_,i=this.partIndex){if(!n||!this.mediaSource_)return!1;let s=typeof e==="number"&&n.segments[e],a=e+1===n.segments.length,r=!s||!s.parts||i+1===s.parts.length;return n.endList&&this.mediaSource_.readyState==="open"&&a&&r}chooseNextRequest_(){let e=this.buffered_(),n=Ny(e)||0,i=t3(e,this.currentTime_()),s=!this.hasPlayed_()&&i>=1,a=i>=this.goalBufferLength_(),r=this.playlist_.segments;if(!r.length||s||a)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);let l={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(l.isSyncRequest)l.mediaIndex=aO(this.currentTimeline_,r,n),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${l.mediaIndex}`);else if(this.mediaIndex!==null){let y=r[this.mediaIndex],x=typeof this.partIndex==="number"?this.partIndex:-1;if(l.startOfSegment=y.end?y.end:n,y.parts&&y.parts[x+1])l.mediaIndex=this.mediaIndex,l.partIndex=x+1;else l.mediaIndex=this.mediaIndex+1}else{let y,x,j,I=this.fetchAtBuffer_?n:this.currentTime_();if(this.mediaSequenceSync_)this.logger_(`chooseNextRequest_ request after Quality Switch:
|
|
212
|
+
For TargetTime: ${I}.
|
|
213
|
+
CurrentTime: ${this.currentTime_()}
|
|
214
|
+
BufferedEnd: ${n}
|
|
215
|
+
Fetch At Buffer: ${this.fetchAtBuffer_}
|
|
216
|
+
`,this.mediaSequenceSync_.diagnostics);if(this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){let P=this.getSyncInfoFromMediaSequenceSync_(I);if(!P)return this.error({message:"No sync info found while using media sequence sync",metadata:{errorType:Ke.Error.StreamingFailedToSelectNextSegment,error:Error("No sync info found while using media sequence sync")}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null;this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${P.start} --> ${P.end})`),y=P.segmentIndex,x=P.partIndex,j=P.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");let P=Ra.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:I,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});y=P.segmentIndex,x=P.partIndex,j=P.startTime}l.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${I}`:`currentTime ${I}`,l.mediaIndex=y,l.startOfSegment=j,l.partIndex=x,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${l.mediaIndex} `)}let c=r[l.mediaIndex],p=c&&typeof l.partIndex==="number"&&c.parts&&c.parts[l.partIndex];if(!c||typeof l.partIndex==="number"&&!p)return null;if(typeof l.partIndex!=="number"&&c.parts)l.partIndex=0,p=c.parts[0];let m=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&p&&!m&&!p.independent){if(l.partIndex===0){let y=r[l.mediaIndex-1],x=y.parts&&y.parts.length&&y.parts[y.parts.length-1];if(x&&x.independent)l.mediaIndex-=1,l.partIndex=y.parts.length-1,l.independent="previous segment"}else if(c.parts[l.partIndex-1].independent)l.partIndex-=1,l.independent="previous part"}let g=this.mediaSource_&&this.mediaSource_.readyState==="ended";if(l.mediaIndex>=r.length-1&&g&&!this.seeking_())return null;if(this.shouldForceTimestampOffsetAfterResync_)this.shouldForceTimestampOffsetAfterResync_=!1,l.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync");return this.generateSegmentInfo_(l)}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;let n=Math.max(e,this.mediaSequenceSync_.start);if(e!==n)this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${n}`);let i=this.mediaSequenceSync_.getSyncInfoForTime(n);if(!i)return null;if(!i.isAppended)return i;let s=this.mediaSequenceSync_.getSyncInfoForTime(i.end);if(!s)return null;if(s.isAppended)this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!");return s}generateSegmentInfo_(e){let{independent:n,playlist:i,mediaIndex:s,startOfSegment:a,isSyncRequest:r,partIndex:l,forceTimestampOffset:c,getMediaInfoForTime:p}=e,m=i.segments[s],g=typeof l==="number"&&m.parts[l],y={requestId:"segment-loader-"+Math.random(),uri:g&&g.resolvedUri||m.resolvedUri,mediaIndex:s,partIndex:g?l:null,isSyncRequest:r,startOfSegment:a,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:m.timeline,duration:g&&g.duration||m.duration,segment:m,part:g,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:p,independent:n},x=typeof c<"u"?c:this.isPendingTimestampOffset_;y.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:m.timeline,currentTimeline:this.currentTimeline_,startOfSegment:a,buffered:this.buffered_(),overrideCheck:x});let j=Ny(this.sourceUpdater_.audioBuffered());if(typeof j==="number")y.audioAppendStart=j-this.sourceUpdater_.audioTimestampOffset();if(this.sourceUpdater_.videoBuffered().length)y.gopsToAlignWith=tO(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_);return y}timestampOffsetForSegment_(e){return cO(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH)return;if(Date.now()-(e.firstBytesReceivedAt||Date.now())<1000)return;let n=this.currentTime_(),i=e.bandwidth,s=this.pendingSegment_.duration,a=Ra.estimateSegmentRequestTime(s,i,this.playlist_,e.bytesReceived),r=DM(this.buffered_(),n,this.vhs_.tech_.playbackRate())-1;if(a<=r)return;let l=GR({main:this.vhs_.playlists.main,currentTime:n,bandwidth:i,duration:this.duration_(),segmentDuration:s,timeUntilRebuffer:r,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!l)return;let p=a-r-l.rebufferingImpact,m=0.5;if(r<=Eo)m=1;if(!l.playlist||l.playlist.uri===this.playlist_.uri||p<m)return;this.bandwidth=l.playlist.attributes.BANDWIDTH*_s.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort")}handleAbort_(e){this.logger_(`Aborting ${Gf(e)}`),this.mediaRequestsAborted+=1}handleProgress_(e,n){if(this.earlyAbortWhenNeeded_(n.stats),this.checkForAbort_(n.requestId))return;this.trigger("progress")}handleTrackInfo_(e,n){let{hasAudio:i,hasVideo:s}=n,a={segmentInfo:ah({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:i,hasVideo:s}};if(this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:a}),this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.checkForIllegalMediaSwitch(n))return;if(n=n||{},!sO(this.currentMediaInfo_,n))this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=n,this.currentMediaInfo_=n,this.logger_("trackinfo update",n),this.trigger("trackinfo");if(this.checkForAbort_(e.requestId))return;if(this.pendingSegment_.trackInfo=n,this.hasEnoughInfoToAppend_())this.processCallQueue_();else Rc(this)}handleTimingInfo_(e,n,i,s){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;let a=this.pendingSegment_,r=H8(n);if(a[r]=a[r]||{},a[r][i]=s,this.logger_(`timinginfo: ${n} - ${i} - ${s}`),this.hasEnoughInfoToAppend_())this.processCallQueue_();else Rc(this)}handleCaptions_(e,n){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(n.length===0){this.logger_("SegmentLoader received no captions from a caption event");return}if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,n));return}let s=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),a={};if(n.forEach((r)=>{a[r.stream]=a[r.stream]||{startTime:1/0,captions:[],endTime:0};let l=a[r.stream];l.startTime=Math.min(l.startTime,r.startTime+s),l.endTime=Math.max(l.endTime,r.endTime+s),l.captions.push(r)}),Object.keys(a).forEach((r)=>{let{startTime:l,endTime:c,captions:p}=a[r],m=this.inbandTextTracks_;this.logger_(`adding cues from ${l} -> ${c} for ${r}`),WR(m,this.vhs_.tech_,r),dp(l,c,m[r]),KR({captionArray:p,inbandTextTracks:m,timestampOffset:s})}),this.transmuxer_)this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,n,i){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,n,i));return}this.addMetadataToTextTrack(i,n,this.duration_())}processMetadataQueue_(){this.metadataQueue_.id3.forEach((e)=>e()),this.metadataQueue_.caption.forEach((e)=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){let e=this.callQueue_;this.callQueue_=[],e.forEach((n)=>n())}processLoadQueue_(){let e=this.loadQueue_;this.loadQueue_=[],e.forEach((n)=>n())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;let e=this.pendingSegment_;if(!e)return!1;if(!this.getCurrentMediaInfo_())return!0;if(o5({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))return!1;return!0}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready())return!1;if(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;let e=this.pendingSegment_,n=this.getCurrentMediaInfo_();if(!e||!n)return!1;let{hasAudio:i,hasVideo:s,isMuxed:a}=n;if(s&&!e.videoTimingInfo)return!1;if(i&&!this.audioDisabled_&&!a&&!e.audioTimingInfo)return!1;if(o5({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))return!1;return!0}handleData_(e,n){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){Rc(this),this.callQueue_.push(this.handleData_.bind(this,e,n));return}let i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),this.mediaSource_.readyState==="closed")return;if(e.map)e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map;if(e.key)this.segmentKey(e.key,!0);if(i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[H8(n.type)].start;else{let s=this.getCurrentMediaInfo_(),a=this.loaderType_==="main"&&s&&s.hasVideo,r;if(a)r=i.videoTimingInfo.start;i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:a,firstVideoFrameTimeForData:r,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,n.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:this.loaderType_==="main"});let s=this.chooseNextRequest_();if(s.mediaIndex!==i.mediaIndex||s.partIndex!==i.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,n)}updateAppendInitSegmentStatus(e,n){if(this.loaderType_==="main"&&typeof e.timestampOffset==="number"&&!e.changedTimestampOffset)this.appendInitSegment_={audio:!0,video:!0};if(this.playlistOfLastInitSegment_[n]!==e.playlist)this.appendInitSegment_[n]=!0}getInitSegmentAndUpdateState_({type:e,initSegment:n,map:i,playlist:s}){if(i){let a=N1(i);if(this.activeInitSegmentId_===a)return null;n=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=a}if(n&&this.appendInitSegment_[e])return this.playlistOfLastInitSegment_[e]=s,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,n;return null}handleQuotaExceededError_({segmentInfo:e,type:n,bytes:i},s){let a=this.sourceUpdater_.audioBuffered(),r=this.sourceUpdater_.videoBuffered();if(a.length>1)this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+rh(a).join(", "));if(r.length>1)this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+rh(r).join(", "));let l=a.length?a.start(0):0,c=a.length?a.end(a.length-1):0,p=r.length?r.start(0):0,m=r.length?r.end(r.length-1):0;if(c-l<=hp&&m-p<=hp){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${rh(a).join(", ")}, video buffer: ${rh(r).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:n,bytes:i}));let y=this.currentTime_()-hp;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${y}`),this.remove(0,y,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${hp}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=qe.default.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},hp*1000)},!0)}handleAppendError_({segmentInfo:e,type:n,bytes:i},s){if(!s)return;if(s.code===yS){this.handleQuotaExceededError_({segmentInfo:e,type:n,bytes:i});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",s),this.error({message:`${n} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:Ke.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}appendToSourceBuffer_({segmentInfo:e,type:n,initSegment:i,data:s,bytes:a}){if(!a){let l=[s],c=s.byteLength;if(i)l.unshift(i),c+=i.byteLength;a=XR({bytes:c,segments:l})}let r={segmentInfo:ah({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:r}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:n,bytes:a},this.handleAppendError_.bind(this,{segmentInfo:e,type:n,bytes:a}))}handleSegmentTimingInfo_(e,n,i){if(!this.pendingSegment_||n!==this.pendingSegment_.requestId)return;let s=this.pendingSegment_.segment,a=`${e}TimingInfo`;if(!s[a])s[a]={};s[a].transmuxerPrependedSeconds=i.prependedContentDuration||0,s[a].transmuxedPresentationStart=i.start.presentation,s[a].transmuxedDecodeStart=i.start.decode,s[a].transmuxedPresentationEnd=i.end.presentation,s[a].transmuxedDecodeEnd=i.end.decode,s[a].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,n){let{type:i,data:s}=n;if(!s||!s.byteLength)return;if(i==="audio"&&this.audioDisabled_)return;let a=this.getInitSegmentAndUpdateState_({type:i,initSegment:n.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:a,data:s})}loadSegment_(e){if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),typeof e.timestampOffset==="number"){if(this.transmuxer_)this.transmuxer_.postMessage({action:"clearAllMp4Captions"})}if(!this.hasEnoughInfoToLoad_()){Rc(this),this.loadQueue_.push(()=>{let n=Ii({},e,{forceTimestampOffset:!0});Ii(e,this.generateSegmentInfo_(n)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){if(this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset))this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset});let n=this.createSimplifiedSegmentObj_(e),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),s=this.mediaIndex!==null,a=e.timeline!==this.currentTimeline_&&e.timeline>0,r=i||s&&a;if(this.logger_(`Requesting
|
|
217
|
+
${VS(e.uri)}
|
|
218
|
+
${Gf(e)}`),n.map&&!n.map.bytes)this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0};e.abortRequests=HR({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:n,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:r,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:l,level:c,stream:p})=>{this.logger_(`${Gf(e)} logged from transmuxer stream ${p} as a ${c}: ${l}`)},triggerSegmentEventFn:({type:l,segment:c,keyInfo:p,trackInfo:m,timingInfo:g})=>{let x={segmentInfo:ah({segment:c})};if(p)x.keyInfo=p;if(m)x.trackInfo=m;if(g)x.timingInfo=g;this.trigger({type:l,metadata:x})}})}trimBackBuffer_(e){let n=lO(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);if(n>0)this.remove(0,n)}createSimplifiedSegmentObj_(e){let{segment:n,part:i}=e,s=e.segment.key||e.segment.map&&e.segment.map.key,a=e.segment.map&&!e.segment.map.bytes,r={resolvedUri:i?i.resolvedUri:n.resolvedUri,byterange:i?i.byterange:n.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:s,isMediaInitialization:a},l=e.playlist.segments[e.mediaIndex-1];if(l&&l.timeline===n.timeline){if(l.videoTimingInfo)r.baseStartTime=l.videoTimingInfo.transmuxedDecodeEnd;else if(l.audioTimingInfo)r.baseStartTime=l.audioTimingInfo.transmuxedDecodeEnd}if(n.key){let c=n.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);r.key=this.segmentKey(n.key),r.key.iv=c}if(n.map)r.map=this.initSegmentForMap(n.map);return r}saveTransferStats_(e){if(this.mediaRequests+=1,e)this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime}saveBandwidthRelatedStats_(e,n){if(this.pendingSegment_.byteLength=n.bytesReceived,e<b1){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${b1}`);return}let i={bandwidthInfo:{from:this.bandwidth,to:n.bandwidth}};this.trigger({type:"bandwidthupdated",metadata:i}),this.bandwidth=n.bandwidth,this.roundTrip=n.roundTripTime}handleTimeout_(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}segmentRequestFinished_(e,n,i){if(this.callQueue_.length){this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,n,i));return}if(this.saveTransferStats_(n.stats),!this.pendingSegment_)return;if(n.requestId!==this.pendingSegment_.requestId)return;if(e){if(this.pendingSegment_=null,this.state="READY",e.code===Io.ABORTED)return;if(this.pause(),e.code===Io.TIMEOUT){this.handleTimeout_();return}this.mediaRequestsErrored+=1,this.error(e),this.trigger("error");return}let s=this.pendingSegment_;if(this.saveBandwidthRelatedStats_(s.duration,n.stats),s.endOfAllRequests=n.endOfAllRequests,i.gopInfo)this.gopBuffer_=nO(this.gopBuffer_,i.gopInfo,this.safeAppend_);this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(s)}setTimeMapping_(e){let n=this.syncController_.mappingForTimeline(e);if(n!==null)this.timeMapping_=n}updateMediaSecondsLoaded_(e){if(typeof e.start==="number"&&typeof e.end==="number")this.mediaSecondsLoaded+=e.end-e.start;else this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){if(e===null)return!1;if(this.loaderType_==="main"&&e!==this.sourceUpdater_.videoTimestampOffset())return!0;if(!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())return!0;return!1}trueSegmentStart_({currentStart:e,playlist:n,mediaIndex:i,firstVideoFrameTimeForData:s,currentVideoTimestampOffset:a,useVideoTimingInfo:r,videoTimingInfo:l,audioTimingInfo:c}){if(typeof e<"u")return e;if(!r)return c.start;let p=n.segments[i-1];if(i===0||!p||typeof p.start>"u"||p.end!==s+a)return s;return l.start}waitForAppendsToComplete_(e){let n=this.getCurrentMediaInfo_(e);if(!n){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}let{hasAudio:i,hasVideo:s,isMuxed:a}=n,r=this.loaderType_==="main"&&s,l=!this.audioDisabled_&&i&&!a;if(e.waitingOnAppends=0,!e.hasAppendedData_){if(!e.timingInfo&&typeof e.timestampOffset==="number")this.isPendingTimestampOffset_=!0;if(e.timingInfo={start:0},e.waitingOnAppends++,!this.isPendingTimestampOffset_)this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_();this.checkAppendsDone_(e);return}if(r)e.waitingOnAppends++;if(l)e.waitingOnAppends++;if(r)this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e));if(l)this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){if(this.checkForAbort_(e.requestId))return;if(e.waitingOnAppends--,e.waitingOnAppends===0)this.handleAppendsDone_()}checkForIllegalMediaSwitch(e){let n=oO(this.loaderType_,this.getCurrentMediaInfo_(),e);if(n)return this.error({message:n,playlistExclusionDuration:1/0}),this.trigger("error"),!0;return!1}updateSourceBufferTimestampOffset_(e){if(e.timestampOffset===null||typeof e.timingInfo.start!=="number"||e.changedTimestampOffset||this.loaderType_!=="main")return;let n=!1;if(e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset())this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),n=!0;if(e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset())this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),n=!0;if(n)this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:n,timingInfo:i}){if(!this.useDtsForTimestampOffset_)return i.start;if(e&&typeof e.transmuxedDecodeStart==="number")return e.transmuxedDecodeStart;if(n&&typeof n.transmuxedDecodeStart==="number")return n.transmuxedDecodeStart;return i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};let n=this.getMediaInfo_(),s=this.loaderType_==="main"&&n&&n.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;if(!s)return;e.timingInfo.end=typeof s.end==="number"?s.end:s.start+e.duration}handleAppendsDone_(){if(this.pendingSegment_){let c={segmentInfo:ah({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:c})}if(!this.pendingSegment_){if(this.state="READY",!this.paused())this.monitorBuffer_();return}let e=this.pendingSegment_;if(e.part&&e.part.syncInfo)e.part.syncInfo.markAppended();else if(e.segment.syncInfo)e.segment.syncInfo.markAppended();if(this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_)this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:this.loaderType_==="main"});let n=dO(e,this.sourceType_);if(n)if(n.severity==="warn")Ke.log.warn(n.message);else this.logger_(n.message);if(this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest){if(this.trigger("syncinfoupdate"),!e.hasAppendedData_){this.logger_(`Throwing away un-appended sync request ${Gf(e)}`);return}}if(this.logger_(`Appended ${Gf(e)}`),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline){if(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),this.loaderType_==="main"&&!this.audioDisabled_)this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})}this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");let{segment:i,part:s}=e,a=i.end&&this.currentTime_()-i.end>e.playlist.targetDuration*3,r=s&&s.end&&this.currentTime_()-s.end>e.playlist.partTargetDuration*3;if(a||r){this.logger_(`bad ${a?"segment":"part"} ${Gf(e)}`),this.resetEverything();return}if(this.mediaIndex!==null)this.trigger("bandwidthupdate");if(this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex))this.endOfStream();if(this.trigger("appended"),e.hasAppendedData_)this.mediaAppends++;if(!this.paused())this.monitorBuffer_()}recordThroughput_(e){if(e.duration<b1){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${b1}`);return}let n=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,s=Math.floor(e.byteLength/i*8*1000);this.throughput.rate+=(s-n)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;let n=e.segment,{start:i,end:s}=n;if(!L8(i)||!L8(s))return;dp(i,s,this.segmentMetadataTrack_);let a=qe.default.WebKitDataCue||qe.default.VTTCue,r={custom:n.custom,dateTimeObject:n.dateTimeObject,dateTimeString:n.dateTimeString,programDateTime:n.programDateTime,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:i,end:s},l=JSON.stringify(r),c=new a(i,s,l);c.value=r,this.segmentMetadataTrack_.addCue(c)}}function Dl(){}var XS=function(e){if(typeof e!=="string")return e;return e.replace(/./,(n)=>n.toUpperCase())},pO=["video","audio"],l5=(e,n)=>{let i=n[`${e}Buffer`];return i&&i.updating||n.queuePending[e]},mO=(e,n)=>{for(let i=0;i<n.length;i++){let s=n[i];if(s.type==="mediaSource")return null;if(s.type===e)return i}return null},ed=(e,n)=>{if(n.queue.length===0)return;let i=0,s=n.queue[i];if(s.type==="mediaSource"){if(!n.updating()&&n.mediaSource.readyState!=="closed"){if(n.queue.shift(),s.action(n),s.doneFn)s.doneFn();ed("audio",n),ed("video",n)}return}if(e==="mediaSource")return;if(!n.ready()||n.mediaSource.readyState==="closed"||l5(e,n))return;if(s.type!==e){if(i=mO(e,n.queue),i===null)return;s=n.queue[i]}if(n.queue.splice(i,1),n.queuePending[e]=s,s.action(e,n),!s.doneFn){n.queuePending[e]=null,ed(e,n);return}},WS=(e,n)=>{let i=n[`${e}Buffer`],s=XS(e);if(!i)return;i.removeEventListener("updateend",n[`on${s}UpdateEnd_`]),i.removeEventListener("error",n[`on${s}Error_`]),n.codecs[e]=null,n[`${e}Buffer`]=null},Co=(e,n)=>e&&n&&Array.prototype.indexOf.call(e.sourceBuffers,n)!==-1,tr={appendBuffer:(e,n,i)=>(s,a)=>{let r=a[`${s}Buffer`];if(!Co(a.mediaSource,r))return;a.logger_(`Appending segment ${n.mediaIndex}'s ${e.length} bytes to ${s}Buffer`);try{r.appendBuffer(e)}catch(l){a.logger_(`Error with code ${l.code} `+(l.code===yS?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${n.mediaIndex} to ${s}Buffer`),a.queuePending[s]=null,i(l)}},remove:(e,n)=>(i,s)=>{let a=s[`${i}Buffer`];if(!Co(s.mediaSource,a))return;s.logger_(`Removing ${e} to ${n} from ${i}Buffer`);try{a.remove(e,n)}catch(r){s.logger_(`Remove ${e} to ${n} from ${i}Buffer failed`)}},timestampOffset:(e)=>(n,i)=>{let s=i[`${n}Buffer`];if(!Co(i.mediaSource,s))return;i.logger_(`Setting ${n}timestampOffset to ${e}`),s.timestampOffset=e},callback:(e)=>(n,i)=>{e()},endOfStream:(e)=>(n)=>{if(n.mediaSource.readyState!=="open")return;n.logger_(`Calling mediaSource endOfStream(${e||""})`);try{n.mediaSource.endOfStream(e)}catch(i){Ke.log.warn("Failed to call media source endOfStream",i)}},duration:(e)=>(n)=>{n.logger_(`Setting mediaSource duration to ${e}`);try{n.mediaSource.duration=e}catch(i){Ke.log.warn("Failed to set media source duration",i)}},abort:()=>(e,n)=>{if(n.mediaSource.readyState!=="open")return;let i=n[`${e}Buffer`];if(!Co(n.mediaSource,i))return;n.logger_(`calling abort on ${e}Buffer`);try{i.abort()}catch(s){Ke.log.warn(`Failed to abort on ${e}Buffer`,s)}},addSourceBuffer:(e,n)=>(i)=>{let s=XS(e),a=eh(n);i.logger_(`Adding ${e}Buffer with codec ${n} to mediaSource`);let r=i.mediaSource.addSourceBuffer(a);r.addEventListener("updateend",i[`on${s}UpdateEnd_`]),r.addEventListener("error",i[`on${s}Error_`]),i.codecs[e]=n,i[`${e}Buffer`]=r},removeSourceBuffer:(e)=>(n)=>{let i=n[`${e}Buffer`];if(WS(e,n),!Co(n.mediaSource,i))return;n.logger_(`Removing ${e}Buffer with codec ${n.codecs[e]} from mediaSource`);try{n.mediaSource.removeSourceBuffer(i)}catch(s){Ke.log.warn(`Failed to removeSourceBuffer ${e}Buffer`,s)}},changeType:(e)=>(n,i)=>{let s=i[`${n}Buffer`],a=eh(e);if(!Co(i.mediaSource,s))return;let r=e.substring(0,e.indexOf(".")),l=i.codecs[n];if(l.substring(0,l.indexOf("."))===r)return;let p={codecsChangeInfo:{from:l,to:e}};i.trigger({type:"codecschange",metadata:p}),i.logger_(`changing ${n}Buffer codec from ${l} to ${e}`);try{s.changeType(a),i.codecs[n]=e}catch(m){p.errorType=Ke.Error.StreamingCodecsChangeError,p.error=m,m.metadata=p,i.error_=m,i.trigger("error"),Ke.log.warn(`Failed to changeType on ${n}Buffer`,m)}}},nr=({type:e,sourceUpdater:n,action:i,doneFn:s,name:a})=>{n.queue.push({type:e,action:i,doneFn:s,name:a}),ed(e,n)},z8=(e,n)=>(i)=>{let s=n[`${e}Buffered`](),a=jM(s);if(n.logger_(`received "updateend" event for ${e} Source Buffer: `,a),n.queuePending[e]){let r=n.queuePending[e].doneFn;if(n.queuePending[e]=null,r)r(n[`${e}Error_`])}ed(e,n)};class o3 extends Ke.EventTarget{constructor(e){super();this.mediaSource=e,this.sourceopenListener_=()=>ed("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=jr("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=z8("video",this),this.onAudioUpdateEnd_=z8("audio",this),this.onVideoError_=(n)=>{this.videoError_=n},this.onAudioError_=(n)=>{this.audioError_=n},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){if(this.hasCreatedSourceBuffers())return;this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady()}triggerReady(){if(this.ready()&&!this.triggeredReady_)this.triggeredReady_=!0,this.trigger("ready")}addSourceBuffer(e,n){nr({type:"mediaSource",sourceUpdater:this,action:tr.addSourceBuffer(e,n),name:"addSourceBuffer"})}abort(e){nr({type:e,sourceUpdater:this,action:tr.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){Ke.log.error("removeSourceBuffer is not supported!");return}nr({type:"mediaSource",sourceUpdater:this,action:tr.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!Ke.browser.IS_FIREFOX&&qe.default.MediaSource&&qe.default.MediaSource.prototype&&typeof qe.default.MediaSource.prototype.removeSourceBuffer==="function"}static canChangeType(){return qe.default.SourceBuffer&&qe.default.SourceBuffer.prototype&&typeof qe.default.SourceBuffer.prototype.changeType==="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,n){if(!this.canChangeType()){Ke.log.error("changeType is not supported!");return}nr({type:e,sourceUpdater:this,action:tr.changeType(n),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||typeof e!=="object"||Object.keys(e).length===0)throw Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach((n)=>{let i=e[n];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(n,i);if(this.canChangeType())this.changeType(n,i)})}appendBuffer(e,n){let{segmentInfo:i,type:s,bytes:a}=e;if(this.processedAppend_=!0,s==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,n]),this.logger_(`delayed audio append of ${a.length} until video append`);return}let r=n;if(nr({type:s,sourceUpdater:this,action:tr.appendBuffer(a,i||{mediaIndex:-1},r),doneFn:n,name:"appendBuffer"}),s==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;let l=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${l.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,l.forEach((c)=>{this.appendBuffer.apply(this,c)})}}audioBuffered(){if(!Co(this.mediaSource,this.audioBuffer))return xs();return this.audioBuffer.buffered?this.audioBuffer.buffered:xs()}videoBuffered(){if(!Co(this.mediaSource,this.videoBuffer))return xs();return this.videoBuffer.buffered?this.videoBuffer.buffered:xs()}buffered(){let e=Co(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,n=Co(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;if(n&&!e)return this.audioBuffered();if(e&&!n)return this.videoBuffered();return qM(this.audioBuffered(),this.videoBuffered())}setDuration(e,n=Dl){nr({type:"mediaSource",sourceUpdater:this,action:tr.duration(e),name:"duration",doneFn:n})}endOfStream(e=null,n=Dl){if(typeof e!=="string")e=void 0;nr({type:"mediaSource",sourceUpdater:this,action:tr.endOfStream(e),name:"endOfStream",doneFn:n})}removeAudio(e,n,i=Dl){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){i();return}nr({type:"audio",sourceUpdater:this,action:tr.remove(e,n),doneFn:i,name:"remove"})}removeVideo(e,n,i=Dl){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){i();return}nr({type:"video",sourceUpdater:this,action:tr.remove(e,n),doneFn:i,name:"remove"})}updating(){if(l5("audio",this)||l5("video",this))return!0;return!1}audioTimestampOffset(e){if(typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e)nr({type:"audio",sourceUpdater:this,action:tr.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e;return this.audioTimestampOffset_}videoTimestampOffset(e){if(typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e)nr({type:"video",sourceUpdater:this,action:tr.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e;return this.videoTimestampOffset_}audioQueueCallback(e){if(!this.audioBuffer)return;nr({type:"audio",sourceUpdater:this,action:tr.callback(e),name:"callback"})}videoQueueCallback(e){if(!this.videoBuffer)return;nr({type:"video",sourceUpdater:this,action:tr.callback(e),name:"callback"})}dispose(){if(this.trigger("dispose"),pO.forEach((e)=>{if(this.abort(e),this.canRemoveSourceBuffer())this.removeSourceBuffer(e);else this[`${e}QueueCallback`](()=>WS(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_)this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_);this.off()}}var G8=(e)=>decodeURIComponent(escape(String.fromCharCode.apply(null,e))),gO=(e)=>{let n=new Uint8Array(e);return Array.from(n).map((i)=>i.toString(16).padStart(2,"0")).join("")},V8=new Uint8Array(`
|
|
219
|
+
|
|
220
|
+
`.split("").map((e)=>e.charCodeAt(0)));class KS extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class $S extends B1{constructor(e,n={}){super(e,n);this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return xs();let e=this.subtitlesTrack_.cues,n=e[0].startTime,i=e[e.length-1].startTime;return xs([[n,i]])}initSegmentForMap(e,n=!1){if(!e)return null;let i=N1(e),s=this.initSegments_[i];if(n&&!s&&e.bytes){let a=V8.byteLength+e.bytes.byteLength,r=new Uint8Array(a);r.set(e.bytes),r.set(V8,e.bytes.byteLength),this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:r}}return s||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){if(typeof e>"u")return this.subtitlesTrack_;if(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_())this.init_();return this.subtitlesTrack_}remove(e,n){dp(e,n,this.subtitlesTrack_)}fillBuffer_(){let e=this.chooseNextRequest_();if(!e)return;if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){let n=()=>{if(this.state="READY",!this.paused())this.monitorBuffer_()};this.syncController_.one("timestampoffset",n),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){while(e&&e.segment.empty){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,n,i){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(n.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){if(e.code===Io.TIMEOUT)this.handleTimeout_();if(e.code===Io.ABORTED)this.mediaRequestsAborted+=1;else this.mediaRequestsErrored+=1;this.stopForError(e);return}let s=this.pendingSegment_,a=i.mp4VttCues&&i.mp4VttCues.length;if(a)s.mp4VttCues=i.mp4VttCues;if(this.saveBandwidthRelatedStats_(s.duration,n.stats),n.key)this.segmentKey(n.key,!0);this.state="APPENDING",this.trigger("appending");let r=s.segment;if(r.map)r.map.bytes=n.map.bytes;if(s.bytes=n.bytes,typeof qe.default.WebVTT!=="function"&&typeof this.loadVttJs==="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,n,i),()=>this.stopForError({message:"Error loading vtt.js"}));return}r.requested=!0;try{this.parseVTTCues_(s)}catch(l){this.stopForError({message:l.message,metadata:{errorType:Ke.Error.StreamingVttParserError,error:l}});return}if(!a)this.updateTimeMapping_(s,this.syncController_.timelines[s.timeline],this.playlist_);if(s.cues.length)s.timingInfo={start:s.cues[0].startTime,end:s.cues[s.cues.length-1].endTime};else s.timingInfo={start:s.startOfSegment,end:s.startOfSegment+s.duration};if(s.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}s.byteLength=s.bytes.byteLength,this.mediaSecondsLoaded+=r.duration,s.cues.forEach((l)=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new qe.default.VTTCue(l.startTime,l.endTime,l.text):l)}),eO(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(e,n){let i=e&&e.type==="vtt",s=n&&n.type==="text";if(i&&s)super.handleData_(e,n)}updateTimingInfoEnd_(){}parseMp4VttCues_(e){let n=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach((i)=>{let s=i.start+n,a=i.end+n,r=new qe.default.VTTCue(s,a,i.cueText);if(i.settings)i.settings.split(" ").forEach((l)=>{let c=l.split(":"),p=c[0],m=c[1];r[p]=isNaN(m)?m:Number(m)});e.cues.push(r)})}parseVTTCues_(e){let n,i=!1;if(typeof qe.default.WebVTT!=="function")throw new KS;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}if(typeof qe.default.TextDecoder==="function")n=new qe.default.TextDecoder("utf8");else n=qe.default.WebVTT.StringDecoder(),i=!0;let s=new qe.default.WebVTT.Parser(qe.default,qe.default.vttjs,n);if(s.oncue=e.cues.push.bind(e.cues),s.ontimestampmap=(r)=>{e.timestampmap=r},s.onparsingerror=(r)=>{Ke.log.warn("Error encountered when parsing cues: "+r.message)},e.segment.map){let r=e.segment.map.bytes;if(i)r=G8(r);s.parse(r)}let a=e.bytes;if(i)a=G8(a);s.parse(a),s.flush()}updateTimeMapping_(e,n,i){let s=e.segment;if(!n)return;if(!e.cues.length){s.empty=!0;return}let{MPEGTS:a,LOCAL:r}=e.timestampmap,c=a/Nc.ONE_SECOND_IN_TS-r+n.mapping;if(e.cues.forEach((p)=>{let m=p.endTime-p.startTime,g=this.handleRollover_(p.startTime+c,n.time);p.startTime=Math.max(g,0),p.endTime=Math.max(g+m,0)}),!i.syncInfo){let p=e.cues[0].startTime,m=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(p,m-s.duration)}}}handleRollover_(e,n){if(n===null)return e;let i=e*Nc.ONE_SECOND_IN_TS,s=n*Nc.ONE_SECOND_IN_TS,a;if(s<i)a=-8589934592;else a=8589934592;while(Math.abs(i-s)>4294967296)i+=a;return i/Nc.ONE_SECOND_IN_TS}}var bO=function(e,n){let i=e.cues;for(let s=0;s<i.length;s++){let a=i[s];if(n>=a.adStartTime&&n<=a.adEndTime)return a}return null},wO=function(e,n,i=0){if(!e.segments)return;let s=i,a;for(let r=0;r<e.segments.length;r++){let l=e.segments[r];if(!a)a=bO(n,s+l.duration/2);if(a){if("cueIn"in l){a.endTime=s,a.adEndTime=s,s+=l.duration,a=null;continue}if(s<a.endTime){s+=l.duration;continue}a.endTime+=l.duration}else{if("cueOut"in l)a=new qe.default.VTTCue(s,s+l.duration,l.cueOut),a.adStartTime=s,a.adEndTime=s+parseFloat(l.cueOut),n.addCue(a);if("cueOutCont"in l){let[c,p]=l.cueOutCont.split("/").map(parseFloat);a=new qe.default.VTTCue(s,s+l.duration,""),a.adStartTime=s-c,a.adEndTime=a.adStartTime+p,n.addCue(a)}}s+=l.duration}};class c5{constructor({start:e,end:n,segmentIndex:i,partIndex:s=null,appended:a=!1}){this.start_=e,this.end_=n,this.segmentIndex_=i,this.partIndex_=s,this.appended_=a}isInRange(e){return e>=this.start&&e<this.end}markAppended(){this.appended_=!0}resetAppendedStatus(){this.appended_=!1}get isAppended(){return this.appended_}get start(){return this.start_}get end(){return this.end_}get segmentIndex(){return this.segmentIndex_}get partIndex(){return this.partIndex_}}class YS{constructor(e,n=[]){this.segmentSyncInfo_=e,this.partsSyncInfo_=n}get segmentSyncInfo(){return this.segmentSyncInfo_}get partsSyncInfo(){return this.partsSyncInfo_}get hasPartsSyncInfo(){return this.partsSyncInfo_.length>0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach((e)=>e.resetAppendedStatus())}}class l3{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach((e)=>e.resetAppendStatus())}update(e,n){let{mediaSequence:i,segments:s}=e;if(this.isReliable_=this.isReliablePlaylist_(i,s),!this.isReliable_)return;return this.updateStorage_(s,i,this.calculateBaseTime_(i,s,n))}getSyncInfoForTime(e){for(let{segmentSyncInfo:n,partsSyncInfo:i}of this.storage_.values())if(!i.length){if(n.isInRange(e))return n}else for(let s of i)if(s.isInRange(e))return s;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,n,i){let s=new Map,a=`
|
|
221
|
+
`,r=i,l=n;this.start_=r,e.forEach((c,p)=>{let m=this.storage_.get(l),g=r,y=g+c.duration,x=Boolean(m&&m.segmentSyncInfo&&m.segmentSyncInfo.isAppended),j=new c5({start:g,end:y,appended:x,segmentIndex:p});c.syncInfo=j;let I=r,P=(c.parts||[]).map((X,Y)=>{let J=I,ne=I+X.duration,ae=Boolean(m&&m.partsSyncInfo&&m.partsSyncInfo[Y]&&m.partsSyncInfo[Y].isAppended),se=new c5({start:J,end:ne,appended:ae,segmentIndex:p,partIndex:Y});return I=ne,a+=`Media Sequence: ${l}.${Y} | Range: ${J} --> ${ne} | Appended: ${ae}
|
|
222
|
+
`,X.syncInfo=se,se});s.set(l,new YS(j,P)),a+=`${VS(c.resolvedUri)} | Media Sequence: ${l} | Range: ${g} --> ${y} | Appended: ${x}
|
|
223
|
+
`,l++,r=y}),this.end_=r,this.storage_=s,this.diagnostics_=a}calculateBaseTime_(e,n,i){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;let s=Math.min(...this.storage_.keys());if(e<s){let a=s-e,r=this.storage_.get(s).segmentSyncInfo.start;for(let l=0;l<a;l++){let c=n[l];r-=c.duration}return r}return i}isReliablePlaylist_(e,n){return e!==void 0&&e!==null&&Array.isArray(n)&&n.length}}class u5 extends l3{constructor(e){super();this.parent_=e}calculateBaseTime_(e,n,i){if(!this.storage_.size){let s=this.parent_.getSyncInfoForMediaSequence(e);if(s)return s.segmentSyncInfo.start;return 0}return super.calculateBaseTime_(e,n,i)}}var yO=86400,Ly=[{name:"VOD",run:(e,n,i,s,a)=>{if(i!==1/0)return{time:0,segmentIndex:0,partIndex:null};return null}},{name:"MediaSequence",run:(e,n,i,s,a,r)=>{let l=e.getMediaSequenceSync(r);if(!l)return null;if(!l.isReliable)return null;let c=l.getSyncInfoForTime(a);if(!c)return null;return{time:c.start,partIndex:c.partIndex,segmentIndex:c.segmentIndex}}},{name:"ProgramDateTime",run:(e,n,i,s,a)=>{if(!Object.keys(e.timelineToDatetimeMappings).length)return null;let r=null,l=null,c=Zy(n);a=a||0;for(let p=0;p<c.length;p++){let m=n.endList||a===0?p:c.length-(p+1),g=c[m],y=g.segment,x=e.timelineToDatetimeMappings[y.timeline];if(!x||!y.dateTimeObject)continue;let I=y.dateTimeObject.getTime()/1000+x;if(y.parts&&typeof g.partIndex==="number")for(let X=0;X<g.partIndex;X++)I+=y.parts[X].duration;let P=Math.abs(a-I);if(l!==null&&(P===0||l<P))break;l=P,r={time:I,segmentIndex:g.segmentIndex,partIndex:g.partIndex}}return r}},{name:"Segment",run:(e,n,i,s,a)=>{let r=null,l=null;a=a||0;let c=Zy(n);for(let p=0;p<c.length;p++){let m=n.endList||a===0?p:c.length-(p+1),g=c[m],y=g.segment,x=g.part&&g.part.start||y&&y.start;if(y.timeline===s&&typeof x<"u"){let j=Math.abs(a-x);if(l!==null&&l<j)break;if(!r||l===null||l>=j)l=j,r={time:x,segmentIndex:g.segmentIndex,partIndex:g.partIndex}}}return r}},{name:"Discontinuity",run:(e,n,i,s,a)=>{let r=null;if(a=a||0,n.discontinuityStarts&&n.discontinuityStarts.length){let l=null;for(let c=0;c<n.discontinuityStarts.length;c++){let p=n.discontinuityStarts[c],m=n.discontinuitySequence+c+1,g=e.discontinuities[m];if(g){let y=Math.abs(a-g.time);if(l!==null&&l<y)break;if(!r||l===null||l>=y)l=y,r={time:g.time,segmentIndex:p,partIndex:null}}}}return r}},{name:"Playlist",run:(e,n,i,s,a)=>{if(n.syncInfo)return{time:n.syncInfo.time,segmentIndex:n.syncInfo.mediaSequence-n.mediaSequence,partIndex:null};return null}}];class QS extends Ke.EventTarget{constructor(e={}){super();this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};let n=new l3,i=new u5(n),s=new u5(n);this.mediaSequenceStorage_={main:n,audio:i,vtt:s},this.logger_=jr("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,n,i,s,a){if(n!==1/0)return Ly.find(({name:c})=>c==="VOD").run(this,e,n);let r=this.runStrategies_(e,n,i,s,a);if(!r.length)return null;for(let l of r){let{syncPoint:c,strategy:p}=l,{segmentIndex:m,time:g}=c;if(m<0)continue;let y=e.segments[m],x=g,j=x+y.duration;if(this.logger_(`Strategy: ${p}. Current time: ${s}. selected segment: ${m}. Time: [${x} -> ${j}]}`),s>=x&&s<j)return this.logger_("Found sync point with exact match: ",c),c}return this.selectSyncPoint_(r,{key:"time",value:s})}getExpiredTime(e,n){if(!e||!e.segments)return null;let i=this.runStrategies_(e,n,e.discontinuitySequence,0);if(!i.length)return null;let s=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});if(s.segmentIndex>0)s.time*=-1;return Math.abs(s.time+bp({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:s.segmentIndex,endIndex:0}))}runStrategies_(e,n,i,s,a){let r=[];for(let l=0;l<Ly.length;l++){let c=Ly[l],p=c.run(this,e,n,i,s,a);if(p)p.strategy=c.name,r.push({strategy:c.name,syncPoint:p})}return r}selectSyncPoint_(e,n){let i=e[0].syncPoint,s=Math.abs(e[0].syncPoint[n.key]-n.value),a=e[0].strategy;for(let r=1;r<e.length;r++){let l=Math.abs(e[r].syncPoint[n.key]-n.value);if(l<s)s=l,i=e[r].syncPoint,a=e[r].strategy}return this.logger_(`syncPoint for [${n.key}: ${n.value}] chosen with strategy [${a}]: [time:${i.time}, segmentIndex:${i.segmentIndex}`+(typeof i.partIndex==="number"?`,partIndex:${i.partIndex}`:"")+"]"),i}saveExpiredSegmentInfo(e,n){let i=n.mediaSequence-e.mediaSequence;if(i>yO){Ke.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);return}for(let s=i-1;s>=0;s--){let a=e.segments[s];if(a&&typeof a.start<"u"){n.syncInfo={mediaSequence:e.mediaSequence+s,time:a.start},this.logger_(`playlist refresh sync: [time:${n.syncInfo.time}, mediaSequence: ${n.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){let n=e.segments[0],i=n.dateTimeObject.getTime()/1000;this.timelineToDatetimeMappings[n.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:n}){let i=this.calculateSegmentTimeMapping_(e,e.timingInfo,n),s=e.segment;if(i){if(this.saveDiscontinuitySyncInfo_(e),!e.playlist.syncInfo)e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:s.start}}let a=s.dateTimeObject;if(s.discontinuity&&n&&a)this.timelineToDatetimeMappings[s.timeline]=-(a.getTime()/1000)}timestampOffsetForTimeline(e){if(typeof this.timelines[e]>"u")return null;return this.timelines[e].time}mappingForTimeline(e){if(typeof this.timelines[e]>"u")return null;return this.timelines[e].mapping}calculateSegmentTimeMapping_(e,n,i){let{segment:s,part:a}=e,r=this.timelines[e.timeline],l,c;if(typeof e.timestampOffset==="number"){if(r={time:e.startOfSegment,mapping:e.startOfSegment-n.start},i)this.timelines[e.timeline]=r,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${r.time}] [mapping: ${r.mapping}]`);l=e.startOfSegment,c=n.end+r.mapping}else if(r)l=n.start+r.mapping,c=n.end+r.mapping;else return!1;if(a)a.start=l,a.end=c;if(!s.start||l<s.start)s.start=l;return s.end=c,!0}saveDiscontinuitySyncInfo_(e){let{playlist:n,segment:i}=e;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(n.discontinuityStarts&&n.discontinuityStarts.length)for(let s=0;s<n.discontinuityStarts.length;s++){let a=n.discontinuityStarts[s],r=n.discontinuitySequence+s+1,l=a-e.mediaIndex,c=Math.abs(l);if(!this.discontinuities[r]||this.discontinuities[r].accuracy>c){let p;if(l<0)p=i.start-bp({defaultDuration:n.targetDuration,durationList:n.segments,startIndex:e.mediaIndex,endIndex:a});else p=i.end+bp({defaultDuration:n.targetDuration,durationList:n.segments,startIndex:e.mediaIndex+1,endIndex:a});this.discontinuities[r]={time:p,accuracy:c}}}}dispose(){this.trigger("dispose"),this.off()}}class JS extends Ke.EventTarget{constructor(){super();this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:n,to:i}){if(typeof n==="number"&&typeof i==="number")this.pendingTimelineChanges_[e]={type:e,from:n,to:i},this.trigger("pendingtimelinechange");return this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:n,to:i}){if(typeof n==="number"&&typeof i==="number"){this.lastTimelineChanges_[e]={type:e,from:n,to:i},delete this.pendingTimelineChanges_[e];let s={timelineChangeInfo:{from:n,to:i}};this.trigger({type:"timelinechange",metadata:s})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}var vO=RS(OS(function(){var e=function(){function P(){this.listeners={}}var X=P.prototype;return X.on=function(J,ne){if(!this.listeners[J])this.listeners[J]=[];this.listeners[J].push(ne)},X.off=function(J,ne){if(!this.listeners[J])return!1;var ae=this.listeners[J].indexOf(ne);return this.listeners[J]=this.listeners[J].slice(0),this.listeners[J].splice(ae,1),ae>-1},X.trigger=function(J){var ne=this.listeners[J];if(!ne)return;if(arguments.length===2){var ae=ne.length;for(var se=0;se<ae;++se)ne[se].call(this,arguments[1])}else{var oe=Array.prototype.slice.call(arguments,1),he=ne.length;for(var we=0;we<he;++we)ne[we].apply(this,oe)}},X.dispose=function(){this.listeners={}},X.pipe=function(J){this.on("data",function(ne){J.push(ne)})},P}();/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */function n(P){return P.subarray(0,P.byteLength-P[P.byteLength-1])}/*! @name aes-decrypter @version 4.0.2 @license Apache-2.0 */let i=function(){let P=[[[],[],[],[],[]],[[],[],[],[],[]]],X=P[0],Y=P[1],J=X[4],ne=Y[4],ae,se,oe,he=[],we=[],Ce,Ne,Pe,Ue,ze,He;for(ae=0;ae<256;ae++)we[(he[ae]=ae<<1^(ae>>7)*283)^ae]=ae;for(se=oe=0;!J[se];se^=Ce||1,oe=we[oe]||1){Ue=oe^oe<<1^oe<<2^oe<<3^oe<<4,Ue=Ue>>8^Ue&255^99,J[se]=Ue,ne[Ue]=se,Pe=he[Ne=he[Ce=he[se]]],He=Pe*16843009^Ne*65537^Ce*257^se*16843008,ze=he[Ue]*257^Ue*16843008;for(ae=0;ae<4;ae++)X[ae][se]=ze=ze<<24^ze>>>8,Y[ae][Ue]=He=He<<24^He>>>8}for(ae=0;ae<5;ae++)X[ae]=X[ae].slice(0),Y[ae]=Y[ae].slice(0);return P},s=null;class a{constructor(P){if(!s)s=i();this._tables=[[s[0][0].slice(),s[0][1].slice(),s[0][2].slice(),s[0][3].slice(),s[0][4].slice()],[s[1][0].slice(),s[1][1].slice(),s[1][2].slice(),s[1][3].slice(),s[1][4].slice()]];let X,Y,J,ne=this._tables[0][4],ae=this._tables[1],se=P.length,oe=1;if(se!==4&&se!==6&&se!==8)throw Error("Invalid aes key size");let he=P.slice(0),we=[];this._key=[he,we];for(X=se;X<4*se+28;X++){if(J=he[X-1],X%se===0||se===8&&X%se===4){if(J=ne[J>>>24]<<24^ne[J>>16&255]<<16^ne[J>>8&255]<<8^ne[J&255],X%se===0)J=J<<8^J>>>24^oe<<24,oe=oe<<1^(oe>>7)*283}he[X]=he[X-se]^J}for(Y=0;X;Y++,X--)if(J=he[Y&3?X:X-4],X<=4||Y<4)we[Y]=J;else we[Y]=ae[0][ne[J>>>24]]^ae[1][ne[J>>16&255]]^ae[2][ne[J>>8&255]]^ae[3][ne[J&255]]}decrypt(P,X,Y,J,ne,ae){let se=this._key[1],oe=P^se[0],he=J^se[1],we=Y^se[2],Ce=X^se[3],Ne,Pe,Ue,ze=se.length/4-2,He,De=4,Fe=this._tables[1],bt=Fe[0],Ve=Fe[1],$e=Fe[2],Ct=Fe[3],ct=Fe[4];for(He=0;He<ze;He++)Ne=bt[oe>>>24]^Ve[he>>16&255]^$e[we>>8&255]^Ct[Ce&255]^se[De],Pe=bt[he>>>24]^Ve[we>>16&255]^$e[Ce>>8&255]^Ct[oe&255]^se[De+1],Ue=bt[we>>>24]^Ve[Ce>>16&255]^$e[oe>>8&255]^Ct[he&255]^se[De+2],Ce=bt[Ce>>>24]^Ve[oe>>16&255]^$e[he>>8&255]^Ct[we&255]^se[De+3],De+=4,oe=Ne,he=Pe,we=Ue;for(He=0;He<4;He++)ne[(3&-He)+ae]=ct[oe>>>24]<<24^ct[he>>16&255]<<16^ct[we>>8&255]<<8^ct[Ce&255]^se[De++],Ne=oe,oe=he,he=we,we=Ce,Ce=Ne}}class r extends e{constructor(){super(e);this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){if(this.jobs.shift()(),this.jobs.length)this.timeout_=setTimeout(this.processJob_.bind(this),this.delay);else this.timeout_=null}push(P){if(this.jobs.push(P),!this.timeout_)this.timeout_=setTimeout(this.processJob_.bind(this),this.delay)}}let l=function(P){return P<<24|(P&65280)<<8|(P&16711680)>>8|P>>>24},c=function(P,X,Y){let J=new Int32Array(P.buffer,P.byteOffset,P.byteLength>>2),ne=new a(Array.prototype.slice.call(X)),ae=new Uint8Array(P.byteLength),se=new Int32Array(ae.buffer),oe,he,we,Ce,Ne,Pe,Ue,ze,He;oe=Y[0],he=Y[1],we=Y[2],Ce=Y[3];for(He=0;He<J.length;He+=4)Ne=l(J[He]),Pe=l(J[He+1]),Ue=l(J[He+2]),ze=l(J[He+3]),ne.decrypt(Ne,Pe,Ue,ze,se,He),se[He]=l(se[He]^oe),se[He+1]=l(se[He+1]^he),se[He+2]=l(se[He+2]^we),se[He+3]=l(se[He+3]^Ce),oe=Ne,he=Pe,we=Ue,Ce=ze;return ae};class p{constructor(P,X,Y,J){let ne=p.STEP,ae=new Int32Array(P.buffer),se=new Uint8Array(P.byteLength),oe=0;this.asyncStream_=new r,this.asyncStream_.push(this.decryptChunk_(ae.subarray(oe,oe+ne),X,Y,se));for(oe=ne;oe<ae.length;oe+=ne)Y=new Uint32Array([l(ae[oe-4]),l(ae[oe-3]),l(ae[oe-2]),l(ae[oe-1])]),this.asyncStream_.push(this.decryptChunk_(ae.subarray(oe,oe+ne),X,Y,se));this.asyncStream_.push(function(){J(null,n(se))})}static get STEP(){return 32000}decryptChunk_(P,X,Y,J){return function(){let ne=c(P,X,Y);J.set(ne,P.byteOffset)}}}var m=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},g;if(typeof window<"u")g=window;else if(typeof m<"u")g=m;else if(typeof self<"u")g=self;else g={};var y=g,x=function(X){if(ArrayBuffer.isView==="function")return ArrayBuffer.isView(X);return X&&X.buffer instanceof ArrayBuffer},j=y.BigInt||Number;j("0x1"),j("0x100"),j("0x10000"),j("0x1000000"),j("0x100000000"),j("0x10000000000"),j("0x1000000000000"),j("0x100000000000000"),j("0x10000000000000000"),function(){var P=new Uint16Array([65484]),X=new Uint8Array(P.buffer,P.byteOffset,P.byteLength);if(X[0]===255)return"big";if(X[0]===204)return"little";return"unknown"}();let I=function(P){let X={};return Object.keys(P).forEach((Y)=>{let J=P[Y];if(x(J))X[Y]={bytes:J.buffer,byteOffset:J.byteOffset,byteLength:J.byteLength};else X[Y]=J}),X};self.onmessage=function(P){let X=P.data,Y=new Uint8Array(X.encrypted.bytes,X.encrypted.byteOffset,X.encrypted.byteLength),J=new Uint32Array(X.key.bytes,X.key.byteOffset,X.key.byteLength/4),ne=new Uint32Array(X.iv.bytes,X.iv.byteOffset,X.iv.byteLength/4);new p(Y,J,ne,function(ae,se){self.postMessage(I({source:X.source,decrypted:se}),[se.buffer])})}})),SO=IS(vO),_O=(e)=>{let n=e.default?"main":"alternative";if(e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0)n="main-desc";return n},ZS=(e,n)=>{if(e.abort(),e.pause(),n&&n.activePlaylistLoader)n.activePlaylistLoader.pause(),n.activePlaylistLoader=null},h5=(e,n)=>{n.activePlaylistLoader=e,e.load()},xO=(e,n)=>()=>{let{segmentLoaders:{[e]:i,main:s},mediaTypes:{[e]:a}}=n,r=a.activeTrack(),l=a.getActiveGroup(),{activePlaylistLoader:c,lastGroup_:p}=a;if(l&&p&&l.id===p.id)return;if(a.lastGroup_=l,a.lastTrack_=r,ZS(i,a),!l||l.isMainPlaylist)return;if(!l.playlistLoader){if(c)s.resetEverything();return}i.resyncLoader(),h5(l.playlistLoader,a)},kO=(e,n)=>()=>{let{segmentLoaders:{[e]:i},mediaTypes:{[e]:s}}=n;s.lastGroup_=null,i.abort(),i.pause()},TO=(e,n)=>()=>{let{mainPlaylistLoader:i,segmentLoaders:{[e]:s,main:a},mediaTypes:{[e]:r}}=n,l=r.activeTrack(),c=r.getActiveGroup(),{activePlaylistLoader:p,lastTrack_:m}=r;if(m&&l&&m.id===l.id)return;if(r.lastGroup_=c,r.lastTrack_=l,ZS(s,r),!c)return;if(c.isMainPlaylist){if(!l||!m||l.id===m.id)return;let g=n.vhs.playlistController_,y=g.selectPlaylist();if(g.media()===y)return;r.logger_(`track change. Switching main audio from ${m.id} to ${l.id}`),i.pause(),a.resetEverything(),g.fastQualityChange_(y);return}if(e==="AUDIO"){if(!c.playlistLoader){a.setAudio(!0),a.resetEverything();return}s.setAudio(!0),a.setAudio(!1)}if(p===c.playlistLoader){h5(c.playlistLoader,r);return}if(s.track)s.track(l);s.resetEverything(),h5(c.playlistLoader,r)},L1={AUDIO:(e,n)=>()=>{let{mediaTypes:{[e]:i},excludePlaylist:s}=n,a=i.activeTrack(),r=i.activeGroup(),l=(r.filter((p)=>p.default)[0]||r[0]).id,c=i.tracks[l];if(a===c){s({error:{message:"Problem encountered loading the default audio track."}});return}Ke.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(let p in i.tracks)i.tracks[p].enabled=i.tracks[p]===c;i.onTrackChanged()},SUBTITLES:(e,n)=>()=>{let{mediaTypes:{[e]:i}}=n;Ke.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");let s=i.activeTrack();if(s)s.mode="disabled";i.onTrackChanged()}},X8={AUDIO:(e,n,i)=>{if(!n)return;let{tech:s,requestOptions:a,segmentLoaders:{[e]:r}}=i;n.on("loadedmetadata",()=>{let l=n.media();if(r.playlist(l,a),!s.paused()||l.endList&&s.preload()!=="none")r.load()}),n.on("loadedplaylist",()=>{if(r.playlist(n.media(),a),!s.paused())r.load()}),n.on("error",L1[e](e,i))},SUBTITLES:(e,n,i)=>{let{tech:s,requestOptions:a,segmentLoaders:{[e]:r},mediaTypes:{[e]:l}}=i;n.on("loadedmetadata",()=>{let c=n.media();if(r.playlist(c,a),r.track(l.activeTrack()),!s.paused()||c.endList&&s.preload()!=="none")r.load()}),n.on("loadedplaylist",()=>{if(r.playlist(n.media(),a),!s.paused())r.load()}),n.on("error",L1[e](e,i))}},AO={AUDIO:(e,n)=>{let{vhs:i,sourceType:s,segmentLoaders:{[e]:a},requestOptions:r,main:{mediaGroups:l},mediaTypes:{[e]:{groups:c,tracks:p,logger_:m}},mainPlaylistLoader:g}=n,y=jp(g.main);if(!l[e]||Object.keys(l[e]).length===0){if(l[e]={main:{default:{default:!0}}},y)l[e].main.default.playlists=g.main.playlists}for(let x in l[e]){if(!c[x])c[x]=[];for(let j in l[e][x]){let I=l[e][x][j],P;if(y)m(`AUDIO group '${x}' label '${j}' is a main playlist`),I.isMainPlaylist=!0,P=null;else if(s==="vhs-json"&&I.playlists)P=new oh(I.playlists[0],i,r);else if(I.resolvedUri)P=new oh(I.resolvedUri,i,r);else if(I.playlists&&s==="dash")P=new P1(I.playlists[0],i,r,g);else P=null;if(I=Jn({id:j,playlistLoader:P},I),X8[e](e,I.playlistLoader,n),c[x].push(I),typeof p[j]>"u"){let X=new Ke.AudioTrack({id:j,kind:_O(I),enabled:!1,language:I.language,default:I.default,label:j});p[j]=X}}}a.on("error",L1[e](e,n))},SUBTITLES:(e,n)=>{let{tech:i,vhs:s,sourceType:a,segmentLoaders:{[e]:r},requestOptions:l,main:{mediaGroups:c},mediaTypes:{[e]:{groups:p,tracks:m}},mainPlaylistLoader:g}=n;for(let y in c[e]){if(!p[y])p[y]=[];for(let x in c[e][y]){if(!s.options_.useForcedSubtitles&&c[e][y][x].forced)continue;let j=c[e][y][x],I;if(a==="hls")I=new oh(j.resolvedUri,s,l);else if(a==="dash"){if(!j.playlists.filter((X)=>X.excludeUntil!==1/0).length)return;I=new P1(j.playlists[0],s,l,g)}else if(a==="vhs-json")I=new oh(j.playlists?j.playlists[0]:j.resolvedUri,s,l);if(j=Jn({id:x,playlistLoader:I},j),X8[e](e,j.playlistLoader,n),p[y].push(j),typeof m[x]>"u"){let P=i.addRemoteTextTrack({id:x,kind:"subtitles",default:j.default&&j.autoselect,language:j.language,label:x},!1).track;m[x]=P}}}r.on("error",L1[e](e,n))},"CLOSED-CAPTIONS":(e,n)=>{let{tech:i,main:{mediaGroups:s},mediaTypes:{[e]:{groups:a,tracks:r}}}=n;for(let l in s[e]){if(!a[l])a[l]=[];for(let c in s[e][l]){let p=s[e][l][c];if(!/^(?:CC|SERVICE)/.test(p.instreamId))continue;let m=i.options_.vhs&&i.options_.vhs.captionServices||{},g={label:c,language:p.language,instreamId:p.instreamId,default:p.default&&p.autoselect};if(m[g.instreamId])g=Jn(g,m[g.instreamId]);if(g.default===void 0)delete g.default;if(a[l].push(Jn({id:c},p)),typeof r[c]>"u"){let y=i.addRemoteTextTrack({id:g.instreamId,kind:"captions",default:g.default,language:g.language,label:g.label},!1).track;r[c]=y}}}}},e_=(e,n)=>{for(let i=0;i<e.length;i++){if(s3(n,e[i]))return!0;if(e[i].playlists&&e_(e[i].playlists,n))return!0}return!1},CO=(e,n)=>(i)=>{let{mainPlaylistLoader:s,mediaTypes:{[e]:{groups:a}}}=n,r=s.media();if(!r)return null;let l=null;if(r.attributes[e])l=a[r.attributes[e]];let c=Object.keys(a);if(!l){if(e==="AUDIO"&&c.length>1&&jp(n.main))for(let p=0;p<c.length;p++){let m=a[c[p]];if(e_(m,r)){l=m;break}}else if(a.main)l=a.main;else if(c.length===1)l=a[c[0]]}if(typeof i>"u")return l;if(i===null||!l)return null;return l.filter((p)=>p.id===i.id)[0]||null},jO={AUDIO:(e,n)=>()=>{let{mediaTypes:{[e]:{tracks:i}}}=n;for(let s in i)if(i[s].enabled)return i[s];return null},SUBTITLES:(e,n)=>()=>{let{mediaTypes:{[e]:{tracks:i}}}=n;for(let s in i)if(i[s].mode==="showing"||i[s].mode==="hidden")return i[s];return null}},EO=(e,{mediaTypes:n})=>()=>{let i=n[e].activeTrack();if(!i)return null;return n[e].activeGroup(i)},qO=(e)=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((m)=>{AO[m](m,e)});let{mediaTypes:n,mainPlaylistLoader:i,tech:s,vhs:a,segmentLoaders:{["AUDIO"]:r,main:l}}=e;["AUDIO","SUBTITLES"].forEach((m)=>{n[m].activeGroup=CO(m,e),n[m].activeTrack=jO[m](m,e),n[m].onGroupChanged=xO(m,e),n[m].onGroupChanging=kO(m,e),n[m].onTrackChanged=TO(m,e),n[m].getActiveGroup=EO(m,e)});let c=n.AUDIO.activeGroup();if(c){let m=(c.filter((y)=>y.default)[0]||c[0]).id;if(n.AUDIO.tracks[m].enabled=!0,n.AUDIO.onGroupChanged(),n.AUDIO.onTrackChanged(),!n.AUDIO.getActiveGroup().playlistLoader)l.setAudio(!0);else l.setAudio(!1),r.setAudio(!0)}i.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach((m)=>n[m].onGroupChanged())}),i.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach((m)=>n[m].onGroupChanging())});let p=()=>{n.AUDIO.onTrackChanged(),s.trigger({type:"usage",name:"vhs-audio-change"})};s.audioTracks().addEventListener("change",p),s.remoteTextTracks().addEventListener("change",n.SUBTITLES.onTrackChanged),a.on("dispose",()=>{s.audioTracks().removeEventListener("change",p),s.remoteTextTracks().removeEventListener("change",n.SUBTITLES.onTrackChanged)}),s.clearTracks("audio");for(let m in n.AUDIO.tracks)s.audioTracks().addTrack(n.AUDIO.tracks[m])},DO=()=>{let e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((n)=>{e[n]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Dl,activeTrack:Dl,getActiveGroup:Dl,onGroupChanged:Dl,onTrackChanged:Dl,lastTrack_:null,logger_:jr(`MediaGroups[${n}]`)}}),e};class f5{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){if(e===1)this.version_=e}set ttl(e){this.ttl_=e||300}set reloadUri(e){if(e)this.reloadUri_=Ma(this.reloadUri_,e)}set priority(e){if(e&&e.length)this.priority_=e}set pathwayClones(e){if(e&&e.length)this.pathwayClones_=new Map(e.map((n)=>[n.ID,n]))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class t_ extends Ke.EventTarget{constructor(e,n){super();this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new f5,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=jr("Content Steering"),this.xhr_=e,this.getBandwidth_=n}assignTagProperties(e,n){this.manifestType_=n.serverUri?"HLS":"DASH";let i=n.serverUri||n.serverURL;if(!i){this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error");return}if(i.startsWith("data:")){this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1));return}if(this.steeringManifest.reloadUri=Ma(e,i),this.defaultPathway=n.pathwayId||n.defaultServiceLocation,this.queryBeforeStart=n.queryBeforeStart,this.proxyServerUrl_=n.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart)this.trigger("content-steering")}requestSteeringManifest(e){let n=this.steeringManifest.reloadUri;if(!n)return;let i=e?n:this.getRequestURI(n);if(!i){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}let s={contentSteeringInfo:{uri:i}};this.trigger({type:"contentsteeringloadstart",metadata:s}),this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},(a,r)=>{if(a){if(r.status===410){this.logger_(`manifest request 410 ${a}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),this.excludedSteeringManifestURLs.add(i);return}if(r.status===429){let p=r.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${a}.`),this.logger_(`content steering will retry in ${p} seconds.`),this.startTTLTimeout_(parseInt(p,10));return}this.logger_(`manifest failed to load ${a}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:s});let l;try{l=JSON.parse(this.request_.responseText)}catch(p){let m={errorType:Ke.Error.StreamingContentSteeringParserError,error:p};this.trigger({type:"error",metadata:m})}this.assignSteeringProperties_(l);let c={contentSteeringInfo:s.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:c}),this.startTTLTimeout_()})}setProxyServerUrl_(e){let n=new qe.default.URL(e),i=new qe.default.URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(n.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){let n=JSON.parse(qe.default.atob(e));this.assignSteeringProperties_(n)}setSteeringParams_(e){let n=new qe.default.URL(e),i=this.getPathway(),s=this.getBandwidth_();if(i){let a=`_${this.manifestType_}_pathway`;n.searchParams.set(a,i)}if(s){let a=`_${this.manifestType_}_throughput`;n.searchParams.set(a,s)}return n.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}if(this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,!this.availablePathways_.size)this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose();let i=((s)=>{for(let a of s)if(this.availablePathways_.has(a))return a;return[...this.availablePathways_][0]})(this.steeringManifest.priority);if(this.currentPathway!==i)this.currentPathway=i,this.trigger("content-steering")}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;let n=(s)=>this.excludedSteeringManifestURLs.has(s);if(this.proxyServerUrl_){let s=this.setProxyServerUrl_(e);if(!n(s))return s}let i=this.setSteeringParams_(e);if(!n(i))return i;return null}startTTLTimeout_(e=this.steeringManifest.ttl){let n=e*1000;this.ttlTimeout_=qe.default.setTimeout(()=>{this.requestSteeringManifest()},n)}clearTTLTimeout_(){qe.default.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){if(this.request_)this.request_.abort();this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new f5}addAvailablePathway(e){if(e)this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,n){return!n&&this.steeringManifest.reloadUri||n&&(Ma(e,n.serverURL)!==this.steeringManifest.reloadUri||n.defaultServiceLocation!==this.defaultPathway||n.queryBeforeStart!==this.queryBeforeStart||n.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}var IO=(e,n)=>{let i=null;return(...s)=>{clearTimeout(i),i=setTimeout(()=>{e.apply(null,s)},n)}},MO=10,El,RO=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],OO=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},FO=function({currentPlaylist:e,buffered:n,currentTime:i,nextPlaylist:s,bufferLowWaterLine:a,bufferHighWaterLine:r,duration:l,bufferBasedABR:c,log:p}){if(!s)return Ke.log.warn("We received no playlist to switch to. Please check your stream."),!1;let m=`allowing switch ${e&&e.id||"null"} -> ${s.id}`;if(!e)return p(`${m} as current playlist is not set`),!0;if(s.id===e.id)return!1;let g=Boolean(Xf(n,i).length);if(!e.endList){if(!g&&typeof e.partTargetDuration==="number")return p(`not ${m} as current playlist is live llhls, but currentTime isn't in buffered.`),!1;return p(`${m} as current playlist is live`),!0}let y=t3(n,i),x=c?_s.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:_s.MAX_BUFFER_LOW_WATER_LINE;if(l<x)return p(`${m} as duration < max low water line (${l} < ${x})`),!0;let j=s.attributes.BANDWIDTH,I=e.attributes.BANDWIDTH;if(j<I&&(!c||y<r)){let P=`${m} as next bandwidth < current bandwidth (${j} < ${I})`;if(c)P+=` and forwardBuffer < bufferHighWaterLine (${y} < ${r})`;return p(P),!0}if((!c||j>I)&&y>=a){let P=`${m} as forwardBuffer >= bufferLowWaterLine (${y} >= ${a})`;if(c)P+=` and next bandwidth > current bandwidth (${j} > ${I})`;return p(P),!0}return p(`not ${m} as no switching criteria met`),!1};class n_ extends Ke.EventTarget{constructor(e){super();this.fastQualityChange_=IO(this.fastQualityChange_.bind(this),100);let{src:n,withCredentials:i,tech:s,bandwidth:a,externVhs:r,useCueTags:l,playlistExclusionDuration:c,enableLowInitialPlaylist:p,sourceType:m,cacheEncryptionKeys:g,bufferBasedABR:y,leastPixelDiffSelector:x,captionServices:j,experimentalUseMMS:I}=e;if(!n)throw Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:P}=e;if(P===null||typeof P>"u")P=1/0;if(El=r,this.bufferBasedABR=Boolean(y),this.leastPixelDiffSelector=Boolean(x),this.withCredentials=i,this.tech_=s,this.vhs_=s.vhs,this.player_=e.player_,this.sourceType_=m,this.useCueTags_=l,this.playlistExclusionDuration=c,this.maxPlaylistRetries=P,this.enableLowInitialPlaylist=p,this.usingManagedMediaSource_=!1,this.useCueTags_)this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType="";if(this.requestOptions_={withCredentials:i,maxPlaylistRetries:P,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=DO(),I&&qe.default.ManagedMediaSource)this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new qe.default.ManagedMediaSource,this.usingManagedMediaSource_=!0,Ke.log("Using ManagedMediaSource");else if(qe.default.MediaSource)this.mediaSource=new qe.default.MediaSource;this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=xs(),this.hasPlayed_=!1,this.syncController_=new QS(e),this.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new SO,this.sourceUpdater_=new o3(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new JS,this.keyStatusMap_=new Map;let X={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:j,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:a,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:g,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new P1(n,this.vhs_,Jn(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new oh(n,this.vhs_,Jn(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new B1(Jn(X,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new B1(Jn(X,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new $S(Jn(X,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((ne,ae)=>{function se(){s.off("vttjserror",oe),ne()}function oe(){s.off("vttjsloaded",se),ae()}s.one("vttjsloaded",se),s.one("vttjserror",oe),s.addWebVttScript_()})}),e);let Y=()=>this.mainSegmentLoader_.bandwidth;if(this.contentSteeringController_=new t_(this.vhs_.xhr,Y),this.setupSegmentLoaderListeners_(),this.bufferBasedABR)this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_());if(RO.forEach((ne)=>{this[ne+"_"]=OO.bind(this,ne)}),this.logger_=jr("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none")this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_);else this.mainPlaylistLoader_.load();this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;let J=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(J,()=>{let ne=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-ne,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){let e=this.mainAppendsToLoadedData_(),n=this.audioAppendsToLoadedData_();if(e===-1||n===-1)return-1;return e+n}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){let n=this.selectPlaylist();if(n&&this.shouldSwitchToMedia_(n))this.switchMedia_(n,e)}switchMedia_(e,n,i){let s=this.media(),a=s&&(s.id||s.uri),r=e&&(e.id||e.uri);if(a&&a!==r){this.logger_(`switch media ${a} -> ${r} from ${n}`);let l={renditionInfo:{id:r,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:n};this.trigger({type:"renditionselected",metadata:l}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${n}`})}this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((e)=>{let n=this.mediaTypes_[e],i=n?n.activeGroup():null,s=this.contentSteeringController_.getPathway();if(i&&s){let r=(i.length?i[0].playlists:i.playlists).filter((l)=>l.attributes.serviceLocation===s);if(r.length)this.mediaTypes_[e].activePlaylistLoader.media(r[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=qe.default.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){if(this.tech_.scrubbing&&this.tech_.scrubbing())return;qe.default.clearInterval(this.abrTimer_),this.abrTimer_=null}getAudioTrackPlaylists_(){let e=this.main(),n=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return n;let i=e.mediaGroups.AUDIO,s=Object.keys(i),a;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)a=this.mediaTypes_.AUDIO.activeTrack();else{let l=i.main||s.length&&i[s[0]];for(let c in l)if(l[c].default){a={label:c};break}}if(!a)return n;let r=[];for(let l in i)if(i[l][a.label]){let c=i[l][a.label];if(c.playlists&&c.playlists.length)r.push.apply(r,c.playlists);else if(c.uri)r.push(c);else if(e.playlists.length)for(let p=0;p<e.playlists.length;p++){let m=e.playlists[p];if(m.attributes&&m.attributes.AUDIO&&m.attributes.AUDIO===l)r.push(m)}}if(!r.length)return n;return r}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{let n=this.mainPlaylistLoader_.media(),i=n.targetDuration*1.5*1000;if(e5(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media()))this.requestOptions_.timeout=0;else this.requestOptions_.timeout=i;if(n.endList&&this.tech_.preload()!=="none")this.mainSegmentLoader_.playlist(n,this.requestOptions_),this.mainSegmentLoader_.load();if(qO({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),n),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media())this.trigger("selectedinitialmedia");else this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{if(this.loadOnPlay_)this.tech_.off("play",this.loadOnPlay_);let n=this.mainPlaylistLoader_.media();if(!n){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let i;if(this.enableLowInitialPlaylist)i=this.selectInitialPlaylist();if(!i)i=this.selectPlaylist();if(!i||!this.shouldSwitchToMedia_(i))return;if(this.initialMedia_=i,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments))return;n=this.initialMedia_}this.handleUpdatedMediaPlaylist(n)}),this.mainPlaylistLoader_.on("error",()=>{let n=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:n.playlist,error:n})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{let n=this.mainPlaylistLoader_.media(),i=n.targetDuration*1.5*1000;if(e5(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media()))this.requestOptions_.timeout=0;else this.requestOptions_.timeout=i;if(this.sourceType_==="dash"){if(this.mainPlaylistLoader_.isPaused)this.mainPlaylistLoader_.load()}if(this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(n,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_)this.runFastQualitySwitch_();else this.mainSegmentLoader_.load();this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{let n=this.mainPlaylistLoader_.media();if(n.lastExcludeReason_==="playlist-unchanged")return;if(this.stuckAtPlaylistEnd_(n))this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck")}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach((n)=>{this.mainPlaylistLoader_.on(n,(i)=>{this.player_.trigger(Ii({},i))})})}handleUpdatedMediaPlaylist(e){if(this.useCueTags_)this.updateAdCues_(e);if(this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_)this.runFastQualitySwitch_();if(this.updateDuration(!e.endList),!this.tech_.paused()){if(this.mainSegmentLoader_.load(),this.audioSegmentLoader_)this.audioSegmentLoader_.load()}}triggerPresenceUsage_(e,n){let i=e.mediaGroups||{},s=!0,a=Object.keys(i.AUDIO);for(let r in i.AUDIO)for(let l in i.AUDIO[r])if(!i.AUDIO[r][l].uri)s=!1;if(s)this.tech_.trigger({type:"usage",name:"vhs-demuxed"});if(Object.keys(i.SUBTITLES).length)this.tech_.trigger({type:"usage",name:"vhs-webvtt"});if(El.Playlist.isAes(n))this.tech_.trigger({type:"usage",name:"vhs-aes"});if(a.length&&Object.keys(i.AUDIO[a[0]]).length>1)this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"});if(this.useCueTags_)this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){let n=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),s=this.bufferLowWaterLine(),a=this.bufferHighWaterLine(),r=this.tech_.buffered();return FO({buffered:r,currentTime:i,currentPlaylist:n,nextPlaylist:e,bufferLowWaterLine:s,bufferHighWaterLine:a,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){if(this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{if(this.bufferBasedABR)this.mainSegmentLoader_.load()}),!this.bufferBasedABR)this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")});this.mainSegmentLoader_.on("error",()=>{let i=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:i.playlist,error:i})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{let i=this.audioSegmentLoader_.pendingSegment_;if(!i||!i.segment||!i.segment.syncInfo)return;let s=i.segment.syncInfo.end+0.01;this.tech_.setCurrentTime(s)}),this.timelineChangeController_.on("fixBadTimelineChange",()=>{if(this.logger_("Fix bad timeline change. Restarting al segment loaders..."),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader)this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything();if(this.mediaTypes_.SUBTITLES.activePlaylistLoader)this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything();this.load()}),this.mainSegmentLoader_.on("earlyabort",(i)=>{if(this.bufferBasedABR)return;this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:MO})});let e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();let i=this.getCodecsOrExclude_();if(!i)return;this.sourceUpdater_.addOrChangeSourceBuffers(i)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{if(!this.triggeredFmp4Usage)this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0}),this.audioSegmentLoader_.on("fmp4",()=>{if(!this.triggeredFmp4Usage)this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach((i)=>{this.mainSegmentLoader_.on(i,(s)=>{this.player_.trigger(Ii({},s))}),this.audioSegmentLoader_.on(i,(s)=>{this.player_.trigger(Ii({},s))}),this.subtitleSegmentLoader_.on(i,(s)=>{this.player_.trigger(Ii({},s))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){if(this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader)this.audioSegmentLoader_.load();if(this.mediaTypes_.SUBTITLES.activePlaylistLoader)this.subtitleSegmentLoader_.load()}pause(){if(this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader)this.audioSegmentLoader_.pause();if(this.mediaTypes_.SUBTITLES.activePlaylistLoader)this.subtitleSegmentLoader_.pause()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){if(this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader)this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything();if(this.mediaTypes_.SUBTITLES.activePlaylistLoader)this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything();this.load()}play(){if(this.setupFirstPlay())return;if(this.tech_.ended())this.tech_.setCurrentTime(0);if(this.hasPlayed_)this.load();let e=this.tech_.seekable();if(this.tech_.duration()===1/0){if(this.tech_.currentTime()<e.start(0))return this.tech_.setCurrentTime(e.end(e.length-1))}}setupFirstPlay(){let e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){let n=this.seekable();if(!n.length)return!1;let i=n.end(0),s=i;if(e.start){let a=e.start.timeOffset;if(a<0){let r=this.mainPlaylistLoader_.main,l=El.Playlist.liveEdgeDelay(r,e),c=i+l;s=Math.max(Math.min(c+a,i),n.start(0))}else s=Math.min(i,a)}this.trigger("firstplay"),this.tech_.setCurrentTime(s)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){let e=this.tech_.play();if(typeof e<"u"&&typeof e.then==="function")e.then(null,(n)=>{})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;let e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;let n=this.duration();e[e.length-1].endTime=isNaN(n)||Math.abs(n)===1/0?Number.MAX_VALUE:n}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){let n=this.mainSegmentLoader_.getCurrentMediaInfo_();if(!n||n.hasVideo)e=e&&this.audioSegmentLoader_.ended_;else e=this.audioSegmentLoader_.ended_}if(!e)return;this.stopABRTimer_(),this.sourceUpdater_.endOfStream()}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;let i=this.syncController_.getExpiredTime(e,this.duration());if(i===null)return!1;let s=El.Playlist.playlistEnd(e,i),a=this.tech_.currentTime(),r=this.tech_.buffered();if(!r.length)return s-a<=qo;let l=r.end(r.length-1);return l-a<=qo&&s-l<=qo}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:n={},playlistExclusionDuration:i}){if(e=e||this.mainPlaylistLoader_.media(),i=i||n.playlistExclusionDuration||this.playlistExclusionDuration,!e){if(this.error=n,this.mediaSource.readyState!=="open")this.trigger("error");else this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;let s=this.mainPlaylistLoader_.main.playlists,a=s.filter(wb),r=a.length===1&&a[0]===e;if(s.length===1&&i!==1/0)return Ke.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(r);if(r){if(this.main().contentSteering){let j=this.pathwayAttribute_(e),I=this.contentSteeringController_.steeringManifest.ttl*1000;this.contentSteeringController_.excludePathway(j),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(j)},I);return}let x=!1;if(s.forEach((j)=>{if(j===e)return;let I=j.excludeUntil;if(typeof I<"u"&&I!==1/0)x=!0,delete j.excludeUntil}),x)Ke.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist")}let l;if(e.playlistErrors_>this.maxPlaylistRetries)l=1/0;else l=Date.now()+i*1000;if(e.excludeUntil=l,n.reason)e.lastExcludeReason_=n.reason;this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});let c=this.selectPlaylist();if(!c){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}let p=n.internal?this.logger_:Ke.log.warn,m=n.message?" "+n.message:"";if(p(`${n.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${m} Switching to playlist ${c.id}.`),c.attributes.AUDIO!==e.attributes.AUDIO)this.delegateLoaders_("audio",["abort","pause"]);if(c.attributes.SUBTITLES!==e.attributes.SUBTITLES)this.delegateLoaders_("subtitle",["abort","pause"]);this.delegateLoaders_("main",["abort","pause"]);let g=c.targetDuration/2*1000||5000,y=typeof c.lastRequest==="number"&&Date.now()-c.lastRequest<=g;return this.switchMedia_(c,"exclude",r||y)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,n){let i=[],s=e==="all";if(s||e==="main")i.push(this.mainPlaylistLoader_);let a=[];if(s||e==="audio")a.push("AUDIO");if(s||e==="subtitle")a.push("CLOSED-CAPTIONS"),a.push("SUBTITLES");a.forEach((r)=>{let l=this.mediaTypes_[r]&&this.mediaTypes_[r].activePlaylistLoader;if(l)i.push(l)}),["main","audio","subtitle"].forEach((r)=>{let l=this[`${r}SegmentLoader_`];if(l&&(e===r||e==="all"))i.push(l)}),i.forEach((r)=>n.forEach((l)=>{if(typeof r[l]==="function")r[l]()}))}setCurrentTime(e){let n=Xf(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()))return 0;if(!this.mainPlaylistLoader_.media().segments)return 0;if(n&&n.length)return e;if(this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader)this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything();if(this.mediaTypes_.SUBTITLES.activePlaylistLoader)this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything();this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;let e=this.mainPlaylistLoader_.media();if(!e)return 0;if(!e.endList)return 1/0;if(this.mediaSource)return this.mediaSource.duration;return El.Playlist.duration(e)}seekable(){return this.seekable_}getSeekableRange_(e,n){let i=e.media();if(!i)return null;let s=this.syncController_.getMediaSequenceSync(n);if(s&&s.isReliable){let{start:l,end:c}=s;if(!isFinite(l)||!isFinite(c))return null;let p=El.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i),m=Math.max(l,c-p);return xs([[l,m]])}let a=this.syncController_.getExpiredTime(i,this.duration());if(a===null)return null;let r=El.Playlist.seekable(i,a,El.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i));return r.length?r:null}computeFinalSeekable_(e,n){if(!n)return e;let i=e.start(0),s=e.end(0),a=n.start(0),r=n.end(0);if(a>s||i>r)return e;return xs([[Math.max(i,a),Math.min(s,r)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;let e=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!e)return;let n;if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(n=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!n)return}let i=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,n),!this.seekable_)return;if(i&&i.length&&this.seekable_.length){if(i.start(0)===this.seekable_.start(0)&&i.end(0)===this.seekable_.end(0))return}this.logger_(`seekable updated [${aS(this.seekable_)}]`);let s={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:s}),this.tech_.trigger("seekablechanged")}updateDuration(e){if(this.updateDuration_)this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null;if(this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){let s=this.seekable();if(!s.length)return;if(isNaN(this.mediaSource.duration)||this.mediaSource.duration<s.end(s.length-1))this.sourceUpdater_.setDuration(s.end(s.length-1));return}let n=this.tech_.buffered(),i=El.Playlist.duration(this.mainPlaylistLoader_.media());if(n.length>0)i=Math.max(i,n.end(n.length-1));if(this.mediaSource.duration!==i)this.sourceUpdater_.setDuration(i)}dispose(){if(this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_)this.tech_.off("play",this.loadOnPlay_);if(["AUDIO","SUBTITLES"].forEach((e)=>{let n=this.mediaTypes_[e].groups;for(let i in n)n[i].forEach((s)=>{if(s.playlistLoader)s.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_)this.mediaSource.removeEventListener("sourceopen",this.updateDuration_);this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){let e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,n=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e?!0:!!this.audioSegmentLoader_.getCurrentMediaInfo_();if(!n||!i)return!1;return!0}getCodecsOrExclude_(){let e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},n=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;let i=wp(this.main(),n),s={},a=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo)s.video=i.video||e.main.videoCodec||C6;if(e.main.isMuxed)s.video+=`,${i.audio||e.main.audioCodec||Vw}`;if(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||a)s.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||Vw,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4;if(!s.audio&&!s.video){this.excludePlaylist({playlistToExclude:n,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}let r=(p,m)=>p?Af(m,this.usingManagedMediaSource_):Yg(m),l={},c;if(["video","audio"].forEach(function(p){if(s.hasOwnProperty(p)&&!r(e[p].isFmp4,s[p])){let m=e[p].isFmp4?"browser":"muxer";if(l[m]=l[m]||[],l[m].push(s[p]),p==="audio")c=m}}),a&&c&&n.attributes.AUDIO){let p=n.attributes.AUDIO;this.main().playlists.forEach((m)=>{if((m.attributes&&m.attributes.AUDIO)===p&&m!==n)m.excludeUntil=1/0}),this.logger_(`excluding audio group ${p} as ${c} does not support codec(s): "${s.audio}"`)}if(Object.keys(l).length){let p=Object.keys(l).reduce((m,g)=>{if(m)m+=", ";return m+=`${g} does not support codec(s): "${l[g].join(",")}"`,m},"")+".";this.excludePlaylist({playlistToExclude:n,error:{internal:!0,message:p},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){let p=[];if(["video","audio"].forEach((m)=>{let g=(Kr(this.sourceUpdater_.codecs[m]||"")[0]||{}).type,y=(Kr(s[m]||"")[0]||{}).type;if(g&&y&&g.toLowerCase()!==y.toLowerCase())p.push(`"${this.sourceUpdater_.codecs[m]}" -> "${s[m]}"`)}),p.length){this.excludePlaylist({playlistToExclude:n,error:{message:`Codec switching not supported: ${p.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return s}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers())return;if(!this.areMediaTypesKnown_())return;let e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);let n=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(n)}excludeUnsupportedVariants_(){let e=this.main().playlists,n=[];Object.keys(e).forEach((i)=>{let s=e[i];if(n.indexOf(s.id)!==-1)return;n.push(s.id);let a=wp(this.main,s),r=[];if(a.audio&&!Yg(a.audio)&&!Af(a.audio,this.usingManagedMediaSource_))r.push(`audio codec ${a.audio}`);if(a.video&&!Yg(a.video)&&!Af(a.video,this.usingManagedMediaSource_))r.push(`video codec ${a.video}`);if(a.text&&a.text==="stpp.ttml.im1t")r.push(`text codec ${a.text}`);if(r.length)s.excludeUntil=1/0,this.logger_(`excluding ${s.id} for unsupported: ${r.join(", ")}`)})}excludeIncompatibleVariants_(e){let n=[],i=this.main().playlists,s=kp(Kr(e)),a=D8(s),r=s.video&&Kr(s.video)[0]||null,l=s.audio&&Kr(s.audio)[0]||null;Object.keys(i).forEach((c)=>{let p=i[c];if(n.indexOf(p.id)!==-1||p.excludeUntil===1/0)return;n.push(p.id);let m=[],g=wp(this.mainPlaylistLoader_.main,p),y=D8(g);if(!g.audio&&!g.video)return;if(y!==a)m.push(`codec count "${y}" !== "${a}"`);if(!this.sourceUpdater_.canChangeType()){let x=g.video&&Kr(g.video)[0]||null,j=g.audio&&Kr(g.audio)[0]||null;if(x&&r&&x.type.toLowerCase()!==r.type.toLowerCase())m.push(`video codec "${x.type}" !== "${r.type}"`);if(j&&l&&j.type.toLowerCase()!==l.type.toLowerCase())m.push(`audio codec "${j.type}" !== "${l.type}"`)}if(m.length)p.excludeUntil=1/0,this.logger_(`excluding ${p.id}: ${m.join(" && ")}`)})}updateAdCues_(e){let n=0,i=this.seekable();if(i.length)n=i.start(0);wO(e,this.cueTagsTrack_,n)}goalBufferLength(){let e=this.tech_.currentTime(),{GOAL_BUFFER_LENGTH:n,GOAL_BUFFER_LENGTH_RATE:i}=_s,s=Math.max(n,_s.MAX_GOAL_BUFFER_LENGTH);return Math.min(n+e*i,s)}bufferLowWaterLine(){let e=this.tech_.currentTime(),{BUFFER_LOW_WATER_LINE:n,BUFFER_LOW_WATER_LINE_RATE:i}=_s,s=Math.max(n,_s.MAX_BUFFER_LOW_WATER_LINE),a=Math.max(n,_s.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(n+e*i,this.bufferBasedABR?a:s)}bufferHighWaterLine(){return _s.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){B8(this.inbandTextTracks_,"com.apple.streaming",this.tech_),ZR({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,n,i){let s=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();B8(this.inbandTextTracks_,e,this.tech_),YR({inbandTextTracks:this.inbandTextTracks_,metadataArray:n,timestampOffset:s,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){let e=this.main();if(!e.contentSteering)return;for(let n of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(n));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){if(this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach((n)=>{this.contentSteeringController_.on(n,(i)=>{this.trigger(Ii({},i))})}),this.sourceType_==="dash")this.mainPlaylistLoader_.on("loadedplaylist",()=>{let n=this.main();if(this.contentSteeringController_.didDASHTagChange(n.uri,n.contentSteering)||(()=>{let a=this.contentSteeringController_.getAvailablePathways(),r=[];for(let l of n.playlists){let c=l.attributes.serviceLocation;if(c){if(r.push(c),!a.has(c))return!0}}if(!r.length&&a.size)return!0;return!1})())this.resetContentSteeringController_()})}excludeThenChangePathway_(){let e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();let i=this.main().playlists,s=new Set,a=!1;if(Object.keys(i).forEach((r)=>{let l=i[r],c=this.pathwayAttribute_(l),p=c&&e!==c;if(l.excludeUntil===1/0&&l.lastExcludeReason_==="content-steering"&&!p)delete l.excludeUntil,delete l.lastExcludeReason_,a=!0;let g=!l.excludeUntil&&l.excludeUntil!==1/0;if(!(!s.has(l.id)&&p&&g))return;s.add(l.id),l.excludeUntil=1/0,l.lastExcludeReason_="content-steering",this.logger_(`excluding ${l.id} for ${l.lastExcludeReason_}`)}),this.contentSteeringController_.manifestType_==="DASH")Object.keys(this.mediaTypes_).forEach((r)=>{let l=this.mediaTypes_[r];if(l.activePlaylistLoader){let c=l.activePlaylistLoader.media_;if(c&&c.attributes.serviceLocation!==e)a=!0}});if(a)this.changeSegmentPathway_()}handlePathwayClones_(){let n=this.main().playlists,i=this.contentSteeringController_.currentPathwayClones,s=this.contentSteeringController_.nextPathwayClones;if(!(i&&i.size||s&&s.size))return;for(let[r,l]of i.entries())if(!s.get(r))this.mainPlaylistLoader_.updateOrDeleteClone(l),this.contentSteeringController_.excludePathway(r);for(let[r,l]of s.entries()){let c=i.get(r);if(!c){n.filter((m)=>m.attributes["PATHWAY-ID"]===l["BASE-ID"]).forEach((m)=>{this.mainPlaylistLoader_.addClonePathway(l,m)}),this.contentSteeringController_.addAvailablePathway(r);continue}if(this.equalPathwayClones_(c,l))continue;this.mainPlaylistLoader_.updateOrDeleteClone(l,!0),this.contentSteeringController_.addAvailablePathway(r)}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...s])))}equalPathwayClones_(e,n){if(e["BASE-ID"]!==n["BASE-ID"]||e.ID!==n.ID||e["URI-REPLACEMENT"].HOST!==n["URI-REPLACEMENT"].HOST)return!1;let i=e["URI-REPLACEMENT"].PARAMS,s=n["URI-REPLACEMENT"].PARAMS;for(let a in i)if(i[a]!==s[a])return!1;for(let a in s)if(i[a]!==s[a])return!1;return!0}changeSegmentPathway_(){let e=this.selectPlaylist();if(this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH")this.switchMediaForDASHContentSteering_();this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0,n="non-usable";if(this.mainPlaylistLoader_.main.playlists.forEach((i)=>{let s=this.mainPlaylistLoader_.getKeyIdSet(i);if(!s||!s.size)return;s.forEach((a)=>{let l=this.keyStatusMap_.has(a)&&this.keyStatusMap_.get(a)==="usable",c=i.lastExcludeReason_===n&&i.excludeUntil===1/0;if(!l){if(i.excludeUntil!==1/0&&i.lastExcludeReason_!==n)i.excludeUntil=1/0,i.lastExcludeReason_=n,this.logger_(`excluding playlist ${i.id} because the key ID ${a} doesn't exist in the keyStatusMap or is not usable`);e++}else if(l&&c)delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${a} is usable`)})}),e>=this.mainPlaylistLoader_.main.playlists.length)this.mainPlaylistLoader_.main.playlists.forEach((i)=>{let s=i&&i.attributes&&i.attributes.RESOLUTION&&i.attributes.RESOLUTION.height<720,a=i.excludeUntil===1/0&&i.lastExcludeReason_===n;if(s&&a)delete i.excludeUntil,Ke.log.warn(`enabling non-HD playlist ${i.id} because all playlists were excluded due to ${n} key IDs`)})}addKeyStatus_(e,n){let a=(typeof e==="string"?e:gO(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${n}' with key ID ${a} added to the keyStatusMap`),this.keyStatusMap_.set(a,n)}updatePlaylistByKeyStatus(e,n){if(this.addKeyStatus_(e,n),!this.waitingForFastQualityPlaylistReceived_)this.excludeNonUsableThenChangePlaylist_();this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}var NO=(e,n,i)=>(s)=>{let a=e.main.playlists[n],r=i3(a),l=wb(a);if(typeof s>"u")return l;if(s)delete a.disabled;else a.disabled=!0;let c={renditionInfo:{id:n,bandwidth:a.attributes.BANDWIDTH,resolution:a.attributes.RESOLUTION,codecs:a.attributes.CODECS},cause:"fast-quality"};if(s!==l&&!r)if(s)i(a),e.trigger({type:"renditionenabled",metadata:c});else e.trigger({type:"renditiondisabled",metadata:c});return s};class i_{constructor(e,n,i){let{playlistController_:s}=e,a=s.fastQualityChange_.bind(s);if(n.attributes){let r=n.attributes.RESOLUTION;this.width=r&&r.width,this.height=r&&r.height,this.bandwidth=n.attributes.BANDWIDTH,this.frameRate=n.attributes["FRAME-RATE"]}this.codecs=wp(s.main(),n),this.playlist=n,this.id=i,this.enabled=NO(e.playlists,n.id,a)}}var PO=function(e){e.representations=()=>{let n=e.playlistController_.main(),i=jp(n)?e.playlistController_.getAudioTrackPlaylists_():n.playlists;if(!i)return[];return i.filter((s)=>!i3(s)).map((s,a)=>new i_(e,s,s.id))}},W8=["seeking","seeked","pause","playing","error"];class s_ extends Ke.EventTarget{constructor(e){super();this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=jr("PlaybackWatcher"),this.logger_("initialize");let n=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),a=()=>this.resetTimeUpdate_(),r=this.playlistController_,l=["main","subtitle","audio"],c={};l.forEach((m)=>{c[m]={reset:()=>this.resetSegmentDownloads_(m),updateend:()=>this.checkSegmentDownloads_(m)},r[`${m}SegmentLoader_`].on("appendsdone",c[m].updateend),r[`${m}SegmentLoader_`].on("playlistupdate",c[m].reset),this.tech_.on(["seeked","seeking"],c[m].reset)});let p=(m)=>{["main","audio"].forEach((g)=>{r[`${g}SegmentLoader_`][m]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{if(this.fixesBadSeeks_())this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),p("off")},this.clearSeekingAppendCheck_=()=>p("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),p("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",s),this.tech_.on(W8,a),this.tech_.on("canplay",i),this.tech_.one("play",n),this.dispose=()=>{if(this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",s),this.tech_.off(W8,a),this.tech_.off("canplay",i),this.tech_.off("play",n),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),l.forEach((m)=>{r[`${m}SegmentLoader_`].off("appendsdone",c[m].updateend),r[`${m}SegmentLoader_`].off("playlistupdate",c[m].reset),this.tech_.off(["seeked","seeking"],c[m].reset)}),this.checkCurrentTimeTimeout_)qe.default.clearTimeout(this.checkCurrentTimeTimeout_);this.resetTimeUpdate_()}}monitorCurrentTime_(){if(this.checkCurrentTime_(),this.checkCurrentTimeTimeout_)qe.default.clearTimeout(this.checkCurrentTimeTimeout_);this.checkCurrentTimeTimeout_=qe.default.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){let n=this.playlistController_[`${e}SegmentLoader_`];if(this[`${e}StalledDownloads_`]>0)this.logger_(`resetting possible stalled download count for ${e} loader`);this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=n.buffered_()}checkSegmentDownloads_(e){let n=this.playlistController_,i=n[`${e}SegmentLoader_`],s=i.buffered_(),a=IM(this[`${e}Buffered_`],s);if(this[`${e}Buffered_`]=s,a){let r={bufferedRanges:s};n.trigger({type:"bufferedrangeschanged",metadata:r}),this.resetSegmentDownloads_(e);return}if(this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:i.playlist_&&i.playlist_.id,buffered:rh(s)}),this[`${e}StalledDownloads_`]<10)return;if(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e==="subtitle")return;n.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0})}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;let e=this.tech_.currentTime(),n=this.tech_.buffered();if(this.lastRecordedTime===e&&(!n.length||e+qo>=n.end(n.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(xs([this.lastRecordedTime,e]));let i={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:i}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;let n=this.seekable(),i=this.tech_.currentTime(),s=this.afterSeekableWindow_(n,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow),a;if(s)a=n.end(n.length-1);if(this.beforeSeekableWindow_(n,i)){let j=n.start(0);a=j+(j===n.end(0)?0:qo)}if(typeof a<"u")return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${aS(n)}. Seeking to ${a}.`),this.tech_.setCurrentTime(a),!0;let r=this.playlistController_.sourceUpdater_,l=this.tech_.buffered(),c=r.audioBuffer?r.audioBuffered():null,p=r.videoBuffer?r.videoBuffered():null,m=this.media(),g=m.partTargetDuration?m.partTargetDuration:(m.targetDuration-Eo)*2,y=[c,p];for(let j=0;j<y.length;j++){if(!y[j])continue;if(t3(y[j],i)<g)return!1}let x=m1(l,i);if(x.length===0)return!1;return a=x.start(0)+qo,this.logger_(`Buffered region starts (${x.start(0)}) just beyond seek point (${i}). Seeking to ${a}.`),this.tech_.setCurrentTime(a),!0}waiting_(){if(this.techWaiting_())return;let e=this.tech_.currentTime(),n=this.tech_.buffered(),i=Xf(n,e);if(i.length&&e+3<=i.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${i.start(0)} -> ${i.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){let e=this.seekable(),n=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,n)){let l=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${n}. Seeking to live point (seekable end) ${l}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(l),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}let i=this.tech_.vhs.playlistController_.sourceUpdater_,s=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:n}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(n),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;let r=m1(s,n);if(r.length>0)return this.logger_(`Stopped at ${n} and seeking to ${r.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(n),!0;return!1}afterSeekableWindow_(e,n,i,s=!1){if(!e.length)return!1;let a=e.end(e.length-1)+qo,r=!i.endList,l=typeof i.partTargetDuration==="number";if(r&&(l||s))a=e.end(e.length-1)+i.targetDuration*3;if(n>a)return!0;return!1}beforeSeekableWindow_(e,n){if(e.length&&e.start(0)>0&&n<e.start(0)-this.liveRangeSafeTimeDelta)return!0;return!1}videoUnderflow_({videoBuffered:e,audioBuffered:n,currentTime:i}){if(!e)return;let s;if(e.length&&n.length){let a=Xf(e,i-3),r=Xf(e,i),l=Xf(n,i);if(l.length&&!r.length&&a.length)s={start:a.end(0),end:l.end(0)}}else if(!m1(e,i).length)s=this.gapFromVideoUnderflow_(e,i);if(s)return this.logger_(`Encountered a gap in video from ${s.start} to ${s.end}. Seeking to current time ${i}`),!0;return!1}skipTheGap_(e){let n=this.tech_.buffered(),i=this.tech_.currentTime(),s=m1(n,i);if(this.resetTimeUpdate_(),s.length===0||i!==e)return;this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",s.start(0)),this.tech_.setCurrentTime(s.start(0)+Eo);let a={gapInfo:{from:i,to:s.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:a}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,n){let i=EM(e);for(let s=0;s<i.length;s++){let a=i.start(s),r=i.end(s);if(n-a<4&&n-a>2)return{start:a,end:r}}return null}}var BO={errorInterval:30,getSource(e){let i=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return e(i)}},a_=function(e,n){let i=0,s=0,a=Jn(BO,n);e.ready(()=>{e.trigger({type:"usage",name:"vhs-error-reload-initialized"})});let r=function(){if(s)e.currentTime(s)},l=function(g){if(g===null||g===void 0)return;s=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",r),e.src(g),e.trigger({type:"usage",name:"vhs-error-reload"}),e.play()},c=function(){if(Date.now()-i<a.errorInterval*1000){e.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!a.getSource||typeof a.getSource!=="function"){Ke.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return i=Date.now(),a.getSource.call(e,l)},p=function(){e.off("loadedmetadata",r),e.off("error",c),e.off("dispose",p)},m=function(g){p(),a_(e,g)};e.on("error",c),e.on("dispose",p),e.reloadSourceOnError=m},LO=function(e){a_(this,e)},r_="3.17.5",HO="7.1.0",UO="1.4.0",zO="7.2.0",GO="4.0.2",Mi={PlaylistLoader:oh,Playlist:Ra,utils:sR,STANDARD_PLAYLIST_SELECTOR:P8,INITIAL_PLAYLIST_SELECTOR:VR,lastBandwidthSelector:P8,movingAverageBandwidthSelector:zR,comparePlaylistBandwidth:r3,comparePlaylistResolution:UR,xhr:TS()};Object.keys(_s).forEach((e)=>{Object.defineProperty(Mi,e,{get(){return Ke.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),_s[e]},set(n){if(Ke.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),typeof n!=="number"||n<0){Ke.log.warn(`value of Vhs.${e} must be greater than or equal to 0`);return}_s[e]=n}})});var o_="videojs-vhs",l_=function(e,n){let i=n.media(),s=-1;for(let a=0;a<e.length;a++)if(e[a].id===i.id){s=a;break}e.selectedIndex_=s,e.trigger({selectedIndex:s,type:"change"})},VO=function(e,n){n.representations().forEach((i)=>{e.addQualityLevel(i)}),l_(e,n.playlists)};Mi.canPlaySource=function(){return Ke.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};var XO=(e,n,i)=>{if(!e)return e;let s={};if(n&&n.attributes&&n.attributes.CODECS)s=kp(Kr(n.attributes.CODECS));if(i&&i.attributes&&i.attributes.CODECS)s.audio=i.attributes.CODECS;let a=eh(s.video),r=eh(s.audio),l={};for(let c in e){if(l[c]={},r)l[c].audioContentType=r;if(a)l[c].videoContentType=a;if(n.contentProtection&&n.contentProtection[c]&&n.contentProtection[c].pssh)l[c].pssh=n.contentProtection[c].pssh;if(typeof e[c]==="string")l[c].url=e[c]}return Jn(e,l)},WO=(e,n)=>e.reduce((i,s)=>{if(!s.contentProtection)return i;let a=n.reduce((r,l)=>{let c=s.contentProtection[l];if(c&&c.pssh)r[l]={pssh:c.pssh};return r},{});if(Object.keys(a).length)i.push(a);return i},[]),KO=({player:e,sourceKeySystems:n,audioMedia:i,mainPlaylists:s})=>{if(!e.eme.initializeMediaKeys)return Promise.resolve();let a=i?s.concat([i]):s,r=WO(a,Object.keys(n)),l=[],c=[];return r.forEach((p)=>{c.push(new Promise((m,g)=>{e.tech_.one("keysessioncreated",m)})),l.push(new Promise((m,g)=>{e.eme.initializeMediaKeys({keySystems:p},(y)=>{if(y){g(y);return}m()})}))}),Promise.race([Promise.all(l),Promise.race(c)])},$O=({player:e,sourceKeySystems:n,media:i,audioMedia:s})=>{let a=XO(n,i,s);if(!a)return!1;if(e.currentSource().keySystems=a,a&&!e.eme)return Ke.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1;return!0},c_=()=>{if(!qe.default.localStorage)return null;let e=qe.default.localStorage.getItem(o_);if(!e)return null;try{return JSON.parse(e)}catch(n){return null}},YO=(e)=>{if(!qe.default.localStorage)return!1;let n=c_();n=n?Jn(n,e):e;try{qe.default.localStorage.setItem(o_,JSON.stringify(n))}catch(i){return!1}return n},QO=(e)=>{if(e.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0)return JSON.parse(e.substring(e.indexOf(",")+1));return e},u_=(e,n)=>{if(!e._requestCallbackSet)e._requestCallbackSet=new Set;e._requestCallbackSet.add(n)};var h_=(e,n)=>{if(!e._responseCallbackSet)e._responseCallbackSet=new Set;e._responseCallbackSet.add(n)},f_=(e,n)=>{if(!e._requestCallbackSet)return;if(e._requestCallbackSet.delete(n),!e._requestCallbackSet.size)delete e._requestCallbackSet},d_=(e,n)=>{if(!e._responseCallbackSet)return;if(e._responseCallbackSet.delete(n),!e._responseCallbackSet.size)delete e._responseCallbackSet};Mi.supportsNativeHls=function(){if(!jt.default||!jt.default.createElement)return!1;let e=jt.default.createElement("video");if(!Ke.getTech("Html5").isSupported())return!1;return["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(i){return/maybe|probably/i.test(e.canPlayType(i))})}();Mi.supportsNativeDash=function(){if(!jt.default||!jt.default.createElement||!Ke.getTech("Html5").isSupported())return!1;return/maybe|probably/i.test(jt.default.createElement("video").canPlayType("application/dash+xml"))}();Mi.supportsTypeNatively=(e)=>{if(e==="hls")return Mi.supportsNativeHls;if(e==="dash")return Mi.supportsNativeDash;return!1};Mi.isSupported=function(){return Ke.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Mi.xhr.onRequest=function(e){u_(Mi.xhr,e)};Mi.xhr.onResponse=function(e){h_(Mi.xhr,e)};Mi.xhr.offRequest=function(e){f_(Mi.xhr,e)};Mi.xhr.offResponse=function(e){d_(Mi.xhr,e)};var JO=Ke.getComponent("Component");class c3 extends JO{constructor(e,n,i){super(n,i.vhs);if(typeof i.initialBandwidth==="number")this.options_.bandwidth=i.initialBandwidth;if(this.logger_=jr("VhsHandler"),n.options_&&n.options_.playerId){let s=Ke.getPlayer(n.options_.playerId);this.player_=s}if(this.tech_=n,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&n.overrideNativeAudioTracks&&n.overrideNativeVideoTracks)n.overrideNativeAudioTracks(!0),n.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(n.featuresNativeVideoTracks||n.featuresNativeAudioTracks))throw Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(jt.default,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(s)=>{let a=jt.default.fullscreenElement||jt.default.webkitFullscreenElement||jt.default.mozFullScreenElement||jt.default.msFullscreenElement;if(a&&a.contains(this.tech_.el()))this.playlistController_.fastQualityChange_();else this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){if(this.tech_.error()&&this.playlistController_)this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=Jn(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions===!1?!1:!0,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.usePlayerObjectFit=this.options_.usePlayerObjectFit||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=typeof this.options_.useNetworkInformationApi<"u"?this.options_.useNetworkInformationApi:!0,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls===!1?!1:!0,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!=="number")this.options_.playlistExclusionDuration=60;if(typeof this.options_.bandwidth!=="number"){if(this.options_.useBandwidthFromLocalStorage){let i=c_();if(i&&i.bandwidth)this.options_.bandwidth=i.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"});if(i&&i.throughput)this.options_.throughput=i.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"})}}if(typeof this.options_.bandwidth!=="number")this.options_.bandwidth=_s.INITIAL_BANDWIDTH;this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===_s.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","usePlayerObjectFit","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach((i)=>{if(typeof this.source_[i]<"u")this.options_[i]=this.source_[i]}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio,this.usePlayerObjectFit=this.options_.usePlayerObjectFit;let n=this.options_.customPixelRatio;if(typeof n==="number"&&n>=0)this.customPixelRatio=n}setOptions(e={}){this.setOptions_(e)}src(e,n){if(!e)return;this.setOptions_(),this.options_.src=QO(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Mi,this.options_.sourceType=Xw(n),this.options_.seekTo=(a)=>{this.tech_.setCurrentTime(a)},this.options_.player_=this.player_,this.playlistController_=new n_(this.options_);let i=Jn({liveRangeSafeTimeDelta:qo},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new s_(i),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{let a=Ke.players[this.tech_.options_.playerId],r=this.playlistController_.error;if(typeof r==="object"&&!r.code)r.code=3;else if(typeof r==="string")r={message:r,code:3};a.error(r)});let s=this.options_.bufferBasedABR?Mi.movingAverageBandwidthSelector(0.55):Mi.STANDARD_PLAYLIST_SELECTOR;if(this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):s.bind(this),this.playlistController_.selectInitialPlaylist=Mi.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(a){this.playlistController_.selectPlaylist=a.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(a){this.playlistController_.mainSegmentLoader_.throughput.rate=a,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let a=this.playlistController_.mainSegmentLoader_.bandwidth,r=qe.default.navigator.connection||qe.default.navigator.mozConnection||qe.default.navigator.webkitConnection,l=1e7;if(this.options_.useNetworkInformationApi&&r){let c=r.downlink*1000*1000;if(c>=l&&a>=l)a=Math.max(a,c);else a=c}return a},set(a){this.playlistController_.mainSegmentLoader_.bandwidth=a,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){let a=1/(this.bandwidth||1),r;if(this.throughput>0)r=1/this.throughput;else r=0;return Math.floor(1/(a+r))},set(){Ke.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth)this.bandwidth=this.options_.bandwidth;if(this.options_.throughput)this.throughput=this.options_.throughput;if(Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>rh(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>rh(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{if(this.options_.useBandwidthFromLocalStorage)YO({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{PO(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),!this.tech_.el())return;if(this.mediaSourceUrl_=qe.default.URL.createObjectURL(this.playlistController_.mediaSource),(Ke.browser.IS_ANY_SAFARI||Ke.browser.IS_IOS)&&this.options_.overrideNative&&this.options_.sourceType==="hls"&&typeof this.tech_.addSourceElement==="function")this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src);else this.tech_.src(this.mediaSourceUrl_)}createKeySessions_(){let e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),KO({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch((n)=>{this.logger_("error while creating EME key session",n),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){let e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,n=$O({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",(i)=>{this.playlistController_.updatePlaylistByKeyStatus(i.keyId,i.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!n){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){let e=Ke.players[this.tech_.options_.playerId];if(!e||!e.qualityLevels||this.qualityLevels_)return;this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{VO(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{l_(this.qualityLevels_,this.playlists)})}static version(){return{"@videojs/http-streaming":r_,"mux.js":HO,"mpd-parser":UO,"m3u8-parser":zO,"aes-decrypter":GO}}version(){return this.constructor.version()}canChangeType(){return o3.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){if(this.playbackWatcher_)this.playbackWatcher_.dispose();if(this.playlistController_)this.playlistController_.dispose();if(this.qualityLevels_)this.qualityLevels_.dispose();if(this.tech_&&this.tech_.vhs)delete this.tech_.vhs;if(this.mediaSourceUrl_&&qe.default.URL.revokeObjectURL)qe.default.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null;if(this.tech_)this.tech_.off("waitingforkey",this.handleWaitingForKey_);super.dispose()}convertToProgramTime(e,n){return hR({playlist:this.playlistController_.media(),time:e,callback:n})}seekToProgramTime(e,n,i=!0,s=2){return qS({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:n})}setupXhrHooks_(){this.xhr.onRequest=(e)=>{u_(this.xhr,e)},this.xhr.onResponse=(e)=>{h_(this.xhr,e)},this.xhr.offRequest=(e)=>{f_(this.xhr,e)},this.xhr.offResponse=(e)=>{d_(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){let e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],n=["gapjumped","playedrangeschanged"];e.forEach((i)=>{this.playlistController_.on(i,(s)=>{this.player_.trigger(Ii({},s))})}),n.forEach((i)=>{this.playbackWatcher_.on(i,(s)=>{this.player_.trigger(Ii({},s))})})}}var H1={name:"videojs-http-streaming",VERSION:r_,canHandleSource(e,n={}){let i=Jn(Ke.options,n);if(!i.vhs.experimentalUseMMS&&!Af("avc1.4d400d,mp4a.40.2",!1))return!1;return H1.canPlayType(e.type,i)},handleSource(e,n,i={}){let s=Jn(Ke.options,i);return n.vhs=new c3(e,n,s),n.vhs.xhr=TS(),n.vhs.setupXhrHooks_(),n.vhs.src(e.src,e.type),n.vhs},canPlayType(e,n){let i=Xw(e);if(!i)return"";let s=H1.getOverrideNative(n);return!Mi.supportsTypeNatively(i)||s?"maybe":""},getOverrideNative(e={}){let{vhs:n={}}=e,i=!(Ke.browser.IS_ANY_SAFARI||Ke.browser.IS_IOS),{overrideNative:s=i}=n;return s}},ZO=()=>Af("avc1.4d400d,mp4a.40.2",!0);if(ZO())Ke.getTech("Html5").registerSourceHandler(H1,0);Ke.VhsHandler=c3;Ke.VhsSourceHandler=H1;Ke.Vhs=Mi;if(!Ke.use)Ke.registerComponent("Vhs",Mi);Ke.options.vhs=Ke.options.vhs||{};if(!Ke.getPlugin||!Ke.getPlugin("reloadSourceOnError"))Ke.registerPlugin("reloadSourceOnError",LO);C();var eF=1000;function yb(e,n,i,s){let[a,r]=u(0),l=w(!1),c=w(!1),p=w(null),m=w(a);m.current=a,h(()=>{r(0);let y=e.current;if(!y)return;let x=()=>{c.current=!0},j=()=>{c.current=!1};return y.addEventListener("play",x),y.addEventListener("pause",j),c.current=!y.paused,()=>{y.removeEventListener("play",x),y.removeEventListener("pause",j)}},[e.current]),h(()=>{let y=e.current;if(!y)return;let x=null,j=null,I=!0,P=Date.now(),X=!1,Y=-1,J=()=>{P=Date.now(),X=!1,Y=-1},ne=()=>{if(!I)return;if(y.paused||y.ended)return;let he=y,we=!!he.requestVideoFrameCallback,Ce=cu(n),Ne=Date.now()-P,Pe=X&&Ne>Ce,Ue=!X&&Ne>eF;if(s||!we||Pe||Ue){let He=Math.floor(y.currentTime*n+0.45),De=Math.max(0,Math.min(He,i-1));r(De)}if(j=requestAnimationFrame(ne),he.requestVideoFrameCallback&&x===null)x=he.requestVideoFrameCallback((He,De)=>{x=null,P=Date.now(),X=!0,Y=De.mediaTime;let Fe=Math.floor(De.mediaTime*n+0.45),bt=Math.max(0,Math.min(Fe,i-1));r(bt)})},ae=()=>{J(),ne()},se=()=>{if(x!==null){let Ue=y;if(Ue.cancelVideoFrameCallback)try{Ue.cancelVideoFrameCallback(x)}catch{}x=null}if(j!==null)cancelAnimationFrame(j),j=null;let he=cu(n),Ce=X&&Y>=0&&Date.now()-P<=he?Y:y.currentTime,Ne=Math.floor(Ce*n+0.45),Pe=Math.max(0,Math.min(Ne,i-1));if(r(Pe),!y.ended){let Ue=lu(Pe,n);y.currentTime=Ue}},oe=()=>{r(i-1)};if(y.addEventListener("play",ae),y.addEventListener("pause",se),y.addEventListener("ended",oe),!y.paused)J(),ne();return()=>{if(I=!1,y.removeEventListener("play",ae),y.removeEventListener("pause",se),y.removeEventListener("ended",oe),x!==null){let he=y;if(he.cancelVideoFrameCallback)try{he.cancelVideoFrameCallback(x)}catch{}}if(j!==null)cancelAnimationFrame(j)}},[e.current,n,i]);let g=N(async(y)=>{let x=e.current;if(!x)return;let j=Math.round(y),I=Math.max(0,Math.min(j,i-1));if(l.current){p.current=I,r(I);return}l.current=!0,r(I);let P=async(X)=>{let Y=lu(X,n),J=!x.paused;if(x.currentTime=Y,await new Promise((oe)=>{let he=null,we=()=>{if(he)clearTimeout(he);x.removeEventListener("seeked",we),oe()};x.addEventListener("seeked",we),he=setTimeout(()=>{x.removeEventListener("seeked",we),oe()},500)}),!J&&!c.current)x.pause();let ne=Math.floor(x.currentTime*n+0.45),ae=Math.max(0,Math.min(ne,i-1));r(ae);let se=x;if(se.requestVideoFrameCallback)se.requestVideoFrameCallback((oe,he)=>{let we=Math.floor(he.mediaTime*n+0.45),Ce=Math.max(0,Math.min(we,i-1));r(Ce)});if(p.current!==null){let oe=p.current;p.current=null,await P(oe)}else l.current=!1};await P(I)},[e,n,i]);return h(()=>{let y=(x)=>{let j=x.target;if(j instanceof HTMLInputElement||j instanceof HTMLTextAreaElement||j.isContentEditable)return;if(x.key==="ArrowRight"){x.preventDefault();let I=x.shiftKey?10:1;g(m.current+I)}else if(x.key==="ArrowLeft"){x.preventDefault();let I=x.shiftKey?10:1;g(m.current-I)}};return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y)}},[g]),h(()=>{let y=e.current;if(!y)return;let x=()=>{if(!l.current){let j=Math.floor(y.currentTime*n+0.45),I=Math.max(0,Math.min(j,i-1));r(I);let P=lu(I,n),X=1/n;if(Math.abs(y.currentTime-P)>X/4)y.currentTime=P}};return y.addEventListener("seeked",x),()=>{y.removeEventListener("seeked",x)}},[e.current,n,i]),{currentFrame:a,setCurrentFrame:r,seekToFrame:g,isSeeking:l}}C();var tF=(e)=>{if(isNaN(e))return"00:00";let n=new Date(e*1000),i=n.getUTCHours(),s=n.getUTCMinutes(),a=n.getUTCSeconds().toString().padStart(2,"0");if(i)return`${i}:${s.toString().padStart(2,"0")}:${a}`;return`${s}:${a}`},nF=({totalFrames:e,currentFrame:n,fps:i,previewUrl:s,onSeek:a,buffered:r=0,metadata:l})=>{let c=w(null),p=w(null),[m,g]=u(null),[y,x]=u(!1),[j,I]=u(!1),P=w(a);h(()=>{P.current=a},[a]),h(()=>{if(p.current&&s)p.current.load()},[s]);let X=N((Ne)=>{if(!c.current)return 0;let Pe=c.current.getBoundingClientRect();return Math.max(0,Math.min(Ne-Pe.left,Pe.width))/Pe.width},[]),Y=N((Ne)=>{if(j)return;if(!c.current)return;let Pe=c.current.getBoundingClientRect(),ze=Math.max(0,Math.min(Ne.clientX-Pe.left,Pe.width))/Pe.width;if(g(ze),x(!0),p.current&&e){let He=ze*e,De=1/i,Fe=He*De+De/2,bt=p.current;if(Number.isFinite(Fe))bt.currentTime=Fe}},[e,i,j]),J=()=>{if(!j)x(!1),g(null)},ne=(Ne)=>{if(Ne.button!==0)return;Ne.preventDefault(),I(!0);let Pe=X(Ne.clientX);g(Pe),x(!0),P.current(Pe*e)},ae=(Ne)=>{I(!0);let Pe=X(Ne.touches[0].clientX);g(Pe),x(!0),P.current(Pe*e)};h(()=>{if(!j)return;let Ne=(He)=>{let De=X(He.clientX);if(g(De),x(!0),p.current&&e){let Fe=De*e,bt=1/i,Ve=Fe*bt+bt/2,$e=p.current;if(Number.isFinite(Ve))$e.currentTime=Ve}P.current(De*e)},Pe=(He)=>{I(!1);let De=!1;if(c.current){let bt=c.current.getBoundingClientRect();De=He.clientX>=bt.left&&He.clientX<=bt.right&&He.clientY>=bt.top&&He.clientY<=bt.bottom}if(!De)x(!1),g(null);let Fe=X(He.clientX);P.current(Fe*e)},Ue=(He)=>{if(He.touches.length===0)return;let De=X(He.touches[0].clientX);if(g(De),x(!0),p.current&&e){let Fe=De*e,bt=1/i,Ve=Fe*bt+bt/2,$e=p.current;if(Number.isFinite(Ve))$e.currentTime=Ve}P.current(De*e)},ze=(He)=>{I(!1);let De=He.changedTouches.length>0?He.changedTouches[0].clientX:null,Fe=He.changedTouches.length>0?He.changedTouches[0].clientY:null,bt=!1;if(De!==null&&Fe!==null&&c.current){let Ve=c.current.getBoundingClientRect();bt=De>=Ve.left&&De<=Ve.right&&Fe>=Ve.top&&Fe<=Ve.bottom}if(!bt)x(!1),g(null);if(De!==null){let Ve=X(De);P.current(Ve*e)}};return window.addEventListener("mousemove",Ne),window.addEventListener("mouseup",Pe),window.addEventListener("touchmove",Ue,{passive:!0}),window.addEventListener("touchend",ze),()=>{window.removeEventListener("mousemove",Ne),window.removeEventListener("mouseup",Pe),window.removeEventListener("touchmove",Ue),window.removeEventListener("touchend",ze)}},[j,e,i,X]);let se=j&&m!==null?m*100:e>0?n/e*100:0,oe=m!==null?m*100:0,he=()=>{if(m===null)return{};return{left:`${oe}%`,transform:`translateX(-${oe}%)`}},we=180,Ce={width:`${we}px`,height:"auto"};if(l&&l.originalWidth&&l.originalHeight){let{originalWidth:Ne,originalHeight:Pe}=l;if(Ne>=Pe){let Ue=we*Pe/Ne;Ce={width:`${we}px`,height:`${Ue}px`}}else Ce={width:`${we*Ne/Pe}px`,height:`${we}px`}}return o("div",{ref:c,className:"group relative h-1.5 w-full cursor-pointer touch-none rounded-full bg-muted transition-colors duration-200",onMouseMove:Y,onMouseLeave:J,onMouseDown:ne,onTouchStart:ae,"data-testid":"seekbar",children:[t("video",{ref:p,src:s,className:"hidden",preload:"auto",muted:!0,playsInline:!0}),y&&e>0&&t("div",{className:"pointer-events-none absolute bottom-full z-50 mb-3 flex w-max flex-col",style:he(),children:o("div",{className:"relative overflow-hidden rounded-lg border-2 border-border bg-popover shadow-2xl",children:[t("video",{src:s,className:"bg-black object-cover",style:Ce,muted:!0,ref:(Ne)=>{if(Ne&&p.current)Ne.currentTime=p.current.currentTime}}),t("div",{className:"absolute bottom-0 w-full bg-popover/80 py-0.5 text-center text-xs font-medium text-popover-foreground",children:tF(m*e/i)})]})}),t("div",{className:"absolute top-0 left-0 h-full rounded-full bg-muted-foreground/30 transition-all duration-200",style:{width:`${r}%`}}),y&&t("div",{className:"absolute top-0 left-0 h-full rounded-full bg-primary/30",style:{width:`${oe}%`}}),t("div",{className:"relative absolute top-0 left-0 h-full rounded-full bg-primary",style:{width:`${se}%`},"data-testid":"seekbar-fill",children:t("div",{className:E("absolute top-1/2 right-0 h-3.5 w-3.5 -translate-y-1/2 translate-x-1/2 rounded-full border border-border bg-primary shadow-md transition-transform duration-100",y||j?"scale-100":"scale-0 group-hover:scale-100")})})]})},vb=nF;var ru=({state:e,zoom:n,isControlsVisible:i,buffered:s,data:a,resolutions:r,togglePlay:l,toggleLoop:c,toggleMute:p,handleVolumeChange:m,changePlaybackRate:g,changeResolution:y,handleDownload:x,toggleFullScreen:j,onZoomChange:I,onZoomReset:P,frameRate:X,totalFrames:Y,currentFrame:J,seekToFrame:ne,floatOverlayInFullScreen:ae=!0,onMouseEnter:se,onMouseLeave:oe,allowDownload:he=!0})=>{let{videoTimeDisplayMode:we,setVideoTimeDisplayMode:Ce}=Qt();if(!a.media?.metadata)return null;let Ne=e.isFullScreen&&ae,Pe=a.proxyType==="audio",Ue=a.media?.metadata?.startTimecode,ze=Math.max(0,Y-1),He=we==="frames"?`${J} / ${ze} fr`:we==="standard"?`${In(J,X,"standard")} / ${Sa(Y/X)}`:`${In(J,X,we,Ue)} / ${In(ze,X,we,Ue)}`;return o("div",{className:E("transition-all duration-300 ease-in-out z-20 text-foreground",Ne?"absolute bottom-0 left-0 right-0 px-4 py-4 bg-card/90 backdrop-blur-md border-t border-border":"relative w-full bg-card border-t border-border px-4 py-3 z-10 transition-colors duration-200",i?"opacity-100 translate-y-0":"opacity-0 translate-y-4 pointer-events-none"),onMouseEnter:se,onMouseLeave:oe,children:[t("div",{className:"mb-4 px-1",children:t(vb,{totalFrames:Y,currentFrame:J,fps:X,buffered:s,previewUrl:a.media.videoPreview?.url,onSeek:ne,metadata:{...a.media.metadata,frameRate:X}})}),o("div",{className:"flex items-center justify-between text-foreground",children:[o("div",{className:"flex items-center gap-4",children:[t("button",{onClick:l,className:"hover:text-primary transition-colors","data-testid":"play-toggle","data-playing":e.isPlaying,"aria-label":e.isPlaying?"Pause":"Play",children:e.isPlaying?t(Ug,{className:"w-6 h-6 fill-current"}):t(Ec,{className:"w-6 h-6 fill-current"})}),t("button",{onClick:c,className:E("transition-colors",e.isLooping?"text-primary":"text-muted-foreground"),title:"Loop",children:t(zg,{className:"w-5 h-5"})}),o("div",{className:"flex items-center gap-3 group/vol",children:[t("button",{onClick:p,className:"hover:text-primary",children:e.isMuted||e.volume===0?t(Vg,{className:"w-6 h-6"}):t(Gg,{className:"w-6 h-6"})}),t("div",{className:"w-0 overflow-hidden group-hover/vol:w-24 transition-all duration-300 ease-in-out",children:t("div",{className:"w-24 px-1",children:t(Bs,{value:e.isMuted?[0]:[e.volume],onValueChange:(De)=>m(De[0]),max:1,step:0.05})})})]}),o("div",{className:"flex items-center gap-1 text-sm font-medium tabular-nums select-none min-w-[100px]",children:[t("span",{className:"text-muted-foreground font-mono","data-testid":"time-readout",children:He}),o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:t("button",{className:"h-6 w-6 inline-flex items-center justify-center rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer focus:outline-none",children:t(be,{className:"h-3.5 w-3.5"})})}),o(ye,{align:"start",className:"w-40 z-30",children:[t(Qr,{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-wider",children:"Format"}),o(W,{onClick:()=>Ce("standard"),className:"flex items-center justify-between cursor-pointer text-xs",children:[t("span",{children:"Standard Time"}),we==="standard"&&t(Me,{className:"h-3.5 w-3.5 text-primary"})]}),o(W,{onClick:()=>Ce("frames"),className:"flex items-center justify-between cursor-pointer text-xs",children:[t("span",{children:"Frames"}),we==="frames"&&t(Me,{className:"h-3.5 w-3.5 text-primary"})]}),o(W,{onClick:()=>Ce("timecode"),className:"flex items-center justify-between cursor-pointer text-xs",children:[t("span",{children:"Timecode"}),we==="timecode"&&t(Me,{className:"h-3.5 w-3.5 text-primary"})]})]})]})]})]}),o("div",{className:"relative flex items-center gap-3",children:[!Pe&&o("div",{className:"flex items-center gap-1",children:[o("div",{className:"flex items-center gap-1 rounded-md bg-muted p-0.5",children:[t("button",{onClick:()=>I(n*0.8),className:"p-1 hover:text-primary rounded",title:Lp(),children:t(xa,{size:14})}),o("span",{className:"text-xs w-8 text-center tabular-nums",children:[Math.round(n*100),"%"]}),t("button",{onClick:()=>I(n*1.2),className:"p-1 hover:text-primary rounded",title:Dp(),children:t(fe,{size:14})})]}),t("button",{onClick:P,className:"text-xs font-medium px-2 py-1 rounded bg-muted hover:text-primary transition-colors",children:Pf()})]}),o(ge,{children:[t(Ae,{asChild:!0,children:o("button",{className:"w-8 text-sm font-bold hover:text-primary",children:[e.playbackRate,"x"]})}),t(ye,{children:[0.5,1,1.5,2].map((De)=>o(W,{onClick:()=>g(De),className:E("rounded py-1 px-2 text-left text-xs",e.playbackRate===De?"bg-primary text-primary-foreground focus:bg-primary focus:text-primary-foreground":"text-foreground"),children:[De,"x"]},De))})]}),!Pe&&r.length>0&&o(ge,{children:[t(Ae,{asChild:!0,children:o("button",{className:"flex items-center gap-1 rounded border border-border px-2 py-0.5 text-sm font-semibold hover:bg-muted transition-colors",children:[t(Zs,{className:"h-3.5 w-3.5"}),t("span",{children:e.currentResolution==="Original"?bl():e.currentResolution})]})}),o(ye,{children:[t(Qr,{children:ag()}),r.map((De)=>o(W,{onClick:()=>y(De),className:E("flex w-full items-center justify-between",e.currentResolution===De.resolution?"text-primary font-medium":"text-foreground"),children:[t("span",{children:De.resolution==="Original"?bl():De.resolution}),o("span",{className:"pl-5 text-xs text-muted-foreground",children:[De.width,"x",De.height]})]},De.resolution))]})]}),he&&(Pe?t("button",{onClick:()=>x(a.media?.original?.key||""),className:"transition-colors hover:text-primary",title:gr(),disabled:!a.media?.original?.key,children:t(vt,{className:"h-5 w-5"})}):o(ge,{children:[t(Ae,{asChild:!0,children:t("button",{className:"transition-colors hover:text-primary",title:gr(),children:t(vt,{className:"h-5 w-5"})})}),o(ye,{children:[t(Qr,{children:gr()}),r.map((De)=>o(W,{onClick:()=>x(De.key??""),className:"flex w-full items-center justify-between px-3 py-2 text-left text-sm text-foreground",children:[t("span",{children:De.resolution}),t("span",{className:"text-xs text-muted-foreground",children:"MP4"})]},De.resolution)),a.media?.original?.key&&o(B,{children:[t(Gt,{}),o(W,{onClick:()=>x(a.media?.original?.key??""),className:"flex w-full items-center justify-between px-3 py-2 text-left text-sm text-foreground",children:[t("span",{children:bl()}),t("span",{className:"text-xs text-muted-foreground",children:a.name?.split(".").pop()?.toUpperCase()||"RAW"})]})]})]})]})),t("button",{onClick:j,className:"transition-colors hover:text-primary",title:dd(),children:e.isFullScreen?t(_a,{className:"h-6 w-6"}):t(ya,{className:"h-6 w-6"})})]})]})]})};var p_=({state:e,isControlsVisible:n,buffered:i,data:s,resolutions:a,togglePlay:r,toggleLoop:l,toggleMute:c,changePlaybackRate:p,changeResolution:m,toggleFullScreen:g,frameRate:y,totalFrames:x,currentFrame:j,seekToFrame:I,floatOverlayInFullScreen:P=!0,onMouseEnter:X,onMouseLeave:Y})=>{let{videoTimeDisplayMode:J,setVideoTimeDisplayMode:ne}=Qt();if(!s.media?.metadata)return null;let ae=e.isFullScreen&&P,se=s.proxyType==="audio",oe=s.media?.metadata?.startTimecode,he=Math.max(0,x-1),we=J==="frames"?`${j} / ${he} fr`:J==="standard"?`${In(j,y,"standard")} / ${Sa(x/y)}`:`${In(j,y,J,oe)} / ${In(he,y,J,oe)}`;return o("div",{className:E("transition-all duration-300 ease-in-out z-20 text-foreground",ae?"absolute bottom-0 left-0 right-0 px-3 py-3 bg-card/90 backdrop-blur-md border-t border-border":"relative w-full bg-card border-t border-border px-3 py-2.5 z-10 transition-colors duration-200",n?"opacity-100 translate-y-0":"opacity-0 translate-y-4 pointer-events-none"),onMouseEnter:X,onMouseLeave:Y,children:[t("div",{className:"mb-2 px-0.5",children:t(vb,{totalFrames:x,currentFrame:j,fps:y,buffered:i,previewUrl:s.media.videoPreview?.url,onSeek:I,metadata:{...s.media.metadata,frameRate:y}})}),o("div",{className:"flex items-center justify-between text-foreground gap-1 select-none",children:[o("div",{className:"flex items-center gap-2 min-w-0",children:[t("button",{onClick:r,className:"p-1 hover:text-primary transition-colors cursor-pointer shrink-0","data-testid":"play-toggle","data-playing":e.isPlaying,"aria-label":e.isPlaying?"Pause":"Play",children:e.isPlaying?t(Ug,{className:"w-5 h-5 fill-current"}):t(Ec,{className:"w-5 h-5 fill-current"})}),t("button",{onClick:c,className:"p-1 hover:text-primary transition-colors cursor-pointer shrink-0","aria-label":e.isMuted?"Unmute":"Mute",children:e.isMuted||e.volume===0?t(Vg,{className:"w-5 h-5"}):t(Gg,{className:"w-5 h-5"})}),o("div",{className:"flex items-center gap-0.5 text-xs font-medium tabular-nums min-w-0",children:[t("span",{className:"text-muted-foreground font-mono truncate text-[11px] sm:text-xs","data-testid":"time-readout",children:we}),o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:t("button",{className:"h-5 w-5 inline-flex items-center justify-center rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer focus:outline-none shrink-0","aria-label":s0(),children:t(be,{className:"h-3 w-3"})})}),o(ye,{align:"start",className:"w-40 z-30",children:[t(Qr,{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-wider",children:Hb()}),o(W,{onClick:()=>ne("standard"),className:"flex items-center justify-between cursor-pointer text-xs",children:[t("span",{children:ME()}),J==="standard"&&t(Me,{className:"h-3.5 w-3.5 text-primary"})]}),o(W,{onClick:()=>ne("frames"),className:"flex items-center justify-between cursor-pointer text-xs",children:[t("span",{children:$b()}),J==="frames"&&t(Me,{className:"h-3.5 w-3.5 text-primary"})]}),o(W,{onClick:()=>ne("timecode"),className:"flex items-center justify-between cursor-pointer text-xs",children:[t("span",{children:hI()}),J==="timecode"&&t(Me,{className:"h-3.5 w-3.5 text-primary"})]})]})]})]})]}),o("div",{className:"flex items-center gap-1 shrink-0",children:[o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:o("button",{className:"flex items-center gap-1 rounded border border-border px-1.5 py-1 text-xs font-semibold hover:bg-muted transition-colors cursor-pointer",title:yp(),"aria-label":yp(),children:[t(Zs,{className:"h-3.5 w-3.5"}),t("span",{className:"text-[11px]",children:!se&&e.currentResolution?e.currentResolution:`${e.playbackRate}x`})]})}),o(ye,{align:"end",className:"w-48 z-30",children:[!se&&a.length>0&&o(B,{children:[t(Qr,{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-wider",children:ag()}),a.map((Ce)=>o(W,{onClick:()=>m(Ce),className:E("flex w-full items-center justify-between text-xs cursor-pointer",e.currentResolution===Ce.resolution?"text-primary font-medium":"text-foreground"),children:[t("span",{children:Ce.resolution==="Original"?bl():Ce.resolution}),o("span",{className:"text-[10px] text-muted-foreground",children:[Ce.width,"x",Ce.height]})]},Ce.resolution)),t(Gt,{})]}),t(Qr,{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-wider",children:uS()}),[0.5,1,1.5,2].map((Ce)=>o(W,{onClick:()=>p(Ce),className:E("flex items-center justify-between text-xs cursor-pointer",e.playbackRate===Ce?"text-primary font-medium":"text-foreground"),children:[o("span",{children:[Ce,"x"]}),e.playbackRate===Ce&&t(Me,{className:"h-3.5 w-3.5 text-primary"})]},Ce)),t(Gt,{}),o(W,{onClick:l,className:"flex items-center justify-between text-xs cursor-pointer",children:[o("span",{className:"flex items-center gap-1.5",children:[t(zg,{className:"h-3.5 w-3.5"}),t("span",{children:Lw()})]}),e.isLooping&&t(Me,{className:"h-3.5 w-3.5 text-primary"})]})]})]}),t("button",{onClick:g,className:"p-1 hover:text-primary transition-colors cursor-pointer shrink-0",title:dd(),"aria-label":dd(),children:e.isFullScreen?t(_a,{className:"h-5 w-5"}):t(ya,{className:"h-5 w-5"})})]})]})]})};var iF=Math.PI/180;function sF(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}var Gc=typeof global<"u"?global:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},Tt={_global:Gc,version:"10.3.2",isBrowser:sF(),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle(e){return Tt.angleDeg?e*iF:e},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_renderBackend:"web",legacyTextRendering:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return Tt.DD.isDragging},isTransforming(){var e,n;return(n=(e=Tt.Transformer)===null||e===void 0?void 0:e.isTransforming())!==null&&n!==void 0?n:!1},isDragReady(){return!!Tt.DD.node},releaseCanvasOnDestroy:!0,document:Gc.document,_injectGlobal(e){if(typeof Gc.Konva<"u")console.error("Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment.");Gc.Konva=e}},mn=(e)=>{Tt[e.prototype.getClassName()]=e};Tt._injectGlobal(Tt);var aF=`Konva.js unsupported environment.
|
|
224
|
+
|
|
225
|
+
Looks like you are trying to use Konva.js in Node.js environment. because "document" object is undefined.
|
|
226
|
+
|
|
227
|
+
To use Konva.js in Node.js environment, you need to use the "canvas-backend" or "skia-backend" module.
|
|
228
|
+
|
|
229
|
+
bash: npm install canvas
|
|
230
|
+
js: import "konva/canvas-backend";
|
|
231
|
+
|
|
232
|
+
or
|
|
233
|
+
|
|
234
|
+
bash: npm install skia-canvas
|
|
235
|
+
js: import "konva/skia-backend";
|
|
236
|
+
`,m_=()=>{if(typeof document>"u")throw Error(aF)};class Ps{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new Ps(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){let n=this.m;return{x:n[0]*e.x+n[2]*e.y+n[4],y:n[1]*e.x+n[3]*e.y+n[5]}}translate(e,n){return this.m[4]+=this.m[0]*e+this.m[2]*n,this.m[5]+=this.m[1]*e+this.m[3]*n,this}scale(e,n){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=n,this.m[3]*=n,this}rotate(e){let n=Math.cos(e),i=Math.sin(e),s=this.m[0]*n+this.m[2]*i,a=this.m[1]*n+this.m[3]*i,r=this.m[0]*-i+this.m[2]*n,l=this.m[1]*-i+this.m[3]*n;return this.m[0]=s,this.m[1]=a,this.m[2]=r,this.m[3]=l,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,n){let i=this.m[0]+this.m[2]*n,s=this.m[1]+this.m[3]*n,a=this.m[2]+this.m[0]*e,r=this.m[3]+this.m[1]*e;return this.m[0]=i,this.m[1]=s,this.m[2]=a,this.m[3]=r,this}multiply(e){let n=this.m[0]*e.m[0]+this.m[2]*e.m[1],i=this.m[1]*e.m[0]+this.m[3]*e.m[1],s=this.m[0]*e.m[2]+this.m[2]*e.m[3],a=this.m[1]*e.m[2]+this.m[3]*e.m[3],r=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],l=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=n,this.m[1]=i,this.m[2]=s,this.m[3]=a,this.m[4]=r,this.m[5]=l,this}invert(){let e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),n=this.m[3]*e,i=-this.m[1]*e,s=-this.m[2]*e,a=this.m[0]*e,r=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),l=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=n,this.m[1]=i,this.m[2]=s,this.m[3]=a,this.m[4]=r,this.m[5]=l,this}getMatrix(){return this.m}decompose(){let e=this.m[0],n=this.m[1],i=this.m[2],s=this.m[3],a=this.m[4],r=this.m[5],l=e*s-n*i,c={x:a,y:r,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!=0||n!=0){let p=Math.sqrt(e*e+n*n);c.rotation=n>0?Math.acos(e/p):-Math.acos(e/p),c.scaleX=p,c.scaleY=l/p,c.skewX=(e*i+n*s)/l,c.skewY=0}else if(i!=0||s!=0){let p=Math.sqrt(i*i+s*s);c.rotation=Math.PI/2-(s>0?Math.acos(-i/p):-Math.acos(i/p)),c.scaleX=l/p,c.scaleY=p,c.skewX=0,c.skewY=(e*i+n*s)/l}return c.rotation=Be._getRotation(c.rotation),c}}var rF="[object Array]",oF="[object Number]",lF="[object String]",cF="[object Boolean]",uF=Math.PI/180,v_=180/Math.PI,Sb="#",hF="",fF="0",dF="Konva warning: ",g_="Konva error: ",pF={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Ep=null,mF=typeof window<"u"?window:{},u3=new WeakMap,gF=(e,n)=>{if(typeof e.requestAnimationFrame==="function")e.requestAnimationFrame(n);else if(typeof requestAnimationFrame<"u")requestAnimationFrame(n);else setTimeout(n,16)},b_=new Map,w_=(e)=>{let n=e.trim();return n.indexOf(",")===-1?n.split(/\s*\/\s*|\s+/):n.split(/\s*,\s*/)},S_="[+-]?(?:\\d+\\.?\\d*|\\.\\d+)(?:e[+-]?\\d+)?",bF=new RegExp(`^(${S_})(%?)$`,"i"),mh=(e,n)=>{let i=bF.exec(e);if(!i)return NaN;return i[2]?Number(i[1])/100*n:Number(i[1])},_b=/^#[0-9a-f]+$/i,y_=(e)=>Math.min(Math.max(e,0),1),wF=new RegExp(`^(${S_})(deg|grad|rad|turn)?$`,"i"),yF={deg:1,grad:0.9,rad:v_,turn:360},Be={_isElement(e){return!!(e&&e.nodeType==1)},_isFunction(e){return!!(e&&e.constructor&&e.call&&e.apply)},_isPlainObject(e){return!!e&&e.constructor===Object},_isArray(e){return Object.prototype.toString.call(e)===rF},_isNumber(e){return Object.prototype.toString.call(e)===oF&&!isNaN(e)&&isFinite(e)},_isString(e){return Object.prototype.toString.call(e)===lF},_isBoolean(e){return Object.prototype.toString.call(e)===cF},isObject(e){return e instanceof Object},isValidSelector(e){if(typeof e!=="string")return!1;let n=e[0];return n==="#"||n==="."||n===n.toUpperCase()},_sign(e){if(e===0)return 1;if(e>0)return 1;else return-1},requestAnimFrame(e,n){let i=n&&!n.closed&&n||mF,s=u3.get(i);if(!s)s=[],u3.set(i,s),gF(i,function(){u3.delete(i),s.forEach(function(a){a()})});s.push(e)},createCanvasElement(){m_();let e=document.createElement("canvas");try{e.style=e.style||{}}catch(n){}return e},createImageElement(){return m_(),document.createElement("img")},_isInDocument(e){return!!e.isConnected},_urlToImage(e,n){let i=Be.createImageElement();i.onload=function(){n(i)},i.src=e},_rgbToHex(e,n,i){return(16777216+(e<<16)+(n<<8)+i).toString(16).slice(1)},_hexToRgb(e){e=e.replace(Sb,hF);let n=parseInt(e,16);return{r:n>>16&255,g:n>>8&255,b:n&255}},getRandomColor(){let e=(Math.random()*16777215<<0).toString(16);while(e.length<6)e=fF+e;return Sb+e},isCanvasFarblingActive(){if(Ep!==null)return Ep;if(typeof document>"u")return Ep=!1,!1;let e=this.createCanvasElement();e.width=10,e.height=10;let n=e.getContext("2d",{willReadFrequently:!0});n.clearRect(0,0,10,10),n.fillStyle="#282828",n.fillRect(0,0,10,10);let i=n.getImageData(0,0,10,10).data,s=!1;for(let a=0;a<100;a++)if(i[a*4]!==40||i[a*4+1]!==40||i[a*4+2]!==40||i[a*4+3]!==255){s=!0;break}return Ep=s,this.releaseCanvas(e),Ep},getHitColor(){let e=this.getRandomColor();return this.isCanvasFarblingActive()?this.getSnappedHexColor(e):e},getHitColorKey(e,n,i){if(this.isCanvasFarblingActive())e=Math.round(e/5)*5,n=Math.round(n/5)*5,i=Math.round(i/5)*5;return Sb+this._rgbToHex(e,n,i)},getSnappedHexColor(e){let n=this._hexToRgb(e);return Sb+this._rgbToHex(Math.round(n.r/5)*5,Math.round(n.g/5)*5,Math.round(n.b/5)*5)},getRGB(e){var n;let{r:i=0,g:s=0,b:a=0}=(n=Be.colorToRGBA(e))!==null&&n!==void 0?n:{};return{r:i,g:s,b:a}},colorToRGBA(e){e=(e||"").trim()||"black";let n=Be._namedColorToRBA(e)||Be._hex3ColorToRGBA(e)||Be._hex4ColorToRGBA(e)||Be._hex6ColorToRGBA(e)||Be._hex8ColorToRGBA(e)||Be._rgbColorToRGBA(e)||Be._hslColorToRGBA(e);if(n&&[n.r,n.g,n.b,n.a].every(Be._isNumber))return n},_namedColorToRBA(e){let n=pF[e.toLowerCase()];if(!n)return null;return{r:n[0],g:n[1],b:n[2],a:n.length>3?n[3]:1}},_rgbColorToRGBA(e){let n=/^rgba?\(([^)]*)\)$/i.exec(e);if(!n)return;let i=w_(n[1]);if(i.length<3||i.length>4)return;return{r:mh(i[0],255),g:mh(i[1],255),b:mh(i[2],255),a:i.length>3?mh(i[3],1):1}},_hex8ColorToRGBA(e){if(e.length===9&&_b.test(e))return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:parseInt(e.slice(7,9),16)/255}},_hex6ColorToRGBA(e){if(e.length===7&&_b.test(e))return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex4ColorToRGBA(e){if(e.length===5&&_b.test(e))return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:parseInt(e[4]+e[4],16)/255}},_hex3ColorToRGBA(e){if(e.length===4&&_b.test(e))return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){let n=/^hsla?\(([^)]*)\)$/i.exec(e);if(!n)return;let i=w_(n[1]);if(i.length<3||i.length>4)return;let s=wF.exec(i[0]);if(!s)return;let a=s[2],r=Number(s[1])*(a?yF[a.toLowerCase()]:1);if(!isFinite(r))return;let l=(r%360+360)%360/360,c=y_(mh(i[1],100)/100),p=y_(mh(i[2],100)/100),m=i.length>3?mh(i[3],1):1,g=p<0.5?p*(1+c):p+c-p*c,y=2*p-g,x=[0,0,0];for(let j=0;j<3;j++){let I=l+0.3333333333333333*-(j-1);if(I<0)I++;if(I>1)I--;let P;if(6*I<1)P=y+(g-y)*6*I;else if(2*I<1)P=g;else if(3*I<2)P=y+(g-y)*(0.6666666666666666-I)*6;else P=y;x[j]=P*255}return{r:Math.round(x[0]),g:Math.round(x[1]),b:Math.round(x[2]),a:m}},haveIntersection(e,n){return!(n.x>e.x+e.width||n.x+n.width<e.x||n.y>e.y+e.height||n.y+n.height<e.y)},cloneObject(e){let n={};for(let i in e)if(this._isPlainObject(e[i]))n[i]=this.cloneObject(e[i]);else if(this._isArray(e[i]))n[i]=this.cloneArray(e[i]);else n[i]=e[i];return n},cloneArray(e){return e.slice(0)},degToRad(e){return e*uF},radToDeg(e){return e*v_},_degToRad(e){return Be.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),Be.degToRad(e)},_radToDeg(e){return Be.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),Be.radToDeg(e)},_getRotation(e){return Tt.angleDeg?Be.radToDeg(e):e},_capitalize(e){let n=b_.get(e);if(n!==void 0)return n;let i=e.charAt(0).toUpperCase()+e.slice(1);return b_.set(e,i),i},throw(e){throw Error(g_+e)},error(e){console.error(g_+e)},warn(e){if(!Tt.showWarnings)return;console.warn(dF+e)},each(e,n){for(let i in e)n(i,e[i])},_inRange(e,n,i){return n<=e&&e<i},_getProjectionToSegment(e,n,i,s,a,r){let l,c,p,m=(e-i)*(e-i)+(n-s)*(n-s);if(m==0)l=e,c=n,p=(a-i)*(a-i)+(r-s)*(r-s);else{let g=((a-e)*(i-e)+(r-n)*(s-n))/m;if(g<0)l=e,c=n,p=(e-a)*(e-a)+(n-r)*(n-r);else if(g>1)l=i,c=s,p=(i-a)*(i-a)+(s-r)*(s-r);else l=e+g*(i-e),c=n+g*(s-n),p=(l-a)*(l-a)+(c-r)*(c-r)}return[l,c,p]},_getProjectionToLine(e,n,i){let s=Be.cloneObject(e),a=Number.MAX_VALUE;return n.forEach(function(r,l){if(!i&&l===n.length-1)return;let c=n[(l+1)%n.length],p=Be._getProjectionToSegment(r.x,r.y,c.x,c.y,e.x,e.y),m=p[0],g=p[1],y=p[2];if(y<a)s.x=m,s.y=g,a=y}),s},_prepareArrayForTween(e,n,i){let s=[],a=[];if(e.length>n.length){let l=n;n=e,e=l}for(let l=0;l<e.length;l+=2)s.push({x:e[l],y:e[l+1]});for(let l=0;l<n.length;l+=2)a.push({x:n[l],y:n[l+1]});let r=[];return a.forEach(function(l){let c=Be._getProjectionToLine(l,s,i);r.push(c.x),r.push(c.y)}),r},_prepareToStringify(e){let n;e.visitedByCircularReferenceRemoval=!0;for(let i in e){if(!(e.hasOwnProperty(i)&&e[i]&&typeof e[i]=="object"))continue;if(n=Object.getOwnPropertyDescriptor(e,i),e[i].visitedByCircularReferenceRemoval||Be._isElement(e[i]))if(n.configurable)delete e[i];else return null;else if(Be._prepareToStringify(e[i])===null)if(n.configurable)delete e[i];else return null}return delete e.visitedByCircularReferenceRemoval,e},_assign(e,n){for(let i in n)e[i]=n[i];return e},_getFirstPointerId(e){if(!e.touches)return e.pointerId||999;else return e.changedTouches[0].identifier},releaseCanvas(...e){if(!Tt.releaseCanvasOnDestroy)return;e.forEach((n)=>{n.width=0,n.height=0})},drawRoundedRectPath(e,n,i,s){let a=n<0?n:0,r=i<0?i:0;n=Math.abs(n),i=Math.abs(i);let l=0,c=0,p=0,m=0;if(typeof s==="number")l=c=p=m=Math.min(s,n/2,i/2);else l=Math.min(s[0]||0,n/2,i/2),c=Math.min(s[1]||0,n/2,i/2),m=Math.min(s[2]||0,n/2,i/2),p=Math.min(s[3]||0,n/2,i/2);e.moveTo(a+l,r),e.lineTo(a+n-c,r),e.arc(a+n-c,r+c,c,Math.PI*3/2,0,!1),e.lineTo(a+n,r+i-m),e.arc(a+n-m,r+i-m,m,0,Math.PI/2,!1),e.lineTo(a+p,r+i),e.arc(a+p,r+i-p,p,Math.PI/2,Math.PI,!1),e.lineTo(a,r+l),e.arc(a+l,r+l,l,Math.PI,Math.PI*3/2,!1)},drawRoundedPolygonPath(e,n,i,s,a){s=Math.abs(s);for(let r=0;r<i;r++){let l=n[(r-1+i)%i],c=n[r],p=n[(r+1)%i],m={x:c.x-l.x,y:c.y-l.y},g={x:p.x-c.x,y:p.y-c.y},y=Math.hypot(m.x,m.y),x=Math.hypot(g.x,g.y),j;if(typeof a==="number")j=a;else j=r<a.length?a[r]:0;j=s*Math.cos(Math.PI/i)*Math.min(1,j/s*2);let P={x:m.x/y,y:m.y/y},X={x:g.x/x,y:g.y/x},Y={x:c.x-P.x*j,y:c.y-P.y*j},J={x:c.x+X.x*j,y:c.y+X.y*j};if(r===0)e.moveTo(Y.x,Y.y);else e.lineTo(Y.x,Y.y);e.arcTo(c.x,c.y,J.x,J.y,j)}}};function vF(e){let n=[],i=e.length,s=Be;for(let a=0;a<i;a++){let r=e[a];if(s._isNumber(r))r=Math.round(r*1000)/1000;else if(!s._isString(r))r=r+"";n.push(r)}return n}var __=",",SF="(",_F=")",xF="([",kF="])",TF=";",AF="()",CF="=",x_=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","roundRect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],jF=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","filter"],EF=100,xb=null;function h3(){if(xb!==null)return xb;try{let n=Be.createCanvasElement().getContext("2d");if(!n)return xb=!1,!1;return!!n&&"filter"in n}catch(e){return xb=!1,!1}}class md{constructor(e){if(this.canvas=e,Tt.enableTrace)this.traceArr=[],this._enableTrace()}fillShape(e){if(e.fillEnabled())this._fill(e)}_fill(e){}strokeShape(e){if(e.hasStroke())this._stroke(e)}_stroke(e){}fillStrokeShape(e){if(e.attrs.fillAfterStrokeEnabled)this.strokeShape(e),this.fillShape(e);else this.fillShape(e),this.strokeShape(e)}getTrace(e,n){let i=this.traceArr,s=i.length,a="",r,l,c,p;for(r=0;r<s;r++){if(l=i[r],c=l.method,c)if(p=l.args,a+=c,e)a+=AF;else if(Be._isArray(p[0]))a+=xF+p.join(__)+kF;else{if(n)p=p.map((m)=>typeof m==="number"?Math.floor(m):m);a+=SF+p.join(__)+_F}else if(a+=l.property,!e)a+=CF+l.val;a+=TF}return a}clearTrace(){this.traceArr=[]}_trace(e){let n=this.traceArr,i;if(n.push(e),i=n.length,i>=EF)n.shift()}reset(){let e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){let n=this.getCanvas();if(e)this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0);else this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(e){let n=e.attrs.lineCap;if(n)this.setAttr("lineCap",n)}_applyOpacity(e){let n=e.getAbsoluteOpacity();if(n!==1)this.setAttr("globalAlpha",n)}_applyLineJoin(e){let n=e.attrs.lineJoin;if(n)this.setAttr("lineJoin",n)}_applyMiterLimit(e){let n=e.attrs.miterLimit;if(n!=null)this.setAttr("miterLimit",n)}setAttr(e,n){this._context[e]=n}arc(e,n,i,s,a,r){this._context.arc(e,n,i,s,a,r)}arcTo(e,n,i,s,a){this._context.arcTo(e,n,i,s,a)}beginPath(){this._context.beginPath()}bezierCurveTo(e,n,i,s,a,r){this._context.bezierCurveTo(e,n,i,s,a,r)}clearRect(e,n,i,s){this._context.clearRect(e,n,i,s)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,n){let i=arguments;if(i.length===2)return this._context.createImageData(e,n);else if(i.length===1)return this._context.createImageData(e)}createLinearGradient(e,n,i,s){return this._context.createLinearGradient(e,n,i,s)}createPattern(e,n){return this._context.createPattern(e,n)}createRadialGradient(e,n,i,s,a,r){return this._context.createRadialGradient(e,n,i,s,a,r)}drawImage(e,n,i,s,a,r,l,c,p){let m=arguments,g=this._context;if(m.length===3)g.drawImage(e,n,i);else if(m.length===5)g.drawImage(e,n,i,s,a);else if(m.length===9)g.drawImage(e,n,i,s,a,r,l,c,p)}ellipse(e,n,i,s,a,r,l,c){this._context.ellipse(e,n,i,s,a,r,l,c)}isPointInPath(e,n,i,s){if(i)return this._context.isPointInPath(i,e,n,s);return this._context.isPointInPath(e,n,s)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,n,i,s){this._context.fillRect(e,n,i,s)}strokeRect(e,n,i,s){this._context.strokeRect(e,n,i,s)}fillText(e,n,i,s){if(s)this._context.fillText(e,n,i,s);else this._context.fillText(e,n,i)}measureText(e){return this._context.measureText(e)}getImageData(e,n,i,s){return this._context.getImageData(e,n,i,s)}lineTo(e,n){this._context.lineTo(e,n)}moveTo(e,n){this._context.moveTo(e,n)}rect(e,n,i,s){this._context.rect(e,n,i,s)}roundRect(e,n,i,s,a){this._context.roundRect(e,n,i,s,a)}putImageData(e,n,i){this._context.putImageData(e,n,i)}quadraticCurveTo(e,n,i,s){this._context.quadraticCurveTo(e,n,i,s)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,n){this._context.scale(e,n)}setLineDash(e){if(this._context.setLineDash)this._context.setLineDash(e);else if("mozDash"in this._context)this._context.mozDash=e;else if("webkitLineDash"in this._context)this._context.webkitLineDash=e}getLineDash(){return this._context.getLineDash()}setTransform(e,n,i,s,a,r){this._context.setTransform(e,n,i,s,a,r)}stroke(e){if(e)this._context.stroke(e);else this._context.stroke()}strokeText(e,n,i,s){this._context.strokeText(e,n,i,s)}transform(e,n,i,s,a,r){this._context.transform(e,n,i,s,a,r)}translate(e,n){this._context.translate(e,n)}_enableTrace(){let e=this,n=x_.length,i=this.setAttr,s,a,r=function(l){let c=e[l],p;e[l]=function(){return a=vF(Array.prototype.slice.call(arguments,0)),p=c.apply(e,arguments),e._trace({method:l,args:a}),p}};for(s=0;s<n;s++)r(x_[s]);e.setAttr=function(){i.apply(e,arguments);let l=arguments[0],c=arguments[1];if(l==="shadowOffsetX"||l==="shadowOffsetY"||l==="shadowBlur")c=c/this.canvas.getPixelRatio();e._trace({property:l,val:c})}}_applyGlobalCompositeOperation(e){let n=e.attrs.globalCompositeOperation;if(!(!n||n==="source-over"))this.setAttr("globalCompositeOperation",n)}}jF.forEach(function(e){Object.defineProperty(md.prototype,e,{get(){return this._context[e]},set(n){this._context[e]=n}})});class f3 extends md{constructor(e,{willReadFrequently:n=!1}={}){super(e);this._context=e._canvas.getContext("2d",{willReadFrequently:n})}_fillColor(e){let n=e.fill();this.setAttr("fillStyle",n),e._fillFunc(this)}_fillPattern(e){let n=this._context;if("patternQuality"in n)n.patternQuality=n.imageSmoothingEnabled?"good":"nearest";this.setAttr("fillStyle",e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){let n=e._getLinearGradient();if(n)this.setAttr("fillStyle",n),e._fillFunc(this)}_fillRadialGradient(e){let n=e._getRadialGradient();if(n)this.setAttr("fillStyle",n),e._fillFunc(this)}_fill(e){let n=e.fill(),i=e.getFillPriority();if(n&&i==="color"){this._fillColor(e);return}let s=e.getFillPatternImage();if(s&&i==="pattern"){this._fillPattern(e);return}let a=e.getFillLinearGradientColorStops();if(a&&i==="linear-gradient"){this._fillLinearGradient(e);return}let r=e.getFillRadialGradientColorStops();if(r&&i==="radial-gradient"){this._fillRadialGradient(e);return}if(n)this._fillColor(e);else if(s)this._fillPattern(e);else if(a)this._fillLinearGradient(e);else if(r)this._fillRadialGradient(e)}_strokeLinearGradient(e){let n=e.getStrokeLinearGradientStartPoint(),i=e.getStrokeLinearGradientEndPoint(),s=e.getStrokeLinearGradientColorStops(),a=this.createLinearGradient(n.x,n.y,i.x,i.y);if(s){for(let r=0;r<s.length;r+=2)a.addColorStop(s[r],s[r+1]);this.setAttr("strokeStyle",a)}}_stroke(e){let n=e.dash(),i=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!i){this.save();let a=this.getCanvas().getPixelRatio();this.setTransform(a,0,0,a,0,0)}if(this._applyLineCap(e),n&&e.dashEnabled())this.setLineDash(n),this.setAttr("lineDashOffset",e.dashOffset());if(this.setAttr("lineWidth",e.strokeWidth()),!e.getShadowForStrokeEnabled())this.setAttr("shadowColor","rgba(0,0,0,0)");if(e.getStrokeLinearGradientColorStops())this._strokeLinearGradient(e);else this.setAttr("strokeStyle",e.stroke());if(e._strokeFunc(this),!i)this.restore()}}_applyShadow(e){var n,i,s;let a=(n=e.getShadowRGBA())!==null&&n!==void 0?n:"black",r=(i=e.getShadowBlur())!==null&&i!==void 0?i:5,l=(s=e.getShadowOffset())!==null&&s!==void 0?s:{x:0,y:0},c=e.getAbsoluteScale(),p=this.canvas.getPixelRatio(),m=c.x*p,g=c.y*p;this.setAttr("shadowColor",a),this.setAttr("shadowBlur",r*Math.min(Math.abs(m),Math.abs(g))),this.setAttr("shadowOffsetX",l.x*m),this.setAttr("shadowOffsetY",l.y*g)}}class d3 extends md{constructor(e){super(e);this._context=e._canvas.getContext("2d",{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr("fillStyle",e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){if(e.hasHitStroke())this._stroke(e)}_stroke(e){if(e.hasHitStroke()){let n=e.getStrokeScaleEnabled();if(!n){this.save();let a=this.getCanvas().getPixelRatio();this.setTransform(a,0,0,a,0,0)}this._applyLineCap(e);let i=e.hitStrokeWidth(),s=i==="auto"?e.strokeWidth():i;if(this.setAttr("lineWidth",s),this.setAttr("strokeStyle",e.colorKey),e._strokeFuncHit(this),!n)this.restore()}}}var kb;function qF(){if(kb)return kb;let e=Be.createCanvasElement(),n=e.getContext("2d");return kb=function(){let i=Tt._global.devicePixelRatio||1,s=n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1;return i/s}(),Be.releaseCanvas(e),kb}class qp{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;let i=(e||{}).pixelRatio||Tt.pixelRatio||qF();this.pixelRatio=i,this._canvas=Be.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){let n=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/n,this.getHeight()/n)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";let n=this.pixelRatio;this.getContext()._context.scale(n,n)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";let n=this.pixelRatio;this.getContext()._context.scale(n,n)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,n){this.setWidth(e||0),this.setHeight(n||0)}setSizeIfChanged(e,n){if(this.width!==e*this.pixelRatio||this.height!==n*this.pixelRatio)this.setSize(e,n)}toDataURL(e,n){try{return this._canvas.toDataURL(e,n)}catch(i){try{return this._canvas.toDataURL()}catch(s){return Be.error("Unable to get data URL. "+s.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}class Er extends qp{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e);this.context=new f3(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}}class gh extends qp{constructor(e={width:0,height:0}){super(e);this.hitCanvas=!0,this.context=new d3(this),this.setSize(e.width,e.height)}}var Hn={get isDragging(){let e=!1;return Hn._dragElements.forEach((n)=>{if(n.dragStatus==="dragging")e=!0}),e},justDragged:!1,get node(){let e;return Hn._dragElements.forEach((n)=>{e=n.node}),e},_dragElements:new Map,_listenToWindow(e){let n=(s)=>Hn._endDragBefore(s,e),i=(s)=>Hn._drag(s,e);e.addEventListener("mouseup",n,!0),e.addEventListener("touchend",n,!0),e.addEventListener("touchcancel",n,!0),e.addEventListener("mousemove",i),e.addEventListener("touchmove",i),e.addEventListener("mouseup",Hn._endDragAfter,!1),e.addEventListener("touchend",Hn._endDragAfter,!1),e.addEventListener("touchcancel",Hn._endDragAfter,!1)},_drag(e,n){let i=[];Hn._dragElements.forEach((s,a)=>{let{node:r}=s,l=r.getStage();if(n&&l._getOwnerWindow()!==n)return;if(l.setPointersPositions(e),s.pointerId===void 0)s.pointerId=Be._getFirstPointerId(e);let c=l._changedPointerPositions.find((p)=>p.id===s.pointerId);if(!c)return;if(s.dragStatus!=="dragging"){let p=r.dragDistance();if(Math.max(Math.abs(c.x-s.startPointerPos.x),Math.abs(c.y-s.startPointerPos.y))<p)return;if(r.startDrag({evt:e}),!r.isDragging())return}r._setDragPosition(e,s),i.push(r)}),i.forEach((s)=>{if(!s.getStage())return;s.fire("dragmove",{type:"dragmove",target:s,evt:e},!0)})},_endDragBefore(e,n){let i=[];Hn._dragElements.forEach((s)=>{let{node:a}=s,r=a.getStage();if(e&&(!n||r._getOwnerWindow()===n))r.setPointersPositions(e);if(!r._changedPointerPositions.find((p)=>p.id===s.pointerId))return;if(s.dragStatus==="dragging"||s.dragStatus==="stopped")Hn.justDragged=!0,Tt._mouseListenClick=!1,Tt._touchListenClick=!1,Tt._pointerListenClick=!1,s.dragStatus="stopped";let c=s.node.getLayer()||s.node instanceof Tt.Stage&&s.node;if(c&&i.indexOf(c)===-1)i.push(c)}),i.forEach((s)=>{s.draw()})},_endDragAfter(e){Hn._dragElements.forEach((n,i)=>{if(n.dragStatus==="stopped")n.node.fire("dragend",{type:"dragend",target:n.node,evt:e},!0);if(n.dragStatus!=="dragging")Hn._dragElements.delete(i)})}};function Vc(e){if(Be._isString(e))return'"'+e+'"';if(Object.prototype.toString.call(e)==="[object Number]")return e;if(Be._isBoolean(e))return e;return Object.prototype.toString.call(e)}function Tb(e){if(e>255)return 255;else if(e<0)return 0;return Math.round(e)}function dt(){if(Tt.isUnminified)return function(e,n){if(!Be._isNumber(e))Be.warn(Vc(e)+' is a not valid value for "'+n+'" attribute. The value should be a number.');return e}}function Xc(e){if(Tt.isUnminified)return function(n,i){let s=Be._isNumber(n),a=Be._isArray(n)&&n.length==e;if(!s&&!a)Be.warn(Vc(n)+' is a not valid value for "'+i+'" attribute. The value should be a number or Array<number>('+e+")");return n}}function Ip(){if(Tt.isUnminified)return function(e,n){if(!(Be._isNumber(e)||e==="auto"))Be.warn(Vc(e)+' is a not valid value for "'+n+'" attribute. The value should be a number or "auto".');return e}}function Fo(){if(Tt.isUnminified)return function(e,n){if(!Be._isString(e))Be.warn(Vc(e)+' is a not valid value for "'+n+'" attribute. The value should be a string.');return e}}function p3(){if(Tt.isUnminified)return function(e,n){let i=Be._isString(e),s=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;if(!(i||s))Be.warn(Vc(e)+' is a not valid value for "'+n+'" attribute. The value should be a string or a native gradient.');return e}}function k_(){if(Tt.isUnminified)return function(e,n){let i=Int8Array?Object.getPrototypeOf(Int8Array):null;if(i&&e instanceof i)return e;if(!Be._isArray(e))Be.warn(Vc(e)+' is a not valid value for "'+n+'" attribute. The value should be a array of numbers.');else e.forEach(function(s){if(!Be._isNumber(s))Be.warn('"'+n+'" attribute has non numeric element '+s+". Make sure that all elements are numbers.")});return e}}function Hs(){if(Tt.isUnminified)return function(e,n){if(!(e===!0||e===!1))Be.warn(Vc(e)+' is a not valid value for "'+n+'" attribute. The value should be a boolean.');return e}}function T_(e){if(Tt.isUnminified)return function(n,i){if(n===void 0||n===null)return n;if(!Be.isObject(n))Be.warn(Vc(n)+' is a not valid value for "'+i+'" attribute. The value should be an object with properties '+e);return n}}var Mp="get",Rp="set",_e={addGetterSetter(e,n,i,s,a){_e.addGetter(e,n,i),_e.addSetter(e,n,s,a),_e.addOverloadedGetterSetter(e,n)},addGetter(e,n,i){let s=Mp+Be._capitalize(n);e.prototype[s]=e.prototype[s]||function(){let a=this.attrs[n];return a===void 0?i:a}},addSetter(e,n,i,s){let a=Rp+Be._capitalize(n);if(!e.prototype[a])_e.overWriteSetter(e,n,i,s)},overWriteSetter(e,n,i,s){let a=Rp+Be._capitalize(n);e.prototype[a]=function(r){if(i&&r!==void 0&&r!==null)r=i.call(this,r,n);if(this._setAttr(n,r),s)s.call(this);return this}},addComponentsGetterSetter(e,n,i,s,a){let r=i.length,l=Be._capitalize,c=Mp+l(n),p=Rp+l(n);e.prototype[c]=function(){let g={};for(let y=0;y<r;y++){let x=i[y];g[x]=this.getAttr(n+l(x))}return g};let m=T_(i);e.prototype[p]=function(g){let y=this.attrs[n];if(s)g=s.call(this,g,n);if(m)m.call(this,g,n);for(let x in g){if(!g.hasOwnProperty(x))continue;this._setAttr(n+l(x),g[x])}if(!g)i.forEach((x)=>{this._setAttr(n+l(x),void 0)});if(this._fireChangeEvent(n,y,g),a)a.call(this);return this},_e.addOverloadedGetterSetter(e,n)},addOverloadedGetterSetter(e,n){let i=Be._capitalize(n),s=Rp+i,a=Mp+i;e.prototype[n]=function(){if(arguments.length)return this[s](arguments[0]),this;return this[a]()}},addDeprecatedGetterSetter(e,n,i,s){Be.error("Adding deprecated "+n);let a=Mp+Be._capitalize(n),r=n+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[a]=function(){Be.error(r);let l=this.attrs[n];return l===void 0?i:l},_e.addSetter(e,n,s,function(){Be.error(r)}),_e.addOverloadedGetterSetter(e,n)},backCompat(e,n){Be.each(n,function(i,s){let a=e.prototype[s],r=Mp+Be._capitalize(i),l=Rp+Be._capitalize(i);function c(){a.apply(this,arguments),Be.error('"'+i+'" method is deprecated and will be removed soon. Use ""'+s+'" instead.')}e.prototype[i]=c,e.prototype[r]=c,e.prototype[l]=c})},afterSetFilter(){this._filterUpToDate=!1}};function DF(e){let n=/(\w+)\(([^)]+)\)/g,i;while((i=n.exec(e))!==null){let[,s,a]=i;switch(s){case"blur":{let r=parseFloat(a.replace("px",""));return function(l){this.blurRadius(r*0.5);let c=Tt.Filters;if(c&&c.Blur)c.Blur.call(this,l)}}case"brightness":{let r=a.includes("%")?parseFloat(a)/100:parseFloat(a);return function(l){this.brightness(r);let c=Tt.Filters;if(c&&c.Brightness)c.Brightness.call(this,l)}}case"contrast":{let r=parseFloat(a);return function(l){let c=100*(Math.sqrt(r)-1);this.contrast(c);let p=Tt.Filters;if(p&&p.Contrast)p.Contrast.call(this,l)}}case"grayscale":return function(r){let l=Tt.Filters;if(l&&l.Grayscale)l.Grayscale.call(this,r)};case"sepia":return function(r){let l=Tt.Filters;if(l&&l.Sepia)l.Sepia.call(this,r)};case"invert":return function(r){let l=Tt.Filters;if(l&&l.Invert)l.Invert.call(this,r)};default:Be.warn(`CSS filter "${s}" is not supported in fallback mode. Consider using function filters for better compatibility.`);break}}return()=>{}}var Ab="absoluteOpacity",A_="allEventListeners",Rl="absoluteTransform",C_="absoluteScale",bh="canvas",IF="Change",MF="children",RF="konva",m3="listening",OF="mouseenter",FF="mouseleave",NF="pointerenter",PF="pointerleave",BF="touchenter",LF="touchleave";var j_="set",E_="Shape",Cb=" ",q_="stage",Wc="transform",HF="Stage",g3="visible",UF=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(Cb),zF=1;class wt{constructor(e){this._id=zF++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){if((e===Wc||e===Rl)&&this._cache.get(e))this._cache.get(e).dirty=!0;else if(e)this._cache.delete(e);else this._cache.clear()}_getCache(e,n){let i=this._cache.get(e);if(i===void 0||(e===Wc||e===Rl)&&i.dirty===!0)i=n.call(this),this._cache.set(e,i);return i}_calculate(e,n,i){if(!this._attachedDepsListeners.get(e)){let s=n.map((a)=>a+"Change.konva").join(Cb);this.on(s,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,i)}_getCanvasCache(){return this._cache.get(bh)}_clearSelfAndDescendantCache(e){if(this._clearCache(e),e===Rl)this.fire("absoluteTransformChange")}static _runAfterAbsTransformCascade(e){if(wt._absTransformCascadeDepth>0)wt._pendingAfterCascade.push(e);else e()}clearCache(){if(this._cache.has(bh)){let{scene:e,filter:n,hit:i}=this._cache.get(bh);Be.releaseCanvas(e._canvas,n._canvas,...i?[i._canvas]:[]),this._cache.delete(bh)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){let n=e||{},i={};if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)i=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0});let s=Math.ceil(n.width||i.width),a=Math.ceil(n.height||i.height),r=n.pixelRatio,l=n.x===void 0?Math.floor(i.x):n.x,c=n.y===void 0?Math.floor(i.y):n.y,p=n.offset||0,m=n.drawBorder||!1,g=n.hitCanvasPixelRatio||1;if(!s||!a){Be.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}let y=Math.abs(Math.round(i.x)-l)>0.5?1:0,x=Math.abs(Math.round(i.y)-c)>0.5?1:0;s+=p*2+y,a+=p*2+x,l-=p,c-=p;let j=new Er({pixelRatio:r,width:s,height:a}),I=new Er({pixelRatio:r,width:0,height:0,willReadFrequently:!0}),P=j.getContext(),X=new Er({width:j.width/j.pixelRatio+Math.abs(l),height:j.height/j.pixelRatio+Math.abs(c),pixelRatio:j.pixelRatio}),Y=X.getContext();if(j.isCache=!0,this._cache.delete(bh),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1)j.getContext()._context.imageSmoothingEnabled=!1,I.getContext()._context.imageSmoothingEnabled=!1;if(P.save(),Y.save(),P.translate(-l,-c),Y.translate(-l,-c),X.x=l,X.y=c,this._isUnderCache=!0,this._clearSelfAndDescendantCache(Ab),this._clearSelfAndDescendantCache(C_),this.drawScene(j,this,X),this._isUnderCache=!1,P.restore(),m)P.save(),P.beginPath(),P.rect(0,0,s,a),P.closePath(),P.setAttr("strokeStyle","red"),P.setAttr("lineWidth",5),P.stroke(),P.restore();return Be.releaseCanvas(X._canvas),this._cache.set(bh,{scene:j,filter:I,hit:null,hitConfig:{pixelRatio:g,width:s,height:a},x:l,y:c}),this._requestDraw(),this}_getCachedHitCanvas(e){if(e===this)return null;let n=this._getCanvasCache();if(!n)return null;if(n.hit)return n.hit;let i=new gh(n.hitConfig);i.isCache=!0;let s=i.getContext();return s.save(),s.translate(-n.x,-n.y),this.drawHit(i,this),s.restore(),n.hit=i,i}isCached(){return this._cache.has(bh)}getClientRect(e){throw Error('abstract "getClientRect" method call')}_transformedRect(e,n){let i=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],s=1/0,a=1/0,r=-1/0,l=-1/0,c=this.getAbsoluteTransform(n);return i.forEach(function(p){let m=c.point(p);if(s===void 0)s=r=m.x,a=l=m.y;s=Math.min(s,m.x),a=Math.min(a,m.y),r=Math.max(r,m.x),l=Math.max(l,m.y)}),{x:s,y:a,width:r-s,height:l-a}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);let n=this._getCanvasCache();e.translate(n.x,n.y);let i=this._getCachedSceneCanvas(),s=i.pixelRatio;e.drawImage(i._canvas,0,0,i.width/s,i.height/s),e.restore()}_drawCachedHitCanvas(e,n){let i=this._getCanvasCache();e.save(),e.translate(i.x,i.y),e.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),e.restore()}_getCachedSceneCanvas(){let e=this.filters(),n=this._getCanvasCache(),{scene:i,filter:s}=n,a=s.getContext(),r,l,c,p;if(!e||e.length===0)return i;if(this._filterUpToDate)return s;let m=!0;for(let y=0;y<e.length;y++){let x=typeof e[y]==="string"&&!h3();if(typeof e[y]!=="string"||!h3()){m=!1;break}}let g=i.pixelRatio;if(s.setSize(i.width/i.pixelRatio,i.height/i.pixelRatio),m){let y=e.join(" ");return a.save(),a.setAttr("filter",y),a.drawImage(i._canvas,0,0,i.getWidth()/g,i.getHeight()/g),a.restore(),this._filterUpToDate=!0,s}try{r=e.length,a.clear(),a.drawImage(i._canvas,0,0,i.getWidth()/g,i.getHeight()/g),l=a.getImageData(0,0,s.getWidth(),s.getHeight());for(c=0;c<r;c++){if(p=e[c],typeof p==="string")p=DF(p);p.call(this,l),a.putImageData(l,0,0)}}catch(y){Be.error("Unable to apply filter. "+y.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}return this._filterUpToDate=!0,s}on(...e){let n=e[0],i=e[1],s=e[2];if(this._cache)this._cache.delete(A_);if(e.length===3)return this._delegate.apply(this,e);let a=n.split(Cb);for(let r=0;r<a.length;r++){let c=a[r].split("."),p=c[0],m=c[1]||"";if(!this.eventListeners[p])this.eventListeners[p]=[];this.eventListeners[p].push({name:m,handler:i})}return this}off(e,n){let i=(e||"").split(Cb),s=i.length,a,r,l,c,p,m;if(this._cache&&this._cache.delete(A_),!e)for(r in this.eventListeners)this._off(r);for(a=0;a<s;a++)if(l=i[a],c=l.split("."),p=c[0],m=c[1],p){if(this.eventListeners[p])this._off(p,m,n)}else for(r in this.eventListeners)this._off(r,m,n);return this}dispatchEvent(e){let n={target:this,type:e.type,evt:e};return this.fire(e.type,n),this}addEventListener(e,n){return this.on(e,function(i){n.call(this,i.evt)}),this}removeEventListener(e){return this.off(e),this}_delegate(e,n,i){let s=this;return this.on(e,function(a){let r=a.target.findAncestors(n,!0,s);for(let l=0;l<r.length;l++)a=Be.cloneObject(a),a.currentTarget=r[l],i.call(r[l],a)}),this}remove(){if(this.isDragging())this.stopDrag();return Hn._dragElements.delete(this._id),Hn._dragElements.forEach((e,n)=>{if(this.isAncestorOf(e.node))Hn._dragElements.delete(n)}),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(Rl),this._clearSelfAndDescendantCache(Ab),this._clearSelfAndDescendantCache(C_),this._clearSelfAndDescendantCache(q_),this._clearSelfAndDescendantCache(g3),this._clearSelfAndDescendantCache(m3)}_remove(){this._clearCaches();let e=this.getParent();if(e&&e.children)e.children.splice(this.index,1),e._setChildrenIndices(),this.parent=null}destroy(){return this.remove(),this.clearCache(),this}getAttr(e){let n="get"+Be._capitalize(e);if(Be._isFunction(this[n]))return this[n]();return this.attrs[e]}getAncestors(){let e=this.getParent(),n=[];while(e)n.push(e),e=e.getParent();return n}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges(()=>{let n,i;if(!e)return this;for(n in e){if(n===MF)continue;if(i=j_+Be._capitalize(n),Be._isFunction(this[i]))this[i](e[n]);else this._setAttr(n,e[n])}}),this}isListening(){return this._getCache(m3,this._isListening)}_isListening(e){if(!this.listening())return!1;let i=this.getParent();if(i&&i!==e&&this!==e)return i._isListening(e);else return!0}isVisible(){return this._getCache(g3,this._isVisible)}_isVisible(e){if(!this.visible())return!1;let i=this.getParent();if(i&&i!==e&&this!==e)return i._isVisible(e);else return!0}shouldDrawHit(e,n=!1){if(e)return this._isVisible(e)&&this._isListening(e);let i=this.getLayer(),s=!1;Hn._dragElements.forEach((r)=>{if(r.dragStatus!=="dragging")return;else if(r.node.nodeType==="Stage")s=!0;else if(r.node.getLayer()===i)s=!0});let a=!n&&!Tt.hitOnDragEnabled&&(s||Tt.isTransforming());return this.isListening()&&this.isVisible()&&!a}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let e=this.getDepth(),n=this,i=0,s,a,r,l;function c(m){s=[],a=m.length;for(r=0;r<a;r++){if(l=m[r],i++,l.nodeType!==E_)s=s.concat(l.getChildren().slice());if(l._id===n._id)r=a}if(s.length>0&&s[0].getDepth()<=e)c(s)}let p=this.getStage();if(n.nodeType!==HF&&p)c(p.getChildren());return i}getDepth(){let e=0,n=this.parent;while(n)e++,n=n.parent;return e}_batchTransformChanges(e){if(this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache)this._clearCache(Wc),this._clearSelfAndDescendantCache(Rl);this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){let e=this.getStage();if(!e)return null;let n=e.getPointerPosition();if(!n)return null;let i=this.getAbsoluteTransform().copy();return i.invert(),i.point(n)}getAbsolutePosition(e){let n=!1,i=this.parent;while(i){if(i.isCached()){n=!0;break}i=i.parent}if(n&&!e)e=!0;let s=this.getAbsoluteTransform(e).getMatrix(),a=new Ps,r=this.offset();return a.m=s.slice(),a.translate(r.x,r.y),a.getTranslation()}setAbsolutePosition(e){let{x:n,y:i,...s}=this._clearTransform();this.attrs.x=n,this.attrs.y=i,this._clearCache(Wc);let a=this._getAbsoluteTransform().copy();return a.invert(),a.translate(e.x,e.y),e={x:this.attrs.x+a.getTranslation().x,y:this.attrs.y+a.getTranslation().y},this._setTransform(s),this.setPosition({x:e.x,y:e.y}),this._clearCache(Wc),this._clearSelfAndDescendantCache(Rl),this}_setTransform(e){let n;for(n in e)this.attrs[n]=e[n]}_clearTransform(){let e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){let{x:n,y:i}=e,s=this.x(),a=this.y();if(n!==void 0)s+=n;if(i!==void 0)a+=i;return this.setPosition({x:s,y:a}),this}_eachAncestorReverse(e,n){let i=[],s=this.getParent(),a,r;if(n&&n._id===this._id)return;i.unshift(this);while(s&&(!n||s._id!==n._id))i.unshift(s),s=s.parent;a=i.length;for(r=0;r<a;r++)e(i[r])}rotate(e){return this.rotation(this.rotation()+e),this}moveToTop(){if(!this.parent)return Be.warn("Node has no parent. moveToTop function is ignored."),!1;let e=this.index,n=this.parent.getChildren().length;if(e<n-1)return this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0;return!1}moveUp(){if(!this.parent)return Be.warn("Node has no parent. moveUp function is ignored."),!1;let e=this.index,n=this.parent.getChildren().length;if(e<n-1)return this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0;return!1}moveDown(){if(!this.parent)return Be.warn("Node has no parent. moveDown function is ignored."),!1;let e=this.index;if(e>0)return this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0;return!1}moveToBottom(){if(!this.parent)return Be.warn("Node has no parent. moveToBottom function is ignored."),!1;let e=this.index;if(e>0)return this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0;return!1}setZIndex(e){if(!this.parent)return Be.warn("Node has no parent. zIndex parameter is ignored."),this;if(e<0||e>=this.parent.children.length)Be.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");let n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Ab,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let e=this.opacity(),n=this.getParent();if(n&&!n._isUnderCache)e*=n.getAbsoluteOpacity();return e}moveTo(e){if(this.getParent()!==e)this._remove(),e.add(this);return this}toObject(){let e=this.getAttrs(),n,i,s,a,r,l={attrs:{},className:this.getClassName()};for(n in e){if(i=e[n],r=Be.isObject(i)&&!Be._isPlainObject(i)&&!Be._isArray(i),r)continue;if(s=typeof this[n]==="function"&&this[n],delete e[n],a=s?s.call(this):null,e[n]=i,a!==i)l.attrs[n]=i}return Be._prepareToStringify(l)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,n,i){let s=[];if(n&&this._isMatch(e))s.push(this);let a=this.parent;while(a){if(a===i)return s;if(a._isMatch(e))s.push(a);a=a.parent}return s}isAncestorOf(e){return!1}findAncestor(e,n,i){return this.findAncestors(e,n,i)[0]}_isMatch(e){if(!e)return!1;if(typeof e==="function")return e(this);let n=e.replace(/ /g,"").split(","),i=n.length,s,a;for(s=0;s<i;s++){if(a=n[s],!Be.isValidSelector(a))Be.warn('Selector "'+a+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),Be.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),Be.warn("Konva is awesome, right?");if(a.charAt(0)==="#"){if(this.id()===a.slice(1))return!0}else if(a.charAt(0)==="."){if(this.hasName(a.slice(1)))return!0}else if(this.className===a||this.nodeType===a)return!0}return!1}getLayer(){let e=this.getParent();return e?e.getLayer():null}getStage(){return this._getCache(q_,this._getStage)}_getStage(){let e=this.getParent();if(e)return e.getStage();else return null}fire(e,n={},i){if(n.target=n.target||this,i)this._fireAndBubble(e,n);else this._fire(e,n);return this}getAbsoluteTransform(e){if(e)return this._getAbsoluteTransform(e);else return this._getCache(Rl,this._getAbsoluteTransform)}_getAbsoluteTransform(e){let n;if(e)return n=new Ps,this._eachAncestorReverse(function(i){let s=i.transformsEnabled();if(s==="all")n.multiply(i.getTransform());else if(s==="position")n.translate(i.x()-i.offsetX(),i.y()-i.offsetY())},e),n;else{if(n=this._cache.get(Rl)||new Ps,this.parent)this.parent.getAbsoluteTransform().copyInto(n);else n.reset();let i=this.transformsEnabled();if(i==="all")n.multiply(this.getTransform());else if(i==="position"){let s=this.attrs.x||0,a=this.attrs.y||0,r=this.attrs.offsetX||0,l=this.attrs.offsetY||0;n.translate(s-r,a-l)}return n.dirty=!1,n}}getAbsoluteScale(e){let n=this;while(n){if(n._isUnderCache)e=n;n=n.getParent()}let s=this.getAbsoluteTransform(e).decompose();return{x:s.scaleX,y:s.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(Wc,this._getTransform)}_getTransform(){var e,n;let i=this._cache.get(Wc)||new Ps;i.reset();let s=this.x(),a=this.y(),r=Tt.getAngle(this.rotation()),l=(e=this.attrs.scaleX)!==null&&e!==void 0?e:1,c=(n=this.attrs.scaleY)!==null&&n!==void 0?n:1,p=this.attrs.skewX||0,m=this.attrs.skewY||0,g=this.attrs.offsetX||0,y=this.attrs.offsetY||0;if(s!==0||a!==0)i.translate(s,a);if(r!==0)i.rotate(r);if(p!==0||m!==0)i.skew(p,m);if(l!==1||c!==1)i.scale(l,c);if(g!==0||y!==0)i.translate(-1*g,-1*y);return i.dirty=!1,i}clone(e){let n=Be.cloneObject(this.attrs),i,s,a,r,l;for(i in e)n[i]=e[i];let c=new this.constructor(n);for(i in this.eventListeners){s=this.eventListeners[i],a=s.length;for(r=0;r<a;r++)if(l=s[r],l.name.indexOf(RF)<0){if(!c.eventListeners[i])c.eventListeners[i]=[];c.eventListeners[i].push(l)}}return c}_toKonvaCanvas(e){e=e||{};let n=this.getClientRect(),i=this.getStage(),s=e.x!==void 0?e.x:Math.floor(n.x),a=e.y!==void 0?e.y:Math.floor(n.y),r=e.pixelRatio||1,l=new Er({width:e.width||Math.ceil(n.width)||(i?i.width():0),height:e.height||Math.ceil(n.height)||(i?i.height():0),pixelRatio:r}),c=l.getContext(),p=new Er({width:l.width/l.pixelRatio+Math.abs(s),height:l.height/l.pixelRatio+Math.abs(a),pixelRatio:l.pixelRatio});if(e.imageSmoothingEnabled===!1)c._context.imageSmoothingEnabled=!1;if(c.save(),s||a)c.translate(-1*s,-1*a);return this.drawScene(l,void 0,p),c.restore(),l}toCanvas(e){return this._toKonvaCanvas(e)._canvas}toDataURL(e){e=e||{};let n=e.mimeType||null,i=e.quality||null,s=this._toKonvaCanvas(e).toDataURL(n,i);if(e.callback)e.callback(s);return s}toImage(e){return new Promise((n,i)=>{try{let s=e===null||e===void 0?void 0:e.callback;if(s)delete e.callback;Be._urlToImage(this.toDataURL(e),function(a){n(a),s===null||s===void 0||s(a)})}catch(s){i(s)}})}toBlob(e){return new Promise((n,i)=>{try{let s=e===null||e===void 0?void 0:e.callback;if(s)delete e.callback;this.toCanvas(e).toBlob((a)=>{n(a),s===null||s===void 0||s(a)},e===null||e===void 0?void 0:e.mimeType,e===null||e===void 0?void 0:e.quality)}catch(s){i(s)}})}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){if(this.attrs.dragDistance!==void 0)return this.attrs.dragDistance;else if(this.parent)return this.parent.getDragDistance();else return Tt.dragDistance}_off(e,n,i){let s=this.eventListeners[e],a,r,l;for(a=0;a<s.length;a++)if(r=s[a].name,l=s[a].handler,(r!=="konva"||n==="konva")&&(!n||r===n)&&(!i||i===l)){if(s.splice(a,1),s.length===0){delete this.eventListeners[e];break}a--}}_fireChangeEvent(e,n,i){this._fire(e+IF,{oldVal:n,newVal:i})}addName(e){if(!this.hasName(e)){let n=this.name(),i=n?n+" "+e:e;this.name(i)}return this}hasName(e){if(!e)return!1;let n=this.name();if(!n)return!1;return(n||"").split(/\s/g).indexOf(e)!==-1}removeName(e){let n=(this.name()||"").split(/\s/g),i=n.indexOf(e);if(i!==-1)n.splice(i,1),this.name(n.join(" "));return this}setAttr(e,n){let i=this[j_+Be._capitalize(e)];if(Be._isFunction(i))i.call(this,n);else this._setAttr(e,n);return this}_requestDraw(){if(Tt.autoDrawEnabled){let e=this.getLayer()||this.getStage();e===null||e===void 0||e.batchDraw()}}_setAttr(e,n){let i=this.attrs[e];if(i===n&&!Be.isObject(n))return;if(n===void 0||n===null)delete this.attrs[e];else this.attrs[e]=n;if(this._shouldFireChangeEvents)this._fireChangeEvent(e,i,n);this._requestDraw()}_setComponentAttr(e,n,i){let s;if(i!==void 0){if(s=this.attrs[e],!s)this.attrs[e]=this.getAttr(e);this.attrs[e][n]=i,this._fireChangeEvent(e,s,i)}}_fireAndBubble(e,n,i){if(n&&this.nodeType===E_)n.target=this;let s=[OF,FF,NF,PF,BF,LF];if(!(s.indexOf(e)!==-1&&(i&&(this===i||this.isAncestorOf&&this.isAncestorOf(i))||this.nodeType==="Stage"&&!i))){this._fire(e,n);let r=s.indexOf(e)!==-1&&i&&i.isAncestorOf&&i.isAncestorOf(this)&&!i.isAncestorOf(this.parent);if((n&&!n.cancelBubble||!n)&&this.parent&&this.parent.isListening()&&!r)if(i&&i.parent)this._fireAndBubble.call(this.parent,e,n,i);else this._fireAndBubble.call(this.parent,e,n)}}_getProtoListeners(e){var n,i;let{nodeType:s}=this,a=wt.protoListenerMap.get(s)||{},r=a===null||a===void 0?void 0:a[e];if(r===void 0){r=[];let l=new Set,c=Object.getPrototypeOf(this);while(c){let p=(i=(n=c.eventListeners)===null||n===void 0?void 0:n[e])!==null&&i!==void 0?i:[];for(let m=0;m<p.length;m++){let g=p[m];if(!l.has(g))l.add(g),r.push(g)}c=Object.getPrototypeOf(c)}a[e]=r,wt.protoListenerMap.set(s,a)}return r}_fire(e,n){n=n||{},n.currentTarget=this,n.type=e;let i=this._getProtoListeners(e);if(i)for(let a=0;a<i.length;a++)i[a].handler.call(this,n);let s=this.eventListeners[e];if(s){let a=s.slice(),r=a.length;for(let c=0;c<a.length;c++)a[c].handler.call(this,n);let l=this.eventListeners[e];if(l)for(let c=r;c<l.length;c++)l[c].handler.call(this,n)}}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(e){let n=e?e.pointerId:void 0,i=this.getStage(),s=this.getAbsolutePosition();if(!i)return;let a=i._getPointerById(n)||i._changedPointerPositions[0]||s;Hn._dragElements.set(this._id,{node:this,startPointerPos:a,offset:{x:a.x-s.x,y:a.y-s.y},dragStatus:"ready",pointerId:n,startEvent:e})}startDrag(e,n=!0){if(!Hn._dragElements.has(this._id))this._createDragElement(e);let i=Hn._dragElements.get(this._id);i.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:i.startEvent&&i.startEvent.evt||e&&e.evt},n)}_setDragPosition(e,n){let i=this.getStage()._getPointerById(n.pointerId);if(!i)return;let s={x:i.x-n.offset.x,y:i.y-n.offset.y},a=this.dragBoundFunc();if(a!==void 0){let r=a.call(this,s,e);if(!r)Be.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.");else s=r}if(!this._lastPos||this._lastPos.x!==s.x||this._lastPos.y!==s.y)this.setAbsolutePosition(s),this._requestDraw();this._lastPos=s}stopDrag(e){let n=Hn._dragElements.get(this._id);if(n)n.dragStatus="stopped";Hn._endDragBefore(e),Hn._endDragAfter(e)}setDraggable(e){this._setAttr("draggable",e),this._dragChange()}isDragging(){let e=Hn._dragElements.get(this._id);return e?e.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(e){if(!(e.evt.button===void 0||Tt.dragButtons.indexOf(e.evt.button)>=0))return;if(this.isDragging())return;let s=!1;if(Hn._dragElements.forEach((a)=>{if(this.isAncestorOf(a.node))s=!0}),!s)this._createDragElement(e)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;let n=Hn._dragElements.get(this._id),i=n&&n.dragStatus==="dragging",s=n&&n.dragStatus==="ready";if(i)this.stopDrag();else if(s)Hn._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){let n=this.getStage();if(!n)return!1;let i={x:-e.x,y:-e.y,width:n.width()+2*e.x,height:n.height()+2*e.y};return Be.haveIntersection(i,this.getClientRect())}static create(e,n){if(Be._isString(e))e=JSON.parse(e);return this._createNode(e,n)}static _createNode(e,n){let i=wt.prototype.getClassName.call(e),s=e.children,a,r,l;if(n)e.attrs.container=n;if(!Tt[i])Be.warn('Can not find a node with class name "'+i+'". Fallback to "Shape".'),i="Shape";if(a=new Tt[i](e.attrs),s){r=s.length;for(l=0;l<r;l++)a.add(wt._createNode(s[l]))}return a}}wt._absTransformCascadeDepth=0;wt._pendingAfterCascade=[];wt.protoListenerMap=new Map;wt.prototype.nodeType="Node";wt.prototype._attrsAffectingSize=[];wt.prototype.eventListeners={};wt.prototype.on(UF,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(Wc),this._clearSelfAndDescendantCache(Rl)});wt.prototype.on("visibleChange.konva",function(){this._clearSelfAndDescendantCache(g3)});wt.prototype.on("listeningChange.konva",function(){this._clearSelfAndDescendantCache(m3)});wt.prototype.on("opacityChange.konva",function(){this._clearSelfAndDescendantCache(Ab)});var pi=_e.addGetterSetter;pi(wt,"zIndex");pi(wt,"absolutePosition");pi(wt,"position");pi(wt,"x",0,dt());pi(wt,"y",0,dt());pi(wt,"globalCompositeOperation","source-over",Fo());pi(wt,"opacity",1,dt());pi(wt,"name","",Fo());pi(wt,"id","",Fo());pi(wt,"rotation",0,dt());_e.addComponentsGetterSetter(wt,"scale",["x","y"]);pi(wt,"scaleX",1,dt());pi(wt,"scaleY",1,dt());_e.addComponentsGetterSetter(wt,"skew",["x","y"]);pi(wt,"skewX",0,dt());pi(wt,"skewY",0,dt());_e.addComponentsGetterSetter(wt,"offset",["x","y"]);pi(wt,"offsetX",0,dt());pi(wt,"offsetY",0,dt());pi(wt,"dragDistance",void 0,dt());pi(wt,"width",0,dt());pi(wt,"height",0,dt());pi(wt,"listening",!0,Hs());pi(wt,"preventDefault",!0,Hs());pi(wt,"filters",void 0,function(e){return this._filterUpToDate=!1,e});pi(wt,"visible",!0,Hs());pi(wt,"transformsEnabled","all",Fo());pi(wt,"size");pi(wt,"dragBoundFunc");pi(wt,"draggable",!1,Hs());_e.backCompat(wt,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});class ks extends wt{constructor(){super(...arguments);this.children=[]}getChildren(e){let n=this.children||[];if(e)return n.filter(e);return n}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach((e)=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach((e)=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(let i=0;i<e.length;i++)this.add(e[i]);return this}let n=e[0];if(n.getParent())return n.moveTo(this),this;return this._validateAdd(n),n.index=this.getChildren().length,n.parent=this,n._clearCaches(),this.getChildren().push(n),this._fire("add",{child:n}),this._requestDraw(),this}destroy(){if(this.hasChildren())this.destroyChildren();return super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){let n=this._generalFind(e,!0);return n.length>0?n[0]:void 0}_generalFind(e,n){let i=[];return this._descendants((s)=>{let a=s._isMatch(e);if(a)i.push(s);if(a&&n)return!0;return!1}),i}_descendants(e){let n=!1,i=this.getChildren();for(let s of i){if(n=e(s),n)return!0;if(!s.hasChildren())continue;if(n=s._descendants(e),n)return!0}return!1}toObject(){let e=wt.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach((n)=>{e.children.push(n.toObject())}),e}isAncestorOf(e){let n=e.getParent();while(n){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(e){let n=wt.prototype.clone.call(this,e);return this.getChildren().forEach(function(i){n.add(i.clone())}),n}getAllIntersections(e){let n=[];return this.find("Shape").forEach((i)=>{if(i.isVisible()&&i.intersects(e))n.push(i)}),n}_clearSelfAndDescendantCache(e){var n;let i=e==="absoluteTransform";if(i)wt._absTransformCascadeDepth++;try{if(super._clearSelfAndDescendantCache(e),this.isCached())return;(n=this.children)===null||n===void 0||n.forEach(function(s){s._clearSelfAndDescendantCache(e)})}finally{if(i&&--wt._absTransformCascadeDepth===0){let s=wt._pendingAfterCascade;if(s.length){wt._pendingAfterCascade=[];for(let a=0;a<s.length;a++)s[a]()}}}}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(n,i){n.index=i}),this._requestDraw()}drawScene(e,n,i){let s=this.getLayer(),a=e||s&&s.getCanvas(),r=a&&a.getContext(),l=this._getCanvasCache(),c=l&&l.scene,p=a&&a.isCache;if(!this.isVisible()&&!p)return this;if(c){r.save();let m=this.getAbsoluteTransform(n).getMatrix();r.transform(m[0],m[1],m[2],m[3],m[4],m[5]),this._drawCachedSceneCanvas(r),r.restore()}else this._drawChildren("drawScene",a,n,i);return this}drawHit(e,n){if(!this.shouldDrawHit(n))return this;let i=this.getLayer(),s=e||i&&i.hitCanvas,a=s&&s.getContext(),r=this._getCachedHitCanvas(n);if(r){a.save();let l=this.getAbsoluteTransform(n).getMatrix();a.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedHitCanvas(a,r),a.restore()}else this._drawChildren("drawHit",s,n);return this}_drawChildren(e,n,i,s){var a;let r=n&&n.getContext(),l=this.clipWidth(),c=this.clipHeight(),p=this.clipFunc(),m=typeof l==="number"&&typeof c==="number"||p,g=i===this;if(m){r.save();let x=this.getAbsoluteTransform(i),j=x.getMatrix();r.transform(j[0],j[1],j[2],j[3],j[4],j[5]),r.beginPath();let I;if(p)I=p.call(this,r,this);else{let P=this.clipX(),X=this.clipY();r.rect(P||0,X||0,l,c)}r.clip.apply(r,I),j=x.copy().invert().getMatrix(),r.transform(j[0],j[1],j[2],j[3],j[4],j[5])}let y=!g&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";if(y)r.save(),r._applyGlobalCompositeOperation(this);if((a=this.children)===null||a===void 0||a.forEach(function(x){x[e](n,i,s)}),y)r.restore();if(m)r.restore()}getClientRect(e={}){var n;let{skipTransform:i,relativeTo:s}=e,a,r,l,c,p={x:1/0,y:1/0,width:0,height:0},m=this;(n=this.children)===null||n===void 0||n.forEach(function(x){if(!x.visible())return;let j=x.getClientRect({relativeTo:m,skipShadow:e.skipShadow,skipStroke:e.skipStroke});if(j.width===0&&j.height===0)return;if(a===void 0)a=j.x,r=j.y,l=j.x+j.width,c=j.y+j.height;else a=Math.min(a,j.x),r=Math.min(r,j.y),l=Math.max(l,j.x+j.width),c=Math.max(c,j.y+j.height)});let g=this.find("Shape"),y=!1;for(let x=0;x<g.length;x++)if(g[x]._isVisible(this)){y=!0;break}if(y&&a!==void 0)p={x:a,y:r,width:l-a,height:c-r};else p={x:0,y:0,width:0,height:0};if(!i)return this._transformedRect(p,s);return p}}_e.addComponentsGetterSetter(ks,"clip",["x","y","width","height"]);_e.addGetterSetter(ks,"clipX",void 0,dt());_e.addGetterSetter(ks,"clipY",void 0,dt());_e.addGetterSetter(ks,"clipWidth",void 0,dt());_e.addGetterSetter(ks,"clipHeight",void 0,dt());_e.addGetterSetter(ks,"clipFunc");var Op=new Map,D_=Tt._global.PointerEvent!==void 0;function jb(e){return Op.get(e)}function Eb(e){return{evt:e,pointerId:e.pointerId}}function qb(e,n){return Op.get(e)===n}function Db(e,n){var i;wh(e);let s=n.getStage();if(!s)return;if(Op.set(e,n),D_){try{(i=s.content)===null||i===void 0||i.setPointerCapture(e)}catch(a){}n._fire("gotpointercapture",Eb(new PointerEvent("gotpointercapture")))}}function wh(e,n){var i;let s=Op.get(e);if(!s)return;let a=s.getStage();if(Op.delete(e),D_){try{(i=a===null||a===void 0?void 0:a.content)===null||i===void 0||i.releasePointerCapture(e)}catch(r){}s._fire("lostpointercapture",Eb(new PointerEvent("lostpointercapture")))}}var GF="Stage",VF="string",M_="px",XF="mouseout",B_="mouseleave",L_="mouseover",H_="mouseenter",z_="mousemove",G_="mousedown",V_="mouseup",Fp="pointermove",Np="pointerdown",bd="pointerup",Pp="pointercancel",WF="lostpointercapture",Ib="pointerout",Bp="pointerleave",Mb="pointerover",Rb="pointerenter",w3="contextmenu",X_="touchstart",W_="touchend",K_="touchmove",$_="touchcancel",y3="wheel",KF=5,$F=[[H_,"_pointerenter"],[G_,"_pointerdown"],[z_,"_pointermove"],[V_,"_pointerup"],[B_,"_pointerleave"],[X_,"_pointerdown"],[K_,"_pointermove"],[W_,"_pointerup"],[$_,"_pointercancel"],[L_,"_pointerover"],[y3,"_wheel"],[w3,"_contextmenu"],[Np,"_pointerdown"],[Fp,"_pointermove"],[bd,"_pointerup"],[Pp,"_pointercancel"],[Bp,"_pointerleave"],[WF,"_lostpointercapture"]],b3={mouse:{[Ib]:XF,[Bp]:B_,[Mb]:L_,[Rb]:H_,[Fp]:z_,[Np]:G_,[bd]:V_,[Pp]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[Ib]:"touchout",[Bp]:"touchleave",[Mb]:"touchover",[Rb]:"touchenter",[Fp]:K_,[Np]:X_,[bd]:W_,[Pp]:$_,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[Ib]:Ib,[Bp]:Bp,[Mb]:Mb,[Rb]:Rb,[Fp]:Fp,[Np]:Np,[bd]:bd,[Pp]:Pp,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},Hp=(e)=>{if(e.indexOf("pointer")>=0)return"pointer";if(e.indexOf("touch")>=0)return"touch";return"mouse"},gd=(e)=>{let n=Hp(e);if(n==="pointer")return Tt.pointerEventsEnabled&&b3.pointer;if(n==="touch")return b3.touch;if(n==="mouse")return b3.mouse};function R_(e={}){if(e.clipFunc||e.clipWidth||e.clipHeight)Be.warn("Stage does not support clipping. Please use clip for Layers or Groups.");return e}var YF="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);",wd=[],O_=new WeakSet,F_=(e)=>{if(!e||O_.has(e))return;O_.add(e),Hn._listenToWindow(e),e.document.addEventListener("visibilitychange",()=>{wd.forEach((n)=>{n.batchDraw()})})};class yd extends ks{constructor(e){super(R_(e));this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),wd.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{R_(this.attrs)}),this._checkVisibility()}_validateAdd(e){let n=e.getType()==="Layer",i=e.getType()==="FastLayer";if(!(n||i))Be.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;let e=this.visible()?"":"none";this.content.style.display=e}_getOwnerWindow(){var e;let n=this.content||this.container();return((e=n===null||n===void 0?void 0:n.ownerDocument)===null||e===void 0?void 0:e.defaultView)||(Tt.isBrowser?window:null)}setContainer(e){if(typeof e===VF){let n;if(e.charAt(0)==="."){let i=e.slice(1);e=document.getElementsByClassName(i)[0]}else{if(e.charAt(0)!=="#")n=e;else n=e.slice(1);e=document.getElementById(n)}if(!e)throw"Can not find container in document with id "+n}if(this._setAttr("container",e),this.content){if(this.content.parentElement)this.content.parentElement.removeChild(this.content);e.appendChild(this.content),F_(this._getOwnerWindow())}return this}shouldDrawHit(){return!0}clear(){let e=this.children,n=e.length;for(let i=0;i<n;i++)e[i].clear();return this}clone(e){if(!e)e={};return e.container=typeof document<"u"&&document.createElement("div"),ks.prototype.clone.call(this,e)}destroy(){super.destroy();let e=this.content;if(e&&Be._isInDocument(e))this.container().removeChild(e);let n=wd.indexOf(this);if(n>-1)wd.splice(n,1);return Be.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){let e=this._pointerPositions[0]||this._changedPointerPositions[0];if(!e)return Be.warn(YF),null;return{x:e.x,y:e.y}}_getPointerById(e){return this._pointerPositions.find((n)=>n.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){e={...e},e.x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();let n=new Er({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),i=n.getContext()._context,s=this.children;if(e.x||e.y)i.translate(-1*e.x,-1*e.y);return s.forEach(function(a){if(!a.isVisible())return;let r=a._toKonvaCanvas(e);i.drawImage(r._canvas,e.x,e.y,r.getWidth()/r.getPixelRatio(),r.getHeight()/r.getPixelRatio())}),n}getIntersection(e){if(!e)return null;let n=this.children,i=n.length,s=i-1;for(let a=s;a>=0;a--){let r=n[a].getIntersection(e);if(r)return r}return null}_resizeDOM(){let e=this.width(),n=this.height();if(this.content)this.content.style.width=e+M_,this.content.style.height=n+M_;this.children.forEach((i)=>{i.setSize({width:e,height:n}),i.draw()})}_syncBufferSize(e){return e.setSizeIfChanged(this.width(),this.height()),e}add(e,...n){if(arguments.length>1){for(let s=0;s<arguments.length;s++)this.add(arguments[s]);return this}super.add(e);let i=this.children.length;if(i>KF)Be.warn("The stage has "+i+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group.");if(e.setSize({width:this.width(),height:this.height()}),e.draw(),Tt.isBrowser)this.content.appendChild(e.canvas._canvas);return this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return qb(e,this)}setPointerCapture(e){Db(e,this)}releaseCapture(e){wh(e,this)}getLayers(){return this.children}_bindContentEvents(){if(!Tt.isBrowser)return;$F.forEach(([e,n])=>{this.content.addEventListener(e,(i)=>{this[n](i)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);let n=gd(e.type);if(n)this._fire(n.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);let n=gd(e.type);if(n)this._fire(n.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let n=this[e+"targetShape"];if(n&&!n.getStage())n=null;return n}_pointerleave(e){let n=gd(e.type),i=Hp(e.type);if(!n)return;this.setPointersPositions(e);let s=this._getTargetShape(i),a=!(Tt.isDragging()||Tt.isTransforming())||Tt.hitOnDragEnabled;if(s&&a)s._fireAndBubble(n.pointerout,{evt:e}),s._fireAndBubble(n.pointerleave,{evt:e}),this._fire(n.pointerleave,{evt:e,target:this,currentTarget:this}),this[i+"targetShape"]=null;else if(a)this._fire(n.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(n.pointerout,{evt:e,target:this,currentTarget:this});this.pointerPos=null,this._pointerPositions=[]}_pointerdown(e){let n=gd(e.type),i=Hp(e.type);if(!n)return;this.setPointersPositions(e);let s=!1;if(this._changedPointerPositions.forEach((a)=>{let r=this.getIntersection(a);if(Hn.justDragged=!1,Tt["_"+i+"ListenClick"]=!0,!r||!r.isListening()){this[i+"ClickStartShape"]=void 0;return}if(Tt.capturePointerEventsEnabled)r.setPointerCapture(a.id);this[i+"ClickStartShape"]=r,r._fireAndBubble(n.pointerdown,{evt:e,pointerId:a.id}),s=!0;let l=e.type.indexOf("touch")>=0;if(r.preventDefault()&&e.cancelable&&l)e.preventDefault()}),!s)this._fire(n.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(e){let n=gd(e.type),i=Hp(e.type);if(!n)return;let s=e.type.indexOf("touch")>=0||e.pointerType==="touch";if(Tt.isDragging()&&Hn.node.preventDefault()&&e.cancelable&&s)e.preventDefault();if(this.setPointersPositions(e),!(!(Tt.isDragging()||Tt.isTransforming())||Tt.hitOnDragEnabled))return;let r={},l=!1,c=this._getTargetShape(i);if(this._changedPointerPositions.forEach((p)=>{let m=jb(p.id)||this.getIntersection(p),g=p.id,y={evt:e,pointerId:g},x=c!==m;if(x&&c)c._fireAndBubble(n.pointerout,{...y},m),c._fireAndBubble(n.pointerleave,{...y},m);if(m){if(r[m._id])return;r[m._id]=!0}if(m&&m.isListening()){if(l=!0,x)m._fireAndBubble(n.pointerover,{...y},c),m._fireAndBubble(n.pointerenter,{...y},c),this[i+"targetShape"]=m;m._fireAndBubble(n.pointermove,{...y})}else if(c)this._fire(n.pointerover,{evt:e,target:this,currentTarget:this,pointerId:g}),this[i+"targetShape"]=null}),!l)this._fire(n.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){let n=gd(e.type),i=Hp(e.type);if(!n)return;this.setPointersPositions(e);let s=Hn.justDragged||i==="pointer"&&Tt.isDragging(),a=Tt["_"+i+"ListenClick"]&&!s,r=this[i+"ClickStartShape"],l=this[i+"ClickEndShape"],c={},p=!1;if(this._changedPointerPositions.forEach((m)=>{let g=jb(m.id)||this.getIntersection(m);if(g){if(g.releaseCapture(m.id),c[g._id])return;c[g._id]=!0}let y=m.id,x={evt:e,pointerId:y},j=!1;if(Tt["_"+i+"InDblClickWindow"])j=!0,clearTimeout(this[i+"DblTimeout"]);else if(!s)Tt["_"+i+"InDblClickWindow"]=!0,clearTimeout(this[i+"DblTimeout"]);if(this[i+"DblTimeout"]=setTimeout(function(){Tt["_"+i+"InDblClickWindow"]=!1},Tt.dblClickWindow),g&&g.isListening()){if(p=!0,this[i+"ClickEndShape"]=g,g._fireAndBubble(n.pointerup,{...x}),a&&r===g){if(g._fireAndBubble(n.pointerclick,{...x}),j&&l&&l===g)g._fireAndBubble(n.pointerdblclick,{...x})}}else{if(this[i+"ClickEndShape"]=null,!p)this._fire(n.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),p=!0;if(a)this._fire(n.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:y});if(j)this._fire(n.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:y})}}),!p)this._fire(n.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id});if(Tt["_"+i+"ListenClick"]=!1,e.cancelable&&i!=="touch"&&i!=="pointer")e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);let n=this.getIntersection(this.getPointerPosition());if(n&&n.isListening())n._fireAndBubble(w3,{evt:e});else this._fire(w3,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);let n=this.getIntersection(this.getPointerPosition());if(n&&n.isListening())n._fireAndBubble(y3,{evt:e});else this._fire(y3,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);let n=jb(e.pointerId)||this.getIntersection(this.getPointerPosition());if(n)n._fireAndBubble(bd,Eb(e));wh(e.pointerId)}_lostpointercapture(e){wh(e.pointerId)}setPointersPositions(e){let n=this._getContentPosition(),i=null,s=null;if(e=e?e:window.event,e.touches!==void 0)this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,(a)=>{this._pointerPositions.push({id:a.identifier,x:(a.clientX-n.left)/n.scaleX,y:(a.clientY-n.top)/n.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,(a)=>{this._changedPointerPositions.push({id:a.identifier,x:(a.clientX-n.left)/n.scaleX,y:(a.clientY-n.top)/n.scaleY})});else i=(e.clientX-n.left)/n.scaleX,s=(e.clientY-n.top)/n.scaleY,this.pointerPos={x:i,y:s},this._pointerPositions=[{x:i,y:s,id:Be._getFirstPointerId(e)}],this._changedPointerPositions=[{x:i,y:s,id:Be._getFirstPointerId(e)}]}_setPointerPosition(e){Be.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};let e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new Er({width:0,height:0}),this.bufferHitCanvas=new gh({pixelRatio:1,width:0,height:0}),!Tt.isBrowser)return;let e=this.container();if(!e)throw"Stage has no container. A container is required.";e.innerHTML="",this.content=e.ownerDocument.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),e.appendChild(this.content),F_(this._getOwnerWindow()),this._resizeDOM()}cache(){return Be.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(e){e.batchDraw()}),this}}yd.prototype.nodeType=GF;mn(yd);_e.addGetterSetter(yd,"container");var Q_="hasShadow",J_="shadowRGBA",Z_="patternImage",ex="linearGradient",tx="radialGradient",Ob;function v3(){if(Ob)return Ob;return Ob=Be.createCanvasElement().getContext("2d"),Ob}var yh={};function QF(e){let n=this.attrs.fillRule;if(n)e.fill(n);else e.fill()}function JF(e){e.stroke()}function ZF(e){let n=this.attrs.fillRule;if(n)e.fill(n);else e.fill()}function eN(e){e.stroke()}function tN(){this._clearCache(Q_)}function nN(){this._clearCache(J_)}function iN(){this._clearCache(Z_)}function sN(){this._clearCache(ex)}function aN(){this._clearCache(tx)}class _t extends wt{constructor(e){super(e);let n,i=0;while(!0){if(n=Be.getHitColor(),n&&!(n in yh))break;if(i++,i>=1e4){Be.warn("Failed to find a unique color key for a shape. Konva may work incorrectly. Most likely your browser is using canvas farbling. Consider disabling it."),n=Be.getRandomColor();break}}this.colorKey=n,yh[n]=this}getContext(){return Be.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return Be.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(Q_,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(Z_,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){let n=v3().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(n&&n.setTransform){let i=new Ps;i.translate(this.fillPatternX(),this.fillPatternY()),i.rotate(Tt.getAngle(this.fillPatternRotation())),i.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),i.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());let s=i.getMatrix(),a=typeof DOMMatrix>"u"?{a:s[0],b:s[1],c:s[2],d:s[3],e:s[4],f:s[5]}:new DOMMatrix(s);n.setTransform(a)}return n}}_getLinearGradient(){return this._getCache(ex,this.__getLinearGradient)}__getLinearGradient(){let e=this.fillLinearGradientColorStops();if(e){let n=v3(),i=this.fillLinearGradientStartPoint(),s=this.fillLinearGradientEndPoint(),a=n.createLinearGradient(i.x,i.y,s.x,s.y);for(let r=0;r<e.length;r+=2)a.addColorStop(e[r],e[r+1]);return a}}_getRadialGradient(){return this._getCache(tx,this.__getRadialGradient)}__getRadialGradient(){let e=this.fillRadialGradientColorStops();if(e){let n=v3(),i=this.fillRadialGradientStartPoint(),s=this.fillRadialGradientEndPoint(),a=n.createRadialGradient(i.x,i.y,this.fillRadialGradientStartRadius(),s.x,s.y,this.fillRadialGradientEndRadius());for(let r=0;r<e.length;r+=2)a.addColorStop(e[r],e[r+1]);return a}}getShadowRGBA(){return this._getCache(J_,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;let e=Be.colorToRGBA(this.shadowColor());if(e)return"rgba("+e.r+","+e.g+","+e.b+","+e.a*(this.shadowOpacity()||1)+")"}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){let e=this.hitStrokeWidth();if(e==="auto")return this.hasStroke();return this.strokeEnabled()&&!!e}intersects(e){let n=this.getStage();if(!n)return!1;let i=n._syncBufferSize(n.bufferHitCanvas);return i.getContext().clear(),this.drawHit(i,void 0,!0),i.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return wt.prototype.destroy.call(this),delete yh[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var n;if(!((n=this.attrs.perfectDrawEnabled)!==null&&n!==void 0?n:!0))return!1;let s=e||this.hasFill(),a=this.hasStroke(),r=this.getAbsoluteOpacity()!==1;if(s&&a&&r)return!0;let l=this.hasShadow(),c=this.shadowForStrokeEnabled();if(s&&a&&l&&c)return!0;return!1}setStrokeHitEnabled(e){if(Be.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e)this.hitStrokeWidth("auto");else this.hitStrokeWidth(0)}getStrokeHitEnabled(){if(this.hitStrokeWidth()===0)return!1;else return!0}getSelfRect(){let e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){let n=!1,i=this.getParent();while(i){if(i.isCached()){n=!0;break}i=i.getParent()}let s=e.skipTransform,a=e.relativeTo||n&&this.getStage()||void 0,r=this.getSelfRect(),c=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,p=r.width+c,m=r.height+c,g=!e.skipShadow&&this.hasShadow(),y=g?this.shadowOffsetX():0,x=g?this.shadowOffsetY():0,j=p+Math.abs(y),I=m+Math.abs(x),P=g&&this.shadowBlur()||0,X=j+P*2,Y=I+P*2,J={width:X,height:Y,x:-(c/2+P)+Math.min(y,0)+r.x,y:-(c/2+P)+Math.min(x,0)+r.y};if(!s)return this._transformedRect(J,a);return J}drawScene(e,n,i){let s=this.getLayer(),a=e||s.getCanvas(),r=a.getContext(),l=this._getCanvasCache(),c=this.getSceneFunc(),p=this.hasShadow(),m,g=!1,y=n===this;if(!this.isVisible()&&!y)return this;if(l){r.save();let x=this.getAbsoluteTransform(n).getMatrix();return r.transform(x[0],x[1],x[2],x[3],x[4],x[5]),this._drawCachedSceneCanvas(r),r.restore(),this}if(!c)return this;if(r.save(),this._useBufferCanvas()){m=this.getStage();let x=i||m._syncBufferSize(m.bufferCanvas),j=x.getContext();if(i)j.save(),j.setTransform(1,0,0,1,0,0),j.clearRect(0,0,x.width,x.height),j.restore();else j.clear();j.save(),j.imageSmoothingEnabled=r.imageSmoothingEnabled,j._applyLineJoin(this),j._applyMiterLimit(this);let I=this.getAbsoluteTransform(n).getMatrix();j.transform(I[0],I[1],I[2],I[3],I[4],I[5]),c.call(this,j,this),j.restore();let P=x.pixelRatio;if(p)r._applyShadow(this);if(!y)r._applyOpacity(this),r._applyGlobalCompositeOperation(this);r.drawImage(x._canvas,x.x||0,x.y||0,x.width/P,x.height/P)}else{if(r._applyLineJoin(this),r._applyMiterLimit(this),!y){let x=this.getAbsoluteTransform(n).getMatrix();r.transform(x[0],x[1],x[2],x[3],x[4],x[5]),r._applyOpacity(this),r._applyGlobalCompositeOperation(this)}if(p)r._applyShadow(this);c.call(this,r,this)}return r.restore(),this}drawHit(e,n,i=!1){if(!this.shouldDrawHit(n,i))return this;let s=this.getLayer(),a=e||s.hitCanvas,r=a&&a.getContext(),l=this.hitFunc()||this.sceneFunc(),c=this._getCachedHitCanvas(n);if(!this.colorKey)Be.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()");if(c){r.save();let m=this.getAbsoluteTransform(n).getMatrix();return r.transform(m[0],m[1],m[2],m[3],m[4],m[5]),this._drawCachedHitCanvas(r,c),r.restore(),this}if(!l)return this;if(r.save(),r._applyLineJoin(this),r._applyMiterLimit(this),this!==n){let m=this.getAbsoluteTransform(n).getMatrix();r.transform(m[0],m[1],m[2],m[3],m[4],m[5])}return l.call(this,r,this),r.restore(),this}drawHitFromCache(e=0){let n=this._getCachedSceneCanvas(),i=this._getCachedHitCanvas(),s=i.getContext(),a=i.getWidth(),r=i.getHeight();s.clear(),s.drawImage(n._canvas,0,0,a,r);try{let l=s.getImageData(0,0,a,r),c=l.data,p=c.length,m=Be._hexToRgb(this.colorKey);for(let g=0;g<p;g+=4)if(c[g+3]>e)c[g]=m.r,c[g+1]=m.g,c[g+2]=m.b,c[g+3]=255;else c[g+3]=0;s.putImageData(l,0,0)}catch(l){Be.error("Unable to draw hit graph from cached scene canvas. "+l.message)}return this}hasPointerCapture(e){return qb(e,this)}setPointerCapture(e){Db(e,this)}releaseCapture(e){wh(e,this)}}_t.prototype._fillFunc=QF;_t.prototype._strokeFunc=JF;_t.prototype._fillFuncHit=ZF;_t.prototype._strokeFuncHit=eN;_t.prototype._centroid=!1;_t.prototype.nodeType="Shape";mn(_t);_t.prototype.eventListeners={};_t.prototype.on("shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",tN);_t.prototype.on("shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",nN);_t.prototype.on("fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",iN);_t.prototype.on("fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",sN);_t.prototype.on("fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",aN);_e.addGetterSetter(_t,"stroke",void 0,p3());_e.addGetterSetter(_t,"strokeWidth",2,dt());_e.addGetterSetter(_t,"fillAfterStrokeEnabled",!1);_e.addGetterSetter(_t,"hitStrokeWidth","auto",Ip());_e.addGetterSetter(_t,"strokeHitEnabled",!0,Hs());_e.addGetterSetter(_t,"perfectDrawEnabled",!0,Hs());_e.addGetterSetter(_t,"shadowForStrokeEnabled",!0,Hs());_e.addGetterSetter(_t,"lineJoin");_e.addGetterSetter(_t,"lineCap");_e.addGetterSetter(_t,"miterLimit");_e.addGetterSetter(_t,"sceneFunc");_e.addGetterSetter(_t,"hitFunc");_e.addGetterSetter(_t,"dash");_e.addGetterSetter(_t,"dashOffset",0,dt());_e.addGetterSetter(_t,"shadowColor",void 0,Fo());_e.addGetterSetter(_t,"shadowBlur",0,dt());_e.addGetterSetter(_t,"shadowOpacity",1,dt());_e.addComponentsGetterSetter(_t,"shadowOffset",["x","y"]);_e.addGetterSetter(_t,"shadowOffsetX",0,dt());_e.addGetterSetter(_t,"shadowOffsetY",0,dt());_e.addGetterSetter(_t,"fillPatternImage");_e.addGetterSetter(_t,"fill",void 0,p3());_e.addGetterSetter(_t,"fillPatternX",0,dt());_e.addGetterSetter(_t,"fillPatternY",0,dt());_e.addGetterSetter(_t,"fillLinearGradientColorStops");_e.addGetterSetter(_t,"strokeLinearGradientColorStops");_e.addGetterSetter(_t,"fillRadialGradientStartRadius",0);_e.addGetterSetter(_t,"fillRadialGradientEndRadius",0);_e.addGetterSetter(_t,"fillRadialGradientColorStops");_e.addGetterSetter(_t,"fillPatternRepeat","repeat");_e.addGetterSetter(_t,"fillEnabled",!0);_e.addGetterSetter(_t,"strokeEnabled",!0);_e.addGetterSetter(_t,"shadowEnabled",!0);_e.addGetterSetter(_t,"dashEnabled",!0);_e.addGetterSetter(_t,"strokeScaleEnabled",!0);_e.addGetterSetter(_t,"fillPriority","color");_e.addComponentsGetterSetter(_t,"fillPatternOffset",["x","y"]);_e.addGetterSetter(_t,"fillPatternOffsetX",0,dt());_e.addGetterSetter(_t,"fillPatternOffsetY",0,dt());_e.addComponentsGetterSetter(_t,"fillPatternScale",["x","y"]);_e.addGetterSetter(_t,"fillPatternScaleX",1,dt());_e.addGetterSetter(_t,"fillPatternScaleY",1,dt());_e.addComponentsGetterSetter(_t,"fillLinearGradientStartPoint",["x","y"]);_e.addComponentsGetterSetter(_t,"strokeLinearGradientStartPoint",["x","y"]);_e.addGetterSetter(_t,"fillLinearGradientStartPointX",0);_e.addGetterSetter(_t,"strokeLinearGradientStartPointX",0);_e.addGetterSetter(_t,"fillLinearGradientStartPointY",0);_e.addGetterSetter(_t,"strokeLinearGradientStartPointY",0);_e.addComponentsGetterSetter(_t,"fillLinearGradientEndPoint",["x","y"]);_e.addComponentsGetterSetter(_t,"strokeLinearGradientEndPoint",["x","y"]);_e.addGetterSetter(_t,"fillLinearGradientEndPointX",0);_e.addGetterSetter(_t,"strokeLinearGradientEndPointX",0);_e.addGetterSetter(_t,"fillLinearGradientEndPointY",0);_e.addGetterSetter(_t,"strokeLinearGradientEndPointY",0);_e.addComponentsGetterSetter(_t,"fillRadialGradientStartPoint",["x","y"]);_e.addGetterSetter(_t,"fillRadialGradientStartPointX",0);_e.addGetterSetter(_t,"fillRadialGradientStartPointY",0);_e.addComponentsGetterSetter(_t,"fillRadialGradientEndPoint",["x","y"]);_e.addGetterSetter(_t,"fillRadialGradientEndPointX",0);_e.addGetterSetter(_t,"fillRadialGradientEndPointY",0);_e.addGetterSetter(_t,"fillPatternRotation",0);_e.addGetterSetter(_t,"fillRule",void 0,Fo());_e.backCompat(_t,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var rN="beforeDraw",oN="draw",nx=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],lN=nx.length;class No extends ks{constructor(e){super(e);this.canvas=new Er,this.hitCanvas=new gh({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);let n=this.getStage();if(n&&n.content)if(n.content.removeChild(this.getNativeCanvasElement()),e<n.children.length-1)n.content.insertBefore(this.getNativeCanvasElement(),n.children[e+1].getCanvas()._canvas);else n.content.appendChild(this.getNativeCanvasElement());return this}moveToTop(){wt.prototype.moveToTop.call(this);let e=this.getStage();if(e&&e.content)e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement());return!0}moveUp(){if(!wt.prototype.moveUp.call(this))return!1;let n=this.getStage();if(!n||!n.content)return!1;if(n.content.removeChild(this.getNativeCanvasElement()),this.index<n.children.length-1)n.content.insertBefore(this.getNativeCanvasElement(),n.children[this.index+1].getCanvas()._canvas);else n.content.appendChild(this.getNativeCanvasElement());return!0}moveDown(){if(wt.prototype.moveDown.call(this)){let e=this.getStage();if(e){let n=e.children;if(e.content)e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),n[this.index+1].getCanvas()._canvas)}return!0}return!1}moveToBottom(){if(wt.prototype.moveToBottom.call(this)){let e=this.getStage();if(e){let n=e.children;if(e.content)e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),n[1].getCanvas()._canvas)}return!0}return!1}getLayer(){return this}remove(){let e=this.getNativeCanvasElement();if(wt.prototype.remove.call(this),e&&e.parentNode&&Be._isInDocument(e))e.parentNode.removeChild(e);return this}getStage(){return this.parent}setSize({width:e,height:n}){return this.canvas.setSize(e,n),this._syncHitCanvasSize(),this._setSmoothEnabled(),this}_syncHitCanvasSize(){let e=this.isListening();this.hitCanvas.setSizeIfChanged((e?this.getWidth():0)||0,(e?this.getHeight():0)||0)}_validateAdd(e){let n=e.getType();if(n!=="Group"&&n!=="Shape")Be.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(e){return e={...e},e.width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=e.x!==void 0?e.x:this.x(),e.y=e.y!==void 0?e.y:this.y(),wt.prototype._toKonvaCanvas.call(this,e)}_checkVisibility(){if(this.visible())this.canvas._canvas.style.display="block";else this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){Be.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){Be.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){var e;if(!this._waitingForDraw)this._waitingForDraw=!0,Be.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1},(e=this.getStage())===null||e===void 0?void 0:e._getOwnerWindow());return this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;let n=1,i=!1;while(!0){for(let s=0;s<lN;s++){let a=nx[s],r=this._getIntersection({x:e.x+a.x*n,y:e.y+a.y*n}),l=r.shape;if(l)return l;if(i=!!r.antialiased,!r.antialiased)break}if(i)n+=1;else return null}}_getIntersection(e){if(!this.hitCanvas.width||!this.hitCanvas.height)return{};let n=this.hitCanvas.pixelRatio,i=this.hitCanvas.context.getImageData(Math.round(e.x*n),Math.round(e.y*n),1,1).data,s=i[3];if(s===255){let a=Be.getHitColorKey(i[0],i[1],i[2]),r=yh[a];if(r)return{shape:r};return{antialiased:!0}}else if(s>0)return{antialiased:!0};return{}}drawScene(e,n,i){let s=this.getLayer(),a=e||s&&s.getCanvas();if(this._fire(rN,{node:this}),this.clearBeforeDraw())a.getContext().clear();return ks.prototype.drawScene.call(this,a,n,i),this._fire(oN,{node:this}),this}drawHit(e,n){let i=this.getLayer(),s=e||i&&i.hitCanvas;if(!e&&i){if(i._syncHitCanvasSize(),i.clearBeforeDraw())i.getHitCanvas().getContext().clear()}return ks.prototype.drawHit.call(this,s,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){Be.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return Be.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;let e=this.parent;if(!!this.hitCanvas._canvas.parentNode)e.content.removeChild(this.hitCanvas._canvas);else e.content.appendChild(this.hitCanvas._canvas)}destroy(){return Be.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}No.prototype.nodeType="Layer";mn(No);_e.addGetterSetter(No,"imageSmoothingEnabled",!0);_e.addGetterSetter(No,"clearBeforeDraw",!0);_e.addGetterSetter(No,"hitGraphEnabled",!0,Hs());class Up extends No{constructor(e){super(e);this.listening(!1),Be.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}Up.prototype.nodeType="FastLayer";mn(Up);class Po extends ks{_validateAdd(e){let n=e.getType();if(n!=="Group"&&n!=="Shape")Be.throw("You may only add groups and shapes to groups.")}}Po.prototype.nodeType="Group";mn(Po);var S3=function(){if(Gc.performance&&Gc.performance.now)return function(){return Gc.performance.now()};return function(){return new Date().getTime()}}();class da{constructor(e,n){this.id=da.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:S3(),frameRate:0},this.func=e,this.setLayers(n)}setLayers(e){let n=[];if(e)n=Array.isArray(e)?e:[e];return this.layers=n,this}getLayers(){return this.layers}addLayer(e){let n=this.layers,i=n.length;for(let s=0;s<i;s++)if(n[s]._id===e._id)return!1;return this.layers.push(e),!0}isRunning(){let n=da.animations,i=n.length;for(let s=0;s<i;s++)if(n[s].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=S3(),da._addAnimation(this),this}stop(){return da._removeAnimation(this),this}_updateFrameObject(e){this.frame.timeDiff=e-this.frame.lastTime,this.frame.lastTime=e,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1000/this.frame.timeDiff}static _addAnimation(e){this.animations.push(e),this._handleAnimation()}static _removeAnimation(e){let n=e.id,i=this.animations,s=i.length;for(let a=0;a<s;a++)if(i[a].id===n){this.animations.splice(a,1);break}}static _runFrames(){let e={},n=this.animations;for(let i=0;i<n.length;i++){let s=n[i],{layers:a,func:r}=s;s._updateFrameObject(S3());let l=a.length,c;if(r)c=r.call(s,s.frame)!==!1;else c=!0;if(!c)continue;for(let p=0;p<l;p++){let m=a[p];if(m._id!==void 0)e[m._id]=m}}for(let i in e){if(!e.hasOwnProperty(i))continue;e[i].batchDraw()}}static _animationLoop(){let e=da;if(e.animations.length)e._runFrames(),Be.requestAnimFrame(e._animationLoop);else e.animRunning=!1}static _handleAnimation(){if(!this.animRunning)this.animRunning=!0,Be.requestAnimFrame(this._animationLoop)}}da.animations=[];da.animIdCounter=0;da.animRunning=!1;var cN={node:1,duration:1,easing:1,onFinish:1,yoyo:1},uN=1,ix=2,sx=3,ax=["fill","stroke","shadowColor"],hN=0;function Fb(e){return Be.colorToRGBA(e)||Be.throw('can not tween the color "'+e+'", because it is not a valid color.')}class rx{constructor(e,n,i,s,a,r,l){this.prop=e,this.propFunc=n,this.begin=s,this._pos=s,this.duration=r,this._change=0,this.prevPos=0,this.yoyo=l,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=i,this._change=a-this.begin,this.pause()}fire(e){let n=this[e];if(n)n()}setTime(e){if(e>this.duration)if(this.yoyo)this._time=this.duration,this.reverse();else this.finish();else if(e<0)if(this.yoyo)this._time=0,this.play();else this.reset();else this._time=e,this.update()}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){if(e===void 0)e=this._time;return this.func(e,this.begin,this._change,this.duration)}play(){this.state=ix,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=sx,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){let e=this.getTimer()-this._startTime;if(this.state===ix)this.setTime(e);else if(this.state===sx)this.setTime(this.duration-e)}pause(){this.state=uN,this.fire("onPause")}getTimer(){return new Date().getTime()}}class mi{constructor(e){let n=this,i=e.node,s=i._id,a=e.easing||vd.Linear,r=!!e.yoyo,l,c;if(typeof e.duration>"u")l=0.3;else if(e.duration===0)l=0.001;else l=e.duration;this.node=i,this._id=hN++;let p=i.getLayer()||(i instanceof Tt.Stage?i.getLayers():null);if(!p)Be.error("Tween constructor have `node` that is not in a layer. Please add node into layer first.");if(this.anim=new da(function(){n.tween.onEnterFrame()},p),this.tween=new rx(c,function(m){n._tweenFunc(m)},a,0,1,l*1000,r),this._addListeners(),!mi.attrs[s])mi.attrs[s]={};if(!mi.attrs[s][this._id])mi.attrs[s][this._id]={};if(!mi.tweens[s])mi.tweens[s]={};for(c in e)if(cN[c]===void 0)this._addAttr(c,e[c]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,n){let i=this.node,s=i._id,a,r,l,c,p,m=mi.tweens[s][e];if(m)delete mi.attrs[s][m][e];let g=i.getAttr(e);if(Be._isArray(n)){if(a=[],r=Math.max(n.length,g.length),e==="points"&&n.length!==g.length)if(n.length>g.length)c=g,g=Be._prepareArrayForTween(g,n,i.closed());else l=n,n=Be._prepareArrayForTween(n,g,i.closed());if(e.indexOf("fill")===0)for(let y=0;y<r;y++)if(y%2===0)a.push(n[y]-g[y]);else{let x=Fb(g[y]);p=Fb(n[y]),g[y]=x,a.push({r:p.r-x.r,g:p.g-x.g,b:p.b-x.b,a:p.a-x.a})}else for(let y=0;y<r;y++)a.push(n[y]-g[y])}else if(ax.indexOf(e)!==-1)g=Fb(g),p=Fb(n),a={r:p.r-g.r,g:p.g-g.g,b:p.b-g.b,a:p.a-g.a};else a=n-g;mi.attrs[s][this._id][e]={start:g,diff:a,end:n,trueEnd:l,trueStart:c},mi.tweens[s][e]=this._id}_tweenFunc(e){let n=this.node,i=mi.attrs[n._id][this._id],s,a,r,l,c,p,m,g;for(s in i){if(a=i[s],r=a.start,l=a.diff,g=a.end,Be._isArray(r))if(c=[],m=Math.max(r.length,g.length),s.indexOf("fill")===0)for(p=0;p<m;p++)if(p%2===0)c.push((r[p]||0)+l[p]*e);else c.push("rgba("+Math.round(r[p].r+l[p].r*e)+","+Math.round(r[p].g+l[p].g*e)+","+Math.round(r[p].b+l[p].b*e)+","+(r[p].a+l[p].a*e)+")");else for(p=0;p<m;p++)c.push((r[p]||0)+l[p]*e);else if(ax.indexOf(s)!==-1)c="rgba("+Math.round(r.r+l.r*e)+","+Math.round(r.g+l.g*e)+","+Math.round(r.b+l.b*e)+","+(r.a+l.a*e)+")";else c=r+l*e;n.setAttr(s,c)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{let e=this.node,n=mi.attrs[e._id][this._id];if(n.points&&n.points.trueEnd)e.setAttr("points",n.points.trueEnd);if(this.onFinish)this.onFinish.call(this)},this.tween.onReset=()=>{let e=this.node,n=mi.attrs[e._id][this._id];if(n.points&&n.points.trueStart)e.points(n.points.trueStart);if(this.onReset)this.onReset()},this.tween.onUpdate=()=>{if(this.onUpdate)this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(e){return this.tween.seek(e*1000),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){let e=this.node._id,n=this._id,i=mi.tweens[e];if(this.pause(),this.anim)this.anim.stop();for(let s in i)delete mi.tweens[e][s];if(delete mi.attrs[e][n],mi.tweens[e]){if(Object.keys(mi.tweens[e]).length===0)delete mi.tweens[e];if(Object.keys(mi.attrs[e]).length===0)delete mi.attrs[e]}}}mi.attrs={};mi.tweens={};wt.prototype.to=function(e){let n=e.onFinish;e.node=this,e.onFinish=function(){if(this.destroy(),n)n()},new mi(e).play()};var vd={BackEaseIn(e,n,i,s){return i*(e/=s)*e*(2.70158*e-1.70158)+n},BackEaseOut(e,n,i,s){return i*((e=e/s-1)*e*(2.70158*e+1.70158)+1)+n},BackEaseInOut(e,n,i,s){let a=1.70158;if((e/=s/2)<1)return i/2*(e*e*(((a*=1.525)+1)*e-a))+n;return i/2*((e-=2)*e*(((a*=1.525)+1)*e+a)+2)+n},ElasticEaseIn(e,n,i,s,a,r){let l=0;if(e===0)return n;if((e/=s)===1)return n+i;if(!r)r=s*0.3;if(!a||a<Math.abs(i))a=i,l=r/4;else l=r/(2*Math.PI)*Math.asin(i/a);return-(a*Math.pow(2,10*(e-=1))*Math.sin((e*s-l)*(2*Math.PI)/r))+n},ElasticEaseOut(e,n,i,s,a,r){let l=0;if(e===0)return n;if((e/=s)===1)return n+i;if(!r)r=s*0.3;if(!a||a<Math.abs(i))a=i,l=r/4;else l=r/(2*Math.PI)*Math.asin(i/a);return a*Math.pow(2,-10*e)*Math.sin((e*s-l)*(2*Math.PI)/r)+i+n},ElasticEaseInOut(e,n,i,s,a,r){let l=0;if(e===0)return n;if((e/=s/2)===2)return n+i;if(!r)r=s*0.44999999999999996;if(!a||a<Math.abs(i))a=i,l=r/4;else l=r/(2*Math.PI)*Math.asin(i/a);if(e<1)return-0.5*(a*Math.pow(2,10*(e-=1))*Math.sin((e*s-l)*(2*Math.PI)/r))+n;return a*Math.pow(2,-10*(e-=1))*Math.sin((e*s-l)*(2*Math.PI)/r)*0.5+i+n},BounceEaseOut(e,n,i,s){if((e/=s)<0.36363636363636365)return i*(7.5625*e*e)+n;else if(e<0.7272727272727273)return i*(7.5625*(e-=0.5454545454545454)*e+0.75)+n;else if(e<0.9090909090909091)return i*(7.5625*(e-=0.8181818181818182)*e+0.9375)+n;else return i*(7.5625*(e-=0.9545454545454546)*e+0.984375)+n},BounceEaseIn(e,n,i,s){return i-vd.BounceEaseOut(s-e,0,i,s)+n},BounceEaseInOut(e,n,i,s){if(e<s/2)return vd.BounceEaseIn(e*2,0,i,s)*0.5+n;else return vd.BounceEaseOut(e*2-s,0,i,s)*0.5+i*0.5+n},EaseIn(e,n,i,s){return i*(e/=s)*e+n},EaseOut(e,n,i,s){return-i*(e/=s)*(e-2)+n},EaseInOut(e,n,i,s){if((e/=s/2)<1)return i/2*e*e+n;return-i/2*(--e*(e-2)-1)+n},StrongEaseIn(e,n,i,s){return i*(e/=s)*e*e*e*e+n},StrongEaseOut(e,n,i,s){return i*((e=e/s-1)*e*e*e*e+1)+n},StrongEaseInOut(e,n,i,s){if((e/=s/2)<1)return i/2*e*e*e*e*e+n;return i/2*((e-=2)*e*e*e*e+2)+n},Linear(e,n,i,s){return i*e/s+n}};var Sd=Be._assign(Tt,{Util:Be,Transform:Ps,Node:wt,Container:ks,Stage:yd,stages:wd,Layer:No,FastLayer:Up,Group:Po,DD:Hn,Shape:_t,shapes:yh,Animation:da,Tween:mi,Easings:vd,Context:md,Canvas:qp});class eo extends _t{_sceneFunc(e){let n=Tt.getAngle(this.angle()),i=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,n,i),e.arc(0,0,this.innerRadius(),n,0,!i),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){let e=this.innerRadius(),n=this.outerRadius(),i=this.clockwise(),s=Tt.getAngle(this.angle());if(s%(Math.PI*2)===0)return s!==0?{x:-n,y:-n,width:n*2,height:n*2}:{x:e,y:0,width:n-e,height:0};let a=Tt.getAngle(i?360-this.angle():this.angle()),r=Math.cos(Math.min(a,Math.PI)),l=1,c=Math.sin(Math.min(Math.max(Math.PI,a),3*Math.PI/2)),p=Math.sin(Math.min(a,Math.PI/2)),m=r*(r>0?e:n),g=l*(l>0?n:e),y=c*(c>0?e:n),x=p*(p>0?n:e);return{x:m,y:i?-1*x:y,width:g-m,height:x-y}}}eo.prototype._centroid=!0;eo.prototype.className="Arc";eo.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"];mn(eo);_e.addGetterSetter(eo,"innerRadius",0,dt());_e.addGetterSetter(eo,"outerRadius",0,dt());_e.addGetterSetter(eo,"angle",0,dt());_e.addGetterSetter(eo,"clockwise",!1,Hs());var fN=[[],[],[-0.5773502691896257,0.5773502691896257],[0,-0.7745966692414834,0.7745966692414834],[-0.33998104358485626,0.33998104358485626,-0.8611363115940526,0.8611363115940526],[0,-0.5384693101056831,0.5384693101056831,-0.906179845938664,0.906179845938664],[0.6612093864662645,-0.6612093864662645,-0.2386191860831969,0.2386191860831969,-0.932469514203152,0.932469514203152],[0,0.4058451513773972,-0.4058451513773972,-0.7415311855993945,0.7415311855993945,-0.9491079123427585,0.9491079123427585],[-0.1834346424956498,0.1834346424956498,-0.525532409916329,0.525532409916329,-0.7966664774136267,0.7966664774136267,-0.9602898564975363,0.9602898564975363],[0,-0.8360311073266358,0.8360311073266358,-0.9681602395076261,0.9681602395076261,-0.3242534234038089,0.3242534234038089,-0.6133714327005904,0.6133714327005904],[-0.14887433898163122,0.14887433898163122,-0.4333953941292472,0.4333953941292472,-0.6794095682990244,0.6794095682990244,-0.8650633666889845,0.8650633666889845,-0.9739065285171717,0.9739065285171717],[0,-0.26954315595234496,0.26954315595234496,-0.5190961292068118,0.5190961292068118,-0.7301520055740494,0.7301520055740494,-0.8870625997680953,0.8870625997680953,-0.978228658146057,0.978228658146057],[-0.1252334085114689,0.1252334085114689,-0.3678314989981802,0.3678314989981802,-0.5873179542866175,0.5873179542866175,-0.7699026741943047,0.7699026741943047,-0.9041172563704749,0.9041172563704749,-0.9815606342467192,0.9815606342467192],[0,-0.2304583159551348,0.2304583159551348,-0.44849275103644687,0.44849275103644687,-0.6423493394403402,0.6423493394403402,-0.8015780907333099,0.8015780907333099,-0.9175983992229779,0.9175983992229779,-0.9841830547185881,0.9841830547185881],[-0.10805494870734367,0.10805494870734367,-0.31911236892788974,0.31911236892788974,-0.5152486363581541,0.5152486363581541,-0.6872929048116855,0.6872929048116855,-0.827201315069765,0.827201315069765,-0.9284348836635735,0.9284348836635735,-0.9862838086968123,0.9862838086968123],[0,-0.20119409399743451,0.20119409399743451,-0.3941513470775634,0.3941513470775634,-0.5709721726085388,0.5709721726085388,-0.7244177313601701,0.7244177313601701,-0.8482065834104272,0.8482065834104272,-0.937273392400706,0.937273392400706,-0.9879925180204854,0.9879925180204854],[-0.09501250983763744,0.09501250983763744,-0.2816035507792589,0.2816035507792589,-0.45801677765722737,0.45801677765722737,-0.6178762444026438,0.6178762444026438,-0.755404408355003,0.755404408355003,-0.8656312023878318,0.8656312023878318,-0.9445750230732326,0.9445750230732326,-0.9894009349916499,0.9894009349916499],[0,-0.17848418149584785,0.17848418149584785,-0.3512317634538763,0.3512317634538763,-0.5126905370864769,0.5126905370864769,-0.6576711592166907,0.6576711592166907,-0.7815140038968014,0.7815140038968014,-0.8802391537269859,0.8802391537269859,-0.9506755217687678,0.9506755217687678,-0.9905754753144174,0.9905754753144174],[-0.0847750130417353,0.0847750130417353,-0.2518862256915055,0.2518862256915055,-0.41175116146284263,0.41175116146284263,-0.5597708310739475,0.5597708310739475,-0.6916870430603532,0.6916870430603532,-0.8037049589725231,0.8037049589725231,-0.8926024664975557,0.8926024664975557,-0.9558239495713977,0.9558239495713977,-0.9915651684209309,0.9915651684209309],[0,-0.16035864564022537,0.16035864564022537,-0.31656409996362983,0.31656409996362983,-0.46457074137596094,0.46457074137596094,-0.600545304661681,0.600545304661681,-0.7209661773352294,0.7209661773352294,-0.8227146565371428,0.8227146565371428,-0.9031559036148179,0.9031559036148179,-0.96020815213483,0.96020815213483,-0.9924068438435844,0.9924068438435844],[-0.07652652113349734,0.07652652113349734,-0.22778585114164507,0.22778585114164507,-0.37370608871541955,0.37370608871541955,-0.5108670019508271,0.5108670019508271,-0.636053680726515,0.636053680726515,-0.7463319064601508,0.7463319064601508,-0.8391169718222188,0.8391169718222188,-0.912234428251326,0.912234428251326,-0.9639719272779138,0.9639719272779138,-0.9931285991850949,0.9931285991850949],[0,-0.1455618541608951,0.1455618541608951,-0.2880213168024011,0.2880213168024011,-0.4243421202074388,0.4243421202074388,-0.5516188358872198,0.5516188358872198,-0.6671388041974123,0.6671388041974123,-0.7684399634756779,0.7684399634756779,-0.8533633645833173,0.8533633645833173,-0.9200993341504008,0.9200993341504008,-0.9672268385663063,0.9672268385663063,-0.9937521706203895,0.9937521706203895],[-0.06973927331972223,0.06973927331972223,-0.20786042668822127,0.20786042668822127,-0.34193582089208424,0.34193582089208424,-0.469355837986757,0.469355837986757,-0.5876404035069116,0.5876404035069116,-0.6944872631866827,0.6944872631866827,-0.7878168059792081,0.7878168059792081,-0.8658125777203002,0.8658125777203002,-0.926956772187174,0.926956772187174,-0.9700604978354287,0.9700604978354287,-0.9942945854823992,0.9942945854823992],[0,-0.1332568242984661,0.1332568242984661,-0.26413568097034495,0.26413568097034495,-0.3903010380302908,0.3903010380302908,-0.5095014778460075,0.5095014778460075,-0.6196098757636461,0.6196098757636461,-0.7186613631319502,0.7186613631319502,-0.8048884016188399,0.8048884016188399,-0.8767523582704416,0.8767523582704416,-0.9329710868260161,0.9329710868260161,-0.9725424712181152,0.9725424712181152,-0.9947693349975522,0.9947693349975522],[-0.06405689286260563,0.06405689286260563,-0.1911188674736163,0.1911188674736163,-0.3150426796961634,0.3150426796961634,-0.4337935076260451,0.4337935076260451,-0.5454214713888396,0.5454214713888396,-0.6480936519369755,0.6480936519369755,-0.7401241915785544,0.7401241915785544,-0.820001985973903,0.820001985973903,-0.8864155270044011,0.8864155270044011,-0.9382745520027328,0.9382745520027328,-0.9747285559713095,0.9747285559713095,-0.9951872199970213,0.9951872199970213]],dN=[[],[],[1,1],[0.8888888888888888,0.5555555555555556,0.5555555555555556],[0.6521451548625461,0.6521451548625461,0.34785484513745385,0.34785484513745385],[0.5688888888888889,0.47862867049936647,0.47862867049936647,0.23692688505618908,0.23692688505618908],[0.3607615730481386,0.3607615730481386,0.46791393457269104,0.46791393457269104,0.17132449237917036,0.17132449237917036],[0.4179591836734694,0.3818300505051189,0.3818300505051189,0.27970539148927664,0.27970539148927664,0.1294849661688697,0.1294849661688697],[0.362683783378362,0.362683783378362,0.31370664587788727,0.31370664587788727,0.22238103445337448,0.22238103445337448,0.10122853629037626,0.10122853629037626],[0.3302393550012598,0.1806481606948574,0.1806481606948574,0.08127438836157441,0.08127438836157441,0.31234707704000286,0.31234707704000286,0.26061069640293544,0.26061069640293544],[0.29552422471475287,0.29552422471475287,0.26926671930999635,0.26926671930999635,0.21908636251598204,0.21908636251598204,0.1494513491505806,0.1494513491505806,0.06667134430868814,0.06667134430868814],[0.2729250867779006,0.26280454451024665,0.26280454451024665,0.23319376459199048,0.23319376459199048,0.18629021092773426,0.18629021092773426,0.1255803694649046,0.1255803694649046,0.05566856711617366,0.05566856711617366],[0.24914704581340277,0.24914704581340277,0.2334925365383548,0.2334925365383548,0.20316742672306592,0.20316742672306592,0.16007832854334622,0.16007832854334622,0.10693932599531843,0.10693932599531843,0.04717533638651183,0.04717533638651183],[0.2325515532308739,0.22628318026289723,0.22628318026289723,0.2078160475368885,0.2078160475368885,0.17814598076194574,0.17814598076194574,0.13887351021978725,0.13887351021978725,0.09212149983772845,0.09212149983772845,0.04048400476531588,0.04048400476531588],[0.2152638534631578,0.2152638534631578,0.2051984637212956,0.2051984637212956,0.18553839747793782,0.18553839747793782,0.15720316715819355,0.15720316715819355,0.12151857068790319,0.12151857068790319,0.08015808715976021,0.08015808715976021,0.03511946033175186,0.03511946033175186],[0.2025782419255613,0.19843148532711158,0.19843148532711158,0.1861610000155622,0.1861610000155622,0.16626920581699392,0.16626920581699392,0.13957067792615432,0.13957067792615432,0.10715922046717194,0.10715922046717194,0.07036604748810812,0.07036604748810812,0.03075324199611727,0.03075324199611727],[0.1894506104550685,0.1894506104550685,0.18260341504492358,0.18260341504492358,0.16915651939500254,0.16915651939500254,0.14959598881657674,0.14959598881657674,0.12462897125553388,0.12462897125553388,0.09515851168249279,0.09515851168249279,0.062253523938647894,0.062253523938647894,0.027152459411754096,0.027152459411754096],[0.17944647035620653,0.17656270536699264,0.17656270536699264,0.16800410215645004,0.16800410215645004,0.15404576107681028,0.15404576107681028,0.13513636846852548,0.13513636846852548,0.11188384719340397,0.11188384719340397,0.08503614831717918,0.08503614831717918,0.0554595293739872,0.0554595293739872,0.02414830286854793,0.02414830286854793],[0.1691423829631436,0.1691423829631436,0.16427648374583273,0.16427648374583273,0.15468467512626524,0.15468467512626524,0.14064291467065065,0.14064291467065065,0.12255520671147846,0.12255520671147846,0.10094204410628717,0.10094204410628717,0.07642573025488905,0.07642573025488905,0.0497145488949698,0.0497145488949698,0.02161601352648331,0.02161601352648331],[0.1610544498487837,0.15896884339395434,0.15896884339395434,0.15276604206585967,0.15276604206585967,0.1426067021736066,0.1426067021736066,0.12875396253933621,0.12875396253933621,0.11156664554733399,0.11156664554733399,0.09149002162245,0.09149002162245,0.06904454273764123,0.06904454273764123,0.0448142267656996,0.0448142267656996,0.019461788229726478,0.019461788229726478],[0.15275338713072584,0.15275338713072584,0.14917298647260374,0.14917298647260374,0.14209610931838204,0.14209610931838204,0.13168863844917664,0.13168863844917664,0.11819453196151841,0.11819453196151841,0.10193011981724044,0.10193011981724044,0.08327674157670475,0.08327674157670475,0.06267204833410907,0.06267204833410907,0.04060142980038694,0.04060142980038694,0.017614007139152118,0.017614007139152118],[0.14608113364969041,0.14452440398997005,0.14452440398997005,0.13988739479107315,0.13988739479107315,0.13226893863333747,0.13226893863333747,0.12183141605372853,0.12183141605372853,0.10879729916714838,0.10879729916714838,0.09344442345603386,0.09344442345603386,0.0761001136283793,0.0761001136283793,0.057134425426857205,0.057134425426857205,0.036953789770852494,0.036953789770852494,0.016017228257774335,0.016017228257774335],[0.13925187285563198,0.13925187285563198,0.13654149834601517,0.13654149834601517,0.13117350478706238,0.13117350478706238,0.12325237681051242,0.12325237681051242,0.11293229608053922,0.11293229608053922,0.10041414444288096,0.10041414444288096,0.08594160621706773,0.08594160621706773,0.06979646842452049,0.06979646842452049,0.052293335152683286,0.052293335152683286,0.03377490158481415,0.03377490158481415,0.0146279952982722,0.0146279952982722],[0.13365457218610619,0.1324620394046966,0.1324620394046966,0.12890572218808216,0.12890572218808216,0.12304908430672953,0.12304908430672953,0.11499664022241136,0.11499664022241136,0.10489209146454141,0.10489209146454141,0.09291576606003515,0.09291576606003515,0.07928141177671895,0.07928141177671895,0.06423242140852585,0.06423242140852585,0.04803767173108467,0.04803767173108467,0.030988005856979445,0.030988005856979445,0.013411859487141771,0.013411859487141771],[0.12793819534675216,0.12793819534675216,0.1258374563468283,0.1258374563468283,0.12167047292780339,0.12167047292780339,0.1155056680537256,0.1155056680537256,0.10744427011596563,0.10744427011596563,0.09761865210411388,0.09761865210411388,0.08619016153195327,0.08619016153195327,0.0733464814110803,0.0733464814110803,0.05929858491543678,0.05929858491543678,0.04427743881741981,0.04427743881741981,0.028531388628933663,0.028531388628933663,0.0123412297999872,0.0123412297999872]],pN=[[1],[1,1],[1,2,1],[1,3,3,1]],x3=(e,n,i)=>{let s,a,r=20,l=i/2;s=0;for(let c=0;c<20;c++)a=l*fN[20][c]+l,s+=dN[20][c]*mN(e,n,a);return l*s},k3=(e,n,i)=>{if(i===void 0)i=1;let s=e[0]-2*e[1]+e[2],a=n[0]-2*n[1]+n[2],r=2*e[1]-2*e[0],l=2*n[1]-2*n[0],c=4*(s*s+a*a),p=4*(s*r+a*l),m=r*r+l*l;if(c===0)return i*Math.sqrt(Math.pow(e[2]-e[0],2)+Math.pow(n[2]-n[0],2));let g=p/(2*c),y=m/c,x=i+g,j=y-g*g,I=x*x+j>0?Math.sqrt(x*x+j):0,P=g*g+j>0?Math.sqrt(g*g+j):0,X=g+Math.sqrt(g*g+j)!==0?j*Math.log(Math.abs((x+I)/(g+P))):0;return Math.sqrt(c)/2*(x*I-g*P+X)};function mN(e,n,i){let s=_3(1,i,e),a=_3(1,i,n),r=s*s+a*a;return Math.sqrt(r)}var _3=(e,n,i)=>{let s=i.length-1,a,r;if(s===0)return 0;if(e===0){r=0;for(let l=0;l<=s;l++)r+=pN[s][l]*Math.pow(1-n,s-l)*Math.pow(n,l)*i[l];return r}else{a=Array(s);for(let l=0;l<s;l++)a[l]=s*(i[l+1]-i[l]);return _3(e-1,n,a)}},T3=(e,n,i)=>{let s=1,a=e/n,r=(e-i(a))/n,l=0;while(s>0.001){let c=i(a+r),p=Math.abs(e-c)/n;if(p<s)s=p,a+=r;else{let m=i(a-r),g=Math.abs(e-m)/n;if(g<s)s=g,a-=r;else r/=2}if(l++,l>500)break}return a},ox=(e,n,i,s)=>{let a=1-s;return a*a*e+2*a*s*n+s*s*i},Nb=(e,n,i,s,a,r)=>{let l=[];for(let c of[[e,i,a],[n,s,r]]){let p=(c[0]-c[1])/(c[0]-2*c[1]+c[2]);if(p>0&&p<1)l.push(ox(e,i,a,p),ox(n,s,r,p))}return l},lx=(e,n,i,s,a)=>{let r=1-a;return r*r*r*e+3*r*r*a*n+3*r*a*a*i+a*a*a*s},zp=(e,n,i,s,a,r,l,c)=>{let p=[];for(let m of[[e,i,a,l],[n,s,r,c]]){let g=-3*m[0]+9*m[1]-9*m[2]+3*m[3],y=6*m[0]-12*m[1]+6*m[2],x=-3*m[0]+3*m[1],j=y*y-4*g*x;if(j<0)continue;let I=-(y+(y<0?-1:1)*Math.sqrt(j))/2;for(let P of[I/g,x/I])if(P>0&&P<1)p.push(lx(e,i,a,l,P),lx(n,s,r,c,P))}return p};function A3(e,n,i,s,a,r,l){let c=Math.sqrt(Math.pow(i-e,2)+Math.pow(s-n,2)),p=Math.sqrt(Math.pow(a-i,2)+Math.pow(r-s,2)),m=c+p;if(m===0)return[i,s,i,s];let g=l*c/m,y=l*p/m,x=i-g*(a-e),j=s-g*(r-n),I=i+y*(a-e),P=s+y*(r-n);return[x,j,I,P]}function ux(e,n){let i=e.length,s=[];for(let a=2;a<i-2;a+=2){let r=A3(e[a-2],e[a-1],e[a],e[a+1],e[a+2],e[a+3],n);if(isNaN(r[0]))continue;s.push(r[0]),s.push(r[1]),s.push(e[a]),s.push(e[a+1]),s.push(r[2]),s.push(r[3])}return s}function gN(e){let n=[];for(let i=0;i+7<e.length;i+=6)n.push(e[i+6],e[i+7],...zp(e[i],e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6],e[i+7]));return n}class qr extends _t{constructor(e){super(e);this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_hasTension(){return this.tension()!==0&&this.points().length>4}_eachTensionSegment(e,n){let i=this.points(),s=i.length,a=this.closed(),r=this.getTensionPoints(),l=r.length,c=i[0],p=i[1],m=a?0:4;if(!a)e(c,p,r[0],r[1],r[2],r[3]),c=r[2],p=r[3];while(m<l-2){let g=r[m++],y=r[m++],x=r[m++],j=r[m++],I=r[m++],P=r[m++];n(c,p,g,y,x,j,I,P),c=I,p=P}if(!a)e(c,p,r[l-2],r[l-1],i[s-2],i[s-1])}_sceneFunc(e){let n=this.points(),i=n.length,s=this.closed(),a=this.bezier();if(!i)return;let r=0;if(e.beginPath(),e.moveTo(n[0],n[1]),this._hasTension())this._eachTensionSegment((l,c,p,m,g,y)=>e.quadraticCurveTo(p,m,g,y),(l,c,p,m,g,y,x,j)=>e.bezierCurveTo(p,m,g,y,x,j));else if(a){r=2;while(r<i)e.bezierCurveTo(n[r++],n[r++],n[r++],n[r++],n[r++],n[r++])}else for(r=2;r<i;r+=2)e.lineTo(n[r],n[r+1]);if(s)e.closePath(),e.fillStrokeShape(this);else e.strokeShape(this)}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){if(this.closed())return this._getTensionPointsClosed();else return ux(this.points(),this.tension())}_getTensionPointsClosed(){let e=this.points(),n=e.length,i=this.tension(),s=A3(e[n-2],e[n-1],e[0],e[1],e[2],e[3],i),a=A3(e[n-4],e[n-3],e[n-2],e[n-1],e[0],e[1],i),r=ux(e,i);return[s[2],s[3]].concat(r).concat([a[0],a[1],e[n-2],e[n-1],a[2],a[3],s[0],s[1],e[0],e[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};if(this._hasTension()){let c=[e[0],e[1]];this._eachTensionSegment((p,m,g,y,x,j)=>c.push(x,j,...Nb(p,m,g,y,x,j)),(p,m,g,y,x,j,I,P)=>c.push(I,P,...zp(p,m,g,y,x,j,I,P))),e=c}else if(this.bezier())e=[e[0],e[1],...gN(e)];let n=e[0],i=e[0],s=e[1],a=e[1],r,l;for(let c=0;c<e.length/2;c++)r=e[c*2],l=e[c*2+1],n=Math.min(n,r),i=Math.max(i,r),s=Math.min(s,l),a=Math.max(a,l);return{x:n,y:s,width:i-n,height:a-s}}}qr.prototype.className="Line";qr.prototype._attrsAffectingSize=["points","bezier","tension"];mn(qr);_e.addGetterSetter(qr,"closed",!1);_e.addGetterSetter(qr,"bezier",!1);_e.addGetterSetter(qr,"tension",0,dt());_e.addGetterSetter(qr,"points",[],k_());class ui extends _t{constructor(e){super(e);this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=ui.parsePathData(this.data()),this.pathLength=ui.getPathLength(this.dataArray)}_sceneFunc(e){let n=this.dataArray;e.beginPath();let i=!1;for(let s=0;s<n.length;s++){let a=n[s].command,r=n[s].points;switch(a){case"L":e.lineTo(r[0],r[1]);break;case"M":e.moveTo(r[0],r[1]);break;case"C":e.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);break;case"Q":e.quadraticCurveTo(r[0],r[1],r[2],r[3]);break;case"A":let l=r[0],c=r[1],p=r[2],m=r[3],g=r[4],y=r[5],x=r[6],j=r[7],I=p>m?p:m,P=p>m?1:p/m,X=p>m?m/p:1;e.translate(l,c),e.rotate(x),e.scale(P,X),e.arc(0,0,I,g,g+y,1-j),e.scale(1/P,1/X),e.rotate(-x),e.translate(-l,-c);break;case"z":i=!0,e.closePath();break}}if(!i&&!this.hasFill())e.strokeShape(this);else e.fillStrokeShape(this)}getSelfRect(){let e=[];this.dataArray.forEach(function(c){if(c.command==="A"){let p=c.points[4],m=c.points[5],g=c.points[4]+m,y=Math.PI/180;if(Math.abs(p-g)<y)y=Math.abs(p-g);if(m<0)for(let x=p-y;x>g;x-=y){let j=ui.getPointOnEllipticalArc(c.points[0],c.points[1],c.points[2],c.points[3],x,0);e.push(j.x,j.y)}else for(let x=p+y;x<g;x+=y){let j=ui.getPointOnEllipticalArc(c.points[0],c.points[1],c.points[2],c.points[3],x,0);e.push(j.x,j.y)}}else if(c.command==="C")e.push(c.start.x,c.start.y,c.points[4],c.points[5],...zp(c.start.x,c.start.y,c.points[0],c.points[1],c.points[2],c.points[3],c.points[4],c.points[5]));else if(c.command==="Q")e.push(c.start.x,c.start.y,c.points[2],c.points[3],...Nb(c.start.x,c.start.y,c.points[0],c.points[1],c.points[2],c.points[3]));else e=e.concat(c.points)});let n=e[0],i=e[0],s=e[1],a=e[1],r,l;for(let c=0;c<e.length/2;c++){if(r=e[c*2],l=e[c*2+1],!isNaN(r))n=Math.min(n,r),i=Math.max(i,r);if(!isNaN(l))s=Math.min(s,l),a=Math.max(a,l)}return{x:n,y:s,width:i-n,height:a-s}}getLength(){return this.pathLength}getPointAtLength(e){return ui.getPointAtLengthOfDataArray(e,this.dataArray)}static getLineLength(e,n,i,s){return Math.sqrt((i-e)*(i-e)+(s-n)*(s-n))}static getPathLength(e){let n=0;for(let i=0;i<e.length;++i)n+=e[i].pathLength;return n}static getPointAtLengthOfDataArray(e,n){let i,s=0,a=n.length;if(!a)return null;while(s<a&&e>n[s].pathLength)e-=n[s].pathLength,++s;if(s===a){let c=s-1;while(c>0&&n[c].points.length<2)c--;return i=n[c].points.slice(-2),{x:i[0],y:i[1]}}if(e<0.01)if(n[s].command==="M")return i=n[s].points.slice(0,2),{x:i[0],y:i[1]};else return{x:n[s].start.x,y:n[s].start.y};let r=n[s],l=r.points;switch(r.command){case"L":return ui.getPointOnLine(e,r.start.x,r.start.y,l[0],l[1]);case"C":return ui.getPointOnCubicBezier(T3(e,ui.getPathLength(n),(I)=>x3([r.start.x,l[0],l[2],l[4]],[r.start.y,l[1],l[3],l[5]],I)),r.start.x,r.start.y,l[0],l[1],l[2],l[3],l[4],l[5]);case"Q":return ui.getPointOnQuadraticBezier(T3(e,ui.getPathLength(n),(I)=>k3([r.start.x,l[0],l[2]],[r.start.y,l[1],l[3]],I)),r.start.x,r.start.y,l[0],l[1],l[2],l[3]);case"A":let c=l[0],p=l[1],m=l[2],g=l[3],y=l[5],x=l[6],j=l[4];return j+=y*e/r.pathLength,ui.getPointOnEllipticalArc(c,p,m,g,j,x)}return null}static getPointOnLine(e,n,i,s,a,r,l){r=r!==null&&r!==void 0?r:n,l=l!==null&&l!==void 0?l:i;let c=this.getLineLength(n,i,s,a);if(c<0.0000000001)return{x:n,y:i};if(s===n)return{x:r,y:l+(a>i?e:-e)};let p=(a-i)/(s-n),m=Math.sqrt(e*e/(1+p*p))*(s<n?-1:1),g=p*m;if(Math.abs(l-i-p*(r-n))<0.0000000001)return{x:r+m,y:l+g};let y=((r-n)*(s-n)+(l-i)*(a-i))/(c*c),x=n+y*(s-n),j=i+y*(a-i),I=this.getLineLength(r,l,x,j),P=Math.sqrt(e*e-I*I),X=Math.sqrt(P*P/(1+p*p))*(s<n?-1:1),Y=p*X;return{x:x+X,y:j+Y}}static getPointOnCubicBezier(e,n,i,s,a,r,l,c,p){function m(P){return P*P*P}function g(P){return 3*P*P*(1-P)}function y(P){return 3*P*(1-P)*(1-P)}function x(P){return(1-P)*(1-P)*(1-P)}let j=c*m(e)+r*g(e)+s*y(e)+n*x(e),I=p*m(e)+l*g(e)+a*y(e)+i*x(e);return{x:j,y:I}}static getPointOnQuadraticBezier(e,n,i,s,a,r,l){function c(x){return x*x}function p(x){return 2*x*(1-x)}function m(x){return(1-x)*(1-x)}let g=r*c(e)+s*p(e)+n*m(e),y=l*c(e)+a*p(e)+i*m(e);return{x:g,y}}static getPointOnEllipticalArc(e,n,i,s,a,r){let l=Math.cos(r),c=Math.sin(r),p={x:i*Math.cos(a),y:s*Math.sin(a)};return{x:e+(p.x*l-p.y*c),y:n+(p.x*c+p.y*l)}}static parsePathData(e){if(!e)return[];let n=e,i=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];n=n.replace(new RegExp(" ","g"),",");for(let g=0;g<i.length;g++)n=n.replace(new RegExp(i[g],"g"),"|"+i[g]);let s=n.split("|"),a=[],r=[],l=0,c=0,p=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi,m;for(let g=1;g<s.length;g++){let y=s[g],x=y.charAt(0);y=y.slice(1),r.length=0;while(m=p.exec(y))r.push(m[0]);let j=[],I=x==="A"||x==="a"?0:-1;for(let P=0,X=r.length;P<X;P++){let Y=r[P];if(Y==="00"){if(j.push(0,0),I>=0){if(I+=2,I>=7)I-=7}continue}if(I>=0){if(I===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(Y)){if(j.push(parseInt(Y[0],10)),j.push(parseInt(Y[1],10)),j.push(parseFloat(Y.slice(2))),I+=3,I>=7)I-=7;continue}if(Y==="11"||Y==="10"||Y==="01"){if(j.push(parseInt(Y[0],10)),j.push(parseInt(Y[1],10)),I+=2,I>=7)I-=7;continue}if(Y==="0"||Y==="1"){if(j.push(parseInt(Y,10)),I+=1,I>=7)I-=7;continue}}else if(I===4){if(/^[01]\d+(?:\.\d+)?$/.test(Y)){if(j.push(parseInt(Y[0],10)),j.push(parseFloat(Y.slice(1))),I+=2,I>=7)I-=7;continue}if(Y==="0"||Y==="1"){if(j.push(parseInt(Y,10)),I+=1,I>=7)I-=7;continue}}let J=parseFloat(Y);if(!isNaN(J))j.push(J);else j.push(0);if(I+=1,I>=7)I-=7}else{let J=parseFloat(Y);if(!isNaN(J))j.push(J);else j.push(0)}}while(j.length>0){if(isNaN(j[0]))break;let P="",X=[],Y=l,J=c,ne,ae,se,oe,he,we,Ce,Ne,Pe,Ue;switch(x){case"l":l+=j.shift(),c+=j.shift(),P="L",X.push(l,c);break;case"L":l=j.shift(),c=j.shift(),X.push(l,c);break;case"m":let ze=j.shift(),He=j.shift();if(l+=ze,c+=He,P="M",a.length>2&&a[a.length-1].command==="z"){for(let De=a.length-2;De>=0;De--)if(a[De].command==="M"){l=a[De].points[0]+ze,c=a[De].points[1]+He;break}}X.push(l,c),x="l";break;case"M":l=j.shift(),c=j.shift(),P="M",X.push(l,c),x="L";break;case"h":l+=j.shift(),P="L",X.push(l,c);break;case"H":l=j.shift(),P="L",X.push(l,c);break;case"v":c+=j.shift(),P="L",X.push(l,c);break;case"V":c=j.shift(),P="L",X.push(l,c);break;case"C":X.push(j.shift(),j.shift(),j.shift(),j.shift()),l=j.shift(),c=j.shift(),X.push(l,c);break;case"c":X.push(l+j.shift(),c+j.shift(),l+j.shift(),c+j.shift()),l+=j.shift(),c+=j.shift(),P="C",X.push(l,c);break;case"S":if(ae=l,se=c,ne=a[a.length-1],ne.command==="C")ae=l+(l-ne.points[2]),se=c+(c-ne.points[3]);X.push(ae,se,j.shift(),j.shift()),l=j.shift(),c=j.shift(),P="C",X.push(l,c);break;case"s":if(ae=l,se=c,ne=a[a.length-1],ne.command==="C")ae=l+(l-ne.points[2]),se=c+(c-ne.points[3]);X.push(ae,se,l+j.shift(),c+j.shift()),l+=j.shift(),c+=j.shift(),P="C",X.push(l,c);break;case"Q":X.push(j.shift(),j.shift()),l=j.shift(),c=j.shift(),X.push(l,c);break;case"q":X.push(l+j.shift(),c+j.shift()),l+=j.shift(),c+=j.shift(),P="Q",X.push(l,c);break;case"T":if(ae=l,se=c,ne=a[a.length-1],ne.command==="Q")ae=l+(l-ne.points[0]),se=c+(c-ne.points[1]);l=j.shift(),c=j.shift(),P="Q",X.push(ae,se,l,c);break;case"t":if(ae=l,se=c,ne=a[a.length-1],ne.command==="Q")ae=l+(l-ne.points[0]),se=c+(c-ne.points[1]);l+=j.shift(),c+=j.shift(),P="Q",X.push(ae,se,l,c);break;case"A":oe=j.shift(),he=j.shift(),we=j.shift(),Ce=j.shift(),Ne=j.shift(),Pe=l,Ue=c,l=j.shift(),c=j.shift(),P="A",X=this.convertEndpointToCenterParameterization(Pe,Ue,l,c,Ce,Ne,oe,he,we);break;case"a":oe=j.shift(),he=j.shift(),we=j.shift(),Ce=j.shift(),Ne=j.shift(),Pe=l,Ue=c,l+=j.shift(),c+=j.shift(),P="A",X=this.convertEndpointToCenterParameterization(Pe,Ue,l,c,Ce,Ne,oe,he,we);break}a.push({command:P||x,points:X,start:{x:Y,y:J},pathLength:this.calcLength(Y,J,P||x,X)})}if(x==="z"||x==="Z")a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(e,n,i,s){let a,r,l,c,p=ui;switch(i){case"L":return p.getLineLength(e,n,s[0],s[1]);case"C":return x3([e,s[0],s[2],s[4]],[n,s[1],s[3],s[5]],1);case"Q":return k3([e,s[0],s[2]],[n,s[1],s[3]],1);case"A":a=0;let m=s[4],g=s[5],y=s[4]+g,x=Math.PI/180;if(Math.abs(m-y)<x)x=Math.abs(m-y);if(r=p.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],m,0),g<0)for(c=m-x;c>y;c-=x)l=p.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],c,0),a+=p.getLineLength(r.x,r.y,l.x,l.y),r=l;else for(c=m+x;c<y;c+=x)l=p.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],c,0),a+=p.getLineLength(r.x,r.y,l.x,l.y),r=l;return l=p.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],y,0),a+=p.getLineLength(r.x,r.y,l.x,l.y),a}return 0}static convertEndpointToCenterParameterization(e,n,i,s,a,r,l,c,p){let m=p*(Math.PI/180),g=Math.cos(m)*(e-i)/2+Math.sin(m)*(n-s)/2,y=-1*Math.sin(m)*(e-i)/2+Math.cos(m)*(n-s)/2,x=g*g/(l*l)+y*y/(c*c);if(x>1)l*=Math.sqrt(x),c*=Math.sqrt(x);let j=Math.sqrt((l*l*(c*c)-l*l*(y*y)-c*c*(g*g))/(l*l*(y*y)+c*c*(g*g)));if(a===r)j*=-1;if(isNaN(j))j=0;let I=j*l*y/c,P=j*-c*g/l,X=(e+i)/2+Math.cos(m)*I-Math.sin(m)*P,Y=(n+s)/2+Math.sin(m)*I+Math.cos(m)*P,J=function(Ce){return Math.sqrt(Ce[0]*Ce[0]+Ce[1]*Ce[1])},ne=function(Ce,Ne){return(Ce[0]*Ne[0]+Ce[1]*Ne[1])/(J(Ce)*J(Ne))},ae=function(Ce,Ne){return(Ce[0]*Ne[1]<Ce[1]*Ne[0]?-1:1)*Math.acos(ne(Ce,Ne))},se=ae([1,0],[(g-I)/l,(y-P)/c]),oe=[(g-I)/l,(y-P)/c],he=[(-1*g-I)/l,(-1*y-P)/c],we=ae(oe,he);if(ne(oe,he)<=-1)we=Math.PI;if(ne(oe,he)>=1)we=0;if(r===0&&we>0)we=we-2*Math.PI;if(r===1&&we<0)we=we+2*Math.PI;return[X,Y,l,c,se,we,m,r]}}ui.prototype.className="Path";ui.prototype._attrsAffectingSize=["data"];mn(ui);_e.addGetterSetter(ui,"data");class Ol extends qr{_sceneFunc(e){super._sceneFunc(e);let n=Math.PI*2,i=this.points(),s=i,a=this.tension()!==0&&i.length>4;if(a)s=this.getTensionPoints();let r=this.pointerLength(),l=i.length,c,p;if(a){let y=[s[s.length-4],s[s.length-3],s[s.length-2],s[s.length-1],i[l-2],i[l-1]],x=ui.calcLength(s[s.length-4],s[s.length-3],"C",y),j=ui.getPointOnQuadraticBezier(Math.min(1,1-r/x),y[0],y[1],y[2],y[3],y[4],y[5]);c=i[l-2]-j.x,p=i[l-1]-j.y}else c=i[l-2]-i[l-4],p=i[l-1]-i[l-3];let m=(Math.atan2(p,c)+n)%n,g=this.pointerWidth();if(this.pointerAtEnding())e.save(),e.beginPath(),e.translate(i[l-2],i[l-1]),e.rotate(m),e.moveTo(0,0),e.lineTo(-r,g/2),e.lineTo(-r,-g/2),e.closePath(),e.restore(),this.__fillStroke(e);if(this.pointerAtBeginning()){if(e.save(),e.beginPath(),e.translate(i[0],i[1]),a)c=(s[0]+s[2])/2-i[0],p=(s[1]+s[3])/2-i[1];else c=i[2]-i[0],p=i[3]-i[1];e.rotate((Math.atan2(-p,-c)+n)%n),e.moveTo(0,0),e.lineTo(-r,g/2),e.lineTo(-r,-g/2),e.closePath(),e.restore(),this.__fillStroke(e)}}__fillStroke(e){let n=this.dashEnabled();if(n)this.attrs.dashEnabled=!1,e.setLineDash([]);if(e.fillStrokeShape(this),n)this.attrs.dashEnabled=!0}getSelfRect(){let e=super.getSelfRect(),n=this.pointerWidth()/2;return{x:e.x,y:e.y-n,width:e.width,height:e.height+n*2}}}Ol.prototype.className="Arrow";mn(Ol);_e.addGetterSetter(Ol,"pointerLength",10,dt());_e.addGetterSetter(Ol,"pointerWidth",10,dt());_e.addGetterSetter(Ol,"pointerAtBeginning",!1);_e.addGetterSetter(Ol,"pointerAtEnding",!0);class Kc extends _t{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){if(this.radius()!==e/2)this.radius(e/2)}setHeight(e){if(this.radius()!==e/2)this.radius(e/2)}}Kc.prototype._centroid=!0;Kc.prototype.className="Circle";Kc.prototype._attrsAffectingSize=["radius"];mn(Kc);_e.addGetterSetter(Kc,"radius",0,dt());class Bo extends _t{_sceneFunc(e){let n=this.radiusX(),i=this.radiusY();if(e.beginPath(),e.save(),n!==i)e.scale(1,i/n);e.arc(0,0,n,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}Bo.prototype.className="Ellipse";Bo.prototype._centroid=!0;Bo.prototype._attrsAffectingSize=["radiusX","radiusY"];mn(Bo);_e.addComponentsGetterSetter(Bo,"radius",["x","y"]);_e.addGetterSetter(Bo,"radiusX",0,dt());_e.addGetterSetter(Bo,"radiusY",0,dt());class Pa extends _t{constructor(e){super(e);this._loadListener=()=>{this._requestDraw()},this.on("imageChange.konva",(n)=>{this._removeImageLoad(n.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){let e=this.image();if(e&&e.complete)return;if(e&&e.readyState===4)return;if(e&&e.addEventListener)e.addEventListener("load",this._loadListener)}_removeImageLoad(e){if(e&&e.removeEventListener)e.removeEventListener("load",this._loadListener)}destroy(){return this._removeImageLoad(this.image()),super.destroy(),this}_useBufferCanvas(){let e=!!this.cornerRadius(),n=this.hasShadow();if(e&&n)return!0;return super._useBufferCanvas(!0)}_sceneFunc(e){let n=this.getWidth(),i=this.getHeight(),s=this.cornerRadius(),a=this.attrs.image,r;if(a){let l=this.attrs.cropWidth,c=this.attrs.cropHeight;if(l&&c)r=[a,this.cropX(),this.cropY(),l,c,0,0,n,i];else r=[a,0,0,n,i]}if(this.hasFill()||this.hasStroke()||s)e.beginPath(),s?Be.drawRoundedRectPath(e,n,i,s):e.rect(0,0,n,i),e.closePath(),e.fillStrokeShape(this);if(a){if(s)e.clip();e.drawImage.apply(e,r)}}_hitFunc(e){let n=this.width(),i=this.height(),s=this.cornerRadius();if(e.beginPath(),!s)e.rect(0,0,n,i);else Be.drawRoundedRectPath(e,n,i,s);e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,n,i;return(i=(e=this.attrs.width)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.width)!==null&&i!==void 0?i:0}getHeight(){var e,n,i;return(i=(e=this.attrs.height)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.height)!==null&&i!==void 0?i:0}static fromURL(e,n,i=null){let s=Be.createImageElement();s.onload=function(){let a=new Pa({image:s});n(a)},s.onerror=i,s.crossOrigin="Anonymous",s.src=e}}Pa.prototype.className="Image";Pa.prototype._attrsAffectingSize=["image"];mn(Pa);_e.addGetterSetter(Pa,"cornerRadius",0,Xc(4));_e.addGetterSetter(Pa,"image");_e.addComponentsGetterSetter(Pa,"crop",["x","y","width","height"]);_e.addGetterSetter(Pa,"cropX",0,dt());_e.addGetterSetter(Pa,"cropY",0,dt());_e.addGetterSetter(Pa,"cropWidth",0,dt());_e.addGetterSetter(Pa,"cropHeight",0,dt());var hx=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],bN="Change.konva",wN="none",C3="up",j3="right",E3="down",q3="left",yN=hx.length;class Gp extends Po{constructor(e){super(e);this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){let n=this,i,s=function(){n._sync()};for(i=0;i<yN;i++)e.on(hx[i]+bN,s)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let e=this.getText(),n=this.getTag(),i,s,a,r,l,c,p;if(e&&n){switch(i=e.width(),s=e.height(),a=n.pointerDirection(),r=n.pointerWidth(),p=n.pointerHeight(),l=0,c=0,a){case C3:l=i/2,c=-1*p;break;case j3:l=i+r,c=s/2;break;case E3:l=i/2,c=s+p;break;case q3:l=-1*r,c=s/2;break}n.setAttrs({x:-1*l,y:-1*c,width:i,height:s}),e.setAttrs({x:-1*l,y:-1*c})}}}Gp.prototype.className="Label";mn(Gp);class Fl extends _t{_sceneFunc(e){let n=this.width(),i=this.height(),s=this.pointerDirection(),a=this.pointerWidth(),r=this.pointerHeight(),l=this.cornerRadius(),c=0,p=0,m=0,g=0;if(typeof l==="number")c=p=m=g=Math.min(l,n/2,i/2);else c=Math.min(l[0]||0,n/2,i/2),p=Math.min(l[1]||0,n/2,i/2),g=Math.min(l[2]||0,n/2,i/2),m=Math.min(l[3]||0,n/2,i/2);if(e.beginPath(),e.moveTo(c,0),s===C3)e.lineTo((n-a)/2,0),e.lineTo(n/2,-1*r),e.lineTo((n+a)/2,0);if(e.lineTo(n-p,0),e.arc(n-p,p,p,Math.PI*3/2,0,!1),s===j3)e.lineTo(n,(i-r)/2),e.lineTo(n+a,i/2),e.lineTo(n,(i+r)/2);if(e.lineTo(n,i-g),e.arc(n-g,i-g,g,0,Math.PI/2,!1),s===E3)e.lineTo((n+a)/2,i),e.lineTo(n/2,i+r),e.lineTo((n-a)/2,i);if(e.lineTo(m,i),e.arc(m,i-m,m,Math.PI/2,Math.PI,!1),s===q3)e.lineTo(0,(i+r)/2),e.lineTo(-1*a,i/2),e.lineTo(0,(i-r)/2);e.lineTo(0,c),e.arc(c,c,c,Math.PI,Math.PI*3/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){let e=0,n=0,i=this.pointerWidth(),s=this.pointerHeight(),a=this.pointerDirection(),r=this.width(),l=this.height();if(a===C3)n-=s,l+=s;else if(a===E3)l+=s;else if(a===q3)e-=i*1.5,r+=i;else if(a===j3)r+=i*1.5;return{x:e,y:n,width:r,height:l}}}Fl.prototype.className="Tag";mn(Fl);_e.addGetterSetter(Fl,"pointerDirection",wN);_e.addGetterSetter(Fl,"pointerWidth",0,dt());_e.addGetterSetter(Fl,"pointerHeight",0,dt());_e.addGetterSetter(Fl,"cornerRadius",0,Xc(4));class $c extends _t{_sceneFunc(e){let n=this.cornerRadius(),i=this.width(),s=this.height();if(e.beginPath(),!n)e.rect(0,0,i,s);else Be.drawRoundedRectPath(e,i,s,n);e.closePath(),e.fillStrokeShape(this)}}$c.prototype.className="Rect";mn($c);_e.addGetterSetter($c,"cornerRadius",0,Xc(4));class Lo extends _t{_sceneFunc(e){let n=this._getPoints(),i=this.radius(),s=this.sides(),a=this.cornerRadius();if(e.beginPath(),!a){e.moveTo(n[0].x,n[0].y);for(let r=1;r<n.length;r++)e.lineTo(n[r].x,n[r].y)}else Be.drawRoundedPolygonPath(e,n,s,i,a);e.closePath(),e.fillStrokeShape(this)}_getPoints(){let e=this.attrs.sides,n=this.attrs.radius||0,i=[];for(let s=0;s<e;s++)i.push({x:n*Math.sin(s*2*Math.PI/e),y:-1*n*Math.cos(s*2*Math.PI/e)});return i}getSelfRect(){let e=this._getPoints(),n=e[0].x,i=e[0].x,s=e[0].y,a=e[0].y;return e.forEach((r)=>{n=Math.min(n,r.x),i=Math.max(i,r.x),s=Math.min(s,r.y),a=Math.max(a,r.y)}),{x:n,y:s,width:i-n,height:a-s}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}Lo.prototype.className="RegularPolygon";Lo.prototype._centroid=!0;Lo.prototype._attrsAffectingSize=["radius"];mn(Lo);_e.addGetterSetter(Lo,"radius",0,dt());_e.addGetterSetter(Lo,"sides",0,dt());_e.addGetterSetter(Lo,"cornerRadius",0,Xc(4));var fx=Math.PI*2;class Nl extends _t{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,fx,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),fx,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Nl.prototype.className="Ring";Nl.prototype._centroid=!0;Nl.prototype._attrsAffectingSize=["innerRadius","outerRadius"];mn(Nl);_e.addGetterSetter(Nl,"innerRadius",0,dt());_e.addGetterSetter(Nl,"outerRadius",0,dt());class Dr extends _t{constructor(e){super(e);this._updated=!0,this.anim=new da(()=>{let n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){if(!this.anim.isRunning())return;clearInterval(this.interval),this._setInterval()})}_sceneFunc(e){let n=this.animation(),i=this.frameIndex(),s=i*4,a=this.animations()[n],r=this.frameOffsets(),l=a[s+0],c=a[s+1],p=a[s+2],m=a[s+3],g=this.image();if(this.hasFill()||this.hasStroke())e.beginPath(),e.rect(0,0,p,m),e.closePath(),e.fillStrokeShape(this);if(g)if(r){let y=r[n],x=i*2;e.drawImage(g,l,c,p,m,y[x+0],y[x+1],p,m)}else e.drawImage(g,l,c,p,m,0,0,p,m)}_hitFunc(e){let n=this.animation(),i=this.frameIndex(),s=i*4,a=this.animations()[n],r=this.frameOffsets(),l=a[s+2],c=a[s+3];if(e.beginPath(),r){let p=r[n],m=i*2;e.rect(p[m+0],p[m+1],l,c)}else e.rect(0,0,l,c);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){let e=this;this.interval=setInterval(function(){e._updateIndex()},1000/this.frameRate())}start(){if(this.isRunning())return;let e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){let e=this.frameIndex(),n=this.animation(),i=this.animations(),s=i[n],a=s.length/4;if(e<a-1)this.frameIndex(e+1);else this.frameIndex(0)}}Dr.prototype.className="Sprite";mn(Dr);_e.addGetterSetter(Dr,"animation");_e.addGetterSetter(Dr,"animations");_e.addGetterSetter(Dr,"frameOffsets");_e.addGetterSetter(Dr,"image");_e.addGetterSetter(Dr,"frameIndex",0,dt());_e.addGetterSetter(Dr,"frameRate",17,dt());_e.backCompat(Dr,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});class Ho extends _t{_sceneFunc(e){let n=this.innerRadius(),i=this.outerRadius(),s=this.numPoints();e.beginPath(),e.moveTo(0,0-i);for(let a=1;a<s*2;a++){let r=a%2===0?i:n,l=r*Math.sin(a*Math.PI/s),c=-1*r*Math.cos(a*Math.PI/s);e.lineTo(l,c)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Ho.prototype.className="Star";Ho.prototype._centroid=!0;Ho.prototype._attrsAffectingSize=["innerRadius","outerRadius"];mn(Ho);_e.addGetterSetter(Ho,"numPoints",5,dt());_e.addGetterSetter(Ho,"innerRadius",0,dt());_e.addGetterSetter(Ho,"outerRadius",0,dt());function xd(e){return[...e].reduce((n,i,s,a)=>{if(/\p{Emoji}/u.test(i)){let r=a[s+1];if(r&&/\p{Emoji_Modifier}|\u200D/u.test(r))n.push(i+r),a[s+1]="";else n.push(i)}else if(/\p{Regional_Indicator}{2}/u.test(i+(a[s+1]||"")))n.push(i+a[s+1]);else if(s>0&&/\p{Mn}|\p{Me}|\p{Mc}/u.test(i))n[n.length-1]+=i;else if(i)n.push(i);return n},[])}var _d="auto",vN="center",bx="inherit",Vp="justify",SN="Change.konva",wx="2d",dx="-",yx="left",_N="text",xN="Text",kN="top",TN="bottom",px="middle",vx="normal",AN="px ",Pb=" ",CN="right",mx="rtl",jN="word",EN="char",gx="none",D3="…",Sx=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],qN=Sx.length,Xp=null;function DN(){if(Xp!==null)return Xp;Xp=!1;try{let e=document.createElement("canvas");e.width=10,e.height=10;let n=e.getContext(wx);if(n){n.globalAlpha=0,n.shadowColor="black",n.shadowBlur=5,n.shadowOffsetX=5,n.shadowOffsetY=5,n.fillStyle="black",n.font="10px Arial",n.fillText("X",0,10);let i=n.getImageData(0,0,10,10).data;for(let s=3;s<i.length;s+=4)if(i[s]>0){Xp=!0;break}}}catch(e){}return Xp}function IN(e){return e.split(",").map((n)=>{n=n.trim();let i=n.indexOf(" ")>=0,s=n.indexOf('"')>=0||n.indexOf("'")>=0;if(i&&!s)n=`"${n}"`;return n}).join(", ")}var Bb;function I3(){if(Bb)return Bb;return Bb=Be.createCanvasElement().getContext(wx),Bb}function MN(e){if(this._partialFillStyle)e.setAttr("fillStyle",this._partialFillStyle);e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function RN(e){if(e.setAttr("miterLimit",2),this._partialStrokeStyle)e.setAttr("strokeStyle",this._partialStrokeStyle);e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function ON(e){if(e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage)e.fill=e.fill||"black";return e}class si extends _t{constructor(e){super(ON(e));this._partialTextX=0,this._partialTextY=0;for(let n=0;n<qN;n++)this.on(Sx[n]+SN,this._setTextData);this._setTextData()}_sceneFunc(e){var n,i;let s=this.textArr,a=s.length;if(!this.text())return;let r=this.padding(),l=this.fontSize(),c=this.lineHeight()*l,p=this.verticalAlign(),m=this.direction(),g=0,y=this.align(),x=this.getWidth(),j=this.letterSpacing(),I=this.charRenderFunc(),P=this.fill(),X=this.textDecoration(),Y=this.underlineOffset(),J=X.indexOf("underline")!==-1,ne=X.indexOf("line-through")!==-1,ae;m=m===bx?e.direction:m;let se=c/2,oe=px;if(!Tt.legacyTextRendering){let Ce=this.measureSize("M");oe="alphabetic";let Ne=(n=Ce.fontBoundingBoxAscent)!==null&&n!==void 0?n:Ce.actualBoundingBoxAscent,Pe=(i=Ce.fontBoundingBoxDescent)!==null&&i!==void 0?i:Ce.actualBoundingBoxDescent;se=(Ne-Pe)/2+c/2}if(m===mx)e.setAttr("direction",m);if(e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",oe),e.setAttr("textAlign",yx),p===px)g=(this.getHeight()-a*c-r*2)/2;else if(p===TN)g=this.getHeight()-a*c-r*2;e.translate(r,g+r);let he=I?e.fillStyle:void 0,we=I?e.strokeStyle:void 0;for(ae=0;ae<a;ae++){let Ce=0,Ne=0,Pe=s[ae],{text:Ue,width:ze,lastInParagraph:He}=Pe;if(e.save(),y===CN)Ce+=x-ze-r*2;else if(y===vN)Ce+=(x-ze-r*2)/2;if(J){e.save(),e.beginPath();let Fe=Y!==null&&Y!==void 0?Y:!Tt.legacyTextRendering?Math.round(l/4):Math.round(l/2),bt=Ce,Ve=se+Ne+Fe;e.moveTo(bt,Ve);let $e=y===Vp&&!He?x-r*2:ze;e.lineTo(bt+Math.round($e),Ve),e.lineWidth=l/15;let Ct=this._getLinearGradient();e.strokeStyle=Ct||P,e.stroke(),e.restore()}let De=Ce;if(m!==mx&&(j!==0||y===Vp||I)){let Fe=Ue.split(" ").length-1,bt=xd(Ue);for(let Ve=0;Ve<bt.length;Ve++){let $e=bt[Ve];if($e===" "&&!He&&y===Vp)Ce+=(x-r*2-ze)/Fe;if(this._partialTextX=Ce,this._partialTextY=se+Ne,this._partialText=$e,I){e.save();let ct=s.slice(0,ae).reduce((hn,nn)=>hn+xd(nn.text).length,0),Ze=Ve+ct;I({char:$e,index:Ze,x:Ce,y:se+Ne,lineIndex:ae,column:Ve,isLastInLine:He,width:this.measureSize($e).width,context:e});let mt=e.fillStyle;if(mt!==he)this._partialFillStyle=mt;let Xt=e.strokeStyle;if(Xt!==we)this._partialStrokeStyle=Xt}if(e.fillStrokeShape(this),I)this._partialFillStyle=void 0,this._partialStrokeStyle=void 0,e.restore();Ce+=this.measureSize($e).width+j}}else{if(j!==0)e.setAttr("letterSpacing",`${j}px`);this._partialTextX=Ce,this._partialTextY=se+Ne,this._partialText=Ue,e.fillStrokeShape(this)}if(ne){e.save(),e.beginPath();let Fe=!Tt.legacyTextRendering?-Math.round(l/4):0,bt=De;e.moveTo(bt,se+Ne+Fe);let Ve=y===Vp&&!He?x-r*2:ze;e.lineTo(bt+Math.round(Ve),se+Ne+Fe),e.lineWidth=l/15;let $e=this._getLinearGradient();e.strokeStyle=$e||P,e.stroke(),e.restore()}if(e.restore(),a>1)se+=c}}_hitFunc(e){let n=this.getWidth(),i=this.getHeight();e.beginPath(),e.rect(0,0,n,i),e.closePath(),e.fillStrokeShape(this)}setText(e){let n=Be._isString(e)?e:e===null||e===void 0?"":e+"";return this._setAttr(_N,n),this}getWidth(){return this.attrs.width===_d||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===_d||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return Be.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var n,i,s,a,r,l,c,p,m,g,y;let x=I3(),j=this.fontSize(),I;x.save(),x.font=this._getContextFont(),I=x.measureText(e),x.restore();let P=j/100;return{actualBoundingBoxAscent:(n=I.actualBoundingBoxAscent)!==null&&n!==void 0?n:71.58203125*P,actualBoundingBoxDescent:(i=I.actualBoundingBoxDescent)!==null&&i!==void 0?i:0,actualBoundingBoxLeft:(s=I.actualBoundingBoxLeft)!==null&&s!==void 0?s:-7.421875*P,actualBoundingBoxRight:(a=I.actualBoundingBoxRight)!==null&&a!==void 0?a:75.732421875*P,alphabeticBaseline:(r=I.alphabeticBaseline)!==null&&r!==void 0?r:0,emHeightAscent:(l=I.emHeightAscent)!==null&&l!==void 0?l:100*P,emHeightDescent:(c=I.emHeightDescent)!==null&&c!==void 0?c:-20*P,fontBoundingBoxAscent:(p=I.fontBoundingBoxAscent)!==null&&p!==void 0?p:91*P,fontBoundingBoxDescent:(m=I.fontBoundingBoxDescent)!==null&&m!==void 0?m:21*P,hangingBaseline:(g=I.hangingBaseline)!==null&&g!==void 0?g:72.80000305175781*P,ideographicBaseline:(y=I.ideographicBaseline)!==null&&y!==void 0?y:-21*P,width:I.width,height:j}}_getContextFont(){return this.fontStyle()+Pb+this.fontVariant()+Pb+(this.fontSize()+AN)+IN(this.fontFamily())}_addTextLine(e){if(this.align()===Vp)e=e.trim();let i=this._getTextWidth(e);return this.textArr.push({text:e,width:i,lastInParagraph:!1})}_getTextWidth(e){let n=this.letterSpacing(),i=e.length;return I3().measureText(e).width+n*i}_setTextData(){let e=this.text().split(`
|
|
237
|
+
`),n=+this.fontSize(),i=0,s=this.lineHeight()*n,a=this.attrs.width,r=this.attrs.height,l=a!==_d&&a!==void 0,c=r!==_d&&r!==void 0,p=this.padding(),m=a-p*2,g=r-p*2,y=0,x=this.wrap(),j=x!==gx,I=x!==EN&&j,P=this.ellipsis();this.textArr=[],I3().font=this._getContextFont();let X=P?this._getTextWidth(D3):0;for(let Y=0,J=e.length;Y<J;++Y){let ne=e[Y],ae=this._getTextWidth(ne);if(l&&ae>m)while(ne.length>0){let se=xd(ne),oe=0,he=se.length,we="",Ce=0;while(oe<he){let Ne=oe+he>>>1,Pe=se.slice(0,Ne+1).join(""),Ue=this._getTextWidth(Pe);if((P&&c&&y+s>g?Ue+X:Ue)<=m)oe=Ne+1,we=Pe,Ce=Ue;else he=Ne}if(we){if(I){let Pe=xd(we),Ue=se[Pe.length],ze=Ue===Pb||Ue===dx,He;if(ze&&Ce<=m)He=Pe.length;else{let De=Pe.lastIndexOf(Pb),Fe=Pe.lastIndexOf(dx);He=Math.max(De,Fe)+1}if(He>0)oe=He,we=se.slice(0,oe).join(""),Ce=this._getTextWidth(we)}if(we=we.trimRight(),this._addTextLine(we),i=Math.max(i,Ce),y+=s,this._shouldHandleEllipsis(y)){this._tryToAddEllipsisToLastLine();break}if(ne=se.slice(oe).join("").trimLeft(),ne.length>0){if(ae=this._getTextWidth(ne),ae<=m){this._addTextLine(ne),y+=s,i=Math.max(i,ae);break}}}else break}else if(this._addTextLine(ne),y+=s,i=Math.max(i,ae),this._shouldHandleEllipsis(y)&&Y<J-1)this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1])this.textArr[this.textArr.length-1].lastInParagraph=!0;if(c&&y+s>g)break}this.textHeight=n,this.textWidth=i}_shouldHandleEllipsis(e){let n=+this.fontSize(),i=this.lineHeight()*n,s=this.attrs.height,a=s!==_d&&s!==void 0,r=this.padding(),l=s-r*2;return this.wrap()===gx||a&&e+i>l}_tryToAddEllipsisToLastLine(){let e=this.attrs.width,n=e!==_d&&e!==void 0,i=this.padding(),s=e-i*2,a=this.ellipsis(),r=this.textArr[this.textArr.length-1];if(!r||!a)return;if(n){if(!(this._getTextWidth(r.text+D3)<s))r.text=r.text.slice(0,r.text.length-3)}this.textArr.splice(this.textArr.length-1,1),this._addTextLine(r.text+D3)}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){let e=this.textDecoration().indexOf("underline")!==-1||this.textDecoration().indexOf("line-through")!==-1,n=this.hasShadow();if(e&&n)return!0;if(n&&this.getAbsoluteOpacity()!==1&&DN())return!0;return super._useBufferCanvas()}}si.prototype._fillFunc=MN;si.prototype._strokeFunc=RN;si.prototype.className=xN;si.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"];mn(si);_e.overWriteSetter(si,"width",Ip());_e.overWriteSetter(si,"height",Ip());_e.addGetterSetter(si,"direction",bx);_e.addGetterSetter(si,"fontFamily","Arial");_e.addGetterSetter(si,"fontSize",12,dt());_e.addGetterSetter(si,"fontStyle",vx);_e.addGetterSetter(si,"fontVariant",vx);_e.addGetterSetter(si,"padding",0,dt());_e.addGetterSetter(si,"align",yx);_e.addGetterSetter(si,"verticalAlign",kN);_e.addGetterSetter(si,"lineHeight",1,dt());_e.addGetterSetter(si,"wrap",jN);_e.addGetterSetter(si,"ellipsis",!1,Hs());_e.addGetterSetter(si,"letterSpacing",0,dt());_e.addGetterSetter(si,"text","",Fo());_e.addGetterSetter(si,"textDecoration","");_e.addGetterSetter(si,"underlineOffset",void 0,dt());_e.addGetterSetter(si,"charRenderFunc",void 0);var FN="",_x="normal";function xx(e){e.fillText(this.partialText,0,0)}function kx(e){e.strokeText(this.partialText,0,0)}class Ui extends _t{constructor(e){super(e);this.dummyCanvas=Be.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva directionChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return ui.getPathLength(this.dataArray)}_getPointAtLength(e){if(!this.attrs.data)return null;let n=this.pathLength;if(e>n)return null;return ui.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=ui.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();let n=this.textDecoration(),i=this.fill(),s=this.fontSize(),a=this.glyphInfo,r=n.indexOf("underline")!==-1,l=n.indexOf("line-through")!==-1;if(r)e.beginPath();for(let c=0;c<a.length;c++){e.save();let p=a[c].p0;if(e.translate(p.x,p.y),e.rotate(a[c].rotation),this.partialText=a[c].text,e.fillStrokeShape(this),r){if(c===0)e.moveTo(0,s/2+1);e.lineTo(a[c].width,s/2+1)}e.restore()}if(r)e.strokeStyle=i,e.lineWidth=s/20,e.stroke();if(l){e.beginPath();for(let c=0;c<a.length;c++){e.save();let p=a[c].p0;if(e.translate(p.x,p.y),e.rotate(a[c].rotation),c===0)e.moveTo(0,0);e.lineTo(a[c].width,0),e.restore()}e.strokeStyle=i,e.lineWidth=s/20,e.stroke()}e.restore()}_hitFunc(e){e.beginPath();let n=this.glyphInfo;if(n.length>=1){let i=n[0].p0;e.moveTo(i.x,i.y)}for(let i=0;i<n.length;i++){let s=n[i].p1;e.lineTo(s.x,s.y)}e.setAttr("lineWidth",this.fontSize()),e.setAttr("strokeStyle",this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return Be.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return si.prototype.setText.call(this,e)}_getContextFont(){return si.prototype._getContextFont.call(this)}_getTextSize(e){let i=this.dummyCanvas.getContext("2d");i.save(),i.font=this._getContextFont();let s=i.measureText(e);return i.restore(),{width:s.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){let e=xd(this.text());if(this.direction()==="rtl")e.reverse();let n=[],i=0;for(let x=0;x<e.length;x++)n.push({char:e[x],width:this._getTextSize(e[x]).width}),i+=n[x].width;let{width:s,height:a}=this._getTextSize(this.attrs.text);if(this.textWidth=i,this.textHeight=a,this.glyphInfo=[],!this.attrs.data)return null;let r=this.letterSpacing(),l=this.align(),c=this.kerningFunc(),p=Math.max(0,i-s),m=Math.max(this.textWidth+((this.attrs.text||"").length-1)*r,0),g=0;if(l==="center")g=Math.max(0,this.pathLength/2-m/2);if(l==="right")g=Math.max(0,this.pathLength-m);let y=g;for(let x=0;x<n.length;x++){let j=this._getPointAtLength(y);if(!j)return;let I=n[x].char,P=n[x].width+r;if(I===" "&&l==="justify"){let oe=this.text().split(" ").length-1;P+=(this.pathLength-m)/oe}let X=y+P,Y=this._getPointAtLength(X>this.pathLength&&X-this.pathLength<=p?this.pathLength:X);if(!Y)return;let J=ui.getLineLength(j.x,j.y,Y.x,Y.y),ne=0;if(c)try{ne=c(n[x-1].char,I)*this.fontSize()}catch(oe){ne=0}j.x+=ne,Y.x+=ne,this.textWidth+=ne;let ae=ui.getPointOnLine(ne+J/2,j.x,j.y,Y.x,Y.y),se=Math.atan2(Y.y-j.y,Y.x-j.x);this.glyphInfo.push({transposeX:ae.x,transposeY:ae.y,text:e[x],rotation:se,p0:j,p1:Y,width:J}),y+=P}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};let e=[];this.glyphInfo.forEach(function(p){e.push(p.p0.x),e.push(p.p0.y),e.push(p.p1.x),e.push(p.p1.y)});let n=e[0]||0,i=e[0]||0,s=e[1]||0,a=e[1]||0,r,l;for(let p=0;p<e.length/2;p++)r=e[p*2],l=e[p*2+1],n=Math.min(n,r),i=Math.max(i,r),s=Math.min(s,l),a=Math.max(a,l);let c=this.fontSize();return{x:n-c/2,y:s-c/2,width:i-n+c,height:a-s+c}}destroy(){return Be.releaseCanvas(this.dummyCanvas),super.destroy()}}Ui.prototype._fillFunc=xx;Ui.prototype._strokeFunc=kx;Ui.prototype._fillFuncHit=xx;Ui.prototype._strokeFuncHit=kx;Ui.prototype.className="TextPath";Ui.prototype._attrsAffectingSize=["text","fontSize","data"];mn(Ui);_e.addGetterSetter(Ui,"data");_e.addGetterSetter(Ui,"fontFamily","Arial");_e.addGetterSetter(Ui,"fontSize",12,dt());_e.addGetterSetter(Ui,"fontStyle",_x);_e.addGetterSetter(Ui,"align","left");_e.addGetterSetter(Ui,"letterSpacing",0,dt());_e.addGetterSetter(Ui,"textBaseline","middle");_e.addGetterSetter(Ui,"fontVariant",_x);_e.addGetterSetter(Ui,"text",FN);_e.addGetterSetter(Ui,"textDecoration","");_e.addGetterSetter(Ui,"kerningFunc",void 0);_e.addGetterSetter(Ui,"direction","inherit");var Cx="tr-konva",NN=["resizeEnabledChange","rotateAnchorOffsetChange","rotateAnchorAngleChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map((e)=>e+`.${Cx}`).join(" "),Tx="nodesRect",PN=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange","draggableChange"],BN={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},LN="ontouchstart"in Tt._global;function HN(e,n,i){if(e==="rotater")return i;n+=Be.degToRad(BN[e]||0);let s=(Be.radToDeg(n)%360+360)%360;if(Be._inRange(s,337.5,360)||Be._inRange(s,0,22.5))return"ns-resize";else if(Be._inRange(s,22.5,67.5))return"nesw-resize";else if(Be._inRange(s,67.5,112.5))return"ew-resize";else if(Be._inRange(s,112.5,157.5))return"nwse-resize";else if(Be._inRange(s,157.5,202.5))return"ns-resize";else if(Be._inRange(s,202.5,247.5))return"nesw-resize";else if(Be._inRange(s,247.5,292.5))return"ew-resize";else if(Be._inRange(s,292.5,337.5))return"nwse-resize";else return Be.error("Transformer has unknown angle for cursor detection: "+s),"pointer"}var Lb=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],Ax=1e8;function UN(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function jx(e,n,i){let s=i.x+(e.x-i.x)*Math.cos(n)-(e.y-i.y)*Math.sin(n),a=i.y+(e.x-i.x)*Math.sin(n)+(e.y-i.y)*Math.cos(n);return{...e,rotation:e.rotation+n,x:s,y:a}}function zN(e,n){let i=UN(e);return jx(e,n,i)}function GN(e,n,i){let s=n;for(let a=0;a<e.length;a++){let r=Tt.getAngle(e[a]),l=Math.abs(r-n)%(Math.PI*2);if(Math.min(l,Math.PI*2-l)<i)s=r}return s}var M3=0;class jn extends Po{constructor(e){super(e);if(this._movingAnchorName=null,this._transforming=!1,this._transformWindow=null,this._elementsCreated=!1,this._updateScheduled=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(NN,this.update),this.getNode())this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return Be.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return Cx+this._id}setNodes(e=[]){if(this._nodes&&this._nodes.length)this.detach();let n=e.filter((s)=>{if(s.isAncestorOf(this))return Be.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1;return!0});if(this._nodes=e=n,e.length===1&&this.useSingleNodeRotation())this.rotation(e[0].getAbsoluteRotation());else this.rotation(0);if(this._nodes.forEach((s)=>{let a=()=>{if(this._transforming)return;if(this.nodes().length===1&&this.useSingleNodeRotation())this.rotation(this.nodes()[0].getAbsoluteRotation());if(this._resetTransformCache(),!this.isDragging())this._scheduleUpdate()};if(s._attrsAffectingSize.length){let r=s._attrsAffectingSize.map((l)=>l+"Change."+this._getEventNamespace()).join(" ");s.on(r,a)}s.on(PN.map((r)=>r+`.${this._getEventNamespace()}`).join(" "),a),s.on(`absoluteTransformChange.${this._getEventNamespace()}`,a),this._proxyDrag(s)}),this._resetTransformCache(),!!this.findOne(".top-left"))this.update();return this}_proxyDrag(e){let n;e.on(`dragstart.${this._getEventNamespace()}`,(i)=>{if(n=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back"))this.startDrag(i,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,(i)=>{if(!n)return;let s=e.getAbsolutePosition(),a=s.x-n.x,r=s.y-n.y;this.nodes().forEach((l)=>{if(l===e)return;if(l.isDragging())return;let c=l.getAbsolutePosition();l.setAbsolutePosition({x:c.x+a,y:c.y+r}),l.startDrag(i)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){if(this._nodes)this._nodes.forEach((e)=>{e.off("."+this._getEventNamespace())});this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(Tx),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(Tx,this.__getNodeRect)}__getNodeShape(e,n=this.rotation(),i){let s=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),a=e.getAbsoluteScale(i),r=e.getAbsolutePosition(i),l=s.x*a.x-e.offsetX()*a.x,c=s.y*a.y-e.offsetY()*a.y,p=(Tt.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),m={x:r.x+l*Math.cos(p)+c*Math.sin(-p),y:r.y+c*Math.cos(p)+l*Math.sin(p),width:s.width*a.x,height:s.height*a.y,rotation:p};return jx(m,-Tt.getAngle(n),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-Ax,y:-Ax,width:0,height:0,rotation:0};let n=[];this.nodes().map((p)=>{let m=p.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),g=[{x:m.x,y:m.y},{x:m.x+m.width,y:m.y},{x:m.x+m.width,y:m.y+m.height},{x:m.x,y:m.y+m.height}],y=p.getAbsoluteTransform();g.forEach(function(x){let j=y.point(x);n.push(j)})});let i=new Ps;i.rotate(-Tt.getAngle(this.rotation()));let s=1/0,a=1/0,r=-1/0,l=-1/0;n.forEach(function(p){let m=i.point(p);if(s===void 0)s=r=m.x,a=l=m.y;s=Math.min(s,m.x),a=Math.min(a,m.y),r=Math.max(r,m.x),l=Math.max(l,m.y)}),i.invert();let c=i.point({x:s,y:a});return{x:c.x,y:c.y,width:r-s,height:l-a,rotation:Tt.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),Lb.forEach((e)=>{this._createAnchor(e)}),this._createAnchor("rotater"),this._elementsCreated=!0}_createAnchor(e){let n=new $c({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:LN?10:"auto"}),i=this;n.on("mousedown touchstart",function(s){i._handleMouseDown(s)}),n.on("dragstart",(s)=>{n.stopDrag(),s.cancelBubble=!0}),n.on("dragend",(s)=>{s.cancelBubble=!0}),n.on("mouseenter",()=>{let s=Tt.getAngle(this.rotation()),a=this.rotateAnchorCursor(),r=HN(e,s,a);n.getStage().content&&(n.getStage().content.style.cursor=r),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){let e=new _t({name:"back",width:0,height:0,sceneFunc(n,i){let s=i.getParent(),a=s.padding(),r=i.width(),l=i.height();if(n.beginPath(),n.rect(-a,-a,r+a*2,l+a*2),s.rotateEnabled()&&s.rotateLineVisible()){let c=s.rotateAnchorAngle(),p=s.rotateAnchorOffset(),m=Be.degToRad(c),g=Math.sin(m),y=-Math.cos(m),x=r/2,j=l/2,I=1/0;if(y<0)I=Math.min(I,-j/y);else if(y>0)I=Math.min(I,(l-j)/y);if(g<0)I=Math.min(I,-x/g);else if(g>0)I=Math.min(I,(r-x)/g);let P=x+g*I,X=j+y*I,Y=Be._sign(l),J=P+g*p*Y,ne=X+y*p*Y;n.moveTo(P,X),n.lineTo(J,ne)}n.fillStrokeShape(i)},hitFunc:(n,i)=>{if(!this.shouldOverdrawWholeArea())return;let s=this.padding();n.beginPath(),n.rect(-s,-s,i.width()+s*2,i.height()+s*2),n.fillStrokeShape(i)}});this.add(e),this._proxyDrag(e),e.on("dragstart",(n)=>{n.cancelBubble=!0}),e.on("dragmove",(n)=>{n.cancelBubble=!0}),e.on("dragend",(n)=>{n.cancelBubble=!0}),this.on("dragmove",(n)=>{this.update()})}_handleMouseDown(e){var n;if(this._transforming)return;this._movingAnchorName=e.target.name().split(" ")[0];let i=this._getNodeRect(),{width:s,height:a}=i,r=Math.sqrt(Math.pow(s,2)+Math.pow(a,2));this.sin=Math.abs(a/r),this.cos=Math.abs(s/r);let l=(n=this.getStage())===null||n===void 0?void 0:n._getOwnerWindow();if(this._transformWindow=l||null,l)l.addEventListener("mousemove",this._handleMouseMove),l.addEventListener("touchmove",this._handleMouseMove),l.addEventListener("mouseup",this._handleMouseUp,!0),l.addEventListener("touchend",this._handleMouseUp,!0);this._transforming=!0;let c=e.target.getAbsolutePosition(),p=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:p.x-c.x,y:p.y-c.y},M3++,this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach((m)=>{m._fire("transformstart",{evt:e.evt,target:m})})}_handleMouseMove(e){let n,i,s,a=this.findOne("."+this._movingAnchorName),r=a.getStage();r.setPointersPositions(e);let l=r.getPointerPosition(),c={x:l.x-this._anchorDragOffset.x,y:l.y-this._anchorDragOffset.y},p=a.getAbsolutePosition();if(this.anchorDragBoundFunc())c=this.anchorDragBoundFunc()(p,c,e);a.setAbsolutePosition(c);let m=a.getAbsolutePosition();if(p.x===m.x&&p.y===m.y)return;if(this._movingAnchorName==="rotater"){let J=this._getNodeRect();n=a.x()-J.width/2,i=-a.y()+J.height/2;let ne=Tt.getAngle(this.rotateAnchorAngle()),ae=Math.atan2(-i,n)+Math.PI/2-ne;if(J.height<0)ae-=Math.PI;let oe=Tt.getAngle(this.rotation())+ae,he=Tt.getAngle(this.rotationSnapTolerance()),Ce=GN(this.rotationSnaps(),oe,he)-J.rotation,Ne=zN(J,Ce);this._fitNodesInto(Ne,e);return}let g=this.shiftBehavior(),y;if(g==="inverted")y=this.keepRatio()&&!e.shiftKey;else if(g==="none")y=this.keepRatio();else y=this.keepRatio()||e.shiftKey;let x=this.centeredScaling()||e.altKey,j=!1;if(this._movingAnchorName==="top-left"){if(y){j=!0;let J=x?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};s=Math.sqrt(Math.pow(J.x-a.x(),2)+Math.pow(J.y-a.y(),2));let ne=this.findOne(".top-left").x()>J.x?-1:1,ae=this.findOne(".top-left").y()>J.y?-1:1;n=s*this.cos*ne,i=s*this.sin*ae,this.findOne(".top-left").x(J.x-n),this.findOne(".top-left").y(J.y-i)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(a.y());else if(this._movingAnchorName==="top-right"){if(y){j=!0;let J=x?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};s=Math.sqrt(Math.pow(a.x()-J.x,2)+Math.pow(J.y-a.y(),2));let ne=this.findOne(".top-right").x()<J.x?-1:1,ae=this.findOne(".top-right").y()>J.y?-1:1;n=s*this.cos*ne,i=s*this.sin*ae,this.findOne(".top-right").x(J.x+n),this.findOne(".top-right").y(J.y-i)}var I=a.position();this.findOne(".top-left").y(I.y),this.findOne(".bottom-right").x(I.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(a.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(a.x());else if(this._movingAnchorName==="bottom-left"){if(y){j=!0;let J=x?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};s=Math.sqrt(Math.pow(J.x-a.x(),2)+Math.pow(a.y()-J.y,2));let ne=J.x<a.x()?-1:1,ae=a.y()<J.y?-1:1;n=s*this.cos*ne,i=s*this.sin*ae,a.x(J.x-n),a.y(J.y+i)}I=a.position(),this.findOne(".top-left").x(I.x),this.findOne(".bottom-right").y(I.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(a.y());else if(this._movingAnchorName==="bottom-right"){if(y){j=!0;let J=x?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};s=Math.sqrt(Math.pow(a.x()-J.x,2)+Math.pow(a.y()-J.y,2));let ne=this.findOne(".bottom-right").x()<J.x?-1:1,ae=this.findOne(".bottom-right").y()<J.y?-1:1;n=s*this.cos*ne,i=s*this.sin*ae,this.findOne(".bottom-right").x(J.x+n),this.findOne(".bottom-right").y(J.y+i)}}else console.error(Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(x=this.centeredScaling()||e.altKey,x){let J=this.findOne(".top-left"),ne=this.findOne(".bottom-right"),ae=J.x(),se=J.y(),oe=this.getWidth()-ne.x(),he=this.getHeight()-ne.y();ne.move({x:-ae,y:-se}),J.move({x:oe,y:he})}let P=this.findOne(".top-left").getAbsolutePosition();n=P.x,i=P.y;let X=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),Y=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:n,y:i,width:X,height:Y,rotation:Tt.getAngle(this.rotation())},e,j)}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){var n;if(this._transforming){this._transforming=!1;let i=this._transformWindow;if(this._transformWindow=null,i)i.removeEventListener("mousemove",this._handleMouseMove),i.removeEventListener("touchmove",this._handleMouseMove),i.removeEventListener("mouseup",this._handleMouseUp,!0),i.removeEventListener("touchend",this._handleMouseUp,!0);let s=this.getNode();if(M3--,this._fire("transformend",{evt:e,target:s}),(n=this.getLayer())===null||n===void 0||n.batchDraw(),s)this._nodes.forEach((a)=>{var r;a._fire("transformend",{evt:e,target:a}),(r=a.getLayer())===null||r===void 0||r.batchDraw()});this._movingAnchorName=null}}_fitNodesInto(e,n,i=!1){let s=Tt.autoDrawEnabled;Tt.autoDrawEnabled=!1;try{return this._doFitNodesInto(e,n,i)}finally{Tt.autoDrawEnabled=s}}_doFitNodesInto(e,n,i=!1){let s=this._getNodeRect(),a=1;if(Be._inRange(e.width,-this.padding()*2-1,1)){this.update();return}if(Be._inRange(e.height,-this.padding()*2-1,1)){this.update();return}let r=new Ps;r.rotate(Tt.getAngle(this.rotation()));let l=i?0:this.padding()*2,c=null,p=null;if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){let X=r.point({x:-l,y:0});e.x+=X.x,e.y+=X.y,e.width+=l,c={axis:"width",from:"left",to:"right",offset:X}}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){let X=r.point({x:l,y:0});e.width+=l,c={axis:"width",from:"right",to:"left",offset:X}}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){let X=r.point({x:0,y:-l});e.x+=X.x,e.y+=X.y,e.height+=l,p={axis:"height",from:"top",to:"bottom",offset:X}}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){let X=r.point({x:0,y:l});e.height+=l,p={axis:"height",from:"bottom",to:"top",offset:X}}if(this.boundBoxFunc()){let X=this.boundBoxFunc()(s,e);if(X)e=X;else Be.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}for(let X of[c,p])if(X&&e[X.axis]<0&&this._movingAnchorName)this._movingAnchorName=this._movingAnchorName.replace(X.from,X.to),this._anchorDragOffset.x-=X.offset.x,this._anchorDragOffset.y-=X.offset.y;let m=1e7,g=new Ps;g.translate(s.x,s.y),g.rotate(s.rotation),g.scale(s.width/m,s.height/m);let y=new Ps,x=e.width/m,j=e.height/m;if(this.flipEnabled()===!1)y.translate(e.x,e.y),y.rotate(e.rotation),y.translate(e.width<0?e.width:0,e.height<0?e.height:0),y.scale(Math.abs(x),Math.abs(j));else y.translate(e.x,e.y),y.rotate(e.rotation),y.scale(x,j);let I=y.multiply(g.invert()),P=new Set;this._nodes.forEach((X)=>{if(!X.getStage())return;let Y=X.getParent().getAbsoluteTransform(),J=X.getTransform().copy();J.translate(X.offsetX(),X.offsetY());let ne=new Ps;ne.multiply(Y.copy().invert()).multiply(I).multiply(Y).multiply(J);let ae=ne.decompose();X.setAttrs(ae);let se=X.getLayer();if(se)P.add(se)}),this.rotation(Be._getRotation(e.rotation)),this._nodes.forEach((X)=>{this._fire("transform",{evt:n,target:X}),X._fire("transform",{evt:n,target:X})}),this._resetTransformCache(),this.update(),P.add(this.getLayer()),P.forEach((X)=>X&&X.batchDraw())}_scheduleUpdate(){if(this._updateScheduled)return;this._updateScheduled=!0,wt._runAfterAbsTransformCascade(()=>{var e;if(this._updateScheduled=!1,!((e=this._nodes)===null||e===void 0?void 0:e.length)||this._transforming||this.isDragging())return;this.update()})}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,n){this.findOne(e).setAttrs(n)}update(){var e;let n=this._getNodeRect();this.rotation(Be._getRotation(n.rotation));let{width:i,height:s}=n,a=this.enabledAnchors(),r=this.resizeEnabled(),l=this.padding(),c=this.anchorSize(),p=this.find("._anchor");p.forEach((se)=>{se.setAttrs({width:c,height:c,offsetX:c/2,offsetY:c/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:c/2+l,offsetY:c/2+l,visible:r&&a.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:i/2,y:0,offsetY:c/2+l,visible:r&&a.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:i,y:0,offsetX:c/2-l,offsetY:c/2+l,visible:r&&a.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:s/2,offsetX:c/2+l,visible:r&&a.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:i,y:s/2,offsetX:c/2-l,visible:r&&a.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:s,offsetX:c/2+l,offsetY:c/2-l,visible:r&&a.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:i/2,y:s,offsetY:c/2-l,visible:r&&a.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:i,y:s,offsetX:c/2-l,offsetY:c/2-l,visible:r&&a.indexOf("bottom-right")>=0});let m=this.rotateAnchorAngle(),g=this.rotateAnchorOffset(),y=Be.degToRad(m),x=Math.sin(y),j=-Math.cos(y),I=i/2,P=s/2,X=1/0;if(j<0)X=Math.min(X,-P/j);else if(j>0)X=Math.min(X,(s-P)/j);if(x<0)X=Math.min(X,-I/x);else if(x>0)X=Math.min(X,(i-I)/x);let Y=I+x*X,J=P+j*X,ne=Be._sign(s);this._batchChangeChild(".rotater",{x:Y+x*g*ne,y:J+j*g*ne-l*j,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:i,height:s,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),draggable:this.nodes().some((se)=>se.draggable()),x:0,y:0});let ae=this.anchorStyleFunc();if(ae)p.forEach((se)=>{ae(se)});(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();let e=this.findOne("."+this._movingAnchorName);if(e)e.stopDrag()}}destroy(){if(this.getStage()&&this._cursorChange)this.getStage().content&&(this.getStage().content.style.cursor="");return Po.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}add(...e){if(this._elementsCreated)return Be.error("You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead."),this;return super.add(...e)}toObject(){return wt.prototype.toObject.call(this)}clone(e){return wt.prototype.clone.call(this,e)}getClientRect(){if(this.nodes().length>0)return super.getClientRect();else return{x:0,y:0,width:0,height:0}}}jn.isTransforming=()=>M3>0;function VN(e){if(!(e instanceof Array))Be.warn("enabledAnchors value should be an array");if(e instanceof Array)e.forEach(function(n){if(Lb.indexOf(n)===-1)Be.warn("Unknown anchor name: "+n+". Available names are: "+Lb.join(", "))});return e||[]}jn.prototype.className="Transformer";mn(jn);_e.addGetterSetter(jn,"enabledAnchors",Lb,VN);_e.addGetterSetter(jn,"flipEnabled",!0,Hs());_e.addGetterSetter(jn,"resizeEnabled",!0);_e.addGetterSetter(jn,"anchorSize",10,dt());_e.addGetterSetter(jn,"rotateEnabled",!0);_e.addGetterSetter(jn,"rotateLineVisible",!0);_e.addGetterSetter(jn,"rotationSnaps",[]);_e.addGetterSetter(jn,"rotateAnchorOffset",50,dt());_e.addGetterSetter(jn,"rotateAnchorAngle",0,dt());_e.addGetterSetter(jn,"rotateAnchorCursor","crosshair");_e.addGetterSetter(jn,"rotationSnapTolerance",5,dt());_e.addGetterSetter(jn,"borderEnabled",!0);_e.addGetterSetter(jn,"anchorStroke","rgb(0, 161, 255)");_e.addGetterSetter(jn,"anchorStrokeWidth",1,dt());_e.addGetterSetter(jn,"anchorFill","white");_e.addGetterSetter(jn,"anchorCornerRadius",0,dt());_e.addGetterSetter(jn,"borderStroke","rgb(0, 161, 255)");_e.addGetterSetter(jn,"borderStrokeWidth",1,dt());_e.addGetterSetter(jn,"borderDash");_e.addGetterSetter(jn,"keepRatio",!0);_e.addGetterSetter(jn,"shiftBehavior","default");_e.addGetterSetter(jn,"centeredScaling",!1);_e.addGetterSetter(jn,"ignoreStroke",!1);_e.addGetterSetter(jn,"padding",0,dt());_e.addGetterSetter(jn,"nodes");_e.addGetterSetter(jn,"node");_e.addGetterSetter(jn,"boundBoxFunc");_e.addGetterSetter(jn,"anchorDragBoundFunc");_e.addGetterSetter(jn,"anchorStyleFunc");_e.addGetterSetter(jn,"shouldOverdrawWholeArea",!1);_e.addGetterSetter(jn,"useSingleNodeRotation",!0);_e.backCompat(jn,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class to extends _t{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,Tt.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}to.prototype.className="Wedge";to.prototype._centroid=!0;to.prototype._attrsAffectingSize=["radius"];mn(to);_e.addGetterSetter(to,"radius",0,dt());_e.addGetterSetter(to,"angle",0,dt());_e.addGetterSetter(to,"clockwise",!1);_e.backCompat(to,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function Ex(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var XN=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],WN=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function KN(e,n){let{data:i,width:s,height:a}=e,r,l,c,p,m,g,y,x,j,I,P,X,Y,J,ne,ae,se,oe,he,we,Ce=n+n+1,Ne=s-1,Pe=a-1,Ue=n+1,ze=Ue*(Ue+1)/2,He=new Ex,De=XN[n],Fe=WN[n],bt=null,Ve=He,$e=null,Ct=null;for(let ct=1;ct<Ce;ct++)if(Ve=Ve.next=new Ex,ct===Ue)bt=Ve;Ve.next=He,c=l=0;for(let ct=0;ct<a;ct++){X=Y=J=ne=p=m=g=y=0,x=Ue*(ae=i[l]),j=Ue*(se=i[l+1]),I=Ue*(oe=i[l+2]),P=Ue*(he=i[l+3]),p+=ze*ae,m+=ze*se,g+=ze*oe,y+=ze*he,Ve=He;for(let Ze=0;Ze<Ue;Ze++)Ve.r=ae,Ve.g=se,Ve.b=oe,Ve.a=he,Ve=Ve.next;for(let Ze=1;Ze<Ue;Ze++)r=l+((Ne<Ze?Ne:Ze)<<2),p+=(Ve.r=ae=i[r])*(we=Ue-Ze),m+=(Ve.g=se=i[r+1])*we,g+=(Ve.b=oe=i[r+2])*we,y+=(Ve.a=he=i[r+3])*we,X+=ae,Y+=se,J+=oe,ne+=he,Ve=Ve.next;$e=He,Ct=bt;for(let Ze=0;Ze<s;Ze++){if(i[l+3]=he=y*De>>Fe,he!==0)he=255/he,i[l]=(p*De>>Fe)*he,i[l+1]=(m*De>>Fe)*he,i[l+2]=(g*De>>Fe)*he;else i[l]=i[l+1]=i[l+2]=0;p-=x,m-=j,g-=I,y-=P,x-=$e.r,j-=$e.g,I-=$e.b,P-=$e.a,r=c+((r=Ze+n+1)<Ne?r:Ne)<<2,X+=$e.r=i[r],Y+=$e.g=i[r+1],J+=$e.b=i[r+2],ne+=$e.a=i[r+3],p+=X,m+=Y,g+=J,y+=ne,$e=$e.next,x+=ae=Ct.r,j+=se=Ct.g,I+=oe=Ct.b,P+=he=Ct.a,X-=ae,Y-=se,J-=oe,ne-=he,Ct=Ct.next,l+=4}c+=s}for(let ct=0;ct<s;ct++){Y=J=ne=X=m=g=y=p=0,l=ct<<2,x=Ue*(ae=i[l]),j=Ue*(se=i[l+1]),I=Ue*(oe=i[l+2]),P=Ue*(he=i[l+3]),p+=ze*ae,m+=ze*se,g+=ze*oe,y+=ze*he,Ve=He;for(let mt=0;mt<Ue;mt++)Ve.r=ae,Ve.g=se,Ve.b=oe,Ve.a=he,Ve=Ve.next;let Ze=s;for(let mt=1;mt<=n;mt++)if(l=Ze+ct<<2,p+=(Ve.r=ae=i[l])*(we=Ue-mt),m+=(Ve.g=se=i[l+1])*we,g+=(Ve.b=oe=i[l+2])*we,y+=(Ve.a=he=i[l+3])*we,X+=ae,Y+=se,J+=oe,ne+=he,Ve=Ve.next,mt<Pe)Ze+=s;l=ct,$e=He,Ct=bt;for(let mt=0;mt<a;mt++){if(r=l<<2,i[r+3]=he=y*De>>Fe,he>0)he=255/he,i[r]=(p*De>>Fe)*he,i[r+1]=(m*De>>Fe)*he,i[r+2]=(g*De>>Fe)*he;else i[r]=i[r+1]=i[r+2]=0;p-=x,m-=j,g-=I,y-=P,x-=$e.r,j-=$e.g,I-=$e.b,P-=$e.a,r=ct+((r=mt+Ue)<Pe?r:Pe)*s<<2,p+=X+=$e.r=i[r],m+=Y+=$e.g=i[r+1],g+=J+=$e.b=i[r+2],y+=ne+=$e.a=i[r+3],$e=$e.next,x+=ae=Ct.r,j+=se=Ct.g,I+=oe=Ct.b,P+=he=Ct.a,X-=ae,Y-=se,J-=oe,ne-=he,Ct=Ct.next,l+=s}}}var qx=function(n){let i=Math.round(this.blurRadius());if(i>0)KN(n,i)};_e.addGetterSetter(wt,"blurRadius",0,dt(),_e.afterSetFilter);var Dx=function(e){let n=this.brightness()*255,i=e.data,s=i.length;for(let a=0;a<s;a+=4)i[a]+=n,i[a+1]+=n,i[a+2]+=n};_e.addGetterSetter(wt,"brightness",0,dt(),_e.afterSetFilter);var Ix=function(e){let n=this.brightness(),i=e.data,s=i.length;for(let a=0;a<s;a+=4)i[a]=Math.min(255,i[a]*n),i[a+1]=Math.min(255,i[a+1]*n),i[a+2]=Math.min(255,i[a+2]*n)};var Mx=function(e){let n=Math.pow((this.contrast()+100)/100,2),i=e.data,s=i.length,a=150,r=150,l=150;for(let c=0;c<s;c+=4)a=i[c],r=i[c+1],l=i[c+2],a/=255,a-=0.5,a*=n,a+=0.5,a*=255,r/=255,r-=0.5,r*=n,r+=0.5,r*=255,l/=255,l-=0.5,l*=n,l+=0.5,l*=255,a=a<0?0:a>255?255:a,r=r<0?0:r>255?255:r,l=l<0?0:l>255?255:l,i[c]=a,i[c+1]=r,i[c+2]=l};_e.addGetterSetter(wt,"contrast",0,dt(),_e.afterSetFilter);var Rx=function(e){var n,i,s,a,r,l,c,p,m;let{data:g,width:y,height:x}=e,j=Math.min(1,Math.max(0,(i=(n=this.embossStrength)===null||n===void 0?void 0:n.call(this))!==null&&i!==void 0?i:0.5)),I=Math.min(1,Math.max(0,(a=(s=this.embossWhiteLevel)===null||s===void 0?void 0:s.call(this))!==null&&a!==void 0?a:0.5)),X=(c={"top-left":315,top:270,"top-right":225,right:180,"bottom-right":135,bottom:90,"bottom-left":45,left:0}[(l=(r=this.embossDirection)===null||r===void 0?void 0:r.call(this))!==null&&l!==void 0?l:"top-left"])!==null&&c!==void 0?c:315,Y=!!((m=(p=this.embossBlend)===null||p===void 0?void 0:p.call(this))!==null&&m!==void 0?m:!1),J=j*10,ne=I*255,ae=X*Math.PI/180,se=Math.cos(ae),oe=Math.sin(ae),he=0.12549019607843137*J,we=new Uint8ClampedArray(g),Ce=new Float32Array(y*x);for(let He=0,De=0;De<g.length;De+=4,He++)Ce[He]=0.2126*we[De]+0.7152*we[De+1]+0.0722*we[De+2];let Ne=[-1,0,1,-2,0,2,-1,0,1],Pe=[-1,-2,-1,0,0,0,1,2,1],Ue=[-y-1,-y,-y+1,-1,0,1,y-1,y,y+1],ze=(He)=>He<0?0:He>255?255:He;for(let He=1;He<x-1;He++)for(let De=1;De<y-1;De++){let Fe=He*y+De,bt=0,Ve=0;bt+=Ce[Fe+Ue[0]]*Ne[0],Ve+=Ce[Fe+Ue[0]]*Pe[0],bt+=Ce[Fe+Ue[1]]*Ne[1],Ve+=Ce[Fe+Ue[1]]*Pe[1],bt+=Ce[Fe+Ue[2]]*Ne[2],Ve+=Ce[Fe+Ue[2]]*Pe[2],bt+=Ce[Fe+Ue[3]]*Ne[3],Ve+=Ce[Fe+Ue[3]]*Pe[3],bt+=Ce[Fe+Ue[5]]*Ne[5],Ve+=Ce[Fe+Ue[5]]*Pe[5],bt+=Ce[Fe+Ue[6]]*Ne[6],Ve+=Ce[Fe+Ue[6]]*Pe[6],bt+=Ce[Fe+Ue[7]]*Ne[7],Ve+=Ce[Fe+Ue[7]]*Pe[7],bt+=Ce[Fe+Ue[8]]*Ne[8],Ve+=Ce[Fe+Ue[8]]*Pe[8];let $e=se*bt+oe*Ve,Ct=ze(ne+$e*he),ct=Fe*4;if(Y){let Ze=Ct-ne;g[ct]=ze(we[ct]+Ze),g[ct+1]=ze(we[ct+1]+Ze),g[ct+2]=ze(we[ct+2]+Ze),g[ct+3]=we[ct+3]}else g[ct]=g[ct+1]=g[ct+2]=Ct,g[ct+3]=we[ct+3]}for(let He=0;He<y;He++){let De=He*4,Fe=((x-1)*y+He)*4;g[De]=we[De],g[De+1]=we[De+1],g[De+2]=we[De+2],g[De+3]=we[De+3],g[Fe]=we[Fe],g[Fe+1]=we[Fe+1],g[Fe+2]=we[Fe+2],g[Fe+3]=we[Fe+3]}for(let He=1;He<x-1;He++){let De=He*y*4,Fe=(He*y+(y-1))*4;g[De]=we[De],g[De+1]=we[De+1],g[De+2]=we[De+2],g[De+3]=we[De+3],g[Fe]=we[Fe],g[Fe+1]=we[Fe+1],g[Fe+2]=we[Fe+2],g[Fe+3]=we[Fe+3]}return e};_e.addGetterSetter(wt,"embossStrength",0.5,dt(),_e.afterSetFilter);_e.addGetterSetter(wt,"embossWhiteLevel",0.5,dt(),_e.afterSetFilter);_e.addGetterSetter(wt,"embossDirection","top-left",void 0,_e.afterSetFilter);_e.addGetterSetter(wt,"embossBlend",!1,void 0,_e.afterSetFilter);function R3(e,n,i,s,a){let r=i-n,l=a-s;if(r===0)return s+l/2;if(l===0)return s;let c=(e-n)/r;return c=l*c+s,c}var Ox=function(e){let n=e.data,i=n.length,s=n[0],a=s,r,l=n[1],c=l,p,m=n[2],g=m,y,x=this.enhance();if(x===0)return;for(let ne=0;ne<i;ne+=4){if(r=n[ne+0],r<s)s=r;else if(r>a)a=r;if(p=n[ne+1],p<l)l=p;else if(p>c)c=p;if(y=n[ne+2],y<m)m=y;else if(y>g)g=y}if(a===s)a=255,s=0;if(c===l)c=255,l=0;if(g===m)g=255,m=0;let j,I,P,X,Y,J;if(x>0)j=a+x*(255-a),I=s-x*(s-0),P=c+x*(255-c),X=l-x*(l-0),Y=g+x*(255-g),J=m-x*(m-0);else{let ne=(a+s)*0.5;j=a+x*(a-ne),I=s+x*(s-ne);let ae=(c+l)*0.5;P=c+x*(c-ae),X=l+x*(l-ae);let se=(g+m)*0.5;Y=g+x*(g-se),J=m+x*(m-se)}for(let ne=0;ne<i;ne+=4)n[ne+0]=R3(n[ne+0],s,a,I,j),n[ne+1]=R3(n[ne+1],l,c,X,P),n[ne+2]=R3(n[ne+2],m,g,J,Y)};_e.addGetterSetter(wt,"enhance",0,dt(),_e.afterSetFilter);var Fx=function(e){let n=e.data,i=n.length;for(let s=0;s<i;s+=4){let a=0.34*n[s]+0.5*n[s+1]+0.16*n[s+2];n[s]=a,n[s+1]=a,n[s+2]=a}};_e.addGetterSetter(wt,"hue",0,dt(),_e.afterSetFilter);_e.addGetterSetter(wt,"saturation",0,dt(),_e.afterSetFilter);_e.addGetterSetter(wt,"luminance",0,dt(),_e.afterSetFilter);var Nx=function(e){let n=e.data,i=n.length,a=Math.pow(2,this.saturation()),r=Math.abs(this.hue()+360)%360,l=this.luminance()*127,c=1*a*Math.cos(r*Math.PI/180),p=1*a*Math.sin(r*Math.PI/180),m=0.299+0.701*c+0.167*p,g=0.587-0.587*c+0.33*p,y=0.114-0.114*c-0.497*p,x=0.299-0.299*c-0.328*p,j=0.587+0.413*c+0.035*p,I=0.114-0.114*c+0.293*p,P=0.299-0.3*c+1.25*p,X=0.587-0.586*c-1.05*p,Y=0.114+0.886*c-0.2*p,J,ne,ae,se;for(let oe=0;oe<i;oe+=4)J=n[oe+0],ne=n[oe+1],ae=n[oe+2],se=n[oe+3],n[oe+0]=m*J+g*ne+y*ae+l,n[oe+1]=x*J+j*ne+I*ae+l,n[oe+2]=P*J+X*ne+Y*ae+l,n[oe+3]=se};var Px=function(e){let n=e.data,i=n.length,s=Math.pow(2,this.value()),a=Math.pow(2,this.saturation()),r=Math.abs(this.hue()+360)%360,l=s*a*Math.cos(r*Math.PI/180),c=s*a*Math.sin(r*Math.PI/180),p=0.299*s+0.701*l+0.167*c,m=0.587*s-0.587*l+0.33*c,g=0.114*s-0.114*l-0.497*c,y=0.299*s-0.299*l-0.328*c,x=0.587*s+0.413*l+0.035*c,j=0.114*s-0.114*l+0.293*c,I=0.299*s-0.3*l+1.25*c,P=0.587*s-0.586*l-1.05*c,X=0.114*s+0.886*l-0.2*c;for(let Y=0;Y<i;Y+=4){let J=n[Y+0],ne=n[Y+1],ae=n[Y+2],se=n[Y+3];n[Y+0]=p*J+m*ne+g*ae,n[Y+1]=y*J+x*ne+j*ae,n[Y+2]=I*J+P*ne+X*ae,n[Y+3]=se}};_e.addGetterSetter(wt,"hue",0,dt(),_e.afterSetFilter);_e.addGetterSetter(wt,"saturation",0,dt(),_e.afterSetFilter);_e.addGetterSetter(wt,"value",0,dt(),_e.afterSetFilter);var Bx=function(e){let n=e.data,i=n.length;for(let s=0;s<i;s+=4)n[s]=255-n[s],n[s+1]=255-n[s+1],n[s+2]=255-n[s+2]};var $N=function(e,n,i){let s=e.data,a=n.data,{width:r,height:l}=e,c=i.polarCenterX||r/2,p=i.polarCenterY||l/2,m=Math.sqrt(c*c+p*p),g=r-c,y=l-p,x=Math.sqrt(g*g+y*y);m=x>m?x:m;let j=l,I=r,P=360/I*Math.PI/180;for(let X=0;X<I;X+=1){let Y=Math.sin(X*P),J=Math.cos(X*P);for(let ne=0;ne<j;ne+=1){g=Math.floor(c+m*ne/j*J),y=Math.floor(p+m*ne/j*Y);let ae=(y*r+g)*4,se=s[ae+0],oe=s[ae+1],he=s[ae+2],we=s[ae+3];ae=(X+ne*r)*4,a[ae+0]=se,a[ae+1]=oe,a[ae+2]=he,a[ae+3]=we}}},YN=function(e,n,i){let s=e.data,a=n.data,{width:r,height:l}=e,c=i.polarCenterX||r/2,p=i.polarCenterY||l/2,m=Math.sqrt(c*c+p*p),g=r-c,y=l-p,x=Math.sqrt(g*g+y*y);m=x>m?x:m;let j=l,I=r,P=i.polarRotation||0,X,Y;for(g=0;g<r;g+=1)for(y=0;y<l;y+=1){let J=g-c,ne=y-p,ae=Math.sqrt(J*J+ne*ne)*j/m,se=(Math.atan2(ne,J)*180/Math.PI+360+P)%360;se=se*I/360,X=Math.floor(se),Y=Math.floor(ae);let oe=(Y*r+X)*4,he=s[oe+0],we=s[oe+1],Ce=s[oe+2],Ne=s[oe+3];oe=(y*r+g)*4,a[oe+0]=he,a[oe+1]=we,a[oe+2]=Ce,a[oe+3]=Ne}},Lx=function(e){let{width:n,height:i}=e,s,a,r,l,c,p,m,g,y,x,j=Math.round(this.kaleidoscopePower()),I=Math.round(this.kaleidoscopeAngle()),P=Math.floor(n*(I%360)/360);if(j<1)return;let X=Be.createCanvasElement();X.width=n,X.height=i;let Y=X.getContext("2d").getImageData(0,0,n,i);Be.releaseCanvas(X),$N(e,Y,{polarCenterX:n/2,polarCenterY:i/2});let J=n/Math.pow(2,j);while(J<=8)J=J*2,j-=1;J=Math.ceil(J);let ne=J,ae=0,se=ne,oe=1;if(P+J>n)ae=ne,se=0,oe=-1;for(a=0;a<i;a+=1)for(s=ae;s!==se;s+=oe)r=Math.round(s+P)%n,y=(n*a+r)*4,c=Y.data[y+0],p=Y.data[y+1],m=Y.data[y+2],g=Y.data[y+3],x=(n*a+s)*4,Y.data[x+0]=c,Y.data[x+1]=p,Y.data[x+2]=m,Y.data[x+3]=g;for(a=0;a<i;a+=1){ne=Math.floor(J);for(l=0;l<j;l+=1){for(s=0;s<ne+1;s+=1)y=(n*a+s)*4,c=Y.data[y+0],p=Y.data[y+1],m=Y.data[y+2],g=Y.data[y+3],x=(n*a+ne*2-s-1)*4,Y.data[x+0]=c,Y.data[x+1]=p,Y.data[x+2]=m,Y.data[x+3]=g;ne*=2}}YN(Y,e,{polarRotation:0})};_e.addGetterSetter(wt,"kaleidoscopePower",2,dt(),_e.afterSetFilter);_e.addGetterSetter(wt,"kaleidoscopeAngle",0,dt(),_e.afterSetFilter);function Ub(e,n,i){let s=(i*e.width+n)*4,a=[];return a.push(e.data[s++],e.data[s++],e.data[s++],e.data[s++]),a}function Wp(e,n){return Math.sqrt(Math.pow(e[0]-n[0],2)+Math.pow(e[1]-n[1],2)+Math.pow(e[2]-n[2],2))}function QN(e){let n=[0,0,0];for(let i=0;i<e.length;i++)n[0]+=e[i][0],n[1]+=e[i][1],n[2]+=e[i][2];return n[0]/=e.length,n[1]/=e.length,n[2]/=e.length,n}function JN(e,n){let i=Ub(e,0,0),s=Ub(e,e.width-1,0),a=Ub(e,0,e.height-1),r=Ub(e,e.width-1,e.height-1),l=n||10;if(Wp(i,s)<l&&Wp(s,r)<l&&Wp(r,a)<l&&Wp(a,i)<l){let c=QN([s,i,r,a]),p=[];for(let m=0;m<e.width*e.height;m++){let g=Wp(c,[e.data[m*4],e.data[m*4+1],e.data[m*4+2]]);p[m]=g<l?0:255}return p}}function ZN(e,n){for(let i=0;i<e.width*e.height;i++)e.data[4*i+3]=n[i]}function eP(e,n,i){let s=[1,1,1,1,0,1,1,1,1],a=Math.round(Math.sqrt(s.length)),r=Math.floor(a/2),l=[];for(let c=0;c<i;c++)for(let p=0;p<n;p++){let m=c*n+p,g=0;for(let y=0;y<a;y++)for(let x=0;x<a;x++){let j=c+y-r,I=p+x-r;if(j>=0&&j<i&&I>=0&&I<n){let P=j*n+I,X=s[y*a+x];g+=e[P]*X}}l[m]=g===2040?255:0}return l}function tP(e,n,i){let s=[1,1,1,1,1,1,1,1,1],a=Math.round(Math.sqrt(s.length)),r=Math.floor(a/2),l=[];for(let c=0;c<i;c++)for(let p=0;p<n;p++){let m=c*n+p,g=0;for(let y=0;y<a;y++)for(let x=0;x<a;x++){let j=c+y-r,I=p+x-r;if(j>=0&&j<i&&I>=0&&I<n){let P=j*n+I,X=s[y*a+x];g+=e[P]*X}}l[m]=g>=1020?255:0}return l}function nP(e,n,i){let s=[0.1111111111111111,0.1111111111111111,0.1111111111111111,0.1111111111111111,0.1111111111111111,0.1111111111111111,0.1111111111111111,0.1111111111111111,0.1111111111111111],a=Math.round(Math.sqrt(s.length)),r=Math.floor(a/2),l=[];for(let c=0;c<i;c++)for(let p=0;p<n;p++){let m=c*n+p,g=0;for(let y=0;y<a;y++)for(let x=0;x<a;x++){let j=c+y-r,I=p+x-r;if(j>=0&&j<i&&I>=0&&I<n){let P=j*n+I,X=s[y*a+x];g+=e[P]*X}}l[m]=g}return l}var Hx=function(e){let n=this.threshold(),i=JN(e,n);if(i)i=eP(i,e.width,e.height),i=tP(i,e.width,e.height),i=nP(i,e.width,e.height),ZN(e,i);return e};_e.addGetterSetter(wt,"threshold",0,dt(),_e.afterSetFilter);var Ux=function(e){let n=this.noise()*255,i=e.data,s=i.length,a=n/2;for(let r=0;r<s;r+=4)i[r+0]+=a-2*a*Math.random(),i[r+1]+=a-2*a*Math.random(),i[r+2]+=a-2*a*Math.random()};_e.addGetterSetter(wt,"noise",0.2,dt(),_e.afterSetFilter);var zx=function(e){let n=Math.ceil(this.pixelSize()),{width:i,height:s}=e,a=Math.ceil(i/n),r=Math.ceil(s/n),l=e.data;if(n<=0){Be.error("pixelSize value can not be <= 0");return}for(let c=0;c<a;c+=1)for(let p=0;p<r;p+=1){let m=0,g=0,y=0,x=0,j=c*n,I=j+n,P=p*n,X=P+n,Y=0;for(let J=j;J<I;J+=1){if(J>=i)continue;for(let ne=P;ne<X;ne+=1){if(ne>=s)continue;let ae=(i*ne+J)*4;m+=l[ae+0],g+=l[ae+1],y+=l[ae+2],x+=l[ae+3],Y+=1}}m=m/Y,g=g/Y,y=y/Y,x=x/Y;for(let J=j;J<I;J+=1){if(J>=i)continue;for(let ne=P;ne<X;ne+=1){if(ne>=s)continue;let ae=(i*ne+J)*4;l[ae+0]=m,l[ae+1]=g,l[ae+2]=y,l[ae+3]=x}}}};_e.addGetterSetter(wt,"pixelSize",8,dt(),_e.afterSetFilter);var Gx=function(e){let n=Math.round(this.levels()*254)+1,i=e.data,s=i.length,a=255/n;for(let r=0;r<s;r+=1)i[r]=Math.floor(i[r]/a)*a};_e.addGetterSetter(wt,"levels",0.5,dt(),_e.afterSetFilter);var Vx=function(e){let n=e.data,i=n.length,s=this.red(),a=this.green(),r=this.blue();for(let l=0;l<i;l+=4){let c=(0.34*n[l]+0.5*n[l+1]+0.16*n[l+2])/255;n[l]=c*s,n[l+1]=c*a,n[l+2]=c*r,n[l+3]=n[l+3]}};_e.addGetterSetter(wt,"red",0,function(e){if(this._filterUpToDate=!1,e>255)return 255;else if(e<0)return 0;else return Math.round(e)});_e.addGetterSetter(wt,"green",0,function(e){if(this._filterUpToDate=!1,e>255)return 255;else if(e<0)return 0;else return Math.round(e)});_e.addGetterSetter(wt,"blue",0,Tb,_e.afterSetFilter);var Wx=function(e){let n=e.data,i=n.length,s=this.red(),a=this.green(),r=this.blue(),l=this.alpha();for(let c=0;c<i;c+=4){let p=1-l;n[c]=s*l+n[c]*p,n[c+1]=a*l+n[c+1]*p,n[c+2]=r*l+n[c+2]*p}};_e.addGetterSetter(wt,"red",0,function(e){if(this._filterUpToDate=!1,e>255)return 255;else if(e<0)return 0;else return Math.round(e)});_e.addGetterSetter(wt,"green",0,function(e){if(this._filterUpToDate=!1,e>255)return 255;else if(e<0)return 0;else return Math.round(e)});_e.addGetterSetter(wt,"blue",0,Tb,_e.afterSetFilter);_e.addGetterSetter(wt,"alpha",1,function(e){if(this._filterUpToDate=!1,e>1)return 1;else if(e<0)return 0;else return e});var Kx=function(e){let n=e.data,i=n.length;for(let s=0;s<i;s+=4){let a=n[s+0],r=n[s+1],l=n[s+2];n[s+0]=Math.min(255,a*0.393+r*0.769+l*0.189),n[s+1]=Math.min(255,a*0.349+r*0.686+l*0.168),n[s+2]=Math.min(255,a*0.272+r*0.534+l*0.131)}};var $x=function(e){let i=e.data;for(let s=0;s<i.length;s+=4){let a=i[s],r=i[s+1],l=i[s+2];if(0.2126*a+0.7152*r+0.0722*l>=128)i[s]=255-a,i[s+1]=255-r,i[s+2]=255-l}return e};var Yx=function(e){let n=this.threshold()*255,i=e.data,s=i.length;for(let a=0;a<s;a+=1)i[a]=i[a]<n?0:255};_e.addGetterSetter(wt,"threshold",0.5,dt(),_e.afterSetFilter);var Qx=Sd.Util._assign(Sd,{Arc:eo,Arrow:Ol,Circle:Kc,Ellipse:Bo,Image:Pa,Label:Gp,Tag:Fl,Line:qr,Path:ui,Rect:$c,RegularPolygon:Lo,Ring:Nl,Sprite:Dr,Star:Ho,Text:si,TextPath:Ui,Transformer:jn,Wedge:to,Filters:{Blur:qx,Brightness:Ix,Brighten:Dx,Contrast:Mx,Emboss:Rx,Enhance:Ox,Grayscale:Fx,HSL:Nx,HSV:Px,Invert:Bx,Kaleidoscope:Lx,Mask:Hx,Noise:Ux,Pixelate:zx,Posterize:Gx,RGB:Vx,RGBA:Wx,Sepia:Kx,Solarize:$x,Threshold:Yx}});var Jx=Qx;C();C();var kd=Sd;var hk=z(Zx());var O3=1;var zb=32,F3=2;C();var P3={};Oe(P3,{HostTransitionContext:()=>gB,NotPendingTransition:()=>mB,afterActiveInstanceBlur:()=>JP,appendChild:()=>FP,appendChildToContainer:()=>NP,appendInitialChild:()=>fP,beforeActiveInstanceBlur:()=>QP,cancelTimeout:()=>AP,clearContainer:()=>KP,commitMount:()=>UP,commitTextUpdate:()=>HP,commitUpdate:()=>zP,createInstance:()=>dP,createTextInstance:()=>pP,detachDeletedInstance:()=>$P,finalizeInitialChildren:()=>mP,getChildHostContext:()=>kP,getCurrentEventPriority:()=>ZP,getCurrentUpdatePriority:()=>iB,getInstanceFromNode:()=>YP,getInstanceFromScope:()=>tB,getPublicInstance:()=>gP,getRootHostContext:()=>xP,hideInstance:()=>GP,hideTextInstance:()=>VP,idlePriority:()=>qa,insertBefore:()=>ok,insertInContainerBefore:()=>PP,isPrimaryRenderer:()=>DP,maySuspendCommit:()=>uB,noTimeout:()=>EP,now:()=>Kn,preloadInstance:()=>hB,prepareForCommit:()=>bP,preparePortalMount:()=>wP,prepareScopeUpdate:()=>eB,prepareUpdate:()=>yP,removeChild:()=>BP,removeChildFromContainer:()=>LP,requestPostPaintCallback:()=>cB,resetAfterCommit:()=>vP,resetFormInstance:()=>bB,resetTextContent:()=>SP,resolveEventTimeStamp:()=>lB,resolveEventType:()=>oB,resolveUpdatePriority:()=>sB,run:()=>zu,scheduleMicrotask:()=>jP,scheduleTimeout:()=>TP,setCurrentUpdatePriority:()=>nB,shouldAttemptEagerTransition:()=>aB,shouldDeprioritizeSubtree:()=>_P,shouldSetTextContent:()=>qP,startSuspendingCommit:()=>fB,supportsHydration:()=>OP,supportsMicrotasks:()=>CP,supportsMutation:()=>MP,supportsPersistence:()=>RP,suspendInstance:()=>dB,trackSchedulerEvent:()=>rB,unhideInstance:()=>XP,unhideTextInstance:()=>WP,waitForCommitToBeReady:()=>pB,warnsIfNotActing:()=>IP});var ek={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0},tk=!1,nk=!1,Td=".react-konva-event",rP=!1;var oP=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled.
|
|
238
|
+
Position of a node will be changed during drag&drop, so you should update state of the react app as well.
|
|
239
|
+
Consider to add onDragMove or onDragEnd events.
|
|
240
|
+
For more info see: https://github.com/konvajs/react-konva/issues/256
|
|
241
|
+
`,lP=`ReactKonva: You are using "zIndex" attribute for a Konva node.
|
|
242
|
+
react-konva may get confused with ordering. Just define correct order of elements in your render function of a component.
|
|
243
|
+
For more info see: https://github.com/konvajs/react-konva/issues/194
|
|
244
|
+
`,cP={},ik=()=>{};function sk(e){ik=e}var N3=!1;function uP(e){return function(...n){let i=e.apply(this,n);if(!N3){N3=!0;try{ik()}finally{N3=!1}}return i}}function Ad(e,n,i=cP){if(!tk&&"zIndex"in n)console.warn(lP),tk=!0;if(!nk&&n.draggable){var s=n.x!==void 0||n.y!==void 0,a=n.onDragEnd||n.onDragMove;if(s&&!a)console.warn(oP),nk=!0}for(var r in i){if(ek[r])continue;var l=r.slice(0,2)==="on",c=i[r]!==n[r];if(l&&c){var p=r.substr(2).toLowerCase();if(p.substr(0,7)==="content")p="content"+p.substr(7,1).toUpperCase()+p.substr(8);e.off(p+Td)}var m=!n.hasOwnProperty(r);if(m)e.setAttr(r,void 0)}var g=rP||n._useStrictMode,y={},x=!1;let j={};for(var r in n){if(ek[r])continue;var l=r.slice(0,2)==="on",I=i[r]!==n[r];if(l&&I){var p=r.substr(2).toLowerCase();if(p.substr(0,7)==="content")p="content"+p.substr(7,1).toUpperCase()+p.substr(8);if(n[r])j[p]=n[r]}if(!l&&(n[r]!==i[r]||g&&n[r]!==e.getAttr(r)))x=!0,y[r]=n[r]}if(x)e.setAttrs(y),Pl(e);for(var p in j)e.off(p+Td),e.on(p+Td,uP(j[p]))}function Pl(e){if(!Tt.autoDrawEnabled){var n=e.getLayer()||e.getStage();n&&n.batchDraw()}}ju();var ak={},hP={};kd.Node.prototype._applyProps=Ad;var rk=zb;function fP(e,n){if(typeof n==="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${n}`);return}e.add(n),Pl(e)}function dP(e,n,i){let s=kd[e];if(!s)console.error(`Konva has no node with the type ${e}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${e}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),s=kd.Group;let a={},r={};for(var l in n){if(l==="ref")continue;var c=l.slice(0,2)==="on";if(c)r[l]=n[l];else a[l]=n[l]}let p=new s(a);return Ad(p,r),p}function pP(e,n,i){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function mP(e,n,i){return!1}function gP(e){return e}function bP(){return null}function wP(){return null}function yP(e,n,i,s){return hP}function vP(){}function SP(e){}function _P(e,n){return!1}function xP(){return ak}function kP(){return ak}var TP=setTimeout,AP=clearTimeout,CP=!0,jP=typeof queueMicrotask==="function"?queueMicrotask:(e)=>Promise.resolve(null).then(e),EP=-1;function qP(e,n){return!1}var DP=!1,IP=!1,MP=!0,RP=!1,OP=!1;function FP(e,n){if(n.parent===e)n.moveToTop();else e.add(n);Pl(e)}function NP(e,n){if(n.parent===e)n.moveToTop();else e.add(n);Pl(e)}function ok(e,n,i){n._remove(),e.add(n),n.setZIndex(i.getZIndex()),Pl(e)}function PP(e,n,i){ok(e,n,i)}function BP(e,n){n.destroy(),n.off(Td),Pl(e)}function LP(e,n){n.destroy(),n.off(Td),Pl(e)}function HP(e,n,i){console.error(`Text components are not yet supported in ReactKonva. You text is: "${i}"`)}function UP(e,n,i){}function zP(e,n,i,s){Ad(e,s,i)}function GP(e){e.hide(),Pl(e)}function VP(e){}function XP(e,n){if(n.visible==null||n.visible)e.show()}function WP(e,n){}function KP(e){}function $P(){}function YP(){return null}function QP(){}function JP(){}function ZP(){return zb}function eB(){}function tB(){return null}function nB(e){rk=e}function iB(){return rk}function sB(){return F3}function aB(){return!1}function rB(){}function oB(){return null}function lB(){return-1.1}function cB(){}function uB(){return!1}function hB(){return!0}function fB(){}function dB(){}function pB(){return null}var mB=null,gB=xt(null);function bB(){}C();function lk(e,n,i){if(!e)return;if(i(e)===!0)return e;let s=n?e.return:e.child;for(;s;){let a=lk(s,n,i);if(a)return a;s=n?null:s.sibling}}function ck(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch(n){return e}}var B3=ck(xt(null));class Gb extends Cs{render(){return q(B3.Provider,{value:this._reactInternals},this.props.children)}}function wB(){let e=St(B3);if(e===null)throw Error("its-fine: useFiber must be called within a <FiberProvider />!");let n=Nu();return O(()=>{for(let i of[e,e==null?void 0:e.alternate]){if(!i)continue;let s=lk(i,!1,(a)=>{let r=a.memoizedState;for(;r;){if(r.memoizedState===n)return!0;r=r.next}});if(s)return s}},[e,n])}var yB=Symbol.for("react.context"),vB=(e)=>e!==null&&typeof e=="object"&&("$$typeof"in e)&&e.$$typeof===yB;function SB(){let e=wB(),[n]=u(()=>new Map);n.clear();let i=e;for(;i;){let s=i.type;vB(s)&&s!==B3&&!n.has(s)&&n.set(s,wc(ck(s))),i=i.return}return n}function uk(){let e=SB();return O(()=>Array.from(e.keys()).reduce((n,i)=>(s)=>q(n,null,q(i.Provider,{...s,value:e.get(i)})),(n)=>q(Gb,{...n})),[e])}if(Es.indexOf("19")===-1)throw Error("react-konva version 19 is only compatible with React 19. Make sure to have the last version of react-konva and react or downgrade react-konva to version 18.");function _B(e){let n=w({});return Ge(()=>{n.current=e}),Ge(()=>()=>{n.current={}},[]),n.current}var xB=()=>{let e=w(0);return O(()=>{e.current++},[]),e.current>1},kB=(e)=>{let n=w(null),i=w(null),s=w(null),a=_B(e),r=uk(),l=w(null),c=(g)=>{let{forwardedRef:y}=e;if(!y)return;if(typeof y==="function")y(g);else y.current=g},p=xB(),m=()=>{c(null),vh.flushSyncFromReconciler(()=>{vh.updateContainer(null,s.current,null)}),i.current?.destroy(),i.current=null};return Ge(()=>{if(l.current)clearTimeout(l.current),l.current=null;if(i.current)c(i.current);else i.current=new kd.Stage({width:e.width,height:e.height,container:n.current}),c(i.current),s.current=vh.createContainer(i.current,O3,null,!1,null,"",console.error,console.error,console.error,null),vh.updateContainer(q(r,{},e.children),s.current,null,()=>{});return()=>{if(p)l.current=setTimeout(m,0);else m()}},[]),Ge(()=>{c(i.current),Ad(i.current,e,a),vh.updateContainer(q(r,{},e.children),s.current,null),vh.flushSyncWork()}),q("div",{ref:n,id:e.id,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},fk="Layer";var dk="Group";var L3="Rect";var H3="Line";var pk="Image";var U3="Arrow";var vh=hk.default(P3);sk(()=>vh.flushSyncWork());var mk=D((e,n)=>q(Gb,{},q(kB,{...e,forwardedRef:n})));var wk=z(bk(),1);var TB=({width:e,height:n,mediaDimensions:i,imageUrl:s,canvasElement:a,videoElement:r,annotations:l,scale:c,offset:p,onPan:m,onClick:g,className:y,isDrawing:x=!1,currentTool:j="arrow",currentColor:I="#ef4444",onAddAnnotation:P})=>{let[X]=wk.default(s||"","anonymous"),Y=w(null),J=w(!1),ne=w({x:0,y:0}),ae=w(null),se=w(null),oe=w(null),he=w(null);h(()=>{if(a&&Y.current)Y.current.getLayer()?.batchDraw()},[a]),h(()=>{if(r&&Y.current){let ze=Y.current.getLayer();if(!ze)return;let He=new Jx.Animation(()=>{},ze);return He.start(),()=>{He.stop()}}},[r]);let we=(ze,He=!1,De)=>{let Fe=ze.getAbsoluteTransform().copy();Fe.invert();let bt=De||ze.getStage()?.getPointerPosition();if(bt){let Ve=Fe.point(bt);if(He)return{x:Math.max(0,Math.min(i.width,Ve.x)),y:Math.max(0,Math.min(i.height,Ve.y))};return Ve}return null},Ce=w({isDrawing:x,currentTool:j,currentColor:I,onPan:m,offset:p,scale:c,mediaDimensions:i,onAddAnnotation:P});Ce.current={isDrawing:x,currentTool:j,currentColor:I,onPan:m,offset:p,scale:c,mediaDimensions:i,onAddAnnotation:P};let Ne=()=>{if(!J.current)return;J.current=!1;let{isDrawing:ze,onAddAnnotation:He,mediaDimensions:De,currentTool:Fe,currentColor:bt}=Ce.current;if(ze&&He){let{width:Ve,height:$e}=De,Ct=(ct,Ze)=>ct/Ze;if(Fe==="freehand"&&se.current){se.current.visible(!1);let ct=se.current.points(),Ze=[];for(let mt=0;mt<ct.length;mt+=2)Ze.push([Ct(ct[mt],Ve),Ct(ct[mt+1],$e)]);if(Ze.length>1)He({type:"freehand",color:bt,points:Ze})}else if(Fe==="line"&&se.current){se.current.visible(!1);let ct=se.current.points(),Ze={type:"line",color:bt,points:[[Ct(ct[0],Ve),Ct(ct[1],$e)],[Ct(ct[2],Ve),Ct(ct[3],$e)]]};He(Ze)}else if(Fe==="box"&&oe.current){oe.current.visible(!1);let ct=oe.current.x(),Ze=oe.current.y(),mt=oe.current.width(),Xt=oe.current.height(),hn=[Ct(ct,Ve),Ct(Ze,$e)],nn=[Ct(ct+mt,Ve),Ct(Ze+Xt,$e)];He({type:"box",color:bt,points:[hn,nn]})}else if(Fe==="arrow"&&he.current){he.current.visible(!1);let ct=he.current.points(),Ze={type:"arrow",color:bt,points:[[Ct(ct[0],Ve),Ct(ct[1],$e)],[Ct(ct[2],Ve),Ct(ct[3],$e)]]};He(Ze)}}};h(()=>{let ze=(De)=>{if(!J.current)return;let Fe=Y.current?.getStage();if(!Fe)return;let Ve=Fe.container().getBoundingClientRect(),$e,Ct;if("clientX"in De)$e=De.clientX,Ct=De.clientY;else $e=De.touches[0].clientX,Ct=De.touches[0].clientY;let ct={x:$e-Ve.left,y:Ct-Ve.top};if("touches"in De&&De.touches.length>1){ne.current=ct;return}let{isDrawing:Ze,currentTool:mt,onPan:Xt,offset:hn}=Ce.current;if(Ze){if(mt==="select")return;let nn=we(Y.current,!0,ct);if(!nn||!ae.current)return;let Zt=ae.current,Rn=Y.current?.getLayer();if(mt==="freehand"&&se.current){let Zn=se.current.points().concat([nn.x,nn.y]);se.current.points(Zn)}else if(mt==="line"&&se.current)se.current.points([Zt.x,Zt.y,nn.x,nn.y]);else if(mt==="box"&&oe.current)oe.current.width(nn.x-Zt.x),oe.current.height(nn.y-Zt.y);else if(mt==="arrow"&&he.current)he.current.points([Zt.x,Zt.y,nn.x,nn.y]);Rn?.batchDraw()}else{if(!Xt)return;let nn=ct.x-ne.current.x,Zt=ct.y-ne.current.y;ne.current=ct,Xt({x:hn.x+nn,y:hn.y+Zt})}},He=(De)=>{if("touches"in De&&De.touches.length>0)return;Ne()};return window.addEventListener("mousemove",ze),window.addEventListener("mouseup",He),window.addEventListener("touchmove",ze),window.addEventListener("touchend",He),()=>{window.removeEventListener("mousemove",ze),window.removeEventListener("mouseup",He),window.removeEventListener("touchmove",ze),window.removeEventListener("touchend",He)}},[]);let Pe=(ze)=>{if(x){if(j==="select")return;if(!ze.target.getStage())return;let De=we(Y.current);if(!De)return;if(De.x<0||De.x>i.width||De.y<0||De.y>i.height)return;J.current=!0,ae.current=De;let Fe=Y.current?.getLayer();if(!Fe)return;if(j==="freehand"&&se.current)se.current.points([De.x,De.y]),se.current.stroke(I),se.current.visible(!0);else if(j==="line"&&se.current)se.current.points([De.x,De.y,De.x,De.y]),se.current.stroke(I),se.current.visible(!0);else if(j==="box"&&oe.current)oe.current.position(De),oe.current.width(0),oe.current.height(0),oe.current.stroke(I),oe.current.visible(!0);else if(j==="arrow"&&he.current)he.current.points([De.x,De.y,De.x,De.y]),he.current.stroke(I),he.current.fill(I),he.current.visible(!0);Fe.batchDraw()}else{if(!m)return;J.current=!0;let He=ze.target.getStage();if(He){let De=He.getPointerPosition();if(De)ne.current=De}}},Ue=(ze,He)=>{let{width:De,height:Fe}=i;switch(ze.type){case"box":{let[bt,Ve]=ze.points,$e=Math.min(bt[0],Ve[0])*De,Ct=Math.min(bt[1],Ve[1])*Fe,ct=Math.abs(Ve[0]-bt[0])*De,Ze=Math.abs(Ve[1]-bt[1])*Fe;return t(L3,{x:$e,y:Ct,width:ct,height:Ze,stroke:ze.color,strokeWidth:2.6/c,listening:!1},He)}case"arrow":{let bt=ze.points.flat().map((Ve,$e)=>$e%2===0?Ve*De:Ve*Fe);return t(U3,{points:bt,stroke:ze.color,strokeWidth:2.6/c,fill:ze.color,pointerLength:10/c,pointerWidth:10/c,listening:!1},He)}case"line":case"freehand":{let bt=ze.points.flat().map((Ve,$e)=>$e%2===0?Ve*De:Ve*Fe);return t(H3,{points:bt,stroke:ze.color,strokeWidth:2.6/c,tension:0.5,lineCap:"round",lineJoin:"round",listening:!1},He)}default:return null}};return t("div",{className:y,style:{width:e,height:n,overflow:"hidden",pointerEvents:!x&&!m?"none":"auto",cursor:x&&j!=="select"?"crosshair":m?J.current?"grabbing":"grab":"default"},children:t(mk,{width:e,height:n,scaleX:c,scaleY:c,x:p.x,y:p.y,onMouseDown:Pe,onClick:!x?g:void 0,onTap:!x?g:void 0,onTouchStart:Pe,children:o(fk,{children:[t(pk,{ref:Y,image:r||a||X,width:i.width,height:i.height}),l.map(Ue),o(dk,{listening:!1,children:[t(H3,{ref:se,strokeWidth:2.6/c,lineCap:"round",lineJoin:"round",visible:!1}),t(L3,{ref:oe,strokeWidth:2.6/c,visible:!1}),t(U3,{ref:he,points:[],strokeWidth:2.6/c,pointerLength:10/c,pointerWidth:10/c,visible:!1})]})]})})})},Uo=TB;function Yc(e,n,i,s){if(e<=0||n<=0||i<=0||s<=0)return 1;return Math.min(e/i,n/s)}function Bl(e,n,i,s,a){return{x:(e-i*a)/2,y:(n-s*a)/2}}function $p(e,n,i=0.02){return e>n*(1+i)}function AB(e,n=0.01,i=50){return Math.min(i,Math.max(n,e))}function Ll(e,n,i,s,a,r=0.01,l=50){let c=AB(e*i,r,l),p=c/e;return{zoom:c,pan:{x:s-(s-n.x)*p,y:a-(a-n.y)*p}}}function yk(e,n){let i=n===1?e*16:n===2?e*100:e,s=Math.exp(-i*0.01);return Math.min(2,Math.max(0.5,s))}C();function Cd({containerRef:e,zoom:n,pan:i,baseScale:s,onZoomChange:a,onPanChange:r}){let l=w({zoom:n,pan:i,baseScale:s,onZoomChange:a,onPanChange:r});l.current={zoom:n,pan:i,baseScale:s,onZoomChange:a,onPanChange:r},h(()=>{let c=e.current;if(!c)return;let p=new Map,m=null,g=(X)=>{let Y=l.current;if(X.ctrlKey){X.preventDefault();let J=c.getBoundingClientRect(),ne=X.clientX-J.left,ae=X.clientY-J.top;Y.onZoomChange(Ll(Y.zoom,Y.pan,yk(X.deltaY,X.deltaMode),ne,ae));return}if($p(Y.zoom,Y.baseScale))X.preventDefault(),Y.onPanChange({x:Y.pan.x-X.deltaX,y:Y.pan.y-X.deltaY})},y=(X,Y)=>Math.hypot(Y.x-X.x,Y.y-X.y),x=(X,Y,J)=>({x:(X.x+Y.x)/2-J.left,y:(X.y+Y.y)/2-J.top}),j=(X)=>{for(let Y of Array.from(X.touches))p.set(Y.identifier,{x:Y.clientX,y:Y.clientY});if(p.size===2){X.preventDefault();let Y=c.getBoundingClientRect(),[J,ne]=Array.from(p.values());m={lastDist:y(J,ne),lastMid:x(J,ne,Y)}}},I=(X)=>{for(let Ne of Array.from(X.touches))p.set(Ne.identifier,{x:Ne.clientX,y:Ne.clientY});if(!m||p.size<2)return;X.preventDefault();let Y=c.getBoundingClientRect(),[J,ne]=Array.from(p.values()),ae=x(J,ne,Y),se=y(J,ne),oe=l.current,he=m.lastDist>0?se/m.lastDist:1,we=Ll(oe.zoom,oe.pan,he,ae.x,ae.y),Ce=we.pan;if($p(we.zoom,oe.baseScale))Ce={x:Ce.x+(ae.x-m.lastMid.x),y:Ce.y+(ae.y-m.lastMid.y)};oe.onZoomChange({zoom:we.zoom,pan:Ce}),m.lastDist=se,m.lastMid=ae},P=(X)=>{for(let Y of Array.from(X.changedTouches))p.delete(Y.identifier);if(p.size<2)m=null};return c.addEventListener("wheel",g,{passive:!1}),c.addEventListener("touchstart",j,{passive:!1}),c.addEventListener("touchmove",I,{passive:!1}),c.addEventListener("touchend",P,{passive:!1}),c.addEventListener("touchcancel",P,{passive:!1}),()=>{c.removeEventListener("wheel",g),c.removeEventListener("touchstart",j),c.removeEventListener("touchmove",I),c.removeEventListener("touchend",P),c.removeEventListener("touchcancel",P)}},[e])}var CB=D(({file:e,onPlay:n,onPause:i,onTimeUpdate:s,annotations:a,startTime:r,shareId:l,children:c,allowDownload:p},m)=>{let g=w(null),y=g,x=(e.media?.videoTranscodes??[]).map((Et)=>{let Ft=Math.max(Et.width,Et.height),Wt=`${Et.height}p`;if(Ft>=3840)Wt="2160p";else if(Ft>=1920)Wt="1080p";else if(Ft>=1280)Wt="720p";else if(Ft>=960)Wt="540p";else if(Ft>=640)Wt="360p";else if(Ft>=320)Wt="180p";return{...Et,resolution:Wt}}),j=x.length>0&&!!e.media?.metadata,I=w(null),P=()=>{if(x.length===0)return null;if(typeof window>"u")return x[0];let Et=window.innerWidth*(window.devicePixelRatio||1),Ft=[...x].sort((Kt,Ci)=>{let gi=Kt.width??0,hr=Ci.width??0;return gi-hr});return Ft.find((Kt)=>(Kt.width??0)>=Et)||Ft[Ft.length-1]},X=P(),[Y,J]=u({isPlaying:!1,progress:0,currentTime:0,duration:e.media?.metadata?.duration||0,volume:1,isMuted:!1,isLooping:!1,playbackRate:1,isFullScreen:!1,showFrames:!1,currentResolution:X?.resolution??"",currentSrc:X?.url??""}),ne=w(null),ae=w(null),se=w(null);ln(m,()=>({play:()=>{if(g.current)g.current.play()},pause:()=>{if(g.current)g.current.pause()},seekTo:(Et)=>{if(g.current)g.current.currentTime(Et)},getCurrentTime:()=>(g.current?g.current.currentTime():0)??0,getDuration:()=>(g.current?g.current.duration():0)??0}));let oe=w(!1),[he,we]=u(void 0),Ce=w(null),[Ne,Pe]=u(1),[Ue,ze]=u({x:0,y:0}),[He,De]=u(!1),[Fe,bt]=u({width:0,height:0});h(()=>{let Et=P();J((Ft)=>({...Ft,isPlaying:!1,progress:0,currentTime:0,duration:e.media?.metadata?.duration||0,currentResolution:Et?.resolution??"",currentSrc:Et?.url??""})),De(!1),zi(!1),Ni(0),Ht.current=null},[e.id]);let Ve=e.media?.metadata?.originalWidth||1920,$e=e.media?.metadata?.originalHeight||1080,Ct=Yc(Fe.width,Fe.height,Ve,$e),ct=(Et)=>{De(!0);let Ft=Ll(Ne,Ue,Et/Ne,Fe.width/2,Fe.height/2);Pe(Ft.zoom),ze(Ft.pan)},Ze=()=>{if(De(!1),Fe.width>0&&Fe.height>0){let Et=Yc(Fe.width,Fe.height,Ve,$e);Pe(Et),ze(Bl(Fe.width,Fe.height,Ve,$e,Et))}},{isDrawing:mt,currentTool:Xt,currentColor:hn,addAnnotation:nn,annotations:Zt}=tn(),Rn=[...a||[],...Zt];h(()=>{if(!ne.current)return;let Et=new ResizeObserver((Ft)=>{let Wt=Ft[0];if(Wt)bt({width:Wt.contentRect.width,height:Wt.contentRect.height})});return Et.observe(ne.current),()=>Et.disconnect()},[]),h(()=>{if(Fe.width<=0||Fe.height<=0)return;if(He)return;let Et=Yc(Fe.width,Fe.height,Ve,$e);Pe(Et),ze(Bl(Fe.width,Fe.height,Ve,$e,Et))},[Fe.width,Fe.height,Ve,$e,He]),Cd({containerRef:ne,zoom:Ne,pan:Ue,baseScale:Ct,onZoomChange:(Et)=>{De(!0),Pe(Et.zoom),ze(Et.pan)},onPanChange:ze}),h(()=>()=>{Ce.current=null},[]);let[Zn,Ni]=u(0),[ri,Ai]=u(!0),[Vs,zi]=u(!1),Ht=w(null),$t=e.media?.metadata,cn=$t?.frameRate||30,pn=$t?.totalFrames||0,oi=$t?.duration||0,fn=e.proxyType==="audio",Si=uu({dbTotalFrames:pn,containerDuration:oi,frameRate:cn}),{currentFrame:Cn,seekToFrame:ta}=yb(Ce,cn,Si,fn),lr=Cn/cn,os=Si/cn,ls=os>0?lr/os*100:0,na={...Y,currentTime:lr,duration:os,progress:ls};h(()=>{if(s)s(Cn/cn)},[Cn,cn,s]),h(()=>{if(!I.current)return;let Ft=P()?.url??"";if(!Ft)return;if(y.current&&!y.current.isDisposed())y.current.dispose(),y.current=null,Ce.current=null;let Wt=document.createElement("video-js");Wt.classList.add("vjs-big-play-centered","!h-full","!w-full"),Wt.style.opacity="0",Wt.style.pointerEvents="none",I.current.appendChild(Wt);let Kt=y.current=Ke(Wt,{controls:!1,autoplay:!1,preload:"auto",playsinline:!0,sources:[{src:Ft,type:"video/mp4"}]}),Ci=Wt.querySelector("video");if(Ci)we(Ci),Ce.current=Ci;else Kt.ready(()=>{let gi=Kt.tech({iWillNotUseThisInPlugins:!0})?.el();if(gi)we(gi),Ce.current=gi});return Kt.on("play",()=>{J((gi)=>({...gi,isPlaying:!0})),n?.()}),Kt.on("pause",()=>{J((gi)=>({...gi,isPlaying:!1})),i?.()}),Kt.on("ended",()=>J((gi)=>({...gi,isPlaying:!1}))),Kt.on("loadedmetadata",()=>{zi(!0)}),Kt.on("loadstart",()=>{zi(!1)}),Kt.on("timeupdate",()=>{let gi=Kt.duration()||e.media?.metadata?.duration||0,hr=Kt.bufferedEnd();if(gi>0)Ni(hr/gi*100)}),Kt.on("volumechange",()=>{let gi=Kt.volume(),hr=Kt.muted();J((Ko)=>({...Ko,volume:gi||0,isMuted:hr||!1}))}),Kt.on("ratechange",()=>{J((gi)=>({...gi,playbackRate:Kt.playbackRate()||1}))}),Kt.on("error",()=>{console.error("VideoJS Error:",Kt.error())}),Kt.volume(Y.volume),()=>{if(Kt&&!Kt.isDisposed())Kt.dispose(),y.current=null,Ce.current=null}},[e.id]),h(()=>{if(!Vs)return;if(r!==void 0&&r!==null&&r>0){if(r!==Ht.current){Ht.current=r;let Et=Math.floor(r*cn+0.45);ta(Et)}}},[r,cn,ta,Vs]);let Pi=N(()=>{if(se.current)clearTimeout(se.current);if(Y.isFullScreen&&!oe.current)se.current=setTimeout(()=>{Ai(!1)},1200)},[Y.isFullScreen]),cs=N(()=>{Ai(!0),Pi()},[Pi]),Pr=N(()=>{if(oe.current=!0,se.current)clearTimeout(se.current);Ai(!0)},[]),Br=N(()=>{oe.current=!1,Pi()},[Pi]),zn=N(()=>{if(Y.isFullScreen){if(se.current)clearTimeout(se.current);Ai(!1)}},[Y.isFullScreen]);h(()=>()=>{if(se.current)clearTimeout(se.current)},[]),h(()=>{if(!Y.isFullScreen){if(Ai(!0),se.current)clearTimeout(se.current)}else cs()},[Y.isPlaying,Y.isFullScreen,cs]);let ma=N(()=>{if(tn.getState().isDrawing)return;let Et=y.current;if(!Et)return;if(Et.paused()||Et.ended()){let Ft=Et.play();if(Ft!==void 0)Ft.catch((Wt)=>{if(Wt.name==="AbortError")return;console.error("Play failed:",Wt)})}else Et.pause()},[]);h(()=>{let Et=(Ft)=>{let Wt=document.activeElement;if(Wt&&(Wt.tagName==="INPUT"||Wt.tagName==="TEXTAREA"||Wt instanceof HTMLElement&&Wt.isContentEditable))return;let Kt=Ft.key===" ",Ci=Wt&&(Wt.tagName==="BUTTON"||Wt.tagName==="A"||Wt.tagName==="SELECT"||Wt.tagName==="OPTION"||Wt.getAttribute("role")==="button"||Wt.getAttribute("role")==="link"||Wt.getAttribute("role")==="checkbox"||Wt.getAttribute("role")==="radio"||Wt.getAttribute("role")==="menuitem");if(Kt&&Ci)return;if(Ft.key===" "||Ft.key.toLowerCase()==="k")Ft.preventDefault(),ma()};return window.addEventListener("keydown",Et),()=>{window.removeEventListener("keydown",Et)}},[ma]);let ur=()=>{let Et=y.current;if(!Et)return;let Ft=!Y.isLooping;Et.loop(Ft),J((Wt)=>({...Wt,isLooping:Ft}))},Xl=(Et)=>{J((Wt)=>({...Wt,volume:Et,isMuted:Et===0}));let Ft=y.current;if(!Ft)return;if(Ft.volume(Et),Et>0&&Ft.muted())Ft.muted(!1);else if(Et===0&&!Ft.muted())Ft.muted(!0)},ao=()=>{let Et=y.current;if(!Et)return;if(Et.muted()){if(Et.muted(!1),Et.volume()===0)Et.volume(0.5)}else Et.muted(!0)},Wl=(Et)=>{let Ft=y.current;if(!Ft)return;Ft.playbackRate(Et)},ro=(Et)=>{let Ft=y.current;if(!Ft)return;let Wt=!Ft.paused(),Kt=Ft.currentTime();J((Ci)=>({...Ci,currentResolution:Et.resolution,currentSrc:Et.url})),Ft.src({type:"video/mp4",src:Et.url}),Ft.one("loadedmetadata",()=>{if(Ft.currentTime(Kt),Wt){let Ci=Ft.play();if(Ci!==void 0)Ci.catch((gi)=>{if(gi.name==="AbortError")return;console.error("Play after seek failed:",gi)})}Ft.playbackRate(Y.playbackRate)})},Ut=()=>{let Et=ae.current,Ft=he||Ce.current;if(Et&&typeof Et.requestFullscreen==="function"){if(!document.fullscreenElement)Et.requestFullscreen().catch(()=>{}),J((Kt)=>({...Kt,isFullScreen:!0}));else if(document.exitFullscreen)document.exitFullscreen().catch(()=>{}),J((Kt)=>({...Kt,isFullScreen:!1}));return}let Wt=Ft;if(Wt&&typeof Wt.webkitEnterFullscreen==="function"){if(!Wt.webkitDisplayingFullscreen)try{Wt.webkitEnterFullscreen()}catch(Kt){console.error("Failed to enter iOS fullscreen:",Kt)}else if(typeof Wt.webkitExitFullscreen==="function")try{Wt.webkitExitFullscreen()}catch(Kt){console.error("Failed to exit iOS fullscreen:",Kt)}return}J((Kt)=>({...Kt,isFullScreen:!Kt.isFullScreen}))},Yt=async(Et)=>{try{let Ft=l?await A.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:l,fileId:e.id},json:{key:Et}}):await A.api.files["download-url"].$post({json:{key:Et,assetId:e.id}});if(!Ft.ok)return;let{url:Wt}=await Ft.json(),Kt=document.createElement("a");Kt.href=Wt,Kt.download="",document.body.appendChild(Kt),Kt.click(),document.body.removeChild(Kt)}catch{}};h(()=>{let Et=()=>{J((Ci)=>({...Ci,isFullScreen:!!document.fullscreenElement}))};document.addEventListener("fullscreenchange",Et);let Ft=he||Ce.current,Wt=()=>{J((Ci)=>({...Ci,isFullScreen:!0}))},Kt=()=>{J((Ci)=>({...Ci,isFullScreen:!1}))};if(Ft)Ft.addEventListener("webkitbeginfullscreen",Wt),Ft.addEventListener("webkitendfullscreen",Kt);return()=>{if(document.removeEventListener("fullscreenchange",Et),Ft)Ft.removeEventListener("webkitbeginfullscreen",Wt),Ft.removeEventListener("webkitendfullscreen",Kt)}},[he]);let ei=Ne,Ki=Do();if(!j)return t("div",{className:"flex h-full w-full items-center justify-center",children:t("p",{className:"text-muted-foreground",children:"Media is not available."})});return o("div",{ref:ae,className:E("group shadow-2xl font-sans select-none flex flex-col mx-auto relative",Y.isFullScreen?"h-full w-full rounded-none bg-black":"w-full h-full",!ri&&Y.isFullScreen?"cursor-none":""),onMouseMove:cs,onMouseLeave:zn,children:[o("div",{className:"flex-1 flex flex-col-reverse md:flex-row min-h-0 relative",children:[!Y.isFullScreen&&c,o("div",{ref:ne,className:E("flex-1 bg-black cursor-pointer relative flex items-center justify-center overflow-hidden min-h-0 touch-none"),onClick:ma,"data-vjs-player":!0,"data-testid":"video-area",children:[t("div",{ref:I,className:"absolute inset-0 z-[-1]"}),fn?t("div",{className:"flex flex-col items-center justify-center text-muted-foreground w-full h-full pointer-events-none select-none",children:t(Zo,{className:E("w-16 h-16 text-foreground/75 transition-transform duration-500",Y.isPlaying?"animate-pulse scale-110 text-primary":"")})}):he&&Fe.width>0&&t(Uo,{width:Fe.width,height:Fe.height,mediaDimensions:{width:Ve,height:$e},videoElement:he,annotations:Rn,scale:ei,offset:Ue,className:"absolute inset-0",isDrawing:mt,currentTool:Xt,currentColor:hn,onAddAnnotation:nn}),!Y.isPlaying&&!mt&&t("div",{className:"absolute inset-0 flex items-center justify-center bg-black/20 pointer-events-none z-10",children:t("div",{className:"w-20 h-20 bg-white/10 backdrop-blur-sm rounded-full flex items-center justify-center border-2 border-white/30 animate-pulse",children:t(Ec,{className:"w-10 h-10 text-white ml-1 fill-white"})})})]})]}),Ki?t(p_,{state:na,zoom:Ne,isControlsVisible:ri,buffered:Zn,data:e,resolutions:x,togglePlay:ma,toggleLoop:ur,toggleMute:ao,handleVolumeChange:Xl,changePlaybackRate:Wl,changeResolution:ro,handleDownload:Yt,toggleFullScreen:Ut,onZoomChange:ct,onZoomReset:Ze,frameRate:cn,totalFrames:Si,currentFrame:Cn,seekToFrame:ta,onMouseEnter:Pr,onMouseLeave:Br,allowDownload:p}):t(ru,{state:na,zoom:Ne,isControlsVisible:ri,buffered:Zn,data:e,resolutions:x,togglePlay:ma,toggleLoop:ur,toggleMute:ao,handleVolumeChange:Xl,changePlaybackRate:Wl,changeResolution:ro,handleDownload:Yt,toggleFullScreen:Ut,onZoomChange:ct,onZoomReset:Ze,frameRate:cn,totalFrames:Si,currentFrame:Cn,seekToFrame:ta,onMouseEnter:Pr,onMouseLeave:Br,allowDownload:p})]})}),vk=CB;C();function jB(e){return(e.media?.videoTranscodes??[]).map((n)=>{let i=Math.max(n.width,n.height),s=`${n.height}p`;if(i>=3840)s="2160p";else if(i>=1920)s="1080p";else if(i>=1280)s="720p";else if(i>=960)s="540p";else if(i>=640)s="360p";else if(i>=320)s="180p";return{...n,resolution:s}})}var Sk=D(function({file:n,shareId:i,isActive:s,muted:a=!0,volume:r=1,annotations:l,onStateChange:c,onActivate:p,onRequestTogglePlay:m,onTimeUpdate:g,onPlay:y},x){let j=w(null),I=w(null),P=w(null),X=w(null),[Y,J]=u(void 0),{isDrawing:ne,currentTool:ae,currentColor:se,addAnnotation:oe,annotations:he}=tn(),[we,Ce]=u({width:0,height:0}),[Ne,Pe]=u(1),[Ue,ze]=u(!1),[He,De]=u(null),[Fe,bt]=u(!1),[Ve,$e]=u(!1),[Ct,ct]=u(1),[Ze,mt]=u(0),[Xt,hn]=u(r),[nn,Zt]=u(a),[Rn,Zn]=u(!1),Ni=n.media?.metadata,ri=Ni?.frameRate||30,Ai=Ni?.totalFrames||0,Vs=Ni?.duration||0,zi=uu({dbTotalFrames:Ai,containerDuration:Vs,frameRate:ri}),Ht=jB(n),$t=Ht[0],[cn,pn]=u($t?.resolution??""),oi=w($t?.url),fn=n.proxyType==="audio",{currentFrame:Si,seekToFrame:Cn}=yb(X,ri,zi,fn),ta=w(Ne);ta.current=Ne;let lr=w(Si);lr.current=Si,h(()=>{if(!P.current)return;let Ut=new ResizeObserver((Yt)=>{let ei=Yt[0];if(ei)Ce({width:ei.contentRect.width,height:ei.contentRect.height})});return Ut.observe(P.current),()=>Ut.disconnect()},[]);let os=Ni?.originalWidth||1920,ls=Ni?.originalHeight||1080;h(()=>{if(we.width>0&&we.height>0&&!Ue){let Ut=Math.min(we.width/os,we.height/ls);Pe(Ut)}},[we.width,we.height,os,ls,Ue]),h(()=>{pn($t?.resolution??""),oi.current=$t?.url},[n.id]),h(()=>{if(!I.current)return;let Ut=document.createElement("video-js");Ut.classList.add("vjs-big-play-centered","!h-full","!w-full"),Ut.style.opacity="0",Ut.style.pointerEvents="none",I.current.appendChild(Ut);let Yt=j.current=Ke(Ut,{controls:!1,autoplay:!1,preload:"auto",playsinline:!0,sources:[{src:oi.current??"",type:"video/mp4"}]}),ei=Ut.querySelector("video");if(ei)J(ei),X.current=ei;else Yt.ready(()=>{let Ki=Yt.tech({iWillNotUseThisInPlugins:!0})?.el();if(Ki)J(Ki),X.current=Ki});return Yt.on("play",()=>{bt(!0),y?.()}),Yt.on("pause",()=>bt(!1)),Yt.on("ended",()=>bt(!1)),Yt.on("loadedmetadata",()=>Zn(!0)),Yt.on("loadstart",()=>Zn(!1)),Yt.on("timeupdate",()=>{let Ki=Yt.duration()||Vs||0,Et=Yt.bufferedEnd();if(Ki>0)mt(Et/Ki*100)}),Yt.on("volumechange",()=>{hn(Yt.volume()||0),Zt(Yt.muted()||!1)}),Yt.on("ratechange",()=>ct(Yt.playbackRate()||1)),()=>{if(Yt&&!Yt.isDisposed())Yt.dispose(),j.current=null,X.current=null}},[n.id]),h(()=>{let Ut=j.current;if(!Ut||!Rn)return;Ut.muted(a),Ut.volume(r)},[a,r,Rn]),h(()=>{c({kind:"video",zoom:Ne,video:{frameRate:ri,totalFrames:zi,currentFrame:Si,isPlaying:Fe,volume:Xt,isMuted:nn,playbackRate:Ct,isLooping:Ve,currentResolution:cn,resolutions:Ht,buffered:Ze}})},[Ne,ri,zi,Si,Fe,Xt,nn,Ct,Ve,cn,Ze]),h(()=>{if(s)g?.(Si/ri)},[Si,ri,s,g]);let na=N((Ut)=>{let ei=ta.current*Ut;if(ei<0.01||ei>50)return;Pe(ei),ze(!0)},[]),Pi=N(()=>{ze(!1),De(null)},[]),cs=N((Ut)=>y4(Ut,zi),[zi]),Pr=N(async(Ut)=>{let Yt=Ut??n.media?.original?.key;if(!Yt||!n.id)return;try{let ei=i?await A.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:i,fileId:n.id},json:{key:Yt}}):await A.api.files["download-url"].$post({json:{key:Yt,assetId:n.id}});if(!ei.ok)return;let{url:Ki}=await ei.json(),Et=document.createElement("a");Et.href=Ki,Et.download="",document.body.appendChild(Et),Et.click(),document.body.removeChild(Et)}catch{}},[n.id,n.media?.original?.key,i]),Br=N((Ut)=>{let Yt=j.current;if(!Yt)return;let ei=Ht.find((Ft)=>Ft.resolution===Ut);if(!ei)return;let Ki=!Yt.paused(),Et=Yt.currentTime();pn(Ut),oi.current=ei.url,Yt.src({type:"video/mp4",src:ei.url}),Yt.one("loadedmetadata",()=>{if(Yt.currentTime(Et),Ki){let Ft=Yt.play();if(Ft!==void 0)Ft.catch(()=>{})}})},[Ht]);ln(x,()=>({getKind:()=>"video",play:()=>{let Ut=j.current?.play();if(Ut!==void 0)Ut.catch(()=>{})},pause:()=>j.current?.pause(),togglePlay:()=>{let Ut=j.current;if(!Ut)return;if(Ut.paused()||Ut.ended()){let Yt=Ut.play();if(Yt!==void 0)Yt.catch(()=>{})}else Ut.pause()},seekToFrame:(Ut)=>Cn(cs(Ut)),seekToSecond:(Ut)=>{let Yt=Math.floor(Ut*ri+0.45);Cn(cs(Yt))},stepFrame:(Ut)=>Cn(cs(lr.current+Ut)),setMuted:(Ut)=>j.current?.muted(Ut),setVolume:(Ut)=>{let Yt=j.current;if(!Yt)return;if(Yt.volume(Ut),Ut>0&&Yt.muted())Yt.muted(!1);else if(Ut===0&&!Yt.muted())Yt.muted(!0)},setPlaybackRate:(Ut)=>j.current?.playbackRate(Ut),toggleLoop:()=>{let Ut=j.current;if(!Ut)return;let Yt=!Ut.loop();Ut.loop(Yt),$e(Yt)},changeResolution:Br,zoomBy:na,fit:Pi,panBy:(Ut,Yt)=>De((ei)=>{let Ki=ta.current,Et=ei??{x:(we.width-os*Ki)/2,y:(we.height-ls*Ki)/2};return{x:Et.x+Ut,y:Et.y+Yt}}),download:(Ut)=>Pr(Ut)}),[Cn,cs,ri,na,Pi,Br,Pr,we.width,we.height,os,ls]);let zn=[...l,...s?he:[]],ma=Ne,ur=(we.width-os*ma)/2,Xl=(we.height-ls*ma)/2,ao=He?.x??ur,Wl=He?.y??Xl,ro=N(()=>{if(tn.getState().isDrawing)return;if(!s){p?.();return}m?.()},[s,p,m]);if(!n.media?.metadata||Ht.length===0)return t("div",{className:"flex h-full w-full items-center justify-center bg-black",children:t("p",{className:"text-muted-foreground",children:"Media is not available."})});return o("div",{ref:P,className:E("relative flex flex-1 cursor-pointer items-center justify-center overflow-hidden bg-black"),onClick:ro,"data-testid":"compare-video-area",children:[t("div",{ref:I,className:"absolute inset-0 z-[-1]"}),fn?t("div",{className:"flex flex-col items-center justify-center text-muted-foreground w-full h-full pointer-events-none select-none",children:t(Zo,{className:E("w-16 h-16 text-foreground/75 transition-transform duration-500",Fe?"animate-pulse scale-110 text-primary":"")})}):Y&&we.width>0&&t(Uo,{width:we.width,height:we.height,mediaDimensions:{width:os,height:ls},videoElement:Y,annotations:zn,scale:ma,offset:{x:ao,y:Wl},className:"absolute inset-0",onClick:ro,isDrawing:s&&ne,currentTool:ae,currentColor:se,onAddAnnotation:s?oe:void 0}),!Fe&&!ne&&t("div",{className:"pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-black/20",children:t("div",{className:"flex h-16 w-16 items-center justify-center rounded-full border-2 border-white/30 bg-white/10 backdrop-blur-sm",children:t(Ec,{className:"ml-1 h-8 w-8 fill-white text-white"})})})]})});var _k={id:"video",name:"Video",match:(e)=>e.proxyType==="video"||e.proxyType==="audio",viewer:vk,comparePane:Sk,commentsConfig:{hasTimestamp:!0,hasAnnotations:!0}};C();function Vb(){let[e,n]=u({width:window.innerWidth,height:window.innerHeight});return Ge(()=>{function i(){n({width:window.innerWidth,height:window.innerHeight})}return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),e}C();function nu({zoom:e,onZoomIn:n,onZoomOut:i,onFit:s,onDownload:a,canDownload:r,onCopy:l,copied:c=!1,canCopy:p=!0,allowDownload:m=!0,fullscreen:g}){return o("div",{className:"relative px-4 py-3 bg-card border-t border-gray-200 dark:border-gray-700 z-10 flex items-center justify-end gap-2 transition-colors duration-200",children:[o("div",{className:"flex items-center gap-1 bg-gray-200/50 dark:bg-white/10 rounded-md p-0.5 mr-auto",children:[t("button",{onClick:i,className:"p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors",title:Lp(),children:t(xa,{size:16})}),o("span",{className:"w-12 text-center text-xs font-mono font-medium text-gray-900 dark:text-gray-100 select-none",children:[Math.round(e*100),"%"]}),t("button",{onClick:n,className:"p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors",title:Dp(),children:t(fe,{size:16})})]}),t("button",{onClick:s,className:"text-xs font-medium px-3 py-1.5 rounded bg-gray-200/50 dark:bg-white/10 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors border border-transparent animate-in fade-in zoom-in-95 duration-200",children:Pf()}),l&&o("button",{onClick:l,disabled:!p,className:"flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded bg-gray-200/50 dark:bg-white/10 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors border border-transparent disabled:opacity-50 animate-in fade-in zoom-in-95 duration-200",title:P0(),children:[c?t(Me,{size:14,className:"text-green-500"}):t(Rr,{size:14}),c?I0():k0()]}),m&&o("button",{onClick:a,disabled:!r,className:"flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded bg-gray-200/50 dark:bg-white/10 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors border border-transparent disabled:opacity-50 animate-in fade-in zoom-in-95 duration-200",title:N_(),children:[t(vt,{size:14}),gr()]}),g&&t("button",{onClick:g.onToggle,className:"p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors",title:dd(),children:g.isFullScreen?t(_a,{size:16}):t(ya,{size:16})})]})}var EB=D(({file:e,annotations:n,shareId:i,children:s,allowDownload:a},r)=>{ln(r,()=>({play:()=>{},pause:()=>{},seekTo:()=>{}}));let{width:l}=Vb(),{isDrawing:c,currentTool:p,currentColor:m,addAnnotation:g,annotations:y}=tn(),[x,j]=u({width:0,height:0}),[I,P]=u(1),[X,Y]=u({x:0,y:0}),[J,ne]=u(!1),[ae,se]=u(!1),oe=w(null);h(()=>{ne(!1),se(!1)},[e.id]),h(()=>{let Ve=oe.current;if(!Ve)return;let $e=new ResizeObserver((Ct)=>{let ct=Ct[0];if(ct)j({width:ct.contentRect.width,height:ct.contentRect.height})});return $e.observe(Ve),()=>$e.disconnect()},[]);let he=e.media?.metadata?.originalWidth??1920,we=e.media?.metadata?.originalHeight??1080,{width:Ce,height:Ne}=x,Pe=Yc(Ce,Ne,he,we);h(()=>{if(Ce<=0||Ne<=0)return;if(J)return;P(Pe),Y(Bl(Ce,Ne,he,we,Pe))},[Ce,Ne,Pe,he,we,J]);let Ue=(Ve)=>{ne(!0);let $e=Ll(I,X,Ve,Ce/2,Ne/2);P($e.zoom),Y($e.pan)},ze=()=>{ne(!1),P(Pe),Y(Bl(Ce,Ne,he,we,Pe))};Cd({containerRef:oe,zoom:I,pan:X,baseScale:Pe,onZoomChange:(Ve)=>{ne(!0),P(Ve.zoom),Y(Ve.pan)},onPanChange:Y});let He=jd(e.media?.imageTranscodes,l)?.url??"",De=async()=>{let Ve=e.media?.original?.key;if(!Ve||!e.id)return;try{let $e=i?await A.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:i,fileId:e.id},json:{key:Ve}}):await A.api.files["download-url"].$post({json:{key:Ve,assetId:e.id}});if(!$e.ok)return;let{url:Ct}=await $e.json(),ct=document.createElement("a");ct.href=Ct,ct.download="",document.body.appendChild(ct),ct.click(),document.body.removeChild(ct)}catch{}},Fe=async()=>{let Ve=He;if(!Ve)return;try{let $e=(async()=>{let ct=await(await fetch(Ve)).blob(),Ze=new Image;Ze.crossOrigin="anonymous";let mt=URL.createObjectURL(ct);Ze.src=mt;try{await new Promise((Zt,Rn)=>{Ze.onload=Zt,Ze.onerror=(Zn)=>Rn(Error("Failed to load image: "+String(Zn)))});let Xt=document.createElement("canvas");Xt.width=Ze.width,Xt.height=Ze.height;let hn=Xt.getContext("2d");if(!hn)throw Error("Could not get canvas context");hn.drawImage(Ze,0,0);let nn=await new Promise((Zt)=>{Xt.toBlob(Zt,"image/png")});if(!nn)throw Error("Failed to convert image to PNG");return nn}finally{URL.revokeObjectURL(mt)}})();await navigator.clipboard.write([new ClipboardItem({"image/png":$e})]),se(!0),setTimeout(()=>se(!1),2000)}catch($e){console.error("Failed to copy image to clipboard:",$e)}},bt=[...n||[],...y];return o("div",{className:"flex flex-col flex-1 h-full overflow-hidden bg-gray-100 dark:bg-gray-950 relative",children:[o("div",{className:"flex-1 flex flex-col-reverse md:flex-row min-h-0 relative",children:[s,t("div",{ref:oe,className:"flex-1 relative overflow-hidden touch-none",children:He?t(Uo,{width:Ce,height:Ne,mediaDimensions:{width:he,height:we},imageUrl:He,annotations:bt,scale:I,offset:X,onPan:$p(I,Pe)?Y:void 0,className:"absolute inset-0 z-0",isDrawing:c,currentTool:p,currentColor:m,onAddAnnotation:g}):t("div",{className:"flex h-full w-full items-center justify-center",children:t("p",{className:"text-muted-foreground",children:"Preview unavailable"})})})]}),t(nu,{zoom:I,onZoomIn:()=>Ue(1.2),onZoomOut:()=>Ue(0.8),onFit:ze,onDownload:De,canDownload:!!e.media?.original?.key,onCopy:Fe,copied:ae,canCopy:!!He,allowDownload:a})]})}),xk=EB;C();var qB=0.01,DB=50,kk=D(function({file:n,shareId:i,isActive:s,annotations:a,onStateChange:r,onUserPan:l,onActivate:c},p){let{width:m}=Vb(),{isDrawing:g,currentTool:y,currentColor:x,addAnnotation:j,annotations:I}=tn(),[P,X]=u({width:0,height:0}),[Y,J]=u(1),[ne,ae]=u({x:0,y:0}),se=w(null),oe=w(Y);oe.current=Y;let he=w(ne);he.current=ne;let we=N((Ct)=>{if(se.current)se.current.disconnect(),se.current=null;if(Ct!==null){let ct=new ResizeObserver((Ze)=>{let mt=Ze[0];if(mt)X({width:mt.contentRect.width,height:mt.contentRect.height})});ct.observe(Ct),se.current=ct}},[]),Ce=n.media?.metadata?.originalWidth??1920,Ne=n.media?.metadata?.originalHeight??1080,{width:Pe,height:Ue}=P,ze=1;if(Pe>0&&Ue>0)ze=Math.min(Pe/Ce,Ue/Ne);h(()=>{if(Pe>0&&Ue>0)J(ze),ae({x:(Pe-Ce*ze)/2,y:(Ue-Ne*ze)/2})},[n.id,Pe,Ue,ze,Ce,Ne]);let He=N((Ct)=>{let ct=Pe/2,Ze=Ue/2,mt=oe.current,Xt=mt*Ct;if(Xt<qB||Xt>DB)return;let hn=he.current;ae({x:ct-(ct-hn.x)*(Xt/mt),y:Ze-(Ze-hn.y)*(Xt/mt)}),J(Xt)},[Pe,Ue]),De=N(()=>{J(ze),ae({x:(Pe-Ce*ze)/2,y:(Ue-Ne*ze)/2})},[ze,Pe,Ue,Ce,Ne]),Fe=jd(n.media?.imageTranscodes,m)?.url??"",bt=N(async()=>{let Ct=n.media?.original?.key;if(!Ct||!n.id)return;try{let ct=i?await A.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:i,fileId:n.id},json:{key:Ct}}):await A.api.files["download-url"].$post({json:{key:Ct,assetId:n.id}});if(!ct.ok)return;let{url:Ze}=await ct.json(),mt=document.createElement("a");mt.href=Ze,mt.download="",document.body.appendChild(mt),mt.click(),document.body.removeChild(mt)}catch{}},[n.id,n.media?.original?.key,i]);ln(p,()=>({getKind:()=>"image",play:()=>{},pause:()=>{},togglePlay:()=>{},seekToFrame:()=>{},seekToSecond:()=>{},stepFrame:()=>{},setMuted:()=>{},setVolume:()=>{},setPlaybackRate:()=>{},toggleLoop:()=>{},changeResolution:()=>{},zoomBy:(Ct)=>He(Ct),fit:De,panBy:(Ct,ct)=>ae((Ze)=>({x:Ze.x+Ct,y:Ze.y+ct})),download:bt}),[He,De,bt]),h(()=>{r({kind:"image",zoom:Y})},[Y,r]);let Ve=[...a,...s?I:[]],$e=N((Ct)=>{let ct=he.current,Ze=Ct.x-ct.x,mt=Ct.y-ct.y;if(ae(Ct),Ze!==0||mt!==0)l?.(Ze,mt)},[l]);if(!Fe)return t("div",{className:"flex flex-1 items-center justify-center bg-gray-100 dark:bg-gray-950",children:t("p",{className:"text-muted-foreground",children:"Preview unavailable"})});return t("div",{ref:we,className:"relative flex-1 overflow-hidden bg-black",onMouseDown:c,children:t(Uo,{width:Pe,height:Ue,mediaDimensions:{width:Ce,height:Ne},imageUrl:Fe,annotations:Ve,scale:Y,offset:ne,onPan:$e,className:"absolute inset-0 z-0",isDrawing:s&&g,currentTool:y,currentColor:x,onAddAnnotation:s?j:void 0})})});var Tk={id:"image",name:"Image",match:(e)=>e.proxyType==="image",viewer:xk,comparePane:kk,commentsConfig:{hasTimestamp:!1,hasAnnotations:!0}};var ar=typeof process==="object"&&process+""==="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),zl=[1/0,1/0,-1/0,-1/0],kh=new Float32Array(zl),K3=[0.001,0,0,0.001,0,0];var sr={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Jc={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};var gn={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},Pn={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,INK_COLOR_AND_OPACITY:24,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},IB={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};var as={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},t2={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Oi={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26,RICHMEDIA:27};var qd={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};var m2={ERRORS:0,WARNINGS:1,INFOS:5},Xo={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},Yp={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},MB={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},g2=m2.WARNINGS;function RB(e){if(Number.isInteger(e))g2=e}function OB(){return g2}function b2(e){if(g2>=m2.INFOS)console.info(`Info: ${e}`)}function yn(e){if(g2>=m2.WARNINGS)console.warn(`Warning: ${e}`)}function Un(e){throw Error(e)}function Fi(e,n){if(!e)Un(n)}function FB(e){switch(e?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Zk(e,n=null,i=null){if(!e)return null;if(i&&typeof e==="string"){if(i.addDefaultProtocol&&e.startsWith("www.")){if(e.match(/\./g)?.length>=2)e=`http://${e}`}if(i.tryConvertEncoding)try{e=PB(e)}catch{}}let s=n?URL.parse(e,n):URL.parse(e);return FB(s)?s:null}function eT(e,n,i=!1){let s=URL.parse(e);if(s)return s.hash=n,s.href;if(i&&Zk(e,"http://example.com"))return e.split("#",1)[0]+`${n?`#${n}`:""}`;return""}function $3(e){return e.substring(e.lastIndexOf("/")+1)}function en(e,n,i,s=!1){return Object.defineProperty(e,n,{value:i,enumerable:!s,configurable:!0,writable:!1}),i}var qh=function(){function n(i,s){this.message=i,this.name=s}return n.prototype=Error(),n.constructor=n,n}();class a2 extends qh{constructor(e,n){super(e,"PasswordException");this.code=n}}class n2 extends qh{constructor(e,n){super(e,"UnknownErrorException");this.details=n}}class r2 extends qh{constructor(e){super(e,"InvalidPDFException")}}class im extends qh{constructor(e,n,i){super(e,"ResponseException");this.status=n,this.missing=i}}class tT extends qh{constructor(e){super(e,"FormatError")}}class Vl extends qh{constructor(e){super(e,"AbortException")}}function NB(e){if(typeof e!=="object"||e?.length===void 0)Un("Invalid argument for bytesToString");let n=e.length,i=8192;if(n<i)return String.fromCharCode.apply(null,e);let s=[];for(let a=0;a<n;a+=i){let r=Math.min(a+i,n),l=e.subarray(a,r);s.push(String.fromCharCode.apply(null,l))}return s.join("")}function w2(e){if(typeof e!=="string")Un("Invalid argument for stringToBytes");let n=e.length,i=new Uint8Array(n);for(let s=0;s<n;++s)i[s]=e.charCodeAt(s)&255;return i}class ai{static get isLittleEndian(){let e=new Uint8Array(4);e[0]=1;let n=new Uint32Array(e.buffer,0,1);return en(this,"isLittleEndian",n[0]===1)}static get isOffscreenCanvasSupported(){return en(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return en(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return en(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return en(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){let{platform:e,userAgent:n}=navigator;return en(this,"platform",{isAndroid:n.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:n.includes("Firefox")})}static get isCanvasFilterSupported(){let e;if(this.isOffscreenCanvasSupported)e=new OffscreenCanvas(1,1).getContext("2d");else if(typeof document<"u")e=document.createElement("canvas").getContext("2d");return en(this,"isCanvasFilterSupported",e?.filter!==void 0)}static get isAlphaColorInputSupported(){if(typeof document>"u")return en(this,"isAlphaColorInputSupported",!1);let e=document.createElement("input");return e.type="color",e.setAttribute("alpha",""),e.value="#ff000080",en(this,"isAlphaColorInputSupported",e.value!=="#ff0000")}static get isBackdropFilterSupported(){return en(this,"isBackdropFilterSupported",typeof CSS<"u"&&CSS.supports("backdrop-filter","blur(1px)"))}}class It{static get hexNums(){return en(this,"hexNums",Array.from({length:256},(e,n)=>n.toString(16).padStart(2,"0")))}static makeHexColor(e,n,i){return`#${this.hexNums[e]}${this.hexNums[n]}${this.hexNums[i]}`}static transform(e,n){return[e[0]*n[0]+e[2]*n[1],e[1]*n[0]+e[3]*n[1],e[0]*n[2]+e[2]*n[3],e[1]*n[2]+e[3]*n[3],e[0]*n[4]+e[2]*n[5]+e[4],e[1]*n[4]+e[3]*n[5]+e[5]]}static multiplyByDOMMatrix(e,n){return[e[0]*n.a+e[2]*n.b,e[1]*n.a+e[3]*n.b,e[0]*n.c+e[2]*n.d,e[1]*n.c+e[3]*n.d,e[0]*n.e+e[2]*n.f+e[4],e[1]*n.e+e[3]*n.f+e[5]]}static applyTransform(e,n,i=0){let s=e[i],a=e[i+1];e[i]=s*n[0]+a*n[2]+n[4],e[i+1]=s*n[1]+a*n[3]+n[5]}static applyTransformToBezier(e,n,i=0){let s=n[0],a=n[1],r=n[2],l=n[3],c=n[4],p=n[5];for(let m=0;m<6;m+=2){let g=e[i+m],y=e[i+m+1];e[i+m]=g*s+y*r+c,e[i+m+1]=g*a+y*l+p}}static applyInverseTransform(e,n){let i=e[0],s=e[1],a=n[0]*n[3]-n[1]*n[2];e[0]=(i*n[3]-s*n[2]+n[2]*n[5]-n[4]*n[3])/a,e[1]=(-i*n[1]+s*n[0]+n[4]*n[1]-n[5]*n[0])/a}static axialAlignedBoundingBox(e,n,i){let s=n[0],a=n[1],r=n[2],l=n[3],c=n[4],p=n[5],m=e[0],g=e[1],y=e[2],x=e[3],j=s*m+c,I=j,P=s*y+c,X=P,Y=l*g+p,J=Y,ne=l*x+p,ae=ne;if(a!==0||r!==0){let se=a*m,oe=a*y,he=r*g,we=r*x;j+=he,X+=he,P+=we,I+=we,Y+=se,ae+=se,ne+=oe,J+=oe}i[0]=Math.min(i[0],j,P,I,X),i[1]=Math.min(i[1],Y,ne,J,ae),i[2]=Math.max(i[2],j,P,I,X),i[3]=Math.max(i[3],Y,ne,J,ae)}static inverseTransform(e){let n=e[0]*e[3]-e[1]*e[2];return[e[3]/n,-e[1]/n,-e[2]/n,e[0]/n,(e[2]*e[5]-e[4]*e[3])/n,(e[4]*e[1]-e[5]*e[0])/n]}static singularValueDecompose2dScale(e,n){let i=e[0],s=e[1],a=e[2],r=e[3],l=i**2+s**2,c=i*a+s*r,p=a**2+r**2,m=(l+p)/2,g=Math.sqrt(m**2-(l*p-c**2));n[0]=Math.sqrt(m+g||1),n[1]=Math.sqrt(m-g||1)}static normalizeRect(e){let n=e.slice(0);if(e[0]>e[2])n[0]=e[2],n[2]=e[0];if(e[1]>e[3])n[1]=e[3],n[3]=e[1];return n}static intersect(e,n){let i=Math.max(Math.min(e[0],e[2]),Math.min(n[0],n[2])),s=Math.min(Math.max(e[0],e[2]),Math.max(n[0],n[2]));if(i>s)return null;let a=Math.max(Math.min(e[1],e[3]),Math.min(n[1],n[3])),r=Math.min(Math.max(e[1],e[3]),Math.max(n[1],n[3]));if(a>r)return null;return[i,a,s,r]}static pointBoundingBox(e,n,i){i[0]=Math.min(i[0],e),i[1]=Math.min(i[1],n),i[2]=Math.max(i[2],e),i[3]=Math.max(i[3],n)}static rectBoundingBox(e,n,i,s,a){a[0]=Math.min(a[0],e,i),a[1]=Math.min(a[1],n,s),a[2]=Math.max(a[2],e,i),a[3]=Math.max(a[3],n,s)}static#e(e,n,i,s,a,r,l,c,p,m){if(p<=0||p>=1)return;let g=1-p,y=p*p,x=y*p,j=g*(g*(g*e+3*p*n)+3*y*i)+x*s,I=g*(g*(g*a+3*p*r)+3*y*l)+x*c;m[0]=Math.min(m[0],j),m[1]=Math.min(m[1],I),m[2]=Math.max(m[2],j),m[3]=Math.max(m[3],I)}static#t(e,n,i,s,a,r,l,c,p,m,g,y){if(Math.abs(p)<0.000000000001){if(Math.abs(m)>=0.000000000001)this.#e(e,n,i,s,a,r,l,c,-g/m,y);return}let x=m**2-4*g*p;if(x<0)return;let j=Math.sqrt(x),I=2*p;this.#e(e,n,i,s,a,r,l,c,(-m+j)/I,y),this.#e(e,n,i,s,a,r,l,c,(-m-j)/I,y)}static bezierBoundingBox(e,n,i,s,a,r,l,c,p){p[0]=Math.min(p[0],e,l),p[1]=Math.min(p[1],n,c),p[2]=Math.max(p[2],e,l),p[3]=Math.max(p[3],n,c),this.#t(e,i,a,l,n,s,r,c,3*(-e+3*(i-a)+l),6*(e-2*i+a),3*(i-e),p),this.#t(e,i,a,l,n,s,r,c,3*(-n+3*(s-r)+c),6*(n-2*s+r),3*(s-n),p)}}function PB(e){return decodeURIComponent(escape(e))}var z3=null,Ak=null;function BB(e){if(!z3)z3=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,Ak=new Map([["ſt","ſt"]]);return e.replaceAll(z3,(n,i,s)=>i?i.normalize("NFKC"):Ak.get(s))}function nT(){if(typeof crypto.randomUUID==="function")return crypto.randomUUID();let e=new Uint8Array(32);return crypto.getRandomValues(e),NB(e)}function LB(e,n,i){if(!Array.isArray(i)||i.length<2)return!1;let[s,a,...r]=i;if(!e(s)&&!Number.isInteger(s))return!1;if(!n(a))return!1;let l=r.length,c=!0;switch(a.name){case"XYZ":if(l<2||l>3)return!1;break;case"Fit":case"FitB":return l===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(l>1)return!1;break;case"FitR":if(l!==4)return!1;c=!1;break;default:return!1}for(let p of r){if(typeof p==="number"||c&&p===null)continue;return!1}return!0}var Rd=()=>[],r9=()=>new Map,Y3=()=>Object.create(null),HB=()=>new Set;if(typeof Iterator.prototype.join!=="function")Iterator.prototype.join=function(e){return[...this].join(e)};function vi(e,n,i){return Math.min(Math.max(e,n),i)}class um{constructor({viewBox:e,userUnit:n,scale:i,rotation:s,offsetX:a=0,offsetY:r=0,dontFlip:l=!1}){this.viewBox=e,this.userUnit=n,this.scale=i,this.rotation=s,this.offsetX=a,this.offsetY=r,i*=n;let c=(e[2]+e[0])/2,p=(e[3]+e[1])/2,m,g,y,x;if(s%=360,s<0)s+=360;switch(s){case 180:m=-1,g=0,y=0,x=1;break;case 90:m=0,g=1,y=1,x=0;break;case 270:m=0,g=-1,y=-1,x=0;break;case 0:m=1,g=0,y=0,x=-1;break;default:throw Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}if(l)y=-y,x=-x;let j,I,P,X;if(m===0)j=Math.abs(p-e[1])*i+a,I=Math.abs(c-e[0])*i+r,P=(e[3]-e[1])*i,X=(e[2]-e[0])*i;else j=Math.abs(c-e[0])*i+a,I=Math.abs(p-e[1])*i+r,P=(e[2]-e[0])*i,X=(e[3]-e[1])*i;this.transform=[m*i,g*i,y*i,x*i,j-m*i*c-y*i*p,I-g*i*c-x*i*p],this.width=P,this.height=X}get rawDims(){let e=this.viewBox;return en(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:n=this.rotation,offsetX:i=this.offsetX,offsetY:s=this.offsetY,dontFlip:a=!1}={}){return new um({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:n,offsetX:i,offsetY:s,dontFlip:a})}convertToViewportPoint(e,n){let i=[e,n];return It.applyTransform(i,this.transform),i}convertToPdfPoint(e,n){let i=[e,n];return It.applyInverseTransform(i,this.transform),i}}class sm{static textContent(e){let n=[],i={items:n,styles:Object.create(null)};function s(a){if(!a)return;let r=null,l=a.name;if(l==="#text")r=a.value;else if(!sm.shouldBuildText(l))return;else if(a?.attributes?.textContent)r=a.attributes.textContent;else if(a.value)r=a.value;if(r!==null)n.push({str:r});if(!a.children)return;for(let c of a.children)s(c)}return s(e),i}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}var UB=/url\(|image-set\(/i,zB=/^on/i;class o9{static get _allowedHtmlElements(){return en(this,"_allowedHtmlElements",new Set(["a","b","br","button","div","i","img","input","label","li","ol","option","p","select","span","sub","sup","textarea","ul"]))}static get _allowedSvgElements(){return en(this,"_allowedSvgElements",new Set(["ellipse","line","path","rect","svg"]))}static get _allowedRichTextElements(){return en(this,"_allowedRichTextElements",new Set(["a","b","br","div","i","li","ol","p","span","sub","sup","ul"]))}static get _allowedRichTextAttributes(){return en(this,"_allowedRichTextAttributes",new Set(["class","dir","style"]))}static get _allowedRichTextStyles(){return en(this,"_allowedRichTextStyles",new Set(["color","font","fontFamily","fontSize","fontStretch","fontStyle","fontWeight","kerningMode","letterSpacing","lineHeight","margin","marginBottom","marginLeft","marginRight","marginTop","orphans","paddingLeft","paddingRight","breakAfter","breakBefore","breakInside","tabInterval","tabStop","textAlign","textDecoration","textIndent","transform","verticalAlign","widows"]))}static setupStorage(e,n,i,s,a){let r=s.getValue(n,{value:null});switch(i.name){case"textarea":if(r.value!==null)e.textContent=r.value;if(a==="print")break;e.addEventListener("input",(l)=>{s.setValue(n,{value:l.target.value})});break;case"input":if(i.attributes.type==="radio"||i.attributes.type==="checkbox"){if(r.value===i.attributes.xfaOn)e.setAttribute("checked",!0);else if(r.value===i.attributes.xfaOff)e.removeAttribute("checked");if(a==="print")break;e.addEventListener("change",(l)=>{s.setValue(n,{value:l.target.checked?l.target.getAttribute("xfaOn"):l.target.getAttribute("xfaOff")})})}else{if(r.value!==null)e.setAttribute("value",r.value);if(a==="print")break;e.addEventListener("input",(l)=>{s.setValue(n,{value:l.target.value})})}break;case"select":if(r.value!==null){e.setAttribute("value",r.value);for(let l of i.children)if(l.attributes.value===r.value)l.attributes.selected=!0;else if(Object.hasOwn(l.attributes,"selected"))delete l.attributes.selected}e.addEventListener("input",(l)=>{let c=l.target.options,p=c.selectedIndex===-1?"":c[c.selectedIndex].value;s.setValue(n,{value:p})});break}}static setAttributes({html:e,element:n,storage:i=null,intent:s,linkService:a}){let{attributes:r}=n,l=e instanceof HTMLAnchorElement;if(r.type==="radio")r.name=`${r.name}-${s}`;for(let[c,p]of Object.entries(r)){if(p===null||p===void 0)continue;if(zB.test(c))continue;if(s==="richText"&&!this._allowedRichTextAttributes.has(c))continue;switch(c){case"class":if(p.length)e.setAttribute(c,p.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",p);break;case"style":if(s==="richText"){let m=this._allowedRichTextStyles;for(let[g,y]of Object.entries(p))if(m.has(g)&&!UB.test(y))e.style[g]=y}else Object.assign(e.style,p);break;case"textContent":e.textContent=p;break;default:if(!l||c!=="href"&&c!=="newWindow")e.setAttribute(c,p)}}if(l)a?.addLinkAttributes(e,r.href,r.newWindow);if(i&&r.dataId)this.setupStorage(e,r.dataId,n,i)}static#e(e,n,i){if(i==="richText")return!n&&this._allowedRichTextElements.has(e)?document.createElement(e):null;if(n)return n==="http://www.w3.org/2000/svg"&&this._allowedSvgElements.has(e)?document.createElementNS("http://www.w3.org/2000/svg",e):null;return this._allowedHtmlElements.has(e)?document.createElement(e):null}static render(e){let{annotationStorage:n,linkService:i,xfaHtml:s}=e,a=e.intent||"display",r=this.#e(s.name,s.attributes?.xmlns,a)??document.createElement("div");if(s.attributes)this.setAttributes({html:r,element:s,intent:a,linkService:i});let l=a!=="richText",c=e.div;if(c.append(r),e.viewport){let g=`matrix(${e.viewport.transform.join(",")})`;c.style.transform=g}if(l)c.setAttribute("class","xfaLayer xfaFont");let p=[];if(s.children.length===0){if(s.value){let g=document.createTextNode(s.value);if(r.append(g),l&&sm.shouldBuildText(s.name))p.push(g)}return{textDivs:p}}let m=[[s,-1,r]];while(m.length>0){let[g,y,x]=m.at(-1);if(y+1===g.children.length){m.pop();continue}let j=g.children[++m.at(-1)[1]];if(j===null)continue;let{name:I}=j;if(I==="#text"){let X=document.createTextNode(j.value);p.push(X),x.append(X);continue}let P=this.#e(I,j.attributes?.xmlns,a);if(!P)continue;if(x.append(P),j.attributes)this.setAttributes({html:P,element:j,storage:n,intent:a,linkService:i});if(j.children?.length>0)m.push([j,-1,P]);else if(j.value){let X=document.createTextNode(j.value);if(l&&sm.shouldBuildText(I))p.push(X);P.append(X)}}for(let g of c.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))g.setAttribute("readOnly",!0);return{textDivs:p}}static update(e){let n=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=n,e.div.hidden=!1}static getPageViewport(e,{scale:n=1,rotation:i=0}){let{width:s,height:a}=e.attributes.style;return new um({viewBox:[0,0,parseInt(s,10),parseInt(a,10)],userUnit:1,scale:n,rotation:i})}}class Ch{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}async function l9(e,n="text"){if(em(e,document.baseURI)){let i=await fetch(e);if(!i.ok)throw Error(i.statusText);switch(n){case"blob":return i.blob();case"bytes":return i.bytes();case"json":return i.json()}return i.text()}return new Promise((i,s)=>{let a=new XMLHttpRequest;a.open("GET",e,!0),a.responseType=n==="bytes"?"arraybuffer":n,a.onreadystatechange=()=>{if(a.readyState!==XMLHttpRequest.DONE)return;if(a.status===200||a.status===0){switch(n){case"bytes":i(new Uint8Array(a.response));return;case"blob":case"json":i(a.response);return}i(a.responseText);return}s(Error(a.statusText))},a.send(null)})}class y2 extends qh{constructor(e,n=0){super(e,"RenderingCancelledException");this.extraDelay=n}}function v2(e){let n=e.length,i=0;while(i<n&&e[i].trim()==="")i++;return e.substring(i,i+5).toLowerCase()==="data:"}function c9(e){return typeof e==="string"&&/\.pdf$/i.test(e)}function GB(e){return[e]=e.split(/[#?]/,1),$3(e)}function VB(e,n="document.pdf"){if(typeof e!=="string")return n;if(v2(e))return yn('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),n;let s=((c)=>{try{return new URL(c)}catch{}try{return new URL(decodeURIComponent(c))}catch{}try{return new URL(c,"https://foo.bar")}catch{}try{return new URL(decodeURIComponent(c),"https://foo.bar")}catch{}return null})(e);if(!s)return n;let a=(c)=>{try{let p=decodeURIComponent(c);if(p.includes("/")){if(p=$3(p),p.length===4&&r.test(p))return c}return p}catch{return c}},r=/\.pdf$/i,l=$3(s.pathname);if(r.test(l))return a(l);if(s.searchParams.size>0){let c=(m)=>[...m].findLast((g)=>r.test(g)),p=c(s.searchParams.values())??c(s.searchParams.keys());if(p)return a(p)}if(s.hash){let{hash:c}=s,p=-1;for(let{index:m}of c.matchAll(/\.pdf\b/gi))p=m;if(p>0){let m=p;while(m>0&&!"/?#=".includes(c[m-1]))m--;if(m<p)return a(c.slice(m,p+4))}}return n}class Q3{#e=new Map;times=[];time(e){if(this.#e.has(e))yn(`Timer is already running for ${e}`);this.#e.set(e,Date.now())}timeEnd(e){if(!this.#e.has(e))yn(`Timer has not been started for ${e}`);this.times.push({name:e,start:this.#e.get(e),end:Date.now()}),this.#e.delete(e)}toString(){let e=Math.max(...this.times.map((n)=>n.name.length));return this.times.map((n)=>`${n.name.padEnd(e)} ${n.end-n.start}ms
|
|
245
|
+
`).join("")}}function em(e,n){let i=n?URL.parse(e,n):URL.parse(e);return/https?:/.test(i?.protocol??"")}function io(e){e.preventDefault()}function rs(e){e.preventDefault(),e.stopPropagation()}class o2{static#e;static toDateObject(e){if(e instanceof Date)return e;if(!e||typeof e!=="string")return null;this.#e||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+\\-])?(\\d{2})?'?(\\d{2})?'?");let n=this.#e.exec(e);if(!n)return null;let i=parseInt(n[1],10),s=parseInt(n[2],10);s=s>=1&&s<=12?s-1:0;let a=parseInt(n[3],10);a=a>=1&&a<=31?a:1;let r=parseInt(n[4],10);r=r>=0&&r<=23?r:0;let l=parseInt(n[5],10);l=l>=0&&l<=59?l:0;let c=parseInt(n[6],10);c=c>=0&&c<=59?c:0;let p=n[7]||"Z",m=parseInt(n[8],10);m=m>=0&&m<=23?m:0;let g=parseInt(n[9],10)||0;if(g=g>=0&&g<=59?g:0,p==="-")r+=m,l+=g;else if(p==="+")r-=m,l-=g;return new Date(Date.UTC(i,s,a,r,l,c))}}function hm(e){if(e.startsWith("#")){let i=e.slice(1);return[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16),i.length>=8?parseInt(i.slice(6,8),16)/255:1]}if(e.startsWith("rgb(")){let[i,s,a]=e.slice(4,-1).split(",").map((r)=>parseInt(r,10));return[i,s,a,1]}if(e.startsWith("rgba(")){let i=e.slice(5,-1).split(",");return[parseInt(i[0],10),parseInt(i[1],10),parseInt(i[2],10),parseFloat(i[3])]}let n=e.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);if(n)return[Math.round(parseFloat(n[1])*255),Math.round(parseFloat(n[2])*255),Math.round(parseFloat(n[3])*255),n[4]!==void 0&&n[4]!=="none"?parseFloat(n[4]):1];return null}function fm(e){let n=hm(e);if(!n)return yn(`Not a valid color format: "${e}"`),[0,0,0];return n.slice(0,3)}function XB(e){let n=document.createElement("span");n.style.visibility="hidden",n.style.colorScheme="only light",document.body.append(n);for(let i of e.keys()){n.style.color=i;let s=window.getComputedStyle(n).color;e.set(i,fm(s))}n.remove()}function bi(e){let{a:n,b:i,c:s,d:a,e:r,f:l}=e.getTransform();return[n,i,s,a,r,l]}function zo(e){let{a:n,b:i,c:s,d:a,e:r,f:l}=e.getTransform().invertSelf();return[n,i,s,a,r,l]}function jh(e,n,i=!1,s=!0){if(n instanceof um){let{pageWidth:a,pageHeight:r}=n.rawDims,{style:l}=e,c=`round(down, var(--total-scale-factor) * ${a}px, var(--scale-round-x))`,p=`round(down, var(--total-scale-factor) * ${r}px, var(--scale-round-y))`;if(!i||n.rotation%180===0)l.width=c,l.height=p;else l.width=p,l.height=c}if(s)e.setAttribute("data-main-rotation",n.rotation)}class so{constructor(){let{pixelRatio:e}=so;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(e,n,i,s,a=-1){let r=1/0,l=1/0,c=1/0;if(i=so.capPixels(i,a),i>0)r=Math.sqrt(i/(e*n));if(s!==-1)l=s/e,c=s/n;let p=Math.min(r,l,c);if(this.sx>p||this.sy>p)return this.sx=p,this.sy=p,!0;return!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,n){if(n>=0){let i=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+n/100));return e>0?Math.min(e,i):i}return e}}var J3=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class iT{static get isDarkMode(){return en(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}}class sT{static get commentForegroundColor(){let e=document.createElement("span");e.classList.add("comment","sidebar");let{style:n}=e;n.width=n.height="0",n.display="none",n.color="var(--comment-fg-color)",document.body.append(e);let{color:i}=window.getComputedStyle(e);return e.remove(),en(this,"commentForegroundColor",fm(i))}}function WB(e,n){n=vi(n??1,0,1);let i=255*(1-n);return e.map((s)=>Math.round(s*n+i))}function Ck(e,n){let i=e[0]/255,s=e[1]/255,a=e[2]/255,r=Math.max(i,s,a),l=Math.min(i,s,a),c=(r+l)/2;if(r===l)n[0]=n[1]=0;else{let p=r-l;switch(n[1]=c<0.5?p/(r+l):p/(2-r-l),r){case i:n[0]=((s-a)/p+(s<a?6:0))*60;break;case s:n[0]=((a-i)/p+2)*60;break;case a:n[0]=((i-s)/p+4)*60;break}}n[2]=c}function Z3(e,n){let i=e[0],s=e[1],a=e[2],r=(1-Math.abs(2*a-1))*s,l=r*(1-Math.abs(i/60%2-1)),c=a-r/2;switch(Math.floor(i/60)){case 0:n[0]=r+c,n[1]=l+c,n[2]=c;break;case 1:n[0]=l+c,n[1]=r+c,n[2]=c;break;case 2:n[0]=c,n[1]=r+c,n[2]=l+c;break;case 3:n[0]=c,n[1]=l+c,n[2]=r+c;break;case 4:n[0]=l+c,n[1]=c,n[2]=r+c;break;case 5:case 6:n[0]=r+c,n[1]=c,n[2]=l+c;break}}function e9(e){return e<=0.03928?e/12.92:((e+0.055)/1.055)**2.4}function jk(e,n,i){Z3(e,i),i.map(e9);let s=0.2126*i[0]+0.7152*i[1]+0.0722*i[2];Z3(n,i),i.map(e9);let a=0.2126*i[0]+0.7152*i[1]+0.0722*i[2];return s>a?(s+0.05)/(a+0.05):(a+0.05)/(s+0.05)}var Ek=new Map;function KB(e,n){let i=e[0]+e[1]*256+e[2]*65536+n[0]*16777216+n[1]*4294967296+n[2]*1099511627776,s=Ek.get(i);if(s)return s;let a=new Float32Array(9),r=a.subarray(0,3),l=a.subarray(3,6);Ck(e,l);let c=a.subarray(6,9);Ck(n,c);let p=c[2]<0.5,m=p?12:4.5;if(l[2]=p?Math.sqrt(l[2]):1-Math.sqrt(1-l[2]),jk(l,c,r)<m){let g,y;if(p)g=l[2],y=1;else g=0,y=l[2];let x=0.005;while(y-g>x){let j=l[2]=(g+y)/2;if(p===jk(l,c,r)<m)g=j;else y=j}l[2]=p?y:g}return Z3(l,r),s=It.makeHexColor(Math.round(r[0]*255),Math.round(r[1]*255),Math.round(r[2]*255)),Ek.set(i,s),s}function aT({html:e,dir:n,className:i},s){let a=document.createDocumentFragment();if(typeof e==="string"){let r=document.createElement("p");r.dir=n||"auto";let l=e.split(/\r\n?|\n/);for(let c=0,p=l.length;c<p;++c){let m=l[c];if(r.append(document.createTextNode(m)),c<p-1)r.append(document.createElement("br"))}a.append(r)}else o9.render({xfaHtml:e,div:a,intent:"richText"});a.firstElementChild.classList.add("richText",i),s.append(a)}function rT(e){let n=new Path2D;if(!e)return n;for(let i=0,s=e.length;i<s;)switch(e[i++]){case Yp.moveTo:n.moveTo(e[i++],e[i++]);break;case Yp.lineTo:n.lineTo(e[i++],e[i++]);break;case Yp.curveTo:n.bezierCurveTo(e[i++],e[i++],e[i++],e[i++],e[i++],e[i++]);break;case Yp.quadraticCurveTo:n.quadraticCurveTo(e[i++],e[i++],e[i++],e[i++]);break;case Yp.closePath:n.closePath();break;default:yn(`Unrecognized drawing path operator: ${e[i-1]}`);break}return n}class tm{#e=null;#t=null;#n;#i=null;#s=null;#r=null;#a=null;#o=null;static#l=null;constructor(e){this.#n=e,tm.#l||=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"})}render(){let e=this.#e=document.createElement("div");e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");let n=this.#n._uiManager._signal;if(n instanceof AbortSignal&&!n.aborted)e.addEventListener("contextmenu",io,{signal:n}),e.addEventListener("pointerdown",tm.#c,{signal:n});let i=this.#i=document.createElement("div");i.className="buttons",e.append(i);let s=this.#n.toolbarPosition;if(s){let{style:a}=e,r=this.#n._uiManager.direction==="ltr"?1-s[0]:s[0];a.insetInlineEnd=`${100*r}%`,a.top=`calc(${100*s[1]}% + var(--editor-toolbar-vert-offset))`}return e}get div(){return this.#e}static#c(e){e.stopPropagation()}#f(e){this.#n._focusEventsAllowed=!1,rs(e)}#h(e){this.#n._focusEventsAllowed=!0,rs(e)}#d(e){let n=this.#n._uiManager._signal;if(!(n instanceof AbortSignal)||n.aborted)return!1;return e.addEventListener("focusin",this.#f.bind(this),{capture:!0,signal:n}),e.addEventListener("focusout",this.#h.bind(this),{capture:!0,signal:n}),e.addEventListener("contextmenu",io,{signal:n}),!0}hide(){this.#e.classList.add("hidden"),this.#t?.hideDropdown()}show(){this.#e.classList.remove("hidden"),this.#s?.shown(),this.#r?.shown()}addDeleteButton(){let{editorType:e,_uiManager:n}=this.#n,i=document.createElement("button");if(i.classList.add("basic","deleteButton"),i.tabIndex=0,i.setAttribute("data-l10n-id",tm.#l[e]),this.#d(i))i.addEventListener("click",(s)=>{n.delete()},{signal:n._signal});this.#i.append(i)}get#m(){let e=document.createElement("div");return e.className="divider",e}async addAltText(e){let n=await e.render();this.#d(n),this.#i.append(n,this.#m),this.#s=e}addComment(e,n=null){if(this.#r)return;let i=e.renderForToolbar();if(!i)return;this.#d(i);let s=this.#a=this.#m;if(!n)this.#i.append(i,s);else this.#i.insertBefore(i,n),this.#i.insertBefore(s,n);this.#r=e,e.toolbar=this}addColorPicker(e){if(this.#t)return;this.#t=e;let n=e.renderButton();this.#d(n),this.#i.append(n,this.#m)}async addEditSignatureButton(e){let n=this.#o=await e.renderEditButton(this.#n);this.#d(n),this.#i.append(n,this.#m)}removeButton(e){switch(e){case"comment":this.#r?.removeToolbarCommentButton(),this.#r=null,this.#a?.remove(),this.#a=null;break}}async addButton(e,n){switch(e){case"colorPicker":if(n)this.addColorPicker(n);break;case"altText":if(n)await this.addAltText(n);break;case"editSignature":if(n)await this.addEditSignatureButton(n);break;case"delete":this.addDeleteButton();break;case"comment":if(n)this.addComment(n);break}}async addButtonBefore(e,n,i){if(!n&&e==="comment")return;let s=this.#i.querySelector(i);if(!s)return;if(e==="comment")this.addComment(n,s)}updateEditSignatureButton(e){if(this.#o)this.#o.title=e}remove(){this.#e.remove(),this.#t?.destroy(),this.#t=null}}class oT{#e=null;#t=null;#n;constructor(e){this.#n=e}#i(){let e=this.#t=document.createElement("div");e.className="editToolbar",e.setAttribute("role","toolbar"),e.dir=this.#n.direction;let n=this.#n._signal;if(n instanceof AbortSignal&&!n.aborted)e.addEventListener("contextmenu",io,{signal:n});let i=this.#e=document.createElement("div");if(i.className="buttons",e.append(i),this.#n.hasCommentManager())this.#r("commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{this.#n.commentSelection("floating_button")});return this.#r("highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{this.#n.highlightSelection("floating_button")}),e}#s(e,n){let i=0,s=0;for(let a of e){let r=a.y+a.height;if(r<i)continue;let l=a.x+(n?a.width:0);if(r>i){s=l,i=r;continue}if(n){if(l>s)s=l}else if(l<s)s=l}return[n?1-s:s,i]}show(e,n,i){let[s,a]=this.#s(n,i),{style:r}=this.#t||=this.#i();e.append(this.#t),r.insetInlineEnd=`${100*s}%`,r.top=`calc(${100*a}% + var(--editor-toolbar-vert-offset))`}hide(){this.#t.remove()}#r(e,n,i,s){let a=document.createElement("button");a.classList.add("basic",e),a.tabIndex=0,a.setAttribute("data-l10n-id",n);let r=document.createElement("span");a.append(r),r.className="visuallyHidden",r.setAttribute("data-l10n-id",i);let l=this.#n._signal;if(l instanceof AbortSignal&&!l.aborted)a.addEventListener("contextmenu",io,{signal:l}),a.addEventListener("click",s,{signal:l});this.#e.append(a)}}var $B="59968104-cc61-4cf9-b570-014b35b3709c",G3=Object.freeze({internal:$B});function lT(e,n,i){for(let s of i)n.addEventListener(s,e[s].bind(e))}class Wn{static#e=NaN;static#t=null;static#n=NaN;static#i=null;static initializeAndAddPointerId(e){(Wn.#t||=new Set).add(e)}static setPointer(e,n){Wn.#e||=n,Wn.#i??=e}static setTimeStamp(e){Wn.#n=e}static isSamePointerId(e){return Wn.#e===e}static isSamePointerIdOrRemove(e){if(Wn.#e===e)return!0;return Wn.#t?.delete(e),!1}static isSamePointerType(e){return Wn.#i===e}static isInitializedAndDifferentPointerType(e){return Wn.#i!==null&&!Wn.isSamePointerType(e)}static isSameTimeStamp(e){return Wn.#n===e}static isUsingMultiplePointers(){return Wn.#t?.size>=1}static clearPointerType(){Wn.#i=null}static clearPointerIds(){Wn.#e=NaN,Wn.#t=null}static clearTimeStamp(){Wn.#n=NaN}}class cT{#e=0;get id(){return`pdfjs_internal_editor_${this.#e++}`}}class u9{#e=nT();#t=0;#n=null;static get _isSVGFittingCanvas(){let i=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),s=new Image;s.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>';let a=s.decode().then(()=>(i.drawImage(s,0,0,1,1,0,0,1,3),new Uint32Array(i.getImageData(0,0,1,1).data.buffer)[0]===0));return en(this,"_isSVGFittingCanvas",a)}async#i(e,n){this.#n||=new Map;let i=this.#n.get(e);if(i===null)return null;if(i?.bitmap)return i.refCounter+=1,i;try{i||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let s;if(typeof n==="string")i.url=n,s=await l9(n,"blob");else if(n instanceof File)s=i.file=n;else if(n instanceof Blob)s=n;if(s.type==="image/svg+xml"){let a=u9._isSVGFittingCanvas,r=new FileReader,l=new Image,c=new Promise((p,m)=>{l.onload=()=>{i.bitmap=l,i.isSvg=!0,p()},r.onload=async()=>{let g=i.svgUrl=r.result;l.src=await a?`${g}#svgView(preserveAspectRatio(none))`:g},l.onerror=r.onerror=m});r.readAsDataURL(s),await c}else i.bitmap=await createImageBitmap(s);i.refCounter=1}catch(s){yn(s),i=null}if(this.#n.set(e,i),i)this.#n.set(i.id,i);return i}async getFromFile(e){let{lastModified:n,name:i,size:s,type:a}=e;return this.#i(`${n}_${i}_${s}_${a}`,e)}async getFromUrl(e){return this.#i(e,e)}async getFromBlob(e,n){let i=await n;return this.#i(e,i)}async getFromId(e){this.#n||=new Map;let n=this.#n.get(e);if(!n)return null;if(n.bitmap)return n.refCounter+=1,n;if(n.file)return this.getFromFile(n.file);if(n.blobPromise){let{blobPromise:i}=n;return delete n.blobPromise,this.getFromBlob(n.id,i)}return this.getFromUrl(n.url)}getFromCanvas(e,n){this.#n||=new Map;let i=this.#n.get(e);if(i?.bitmap)return i.refCounter+=1,i;let s=new OffscreenCanvas(n.width,n.height);return s.getContext("2d").drawImage(n,0,0),i={bitmap:s.transferToImageBitmap(),id:`image_${this.#e}_${this.#t++}`,refCounter:1,isSvg:!1},this.#n.set(e,i),this.#n.set(i.id,i),i}getSvgUrl(e){let n=this.#n.get(e);if(!n?.isSvg)return null;return n.svgUrl}deleteId(e){this.#n||=new Map;let n=this.#n.get(e);if(!n)return;if(n.refCounter-=1,n.refCounter!==0)return;let{bitmap:i}=n;if(!n.url&&!n.file){let s=new OffscreenCanvas(i.width,i.height);s.getContext("bitmaprenderer").transferFromImageBitmap(i),n.blobPromise=s.convertToBlob()}i.close?.(),n.bitmap=null}isValidId(e){return e.startsWith(`image_${this.#e}_`)}}class uT{#e=[];#t=!1;#n;#i=-1;constructor(e=128){this.#n=e}add({cmd:e,undo:n,post:i,mustExec:s,type:a=NaN,overwriteIfSameType:r=!1,keepUndo:l=!1}){if(s)e();if(this.#t)return;let c={cmd:e,undo:n,post:i,type:a};if(this.#i===-1){if(this.#e.length>0)this.#e.length=0;this.#i=0,this.#e.push(c);return}if(r&&this.#e[this.#i].type===a){if(l)c.undo=this.#e[this.#i].undo;this.#e[this.#i]=c;return}let p=this.#i+1;if(p===this.#n)this.#e.splice(0,1);else if(this.#i=p,p<this.#e.length)this.#e.splice(p);this.#e.push(c)}undo(){if(this.#i===-1)return;this.#t=!0;let{undo:e,post:n}=this.#e[this.#i];e(),n?.(),this.#t=!1,this.#i-=1}redo(){if(this.#i<this.#e.length-1){this.#i+=1,this.#t=!0;let{cmd:e,post:n}=this.#e[this.#i];e(),n?.(),this.#t=!1}}hasSomethingToUndo(){return this.#i!==-1}hasSomethingToRedo(){return this.#i<this.#e.length-1}cleanType(e){if(this.#i===-1)return;for(let n=this.#i;n>=0;n--)if(this.#e[n].type!==e){this.#e.splice(n+1,this.#i-n),this.#i=n;return}this.#e.length=0,this.#i=-1}destroy(){this.#e=null}}class rr{static ALT=1;static CTRL=2;static META=4;static SHIFT=8;constructor(e){this.callbacks=new Map;let{isMac:n}=ai.platform;for(let[i,s,a={}]of e){let r=i.some((l)=>l.startsWith("mac+"));for(let l of i){let c=l;if(r){let g=l.startsWith("mac+");if(n!==g)continue;if(g)c=l.slice(4)}let[p,m]=rr.#e(c);if(p===null)continue;this.callbacks.getOrInsertComputed(p,Rd).push({callback:s,options:a,modifiers:m})}}}static#e(e){let n=null,i=0;for(let s of e.split("+")){if(s=s.trim(),!s)continue;let a=s.toUpperCase(),r=rr[a];if(r){i|=r;continue}if(n!==null){yn(`KeyboardManager: multiple keys in shortcut "${e}"`);break}n=a==="SPACE"?" ":s}if(n===null)yn(`KeyboardManager: no key found in shortcut "${e}"`);return[n,i]}static#t(e){let n=/^(?:Key([A-Z])|(?:Digit|Numpad)(\d))$/.exec(e);if(!n)return null;return n[1]?.toLowerCase()??n[2]}exec(e,n){let i=this.callbacks.get(n.key);if(!i){if(/^[a-z]$/i.test(n.key))return;let m=rr.#t(n.code);if(m===null||m===n.key)return;if(i=this.callbacks.get(m),!i)return}let s=(n.altKey?rr.ALT:0)|(n.ctrlKey?rr.CTRL:0)|(n.metaKey?rr.META:0)|(n.shiftKey?rr.SHIFT:0),a=i.find((m)=>m.modifiers===s);if(!a)return;let{callback:r,options:{bubbles:l=!1,args:c=[],checker:p=null}}=a;if(p&&!p(e,n))return;if(r.bind(e,...c,n)(),!l)rs(n)}}class h9{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){let e=new Map([["CanvasText",null],["Canvas",null]]);return XB(e),en(this,"_colors",e)}convert(e){let n=fm(e);if(!window.matchMedia("(forced-colors: active)").matches)return n;for(let[i,s]of this._colors)if(s.every((a,r)=>a===n[r]))return h9._colorsMapping.get(i);return n}getHexCode(e){let n=this._colors.get(e);if(!n)return e;return It.makeHexColor(...n)}}class Zc{#e=new AbortController;#t=null;#n=null;#i=new Map;#s=new Map;#r=null;#a=null;#o=null;#l=null;#c=null;#f=new uT;#h=null;#d=null;#m=null;#g=0;#u=new Set;#p=null;#b=null;#w=new Set;_editorUndoBar=null;#y=!1;#v=!1;#x=!1;#_=null;#k=null;#T=null;#q=null;#j=!1;#C=null;#I=new cT;#D=!1;#M=!1;#L=!1;#R=null;#F=null;#G=null;#N=null;#H=null;#A=gn.NONE;#S=new Set;#P=null;#U=null;#V=null;#Y=null;#K=null;#$={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#O=[0,0];#X=null;#W=null;#ee=null;#te=null;#B=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let e=Zc.prototype,n=(r)=>r.#W.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&r.hasSomethingToControl(),i=(r,{target:l})=>{if(l instanceof HTMLInputElement){let{type:c}=l;return c!=="text"&&c!=="number"}return!0},s=this.TRANSLATE_SMALL,a=this.TRANSLATE_BIG;return en(this,"_keyboardManager",new rr([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],e.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:i}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:i}],[["Enter"],e.addNewEditorFromKeyboard,{checker:(r,{target:l})=>!(l instanceof HTMLButtonElement)&&r.#W.contains(l)&&!r.isEnterHandled}],[["Space"],e.addNewEditorFromKeyboard,{checker:(r,{target:l})=>!(l instanceof HTMLButtonElement)&&r.#W.contains(document.activeElement)}],[["Escape"],e.unselectAll],[["ArrowLeft"],e.translateSelectedEditors,{args:[-s,0],checker:n}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-a,0],checker:n}],[["ArrowRight"],e.translateSelectedEditors,{args:[s,0],checker:n}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[a,0],checker:n}],[["ArrowUp"],e.translateSelectedEditors,{args:[0,-s],checker:n}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-a],checker:n}],[["ArrowDown"],e.translateSelectedEditors,{args:[0,s],checker:n}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,a],checker:n}]]))}constructor(e,n,i,s,a,r,l,c,p,m,g,y,x,j,I,P){let X=this._signal=this.#e.signal;this.#W=e,this.#ee=n,this.#te=i,this.#o=s,this.#h=a,this.#U=r,this.#K=c,this._eventBus=l;let Y={signal:X,...G3};l.on("editingaction",this.onEditingAction.bind(this),Y),l.on("pagechanging",this.onPageChanging.bind(this),Y),l.on("scalechanging",this.onScaleChanging.bind(this),Y),l.on("rotationchanging",this.onRotationChanging.bind(this),Y),l.on("setpreference",this.onSetPreference.bind(this),Y),l.on("switchannotationeditorparams",(J)=>this.updateParams(J.type,J.value),Y),window.addEventListener("pointerdown",()=>{this.#M=!0},{capture:!0,signal:X}),window.addEventListener("pointerup",()=>{this.#M=!1},{capture:!0,signal:X}),window.addEventListener("beforeunload",this.endCurrentEditing.bind(this),{capture:!0,signal:X}),this.#le(),this.#pe(),this.#ie(),this.#l=c.annotationStorage,this.#_=c.filterFactory,this.#V=p,this.#q=m||null,this.#y=g,this.#v=y,this.#x=x,this.#H=j||null,this.viewParameters={realScale:Ch.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=I||null,this._supportsPinchToZoom=P!==!1,a?.setSidebarUiManager(this)}destroy(){this.#B?.resolve(),this.#B=null,this.#e?.abort(),this.#e=null,this._signal=null;for(let e of this.#s.values())e.destroy();if(this.#s.clear(),this.#i.clear(),this.#w.clear(),this.#N?.clear(),this.#t=null,this.#S.clear(),this.#f.destroy(),this.#o?.destroy(),this.#h?.destroy(),this.#U?.destroy(),this.#C?.hide(),this.#C=null,this.#G?.destroy(),this.#G=null,this.#n=null,this.#k)clearTimeout(this.#k),this.#k=null;if(this.#X)clearTimeout(this.#X),this.#X=null;this._editorUndoBar?.destroy(),this.#K=null}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return this.#H}get useNewAltTextFlow(){return this.#v}get useNewAltTextWhenAddingImage(){return this.#x}get hcmFilter(){return en(this,"hcmFilter",this.#V?this.#_.addHCMFilter(this.#V.foreground,this.#V.background):"none")}get direction(){return en(this,"direction",getComputedStyle(this.#W).direction)}get _highlightColors(){return en(this,"_highlightColors",this.#q?new Map(this.#q.split(",").map((e)=>(e=e.split("=").map((n)=>n.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){let{_highlightColors:e}=this;if(!e)return en(this,"highlightColors",null);let n=new Map,i=!!this.#V;for(let[s,a]of e){let r=s.endsWith("_HCM");if(i&&r){n.set(s.replace("_HCM",""),a);continue}if(!i&&!r)n.set(s,a)}return en(this,"highlightColors",n)}get highlightColorNames(){return en(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,(e)=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;let n=this.highlightColorNames.get(e);return this._highlightColors.get(n)||e}getNonHCMColorName(e){return this.highlightColorNames.get(e)||e}setCurrentDrawingSession(e){if(e)this.unselectAll(),this.disableUserSelect(!0);else this.disableUserSelect(!1);this.#m=e}setMainHighlightColorPicker(e){this.#G=e}editAltText(e,n=!1){this.#o?.editAltText(this,e,n)}hasCommentManager(){return!!this.#h}editComment(e,n,i,s){this.#h?.showDialog(this,e,n,i,s)}selectComment(e,n){this.#s.get(e)?.getEditorByUID(n)?.toggleComment(!0,!0)}updateComment(e){this.#h?.updateComment(e.getData())}updatePopupColor(e){this.#h?.updatePopupColor(e)}removeComment(e){this.#h?.removeComments([e.uid])}deleteComment(e,n){let i=()=>{e.comment=n},s=()=>{this._editorUndoBar?.show(i,"comment"),this.toggleComment(null),e.comment=null};this.addCommands({cmd:s,undo:i,mustExec:!0})}toggleComment(e,n,i=void 0){this.#h?.toggleCommentPopup(e,n,i)}makeCommentColor(e,n){return e&&this.#h?.makeCommentColor(e,n)||null}getCommentDialogElement(){return this.#h?.dialogElement||null}async waitForEditorsRendered(e){if(this.#s.has(e-1))return;let{resolve:n,promise:i}=Promise.withResolvers(),s=(a)=>{if(a.pageNumber===e)this._eventBus.off("editorsrendered",s),n()};this._eventBus.on("editorsrendered",s,G3),await i}getSignature(e){this.#U?.getSignature({uiManager:this,editor:e})}get signatureManager(){return this.#U}switchToMode(e,n){this._eventBus.on("annotationeditormodechanged",n,{once:!0,signal:this._signal,...G3}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,n){this._eventBus.dispatch("setpreference",{source:this,name:e,value:n})}onSetPreference({name:e,value:n}){switch(e){case"enableNewAltTextWhenAddingImage":this.#x=n;break}}onPageChanging({pageNumber:e}){this.#g=e-1}deletePage(e){for(let n of this.getEditors(e))n.remove();if(this.#s.delete(e),this.#g===e)this.#g=0}focusMainContainer(){this.#W.focus()}findParent(e,n){for(let i of this.#s.values()){let{x:s,y:a,width:r,height:l}=i.div.getBoundingClientRect();if(e>=s&&e<=s+r&&n>=a&&n<=a+l)return i}return null}disableUserSelect(e=!1){this.#ee.classList.toggle("noUserSelect",e)}addShouldRescale(e){this.#w.add(e)}removeShouldRescale(e){this.#w.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*Ch.PDF_TO_CSS_UNITS;for(let n of this.#w)n.onScaleChanging();this.#m?.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}#Z({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e}#ne(e){let{currentLayer:n}=this;if(n.hasTextLayer(e))return n;for(let i of this.#s.values())if(i.hasTextLayer(e))return i;return null}highlightSelection(e="",n=!1){let i=document.getSelection();if(!i||i.isCollapsed)return;let{anchorNode:s,anchorOffset:a,focusNode:r,focusOffset:l}=i,c=i.toString(),m=this.#Z(i).closest(".textLayer"),g=this.getSelectionBoxes(m);if(!g)return;i.empty();let y=this.#ne(m),x=this.#A===gn.NONE,j=()=>{let I=y?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:g,anchorNode:s,anchorOffset:a,focusNode:r,focusOffset:l,text:c});if(x)this.showAllEditors("highlight",!0,!0);if(n)I?.editComment()};if(x){this.switchToMode(gn.HIGHLIGHT,j);return}j()}commentSelection(e=""){this.highlightSelection(e,!0)}endCurrentEditing(){this.commitOrRemove(),this.currentLayer?.endDrawingSession(!1)}#re(){let e=document.getSelection();if(!e||e.isCollapsed)return;let i=this.#Z(e).closest(".textLayer"),s=this.getSelectionBoxes(i);if(!s)return;this.#C||=new oT(this),this.#C.show(i,s,this.direction==="ltr")}getAndRemoveDataFromAnnotationStorage(e){if(!this.#l)return null;let n=`pdfjs_internal_editor_${e}`,i=this.#l.getRawValue(n);if(i)this.#l.remove(n);return i}addToAnnotationStorage(e){if(!e.isEmpty()&&this.#l&&!this.#l.has(e.id))this.#l.setValue(e.id,e)}a11yAlert(e,n=null){let i=this.#te;if(!i)return;if(i.setAttribute("data-l10n-id",e),n)i.setAttribute("data-l10n-args",JSON.stringify(n));else i.removeAttribute("data-l10n-args")}#oe(){let e=document.getSelection();if(!e||e.isCollapsed){if(this.#P)this.#C?.hide(),this.#P=null,this.#E({hasSelectedText:!1});return}let{anchorNode:n}=e;if(n===this.#P)return;let s=this.#Z(e).closest(".textLayer");if(!s){if(this.#P)this.#C?.hide(),this.#P=null,this.#E({hasSelectedText:!1});return}if(this.#C?.hide(),this.#P=n,this.#E({hasSelectedText:!0}),this.#A!==gn.HIGHLIGHT&&this.#A!==gn.NONE)return;if(this.#A===gn.HIGHLIGHT)this.showAllEditors("highlight",!0,!0);if(this.#j=this.isShiftKeyDown,!this.isShiftKeyDown){let a=this.#A===gn.HIGHLIGHT?this.#ne(s):null;if(a?.toggleDrawing(),this.#M){let r=new AbortController,l=this.combinedSignal(r),c=(p)=>{if(p.type==="pointerup"&&p.button!==0)return;if(r.abort(),a?.toggleDrawing(!0),p.type==="pointerup")this.#Q("main_toolbar")};window.addEventListener("pointerup",c,{signal:l}),window.addEventListener("blur",c,{signal:l})}else a?.toggleDrawing(!0),this.#Q("main_toolbar")}}#Q(e=""){if(this.#A===gn.HIGHLIGHT)this.highlightSelection(e);else if(this.#y)this.#re()}#le(){document.addEventListener("selectionchange",this.#oe.bind(this),{signal:this._signal})}#ce(){if(this.#T)return;this.#T=new AbortController;let e=this.combinedSignal(this.#T);window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})}#ue(){this.#T?.abort(),this.#T=null}blur(){if(this.isShiftKeyDown=!1,this.#j)this.#j=!1,this.#Q("main_toolbar");if(!this.hasSelection)return;let{activeElement:e}=document;for(let n of this.#S)if(n.div.contains(e)){this.#F=[n,e],n._focusEventsAllowed=!1;break}}focus(){if(!this.#F)return;let[e,n]=this.#F;this.#F=null,n.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),n.focus()}#ie(){if(this.#R)return;this.#R=new AbortController;let e=this.combinedSignal(this.#R);window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})}#he(){this.#R?.abort(),this.#R=null}#fe(){if(this.#d)return;this.#d=new AbortController;let e=this.combinedSignal(this.#d);document.addEventListener("copy",this.copy.bind(this),{signal:e}),document.addEventListener("cut",this.cut.bind(this),{signal:e}),document.addEventListener("paste",this.paste.bind(this),{signal:e})}#de(){this.#d?.abort(),this.#d=null}#pe(){let e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})}addEditListeners(){this.#ie(),this.setEditingState(!0)}removeEditListeners(){this.#he(),this.setEditingState(!1)}dragOver(e){for(let{type:n}of e.dataTransfer.items)for(let i of this.#b)if(i.isHandlingMimeForPasting(n)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(let n of e.dataTransfer.items)for(let i of this.#b)if(i.isHandlingMimeForPasting(n.type)){i.paste(n,this.currentLayer),e.preventDefault();return}}copy(e){if(e.preventDefault(),this.#t?.commitOrRemove(),!this.hasSelection)return;let n=[];for(let i of this.#S){let s=i.serialize(!0);if(s)n.push(s)}if(n.length===0)return;e.clipboardData.setData("application/pdfjs",JSON.stringify(n))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();let{clipboardData:n}=e;for(let a of n.items)for(let r of this.#b)if(r.isHandlingMimeForPasting(a.type)){r.paste(a,this.currentLayer);return}let i=n.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(a){yn(`paste: "${a.message}".`);return}if(!Array.isArray(i))return;this.unselectAll();let s=this.currentLayer;try{let a=[];for(let c of i){let p=await s.deserialize(c);if(!p)return;a.push(p)}let r=()=>{for(let c of a)this.#se(c);this.#ae(a)},l=()=>{for(let c of a)c.remove()};this.addCommands({cmd:r,undo:l,mustExec:!0})}catch(a){yn(`paste: "${a.message}".`)}}keydown(e){if(!this.isShiftKeyDown&&e.key==="Shift")this.isShiftKeyDown=!0;if(this.#A!==gn.NONE&&!this.isEditorHandlingKeyboard)Zc._keyboardManager.exec(this,e)}keyup(e){if(this.isShiftKeyDown&&e.key==="Shift"){if(this.isShiftKeyDown=!1,this.#j)this.#j=!1,this.#Q("main_toolbar")}}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu");break}}updatePageIndex(e,n){for(let s of this.#a.get(e)||[])s.pageIndex=n;let i=this.#r.get(e);if(i)if(i.pageIndex=n,this.#s.set(n,i),this.#D)i.enable();else i.disable()}startUpdatePages(){this.#r=new Map(this.#s),this.#s.clear();let e=this.#a=new Map,n=(i)=>{e.getOrInsertComputed(i.pageIndex,Rd).push(i)};for(let i of this.#i.values())n(i);for(let[i,s]of this.#l)if(i.startsWith("pdfjs_internal_editor_")&&!this.#i.has(i)&&Number.isInteger(s?.pageIndex))n(s)}endUpdatePages(){this.#r=null,this.#a=null}clonePage(e,n){for(let i of this.getEditors(e)){let s=i.serialize(i.mode!==gn.HIGHLIGHT);if(!s)continue;s.pageIndex=n,s.id=this.getId(),s.isClone=!0,delete s.popupRef,this.#l.setValue(s.id,s)}}findClonesForPage(e){let n=[],{pageIndex:i}=e;for(let[s,a]of this.#l)if(a.pageIndex===i&&a.isClone)this.#l.remove(s),n.push(e.deserialize(a).then((r)=>{if(r)r.isClone=!0,e.addOrRebuild(r)}));return Promise.all(n)}#E(e){if(Object.entries(e).some(([i,s])=>this.#$[i]!==s)){if(this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(this.#$,e)}),this.#A===gn.HIGHLIGHT&&e.hasSelectedEditor===!1)this.#z([[Pn.HIGHLIGHT_FREE,!0]])}}#z(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})}setEditingState(e){if(e)this.#ce(),this.#fe(),this.#E({isEditing:this.#A!==gn.NONE,isEmpty:this.#J(),hasSomethingToUndo:this.#f.hasSomethingToUndo(),hasSomethingToRedo:this.#f.hasSomethingToRedo(),hasSelectedEditor:!1});else this.#ue(),this.#de(),this.#E({isEditing:!1}),this.disableUserSelect(!1)}registerEditorTypes(e){if(this.#b)return;this.#b=e;for(let n of this.#b)this.#z(n.defaultPropertiesToUpdate)}getId(){return this.#I.id}get currentLayer(){return this.#s.get(this.#g)}getLayer(e){return this.#s.get(e)}get currentPageIndex(){return this.#g}addLayer(e){if(this.#s.set(e.pageIndex,e),this.#D)e.enable();else e.disable()}removeLayer(e){this.#s.delete(e.pageIndex)}async updateMode(e,n=null,i=!1,s=!1,a=!1,r=!1){if(this.#A===e)return;if(this.#B){if(await this.#B.promise,!this.#B)return}if(this.#B=Promise.withResolvers(),this.#m?.commitOrRemove(),this.#A===gn.POPUP)this.#h?.hideSidebar();if(this.#h?.destroyPopup(),this.#A=e,e===gn.NONE){this.setEditingState(!1),this.#ge();for(let l of this.#i.values())l.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),this.#B.resolve();return}for(let l of this.#i.values())l.addStandaloneCommentButton();if(e===gn.SIGNATURE)await this.#U?.loadSignatures();if(i)Wn.clearPointerType();this.setEditingState(!0),await this.#me(),this.unselectAll();for(let l of this.#s.values())l.updateMode(e);if(e===gn.POPUP){this.#n||=await this.#K.getAnnotationsByType(new Set(this.#b.map((p)=>p._editorType)));let l=new Set,c=[];for(let p of this.#i.values()){let{annotationElementId:m,hasComment:g,deleted:y}=p;if(m)l.add(m);if(g&&!y)c.push(p.getData())}for(let p of this.#n){let{id:m,popupRef:g,contentsObj:y}=p;if(g&&y?.str&&!l.has(m)&&!this.#u.has(m))c.push(p)}this.#h?.showSidebar(c)}if(!n){if(s)this.addNewEditorFromKeyboard();this.#B.resolve();return}for(let l of this.#i.values())if(l.uid===n)if(this.setSelected(l),r)l.editComment();else if(a)l.enterInEditMode();else l.focus();else l.unselect();this.#B.resolve()}addNewEditorFromKeyboard(){if(this.currentLayer.canCreateNewEmptyEditor())this.currentLayer.addNewEditor()}updateToolbar(e){if(e.mode===this.#A)return;this._eventBus.dispatch("switchannotationeditormode",{source:this,...e})}updateParams(e,n){if(!this.#b)return;switch(e){case Pn.CREATE:this.currentLayer.addNewEditor(n);return;case Pn.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#Y||=new Map).set(e,n),this.showAllEditors("highlight",n);break}if(this.hasSelection)for(let i of this.#S)i.updateParams(e,n);else for(let i of this.#b)i.updateDefaultParams(e,n)}showAllEditors(e,n,i=!1){for(let a of this.#i.values())if(a.editorType===e)a.show(n);if((this.#Y?.get(Pn.HIGHLIGHT_SHOW_ALL)??!0)!==n)this.#z([[Pn.HIGHLIGHT_SHOW_ALL,n]])}enableWaiting(e=!1){if(this.#L===e)return;this.#L=e;for(let n of this.#s.values()){if(e)n.disableClick();else n.enableClick();n.div.classList.toggle("waiting",e)}}async#me(){if(!this.#D){this.#D=!0;let e=[];for(let n of this.#s.values())e.push(n.enable());await Promise.all(e);for(let n of this.#i.values())n.enable()}}#ge(){if(this.unselectAll(),this.#D){this.#D=!1;for(let e of this.#s.values())e.disable();for(let e of this.#i.values())e.disable()}}*getEditors(e){for(let n of this.#i.values())if(n.pageIndex===e)yield n}getEditor(e){return this.#i.get(e)}addEditor(e){this.#i.set(e.id,e)}removeEditor(e){if(e.div.contains(document.activeElement)){if(this.#k)clearTimeout(this.#k);this.#k=setTimeout(()=>{this.focusMainContainer(),this.#k=null},0)}if(this.#i.delete(e.id),e.annotationElementId)this.#N?.delete(e.annotationElementId);if(this.unselect(e),!e.annotationElementId||!this.#u.has(e.annotationElementId))this.#l?.remove(e.id)}addDeletedAnnotationElement(e){this.#u.add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return this.#u.has(e)}removeDeletedAnnotationElement(e){this.#u.delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}#se(e){let n=this.#s.get(e.pageIndex);if(n)n.addOrRebuild(e);else this.addEditor(e),this.addToAnnotationStorage(e)}setActiveEditor(e){if(this.#t===e)return;if(this.#t=e,e)this.#z(e.propertiesToUpdate)}get#be(){let e=null;for(e of this.#S);return e}updateUI(e){if(this.#be===e)this.#z(e.propertiesToUpdate)}updateUIForDefaultProperties(e){this.#z(e.defaultPropertiesToUpdate)}toggleSelected(e){if(this.#S.has(e)){this.#S.delete(e),e.unselect(),this.#E({hasSelectedEditor:this.hasSelection});return}this.#S.add(e),e.select(),this.#z(e.propertiesToUpdate),this.#E({hasSelectedEditor:!0})}setSelected(e){this.updateToolbar({mode:e.mode,editId:e.uid}),this.#m?.commitOrRemove();for(let n of this.#S)if(n!==e)n.unselect();this.#h?.destroyPopup(),this.#S.clear(),this.#S.add(e),e.select(),this.#z(e.propertiesToUpdate),this.#E({hasSelectedEditor:!0})}get firstSelectedEditor(){return this.#S.values().next().value}unselect(e){e.unselect(),this.#S.delete(e),this.#E({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#S.size!==0}get isEnterHandled(){return this.#S.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#f.undo(),this.#E({hasSomethingToUndo:this.#f.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#J()}),this._editorUndoBar?.hide()}redo(){this.#f.redo(),this.#E({hasSomethingToUndo:!0,hasSomethingToRedo:this.#f.hasSomethingToRedo(),isEmpty:this.#J()})}addCommands(e){this.#f.add(e),this.#E({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#J()})}cleanUndoStack(e){this.#f.cleanType(e)}#J(){if(this.#i.size===0)return!0;if(this.#i.size===1)for(let e of this.#i.values())return e.isEmpty();return!1}delete(){this.commitOrRemove();let e=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!e)return;let n=e?[e]:[...this.#S],i=()=>{this._editorUndoBar?.show(s,n.length===1?n[0].editorType:n.length);for(let a of n)a.remove()},s=()=>{for(let a of n)this.#se(a)};this.addCommands({cmd:i,undo:s,mustExec:!0})}commitOrRemove(){this.#t?.commitOrRemove()}hasSomethingToControl(){return this.#t||this.hasSelection}#ae(e){for(let n of this.#S)n.unselect();this.#S.clear();for(let n of e){if(n.isEmpty())continue;this.#S.add(n),n.select()}this.#E({hasSelectedEditor:this.hasSelection})}selectAll(){for(let e of this.#S)e.commit();this.#ae(this.#i.values())}unselectAll(){if(this.#t){if(this.#t.commitOrRemove(),this.#A!==gn.NONE)return}if(this.#m?.commitOrRemove())return;if(this.#h?.destroyPopup(),!this.hasSelection)return;for(let e of this.#S)e.unselect();this.#S.clear(),this.#E({hasSelectedEditor:!1})}translateSelectedEditors(e,n,i=!1){if(!i)this.commitOrRemove();if(!this.hasSelection)return;this.#O[0]+=e,this.#O[1]+=n;let[s,a]=this.#O,r=[...this.#S],l=1000;if(this.#X)clearTimeout(this.#X);this.#X=setTimeout(()=>{this.#X=null,this.#O[0]=this.#O[1]=0,this.addCommands({cmd:()=>{for(let c of r)if(this.#i.has(c.id))c.translateInPage(s,a),c.translationDone()},undo:()=>{for(let c of r)if(this.#i.has(c.id))c.translateInPage(-s,-a),c.translationDone()},mustExec:!1})},l);for(let c of r)c.translateInPage(e,n),c.translationDone()}setUpDragSession(){if(!this.hasSelection)return;this.disableUserSelect(!0),this.#p=new Map;for(let e of this.#S)this.#p.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}endDragSession(){if(!this.#p)return!1;this.disableUserSelect(!1);let e=this.#p;this.#p=null;let n=!1;for(let[{x:s,y:a,pageIndex:r},l]of e)l.newX=s,l.newY=a,l.newPageIndex=r,n||=s!==l.savedX||a!==l.savedY||r!==l.savedPageIndex;if(!n)return!1;let i=(s,a,r,l)=>{if(this.#i.has(s.id)){let c=this.#s.get(l);if(c)s._setParentAndPosition(c,a,r);else s.pageIndex=l,s.x=a,s.y=r}};return this.addCommands({cmd:()=>{for(let[s,{newX:a,newY:r,newPageIndex:l}]of e)i(s,a,r,l)},undo:()=>{for(let[s,{savedX:a,savedY:r,savedPageIndex:l}]of e)i(s,a,r,l)},mustExec:!0}),!0}dragSelectedEditors(e,n){if(!this.#p)return;for(let i of this.#p.keys())i.drag(e,n)}rebuild(e){if(e.parent===null){let n=this.getLayer(e.pageIndex);if(n)n.changeParent(e),n.addOrRebuild(e);else this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild()}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#S.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return this.#t===e}getActive(){return this.#t}getMode(){return this.#A}isEditingMode(){return this.#A!==gn.NONE}get imageManager(){return en(this,"imageManager",new u9)}getSelectionBoxes(e){if(!e)return null;let n=document.getSelection();for(let p=0,m=n.rangeCount;p<m;p++)if(!e.contains(n.getRangeAt(p).commonAncestorContainer))return null;let{x:i,y:s,width:a,height:r}=e.getBoundingClientRect(),l;switch(e.getAttribute("data-main-rotation")){case"90":l=(p,m,g,y)=>({x:(m-s)/r,y:1-(p+g-i)/a,width:y/r,height:g/a});break;case"180":l=(p,m,g,y)=>({x:1-(p+g-i)/a,y:1-(m+y-s)/r,width:g/a,height:y/r});break;case"270":l=(p,m,g,y)=>({x:1-(m+y-s)/r,y:(p-i)/a,width:y/r,height:g/a});break;default:l=(p,m,g,y)=>({x:(p-i)/a,y:(m-s)/r,width:g/a,height:y/r});break}let c=[];for(let p=0,m=n.rangeCount;p<m;p++){let g=n.getRangeAt(p);if(g.collapsed)continue;for(let{x:y,y:x,width:j,height:I}of g.getClientRects()){if(j===0||I===0)continue;c.push(l(y,x,j,I))}}return c.length===0?null:c}addChangedExistingAnnotation({annotationElementId:e,id:n}){(this.#c||=new Map).set(e,n)}removeChangedExistingAnnotation({annotationElementId:e}){this.#c?.delete(e)}renderAnnotationElement(e){let n=this.#c?.get(e.data.id);if(!n)return;let i=this.#l.getRawValue(n);if(!i)return;if(this.#A===gn.NONE&&!i.hasBeenModified)return;i.renderAnnotationElement(e)}setMissingCanvas(e,n,i){let s=this.#N?.get(e);if(!s)return;s.setCanvas(n,i),this.#N.delete(e)}addMissingCanvas(e,n){(this.#N||=new Map).set(e,n)}}class Wo{#e=null;#t=!1;#n=null;#i=null;#s=null;#r=null;#a=!1;#o=null;#l=null;#c=null;#f=null;#h=!1;static#d=null;static _l10n=null;constructor(e){this.#l=e,this.#h=e._uiManager.useNewAltTextFlow,Wo.#d||=Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"})}static initialize(e){Wo._l10n??=e}async render(){let e=this.#n=document.createElement("button");e.className="altText",e.tabIndex="0";let n=this.#i=document.createElement("span");if(e.append(n),this.#h)e.classList.add("new"),e.setAttribute("data-l10n-id",Wo.#d.missing),n.setAttribute("data-l10n-id",Wo.#d["missing-label"]);else e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),n.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label");let i=this.#l._uiManager._signal;e.addEventListener("contextmenu",io,{signal:i}),e.addEventListener("pointerdown",(a)=>a.stopPropagation(),{signal:i});let s=(a)=>{if(a.preventDefault(),this.#l._uiManager.editAltText(this.#l),this.#h)this.#l._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#m}})};return e.addEventListener("click",s,{capture:!0,signal:i}),e.addEventListener("keydown",(a)=>{if(a.target===e&&a.key==="Enter")this.#a=!0,s(a)},{signal:i}),await this.#g(),e}get#m(){return this.#e&&"added"||this.#e===null&&this.guessedText&&"review"||"missing"}finish(){if(!this.#n)return;this.#n.focus({focusVisible:this.#a}),this.#a=!1}isEmpty(){return this.#h?this.#e===null:!this.#e&&!this.#t}hasData(){return this.#h?this.#e!==null||!!this.#c:this.isEmpty()}get guessedText(){return this.#c}async setGuessedText(e){if(this.#e!==null)return;this.#c=e,this.#f=await Wo._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e}),this.#g()}toggleAltTextBadge(e=!1){if(!this.#h||this.#e){this.#o?.remove(),this.#o=null;return}if(!this.#o){let n=this.#o=document.createElement("div");n.className="noAltTextBadge",this.#l.div.append(n)}this.#o.classList.toggle("hidden",!e)}serialize(e){let n=this.#e;if(!e&&this.#c===n)n=this.#f;return{altText:n,decorative:this.#t,guessedText:this.#c,textWithDisclaimer:this.#f}}get data(){return{altText:this.#e,decorative:this.#t}}set data({altText:e,decorative:n,guessedText:i,textWithDisclaimer:s,cancel:a=!1}){if(i)this.#c=i,this.#f=s;if(this.#e===e&&this.#t===n)return;if(!a)this.#e=e,this.#t=n;this.#g()}toggle(e=!1){if(!this.#n)return;if(!e&&this.#r)clearTimeout(this.#r),this.#r=null;this.#n.disabled=!e}shown(){this.#l._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#m}})}destroy(){this.#n?.remove(),this.#n=null,this.#i=null,this.#s=null,this.#o?.remove(),this.#o=null}async#g(){let e=this.#n;if(!e)return;if(this.#h){if(e.classList.toggle("done",!!this.#e),e.setAttribute("data-l10n-id",Wo.#d[this.#m]),this.#i?.setAttribute("data-l10n-id",Wo.#d[`${this.#m}-label`]),!this.#e){this.#s?.remove();return}}else{if(!this.#e&&!this.#t){e.classList.remove("done"),this.#s?.remove();return}e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let n=this.#s;if(!n){this.#s=n=document.createElement("span"),n.className="tooltip",n.setAttribute("role","tooltip"),n.id=`alt-text-tooltip-${this.#l.id}`;let s=100,a=this.#l._uiManager._signal;a.addEventListener("abort",()=>{clearTimeout(this.#r),this.#r=null},{once:!0}),e.addEventListener("mouseenter",()=>{this.#r=setTimeout(()=>{this.#r=null,this.#s.classList.add("show"),this.#l._reportTelemetry({action:"alt_text_tooltip"})},s)},{signal:a}),e.addEventListener("mouseleave",()=>{if(this.#r)clearTimeout(this.#r),this.#r=null;this.#s?.classList.remove("show")},{signal:a})}if(this.#t)n.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip");else n.removeAttribute("data-l10n-id"),n.textContent=this.#e;if(!n.parentNode)e.append(n);this.#l.getElementForAltText()?.setAttribute("aria-describedby",n.id)}}class Zp{#e=null;#t=null;#n=!1;#i=null;#s=null;#r=null;#a=null;#o=null;#l=!1;#c=null;constructor(e){this.#i=e}renderForToolbar(){let e=this.#t=document.createElement("button");return e.className="comment",this.#f(e,!1)}renderForStandalone(){let e=this.#e=document.createElement("button");e.className="annotationCommentButton";let n=this.#i.commentButtonPosition;if(n){let{style:i}=e;i.insetInlineEnd=`calc(${100*(this.#i._uiManager.direction==="ltr"?1-n[0]:n[0])}% - var(--comment-button-dim))`,i.top=`calc(${100*n[1]}% - var(--comment-button-dim))`;let s=this.#i.commentButtonColor;if(s)i.backgroundColor=s}return this.#f(e,!0)}focusButton(){setTimeout(()=>{(this.#e??this.#t)?.focus()},0)}onUpdatedColor(){if(!this.#e)return;let e=this.#i.commentButtonColor;if(e)this.#e.style.backgroundColor=e;this.#i._uiManager.updatePopupColor(this.#i)}get commentButtonWidth(){return(this.#e?.getBoundingClientRect().width??0)/this.#i.parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(this.#c)return this.#c;if(!this.#e)return null;let{x:e,y:n,height:i}=this.#e.getBoundingClientRect(),{x:s,y:a,width:r,height:l}=this.#i.parent.boundingClientRect;return[(e-s)/r,(n+i-a)/l]}set commentPopupPositionInLayer(e){this.#c=e}hasDefaultPopupPosition(){return this.#c===null}removeStandaloneCommentButton(){this.#e?.remove(),this.#e=null}removeToolbarCommentButton(){this.#t?.remove(),this.#t=null}setCommentButtonStates({selected:e,hasPopup:n}){if(!this.#e)return;this.#e.classList.toggle("selected",e),this.#e.ariaExpanded=n}#f(e,n){if(!this.#i._uiManager.hasCommentManager())return null;if(e.tabIndex="0",e.ariaHasPopup="dialog",n)e.ariaControls="commentPopup",e.setAttribute("data-l10n-id","pdfjs-show-comment-button");else e.ariaControlsElements=[this.#i._uiManager.getCommentDialogElement()],e.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button");let i=this.#i._uiManager._signal;if(!(i instanceof AbortSignal)||i.aborted)return e;if(e.addEventListener("contextmenu",io,{signal:i}),n)e.addEventListener("focusin",(a)=>{this.#i._focusEventsAllowed=!1,rs(a)},{capture:!0,signal:i}),e.addEventListener("focusout",(a)=>{this.#i._focusEventsAllowed=!0,rs(a)},{capture:!0,signal:i});e.addEventListener("pointerdown",(a)=>a.stopPropagation(),{signal:i});let s=(a)=>{if(a.preventDefault(),e===this.#t)this.edit();else this.#i.toggleComment(!0)};return e.addEventListener("click",s,{capture:!0,signal:i}),e.addEventListener("keydown",(a)=>{if(a.target===e&&a.key==="Enter")this.#n=!0,s(a)},{signal:i}),e.addEventListener("pointerenter",()=>{this.#i.toggleComment(!1,!0)},{signal:i}),e.addEventListener("pointerleave",()=>{this.#i.toggleComment(!1,!1)},{signal:i}),e}edit(e){let n=this.commentPopupPositionInLayer,i,s;if(n)[i,s]=n;else{[i,s]=this.#i.commentButtonPosition;let{width:m,height:g,x:y,y:x}=this.#i;i=y+i*m,s=x+s*g}let a=this.#i.parent.boundingClientRect,{x:r,y:l,width:c,height:p}=a;this.#i._uiManager.editComment(this.#i,r+i*c,l+s*p,{...e,parentDimensions:a})}finish(){if(!this.#t)return;this.#t.focus({focusVisible:this.#n}),this.#n=!1}isDeleted(){return this.#l||this.#a===""}isEmpty(){return this.#a===null}hasBeenEdited(){return this.isDeleted()||this.#a!==this.#s}serialize(){return this.data}get data(){return{text:this.#a,richText:this.#r,date:this.#o,deleted:this.isDeleted()}}set data(e){if(e!==this.#a)this.#r=null;if(e===null){this.#a="",this.#l=!0;return}this.#a=e,this.#o=new Date,this.#l=!1}restoreData({text:e,richText:n,date:i}){this.#a=e,this.#r=n,this.#o=i,this.#l=!1}setInitialText(e,n=null){this.#s=e,this.data=e,this.#o=null,this.#r=n}shown(){}destroy(){this.#t?.remove(),this.#t=null,this.#e?.remove(),this.#e=null,this.#a="",this.#r=null,this.#o=null,this.#i=null,this.#n=!1,this.#l=!1}}function qk(e){e.preventDefault()}var Dk=0.0001;function V3(e){if(e.cancelable)return rs(e),!0;return e.stopPropagation(),!1}class f9{#e;#t=!1;#n=null;#i;#s;#r;#a;#o;#l=!1;#c=null;#f;#h=new Set;#d=null;#m;#g=null;#u=0;constructor({container:e,isPinchingDisabled:n=null,isPinchingStopped:i=null,onPinchStart:s=null,onPinching:a=null,onPinchEnd:r=null,onPanning:l=null,signal:c}){this.#e=e,this.#n=i,this.#i=n,this.#s=s,this.#r=a,this.#a=r,this.#o=l,this.#m=new AbortController,this.#f=AbortSignal.any([c,this.#m.signal]),e.addEventListener("touchstart",this.#p.bind(this),{passive:!1,signal:this.#f})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/so.pixelRatio}get MIN_TOUCH_DISTANCE_TO_SCALE(){return 4/so.pixelRatio}#p(e){if(this.#i?.())return;this.#w(e);let n=this.#h;for(let{identifier:i}of e.changedTouches)n.add(i);if(n.size===1){this.#b();return}if(!this.#g){this.#g=new AbortController;let i=AbortSignal.any([this.#f,this.#g.signal]),s=this.#e,a={signal:i,capture:!1,passive:!1};s.addEventListener("touchmove",this.#x.bind(this),a);let r=this.#_.bind(this);s.addEventListener("touchend",r,a),s.addEventListener("touchcancel",r,a),a.capture=!0,s.addEventListener("pointerdown",rs,a),s.addEventListener("pointermove",rs,a),s.addEventListener("pointercancel",qk,a),s.addEventListener("pointerup",qk,a),this.#s?.()}this.#l=V3(e),this.#v(e)}#b(){if(this.#c)return;let e=this.#c=new AbortController,n=AbortSignal.any([this.#f,e.signal]),i=this.#e,s={capture:!0,signal:n,passive:!1},a=(r)=>{if(r.pointerType==="touch")this.#c?.abort(),this.#c=null};i.addEventListener("pointerdown",(r)=>{if(r.pointerType==="touch")rs(r),a(r)},s),i.addEventListener("pointerup",a,s),i.addEventListener("pointercancel",a,s)}#w(e){let n=this.#h;if(n.size===0)return;let i=this.#h=new Set;for(let{identifier:s}of e.touches)if(n.has(s))i.add(s)}#y(e){let n=this.#h,i=[];for(let s of e.touches)if(n.has(s.identifier))i.push(s);return i}#v(e){let n=this.#y(e);if(n.length!==2||this.#n?.()){this.#d=null;return}let[i,s]=n;this.#d={touch0X:i.screenX,touch0Y:i.screenY,touch1X:s.screenX,touch1Y:s.screenY,panX:(i.clientX+s.clientX)/2,panY:(i.clientY+s.clientY)/2,screenPanX:(i.screenX+s.screenX)/2,screenPanY:(i.screenY+s.screenY)/2}}#x(e){if(!this.#d)return;let n=this.#y(e);if(n.length!==2)return;let i=this.#l;if(this.#l=V3(e),!this.#l)return;if(!i){this.#v(e);return}let[s,a]=n,{screenX:r,screenY:l}=s,{screenX:c,screenY:p}=a,m=this.#d,{touch0X:g,touch0Y:y,touch1X:x,touch1Y:j,panX:I,panY:P}=m,X=x-g,Y=j-y,J=c-r,ne=p-l,ae=(s.clientX+a.clientX)/2,se=(s.clientY+a.clientY)/2;m.panX=ae,m.panY=se;let oe=ae-I,he=se-P,we=(r+c)/2,Ce=(l+p)/2,Ne=Math.hypot(we-m.screenPanX,Ce-m.screenPanY);m.screenPanX=we,m.screenPanY=Ce;let Pe=Math.hypot(J,ne),Ue=Math.hypot(X,Y),ze=this.#t?this.MIN_TOUCH_DISTANCE_TO_SCALE:this.MIN_TOUCH_DISTANCE_TO_PINCH+2*Ne;if(Pe<Dk||Ue<Dk||Math.abs(Ue-Pe)<=ze){if(oe||he)this.#o?.(oe,he);return}m.touch0X=r,m.touch0Y=l,m.touch1X=c,m.touch1Y=p;let He=Math.sign(Pe-Ue);if(!this.#t){if(this.#t=!0,this.#u=He,oe||he)this.#o?.(oe,he);return}if(this.#u){let De=this.#u;if(this.#u=0,He!==De&&Math.abs(Pe-Ue)<=2*Ne){if(this.#t=!1,oe||he)this.#o?.(oe,he);return}}this.#r?.([I,P],Ue,Pe,oe,he)}#_(e){if(this.#w(e),this.#h.size>=2){this.#v(e);return}let n=!!this.#d;if(this.#k(),this.#h.size===1)this.#b();if(n)V3(e)}#k(){if(this.#d=null,this.#t=!1,this.#u=0,this.#l=!1,this.#g)this.#g.abort(),this.#g=null,this.#a?.()}destroy(){this.#k(),this.#h.clear(),this.#m?.abort(),this.#m=null,this.#c?.abort(),this.#c=null}}class Jt{#e=null;#t=null;#n=null;#i=null;#s=null;#r=!1;#a=null;#o="";#l=null;#c=null;#f=null;#h=null;#d=null;#m="";#g=!1;#u=null;#p=!1;#b=!1;#w=!1;#y=null;#v=0;#x=0;#_=null;#k=null;isSelected=!1;_isCopy=!1;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nAlert=null;static _l10nResizer=null;#T=!1;#q=Jt._zIndex++;static _borderLineWidth=-1;static _colorManager=new h9;static _zIndex=1;static _telemetryTimeout=1000;static get _resizerKeyboardManager(){let e=Jt.prototype._resizeWithKeyboard,{TRANSLATE_SMALL:n,TRANSLATE_BIG:i}=Zc;return en(this,"_resizerKeyboardManager",new rr([[["ArrowLeft"],e,{args:[-n,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-i,0]}],[["ArrowRight"],e,{args:[n,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[i,0]}],[["ArrowUp"],e,{args:[0,-n]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-i]}],[["ArrowDown"],e,{args:[0,n]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,i]}],[["Escape"],Jt.prototype._stopResizingWithKeyboard]]))}constructor(e){this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null,this.annotationElementId=e.annotationElementId||null,this.creationDate=e.creationDate||new Date,this.modificationDate=e.modificationDate||null,this.canAddComment=!0;let{rotation:n,rawDims:{pageWidth:i,pageHeight:s,pageX:a,pageY:r}}=this.parent.viewport;this.rotation=n,this.pageRotation=(360+n-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,s],this.pageTranslation=[a,r];let[l,c]=this.parentDimensions;this.x=e.x/l,this.y=e.y/c,this.isAttachedToDOM=!1,this.deleted=!1}updatePageIndex(e){this.pageIndex=e}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return en(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){let n=new hT({id:e._uiManager.getId(),parent:e.parent,uiManager:e._uiManager});n.annotationElementId=e.annotationElementId,n.deleted=!0,n._uiManager.addToAnnotationStorage(n)}static initialize(e,n){if(Jt._l10n??=e,Jt._l10nAlert??=Object.freeze({highlight:"pdfjs-editor-highlight-added-alert",freetext:"pdfjs-editor-freetext-added-alert",ink:"pdfjs-editor-ink-added-alert",stamp:"pdfjs-editor-stamp-added-alert",signature:"pdfjs-editor-signature-added-alert"}),Jt._l10nResizer??=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"}),Jt._borderLineWidth!==-1)return;let i=getComputedStyle(document.documentElement);Jt._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,n){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,n){Un("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#T}set _isDraggable(e){this.#T=e,this.div?.classList.toggle("draggable",e)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){let[e,n]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*n/(e*2),this.y+=this.width*e/(n*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*n/(e*2),this.y-=this.width*e/(n*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#q}setParent(e){if(e!==null)this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions;else this.#O(),this.#h?.remove(),this.#h=null;this.parent=e}focusin(e){if(!this._focusEventsAllowed)return;if(!this.#g)this.parent.setSelected(this);else this.#g=!1}focusout(e){if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;if(e.relatedTarget?.closest(`#${this.id}`))return;if(e.preventDefault(),!this.parent?.isMultipleSelection)this.commitOrRemove()}commitOrRemove(){if(this.isEmpty())this.remove();else this.commit()}commit(){if(!this.isInEditMode())return;this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,n,i,s){let[a,r]=this.parentDimensions;[i,s]=this.screenToPageTranslation(i,s),this.x=(e+i)/a,this.y=(n+s)/r,this.fixAndSetPosition()}_moveAfterPaste(e,n){if(this.isClone){delete this.isClone;return}let[i,s]=this.parentDimensions;this.setAt(e*i,n*s,this.width*i,this.height*s),this._onTranslated()}#j([e,n],i,s){[i,s]=this.screenToPageTranslation(i,s),this.x+=i/e,this.y+=s/n,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(e,n){this.#j(this.parentDimensions,e,n)}translateInPage(e,n){this.#u||=[this.x,this.y,this.width,this.height],this.#j(this.pageDimensions,e,n),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,n){this.#u||=[this.x,this.y,this.width,this.height];let{div:i,parentDimensions:[s,a]}=this;if(this.x+=e/s,this.y+=n/a,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:g,y}=this.div.getBoundingClientRect();if(this.parent.findNewParent(this,g,y))this.x-=Math.floor(this.x),this.y-=Math.floor(this.y)}let{x:r,y:l}=this,[c,p]=this.getBaseTranslation();r+=c,l+=p;let{style:m}=i;m.left=`${(100*r).toFixed(2)}%`,m.top=`${(100*l).toFixed(2)}%`,this._onTranslating(r,l)}_onTranslating(e,n){}_onTranslated(e,n){}get _hasBeenMoved(){return!!this.#u&&(this.#u[0]!==this.x||this.#u[1]!==this.y)}get _hasBeenResized(){return!!this.#u&&(this.#u[2]!==this.width||this.#u[3]!==this.height)}getBaseTranslation(){let[e,n]=this.parentDimensions,{_borderLineWidth:i}=Jt,s=i/e,a=i/n;switch(this.rotation){case 90:return[-s,a];case 180:return[s,a];case 270:return[s,-a];default:return[-s,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){let{div:{style:n},pageDimensions:[i,s]}=this,{x:a,y:r,width:l,height:c}=this;if(l*=i,c*=s,a*=i,r*=s,this._mustFixPosition)switch(e){case 0:a=vi(a,0,i-l),r=vi(r,0,s-c);break;case 90:a=vi(a,0,i-c),r=vi(r,l,s);break;case 180:a=vi(a,l,i),r=vi(r,c,s);break;case 270:a=vi(a,c,i),r=vi(r,0,s-l);break}this.x=a/=i,this.y=r/=s;let[p,m]=this.getBaseTranslation();a+=p,r+=m,n.left=`${(100*a).toFixed(2)}%`,n.top=`${(100*r).toFixed(2)}%`,this.moveInDOM()}static#C(e,n,i){switch(i){case 90:return[n,-e];case 180:return[-e,-n];case 270:return[-n,e];default:return[e,n]}}screenToPageTranslation(e,n){return Jt.#C(e,n,this.parentRotation)}pageTranslationToScreen(e,n){return Jt.#C(e,n,360-this.parentRotation)}#I(e){switch(e){case 90:{let[n,i]=this.pageDimensions;return[0,-n/i,i/n,0]}case 180:return[-1,0,0,-1];case 270:{let[n,i]=this.pageDimensions;return[0,n/i,-i/n,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:e,pageDimensions:[n,i]}=this;return[n*e,i*e]}setDims(){let{div:{style:e},width:n,height:i}=this;e.width=`${(100*n).toFixed(2)}%`,e.height=`${(100*i).toFixed(2)}%`}getInitialTranslation(){return[0,0]}#D(){if(this.#l)return;this.#l=document.createElement("div"),this.#l.classList.add("resizers");let e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],n=this._uiManager._signal;for(let i of e){let s=document.createElement("div");this.#l.append(s),s.classList.add("resizer",i),s.setAttribute("data-resizer-name",i),s.addEventListener("pointerdown",this.#M.bind(this,i),{signal:n}),s.addEventListener("contextmenu",io,{signal:n}),s.tabIndex=-1}this.div.prepend(this.#l)}#M(e,n){n.preventDefault();let{isMac:i}=ai.platform;if(n.button!==0||n.ctrlKey&&i)return;this.#n?.toggle(!1);let s=this._isDraggable;this._isDraggable=!1,this.#c=[n.screenX,n.screenY];let a=new AbortController,r=this._uiManager.combinedSignal(a);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#F.bind(this,e),{passive:!0,capture:!0,signal:r}),window.addEventListener("touchmove",rs,{passive:!1,signal:r}),window.addEventListener("contextmenu",io,{signal:r}),this.#f={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let l=this.parent.div.style.cursor,c=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(n.target).cursor;let p=()=>{a.abort(),this.parent.togglePointerEvents(!0),this.#n?.toggle(!0),this._isDraggable=s,this.parent.div.style.cursor=l,this.div.style.cursor=c,this.#R()};window.addEventListener("pointerup",p,{signal:r}),window.addEventListener("blur",p,{signal:r})}#L(e,n,i,s){this.width=i,this.height=s,this.x=e,this.y=n,this.setDims(),this.fixAndSetPosition(),this._onResized()}_onResized(){}#R(){if(!this.#f)return;let{savedX:e,savedY:n,savedWidth:i,savedHeight:s}=this.#f;this.#f=null;let a=this.x,r=this.y,l=this.width,c=this.height;if(a===e&&r===n&&l===i&&c===s)return;this.addCommands({cmd:this.#L.bind(this,a,r,l,c),undo:this.#L.bind(this,e,n,i,s),mustExec:!0})}static _round(e){return Math.round(e*1e4)/1e4}#F(e,n){let[i,s]=this.parentDimensions,a=this.x,r=this.y,l=this.width,c=this.height,p=Jt.MIN_SIZE/i,m=Jt.MIN_SIZE/s,g=this.#I(this.rotation),y=(De,Fe)=>[g[0]*De+g[2]*Fe,g[1]*De+g[3]*Fe],x=this.#I(360-this.rotation),j=(De,Fe)=>[x[0]*De+x[2]*Fe,x[1]*De+x[3]*Fe],I,P,X=!1,Y=!1;switch(e){case"topLeft":X=!0,I=(De,Fe)=>[0,0],P=(De,Fe)=>[De,Fe];break;case"topMiddle":I=(De,Fe)=>[De/2,0],P=(De,Fe)=>[De/2,Fe];break;case"topRight":X=!0,I=(De,Fe)=>[De,0],P=(De,Fe)=>[0,Fe];break;case"middleRight":Y=!0,I=(De,Fe)=>[De,Fe/2],P=(De,Fe)=>[0,Fe/2];break;case"bottomRight":X=!0,I=(De,Fe)=>[De,Fe],P=(De,Fe)=>[0,0];break;case"bottomMiddle":I=(De,Fe)=>[De/2,Fe],P=(De,Fe)=>[De/2,0];break;case"bottomLeft":X=!0,I=(De,Fe)=>[0,Fe],P=(De,Fe)=>[De,0];break;case"middleLeft":Y=!0,I=(De,Fe)=>[0,Fe/2],P=(De,Fe)=>[De,Fe/2];break}let J=I(l,c),ne=P(l,c),ae=y(...ne),se=Jt._round(a+ae[0]),oe=Jt._round(r+ae[1]),he=1,we=1,Ce,Ne;if(!n.fromKeyboard){let{screenX:De,screenY:Fe}=n,[bt,Ve]=this.#c;[Ce,Ne]=this.screenToPageTranslation(De-bt,Fe-Ve),this.#c[0]=De,this.#c[1]=Fe}else({deltaX:Ce,deltaY:Ne}=n);if([Ce,Ne]=j(Ce/i,Ne/s),X){let De=Math.hypot(l,c);he=we=Math.max(Math.min(Math.hypot(ne[0]-J[0]-Ce,ne[1]-J[1]-Ne)/De,1/l,1/c),p/l,m/c)}else if(Y)he=vi(Math.abs(ne[0]-J[0]-Ce),p,1)/l;else we=vi(Math.abs(ne[1]-J[1]-Ne),m,1)/c;let Pe=Jt._round(l*he),Ue=Jt._round(c*we);ae=y(...P(Pe,Ue));let ze=se-ae[0],He=oe-ae[1];this.#u||=[this.x,this.y,this.width,this.height],this.width=Pe,this.height=Ue,this.x=ze,this.y=He,this.setDims(),this.fixAndSetPosition(),this._onResizing()}_onResizing(){}altTextFinish(){this.#n?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||this.#b)return this._editToolbar;this._editToolbar=new tm(this),this.div.append(this._editToolbar.render());let{toolbarButtons:e}=this;if(e)for(let[n,i]of e)await this._editToolbar.addButton(n,i);if(!this.hasComment)this._editToolbar.addButton("comment",this.addCommentButton());return this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){this._editToolbar?.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){this._editToolbar?.removeButton("comment")}removeEditToolbar(){this._editToolbar?.remove(),this._editToolbar=null,this.#n?.destroy()}addContainer(e){let n=this._editToolbar?.div;if(n)n.before(e);else this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){if(!this.#n){if(Wo.initialize(Jt._l10n),this.#n=new Wo(this),this.#e)this.#n.data=this.#e,this.#e=null}return this.#n}get altTextData(){return this.#n?.data}set altTextData(e){if(!this.#n)return;this.#n.data=e}get guessedAltText(){return this.#n?.guessedText}async setGuessedAltText(e){await this.#n?.setGuessedText(e)}serializeAltText(e){return this.#n?.serialize(e)}hasAltText(){return!!this.#n&&!this.#n.isEmpty()}hasAltTextData(){return this.#n?.hasData()??!1}focusCommentButton(){this.#i?.focusButton()}addCommentButton(){return this.canAddComment?this.#i||=new Zp(this):null}addStandaloneCommentButton(){if(!this._uiManager.hasCommentManager())return;if(this.#s){if(this._uiManager.isEditingMode())this.#s.classList.remove("hidden");return}if(!this.hasComment)return;this.#s=this.#i.renderForStandalone(),this.div.append(this.#s)}removeStandaloneCommentButton(){this.#i.removeStandaloneCommentButton(),this.#s=null}hideStandaloneCommentButton(){this.#s?.classList.add("hidden")}get comment(){if(!this.#i)return null;let{data:{richText:e,text:n,date:i,deleted:s}}=this.#i;return{text:n,richText:e,date:i,deleted:s,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(e){if(this.#i||=new Zp(this),typeof e==="object"&&e!==null)this.#i.restoreData(e);else this.#i.data=e;if(this.hasComment)this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this);else this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this)}setCommentData({comment:e,popupRef:n,richText:i}){if(!n)return;if(this.#i||=new Zp(this),this.#i.setInitialText(e,i),!this.annotationElementId)return;let s=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);if(s)this.updateFromAnnotationLayer(s)}get hasEditedComment(){return this.#i?.hasBeenEdited()}get hasDeletedComment(){return this.#i?.isDeleted()}get hasComment(){return!!this.#i&&!this.#i.isEmpty()&&!this.#i.isDeleted()}async editComment(e){this.#i||=new Zp(this),this.#i.edit(e)}toggleComment(e,n=void 0){if(this.hasComment)this._uiManager.toggleComment(this,e,n)}setSelectedCommentButton(e){this.#i.setSelectedButton(e)}addComment(e){if(this.hasEditedComment){let[,,,s]=e.rect,[a]=this.pageDimensions,[r]=this.pageTranslation,l=r+a+1,c=s-100,p=l+180;e.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[l,c,p,s]}}}updateFromAnnotationLayer({popup:{contents:e,deleted:n}}){this.#i.data=n?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){let e=this.div=document.createElement("div");if(e.setAttribute("data-editor-rotation",(360-this.rotation)%360),e.className=this.name,e.setAttribute("id",this.id),e.tabIndex=this.#r?-1:0,e.setAttribute("role","application"),this.defaultL10nId)e.setAttribute("data-l10n-id",this.defaultL10nId);if(!this._isVisible)e.classList.add("hidden");this.setInForeground(),this.#P();let[n,i]=this.parentDimensions;if(this.parentRotation%180!==0)e.style.maxWidth=`${(100*i/n).toFixed(2)}%`,e.style.maxHeight=`${(100*n/i).toFixed(2)}%`;let[s,a]=this.getInitialTranslation();return this.translate(s,a),lT(this,e,["keydown","pointerdown","dblclick"]),this.#U(),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),e}#G(){this.#f={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#n?.toggle(!1),this.parent.togglePointerEvents(!1)}#N(e,n,i){let a=0.7*(i/n)+1-0.7;if(a===1)return;let r=this.#I(this.rotation),l=(se,oe)=>[r[0]*se+r[2]*oe,r[1]*se+r[3]*oe],[c,p]=this.parentDimensions,m=this.x,g=this.y,y=this.width,x=this.height,j=Jt.MIN_SIZE/c,I=Jt.MIN_SIZE/p;a=Math.max(Math.min(a,1/y,1/x),j/y,I/x);let P=Jt._round(y*a),X=Jt._round(x*a);if(P===y&&X===x)return;this.#u||=[m,g,y,x];let Y=l(y/2,x/2),J=Jt._round(m+Y[0]),ne=Jt._round(g+Y[1]),ae=l(P/2,X/2);this.x=J-ae[0],this.y=ne-ae[1],this.width=P,this.height=X,this.setDims(),this.fixAndSetPosition(),this._onResizing()}#H(){this.#n?.toggle(!0),this.parent.togglePointerEvents(!0),this.#R()}pointerdown(e){let{isMac:n}=ai.platform;if(e.button!==0||e.ctrlKey&&n){e.preventDefault();return}if(this.#g=!0,this._isDraggable){this.#S(e);return}this.#A(e)}#A(e){let{isMac:n}=ai.platform;if(e.ctrlKey&&!n||e.shiftKey||e.metaKey&&n)this.parent.toggleSelected(this);else this.parent.setSelected(this)}#S(e){let{isSelected:n}=this;this._uiManager.setUpDragSession();let i=!1,s=new AbortController,a=this._uiManager.combinedSignal(s),r={capture:!0,passive:!1,signal:a},l=(p)=>{if(s.abort(),this.#a=null,this.#g=!1,!this._uiManager.endDragSession())this.#A(p);if(i)this._onStopDragging()};if(n)this.#v=e.clientX,this.#x=e.clientY,this.#a=e.pointerId,this.#o=e.pointerType,window.addEventListener("pointermove",(p)=>{if(!i)i=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging();let{clientX:m,clientY:g,pointerId:y}=p;if(y!==this.#a){rs(p);return}let[x,j]=this.screenToPageTranslation(m-this.#v,g-this.#x);this.#v=m,this.#x=g,this._uiManager.dragSelectedEditors(x,j),this.div.scrollIntoView({block:"nearest"})},r),window.addEventListener("touchmove",rs,r),window.addEventListener("pointerdown",(p)=>{if(p.pointerType===this.#o){if(this.#k||p.isPrimary)l(p)}rs(p)},r);let c=(p)=>{if(!this.#a||this.#a===p.pointerId){l(p);return}rs(p)};window.addEventListener("pointerup",c,{signal:a}),window.addEventListener("blur",c,{signal:a})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){if(this.#y)clearTimeout(this.#y);this.#y=setTimeout(()=>{this.#y=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(e,n,i){e.changeParent(this),this.x=n,this.y=i,this.fixAndSetPosition(),this._onTranslated()}getRect(e,n,i=this.rotation){let s=this.parentScale,[a,r]=this.pageDimensions,[l,c]=this.pageTranslation,p=e/s,m=n/s,g=this.x*a,y=this.y*r,x=this.width*a,j=this.height*r;switch(i){case 0:return[g+p+l,r-y-m-j+c,g+p+x+l,r-y-m+c];case 90:return[g+m+l,r-y+p+c,g+m+j+l,r-y+p+x+c];case 180:return[g-p-x+l,r-y+m+c,g-p+l,r-y+m+j+c];case 270:return[g-m-j+l,r-y-p-x+c,g-m+l,r-y-p+c];default:throw Error("Invalid rotation")}}getRectInCurrentCoords(e,n){let[i,s,a,r]=e,l=a-i,c=r-s;switch(this.rotation){case 0:return[i,n-r,l,c];case 90:return[i,n-s,c,l];case 180:return[a,n-s,l,c];case 270:return[a,n-r,c,l];default:throw Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&Jt._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){this.#i?.onUpdatedColor()}getData(){let{comment:{text:e,color:n,date:i,opacity:s,deleted:a,richText:r},uid:l,pageIndex:c,creationDate:p,modificationDate:m}=this;return{id:l,pageIndex:c,rect:this.getPDFRect(),richText:r,contentsObj:{str:e},creationDate:p,modificationDate:i||m,popupRef:!a,color:n,opacity:s}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){if(this.isInEditMode())return!1;return this.parent.setEditingState(!1),this.#b=!0,!0}disableEditMode(){if(!this.isInEditMode())return!1;return this.parent.setEditingState(!0),this.#b=!1,!0}isInEditMode(){return this.#b}shouldGetKeyboardEvents(){return this.#w}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:e,left:n,bottom:i,right:s}=this.getClientDimensions(),{innerHeight:a,innerWidth:r}=window;return n<r&&s>0&&e<a&&i>0}#P(){if(this.#d||!this.div)return;this.#d=new AbortController;let e=this._uiManager.combinedSignal(this.#d);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})}#U(){if(this.#k||!this.div||!this.isResizable||!this._uiManager._supportsPinchToZoom)return;this.#k=new f9({container:this.div,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#G.bind(this),onPinching:this.#N.bind(this),onPinchEnd:this.#H.bind(this),signal:this._uiManager._signal})}rebuild(){this.#P(),this.#U()}rotate(e){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(e=!1,n=null){return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:this._initialData?.popupRef||""}}static async deserialize(e,n,i){let s=new this.prototype.constructor({parent:n,id:i.getId(),uiManager:i,annotationElementId:e.annotationElementId,creationDate:e.creationDate,modificationDate:e.modificationDate});s.rotation=e.rotation,s.#e=e.accessibilityData,s._isCopy=e.isCopy||!1;let[a,r]=s.pageDimensions,[l,c,p,m]=s.getRectInCurrentCoords(e.rect,r);return s.x=l/a,s.y=c/r,s.width=p/a,s.height=m/r,s}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.#d?.abort(),this.#d=null,!this.isEmpty())this.commit();if(this.#k?.destroy(),this.#k=null,this.parent)this.parent.remove(this);else this._uiManager.removeEditor(this);if(this.hideCommentPopup(),this.#y)clearTimeout(this.#y),this.#y=null;if(this.#O(),this.removeEditToolbar(),this.#_){for(let e of this.#_.values())clearTimeout(e);this.#_=null}this.parent=null,this.#h?.remove(),this.#h=null}get isResizable(){return!1}makeResizable(){if(this.isResizable)this.#D(),this.#l.classList.remove("hidden")}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction==="ltr"?[1,0]:[0,0]}get commentButtonPositionInPage(){let{commentButtonPosition:[e,n]}=this,[i,s,a,r]=this.getPDFRect();return[Jt._round(i+(a-i)*e),Jt._round(s+(r-s)*(1-n))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return this.#i.commentPopupPositionInLayer}set commentPopupPosition(e){this.#i.commentPopupPositionInLayer=e}hasDefaultPopupPosition(){return this.#i.hasDefaultPopupPosition()}get commentButtonWidth(){return this.#i.commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(e){this.#i?.setCommentButtonStates(e)}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),this.#f={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let n=this.#l.children;if(!this.#t){this.#t=Array.from(n);let r=this.#V.bind(this),l=this.#Y.bind(this),c=this._uiManager._signal;for(let p of this.#t){let m=p.getAttribute("data-resizer-name");p.setAttribute("role","spinbutton"),p.addEventListener("keydown",r,{signal:c}),p.addEventListener("blur",l,{signal:c}),p.addEventListener("focus",this.#K.bind(this,m),{signal:c}),p.setAttribute("data-l10n-id",Jt._l10nResizer[m])}}let i=this.#t[0],s=0;for(let r of n){if(r===i)break;s++}let a=(360-this.rotation+this.parentRotation)%360/90*(this.#t.length/4);if(a!==s){if(a<s)for(let l=0;l<s-a;l++)this.#l.append(this.#l.firstElementChild);else if(a>s)for(let l=0;l<a-s;l++)this.#l.firstElementChild.before(this.#l.lastElementChild);let r=0;for(let l of n){let p=this.#t[r++].getAttribute("data-resizer-name");l.setAttribute("data-l10n-id",Jt._l10nResizer[p])}}this.#$(0),this.#w=!0,this.#l.firstElementChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}#V(e){Jt._resizerKeyboardManager.exec(this,e)}#Y(e){if(this.#w&&e.relatedTarget?.parentNode!==this.#l)this.#O()}#K(e){this.#m=this.#w?e:""}#$(e){if(!this.#t)return;for(let n of this.#t)n.tabIndex=e}_resizeWithKeyboard(e,n){if(!this.#w)return;this.#F(this.#m,{deltaX:e,deltaY:n,fromKeyboard:!0})}#O(){this.#w=!1,this.#$(-1),this.#R()}_stopResizingWithKeyboard(){this.#O(),this.div.focus()}select(){if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),this.div?.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{if(this.div?.classList.contains("selectedEditor"))this._editToolbar?.show()});return}this._editToolbar?.show(),this.#n?.toggleAltTextBadge(!1)}focus(){if(this.div&&!this.div.contains(document.activeElement))setTimeout(()=>this.div?.focus({preventScroll:!0}),0)}unselect(){if(!this.isSelected)return;if(this.isSelected=!1,this.#l?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement))this._uiManager.currentLayer.div.focus({preventScroll:!0});this._editToolbar?.hide(),this.#n?.toggleAltTextBadge(!0),this.hideCommentPopup()}hideCommentPopup(){if(this.hasComment)this._uiManager.toggleComment(null)}updateParams(e,n){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){if(!this.canChangeContent)return;this.enableEditMode(),this.div.focus()}dblclick(e){if(e.target.nodeName==="BUTTON")return;this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid})}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return this.#p}set isEditing(e){if(this.#p=e,!this.parent)return;if(e)this.parent.setSelected(this),this.parent.setActiveEditor(this);else this.parent.setActiveEditor(null)}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,n=!1){if(n){this.#_||=new Map;let{action:i}=e,s=this.#_.get(i);if(s)clearTimeout(s);s=setTimeout(()=>{if(this._reportTelemetry(e),this.#_.delete(i),this.#_.size===0)this.#_=null},Jt._telemetryTimeout),this.#_.set(i,s);return}e.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(e=this._isVisible){this.div.classList.toggle("hidden",!e),this._isVisible=e}enable(){if(this.div)this.div.tabIndex=0;this.#r=!1}disable(){if(this.div)this.div.tabIndex=-1;this.#r=!0}updateFakeAnnotationElement(e){if(!this.#h&&!this.deleted){this.#h=e.addFakeAnnotation(this);return}if(this.deleted){this.#h.remove(),this.#h=null;return}if(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)this.#h.updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let n=e.container.querySelector(".annotationContent");if(!n)n=document.createElement("div"),n.classList.add("annotationContent",this.editorType),e.container.prepend(n);else if(n.nodeName==="CANVAS"){let i=n;n=document.createElement("div"),n.classList.add("annotationContent",this.editorType),i.before(n)}return n}resetAnnotationElement(e){let{firstElementChild:n}=e.container;if(n?.nodeName==="DIV"&&n.classList.contains("annotationContent"))n.remove()}}class hT extends Jt{constructor(e){super(e);this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}var Ik=3285377520,Ir=4294901760,Go=65535;class l2{constructor(e){this.h1=e?e&4294967295:Ik,this.h2=e?e&4294967295:Ik}update(e){let n,i;if(typeof e==="string"){n=new Uint8Array(e.length*2),i=0;for(let I=0,P=e.length;I<P;I++){let X=e.charCodeAt(I);if(X<=255)n[i++]=X;else n[i++]=X>>>8,n[i++]=X&255}}else if(ArrayBuffer.isView(e))n=e.slice(),i=n.byteLength;else throw Error("Invalid data format, must be a string or TypedArray.");let s=i>>2,a=i-s*4,r=new Uint32Array(n.buffer,0,s),l=0,c=0,p=this.h1,m=this.h2,g=3432918353,y=461845907,x=g&Go,j=y&Go;for(let I=0;I<s;I++)if(I&1)l=r[I],l=l*g&Ir|l*x&Go,l=l<<15|l>>>17,l=l*y&Ir|l*j&Go,p^=l,p=p<<13|p>>>19,p=p*5+3864292196;else c=r[I],c=c*g&Ir|c*x&Go,c=c<<15|c>>>17,c=c*y&Ir|c*j&Go,m^=c,m=m<<13|m>>>19,m=m*5+3864292196;switch(l=0,a){case 3:l^=n[s*4+2]<<16;case 2:l^=n[s*4+1]<<8;case 1:if(l^=n[s*4],l=l*g&Ir|l*x&Go,l=l<<15|l>>>17,l=l*y&Ir|l*j&Go,s&1)p^=l;else m^=l}this.h1=p,this.h2=m}hexdigest(){let e=this.h1,n=this.h2;return e^=n>>>1,e=e*3981806797&Ir|e*36045&Go,n=n*4283543511&Ir|((n<<16|e>>>16)*2950163797&Ir)>>>16,e^=n>>>1,e=e*444984403&Ir|e*60499&Go,n=n*3301882366&Ir|((n<<16|e>>>16)*3120437893&Ir)>>>16,e^=n>>>1,(e>>>0).toString(16).padStart(8,"0")+(n>>>0).toString(16).padStart(8,"0")}}var am=Object.freeze({map:null,hash:"",transfer:void 0});class S2{#e=!1;#t=null;#n=null;#i=new Map;onSetModified=null;onResetModified=null;onAnnotationEditor=null;getValue(e,n){let i=this.#i.get(e);if(i===void 0)return n;return Object.assign(n,i)}getRawValue(e){return this.#i.get(e)}remove(e){let n=this.#i.get(e);if(n===void 0)return;if(n instanceof Jt)this.#n.delete(n.annotationElementId);if(this.#i.delete(e),this.#i.size===0)this.resetModified();if(this.#i.values().some((i)=>i instanceof Jt))return;this.onAnnotationEditor?.(null)}setValue(e,n){let i=this.#i.get(e),s=!1;if(i!==void 0){for(let[a,r]of Object.entries(n))if(i[a]!==r)s=!0,i[a]=r}else s=!0,this.#i.set(e,n);if(s)this.#s();if(n instanceof Jt)(this.#n||=new Map).set(n.annotationElementId,n),this.onAnnotationEditor?.(n.constructor._type)}has(e){return this.#i.has(e)}get size(){return this.#i.size}#s(){if(!this.#e)this.#e=!0,this.onSetModified?.()}resetModified(){if(this.#e)this.#e=!1,this.onResetModified?.()}get print(){return new d9(this)}get serializable(){if(this.#i.size===0)return am;let e=new Map,n=new l2,i=[],s=Object.create(null),a=!1;for(let[r,l]of this.#i){let c=l instanceof Jt?l.serialize(!1,s):l;if(l.page)l.pageIndex=l.page._pageIndex,delete l.page;if(c)e.set(r,c),n.update(`${r}:${JSON.stringify(c)}`),a||=!!c.bitmap}if(a){for(let r of e.values())if(r.bitmap)i.push(r.bitmap)}return e.size>0?{map:e,hash:n.hexdigest(),transfer:i}:am}get editorStats(){let e=null,n=new Map,i=0,s=0;for(let a of this.#i.values()){if(!(a instanceof Jt)){if(a.popup)if(a.popup.deleted)s+=1;else i+=1;continue}if(a.isCommentDeleted)s+=1;else if(a.hasEditedComment)i+=1;let r=a.telemetryFinalData;if(!r)continue;let{type:l}=r;n.getOrInsertComputed(l,()=>Object.getPrototypeOf(a).constructor),e||=Object.create(null);let c=e[l]||=new Map;for(let[p,m]of Object.entries(r)){if(p==="type")continue;let g=c.getOrInsertComputed(p,r9);g.set(m,(g.get(m)??0)+1)}}if(s>0||i>0)e||=Object.create(null),e.comments={deleted:s,edited:i};if(!e)return null;for(let[a,r]of n)e[a]=r.computeTelemetryFinalData(e[a]);return e}resetModifiedIds(){this.#t=null}updateEditor(e,n){let i=this.#n?.get(e);if(i)return i.updateFromAnnotationLayer(n),!0;return!1}getEditor(e){return this.#n?.get(e)||null}get modifiedIds(){if(this.#t)return this.#t;let e=[];if(this.#n)for(let i of this.#n.values()){if(!i.serialize())continue;e.push(i.annotationElementId)}let n="";if(e.length){let i=new l2;i.update(e.join(",")),n=i.hexdigest()}return this.#t={ids:new Set(e),hash:n}}[Symbol.iterator](){return this.#i.entries()}}class d9 extends S2{#e=am;constructor(e){super();let{serializable:n}=e;if(n===am)return;let{map:i,hash:s,transfer:a}=n,r=structuredClone(i,a?{transfer:a}:null);this.#e={map:r,hash:s,transfer:[]}}get print(){Un("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#e}get modifiedIds(){return en(this,"modifiedIds",{ids:new Set,hash:""})}}var Ed="__forcedDependency",{floor:Mk,ceil:Rk}=Math;function Ok(e,n,i,s,a,r){e[n*4+0]=Math.min(e[n*4+0],i),e[n*4+1]=Math.min(e[n*4+1],s),e[n*4+2]=Math.max(e[n*4+2],a),e[n*4+3]=Math.max(e[n*4+3],r)}function YB(e,n,i,s,a){let r;if(e){if(e<0)r=a[0],a[0]=a[2],a[2]=r;if(a[0]*=e,a[2]*=e,n<0)r=a[1],a[1]=a[3],a[3]=r;a[1]*=n,a[3]*=n}else a.fill(0);a[0]+=i,a[1]+=s,a[2]+=i,a[3]+=s}var t9=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];class fT{#e;#t;constructor(e,n){this.#e=e,this.#t=n}get length(){return this.#e.length}isEmpty(e){return this.#e[e]===t9}minX(e){return this.#t[e*4+0]/256}minY(e){return this.#t[e*4+1]/256}maxX(e){return(this.#t[e*4+2]+1)/256}maxY(e){return(this.#t[e*4+3]+1)/256}}var Fk=(e,n)=>e?.getOrInsertComputed(n,()=>({dependencies:new Set,isRenderingOperation:!1}));class dT{#e=[[1,0,0,1,0,0]];#t=[-1/0,-1/0,1/0,1/0];#n=new Float64Array(zl);_pendingBBoxIdx=-1;#i;#s;#r;#a;_savesStack=[];_markedContentStack=[];constructor(e,n){this.#i=e.width,this.#s=e.height,this.#o(n)}growOperationsCount(e){if(e>=this.#a.length)this.#o(e,this.#a)}#o(e,n){let i=new ArrayBuffer(e*4);if(this.#r=new Uint8ClampedArray(i),this.#a=new Uint32Array(i),n&&n.length>0)this.#a.set(n),this.#a.fill(t9,n.length);else this.#a.fill(t9)}get clipBox(){return this.#t}save(e){return this.#t={__proto__:this.#t},this._savesStack.push(e),this}restore(e,n){let i=Object.getPrototypeOf(this.#t);if(i===null)return this;this.#t=i;let s=this._savesStack.pop();if(s!==void 0)n?.(s,e),this.#a[e]=this.#a[s];return this}recordOpenMarker(e){return this._savesStack.push(e),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(e,n){let i=this._savesStack.pop();if(i!==void 0)n?.(i,e),this.#a[e]=this.#a[i];return this}beginMarkedContent(e){return this._markedContentStack.push(e),this}endMarkedContent(e,n){let i=this._markedContentStack.pop();if(i!==void 0)n?.(i,e),this.#a[e]=this.#a[i];return this}pushBaseTransform(e){return this.#e.push(It.multiplyByDOMMatrix(this.#e.at(-1),e.getTransform())),this}popBaseTransform(){if(this.#e.length>1)this.#e.pop();return this}resetBBox(e){if(this._pendingBBoxIdx!==e)this._pendingBBoxIdx=e,this.#n.set(zl,0);return this}recordClipBox(e,n,i,s,a,r){let l=It.multiplyByDOMMatrix(this.#e.at(-1),n.getTransform()),c=zl.slice();It.axialAlignedBoundingBox([i,a,s,r],l,c);let p=It.intersect(this.#t,c);if(p)this.#t[0]=p[0],this.#t[1]=p[1],this.#t[2]=p[2],this.#t[3]=p[3];else this.#t[0]=this.#t[1]=1/0,this.#t[2]=this.#t[3]=-1/0;return this}recordBBox(e,n,i,s,a,r){let l=this.#t;if(l[0]===1/0)return this;let c=It.multiplyByDOMMatrix(this.#e.at(-1),n.getTransform());if(l[0]===-1/0)return It.axialAlignedBoundingBox([i,a,s,r],c,this.#n),this;let p=zl.slice();return It.axialAlignedBoundingBox([i,a,s,r],c,p),this.#n[0]=vi(p[0],l[0],this.#n[0]),this.#n[1]=vi(p[1],l[1],this.#n[1]),this.#n[2]=vi(p[2],this.#n[2],l[2]),this.#n[3]=vi(p[3],this.#n[3],l[3]),this}recordFullPageBBox(e){return this.#n[0]=Math.max(0,this.#t[0]),this.#n[1]=Math.max(0,this.#t[1]),this.#n[2]=Math.min(this.#i,this.#t[2]),this.#n[3]=Math.min(this.#s,this.#t[3]),this}recordOperation(e,n=!1,i){if(this._pendingBBoxIdx!==e)return this;let s=Mk(this.#n[0]*256/this.#i),a=Mk(this.#n[1]*256/this.#s),r=Rk(this.#n[2]*256/this.#i),l=Rk(this.#n[3]*256/this.#s);if(Ok(this.#r,e,s,a,r,l),i){for(let c of i)for(let p of c)if(p!==e)Ok(this.#r,p,s,a,r,l)}if(!n)this._pendingBBoxIdx=-1;return this}bboxToClipBoxDropOperation(e){if(this._pendingBBoxIdx===e)this._pendingBBoxIdx=-1,this.#t[0]=Math.max(this.#t[0],this.#n[0]),this.#t[1]=Math.max(this.#t[1],this.#n[1]),this.#t[2]=Math.min(this.#t[2],this.#n[2]),this.#t[3]=Math.min(this.#t[3],this.#n[3]);return this}take(){return new fT(this.#a,this.#r)}takeDebugMetadata(){throw Error("Unreachable")}recordSimpleData(e,n){return this}recordIncrementalData(e,n){return this}resetIncrementalData(e,n){return this}recordNamedData(e,n){return this}recordSimpleDataFromNamed(e,n,i){return this}recordFutureForcedDependency(e,n){return this}inheritSimpleDataAsFutureForcedDependencies(e){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(e,n,i,s=1,a=0,r=0,l){return this}getSimpleIndex(e){return}recordDependencies(e,n){return this}recordNamedDependency(e,n){return this}recordShowTextOperation(e,n=!1){return this}}class pT{#e={__proto__:null};#t={__proto__:null,transform:[],moveText:[],sameLineText:[],[Ed]:[]};#n=new Map;#i=new Set;#s=new Map;#r;#a;#o;constructor(e,n=!1){if(this.#o=e,n)this.#r=new Map,this.#a=(i,s)=>{Fk(this.#r,s).dependencies.add(i)}}get clipBox(){return this.#o.clipBox}growOperationsCount(e){this.#o.growOperationsCount(e)}save(e){return this.#e={__proto__:this.#e},this.#t={__proto__:this.#t,transform:{__proto__:this.#t.transform},moveText:{__proto__:this.#t.moveText},sameLineText:{__proto__:this.#t.sameLineText},[Ed]:{__proto__:this.#t[Ed]}},this.#o.save(e),this}restore(e){this.#o.restore(e,this.#a);let n=Object.getPrototypeOf(this.#e);if(n===null)return this;return this.#e=n,this.#t=Object.getPrototypeOf(this.#t),this}recordOpenMarker(e){return this.#o.recordOpenMarker(e,this.#a),this}getOpenMarker(){return this.#o.getOpenMarker()}recordCloseMarker(e){return this.#o.recordCloseMarker(e,this.#a),this}beginMarkedContent(e){return this.#o.beginMarkedContent(e),this}endMarkedContent(e){return this.#o.endMarkedContent(e,this.#a),this}pushBaseTransform(e){return this.#o.pushBaseTransform(e),this}popBaseTransform(){return this.#o.popBaseTransform(),this}recordSimpleData(e,n){return this.#e[e]=n,this}recordIncrementalData(e,n){return this.#t[e].push(n),this}resetIncrementalData(e,n){return this.#t[e].length=0,this}recordNamedData(e,n){return this.#n.set(e,n),this}recordSimpleDataFromNamed(e,n,i){this.#e[e]=this.#n.get(n)??i}recordFutureForcedDependency(e,n){return this.recordIncrementalData(Ed,n),this}inheritSimpleDataAsFutureForcedDependencies(e){for(let n of e)if(n in this.#e)this.recordFutureForcedDependency(n,this.#e[n]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let e of this.#i)this.recordFutureForcedDependency(Ed,e);return this}resetBBox(e){return this.#o.resetBBox(e),this}recordClipBox(e,n,i,s,a,r){return this.#o.recordClipBox(e,n,i,s,a,r),this}recordBBox(e,n,i,s,a,r){return this.#o.recordBBox(e,n,i,s,a,r),this}recordCharacterBBox(e,n,i,s=1,a=0,r=0,l){let c=i.bbox,p,m;if(c){if(p=c[2]!==c[0]&&c[3]!==c[1]&&this.#s.get(i),p!==!1){if(m=[0,0,0,0],It.axialAlignedBoundingBox(c,i.fontMatrix,m),s!==1||a!==0||r!==0)YB(s,-s,a,r,m);if(p)return this.recordBBox(e,n,m[0],m[2],m[1],m[3])}}if(!l)return this.recordFullPageBBox(e);let g=l();if(c&&m&&p===void 0){if(p=m[0]<=a-g.actualBoundingBoxLeft&&m[2]>=a+g.actualBoundingBoxRight&&m[1]<=r-g.actualBoundingBoxAscent&&m[3]>=r+g.actualBoundingBoxDescent,this.#s.set(i,p),p)return this.recordBBox(e,n,m[0],m[2],m[1],m[3])}return this.recordBBox(e,n,a-g.actualBoundingBoxLeft,a+g.actualBoundingBoxRight,r-g.actualBoundingBoxAscent,r+g.actualBoundingBoxDescent)}recordFullPageBBox(e){return this.#o.recordFullPageBBox(e),this}getSimpleIndex(e){return this.#e[e]}recordDependencies(e,n){let i=this.#i,s=this.#e,a=this.#t;for(let r of n)if(r in this.#e)i.add(s[r]);else if(r in a)a[r].forEach(i.add,i);return this}recordNamedDependency(e,n){if(this.#n.has(n))this.#i.add(this.#n.get(n));return this}recordOperation(e,n=!1){if(this.recordDependencies(e,[Ed]),this.#r){let s=Fk(this.#r,e),{dependencies:a}=s;this.#i.forEach(a.add,a),this.#o._savesStack.forEach(a.add,a),this.#o._markedContentStack.forEach(a.add,a),a.delete(e),s.isRenderingOperation=!0}let i=!n&&e===this.#o._pendingBBoxIdx;if(this.#o.recordOperation(e,n,[this.#i,this.#o._savesStack,this.#o._markedContentStack]),i)this.#i.clear();return this}recordShowTextOperation(e,n=!1){let i=Array.from(this.#i);this.recordOperation(e,n),this.recordIncrementalData("sameLineText",e);for(let s of i)this.recordIncrementalData("sameLineText",s);return this}bboxToClipBoxDropOperation(e,n=!1){let i=!n&&e===this.#o._pendingBBoxIdx;if(this.#o.bboxToClipBoxDropOperation(e),i)this.#i.clear();return this}take(){return this.#s.clear(),this.#o.take()}takeDebugMetadata(){return this.#r}}class rm{#e;#t;#n;#i=0;#s=0;constructor(e,n,i){if(e instanceof rm&&e.#n===!!i)return e;this.#e=e,this.#t=n,this.#n=!!i}get clipBox(){return this.#e.clipBox}growOperationsCount(){throw Error("Unreachable")}save(e){return this.#s++,this.#e.save(this.#t),this}restore(e){if(this.#s>0)this.#e.restore(this.#t),this.#s--;return this}recordOpenMarker(e){return this.#i++,this}getOpenMarker(){return this.#i>0?this.#t:this.#e.getOpenMarker()}recordCloseMarker(e){return this.#i--,this}beginMarkedContent(e){return this}endMarkedContent(e){return this}pushBaseTransform(e){return this.#e.pushBaseTransform(e),this}popBaseTransform(){return this.#e.popBaseTransform(),this}recordSimpleData(e,n){return this.#e.recordSimpleData(e,this.#t),this}recordIncrementalData(e,n){return this.#e.recordIncrementalData(e,this.#t),this}resetIncrementalData(e,n){return this.#e.resetIncrementalData(e,this.#t),this}recordNamedData(e,n){return this}recordSimpleDataFromNamed(e,n,i){return this.#e.recordSimpleDataFromNamed(e,n,this.#t),this}recordFutureForcedDependency(e,n){return this.#e.recordFutureForcedDependency(e,this.#t),this}inheritSimpleDataAsFutureForcedDependencies(e){return this.#e.inheritSimpleDataAsFutureForcedDependencies(e),this}inheritPendingDependenciesAsFutureForcedDependencies(){return this.#e.inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(e){if(!this.#n)this.#e.resetBBox(this.#t);return this}recordClipBox(e,n,i,s,a,r){if(!this.#n)this.#e.recordClipBox(this.#t,n,i,s,a,r);return this}recordBBox(e,n,i,s,a,r){if(!this.#n)this.#e.recordBBox(this.#t,n,i,s,a,r);return this}recordCharacterBBox(e,n,i,s,a,r,l){if(!this.#n)this.#e.recordCharacterBBox(this.#t,n,i,s,a,r,l);return this}recordFullPageBBox(e){if(!this.#n)this.#e.recordFullPageBBox(this.#t);return this}getSimpleIndex(e){return this.#e.getSimpleIndex(e)}recordDependencies(e,n){return this.#e.recordDependencies(this.#t,n),this}recordNamedDependency(e,n){return this.#e.recordNamedDependency(this.#t,n),this}recordOperation(e){return this.#e.recordOperation(this.#t,!0),this}recordShowTextOperation(e){return this.#e.recordShowTextOperation(this.#t,!0),this}bboxToClipBoxDropOperation(e){if(!this.#n)this.#e.bboxToClipBoxDropOperation(this.#t,!0);return this}take(){throw Error("Unreachable")}takeDebugMetadata(){throw Error("Unreachable")}}var Mr={stroke:["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],fill:["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],imageXObject:["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],rawFillPath:["filter","fillColor","fillAlpha"],showText:["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],transform:["transform"],transformAndFill:["transform","fillColor"]};class c2{#e;#t;#n=4;#i=0;#s=new c2.#r(this.#n*6);static#r=ai.isFloat16ArraySupported?Float16Array:Float32Array;constructor(e){this.#e=e.width,this.#t=e.height}record(e,n,i,s){if(this.#i===this.#n){this.#n*=2;let l=new c2.#r(this.#n*6);l.set(this.#s),this.#s=l}let a=bi(e),r;if(s[0]!==1/0){let l=zl.slice();It.axialAlignedBoundingBox([0,-i,n,0],a,l);let c=It.intersect(s,l);if(!c)return;let[p,m,g,y]=c;if(p!==l[0]||m!==l[1]||g!==l[2]||y!==l[3]){let x=Math.atan2(a[1],a[0]),j=Math.abs(Math.sin(x)),I=Math.abs(Math.cos(x));if(j<0.000001||I<0.000001||Math.abs(j-I)<0.000001)r=[p,m,p,y,g,m];else{let P=g-p,X=y-m,Y=j*j,J=I*I,ne=I*j,ae=J-Y,se=(X*J-P*ne)/ae,oe=(X*ne-P*Y)/ae;r=[p+oe,m,p,m+se,g,y-se]}}}if(!r)r=[0,-i,0,0,n,-i],It.applyTransform(r,a,0),It.applyTransform(r,a,2),It.applyTransform(r,a,4);r[0]/=this.#e,r[1]/=this.#t,r[2]/=this.#e,r[3]/=this.#t,r[4]/=this.#e,r[5]/=this.#t,this.#s.set(r,this.#i*6),this.#i++}take(){return this.#s.subarray(0,this.#i*6)}}var Nk=/\p{Cc}/u;function QB(e){let n=e[0];if(e.length<2||n!=='"'&&n!=="'"||e.at(-1)!==n)return!1;let i=e.length-1;for(let s=1;s<i;s++){let a=e[s];if(a===n||Nk.test(a))return!1;if(a==="\\"){if(++s>=i||Nk.test(e[s]))return!1}}return!0}function Pk(e){if(QB(e))return e;return`"${e.replaceAll(/["\\\p{Cc}]/gu,(i)=>i==='"'||i==="\\"?`\\${i}`:`\\${i.codePointAt(0).toString(16)} `)}"`}class mT{#e=new Set;#t=null;constructor({ownerDocument:e=globalThis.document,styleElement:n=null}){this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){let n=this.#n();n.insertRule(e,n.cssRules.length)}#n(){if(this.#t)return this.#t;let e=this._document.defaultView?.CSSStyleSheet||globalThis.CSSStyleSheet;if(!this.styleElement&&e){let{adoptedStyleSheets:n}=this._document;if(n){let i=new e;return n.push(i),this.#t=i}}if(!this.styleElement)this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement);return this.#t=this.styleElement.sheet}clear(){for(let e of this.nativeFontFaces)this._document.fonts.delete(e);if(this.nativeFontFaces.clear(),this.#e.clear(),this.#t){let{adoptedStyleSheets:e}=this._document;if(e?.includes(this.#t))this._document.adoptedStyleSheets=e.filter((n)=>n!==this.#t);this.#t=null}if(this.styleElement)this.styleElement.remove(),this.styleElement=null}async loadSystemFont({systemFontInfo:e,disableFontFace:n,_inspectFont:i}){if(!e||this.#e.has(e.loadedName))return;if(Fi(!n,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:s,src:a,style:r}=e,l=new FontFace(s,a,r);this.addNativeFontFace(l);try{await l.load(),this.#e.add(s),i?.(e)}catch{yn(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(l)}return}Un("Not implemented: loadSystemFont without the Font Loading API.")}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){let i=e.createNativeFontFace();if(i){this.addNativeFontFace(i);try{await i.loaded}catch(s){throw yn(`Failed to load font '${i.family}': '${s}'.`),e.disableFontFace=!0,s}}return}let n=e.createFontFaceRule();if(n){if(this.insertRule(n),this.isSyncFontLoadingSupported)return;await new Promise((i)=>{let s=this._queueLoadingCallback(i);this._prepareFontLoadEvent(e,s)})}}get isFontLoadingAPISupported(){let e=!!this._document?.fonts;return en(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){return en(this,"isSyncFontLoadingSupported",ar||ai.platform.isFirefox)}_queueLoadingCallback(e){function n(){Fi(!s.done,"completeRequest() cannot be called twice."),s.done=!0;while(i.length>0&&i[0].done){let a=i.shift();setTimeout(a.callback,0)}}let{loadingRequests:i}=this,s={done:!1,complete:n,callback:e};return i.push(s),s}get _loadTestFont(){let e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return en(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,n){function i(ae,se){return ae.charCodeAt(se)<<24|ae.charCodeAt(se+1)<<16|ae.charCodeAt(se+2)<<8|ae.charCodeAt(se+3)&255}function s(ae){return String.fromCharCode(ae>>24&255,ae>>16&255,ae>>8&255,ae&255)}function a(ae,se,oe,he){let we=ae.substring(0,se),Ce=ae.substring(se+oe);return we+he+Ce}let r,l,c=this._document.createElement("canvas");c.width=1,c.height=1;let p=c.getContext("2d"),m=0;function g(ae,se){if(++m>30){yn("Load test font never loaded."),se();return}if(p.font="30px "+ae,p.fillText(".",0,20),p.getImageData(0,0,1,1).data[3]>0){se();return}setTimeout(g.bind(null,ae,se))}let y=`lt${Date.now()}${this.loadTestFontId++}`,x=this._loadTestFont;x=a(x,976,y.length,y);let I=16,P=1482184792,X=i(x,I);for(r=0,l=y.length-3;r<l;r+=4)X=X-P+i(y,r)|0;if(r<y.length)X=X-P+i(y+"XXX",r)|0;x=a(x,I,4,s(X));let Y=`url(data:font/opentype;base64,${btoa(x)});`,J=`@font-face {font-family:"${y}";src:${Y}}`;this.insertRule(J);let ne=this._document.createElement("div");ne.style.visibility="hidden",ne.style.width=ne.style.height="10px",ne.style.position="absolute",ne.style.top=ne.style.left="0px";for(let ae of[e.loadedName,y]){let se=this._document.createElement("span");se.textContent="Hi",se.style.fontFamily=ae,ne.append(se)}this._document.body.append(ne),g(y,()=>{ne.remove(),n.complete()})}}class gT{compiledGlyphs=Object.create(null);#e;constructor(e,n=null,i,s){if(this.#e=e,this._inspectFont=n,i)this.charProcOperatorList=i;if(s)Object.assign(this,s)}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{let n={weight:this.cssFontInfo.fontWeight};if(this.cssFontInfo.italicAngle)n.style=`oblique ${this.cssFontInfo.italicAngle}deg`;e=new FontFace(Pk(this.cssFontInfo.fontFamily),this.data,n)}return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;let e=`url(data:${this.mimetype};base64,${this.data.toBase64()});`,n;if(!this.cssFontInfo)n=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let i=`font-weight: ${this.cssFontInfo.fontWeight};`;if(this.cssFontInfo.italicAngle)i+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`;n=`@font-face {font-family:${Pk(this.cssFontInfo.fontFamily)};${i}src:${e}}`}return this._inspectFont?.(this,e),n}getPathGenerator(e,n){if(this.compiledGlyphs[n]!==void 0)return this.compiledGlyphs[n];let i=this.loadedName+"_path_"+n,s;try{s=e.get(i)}catch(r){yn(`getPathGenerator - ignoring character: "${r}".`)}let a=rT(s?.path);if(!this.fontExtraProperties)e.delete(i);return this.compiledGlyphs[n]=a}get black(){return this.#e.black}get bold(){return this.#e.bold}get disableFontFace(){return this.#e.disableFontFace}set disableFontFace(e){en(this,"disableFontFace",!!e)}get fontExtraProperties(){return this.#e.fontExtraProperties}get isInvalidPDFjsFont(){return this.#e.isInvalidPDFjsFont}get isType3Font(){return this.#e.isType3Font}get italic(){return this.#e.italic}get missingFile(){return this.#e.missingFile}get remeasure(){return this.#e.remeasure}get vertical(){return this.#e.vertical}get ascent(){return this.#e.ascent}get defaultWidth(){return this.#e.defaultWidth}get descent(){return this.#e.descent}get bbox(){return this.#e.bbox}get fontMatrix(){return this.#e.fontMatrix}get fallbackName(){return this.#e.fallbackName}get loadedName(){return this.#e.loadedName}get mimetype(){return this.#e.mimetype}get name(){return this.#e.name}get data(){return this.#e.data}clearData(){this.#e.clearData()}get cssFontInfo(){return this.#e.cssFontInfo}get systemFontInfo(){return this.#e.systemFontInfo}get defaultVMetrics(){return this.#e.defaultVMetrics}}class bT{static strings=["fontFamily","fontWeight","italicAngle"]}class wT{static strings=["css","loadedName","baseFontName","src"]}class Fr{static bools=["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"];static numbers=["ascent","defaultWidth","descent"];static strings=["fallbackName","loadedName","mimetype","name"];static OFFSET_NUMBERS=Math.ceil(this.bools.length*2/8);static OFFSET_BBOX=this.OFFSET_NUMBERS+this.numbers.length*8;static OFFSET_FONT_MATRIX=this.OFFSET_BBOX+1+8;static OFFSET_DEFAULT_VMETRICS=this.OFFSET_FONT_MATRIX+1+48;static OFFSET_STRINGS=this.OFFSET_DEFAULT_VMETRICS+1+6}class Qc{static KIND=0;static HAS_BBOX=1;static HAS_BACKGROUND=2;static SHADING_TYPE=3;static N_COORD=4;static N_COLOR=8;static N_STOP=12;static N_FIGURES=16}class om{static get decoder(){return en(this,"decoder",new TextDecoder)}static get encoder(){return en(this,"encoder",new TextEncoder)}}class yT{#e;#t;constructor(e){this.#e=e,this.#t=new DataView(e)}#n(e){Fi(e<bT.strings.length,"Invalid string index");let{decoder:n}=om,i=0;for(let a=0;a<e;a++)i+=this.#t.getUint32(i)+4;let s=this.#t.getUint32(i);return n.decode(new Uint8Array(this.#e,i+4,s))}get fontFamily(){return this.#n(0)}get fontWeight(){return this.#n(1)}get italicAngle(){return this.#n(2)}}class vT{#e;#t;constructor(e){this.#e=e,this.#t=new DataView(e)}get guessFallback(){return this.#t.getUint8(0)!==0}#n(e){Fi(e<wT.strings.length,"Invalid string index");let{decoder:n}=om,i=5;for(let a=0;a<e;a++)i+=this.#t.getUint32(i)+4;let s=this.#t.getUint32(i);return n.decode(new Uint8Array(this.#e,i+4,s))}get css(){return this.#n(0)}get loadedName(){return this.#n(1)}get baseFontName(){return this.#n(2)}get src(){return this.#n(3)}get style(){let{decoder:e}=om,n=1;n+=4+this.#t.getUint32(n);let i=this.#t.getUint32(n),s=e.decode(new Uint8Array(this.#e,n+4,i));n+=4+i;let a=this.#t.getUint32(n),r=e.decode(new Uint8Array(this.#e,n+4,a));return{style:s,weight:r}}}class ST{#e;#t;constructor({buffer:e,extra:n}){if(this.#e=e,this.#t=new DataView(e),n)Object.assign(this,n)}#n(e){Fi(e<Fr.bools.length,"Invalid boolean index");let n=Math.floor(e/4),i=e*2%8,s=this.#t.getUint8(n)>>i&3;return s===0?void 0:s===2}get black(){return this.#n(0)}get bold(){return this.#n(1)}get disableFontFace(){return this.#n(2)}get fontExtraProperties(){return this.#n(3)}get isInvalidPDFjsFont(){return this.#n(4)}get isType3Font(){return this.#n(5)}get italic(){return this.#n(6)}get missingFile(){return this.#n(7)}get remeasure(){return this.#n(8)}get vertical(){return this.#n(9)}#i(e){return Fi(e<Fr.numbers.length,"Invalid number index"),this.#t.getFloat64(Fr.OFFSET_NUMBERS+e*8)}get ascent(){return this.#i(0)}get defaultWidth(){return this.#i(1)}get descent(){return this.#i(2)}#s(e,n,i,s){let a=this.#t.getUint8(e);if(a===0)return;Fi(a===n,"Invalid array length."),e+=1;let r=Array(a);for(let l=0;l<a;l++)r[l]=this.#t[i](e,!0),e+=s;return r}get bbox(){return this.#s(Fr.OFFSET_BBOX,4,"getInt16",2)}get fontMatrix(){return this.#s(Fr.OFFSET_FONT_MATRIX,6,"getFloat64",8)}get defaultVMetrics(){return this.#s(Fr.OFFSET_DEFAULT_VMETRICS,3,"getInt16",2)}#r(e){Fi(e<Fr.strings.length,"Invalid string index");let{decoder:n}=om,i=Fr.OFFSET_STRINGS+4;for(let a=0;a<e;a++)i+=this.#t.getUint32(i)+4;let s=this.#t.getUint32(i);return n.decode(new Uint8Array(this.#e,i+4,s))}get fallbackName(){return this.#r(0)}get loadedName(){return this.#r(1)}get mimetype(){return this.#r(2)}get name(){return this.#r(3)}#a(){let e=Fr.OFFSET_STRINGS,n=this.#t.getUint32(e);e+=4+n;let i=this.#t.getUint32(e);e+=4+i;let s=this.#t.getUint32(e);e+=4+s;let a=this.#t.getUint32(e);return{offset:e,length:a}}get data(){let{offset:e,length:n}=this.#a();return n===0?void 0:new Uint8Array(this.#e,e+4,n)}clearData(){let{offset:e,length:n}=this.#a();if(n===0)return;this.#t.setUint32(e,0),this.#e=new Uint8Array(this.#e,0,e+4).slice().buffer,this.#t=new DataView(this.#e)}get cssFontInfo(){let e=Fr.OFFSET_STRINGS,n=this.#t.getUint32(e);e+=4+n;let i=this.#t.getUint32(e);e+=4+i;let s=this.#t.getUint32(e);if(s===0)return null;let a=new Uint8Array(s);return a.set(new Uint8Array(this.#e,e+4,s)),new yT(a.buffer)}get systemFontInfo(){let e=Fr.OFFSET_STRINGS,n=this.#t.getUint32(e);e+=4+n;let i=this.#t.getUint32(e);if(i===0)return null;let s=new Uint8Array(i);return s.set(new Uint8Array(this.#e,e+4,i)),new vT(s.buffer)}}class _T{constructor(e){this.buffer=e,this.view=new DataView(e),this.data=new Uint8Array(e)}getIR(){let e=this.view,n=this.data[Qc.KIND],i=!!this.data[Qc.HAS_BBOX],s=!!this.data[Qc.HAS_BACKGROUND],a=e.getUint32(Qc.N_COORD,!0),r=e.getUint32(Qc.N_COLOR,!0),l=e.getUint32(Qc.N_STOP,!0),c=20,p=new Float32Array(this.buffer,c,a*2);c+=a*8;let m=new Uint8Array(this.buffer,c,r*4);c+=r*4;let g=[];for(let j=0;j<l;++j){let I=e.getFloat32(c,!0);c+=4;let P=e.getUint32(c,!0);c+=4,g.push([I,`#${P.toString(16).padStart(6,"0")}`])}let y=null;if(i){y=[];for(let j=0;j<4;++j)y.push(e.getFloat32(c,!0)),c+=4}let x=null;if(s)x=new Uint8Array(this.buffer,c,3),c+=3;if(n===1)return["RadialAxial","axial",y,g,Array.from(p.slice(0,2)),Array.from(p.slice(2,4)),null,null];if(n===2)return["RadialAxial","radial",y,g,[p[0],p[1]],[p[3],p[4]],p[2],p[5]];if(n===3){let j=this.data[Qc.SHADING_TYPE],I=null;if(p.length>0){I=zl.slice();for(let P=0,X=p.length;P<X;P+=2)It.pointBoundingBox(p[P],p[P+1],I)}return["Mesh",j,p,m,a,I,y,x]}throw Error(`Unsupported pattern kind: ${n}`)}}class xT{#e;constructor(e){this.#e=e}get path(){if(ai.isFloat16ArraySupported)return new Float16Array(this.#e);return new Float32Array(this.#e)}}function JB(e){if(e instanceof URL)return e;if(typeof e==="string"){if(ar){if(/^[a-z][a-z0-9\-+.]+:/i.test(e))return new URL(e);let i=process.getBuiltinModule("url");return new URL(i.pathToFileURL(e))}let n=URL.parse(e,window.location);if(n)return n}throw Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function ZB(e){if(ar&&typeof Buffer<"u"&&e instanceof Buffer)throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if(typeof e==="string")return w2(e);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof e==="object"&&!isNaN(e?.length))return new Uint8Array(e);throw Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function Xb(e){if(typeof e!=="string")return null;if(e.endsWith("/"))return e;throw Error(`Invalid factory url: "${e}" must include trailing slash.`)}var n9=(e)=>typeof e==="object"&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0,eL=(e)=>typeof e==="object"&&typeof e?.name==="string",tL=LB.bind(null,n9,eL);class kT{#e=new Map;#t=Promise.resolve();postMessage(e,n){let i={data:structuredClone(e,n?{transfer:n}:null)};this.#t.then(()=>{for(let[s]of this.#e)s.call(this,i)})}addEventListener(e,n,i=null){let s=null;if(i?.signal instanceof AbortSignal){let{signal:a}=i;if(a.aborted){yn("LoopbackPort - cannot use an `aborted` signal.");return}let r=()=>this.removeEventListener(e,n);s=()=>a.removeEventListener("abort",r),a.addEventListener("abort",r)}this.#e.set(n,s)}removeEventListener(e,n){this.#e.get(n)?.(),this.#e.delete(n)}terminate(){for(let[,e]of this.#e)e?.();this.#e.clear()}}var Wb={DATA:1,ERROR:2},ns={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function Bk(){}function Ba(e){if(e instanceof Vl||e instanceof r2||e instanceof a2||e instanceof im||e instanceof n2)return e;if(!(e instanceof Error||typeof e==="object"&&e!==null))Un('wrapReason: Expected "reason" to be a (possibly cloned) Error.');switch(e.name){case"AbortException":return new Vl(e.message);case"InvalidPDFException":return new r2(e.message);case"PasswordException":return new a2(e.message,e.code);case"ResponseException":return new im(e.message,e.status,e.missing);case"UnknownErrorException":return new n2(e.message,e.details)}return new n2(e.message,e.toString())}class Id{#e=new AbortController;constructor(e,n,i){this.sourceName=e,this.targetName=n,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),i.addEventListener("message",this.#t.bind(this),{signal:this.#e.signal})}#t({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){this.#i(e);return}if(e.callback){let i=e.callbackId,s=this.callbackCapabilities[i];if(!s)throw Error(`Cannot resolve callback ${i}`);if(delete this.callbackCapabilities[i],e.callback===Wb.DATA)s.resolve(e.data);else if(e.callback===Wb.ERROR)s.reject(Ba(e.reason));else throw Error("Unexpected callback case");return}let n=this.actionHandler[e.action];if(!n)throw Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){let i=this.sourceName,s=e.sourceName,a=this.comObj;Promise.try(n,e.data).then(function(r){a.postMessage({sourceName:i,targetName:s,callback:Wb.DATA,callbackId:e.callbackId,data:r})},function(r){a.postMessage({sourceName:i,targetName:s,callback:Wb.ERROR,callbackId:e.callbackId,reason:Ba(r)})});return}if(e.streamId){this.#n(e);return}n(e.data)}on(e,n){let i=this.actionHandler;if(i[e])throw Error(`There is already an actionName called "${e}"`);i[e]=n}send(e,n,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:n},i)}sendWithPromise(e,n,i){let s=this.callbackId++,a=Promise.withResolvers();this.callbackCapabilities[s]=a;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:s,data:n},i)}catch(r){a.reject(r)}return a.promise}sendWithStream(e,n,i,s){let a=this.streamId++,r=this.sourceName,l=this.targetName,c=this.comObj;return new ReadableStream({start:(p)=>{let m=Promise.withResolvers();return this.streamControllers[a]={controller:p,startCall:m,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:r,targetName:l,action:e,streamId:a,data:n,desiredSize:p.desiredSize},s),m.promise},pull:(p)=>{let m=Promise.withResolvers();return this.streamControllers[a].pullCall=m,c.postMessage({sourceName:r,targetName:l,stream:ns.PULL,streamId:a,desiredSize:p.desiredSize}),m.promise},cancel:(p)=>{Fi(p instanceof Error,"cancel must have a valid reason");let m=Promise.withResolvers();return this.streamControllers[a].cancelCall=m,this.streamControllers[a].isClosed=!0,c.postMessage({sourceName:r,targetName:l,stream:ns.CANCEL,streamId:a,reason:Ba(p)}),m.promise}},i)}#n(e){let n=e.streamId,i=this.sourceName,s=e.sourceName,a=this.comObj,r=this,l=this.actionHandler[e.action],c={enqueue(p,m=1,g){if(this.isCancelled)return;let y=this.desiredSize;if(this.desiredSize-=m,y>0&&this.desiredSize<=0)this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise;a.postMessage({sourceName:i,targetName:s,stream:ns.ENQUEUE,streamId:n,chunk:p},g)},close(){if(this.isCancelled)return;this.isCancelled=!0,a.postMessage({sourceName:i,targetName:s,stream:ns.CLOSE,streamId:n}),delete r.streamSinks[n]},error(p){if(Fi(p instanceof Error,"error must have a valid reason"),this.isCancelled)return;this.isCancelled=!0,a.postMessage({sourceName:i,targetName:s,stream:ns.ERROR,streamId:n,reason:Ba(p)})},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};c.sinkCapability.resolve(),c.ready=c.sinkCapability.promise,this.streamSinks[n]=c,Promise.try(l,e.data,c).then(function(){a.postMessage({sourceName:i,targetName:s,stream:ns.START_COMPLETE,streamId:n,success:!0})},function(p){a.postMessage({sourceName:i,targetName:s,stream:ns.START_COMPLETE,streamId:n,reason:Ba(p)})})}#i(e){let n=e.streamId,i=this.sourceName,s=e.sourceName,a=this.comObj,r=this.streamControllers[n],l=this.streamSinks[n];switch(e.stream){case ns.START_COMPLETE:if(e.success)r.startCall.resolve();else r.startCall.reject(Ba(e.reason));break;case ns.PULL_COMPLETE:if(e.success)r.pullCall.resolve();else r.pullCall.reject(Ba(e.reason));break;case ns.PULL:if(!l){a.postMessage({sourceName:i,targetName:s,stream:ns.PULL_COMPLETE,streamId:n,success:!0});break}if(l.desiredSize<=0&&e.desiredSize>0)l.sinkCapability.resolve();l.desiredSize=e.desiredSize,Promise.try(l.onPull||Bk).then(function(){a.postMessage({sourceName:i,targetName:s,stream:ns.PULL_COMPLETE,streamId:n,success:!0})},function(p){a.postMessage({sourceName:i,targetName:s,stream:ns.PULL_COMPLETE,streamId:n,reason:Ba(p)})});break;case ns.ENQUEUE:if(Fi(r,"enqueue should have stream controller"),r.isClosed)break;r.controller.enqueue(e.chunk);break;case ns.CLOSE:if(Fi(r,"close should have stream controller"),r.isClosed)break;r.isClosed=!0,r.controller.close(),this.#s(r,n);break;case ns.ERROR:Fi(r,"error should have stream controller"),r.controller.error(Ba(e.reason)),this.#s(r,n);break;case ns.CANCEL_COMPLETE:if(e.success)r.cancelCall.resolve();else r.cancelCall.reject(Ba(e.reason));this.#s(r,n);break;case ns.CANCEL:if(!l)break;let c=Ba(e.reason);Promise.try(l.onCancel||Bk,c).then(function(){a.postMessage({sourceName:i,targetName:s,stream:ns.CANCEL_COMPLETE,streamId:n,success:!0})},function(p){a.postMessage({sourceName:i,targetName:s,stream:ns.CANCEL_COMPLETE,streamId:n,reason:Ba(p)})}),l.sinkCapability.reject(c),l.isCancelled=!0,delete this.streamSinks[n];break;default:throw Error("Unexpected stream case")}}async#s(e,n){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),delete this.streamControllers[n]}destroy(){this.#e?.abort(),this.#e=null}}class p9{#e=Object.freeze({cMapUrl:"CMap",standardFontDataUrl:"font",wasmUrl:"wasm"});constructor({cMapUrl:e=null,standardFontDataUrl:n=null,wasmUrl:i=null}){this.cMapUrl=e,this.standardFontDataUrl=n,this.wasmUrl=i}async fetch({kind:e,filename:n}){switch(e){case"cMapUrl":case"standardFontDataUrl":case"wasmUrl":break;default:Un(`Not implemented: ${e}`)}let i=this[e];if(!i)throw Error(`Ensure that the \`${e}\` API parameter is provided.`);let s=`${i}${n}`;return this._fetch(s,e).catch((a)=>{throw Error(`Unable to load ${this.#e[e]} data at: ${s}`)})}async _fetch(e,n){Un("Abstract method `_fetch` called.")}}class i9 extends p9{async _fetch(e,n){let i=n==="cMapUrl"&&!e.endsWith(".bcmap")?"text":"bytes",s=await l9(e,i);return s instanceof Uint8Array?s:w2(s)}}class m9{#e=!1;constructor({enableHWA:e=!1}){this.#e=e}create(e,n){if(e<=0||n<=0)throw Error("Invalid canvas size");let i=this._createCanvas(e,n);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!this.#e})}}reset({canvas:e},n,i){if(!e)throw Error("Canvas is not specified");if(n<=0||i<=0)throw Error("Invalid canvas size");e.width=n,e.height=i}destroy(e){let{canvas:n}=e;if(!n)throw Error("Canvas is not specified");n.width=n.height=0,e.canvas=null,e.context=null}_createCanvas(e,n){Un("Abstract method `_createCanvas` called.")}}class TT extends m9{constructor({ownerDocument:e=globalThis.document,enableHWA:n=!1}){super({enableHWA:n});this._document=e}_createCanvas(e,n){let i=this._document.createElement("canvas");return i.width=e,i.height=n,i}}class g9{addFilter(e){return"none"}addHCMFilter(e,n){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addKnockoutFilter(e=0){return"none"}addHighlightHCMFilter(e,n,i,s,a){return"none"}addSelectionHCMFilter(e,n){return"none"}addSelectionFilter(){return"none"}createSelectionStyle(e=null){return null}destroy(e=!1){}}class AT extends g9{#e;#t;#n;#i;#s;#r;#a=0;constructor({docId:e,ownerDocument:n=globalThis.document}){super();this.#i=e,this.#s=n}get#o(){return this.#t||=new Map}get#l(){return this.#r||=new Map}get#c(){if(!this.#n){let e=this.#s.createElement("div"),{style:n}=e;n.colorScheme="only light",n.visibility="hidden",n.contain="strict",n.width=n.height=0,n.position="absolute",n.top=n.left=0,n.zIndex=-1;let i=this.#s.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("width",0),i.setAttribute("height",0),this.#n=this.#s.createElementNS("http://www.w3.org/2000/svg","defs"),e.append(i),i.append(this.#n),this.#s.body.append(e)}return this.#n}#f(e){if(e.length===1){let c=e[0],p=Array(256);for(let g=0;g<256;g++)p[g]=c[g]/255;let m=p.join(",");return[m,m,m]}let[n,i,s]=e,a=Array(256),r=Array(256),l=Array(256);for(let c=0;c<256;c++)a[c]=n[c]/255,r[c]=i[c]/255,l[c]=s[c]/255;return[a.join(","),r.join(","),l.join(",")]}#h(e){if(this.#e===void 0){this.#e="";let n=this.#s.URL;if(n!==this.#s.baseURI)if(v2(n))yn('#createUrl: ignore "data:"-URL for performance reasons.');else this.#e=eT(n,"")}return`url(${this.#e}#${e})`}addFilter(e){if(!e)return"none";let n=this.#o.get(e);if(n)return n;let[i,s,a]=this.#f(e),r=e.length===1?i:`${i}${s}${a}`;if(n=this.#o.get(r),n)return this.#o.set(e,n),n;let l=`g_${this.#i}_transfer_map_${this.#a++}`,c=this.#h(l);this.#o.set(e,c),this.#o.set(r,c);let p=this.#g(l);return this.#p(i,s,a,p),c}addHCMFilter(e,n){let i=`${e}-${n}`,s="base",a=this.#l.get("base");if(a?.key===i)return a.url;if(a)a.filter?.remove(),a.key=i,a.url="none",a.filter=null;else a={key:i,url:"none",filter:null},this.#l.set("base",a);if(!e||!n)return a.url;let r=this.#w(e);e=It.makeHexColor(...r);let l=this.#w(n);if(n=It.makeHexColor(...l),this.#v(),e==="#000000"&&n==="#ffffff"||e===n)return a.url;let p=Array.from({length:256},(x,j)=>e9(j/255)).join(","),m=`g_${this.#i}_hcm_filter`,g=a.filter=this.#g(m);this.#p(p,p,p,g),this.#m(g);let y=(x,j)=>{let I=r[x]/255,P=l[x]/255,X=Array(j+1);for(let Y=0;Y<=j;Y++)X[Y]=I+Y/j*(P-I);return X.join(",")};return this.#p(y(0,5),y(1,5),y(2,5),g),a.url=this.#h(m),a.url}addSelectionHCMFilter(e,n){return this.addHighlightHCMFilter("selection",e,n,"HighlightText","Highlight")}addSelectionFilter(){return this.addHighlightHCMFilter("selection_default","black","white","HighlightText","Highlight")}createSelectionStyle(e=null){let n=e?this.addSelectionHCMFilter(e.foreground,e.background):this.addSelectionFilter();if(n==="none"||!ai.platform.isFirefox)return null;return{"backdrop-filter":n,"background-color":"transparent"}}addAlphaFilter(e){let n=this.#o.get(e);if(n)return n;let[i]=this.#f([e]),s=`alpha_${i}`;if(n=this.#o.get(s),n)return this.#o.set(e,n),n;let a=`g_${this.#i}_alpha_map_${this.#a++}`,r=this.#h(a);this.#o.set(e,r),this.#o.set(s,r);let l=this.#g(a);return this.#b(i,l),r}addLuminosityFilter(e){let n=this.#o.get(e||"luminosity");if(n)return n;let i,s;if(e)[i]=this.#f([e]),s=`luminosity_${i}`;else s="luminosity";if(n=this.#o.get(s),n)return this.#o.set(e,n),n;let a=`g_${this.#i}_luminosity_map_${this.#a++}`,r=this.#h(a);this.#o.set(e,r),this.#o.set(s,r);let l=this.#g(a);if(this.#d(l),e)this.#b(i,l);return r}addKnockoutFilter(e=0){let n=e>0?Math.min(1/e,1e6):1e6,i=`knockout_${n}`,s=this.#o.get(i);if(s)return s;let a=`g_${this.#i}_knockout_filter_${this.#a++}`,r=this.#h(a);this.#o.set(i,r);let l=this.#g(a),c=this.#s.createElementNS("http://www.w3.org/2000/svg","feComponentTransfer");l.append(c);let p=this.#s.createElementNS("http://www.w3.org/2000/svg","feFuncA");return p.setAttribute("type","linear"),p.setAttribute("slope",`${n}`),p.setAttribute("intercept","0"),c.append(p),r}addHighlightHCMFilter(e,n,i,s,a){let r=`${n}-${i}-${s}-${a}`,l=this.#l.get(e);if(l?.key===r)return l.url;if(l)l.filter?.remove(),l.key=r,l.url="none",l.filter=null;else l={key:r,url:"none",filter:null},this.#l.set(e,l);if(!n||!i)return l.url;let[c,p]=[n,i].map(this.#w.bind(this)),m=Math.round(0.2126*c[0]+0.7152*c[1]+0.0722*c[2]),g=Math.round(0.2126*p[0]+0.7152*p[1]+0.0722*p[2]),[y,x]=[s,a].map(this.#x.bind(this));if(g<m)[m,g,y,x]=[g,m,x,y];this.#v();let j=(X,Y,J)=>{let ne=Array(256),ae=(g-m)/J,se=X/255,oe=(Y-X)/(255*J),he=0;for(let we=0;we<=J;we++){let Ce=Math.round(m+we*ae),Ne=se+we*oe;for(let Pe=he;Pe<=Ce;Pe++)ne[Pe]=Ne;he=Ce+1}for(let we=he;we<256;we++)ne[we]=ne[he-1];return ne.join(",")},I=`g_${this.#i}_hcm_${e}_filter`,P=l.filter=this.#g(I);return this.#m(P),this.#p(j(y[0],x[0],5),j(y[1],x[1],5),j(y[2],x[2],5),P),l.url=this.#h(I),l.url}destroy(e=!1){if(e&&this.#r?.size)return;this.#n?.parentNode.parentNode.remove(),this.#n=null,this.#t?.clear(),this.#t=null,this.#r?.clear(),this.#r=null,this.#a=0}#d(e){let n=this.#s.createElementNS("http://www.w3.org/2000/svg","feColorMatrix");n.setAttribute("type","matrix"),n.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(n)}#m(e){let n=this.#s.createElementNS("http://www.w3.org/2000/svg","feColorMatrix");n.setAttribute("type","matrix"),n.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),e.append(n)}#g(e){let n=this.#s.createElementNS("http://www.w3.org/2000/svg","filter");return n.setAttribute("color-interpolation-filters","sRGB"),n.setAttribute("id",e),this.#c.append(n),n}#u(e,n,i){let s=this.#s.createElementNS("http://www.w3.org/2000/svg",n);s.setAttribute("type","discrete"),s.setAttribute("tableValues",i),e.append(s)}#p(e,n,i,s){let a=this.#s.createElementNS("http://www.w3.org/2000/svg","feComponentTransfer");s.append(a),this.#u(a,"feFuncR",e),this.#u(a,"feFuncG",n),this.#u(a,"feFuncB",i)}#b(e,n){let i=this.#s.createElementNS("http://www.w3.org/2000/svg","feComponentTransfer");n.append(i),this.#u(i,"feFuncA",e)}#w(e){return this.#c.style.color="CanvasText",this.#c.style.backgroundColor=e,fm(getComputedStyle(this.#c).getPropertyValue("background-color"))}#y(e){return this.#c.style.color="CanvasText",this.#c.style.backgroundColor=e,hm(getComputedStyle(this.#c).getPropertyValue("background-color"))}#v(){this.#c.style.color="",this.#c.style.backgroundColor=""}#x(e){let[n,i,s,a]=this.#y(e);if(a===1)return[n,i,s];let[r,l,c]=this.#w("Canvas");return[X3(n,r,a),X3(i,l,a),X3(s,c,a)]}}function X3(e,n,i){return Math.round(i*e+(1-i)*n)}if(ar)yn("Please use the `legacy` build in Node.js environments.");async function nL(e){let i=await process.getBuiltinModule("fs/promises").readFile(e);return new Uint8Array(i)}class CT extends g9{}class jT extends m9{_createCanvas(e,n){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(e,n)}}class ET extends p9{async _fetch(e,n){return nL(e)}}function qT({src:e,srcPos:n=0,dest:i,width:s,height:a,nonBlackColor:r=4294967295,inverseDecode:l=!1}){let c=ai.isLittleEndian?4278190080:255,[p,m]=l?[r,c]:[c,r],g=s>>3,y=s&7,x=p^m,j=e.length;i=new Uint32Array(i.buffer);let I=0;for(let P=0;P<a;++P){for(let Y=n+g;n<Y;++n,I+=8){let J=e[n];i[I]=p^-(J>>7&1)&x,i[I+1]=p^-(J>>6&1)&x,i[I+2]=p^-(J>>5&1)&x,i[I+3]=p^-(J>>4&1)&x,i[I+4]=p^-(J>>3&1)&x,i[I+5]=p^-(J>>2&1)&x,i[I+6]=p^-(J>>1&1)&x,i[I+7]=p^-(J&1)&x}if(y===0)continue;let X=n<j?e[n++]:255;for(let Y=0;Y<y;++Y,++I)i[I]=p^-(X>>7-Y&1)&x}return{srcPos:n,destPos:I}}function iL({src:e,srcPos:n=0,dest:i,destPos:s=0,width:a,height:r}){let l=0,c=a*r*3,p=c>>2,m=new Uint32Array(e.buffer,n,p),g=ai.isLittleEndian?4278190080:255;if(ai.isLittleEndian){for(;l<p-2;l+=3,s+=4){let y=m[l],x=m[l+1],j=m[l+2];i[s]=y|g,i[s+1]=y>>>24|x<<8|g,i[s+2]=x>>>16|j<<16|g,i[s+3]=j>>>8|g}for(let y=l*4,x=n+c;y<x;y+=3)i[s++]=e[y]|e[y+1]<<8|e[y+2]<<16|g}else{for(;l<p-2;l+=3,s+=4){let y=m[l],x=m[l+1],j=m[l+2];i[s]=y|g,i[s+1]=y<<24|x>>>8|g,i[s+2]=x<<16|j>>>16|g,i[s+3]=j<<8|g}for(let y=l*4,x=n+c;y<x;y+=3)i[s++]=e[y]<<24|e[y+1]<<16|e[y+2]<<8|g}return{srcPos:n+c,destPos:s}}var sL=`
|
|
246
|
+
struct Uniforms {
|
|
247
|
+
offsetX : f32,
|
|
248
|
+
offsetY : f32,
|
|
249
|
+
scaleX : f32,
|
|
250
|
+
scaleY : f32,
|
|
251
|
+
paddedWidth : f32,
|
|
252
|
+
paddedHeight : f32,
|
|
253
|
+
borderSize : f32,
|
|
254
|
+
_pad : f32,
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
@group(0) @binding(0) var<uniform> u : Uniforms;
|
|
258
|
+
|
|
259
|
+
struct VertexInput {
|
|
260
|
+
@location(0) position : vec2<f32>,
|
|
261
|
+
@location(1) color : vec4<f32>,
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
struct VertexOutput {
|
|
265
|
+
@builtin(position) position : vec4<f32>,
|
|
266
|
+
@location(0) color : vec3<f32>,
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
@vertex
|
|
270
|
+
fn vs_main(in : VertexInput) -> VertexOutput {
|
|
271
|
+
var out : VertexOutput;
|
|
272
|
+
let cx = (in.position.x + u.offsetX) * u.scaleX;
|
|
273
|
+
let cy = (in.position.y + u.offsetY) * u.scaleY;
|
|
274
|
+
out.position = vec4<f32>(
|
|
275
|
+
((cx + u.borderSize) / u.paddedWidth) * 2.0 - 1.0,
|
|
276
|
+
1.0 - ((cy + u.borderSize) / u.paddedHeight) * 2.0,
|
|
277
|
+
0.0,
|
|
278
|
+
1.0
|
|
279
|
+
);
|
|
280
|
+
out.color = in.color.rgb;
|
|
281
|
+
return out;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
@fragment
|
|
285
|
+
fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
286
|
+
return vec4<f32>(in.color, 1.0);
|
|
287
|
+
}
|
|
288
|
+
`;class DT{#e=null;#t=null;#n=null;#i=null;async#s(){if(!globalThis.navigator?.gpu)return!1;try{let e=await navigator.gpu.requestAdapter();if(!e)return!1;return this.#i=navigator.gpu.getPreferredCanvasFormat(),this.#t=await e.requestDevice(),!0}catch{return!1}}init(){return this.#e||=this.#s()}get isReady(){return this.#t!==null}loadMeshShader(){if(!this.#t||this.#n)return;let e=this.#t.createShaderModule({code:sL});this.#n=this.#t.createRenderPipeline({layout:"auto",vertex:{module:e,entryPoint:"vs_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]},{arrayStride:4,attributes:[{shaderLocation:1,offset:0,format:"unorm8x4"}]}]},fragment:{module:e,entryPoint:"fs_main",targets:[{format:this.#i}]},primitive:{topology:"triangle-list"}})}draw(e,n,i,s,a,r,l,c){this.loadMeshShader();let p=this.#t,{offsetX:m,offsetY:g,scaleX:y,scaleY:x}=s,j=p.createBuffer({size:Math.max(e.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});if(e.byteLength>0)p.queue.writeBuffer(j,0,e);let I=p.createBuffer({size:Math.max(n.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});if(n.byteLength>0)p.queue.writeBuffer(I,0,n);let P=p.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});p.queue.writeBuffer(P,0,new Float32Array([m,g,y,x,r,l,c,0]));let X=p.createBindGroup({layout:this.#n.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:P}}]}),Y=new OffscreenCanvas(r,l),J=Y.getContext("webgpu");J.configure({device:p,format:this.#i,alphaMode:a?"opaque":"premultiplied"});let ne=a?{r:a[0]/255,g:a[1]/255,b:a[2]/255,a:1}:{r:0,g:0,b:0,a:0},ae=p.createCommandEncoder(),se=ae.beginRenderPass({colorAttachments:[{view:J.getCurrentTexture().createView(),clearValue:ne,loadOp:"clear",storeOp:"store"}]});if(i>0)se.setPipeline(this.#n),se.setBindGroup(0,X),se.setVertexBuffer(0,j),se.setVertexBuffer(1,I),se.draw(i);return se.end(),p.queue.submit([ae.finish()]),j.destroy(),I.destroy(),P.destroy(),Y.transferToImageBitmap()}}var _2=new DT;function aL(){return _2.init()}function rL(){return _2.isReady}function oL(){_2.loadMeshShader()}function lL(e,n,i,s,a,r,l,c){return _2.draw(e,n,i,s,a,r,l,c)}var Gs={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function i2(e,n){if(!n)return;let i=n[2]-n[0],s=n[3]-n[1],a=new Path2D;a.rect(n[0],n[1],i,s),e.clip(a)}class x2{matrix=null;isModifyingCurrentTransform(){return!1}getPattern(){Un("Abstract method `getPattern` called.")}}class IT extends x2{constructor(e){super();this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7]}isOriginBased(){return this._p0[0]===0&&this._p0[1]===0&&(!this.isRadial()||this._p1[0]===0&&this._p1[1]===0)}isRadial(){return this._type==="radial"}areConic(){if(!this.isRadial())return!1;let e=Math.hypot(this._p0[0]-this._p1[0],this._p0[1]-this._p1[1]);return e+this._r1>this._r0&&e+this._r0>this._r1}_createGradient(e,n=null){let i,s=this._p0,a=this._p1;if(n)s=s.slice(),a=a.slice(),It.applyTransform(s,n),It.applyTransform(a,n);if(this._type==="axial")i=e.createLinearGradient(s[0],s[1],a[0],a[1]);else if(this._type==="radial"){let r=this._r0,l=this._r1;if(n){let c=new Float32Array(2);It.singularValueDecompose2dScale(n,c),r*=c[0],l*=c[0]}i=e.createRadialGradient(s[0],s[1],r,a[0],a[1],l)}for(let r of this._colorStops)i.addColorStop(r[0],r[1]);return i}_createReversedGradient(e,n=null){let i=this._p1,s=this._p0;if(n)i=i.slice(),s=s.slice(),It.applyTransform(i,n),It.applyTransform(s,n);let a=this._r1,r=this._r0;if(n){let p=new Float32Array(2);It.singularValueDecompose2dScale(n,p),a*=p[0],r*=p[0]}let l=e.createRadialGradient(i[0],i[1],a,s[0],s[1],r),c=this._colorStops.map(([p,m])=>[1-p,m]).reverse();for(let[p,m]of c)l.addColorStop(p,m);return l}getPattern(e,n,i,s){let a;if(s===Gs.STROKE||s===Gs.FILL){if(this.isOriginBased()){let y=It.transform(i,n.baseTransform);if(this.matrix)y=It.transform(y,this.matrix);let x=0.001,j=Math.hypot(y[0],y[1]),I=Math.hypot(y[2],y[3]),P=(y[0]*y[2]+y[1]*y[3])/(j*I);if(Math.abs(P)<x)if(this.isRadial()){if(Math.abs(j-I)<x)return this._createGradient(e,y)}else return this._createGradient(e,y)}let r=n.current.getClippedPathBoundingBox(s,bi(e))||[0,0,0,0],l=Math.ceil(r[2]-r[0])||1,c=Math.ceil(r[3]-r[1])||1,p=n.canvasFactory.create(l,c),m=p.context;if(m.clearRect(0,0,m.canvas.width,m.canvas.height),m.beginPath(),m.rect(0,0,m.canvas.width,m.canvas.height),m.translate(-r[0],-r[1]),i=It.transform(i,[1,0,0,1,r[0],r[1]]),m.transform(...n.baseTransform),this.matrix)m.transform(...this.matrix);if(i2(m,this._bbox),this.areConic())m.fillStyle=this._createReversedGradient(m),m.fill();m.fillStyle=this._createGradient(m),m.fill(),a=e.createPattern(p.canvas,"no-repeat"),n.canvasFactory.destroy(p);let g=new DOMMatrix(i);a.setTransform(g)}else{if(this.areConic())e.save(),i2(e,this._bbox),e.fillStyle=this._createReversedGradient(e),e.fillRect(-10000000000,-10000000000,20000000000,20000000000),e.restore();i2(e,this._bbox),a=this._createGradient(e)}return a}}function cL(e,n,i,s,a,r,l,c){let{coords:p,colors:m}=n,g=e.data,y=e.width*4,x;if(p[i*2+1]>p[s*2+1])x=i,i=s,s=x,x=r,r=l,l=x;if(p[s*2+1]>p[a*2+1])x=s,s=a,a=x,x=l,l=c,c=x;if(p[i*2+1]>p[s*2+1])x=i,i=s,s=x,x=r,r=l,l=x;let j=(p[i*2]+n.offsetX)*n.scaleX,I=(p[i*2+1]+n.offsetY)*n.scaleY,P=(p[s*2]+n.offsetX)*n.scaleX,X=(p[s*2+1]+n.offsetY)*n.scaleY,Y=(p[a*2]+n.offsetX)*n.scaleX,J=(p[a*2+1]+n.offsetY)*n.scaleY;if(I>=J)return;let ne=m[r*4],ae=m[r*4+1],se=m[r*4+2],oe=m[l*4],he=m[l*4+1],we=m[l*4+2],Ce=m[c*4],Ne=m[c*4+1],Pe=m[c*4+2],Ue=Math.round(I),ze=Math.round(J),He,De,Fe,bt,Ve,$e,Ct,ct;for(let Ze=Ue;Ze<=ze;Ze++){if(Ze<X){let Zt=Ze<I?0:(I-Ze)/(I-X);He=j-(j-P)*Zt,De=ne-(ne-oe)*Zt,Fe=ae-(ae-he)*Zt,bt=se-(se-we)*Zt}else{let Zt;if(Ze>J)Zt=1;else if(X===J)Zt=0;else Zt=(X-Ze)/(X-J);He=P-(P-Y)*Zt,De=oe-(oe-Ce)*Zt,Fe=he-(he-Ne)*Zt,bt=we-(we-Pe)*Zt}let mt;if(Ze<I)mt=0;else if(Ze>J)mt=1;else mt=(I-Ze)/(I-J);Ve=j-(j-Y)*mt,$e=ne-(ne-Ce)*mt,Ct=ae-(ae-Ne)*mt,ct=se-(se-Pe)*mt;let Xt=Math.round(Math.min(He,Ve)),hn=Math.round(Math.max(He,Ve)),nn=y*Ze+Xt*4;for(let Zt=Xt;Zt<=hn;Zt++){if(mt=(He-Zt)/(He-Ve),mt<0)mt=0;else if(mt>1)mt=1;g[nn++]=De-(De-$e)*mt|0,g[nn++]=Fe-(Fe-Ct)*mt|0,g[nn++]=bt-(bt-ct)*mt|0,g[nn++]=255}}}class MT extends x2{constructor(e){super();this._posData=e[2],this._colData=e[3],this._vertexCount=e[4],this._bounds=e[5],this._bbox=e[6],this._background=e[7],oL()}_createMeshCanvas(e,n,i){let l=Math.floor(this._bounds[0]),c=Math.floor(this._bounds[1]),p=Math.ceil(this._bounds[2])-l,m=Math.ceil(this._bounds[3])-c,g=Math.min(Math.ceil(Math.abs(p*e[0]*1.1)),3000)||1,y=Math.min(Math.ceil(Math.abs(m*e[1]*1.1)),3000)||1,x=p?p/g:1,j=m?m/y:1,I={coords:this._posData,colors:this._colData,offsetX:-l,offsetY:-c,scaleX:1/x,scaleY:1/j},P=g+4,X=y+4,Y=i.create(P,X);if(rL()&&this._vertexCount>48)Y.context.drawImage(lL(this._posData,this._colData,this._vertexCount,I,n,P,X,2),0,0);else{let J=Y.context.createImageData(g,y);if(n){let ne=J.data;for(let ae=0,se=ne.length;ae<se;ae+=4)ne[ae]=n[0],ne[ae+1]=n[1],ne[ae+2]=n[2],ne[ae+3]=255}for(let ne=0,ae=this._vertexCount;ne<ae;ne+=3)cL(J,I,ne,ne+1,ne+2,ne,ne+1,ne+2);Y.context.putImageData(J,2,2)}return{canvas:Y.canvas,offsetX:l-2*x,offsetY:c-2*j,scaleX:x,scaleY:j}}isModifyingCurrentTransform(){return!0}getPattern(e,n,i,s){i2(e,this._bbox);let a=new Float32Array(2);if(s===Gs.SHADING)It.singularValueDecompose2dScale(bi(e),a);else if(this.matrix){It.singularValueDecompose2dScale(this.matrix,a);let[c,p]=a;It.singularValueDecompose2dScale(n.baseTransform,a),a[0]*=c,a[1]*=p}else It.singularValueDecompose2dScale(n.baseTransform,a);let r=this._createMeshCanvas(a,s===Gs.SHADING?null:this._background,n.canvasFactory);if(s!==Gs.SHADING){if(e.setTransform(...n.baseTransform),this.matrix)e.transform(...this.matrix)}e.translate(r.offsetX,r.offsetY),e.scale(r.scaleX,r.scaleY);let l=e.createPattern(r.canvas,"no-repeat");return n.canvasFactory.destroy(r),l}}class RT extends x2{getPattern(){return"hotpink"}}function uL(e){switch(e[0]){case"RadialAxial":return new IT(e);case"Mesh":return new MT(e);case"Dummy":return new RT}throw Error(`Unknown IR type: ${e[0]}`)}var Lk={COLORED:1,UNCOLORED:2};class nm{static MAX_PATTERN_SIZE=3000;constructor(e,n,i,s){this.color=e[1],this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.needsIsolation=e[9]??!0,this.ctx=n,this.canvasGraphicsFactory=i,this.baseTransform=s,this.patternBaseMatrix=this.matrix?It.transform(s,this.matrix):s}canSkipPatternCanvas([e,n,i,s]){let[a,r,l,c]=this.bbox,p=Math.abs(this.xstep),m=Math.abs(this.ystep);if(e>p+0.000001||n>m+0.000001)return null;let g=Math.floor((i-l)/p)+1,y=Math.ceil((i+e-a)/p)-1,x=Math.floor((s-c)/m)+1,j=Math.ceil((s+n-r)/m)-1;return y<=g&&j<=x?[g,x]:null}updatePatternDims(e,n){let i=It.inverseTransform(this.patternBaseMatrix),s=[e[0],e[1]],a=[e[2],e[3]];It.applyTransform(s,i),It.applyTransform(a,i),n[0]=Math.abs(a[0]-s[0]),n[1]=Math.abs(a[1]-s[1]),n[2]=Math.min(s[0],a[0]),n[3]=Math.min(s[1],a[1])}_renderTileCanvas(e,n,i,s){let[a,r,l,c]=this.bbox,p=e.canvasFactory.create(i.size,s.size),m=p.context,g=this.canvasGraphicsFactory.createCanvasGraphics(m,n);return g.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(g,this.paintType,this.color),m.translate(-i.scale*a,-s.scale*r),g.transform(0,i.scale,0,0,s.scale,0,0),m.save(),g.dependencyTracker?.save(),this.clipBbox(g,a,r,l,c),g.baseTransform=bi(g.ctx),g.executeOperatorList(this.operatorList),g.endDrawing(),g.dependencyTracker?.restore(),m.restore(),p}_getCombinedScales(){let e=new Float32Array(2);It.singularValueDecompose2dScale(this.matrix,e);let[n,i]=e;return It.singularValueDecompose2dScale(this.baseTransform,e),[n*e[0],i*e[1]]}drawPattern(e,n,i=!1,[s,a],r){let[l,c,p,m]=this.bbox,g=e.dependencyTracker;if(g)e.dependencyTracker=new rm(g,r);if(e.save(),i)e.ctx.clip(n,"evenodd");else e.ctx.clip(n);if(e.ctx.setTransform(...this.patternBaseMatrix),e.ctx.translate(s*this.xstep,a*this.ystep),this.needsIsolation||e.ctx.globalAlpha!==1||e.ctx.globalCompositeOperation!=="source-over"||e.inSMaskMode){let y=p-l,x=m-c,[j,I]=this._getCombinedScales(),P=this.getSizeAndScale(y,this.ctx.canvas.width,j),X=this.getSizeAndScale(x,this.ctx.canvas.height,I),Y=this._renderTileCanvas(e,r,P,X);e.ctx.drawImage(Y.canvas,l,c,y,x),e.canvasFactory.destroy(Y)}else this.setFillAndStrokeStyleToContext(e,this.paintType,this.color),this.clipBbox(e,l,c,p,m),e.baseTransformStack.push(e.baseTransform),e.baseTransform=bi(e.ctx),e.executeOperatorList(this.operatorList),e.baseTransform=e.baseTransformStack.pop();if(e.restore(),g)e.dependencyTracker=g}createPatternCanvas(e,n){let[i,s,a,r]=this.bbox,l=a-i,c=r-s,{xstep:p,ystep:m}=this;p=Math.abs(p),m=Math.abs(m),b2("TilingType: "+this.tilingType);let[g,y]=this._getCombinedScales(),x=l,j=c,I=!1,P=!1;if(Math.ceil(p*g)>=Math.ceil(l*g))x=p;else I=!0;if(Math.ceil(m*y)>=Math.ceil(c*y))j=m;else P=!0;let X=this.getSizeAndScale(x,this.ctx.canvas.width,g),Y=this.getSizeAndScale(j,this.ctx.canvas.height,y),J=this._renderTileCanvas(e,n,X,Y);if(I||P){let ne=J.canvas;if(I)x=p;if(P)j=m;let ae=this.getSizeAndScale(x,this.ctx.canvas.width,g),se=this.getSizeAndScale(j,this.ctx.canvas.height,y),oe=ae.size,he=se.size,we=e.canvasFactory.create(oe,he),Ce=we.context,Ne=I?Math.floor(l/p):0,Pe=P?Math.floor(c/m):0;for(let Ue=0;Ue<=Ne;Ue++)for(let ze=0;ze<=Pe;ze++)Ce.drawImage(ne,oe*Ue,he*ze,oe,he,0,0,oe,he);return e.canvasFactory.destroy(J),{canvas:we.canvas,canvasEntry:we,scaleX:ae.scale,scaleY:se.scale,offsetX:i,offsetY:s}}return{canvas:J.canvas,canvasEntry:J,scaleX:X.scale,scaleY:Y.scale,offsetX:i,offsetY:s}}getSizeAndScale(e,n,i){let s=Math.max(nm.MAX_PATTERN_SIZE,n),a=Math.ceil(e*i);if(a>=s)a=s;else i=a/e;return{scale:i,size:a}}clipBbox(e,n,i,s,a){let r=s-n,l=a-i,c=new Path2D;c.rect(n,i,r,l),It.axialAlignedBoundingBox([n,i,s,a],bi(e.ctx),e.current.minMax),e.ctx.clip(c),e.current.updateClipFromPath()}setFillAndStrokeStyleToContext(e,n,i){let{ctx:s,current:a}=e;switch(a.patternFill=a.patternStroke=!1,n){case Lk.COLORED:let{fillStyle:r,strokeStyle:l}=this.ctx;s.fillStyle=a.fillColor=r,s.strokeStyle=a.strokeColor=l;break;case Lk.UNCOLORED:s.fillStyle=s.strokeStyle=i,a.fillColor=a.strokeColor=i;break;default:throw new tT(`Unsupported paint type: ${n}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,n,i,s,a){let r=s!==Gs.SHADING?It.transform(i,this.patternBaseMatrix):i,l=this.createPatternCanvas(n,a),c=new DOMMatrix(r);c=c.translate(l.offsetX,l.offsetY),c=c.scale(1/l.scaleX,1/l.scaleY);let p=e.createPattern(l.canvas,"repeat");return n.canvasFactory.destroy(l.canvasEntry),p.setTransform(c),p}}var hL=16,fL=100,dL=15,Hk=10,La=16,or=new Float32Array(2);function Uk(e,n){if(e._removeMirroring)throw Error("Context is already forwarding operations.");let i=new Map;for(let s of["save","restore","rotate","scale","translate","transform","setTransform","resetTransform","clip","moveTo","lineTo","bezierCurveTo","quadraticCurveTo","arc","arcTo","ellipse","rect","roundRect","closePath","beginPath"]){let a=e[s];if(typeof a!=="function"||typeof n[s]!=="function")continue;i.set(s,a),e[s]=function(...r){return n[s](...r),a.apply(this,r)}}e._removeMirroring=()=>{for(let[s,a]of i)e[s]=a;delete e._removeMirroring}}function Kb(e,n,i,s,a,r,l,c,p,m){let[g,y,x,j,I,P]=bi(e);if(y===0&&x===0){let J=l*g+I,ne=Math.round(J),ae=c*j+P,se=Math.round(ae),oe=(l+p)*g+I,he=Math.abs(Math.round(oe)-ne)||1,we=(c+m)*j+P,Ce=Math.abs(Math.round(we)-se)||1;return e.setTransform(Math.sign(g),0,0,Math.sign(j),ne,se),e.drawImage(n,i,s,a,r,0,0,he,Ce),e.setTransform(g,y,x,j,I,P),[he,Ce]}if(g===0&&j===0){let J=c*x+I,ne=Math.round(J),ae=l*y+P,se=Math.round(ae),oe=(c+m)*x+I,he=Math.abs(Math.round(oe)-ne)||1,we=(l+p)*y+P,Ce=Math.abs(Math.round(we)-se)||1;return e.setTransform(0,Math.sign(y),Math.sign(x),0,ne,se),e.drawImage(n,i,s,a,r,0,0,Ce,he),e.setTransform(g,y,x,j,I,P),[Ce,he]}e.drawImage(n,i,s,a,r,l,c,p,m);let X=Math.hypot(g,y),Y=Math.hypot(x,j);return[X*p,Y*m]}class s9{alphaIsShape=!1;fontSize=0;fontSizeScale=1;textMatrix=null;textMatrixScale=1;fontMatrix=K3;leading=0;x=0;y=0;lineX=0;lineY=0;charSpacing=0;wordSpacing=0;textHScale=1;textRenderingMode=as.FILL;textRise=0;fillColor="#000000";strokeColor="#000000";tilingPatternDims=null;patternFill=!1;patternStroke=!1;fillAlpha=1;strokeAlpha=1;lineWidth=1;activeSMask=null;transferMaps="none";minMax=kh.slice();constructor(e,n){this.clipBox=new Float32Array([0,0,e,n])}clone(){let e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e.tilingPatternDims=this.tilingPatternDims?.slice(),e}getPathBoundingBox(e=Gs.FILL,n=null){let i=this.minMax.slice();if(e===Gs.STROKE){if(!n)Un("Stroke bounding box must include transform.");It.singularValueDecompose2dScale(n,or);let s=or[0]*this.lineWidth/2,a=or[1]*this.lineWidth/2;i[0]-=s,i[1]-=a,i[2]+=s,i[3]+=a}return i}updateClipFromPath(){let e=It.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(e){this.clipBox.set(e,0),this.minMax.set(kh,0)}getClippedPathBoundingBox(e=Gs.FILL,n=null){return It.intersect(this.clipBox,this.getPathBoundingBox(e,n))}}function zk(e,n){let{width:i,height:s,kind:a}=n,r=s%La,l=(s-r)/La,c=r===0?l:l+1,p=e.createImageData(i,La),m=0,g=n.data,y=p.data,x;if(a===t2.GRAYSCALE_1BPP)for(x=0;x<c;x++)({srcPos:m}=qT({src:g,srcPos:m,dest:y,width:i,height:x<l?La:r})),e.putImageData(p,0,x*La);else if(a===t2.RGBA_32BPP){let j=0,I=i*La*4;for(x=0;x<l;x++)y.set(g.subarray(m,m+I)),m+=I,e.putImageData(p,0,j),j+=La;if(x<c)I=i*r*4,y.set(g.subarray(m,m+I)),e.putImageData(p,0,j)}else if(a===t2.RGB_24BPP)for(x=0;x<c;x++)({srcPos:m}=iL({src:g,srcPos:m,dest:new Uint32Array(y.buffer),width:i,height:x<l?La:r})),e.putImageData(p,0,x*La);else throw Error(`bad image kind: ${a}`)}function Gk(e,n){if(n.bitmap){e.drawImage(n.bitmap,0,0);return}let{width:i,height:s}=n,a=s%La,r=(s-a)/La,l=a===0?r:r+1,c=e.createImageData(i,La),p=0,m=n.data,g=c.data;for(let y=0;y<l;y++)({srcPos:p}=qT({src:m,srcPos:p,dest:g,width:i,height:y<r?La:a,nonBlackColor:0})),e.putImageData(c,0,y*La)}function Sh(e,n){let i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(let s of i)if(e[s]!==void 0)n[s]=e[s];if(e.setLineDash!==void 0)n.setLineDash(e.getLineDash()),n.lineDashOffset=e.lineDashOffset}function Yb(e){if(e.strokeStyle=e.fillStyle="#000000",e.fillRule="nonzero",e.globalAlpha=1,e.lineWidth=1,e.lineCap="butt",e.lineJoin="miter",e.miterLimit=10,e.globalCompositeOperation="source-over",e.font="10px sans-serif",e.setLineDash!==void 0)e.setLineDash([]),e.lineDashOffset=0;let{filter:n}=e;if(n!=="none"&&n!=="")e.filter="none"}function Vk(e,n){if(n)return!0;It.singularValueDecompose2dScale(e,or);let i=Math.fround(so.pixelRatio*Ch.PDF_TO_CSS_UNITS);return or[0]<=i&&or[1]<=i}var pL=["butt","round","square"],mL=["miter","round","bevel"],gL={},Xk={};class Ah{static#e=null;#t=0;#n=0;#i=null;#s=null;#r=null;#a=null;#o=1;#l;#c=null;#f=[];constructor(e,n,i,s,a,{optionalContentConfig:r,markedContentStack:l=null},c,p,m,g){this.ctx=e,this.current=new s9(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.commonObjs=n,this.objs=i,this.canvasFactory=s,this.filterFactory=a,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.tempSMask=null,this.smaskGroupCanvases=[],this.smaskPreparedEntry=null,this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=l||[],this.optionalContentConfig=r,this.cachedPatterns=new Map,this.annotationCanvasMap=c,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=p,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=m??null,this.imagesTracker=g??null}getObject(e,n,i=null){if(typeof n==="string")return this.dependencyTracker?.recordNamedDependency(e,n),n.startsWith("g_")?this.commonObjs.get(n):this.objs.get(n);return i}beginDrawing({transform:e,viewport:n,transparency:i=!1,background:s=null}){let a=this.ctx.canvas.width,r=this.ctx.canvas.height,l=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,a,r),this.ctx.fillStyle=l,i){let c=this.transparentCanvasEntry=this.canvasFactory.create(a,r);this.compositeCtx=this.ctx,{canvas:this.transparentCanvas,context:this.ctx}=c,this.ctx.save(),this.ctx.transform(...bi(this.compositeCtx))}if(this.ctx.save(),Yb(this.ctx),e)this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[3];this.ctx.transform(...n.transform),this.viewportScale=n.scale,this.baseTransform=bi(this.ctx)}executeOperatorList(e,n,i,s,a){let{argsArray:r,fnArray:l}=e,c=n||0,p=r.length;if(p===c)return c;let m=p-c>Hk&&typeof i==="function",g=m?Date.now()+dL:0,y=0,x=this.commonObjs,j=this.objs,I,P;while(!0){if(s!==void 0){if(c===s.nextBreakPoint)return s.breakIt(c,i),c;if(s.shouldSkip(c)){if(++c===p)return c;continue}}if(!a||a(c))if(I=l[c],P=r[c]??null,I!==Xo.dependency)if(P===null)this[I](c);else this[I](c,...P);else for(let X of P){this.dependencyTracker?.recordNamedData(X,c);let Y=X.startsWith("g_")?x:j;if(!Y.has(X))return Y.get(X,i),c}if(c++,c===p)return c;if(m&&++y>Hk){if(Date.now()>g)return i(),c;y=0}}}#h(){while(this.stateStack.length||this.inSMaskMode)this.restore();if(this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas)this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(this.transparentCanvasEntry),this.transparentCanvas=null,this.transparentCanvasEntry=null}endDrawing(){this.#h();for(let e of this.smaskGroupCanvases)this.canvasFactory.destroy(e);this.smaskGroupCanvases.length=0,this._clearPreparedSMask(),this.tempSMask=null,this.smaskStack.length=0;for(let e of this.#f)this.#v(e);this.#f.length=0,this.#i=null,this.#s=null,this.#r=null,this.#a=null,this.#o=1,this.#c=null,this.#n=0,this.#t=0,this.cachedPatterns.clear();for(let e of this._cachedBitmapsMap.values()){for(let n of e.values())if(typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement)n.width=n.height=0;e.clear()}this._cachedBitmapsMap.clear(),this.#d()}#d(){if(this.pageColors){let e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){let n=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=n}}}_scaleImage(e,n){let i=e.width??e.displayWidth,s=e.height??e.displayHeight,a=Math.max(Math.hypot(n[0],n[1]),1),r=Math.max(Math.hypot(n[2],n[3]),1),l=[],c=a,p=r,m=i,g=s;while(c>2&&m>1||p>2&&g>1){let X=m,Y=g;if(c>2&&m>1)X=Math.ceil(m/2),c/=m/X;if(p>2&&g>1)Y=Math.ceil(g/2),p/=g/Y;l.push({newWidth:X,newHeight:Y}),m=X,g=Y}if(l.length===0)return{img:e,paintWidth:i,paintHeight:s,tmpCanvas:null};if(l.length===1){let{newWidth:X,newHeight:Y}=l[0],J=this.canvasFactory.create(X,Y);return J.context.drawImage(e,0,0,i,s,0,0,X,Y),{img:J.canvas,paintWidth:X,paintHeight:Y,tmpCanvas:J}}let y=this.canvasFactory.create(1,1),x=this.canvasFactory.create(1,1),j=i,I=s,P=e;for(let{newWidth:X,newHeight:Y}of l)this.canvasFactory.reset(x,X,Y),x.context.drawImage(P,0,0,j,I,0,0,X,Y),[y,x]=[x,y],P=y.canvas,j=X,I=Y;return this.canvasFactory.destroy(x),{img:y.canvas,paintWidth:j,paintHeight:I,tmpCanvas:y}}_createMaskCanvas(e,n){let i=this.ctx,{width:s,height:a}=n,r=this.current.fillColor,l=this.current.patternFill,c=bi(i),p,m,g,y;if((n.bitmap||n.data)&&n.count>1){let Ne=n.bitmap||n.data.buffer;m=JSON.stringify(l?c:[c.slice(0,4),r]),p=this._cachedBitmapsMap.getOrInsertComputed(Ne,r9);let Pe=p.get(m);if(Pe&&!l){let Ue=Math.round(Math.min(c[0],c[2])+c[4]),ze=Math.round(Math.min(c[1],c[3])+c[5]);return this.dependencyTracker?.recordDependencies(e,Mr.transformAndFill),{canvas:Pe,offsetX:Ue,offsetY:ze}}g=Pe}if(!g)y=this.canvasFactory.create(s,a),Gk(y.context,n);let x=It.transform(c,[1/s,0,0,-1/a,0,0]);x=It.transform(x,[1,0,0,1,0,-a]);let j=kh.slice();It.axialAlignedBoundingBox([0,0,s,a],x,j);let[I,P,X,Y]=j,J=Math.round(X-I)||1,ne=Math.round(Y-P)||1,ae=this.canvasFactory.create(J,ne),se=ae.context,oe=I,he=P;se.translate(-oe,-he),se.transform(...x);let we=null;if(!g){let Ne=this._scaleImage(y.canvas,zo(se));if(g=Ne.img,we=Ne.tmpCanvas,g!==y.canvas)this.canvasFactory.destroy(y),y=null;if(p&&l)p.set(m,g),we=null,y=null}if(se.imageSmoothingEnabled=Vk(bi(se),n.interpolate),Kb(se,g,0,0,g.width,g.height,0,0,s,a),we)this.canvasFactory.destroy(we);if(y)this.canvasFactory.destroy(y);se.globalCompositeOperation="source-in";let Ce=It.transform(zo(se),[1,0,0,1,-oe,-he]);if(se.fillStyle=l?r.getPattern(i,this,Ce,Gs.FILL,e):r,se.fillRect(0,0,s,a),p&&!l)p.set(m,ae.canvas);return this.dependencyTracker?.recordDependencies(e,Mr.transformAndFill),{canvas:ae.canvas,canvasEntry:p&&!l?null:ae,offsetX:Math.round(oe),offsetY:Math.round(he)}}setLineWidth(e,n){if(this.dependencyTracker?.recordSimpleData("lineWidth",e),n!==this.current.lineWidth)this._cachedScaleForStroking[0]=-1;this.current.lineWidth=n,this.ctx.lineWidth=n}setLineCap(e,n){this.dependencyTracker?.recordSimpleData("lineCap",e),this.ctx.lineCap=pL[n]}setLineJoin(e,n){this.dependencyTracker?.recordSimpleData("lineJoin",e),this.ctx.lineJoin=mL[n]}setMiterLimit(e,n){this.dependencyTracker?.recordSimpleData("miterLimit",e),this.ctx.miterLimit=n}setDash(e,n,i){this.dependencyTracker?.recordSimpleData("dash",e);let s=this.ctx;if(s.setLineDash!==void 0)s.setLineDash(n),s.lineDashOffset=i}setRenderingIntent(e,n){}setFlatness(e,n){}setGState(e,n){for(let[i,s]of n)switch(i){case"LW":this.setLineWidth(e,s);break;case"LC":this.setLineCap(e,s);break;case"LJ":this.setLineJoin(e,s);break;case"ML":this.setMiterLimit(e,s);break;case"D":this.setDash(e,s[0],s[1]);break;case"RI":this.setRenderingIntent(e,s);break;case"FL":this.setFlatness(e,s);break;case"Font":this.setFont(e,s[0],s[1]);break;case"CA":this.dependencyTracker?.recordSimpleData("strokeAlpha",e),this.current.strokeAlpha=s;break;case"ca":this.dependencyTracker?.recordSimpleData("fillAlpha",e),this.ctx.globalAlpha=this.current.fillAlpha=s;break;case"BM":this.dependencyTracker?.recordSimpleData("globalCompositeOperation",e),this.ctx.globalCompositeOperation=s;break;case"SMask":if(this.dependencyTracker?.recordSimpleData("SMask",e),this.current.activeSMask=s?this.tempSMask:null,this.current.activeSMask)this.current.activeSMask.blendMode=this.ctx.globalCompositeOperation;this.tempSMask=null,this.checkSMaskState(e);break;case"TR":this.dependencyTracker?.recordSimpleData("filter",e),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(s);break}}get inSMaskMode(){return!!this.suspendedCtx}_clearPreparedSMask(){if(this.smaskPreparedEntry)this.canvasFactory.destroy(this.smaskPreparedEntry),this.smaskPreparedEntry=null;this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null}_ensurePreparedSMask(e){if(e===this.smaskPreparedFor)return;this._clearPreparedSMask(),this._prepareSMaskCanvas(e)}checkSMaskState(e){let n=this.inSMaskMode;if(this.current.activeSMask&&!n)this.beginSMaskMode(e);else if(!this.current.activeSMask&&n)this.endSMaskMode();else if(this.current.activeSMask&&n)this._ensurePreparedSMask(this.current.activeSMask)}_prepareSMaskCanvas(e){let{canvas:n,subtype:i,backdrop:s,transferMap:a}=e,r=i==="Luminosity"||i==="Alpha"&&a;if(!r&&!(i==="Luminosity"&&s)){this.smaskPreparedFor=e;return}let l;if(i==="Luminosity"&&s){let[Y,J,ne]=hm(s),ae=Math.round(0.3*Y+0.59*J+0.11*ne);l=a?.[ae]??ae}else l=a?.[0]??0;let c=4,{width:p,height:m}=this.ctx.canvas,g=n.width*n.height,y=p*m<c*g,x=r?{url:i==="Alpha"?this.filterFactory.addAlphaFilter(a):this.filterFactory.addLuminosityFilter(a),subtype:i,transferMap:a}:null,j=i==="Luminosity"?s:null,I,P,X;if(y)I=this._bakeSMaskCanvas(n,e.offsetX,e.offsetY,p,m,j,x),P=0,X=0;else I=this._bakeSMaskCanvas(n,0,0,n.width,n.height,j,x),P=e.offsetX,X=e.offsetY;this.smaskPreparedEntry=I,this.smaskPreparedFor=e,this.smaskPreparedOffsetX=P,this.smaskPreparedOffsetY=X,this.smaskPreparedOOBAlpha=!y&&l!==0?l:null}_bakeSMaskCanvas(e,n,i,s,a,r,l){if(!r&&!l)Un("_bakeSMaskCanvas with neither backdrop nor filter");let c=this.canvasFactory.create(s,a),p=c.context;if(p.drawImage(e,n,i),r)p.globalCompositeOperation="destination-atop",p.fillStyle=r,p.fillRect(0,0,s,a);if(!l)return c;let m=this.canvasFactory.create(s,a),g=m.context;g.filter=l.url;let y=ai.isCanvasFilterSupported&&g.filter!=="none"&&g.filter!=="";if(g.drawImage(c.canvas,0,0),ai.isCanvasFilterSupported)g.filter="none";if(!y){let x=g.getImageData(0,0,s,a),{data:j}=x,{transferMap:I}=l;if(l.subtype==="Luminosity")for(let P=0,X=j.length;P<X;P+=4){let Y=0.3*j[P]+0.59*j[P+1]+0.11*j[P+2]+0.5|0;j[P]=j[P+1]=j[P+2]=0,j[P+3]=I?.[Y]??Y}else for(let P=3,X=j.length;P<X;P+=4)j[P]=I[j[P]];g.putImageData(x,0,0)}return this.canvasFactory.destroy(c),m}beginSMaskMode(e){if(this.inSMaskMode)throw Error("beginSMaskMode called while already in smask mode");let{width:n,height:i}=this.ctx.canvas,s=this.canvasFactory.create(n,i);this.smaskScratchCanvas=s,this.suspendedCtx=this.ctx;let a=this.ctx=s.context;a.setTransform(this.suspendedCtx.getTransform()),Sh(this.suspendedCtx,a),Uk(a,this.suspendedCtx),this._ensurePreparedSMask(this.current.activeSMask),this.setGState(e,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Sh(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null,this.canvasFactory.destroy(this.smaskScratchCanvas),this.smaskScratchCanvas=null,this._clearPreparedSMask()}#m(e,n=null,i=1){let{width:s,height:a}=e,r=n??this.canvasFactory.create(s,a),l=r.context;i=Math.round(i*255)/255;let c=i<1;if(c&&this.#l===void 0)this.#l=ai.isCanvasFilterSupported?new Map:"none";let p="none";if(c&&this.#l instanceof Map)p=this.#l.getOrInsertComputed(i,()=>this.filterFactory.addKnockoutFilter(i));if(!c||p!=="none"){if(n)l.save(),l.setTransform(1,0,0,1,0,0),l.clearRect(0,0,s,a),l.restore();return l.filter=p,l.drawImage(e,0,0),l.filter="none",r}let m=e.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,s,a),g=l.createImageData(s,a),y=m.data,x=g.data,j=i>0?1/i:1e6;for(let I=3,P=y.length;I<P;I+=4)x[I]=Math.min(Math.round(y[I]*j),255);return l.putImageData(g,0,0),r}#g(e,n,i,s){let a=e?.[n]??null;if(a&&(a.canvas.width!==i||a.canvas.height!==s))this.canvasFactory.destroy(a),a=null;if(!a){if(a=this.canvasFactory.create(i,s),e)e[n]=a;return a}let r=a.context;return r.save(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,i,s),r.restore(),a}#u(e,n,i={}){let{backdropCanvas:s=null,destTransform:a=[1,0,0,1,0,0],backdropOffset:r=[0,0],reuseMaskEntry:l=null,poolMeta:c=null,sourceAlpha:p=1,sourceFilter:m="none",knockoutAlpha:g=1}=i,{width:y,height:x}=n,j=this.#m(n,l,g),I=e.globalCompositeOperation;if(e.save(),e.setTransform(...a),e.globalAlpha=1,ai.isCanvasFilterSupported)e.filter="none";if(e.globalCompositeOperation="destination-out",e.drawImage(j.canvas,0,0),s){let[P,X]=r,Y=this.#g(c,"knockoutBackdropEntry",y,x),J=Y.context;if(J.drawImage(s,P,X,y,x,0,0,y,x),J.globalCompositeOperation="destination-in",J.drawImage(j.canvas,0,0),J.globalCompositeOperation="source-over",e.globalCompositeOperation="destination-over",e.drawImage(Y.canvas,0,0),!c)this.canvasFactory.destroy(Y)}if(e.globalCompositeOperation=I,e.globalAlpha=p,ai.isCanvasFilterSupported)e.filter=m??"none";if(e.drawImage(n,0,0),e.restore(),!l)this.canvasFactory.destroy(j)}#p(e=1){if(this.#t===0||this.#n>0||!this.contentVisible)return!1;this.#n++,this.#o=e;let n=this.#f.at(-1),{canvas:i}=this.ctx,s=this.#g(n,"knockoutTempEntry",i.width,i.height);this.#i=s;let a=s.context;if(a.save(),a.setTransform(this.ctx.getTransform()),Sh(this.ctx,a),this.#a=a.globalCompositeOperation,a.globalCompositeOperation="source-over",Uk(a,this.ctx),this.#c=n,this.#s=this.ctx,this.#r=this.suspendedCtx,this.ctx=a,this.inSMaskMode)this.suspendedCtx=a;return!0}#b(e){if(!e)return;let n=this.#i,i=this.#s,s=this.#r,a=n.context;if(this.#i=null,this.#s=null,this.#r=null,this.inSMaskMode&&this.suspendedCtx===a&&this.ctx!==a)this.endSMaskMode();if(this.inSMaskMode)this.suspendedCtx=s;this.ctx._removeMirroring(),this.ctx.globalCompositeOperation=this.#a,this.#a=null,Sh(this.ctx,i),this.ctx=i;let r=this.#c;this.#c=null;let l=this.#o;this.#o=1;try{this.#u(s??i,n.canvas,{backdropCanvas:r?.backdropCtx?.canvas??null,backdropOffset:r?.backdropCtx?[r.offsetX,r.offsetY]:[0,0],reuseMaskEntry:r?.knockoutMaskEntry??null,poolMeta:r,knockoutAlpha:l})}finally{if(a.restore(),this.#n--,!r)this.canvasFactory.destroy(n)}}compose(e){if(!this.current.activeSMask)return;e=e?[Math.floor(e[0]),Math.floor(e[1]),Math.ceil(e[2]),Math.ceil(e[3])]:[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let n=this.current.activeSMask,i=this.suspendedCtx,s=this.#n>0&&i===this.ctx;if(this.composeSMask(s?null:i,n,this.ctx,e),s)return;this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(e,n,i,s){let a=s[0],r=s[1],l=s[2]-a,c=s[3]-r;if(l===0||c===0)return;let p=this.smaskPreparedEntry;if(p){let m=a,g=r,y=l,x=c,j=this.smaskPreparedOOBAlpha,I=j!==null;if(I){m=Math.max(a,n.offsetX),g=Math.max(r,n.offsetY);let P=Math.min(a+l,n.offsetX+n.canvas.width),X=Math.min(r+c,n.offsetY+n.canvas.height);y=P-m,x=X-g}if(y>0&&x>0){let P=m-this.smaskPreparedOffsetX,X=g-this.smaskPreparedOffsetY;i.save(),i.globalAlpha=1,i.setTransform(1,0,0,1,0,0);let Y=new Path2D;Y.rect(m,g,y,x),i.clip(Y),i.globalCompositeOperation="destination-in",i.drawImage(p.canvas,P,X,y,x,m,g,y,x),i.restore()}if(I&&j<255)this._applySMaskOOBAlpha(i,a,r,l,c,m,g,m+y,g+x,j)}else this.genericComposeSMask(n,i,l,c,a,r);if(!e)return;e.save(),e.globalAlpha=1,e.globalCompositeOperation=n.blendMode||"source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(i.canvas,a,r,l,c,a,r,l,c),e.restore()}_applySMaskOOBAlpha(e,n,i,s,a,r,l,c,p,m){let g=r<c&&l<p;if(g&&r===n&&l===i&&c===n+s&&p===i+a)return;let y=new Path2D;if(y.rect(n,i,s,a),g)y.rect(r,l,c-r,p-l);e.save(),e.globalAlpha=m/255,e.setTransform(1,0,0,1,0,0),e.clip(y,"evenodd"),e.globalCompositeOperation="destination-in",e.fillStyle="#000000",e.fillRect(n,i,s,a),e.restore()}genericComposeSMask(e,n,i,s,a,r){let{context:l,offsetX:c,offsetY:p}=e;n.save(),n.globalAlpha=1,n.setTransform(1,0,0,1,0,0);let m=new Path2D;m.rect(a,r,i,s),n.clip(m),n.globalCompositeOperation="destination-in",n.drawImage(l.canvas,a-c,r-p,i,s,a,r,i,s),n.restore()}save(e){if(this.inSMaskMode)Sh(this.ctx,this.suspendedCtx);this.ctx.save();let n=this.current;this.stateStack.push(n),this.current=n.clone(),this.dependencyTracker?.save(e)}restore(e){if(this.dependencyTracker?.restore(e),this.stateStack.length===0){if(this.inSMaskMode)this.endSMaskMode();return}if(this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode)Sh(this.suspendedCtx,this.ctx),this.ctx.setTransform(this.suspendedCtx.getTransform());this.checkSMaskState(e),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(e,n,i,s,a,r,l){this.dependencyTracker?.recordIncrementalData("transform",e),this.ctx.transform(n,i,s,a,r,l),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,n,i,s){let[a]=i;if(!s){if(a||=i[0]=new Path2D,n!==Xo.stroke&&n!==Xo.closeStroke)this.current.tilingPatternDims=null;this[n](e,a);return}if(this.dependencyTracker!==null){let l=n===Xo.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(e).recordBBox(e,this.ctx,s[0]-l,s[2]+l,s[1]-l,s[3]+l).recordDependencies(e,["transform"])}if(!(a instanceof Path2D))a=i[0]=rT(a);It.axialAlignedBoundingBox(s,bi(this.ctx),this.current.minMax);let r=this.current.tilingPatternDims;if(r&&n!==Xo.stroke&&n!==Xo.closeStroke&&this.current.fillColor instanceof nm){let l=It.intersect(this.current.clipBox,this.current.minMax);if(!l)this.current.tilingPatternDims=null;else this.current.fillColor.updatePatternDims(l,r)}this[n](e,a),this._pathStartIdx=e}closePath(e){this.ctx.closePath()}stroke(e,n,i=!0){let s=i&&this.#p(this.current.strokeAlpha),a=this.ctx,r=this.current.strokeColor;if(a.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof r==="object"&&r?.getPattern){let l=r.isModifyingCurrentTransform()?a.getTransform():null;if(a.save(),a.strokeStyle=r.getPattern(a,this,zo(a),Gs.STROKE,e),l){let c=new Path2D;c.addPath(n,a.getTransform().invertSelf().multiplySelf(l)),n=c}this.rescaleAndStroke(n,!1),a.restore()}else this.rescaleAndStroke(n,!0);if(this.dependencyTracker?.recordDependencies(e,Mr.stroke),i)this.consumePath(e,n,this.current.getClippedPathBoundingBox(Gs.STROKE,bi(this.ctx)));a.globalAlpha=this.current.fillAlpha,this.#b(s)}closeStroke(e,n){this.stroke(e,n)}fill(e,n,i=!0){let s=i&&this.#p(this.current.fillAlpha),a=this.ctx,r=this.current.fillColor,l=this.current.patternFill,c=!1,p=this.current.getClippedPathBoundingBox();if(this.dependencyTracker?.recordDependencies(e,Mr.fill),l){let m=this.current.tilingPatternDims,g=m&&r.canSkipPatternCanvas(m);if(g){if(r.drawPattern(this,n,this.pendingEOFill,g,e),this.pendingEOFill=!1,i)this.consumePath(e,n,p);this.current.tilingPatternDims=null,this.#b(s);return}let y=r.isModifyingCurrentTransform()?a.getTransform():null;if(this.dependencyTracker?.save(e),a.save(),a.fillStyle=r.getPattern(a,this,zo(a),Gs.FILL,e),y){let x=new Path2D;x.addPath(n,a.getTransform().invertSelf().multiplySelf(y)),n=x}c=!0}if(this.contentVisible&&p!==null)if(this.pendingEOFill)a.fill(n,"evenodd"),this.pendingEOFill=!1;else a.fill(n);if(c)a.restore(),this.dependencyTracker?.restore(e);if(i)this.consumePath(e,n,p);this.#b(s)}eoFill(e,n){this.pendingEOFill=!0,this.fill(e,n)}fillStroke(e,n){let i=this.#p(Math.min(this.current.fillAlpha,this.current.strokeAlpha));this.fill(e,n,!1),this.stroke(e,n,!1),this.consumePath(e,n),this.#b(i)}eoFillStroke(e,n){this.pendingEOFill=!0,this.fillStroke(e,n)}closeFillStroke(e,n){this.fillStroke(e,n)}closeEOFillStroke(e,n){this.pendingEOFill=!0,this.fillStroke(e,n)}endPath(e,n){this.consumePath(e,n)}rawFillPath(e,n){let i=this.#p(this.current.fillAlpha);this.ctx.fill(n),this.dependencyTracker?.recordDependencies(e,Mr.rawFillPath).recordOperation(e),this.#b(i)}clip(e){this.dependencyTracker?.recordFutureForcedDependency("clipMode",e),this.pendingClip=gL}eoClip(e){this.dependencyTracker?.recordFutureForcedDependency("clipMode",e),this.pendingClip=Xk}beginText(e){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,this.dependencyTracker?.recordOpenMarker(e).resetIncrementalData("sameLineText").resetIncrementalData("moveText",e)}endText(e){let n=this.pendingTextPaths,i=this.ctx;if(this.dependencyTracker){let{dependencyTracker:s}=this;if(n!==void 0)s.recordFutureForcedDependency("textClip",s.getOpenMarker()).recordFutureForcedDependency("textClip",e);s.recordCloseMarker(e)}if(n!==void 0){let s=new Path2D,a=i.getTransform().invertSelf();for(let{transform:r,x:l,y:c,fontSize:p,path:m}of n){if(!m)continue;s.addPath(m,new DOMMatrix(r).preMultiplySelf(a).translate(l,c).scale(p,-p))}i.clip(s)}delete this.pendingTextPaths}setCharSpacing(e,n){this.dependencyTracker?.recordSimpleData("charSpacing",e),this.current.charSpacing=n}setWordSpacing(e,n){this.dependencyTracker?.recordSimpleData("wordSpacing",e),this.current.wordSpacing=n}setHScale(e,n){this.dependencyTracker?.recordSimpleData("hScale",e),this.current.textHScale=n/100}setLeading(e,n){this.dependencyTracker?.recordSimpleData("leading",e),this.current.leading=-n}setFont(e,n,i){this.dependencyTracker?.recordSimpleData("font",e).recordSimpleDataFromNamed("fontObj",n,e);let s=this.commonObjs.get(n),a=this.current;if(!s)throw Error(`Can't find font for ${n}`);if(a.fontMatrix=s.fontMatrix||K3,a.fontMatrix[0]===0||a.fontMatrix[3]===0)yn("Invalid font matrix for font "+n);if(i<0)i=-i,a.fontDirection=-1;else a.fontDirection=1;if(this.current.font=s,this.current.fontSize=i,s.isType3Font)return;let r=s.loadedName||"sans-serif",l=s.systemFontInfo?.css||`"${r}", ${s.fallbackName}`,c="normal";if(s.black)c="900";else if(s.bold)c="bold";let p=s.italic?"italic":"normal",m=vi(i,hL,fL);this.current.fontSizeScale=i/m,this.ctx.font=`${p} ${c} ${m}px ${l}`}setTextRenderingMode(e,n){this.dependencyTracker?.recordSimpleData("textRenderingMode",e),this.current.textRenderingMode=n}setTextRise(e,n){this.dependencyTracker?.recordSimpleData("textRise",e),this.current.textRise=n}moveText(e,n,i){this.dependencyTracker?.resetIncrementalData("sameLineText").recordIncrementalData("moveText",e),this.current.x=this.current.lineX+=n,this.current.y=this.current.lineY+=i}setLeadingMoveText(e,n,i){this.setLeading(e,-i),this.moveText(e,n,i)}setTextMatrix(e,n){this.dependencyTracker?.resetIncrementalData("sameLineText").recordSimpleData("textMatrix",e);let{current:i}=this;i.textMatrix=n,i.textMatrixScale=Math.hypot(n[0],n[1]),i.x=i.lineX=0,i.y=i.lineY=0}nextLine(e){this.moveText(e,0,this.current.leading),this.dependencyTracker?.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??e)}#w(e,n,i){let s=new Path2D;return s.addPath(e,new DOMMatrix(i).invertSelf().multiplySelf(n)),s}paintChar(e,n,i,s,a,r){let l=this.ctx,c=this.current,{font:p,textRenderingMode:m}=c,g=c.fontSize/c.fontSizeScale,y=m&as.FILL_STROKE_MASK,x=!!(m&as.ADD_TO_PATH_FLAG),j=c.patternFill&&!p.missingFile,I=c.patternStroke&&!p.missingFile,P;if((p.disableFontFace||x||j||I)&&!p.missingFile)P=p.getPathGenerator(this.commonObjs,n);if(P&&(p.disableFontFace||j||I)){l.save(),l.translate(i,s),l.scale(g,-g),this.dependencyTracker?.recordCharacterBBox(e,l,p);let X;if(y===as.FILL||y===as.FILL_STROKE)if(a){X=l.getTransform(),l.setTransform(...a);let Y=this.#w(P,X,a);l.fill(Y)}else l.fill(P);if(y===as.STROKE||y===as.FILL_STROKE)if(r){X||=l.getTransform(),l.setTransform(...r);let{a:Y,b:J,c:ne,d:ae}=X,se=It.inverseTransform(r),oe=It.transform([Y,J,ne,ae,0,0],se);It.singularValueDecompose2dScale(oe,or),l.lineWidth*=Math.max(or[0],or[1])/g,l.stroke(this.#w(P,X,r))}else l.lineWidth/=g,l.stroke(P);l.restore()}else{if(y===as.FILL||y===as.FILL_STROKE)l.fillText(n,i,s),this.dependencyTracker?.recordCharacterBBox(e,l,p,g,i,s,()=>l.measureText(n));if(y===as.STROKE||y===as.FILL_STROKE){if(this.dependencyTracker)this.dependencyTracker?.recordCharacterBBox(e,l,p,g,i,s,()=>l.measureText(n)).recordDependencies(e,Mr.stroke);l.strokeText(n,i,s)}}if(x)(this.pendingTextPaths||=[]).push({transform:bi(l),x:i,y:s,fontSize:g,path:P}),this.dependencyTracker?.recordCharacterBBox(e,l,p,g,i,s)}get isFontSubpixelAAEnabled(){let e=this.canvasFactory.create(10,10),n=e.context;n.scale(1.5,1),n.fillText("I",0,10);let i=n.getImageData(0,0,10,10).data;this.canvasFactory.destroy(e);let s=!1;for(let a=3;a<i.length;a+=4)if(i[a]>0&&i[a]<255){s=!0;break}return en(this,"isFontSubpixelAAEnabled",s)}showText(e,n){if(this.dependencyTracker){if(this.dependencyTracker.recordDependencies(e,Mr.showText).resetBBox(e),this.current.textRenderingMode&as.ADD_TO_PATH_FLAG)this.dependencyTracker.recordFutureForcedDependency("textClip",e).inheritPendingDependenciesAsFutureForcedDependencies()}let i=this.current,s=i.font;if(s.isType3Font){let Pe=this.#p(i.fillAlpha);this.showType3Text(e,n),this.dependencyTracker?.recordShowTextOperation(e),this.#b(Pe);return}let a=i.fontSize;if(a===0){this.dependencyTracker?.recordOperation(e);return}let r=this.#p(i.fillAlpha),l=this.ctx,{fontSizeScale:c,charSpacing:p,wordSpacing:m,fontDirection:g}=i,y=i.textHScale*g,x=n.length,j=s.vertical,I=j?1:-1,P=s.defaultVMetrics,X=a*i.fontMatrix[0],Y=i.textRenderingMode===as.FILL&&!s.disableFontFace&&!i.patternFill;if(l.save(),i.textMatrix)l.transform(...i.textMatrix);if(l.translate(i.x,i.y+i.textRise),g>0)l.scale(y,-1);else l.scale(y,1);let J,ne,ae=i.textRenderingMode&as.FILL_STROKE_MASK,se=ae===as.FILL||ae===as.FILL_STROKE,oe=ae===as.STROKE||ae===as.FILL_STROKE,{lineWidth:he,textMatrixScale:we}=i;if(we===0||he===0){if(oe)he=this.getSinglePixelWidth()}else he/=we;if(c!==1)l.scale(c,c),he/=c;if(l.lineWidth=he,se&&i.patternFill){l.save();let Pe=i.fillColor.getPattern(l,this,zo(l),Gs.FILL,e);J=bi(l),l.restore(),l.fillStyle=Pe}if(oe&&i.patternStroke){l.save();let Pe=i.strokeColor.getPattern(l,this,zo(l),Gs.STROKE,e);ne=bi(l),l.restore(),l.strokeStyle=Pe}if(s.isInvalidPDFjsFont){let Pe=[],Ue=0;for(let He of n)Pe.push(He.unicode),Ue+=He.width;let ze=Pe.join("");if(l.fillText(ze,0,0),this.dependencyTracker!==null){let He=l.measureText(ze);this.dependencyTracker.recordBBox(e,this.ctx,-He.actualBoundingBoxLeft,He.actualBoundingBoxRight,-He.actualBoundingBoxAscent,He.actualBoundingBoxDescent).recordShowTextOperation(e)}i.x+=Ue*X*y,l.restore(),this.compose(),this.#b(r);return}let Ce=0,Ne;for(Ne=0;Ne<x;++Ne){let Pe=n[Ne];if(typeof Pe==="number"){Ce+=I*Pe*a/1000;continue}let Ue=!1,ze=(Pe.isSpace?m:0)+p,{fontChar:He,accent:De}=Pe,Fe,bt,Ve=Pe.width;if(j){let ct=Pe.vmetric||P,Ze=-(Pe.vmetric?ct[1]:Ve*0.5)*X,mt=ct[2]*X;Ve=ct?-ct[0]:Ve,Fe=Ze/c,bt=(Ce+mt)/c}else Fe=Ce/c,bt=0;let $e;if(s.remeasure&&Ve>0){$e=l.measureText(He);let ct=$e.width*1000/a*c;if(Ve<ct&&this.isFontSubpixelAAEnabled){let Ze=Ve/ct;Ue=!0,l.save(),l.scale(Ze,1),Fe/=Ze}else if(Ve!==ct)Fe+=(Ve-ct)/2000*a/c}if(this.contentVisible&&(Pe.isInFont||s.missingFile)){if(Y&&!De)l.fillText(He,Fe,bt),this.dependencyTracker?.recordCharacterBBox(e,l,$e?{bbox:null}:s,a/c,Fe,bt,()=>$e??l.measureText(He));else if(this.paintChar(e,He,Fe,bt,J,ne),De){let ct=Fe+a*De.offset.x/c,Ze=bt-a*De.offset.y/c;this.paintChar(e,De.fontChar,ct,Ze,J,ne)}}let Ct=j?Ve*X-ze*g:Ve*X+ze*g;if(Ce+=Ct,Ue)l.restore()}if(j)i.y-=Ce;else i.x+=Ce*y;l.restore(),this.compose(),this.dependencyTracker?.recordShowTextOperation(e),this.#b(r)}showType3Text(e,n){let i=this.ctx,s=this.current,{font:a,fontSize:r,fontDirection:l}=s,c=a.vertical?1:-1,{charSpacing:p,wordSpacing:m}=s,g=s.textHScale*l,y=s.fontMatrix||K3,x=n.length,j=s.textRenderingMode===as.INVISIBLE,I,P,X,Y;if(j||r===0)return;if(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,i.save(),s.textMatrix)i.transform(...s.textMatrix);i.translate(s.x,s.y+s.textRise),i.scale(g,l);let J=this.dependencyTracker;this.dependencyTracker=J?new rm(J,e):null;for(I=0;I<x;++I){if(P=n[I],typeof P==="number"){Y=c*P*r/1000,this.ctx.translate(Y,0),s.x+=Y*g;continue}let ne=(P.isSpace?m:0)+p,ae=a.charProcOperatorList.get(P.operatorListId);if(!ae)yn(`Type3 character "${P.operatorListId}" is not available.`);else if(this.contentVisible){if(this.save(),ae.fnArray[0]===Xo.setCharWidth)s.fillAlpha=s.strokeAlpha=1,i.globalAlpha=1;i.scale(r,r),i.transform(...y),this.executeOperatorList(ae),this.restore()}let se=[P.width,0];It.applyTransform(se,y),X=se[0]*r+ne,i.translate(X,0),s.x+=X*g}if(i.restore(),J)this.dependencyTracker=J}setCharWidth(e,n,i){}setCharWidthAndBounds(e,n,i,s,a,r,l){let c=new Path2D;c.rect(s,a,r-s,l-a),this.ctx.clip(c),this.dependencyTracker?.recordBBox(e,this.ctx,s,r,a,l).recordClipBox(e,this.ctx,s,r,a,l),this.endPath(e)}getColorN_Pattern(e,n){let i;if(n[0]==="TilingPattern"){let s=this.baseTransform||bi(this.ctx),a={createCanvasGraphics:(r,l)=>new Ah(r,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new rm(this.dependencyTracker,l,!0):null)};i=new nm(n,this.ctx,a,s)}else i=this._getPattern(e,n[1],n[2]);return i}setStrokeColorN(e,...n){this.dependencyTracker?.recordSimpleData("strokeColor",e),this.current.strokeColor=this.getColorN_Pattern(e,n),this.current.patternStroke=!0}setFillColorN(e,...n){this.dependencyTracker?.recordSimpleData("fillColor",e);let i=this.current.fillColor=this.getColorN_Pattern(e,n);this.current.patternFill=!0,this.current.tilingPatternDims=i instanceof nm?[0,0,0,0]:null}setStrokeRGBColor(e,n){this.dependencyTracker?.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor=n,this.current.patternStroke=!1}setStrokeTransparent(e){this.dependencyTracker?.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e,n){this.dependencyTracker?.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor=n,this.current.patternFill=!1,this.current.tilingPatternDims=null}setFillTransparent(e){this.dependencyTracker?.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1,this.current.tilingPatternDims=null}_getPattern(e,n,i=null){let s=this.cachedPatterns.getOrInsertComputed(n,()=>uL(this.getObject(e,n)));if(i)s.matrix=i;return s}shadingFill(e,n){if(!this.contentVisible)return;let i=this.#p(this.current.fillAlpha),s=this.ctx;this.save(e);let a=this._getPattern(e,n);s.fillStyle=a.getPattern(s,this,zo(s),Gs.SHADING,e);let r=zo(s);if(r){let{width:l,height:c}=s.canvas,p=kh.slice();It.axialAlignedBoundingBox([0,0,l,c],r,p);let[m,g,y,x]=p;this.ctx.fillRect(m,g,y-m,x-g)}else this.ctx.fillRect(-10000000000,-10000000000,20000000000,20000000000);this.dependencyTracker?.resetBBox(e).recordFullPageBBox(e).recordDependencies(e,Mr.transform).recordDependencies(e,Mr.fill).recordOperation(e),this.compose(this.current.getClippedPathBoundingBox()),this.restore(e),this.#b(i)}beginInlineImage(){Un("Should not call beginInlineImage")}beginImageData(){Un("Should not call beginImageData")}paintFormXObjectBegin(e,n,i){if(!this.contentVisible)return;if(this.save(e),this.baseTransformStack.push(this.baseTransform),n)this.transform(e,...n);if(this.baseTransform=bi(this.ctx),i){It.axialAlignedBoundingBox(i,this.baseTransform,this.current.minMax);let[s,a,r,l]=i,c=new Path2D;c.rect(s,a,r-s,l-a),this.ctx.clip(c),this.dependencyTracker?.recordClipBox(e,this.ctx,s,r,a,l),this.endPath(e)}}paintFormXObjectEnd(e){if(!this.contentVisible)return;this.restore(e),this.baseTransform=this.baseTransformStack.pop()}beginGroup(e,n){if(!this.contentVisible)return;this.save(e);let{inSMaskMode:i}=this;if(i)this.endSMaskMode(),this.current.activeSMask=null;let s=this.ctx;if((!n.needsIsolation||!n.isolated&&!n.hasSoftMask)&&!n.knockout&&!n.isGray&&this.#t===0&&s.globalAlpha===1&&s.globalCompositeOperation==="source-over"&&!i){if(n.bbox){let ne=new Path2D,[ae,se,oe,he]=n.bbox;if(ne.rect(ae,se,oe-ae,he-se),n.matrix){let we=new Path2D;we.addPath(ne,new DOMMatrix(n.matrix)),ne=we}s.clip(ne)}this.groupStack.push(null),this.#f.push(null),this.groupLevel++;return}if(!n.isolated&&!n.knockout&&this.#t===0)b2("TODO: Fully support non-isolated non-knockout groups.");let a=bi(s);if(n.matrix)s.transform(...n.matrix);let r=[0,0,s.canvas.width,s.canvas.height],l;if(n.bbox)l=kh.slice(),It.axialAlignedBoundingBox(n.bbox,bi(s),l),l=It.intersect(l,r)||[0,0,0,0];else l=r;let c=Math.floor(l[0]),p=Math.floor(l[1]),m=Math.max(Math.ceil(l[2])-c,1),g=Math.max(Math.ceil(l[3])-p,1);this.current.startNewPathAndClipBox([0,0,m,g]);let y=this.canvasFactory.create(m,g);if(n.smask)this.smaskGroupCanvases.push(y);let x=y.context,j=n.knockout&&!n.isolated?s:null,I=!n.isolated&&!n.knockout&&!n.smask&&n.needsIsolation&&this.#t>0,P=n.knockout?this.canvasFactory.create(m,g):null,X=this.#t;if(n.knockout)this.#t++;else this.#t=0;x.translate(-c,-p),x.transform(...a);let Y=!n.isolated&&!n.smask&&n.needsIsolation,J=Y&&!i&&X===0&&!n.knockout&&!n.isGray&&n.hasSoftMask&&s.globalAlpha===1&&s.globalCompositeOperation==="source-over"&&this.current.transferMaps==="none";if(Y&&(i||J))x.save(),x.setTransform(1,0,0,1,0,0),x.drawImage(s.canvas,-c,-p),x.restore();if(n.bbox){let ne=new Path2D,[ae,se,oe,he]=n.bbox;if(ne.rect(ae,se,oe-ae,he-se),n.matrix){let we=new Path2D;we.addPath(ne,new DOMMatrix(n.matrix)),ne=we}x.clip(ne)}if(n.smask)this.smaskStack.push({canvas:y.canvas,context:x,offsetX:c,offsetY:p,subtype:n.smask.subtype,backdrop:n.smask.backdrop,transferMap:n.smask.transferMap||null});if(!n.smask||this.dependencyTracker)s.setTransform(1,0,0,1,0,0),s.translate(c,p),s.save();Sh(s,x),this.ctx=x,this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(s),this.setGState(e,[["BM","source-over"],["ca",1],["CA",1],["TR",null]]),this.groupStack.push(s),this.#f.push({backdropCtx:j,savedKnockoutLevel:X,offsetX:c,offsetY:p,hasInnerBackdrop:I,replaceBackdrop:J,knockoutMaskEntry:P,knockoutTempEntry:null,knockoutBackdropEntry:null}),this.groupLevel++}endGroup(e,n){if(!this.contentVisible)return;this.groupLevel--;let i=this.ctx,s=this.groupStack.pop(),a=this.#f.pop();if(a)this.#t=a.savedKnockoutLevel;if(s===null){this.restore(e);return}if(n.isGray)this.#y(i);if(this.ctx=s,this.ctx.imageSmoothingEnabled=!1,this.dependencyTracker?.popBaseTransform(),n.smask){if(this.tempSMask=this.smaskStack.pop(),this.restore(e),this.dependencyTracker){if(this.ctx.restore(),this.inSMaskMode)this.ctx.setTransform(this.suspendedCtx.getTransform())}this.#v(a)}else{this.ctx.restore();let r=bi(this.ctx);this.restore(e),this.ctx.save(),this.ctx.setTransform(...r);let l=kh.slice();It.axialAlignedBoundingBox([0,0,i.canvas.width,i.canvas.height],r,l);let c=this.#f.at(-1);if(this.#t>0)if(a.hasInnerBackdrop){let{width:p,height:m}=i.canvas,g=this.canvasFactory.create(p,m),y=g.context;y.drawImage(s.canvas,a.offsetX,a.offsetY,p,m,0,0,p,m),y.globalCompositeOperation="source-over",y.drawImage(i.canvas,0,0);let x=this.#m(i.canvas);y.globalCompositeOperation="destination-in",y.drawImage(x.canvas,0,0);let j=this.ctx.globalCompositeOperation,I=this.ctx.globalAlpha,P=this.ctx.filter;if(this.ctx.save(),this.ctx.setTransform(...r),this.ctx.globalAlpha=1,ai.isCanvasFilterSupported)this.ctx.filter="none";if(this.ctx.globalCompositeOperation="destination-out",this.ctx.drawImage(x.canvas,0,0),this.ctx.globalCompositeOperation=j,this.ctx.globalAlpha=I,ai.isCanvasFilterSupported)this.ctx.filter=P??"none";this.ctx.drawImage(g.canvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(x),this.canvasFactory.destroy(g)}else{let p=c?.backdropCtx??null;this.#u(this.ctx,i.canvas,{backdropCanvas:p?.canvas??null,destTransform:r,backdropOffset:p?[c.offsetX+a.offsetX,c.offsetY+a.offsetY]:[0,0],sourceAlpha:this.ctx.globalAlpha,sourceFilter:this.ctx.filter})}else{if(a.replaceBackdrop){let p=new Path2D;p.rect(0,0,i.canvas.width,i.canvas.height),this.ctx.clip(p),this.ctx.globalCompositeOperation="copy"}this.ctx.drawImage(i.canvas,0,0)}this.ctx.restore(),this.canvasFactory.destroy({canvas:i.canvas,context:i}),this.#v(a),this.compose(l)}}#y(e){let{canvas:n}=e,{width:i,height:s}=n;if(ai.isCanvasFilterSupported){e.save(),e.setTransform(1,0,0,1,0,0),e.filter="grayscale(1)",e.globalAlpha=1,e.globalCompositeOperation="copy",e.drawImage(n,0,0),e.restore();return}let a=e.getImageData(0,0,i,s),{data:r}=a;for(let l=0,c=r.length;l<c;l+=4){let p=r[l]*0.2126+r[l+1]*0.7152+r[l+2]*0.0722+0.5|0;r[l]=r[l+1]=r[l+2]=p}e.putImageData(a,0,0)}#v(e){if(!e)return;if(e.knockoutMaskEntry)this.canvasFactory.destroy(e.knockoutMaskEntry),e.knockoutMaskEntry=null;if(e.knockoutTempEntry)this.canvasFactory.destroy(e.knockoutTempEntry),e.knockoutTempEntry=null;if(e.knockoutBackdropEntry)this.canvasFactory.destroy(e.knockoutBackdropEntry),e.knockoutBackdropEntry=null}beginAnnotation(e,n,i,s,a,r,l){if(this.#h(),Yb(this.ctx),this.ctx.save(),this.save(e),this.baseTransform)this.ctx.setTransform(...this.baseTransform);if(i){let c=i[2]-i[0],p=i[3]-i[1];if(r&&this.annotationCanvasMap){s=s.slice(),s[4]-=i[0],s[5]-=i[1],It.singularValueDecompose2dScale(bi(this.ctx),or);let{viewportScale:m}=this,g=Math.ceil(c*this.outputScaleX*m),y=Math.ceil(p*this.outputScaleY*m);this.annotationCanvas=this.canvasFactory.create(g,y);let{canvas:x,context:j}=this.annotationCanvas;if(l){let I=this.annotationCanvasMap.getOrInsertComputed(n,Rd);x.setAttribute("data-canvas-name",l);let P=I.findIndex((X)=>X.getAttribute("data-canvas-name")===l);if(P===-1)I.push(x);else I[P]=x}else this.annotationCanvasMap.set(n,x);this.annotationCanvas.savedCtx=this.ctx,this.ctx=j,this.ctx.save(),this.ctx.setTransform(or[0],0,0,-or[1],0,p*or[1]),Yb(this.ctx)}else{Yb(this.ctx),this.endPath(e);let m=new Path2D;m.rect(i[0],i[1],c,p),this.ctx.clip(m)}}this.current=new s9(this.ctx.canvas.width,this.ctx.canvas.height),this.baseTransformStack.push(this.baseTransform),this.transform(e,...s),this.transform(e,...a),this.baseTransform=bi(this.ctx)}endAnnotation(e){if(this.annotationCanvas)this.ctx.restore(),this.#d(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas;this.baseTransform=this.baseTransformStack.pop()}paintImageMaskXObject(e,n){if(!this.contentVisible)return;let i=n.count;n=this.getObject(e,n.data,n),n.count=i;let s=this.#p(this.current.fillAlpha),a=this.ctx,r=this._createMaskCanvas(e,n),l=r.canvas;if(a.save(),a.setTransform(1,0,0,1,0,0),a.drawImage(l,r.offsetX,r.offsetY),this.dependencyTracker?.resetBBox(e).recordBBox(e,this.ctx,r.offsetX,r.offsetX+l.width,r.offsetY,r.offsetY+l.height).recordOperation(e),a.restore(),r.canvasEntry)this.canvasFactory.destroy(r.canvasEntry);this.compose(),this.#b(s)}paintImageMaskXObjectRepeat(e,n,i,s=0,a=0,r,l){if(!this.contentVisible)return;n=this.getObject(e,n.data,n);let c=this.#p(this.current.fillAlpha),p=this.ctx;p.save();let m=bi(p);p.transform(i,s,a,r,0,0);let g=this._createMaskCanvas(e,n);p.setTransform(1,0,0,1,g.offsetX-m[4],g.offsetY-m[5]),this.dependencyTracker?.resetBBox(e);for(let y=0,x=l.length;y<x;y+=2){let j=It.transform(m,[i,s,a,r,l[y],l[y+1]]);p.drawImage(g.canvas,j[4],j[5]),this.dependencyTracker?.recordBBox(e,this.ctx,j[4],j[4]+g.canvas.width,j[5],j[5]+g.canvas.height)}if(p.restore(),g.canvasEntry)this.canvasFactory.destroy(g.canvasEntry);this.compose(),this.dependencyTracker?.recordOperation(e),this.#b(c)}paintImageMaskXObjectGroup(e,n){if(!this.contentVisible)return;let i=this.#p(this.current.fillAlpha),s=this.ctx,a=this.current.fillColor,r=this.current.patternFill;this.dependencyTracker?.resetBBox(e).recordDependencies(e,Mr.transformAndFill);for(let l of n){let{data:c,width:p,height:m,transform:g}=l,y=this.canvasFactory.create(p,m),x=y.context;x.save();let j=this.getObject(e,c,l);Gk(x,j),x.globalCompositeOperation="source-in",x.fillStyle=r?a.getPattern(x,this,zo(s),Gs.FILL,e):a,x.fillRect(0,0,p,m),x.restore(),s.save(),s.transform(...g),s.scale(1,-1),Kb(s,y.canvas,0,0,p,m,0,-1,1,1),this.canvasFactory.destroy(y),this.dependencyTracker?.recordBBox(e,s,0,p,0,m),s.restore()}this.compose(),this.dependencyTracker?.recordOperation(e),this.#b(i)}paintImageXObject(e,n){if(!this.contentVisible)return;let i=this.getObject(e,n);if(!i){yn("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e,i)}paintImageXObjectRepeat(e,n,i,s,a){if(!this.contentVisible)return;let r=this.getObject(e,n);if(!r){yn("Dependent image isn't ready yet");return}let{width:l,height:c}=r,p=[];for(let m=0,g=a.length;m<g;m+=2)p.push({transform:[i,0,0,s,a[m],a[m+1]],x:0,y:0,w:l,h:c});this.paintInlineImageXObjectGroup(e,r,p)}applyTransferMapsToCanvas(e){if(this.current.transferMaps!=="none")e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none";return e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps==="none")return{img:e.bitmap,canvasEntry:null};let{bitmap:n,width:i,height:s}=e,a=this.canvasFactory.create(i,s),r=a.context;return r.filter=this.current.transferMaps,r.drawImage(n,0,0),r.filter="none",{img:a.canvas,canvasEntry:a}}paintInlineImageXObject(e,n){if(!this.contentVisible)return;let{width:i,height:s}=n,a=this.#p(this.current.fillAlpha),r=this.ctx;this.save(e);let{filter:l}=r;if(l!=="none"&&l!=="")r.filter="none";r.scale(1/i,-1/s);let c,p=null;if(n.bitmap){let g=this.applyTransferMapsToBitmap(n);c=g.img,p=g.canvasEntry}else{let g=this.canvasFactory.create(i,s);zk(g.context,n),c=this.applyTransferMapsToCanvas(g.context),p=g}let m=this._scaleImage(c,zo(r));if(r.imageSmoothingEnabled=Vk(bi(r),n.interpolate),this.dependencyTracker)this.dependencyTracker.resetBBox(e).recordBBox(e,r,0,i,-s,0).recordDependencies(e,Mr.imageXObject).recordOperation(e),this.imagesTracker?.record(r,i,s,this.dependencyTracker.clipBox);if(Kb(r,m.img,0,0,m.paintWidth,m.paintHeight,0,-s,i,s),m.tmpCanvas)this.canvasFactory.destroy(m.tmpCanvas);if(p)this.canvasFactory.destroy(p);this.compose(),this.restore(e),this.#b(a)}paintInlineImageXObjectGroup(e,n,i){if(!this.contentVisible)return;let s=this.#p(this.current.fillAlpha),a=this.ctx,r,l=null;if(n.bitmap)r=n.bitmap;else{let{width:c,height:p}=n,m=this.canvasFactory.create(c,p);zk(m.context,n),r=this.applyTransferMapsToCanvas(m.context),l=m}this.dependencyTracker?.resetBBox(e);for(let c of i)a.save(),a.transform(...c.transform),a.scale(1,-1),Kb(a,r,c.x,c.y,c.w,c.h,0,-1,1,1),this.dependencyTracker?.recordBBox(e,a,0,1,-1,0),a.restore();if(l)this.canvasFactory.destroy(l);this.dependencyTracker?.recordOperation(e),this.compose(),this.#b(s)}paintSolidColorImageMask(e){if(!this.contentVisible)return;let n=this.#p(this.current.fillAlpha);this.dependencyTracker?.resetBBox(e).recordBBox(e,this.ctx,0,1,0,1).recordDependencies(e,Mr.fill).recordOperation(e),this.ctx.fillRect(0,0,1,1),this.compose(),this.#b(n)}markPoint(e,n){}markPointProps(e,n,i){}beginMarkedContent(e,n){this.dependencyTracker?.beginMarkedContent(e),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,n,i){if(this.dependencyTracker?.beginMarkedContent(e),n==="OC")this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(i)});else this.markedContentStack.push({visible:!0});this.contentVisible=this.isContentVisible()}endMarkedContent(e){this.dependencyTracker?.endMarkedContent(e),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(e){}endCompat(e){}consumePath(e,n,i){let s=this.current.isEmptyClip();if(this.pendingClip)this.current.updateClipFromPath();if(!this.pendingClip)this.compose(i);let a=this.ctx;if(this.pendingClip){if(!s)if(this.pendingClip===Xk)a.clip(n,"evenodd");else a.clip(n);this.pendingClip=null,this.dependencyTracker?.bboxToClipBoxDropOperation(e).recordFutureForcedDependency("clipPath",e)}else this.dependencyTracker?.recordOperation(e);this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let e=bi(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{let n=Math.abs(e[0]*e[3]-e[2]*e[1]),i=Math.hypot(e[0],e[2]),s=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(i,s)/n}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){let{lineWidth:e}=this.current,{a:n,b:i,c:s,d:a}=this.ctx.getTransform(),r,l;if(i===0&&s===0){let c=Math.abs(n),p=Math.abs(a);if(c===p)if(e===0)r=l=1/c;else{let m=c*e;r=l=m<1?1/m:1}else if(e===0)r=1/c,l=1/p;else{let m=c*e,g=p*e;r=m<1?1/m:1,l=g<1?1/g:1}}else{let c=Math.abs(n*a-i*s),p=Math.hypot(n,i),m=Math.hypot(s,a);if(e===0)r=m/c,l=p/c;else{let g=e*c;r=m>g?m/g:1,l=p>g?p/g:1}}this._cachedScaleForStroking[0]=r,this._cachedScaleForStroking[1]=l}return this._cachedScaleForStroking}rescaleAndStroke(e,n){let{ctx:i,current:{lineWidth:s}}=this,[a,r]=this.getScaleForStroking();if(a===r){i.lineWidth=(s||1)*a,i.stroke(e);return}let l=Ah.#e??=new DOMMatrix,c=i.getLineDash();if(n)i.save();i.scale(a,r),l.a=1/a,l.d=1/r;let p=new Path2D;if(p.addPath(e,l),c.length>0){let m=Math.max(a,r);i.setLineDash(c.map((g)=>g/m)),i.lineDashOffset/=m}if(i.lineWidth=s||1,i.stroke(p),n)i.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}for(let e in Xo)if(Ah.prototype[e]!==void 0)Ah.prototype[Xo[e]]=Ah.prototype[e];class dm{#e=null;#t=null;_fullReader=null;_rangeReaders=new Set;_source=null;constructor(e,n,i){this._source=e,this.#e=n,this.#t=i}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){return Fi(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new this.#e(this)}getRangeReader(e,n){if(n<=this._progressiveDataLength)return null;let i=new this.#t(this,e,n);return this._rangeReaders.add(i),i}cancelAllRequests(e){this._fullReader?.cancel(e);for(let n of new Set(this._rangeReaders))n.cancel(e)}}class pm{onProgress=null;_contentLength=0;_filename=null;_headersCapability=Promise.withResolvers();_isRangeSupported=!1;_isStreamingSupported=!1;_loaded=0;_stream=null;constructor(e){this._stream=e}_callOnProgress(){this.onProgress?.({loaded:this._loaded,total:this._contentLength})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){Un("Abstract method `read` called")}cancel(e){Un("Abstract method `cancel` called")}}class mm{_stream=null;constructor(e,n,i){this._stream=e}async read(){Un("Abstract method `read` called")}cancel(e){Un("Abstract method `cancel` called")}}function bL(e){let n=!0,i=s("filename\\*","i").exec(e);if(i){i=i[1];let g=c(i);return g=unescape(g),g=p(g),g=m(g),r(g)}if(i=l(e),i){let g=m(i);return r(g)}if(i=s("filename","i").exec(e),i){i=i[1];let g=c(i);return g=m(g),r(g)}function s(g,y){return new RegExp("(?:^|;)\\s*"+g+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',y)}function a(g,y){if(g){if(!/^[\x00-\xFF]+$/.test(y))return y;try{let x=new TextDecoder(g,{fatal:!0}),j=w2(y);y=x.decode(j),n=!1}catch{}}return y}function r(g){if(n&&/[\x80-\xff]/.test(g)){if(g=a("utf-8",g),n)g=a("iso-8859-1",g)}return g}function l(g){let y=[],x,j=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");while((x=j.exec(g))!==null){let[,P,X,Y]=x;if(P=parseInt(P,10),P in y){if(P===0)break;continue}y[P]=[X,Y]}let I=[];for(let P=0;P<y.length;++P){if(!(P in y))break;let[X,Y]=y[P];if(Y=c(Y),X){if(Y=unescape(Y),P===0)Y=p(Y)}I.push(Y)}return I.join("")}function c(g){if(g.startsWith('"')){let y=g.slice(1).split("\\\"");for(let x=0;x<y.length;++x){let j=y[x].indexOf('"');if(j!==-1)y[x]=y[x].slice(0,j),y.length=x+1;y[x]=y[x].replaceAll(/\\(.)/g,"$1")}g=y.join('"')}return g}function p(g){let y=g.indexOf("'");if(y===-1)return g;let x=g.slice(0,y),I=g.slice(y+1).replace(/^[^']*'/,"");return a(x,I)}function m(g){if(!g.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(g))return g;return g.replaceAll(/=\?([\w-]*)\?([QB])\?((?:[^?]|\?(?!=))*)\?=/gi,function(y,x,j,I){if(j==="q"||j==="Q")return I=I.replaceAll("_"," "),I=I.replaceAll(/=([0-9a-f]{2})/gi,function(P,X){return String.fromCharCode(parseInt(X,16))}),a(x,I);try{I=atob(I)}catch{}return a(x,I)})}return""}function OT(e,n){let i=new Headers;if(!e||!n||typeof n!=="object")return i;for(let s in n){let a=n[s];if(a!==void 0)i.append(s,a)}return i}function wL(e){let n=e.length;while(n>0&&e[n-1]!==" "&&/\s/.test(e[n-1]))n--;return e.slice(0,n)}function k2(e){return URL.parse(e)?.origin??null}function FT({responseHeaders:e,isHttp:n,rangeChunkSize:i,disableRange:s}){let a={contentLength:0,isRangeSupported:!1},r=parseInt(e.get("Content-Length"),10);if(!Number.isInteger(r))return a;if(a.contentLength=r,r<=2*i)return a;if(s||!n)return a;if(e.get("Accept-Ranges")!=="bytes")return a;if((e.get("Content-Encoding")||"identity")==="identity")a.isRangeSupported=!0;return a}function NT(e){let n=e.get("Content-Disposition");if(n){let i=bL(n);if(i.includes("%"))try{i=decodeURIComponent(i)}catch{}if(c9(i))return i}return null}function T2(e,n){return new im(`Unexpected server response (${e}) while retrieving PDF "${n.href}".`,e,e===404||e===0&&n.protocol==="file:")}function PT(e,n){if(e!==n)throw Error(`Expected range response-origin "${e}" to match "${n}".`)}function BT(e,n,i,s){return fetch(e,{method:"GET",headers:n,signal:s.signal,mode:"cors",credentials:i?"include":"same-origin",redirect:"follow"})}function LT(e,n){if(e!==200&&e!==206)throw T2(e,n)}function A2(e){if(e instanceof Uint8Array)return e.buffer;if(e instanceof ArrayBuffer)return e;throw Error(`getArrayBuffer - unexpected data: ${e}`)}class HT extends dm{_responseOrigin=null;constructor(e){super(e,UT,zT);let{httpHeaders:n,url:i}=e;Fi(/https?:/.test(i.protocol),"PDFFetchStream only supports http(s):// URLs."),this.headers=OT(!0,n)}}class UT extends pm{_abortController=new AbortController;_reader=null;constructor(e){super(e);let{disableRange:n,disableStream:i,rangeChunkSize:s,url:a,withCredentials:r}=e._source;this._isStreamingSupported=!i;let l=new Headers(e.headers);BT(a,l,r,this._abortController).then((c)=>{e._responseOrigin=k2(c.url),LT(c.status,a),this._reader=c.body.getReader();let p=c.headers,{contentLength:m,isRangeSupported:g}=FT({responseHeaders:p,isHttp:!0,rangeChunkSize:s,disableRange:n});if(this._contentLength=m,this._isRangeSupported=g,this._filename=NT(p),!this._isStreamingSupported&&this._isRangeSupported)this.cancel(new Vl("Streaming is disabled."));this._headersCapability.resolve()}).catch(this._headersCapability.reject)}async read(){await this._headersCapability.promise;let{value:e,done:n}=await this._reader.read();if(n)return{value:e,done:n};return this._loaded+=e.byteLength,this._callOnProgress(),{value:A2(e),done:!1}}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class zT extends mm{_abortController=new AbortController;_readCapability=Promise.withResolvers();_reader=null;constructor(e,n,i){super(e,n,i);let{url:s,withCredentials:a}=e._source,r=new Headers(e.headers);r.append("Range",`bytes=${n}-${i-1}`),BT(s,r,a,this._abortController).then((l)=>{let c=k2(l.url);PT(c,e._responseOrigin),LT(l.status,s),this._reader=l.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;let{value:e,done:n}=await this._reader.read();if(n)return{value:e,done:n};return{value:A2(e),done:!1}}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}function Wk(e){return e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer}function C2(){for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}class GT extends dm{_progressiveDone=!1;_queuedChunks=[];constructor(e){super(e,VT,XT);let{pdfDataRangeTransport:n}=e,{initialData:i,progressiveDone:s}=n;if(i?.length>0){let r=Wk(i);this._queuedChunks.push(r)}this._progressiveDone=s;let a=(r)=>{switch(r.type){case"range":case"progressiveRead":this.#e(r.begin,r.chunk);break;case"progressiveDone":this._fullReader?.progressiveDone(),this._progressiveDone=!0;break}};n.transportReady(a)}#e(e,n){let i=Wk(n);if(e===void 0)if(this._fullReader)this._fullReader._enqueue(i);else this._queuedChunks.push(i);else{let s=this._rangeReaders.keys().find((a)=>a._begin===e);Fi(s,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),s._enqueue(i)}}getFullReader(){let e=super.getFullReader();return this._queuedChunks=null,e}getRangeReader(e,n){let i=super.getRangeReader(e,n);if(i)i.onDone=()=>this._rangeReaders.delete(i),this._source.pdfDataRangeTransport.requestDataRange(e,n);return i}cancelAllRequests(e){super.cancelAllRequests(e),this._source.pdfDataRangeTransport.abort()}}class VT extends pm{#e=C2.bind(this);_done=!1;_queuedChunks=null;_requests=[];constructor(e){super(e);let{pdfDataRangeTransport:n,disableRange:i,disableStream:s}=e._source,{length:a,contentDispositionFilename:r}=n;this._queuedChunks=e._queuedChunks||[];for(let c of this._queuedChunks)this._loaded+=c.byteLength;if(this._done=e._progressiveDone,this._contentLength=a,this._isStreamingSupported=!s,this._isRangeSupported=!i,c9(r))this._filename=r;this._headersCapability.resolve();let l=this._loaded;Promise.resolve().then(()=>{if(l>0&&this._loaded===l)this._callOnProgress()})}_enqueue(e){if(this._done)return;if(this._requests.length>0)this._requests.shift().resolve({value:e,done:!1});else this._queuedChunks.push(e);this._loaded+=e.byteLength,this._callOnProgress()}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this.#e()}progressiveDone(){if(this._done||=!0,this._queuedChunks.length===0)this.#e()}}class XT extends mm{#e=C2.bind(this);onDone=null;_begin=-1;_done=!1;_queuedChunk=null;_requests=[];constructor(e,n,i){super(e,n,i);this._begin=n}_enqueue(e){if(this._done)return;if(this._requests.length===0)this._queuedChunk=e;else this._requests.shift().resolve({value:e,done:!1}),this.#e();this._done=!0,this.onDone?.()}async read(){if(this._queuedChunk){let n=this._queuedChunk;return this._queuedChunk=null,{value:n,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this.#e(),this.onDone?.()}}var W3=200,Kk=206;function yL(e){return typeof e!=="string"?e:w2(e).buffer}class WT extends dm{#e=new WeakMap;_responseOrigin=null;constructor(e){super(e,KT,$T);let{httpHeaders:n,url:i}=e;this.url=i,this.isHttp=/https?:/.test(i.protocol),this.headers=OT(this.isHttp,n)}_request(e){let n=new XMLHttpRequest,i={validateStatus:null,onHeadersReceived:e.onHeadersReceived,onDone:e.onDone,onError:e.onError,onProgress:e.onProgress};this.#e.set(n,i),n.open("GET",this.url),n.withCredentials=this._source.withCredentials;for(let[s,a]of this.headers)n.setRequestHeader(s,a);if(this.isHttp&&"begin"in e&&"end"in e)n.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),i.validateStatus=(s)=>s===Kk||s===W3;else i.validateStatus=(s)=>s===W3;return n.responseType="arraybuffer",Fi(e.onError,"Expected `onError` callback to be provided."),n.onerror=()=>e.onError(n.status),n.onreadystatechange=this.#n.bind(this,n),n.onprogress=this.#t.bind(this,n),n.send(null),n}#t(e,n){this.#e.get(e)?.onProgress?.(n)}#n(e,n){let i=this.#e.get(e);if(!i)return;if(e.readyState>=2&&i.onHeadersReceived)i.onHeadersReceived(),delete i.onHeadersReceived;if(e.readyState!==4)return;if(!this.#e.has(e))return;if(this.#e.delete(e),e.status===0&&this.isHttp){i.onError(e.status);return}let s=e.status||W3;if(!i.validateStatus(s)){i.onError(e.status);return}let a=yL(e.response);if(s===Kk){let r=e.getResponseHeader("Content-Range");if(/bytes \d+-\d+\/\d+/.test(r))i.onDone(a);else yn('Missing or invalid "Content-Range" header.'),i.onError(0)}else if(a)i.onDone(a);else i.onError(e.status)}_abortRequest(e){if(this.#e.has(e))this.#e.delete(e),e.abort()}getRangeReader(e,n){let i=super.getRangeReader(e,n);if(i)i.onClosed=()=>this._rangeReaders.delete(i);return i}}class KT extends pm{#e=C2.bind(this);_cachedChunks=[];_done=!1;_requests=[];_storedError=null;constructor(e){super(e);this._fullRequestXhr=e._request({onHeadersReceived:this.#t.bind(this),onDone:this.#n.bind(this),onError:this.#i.bind(this),onProgress:this.#s.bind(this)})}#t(){let e=this._stream,{disableRange:n,rangeChunkSize:i}=e._source,s=this._fullRequestXhr;e._responseOrigin=k2(s.responseURL);let a=s.getAllResponseHeaders(),r=new Headers(a?wL(a.trimStart()).split(/[\r\n]+/).map((p)=>{let[m,...g]=p.split(": ");return[m,g.join(": ")]}):[]),{contentLength:l,isRangeSupported:c}=FT({responseHeaders:r,isHttp:e.isHttp,rangeChunkSize:i,disableRange:n});if(this._contentLength=l,this._isRangeSupported=c,this._filename=NT(r),this._isRangeSupported)e._abortRequest(s);this._headersCapability.resolve()}#n(e){if(this._requests.length>0)this._requests.shift().resolve({value:e,done:!1});else this._cachedChunks.push(e);if(this._done=!0,this._cachedChunks.length===0)this.#e()}#i(e){this._storedError=T2(e,this._stream.url),this._headersCapability.reject(this._storedError);for(let n of this._requests)n.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}#s(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e),this.#e(),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}}class $T extends mm{#e=C2.bind(this);onClosed=null;_done=!1;_queuedChunk=null;_requests=[];_storedError=null;constructor(e,n,i){super(e,n,i);this._requestXhr=e._request({begin:n,end:i,onHeadersReceived:this.#t.bind(this),onDone:this.#n.bind(this),onError:this.#i.bind(this),onProgress:null})}#t(){let e=k2(this._requestXhr?.responseURL);try{PT(e,this._stream._responseOrigin)}catch(n){this._storedError=n,this.#i(0)}}#n(e){if(this._requests.length>0)this._requests.shift().resolve({value:e,done:!1});else this._queuedChunk=e;this._done=!0,this.#e(),this.onClosed?.()}#i(e){this._storedError??=T2(e,this._stream.url);for(let n of this._requests)n.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){let n=this._queuedChunk;return this._queuedChunk=null,{value:n,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this.#e(),this._stream._abortRequest(this._requestXhr),this.onClosed?.()}}function YT(e,n=null){let i=process.getBuiltinModule("fs"),{Readable:s}=process.getBuiltinModule("stream"),a=i.createReadStream(e,n);return s.toWeb(a)}class QT extends dm{constructor(e){super(e,JT,ZT);let{url:n}=e;Fi(n.protocol==="file:","PDFNodeStream only supports file:// URLs.")}}class JT extends pm{_reader=null;constructor(e){super(e);let{disableRange:n,disableStream:i,rangeChunkSize:s,url:a}=e._source;this._isStreamingSupported=!i,process.getBuiltinModule("fs/promises").lstat(a).then((l)=>{let c=YT(a);this._reader=c.getReader();let{size:p}=l;if(this._contentLength=p,this._isRangeSupported=!n&&p>2*s,!this._isStreamingSupported&&this._isRangeSupported)this.cancel(new Vl("Streaming is disabled."));this._headersCapability.resolve()}).catch((l)=>{if(l.code==="ENOENT")l=T2(0,a);this._headersCapability.reject(l)})}async read(){await this._headersCapability.promise;let{value:e,done:n}=await this._reader.read();if(n)return{value:e,done:n};return this._loaded+=e.byteLength,this._callOnProgress(),{value:A2(e),done:!1}}cancel(e){this._reader?.cancel(e)}}class ZT extends mm{_readCapability=Promise.withResolvers();_reader=null;constructor(e,n,i){super(e,n,i);let{url:s}=e._source;try{let a=YT(s,{start:n,end:i-1});this._reader=a.getReader(),this._readCapability.resolve()}catch(a){this._readCapability.reject(a)}}async read(){await this._readCapability.promise;let{value:e,done:n}=await this._reader.read();if(n)return{value:e,done:n};return{value:A2(e),done:!1}}cancel(e){this._reader?.cancel(e)}}function vL(e){return em(e)?HT:ar?QT:WT}class Gl{static#e=null;static#t="";static get workerPort(){return this.#e}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw Error("Invalid `workerPort` type.");this.#e=e}static get workerSrc(){return this.#t}static set workerSrc(e){if(typeof e!=="string")throw Error("Invalid `workerSrc` type.");this.#t=e}}class eA{#e;#t;constructor({parsedData:e,rawData:n}){this.#e=e,this.#t=n}getRaw(){return this.#t}get(e){return this.#e.get(e)??null}[Symbol.iterator](){return this.#e.entries()}}var _h=Symbol("INTERNAL");class tA{#e=!1;#t=!1;#n=!1;#i=!0;constructor(e,{name:n,intent:i,usage:s,rbGroups:a}){this.#e=!!(e&sr.DISPLAY),this.#t=!!(e&sr.PRINT),this.name=n,this.intent=i,this.usage=s,this.rbGroups=a}get visible(){if(this.#n)return this.#i;if(!this.#i)return!1;let{print:e,view:n}=this.usage;if(this.#e)return n?.viewState!=="OFF";else if(this.#t)return e?.printState!=="OFF";return!0}_setVisible(e,n,i=!1){if(e!==_h)Un("Internal method `_setVisible` called.");this.#n=i,this.#i=n}get serializable(){return{userSet:this.#n,visible:this.#i}}}class b9{#e=null;#t=new Map;#n=null;#i=null;#s;creator=null;name=null;constructor(e,n=sr.DISPLAY,i=null){if(this.#s=e,this.renderingIntent=n,e===null)return;this.name=e.name,this.creator=e.creator,this.#i=e.order;for(let s of e.groups)this.#t.set(s.id,new tA(n,s));if(i){if(i.size!==this.#t.size)Un("Incorrect serialized groupState.");for(let[s,a]of i)this.#t.get(s)._setVisible(_h,a.visible,a.userSet)}else{if(e.baseState==="OFF")for(let s of this.#t.values())s._setVisible(_h,!1);for(let s of e.on)this.#t.get(s)._setVisible(_h,!0);for(let s of e.off)this.#t.get(s)._setVisible(_h,!1)}this.#n=this.getHash()}#r(e){let n=e.length;if(n<2)return!0;let i=e[0];for(let s=1;s<n;s++){let a=e[s],r;if(Array.isArray(a))r=this.#r(a);else if(this.#t.has(a))r=this.#t.get(a).visible;else return yn(`Optional content group not found: ${a}`),!0;switch(i){case"And":if(!r)return!1;break;case"Or":if(r)return!0;break;case"Not":return!r;default:return!0}}return i==="And"}isVisible(e){if(this.#t.size===0)return!0;if(!e)return b2("Optional content group not defined."),!0;if(e.type==="OCG"){if(!this.#t.has(e.id))return yn(`Optional content group not found: ${e.id}`),!0;return this.#t.get(e.id).visible}else if(e.type==="OCMD"){if(e.expression)return this.#r(e.expression);if(!e.policy||e.policy==="AnyOn"){for(let n of e.ids){if(!this.#t.has(n))return yn(`Optional content group not found: ${n}`),!0;if(this.#t.get(n).visible)return!0}return!1}else if(e.policy==="AllOn"){for(let n of e.ids){if(!this.#t.has(n))return yn(`Optional content group not found: ${n}`),!0;if(!this.#t.get(n).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(let n of e.ids){if(!this.#t.has(n))return yn(`Optional content group not found: ${n}`),!0;if(!this.#t.get(n).visible)return!0}return!1}else if(e.policy==="AllOff"){for(let n of e.ids){if(!this.#t.has(n))return yn(`Optional content group not found: ${n}`),!0;if(this.#t.get(n).visible)return!1}return!0}return yn(`Unknown optional content policy ${e.policy}.`),!0}return yn(`Unknown group type ${e.type}.`),!0}setVisibility(e,n=!0,i=!0){let s=this.#t.get(e);if(!s){yn(`Optional content group not found: ${e}`);return}if(i&&n&&s.rbGroups.length){for(let a of s.rbGroups)for(let r of a)if(r!==e)this.#t.get(r)?._setVisible(_h,!1,!0)}s._setVisible(_h,!!n,!0),this.#e=null}setOCGState({state:e,preserveRB:n}){let i;for(let s of e){switch(s){case"ON":case"OFF":case"Toggle":i=s;continue}let a=this.#t.get(s);if(!a)continue;switch(i){case"ON":this.setVisibility(s,!0,n);break;case"OFF":this.setVisibility(s,!1,n);break;case"Toggle":this.setVisibility(s,!a.visible,n);break}}this.#e=null}get hasInitialVisibility(){return this.#n===null||this.getHash()===this.#n}getOrder(){if(!this.#t.size)return null;if(this.#i)return this.#i.slice();return[...this.#t.keys()]}getGroup(e){return this.#t.get(e)||null}getHash(){if(this.#e!==null)return this.#e;let e=new l2;for(let[n,i]of this.#t)e.update(`${n}:${i.visible}`);return this.#e=e.hexdigest()}[Symbol.iterator](){return this.#t.entries()}get serializable(){let e=new Map;for(let[n,i]of this.#t)e.set(n,i.serializable);return{data:this.#s,renderingIntent:this.renderingIntent,groupState:e}}static fromSerializable({data:e,renderingIntent:n,groupState:i}){return new b9(e,n,i)}}class nA{#e=null;#t=null;#n=0;#i=null;#s=null;get pagesNumber(){return this.#n}set pagesNumber(e){if(this.#n===e)return;this.#n=e,this.#e=null,this.#t=null}#r(){if(this.#e)return;let e=this.#n,n=this.#e=new Uint32Array(e);for(let i=0;i<e;i++)n[i]=i+1;this.#t=new Int32Array(n)}#a(){let e=new Map,n=this.#e;for(let i=0,s=this.#n;i<s;i++){let a=n[i],r=e.get(a);if(r)r.push(i+1);else e.set(a,[i+1])}return e}movePages(e,n,i){this.#r();let s=this.#e,a=n.length,r=new Uint32Array(a),l=0;for(let y=0;y<a;y++){let x=n[y]-1;if(r[y]=s[x],x<i)l++}let c=this.#n,p=c-a,m=new Int32Array(c),g=vi(i-l,0,p);for(let y=0,x=0;y<c;y++)if(!e.has(y+1))s[x]=s[y],m[x++]=y+1;if(s.copyWithin(g+a,g,p),s.set(r,g),m.copyWithin(g+a,g,p),m.set(n,g),this.#t=m,s.every((y,x)=>y===x+1))this.#e=null}deletePages(e){this.#r();let n=this.#e,i=this.#a();this.#s={pageNumberToId:n.slice(),pagesNumber:this.#n,prevPageNumbers:this.#t.slice()};let s=this.#n-e.length;this.#n=s;let a=this.#e=new Uint32Array(s);this.#t=new Int32Array(s);let r=0,l=0;for(let c of e){let p=c-1;if(p!==r)a.set(n.subarray(r,p),l),l+=p-r;r=p+1}if(r<n.length)a.set(n.subarray(r),l);this.#o(i,new Set(e))}cancelDelete(){if(this.#s)this.#e=this.#s.pageNumberToId,this.#n=this.#s.pagesNumber,this.#t=this.#s.prevPageNumbers,this.#s=null}cleanSavedData(){this.#s=null}copyPages(e){this.#r(),this.#i={pageNumbers:e,pageIds:e.map((n)=>this.#e[n-1])}}cancelCopy(){this.#i=null}pastePages(e){this.#r();let n=this.#e,i=this.#a(),{pageNumbers:s,pageIds:a}=this.#i,r=this.#n+s.length;this.#n=r;let l=this.#e=new Uint32Array(r);this.#t=new Int32Array(r),l.set(n.subarray(0,e),0),l.set(a,e),l.set(n.subarray(e),e+s.length),this.#o(i,null,e,s),this.#i=null}#o(e,n=null,i=-1,s=null){let a=this.#t,r=this.#e,l=i+(s?.length??0),c=new Map;for(let p=0,m=this.#n;p<m;p++){if(p>=i&&p<l){a[p]=-s[p-i];continue}let g=r[p],y=e.get(g),x=c.get(g)||0;if(n&&y)while(x<y.length&&n.has(y[x]))x++;a[p]=y?.[x],c.set(g,x+1)}}hasBeenAltered(){return this.#e!==null}#l(e=null){if(!this.#e)return null;let n=new Int32Array(this.#n).fill(-1),i=new Map;if(e)for(let s of e){let a=this.getPageId(s),r=i.get(a)??0;i.set(a,r+1),n[s-1]=r}else for(let s=0,a=this.#n;s<a;s++){let r=this.#e[s],l=i.get(r)??0;i.set(r,l+1),n[s]=l}return n}getPageMappingForSaving(e=null,n=this.#l()){e??=this.#a();let i=0;for(let a of e.values())i=Math.max(i,a.length);let s=Array(i);for(let a=0;a<i;a++)s[a]={document:null,pageIndices:[],includePages:[]};for(let[a,r]of e)for(let l=0,c=r.length;l<c;l++)s[l].includePages.push([a-1,r[l]-1]);for(let{includePages:a,pageIndices:r}of s){a.sort((l,c)=>l[0]-c[0]);for(let l=0,c=a.length;l<c;l++)r.push(a[l][1]),a[l]=a[l][0]}return{pageInfos:s,copyLevels:n}}extractPages(e){e=Array.from(e).sort((i,s)=>i-s);let n=new Map;for(let i=0,s=e.length;i<s;i++){let a=this.getPageId(e[i]);n.getOrInsertComputed(a,Rd).push(i+1)}return this.getPageMappingForSaving(n,this.#l(e))}getPrevPageNumber(e){return this.#t?.[e-1]??0}getPageNumber(e){if(!this.#e)return e;let n=this.#e;for(let i=0,s=this.#n;i<s;i++)if(n[i]===e)return i+1;return 0}getPageId(e){return this.#e?.[e-1]??e}getMapping(){return this.#e?.subarray(0,this.pagesNumber)}}var Dd=Symbol("INITIAL_DATA"),$k=()=>({...Promise.withResolvers(),data:Dd});class w9{#e=new Map;get(e,n=null){if(n){let s=this.#e.getOrInsertComputed(e,$k);return s.promise.then(()=>n(s.data)),null}let i=this.#e.get(e);if(!i||i.data===Dd)throw Error(`Requesting object that isn't resolved yet ${e}.`);return i.data}has(e){let n=this.#e.get(e);return!!n&&n.data!==Dd}delete(e){let n=this.#e.get(e);if(!n||n.data===Dd)return!1;return this.#e.delete(e),!0}resolve(e,n=null){let i=this.#e.getOrInsertComputed(e,$k);if(i.data!==Dd)throw Error(`Object already resolved ${e}.`);i.data=n,i.resolve()}clear(){for(let{data:e}of this.#e.values())e?.bitmap?.close();this.#e.clear()}*[Symbol.iterator](){for(let[e,{data:n}]of this.#e)if(n!==Dd)yield[e,n]}}var SL=1e5,Yk=30;class pa{#e=Promise.withResolvers();#t=null;#n=!1;#i=!!globalThis.FontInspector?.enabled;#s=null;#r=null;#a=null;#o=0;#l=0;#c=null;#f=null;#h=0;#d=0;#m=Object.create(null);#g=[];#u=null;#p=[];#b=new WeakMap;#w=null;static#y=new Map;static#v=new Map;static#x=new WeakMap;static#_=null;static#k=new Set;constructor({textContentSource:e,images:n,container:i,viewport:s}){if(e instanceof ReadableStream)this.#u=e;else if(typeof e==="object")this.#u=new ReadableStream({start(p){p.enqueue(e),p.close()}});else throw Error('No "textContentSource" parameter specified.');this.#t=this.#f=i,this.#s=n,this.#d=s.scale*so.pixelRatio,this.#h=s.rotation,this.#a={div:null,properties:null,ctx:null};let{pageWidth:a,pageHeight:r,pageX:l,pageY:c}=s.rawDims;this.#w=[1,0,0,-1,-l,c+r],this.#l=a,this.#o=r,pa.#D(),i.style.setProperty("--min-font-size",pa.#_),jh(i,s),this.#e.promise.finally(()=>{pa.#k.delete(this),this.#a=null,this.#m=null}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:e,isFirefox:n}=ai.platform;return en(this,"fontFamilyMap",new Map([["sans-serif",`${e&&n?"Calibri, ":""}sans-serif`],["monospace",`${e&&n?"Lucida Console, ":""}monospace`]]))}render(){if(this.#s)this.#t.append(this.#s.render());let e=()=>{this.#c.read().then(({value:n,done:i})=>{if(i){this.#e.resolve();return}this.#r??=n.lang,Object.assign(this.#m,n.styles),this.#T(n.items),e()},this.#e.reject)};return this.#c=this.#u.getReader(),pa.#k.add(this),e(),this.#e.promise}update({viewport:e,onBefore:n=null}){let i=e.scale*so.pixelRatio,s=e.rotation;if(s!==this.#h)n?.(),this.#h=s,jh(this.#f,{rotation:s});if(i!==this.#d){n?.(),this.#d=i;let a={div:null,properties:null,ctx:pa.#C(this.#r)};for(let r of this.#p)a.properties=this.#b.get(r),a.div=r,this.#j(a)}}cancel(){let e=new Vl("TextLayer task cancelled.");this.#c?.cancel(e).catch(()=>{}),this.#c=null,this.#e.reject(e)}get textDivs(){return this.#p}get textContentItemsStr(){return this.#g}#T(e){if(this.#n)return;this.#a.ctx??=pa.#C(this.#r);let n=this.#p,i=this.#g;for(let s of e){if(n.length>SL){yn("Ignoring additional textDivs for performance reasons."),this.#n=!0;return}if(s.str===void 0){if(s.type==="beginMarkedContentProps"||s.type==="beginMarkedContent"){let a=this.#t;if(this.#t=document.createElement("span"),this.#t.classList.add("markedContent"),s.id)this.#t.setAttribute("id",s.id);if(s.tag==="Artifact")this.#t.ariaHidden=!0;a.append(this.#t)}else if(s.type==="endMarkedContent")this.#t=this.#t.parentNode;continue}i.push(s.str),this.#q(s)}}#q(e){let n=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};this.#p.push(n);let s=It.transform(this.#w,e.transform),a=Math.atan2(s[1],s[0]),r=this.#m[e.fontName];if(r.vertical)a+=Math.PI/2;let l=this.#i&&r.fontSubstitution||r.fontFamily;l=pa.fontFamilyMap.get(l)||l;let c=Math.hypot(s[2],s[3]),p=c*pa.#M(l,r,this.#r),m,g;if(a===0)m=s[4],g=s[5]-p;else m=s[4]+p*Math.sin(a),g=s[5]-p*Math.cos(a);let y=n.style;if(y.left=`${(100*m/this.#l).toFixed(2)}%`,y.top=`${(100*g/this.#o).toFixed(2)}%`,y.setProperty("--font-height",`${c.toFixed(2)}px`),y.fontFamily=l,i.fontSize=c,n.setAttribute("role","presentation"),n.textContent=e.str,n.dir=e.dir,this.#i)n.dataset.fontName=r.fontSubstitutionLoadedName||e.fontName;if(a!==0)i.angle=a*(180/Math.PI);let x=!1;if(e.str.length>1)x=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){let j=Math.abs(e.transform[0]),I=Math.abs(e.transform[3]);if(j!==I&&Math.max(j,I)/Math.min(j,I)>1.5)x=!0}if(x)i.canvasWidth=r.vertical?e.height:e.width;if(this.#b.set(n,i),this.#a.div=n,this.#a.properties=i,this.#j(this.#a),i.hasText)this.#t.append(n);if(i.hasEOL){let j=document.createElement("br");j.setAttribute("role","presentation"),this.#t.append(j)}}#j(e){let{div:n,properties:i,ctx:s}=e,{style:a}=n;if(i.canvasWidth!==0&&i.hasText){let{fontFamily:r}=a,{canvasWidth:l,fontSize:c}=i;pa.#I(s,c*this.#d,r);let{width:p}=s.measureText(n.textContent);if(p>0)a.setProperty("--scale-x",l*this.#d/p)}if(i.angle!==0)a.setProperty("--rotate",`${i.angle}deg`)}static cleanup(){if(this.#k.size>0)return;this.#y.clear();for(let{canvas:e}of this.#v.values())e.remove();this.#v.clear()}static#C(e=null){let n=this.#v.get(e||="");if(!n){let i=document.createElement("canvas");i.style.cssText="position:absolute;top:0;left:0;width:0;height:0;display:none;letter-spacing:normal;word-spacing:normal",i.lang=e,document.body.append(i),n=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#v.set(e,n),this.#x.set(n,{size:0,family:""})}return n}static#I(e,n,i){let s=this.#x.get(e);if(n===s.size&&i===s.family)return;e.font=`${n}px ${i}`,s.size=n,s.family=i}static#D(){if(this.#_!==null)return;let e=document.createElement("div");e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize="1px",e.style.position="absolute",e.textContent="X",document.body.append(e),this.#_=e.getBoundingClientRect().height,e.remove()}static#M(e,n,i){let s=this.#y.get(e);if(s)return s;let a=this.#C(i);a.canvas.width=a.canvas.height=Yk,this.#I(a,Yk,e);let r=a.measureText(""),l=r.fontBoundingBoxAscent,c=Math.abs(r.fontBoundingBoxDescent);a.canvas.width=a.canvas.height=0;let p=0.8;if(l)p=l/(l+c);else{if(ai.platform.isFirefox)yn("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering.");if(n.ascent)p=n.ascent;else if(n.descent)p=1+n.descent}return this.#y.set(e,p),p}}var _L=100;function y9(e={}){let n=new v9,{docId:i}=n,s=e.url?JB(e.url):null,a=e.data?ZB(e.data):null,r=e.httpHeaders||null,l=e.withCredentials===!0,c=e.password??null,p=e.range instanceof S9?e.range:null,m=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:65536,g=e.worker instanceof zs?e.worker:null,y=e.verbosity,x=typeof e.docBaseUrl==="string"&&!v2(e.docBaseUrl)?e.docBaseUrl:null,j=Xb(e.cMapUrl),I=e.cMapPacked!==!1,P=Xb(e.iccUrl),X=Xb(e.standardFontDataUrl),Y=Xb(e.wasmUrl),J=e.stopAtErrors!==!0,ne=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,ae=typeof e.isOffscreenCanvasSupported==="boolean"?e.isOffscreenCanvasSupported:!ar,se=typeof e.isImageDecoderSupported==="boolean"?e.isImageDecoderSupported:!ar,oe=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,he=typeof e.disableFontFace==="boolean"?e.disableFontFace:ar,we=e.fontExtraProperties===!0,Ce=e.enableXfa===!0,Ne=e.ownerDocument||globalThis.document,Pe=e.disableRange===!0,Ue=e.disableStream===!0,ze=e.disableAutoFetch===!0,He=e.pdfBug===!0,De=e.CanvasFactory||(ar?jT:TT),Fe=e.FilterFactory||(ar?CT:AT),bt=e.BinaryDataFactory||(ar?ET:i9),Ve=e.enableHWA===!0,Ct=e.enableWebGPU===!0?aL():Promise.resolve(!1),ct=e.useWasm!==!1,Ze=e.pagesMapper||new nA,mt=typeof e.useSystemFonts==="boolean"?e.useSystemFonts:!ar&&!he,Xt=typeof e.useWorkerFetch==="boolean"?e.useWorkerFetch:!!(bt===i9&&j&&I&&X&&Y&&em(j,document.baseURI)&&em(X,document.baseURI)&&em(Y,document.baseURI)),hn=null;RB(y);let nn={canvasFactory:new De({ownerDocument:Ne,enableHWA:Ve}),filterFactory:new Fe({docId:i,ownerDocument:Ne}),binaryDataFactory:Xt?null:new bt({cMapUrl:j,standardFontDataUrl:X,wasmUrl:Y})};if(!g)g=zs.create({verbosity:y,port:Gl.workerPort}),n._worker=g;let Zt={docId:i,apiVersion:"6.3.289",data:a,password:c,disableAutoFetch:ze,rangeChunkSize:m,docBaseUrl:x,enableXfa:Ce,evaluatorOptions:{maxImageSize:ne,disableFontFace:he,ignoreErrors:J,isOffscreenCanvasSupported:ae,isImageDecoderSupported:se,canvasMaxAreaInBytes:oe,fontExtraProperties:we,useSystemFonts:mt,useWasm:ct,useWorkerFetch:Xt,cMapUrl:j,cMapPacked:I,iccUrl:P,standardFontDataUrl:X,wasmUrl:Y,hasGPU:!1}},Rn={ownerDocument:Ne,pdfBug:He,styleElement:hn,enableHWA:Ve,loadingParams:{disableAutoFetch:ze,enableXfa:Ce}};return Promise.all([g.promise,Ct]).then(function([,Zn]){if(g.destroyed)throw Error("Worker was destroyed");Zt.evaluatorOptions.hasGPU=Zn;let Ni=g.messageHandler.sendWithPromise("GetDocRequest",Zt,a?[a.buffer]:null),ri;if(a);else if(p)ri=new GT({pdfDataRangeTransport:p,disableRange:Pe,disableStream:Ue});else if(s)ri=new(vL(s))({url:s,httpHeaders:r,withCredentials:l,rangeChunkSize:m,disableRange:Pe,disableStream:Ue});else throw Error("getDocument - expected either `data`, `range`, or `url` parameter.");return Ni.then((Ai)=>{if(g.destroyed)throw Error("Worker was destroyed");let Vs=new Id(i,Ai,g.port),zi=new sA(Vs,n,ri,Rn,nn,Ze);if(n._transport=zi,n.destroyed)throw Error("Loading aborted");Vs.send("Ready",null)})}).catch(n._capability.reject).finally(n._setupCapability.resolve),n}class v9{static#e=0;_capability=Promise.withResolvers();_setupCapability=Promise.withResolvers();_transport=null;_worker=null;docId=`d${v9.#e++}`;destroyed=!1;onPassword=null;onProgress=null;get promise(){return this._capability.promise}async destroy(){this.destroyed=!0,this._capability.promise.catch(()=>{});try{if(this._worker?.port)this._worker._pendingDestroy=!0;await this._setupCapability.promise,await this._transport?.destroy()}catch(e){if(this._worker?.port)delete this._worker._pendingDestroy;throw e}this._transport=null,this._worker?.destroy(),this._worker=null}async getData(){return this._transport.getData()}}class S9{#e=Promise.withResolvers();#t=null;constructor(e,n,i=!1,s=null){this.length=e,this.initialData=n,this.progressiveDone=i,this.contentDispositionFilename=s}onDataRange(e,n){this.#t({type:"range",begin:e,chunk:n})}onDataProgressiveRead(e){this.#e.promise.then(()=>{this.#t({type:"progressiveRead",chunk:e})})}onDataProgressiveDone(){this.#e.promise.then(()=>{this.#t({type:"progressiveDone"})})}transportReady(e){this.#t=e,this.#e.resolve()}requestDataRange(e,n){Un("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class iA{constructor(e,n){this._pdfInfo=e,this._transport=n}get pagesMapper(){return this._transport.pagesMapper}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return en(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAttachmentContent(e){return this._transport.getAttachmentContent(e)}getAnnotationsByType(e,n){return this._transport.getAnnotationsByType(e,n)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){let{renderingIntent:n}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(n)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}extractPages(e,n=null){return this._transport.extractPages(e,n)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}getSignatures(){return this._transport.getSignatures()}getSignatureData(e){return this._transport.getSignatureData(e)}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class _9{#e=!1;#t=null;constructor(e,n,i,s,a=!1){this._pageIndex=e,this._pageInfo=n,this._transport=i,this._stats=a?new Q3:null,this._pdfBug=a,this.commonObjs=i.commonObjs,this.objs=new w9,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,this.#t=s,this.imageCoordinates=null}clone(e){let n=new _9(e,this._pageInfo,this._transport,this.#t,this._pdfBug);return n.clonedFromIndex=this.clonedFromIndex??this._pageIndex,this._transport.updatePage(n),n}get pageNumber(){return this._pageIndex+1}set pageNumber(e){this._pageIndex=e-1,this._transport.updatePage(this)}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:n=this.rotate,offsetX:i=0,offsetY:s=0,dontFlip:a=!1}={}){return new um({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:n,offsetX:i,offsetY:s,dontFlip:a})}getAnnotations({intent:e="display"}={}){let{renderingIntent:n}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,n)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return en(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,canvas:n=e.canvas,viewport:i,intent:s="display",annotationMode:a=Jc.ENABLE,transform:r=null,background:l=null,optionalContentConfigPromise:c=null,annotationCanvasMap:p=null,pageColors:m=null,printAnnotationStorage:g=null,isEditing:y=!1,recordImages:x=!1,recordOperations:j=!1,operationsFilter:I=null}){this._stats?.time("Overall");let P=this._transport.getRenderingIntent(s,a,g,y),{renderingIntent:X,cacheKey:Y}=P;this.#e=!1,c||=this._transport.getOptionalContentConfig(X);let J=this._intentStates.getOrInsertComputed(Y,Y3);if(J.streamReaderCancelTimeout)clearTimeout(J.streamReaderCancelTimeout),J.streamReaderCancelTimeout=null;let ne=!!(X&sr.PRINT);if(!J.displayReadyCapability)J.displayReadyCapability=Promise.withResolvers(),J.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(P);let ae=!!(this._pdfBug&&globalThis.StepperManager?.enabled),se=!!n&&!this.recordedBBoxes&&(j||ae),oe=!!n&&!this.imageCoordinates&&x,he=(Ue)=>{if(J.renderTasks.delete(Ne),se){let ze=Ne.gfx?.dependencyTracker.take();if(ze){if(Ne.stepper?.setOperatorBBoxes(ze,Ne.gfx.dependencyTracker.takeDebugMetadata()),j)this.recordedBBoxes=ze}}if(oe&&!Ue)this.imageCoordinates=Ne.gfx?.imagesTracker.take();if(ne)this.#e=!0;if(this.#n(),Ue)Ne.capability.reject(Ue),this._abortOperatorList({intentState:J,reason:Ue instanceof Error?Ue:Error(Ue)});else Ne.capability.resolve();if(this._stats){if(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled)globalThis.Stats.add(this.pageNumber,this._stats)}},we=null,Ce=null;if(se||oe)Ce=new dT(n,J.operatorList.length);if(se)we=new pT(Ce,ae);let Ne=new Md({callback:he,params:{canvas:n,canvasContext:e,dependencyTracker:we??Ce,imagesTracker:oe?new c2(n):null,viewport:i,transform:r,background:l},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:p,operatorList:J.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!ne,pdfBug:this._pdfBug,pageColors:m,enableHWA:this._transport.enableHWA,operationsFilter:I});(J.renderTasks||=new Set).add(Ne);let Pe=Ne.task;return Promise.all([J.displayReadyCapability.promise,c]).then(([Ue,ze])=>{if(this.destroyed){he();return}if(this._stats?.time("Rendering"),!(ze.renderingIntent&X))throw Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");Ne.initializeGraphics({transparency:Ue,optionalContentConfig:ze}),Ne.operatorListChanged()}).catch(he),Pe}getOperatorList({intent:e="display",annotationMode:n=Jc.ENABLE,printAnnotationStorage:i=null,isEditing:s=!1}={}){function a(){if(l.operatorList.lastChunk)l.opListReadCapability.resolve(l.operatorList),l.renderTasks.delete(c)}let r=this._transport.getRenderingIntent(e,n,i,s,!0),l=this._intentStates.getOrInsertComputed(r.cacheKey,Y3),c;if(!l.opListReadCapability)c=Object.create(null),c.operatorListChanged=a,l.opListReadCapability=Promise.withResolvers(),(l.renderTasks||=new Set).add(c),l.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(r);return l.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:n=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageId:this.#t.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:n===!0},{highWaterMark:100,size(s){return s.items.length}})}async getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then((s)=>sm.textContent(s));let n=this.streamTextContent(e),i={items:[],styles:Object.create(null),lang:null};for await(let s of n)i.lang??=s.lang,Object.assign(i.styles,s.styles),i.items.push(...s.items);return i}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let e=[];for(let n of this._intentStates.values()){if(this._abortOperatorList({intentState:n,reason:Error("Page was destroyed."),force:!0}),n.opListReadCapability)continue;for(let i of n.renderTasks)e.push(i.completed),i.cancel()}return this.objs.clear(),this.#e=!1,Promise.all(e)}cleanup(e=!1){this.#e=!0;let n=this.#n();if(e&&n)this._stats&&=new Q3;return n}#n(){if(!this.#e||this.destroyed)return!1;for(let{renderTasks:e,operatorList:n}of this._intentStates.values())if(e.size>0||!n.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#e=!1,!0}_startRenderPage(e,n){let i=this._intentStates.get(n);if(!i)return;this._stats?.timeEnd("Page Request"),i.displayReadyCapability?.resolve(e)}_renderPageChunk(e,n){for(let i=0,s=e.length;i<s;i++)n.operatorList.fnArray.push(e.fnArray[i]),n.operatorList.argsArray.push(e.argsArray[i]);n.operatorList.lastChunk=e.lastChunk,n.operatorList.separateAnnots=e.separateAnnots;for(let i of n.renderTasks)i.operatorListChanged();if(e.lastChunk)this.#n()}_pumpOperatorList({renderingIntent:e,cacheKey:n,annotationStorageSerializable:i,modifiedIds:s}){let{map:a,transfer:r}=i,c=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageId:this.#t.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,intent:e,cacheKey:n,annotationStorage:a,modifiedIds:s},void 0,r).getReader(),p=this._intentStates.get(n);p.streamReader=c;let m=()=>{c.read().then(({value:g,done:y})=>{if(y){p.streamReader=null;return}if(this._transport.destroyed)return;this._renderPageChunk(g,p),m()},(g)=>{if(p.streamReader=null,this._transport.destroyed)return;if(p.operatorList){p.operatorList.lastChunk=!0;for(let y of p.renderTasks)y.operatorListChanged();this.#n()}if(p.displayReadyCapability)p.displayReadyCapability.reject(g);else if(p.opListReadCapability)p.opListReadCapability.reject(g);else throw g})};m()}_abortOperatorList({intentState:e,reason:n,force:i=!1}){if(!e.streamReader)return;if(e.streamReaderCancelTimeout)clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null;if(!i){if(e.renderTasks.size>0)return;if(n instanceof y2){let s=_L;if(n.extraDelay>0&&n.extraDelay<1000)s+=n.extraDelay;e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:n,force:!0})},s);return}}if(e.streamReader.cancel(new Vl(n.message)).catch(()=>{}),e.streamReader=null,this._transport.destroyed)return;for(let[s,a]of this._intentStates)if(a===e){this._intentStates.delete(s);break}this.cleanup()}get stats(){return this._stats}}class zs{#e=Promise.withResolvers();#t=null;#n=null;#i=null;static#s=0;static#r=!1;static#a=new WeakMap;static{if(ar)this.#r=!0,Gl.workerSrc||="./pdf.worker.mjs";this._isSameOrigin=(e,n)=>{let i=URL.parse(e);if(!i?.origin||i.origin==="null")return!1;let s=new URL(n,i);return i.origin===s.origin},this._createCDNWrapper=(e)=>{let n=`await import("${e}");`;return URL.createObjectURL(new Blob([n],{type:"text/javascript"}))}}constructor({name:e=null,port:n=null,verbosity:i=OB()}={}){if(this.name=e,this.destroyed=!1,this.verbosity=i,n){if(zs.#a.has(n))throw Error("Cannot use more than one PDFWorker per port.");zs.#a.set(n,this),this.#l(n)}else this.#c()}get promise(){return this.#e.promise}#o(){this.#e.resolve(),this.#t.send("configure",{verbosity:this.verbosity})}get port(){return this.#n}get messageHandler(){return this.#t}#l(e){this.#n=e,this.#t=new Id("main","worker",e),this.#t.on("ready",()=>{}),this.#o()}#c(){if(zs.#r||zs.#h){this.#f();return}let{workerSrc:e}=zs;try{if(!zs._isSameOrigin(window.location,e))e=zs._createCDNWrapper(new URL(e,window.location).href);let n=new Worker(e,{type:"module"}),i=new Id("main","worker",n),s=()=>{if(a.abort(),i.destroy(),n.terminate(),this.destroyed)this.#e.reject(Error("Worker was destroyed"));else this.#f()},a=new AbortController;n.addEventListener("error",()=>{if(!this.#i)s()},{signal:a.signal}),i.on("test",(l)=>{if(a.abort(),this.destroyed||!l){s();return}this.#t=i,this.#n=n,this.#i=n,this.#o()}),i.on("ready",(l)=>{if(a.abort(),this.destroyed){s();return}try{r()}catch{this.#f()}});let r=()=>{let l=new Uint8Array;i.send("test",l,[l.buffer])};r();return}catch{b2("The worker has been disabled.")}this.#f()}#f(){if(!zs.#r)yn("Setting up fake worker."),zs.#r=!0;zs._setupFakeWorkerGlobal.then((e)=>{if(this.destroyed){this.#e.reject(Error("Worker was destroyed"));return}let n=new kT;this.#n=n;let i=`fake${zs.#s++}`,s=new Id(i+"_worker",i,n);e.setup(s,n),this.#t=new Id(i,i+"_worker",n),this.#o()}).catch((e)=>{this.#e.reject(Error(`Setting up fake worker failed: "${e.message}".`))})}destroy(){this.destroyed=!0,this.#i?.terminate(),this.#i=null,zs.#a.delete(this.#n),this.#n=null,this.#t?.destroy(),this.#t=null}static create(e){let n=this.#a.get(e?.port);if(n){if(n._pendingDestroy)throw Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return n}return new zs(e)}static get workerSrc(){if(Gl.workerSrc)return Gl.workerSrc;throw Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#h(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return en(this,"_setupFakeWorkerGlobal",(async()=>{if(this.#h)return this.#h;return(await import(this.workerSrc)).WorkerMessageHandler})())}}class sA{downloadInfoCapability=Promise.withResolvers();#e=null;#t=new Map;#n=null;#i=new Map;#s=new Map;#r=new Map;#a=null;constructor(e,n,i,s,a,r){this.messageHandler=e,this.loadingTask=n,this.#n=i,this.commonObjs=new w9,this.fontLoader=new mT({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this.enableHWA=s.enableHWA,this.loadingParams=s.loadingParams,this._params=s,this.canvasFactory=a.canvasFactory,this.filterFactory=a.filterFactory,this.binaryDataFactory=a.binaryDataFactory,this.pagesMapper=r,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler()}updatePage(e){let{_pageIndex:n}=e;this.#i.set(n,e),this.#s.set(n,Promise.resolve(e))}#o(e,n=null){return this.#t.getOrInsertComputed(e,()=>this.messageHandler.sendWithPromise(e,n))}#l({loaded:e,total:n}){this.loadingTask.onProgress?.({loaded:e,total:n,percent:n?vi(Math.round(e/n*100),0,100):NaN})}get annotationStorage(){return en(this,"annotationStorage",new S2)}getRenderingIntent(e,n=Jc.ENABLE,i=null,s=!1,a=!1){let r=sr.DISPLAY,l=am;switch(e){case"any":r=sr.ANY;break;case"display":break;case"print":r=sr.PRINT;break;default:yn(`getRenderingIntent - invalid intent: ${e}`)}let c=r&sr.PRINT&&i instanceof d9?i:this.annotationStorage;switch(n){case Jc.DISABLE:r+=sr.ANNOTATIONS_DISABLE;break;case Jc.ENABLE:break;case Jc.ENABLE_FORMS:r+=sr.ANNOTATIONS_FORMS;break;case Jc.ENABLE_STORAGE:r+=sr.ANNOTATIONS_STORAGE,l=c.serializable;break;default:yn(`getRenderingIntent - invalid annotationMode: ${n}`)}if(s)r+=sr.IS_EDITING;if(a)r+=sr.OPLIST;let{ids:p,hash:m}=c.modifiedIds,g=[r,l.hash,m];return{renderingIntent:r,cacheKey:g.join("_"),annotationStorageSerializable:l,modifiedIds:p}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#a?.reject(Error("Worker was destroyed during onPassword callback"));let e=[];for(let i of this.#i.values())e.push(i._destroy());if(this.#i.clear(),this.#s.clear(),this.#r.clear(),Object.hasOwn(this,"annotationStorage"))this.annotationStorage.resetModified();let n=this.messageHandler.sendWithPromise("Terminate",null);return e.push(n),Promise.all(e).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#t.clear(),this.filterFactory.destroy(),pa.cleanup(),this.#n?.cancelAllRequests(new Vl("Worker was terminated.")),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:e,loadingTask:n}=this;e.on("GetReader",(i,s)=>{Fi(this.#n,"GetReader - no `BasePDFStream` instance available."),this.#e=this.#n.getFullReader(),this.#e.onProgress=(a)=>this.#l(a),s.onPull=()=>{this.#e.read().then(function({value:a,done:r}){if(r){s.close();return}Fi(a instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(a),1,[a])}).catch((a)=>{s.error(a)})},s.onCancel=(a)=>{this.#e.cancel(a),s.ready.catch((r)=>{if(this.destroyed)return;throw r})}}),e.on("ReaderHeadersReady",async(i)=>{await this.#e.headersReady;let{isStreamingSupported:s,isRangeSupported:a,contentLength:r}=this.#e;if(s&&a)this.#e.onProgress=null;return{isStreamingSupported:s,isRangeSupported:a,contentLength:r}}),e.on("GetRangeReader",(i,s)=>{Fi(this.#n,"GetRangeReader - no `BasePDFStream` instance available.");let a=this.#n.getRangeReader(i.begin,i.end);if(!a){s.close();return}s.onPull=()=>{a.read().then(function({value:r,done:l}){if(l){s.close();return}Fi(r instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(r),1,[r])}).catch((r)=>{s.error(r)})},s.onCancel=(r)=>{a.cancel(r),s.ready.catch((l)=>{if(this.destroyed)return;throw l})}}),e.on("GetDoc",({pdfInfo:i})=>{this.pagesMapper.pagesNumber=i.numPages,this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,n._capability.resolve(new iA(i,this))}),e.on("DocException",(i)=>{n._capability.reject(Ba(i))}),e.on("PasswordRequest",(i)=>{this.#a=Promise.withResolvers();try{if(!n.onPassword)throw Ba(i);let s=(a)=>{if(a instanceof Error)this.#a.reject(a);else this.#a.resolve({password:a})};n.onPassword(s,i.code)}catch(s){this.#a.reject(s)}return this.#a.promise}),e.on("DataLoaded",(i)=>{this.#l({loaded:i.length,total:i.length}),this.downloadInfoCapability.resolve(i)}),e.on("StartRenderPage",(i)=>{if(this.destroyed)return;this.#i.get(i.pageIndex)._startRenderPage(i.transparency,i.cacheKey)}),e.on("commonobj",([i,s,a])=>{if(this.destroyed)return null;if(this.commonObjs.has(i))return null;switch(s){case"Font":if("error"in a){let g=a.error;yn(`Error during font loading: ${g}`),this.commonObjs.resolve(i,g);break}let r=new ST(a),l=this._params.pdfBug&&globalThis.FontInspector?.enabled?(g,y)=>globalThis.FontInspector.fontAdded(g,y):null,c=new gT(r,l,a.charProcOperatorList,a.extra);this.fontLoader.bind(c).catch(()=>e.sendWithPromise("FontFallback",{id:i})).finally(()=>{if(!c.fontExtraProperties)c.clearData();this.commonObjs.resolve(i,c)});break;case"CopyLocalImage":let{imageRef:p}=a;Fi(p,"The imageRef must be defined.");for(let g of this.#i.values())for(let[,y]of g.objs){if(y?.ref!==p)continue;if(!y.dataLen)return null;let x=structuredClone(y);return this.commonObjs.resolve(i,x),y.dataLen}break;case"FontPath":this.commonObjs.resolve(i,new xT(a));break;case"Image":this.commonObjs.resolve(i,a);break;case"Pattern":let m=new _T(a);this.commonObjs.resolve(i,m.getIR());break;default:throw Error(`Got unknown common object type ${s}`)}return null}),e.on("obj",([i,s,a,r])=>{if(this.destroyed)return;let l=this.#i.get(s);if(l.objs.has(i))return;if(l._intentStates.size===0){r?.bitmap?.close();return}switch(a){case"Image":case"Pattern":l.objs.resolve(i,r);break;default:throw Error(`Got unknown object type ${a}`)}}),e.on("DocProgress",(i)=>{if(this.destroyed)return;this.#l(i)}),e.on("FetchBinaryData",async(i)=>{if(this.destroyed)throw Error("Worker was destroyed.");if(!this.binaryDataFactory)throw Error("`BinaryDataFactory` not initialized, see the `useWorkerFetch` parameter.");return this.binaryDataFactory.fetch(i)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){if(this.annotationStorage.size<=0)yn("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:e,transfer:n}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:this.#e?.filename??null},n).finally(()=>{this.annotationStorage.resetModified()})}extractPages(e,n=null){let i={pageInfos:e},s,a=globalThis.ImageBitmap;if(typeof a==="function"){let r=Array.isArray(e)?e:[e];for(let l of r)if(l?.image instanceof a)(s||=[]).push(l.image)}if(this.annotationStorage.size>0){let r=this.annotationStorage.serializable,{map:l}=r;if(r.transfer?.length)if(s)s.push(...r.transfer);else s=r.transfer;let c=this.pagesMapper.getMapping();if(c){let p=new Map;for(let[m,g]of l){if(g?.pageIndex!==void 0&&g.pageIndex>=0&&g.pageIndex<c.length){let y=n?.[g.pageIndex]??0,x=c[g.pageIndex]-1;if(x!==g.pageIndex||y!==0){p.set(m,{...g,pageIndex:x,copyLevel:y});continue}}p.set(m,g)}l=p}i.annotationStorage=l}return this.messageHandler.sendWithPromise("ExtractPages",i,s).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this.pagesMapper.pagesNumber)return Promise.reject(Error("Invalid page request."));let n=e-1,i=this.pagesMapper.getPageId(e)-1,s=this.#s.get(n);if(s)return s;let a=this.messageHandler.sendWithPromise("GetPage",{pageIndex:i}).then((r)=>{if(this.destroyed)throw Error("Transport destroyed");if(r.refStr)this.#r.set(r.refStr,i);let l=new _9(n,r,this,this.pagesMapper,this._params.pdfBug);return this.#i.set(n,l),l});return this.#s.set(n,a),a}async getPageIndex(e){if(!n9(e))throw Error("Invalid pageIndex request.");let n=await this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}),i=this.pagesMapper.getPageNumber(n+1);if(i===0)throw Error("GetPageIndex: page has been removed.");return i-1}getAnnotations(e,n){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:this.pagesMapper.getPageId(e+1)-1,intent:n})}getFieldObjects(){return this.#o("GetFieldObjects")}getSignatures(){return this.#o("GetSignatures")}getSignatureData(e){return this.messageHandler.sendWithPromise("GetSignatureData",e)}hasJSActions(){return this.#o("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){if(typeof e!=="string")return Promise.reject(Error("Invalid destination request."));return this.messageHandler.sendWithPromise("GetDestination",{id:e})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getAttachmentContent(e){return this.messageHandler.sendWithPromise("GetAttachmentContent",e)}getAnnotationsByType(e,n){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:e,pageIndexesToSkip:n})}getDocJSActions(){return this.#o("GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:this.pagesMapper.getPageId(e+1)-1})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:this.pagesMapper.getPageId(e+1)-1})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return this.#o("GetOptionalContentConfig").then((n)=>new b9(n,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){return this.#t.getOrInsertComputed("GetMetadata",()=>this.messageHandler.sendWithPromise("GetMetadata",null).then((n)=>({info:n[0],metadata:n[1]?new eA(n[1]):null,contentDispositionFilename:this.#e?.filename??null,contentLength:this.#e?.contentLength??null,hasStructTree:n[2]})))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(this.destroyed)return;await this.messageHandler.sendWithPromise("Cleanup",null);for(let n of this.#i.values())if(!n.cleanup())throw Error(`startCleanup: Page ${n.pageNumber} is currently rendering.`);if(this.commonObjs.clear(),!e)this.fontLoader.clear();this.#t.clear(),this.filterFactory.destroy(!0),pa.cleanup()}cachedPageNumber(e){if(!n9(e))return null;let n=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`,i=this.#r.get(n);if(i>=0){let s=this.pagesMapper.getPageNumber(i+1);if(s!==0)return s}return null}}class aA{_internalRenderTask=null;onContinue=null;onError=null;constructor(e){this._internalRenderTask=e}get promise(){return this._internalRenderTask.capability.promise}cancel(e=0){this._internalRenderTask.cancel(null,e)}get separateAnnots(){let{separateAnnots:e}=this._internalRenderTask.operatorList;if(!e)return!1;let{annotationCanvasMap:n}=this._internalRenderTask;return e.form||e.canvas&&n?.size>0}get imageCoordinates(){return this._internalRenderTask.imageCoordinates||null}}class Md{#e=null;static#t=new WeakSet;constructor({callback:e,params:n,objs:i,commonObjs:s,annotationCanvasMap:a,operatorList:r,pageIndex:l,canvasFactory:c,filterFactory:p,useRequestAnimationFrame:m=!1,pdfBug:g=!1,pageColors:y=null,enableHWA:x=!1,operationsFilter:j=null}){this.callback=e,this.params=n,this.objs=i,this.commonObjs=s,this.annotationCanvasMap=a,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=l,this.canvasFactory=c,this.filterFactory=p,this._pdfBug=g,this.pageColors=y,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=m===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new aA(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=n.canvas,this._canvasContext=n.canvas?null:n.canvasContext,this._enableHWA=x,this._dependencyTracker=n.dependencyTracker,this._imagesTracker=n.imagesTracker,this._operationsFilter=j}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:n}){if(this.cancelled)return;if(this._canvas){if(Md.#t.has(this._canvas))throw Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");Md.#t.add(this._canvas)}if(this._pdfBug&&globalThis.StepperManager?.enabled)this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint();let{viewport:i,transform:s,background:a,dependencyTracker:r,imagesTracker:l}=this.params,c=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new Ah(c,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:n},this.annotationCanvasMap,this.pageColors,r,l),this.gfx.beginDrawing({transform:s,viewport:i,transparency:e,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(e=null,n=0){if(this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#e)window.cancelAnimationFrame(this.#e),this.#e=null;Md.#t.delete(this._canvas),e||=new y2(`Rendering cancelled, page ${this._pageIndex+1}`,n),this.callback(e),this.task.onError?.(e)}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}if(this.gfx.dependencyTracker?.growOperationsCount(this.operatorList.fnArray.length),this.stepper?.updateOperatorList(this.operatorList),this.running)return;this._continue()}_continue(){if(this.running=!0,this.cancelled)return;if(this.task.onContinue)this.task.onContinue(this._scheduleNextBound);else this._scheduleNext()}_scheduleNext(){if(this._useRequestAnimationFrame)this.#e=window.requestAnimationFrame(()=>{this.#e=null,this._nextBound().catch(this._cancelBound)});else Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){if(this.cancelled)return;if(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length){if(this.running=!1,this.operatorList.lastChunk)this.gfx.endDrawing(),Md.#t.delete(this._canvas),this.callback()}}}var xL="6.3.289",kL="1c8020a7d";class Nr{#e=null;#t=null;#n;#i=null;#s=!1;#r=!1;#a=null;#o;#l=null;#c=null;static#f=null;static get _keyboardManager(){return en(this,"_keyboardManager",new rr([[["Escape"],Nr.prototype._hideDropdownFromKeyboard],[["Space"],Nr.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight"],Nr.prototype._moveToNext],[["ArrowUp","ArrowLeft"],Nr.prototype._moveToPrevious],[["Home"],Nr.prototype._moveToBeginning],[["End"],Nr.prototype._moveToEnd]]))}constructor({editor:e=null,uiManager:n=null}){if(e)this.#r=!1,this.#a=e;else this.#r=!0;this.#c=e?._uiManager||n,this.#o=this.#c._eventBus,this.#n=e?.color?.toUpperCase()||this.#c?.highlightColors.values().next().value||"#FFFF98",Nr.#f||=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"})}renderButton(){let e=this.#e=document.createElement("button");if(e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.ariaHasPopup="true",this.#a)e.ariaControls=`${this.#a.id}_colorpicker_dropdown`;let n=this.#c._signal;e.addEventListener("click",this.#g.bind(this),{signal:n}),e.addEventListener("keydown",this.#m.bind(this),{signal:n});let i=this.#t=document.createElement("span");return i.className="swatch",i.ariaHidden="true",i.style.backgroundColor=this.#n,e.append(i),e}renderMainDropdown(){let e=this.#i=this.#h();return e.ariaOrientation="horizontal",e.ariaLabelledBy="highlightColorPickerLabel",e}#h(){let e=document.createElement("div"),n=this.#c._signal;if(e.addEventListener("contextmenu",io,{signal:n}),e.className="dropdown",e.role="listbox",e.ariaMultiSelectable="false",e.ariaOrientation="vertical",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),this.#a)e.id=`${this.#a.id}_colorpicker_dropdown`;for(let[i,s]of this.#c.highlightColors){let a=document.createElement("button");a.tabIndex="0",a.role="option",a.setAttribute("data-color",s),a.title=i,a.setAttribute("data-l10n-id",Nr.#f[i]);let r=document.createElement("span");a.append(r),r.className="swatch",r.style.backgroundColor=s,a.ariaSelected=s===this.#n,a.addEventListener("click",this.#d.bind(this,s),{signal:n}),e.append(a)}return e.addEventListener("keydown",this.#m.bind(this),{signal:n}),e}#d(e,n){n.stopPropagation(),this.#o.dispatch("switchannotationeditorparams",{source:this,type:Pn.HIGHLIGHT_COLOR,value:e}),this.update(e)}_colorSelectFromKeyboard(e){if(e.target===this.#e){this.#g(e);return}let n=e.target.getAttribute("data-color");if(!n)return;this.#d(n,e)}_moveToNext(e){if(!this.#p){this.#g(e);return}if(e.target===this.#e){this.#i.firstElementChild?.focus();return}e.target.nextSibling?.focus()}_moveToPrevious(e){if(e.target===this.#i?.firstElementChild||e.target===this.#e){if(this.#p)this._hideDropdownFromKeyboard();return}if(!this.#p)this.#g(e);e.target.previousSibling?.focus()}_moveToBeginning(e){if(!this.#p){this.#g(e);return}this.#i.firstElementChild?.focus()}_moveToEnd(e){if(!this.#p){this.#g(e);return}this.#i.lastElementChild?.focus()}#m(e){Nr._keyboardManager.exec(this,e)}#g(e){if(this.#p){this.hideDropdown();return}if(this.#s=e.detail===0,!this.#l)this.#l=new AbortController,window.addEventListener("pointerdown",this.#u.bind(this),{signal:this.#c.combinedSignal(this.#l)});if(this.#e.ariaExpanded="true",this.#i){this.#i.classList.remove("hidden");return}let n=this.#i=this.#h();this.#e.append(n)}#u(e){if(this.#i?.contains(e.target))return;this.hideDropdown()}hideDropdown(){this.#i?.classList.add("hidden"),this.#e.ariaExpanded="false",this.#l?.abort(),this.#l=null}get#p(){return this.#i&&!this.#i.classList.contains("hidden")}_hideDropdownFromKeyboard(){if(this.#r)return;if(!this.#p){this.#a?.unselect();return}this.hideDropdown(),this.#e.focus({preventScroll:!0,focusVisible:this.#s})}update(e){if(this.#t)this.#t.style.backgroundColor=e;if(!this.#i)return;let n=this.#c.highlightColors.values();for(let i of this.#i.children)i.ariaSelected=n.next().value===e.toUpperCase()}destroy(){this.#e?.remove(),this.#e=null,this.#t=null,this.#i?.remove(),this.#i=null}}class lm{#e=null;#t=!1;#n=null;#i=null;static#s=null;constructor(e){this.#n=e,this.#i=e._uiManager,lm.#s||=Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"})}renderButton(){if(this.#e)return this.#e;let{editorType:e,colorType:n,colorAndOpacityType:i,opacityType:s,color:a,opacity:r}=this.#n,l=this.#t=ai.isAlphaColorInputSupported&&s!==void 0,c=this.#e=document.createElement("input");if(c.type="color",l){c.setAttribute("alpha","");let p=It.hexNums[Math.round((r??1)*255)];c.value=(a||"#000000")+p}else c.value=a||"#000000";return c.className="basicColorPicker",c.tabIndex=0,c.setAttribute("data-l10n-id",lm.#s[e]),c.addEventListener("input",()=>{if(l){let p=hm(c.value);if(!p)return;let[m,g,y,x]=p,j=It.makeHexColor(m,g,y);if(i!==void 0)this.#i.updateParams(i,{color:j,opacity:x});else this.#i.updateParams(n,j),this.#i.updateParams(s,x)}else this.#i.updateParams(n,c.value)},{signal:this.#i._signal}),c}update(e){if(!this.#e)return;if(this.#t){let n=It.hexNums[Math.round(this.#n.opacity*255)];this.#e.value=e+n}else this.#e.value=e}updateOpacity(e){if(!this.#e||!this.#t)return;let n=It.hexNums[Math.round(e*255)];this.#e.value=this.#n.color+n}destroy(){this.#e?.remove(),this.#e=null}hideDropdown(){}}function Qk(e){return Math.floor(vi(e,0,1)*255).toString(16).padStart(2,"0")}function Qp(e){return vi(e,0,1)*255}class a9{static CMYK_G([e,n,i,s]){return["G",1-Math.min(1,0.3*e+0.59*i+0.11*n+s)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return e=Qp(e),[e,e,e]}static G_HTML([e]){let n=Qk(e);return`#${n}${n}${n}`}static RGB_G([e,n,i]){return["G",0.3*e+0.59*n+0.11*i]}static RGB_rgb(e){return e.map(Qp)}static RGB_HTML(e){return`#${e.map(Qk).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,n,i,s]){return["RGB",1-Math.min(1,e+s),1-Math.min(1,i+s),1-Math.min(1,n+s)]}static CMYK_rgb([e,n,i,s]){return[Qp(1-Math.min(1,e+s)),Qp(1-Math.min(1,i+s)),Qp(1-Math.min(1,n+s))]}static CMYK_HTML(e){let n=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(n)}static RGB_CMYK([e,n,i]){let s=1-e,a=1-n,r=1-i,l=Math.min(s,a,r);return["CMYK",s,a,r,l]}}class rA{create(e,n,i=!1){if(e<=0||n<=0)throw Error("Invalid SVG dimensions");let s=this._createSVG("svg:svg");if(s.setAttribute("version","1.1"),!i)s.setAttribute("width",`${e}px`),s.setAttribute("height",`${n}px`);return s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox",`0 0 ${e} ${n}`),s}createElement(e){if(typeof e!=="string")throw Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){Un("Abstract method `_createSVG` called.")}}class cm extends rA{_createSVG(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}}var TL=9,Eh=new WeakSet,AL=new Date().getTimezoneOffset()*60*1000;class s2{static create(e){switch(e.data.annotationType){case Oi.LINK:return new j2(e);case Oi.TEXT:return new lA(e);case Oi.WIDGET:switch(e.data.fieldType){case"Tx":return new cA(e);case"Btn":if(e.data.radioButton)return new fA(e);else if(e.data.checkBox)return new hA(e);return new dA(e);case"Ch":return new pA(e);case"Sig":return new uA(e)}return new eu(e);case Oi.POPUP:return new u2(e);case Oi.FREETEXT:return new x9(e);case Oi.LINE:return new gA(e);case Oi.SQUARE:return new bA(e);case Oi.CIRCLE:return new wA(e);case Oi.POLYLINE:return new k9(e);case Oi.CARET:return new vA(e);case Oi.INK:return new E2(e);case Oi.POLYGON:return new yA(e);case Oi.HIGHLIGHT:return new T9(e);case Oi.UNDERLINE:return new SA(e);case Oi.SQUIGGLY:return new _A(e);case Oi.STRIKEOUT:return new xA(e);case Oi.STAMP:return new A9(e);case Oi.FILEATTACHMENT:return new kA(e);case Oi.RICHMEDIA:case Oi.SCREEN:case Oi.SOUND:return new C9(e);default:return new ki(e)}}}class ki{#e=null;#t=!1;#n=null;constructor(e,{isRenderable:n=!1,ignoreBorder:i=!1,createQuadrilaterals:s=!1}={}){if(this.isRenderable=n,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableComment=e.enableComment,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,this.hasOwnCommentButton=!1,n)this.contentElement=this.container=this._createContainer(i);if(s)this._createQuadrilaterals()}static _hasPopupData({contentsObj:e,richText:n}){return!!(e?.str||n?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return ki._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){let{data:e}=this,n=this.annotationStorage?.getEditor(e.id);if(n)return n.getData();return e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){let e=this.annotationStorage?.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;let{quadPoints:n,inkLists:i,rect:s}=this.data,a=-1/0,r=-1/0;if(n?.length>=8){for(let l=0;l<n.length;l+=8)if(n[l+1]>r)r=n[l+1],a=n[l+2];else if(n[l+1]===r)a=Math.max(a,n[l+2]);return[a,r]}if(i?.length>=1){for(let l of i)for(let c=0,p=l.length;c<p;c+=2)if(l[c+1]>r)r=l[c+1],a=l[c];else if(l[c+1]===r)a=Math.max(a,l[c]);if(a!==1/0)return[a,r]}if(s)return[s[2],s[3]];return null}_normalizePoint(e){let{page:{view:n},viewport:{rawDims:{pageWidth:i,pageHeight:s,pageX:a,pageY:r}}}=this.parent;return e[1]=n[3]-e[1]+n[1],e[0]=100*(e[0]-a)/i,e[1]=100*(e[1]-r)/s,e}get commentText(){let{data:e}=this;return this.annotationStorage.getRawValue(`pdfjs_internal_editor_${e.id}`)?.popup?.contents||e.contentsObj?.str||""}set commentText(e){let{data:n}=this,i={deleted:!e,contents:e||""};if(!this.annotationStorage.updateEditor(n.id,{popup:i}))this.annotationStorage.setValue(`pdfjs_internal_editor_${n.id}`,{id:n.id,annotationType:n.annotationType,page:this.parent.page,popup:i,popupRef:n.popupRef,modificationDate:new Date});if(!e)this.removePopup()}removePopup(){(this.#n?.popup||this.popup)?.remove(),this.#n=this.popup=null}updateEdited(e){if(!this.container)return;if(e.rect)this.#e||={rect:this.data.rect.slice(0)};let{rect:n,popup:i}=e;if(n)this.#i(n);let s=this.#n?.popup||this.popup;if(!s&&i?.text)this._createPopup(i),s=this.#n.popup;if(!s)return;if(s.updateEdited(e),i?.deleted)s.remove(),this.#n=null,this.popup=null}resetEdited(){if(!this.#e)return;this.#i(this.#e.rect),this.#n?.popup.resetEdited(),this.#e=null}#i(e){let{container:{style:n},data:{rect:i,rotation:s},parent:{viewport:{rawDims:{pageWidth:a,pageHeight:r,pageX:l,pageY:c}}}}=this;if(i?.splice(0,4,...e),n.left=`${100*(e[0]-l)/a}%`,n.top=`${100*(r-e[3]+c)/r}%`,s===0)n.width=`${100*(e[2]-e[0])/a}%`,n.height=`${100*(e[3]-e[1])/r}%`;else this.setRotation(s)}_createContainer(e){let{data:n,parent:{page:i,viewport:s}}=this,a=document.createElement("section");if(a.setAttribute("data-annotation-id",n.id),!(this instanceof eu)&&!(this instanceof j2)&&!(this instanceof C9))a.tabIndex=0;let{style:r}=a;if(r.zIndex=this.parent.zIndex,this.parent.zIndex+=2,n.alternativeText)a.title=n.alternativeText;if(n.noRotate)a.classList.add("norotate");if(!n.rect||this instanceof u2){let{rotation:I}=n;if(!n.hasOwnCanvas&&I!==0)this.setRotation(I,a);return a}let{width:l,height:c}=this;if(!e&&n.borderStyle.width>0){r.borderWidth=`${n.borderStyle.width}px`;let I=n.borderStyle.horizontalCornerRadius,P=n.borderStyle.verticalCornerRadius;if(I>0||P>0){let Y=`calc(${I}px * var(--total-scale-factor)) / calc(${P}px * var(--total-scale-factor))`;r.borderRadius=Y}switch(n.borderStyle.style){case qd.SOLID:r.borderStyle="solid";break;case qd.DASHED:r.borderStyle="dashed";break;case qd.BEVELED:yn("Unimplemented border style: beveled");break;case qd.INSET:yn("Unimplemented border style: inset");break;case qd.UNDERLINE:r.borderBottomStyle="solid";break;default:break}let X=n.borderColor||null;if(X)this.#t=!0,r.borderColor=It.makeHexColor(...X);else r.borderWidth=0}let p=It.normalizeRect([n.rect[0],i.view[3]-n.rect[1]+i.view[1],n.rect[2],i.view[3]-n.rect[3]+i.view[1]]),{pageWidth:m,pageHeight:g,pageX:y,pageY:x}=s.rawDims;r.left=`${100*(p[0]-y)/m}%`,r.top=`${100*(p[1]-x)/g}%`;let{rotation:j}=n;if(n.hasOwnCanvas||j===0)r.width=`${100*l/m}%`,r.height=`${100*c/g}%`;else this.setRotation(j,a);return a}setRotation(e,n=this.container){if(!this.data.rect)return;let{pageWidth:i,pageHeight:s}=this.parent.viewport.rawDims,{width:a,height:r}=this;if(e%180!==0)[a,r]=[r,a];n.style.width=`${100*a/i}%`,n.style.height=`${100*r/s}%`,n.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){let e=(n,i,s)=>{let a=s.detail[n],r=a[0],l=a.slice(1);s.target.style[i]=a9[`${r}_HTML`](l),this.annotationStorage.setValue(this.data.id,{[i]:a9[`${r}_rgb`](l)})};return en(this,"_commonActions",{display:(n)=>{let{display:i}=n.detail,s=i%2===1;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:s,noPrint:i===1||i===2})},print:(n)=>{this.annotationStorage.setValue(this.data.id,{noPrint:!n.detail.print})},hidden:(n)=>{let{hidden:i}=n.detail;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:i,noView:i})},focus:(n)=>{setTimeout(()=>n.target.focus({preventScroll:!1}),0)},userName:(n)=>{n.target.title=n.detail.userName},readonly:(n)=>{n.target.disabled=n.detail.readonly},required:(n)=>{this._setRequired(n.target,n.detail.required)},bgColor:(n)=>{e("bgColor","backgroundColor",n)},fillColor:(n)=>{e("fillColor","backgroundColor",n)},fgColor:(n)=>{e("fgColor","color",n)},textColor:(n)=>{e("textColor","color",n)},borderColor:(n)=>{e("borderColor","borderColor",n)},strokeColor:(n)=>{e("strokeColor","borderColor",n)},rotation:(n)=>{let i=n.detail.rotation;this.setRotation(i),this.annotationStorage.setValue(this.data.id,{rotation:i})}})}_dispatchEventFromSandbox(e,n){let i=this._commonActions;for(let s of Object.keys(n.detail))(e[s]||i[s])?.(n)}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;let n=this.annotationStorage.getRawValue(this.data.id);if(!n)return;let i=this._commonActions;for(let[s,a]of Object.entries(n)){let r=i[s];if(r){let l={detail:{[s]:a},target:e};r(l),delete n[s]}}}_createQuadrilaterals(){if(!this.container)return;let{quadPoints:e}=this.data;if(!e)return;let[n,i,s,a]=this.data.rect.map(Math.fround);if(e.length===8){let[I,P,X,Y]=e.subarray(2,6);if(s===I&&a===P&&n===X&&i===Y)return}let{style:r}=this.container,l;if(this.#t){let{borderColor:I,borderWidth:P}=r;r.borderWidth=0,l=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${I}" stroke-width="${P}">`],this.container.classList.add("hasBorder")}let c=s-n,p=a-i,{svgFactory:m}=this,g=m.createElement("svg");g.classList.add("quadrilateralsContainer"),g.setAttribute("width",0),g.setAttribute("height",0),g.role="none";let y=m.createElement("defs");g.append(y);let x=m.createElement("clipPath"),j=`clippath_${this.data.id}`;x.setAttribute("id",j),x.setAttribute("clipPathUnits","objectBoundingBox"),y.append(x);for(let I=2,P=e.length;I<P;I+=8){let X=e[I],Y=e[I+1],J=e[I+2],ne=e[I+3],ae=m.createElement("rect"),se=(J-n)/c,oe=(a-Y)/p,he=(X-J)/c,we=(Y-ne)/p;ae.setAttribute("x",se),ae.setAttribute("y",oe),ae.setAttribute("width",he),ae.setAttribute("height",we),x.append(ae),l?.push(`<rect vector-effect="non-scaling-stroke" x="${se}" y="${oe}" width="${he}" height="${we}"/>`)}if(this.#t)l.push("</g></svg>')"),r.backgroundImage=l.join("");this.container.append(g),this.container.style.clipPath=`url(#${j})`}_createPopup(e=null){let{data:n}=this,i,s;if(e)i={str:e.text},s=e.date;else i=n.contentsObj,s=n.modificationDate;this.#n=new u2({data:{color:n.color,titleObj:n.titleObj,modificationDate:s,contentsObj:i,richText:n.richText,parentRect:n.rect,borderStyle:0,id:`popup_${n.id}`,rotation:n.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]})}get hasPopupElement(){return!!(this.#n||this.popup||this.data.popupRef)}get extraPopupElement(){return this.#n}render(){Un("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,n=null){let i=[];if(this._fieldObjects){let s=this._fieldObjects.get(e)||[];for(let{page:a,id:r,exportValues:l}of s){if(a===-1)continue;if(r===n)continue;let c=typeof l==="string"?l:null,p=document.querySelector(`[data-element-id="${r}"]`);if(p&&!Eh.has(p)){yn(`_getElementsByName - element not allowed: ${r}`);continue}i.push({id:r,exportValue:c,domElement:p})}return i}for(let s of document.getElementsByName(e)){let{exportValue:a}=s,r=s.getAttribute("data-element-id");if(r===n)continue;if(!Eh.has(s))continue;i.push({id:r,exportValue:a,domElement:s})}return i}show(){if(this.container)this.container.hidden=!1;this.popup?.maybeShow()}hide(){if(this.container)this.container.hidden=!0;this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){let e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(let n of e)n.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:e,data:{id:n}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:e,editId:n,mustEnterInEditMode:!0})})}updateOC(e){if(!this.data.oc||!e)return;if(e.isVisible(this.data.oc))this.show();else this.hide()}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}_setBackgroundColor(e){let n=this.data.backgroundColor||null;e.style.backgroundColor=n===null?"transparent":It.makeHexColor(...n)}}class oA extends ki{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});this.editor=e.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){let{editor:e}=this;if(!e.hasComment)return;this._createPopup(e.comment)}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(e){if(this.editor.comment=e,!e)this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.parent.removeAnnotation(this.data.id),this.container.remove(),this.container=null,this.removePopup()}}class j2 extends ki{constructor(e,n=null){super(e,{isRenderable:!0,ignoreBorder:!!n?.ignoreBorder,createQuadrilaterals:!0});this.isTooltipOnly=e.data.isTooltipOnly}render(){let{data:e,linkService:n}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let s=!1;if(e.url)n.addLinkAttributes(i,e.url,e.newWindow),s=!0;else if(e.action)this._bindNamedAction(i,e.action,e.overlaidText),s=!0;else if(e.attachment)this.#t(i,e.attachmentId,e.attachment,e.overlaidText,e.attachmentDest),s=!0;else if(e.setOCGState)this.#n(i,e.setOCGState,e.overlaidText),s=!0;else if(e.dest)this._bindLink(i,e.dest,e.overlaidText),s=!0;else{if(e.actions&&(e.actions.has("Action")||e.actions.has("Mouse Up")||e.actions.has("Mouse Down"))&&this.enableScripting&&this.hasJSActions)this._bindJSAction(i,e),s=!0;if(e.resetForm)this._bindResetFormAction(i,e.resetForm),s=!0;else if(this.isTooltipOnly&&!s)this._bindLink(i,""),s=!0}if(this.container.classList.add("linkAnnotation"),s)this.contentElement=i,this.container.append(i);return this.container}#e(){this.container.setAttribute("data-internal-link","")}_bindLink(e,n,i=""){if(e.href=this.linkService.getDestinationHash(n),e.onclick=()=>{if(n)this.linkService.goToDestination(n);return!1},n||n==="")this.#e();if(i)e.title=i}_bindNamedAction(e,n,i=""){if(e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(n),!1),i)e.title=i;this.#e()}#t(e,n,i,s="",a=null){if(e.href=this.linkService.getAnchorUrl(""),i.description)e.title=i.description;else if(s)e.title=s;let r=async()=>{let l=await this.linkService.getAttachmentContent(n);if(l)this.downloadManager?.openOrDownloadData(l,i.filename,a)};e.onclick=()=>(r(),!1),this.#e()}#n(e,n,i=""){if(e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(n),!1),i)e.title=i;this.#e()}_bindJSAction(e,{actions:n,id:i,overlaidText:s}){e.href=this.linkService.getAnchorUrl("");let a=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let r of n.keys()){let l=a.get(r);if(!l)continue;e[l]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:r}}),!1)}if(s)e.title=s;e.onclick||=()=>!1,this.#e()}_bindResetFormAction(e,n){let i=e.onclick;if(!i)e.href=this.linkService.getAnchorUrl("");if(this.#e(),!this._fieldObjects){if(yn('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),!i)e.onclick=()=>!1;return}e.onclick=()=>{i?.();let{fields:s,refs:a,include:r}=n,l=[];if(s.length!==0||a.length!==0){let m=new Set(a);for(let g of s){let y=this._fieldObjects.get(g)||[];for(let{id:x}of y)m.add(x)}for(let g of this._fieldObjects.values())for(let y of g)if(m.has(y.id)===r)l.push(y)}else for(let m of this._fieldObjects.values())l.push(...m);let c=this.annotationStorage,p=[];for(let m of l){let{id:g}=m;switch(p.push(g),m.type){case"text":{let x=m.defaultValue||"";c.setValue(g,{value:x});break}case"checkbox":case"radiobutton":{let x=m.defaultValue===m.exportValues;c.setValue(g,{value:x});break}case"combobox":case"listbox":{let x=m.defaultValue||"";c.setValue(g,{value:x});break}default:continue}let y=document.querySelector(`[data-element-id="${g}"]`);if(!y)continue;else if(!Eh.has(y)){yn(`_bindResetFormAction - element not allowed: ${g}`);continue}y.dispatchEvent(new Event("resetform"))}if(this.enableScripting)this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:p,name:"ResetForm"}});return!1}}}class lA extends ki{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");let e=document.createElement("img");if(e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this.container.append(e),this.container}}class eu extends ki{render(){return this.container}_getKeyModifier(e){return ai.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,n,i,s,a){if(i.includes("mouse"))e.addEventListener(i,(r)=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:a(r),shift:r.shiftKey,modifier:this._getKeyModifier(r)}})});else e.addEventListener(i,(r)=>{if(i==="blur"){if(!n.focused||!r.relatedTarget)return;n.focused=!1}else if(i==="focus"){if(n.focused)return;n.focused=!0}if(!a)return;this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:a(r)}})})}_setEventListeners(e,n,i,s){let{actions:a}=this.data;for(let[r,l]of i)if(l==="Action"||a?.has(l)){if(l==="Focus"||l==="Blur")n||={focused:!1};if(this._setEventListener(e,n,r,l,s),l==="Focus"&&!a?.has("Blur"))this._setEventListener(e,n,"blur","Blur",null);else if(l==="Blur"&&!a?.has("Focus"))this._setEventListener(e,n,"focus","Focus",null)}}_setTextStyle(e){let n=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||TL,a=e.style,r,l=2,c=(p)=>Math.round(10*p)/10;if(this.data.multiLine){let p=Math.abs(this.data.rect[3]-this.data.rect[1]-2),m=Math.round(p/(1.35*s))||1,g=p/m;r=Math.min(s,c(g/1.35))}else{let p=Math.abs(this.data.rect[3]-this.data.rect[1]-2);r=Math.min(s,c(p/1.35))}if(a.fontSize=`calc(${r}px * var(--total-scale-factor))`,a.color=It.makeHexColor(...i),this.data.textAlignment!==null&&!this.data.comb)a.textAlign=n[this.data.textAlignment]}_setRequired(e,n){if(n)e.setAttribute("required",!0);else e.removeAttribute("required");e.setAttribute("aria-required",n)}}class cA extends eu{constructor(e){let n=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:n})}setPropertyOnSiblings(e,n,i,s){let a=this.annotationStorage;for(let r of this._getElementsByName(e.name,e.id)){if(r.domElement)r.domElement[n]=i;a.setValue(r.id,{[s]:i})}}render(){let e=this.annotationStorage,n=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){let s=e.getValue(n,{value:this.data.fieldValue}),a=s.value||"",r=e.getValue(n,{charLimit:this.data.maxLen}).charLimit;if(r&&a.length>r)a=a.slice(0,r);let l=s.formattedValue||this.data.textContent?.join(`
|
|
289
|
+
`)||null;if(l&&this.data.comb)l=l.replaceAll(/\s+/g,"");let c={userValue:a,formattedValue:l,lastCommittedValue:null,commitKey:1,focused:!1};if(this.data.multiLine){if(i=document.createElement("textarea"),i.textContent=l??a,this.data.doNotScroll)i.style.overflowY="hidden"}else if(i=document.createElement("input"),i.type=this.data.password?"password":"text",i.setAttribute("value",l??a),this.data.doNotScroll)i.style.overflowX="hidden";if(this.data.hasOwnCanvas){if(this.container.classList.add("hasOwnCanvas"),e.has(n))this.container.classList.add("sandboxModified")}Eh.add(i),this.contentElement=i,i.setAttribute("data-element-id",n),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=0;let{datetimeFormat:p,datetimeType:m,timeStep:g}=this.data,y=!!m&&this.enableScripting;if(p)i.title=p;if(this._setRequired(i,this.data.required),r)i.maxLength=r;i.addEventListener("input",(j)=>{e.setValue(n,{value:j.target.value}),this.setPropertyOnSiblings(i,"value",j.target.value,"value"),c.formattedValue=null}),i.addEventListener("resetform",(j)=>{let I=this.data.defaultFieldValue??"";i.value=c.userValue=I,c.formattedValue=null});let x=(j)=>{let{formattedValue:I}=c;if(I!==null&&I!==void 0)j.target.value=I;j.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",(I)=>{if(c.focused)return;let{target:P}=I;if(y){if(P.type=m,g)P.step=g}if(c.userValue){let X=c.userValue;if(y)if(m==="time"){let Y=new Date(X),J=[Y.getHours(),Y.getMinutes(),Y.getSeconds()];P.value=J.map((ne)=>ne.toString().padStart(2,"0")).join(":")}else P.value=new Date(X-AL).toISOString().split(m==="date"?"T":".",1)[0];else P.value=X}if(c.lastCommittedValue=P.value,c.commitKey=1,!this.data.actions?.has("Focus"))c.focused=!0}),i.addEventListener("updatefromsandbox",(I)=>{this.container.classList.add("sandboxModified");let P={value(X){if(c.userValue=X.detail.value??"",!y)e.setValue(n,{value:c.userValue.toString()});X.target.value=c.userValue},formattedValue(X){let{formattedValue:Y}=X.detail;if(c.formattedValue=Y,Y!==null&&Y!==void 0&&X.target!==document.activeElement)X.target.value=Y;let J={formattedValue:Y};if(y)J.value=Y;e.setValue(n,J)},selRange(X){X.target.setSelectionRange(...X.detail.selRange)},charLimit:(X)=>{let{charLimit:Y}=X.detail,{target:J}=X;if(Y===0){J.removeAttribute("maxLength");return}J.setAttribute("maxLength",Y);let ne=c.userValue;if(!ne||ne.length<=Y)return;ne=ne.slice(0,Y),J.value=c.userValue=ne,e.setValue(n,{value:ne}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:ne,willCommit:!0,commitKey:1,selStart:J.selectionStart,selEnd:J.selectionEnd}})}};this._dispatchEventFromSandbox(P,I)}),i.addEventListener("keydown",(I)=>{c.commitKey=1;let P=-1;if(I.key==="Escape")P=0;else if(I.key==="Enter"&&!this.data.multiLine)P=2;else if(I.key==="Tab")c.commitKey=3;if(P===-1)return;let{value:X}=I.target;if(c.lastCommittedValue===X)return;c.lastCommittedValue=X,c.userValue=X,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:X,willCommit:!0,commitKey:P,selStart:I.target.selectionStart,selEnd:I.target.selectionEnd}})});let j=x;if(x=null,i.addEventListener("blur",(I)=>{if(!c.focused||!I.relatedTarget)return;if(!this.data.actions?.has("Blur"))c.focused=!1;let{target:P}=I,{value:X}=P;if(y){if(X&&m==="time"){let Y=X.split(":").map((J)=>parseInt(J,10));X=new Date(2000,0,1,Y[0],Y[1],Y[2]||0).valueOf(),P.step=""}else{if(!X.includes("T"))X=`${X}T00:00`;X=new Date(X).valueOf()}P.type="text"}if(c.userValue=X,c.lastCommittedValue!==X)this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:X,willCommit:!0,commitKey:c.commitKey,selStart:I.target.selectionStart,selEnd:I.target.selectionEnd}});j(I)}),this.data.actions?.has("Keystroke"))i.addEventListener("beforeinput",(I)=>{c.lastCommittedValue=null;let{data:P,target:X}=I,{value:Y,selectionStart:J,selectionEnd:ne}=X,ae=J,se=ne;switch(I.inputType){case"deleteWordBackward":{let oe=/\w/;while(ae>0&&!oe.test(Y[ae-1]))ae--;while(ae>0&&oe.test(Y[ae-1]))ae--;break}case"deleteWordForward":{let oe=Y.substring(J).match(/^\W*\w*/);if(oe)se+=oe[0].length;break}case"deleteContentBackward":if(J===ne)ae-=1;break;case"deleteContentForward":if(J===ne)se+=1;break}I.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:Y,change:P||"",willCommit:!1,selStart:ae,selEnd:se}})});this._setEventListeners(i,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(I)=>I.target.value)}if(x)i.addEventListener("blur",x);if(this.data.comb){let I=(this.data.rect[2]-this.data.rect[0])/r;i.classList.add("comb"),i.style.setProperty("--comb-width",`calc(${I}px * var(--total-scale-factor))`);let P=this.data.textAlignment;if(P===1||P===2){let X=()=>{let Y=r-i.value.length;i.style.setProperty("--comb-offset",`${P===1?Y>>1:Y}`)};X();for(let Y of["input","blur","resetform","updatefromsandbox"])i.addEventListener(Y,X)}}}else if(i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas)i.hidden=!0;return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class uA extends eu{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class hA extends eu{constructor(e){super(e,{isRenderable:e.renderForms})}render(){let e=this.annotationStorage,n=this.data,i=n.id,s=e.getValue(i,{value:n.exportValue===n.fieldValue}).value;if(typeof s==="string")s=s!=="Off",e.setValue(i,{value:s});this.container.classList.add("buttonWidgetAnnotation","checkBox");let a=document.createElement("input");if(Eh.add(a),a.setAttribute("data-element-id",i),a.disabled=n.readOnly,this._setRequired(a,this.data.required),a.type="checkbox",a.name=n.fieldName,s)a.setAttribute("checked",!0);if(a.setAttribute("exportValue",n.exportValue),a.tabIndex=0,a.addEventListener("change",(r)=>{let{name:l,checked:c}=r.target;for(let p of this._getElementsByName(l,i)){let m=c&&p.exportValue===n.exportValue;if(p.domElement)p.domElement.checked=m;e.setValue(p.id,{value:m})}e.setValue(i,{value:c})}),a.addEventListener("resetform",(r)=>{let l=n.defaultFieldValue||"Off";r.target.checked=l===n.exportValue}),this.enableScripting&&this.hasJSActions)a.addEventListener("updatefromsandbox",(r)=>{let l={value(c){c.target.checked=c.detail.value!=="Off",e.setValue(i,{value:c.target.checked})}};this._dispatchEventFromSandbox(l,r)}),this._setEventListeners(a,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(r)=>r.target.checked);return this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class fA extends eu{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let e=this.annotationStorage,n=this.data,i=n.id,s=e.getValue(i,{value:n.buttonValue!==null&&n.fieldValue===n.buttonValue}).value;if(typeof s==="string")s=s!==n.buttonValue,e.setValue(i,{value:s});if(s)for(let r of this._getElementsByName(n.fieldName,i))e.setValue(r.id,{value:!1});let a=document.createElement("input");if(Eh.add(a),a.setAttribute("data-element-id",i),a.disabled=n.readOnly,this._setRequired(a,this.data.required),a.type="radio",a.name=n.fieldName,s)a.setAttribute("checked",!0);if(a.tabIndex=0,a.addEventListener("change",(r)=>{let{name:l,checked:c}=r.target;for(let p of this._getElementsByName(l,i))e.setValue(p.id,{value:!1});e.setValue(i,{value:c})}),a.addEventListener("resetform",(r)=>{let l=n.defaultFieldValue;r.target.checked=l!==null&&l!==void 0&&l===n.buttonValue}),this.enableScripting&&this.hasJSActions){let r=n.buttonValue;a.addEventListener("updatefromsandbox",(l)=>{let c={value:(p)=>{let m=r===p.detail.value;for(let g of this._getElementsByName(p.target.name)){let y=m&&g.id===i;if(g.domElement)g.domElement.checked=y;e.setValue(g.id,{value:y})}}};this._dispatchEventFromSandbox(c,l)}),this._setEventListeners(a,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(l)=>l.target.checked)}return this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class dA extends j2{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){let e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");let n=e.lastChild;if(this.enableScripting&&this.hasJSActions&&n)this._setDefaultPropertiesFromJS(n),n.addEventListener("updatefromsandbox",(i)=>{this._dispatchEventFromSandbox({},i)});return e}}class pA extends eu{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");let e=this.annotationStorage,n=this.data.id,i=e.getValue(n,{value:this.data.fieldValue}),s=document.createElement("select");Eh.add(s),s.setAttribute("data-element-id",n),s.disabled=this.data.readOnly,this._setRequired(s,this.data.required),s.name=this.data.fieldName,s.tabIndex=0;let a=this.data.combo&&this.data.options.length>0;if(!this.data.combo){if(s.size=this.data.options.length,this.data.multiSelect)s.multiple=!0}s.addEventListener("resetform",(g)=>{let y=this.data.defaultFieldValue;for(let x of s.options)x.selected=x.value===y});let r=(g,y)=>{let x=y.replaceAll(" "," ");if(g.textContent=x,x!==y)g.setAttribute("display-value",y)};for(let g of this.data.options){let y=document.createElement("option");if(r(y,g.displayValue),y.value=g.exportValue,i.value.includes(g.exportValue))y.setAttribute("selected",!0),a=!1;s.append(y)}let l=null;if(a){let g=document.createElement("option");g.value=" ",g.setAttribute("hidden",!0),g.setAttribute("selected",!0),s.prepend(g),l=()=>{g.remove(),s.removeEventListener("input",l),l=null},s.addEventListener("input",l)}let c=(g)=>{let y=g?"value":"textContent",{options:x,multiple:j}=s;if(!j)return x.selectedIndex===-1?null:x[x.selectedIndex][y];return Array.prototype.filter.call(x,(I)=>I.selected).map((I)=>I[y])},p=c(!1),m=(g)=>{let y=g.target.options;return Array.prototype.map.call(y,(x)=>({displayValue:x.getAttribute("display-value")||x.textContent,exportValue:x.value}))};if(this.enableScripting&&this.hasJSActions)s.addEventListener("updatefromsandbox",(g)=>{let y={value(x){l?.();let j=x.detail.value,I=new Set(Array.isArray(j)?j:[j]);for(let P of s.options)P.selected=I.has(P.value);e.setValue(n,{value:c(!0)}),p=c(!1)},multipleSelection(x){s.multiple=!0},remove(x){let j=s.options,I=x.detail.remove;if(j[I].selected=!1,s.remove(I),j.length>0){if(Array.prototype.findIndex.call(j,(X)=>X.selected)===-1)j[0].selected=!0}e.setValue(n,{value:c(!0),items:m(x)}),p=c(!1)},clear(x){while(s.length!==0)s.remove(0);e.setValue(n,{value:null,items:[]}),p=c(!1)},insert(x){let{index:j,displayValue:I,exportValue:P}=x.detail.insert,X=s.children[j],Y=document.createElement("option");if(r(Y,I),Y.value=P,X)X.before(Y);else s.append(Y);e.setValue(n,{value:c(!0),items:m(x)}),p=c(!1)},items(x){let{items:j}=x.detail;while(s.length!==0)s.remove(0);for(let I of j){let{displayValue:P,exportValue:X}=I,Y=document.createElement("option");r(Y,P),Y.value=X,s.append(Y)}if(s.options.length>0)s.options[0].selected=!0;e.setValue(n,{value:c(!0),items:m(x)}),p=c(!1)},indices(x){let j=new Set(x.detail.indices);for(let I of x.target.options)I.selected=j.has(I.index);e.setValue(n,{value:c(!0)}),p=c(!1)},editable(x){x.target.disabled=!x.detail.editable}};this._dispatchEventFromSandbox(y,g)}),s.addEventListener("input",(g)=>{let y=c(!0),x=c(!1);e.setValue(n,{value:y}),g.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:p,change:x,changeEx:y,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(s,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(g)=>g.target.value);else s.addEventListener("input",function(g){e.setValue(n,{value:c(!0)})});if(this.data.combo)this._setTextStyle(s);return this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class u2 extends ki{constructor(e){let{data:n,elements:i,parent:s}=e,a=!!s._commentManager;super(e,{isRenderable:!a&&ki._hasPopupData(n)});if(this.elements=i,a&&ki._hasPopupData(n)){let r=this.popup=this.#e();for(let l of i)l.popup=r}else this.popup=null}#e(){return new mA({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})}render(){let{container:e}=this;e.classList.add("popupAnnotation"),e.role="comment";let n=this.popup=this.#e(),i=[];for(let s of this.elements)s.popup=n,s.container.ariaHasPopup="dialog",i.push(s.data.id),s.addHighlightArea();return this.container.setAttribute("aria-controls",i.map((s)=>`pdfjs_internal_id_${s}`).join(",")),this.container}}class mA{#e=null;#t=this.#G.bind(this);#n=this.#S.bind(this);#i=this.#A.bind(this);#s=this.#H.bind(this);#r=null;#a=null;#o=null;#l=null;#c=null;#f=null;#h=null;#d=!1;#m=null;#g=null;#u=null;#p=null;#b=null;#w=null;#y=null;#v=null;#x=null;#_=null;#k=!1;#T=null;#q=null;constructor({container:e,color:n,elements:i,titleObj:s,modificationDate:a,contentsObj:r,richText:l,parent:c,rect:p,parentRect:m,open:g,commentManager:y=null}){if(this.#a=e,this.#x=s,this.#o=r,this.#v=l,this.#f=c,this.#r=n,this.#y=p,this.#h=m,this.#c=i,this.#e=y,this.#T=i[0],this.#l=o2.toDateObject(a),this.trigger=i.flatMap((x)=>x.getElementsToTriggerPopup()),!y){if(this.#j(),this.#a.hidden=!0,g)this.#H()}}#j(){if(this.#g)return;this.#g=new AbortController;let{signal:e}=this.#g;for(let n of this.trigger)n.addEventListener("click",this.#s,{signal:e}),n.addEventListener("pointerenter",this.#i,{signal:e}),n.addEventListener("pointerleave",this.#n,{signal:e}),n.classList.add("popupTriggerArea");for(let n of this.#c)n.container?.addEventListener("keydown",this.#t,{signal:e})}#C(){let e=this.#c.find((n)=>n.hasCommentButton);if(!e)return;this.#b=e._normalizePoint(e.commentButtonPosition)}renderCommentButton(){if(this.#p){if(!this.#p.parentNode)this.#T.container.after(this.#p);return}if(!this.#b)this.#C();if(!this.#b)return;let{signal:e}=this.#g=new AbortController,n=this.#T.hasOwnCommentButton,i=()=>{this.#e.toggleCommentPopup(this,!0,void 0,!n)},s=()=>{this.#e.toggleCommentPopup(this,!1,!0,!n)},a=()=>{this.#e.toggleCommentPopup(this,!1,!1)};if(!n){let r=this.#p=document.createElement("button");r.className="annotationCommentButton";let l=this.#T.container;r.style.zIndex=parseInt(l.style.zIndex,10)+1,r.tabIndex=0,r.ariaHasPopup="dialog",r.ariaControls="commentPopup",r.setAttribute("data-l10n-id","pdfjs-show-comment-button"),this.#D(),this.#I(),r.addEventListener("keydown",this.#t,{signal:e}),r.addEventListener("click",i,{signal:e}),r.addEventListener("pointerenter",s,{signal:e}),r.addEventListener("pointerleave",a,{signal:e}),l.after(r)}else{this.#p=this.#T.container;for(let r of this.trigger)r.ariaHasPopup="dialog",r.ariaControls="commentPopup",r.addEventListener("keydown",this.#t,{signal:e}),r.addEventListener("click",i,{signal:e}),r.addEventListener("pointerenter",s,{signal:e}),r.addEventListener("pointerleave",a,{signal:e}),r.classList.add("popupTriggerArea")}}#I(){if(this.#T.extraPopupElement&&!this.#T.editor)return;if(!this.#p)this.renderCommentButton();let[e,n]=this.#b,{style:i}=this.#p;i.left=`calc(${e}%)`,i.top=`calc(${n}% - var(--comment-button-dim))`}#D(){if(this.#T.extraPopupElement)return;if(!this.#p)this.renderCommentButton();this.#p.style.backgroundColor=this.commentButtonColor||""}get commentButtonColor(){let{color:e,opacity:n}=this.#T.commentData;if(!e)return null;return this.#f._commentManager.makeCommentColor(e,n)}focusCommentButton(){setTimeout(()=>{this.#p?.focus()},0)}getData(){let{richText:e,color:n,opacity:i,creationDate:s,modificationDate:a}=this.#T.commentData;return{contentsObj:{str:this.comment},richText:e,color:n,opacity:i,creationDate:s,modificationDate:a}}get elementBeforePopup(){return this.#p}get comment(){return this.#q||=this.#T.commentText,this.#q}set comment(e){if(e===this.comment)return;this.#T.commentText=this.#q=e}focus(){this.#T.container?.focus()}get parentBoundingClientRect(){return this.#T.layer.getBoundingClientRect()}setCommentButtonStates({selected:e,hasPopup:n}){if(!this.#p)return;this.#p.classList.toggle("selected",e),this.#p.ariaExpanded=n}setSelectedCommentButton(e){this.#p.classList.toggle("selected",e)}get commentPopupPosition(){if(this.#w)return this.#w;let{x:e,y:n,height:i}=this.#p.getBoundingClientRect(),{x:s,y:a,width:r,height:l}=this.#T.layer.getBoundingClientRect();return[(e-s)/r,(n+i-a)/l]}set commentPopupPosition(e){this.#w=e}hasDefaultPopupPosition(){return this.#w===null}get commentButtonPosition(){return this.#b}get commentButtonWidth(){return this.#p.getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(e){let[n,i]=this.#w||this.commentButtonPosition.map((p)=>p/100),s=this.parentBoundingClientRect,{x:a,y:r,width:l,height:c}=s;this.#e.showDialog(null,this,a+n*l,r+i*c,{...e,parentDimensions:s})}render(){if(this.#m)return;let e=this.#m=document.createElement("div");if(e.className="popup",this.#r){let i=e.style.outlineColor=It.makeHexColor(...this.#r);e.style.backgroundColor=`color-mix(in srgb, ${i} 30%, white)`}let n=document.createElement("span");if(n.className="header",this.#x?.str){let i=document.createElement("span");i.className="title",n.append(i),{dir:i.dir,str:i.textContent}=this.#x}if(e.append(n),this.#l){let i=document.createElement("time");i.className="popupDate",i.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),i.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#l.valueOf()})),i.dateTime=this.#l.toISOString(),n.append(i)}aT({html:this.#M||this.#o.str,dir:this.#o?.dir,className:"popupContent"},e),this.#a.append(e)}get#M(){let e=this.#v,n=this.#o;if(e?.str&&(!n?.str||n.str===e.str))return this.#v.html||null;return null}get#L(){return this.#M?.attributes?.style?.fontSize||0}get#R(){return this.#M?.attributes?.style?.color||null}#F(e){let n=[],i={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:n}]}},s={style:{color:this.#R,fontSize:this.#L?`calc(${this.#L}px * var(--total-scale-factor))`:""}};for(let a of e.split(`
|
|
290
|
+
`))n.push({name:"span",value:a,attributes:s});return i}#G(e){if(e.altKey||e.shiftKey||e.ctrlKey||e.metaKey)return;if(e.key==="Enter"||e.key==="Escape"&&this.#d)this.#H()}updateEdited({rect:e,popup:n,deleted:i}){if(this.#e){if(i)this.remove(),this.#q=null;else if(n)if(n.deleted)this.remove();else this.#D(),this.#q=n.text;if(e)this.#b=null,this.#C(),this.#I();return}if(i||n?.deleted){this.remove();return}if(this.#j(),this.#_||={contentsObj:this.#o,richText:this.#v},e)this.#u=null;if(n&&n.text)this.#v=this.#F(n.text),this.#l=o2.toDateObject(n.date),this.#o=null;this.#m?.remove(),this.#m=null}resetEdited(){if(!this.#_)return;({contentsObj:this.#o,richText:this.#v}=this.#_),this.#_=null,this.#m?.remove(),this.#m=null,this.#u=null}remove(){if(this.#g?.abort(),this.#g=null,this.#m?.remove(),this.#m=null,this.#k=!1,this.#d=!1,this.#p?.remove(),this.#p=null,this.trigger)for(let e of this.trigger)e.classList.remove("popupTriggerArea")}#N(){if(this.#u!==null)return;let{page:{view:e},viewport:{rawDims:{pageWidth:n,pageHeight:i,pageX:s,pageY:a}}}=this.#f,r=!!this.#h,l=r?this.#h:this.#y;for(let j of this.#c)if(!l||It.intersect(j.data.rect,l)!==null){l=j.data.rect,r=!0;break}let c=It.normalizeRect([l[0],e[3]-l[1]+e[1],l[2],e[3]-l[3]+e[1]]),p=5,m=r?l[2]-l[0]+p:0,g=c[0]+m,y=c[1];this.#u=[100*(g-s)/n,100*(y-a)/i];let{style:x}=this.#a;x.left=`${this.#u[0]}%`,x.top=`${this.#u[1]}%`}#H(){if(this.#e){this.#e.toggleCommentPopup(this,!1);return}if(this.#d=!this.#d,this.#d)this.#A(),this.#a.addEventListener("click",this.#s),this.#a.addEventListener("keydown",this.#t);else this.#S(),this.#a.removeEventListener("click",this.#s),this.#a.removeEventListener("keydown",this.#t)}#A(){if(!this.#m)this.render();if(!this.isVisible)this.#N(),this.#a.hidden=!1,this.#a.style.zIndex=parseInt(this.#a.style.zIndex,10)+1000;else if(this.#d)this.#a.classList.add("focused")}#S(){if(this.#a.classList.remove("focused"),this.#d||!this.isVisible)return;this.#a.hidden=!0,this.#a.style.zIndex=parseInt(this.#a.style.zIndex,10)-1000}forceHide(){if(this.#k=this.isVisible,!this.#k)return;this.#a.hidden=!0}maybeShow(){if(this.#e)return;if(this.#j(),!this.#k)return;if(!this.#m)this.#A();this.#k=!1,this.#a.hidden=!1}get isVisible(){return!this.#e&&this.#a.hidden===!1}}class x9 extends ki{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=gn.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let e=this.contentElement=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(let n of this.textContent){let i=document.createElement("span");i.textContent=n,e.append(i)}this.container.append(e)}if(!this.data.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this._editOnDoubleClick(),this.container}}class gA extends ki{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");let{data:e,width:n,height:i}=this,s=this.svgFactory.create(n,i,!0),a=this.#e=this.svgFactory.createElement("svg:line");if(a.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),a.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),a.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),a.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),a.setAttribute("stroke-width",e.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),s.append(a),this.container.append(s),!e.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class bA extends ki{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");let{data:e,width:n,height:i}=this,s=this.svgFactory.create(n,i,!0),a=e.borderStyle.width,r=this.#e=this.svgFactory.createElement("svg:rect");if(r.setAttribute("x",a/2),r.setAttribute("y",a/2),r.setAttribute("width",n-a),r.setAttribute("height",i-a),r.setAttribute("stroke-width",a||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),s.append(r),this.container.append(s),!e.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class wA extends ki{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");let{data:e,width:n,height:i}=this,s=this.svgFactory.create(n,i,!0),a=e.borderStyle.width,r=this.#e=this.svgFactory.createElement("svg:ellipse");if(r.setAttribute("cx",n/2),r.setAttribute("cy",i/2),r.setAttribute("rx",n/2-a/2),r.setAttribute("ry",i/2-a/2),r.setAttribute("stroke-width",a||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),s.append(r),this.container.append(s),!e.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class k9 extends ki{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,vertices:n,borderStyle:i,popupRef:s},width:a,height:r}=this;if(!n)return this.container;let l=this.svgFactory.create(a,r,!0),c=[];for(let m=0,g=n.length;m<g;m+=2){let y=n[m]-e[0],x=e[3]-n[m+1];c.push(`${y},${x}`)}c=c.join(" ");let p=this.#e=this.svgFactory.createElement(this.svgElementName);if(p.setAttribute("points",c),p.setAttribute("stroke-width",i.width||1),p.setAttribute("stroke","transparent"),p.setAttribute("fill","transparent"),l.append(p),this.container.append(l),!s&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class yA extends k9{constructor(e){super(e);this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class vA extends ki{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){if(this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this.container}}class E2 extends ki{#e=null;#t=[];constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?gn.HIGHLIGHT:gn.INK}#n(e,n){switch(e){case 90:return{transform:`rotate(90) translate(${-n[0]},${n[1]}) scale(1,-1)`,width:n[3]-n[1],height:n[2]-n[0]};case 180:return{transform:`rotate(180) translate(${-n[2]},${n[1]}) scale(1,-1)`,width:n[2]-n[0],height:n[3]-n[1]};case 270:return{transform:`rotate(270) translate(${-n[2]},${n[3]}) scale(1,-1)`,width:n[3]-n[1],height:n[2]-n[0]};default:return{transform:`translate(${-n[0]},${n[3]}) scale(1,-1)`,width:n[2]-n[0],height:n[3]-n[1]}}}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,rotation:n,inkLists:i,borderStyle:s,popupRef:a}}=this,{transform:r,width:l,height:c}=this.#n(n,e),p=this.svgFactory.create(l,c,!0),m=this.#e=this.svgFactory.createElement("svg:g");p.append(m),m.setAttribute("stroke-width",s.width||1),m.setAttribute("stroke-linecap","round"),m.setAttribute("stroke-linejoin","round"),m.setAttribute("stroke-miterlimit",10),m.setAttribute("stroke","transparent"),m.setAttribute("fill","transparent"),m.setAttribute("transform",r);for(let g of i){let y=this.svgFactory.createElement(this.svgElementName);this.#t.push(y),y.setAttribute("points",g.join(",")),m.append(y)}if(!a&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this.container.append(p),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);let{thickness:n,points:i,rect:s}=e,a=this.#e;if(n>=0)a.setAttribute("stroke-width",n||1);if(i)for(let r=0,l=this.#t.length;r<l;r++)this.#t[r].setAttribute("points",i[r].join(","));if(s){let{transform:r,width:l,height:c}=this.#n(this.data.rotation,s);a.parentElement.setAttribute("viewBox",`0 0 ${l} ${c}`),a.setAttribute("transform",r)}}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class T9 extends ki{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0});this.annotationEditorType=gn.HIGHLIGHT}render(){let{data:{overlaidText:e,popupRef:n}}=this;if(!n&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();if(this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),e){let i=document.createElement("mark");i.classList.add("overlaidText"),i.textContent=e,this.container.append(i)}return this.container}}class SA extends ki{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:n}}=this;if(!n&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();if(this.container.classList.add("underlineAnnotation"),e){let i=document.createElement("u");i.classList.add("overlaidText"),i.textContent=e,this.container.append(i)}return this.container}}class _A extends ki{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:n}}=this;if(!n&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();if(this.container.classList.add("squigglyAnnotation"),e){let i=document.createElement("u");i.classList.add("overlaidText"),i.textContent=e,this.container.append(i)}return this.container}}class xA extends ki{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:n}}=this;if(!n&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();if(this.container.classList.add("strikeoutAnnotation"),e){let i=document.createElement("s");i.classList.add("overlaidText"),i.textContent=e,this.container.append(i)}return this.container}}class A9 extends ki{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});this.annotationEditorType=gn.STAMP}render(){if(this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this._editOnDoubleClick(),this.container}}class kA extends ki{#e=null;constructor(e){super(e,{isRenderable:!0});let{fileId:n,file:i}=this.data;this.filename=i.filename,this.content=i.content,this.fileId=n,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,attachmentId:this.fileId,...i})}render(){this.container.classList.add("fileAttachmentAnnotation");let{container:e,data:n}=this,i;if(n.hasAppearance||n.fillAlpha===0)i=document.createElement("div");else if(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(n.name)?"paperclip":"pushpin"}.svg`,n.fillAlpha&&n.fillAlpha<1)i.style=`filter: opacity(${Math.round(n.fillAlpha*100)}%);`;i.addEventListener("dblclick",this.#t.bind(this)),this.#e=i;let{isMac:s}=ai.platform;if(e.addEventListener("keydown",(a)=>{if(a.key==="Enter"&&(s?a.metaKey:a.ctrlKey))this.#t()}),!n.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();else i.classList.add("popupTriggerArea");return e.append(i),e}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}async#t(){let{fileId:e,filename:n,content:i}=this,s=await this.linkService.getAttachmentContent(e)||i;if(s)this.downloadManager?.openOrDownloadData(s,n)}}class C9 extends ki{#e=new AbortController;#t=null;#n=null;constructor(e){super(e,{isRenderable:!!e.data.richMedia})}render(){this.container.classList.add("mediaAnnotation");let{filename:e}=this.data.richMedia,n=document.createElement("button");return n.className="mediaPlayButton",n.type="button",n.title=n.ariaLabel=e,n.addEventListener("click",()=>this.#i(n),{signal:this.#e.signal}),this.container.append(n),this.container}async#i(e){let{fileId:n,filename:i,contentType:s}=this.data.richMedia;e.disabled=!0;let a;try{a=await this.linkService.getAttachmentContent(n)}catch{return}finally{e.disabled=!1}if(!a||!e.isConnected)return;let{signal:r}=this.#e,l=URL.createObjectURL(new Blob([a],{type:s}));this.#t=l;let c=s.startsWith("audio/"),p=document.createElement(c?"audio":"video");if(this.#n=p,p.className="mediaContent",this._setBackgroundColor(p),p.src=l,p.title=i,p.controls=!0,p.autoplay=!0,p.tabIndex=0,c){let m=!1,g=!1,y=()=>{p.controls=m||g};this.container.addEventListener("pointerenter",()=>{m=!0,y()},{signal:r}),this.container.addEventListener("pointerleave",()=>{m=!1,y()},{signal:r}),this.container.addEventListener("focusin",()=>{g=!0,y()},{signal:r}),this.container.addEventListener("focusout",()=>{g=!1,y()},{signal:r})}p.addEventListener("emptied",()=>this.#s(l),{once:!0,signal:r}),e.replaceWith(p),p.play().catch(()=>{})}#s(e=this.#t){if(e&&e===this.#t)URL.revokeObjectURL(e),this.#t=null}destroy(){if(this.#e.abort(),this.#n)this.#n.pause(),this.#n.removeAttribute("src"),this.#n.load(),this.#n=null;this.#s()}}class j9{#e=null;#t=null;#n=null;#i=new Map;#s=null;#r=null;#a=[];#o=!1;zIndex=0;constructor({div:e,accessibilityManager:n,annotationCanvasMap:i,annotationEditorUIManager:s,page:a,viewport:r,structTreeLayer:l,commentManager:c,linkService:p,annotationStorage:m}){this.div=e,this.#e=n,this.#t=i,this.#s=l||null,this.#r=p||null,this.#n=m||new S2,this.page=a,this.viewport=r,this._annotationEditorUIManager=s,this._commentManager=c||null}hasEditableAnnotations(){return this.#i.size>0}async render(e){let{annotations:n,optionalContentConfig:i}=e,s=this.div;jh(s,this.viewport);let a=new Map,r=[],l={data:null,layer:s,linkService:this.#r,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new cm,annotationStorage:this.#n,enableComment:e.enableComment===!0,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(let c of n){if(c.noHTML)continue;let p=c.annotationType===Oi.POPUP;if(!p){if(c.rect[2]===c.rect[0]||c.rect[3]===c.rect[1])continue}else{let y=a.get(c.id);if(!y)continue;if(!this._commentManager){r.push(c);continue}l.elements=y}l.data=c;let m=s2.create(l);if(!m.isRenderable)continue;if(!p){if(this.#a.push(m),c.popupRef)a.getOrInsertComputed(c.popupRef,Rd).push(m)}let g=m.render();if(c.hidden)g.style.visibility="hidden";if(m.updateOC(i),m._isEditable)this.#i.set(m.data.id,m),this._annotationEditorUIManager?.renderAnnotationElement(m)}await this.#l();for(let c of r){let p=l.elements=a.get(c.id);l.data=c;let m=s2.create(l);if(!m.isRenderable)continue;let g=m.render();if(m.contentElement.id=`pdfjs_internal_id_${c.id}`,c.hidden)g.style.visibility="hidden";p.at(-1).container.after(g)}this.#c()}async#l(){if(this.#a.length===0)return;this.div.replaceChildren();let e=[];if(!this.#o){this.#o=!0;for(let{contentElement:i,data:{hidden:s,id:a,oc:r}}of this.#a){let l=i.id=`pdfjs_internal_id_${a}`,c=i.localName==="a"&&!s&&!r;e.push(this.#s?.getAriaAttributes(l,{enableLinkOwnership:c}).then((p)=>{if(p)for(let[m,g]of p)i.setAttribute(m,g)}))}}this.#a.sort(({data:{rect:[i,s,a,r]}},{data:{rect:[l,c,p,m]}})=>{if(i===a&&s===r)return 1;if(l===p&&c===m)return-1;let g=r,y=s,x=(s+r)/2,j=m,I=c,P=(c+m)/2;if(x>=j&&P<=y)return-1;if(P>=g&&x<=I)return 1;let X=(i+a)/2,Y=(l+p)/2;return X-Y});let n=document.createDocumentFragment();for(let i of this.#a)if(n.append(i.container),this._commentManager)(i.extraPopupElement?.popup||i.popup)?.renderCommentButton();else if(i.extraPopupElement)n.append(i.extraPopupElement.render());if(this.div.append(n),await Promise.all(e),this.#e){let i=await this.#s?.getAnnotationIds();for(let{contentElement:s}of this.#a){if(i?.has(s.id))continue;this.#e.addPointerInTextLayer(s,!1)}}}async addLinkAnnotations(e){let n={data:null,layer:this.div,linkService:this.#r,svgFactory:new cm,parent:this};for(let i of e){i.borderStyle||=j9._defaultBorderStyle,n.data=i;let s=s2.create(n);if(!s.isRenderable)continue;s.render(),s.contentElement.id=`pdfjs_internal_id_${i.id}`,this.#a.push(s)}await this.#l()}update({viewport:e,optionalContentConfig:n}){let i=this.div;this.viewport=e,jh(i,{rotation:e.rotation});for(let s of this.#a)s.updateOC(n);this.#c(),i.hidden=!1}destroy(){for(let e of this.#a)e.destroy?.(),this.#e?.removePointerInTextLayer(e.contentElement);this.#a.length=0,this.#i.clear(),this.div.replaceChildren()}#c(){if(!this.#t)return;let e=this.div;for(let[n,i]of this.#t){let s=e.querySelector(`[data-annotation-id="${n}"]`);if(!s)continue;if(Array.isArray(i))for(let p of i)p.className="annotationContent",p.ariaHidden=!0;else i.className="annotationContent",i.ariaHidden=!0;let a=[];for(let p of s.children)if(p.nodeName==="CANVAS")a.push(p);for(let p of a)p.remove();let r=Array.isArray(i)?i[0]:i,{firstChild:l}=s;if(!l)s.append(r);else if(!l.classList.contains("annotationContent"))l.before(r);else l.after(r);if(Array.isArray(i)){let p=r;for(let m=1,g=i.length;m<g;m++)p.after(i[m]),p=i[m]}this.#t.delete(n);let c=this.#i.get(n);if(!c)continue;if(c._hasNoCanvas)this._annotationEditorUIManager?.setMissingCanvas(n,s.id,i),c._hasNoCanvas=!1;else c.canvas=i}}refreshCanvases(){this.#c()}getEditableAnnotations(){return this.#i.values()}getEditableAnnotation(e){return this.#i.get(e)}addFakeAnnotation(e){let{div:n}=this,{id:i,rotation:s}=e,a=new oA({data:{id:i,rect:e.getPDFRect(),rotation:s},editor:e,layer:n,parent:this,enableComment:!!this._commentManager,linkService:this.#r,annotationStorage:this.#n});return a.render(),a.contentElement.id=`pdfjs_internal_id_${i}`,a.createOrUpdatePopup(),this.#a.push(a),a}removeAnnotation(e){let n=this.#a.findIndex((s)=>s.data.id===e);if(n<0)return;let[i]=this.#a.splice(n,1);this.#e?.removePointerInTextLayer(i.contentElement)}updateFakeAnnotations(e){if(e.length===0)return;for(let n of e)n.updateFakeAnnotationElement(this);this.#l()}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}static get _defaultBorderStyle(){return en(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:qd.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}}var Qb=/\r\n?|\n/g;class As extends Jt{#e="";#t=`${this.id}-editor`;#n=null;#i;_colorPicker=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){let e=As.prototype,n=(a)=>a.isEmpty(),{TRANSLATE_SMALL:i,TRANSLATE_BIG:s}=Zc;return en(this,"_keyboardManager",new rr([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter"],e.commitOrRemove],[["Escape"],e.commitOrRemove],[["ArrowLeft"],e._translateEmpty,{args:[-i,0],checker:n}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-s,0],checker:n}],[["ArrowRight"],e._translateEmpty,{args:[i,0],checker:n}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[s,0],checker:n}],[["ArrowUp"],e._translateEmpty,{args:[0,-i],checker:n}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-s],checker:n}],[["ArrowDown"],e._translateEmpty,{args:[0,i],checker:n}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,s],checker:n}]]))}static _type="freetext";static _editorType=gn.FREETEXT;constructor(e){super({...e,name:"freeTextEditor"});if(this.color=e.color||As._defaultColor||Jt._defaultLineColor,this.#i=e.fontSize||As._defaultFontSize,!this.annotationElementId)this._uiManager.a11yAlert(Jt._l10nAlert.freetext);this.canAddComment=!1}static initialize(e,n){Jt.initialize(e,n);let i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,n){switch(e){case Pn.FREETEXT_SIZE:As._defaultFontSize=n;break;case Pn.FREETEXT_COLOR:As._defaultColor=n;break}}updateParams(e,n){switch(e){case Pn.FREETEXT_SIZE:this.#s(n);break;case Pn.FREETEXT_COLOR:this.#r(n);break}}static get defaultPropertiesToUpdate(){return[[Pn.FREETEXT_SIZE,As._defaultFontSize],[Pn.FREETEXT_COLOR,As._defaultColor||Jt._defaultLineColor]]}get propertiesToUpdate(){return[[Pn.FREETEXT_SIZE,this.#i],[Pn.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||=new lm(this),[["colorPicker",this._colorPicker]]}get colorType(){return Pn.FREETEXT_COLOR}#s(e){let n=(s)=>{this.editorDiv.style.fontSize=`calc(${s}px * var(--total-scale-factor))`,this.translate(0,-(s-this.#i)*this.parentScale),this.#i=s,this.#o()},i=this.#i;this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Pn.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}onUpdatedColor(){this.editorDiv.style.color=this.color,this._colorPicker?.update(this.color),super.onUpdatedColor()}#r(e){let n=(s)=>{this.color=s,this.onUpdatedColor()},i=this.color;this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Pn.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(e,n){this._uiManager.translateSelectedEditors(e,n,!0)}getInitialTranslation(){let e=this.parentScale;return[-As._internalPadding*e,-(As._internalPadding+this.#i)*e]}rebuild(){if(!this.parent)return;if(super.rebuild(),this.div===null)return;if(!this.isAttachedToDOM)this.parent.add(this)}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.#n=new AbortController;let e=this._uiManager.combinedSignal(this.#n);return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e}),!0}disableEditMode(){if(!super.disableEditMode())return!1;return this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#t),this._isDraggable=!0,this.#n?.abort(),this.#n=null,this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0}focusin(e){if(!this._focusEventsAllowed)return;if(super.focusin(e),e.target!==this.editorDiv)this.editorDiv.focus()}onceAdded(e){if(this.width)return;if(this.enableEditMode(),e)this.editorDiv.focus();if(this._initialOptions?.isCentered)this.center();this._initialOptions=null}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){if(this.isEditing=!1,this.parent)this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing");super.remove()}#a(){let e=[];this.editorDiv.normalize();let n=null;for(let i of this.editorDiv.childNodes){if(n?.nodeType===Node.TEXT_NODE&&i.nodeName==="BR")continue;e.push(As.#l(i)),n=i}return e.join(`
|
|
291
|
+
`)}#o(){let[e,n]=this.parentDimensions,i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{let{currentLayer:s,div:a}=this,r=a.style.display,l=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",s.div.append(this.div),i=a.getBoundingClientRect(),a.remove(),a.style.display=r,a.classList.toggle("hidden",l)}if(this.rotation%180===this.parentRotation%180)this.width=i.width/e,this.height=i.height/n;else this.width=i.height/e,this.height=i.width/n;this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let e=this.#e,n=this.#e=this.#a().trimEnd();if(e===n)return;let i=(s)=>{if(this.#e=s,!s){this.remove();return}this.#c(),this._uiManager.rebuild(this),this.#o()};this.addCommands({cmd:()=>{i(n)},undo:()=>{i(e)},mustExec:!1}),this.#o()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(e){if(e.target===this.div&&e.key==="Enter")this.enterInEditMode(),e.preventDefault()}editorDivKeydown(e){As._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let e,n;if(this._isCopy||this.annotationElementId)e=this.x,n=this.y;super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#t),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;let{style:i}=this.editorDiv;if(i.fontSize=`calc(${this.#i}px * var(--total-scale-factor))`,i.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){let[s,a]=this.parentDimensions;if(this.annotationElementId){let{position:r}=this._initialData,[l,c]=this.getInitialTranslation();[l,c]=this.pageTranslationToScreen(l,c);let[p,m]=this.pageDimensions,[g,y]=this.pageTranslation,x,j;switch(this.rotation){case 0:x=e+(r[0]-g)/p,j=n+this.height-(r[1]-y)/m;break;case 90:x=e+(r[0]-g)/p,j=n-(r[1]-y)/m,[l,c]=[c,-l];break;case 180:x=e-this.width+(r[0]-g)/p,j=n-(r[1]-y)/m,[l,c]=[-l,-c];break;case 270:x=e+(r[0]-g-this.height*m)/p,j=n+(r[1]-y-this.width*p)/m,[l,c]=[-c,l];break}this.setAt(x*s,j*a,l,c)}else this._moveAfterPaste(e,n);this.#c(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#l(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(Qb,"")}editorDivPaste(e){let n=e.clipboardData||window.clipboardData,{types:i}=n;if(i.length===1&&i[0]==="text/plain")return;e.preventDefault();let s=As.#h(n.getData("text")||"").replaceAll(Qb,`
|
|
292
|
+
`);if(!s)return;let a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();let r=a.getRangeAt(0);if(!s.includes(`
|
|
293
|
+
`)){r.insertNode(document.createTextNode(s)),this.editorDiv.normalize(),a.collapseToStart();return}let{startContainer:l,startOffset:c}=r,p=[],m=[];if(l.nodeType===Node.TEXT_NODE){let x=l.parentElement;if(m.push(l.nodeValue.slice(c).replaceAll(Qb,"")),x!==this.editorDiv){let j=p;for(let I of this.editorDiv.childNodes){if(I===x){j=m;continue}j.push(As.#l(I))}}p.push(l.nodeValue.slice(0,c).replaceAll(Qb,""))}else if(l===this.editorDiv){let x=p,j=0;for(let I of this.editorDiv.childNodes){if(j++===c)x=m;x.push(As.#l(I))}}this.#e=`${p.join(`
|
|
294
|
+
`)}${s}${m.join(`
|
|
295
|
+
`)}`,this.#c();let g=new Range,y=Math.sumPrecise(p.map((x)=>x.length));for(let{firstChild:x}of this.editorDiv.childNodes)if(x.nodeType===Node.TEXT_NODE){let j=x.nodeValue.length;if(y<=j){g.setStart(x,y),g.setEnd(x,y);break}y-=j}a.removeAllRanges(),a.addRange(g)}#c(){if(this.editorDiv.replaceChildren(),!this.#e)return;for(let e of this.#e.split(`
|
|
296
|
+
`)){let n=document.createElement("div");n.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(n)}}#f(){return this.#e.replaceAll(" "," ")}static#h(e){return e.replaceAll(" "," ")}get contentDiv(){return this.editorDiv}getPDFRect(){let e=As._internalPadding*this.parentScale;return this.getRect(e,e)}static async deserialize(e,n,i){let s=null;if(e instanceof x9){let{data:{defaultAppearanceData:{fontSize:r,fontColor:l},rect:c,rotation:p,id:m,popupRef:g,richText:y,contentsObj:x,creationDate:j,modificationDate:I},textContent:P,textPosition:X,parent:{page:{pageNumber:Y}}}=e;if(!P?.length)return null;s=e={annotationType:gn.FREETEXT,color:Array.from(l),fontSize:r,value:P.join(`
|
|
297
|
+
`),position:X,pageIndex:Y-1,rect:c.slice(0),rotation:p,annotationElementId:m,id:m,deleted:!1,popupRef:g,comment:x?.str||null,richText:y,creationDate:j,modificationDate:I}}let a=await super.deserialize(e,n,i);if(a.#i=e.fontSize,a.color=It.makeHexColor(...e.color),a.#e=As.#h(e.value),a._initialData=s,e.comment)a.setCommentData(e);return a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let n=Jt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),i=Object.assign(super.serialize(e),{color:n,fontSize:this.#i,value:this.#f()});if(this.addComment(i),e)return i.isCopy=!0,i;if(this.annotationElementId&&!this.#d(i))return null;return i.id=this.annotationElementId,i}#d(e){let{value:n,fontSize:i,color:s,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==n||e.fontSize!==i||e.color.some((r,l)=>r!==s[l])||e.pageIndex!==a}renderAnnotationElement(e){let n=super.renderAnnotationElement(e);if(!n)return null;let{style:i}=n;i.fontSize=`calc(${this.#i}px * var(--total-scale-factor))`,i.color=this.color,n.replaceChildren();for(let s of this.#e.split(`
|
|
298
|
+
`)){let a=document.createElement("div");a.append(s?document.createTextNode(s):document.createElement("br")),n.append(a)}return e.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:this.#e}}),n}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}}class q2{#e=Object.create(null);updateProperty(e,n){this[e]=n,this.updateSVGProperty(e,n)}updateProperties(e){if(!e)return;for(let[n,i]of Object.entries(e))if(!n.startsWith("_"))this.updateProperty(n,i)}updateSVGProperty(e,n){this.#e[e]=n}toSVGProperties(){let e=this.#e;return this.#e=Object.create(null),{root:e}}reset(){this.#e=Object.create(null)}updateAll(e=this){this.updateProperties(e)}clone(){Un("Not implemented")}}class Mn extends Jt{#e=null;#t;_clipPathId=null;_colorPicker=null;_drawId=null;_drawOutlines=null;_focusDrawId=null;static _currentDrawId=-1;static _currentParent=null;static#n=null;static#i=null;static#s=null;static#r=null;static _INNER_MARGIN=3;constructor(e){super(e);this.#t=e.mustBeCommitted||!1,this._addOutlines(e)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){this._colorPicker?.updateOpacity?.(this.opacity)}_addOutlines(e){if(e.drawOutlines)this.#a(e),this.#g()}#a({drawOutlines:e,drawId:n,drawingOptions:i,clipPathId:s}){if(this._drawOutlines=e,this._drawingOptions||=i,!this.annotationElementId)this._uiManager.a11yAlert(Jt._l10nAlert[this.editorType]);if(n>=0)this._drawId=n,this._clipPathId=s??null,this.parent.drawLayer.finalizeDraw(n,e.defaultProperties),this.#l(this.parent);else this._drawId=this.#o(e,this.parent);this.#b(e.box)}#o(e,n){let{id:i,clipPathId:s}=n.drawLayer.draw(Mn._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,this.constructor._hasClipPath);if(this.constructor._hasClipPath)this._clipPathId=s;return this.#l(n),i}#l(e){let n=this._drawOutlines.getFocusSVGProperties(this.#d);if(n)this._focusDrawId=e.drawLayer.drawOutline(n,this._drawOutlines.focusMustRemoveSelfIntersections)}#c(e=this.#d){if(this._focusDrawId===null)return;this.parent?.drawLayer.updateProperties(this._focusDrawId,this._drawOutlines.getFocusSVGProperties(e))}#f(e){if(this._focusDrawId!==null)this.parent?.drawLayer.updateProperties(this._focusDrawId,{rootClass:e})}#h(){let{parent:e,_drawId:n,_focusDrawId:i,_isVisible:s}=this;if(!e||n===null)return;let a={hidden:!s};if(e.drawLayer.updateProperties(n,{rootClass:a}),i!==null)e.drawLayer.updateProperties(i,{rootClass:a})}static _mergeSVGProperties(e,n){let i=new Set(Object.keys(e));for(let[s,a]of Object.entries(n))if(i.has(s))Object.assign(e[s],a);else e[s]=a;return e}static getDefaultDrawingOptions(e){Un("Not implemented")}static get typesMap(){Un("Not implemented")}static get isDrawer(){return!0}static get _hasClipPath(){return!1}static get _hasDrawClass(){return!0}static get supportMultipleDrawings(){return!1}get _drawRotation(){return this.rotation}get _opacityName(){return this.constructor.typesMap.get(this.opacityType)}get#d(){return(this.parentRotation-this._drawRotation+360)%360}static updateDefaultParams(e,n){let i=this.typesMap.get(e);if(i)this._defaultDrawingOptions.updateProperty(i,n);if(this._currentParent)Mn.#n.updateProperty(i,n),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties())}updateParams(e,n){let i=this.constructor.typesMap.get(e);if(i)this._updateProperty(e,i,n)}static get defaultPropertiesToUpdate(){let e=[],n=this._defaultDrawingOptions;for(let[i,s]of this.typesMap)e.push([i,n[s]]);return e}get propertiesToUpdate(){let e=[],{_drawingOptions:n}=this;for(let[i,s]of this.constructor.typesMap)e.push([i,n[s]]);return e}_updateProperty(e,n,i){let s=this._drawingOptions,a=s[n],r=(l)=>{s.updateProperty(n,l);let c=this._drawOutlines.updateProperty(n,l);if(c)this.#b(c);if(this.parent?.drawLayer.updateProperties(this._drawId,s.toSVGProperties()),e===this.colorType)this.onUpdatedColor();else if(e===this.opacityType)this.onUpdatedOpacity()};this.addCommands({cmd:r.bind(this,i),undo:r.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(e,n,i=this.colorAndOpacityType){let s=this.constructor.typesMap.get(this.colorType),a=this._opacityName,r=this._drawingOptions,l=r[s],c=r[a],p=(m,g)=>{r.updateProperty(s,m),r.updateProperty(a,g),this._drawOutlines.updateProperty(s,m),this._drawOutlines.updateProperty(a,g),this.parent?.drawLayer.updateProperties(this._drawId,r.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:p.bind(this,e,n),undo:p.bind(this,l,c),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:i,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,Mn._mergeSVGProperties(this._drawOutlines.getPathResizingSVGProperties(this.#p()),{bbox:this.#w()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,Mn._mergeSVGProperties(this._drawOutlines.getPathResizedSVGProperties(this.#p()),{bbox:this.#w()})),this.#c()}_onTranslating(e,n){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#w()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,Mn._mergeSVGProperties(this._drawOutlines.getPathTranslatedSVGProperties(this.#p(),this.parentDimensions),{bbox:this.#w()}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}get _mustBeDisabledOnCommit(){return!0}commit(){if(super.commit(),this._mustBeDisabledOnCommit)this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){if(!this.annotationElementId)this.parent.addUndoableEditor(this);if(this._isDraggable=!0,this.#t){if(this.#t=!1,this.commit(),this.parent.setSelected(this),e&&this.isOnScreen)this.div.focus()}}remove(){this._uiManager.removeShouldRescale(this),this.#m(),super.remove()}rebuild(){if(!this.parent)return;if(super.rebuild(),this.div===null)return;if(this.#g(),this.#b(this._drawOutlines.box),!this.isAttachedToDOM)this.parent.add(this)}setParent(e){let n=!1;if(this.parent&&!e)this._uiManager.removeShouldRescale(this),this.#m();else if(e)this._uiManager.addShouldRescale(this),this.#g(e),n=!this.parent&&this.div?.classList.contains("selectedEditor");if(super.setParent(e),this.#h(),n)this.select()}#m(){if(this._drawId===null||!this.parent)return;let{drawLayer:e}=this.parent;if(e.remove(this._drawId),this._drawId=null,this._focusDrawId!==null)e.remove(this._focusDrawId),this._focusDrawId=null;this._drawingOptions.reset()}#g(e=this.parent){if(this._drawId!==null&&this.parent===e)return;if(this._drawId!==null){let{drawLayer:n}=this.parent;if(n.updateParent(this._drawId,e.drawLayer),this._focusDrawId!==null)n.updateParent(this._focusDrawId,e.drawLayer);return}if(this._drawingOptions.updateAll(),this._drawId=this.#o(this._drawOutlines,e),this._clipPathId&&this.#e)this.#e.style.clipPath=this._clipPathId}#u([e,n,i,s]){let{parentDimensions:[a,r],_drawRotation:l}=this;switch(l){case 90:return[n,1-e,i*(r/a),s*(a/r)];case 180:return[1-e,1-n,i,s];case 270:return[1-n,e,i*(r/a),s*(a/r)];default:return[e,n,i,s]}}#p(){let{x:e,y:n,width:i,height:s,parentDimensions:[a,r],_drawRotation:l}=this;switch(l){case 90:return[1-n,e,i*(a/r),s*(r/a)];case 180:return[1-e,1-n,i,s];case 270:return[n,1-e,i*(a/r),s*(r/a)];default:return[e,n,i,s]}}#b(e){if([this.x,this.y,this.width,this.height]=this.#u(e),this.div)this.fixAndSetPosition(),this.setDims();this._onResized()}#w(e=this.parentRotation){let{x:n,y:i,width:s,height:a,_drawRotation:r,parentDimensions:[l,c]}=this;switch((r*4+e)/90){case 1:return[1-i-a,n,a,s];case 2:return[1-n-s,1-i-a,s,a];case 3:return[i,1-n-s,a,s];case 4:return[n,i-s*(l/c),a*(c/l),s*(l/c)];case 5:return[1-i,n,s*(l/c),a*(c/l)];case 6:return[1-n-a*(c/l),1-i,a*(c/l),s*(l/c)];case 7:return[i-s*(l/c),1-n-a*(c/l),s*(l/c),a*(c/l)];case 8:return[n-s,i-a,s,a];case 9:return[1-i,n-s,a,s];case 10:return[1-n,1-i,s,a];case 11:return[i-a,1-n,a,s];case 12:return[n-a*(c/l),i,a*(c/l),s*(l/c)];case 13:return[1-i-s*(l/c),n-a*(c/l),s*(l/c),a*(c/l)];case 14:return[1-n,1-i-s*(l/c),a*(c/l),s*(l/c)];case 15:return[i,1-n,s*(l/c),a*(c/l)];default:return[n,i,s,a]}}rotate(e=this.parentRotation){if(!this.parent||this._drawId===null)return;let n=(e-this._drawRotation+360)%360;this.parent.drawLayer.updateProperties(this._drawId,Mn._mergeSVGProperties({bbox:this.#w(e)},this._drawOutlines.updateRotation(n))),this.#c(n)}show(e=this._isVisible){super.show(e),this.#h()}select(){super.select(),this.#f({hovered:!1,selected:!0})}unselect(){super.unselect(),this.#f({selected:!1})}pointerover(){if(!this.isSelected)this.#f({hovered:!0})}pointerleave(){if(!this.isSelected)this.#f({hovered:!1})}onScaleChanging(){if(!this.parent)return;let e=this._drawOutlines.updateParentDimensions(this.parentDimensions,this.parent.scale);if(e)this.#b(e)}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,n;if(this._isCopy)e=this.x,n=this.y;let i=super.render();if(this.constructor._hasDrawClass)i.classList.add("draw");let s=this.#e=document.createElement("div");if(i.append(s),s.setAttribute("aria-hidden","true"),s.className="internal",this._clipPathId)s.style.clipPath=this._clipPathId;if(lT(this,s,["pointerover","pointerleave"]),this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy)this._moveAfterPaste(e,n);return i}static createDrawerInstance(e){Un("Not implemented")}static _getDrawingTarget(e,{target:n}){return n}static _getPointerCoords({offsetX:e,offsetY:n,clientX:i,clientY:s},a=null){if(!a)return[e,n];let r=i-a.clientX,l=s-a.clientY;switch(this._currentParent.viewport.rotation){case 90:[r,l]=[l,-r];break;case 180:[r,l]=[-r,-l];break;case 270:[r,l]=[-l,r];break}return[a.offsetX+r,a.offsetY+l]}static _addDrawingListeners(e,n){}static _endDrawingSession(e=!1){return this._currentParent.endDrawingSession(e)}static startDrawing(e,n,i,s){let{pointerId:a,pointerType:r}=s;if(Wn.isInitializedAndDifferentPointerType(r))return;let l=this._getDrawingTarget(e,s),[c,p]=this._getPointerCoords(s),{viewport:{rotation:m}}=e,{x:g,y,width:x,height:j}=l.getBoundingClientRect(),I=Mn.#i=new AbortController,P=e.combinedSignal(I);if(Wn.setPointer(r,a),window.addEventListener("pointerup",(J)=>{if(Wn.isSamePointerIdOrRemove(J.pointerId))this._endDraw(J)},{signal:P}),window.addEventListener("pointercancel",(J)=>{if(Wn.isSamePointerIdOrRemove(J.pointerId))this._endDrawingSession()},{signal:P}),window.addEventListener("pointerdown",(J)=>{if(!Wn.isSamePointerType(J.pointerType))return;if(Wn.initializeAndAddPointerId(J.pointerId),Mn.#n.isCancellable())if(Mn.#n.removeLastElement(),Mn.#n.isEmpty())this._endDrawingSession(!0);else this._endDraw(null)},{capture:!0,passive:!1,signal:P}),window.addEventListener("contextmenu",io,{signal:P}),l.addEventListener("pointermove",this._drawMove.bind(this),{signal:P}),l.addEventListener("touchmove",(J)=>{if(Wn.isSameTimeStamp(J.timeStamp))rs(J)},{signal:P}),this._addDrawingListeners(l,P),e.toggleDrawing(),n._editorUndoBar?.hide(),Mn.#n){e.drawLayer.updateProperties(this._currentDrawId,Mn.#n.startNew(c,p,x,j,m));return}n.updateUIForDefaultProperties(this),Mn.#n=this.createDrawerInstance({x:c,y:p,box:[g,y,x,j],rotation:m,parent:e,isLTR:i}),Mn.#s=this.getDefaultDrawingOptions(),this._currentParent=e;let{id:X,clipPathId:Y}=e.drawLayer.draw(this._mergeSVGProperties(Mn.#s.toSVGProperties(),Mn.#n.defaultSVGProperties),!0,this._hasClipPath);this._currentDrawId=X,Mn.#r=this._hasClipPath?Y:null}static _drawMove(e){if(Wn.isSameTimeStamp(e.timeStamp),!Mn.#n)return;if(!Wn.isSamePointerId(e.pointerId))return;if(Wn.isUsingMultiplePointers()){this._endDraw(e);return}let n,i=e.getCoalescedEvents?.();if(i?.length){let s=[];for(let a of i)s.push(...this._getPointerCoords(a,e));n=Mn.#n.addPoints(s)}else n=Mn.#n.add(...this._getPointerCoords(e));this._currentParent.drawLayer.updateProperties(this._currentDrawId,n),Wn.setTimeStamp(e.timeStamp),rs(e)}static _cleanup(e){if(e)this._currentDrawId=-1,this._currentParent=null,Mn.#n=null,Mn.#s=null,Mn.#r=null,Wn.clearTimeStamp();if(Mn.#i)Mn.#i.abort(),Mn.#i=null,Wn.clearPointerIds()}static _endDraw(e){let n=this._currentParent;if(!n)return;if(n.toggleDrawing(!0),this._cleanup(!1),n.drawLayer.updateProperties(this._currentDrawId,e?.target===n.div?Mn.#n.end(...this._getPointerCoords(e)):Mn.#n.end()),this.supportMultipleDrawings){let i=Mn.#n,s=this._currentDrawId,a=i.getLastElement();n.addCommands({cmd:()=>{n.drawLayer.updateProperties(s,i.setLastElement(a))},undo:()=>{n.drawLayer.updateProperties(s,i.removeLastElement())},mustExec:!1,type:Pn.DRAW_STEP});return}this.endDrawing(!1)}static endDrawing(e){let n=this._currentParent;if(!n)return null;if(n.toggleDrawing(!0),n.cleanUndoStack(Pn.DRAW_STEP),!Mn.#n.isEmpty()){let{pageDimensions:[i,s],scale:a}=n,r=n.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,clipPathId:Mn.#r,drawOutlines:Mn.#n.getOutlines(i*a,s*a,a,this._INNER_MARGIN),drawingOptions:Mn.#s,mustBeCommitted:!e});return this._cleanup(!0),r}return n.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,n,i,s,a,r,l){Un("Not implemented")}static async deserialize(e,n,i){let{rawDims:{pageWidth:s,pageHeight:a,pageX:r,pageY:l}}=n.viewport,c=this.deserializeDraw(r,l,s,a,this._INNER_MARGIN,e,i),p=await super.deserialize(e,n,i);return p.createDrawingOptions(e),p.#a({drawOutlines:c}),p.#g(),p.onScaleChanging(),p.rotate(),p}serializeDraw(e){let[n,i]=this.pageTranslation,[s,a]=this.pageDimensions;return this._drawOutlines.serialize([n,i,s,a],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}}class Nt{static PRECISION=0.0001;focusOutline=null;toSVGPath(){Un("Abstract method `toSVGPath` must be implemented.")}get box(){Un("Abstract getter `box` must be implemented.")}serialize(e,n){Un("Abstract method `serialize` must be implemented.")}get defaultSVGProperties(){Un("Abstract getter `defaultSVGProperties` must be implemented.")}get defaultProperties(){return this.defaultSVGProperties}getFocusSVGProperties(e){return null}get focusMustRemoveSelfIntersections(){return!1}updateProperty(e,n){return null}updateParentDimensions(e,n){return null}serializeQuadPoints(e,n){return null}updateRotation(e){return{}}getPathResizingSVGProperties(e){return{}}getPathResizedSVGProperties(e){return{}}getPathTranslatedSVGProperties(e,n){return{}}static _rotateBox([e,n,i,s],a){switch(a){case 90:return[1-n-s,e,s,i];case 180:return[1-e-i,1-n-s,i,s];case 270:return[n,1-e-i,s,i]}return[e,n,i,s]}static _rescale(e,n,i,s,a,r){r||=new Float32Array(e.length);for(let l=0,c=e.length;l<c;l+=2)r[l]=n+e[l]*s,r[l+1]=i+e[l+1]*a;return r}static _rescaleAndSwap(e,n,i,s,a,r){r||=new Float32Array(e.length);for(let l=0,c=e.length;l<c;l+=2)r[l]=n+e[l+1]*s,r[l+1]=i+e[l]*a;return r}static _translate(e,n,i,s){s||=new Float32Array(e.length);for(let a=0,r=e.length;a<r;a+=2)s[a]=n+e[a],s[a+1]=i+e[a+1];return s}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,n,i,s,a){switch(a){case 90:return[1-n/i,e/s];case 180:return[1-e/i,1-n/s];case 270:return[n/i,1-e/s];default:return[e/i,n/s]}}static createBezierPoints(e,n,i,s,a,r){return[(e+5*i)/6,(n+5*s)/6,(5*i+a)/6,(5*s+r)/6,(i+a)/2,(s+r)/2]}}class Th{#e;#t=[];#n;#i;#s=[];#r=new Float32Array(18);#a;#o;#l;#c;#f;#h;#d=[];static#m=8;static#g=2;static#u=Th.#m+Th.#g;constructor(e,n,i,s,a,r,l=0){this.#e=i,this.#h=a*s,this.#i=r,this.#r.set([NaN,NaN,NaN,NaN,e,n],6),this.#n=l,this.#c=Th.#m*s,this.#l=Th.#u*s,this.#f=s,this.#d.push(e,n)}isEmpty(){return isNaN(this.#r[8])}isCancellable(){return this.#d.length<=10}removeLastElement(){return this.#r.fill(NaN),this.#s.length=this.#t.length=this.#d.length=0,{path:{d:""}}}#p(){let e=this.#r.subarray(4,6),n=this.#r.subarray(16,18),[i,s,a,r]=this.#e;return[(this.#a+(e[0]-n[0])/2-i)/a,(this.#o+(e[1]-n[1])/2-s)/r,(this.#a+(n[0]-e[0])/2-i)/a,(this.#o+(n[1]-e[1])/2-s)/r]}add(e,n){this.#a=e,this.#o=n;let[i,s,a,r]=this.#e,[l,c,p,m]=this.#r.subarray(8,12),g=e-p,y=n-m,x=Math.hypot(g,y);if(x<this.#l)return!1;let j=x-this.#c,I=j/x,P=I*g,X=I*y,Y=l,J=c;l=p,c=m,p+=P,m+=X,this.#d?.push(e,n);let ne=-X/j,ae=P/j,se=ne*this.#h,oe=ae*this.#h;if(this.#r.set(this.#r.subarray(2,8),0),this.#r.set([p+se,m+oe],4),this.#r.set(this.#r.subarray(14,18),12),this.#r.set([p-se,m-oe],16),isNaN(this.#r[6])){if(this.#s.length===0)this.#r.set([l+se,c+oe],2),this.#s.push(NaN,NaN,NaN,NaN,(l+se-i)/a,(c+oe-s)/r),this.#r.set([l-se,c-oe],14),this.#t.push(NaN,NaN,NaN,NaN,(l-se-i)/a,(c-oe-s)/r);return this.#r.set([Y,J,l,c,p,m],6),!this.isEmpty()}if(this.#r.set([Y,J,l,c,p,m],6),Math.abs(Math.atan2(J-c,Y-l)-Math.atan2(X,P))<Math.PI/2)return[l,c,p,m]=this.#r.subarray(2,6),this.#s.push(NaN,NaN,NaN,NaN,((l+p)/2-i)/a,((c+m)/2-s)/r),[l,c,Y,J]=this.#r.subarray(14,18),this.#t.push(NaN,NaN,NaN,NaN,((Y+l)/2-i)/a,((J+c)/2-s)/r),!0;return[Y,J,l,c,p,m]=this.#r.subarray(0,6),this.#s.push(((Y+5*l)/6-i)/a,((J+5*c)/6-s)/r,((5*l+p)/6-i)/a,((5*c+m)/6-s)/r,((l+p)/2-i)/a,((c+m)/2-s)/r),[p,m,l,c,Y,J]=this.#r.subarray(12,18),this.#t.push(((Y+5*l)/6-i)/a,((J+5*c)/6-s)/r,((5*l+p)/6-i)/a,((5*c+m)/6-s)/r,((l+p)/2-i)/a,((c+m)/2-s)/r),!0}toSVGPath(){if(this.isEmpty())return"";let e=this.#s,n=this.#t;if(isNaN(this.#r[6])&&!this.isEmpty())return this.#b();let i=[];i.push(`M${e[4]} ${e[5]}`);for(let s=6;s<e.length;s+=6)if(isNaN(e[s]))i.push(`L${e[s+4]} ${e[s+5]}`);else i.push(`C${e[s]} ${e[s+1]} ${e[s+2]} ${e[s+3]} ${e[s+4]} ${e[s+5]}`);this.#y(i);for(let s=n.length-6;s>=6;s-=6)if(isNaN(n[s]))i.push(`L${n[s+4]} ${n[s+5]}`);else i.push(`C${n[s]} ${n[s+1]} ${n[s+2]} ${n[s+3]} ${n[s+4]} ${n[s+5]}`);return this.#w(i),i.join(" ")}#b(){let[e,n,i,s]=this.#e,[a,r,l,c]=this.#p();return`M${(this.#r[2]-e)/i} ${(this.#r[3]-n)/s} L${(this.#r[4]-e)/i} ${(this.#r[5]-n)/s} L${a} ${r} L${l} ${c} L${(this.#r[16]-e)/i} ${(this.#r[17]-n)/s} L${(this.#r[14]-e)/i} ${(this.#r[15]-n)/s} Z`}#w(e){let n=this.#t;e.push(`L${n[4]} ${n[5]} Z`)}#y(e){let[n,i,s,a]=this.#e,r=this.#r.subarray(4,6),l=this.#r.subarray(16,18),[c,p,m,g]=this.#p();e.push(`L${(r[0]-n)/s} ${(r[1]-i)/a} L${c} ${p} L${m} ${g} L${(l[0]-n)/s} ${(l[1]-i)/a}`)}newFreeDrawOutline(e,n,i,s,a,r){return new E9(e,n,i,s,a,r)}getOutlines(){let e=this.#s,n=this.#t,i=this.#r,[s,a,r,l]=this.#e,c=new Float32Array((this.#d?.length??0)+2);for(let g=0,y=c.length-2;g<y;g+=2)c[g]=(this.#d[g]-s)/r,c[g+1]=(this.#d[g+1]-a)/l;if(c[c.length-2]=(this.#a-s)/r,c[c.length-1]=(this.#o-a)/l,isNaN(i[6])&&!this.isEmpty())return this.#v(c);let p=new Float32Array(this.#s.length+24+this.#t.length),m=e.length;for(let g=0;g<m;g+=2){if(isNaN(e[g])){p[g]=p[g+1]=NaN;continue}p[g]=e[g],p[g+1]=e[g+1]}m=this.#_(p,m);for(let g=n.length-6;g>=6;g-=6)for(let y=0;y<6;y+=2){if(isNaN(n[g+y])){p[m]=p[m+1]=NaN,m+=2;continue}p[m]=n[g+y],p[m+1]=n[g+y+1],m+=2}return this.#x(p,m),this.newFreeDrawOutline(p,c,this.#e,this.#f,this.#n,this.#i)}#v(e){let n=this.#r,[i,s,a,r]=this.#e,[l,c,p,m]=this.#p(),g=new Float32Array(36);return g.set([NaN,NaN,NaN,NaN,(n[2]-i)/a,(n[3]-s)/r,NaN,NaN,NaN,NaN,(n[4]-i)/a,(n[5]-s)/r,NaN,NaN,NaN,NaN,l,c,NaN,NaN,NaN,NaN,p,m,NaN,NaN,NaN,NaN,(n[16]-i)/a,(n[17]-s)/r,NaN,NaN,NaN,NaN,(n[14]-i)/a,(n[15]-s)/r],0),this.newFreeDrawOutline(g,e,this.#e,this.#f,this.#n,this.#i)}#x(e,n){let i=this.#t;return e.set([NaN,NaN,NaN,NaN,i[4],i[5]],n),n+=6}#_(e,n){let i=this.#r.subarray(4,6),s=this.#r.subarray(16,18),[a,r,l,c]=this.#e,[p,m,g,y]=this.#p();return e.set([NaN,NaN,NaN,NaN,(i[0]-a)/l,(i[1]-r)/c,NaN,NaN,NaN,NaN,p,m,NaN,NaN,NaN,NaN,g,y,NaN,NaN,NaN,NaN,(s[0]-a)/l,(s[1]-r)/c],n),n+=24}}class E9 extends Nt{#e;#t=new Float32Array(4);#n;#i;#s;#r;#a;constructor(e,n,i,s,a,r){super();this.#a=e,this.#s=n,this.#e=i,this.#r=s,this.#n=a,this.#i=r,this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],this.#o(r);let[l,c,p,m]=this.#t;for(let g=0,y=e.length;g<y;g+=2)e[g]=(e[g]-l)/p,e[g+1]=(e[g+1]-c)/m;for(let g=0,y=n.length;g<y;g+=2)n[g]=(n[g]-l)/p,n[g+1]=(n[g+1]-c)/m}toSVGPath(){let e=[`M${this.#a[4]} ${this.#a[5]}`];for(let n=6,i=this.#a.length;n<i;n+=6){if(isNaN(this.#a[n])){e.push(`L${this.#a[n+4]} ${this.#a[n+5]}`);continue}e.push(`C${this.#a[n]} ${this.#a[n+1]} ${this.#a[n+2]} ${this.#a[n+3]} ${this.#a[n+4]} ${this.#a[n+5]}`)}return e.push("Z"),e.join(" ")}serialize([e,n,i,s],a){let r=i-e,l=s-n,c,p;switch(a){case 0:c=Nt._rescale(this.#a,e,s,r,-l),p=Nt._rescale(this.#s,e,s,r,-l);break;case 90:c=Nt._rescaleAndSwap(this.#a,e,n,r,l),p=Nt._rescaleAndSwap(this.#s,e,n,r,l);break;case 180:c=Nt._rescale(this.#a,i,n,-r,l),p=Nt._rescale(this.#s,i,n,-r,l);break;case 270:c=Nt._rescaleAndSwap(this.#a,i,s,-r,-l),p=Nt._rescaleAndSwap(this.#s,i,s,-r,-l);break}return{outline:Array.from(c),points:[Array.from(p)]}}#o(e){let n=this.#a,i=n[4],s=n[5],a=[i,s,i,s],r=i,l=s,c=i,p=s,m=e?Math.max:Math.min,g=new Float32Array(4);for(let x=6,j=n.length;x<j;x+=6){let I=n[x+4],P=n[x+5];if(isNaN(n[x])){if(It.pointBoundingBox(I,P,a),l>P)r=I,l=P;else if(l===P)r=m(r,I);if(p<P)c=I,p=P;else if(p===P)c=m(c,I)}else{if(g.set(zl,0),It.bezierBoundingBox(i,s,...n.slice(x,x+6),g),It.rectBoundingBox(...g,a),l>g[1])r=g[0],l=g[1];else if(l===g[1])r=m(r,g[0]);if(p<g[3])c=g[2],p=g[3];else if(p===g[3])c=m(c,g[2])}i=I,s=P}let y=this.#t;y[0]=a[0]-this.#n,y[1]=a[1]-this.#n,y[2]=a[2]-a[0]+2*this.#n,y[3]=a[3]-a[1]+2*this.#n,this.firstPoint=[r,l],this.lastPoint=[c,p]}get box(){return this.#t}newOutliner(e,n,i,s,a,r,l=0){return new Th(e,n,i,s,a,r,l)}updateThickness(e){let n=this.getNewOutline(e);return this.#a=n.#a,this.#s=n.#s,this.#t.set(n.#t),this.firstPoint=n.firstPoint,this.lastPoint=n.lastPoint,this.#t}getNewOutline(e,n){let[i,s,a,r]=this.#t,[l,c,p,m]=this.#e,g=a*p,y=r*m,x=i*p+l,j=s*m+c,I=this.#s,P=this.newOutliner(I[0]*g+x,I[1]*y+j,this.#e,this.#r,e,this.#i,n??this.#n);for(let X=2,Y=I.length;X<Y;X+=2)P.add(I[X]*g+x,I[X+1]*y+j);return P.getOutlines()}}function TA(e){return{bbox:e.box,root:{viewBox:"0 0 1 1"},rootClass:{highlight:!0,free:e.isFree},path:{d:e.toSVGPath()}}}function AA(e,n){let{focusOutline:i}=e;return{bbox:Nt._rotateBox(i.box,n),root:{"data-main-rotation":n},rootClass:{highlightOutline:!0,free:e.isFree},path:{d:i.toSVGPath()}}}class h2{#e;#t;#n;#i=[];#s=[];constructor(e,n=0,i=0,s=!0){let a=zl.slice(),r=4,l=0.0001;for(let{x:P,y:X,width:Y,height:J}of e){let ne=Math.floor((P-n)/0.0001)*0.0001,ae=Math.ceil((P+Y+n)/0.0001)*0.0001,se=Math.floor((X-n)/0.0001)*0.0001,oe=Math.ceil((X+J+n)/0.0001)*0.0001,he=[ne,se,oe,!0],we=[ae,se,oe,!1];this.#i.push(he,we),It.rectBoundingBox(ne,se,ae,oe,a)}let c=a[2]-a[0]+2*i,p=a[3]-a[1]+2*i,m=a[0]-i,g=a[1]-i,y=s?-1/0:1/0,x=1/0,j=this.#i.at(s?-1:-2),I=[j[0],j[2]];for(let P of this.#i){let[X,Y,J,ne]=P;if(!ne&&s){if(Y<x)x=Y,y=X;else if(Y===x)y=Math.max(y,X)}else if(ne&&!s){if(Y<x)x=Y,y=X;else if(Y===x)y=Math.min(y,X)}P[0]=(X-m)/c,P[1]=(Y-g)/p,P[2]=(J-g)/p}this.#e=new Float32Array([m,g,c,p]),this.#t=[y,x],this.#n=I}getOutlines(){this.#i.sort((n,i)=>n[0]-i[0]||n[1]-i[1]||n[2]-i[2]);let e=[];for(let n of this.#i)if(n[3])e.push(...this.#c(n)),this.#o(n);else this.#l(n),e.push(...this.#c(n));return this.#r(e)}#r(e){let n=[],i=new Set;for(let r of e){let[l,c,p]=r;n.push([l,c,r],[l,p,r])}n.sort((r,l)=>r[1]-l[1]||r[0]-l[0]);for(let r=0,l=n.length;r<l;r+=2){let c=n[r][2],p=n[r+1][2];c.push(p),p.push(c),i.add(c),i.add(p)}let s=[],a;while(i.size>0){let r=i.values().next().value,[l,c,p,m,g]=r;i.delete(r);let y=l,x=c;a=[l,p],s.push(a);while(!0){let j;if(i.has(m))j=m;else if(i.has(g))j=g;else break;if(i.delete(j),[l,c,p,m,g]=j,y!==l)a.push(y,x,l,x===c?c:p),y=l;x=x===c?p:c}a.push(y,x)}return new f2(s,this.#e,this.#t,this.#n)}#a(e){let n=this.#s,i=0,s=n.length-1;while(i<=s){let a=i+s>>1,r=n[a][0];if(r===e)return a;if(r<e)i=a+1;else s=a-1}return s+1}#o([,e,n]){let i=this.#a(e);this.#s.splice(i,0,[e,n])}#l([,e,n]){let i=this.#a(e);for(let s=i;s<this.#s.length;s++){let[a,r]=this.#s[s];if(a!==e)break;if(a===e&&r===n){this.#s.splice(s,1);return}}for(let s=i-1;s>=0;s--){let[a,r]=this.#s[s];if(a!==e)break;if(a===e&&r===n){this.#s.splice(s,1);return}}}#c(e){let[n,i,s]=e,a=[[n,i,s]],r=this.#a(s);for(let l=0;l<r;l++){let[c,p]=this.#s[l];for(let m=0,g=a.length;m<g;m++){let[,y,x]=a[m];if(p<=y||x<=c)continue;if(y>=c){if(x>p)a[m][1]=p;else{if(g===1)return[];a.splice(m,1),m--,g--}continue}if(a[m][2]=c,x>p)a.push([n,p,x])}}return a}}class f2 extends Nt{#e;#t=null;#n;constructor(e,n,i,s){super();this.#n=e,this.#e=n,this.firstPoint=i,this.lastPoint=s}static build(e,n){let i=new h2(e,0.001).getOutlines();return i.#t=e,i.focusOutline=new h2(e,0.0025,0.001,n).getOutlines(),i}get isFree(){return!1}get defaultSVGProperties(){return TA(this)}getFocusSVGProperties(e){return AA(this,e)}updateRotation(e){return{root:{"data-main-rotation":e}}}serializeQuadPoints([e,n],[i,s]){let a=this.#t,r=new Float32Array(a.length*8),l=0;for(let{x:c,y:p,width:m,height:g}of a){let y=c*i+e,x=(1-p)*s+n;r[l]=r[l+4]=y,r[l+1]=r[l+3]=x,r[l+2]=r[l+6]=y+m*i,r[l+5]=r[l+7]=x-g*s,l+=8}return r}toSVGPath(){let e=[];for(let n of this.#n){let[i,s]=n;e.push(`M${i} ${s}`);for(let a=2;a<n.length;a+=2){let r=n[a],l=n[a+1];if(r===i)e.push(`V${l}`),s=l;else if(l===s)e.push(`H${r}`),i=r}e.push("Z")}return e.join(" ")}serialize([e,n,i,s],a){let r=[],l=i-e,c=s-n;for(let p of this.#n){let m=Array(p.length);for(let g=0;g<p.length;g+=2)m[g]=e+p[g]*l,m[g+1]=s-p[g+1]*c;r.push(m)}return r}get box(){return this.#e}}class D2 extends Th{newFreeDrawOutline(e,n,i,s,a,r){return new q9(e,n,i,s,a,r)}}class CA{#e;#t;constructor(e,n,i,s,a,r,l){this.#e=new D2(e,n,i,s,a,r,l),this.#t=a}add(e,n){return this.#e.add(e,n)?{path:{d:this.#e.toSVGPath()}}:null}addPoints(e){let n=!1;for(let i=0,s=e.length;i<s;i+=2)n=this.#e.add(e[i],e[i+1])||n;return n?{path:{d:this.#e.toSVGPath()}}:null}end(e,n){return e===void 0?null:this.add(e,n)}isEmpty(){return this.#e.isEmpty()}isCancellable(){return this.#e.isCancellable()}removeLastElement(){return this.#e.removeLastElement()}updateProperty(e,n){return null}getOutlines(){let e=this.#e.getOutlines();return e.buildFocusOutline(2*this.#t),e}get defaultSVGProperties(){return{bbox:[0,0,1,1],root:{viewBox:"0 0 1 1"},rootClass:{highlight:!0,free:!0},path:{d:this.#e.toSVGPath()}}}}class q9 extends E9{static#e=1.5;newOutliner(e,n,i,s,a,r,l=0){return new D2(e,n,i,s,a,r,l)}get isFree(){return!0}buildFocusOutline(e){this.focusOutline=this.getNewOutline(e/2+q9.#e,0.0025)}get defaultSVGProperties(){return TA(this)}getFocusSVGProperties(e){return AA(this,e)}get focusMustRemoveSelfIntersections(){return!0}updateRotation(e){return{root:{"data-main-rotation":e}}}updateProperty(e,n){if(e!=="thickness")return null;let i=this.updateThickness(n/2);return this.buildFocusOutline(n),i}getPathResizedSVGProperties(){return{path:{d:this.toSVGPath()}}}}class D9 extends q2{constructor(e=null){super();super.updateProperties(e)}updateSVGProperty(e,n){if(e!=="thickness")super.updateSVGProperty(e,n)}clone(){let e=new D9;return e.updateAll(this),e}}class no extends Mn{#e=null;#t=0;#n=null;#i=0;#s="";#r="";static _DEFAULT_OPACITY=1;static _DEFAULT_THICKNESS=12;static _defaultDrawingOptions=null;static _type="highlight";static _editorType=gn.HIGHLIGHT;static get _keyboardManager(){let e=no.prototype;return en(this,"_keyboardManager",new rr([[["ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown"],e._moveCaret,{args:[3]}]]))}constructor(e){super({...e,name:"highlightEditor"});this.#e=e.anchorNode||null,this.#t=e.anchorOffset||0,this.#n=e.focusNode||null,this.#i=e.focusOffset||0,this.#s=e.methodOfCreation||(this._drawOutlines?.isFree?"main_toolbar":""),this.#r=e.text||"",this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",this.rotate()}static initialize(e,n){Jt.initialize(e,n),this._defaultDrawingOptions||=new D9({fill:n.highlightColors?.values().next().value||"#fff066","fill-opacity":no._DEFAULT_OPACITY,thickness:no._DEFAULT_THICKNESS})}static getDefaultDrawingOptions(e){let n=this._defaultDrawingOptions.clone();return n.updateProperties(e),n}static get typesMap(){return en(this,"typesMap",new Map([[Pn.HIGHLIGHT_COLOR,"fill"],[Pn.HIGHLIGHT_THICKNESS,"thickness"]]))}static get isDrawer(){return!1}static get _hasClipPath(){return!0}static get _hasDrawClass(){return!1}_addOutlines(e){let{boxes:n,drawOutlines:i}=e;if(!n&&!i)return;if(this._drawingOptions||=e.drawingOptions||no.getDefaultDrawingOptions(),n)e={...e,drawOutlines:f2.build(n,this._uiManager.direction==="ltr")};super._addOutlines(e)}get colorType(){return Pn.HIGHLIGHT_COLOR}get color(){return this._drawingOptions.fill}get opacity(){return this._drawingOptions["fill-opacity"]}get _opacityName(){return"fill-opacity"}get _drawRotation(){return this._drawOutlines?.isFree?this.rotation:0}get isResizable(){return!1}get _mustBeDisabledOnCommit(){return!1}get _mustFixPosition(){return!this._drawOutlines?.isFree}get telemetryInitialData(){return{action:"added",type:this._drawOutlines.isFree?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:this._drawingOptions.thickness,methodOfCreation:this.#s}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}translateInPage(e,n){}get toolbarPosition(){return this.#a(this._drawOutlines.focusOutline.lastPoint)}get commentButtonPosition(){return this.#a(this._drawOutlines.firstPoint)}#a([e,n]){let[i,s,a,r]=this._drawOutlines.box;return[(e-i)/a,(n-s)/r]}updateParams(e,n){switch(e){case Pn.HIGHLIGHT_COLOR:this._updateColorAndOpacity(n,no._DEFAULT_OPACITY,e),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(n)},!0);break;case Pn.HIGHLIGHT_THICKNESS:super.updateParams(e,n),this._reportTelemetry({action:"thickness_changed",thickness:n},!0);break}}get propertiesToUpdate(){let e=super.propertiesToUpdate;return e.push([Pn.HIGHLIGHT_FREE,this._drawOutlines.isFree]),e}get toolbarButtons(){if(this._uiManager.highlightColors)return this._colorPicker=new Nr({editor:this}),[["colorPicker",this._colorPicker]];return super.toolbarButtons}fixAndSetPosition(){return super.fixAndSetPosition(this._drawRotation)}getRect(e,n){return super.getRect(e,n,this._drawRotation)}onceAdded(e){if(!this.annotationElementId)this.parent.addUndoableEditor(this);if(e)this.div.focus()}remove(){this._reportTelemetry({action:"deleted"}),super.remove()}render(){if(this.div)return this.div;let e=super.render();if(this.#r)e.setAttribute("aria-label",this.#r),e.setAttribute("role","mark");if(this._drawOutlines.isFree)e.classList.add("free");else e.addEventListener("keydown",this.#o.bind(this),{signal:this._uiManager._signal});return this.enableEditing(),e}#o(e){no._keyboardManager.exec(this,e)}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:this.#l(!0);break;case 1:case 3:this.#l(!1);break}}#l(e){if(!this.#e)return;let n=window.getSelection();if(e)n.setPosition(this.#e,this.#t);else n.setPosition(this.#n,this.#i)}unselect(){if(super.unselect(),!this._drawOutlines.isFree)this.#l(!1)}static createDrawerInstance({x:e,y:n,box:i,parent:s,isLTR:a}){return new CA(e,n,i,s.scale,this._defaultDrawingOptions.thickness/2,a,0.001)}static _getDrawingTarget(e,{target:n}){return n.closest(".textLayer")}static _getPointerCoords({x:e,y:n}){return[e,n]}static _addDrawingListeners(e,n){e.classList.add("free"),n.addEventListener("abort",()=>e.classList.remove("free"),{once:!0}),window.addEventListener("blur",()=>this._endDraw(null),{signal:n}),window.addEventListener("pointerdown",rs,{capture:!0,passive:!1,signal:n})}static _endDrawingSession(e=!1){return this.endDrawing(e)}createDrawingOptions({color:e,opacity:n,thickness:i}){let{_defaultDrawingOptions:s,_DEFAULT_OPACITY:a}=no;this._drawingOptions=no.getDefaultDrawingOptions({fill:It.makeHexColor(...e),"fill-opacity":n||a,thickness:i||s.thickness})}static deserializeDraw(e,n,i,s,a,r,l){let{quadPoints:c}=r;if(c){let x=[];for(let j=0,I=c.length;j<I;j+=8)x.push({x:(c[j]-e)/i,y:1-(c[j+1]-n)/s,width:(c[j+2]-c[j])/i,height:(c[j+1]-c[j+5])/s});return f2.build(x,l.direction==="ltr")}let p=r.thickness||this._defaultDrawingOptions.thickness,m=(r.inkLists||r.outlines.points)[0],g=new D2(m[0]-e,s-(m[1]-n),[0,0,i,s],1,p/2,!0,0.001);for(let x=0,j=m.length;x<j;x+=2)g.add(m[x]-e,s-(m[x+1]-n));let y=g.getOutlines();return y.buildFocusOutline(p),y}static async deserialize(e,n,i){let s=null;if(e instanceof T9){let{data:{quadPoints:r,rect:l,rotation:c,id:p,color:m,opacity:g,popupRef:y,richText:x,contentsObj:j,creationDate:I,modificationDate:P},parent:{page:{pageNumber:X}}}=e;s=e={annotationType:gn.HIGHLIGHT,color:Array.from(m),opacity:g,quadPoints:r,pageIndex:X-1,rect:l.slice(0),rotation:c,annotationElementId:p,id:p,deleted:!1,popupRef:y,richText:x,comment:j?.str||null,creationDate:I,modificationDate:P}}else if(e instanceof E2){let{data:{inkLists:r,rect:l,rotation:c,id:p,color:m,borderStyle:{rawWidth:g},popupRef:y,richText:x,contentsObj:j,creationDate:I,modificationDate:P},parent:{page:{pageNumber:X}}}=e;s=e={annotationType:gn.HIGHLIGHT,color:Array.from(m),thickness:g,inkLists:r,pageIndex:X-1,rect:l.slice(0),rotation:c,annotationElementId:p,id:p,deleted:!1,popupRef:y,richText:x,comment:j?.str||null,creationDate:I,modificationDate:P}}let a=await super.deserialize(e,n,i);if(a._initialData=s,e.comment)a.setCommentData(e);return a}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();let n=super.serialize(e);if(Object.assign(n,{color:Jt._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),opacity:this.opacity,thickness:this._drawingOptions.thickness,quadPoints:this._drawOutlines.serializeQuadPoints(this.pageTranslation,this.pageDimensions),outlines:this._drawOutlines.serialize(n.rect,this._drawRotation)}),this.addComment(n),this.annotationElementId&&!this.#c(n))return null;return n.id=this.annotationElementId,n}#c(e){let{color:n}=this._initialData;return this.hasEditedComment||e.color.some((i,s)=>i!==n[s])}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;return e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null}}class jA{#e=new Float64Array(6);#t=new Float64Array(2);#n;#i;#s;#r;#a;#o="";#l=0;#c=new Od;#f;#h;constructor(e,n,i,s,a,r){this.#f=i,this.#h=s,this.#s=a,this.#r=r,[e,n]=this.#d(e,n);let l=this.#n=[NaN,NaN,NaN,NaN,e,n];this.#a=[e,n],this.#i=[{line:l,points:this.#a}],this.#e.set(l,0),this.#t.set([e,n],0)}updateProperty(e,n){if(e==="stroke-width")this.#r=n}#d(e,n){return Nt._normalizePoint(e,n,this.#f,this.#h,this.#s)}isEmpty(){return!this.#i?.length}isCancellable(){return this.#a.length<=10}add(e,n){if(this.#m(e,n))this.toSVGPath();return{path:{d:this.#g()}}}addPoints(e){let n=!1;for(let i=0,s=e.length;i<s;i+=2){if(!this.#m(e[i],e[i+1]))continue;if(n=!0,this.#a.length<=6)this.toSVGPath(),n=!1}if(n)this.toSVGPath();return{path:{d:this.#g()}}}#m(e,n){[e,n]=this.#d(e,n),this.#t.set([e,n],0);let[i,s,a,r]=this.#e.subarray(2,6),l=e-a,c=n-r;if(Math.hypot(this.#f*l,this.#h*c)<=2)return!1;if(this.#a.push(e,n),isNaN(i))return this.#e.set([a,r,e,n],2),this.#n.push(NaN,NaN,NaN,NaN,e,n),!0;if(isNaN(this.#e[0]))this.#n.splice(6,6);return this.#e.set([i,s,a,r,e,n],0),this.#n.push(...Nt.createBezierPoints(i,s,a,r,e,n)),!0}end(e,n){if(e!==void 0&&this.#m(e,n))return{path:{d:this.toSVGPath()}};if(this.#a.length===2)return{path:{d:this.toSVGPath()}};return{path:{d:this.#o}}}startNew(e,n,i,s,a){this.#f=i,this.#h=s,this.#s=a,[e,n]=this.#d(e,n);let r=this.#n=[NaN,NaN,NaN,NaN,e,n];this.#a=[e,n],this.#t.set([e,n],0);let l=this.#i.at(-1);if(l)l.line=new Float32Array(l.line),l.points=new Float32Array(l.points);return this.#i.push({line:r,points:this.#a}),this.#e.set(r,0),this.#l=0,this.toSVGPath(),null}getLastElement(){return this.#i.at(-1)}setLastElement(e){if(!this.#i)return this.#c.setLastElement(e);return this.#i.push(e),this.#n=e.line,this.#a=e.points,this.#l=0,{path:{d:this.toSVGPath()}}}removeLastElement(){if(!this.#i)return this.#c.removeLastElement();this.#i.pop(),this.#o="";for(let e=0,n=this.#i.length;e<n;e++){let{line:i,points:s}=this.#i[e];this.#n=i,this.#a=s,this.#l=0,this.toSVGPath()}return{path:{d:this.#o}}}#g(){let e=Nt.svgRound(this.#t[0]),n=Nt.svgRound(this.#t[1]);if(this.#a.length===2){let i=Nt.svgRound(this.#n[4]),s=Nt.svgRound(this.#n[5]);return`${this.#o} M ${i} ${s} L ${e} ${n}`}return`${this.#o} L ${e} ${n}`}toSVGPath(){let e=Nt.svgRound(this.#n[4]),n=Nt.svgRound(this.#n[5]);if(this.#a.length===2)return this.#o=`${this.#o} M ${e} ${n} Z`,this.#o;if(this.#a.length<=6){let s=this.#o.lastIndexOf("M");this.#o=`${this.#o.slice(0,s)} M ${e} ${n}`,this.#l=6}if(this.#a.length===4){let s=Nt.svgRound(this.#n[10]),a=Nt.svgRound(this.#n[11]);return this.#o=`${this.#o} L ${s} ${a}`,this.#l=12,this.#o}let i=[];if(this.#l===0)i.push(`M ${e} ${n}`),this.#l=6;for(let s=this.#l,a=this.#n.length;s<a;s+=6){let[r,l,c,p,m,g]=this.#n.slice(s,s+6).map(Nt.svgRound);i.push(`C${r} ${l} ${c} ${p} ${m} ${g}`)}return this.#o+=i.join(" "),this.#l=this.#n.length,this.#o}getOutlines(e,n,i,s){let a=this.#i.at(-1);return a.line=new Float32Array(a.line),a.points=new Float32Array(a.points),this.#c.build(this.#i,e,n,i,this.#s,this.#r,s),this.#e=null,this.#n=null,this.#i=null,this.#o=null,this.#c}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}class Od extends Nt{#e;#t=0;#n;#i;#s;#r;#a;#o;#l;build(e,n,i,s,a,r,l){this.#s=n,this.#r=i,this.#a=s,this.#o=a,this.#l=r,this.#n=l??0,this.#i=e,this.#h()}get thickness(){return this.#l}setLastElement(e){return this.#i.push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#i.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let e=[];for(let{line:n}of this.#i){if(e.push(`M${Nt.svgRound(n[4])} ${Nt.svgRound(n[5])}`),n.length===6){e.push("Z");continue}if(n.length===12&&isNaN(n[6])){e.push(`L${Nt.svgRound(n[10])} ${Nt.svgRound(n[11])}`);continue}for(let i=6,s=n.length;i<s;i+=6){let[a,r,l,c,p,m]=n.subarray(i,i+6).map(Nt.svgRound);e.push(`C${a} ${r} ${l} ${c} ${p} ${m}`)}}return e.join("")}serialize([e,n,i,s],a){let r=[],l=[],[c,p,m,g]=this.#f(),y,x,j,I,P,X,Y,J,ne;switch(this.#o){case 0:ne=Nt._rescale,y=e,x=n+s,j=i,I=-s,P=e+c*i,X=n+(1-p-g)*s,Y=e+(c+m)*i,J=n+(1-p)*s;break;case 90:ne=Nt._rescaleAndSwap,y=e,x=n,j=i,I=s,P=e+p*i,X=n+c*s,Y=e+(p+g)*i,J=n+(c+m)*s;break;case 180:ne=Nt._rescale,y=e+i,x=n,j=-i,I=s,P=e+(1-c-m)*i,X=n+p*s,Y=e+(1-c)*i,J=n+(p+g)*s;break;case 270:ne=Nt._rescaleAndSwap,y=e+i,x=n+s,j=-i,I=-s,P=e+(1-p-g)*i,X=n+(1-c-m)*s,Y=e+(1-p)*i,J=n+(1-c)*s;break}for(let{line:ae,points:se}of this.#i)r.push(ne(ae,y,x,j,I,a?Array(ae.length):null)),l.push(ne(se,y,x,j,I,a?Array(se.length):null));return{lines:r,points:l,rect:[P,X,Y,J]}}static deserialize(e,n,i,s,a,{paths:{lines:r,points:l},rotation:c,thickness:p}){let m=[],g,y,x,j,I;switch(c){case 0:I=Nt._rescale,g=-e/i,y=n/s+1,x=1/i,j=-1/s;break;case 90:I=Nt._rescaleAndSwap,g=-n/s,y=-e/i,x=1/s,j=1/i;break;case 180:I=Nt._rescale,g=e/i+1,y=-n/s,x=-1/i,j=1/s;break;case 270:I=Nt._rescaleAndSwap,g=n/s+1,y=e/i+1,x=-1/s,j=-1/i;break}if(!r){r=[];for(let X of l){let Y=X.length;if(Y===2){r.push(new Float32Array([NaN,NaN,NaN,NaN,X[0],X[1]]));continue}if(Y===4){r.push(new Float32Array([NaN,NaN,NaN,NaN,X[0],X[1],NaN,NaN,NaN,NaN,X[2],X[3]]));continue}let J=new Float32Array(3*(Y-2));r.push(J);let[ne,ae,se,oe]=X.subarray(0,4);J.set([NaN,NaN,NaN,NaN,ne,ae],0);for(let he=4;he<Y;he+=2){let we=X[he],Ce=X[he+1];J.set(Nt.createBezierPoints(ne,ae,se,oe,we,Ce),(he-2)*3),[ne,ae,se,oe]=[se,oe,we,Ce]}}}for(let X=0,Y=r.length;X<Y;X++)m.push({line:I(r[X].map((J)=>J??NaN),g,y,x,j),points:I(l[X].map((J)=>J??NaN),g,y,x,j)});let P=new this.prototype.constructor;return P.build(m,i,s,1,c,p,a),P}#c(e=this.#l){let n=this.#n+e/2*this.#a;return this.#o%180===0?[n/this.#s,n/this.#r]:[n/this.#r,n/this.#s]}#f(){let[e,n,i,s]=this.#e,[a,r]=this.#c(0);return[e+a,n+r,i-2*a,s-2*r]}#h(){let e=this.#e=kh.slice();for(let{line:s}of this.#i){if(s.length<=12){for(let l=4,c=s.length;l<c;l+=6)It.pointBoundingBox(s[l],s[l+1],e);continue}let a=s[4],r=s[5];for(let l=6,c=s.length;l<c;l+=6){let[p,m,g,y,x,j]=s.subarray(l,l+6);It.bezierBoundingBox(a,r,p,m,g,y,x,j,e),a=x,r=j}}let[n,i]=this.#c();e[0]=vi(e[0]-n,0,1),e[1]=vi(e[1]-i,0,1),e[2]=vi(e[2]+n,0,1),e[3]=vi(e[3]+i,0,1),e[2]-=e[0],e[3]-=e[1]}get box(){return this.#e}updateProperty(e,n){return e==="stroke-width"?this.#d(n):null}#d(e){let[n,i]=this.#c();this.#l=e;let[s,a]=this.#c(),[r,l]=[s-n,a-i],c=this.#e;return c[0]-=r,c[1]-=l,c[2]+=2*r,c[3]+=2*l,c}updateParentDimensions([e,n],i){let[s,a]=this.#c();this.#s=e,this.#r=n,this.#a=i;let[r,l]=this.#c(),c=r-s,p=l-a,m=this.#e;return m[0]-=c,m[1]-=p,m[2]+=2*c,m[3]+=2*p,m}updateRotation(e){return this.#t=e,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#e.map(Nt.svgRound).join(" ")}get defaultProperties(){let[e,n]=this.#e;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Nt.svgRound(e)} ${Nt.svgRound(n)}`}}}get rotationTransform(){let[,,e,n]=this.#e,i=0,s=0,a=0,r=0,l=0,c=0;switch(this.#t){case 90:s=n/e,a=-e/n,l=e;break;case 180:i=-1,r=-1,l=e,c=n;break;case 270:s=-n/e,a=e/n,c=n;break;default:return""}return`matrix(${i} ${s} ${a} ${r} ${Nt.svgRound(l)} ${Nt.svgRound(c)})`}getPathResizingSVGProperties([e,n,i,s]){let[a,r]=this.#c(),[l,c,p,m]=this.#e;if(Math.abs(p-a)<=Nt.PRECISION||Math.abs(m-r)<=Nt.PRECISION){let I=e+i/2-(l+p/2),P=n+s/2-(c+m/2);return{path:{"transform-origin":`${Nt.svgRound(e)} ${Nt.svgRound(n)}`,transform:`${this.rotationTransform} translate(${I} ${P})`}}}let g=(i-2*a)/(p-2*a),y=(s-2*r)/(m-2*r),x=p/i,j=m/s;return{path:{"transform-origin":`${Nt.svgRound(l)} ${Nt.svgRound(c)}`,transform:`${this.rotationTransform} scale(${x} ${j}) translate(${Nt.svgRound(a)} ${Nt.svgRound(r)}) scale(${g} ${y}) translate(${Nt.svgRound(-a)} ${Nt.svgRound(-r)})`}}}getPathResizedSVGProperties([e,n,i,s]){let[a,r]=this.#c(),l=this.#e,[c,p,m,g]=l;if(l[0]=e,l[1]=n,l[2]=i,l[3]=s,Math.abs(m-a)<=Nt.PRECISION||Math.abs(g-r)<=Nt.PRECISION){let P=e+i/2-(c+m/2),X=n+s/2-(p+g/2);for(let{line:Y,points:J}of this.#i)Nt._translate(Y,P,X,Y),Nt._translate(J,P,X,J);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Nt.svgRound(e)} ${Nt.svgRound(n)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let y=(i-2*a)/(m-2*a),x=(s-2*r)/(g-2*r),j=-y*(c+a)+e+a,I=-x*(p+r)+n+r;if(y!==1||x!==1||j!==0||I!==0)for(let{line:P,points:X}of this.#i)Nt._rescale(P,j,I,y,x,P),Nt._rescale(X,j,I,y,x,X);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Nt.svgRound(e)} ${Nt.svgRound(n)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,n],i){let[s,a]=i,r=this.#e,l=e-r[0],c=n-r[1];if(this.#s===s&&this.#r===a)for(let{line:p,points:m}of this.#i)Nt._translate(p,l,c,p),Nt._translate(m,l,c,m);else{let p=this.#s/s,m=this.#r/a;this.#s=s,this.#r=a;for(let{line:g,points:y}of this.#i)Nt._rescale(g,l,c,p,m,g),Nt._rescale(y,l,c,p,m,y);r[2]*=p,r[3]*=m}return r[0]=e,r[1]=n,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${Nt.svgRound(e)} ${Nt.svgRound(n)}`}}}get defaultSVGProperties(){let e=this.#e;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${Nt.svgRound(e[0])} ${Nt.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}}class I2 extends q2{constructor(e){super();this._viewParameters=e,super.updateProperties({fill:"none",stroke:Jt._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,n){if(e==="stroke-width")n??=this["stroke-width"],n*=this._viewParameters.realScale;super.updateSVGProperty(e,n)}clone(){let e=new I2(this._viewParameters);return e.updateAll(this),e}}class I9 extends Mn{static _type="ink";static _editorType=gn.INK;static _defaultDrawingOptions=null;constructor(e){super({...e,name:"inkEditor"});this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(e,n){Jt.initialize(e,n),this._defaultDrawingOptions=new I2(n.viewParameters)}static getDefaultDrawingOptions(e){let n=this._defaultDrawingOptions.clone();return n.updateProperties(e),n}static get supportMultipleDrawings(){return!0}static get typesMap(){return en(this,"typesMap",new Map([[Pn.INK_THICKNESS,"stroke-width"],[Pn.INK_COLOR,"stroke"],[Pn.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance({x:e,y:n,box:[,,i,s],rotation:a}){return new jA(e,n,i,s,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(e,n,i,s,a,r){return Od.deserialize(e,n,i,s,a,r)}static async deserialize(e,n,i){let s=null;if(e instanceof E2){let{data:{inkLists:r,rect:l,rotation:c,id:p,color:m,opacity:g,borderStyle:{rawWidth:y},popupRef:x,richText:j,contentsObj:I,creationDate:P,modificationDate:X},parent:{page:{pageNumber:Y}}}=e;s=e={annotationType:gn.INK,color:Array.from(m),thickness:y,opacity:g,paths:{points:r},boxes:null,pageIndex:Y-1,rect:l.slice(0),rotation:c,annotationElementId:p,id:p,deleted:!1,popupRef:x,richText:j,comment:I?.str||null,creationDate:P,modificationDate:X}}let a=await super.deserialize(e,n,i);if(a._initialData=s,e.comment)a.setCommentData(e);return a}get toolbarButtons(){return this._colorPicker||=new lm(this),[["colorPicker",this._colorPicker]]}get colorType(){return Pn.INK_COLOR}get colorAndOpacityType(){return Pn.INK_COLOR_AND_OPACITY}get opacityType(){return Pn.INK_OPACITY}updateParams(e,n){if(e===Pn.INK_COLOR_AND_OPACITY){this._updateColorAndOpacity(n.color,n.opacity);return}super.updateParams(e,n)}static updateDefaultParams(e,n){if(e===Pn.INK_COLOR_AND_OPACITY){super.updateDefaultParams(Pn.INK_COLOR,n.color),super.updateDefaultParams(Pn.INK_OPACITY,n.opacity);return}super.updateDefaultParams(e,n)}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();let{_drawId:e,_drawingOptions:n,parent:i}=this;n.updateSVGProperty("stroke-width"),i.drawLayer.updateProperties(e,n.toSVGProperties())}static onScaleChangingWhenDrawing(){let e=this._currentParent;if(!e)return;super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties())}createDrawingOptions({color:e,thickness:n,opacity:i}){this._drawingOptions=I9.getDefaultDrawingOptions({stroke:It.makeHexColor(...e),"stroke-width":n,"stroke-opacity":i})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:n,points:i}=this.serializeDraw(e),{_drawingOptions:{stroke:s,"stroke-opacity":a,"stroke-width":r}}=this,l=Object.assign(super.serialize(e),{color:Jt._colorManager.convert(s),opacity:a,thickness:r,paths:{lines:n,points:i}});if(this.addComment(l),e)return l.isCopy=!0,l;if(this.annotationElementId&&!this.#e(l))return null;return l.id=this.annotationElementId,l}#e(e){let{color:n,thickness:i,opacity:s,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((r,l)=>r!==n[l])||e.thickness!==i||e.opacity!==s||e.pageIndex!==a}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let{points:n,rect:i}=this.serializeDraw(!1);return e.updateEdited({rect:i,thickness:this._drawingOptions["stroke-width"],points:n,popup:this.comment}),null}}class d2 extends Od{toSVGPath(){let e=super.toSVGPath();if(!e.endsWith("Z"))e+="Z";return e}}var Jb=8,Jp=3;class xh{static#e={maxDim:512,sigmaSFactor:0.02,sigmaR:25,kernelSize:16};static#t(e,n,i,s){if(i-=e,s-=n,i===0)return s>0?0:4;if(i===1)return s+6;return 2-s}static#n=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static#i(e,n,i,s,a,r,l){let c=this.#t(i,s,a,r);for(let p=0;p<8;p++){let m=(-p+c-l+16)%8,g=this.#n[2*m],y=this.#n[2*m+1];if(e[(i+g)*n+(s+y)]!==0)return m}return-1}static#s(e,n,i,s,a,r,l){let c=this.#t(i,s,a,r);for(let p=0;p<8;p++){let m=(p+c+l+16)%8,g=this.#n[2*m],y=this.#n[2*m+1];if(e[(i+g)*n+(s+y)]!==0)return m}return-1}static#r(e,n,i,s){let a=e.length,r=new Int32Array(a);for(let m=0;m<a;m++)r[m]=e[m]<=s?1:0;for(let m=1;m<i-1;m++)r[m*n]=r[m*n+n-1]=0;for(let m=0;m<n;m++)r[m]=r[n*i-1-m]=0;let l=1,c,p=[];for(let m=1;m<i-1;m++){c=1;for(let g=1;g<n-1;g++){let y=m*n+g,x=r[y];if(x===0)continue;let j=m,I=g;if(x===1&&r[y-1]===0)l+=1,I-=1;else if(x>=1&&r[y+1]===0){if(l+=1,I+=1,x>1)c=x}else{if(x!==1)c=Math.abs(x);continue}let P=[g,m],X=I===g+1,Y={isHole:X,points:P,id:l,parent:0};p.push(Y);let J;for(let Ne of p)if(Ne.id===c){J=Ne;break}if(!J)Y.parent=X?c:0;else if(J.isHole)Y.parent=X?J.parent:c;else Y.parent=X?c:J.parent;let ne=this.#i(r,n,m,g,j,I,0);if(ne===-1){if(r[y]=-l,r[y]!==1)c=Math.abs(r[y]);continue}let ae=this.#n[2*ne],se=this.#n[2*ne+1],oe=m+ae,he=g+se;j=oe,I=he;let we=m,Ce=g;while(!0){let Ne=this.#s(r,n,we,Ce,j,I,1);ae=this.#n[2*Ne],se=this.#n[2*Ne+1];let Pe=we+ae,Ue=Ce+se;P.push(Ue,Pe);let ze=we*n+Ce;if(r[ze+1]===0)r[ze]=-l;else if(r[ze]===1)r[ze]=l;if(Pe===m&&Ue===g&&we===oe&&Ce===he){if(r[y]!==1)c=Math.abs(r[y]);break}else j=we,I=Ce,we=Pe,Ce=Ue}}}return p}static#a(e,n,i,s){if(i-n<=4){for(let oe=n;oe<i-2;oe+=2)s.push(e[oe],e[oe+1]);return}let a=e[n],r=e[n+1],l=e[i-4]-a,c=e[i-3]-r,p=Math.hypot(l,c),m=l/p,g=c/p,y=m*r-g*a,x=c/l,j=1/p,I=Math.atan(x),P=Math.cos(I),X=Math.sin(I),Y=j*(Math.abs(P)+Math.abs(X)),J=j*(1-Y+Y**2),ne=Math.max(Math.atan(Math.abs(X+P)*J),Math.atan(Math.abs(X-P)*J)),ae=0,se=n;for(let oe=n+2;oe<i-2;oe+=2){let he=Math.abs(y-m*e[oe+1]+g*e[oe]);if(he>ae)se=oe,ae=he}if(ae>(p*ne)**2)this.#a(e,n,se+2,s),this.#a(e,se,i,s);else s.push(a,r)}static#o(e){let n=[],i=e.length;return this.#a(e,0,i,n),n.push(e[i-2],e[i-1]),n.length<=4?null:n}static#l(e,n,i,s,a,r){let l=new Float32Array(r**2),c=-2*s**2,p=r>>1;for(let I=0;I<r;I++){let P=(I-p)**2;for(let X=0;X<r;X++)l[I*r+X]=Math.exp((P+(X-p)**2)/c)}let m=new Float32Array(256),g=-2*a**2;for(let I=0;I<256;I++)m[I]=Math.exp(I**2/g);let y=e.length,x=new Uint8Array(y),j=new Uint32Array(256);for(let I=0;I<i;I++)for(let P=0;P<n;P++){let X=I*n+P,Y=e[X],J=0,ne=0;for(let se=0;se<r;se++){let oe=I+se-p;if(oe<0||oe>=i)continue;for(let he=0;he<r;he++){let we=P+he-p;if(we<0||we>=n)continue;let Ce=e[oe*n+we],Ne=l[se*r+he]*m[Math.abs(Ce-Y)];J+=Ce*Ne,ne+=Ne}}let ae=x[X]=Math.round(J/ne);j[ae]++}return[x,j]}static#c(e){let n=new Uint32Array(256);for(let i of e)n[i]++;return n}static#f(e){let n=e.length,i=new Uint8ClampedArray(n>>2),s=-1/0,a=1/0;for(let l=0,c=i.length;l<c;l++){let p=i[l]=e[l<<2];s=Math.max(s,p),a=Math.min(a,p)}let r=255/(s-a);for(let l=0,c=i.length;l<c;l++)i[l]=(i[l]-a)*r;return i}static#h(e){let n,i=-1/0,s=-1/0,a=e.findIndex((c)=>c!==0),r=a,l=a;for(n=a;n<256;n++){let c=e[n];if(c>i){if(n-r>s)s=n-r,l=n-1;i=c,r=n}}for(n=l-1;n>=0;n--)if(e[n]>e[n+1])break;return n}static#d(e){let n=e,{width:i,height:s}=e,{maxDim:a}=this.#e,r=i,l=s;if(i>a||s>a){let y=i,x=s,j=Math.log2(Math.max(i,s)/a),I=Math.floor(j);j=j===I?I-1:I;for(let X=0;X<j;X++){r=Math.ceil(y/2),l=Math.ceil(x/2);let Y=new OffscreenCanvas(r,l);if(Y.getContext("2d").drawImage(e,0,0,y,x,0,0,r,l),y=r,x=l,e!==n)e.close();e=Y.transferToImageBitmap()}let P=Math.min(a/r,a/l);r=Math.round(r*P),l=Math.round(l*P)}let p=new OffscreenCanvas(r,l).getContext("2d",{willReadFrequently:!0});p.fillStyle="white",p.fillRect(0,0,r,l),p.filter="grayscale(1)",p.drawImage(e,0,0,e.width,e.height,0,0,r,l);let m=p.getImageData(0,0,r,l).data;return[this.#f(m),r,l]}static extractContoursFromText(e,{fontFamily:n,fontStyle:i,fontWeight:s},a,r,l,c){let p=new OffscreenCanvas(1,1),m=p.getContext("2d",{alpha:!1}),g=200,y=m.font=`${i} ${s} ${g}px ${n}`,{actualBoundingBoxLeft:x,actualBoundingBoxRight:j,actualBoundingBoxAscent:I,actualBoundingBoxDescent:P,fontBoundingBoxAscent:X,fontBoundingBoxDescent:Y,width:J}=m.measureText(e),ne=1.5,ae=Math.ceil(Math.max(Math.abs(x)+Math.abs(j)||0,J)*ne),se=Math.ceil(Math.max(Math.abs(I)+Math.abs(P)||g,Math.abs(X)+Math.abs(Y)||g)*ne);p=new OffscreenCanvas(ae,se),m=p.getContext("2d",{alpha:!0,willReadFrequently:!0}),m.font=y,m.filter="grayscale(1)",m.fillStyle="white",m.fillRect(0,0,ae,se),m.fillStyle="black",m.fillText(e,ae*(ne-1)/2,se*(3-ne)/2);let oe=this.#f(m.getImageData(0,0,ae,se).data),he=this.#c(oe),we=this.#h(he),Ce=this.#r(oe,ae,se,we);return this.processDrawnLines({lines:{curves:Ce,width:ae,height:se},pageWidth:a,pageHeight:r,rotation:l,innerMargin:c,mustSmooth:!0,areContours:!0})}static process(e,n,i,s,a){let[r,l,c]=this.#d(e),[p,m]=this.#l(r,l,c,Math.hypot(l,c)*this.#e.sigmaSFactor,this.#e.sigmaR,this.#e.kernelSize),g=this.#h(m),y=this.#r(p,l,c,g);return this.processDrawnLines({lines:{curves:y,width:l,height:c},pageWidth:n,pageHeight:i,rotation:s,innerMargin:a,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:n,pageHeight:i,rotation:s,innerMargin:a,mustSmooth:r,areContours:l}){if(s%180!==0)[n,i]=[i,n];let{curves:c,width:p,height:m}=e,g=e.thickness??0,y=[],x=Math.min(n/p,i/m),j=x/n,I=x/i,P=[];for(let{points:Y}of c){let J=r?this.#o(Y):Y;if(!J)continue;P.push(J);let ne=J.length,ae=new Float32Array(ne),se=new Float32Array(3*(ne===2?2:ne-2));if(y.push({line:se,points:ae}),ne===2){ae[0]=J[0]*j,ae[1]=J[1]*I,se.set([NaN,NaN,NaN,NaN,ae[0],ae[1]],0);continue}let[oe,he,we,Ce]=J;oe*=j,he*=I,we*=j,Ce*=I,ae.set([oe,he,we,Ce],0),se.set([NaN,NaN,NaN,NaN,oe,he],0);for(let Ne=4;Ne<ne;Ne+=2){let Pe=ae[Ne]=J[Ne]*j,Ue=ae[Ne+1]=J[Ne+1]*I;se.set(Nt.createBezierPoints(oe,he,we,Ce,Pe,Ue),(Ne-2)*3),[oe,he,we,Ce]=[we,Ce,Pe,Ue]}}if(y.length===0)return null;let X=l?new d2:new Od;return X.build(y,n,i,1,s,l?0:g,a),{outline:X,newCurves:P,areContours:l,thickness:g,width:p,height:m}}static async compressSignature({outlines:e,areContours:n,thickness:i,width:s,height:a}){let r=1/0,l=-1/0,c=0;for(let Y of e){c+=Y.length;for(let J=2,ne=Y.length;J<ne;J++){let ae=Y[J]-Y[J-2];r=Math.min(r,ae),l=Math.max(l,ae)}}let p;if(r>=-128&&l<=127)p=Int8Array;else if(r>=-32768&&l<=32767)p=Int16Array;else p=Int32Array;let m=e.length,g=Jb+Jp*m,y=new Uint32Array(g),x=0;y[x++]=g*Uint32Array.BYTES_PER_ELEMENT+(c-2*m)*p.BYTES_PER_ELEMENT,y[x++]=0,y[x++]=s,y[x++]=a,y[x++]=n?0:1,y[x++]=Math.max(0,Math.floor(i??0)),y[x++]=m,y[x++]=p.BYTES_PER_ELEMENT;for(let Y of e)y[x++]=Y.length-2,y[x++]=Y[0],y[x++]=Y[1];let j=new CompressionStream("deflate-raw"),I=j.writable.getWriter();await I.ready,I.write(y);let P=p.prototype.constructor;for(let Y of e){let J=new P(Y.length-2);for(let ne=2,ae=Y.length;ne<ae;ne++)J[ne-2]=Y[ne]-Y[ne-2];I.write(J)}return I.close(),(await new Response(j.readable).bytes()).toBase64()}static async decompressSignature(e){try{let n=Uint8Array.fromBase64(e),{readable:i,writable:s}=new DecompressionStream("deflate-raw"),a=s.getWriter();await a.ready,a.write(n).then(async()=>{await a.ready,await a.close()}).catch(()=>{});let r=null,l=0;for await(let J of i)r||=new Uint8Array(new Uint32Array(J.buffer,0,4)[0]),r.set(J,l),l+=J.length;let c=new Uint32Array(r.buffer,0,r.length>>2),p=c[1];if(p!==0)throw Error(`Invalid version: ${p}`);let m=c[2],g=c[3],y=c[4]===0,x=c[5],j=c[6],I=c[7],P=[],X=(Jb+Jp*j)*Uint32Array.BYTES_PER_ELEMENT,Y;switch(I){case Int8Array.BYTES_PER_ELEMENT:Y=new Int8Array(r.buffer,X);break;case Int16Array.BYTES_PER_ELEMENT:Y=new Int16Array(r.buffer,X);break;case Int32Array.BYTES_PER_ELEMENT:Y=new Int32Array(r.buffer,X);break}l=0;for(let J=0;J<j;J++){let ne=c[Jp*J+Jb],ae=new Float32Array(ne+2);P.push(ae);for(let se=0;se<Jp-1;se++)ae[se]=c[Jp*J+Jb+se+1];for(let se=0;se<ne;se++)ae[se+2]=ae[se]+Y[l++]}return{areContours:y,thickness:x,outlines:P,width:m,height:g}}catch(n){return yn(`decompressSignature: ${n}`),null}}}class M9 extends q2{constructor(){super();super.updateProperties({fill:Jt._defaultLineColor,"stroke-width":0})}clone(){let e=new M9;return e.updateAll(this),e}}class R9 extends I2{constructor(e){super(e);super.updateProperties({stroke:Jt._defaultLineColor,"stroke-width":1})}clone(){let e=new R9(this._viewParameters);return e.updateAll(this),e}}class Vo extends Mn{#e=!1;#t=null;#n=null;#i=null;static _type="signature";static _editorType=gn.SIGNATURE;static _defaultDrawingOptions=null;constructor(e){super({...e,mustBeCommitted:!0,name:"signatureEditor"});this._willKeepAspectRatio=!0,this.#n=e.signatureData||null,this.#t=null,this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(e,n){Jt.initialize(e,n),this._defaultDrawingOptions=new M9,this._defaultDrawnSignatureOptions=new R9(n.viewParameters)}static getDefaultDrawingOptions(e){let n=this._defaultDrawingOptions.clone();return n.updateProperties(e),n}static get supportMultipleDrawings(){return!1}static get typesMap(){return en(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!this.#t}}static computeTelemetryFinalData(e){let n=e.get("hasDescription");return{hasAltText:n.get(!0)??0,hasNoAltText:n.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){if(this._drawId===null)return;super.onScaleChanging()}render(){if(this.div)return this.div;let e,n,{_isCopy:i}=this;if(i)this._isCopy=!1,e=this.x,n=this.y;if(super.render(),this._drawId===null)if(this.#n){let{lines:s,mustSmooth:a,areContours:r,description:l,uuid:c,heightInPage:p}=this.#n,{rawDims:{pageWidth:m,pageHeight:g},rotation:y}=this.parent.viewport,x=xh.processDrawnLines({lines:s,pageWidth:m,pageHeight:g,rotation:y,innerMargin:Vo._INNER_MARGIN,mustSmooth:a,areContours:r});this.addSignature(x,p,l,c)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:this.#t||""}));if(i)this._isCopy=!0,this._moveAfterPaste(e,n);return this.div}setUuid(e){this.#i=e,this.addEditToolbar()}getUuid(){return this.#i}get description(){return this.#t}set description(e){if(this.#t=e,!this.div)return;this.div.setAttribute("data-l10n-args",JSON.stringify({description:e})),super.addEditToolbar().then((n)=>{n?.updateEditSignatureButton(e)})}getSignaturePreview(){let{newCurves:e,areContours:n,thickness:i,width:s,height:a}=this.#n,r=Math.max(s,a),l=xh.processDrawnLines({lines:{curves:e.map((c)=>({points:c})),thickness:i,width:s,height:a},pageWidth:r,pageHeight:r,rotation:0,innerMargin:0,mustSmooth:!1,areContours:n});return{areContours:n,outline:l.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(e,n,i,s){let{x:a,y:r}=this,{outline:l}=this.#n=e;this.#e=l instanceof d2,this.description=i;let c;if(this.#e)c=Vo.getDefaultDrawingOptions();else c=Vo._defaultDrawnSignatureOptions.clone(),c.updateProperties({"stroke-width":l.thickness});this._addOutlines({drawOutlines:l,drawingOptions:c});let[,p]=this.pageDimensions,m=n/p;if(m=m>=1?0.5:m,this.width*=m/this.height,this.width>=1)m*=0.9/this.width,this.width=0.9;this.height=m,this.setDims(),this.x=a,this.y=r,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(s),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!s,hasDescription:!!i}}),this.div.hidden=!1}getFromImage(e){let{rawDims:{pageWidth:n,pageHeight:i},rotation:s}=this.parent.viewport;return xh.process(e,n,i,s,Vo._INNER_MARGIN)}getFromText(e,n){let{rawDims:{pageWidth:i,pageHeight:s},rotation:a}=this.parent.viewport;return xh.extractContoursFromText(e,n,i,s,a,Vo._INNER_MARGIN)}getDrawnSignature(e){let{rawDims:{pageWidth:n,pageHeight:i},rotation:s}=this.parent.viewport;return xh.processDrawnLines({lines:e,pageWidth:n,pageHeight:i,rotation:s,innerMargin:Vo._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:n}){if(e)this._drawingOptions=Vo.getDefaultDrawingOptions();else this._drawingOptions=Vo._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":n})}serialize(e=!1){if(this.isEmpty())return null;let{lines:n,points:i}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":s}}=this,a=Object.assign(super.serialize(e),{isSignature:!0,areContours:this.#e,color:[0,0,0],thickness:this.#e?0:s});if(this.addComment(a),e)a.paths={lines:n,points:i},a.uuid=this.#i,a.isCopy=!0;else a.lines=n;if(this.#t)a.accessibilityData={type:"Figure",alt:this.#t};return a}static deserializeDraw(e,n,i,s,a,r){if(r.areContours)return d2.deserialize(e,n,i,s,a,r);return Od.deserialize(e,n,i,s,a,r)}static async deserialize(e,n,i){let s=await super.deserialize(e,n,i);return s.#e=e.areContours,s.description=e.accessibilityData?.alt||"",s.#i=e.uuid,s}}class EA extends Jt{#e=null;#t=null;#n=null;#i=null;#s=null;#r="";#a=null;#o=!1;#l=null;#c=!1;#f=!1;static _type="stamp";static _editorType=gn.STAMP;constructor(e){super({...e,name:"stampEditor"});this.#i=e.bitmapUrl,this.#s=e.bitmapFile,this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,n){Jt.initialize(e,n)}static isHandlingMimeForPasting(e){return J3.includes(e)}static paste(e,n){n.pasteEditor({mode:gn.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){if(this._uiManager.useNewAltTextFlow)this.div.hidden=!1;super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){let n=e.get("hasAltText");return{hasAltText:n.get(!0)??0,hasNoAltText:n.get(!1)??0}}#h(e,n=!1){if(!e){this.remove();return}if(this.#e=e.bitmap,!n)this.#t=e.id,this.#c=e.isSvg;if(e.file)this.#r=e.file.name;this.#g()}#d(){if(this.#n=null,this._uiManager.enableWaiting(!1),!this.#a)return;if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}async mlGuessAltText(e=null,n=!0){if(this.hasAltTextData())return null;let{mlManager:i}=this._uiManager;if(!i)throw Error("No ML.");if(!await i.isEnabledFor("altText"))throw Error("ML isn't enabled for alt text.");let{data:s,width:a,height:r}=e||this.copyCanvas(null,null,!0).imageData,l=await i.guess({name:"altText",request:{data:s,width:a,height:r,channels:s.length/(a*r)}});if(!l)throw Error("No response from the AI service.");if(l.error)throw Error("Error from the AI service.");if(l.cancel)return null;if(!l.output)throw Error("No valid response from the AI service.");let c=l.output;if(await this.setGuessedAltText(c),n&&!this.hasAltTextData())this.altTextData={alt:c,decorative:!1};return c}#m(){if(this.#t){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#t).then((i)=>this.#h(i,!0)).finally(()=>this.#d());return}if(this.#i){let i=this.#i;this.#i=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromUrl(i).then((s)=>this.#h(s)).finally(()=>this.#d());return}if(this.#s){let i=this.#s;this.#s=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromFile(i).then((s)=>this.#h(s)).finally(()=>this.#d());return}let e=document.createElement("input");e.type="file",e.accept=J3.join(",");let n=this._uiManager._signal;this.#n=new Promise((i)=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let s=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#h(s)}i()},{signal:n}),e.addEventListener("cancel",()=>{this.remove(),i()},{signal:n})}).finally(()=>this.#d()),e.click()}remove(){if(this.#t){if(this.#e=null,this._uiManager.imageManager.deleteId(this.#t),this.#a?.remove(),this.#a=null,this.#l)clearTimeout(this.#l),this.#l=null}super.remove()}rebuild(){if(!this.parent){if(this.#t)this.#m();return}if(super.rebuild(),this.div===null)return;if(this.#t&&this.#a===null)this.#m();if(!this.isAttachedToDOM)this.parent.add(this)}onceAdded(e){if(this._isDraggable=!0,e)this.div.focus()}isEmpty(){return!(this.#n||this.#e||this.#i||this.#s||this.#t||this.#o)}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,n;if(this._isCopy)e=this.x,n=this.y;if(super.render(),this.div.hidden=!0,this.createAltText(),!this.#o)if(this.#e)this.#g();else this.#m();if(this._isCopy)this._moveAfterPaste(e,n);return this._uiManager.addShouldRescale(this),this.div}setCanvas(e,n){let{id:i,bitmap:s}=this._uiManager.imageManager.getFromCanvas(e,n);if(n.remove(),i&&this._uiManager.imageManager.isValidId(i)){if(this.#t=i,s)this.#e=s;this.#o=!1,this.#g()}}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;if(this.#l!==null)clearTimeout(this.#l);let e=200;this.#l=setTimeout(()=>{this.#l=null,this.#p()},e)}#g(){let{div:e}=this,{width:n,height:i}=this.#e,[s,a]=this.pageDimensions,r=0.75;if(this.width)n=this.width*s,i=this.height*a;else if(n>0.75*s||i>0.75*a){let c=Math.min(0.75*s/n,0.75*a/i);n*=c,i*=c}this._uiManager.enableWaiting(!1);let l=this.#a=document.createElement("canvas");if(l.setAttribute("role","img"),this.addContainer(l),this.width=n/s,this.height=i/a,this.setDims(),this._initialOptions?.isCentered)this.center();else this.fixAndSetPosition();if(this._initialOptions=null,!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)e.hidden=!1;if(this.#p(),!this.#f)this.parent.addUndoableEditor(this),this.#f=!0;if(this._reportTelemetry({action:"inserted_image"}),this.#r)this.div.setAttribute("aria-description",this.#r);if(!this.annotationElementId)this._uiManager.a11yAlert(Jt._l10nAlert.stamp)}copyCanvas(e,n,i=!1){e||=224;let{width:s,height:a}=this.#e,r=new so,l=this.#e,c=s,p=a,m=null;if(n){if(s>n||a>n){let se=Math.min(n/s,n/a);c=Math.floor(s*se),p=Math.floor(a*se)}m=document.createElement("canvas");let y=m.width=Math.ceil(c*r.sx),x=m.height=Math.ceil(p*r.sy);if(!this.#c)l=this.#u(y,x);let j=m.getContext("2d");j.filter=this._uiManager.hcmFilter;let I="white",P="#cfcfd8";if(this._uiManager.hcmFilter!=="none")P="black";else if(iT.isDarkMode)I="#8f8f9d",P="#42414d";let X=15,Y=X*r.sx,J=X*r.sy,ne=new OffscreenCanvas(Y*2,J*2),ae=ne.getContext("2d");ae.fillStyle=I,ae.fillRect(0,0,Y*2,J*2),ae.fillStyle=P,ae.fillRect(0,0,Y,J),ae.fillRect(Y,J,Y,J),j.fillStyle=j.createPattern(ne,"repeat"),j.fillRect(0,0,y,x),j.drawImage(l,0,0,l.width,l.height,0,0,y,x)}let g=null;if(i){let y,x;if(r.symmetric&&l.width<e&&l.height<e)y=l.width,x=l.height;else if(l=this.#e,s>e||a>e){let P=Math.min(e/s,e/a);if(y=Math.floor(s*P),x=Math.floor(a*P),!this.#c)l=this.#u(y,x)}let I=new OffscreenCanvas(y,x).getContext("2d",{willReadFrequently:!0});I.drawImage(l,0,0,l.width,l.height,0,0,y,x),g={width:y,height:x,data:I.getImageData(0,0,y,x).data}}return{canvas:m,width:c,height:p,imageData:g}}#u(e,n){let{width:i,height:s}=this.#e,a=i,r=s,l=this.#e;while(a>2*e||r>2*n){let c=a,p=r;if(a>2*e)a=Math.ceil(a/2);if(r>2*n)r=Math.ceil(r/2);let m=new OffscreenCanvas(a,r);m.getContext("2d").drawImage(l,0,0,c,p,0,0,a,r),l=m.transferToImageBitmap()}return l}#p(){let[e,n]=this.parentDimensions,{width:i,height:s}=this,a=new so,r=Math.ceil(i*e*a.sx),l=Math.ceil(s*n*a.sy),c=this.#a;if(!c||c.width===r&&c.height===l)return;c.width=r,c.height=l;let p=this.#c?this.#e:this.#u(r,l),m=c.getContext("2d");m.filter=this._uiManager.hcmFilter,m.drawImage(p,0,0,p.width,p.height,0,0,r,l)}#b(e){if(e){if(this.#c){let s=this._uiManager.imageManager.getSvgUrl(this.#t);if(s)return s}let n=document.createElement("canvas");return{width:n.width,height:n.height}=this.#e,n.getContext("2d").drawImage(this.#e,0,0),n.toDataURL()}if(this.#c){let[n,i]=this.pageDimensions,s=Math.round(this.width*n*Ch.PDF_TO_CSS_UNITS),a=Math.round(this.height*i*Ch.PDF_TO_CSS_UNITS),r=new OffscreenCanvas(s,a);return r.getContext("2d").drawImage(this.#e,0,0,this.#e.width,this.#e.height,0,0,s,a),r.transferToImageBitmap()}return structuredClone(this.#e)}static async deserialize(e,n,i){let s=null,a=!1;if(e instanceof A9){let{data:{rect:I,rotation:P,id:X,structParent:Y,popupRef:J,richText:ne,contentsObj:ae,creationDate:se,modificationDate:oe},container:he,parent:{page:{pageNumber:we}},canvas:Ce}=e,Ne,Pe;if(Ce)delete e.canvas,{id:Ne,bitmap:Pe}=i.imageManager.getFromCanvas(he.id,Ce),Ce.remove();else a=!0,e._hasNoCanvas=!0;let Ue=(await n._structTree.getAriaAttributes(`pdfjs_internal_id_${X}`))?.get("aria-label")||"";s=e={annotationType:gn.STAMP,bitmapId:Ne,bitmap:Pe,pageIndex:we-1,rect:I.slice(0),rotation:P,annotationElementId:X,id:X,deleted:!1,accessibilityData:{decorative:!1,altText:Ue},isSvg:!1,structParent:Y,popupRef:J,richText:ne,comment:ae?.str||null,creationDate:se,modificationDate:oe}}let r=await super.deserialize(e,n,i),{rect:l,bitmap:c,bitmapUrl:p,bitmapId:m,isSvg:g,accessibilityData:y}=e;if(a)i.addMissingCanvas(e.id,r),r.#o=!0;else if(m&&i.imageManager.isValidId(m)){if(r.#t=m,c)r.#e=c}else r.#i=p;r.#c=g;let[x,j]=r.pageDimensions;if(r.width=(l[2]-l[0])/x,r.height=(l[3]-l[1])/j,y)r.altTextData=y;if(r._initialData=s,e.comment)r.setCommentData(e);return r.#f=!!s,r}serialize(e=!1,n=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let i=Object.assign(super.serialize(e),{bitmapId:this.#t,isSvg:this.#c});if(this.addComment(i),e)return i.bitmapUrl=this.#b(!0),i.accessibilityData=this.serializeAltText(!0),i.isCopy=!0,i;let{decorative:s,altText:a}=this.serializeAltText(!1);if(!s&&a)i.accessibilityData={type:"Figure",alt:a};if(this.annotationElementId){let l=this.#w(i);if(l.isSame)return null;if(l.isSameAltText)delete i.accessibilityData;else i.accessibilityData.structParent=this._initialData.structParent??-1;return i.id=this.annotationElementId,delete i.bitmapId,i}if(n===null)return i;n.stamps||=new Map;let r=this.#c?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(!n.stamps.has(this.#t))n.stamps.set(this.#t,{area:r,serialized:i}),i.bitmap=this.#b(!1);else if(this.#c){let l=n.stamps.get(this.#t);if(r>l.area)l.area=r,l.serialized.bitmap.close(),l.serialized.bitmap=this.#b(!1)}return i}#w(e){let{pageIndex:n,accessibilityData:{altText:i}}=this._initialData,s=e.pageIndex===n,a=(e.accessibilityData?.alt||"")===i;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&s&&a,isSameAltText:a}}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;return e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null}}class Hl{#e;#t=!1;#n=null;#i=null;#s=null;#r=new Map;#a=!1;#o=!1;#l=!1;#c=null;#f=null;#h=null;#d=null;#m=null;#g=-1;#u;static _initialized=!1;static#p=new Map([As,I9,EA,no,Vo].map((e)=>[e._editorType,e]));constructor({uiManager:e,pageIndex:n,div:i,structTreeLayer:s,accessibilityManager:a,annotationLayer:r,drawLayer:l,textLayer:c,viewport:p,l10n:m}){let g=[...Hl.#p.values()];if(!Hl._initialized){Hl._initialized=!0;for(let y of g)y.initialize(m,e)}e.registerEditorTypes(g),this.#u=e,this.pageIndex=n,this.div=i,this.#e=a,this.#n=r,this.viewport=p,this.#h=c,this.drawLayer=l,this._structTree=s,this.#u.addLayer(this)}get isEmpty(){return this.#r.size===0}get isInvisible(){return this.isEmpty&&this.#u.getMode()===gn.NONE}updateToolbar(e){this.#u.updateToolbar(e)}updateMode(e=this.#u.getMode()){switch(this.#_(),e){case gn.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case gn.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case gn.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:n}=this.div;if(n.toggle("nonEditing",!1),e===gn.POPUP)n.toggle("commentEditing",!0);else{n.toggle("commentEditing",!1);for(let i of Hl.#p.values())n.toggle(`${i._type}Editing`,e===i._editorType)}this.div.hidden=!1}hasTextLayer(e){return e===this.#h?.div}setEditingState(e){this.#u.setEditingState(e)}addCommands(e){this.#u.addCommands(e)}cleanUndoStack(e){this.#u.cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){this.#n?.togglePointerEvents(e)}get#b(){return this.#r.size!==0?this.#r.values():this.#u.getEditors(this.pageIndex)}async enable(){this.#l=!0,this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),this.#m?.abort(),this.#m=null;let e=new Set;for(let i of this.#b)if(i.enableEditing(),i.show(!0),i.annotationElementId)this.#u.removeChangedExistingAnnotation(i),e.add(i.annotationElementId);let n=this.#n;if(n)for(let i of n.getEditableAnnotations()){if(i.hide(),this.#u.isDeletedAnnotationElement(i.data.id))continue;if(e.has(i.data.id))continue;let s=await this.deserialize(i);if(!s)continue;this.addOrRebuild(s),s.enableEditing()}this.#l=!1,this.#u._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(this.#o=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),this.#h&&!this.#m){this.#m=new AbortController;let s=this.#u.combinedSignal(this.#m);this.#h.div.addEventListener("pointerdown",(a)=>{let{clientX:l,clientY:c,timeStamp:p}=a,m=this.#g;if(p-m>500){this.#g=p;return}this.#g=-1;let{classList:g}=this.div;g.toggle("getElements",!0);let y=document.elementsFromPoint(l,c);if(g.toggle("getElements",!1),!this.div.contains(y[0]))return;let x,j=new RegExp("^pdfjs_internal_editor_[0-9]+$");for(let P of y)if(j.test(P.id)){x=P.id;break}if(!x)return;let I=this.#r.get(x);if(I?.annotationElementId===null)rs(a),I.dblclick(a)},{signal:s,capture:!0})}let e=this.#n,n=[];if(e){let s=new Map,a=new Map;for(let r of this.#b){if(r.disableEditing(),!r.annotationElementId){n.push(r);continue}if(r.serialize()!==null){s.set(r.annotationElementId,r);continue}else a.set(r.annotationElementId,r);this.getEditableAnnotation(r.annotationElementId)?.show(),r.remove()}for(let r of e.getEditableAnnotations()){let{id:l}=r.data;if(this.#u.isDeletedAnnotationElement(l)){r.updateEdited({deleted:!0});continue}let c=a.get(l);if(c){c.resetAnnotationElement(r),c.show(!1),r.show();continue}if(c=s.get(l),c){if(this.#u.addChangedExistingAnnotation(c),c.renderAnnotationElement(r))c.show(!1)}r.show()}}if(this.#_(),this.isEmpty)this.div.hidden=!0;let{classList:i}=this.div;for(let s of Hl.#p.values())i.remove(`${s._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),e?.updateFakeAnnotations(n),this.#o=!1}getEditableAnnotation(e){return this.#n?.getEditableAnnotation(e)||null}setActiveEditor(e){if(this.#u.getActive()===e)return;this.#u.setActiveEditor(e)}enableTextSelection(){if(this.div.tabIndex=-1,this.#h?.div&&!this.#d){this.#d=new AbortController;let e=this.#u.combinedSignal(this.#d);this.#h.div.addEventListener("pointerdown",this.#w.bind(this),{signal:e}),this.#h.div.classList.add("highlighting")}}disableTextSelection(){if(this.div.tabIndex=0,this.#h?.div&&this.#d)this.#d.abort(),this.#d=null,this.#h.div.classList.remove("highlighting")}#w(e){this.#u.unselectAll();let{target:n}=e;if(n===this.#h.div||(n.getAttribute("role")==="img"||n.classList.contains("endOfContent")||n.classList.contains("textLayerImages")||n.classList.contains("textLayerImagePlaceholder"))&&this.#h.div.contains(n)){let{isMac:i}=ai.platform;if(e.button!==0||e.ctrlKey&&i)return;this.#u.showAllEditors("highlight",!0,!0),no.startDrawing(this,this.#u,this.#u.direction==="ltr",e),e.preventDefault()}}enableClick(){if(this.#i)return;this.#i=new AbortController;let e=this.#u.combinedSignal(this.#i);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e});let n=this.pointerup.bind(this);this.div.addEventListener("pointerup",n,{signal:e}),this.div.addEventListener("pointercancel",n,{signal:e})}disableClick(){this.#i?.abort(),this.#i=null}attach(e){this.#r.set(e.id,e);let{annotationElementId:n}=e;if(n&&this.#u.isDeletedAnnotationElement(n))this.#u.removeDeletedAnnotationElement(e)}detach(e){if(this.#r.delete(e.id),this.#e?.removePointerInTextLayer(e.contentDiv),!this.#o&&e.annotationElementId)this.#u.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#u.removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){if(e.parent===this)return;if(e.parent&&e.annotationElementId)this.#u.addDeletedAnnotationElement(e),Jt.deleteAnnotationElement(e),e.annotationElementId=null;if(this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM)e.div.remove(),this.div.append(e.div)}add(e){if(e.parent===this&&e.isAttachedToDOM)return;if(this.changeParent(e),this.#u.addEditor(e),this.attach(e),!e.isAttachedToDOM){let n=e.render();this.div.append(n),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!this.#l),this.#u.addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;let{activeElement:n}=document;if(e.div.contains(n)&&!this.#s)e._focusEventsAllowed=!1,this.#s=setTimeout(()=>{if(this.#s=null,!e.div.contains(document.activeElement))e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this.#u._signal}),n.focus();else e._focusEventsAllowed=!0},0);e._structTreeParentId=this.#e?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){if(e.needsToBeRebuilt())e.parent||=this,e.rebuild(),e.show();else this.add(e)}addUndoableEditor(e){let n=()=>e._uiManager.rebuild(e),i=()=>{e.remove()};this.addCommands({cmd:n,undo:i,mustExec:!1})}getEditorByUID(e){for(let n of this.#r.values())if(n.uid===e)return n;return null}get#y(){return Hl.#p.get(this.#u.getMode())}combinedSignal(e){return this.#u.combinedSignal(e)}#v(e){let n=this.#y;return n?new n.prototype.constructor(e):null}canCreateNewEmptyEditor(){return this.#y?.canCreateNewEmptyEditor()}async pasteEditor(e,n){this.updateToolbar(e),await this.#u.updateMode(e.mode);let{offsetX:i,offsetY:s}=this.#x(),a=this.#u.getId(),r=this.#v({parent:this,id:a,x:i,y:s,uiManager:this.#u,isCentered:!0,...n});if(r)this.add(r)}async deserialize(e){return await Hl.#p.get(e.annotationType??e.annotationEditorType)?.deserialize(e,this,this.#u)||null}createAndAddNewEditor(e,n,i={}){let s=this.#u.getId(),a=this.#v({parent:this,id:s,x:e.offsetX,y:e.offsetY,uiManager:this.#u,isCentered:n,...i});if(a)this.add(a);return a}get boundingClientRect(){return this.div.getBoundingClientRect()}#x(){let{x:e,y:n,width:i,height:s}=this.boundingClientRect,a=Math.max(0,e),r=Math.max(0,n),l=Math.min(window.innerWidth,e+i),c=Math.min(window.innerHeight,n+s),p=(a+l)/2-e,m=(r+c)/2-n,[g,y]=this.viewport.rotation%180===0?[p,m]:[m,p];return{offsetX:g,offsetY:y}}addNewEditor(e={}){this.createAndAddNewEditor(this.#x(),!0,e)}setSelected(e){this.#u.setSelected(e)}toggleSelected(e){this.#u.toggleSelected(e)}unselect(e){this.#u.unselect(e)}pointerup(e){let{isMac:n}=ai.platform;if(e.button!==0||e.ctrlKey&&n)return;if(e.target!==this.div)return;if(!this.#a)return;if(this.#a=!1,this.#y?.isDrawer&&this.#y.supportMultipleDrawings)return;if(!this.#t){this.#t=!0;return}let i=this.#u.getMode();if(i===gn.STAMP||i===gn.POPUP||i===gn.SIGNATURE){this.#u.unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){if(this.#u.getMode()===gn.HIGHLIGHT)this.enableTextSelection();if(this.#a){this.#a=!1;return}let{isMac:n}=ai.platform;if(e.button!==0||e.ctrlKey&&n)return;if(e.target!==this.div)return;if(this.#a=!0,this.#y?.isDrawer){this.startDrawingSession(e);return}let i=this.#u.getActive();this.#t=!i||i.isEmpty()}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),this.#c){this.#y.startDrawing(this,this.#u,!1,e);return}this.#u.setCurrentDrawingSession(this),this.#c=new AbortController;let n=this.#u.combinedSignal(this.#c);this.div.addEventListener("blur",({relatedTarget:i})=>{if(i&&!this.div.contains(i))this.#f=null,this.commitOrRemove()},{signal:n}),this.#y.startDrawing(this,this.#u,!1,e)}pause(e){if(e){let{activeElement:n}=document;if(this.div.contains(n))this.#f=n;return}if(this.#f)setTimeout(()=>{this.#f?.focus(),this.#f=null},0)}endDrawingSession(e=!1){if(!this.#c)return null;return this.#u.setCurrentDrawingSession(null),this.#c.abort(),this.#c=null,this.#f=null,this.#y.endDrawing(e)}findNewParent(e,n,i){let s=this.#u.findParent(n,i);if(s===null||s===this)return!1;return s.changeParent(e),!0}commitOrRemove(){if(this.#c)return this.endDrawingSession(),!0;return!1}onScaleChanging(){if(!this.#c)return;this.#y.onScaleChangingWhenDrawing(this)}destroy(){if(this.commitOrRemove(),this.#u.getActive()?.parent===this)this.#u.commitOrRemove(),this.#u.setActiveEditor(null);if(this.#s)clearTimeout(this.#s),this.#s=null;for(let e of this.#r.values())this.#e?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#r.clear(),this.#u.removeLayer(this)}#_(){for(let e of this.#r.values())if(e.isEmpty())e.remove()}async render({viewport:e}){this.viewport=e,jh(this.div,e);for(let n of this.#u.getEditors(this.pageIndex))this.add(n),n.rebuild();await this.#u.findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:e}){this.#u.commitOrRemove(),this.#_();let n=this.viewport.rotation,i=e.rotation;if(this.viewport=e,jh(this.div,{rotation:i}),n!==i)for(let s of this.#r.values())s.rotate(i)}get pageDimensions(){let{pageWidth:e,pageHeight:n}=this.viewport.rawDims;return[e,n]}get scale(){return this.#u.viewParameters.realScale}}function CL(e,n){if(e===n)return 0;return e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function Zb(e){if(!e)return null;if(e.nodeType===Node.ELEMENT_NODE)return e.closest(".textLayer");return e.parentElement?.closest(".textLayer")||null}function jL(e,n,i,s){if(e===i)return n<=s;let a=e.compareDocumentPosition(i);if(a&Node.DOCUMENT_POSITION_FOLLOWING)return!0;if(a&Node.DOCUMENT_POSITION_PRECEDING)return!1;return null}function Jk(e,n,i){if(e.nodeType!==Node.ELEMENT_NODE||!e.classList.contains("textLayer")||n!==e.childNodes.length)return{container:e,offset:n};let s=e.lastChild;if(s?.nodeType===Node.ELEMENT_NODE&&s.classList.contains("endOfContent"))s=s.previousSibling;if(!s||!i.contains(s))return null;if(s.nodeType===Node.TEXT_NODE)return{container:s,offset:s.textContent.length};return{container:s,offset:s.childNodes.length}}class dn{#e=null;#t=new Map;#n=null;#i=null;#s=null;#r=null;#a=new Map;static#o=0;static#l=0;static#c=null;static#f=new Set;static#h=!1;static#d=new Set;static#m=new WeakMap;constructor({filterFactory:e=null,pageColors:n=null,pageIndex:i,textLayer:s=null}){if(this.pageIndex=i,this.#i=e,this.#s=n,s){let a=dn.#m.get(s);if(a?.selectionDiv)a.selectionDiv.remove(),dn.#f.delete(a.selectionDiv);if(dn.#m.set(s,{drawLayer:this}),dn.#d.add(s),this.#n=s,this.#r=new MutationObserver((r)=>{if(!this.#e||!this.#n?.isConnected||!dn.#u())return;for(let{addedNodes:l}of r)for(let c of l)if(c.nodeType===Node.ELEMENT_NODE&&c.classList.contains("endOfContent")){dn.#b();return}}),this.#r.observe(s,{childList:!0}),dn.#c===null){dn.#c=new AbortController;let{signal:r}=dn.#c;document.addEventListener("selectionchange",dn.#b.bind(dn),{signal:r}),document.addEventListener("pointerdown",()=>{dn.#h=!0},{signal:r}),document.addEventListener("pointerup",()=>{dn.#h=!1},{signal:r}),window.addEventListener("blur",()=>{dn.#h=!1},{signal:r})}}}setParent(e){if(!this.#e){if(this.#e=e,this.#n?.isConnected&&dn.#u())dn.#b();return}if(this.#e!==e){if(this.#t.size>0)for(let n of this.#t.values())n.remove(),e.append(n);this.#e=e}}static#g(e){let n=this.#m.get(e);if(!n?.selectionDiv)return;n.selectionDiv.remove(),this.#f.delete(n.selectionDiv),n.selectionDiv=null,n.path=null}static#u(){let e=document.getSelection();return!!e&&!e.isCollapsed}static#p(){return this.#d.keys().filter((e)=>e.isConnected).toArray().sort(CL)}static#b(){let e=document.getSelection();if(!e||e.isCollapsed){for(let r of this.#f)r.remove();this.#f.clear();return}let n=new WeakMap,i=this.#p(),s=[];for(let r=0,l=e.rangeCount;r<l;r++){let c=e.getRangeAt(r);if(c.collapsed)continue;let{startContainer:p,startOffset:m,endContainer:g,endOffset:y}=c,x=Zb(p),j=Zb(g),I=x===null,P=j===null;if(this.#h&&I!==P)return;if(e.rangeCount===1){let{anchorNode:J,anchorOffset:ne,focusNode:ae,focusOffset:se}=e,oe=Zb(J),he=Zb(ae),we=jL(J,ne,ae,se);if(oe&&he&&we!==null)if(we)p=J,m=ne,x=oe,g=ae,y=se,j=he;else p=ae,m=se,x=he,g=J,y=ne,j=oe}let X=i.filter((J)=>c.intersectsNode(J));if(X.length===0)continue;let Y=!1;if(!x)x=X[0],p=x,m=0,Y=!0;if(!j)j=X.at(-1),g=j,y=j.childNodes.length,Y=!0;if(g.nodeType===Node.ELEMENT_NODE){if(g.classList.contains("endOfContent")){let J=g.previousSibling;if(!J)continue;g=J,y=J.nodeType===Node.TEXT_NODE?J.textContent.length:J.childNodes.length}else if(g.classList.contains("textLayer")&&g.childNodes.length===y){let J=Jk(g,y,j);if(!J)continue;g=J.container,y=J.offset}}if(p.nodeType===Node.ELEMENT_NODE){let J=Jk(p,m,x);if(!J)continue;p=J.container,m=J.offset}if(x===j&&!Y&&X.includes(x)){s.push([c,x]);continue}for(let J of X){let ne=J.firstChild;if(!ne)continue;let ae=document.createRange();if(J===x)ae.setStart(p,m);else ae.setStartBefore(ne);if(J===j)ae.setEnd(g,y);else{let se=J.lastChild;if(!se)continue;if(se.nodeType===Node.ELEMENT_NODE&&se.classList.contains("endOfContent")){let oe=se.previousSibling;if(!oe)continue;ae.setEndAfter(oe)}else ae.setEndAfter(se)}if(!ae.collapsed)s.push([ae,J])}}let a=new Set(s.map((r)=>r[1]));for(let r of this.#d)if(!a.has(r))this.#g(r);for(let[r,l]of s){let c=dn.#m.get(l);if(!c)continue;let p=n.get(l);if(!p){let j=l.getBoundingClientRect();p=(I,P,X,Y)=>({x:(I-j.x)/j.width,y:(P-j.y)/j.height,width:X/j.width,height:Y/j.height}),n.set(l,p)}let m=[];for(let{x:j,y:I,width:P,height:X}of r.getClientRects()){if(P===0||X===0)continue;if({x:j,y:I,width:P,height:X}=p(j,I,P,X),P===1&&X===1)continue;m.push(`M${j} ${I} h${P} v${X} h-${P} Z`)}if(m.length===0)continue;let{drawLayer:g,selectionDiv:y,path:x}=c;if(!y){let j=`clip_selection_${dn.#l++}`;y=document.createElement("div"),y.className="selection",y.style.clipPath=`url(#${j})`;let I=g.#i?.createSelectionStyle(g.#s);if(I)for(let[Y,J]of Object.entries(I))y.style.setProperty(Y,J);let P=dn._svgFactory.create(1,1,!0);P.setAttribute("aria-hidden","true"),P.setAttribute("width","100%"),P.setAttribute("height","100%");let X=dn._svgFactory.createElement("clipPath");X.setAttribute("id",j),X.setAttribute("clipPathUnits","objectBoundingBox"),x=dn._svgFactory.createElement("path"),X.append(x),P.append(X),y.append(P),c.path=x,c.selectionDiv=y}if(g.#e&&y.parentNode!==g.#e)g.#e.append(y),this.#f.add(y);x.setAttribute("d",m.join(" "))}}static get _svgFactory(){return en(this,"_svgFactory",new cm)}static#w(e,[n,i,s,a]){let{style:r}=e;r.top=`${100*i}%`,r.left=`${100*n}%`,r.width=`${100*s}%`,r.height=`${100*a}%`}#y(){let e=dn._svgFactory.create(1,1,!0);return this.#e.append(e),e.setAttribute("aria-hidden","true"),e}#v(e,n){let i=dn._svgFactory.createElement("clipPath");e.append(i);let s=`clip_${n}`;i.setAttribute("id",s),i.setAttribute("clipPathUnits","objectBoundingBox");let a=dn._svgFactory.createElement("use");return i.append(a),a.setAttribute("href",`#${n}`),a.classList.add("clip"),s}#x(e,n){for(let[i,s]of Object.entries(n))if(s===null)e.removeAttribute(i);else e.setAttribute(i,s)}draw(e,n=!1,i=!1){let s=dn.#o++,a=this.#y(),r=dn._svgFactory.createElement("defs");a.append(r);let l=dn._svgFactory.createElement("path");r.append(l);let c=`path_${s}`;if(l.setAttribute("id",c),l.setAttribute("vector-effect","non-scaling-stroke"),n)this.#a.set(s,l);let p=i?this.#v(r,c):null,m=dn._svgFactory.createElement("use");return a.append(m),m.setAttribute("href",`#${c}`),this.updateProperties(a,e),this.#t.set(s,a),{id:s,clipPathId:`url(#${p})`}}drawOutline(e,n){let i=dn.#o++,s=this.#y(),a=dn._svgFactory.createElement("defs");s.append(a);let r=dn._svgFactory.createElement("path");a.append(r);let l=`path_${i}`;r.setAttribute("id",l),r.setAttribute("vector-effect","non-scaling-stroke");let c;if(n){let g=dn._svgFactory.createElement("mask");a.append(g),c=`mask_${i}`,g.setAttribute("id",c),g.setAttribute("maskUnits","objectBoundingBox");let y=dn._svgFactory.createElement("rect");g.append(y),y.setAttribute("width","1"),y.setAttribute("height","1"),y.setAttribute("fill","white");let x=dn._svgFactory.createElement("use");g.append(x),x.setAttribute("href",`#${l}`),x.setAttribute("stroke","none"),x.setAttribute("fill","black"),x.setAttribute("fill-rule","nonzero"),x.classList.add("mask")}let p=dn._svgFactory.createElement("use");if(s.append(p),p.setAttribute("href",`#${l}`),c)p.setAttribute("mask",`url(#${c})`);let m=p.cloneNode();return s.append(m),p.classList.add("mainOutline"),m.classList.add("secondaryOutline"),this.updateProperties(s,e),this.#t.set(i,s),i}finalizeDraw(e,n){this.#a.delete(e),this.updateProperties(e,n)}updateProperties(e,n){if(!n)return;let{root:i,bbox:s,rootClass:a,path:r}=n,l=typeof e==="number"?this.#t.get(e):e;if(!l)return;if(i)this.#x(l,i);if(s)dn.#w(l,s);if(a){let{classList:c}=l;for(let[p,m]of Object.entries(a))c.toggle(p,m)}if(r){let p=l.firstElementChild.firstElementChild;this.#x(p,r)}}updateParent(e,n){if(n===this)return;let i=this.#t.get(e);if(!i)return;n.#e.append(i),this.#t.delete(e),n.#t.set(e,i)}remove(e){if(this.#a.delete(e),this.#e===null)return;this.#t.get(e).remove(),this.#t.delete(e)}destroy(){this.#e=null;for(let e of this.#t.values())e.remove();if(this.#t.clear(),this.#a.clear(),this.#r?.disconnect(),this.#r=null,this.#n){if(dn.#m.get(this.#n)?.drawLayer===this){if(dn.#g(this.#n),dn.#m.delete(this.#n),dn.#d.delete(this.#n),dn.#d.size===0)dn.#c?.abort(),dn.#c=null,dn.#h=!1}this.#n=null}}}function e2(e){return`${(e*100).toFixed(2)}%`}class p2{#e=[];#t=new Map;#n=null;#i=0;#s=0;#r=0;static#a=null;constructor(e,n,i,s){this.#i=e,this.#e=n,this.#s=i.rawDims.pageWidth,this.#r=i.rawDims.pageHeight,this.#n=s}render(){let e=document.createElement("div");e.className="textLayerImages";for(let n=0;n<this.#e.length;n+=6){let i=this.#o(this.#e.subarray(n,n+6));if(i)e.append(i)}return e.addEventListener("contextmenu",(n)=>{if(!(n.target instanceof HTMLCanvasElement))return;let i=n.target,s=this.#t.get(i);if(!s)return;let a=p2.#a?.deref();if(a===i)return;if(a)a.width=0,a.height=0;p2.#a=new WeakRef(i);let{inverseTransform:r,x1:l,y1:c,width:p,height:m}=s,g=this.#n(),y=Math.ceil(l*g.width),x=Math.ceil(c*g.height),j=Math.floor((l+p/this.#s)*g.width),I=Math.floor((c+m/this.#r)*g.height);i.width=j-y,i.height=I-x;let P=i.getContext("2d");P.setTransform(...r),P.translate(-y,-x),P.drawImage(g,0,0)}),e}#o([e,n,i,s,a,r]){let l=Math.hypot((a-e)*this.#s,(r-n)*this.#r),c=Math.hypot((i-e)*this.#s,(s-n)*this.#r);if(l<this.#i||c<this.#i)return null;let p=[(a-e)*this.#s/l,(r-n)*this.#r/l,(i-e)*this.#s/c,(s-n)*this.#r/c,0,0],m=It.inverseTransform(p),g=document.createElement("canvas");return g.className="textLayerImagePlaceholder",g.width=0,g.height=0,Object.assign(g.style,{opacity:0,position:"absolute",left:e2(e),top:e2(n),width:e2(l/this.#s),height:e2(c/this.#r),transformOrigin:"0% 0%",transform:`matrix(${p.join(",")})`}),this.#t.set(g,{inverseTransform:m,width:l,height:c,x1:e,y1:n}),g}}globalThis._pdfjsTestingUtils={HighlightOutliner:h2};globalThis.pdfjsLib={AbortException:Vl,AnnotationEditorLayer:Hl,AnnotationEditorParamsType:Pn,AnnotationEditorType:gn,AnnotationEditorUIManager:Zc,AnnotationLayer:j9,AnnotationMode:Jc,AnnotationType:Oi,applyOpacity:WB,build:kL,ColorPicker:Nr,createValidAbsoluteUrl:Zk,CSSConstants:sT,DOMSVGFactory:cm,DrawLayer:dn,FeatureTest:ai,fetchData:l9,findContrastColor:KB,getDocument:y9,getFilenameFromUrl:GB,getPdfFilenameFromUrl:VB,getRGB:fm,getRGBA:hm,getUuid:nT,GlobalWorkerOptions:Gl,ImageKind:t2,InvalidPDFException:r2,isDataScheme:v2,isPdfFile:c9,isValidExplicitDest:tL,makeArr:Rd,makeMap:r9,makeObj:Y3,makeSet:HB,MathClamp:vi,noContextMenu:io,normalizeUnicode:BB,OPS:Xo,OutputScale:so,PasswordException:a2,PasswordResponses:MB,PDFDataRangeTransport:S9,PDFDateString:o2,PDFWorker:zs,PermissionFlag:IB,PixelsPerInch:Ch,RenderingCancelledException:y2,renderRichText:aT,ResponseException:im,setLayerDimensions:jh,shadow:en,SignatureExtractor:xh,stopEvent:rs,SupportedImageMimeTypes:J3,TextLayer:pa,TextLayerImages:p2,TouchManager:f9,updateUrlHash:eT,Util:It,VerbosityLevel:m2,version:xL,XfaLayer:o9};C();function qA({currentPage:e,totalPages:n,onPageChange:i,zoom:s,onZoomIn:a,onZoomOut:r,onFit:l,onDownload:c,canDownload:p,allowDownload:m=!0}){return o("div",{className:"relative px-2 py-2 sm:px-4 sm:py-3 bg-card border-t border-gray-200 dark:border-gray-700 z-10 flex items-center justify-between gap-1.5 sm:gap-2 transition-colors duration-200 shrink-0",children:[o("div",{className:"flex items-center gap-1 sm:gap-1.5 bg-gray-200/50 dark:bg-white/10 rounded-md p-0.5 shrink-0",children:[t("button",{onClick:()=>i(Math.max(1,e-1)),disabled:e<=1,className:"p-1 sm:p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors disabled:opacity-40",title:tp(),children:t(Gr,{size:16})}),o("span",{className:"px-1 sm:px-2 text-xs font-mono font-medium text-gray-900 dark:text-gray-100 select-none whitespace-nowrap",children:[t("span",{className:"hidden sm:inline",children:Xx({current:e,total:n||1})}),o("span",{className:"inline sm:hidden",children:[e,"/",n||1]})]}),t("button",{onClick:()=>i(Math.min(n,e+1)),disabled:e>=n,className:"p-1 sm:p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors disabled:opacity-40",title:Jv(),children:t(pt,{size:16})})]}),o("div",{className:"flex items-center gap-1 sm:gap-2 shrink-0",children:[o("div",{className:"flex items-center gap-0.5 sm:gap-1 bg-gray-200/50 dark:bg-white/10 rounded-md p-0.5",children:[t("button",{onClick:r,className:"p-1 sm:p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors",title:Lp(),children:t(xa,{size:16})}),o("span",{className:"w-10 sm:w-12 text-center text-xs font-mono font-medium text-gray-900 dark:text-gray-100 select-none",children:[Math.round(s*100),"%"]}),t("button",{onClick:a,className:"p-1 sm:p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors",title:Dp(),children:t(fe,{size:16})})]}),t("button",{onClick:l,className:"text-xs font-medium px-2 py-1 sm:px-3 sm:py-1.5 rounded bg-gray-200/50 dark:bg-white/10 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors border border-transparent",children:Pf()}),m&&o("button",{onClick:c,disabled:!p,className:"flex items-center gap-1 text-xs font-medium px-2 py-1 sm:px-3 sm:py-1.5 rounded bg-gray-200/50 dark:bg-white/10 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors border border-transparent disabled:opacity-50",title:P_(),children:[t(vt,{size:14}),t("span",{className:"hidden sm:inline",children:gr()})]})]})]})}var Fd="./pdf.worker.min-vf48er29.mjs";var DL=32000000,DA=16;if(typeof window<"u"&&Gl)try{let e=typeof Fd==="string"?Fd.startsWith("/")?Fd:"/"+Fd.replace(/^\.\//,""):Fd;if(typeof e==="string")Gl.workerSrc=e}catch{}var IL=D(({file:e,annotations:n,shareId:i,children:s,onPlay:a,onPause:r,onTimeUpdate:l,startTime:c,allowDownload:p},m)=>{let{isDrawing:g,currentTool:y,currentColor:x,addAnnotation:j,annotations:I}=tn(),[P,X]=u(null),[Y,J]=u(()=>c&&!isNaN(c)?Math.max(1,Math.round(c)):1),[ne,ae]=u(1),[se,oe]=u(null),[he,we]=u({width:800,height:1000}),[Ce,Ne]=u(2),Pe=w(null),[Ue,ze]=u(!0),[He,De]=u(null);ln(m,()=>({play:()=>{a?.()},pause:()=>{r?.()},seekTo:(Ht)=>{if(Ht&&!isNaN(Ht)){let $t=Math.max(1,Math.min(ne,Math.round(Ht)));J($t)}}}),[ne,a,r]),h(()=>{l?.(Y)},[Y,l]),h(()=>{let Ht=($t)=>{let cn=document.activeElement;if(cn&&(cn.tagName==="INPUT"||cn.tagName==="TEXTAREA"||cn instanceof HTMLElement&&cn.isContentEditable))return;if($t.key==="ArrowRight"||$t.key==="ArrowDown"||$t.key==="PageDown")$t.preventDefault(),J((pn)=>{let oi=Math.min(ne,pn+1);if(oi!==pn)a?.();return oi});else if($t.key==="ArrowLeft"||$t.key==="ArrowUp"||$t.key==="PageUp")$t.preventDefault(),J((pn)=>{let oi=Math.max(1,pn-1);if(oi!==pn)a?.();return oi});else if($t.key==="Home")$t.preventDefault(),J(1),a?.();else if($t.key==="End")$t.preventDefault(),J(ne),a?.()};return window.addEventListener("keydown",Ht),()=>{window.removeEventListener("keydown",Ht)}},[ne,a]);let[Fe,bt]=u({width:0,height:0}),[Ve,$e]=u(1),[Ct,ct]=u({x:0,y:0}),[Ze,mt]=u(!1);h(()=>{mt(!1)},[e.id]);let Xt=w(null);h(()=>{let Ht=Xt.current;if(!Ht)return;let $t=new ResizeObserver((cn)=>{let pn=cn[0];if(pn)bt({width:pn.contentRect.width,height:pn.contentRect.height})});return $t.observe(Ht),()=>$t.disconnect()},[]);let hn=e.media?.pdfTranscode?.url;h(()=>{if(!hn){De("No PDF URL available"),ze(!1);return}let Ht=!0;ze(!0),De(null);let $t=y9({url:hn});return $t.promise.then((cn)=>{if(!Ht)return;X(cn),ae(cn.numPages),J((pn)=>c&&!isNaN(c)?Math.max(1,Math.min(cn.numPages,Math.round(c))):pn),ze(!1)}).catch((cn)=>{if(!Ht)return;console.error("Failed to load PDF:",cn),De("Failed to load PDF document"),ze(!1)}),()=>{Ht=!1,$t.destroy().catch(()=>{})}},[hn,c]),h(()=>{if(!P)return;let Ht=!0,$t=null;return P.getPage(Y).then((cn)=>{if(!Ht)return;let pn=cn.getViewport({scale:1}),oi=cn.getViewport({scale:Ce}),fn=document.createElement("canvas");fn.width=oi.width,fn.height=oi.height;let Si=fn.getContext("2d");if(!Si)return;if($t=cn.render({canvasContext:Si,viewport:oi,canvas:fn}),!Ht){$t.cancel();return}$t.promise.then(()=>{if(!Ht)return;oe(fn),we({width:pn.width,height:pn.height})}).catch((Cn)=>{if(!Ht||Cn&&typeof Cn==="object"&&"name"in Cn&&Cn.name==="RenderingCancelledException")return;console.error("Failed to render page:",Cn)})}).catch((cn)=>{if(!Ht)return;console.error("Failed to get page:",cn)}),()=>{if(Ht=!1,$t)$t.cancel()}},[P,Y,Ce]),h(()=>{let Ht=window.setTimeout(()=>{let $t=typeof window<"u"?window.devicePixelRatio||1:1,cn=he.width*he.height,pn=cn>0?Math.sqrt(DL/cn):DA,oi=Math.min(Math.max(0.5,Ve*$t),pn,DA);Ne(oi)},150);return()=>window.clearTimeout(Ht)},[Ve,he]),h(()=>{let Ht=Pe.current;if(!P||!Ht)return;let $t=!0,cn=null;return Ht.innerHTML="",P.getPage(Y).then((pn)=>{if(!$t)return;cn=new pa({textContentSource:pn.streamTextContent(),container:Ht,viewport:pn.getViewport({scale:1})}),cn.render().catch(()=>{})}).catch((pn)=>{if(!$t)return;console.error("Failed to build text layer:",pn)}),()=>{$t=!1,cn?.cancel()}},[P,Y]),h(()=>{let Ht=Pe.current;if(!Ht)return;Ht.style.transform=`translate(${Ct.x}px, ${Ct.y}px) scale(${Ve})`},[Ct,Ve]);let{width:nn,height:Zt}=Fe,{width:Rn,height:Zn}=he,Ni=Yc(nn,Zt,Rn,Zn);h(()=>{if(nn<=0||Zt<=0||Rn<=0||Zn<=0)return;if(Ze)return;$e(Ni),ct(Bl(nn,Zt,Rn,Zn,Ni))},[nn,Zt,Ni,Rn,Zn,Ze]);let ri=(Ht)=>{mt(!0);let $t=Ll(Ve,Ct,Ht,nn/2,Zt/2);$e($t.zoom),ct($t.pan)},Ai=()=>{mt(!1),$e(Ni),ct(Bl(nn,Zt,Rn,Zn,Ni))};Cd({containerRef:Xt,zoom:Ve,pan:Ct,baseScale:Ni,onZoomChange:(Ht)=>{mt(!0),$e(Ht.zoom),ct(Ht.pan)},onPanChange:ct});let Vs=async()=>{let Ht=e.media?.original?.key;if(!Ht||!e.id)return;try{let $t=i?await A.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:i,fileId:e.id},json:{key:Ht}}):await A.api.files["download-url"].$post({json:{key:Ht,assetId:e.id}});if(!$t.ok)return;let{url:cn}=await $t.json(),pn=document.createElement("a");pn.href=cn,pn.download=e.name||"document.pdf",document.body.appendChild(pn),pn.click(),document.body.removeChild(pn)}catch{}},zi=[...n||[],...I];return o("div",{className:"flex flex-col flex-1 h-full overflow-hidden bg-gray-100 dark:bg-gray-950 relative",children:[o("div",{className:"flex-1 flex flex-col-reverse md:flex-row min-h-0 relative",children:[s,o("div",{ref:Xt,className:"flex-1 relative overflow-hidden touch-none",children:[Ue?t("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 z-20",children:t("div",{className:"w-8 h-8 border-4 border-white/30 border-t-white rounded-full animate-spin"})}):He?t("div",{className:"absolute inset-0 flex items-center justify-center text-gray-500 text-sm",children:He}):t(Uo,{width:nn,height:Zt,mediaDimensions:he,canvasElement:se,annotations:zi,scale:Ve,offset:Ct,className:"absolute inset-0 z-0",isDrawing:g,currentTool:y,currentColor:x,onAddAnnotation:j}),t("div",{ref:Pe,className:"pdf-text-layer",onMouseDown:(Ht)=>{if(Ht.target instanceof HTMLElement&&Ht.target.tagName!=="SPAN")window.getSelection()?.removeAllRanges()},style:{transform:`translate(${Ct.x}px, ${Ct.y}px) scale(${Ve})`,transformOrigin:"0 0",pointerEvents:g?"none":"auto"}})]})]}),t(qA,{currentPage:Y,totalPages:ne,onPageChange:(Ht)=>{J(Ht),a?.()},zoom:Ve,onZoomIn:()=>ri(1.2),onZoomOut:()=>ri(0.8),onFit:Ai,onDownload:Vs,canDownload:!!e.media?.original?.key,allowDownload:p})]})}),IA=IL;var MA={id:"pdf",name:"PDF",match:(e)=>e.proxyType==="pdf",viewer:IA,commentsConfig:{hasTimestamp:!0,hasAnnotations:!0,formatTimestamp:(e)=>`P${Math.round(e)}`}};C();var ML=D(({file:e,shareId:n,children:i,allowDownload:s=!0},a)=>(ln(a,()=>({play:()=>{},pause:()=>{},seekTo:()=>{}})),o("div",{className:"flex flex-col flex-1 h-full overflow-hidden bg-gray-100 dark:bg-gray-950 relative",children:[o("div",{className:"flex-1 flex flex-col-reverse md:flex-row min-h-0 relative",children:[i,t("div",{className:"flex-1 flex items-center justify-center",children:t("p",{className:"text-muted-foreground",children:"Preview unavailable"})})]}),t("div",{className:"relative px-4 py-3 bg-card border-t border-gray-200 dark:border-gray-700 z-10 flex items-center justify-end gap-2 transition-colors duration-200",children:s&&o("button",{onClick:async()=>{let l=e.media?.original?.key;if(!l||!e.id)return;try{let c=n?await A.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:n,fileId:e.id},json:{key:l}}):await A.api.files["download-url"].$post({json:{key:l,assetId:e.id}});if(!c.ok)return;let{url:p}=await c.json(),m=document.createElement("a");m.href=p,m.download="",document.body.appendChild(m),m.click(),document.body.removeChild(m)}catch{}},disabled:!e.media?.original?.key,className:"flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded bg-gray-200/50 dark:bg-white/10 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors border border-transparent disabled:opacity-50 animate-in fade-in zoom-in-95 duration-200",title:"Download original file",children:[t(vt,{size:14}),"Download"]})})]}))),RA=ML;var O9={id:"default",name:"Default",match:()=>!0,viewer:RA,commentsConfig:{hasTimestamp:!1,hasAnnotations:!1}};var RL=[MA,_k,Tk];function fs(e){if(!e)return O9;return RL.find((i)=>i.match(e))||O9}function ba({teamId:e,projectId:n,file:i,onSaveField:s,members:a,onCommentSelect:r,hideAnnotationControl:l=!1,readOnly:c=!1,publicFields:p,isPublic:m=!1,shareId:g,currentTime:y,onTyping:x,selectedCommentId:j}){let{canEdit:I}=Pt(n),{fields:P,setFields:X}=Or(),Y=K(),{ref:J,inView:ne}=Mt(),[ae,se]=u(null),[oe,he]=u(!1),[we,Ce]=u(null),{data:Ne}=Z({queryKey:["fields",n],queryFn:async()=>{let Ze=await A.api.projects[":projectId"].fields.$get({param:{projectId:n}});if(!Ze.ok)throw Error("Failed to fetch fields");return await Ze.json()},enabled:!!n&&!p}),Pe=fs(i);h(()=>{if(p)X(p,n);else if(Ne)X(Ne,n)},[Ne,p,n,X]);let{data:Ue,fetchNextPage:ze,hasNextPage:He}=ut({queryKey:m?["shares",g,"files",i?.id,"comments"]:["files",i?.id,"comments"],queryFn:async({pageParam:Ze})=>{if(m){let mt=localStorage.getItem(`share_pwd_${g}`)||"",Xt=await A.api.shares[":shareId"].files[":fileId"].comments.$get({param:{shareId:g,fileId:i.id},query:{after:Ze}},{headers:{"x-share-password":mt}});if(!Xt.ok)throw Error("Failed to fetch comments");return await Xt.json()}else{let mt=await A.api.files[":fileId"].comments.$get({param:{fileId:i.id},query:{after:Ze}});if(!mt.ok)throw Error("Failed to fetch comments");return await mt.json()}},enabled:!!i?.id&&(!m||!!g),initialPageParam:"",refetchInterval:2000,getNextPageParam:(Ze)=>Ze.pageInfo?.cursor||void 0}),{mutate:De}=U({mutationFn:async({text:Ze,attachmentIds:mt,annotations:Xt,replyToId:hn,guestUserId:nn,second:Zt})=>{if(m){let Rn=localStorage.getItem(`share_pwd_${g}`)||"",Zn=await A.api.shares[":shareId"].files[":fileId"].comments.$post({param:{shareId:g,fileId:i.id},json:{message:Ze,attachmentIds:mt,replyToId:hn??void 0,annotations:Xt,second:Zt??void 0}},{headers:{"x-share-password":Rn,...nn?{"x-guest-user-id":nn}:{}}});if(!Zn.ok)throw Error("Failed to create comment");return await Zn.json()}else{let Rn=await A.api.files[":fileId"].comments.$post({param:{fileId:i.id},json:{message:Ze,attachmentIds:mt,replyToId:hn??void 0,annotations:Xt,second:Zt??void 0}});if(!Rn.ok)throw Error("Failed to create comment");return await Rn.json()}},onSuccess:()=>{Y.invalidateQueries({queryKey:m?["shares",g,"files",i?.id,"comments"]:["files",i?.id,"comments"]})}});h(()=>{if(ne&&He)ze()},[ne,ze,He]);let Fe=O(()=>(i?.fieldValues||[]).reduce((Ze,mt)=>(Ze[mt.fieldId]=mt,Ze),{}),[i?.fieldValues]),bt=O(()=>[...P].sort((Ze,mt)=>{let Xt=Ze.config?.name?.toLowerCase()||"",hn=mt.config?.name?.toLowerCase()||"";if(Xt<hn)return-1;if(Xt>hn)return 1;return 0}),[P]),Ve=Ue?.pages.flatMap((Ze)=>Ze.data??[])??[],$e=async(Ze,mt,Xt,hn,nn)=>{if(!i?.id)return;if(m){console.log("[handleSendMessage] checking auth status");let Zt=await A.api.me.$get(),{id:Rn}=await Zt.json();if(console.log("[handleSendMessage] loggedInUserId:",Rn),!Rn){let Zn=localStorage.getItem("guest_user_id");if(console.log("[handleSendMessage] guestUserId from storage:",Zn),!Zn){console.log("[handleSendMessage] no guest ID, opening popup"),Ce({text:Ze,attachmentIds:mt,annotations:Xt,replyToId:hn,second:nn}),he(!0);return}De({text:Ze,attachmentIds:mt,annotations:Xt,replyToId:hn,guestUserId:Zn,second:nn})}else De({text:Ze,attachmentIds:mt,annotations:Xt,replyToId:hn,second:nn})}else De({text:Ze,attachmentIds:mt,annotations:Xt,replyToId:hn,second:nn});se(null)},Ct=(Ze)=>{if(console.log("[handleGuestSuccess] guestUserId:",Ze),we)De({...we,guestUserId:Ze}),Ce(null),se(null)},ct=(Ze)=>{let mt=a.find((Xt)=>Xt.id===Ze);if(mt)return mt;return{id:"unknown",name:"Unknown",role:"unknown"}};if(!i)return t("div",{className:"flex h-full items-center justify-center p-8 text-center bg-background",children:o("div",{className:"space-y-2",children:[t("p",{className:"text-sm font-medium text-foreground",children:cx()}),t("p",{className:"text-xs text-muted-foreground",children:KC()})]})});return t("div",{className:"bg-background h-full flex flex-col overflow-hidden",children:o(wo,{defaultValue:"comments",className:"p-1 flex-1 flex flex-col px-2 min-h-0",children:[o(vo,{className:"w-full shrink-0",children:[t(Vr,{value:"comments",className:"flex-1",children:od()}),t(Vr,{value:"fields",className:"flex-1",children:Ti()})]}),o(En,{value:"comments",className:"flex-1 flex flex-col overflow-hidden min-h-0 mt-0",children:[t(ie,{className:"flex-1 min-h-0 [&>div>div]:block!",children:o("div",{className:"space-y-4",children:[Ve.map((Ze)=>o("div",{children:[t(Zi,{teamId:e,message:Ze,getUser:ct,onReply:se,hasReplies:!!Ze.replies?.length,formatTimestamp:Pe?.commentsConfig?.formatTimestamp,frameRate:Pe?.commentsConfig?.hasTimestamp?i?.media?.metadata?.frameRate||30:void 0,startTimecode:Pe?.commentsConfig?.hasTimestamp?i?.media?.metadata?.startTimecode:void 0,isSelected:j===Ze.id,onSelect:()=>{r?.(Ze)}}),Ze.replies?.map((mt,Xt)=>t("div",{children:t(Zi,{teamId:e,isReply:!0,message:mt,getUser:ct,onReply:se,hasReplies:!1,isLastReply:Xt===(Ze.replies?.length??0)-1,formatTimestamp:Pe?.commentsConfig?.formatTimestamp,frameRate:Pe?.commentsConfig?.hasTimestamp?i?.media?.metadata?.frameRate||30:void 0,startTimecode:Pe?.commentsConfig?.hasTimestamp?i?.media?.metadata?.startTimecode:void 0,isSelected:j===mt.id,onSelect:()=>{r?.(mt)}})},mt.id))]},Ze.id)),t("div",{ref:J})]})}),(!c||m)&&t("div",{className:"mt-4 shrink-0",children:t(ou,{isOpen:oe,onClose:()=>he(!1),onSuccess:Ct,children:t(Us,{projectId:n,onSendMessage:$e,replyingTo:ae,onCancelReply:()=>se(null),hideAnnotationControl:l,disableMentions:m,currentTime:Pe?.commentsConfig?.hasTimestamp?y:void 0,formatTimestamp:Pe?.commentsConfig?.formatTimestamp,frameRate:Pe?.commentsConfig?.hasTimestamp?i?.media?.metadata?.frameRate||30:void 0,startTimecode:Pe?.commentsConfig?.hasTimestamp?i?.media?.metadata?.startTimecode:void 0,onTyping:x})})})]}),t(En,{value:"fields",className:"flex-1 flex flex-col overflow-hidden min-h-0 mt-4",children:t(ie,{className:"flex-1 px-4 min-h-0 [&>div>div]:block!",children:bt&&bt.length>0&&t("div",{className:"space-y-4 pb-4",children:bt.map((Ze)=>o("div",{className:"space-y-1",children:[t("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:Ze.config?.name}),t("div",{className:"min-h-[28px]",children:t(hs,{fieldId:Ze.id,config:Ze.config,value:Fe[Ze.id]?.value,onSave:I?(mt)=>s(Ze.id,mt):void 0,readOnly:c||Ze.readOnly||!I})})]},Ze.id))})})})]})})}
|
|
299
|
+
export{ya,_a,ru,Zl,nu,fs,Zi,ou,ba};
|