@shumai-one/shumai 0.3.0 → 0.3.2

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.
Files changed (158) hide show
  1. package/bin/{chunk-93jcw0pn.js → chunk-08dr94gp.js} +1 -1
  2. package/bin/{chunk-a1mtpcrd.js → chunk-08mxv0sm.js} +2 -2
  3. package/bin/{chunk-jjgwrvdb.js → chunk-0t4z17qr.js} +1 -1
  4. package/bin/{chunk-cmcsxkh1.js → chunk-1d22tysv.js} +2 -2
  5. package/bin/{chunk-9zy0a8kt.js → chunk-1dawjfk8.js} +2 -2
  6. package/bin/{chunk-q11m2cp3.js → chunk-1nh6xgek.js} +1 -1
  7. package/bin/chunk-20y3wte3.js +2 -0
  8. package/bin/{chunk-4tt3jvm1.js → chunk-2ynx0den.js} +1 -1
  9. package/bin/{chunk-yaydmgcg.js → chunk-31a3k77j.js} +1 -1
  10. package/bin/{chunk-8rkp0fc5.js → chunk-31mjcykb.js} +2 -2
  11. package/bin/{chunk-1yqar2gz.js → chunk-3jdef7n4.js} +1 -1
  12. package/bin/{chunk-h1hj60fr.js → chunk-3rcc5s99.js} +2 -2
  13. package/bin/{chunk-sa4gc1f5.js → chunk-3t7mjvdv.js} +2 -2
  14. package/bin/{chunk-36wf2dq0.js → chunk-4ahve1nf.js} +1 -1
  15. package/bin/chunk-4hdnrwh1.js +1 -0
  16. package/bin/{chunk-652x28v2.js → chunk-4hdx2tv0.js} +1 -1
  17. package/bin/chunk-4htdb0xp.js +1 -0
  18. package/bin/chunk-4p7xpfey.js +2 -0
  19. package/bin/chunk-5f81c951.js +1 -0
  20. package/bin/{chunk-bnpw72vt.js → chunk-5vqan9c4.js} +2 -2
  21. package/bin/{chunk-e66j69wz.js → chunk-5zntjzxw.js} +1 -1
  22. package/bin/{chunk-jmh934ca.js → chunk-6a2eb3b5.js} +1 -1
  23. package/bin/{chunk-5x1ppya9.js → chunk-6t3gdd7e.js} +2 -2
  24. package/bin/chunk-7d5kep8c.js +2 -0
  25. package/bin/{chunk-a06432s3.js → chunk-7eycsyk6.js} +1 -1
  26. package/bin/{chunk-0p333kh7.js → chunk-7jjc175m.js} +3 -3
  27. package/bin/chunk-7kzqkp5z.js +1 -0
  28. package/bin/chunk-7sh6409h.js +1 -0
  29. package/bin/{chunk-zct68gc7.js → chunk-7y8dng8t.js} +2 -2
  30. package/bin/chunk-8e5zvy88.js +307 -0
  31. package/bin/{chunk-nmzvxgd6.js → chunk-8m6zg15c.js} +2 -2
  32. package/bin/{chunk-wv8xk7n7.js → chunk-8qyke29r.js} +1 -1
  33. package/bin/{chunk-jxxq76at.js → chunk-90et6bwm.js} +1 -1
  34. package/bin/chunk-9c7fxjej.js +2 -0
  35. package/bin/{chunk-449feg7g.js → chunk-9p2d0mk1.js} +1 -1
  36. package/bin/{chunk-c003q4v6.js → chunk-a10tf0d8.js} +1 -1
  37. package/bin/{chunk-9h3c60vw.js → chunk-a76c5r3c.js} +2 -2
  38. package/bin/{chunk-3g54qkv5.js → chunk-amsb41z5.js} +1 -1
  39. package/bin/{chunk-28egv700.js → chunk-arpna31w.js} +1 -1
  40. package/bin/{chunk-k0s6gfg6.js → chunk-b10meywb.js} +1 -1
  41. package/bin/chunk-b1e3tec3.js +62 -0
  42. package/bin/chunk-bdjhb77e.js +2 -0
  43. package/bin/chunk-beay9amy.js +1 -0
  44. package/bin/{chunk-cspp4n1d.js → chunk-c3fvs0bv.js} +2 -2
  45. package/bin/{chunk-ab45988z.js → chunk-c5my1b3k.js} +1 -1
  46. package/bin/{chunk-jh6pw37a.js → chunk-d3s00sn0.js} +1 -1
  47. package/bin/{chunk-9bvwwj5y.js → chunk-dhekxndw.js} +1 -1
  48. package/bin/{chunk-pzehf31g.js → chunk-dwaj1yn4.js} +1 -1
  49. package/bin/{chunk-rybbss5f.js → chunk-dwswqq3g.js} +1 -1
  50. package/bin/{chunk-5jhrqbk2.js → chunk-ejfmxjw6.js} +2 -2
  51. package/bin/{chunk-mzre12bp.js → chunk-er1rb6yj.js} +1 -1
  52. package/bin/chunk-etces6ff.js +2 -0
  53. package/bin/{chunk-r8vrfefa.js → chunk-etqpzc9e.js} +1 -1
  54. package/bin/{chunk-pna93n17.js → chunk-f8cn9m28.js} +1 -1
  55. package/bin/{chunk-fvf7j1qj.js → chunk-fdpjw17x.js} +1 -1
  56. package/bin/{chunk-agd2jevj.js → chunk-g2dk56e7.js} +1 -1
  57. package/bin/{chunk-fr3dg9aj.js → chunk-gn8snrnk.js} +1 -1
  58. package/bin/chunk-gqh4ttjh.js +3 -0
  59. package/bin/{chunk-szs8dy1s.js → chunk-gvn079hy.js} +2 -2
  60. package/bin/{chunk-qwxt1cha.js → chunk-h2wsm7h3.js} +2 -2
  61. package/bin/{chunk-cwebycwv.js → chunk-hfp4hpca.js} +2 -2
  62. package/bin/{chunk-yvgs4kmv.js → chunk-hrzm70wg.js} +1 -1
  63. package/bin/{chunk-fwcm78s9.js → chunk-hz31j0hk.js} +2 -2
  64. package/bin/{chunk-d3cqp0tb.js → chunk-j0p1peav.js} +2 -2
  65. package/bin/{chunk-aa2tkqg0.js → chunk-jm6bxtzt.js} +1 -1
  66. package/bin/{chunk-y132jbf0.js → chunk-jstc7pka.js} +1 -1
  67. package/bin/{chunk-8g1s0pq1.js → chunk-k0a35mg9.js} +1 -1
  68. package/bin/{chunk-e0kw3bst.js → chunk-k20bhxed.js} +1 -1
  69. package/bin/{chunk-he4h8e9e.js → chunk-k9w6mk9d.js} +2 -2
  70. package/bin/chunk-kgb16ggd.css +1 -0
  71. package/bin/{chunk-qjf561n2.js → chunk-m4py21f3.js} +1 -1
  72. package/bin/{chunk-jtwvd0te.js → chunk-mahxw48e.js} +2 -2
  73. package/bin/{chunk-f4x2dxe5.js → chunk-mcxsk75h.js} +3 -3
  74. package/bin/chunk-mm1j72a8.js +7 -0
  75. package/bin/{chunk-zy2sqtt9.js → chunk-na2nympm.js} +1 -1
  76. package/bin/chunk-nr89225z.js +2 -0
  77. package/bin/chunk-nrf5r23d.js +1 -0
  78. package/bin/{chunk-ddag2ezv.js → chunk-nt9tfjx6.js} +2 -2
  79. package/bin/chunk-nzy3pjjm.js +15 -0
  80. package/bin/{chunk-pvx55h1v.js → chunk-p396vw9h.js} +1 -1
  81. package/bin/{chunk-wwsvnz4v.js → chunk-p9xfyqh1.js} +2 -2
  82. package/bin/{chunk-phc9efjf.js → chunk-ph3e1bpp.js} +2 -2
  83. package/bin/{chunk-w3m9g3e9.js → chunk-pj0fgb2x.js} +1 -1
  84. package/bin/{chunk-9fefn2st.js → chunk-pp072ksj.js} +1 -1
  85. package/bin/{chunk-qt9efp9y.js → chunk-q5cdjzbv.js} +1 -1
  86. package/bin/{chunk-nd6psyzq.js → chunk-qc6dmzn0.js} +2 -2
  87. package/bin/{chunk-fytbcgak.js → chunk-qmtvy2j4.js} +2 -2
  88. package/bin/chunk-qn96vbke.js +2 -0
  89. package/bin/{chunk-bf5a4yc8.js → chunk-qvgc9e08.js} +1 -1
  90. package/bin/{chunk-mw0rc5m7.js → chunk-rrxjvewm.js} +1 -1
  91. package/bin/{chunk-nxhzchen.js → chunk-s05f0v9t.js} +1 -1
  92. package/bin/chunk-s5rfya1p.js +1 -0
  93. package/bin/{chunk-gc7b9j22.js → chunk-s7qpj715.js} +1 -1
  94. package/bin/chunk-scsy69bp.js +1 -0
  95. package/bin/{chunk-vjxgv3r6.js → chunk-sf6fwvrs.js} +1 -1
  96. package/bin/{chunk-h3y7szbm.js → chunk-ss45w8ks.js} +2 -2
  97. package/bin/{chunk-4gbs9swm.js → chunk-t2txvzkp.js} +1 -1
  98. package/bin/{chunk-e56nza63.js → chunk-td54rdfj.js} +1 -1
  99. package/bin/{chunk-6wa075zh.js → chunk-tsncwscz.js} +1 -1
  100. package/bin/{chunk-evzxjqr3.js → chunk-v2kfr8fx.js} +2 -2
  101. package/bin/chunk-vb9m47z9.js +1 -0
  102. package/bin/{chunk-t0detvbj.js → chunk-ve7v8wtv.js} +2 -2
  103. package/bin/{chunk-cm25nm9t.js → chunk-vf066xwh.js} +1 -1
  104. package/bin/{chunk-d5fapvnp.js → chunk-vgb8bzcg.js} +2 -2
  105. package/bin/{chunk-wcfpdfgy.js → chunk-vnfmh5ke.js} +2 -2
  106. package/bin/{chunk-hdqvbds8.js → chunk-vy24ncn2.js} +1 -1
  107. package/bin/{chunk-2xmsa8wv.js → chunk-w3a50kz8.js} +1 -1
  108. package/bin/{chunk-bjfwz2m7.js → chunk-w9w5301f.js} +2 -2
  109. package/bin/{chunk-1zpw2mbj.js → chunk-wap08p4j.js} +2 -2
  110. package/bin/{chunk-hktggc90.js → chunk-wny0qagx.js} +1 -1
  111. package/bin/{chunk-dk45f6mp.js → chunk-wqhk76de.js} +2 -2
  112. package/bin/{chunk-en4m76fw.js → chunk-wr5byz6r.js} +1 -1
  113. package/bin/{chunk-ky3dx324.js → chunk-wrz9e73c.js} +2 -2
  114. package/bin/{chunk-6f1twjf6.js → chunk-ws07a9kv.js} +1 -1
  115. package/bin/{chunk-9q32g9jd.js → chunk-x5dcgk62.js} +1 -1
  116. package/bin/{chunk-sprpjp4t.js → chunk-xawwxdq9.js} +2 -2
  117. package/bin/chunk-xwmsxg5x.js +1 -0
  118. package/bin/{chunk-736tcjve.js → chunk-y2nw8rbx.js} +2 -2
  119. package/bin/{chunk-48ebezek.js → chunk-y9ttm07y.js} +1 -1
  120. package/bin/chunk-yahb7wan.js +2 -0
  121. package/bin/{chunk-swa43tzr.js → chunk-z0ej44ak.js} +3 -3
  122. package/bin/chunk-zemgtnk0.js +1 -0
  123. package/bin/{chunk-a6dvjjce.js → chunk-zg0vm233.js} +1 -1
  124. package/bin/chunk-zhd2mkbr.js +1 -0
  125. package/bin/{chunk-cfamv4b2.js → chunk-zs9b0f3z.js} +2 -2
  126. package/bin/{chunk-8sr8ff6a.js → chunk-zxpef55w.js} +3 -3
  127. package/bin/shumai-app.html +1 -1
  128. package/bin/shumai-app.js +254 -224
  129. package/package.json +7 -7
  130. package/prisma/migrations/20260729073910_change_agent_session_asset_on_delete_to_set_null/migration.sql +5 -0
  131. package/prisma/migrations/20260729114346_asset_size_byte_bigint/migration.sql +2 -0
  132. package/prisma/migrations/20260729114659_ai_usage_tokens_bigint/migration.sql +5 -0
  133. package/prisma/schema.prisma +6 -6
  134. package/bin/chunk-1wz0dge4.js +0 -3
  135. package/bin/chunk-2m2saan7.js +0 -2
  136. package/bin/chunk-2p0rg6xs.js +0 -1
  137. package/bin/chunk-3ge0s4k2.js +0 -1
  138. package/bin/chunk-6ks4277t.js +0 -2
  139. package/bin/chunk-80d6p55n.js +0 -1
  140. package/bin/chunk-8a9k4qj6.js +0 -2
  141. package/bin/chunk-8gkm2ysh.js +0 -1
  142. package/bin/chunk-8nvybmyv.js +0 -2
  143. package/bin/chunk-9jd3d3f3.js +0 -320
  144. package/bin/chunk-9nwjhams.js +0 -1
  145. package/bin/chunk-a2njf6av.js +0 -1
  146. package/bin/chunk-af3nys0r.js +0 -1
  147. package/bin/chunk-cx1ebj9k.js +0 -1
  148. package/bin/chunk-d1p9qz3y.js +0 -7
  149. package/bin/chunk-ea0fh29m.js +0 -2
  150. package/bin/chunk-epsctccj.js +0 -1
  151. package/bin/chunk-jyr3g5m4.js +0 -1
  152. package/bin/chunk-n0cn0xfg.js +0 -1
  153. package/bin/chunk-q0dhm16d.js +0 -62
  154. package/bin/chunk-qs5k9j8s.js +0 -1
  155. package/bin/chunk-t0fq8b99.js +0 -2
  156. package/bin/chunk-tm6z4hkd.css +0 -1
  157. package/bin/chunk-vdn3jymh.js +0 -2
  158. package/bin/chunk-z5p39kpk.js +0 -2
@@ -1,320 +0,0 @@
1
- import{B as gO,D as Jd,F as F5,G as B5,H as O5,O as Qd,P as bO,Q as $k,R as cl,S as i3,T as P7,U as H3}from"./chunk-ea0fh29m.js";import{ea as Ed}from"./chunk-vdn3jymh.js";import{Wa as _p}from"./chunk-cwebycwv.js";import{$a as Od,ab as Hd,bb as Md,cb as Dd,db as Td,eb as Rd,fb as Nd,gb as zd}from"./chunk-2m2saan7.js";import{Cf as C3,Df as _3,Ef as v_,Gf as kb,Hf as S_,If as y_,Kf as k_,Lf as M_,Mf as Cb,Nf as C_,Of as __,Pf as wd,Qf as jd,Rf as dd,Sf as qd,Tf as hO,Uf as cO,Vf as kp,Wf as Cp,bg as _5}from"./chunk-zct68gc7.js";import{pg as uO,qg as wo,rg as hi}from"./chunk-z5p39kpk.js";import{Ng as yd}from"./chunk-1zpw2mbj.js";import{Pg as c8}from"./chunk-jtwvd0te.js";import{Rg as Ln,Sg as Mf,Ug as Df,Vg as Tf,Wg as l1,Zg as n3,ch as Yd,dh as mO,eh as h8,fh as kd,gh as Cd,hh as _d,jh as Fd,kh as Bd}from"./chunk-8a9k4qj6.js";import{Bj as l8,Dj as pd,Fi as Gd,Fj as Vd,Hi as $_,Ki as Vn,Kj as Qk,Lj as Zk,Mh as xd,Ni as C5,Nj as qo,Th as Le,ai as bd,bi as Zd,ck as E2,ej as l3,hk as Mi,ij as f3,ik as Ad,jj as ul,jk as vd,ki as Ud,kk as Sd,mi as r8,mj as Xd,nh as Pa,nj as Vk,nk as It,oh as mo,oi as O3,oj as hh,ph as x,pj as ch,qh as rt,rh as k5,rj as Kd,sj as Yk,ti as Id,uh as po,uj as Jk,wh as Hf,wi as oh,xh as oO,xi as jo,yi as aO,yj as Ld,zi as iO}from"./chunk-q0dhm16d.js";import{Wk as Ie,Xk as Me,Yk as o4}from"./chunk-6f1twjf6.js";var kw=Me((lJ,yw)=>{var qw=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,wM=/\n/g,jM=/^\s*/,dM=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,qM=/^:\s*/,AM=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,vM=/^[;\s]*/,SM=/^\s+|\s+$/g,yM=`
2
- `,Aw="/",vw="*",Cf="",kM="comment",CM="declaration";function _M(t,e){if(typeof t!=="string")throw TypeError("First argument must be a string");if(!t)return[];e=e||{};var a=1,i=1;function s(d){var v=d.match(wM);if(v)a+=v.length;var k=d.lastIndexOf(yM);i=~k?d.length-k:i+d.length}function n(){var d={line:a,column:i};return function(v){return v.position=new l(d),c(),v}}function l(d){this.start=d,this.end={line:a,column:i},this.source=e.source}l.prototype.content=t;function f(d){var v=Error(e.source+":"+a+":"+i+": "+d);if(v.reason=d,v.filename=e.source,v.line=a,v.column=i,v.source=t,e.silent);else throw v}function o(d){var v=d.exec(t);if(!v)return;var k=v[0];return s(k),t=t.slice(k.length),v}function c(){o(jM)}function u(d){var v;d=d||[];while(v=m())if(v!==!1)d.push(v);return d}function m(){var d=n();if(Aw!=t.charAt(0)||vw!=t.charAt(1))return;var v=2;while(Cf!=t.charAt(v)&&(vw!=t.charAt(v)||Aw!=t.charAt(v+1)))++v;if(v+=2,Cf===t.charAt(v-1))return f("End of comment missing");var k=t.slice(2,v-2);return i+=2,s(k),t=t.slice(v),i+=2,d({type:kM,comment:k})}function p(){var d=n(),v=o(dM);if(!v)return;if(m(),!o(qM))return f("property missing ':'");var k=o(AM),y=d({type:CM,property:Sw(v[0].replace(qw,Cf)),value:k?Sw(k[0].replace(qw,Cf)):Cf});return o(vM),y}function w(){var d=[];u(d);var v;while(v=p())if(v!==!1)d.push(v),u(d);return d}return c(),w()}function Sw(t){return t?t.replace(SM,Cf):Cf}yw.exports=_M});var Cw=Me((Dc)=>{var FM=Dc&&Dc.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Dc,"__esModule",{value:!0});Dc.default=OM;var BM=FM(kw());function OM(t,e){let a=null;if(!t||typeof t!=="string")return a;let i=(0,BM.default)(t),s=typeof e==="function";return i.forEach((n)=>{if(n.type!=="declaration")return;let{property:l,value:f}=n;if(s)e(l,f,n);else if(f)a=a||{},a[l]=f}),a}});var Ow=Me((Fw)=>{Object.defineProperty(Fw,"__esModule",{value:!0});Fw.camelCase=void 0;var HM=/^--[a-zA-Z0-9_-]+$/,MM=/-([a-z])/g,DM=/^[^-]+$/,TM=/^-(webkit|moz|ms|o|khtml)-/,RM=/^-(ms)-/,NM=function(t){return!t||DM.test(t)||HM.test(t)},zM=function(t,e){return e.toUpperCase()},_w=function(t,e){return"".concat(e,"-")},EM=function(t,e){if(e===void 0)e={};if(NM(t))return t;if(t=t.toLowerCase(),e.reactCompat)t=t.replace(RM,_w);else t=t.replace(TM,_w);return t.replace(MM,zM)};Fw.camelCase=EM});var Mw=Me((j4,Hw)=>{var xM=j4&&j4.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},UM=xM(Cw()),IM=Ow();function w4(t,e){var a={};if(!t||typeof t!=="string")return a;return(0,UM.default)(t,function(i,s){if(i&&s)a[(0,IM.camelCase)(i,e)]=s}),a}w4.default=w4;Hw.exports=w4});var ad=Me((ZP,ed)=>{var v5=Object.prototype.hasOwnProperty,td=Object.prototype.toString,Jj=Object.defineProperty,Qj=Object.getOwnPropertyDescriptor,Zj=function(e){if(typeof Array.isArray==="function")return Array.isArray(e);return td.call(e)==="[object Array]"},$j=function(e){if(!e||td.call(e)!=="[object Object]")return!1;var a=v5.call(e,"constructor"),i=e.constructor&&e.constructor.prototype&&v5.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!a&&!i)return!1;var s;for(s in e);return typeof s>"u"||v5.call(e,s)},Wj=function(e,a){if(Jj&&a.name==="__proto__")Jj(e,a.name,{enumerable:!0,configurable:!0,value:a.newValue,writable:!0});else e[a.name]=a.newValue},Pj=function(e,a){if(a==="__proto__"){if(!v5.call(e,a))return;else if(Qj)return Qj(e,a).value}return e[a]};ed.exports=function t(){var e,a,i,s,n,l,f=arguments[0],o=1,c=arguments.length,u=!1;if(typeof f==="boolean")u=f,f=arguments[1]||{},o=2;if(f==null||typeof f!=="object"&&typeof f!=="function")f={};for(;o<c;++o)if(e=arguments[o],e!=null){for(a in e)if(i=Pj(f,a),s=Pj(e,a),f!==s){if(u&&s&&($j(s)||(n=Zj(s)))){if(n)n=!1,l=i&&Zj(i)?i:[];else l=i&&$j(i)?i:{};Wj(f,{name:a,newValue:t(u,l,s)})}else if(typeof s<"u")Wj(f,{name:a,newValue:s})}}return f}});var h0=Me((Met,Wd)=>{var $c;if(typeof window<"u")$c=window;else if(typeof global<"u")$c=global;else if(typeof self<"u")$c=self;else $c={};Wd.exports=$c});var u8=Me((Det,tq)=>{var Pd=Array.prototype.slice;tq.exports=AR;function AR(t,e){if(!("length"in t))t=[t];t=Pd.call(t);while(t.length){var a=t.shift(),i=e(a);if(i)return i;if(a.childNodes&&a.childNodes.length)t=Pd.call(a.childNodes).concat(t)}}});var aq=Me((Tet,eq)=>{eq.exports=Ao;function Ao(t,e){if(!(this instanceof Ao))return new Ao(t,e);this.data=t,this.nodeValue=t,this.length=t.length,this.ownerDocument=e||null}Ao.prototype.nodeType=8;Ao.prototype.nodeName="#comment";Ao.prototype.toString=function(){return"[object Comment]"}});var sq=Me((Ret,iq)=>{iq.exports=ml;function ml(t,e){if(!(this instanceof ml))return new ml(t);this.data=t||"",this.length=this.data.length,this.ownerDocument=e||null}ml.prototype.type="DOMTextNode";ml.prototype.nodeType=3;ml.prototype.nodeName="#text";ml.prototype.toString=function(){return this.data};ml.prototype.replaceData=function(e,a,i){var s=this.data,n=s.substring(0,e),l=s.substring(e+a,s.length);this.data=n+i+l,this.length=this.data.length}});var m8=Me((Net,nq)=>{nq.exports=vR;function vR(t){var e=this,a=t.type;if(!t.target)t.target=e;if(!e.listeners)e.listeners={};var i=e.listeners[a];if(i)return i.forEach(function(s){if(t.currentTarget=e,typeof s==="function")s(t);else s.handleEvent(t)});if(e.parentNode)e.parentNode.dispatchEvent(t)}});var g8=Me((zet,lq)=>{lq.exports=SR;function SR(t,e){var a=this;if(!a.listeners)a.listeners={};if(!a.listeners[t])a.listeners[t]=[];if(a.listeners[t].indexOf(e)===-1)a.listeners[t].push(e)}});var b8=Me((Eet,fq)=>{fq.exports=yR;function yR(t,e){var a=this;if(!a.listeners)return;if(!a.listeners[t])return;var i=a.listeners[t],s=i.indexOf(e);if(s!==-1)i.splice(s,1)}});var cq=Me((xet,hq)=>{hq.exports=rq;var kR=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];function rq(t){switch(t.nodeType){case 3:return p8(t.data);case 8:return"<!--"+t.data+"-->";default:return CR(t)}}function CR(t){var e=[],a=t.tagName;if(t.namespaceURI==="http://www.w3.org/1999/xhtml")a=a.toLowerCase();if(e.push("<"+a+OR(t)+BR(t)),kR.indexOf(a)>-1)e.push(" />");else{if(e.push(">"),t.childNodes.length)e.push.apply(e,t.childNodes.map(rq));else if(t.textContent||t.innerText)e.push(p8(t.textContent||t.innerText));else if(t.innerHTML)e.push(t.innerHTML);e.push("</"+a+">")}return e.join("")}function _R(t,e){var a=typeof t[e];if(e==="style"&&Object.keys(t.style).length>0)return!0;return t.hasOwnProperty(e)&&(a==="string"||a==="boolean"||a==="number")&&e!=="nodeName"&&e!=="className"&&e!=="tagName"&&e!=="textContent"&&e!=="innerText"&&e!=="namespaceURI"&&e!=="innerHTML"}function FR(t){if(typeof t==="string")return t;var e="";return Object.keys(t).forEach(function(a){var i=t[a];a=a.replace(/[A-Z]/g,function(s){return"-"+s.toLowerCase()}),e+=a+":"+i+";"}),e}function BR(t){var e=t.dataset,a=[];for(var i in e)a.push({name:"data-"+i,value:e[i]});return a.length?oq(a):""}function oq(t){var e=[];return t.forEach(function(a){var{name:i,value:s}=a;if(i==="style")s=FR(s);e.push(i+'="'+HR(s)+'"')}),e.length?" "+e.join(" "):""}function OR(t){var e=[];for(var a in t)if(_R(t,a))e.push({name:a,value:t[a]});for(var i in t._attributes)for(var s in t._attributes[i]){var n=t._attributes[i][s],l=(n.prefix?n.prefix+":":"")+s;e.push({name:l,value:n.value})}if(t.className)e.push({name:"class",value:t.className});return e.length?oq(e):""}function p8(t){var e="";if(typeof t==="string")e=t;else if(t)e=t.toString();return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function HR(t){return p8(t).replace(/"/g,"&quot;")}});var j8=Me((Uet,mq)=>{var w8=u8(),MR=m8(),DR=g8(),TR=b8(),RR=cq(),uq="http://www.w3.org/1999/xhtml";mq.exports=Ca;function Ca(t,e,a){if(!(this instanceof Ca))return new Ca(t);var i=a===void 0?uq:a||null;if(this.tagName=i===uq?String(t).toUpperCase():t,this.nodeName=this.tagName,this.className="",this.dataset={},this.childNodes=[],this.parentNode=null,this.style={},this.ownerDocument=e||null,this.namespaceURI=i,this._attributes={},this.tagName==="INPUT")this.type="text"}Ca.prototype.type="DOMElement";Ca.prototype.nodeType=1;Ca.prototype.appendChild=function(e){if(e.parentNode)e.parentNode.removeChild(e);return this.childNodes.push(e),e.parentNode=this,e};Ca.prototype.replaceChild=function(e,a){if(e.parentNode)e.parentNode.removeChild(e);var i=this.childNodes.indexOf(a);return a.parentNode=null,this.childNodes[i]=e,e.parentNode=this,a};Ca.prototype.removeChild=function(e){var a=this.childNodes.indexOf(e);return this.childNodes.splice(a,1),e.parentNode=null,e};Ca.prototype.insertBefore=function(e,a){if(e.parentNode)e.parentNode.removeChild(e);var i=a===null||a===void 0?-1:this.childNodes.indexOf(a);if(i>-1)this.childNodes.splice(i,0,e);else this.childNodes.push(e);return e.parentNode=this,e};Ca.prototype.setAttributeNS=function(e,a,i){var s=null,n=a,l=a.indexOf(":");if(l>-1)s=a.substr(0,l),n=a.substr(l+1);if(this.tagName==="INPUT"&&a==="type")this.type=i;else{var f=this._attributes[e]||(this._attributes[e]={});f[n]={value:i,prefix:s}}};Ca.prototype.getAttributeNS=function(e,a){var i=this._attributes[e],s=i&&i[a]&&i[a].value;if(this.tagName==="INPUT"&&a==="type")return this.type;if(typeof s!=="string")return null;return s};Ca.prototype.removeAttributeNS=function(e,a){if(!Object.prototype.hasOwnProperty.call(this._attributes,e))return;var i=this._attributes[e];if(i&&Object.prototype.hasOwnProperty.call(i,a))delete i[a]};Ca.prototype.hasAttributeNS=function(e,a){var i=this._attributes[e];return!!i&&a in i};Ca.prototype.setAttribute=function(e,a){return this.setAttributeNS(null,e,a)};Ca.prototype.getAttribute=function(e){return this.getAttributeNS(null,e)};Ca.prototype.removeAttribute=function(e){return this.removeAttributeNS(null,e)};Ca.prototype.hasAttribute=function(e){return this.hasAttributeNS(null,e)};Ca.prototype.removeEventListener=TR;Ca.prototype.addEventListener=DR;Ca.prototype.dispatchEvent=MR;Ca.prototype.focus=function(){return};Ca.prototype.toString=function(){return RR(this)};Ca.prototype.getElementsByClassName=function(e){var a=e.split(" "),i=[];return w8(this,function(s){if(s.nodeType===1){var n=s.className||"",l=n.split(" ");if(a.every(function(f){return l.indexOf(f)!==-1}))i.push(s)}}),i};Ca.prototype.getElementsByTagName=function(e){e=e.toLowerCase();var a=[];return w8(this.childNodes,function(i){if(i.nodeType===1&&(e==="*"||i.tagName.toLowerCase()===e))a.push(i)}),a};Ca.prototype.contains=function(e){return w8(this,function(a){return e===a})||!1}});var bq=Me((Iet,gq)=>{var d8=j8();gq.exports=c0;function c0(t){if(!(this instanceof c0))return new c0;this.childNodes=[],this.parentNode=null,this.ownerDocument=t||null}c0.prototype.type="DocumentFragment";c0.prototype.nodeType=11;c0.prototype.nodeName="#document-fragment";c0.prototype.appendChild=d8.prototype.appendChild;c0.prototype.replaceChild=d8.prototype.replaceChild;c0.prototype.removeChild=d8.prototype.removeChild;c0.prototype.toString=function(){return this.childNodes.map(function(e){return String(e)}).join("")}});var wq=Me((Get,pq)=>{pq.exports=q8;function q8(t){}q8.prototype.initEvent=function(e,a,i){this.type=e,this.bubbles=a,this.cancelable=i};q8.prototype.preventDefault=function(){}});var dq=Me((Xet,jq)=>{var NR=u8(),zR=aq(),ER=sq(),Wc=j8(),xR=bq(),UR=wq(),IR=m8(),GR=g8(),XR=b8();jq.exports=H5;function H5(){if(!(this instanceof H5))return new H5;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 Ws=H5.prototype;Ws.createTextNode=function(e){return new ER(e,this)};Ws.createElementNS=function(e,a){var i=e===null?null:String(e);return new Wc(a,this,i)};Ws.createElement=function(e){return new Wc(e,this)};Ws.createDocumentFragment=function(){return new xR(this)};Ws.createEvent=function(e){return new UR(e)};Ws.createComment=function(e){return new zR(e,this)};Ws.getElementById=function(e){e=String(e);var a=NR(this.childNodes,function(i){if(String(i.id)===e)return i});return a||null};Ws.getElementsByClassName=Wc.prototype.getElementsByClassName;Ws.getElementsByTagName=Wc.prototype.getElementsByTagName;Ws.contains=Wc.prototype.contains;Ws.removeEventListener=XR;Ws.addEventListener=GR;Ws.dispatchEvent=IR});var Aq=Me((Ket,qq)=>{var KR=dq();qq.exports=new KR});var A8=Me((Let,Sq)=>{var vq=typeof global<"u"?global:typeof window<"u"?window:{},LR=Aq(),Pc;if(typeof document<"u")Pc=document;else if(Pc=vq["__GLOBAL_DOCUMENT_CACHE@4"],!Pc)Pc=vq["__GLOBAL_DOCUMENT_CACHE@4"]=LR;Sq.exports=Pc});var yq=Me((Vet,f1)=>{function v8(){return f1.exports=v8=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var i in a)({}).hasOwnProperty.call(a,i)&&(t[i]=a[i])}return t},f1.exports.__esModule=!0,f1.exports.default=f1.exports,v8.apply(null,arguments)}f1.exports=v8,f1.exports.__esModule=!0,f1.exports.default=f1.exports});var Cq=Me((Yet,kq)=>{kq.exports=YR;var VR=Object.prototype.toString;function YR(t){if(!t)return!1;var e=VR.call(t);return e==="[object Function]"||typeof t==="function"&&e!=="[object RegExp]"||typeof window<"u"&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}});var Bq=Me((Jet,Fq)=>{function JR(t,e){var a=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(a)return(a=a.call(t)).next.bind(a);if(Array.isArray(t)||(a=QR(t))||e&&t&&typeof t.length==="number"){if(a)t=a;var i=0;return function(){if(i>=t.length)return{done:!0};return{done:!1,value:t[i++]}}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function QR(t,e){if(!t)return;if(typeof t==="string")return _q(t,e);var a=Object.prototype.toString.call(t).slice(8,-1);if(a==="Object"&&t.constructor)a=t.constructor.name;if(a==="Map"||a==="Set")return Array.from(t);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _q(t,e)}function _q(t,e){if(e==null||e>t.length)e=t.length;for(var a=0,i=Array(e);a<e;a++)i[a]=t[a];return i}var ZR=function(){function t(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var e=t.prototype;return e.getIsEnabled=function(){return this.enabled_},e.enable=function(){this.enabled_=!0},e.disable=function(){this.enabled_=!1},e.reset=function(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1},e.addInterceptor=function(i,s){if(!this.typeToInterceptorsMap_.has(i))this.typeToInterceptorsMap_.set(i,new Set);var n=this.typeToInterceptorsMap_.get(i);if(n.has(s))return!1;return n.add(s),!0},e.removeInterceptor=function(i,s){var n=this.typeToInterceptorsMap_.get(i);if(n&&n.has(s))return n.delete(s),!0;return!1},e.clearInterceptorsByType=function(i){var s=this.typeToInterceptorsMap_.get(i);if(!s)return!1;return this.typeToInterceptorsMap_.delete(i),this.typeToInterceptorsMap_.set(i,new Set),!0},e.clear=function(){if(!this.typeToInterceptorsMap_.size)return!1;return this.typeToInterceptorsMap_=new Map,!0},e.getForType=function(i){return this.typeToInterceptorsMap_.get(i)||new Set},e.execute=function(i,s){var n=this.getForType(i);for(var l=JR(n),f;!(f=l()).done;){var o=f.value;try{s=o(s)}catch(c){}}return s},t}();Fq.exports=ZR});var Hq=Me((Qet,Oq)=>{var $R=function(){function t(){this.maxAttempts_=1,this.delayFactor_=0.1,this.fuzzFactor_=0.1,this.initialDelay_=1000,this.enabled_=!1}var e=t.prototype;return e.getIsEnabled=function(){return this.enabled_},e.enable=function(){this.enabled_=!0},e.disable=function(){this.enabled_=!1},e.reset=function(){this.maxAttempts_=1,this.delayFactor_=0.1,this.fuzzFactor_=0.1,this.initialDelay_=1000,this.enabled_=!1},e.getMaxAttempts=function(){return this.maxAttempts_},e.setMaxAttempts=function(i){this.maxAttempts_=i},e.getDelayFactor=function(){return this.delayFactor_},e.setDelayFactor=function(i){this.delayFactor_=i},e.getFuzzFactor=function(){return this.fuzzFactor_},e.setFuzzFactor=function(i){this.fuzzFactor_=i},e.getInitialDelay=function(){return this.initialDelay_},e.setInitialDelay=function(i){this.initialDelay_=i},e.createRetry=function(i){var s=i===void 0?{}:i,n=s.maxAttempts,l=s.delayFactor,f=s.fuzzFactor,o=s.initialDelay;return new WR({maxAttempts:n||this.maxAttempts_,delayFactor:l||this.delayFactor_,fuzzFactor:f||this.fuzzFactor_,initialDelay:o||this.initialDelay_})},t}(),WR=function(){function t(a){this.maxAttempts_=a.maxAttempts,this.delayFactor_=a.delayFactor,this.fuzzFactor_=a.fuzzFactor,this.currentDelay_=a.initialDelay,this.currentAttempt_=1}var e=t.prototype;return e.moveToNextAttempt=function(){this.currentAttempt_++;var i=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+i},e.shouldRetry=function(){return this.currentAttempt_<this.maxAttempts_},e.getCurrentDelay=function(){return this.currentDelay_},e.getCurrentMinPossibleDelay=function(){return(1-this.fuzzFactor_)*this.currentDelay_},e.getCurrentMaxPossibleDelay=function(){return(1+this.fuzzFactor_)*this.currentDelay_},e.getCurrentFuzzedDelay=function(){var i=this.getCurrentMinPossibleDelay(),s=this.getCurrentMaxPossibleDelay();return i+Math.random()*(s-i)},t}();Oq.exports=$R});var Dq=Me((Zet,Mq)=>{var PR=h0(),tN=function(e,a){if(a===void 0)a=!1;return function(i,s,n){if(i){e(i);return}if(s.statusCode>=400&&s.statusCode<=599){var l=n;if(a)if(PR.TextDecoder){var f=eN(s.headers&&s.headers["content-type"]);try{l=new TextDecoder(f).decode(n)}catch(o){}}else l=String.fromCharCode.apply(null,new Uint8Array(n));e({cause:l});return}e(null,n)}};function eN(t){if(t===void 0)t="";return t.toLowerCase().split(";").reduce(function(e,a){var i=a.split("="),s=i[0],n=i[1];if(s.trim()==="charset")return n.trim();return e},"utf-8")}Mq.exports=tN});var zq=Me(($et,y8)=>{var Tq=h0(),aN=yq(),iN=Cq(),Rq=Bq(),sN=Hq();ti.httpHandler=Dq();ti.requestInterceptorsStorage=new Rq;ti.responseInterceptorsStorage=new Rq;ti.retryManager=new sN;var nN=function(e){var a={};if(!e)return a;return e.trim().split(`
4
- `).forEach(function(i){var s=i.indexOf(":"),n=i.slice(0,s).trim().toLowerCase(),l=i.slice(s+1).trim();if(typeof a[n]>"u")a[n]=l;else if(Array.isArray(a[n]))a[n].push(l);else a[n]=[a[n],l]}),a};y8.exports=ti;y8.exports.default=ti;ti.XMLHttpRequest=Tq.XMLHttpRequest||oN;ti.XDomainRequest="withCredentials"in new ti.XMLHttpRequest?ti.XMLHttpRequest:Tq.XDomainRequest;lN(["get","put","post","patch","head","delete"],function(t){ti[t==="delete"?"del":t]=function(e,a,i){return a=Nq(e,a,i),a.method=t.toUpperCase(),S8(a)}});function lN(t,e){for(var a=0;a<t.length;a++)e(t[a])}function fN(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}function Nq(t,e,a){var i=t;if(iN(e)){if(a=e,typeof t==="string")i={uri:t}}else i=aN({},e,{uri:t});return i.callback=a,i}function ti(t,e,a){return e=Nq(t,e,a),S8(e)}function S8(t){if(typeof t.callback>"u")throw Error("callback argument missing");if(t.requestType&&ti.requestInterceptorsStorage.getIsEnabled()){var e={uri:t.uri||t.url,headers:t.headers||{},body:t.body,metadata:t.metadata||{},retry:t.retry,timeout:t.timeout},a=ti.requestInterceptorsStorage.execute(t.requestType,e);t.uri=a.uri,t.headers=a.headers,t.body=a.body,t.metadata=a.metadata,t.retry=a.retry,t.timeout=a.timeout}var i=!1,s=function(D,T,z){if(!i)i=!0,t.callback(D,T,z)};function n(){if(c.readyState===4&&!ti.responseInterceptorsStorage.getIsEnabled())setTimeout(o,0)}function l(){var M=void 0;if(c.response)M=c.response;else M=c.responseText||rN(c);if(y)try{M=JSON.parse(M)}catch(D){}return M}function f(M){if(clearTimeout(B),clearTimeout(t.retryTimeout),!(M instanceof Error))M=Error(""+(M||"Unknown XMLHttpRequest Error"));if(M.statusCode=0,!m&&ti.retryManager.getIsEnabled()&&t.retry&&t.retry.shouldRetry()){t.retryTimeout=setTimeout(function(){t.retry.moveToNextAttempt(),t.xhr=c,S8(t)},t.retry.getCurrentFuzzedDelay());return}if(t.requestType&&ti.responseInterceptorsStorage.getIsEnabled()){var D={headers:H.headers||{},body:H.body,responseUrl:c.responseURL,responseType:c.responseType},T=ti.responseInterceptorsStorage.execute(t.requestType,D);H.body=T.body,H.headers=T.headers}return s(M,H)}function o(){if(m)return;var M;if(clearTimeout(B),clearTimeout(t.retryTimeout),t.useXDR&&c.status===void 0)M=200;else M=c.status===1223?204:c.status;var D=H,T=null;if(M!==0){if(D={body:l(),statusCode:M,method:w,headers:{},url:p,rawRequest:c},c.getAllResponseHeaders)D.headers=nN(c.getAllResponseHeaders())}else T=Error("Internal XMLHttpRequest Error");if(t.requestType&&ti.responseInterceptorsStorage.getIsEnabled()){var z={headers:D.headers||{},body:D.body,responseUrl:c.responseURL,responseType:c.responseType},E=ti.responseInterceptorsStorage.execute(t.requestType,z);D.body=E.body,D.headers=E.headers}return s(T,D,D.body)}var c=t.xhr||null;if(!c)if(t.cors||t.useXDR)c=new ti.XDomainRequest;else c=new ti.XMLHttpRequest;var u,m,p=c.url=t.uri||t.url,w=c.method=t.method||"GET",d=t.body||t.data,v=c.headers=t.headers||{},k=!!t.sync,y=!1,B,H={body:void 0,headers:{},statusCode:0,method:w,url:p,rawRequest:c};if("json"in t&&t.json!==!1){if(y=!0,v.accept||v.Accept||(v.Accept="application/json"),w!=="GET"&&w!=="HEAD")v["content-type"]||v["Content-Type"]||(v["Content-Type"]="application/json"),d=JSON.stringify(t.json===!0?d:t.json)}if(c.onreadystatechange=n,c.onload=o,c.onerror=f,c.onprogress=function(){},c.onabort=function(){m=!0,clearTimeout(t.retryTimeout)},c.ontimeout=f,c.open(w,p,!k,t.username,t.password),!k)c.withCredentials=!!t.withCredentials;if(!k&&t.timeout>0)B=setTimeout(function(){if(m)return;m=!0,c.abort("timeout");var M=Error("XMLHttpRequest timeout");M.code="ETIMEDOUT",f(M)},t.timeout);if(c.setRequestHeader){for(u in v)if(v.hasOwnProperty(u))c.setRequestHeader(u,v[u])}else if(t.headers&&!fN(t.headers))throw Error("Headers cannot be set on an XDomainRequest object");if("responseType"in t)c.responseType=t.responseType;if("beforeSend"in t&&typeof t.beforeSend==="function")t.beforeSend(c);return c.send(d||null),c}function rN(t){try{if(t.responseType==="document")return t.responseXML;var e=t.responseXML&&t.responseXML.documentElement.nodeName==="parsererror";if(t.responseType===""&&!e)return t.responseXML}catch(a){}return null}function oN(){}});var Kq=Me((Wet,Xq)=>{var Eq=A8(),C8=Object.create||function(){function t(){}return function(e){if(arguments.length!==1)throw Error("Object.create shim only accepts one parameter.");return t.prototype=e,new t}}();function Ps(t,e){this.name="ParsingError",this.code=t.code,this.message=e||t.message}Ps.prototype=C8(Error.prototype);Ps.prototype.constructor=Ps;Ps.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function _8(t){function e(i,s,n,l){return(i|0)*3600+(s|0)*60+(n|0)+(l|0)/1000}var a=t.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);if(!a)return null;if(a[3])return e(a[1],a[2],a[3].replace(":",""),a[4]);else if(a[1]>59)return e(a[1],a[2],0,a[4]);else return e(0,a[1],a[2],a[4])}function e2(){this.values=C8(null)}e2.prototype={set:function(t,e){if(!this.get(t)&&e!=="")this.values[t]=e},get:function(t,e,a){if(a)return this.has(t)?this.values[t]:e[a];return this.has(t)?this.values[t]:e},has:function(t){return t in this.values},alt:function(t,e,a){for(var i=0;i<a.length;++i)if(e===a[i]){this.set(t,e);break}},integer:function(t,e){if(/^-?\d+$/.test(e))this.set(t,parseInt(e,10))},percent:function(t,e){var a;if(a=e.match(/^([\d]{1,3})(\.[\d]*)?%$/)){if(e=parseFloat(e),e>=0&&e<=100)return this.set(t,e),!0}return!1}};function t2(t,e,a,i){var s=i?t.split(i):[t];for(var n in s){if(typeof s[n]!=="string")continue;var l=s[n].split(a);if(l.length!==2)continue;var f=l[0].trim(),o=l[1].trim();e(f,o)}}function hN(t,e,a){var i=t;function s(){var f=_8(t);if(f===null)throw new Ps(Ps.Errors.BadTimeStamp,"Malformed timestamp: "+i);return t=t.replace(/^[^\sa-zA-Z-]+/,""),f}function n(f,o){var c=new e2;t2(f,function(u,m){switch(u){case"region":for(var p=a.length-1;p>=0;p--)if(a[p].id===m){c.set(u,a[p].region);break}break;case"vertical":c.alt(u,m,["rl","lr"]);break;case"line":var w=m.split(","),d=w[0];if(c.integer(u,d),c.percent(u,d)&&c.set("snapToLines",!1),c.alt(u,d,["auto"]),w.length===2)c.alt("lineAlign",w[1],["start","center","end"]);break;case"position":if(w=m.split(","),c.percent(u,w[0]),w.length===2)c.alt("positionAlign",w[1],["start","center","end"]);break;case"size":c.percent(u,m);break;case"align":c.alt(u,m,["start","center","end","left","right"]);break}},/:/,/\s/),o.region=c.get("region",null),o.vertical=c.get("vertical","");try{o.line=c.get("line","auto")}catch(u){}o.lineAlign=c.get("lineAlign","start"),o.snapToLines=c.get("snapToLines",!0),o.size=c.get("size",100);try{o.align=c.get("align","center")}catch(u){o.align=c.get("align","middle")}try{o.position=c.get("position","auto")}catch(u){o.position=c.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},o.align)}o.positionAlign=c.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},o.align)}function l(){t=t.replace(/^\s+/,"")}if(l(),e.startTime=s(),l(),t.substr(0,3)!=="-->")throw new Ps(Ps.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+i);t=t.substr(3),l(),e.endTime=s(),l(),n(t,e)}var k8=Eq.createElement&&Eq.createElement("textarea"),cN={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},xq={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)"},uN={v:"title",lang:"lang"},Uq={rt:"ruby"};function Gq(t,e){function a(){if(!e)return null;function d(k){return e=e.substr(k.length),k}var v=e.match(/^([^<]*)(<[^>]*>?)?/);return d(v[1]?v[1]:v[2])}function i(d){return k8.innerHTML=d,d=k8.textContent,k8.textContent="",d}function s(d,v){return!Uq[v.localName]||Uq[v.localName]===d.localName}function n(d,v){var k=cN[d];if(!k)return null;var y=t.document.createElement(k),B=uN[d];if(B&&v)y[B]=v.trim();return y}var l=t.document.createElement("div"),f=l,o,c=[];while((o=a())!==null){if(o[0]==="<"){if(o[1]==="/"){if(c.length&&c[c.length-1]===o.substr(2).replace(">",""))c.pop(),f=f.parentNode;continue}var u=_8(o.substr(1,o.length-2)),m;if(u){m=t.document.createProcessingInstruction("timestamp",u),f.appendChild(m);continue}var p=o.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!p)continue;if(m=n(p[1],p[3]),!m)continue;if(!s(f,m))continue;if(p[2]){var w=p[2].split(".");w.forEach(function(d){var v=/^bg_/.test(d),k=v?d.slice(3):d;if(xq.hasOwnProperty(k)){var y=v?"background-color":"color",B=xq[k];m.style[y]=B}}),m.className=w.join(" ")}c.push(p[1]),f.appendChild(m),f=m;continue}f.appendChild(t.document.createTextNode(i(o)))}return l}var Iq=[[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 mN(t){for(var e=0;e<Iq.length;e++){var a=Iq[e];if(t>=a[0]&&t<=a[1])return!0}return!1}function gN(t){var e=[],a="",i;if(!t||!t.childNodes)return"ltr";function s(f,o){for(var c=o.childNodes.length-1;c>=0;c--)f.push(o.childNodes[c])}function n(f){if(!f||!f.length)return null;var o=f.pop(),c=o.textContent||o.innerText;if(c){var u=c.match(/^.*(\n|\r)/);if(u)return f.length=0,u[0];return c}if(o.tagName==="ruby")return n(f);if(o.childNodes)return s(f,o),n(f)}s(e,t);while(a=n(e))for(var l=0;l<a.length;l++)if(i=a.charCodeAt(l),mN(i))return"rtl";return"ltr"}function bN(t){if(typeof t.line==="number"&&(t.snapToLines||t.line>=0&&t.line<=100))return t.line;if(!t.track||!t.track.textTrackList||!t.track.textTrackList.mediaElement)return-1;var e=t.track,a=e.textTrackList,i=0;for(var s=0;s<a.length&&a[s]!==e;s++)if(a[s].mode==="showing")i++;return++i*-1}function D5(){}D5.prototype.applyStyles=function(t,e){e=e||this.div;for(var a in t)if(t.hasOwnProperty(a))e.style[a]=t[a]};D5.prototype.formatStyle=function(t,e){return t===0?0:t+e};function M5(t,e,a){D5.call(this),this.cue=e,this.cueDiv=Gq(t,e.text);var i={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:e.vertical===""?"horizontal-tb":e.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(i,this.cueDiv),this.div=t.document.createElement("div"),i={direction:gN(this.cueDiv),writingMode:e.vertical===""?"horizontal-tb":e.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:e.align==="middle"?"center":e.align,font:a.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(i),this.div.appendChild(this.cueDiv);var s=0;switch(e.positionAlign){case"start":case"line-left":s=e.position;break;case"center":s=e.position-e.size/2;break;case"end":case"line-right":s=e.position-e.size;break}if(e.vertical==="")this.applyStyles({left:this.formatStyle(s,"%"),width:this.formatStyle(e.size,"%")});else this.applyStyles({top:this.formatStyle(s,"%"),height:this.formatStyle(e.size,"%")});this.move=function(n){this.applyStyles({top:this.formatStyle(n.top,"px"),bottom:this.formatStyle(n.bottom,"px"),left:this.formatStyle(n.left,"px"),right:this.formatStyle(n.right,"px"),height:this.formatStyle(n.height,"px"),width:this.formatStyle(n.width,"px")})}}M5.prototype=C8(D5.prototype);M5.prototype.constructor=M5;function hs(t){var e,a,i,s;if(t.div){a=t.div.offsetHeight,i=t.div.offsetWidth,s=t.div.offsetTop;var n=(n=t.div.childNodes)&&(n=n[0])&&n.getClientRects&&n.getClientRects();t=t.div.getBoundingClientRect(),e=n?Math.max(n[0]&&n[0].height||0,t.height/n.length):0}this.left=t.left,this.right=t.right,this.top=t.top||s,this.height=t.height||a,this.bottom=t.bottom||s+(t.height||a),this.width=t.width||i,this.lineHeight=e!==void 0?e:t.lineHeight}hs.prototype.move=function(t,e){switch(e=e!==void 0?e:this.lineHeight,t){case"+x":this.left+=e,this.right+=e;break;case"-x":this.left-=e,this.right-=e;break;case"+y":this.top+=e,this.bottom+=e;break;case"-y":this.top-=e,this.bottom-=e;break}};hs.prototype.overlaps=function(t){return this.left<t.right&&this.right>t.left&&this.top<t.bottom&&this.bottom>t.top};hs.prototype.overlapsAny=function(t){for(var e=0;e<t.length;e++)if(this.overlaps(t[e]))return!0;return!1};hs.prototype.within=function(t){return this.top>=t.top&&this.bottom<=t.bottom&&this.left>=t.left&&this.right<=t.right};hs.prototype.overlapsOppositeAxis=function(t,e){switch(e){case"+x":return this.left<t.left;case"-x":return this.right>t.right;case"+y":return this.top<t.top;case"-y":return this.bottom>t.bottom}};hs.prototype.intersectPercentage=function(t){var e=Math.max(0,Math.min(this.right,t.right)-Math.max(this.left,t.left)),a=Math.max(0,Math.min(this.bottom,t.bottom)-Math.max(this.top,t.top)),i=e*a;return i/(this.height*this.width)};hs.prototype.toCSSCompatValues=function(t){return{top:this.top-t.top,bottom:t.bottom-this.bottom,left:this.left-t.left,right:t.right-this.right,height:this.height,width:this.width}};hs.getSimpleBoxPosition=function(t){var e=t.div?t.div.offsetHeight:t.tagName?t.offsetHeight:0,a=t.div?t.div.offsetWidth:t.tagName?t.offsetWidth:0,i=t.div?t.div.offsetTop:t.tagName?t.offsetTop:0;t=t.div?t.div.getBoundingClientRect():t.tagName?t.getBoundingClientRect():t;var s={left:t.left,right:t.right,top:t.top||i,height:t.height||e,bottom:t.bottom||i+(t.height||e),width:t.width||a};return s};function pN(t,e,a,i){function s(k,y){var B,H=new hs(k),M=1;for(var D=0;D<y.length;D++){while(k.overlapsOppositeAxis(a,y[D])||k.within(a)&&k.overlapsAny(i))k.move(y[D]);if(k.within(a))return k;var T=k.intersectPercentage(a);if(M>T)B=new hs(k),M=T;k=new hs(H)}return B||H}var n=new hs(e),l=e.cue,f=bN(l),o=[];if(l.snapToLines){var c;switch(l.vertical){case"":o=["+y","-y"],c="height";break;case"rl":o=["+x","-x"],c="width";break;case"lr":o=["-x","+x"],c="width";break}var u=n.lineHeight,m=u*Math.round(f),p=a[c]+u,w=o[0];if(Math.abs(m)>p)m=m<0?-1:1,m*=Math.ceil(p/u)*u;if(f<0)m+=l.vertical===""?a.height:a.width,o=o.reverse();n.move(w,m)}else{var d=n.lineHeight/a.height*100;switch(l.lineAlign){case"center":f-=d/2;break;case"end":f-=d;break}switch(l.vertical){case"":e.applyStyles({top:e.formatStyle(f,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(f,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(f,"%")});break}o=["+y","-x","+x","-y"],n=new hs(e)}var v=s(n,o);e.move(v.toCSSCompatValues(a))}function vo(){}vo.StringDecoder=function(){return{decode:function(t){if(!t)return"";if(typeof t!=="string")throw Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}};vo.convertCueToDOMTree=function(t,e){if(!t||!e)return null;return Gq(t,e)};var wN=0.05,jN="sans-serif",dN="1.5%";vo.processCues=function(t,e,a){if(!t||!e||!a)return null;while(a.firstChild)a.removeChild(a.firstChild);var i=t.document.createElement("div");i.style.position="absolute",i.style.left="0",i.style.right="0",i.style.top="0",i.style.bottom="0",i.style.margin=dN,a.appendChild(i);function s(u){for(var m=0;m<u.length;m++)if(u[m].hasBeenReset||!u[m].displayState)return!0;return!1}if(!s(e)){for(var n=0;n<e.length;n++)i.appendChild(e[n].displayState);return}var l=[],f=hs.getSimpleBoxPosition(i),o=Math.round(f.height*wN*100)/100,c={font:o+"px "+jN};(function(){var u,m;for(var p=0;p<e.length;p++)m=e[p],u=new M5(t,m,c),i.appendChild(u.div),pN(t,u,f,l),m.displayState=u.div,l.push(hs.getSimpleBoxPosition(u))})()};vo.Parser=function(t,e,a){if(!a)a=e,e={};if(!e)e={};this.window=t,this.vttjs=e,this.state="INITIAL",this.buffer="",this.decoder=a||new TextDecoder("utf8"),this.regionList=[]};vo.Parser.prototype={reportOrThrowError:function(t){if(t instanceof Ps)this.onparsingerror&&this.onparsingerror(t);else throw t},parse:function(t){var e=this;if(t)e.buffer+=e.decoder.decode(t,{stream:!0});function a(){var u=e.buffer,m=0;while(m<u.length&&u[m]!=="\r"&&u[m]!==`
5
- `)++m;var p=u.substr(0,m);if(u[m]==="\r")++m;if(u[m]===`
6
- `)++m;return e.buffer=u.substr(m),p}function i(u){var m=new e2;if(t2(u,function(w,d){switch(w){case"id":m.set(w,d);break;case"width":m.percent(w,d);break;case"lines":m.integer(w,d);break;case"regionanchor":case"viewportanchor":var v=d.split(",");if(v.length!==2)break;var k=new e2;if(k.percent("x",v[0]),k.percent("y",v[1]),!k.has("x")||!k.has("y"))break;m.set(w+"X",k.get("x")),m.set(w+"Y",k.get("y"));break;case"scroll":m.alt(w,d,["up"]);break}},/=/,/\s/),m.has("id")){var p=new(e.vttjs.VTTRegion||e.window.VTTRegion);p.width=m.get("width",100),p.lines=m.get("lines",3),p.regionAnchorX=m.get("regionanchorX",0),p.regionAnchorY=m.get("regionanchorY",100),p.viewportAnchorX=m.get("viewportanchorX",0),p.viewportAnchorY=m.get("viewportanchorY",100),p.scroll=m.get("scroll",""),e.onregion&&e.onregion(p),e.regionList.push({id:m.get("id"),region:p})}}function s(u){var m=new e2;t2(u,function(p,w){switch(p){case"MPEGT":m.integer(p+"S",w);break;case"LOCA":m.set(p+"L",_8(w));break}},/[^\d]:/,/,/),e.ontimestampmap&&e.ontimestampmap({MPEGTS:m.get("MPEGTS"),LOCAL:m.get("LOCAL")})}function n(u){if(u.match(/X-TIMESTAMP-MAP/))t2(u,function(m,p){switch(m){case"X-TIMESTAMP-MAP":s(p);break}},/=/);else t2(u,function(m,p){switch(m){case"Region":i(p);break}},/:/)}try{var l;if(e.state==="INITIAL"){if(!/\r\n|\n/.test(e.buffer))return this;l=a();var f=l.match(/^WEBVTT([ \t].*)?$/);if(!f||!f[0])throw new Ps(Ps.Errors.BadSignature);e.state="HEADER"}var o=!1;while(e.buffer){if(!/\r\n|\n/.test(e.buffer))return this;if(!o)l=a();else o=!1;switch(e.state){case"HEADER":if(/:/.test(l))n(l);else if(!l)e.state="ID";continue;case"NOTE":if(!l)e.state="ID";continue;case"ID":if(/^NOTE($|[ \t])/.test(l)){e.state="NOTE";break}if(!l)continue;e.cue=new(e.vttjs.VTTCue||e.window.VTTCue)(0,0,"");try{e.cue.align="center"}catch(u){e.cue.align="middle"}if(e.state="CUE",l.indexOf("-->")===-1){e.cue.id=l;continue}case"CUE":try{hN(l,e.cue,e.regionList)}catch(u){e.reportOrThrowError(u),e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":var c=l.indexOf("-->")!==-1;if(!l||c&&(o=!0)){e.oncue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}if(e.cue.text)e.cue.text+=`
7
- `;e.cue.text+=l.replace(/\u2028/g,`
8
- `).replace(/u2029/g,`
9
- `);continue;case"BADCUE":if(!l)e.state="ID";continue}}}catch(u){if(e.reportOrThrowError(u),e.state==="CUETEXT"&&e.cue&&e.oncue)e.oncue(e.cue);e.cue=null,e.state=e.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var t=this;try{if(t.buffer+=t.decoder.decode(),t.cue||t.state==="HEADER")t.buffer+=`
10
-
11
- `,t.parse();if(t.state==="INITIAL")throw new Ps(Ps.Errors.BadSignature)}catch(e){t.reportOrThrowError(e)}return t.onflush&&t.onflush(),this}};Xq.exports=vo});var Yq=Me((Pet,Vq)=>{var qN="auto",AN={"":1,lr:1,rl:1},vN={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function SN(t){if(typeof t!=="string")return!1;var e=AN[t.toLowerCase()];return e?t.toLowerCase():!1}function F8(t){if(typeof t!=="string")return!1;var e=vN[t.toLowerCase()];return e?t.toLowerCase():!1}function Lq(t,e,a){this.hasBeenReset=!1;var i="",s=!1,n=t,l=e,f=a,o=null,c="",u=!0,m="auto",p="start",w="auto",d="auto",v=100,k="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return i},set:function(y){i=""+y}},pauseOnExit:{enumerable:!0,get:function(){return s},set:function(y){s=!!y}},startTime:{enumerable:!0,get:function(){return n},set:function(y){if(typeof y!=="number")throw TypeError("Start time must be set to a number.");n=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 f},set:function(y){f=""+y,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return o},set:function(y){o=y,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return c},set:function(y){var B=SN(y);if(B===!1)throw SyntaxError("Vertical: an invalid or illegal direction string was specified.");c=B,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return u},set:function(y){u=!!y,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return m},set:function(y){if(typeof y!=="number"&&y!==qN)throw SyntaxError("Line: an invalid number or illegal string was specified.");m=y,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return p},set:function(y){var B=F8(y);if(!B)console.warn("lineAlign: an invalid or illegal string was specified.");else p=B,this.hasBeenReset=!0}},position:{enumerable:!0,get:function(){return w},set:function(y){if(y<0||y>100)throw Error("Position must be between 0 and 100.");w=y,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return d},set:function(y){var B=F8(y);if(!B)console.warn("positionAlign: an invalid or illegal string was specified.");else d=B,this.hasBeenReset=!0}},size:{enumerable:!0,get:function(){return v},set:function(y){if(y<0||y>100)throw Error("Size must be between 0 and 100.");v=y,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return k},set:function(y){var B=F8(y);if(!B)throw SyntaxError("align: an invalid or illegal alignment string was specified.");k=B,this.hasBeenReset=!0}}}),this.displayState=void 0}Lq.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};Vq.exports=Lq});var Qq=Me((tat,Jq)=>{var yN={"":!0,up:!0};function kN(t){if(typeof t!=="string")return!1;var e=yN[t.toLowerCase()];return e?t.toLowerCase():!1}function a2(t){return typeof t==="number"&&(t>=0&&t<=100)}function CN(){var t=100,e=3,a=0,i=100,s=0,n=100,l="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return t},set:function(f){if(!a2(f))throw Error("Width must be between 0 and 100.");t=f}},lines:{enumerable:!0,get:function(){return e},set:function(f){if(typeof f!=="number")throw TypeError("Lines must be set to a number.");e=f}},regionAnchorY:{enumerable:!0,get:function(){return i},set:function(f){if(!a2(f))throw Error("RegionAnchorX must be between 0 and 100.");i=f}},regionAnchorX:{enumerable:!0,get:function(){return a},set:function(f){if(!a2(f))throw Error("RegionAnchorY must be between 0 and 100.");a=f}},viewportAnchorY:{enumerable:!0,get:function(){return n},set:function(f){if(!a2(f))throw Error("ViewportAnchorY must be between 0 and 100.");n=f}},viewportAnchorX:{enumerable:!0,get:function(){return s},set:function(f){if(!a2(f))throw Error("ViewportAnchorX must be between 0 and 100.");s=f}},scroll:{enumerable:!0,get:function(){return l},set:function(f){var o=kN(f);if(o===!1)console.warn("Scroll: an invalid or illegal string was specified.");else l=o}}})}Jq.exports=CN});var $q=Me((eat,Zq)=>{var r1=h0(),Rf=Zq.exports={WebVTT:Kq(),VTTCue:Yq(),VTTRegion:Qq()};r1.vttjs=Rf;r1.WebVTT=Rf.WebVTT;var{VTTCue:_N,VTTRegion:FN}=Rf,BN=r1.VTTCue,ON=r1.VTTRegion;Rf.shim=function(){r1.VTTCue=_N,r1.VTTRegion=FN};Rf.restore=function(){r1.VTTCue=BN,r1.VTTRegion=ON};if(!r1.VTTCue)Rf.shim()});var s2=Me((LN)=>{function XN(t,e,a){if(a===void 0)a=Array.prototype;if(t&&typeof a.find==="function")return a.find.call(t,e);for(var i=0;i<t.length;i++)if(Object.prototype.hasOwnProperty.call(t,i)){var s=t[i];if(e.call(void 0,s,i,t))return s}}function I8(t,e){if(e===void 0)e=Object;return e&&typeof e.freeze==="function"?e.freeze(t):t}function KN(t,e){if(t===null||typeof t!=="object")throw TypeError("target is not an object");for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a))t[a]=e[a];return t}var oA=I8({HTML:"text/html",isHTML:function(t){return t===oA.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),hA=I8({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(t){return t===hA.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});LN.assign=KN;LN.find=XN;LN.freeze=I8;LN.MIME_TYPE=oA;LN.NAMESPACE=hA});var P8=Me((cz)=>{var jA=s2(),u0=jA.find,n2=jA.NAMESPACE;function $N(t){return t!==""}function WN(t){return t?t.split(/[\t\n\f\r ]+/).filter($N):[]}function PN(t,e){if(!t.hasOwnProperty(e))t[e]=!0;return t}function cA(t){if(!t)return[];var e=WN(t);return Object.keys(e.reduce(PN,{}))}function tz(t){return function(e){return t&&t.indexOf(e)!==-1}}function f2(t,e){for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a))e[a]=t[a]}function Bs(t,e){var a=t.prototype;if(!(a instanceof e)){let s=function(){};var i=s;s.prototype=e.prototype,s=new s,f2(a,s),t.prototype=a=s}if(a.constructor!=t){if(typeof t!="function")console.error("unknown Class:"+t);a.constructor=t}}var Os={},vn=Os.ELEMENT_NODE=1,_o=Os.ATTRIBUTE_NODE=2,E5=Os.TEXT_NODE=3,dA=Os.CDATA_SECTION_NODE=4,qA=Os.ENTITY_REFERENCE_NODE=5,ez=Os.ENTITY_NODE=6,G8=Os.PROCESSING_INSTRUCTION_NODE=7,X8=Os.COMMENT_NODE=8,AA=Os.DOCUMENT_NODE=9,vA=Os.DOCUMENT_TYPE_NODE=10,o1=Os.DOCUMENT_FRAGMENT_NODE=11,az=Os.NOTATION_NODE=12,es={},Fi={},pat=es.INDEX_SIZE_ERR=(Fi[1]="Index size error",1),wat=es.DOMSTRING_SIZE_ERR=(Fi[2]="DOMString size error",2),Fs=es.HIERARCHY_REQUEST_ERR=(Fi[3]="Hierarchy request error",3),jat=es.WRONG_DOCUMENT_ERR=(Fi[4]="Wrong document",4),iz=es.INVALID_CHARACTER_ERR=(Fi[5]="Invalid character",5),dat=es.NO_DATA_ALLOWED_ERR=(Fi[6]="No data allowed",6),qat=es.NO_MODIFICATION_ALLOWED_ERR=(Fi[7]="No modification allowed",7),SA=es.NOT_FOUND_ERR=(Fi[8]="Not found",8),Aat=es.NOT_SUPPORTED_ERR=(Fi[9]="Not supported",9),uA=es.INUSE_ATTRIBUTE_ERR=(Fi[10]="Attribute in use",10),Co=es.INVALID_STATE_ERR=(Fi[11]="Invalid state",11),vat=es.SYNTAX_ERR=(Fi[12]="Syntax error",12),Sat=es.INVALID_MODIFICATION_ERR=(Fi[13]="Invalid modification",13),yat=es.NAMESPACE_ERR=(Fi[14]="Invalid namespace",14),kat=es.INVALID_ACCESS_ERR=(Fi[15]="Invalid access",15);function ma(t,e){if(e instanceof Error)var a=e;else if(a=this,Error.call(this,Fi[t]),this.message=Fi[t],Error.captureStackTrace)Error.captureStackTrace(this,ma);if(a.code=t,e)this.message=this.message+": "+e;return a}ma.prototype=Error.prototype;f2(es,ma);function h1(){}h1.prototype={length:0,item:function(t){return t>=0&&t<this.length?this[t]:null},toString:function(t,e,a){var i=!!a&&!!a.requireWellFormed;for(var s=[],n=0;n<this.length;n++)W8(this[n],s,t,e,null,i);return s.join("")},filter:function(t){return Array.prototype.filter.call(this,t)},indexOf:function(t){return Array.prototype.indexOf.call(this,t)}};function Fo(t,e){this._node=t,this._refresh=e,K8(this)}function K8(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!==e){var a=t._refresh(t._node);if(RA(t,"length",a.length),!t.$$length||a.length<t.$$length){for(var i=a.length;i in t;i++)if(Object.prototype.hasOwnProperty.call(t,i))delete t[i]}f2(a,t),t._inc=e}}Fo.prototype.item=function(t){return K8(this),this[t]||null};Bs(Fo,h1);function x5(){}function yA(t,e){var a=t.length;while(a--)if(t[a]===e)return a}function mA(t,e,a,i){if(i)e[yA(e,i)]=a;else e[e.length++]=a;if(t){a.ownerElement=t;var s=t.ownerDocument;if(s)i&&_A(s,t,i),sz(s,t,a)}}function gA(t,e,a){var i=yA(e,a);if(i>=0){var s=e.length-1;while(i<s)e[i]=e[++i];if(e.length=s,t){var n=t.ownerDocument;if(n)_A(n,t,a),a.ownerElement=null}}else throw new ma(SA,Error(t.tagName+"@"+a))}x5.prototype={length:0,item:h1.prototype.item,getNamedItem:function(t){var e=this.length;while(e--){var a=this[e];if(a.nodeName==t)return a}},setNamedItem:function(t){var e=t.ownerElement;if(e&&e!=this._ownerElement)throw new ma(uA);var a=this.getNamedItem(t.nodeName);return mA(this._ownerElement,this,t,a),a},setNamedItemNS:function(t){var e=t.ownerElement,a;if(e&&e!=this._ownerElement)throw new ma(uA);return a=this.getNamedItemNS(t.namespaceURI,t.localName),mA(this._ownerElement,this,t,a),a},removeNamedItem:function(t){var e=this.getNamedItem(t);return gA(this._ownerElement,this,e),e},removeNamedItemNS:function(t,e){var a=this.getNamedItemNS(t,e);return gA(this._ownerElement,this,a),a},getNamedItemNS:function(t,e){var a=this.length;while(a--){var i=this[a];if(i.localName==e&&i.namespaceURI==t)return i}return null}};function kA(){}kA.prototype={hasFeature:function(t,e){return!0},createDocument:function(t,e,a){var i=new r2;if(i.implementation=this,i.childNodes=new h1,i.doctype=a||null,a)i.appendChild(a);if(e){var s=i.createElementNS(t,e);i.appendChild(s)}return i},createDocumentType:function(t,e,a){var i=new X5;return i.name=t,i.nodeName=t,i.publicId=e||"",i.systemId=a||"",i}};function fa(){}fa.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(t,e){return I5(this,t,e)},replaceChild:function(t,e){if(I5(this,t,e,BA),e)this.removeChild(e)},removeChild:function(t){return FA(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(t){return TA(this.ownerDocument||this,this,t)},normalize:function(){_i(this,null,{enter:function(t){var e=t.firstChild;while(e){var a=e.nextSibling;if(a!==null&&a.nodeType===E5&&e.nodeType===E5)t.removeChild(a),e.appendData(a.data);else e=a}return!0}})},isSupported:function(t,e){return this.ownerDocument.implementation.hasFeature(t,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(t){var e=this;while(e){var a=e._nsMap;if(a){for(var i in a)if(Object.prototype.hasOwnProperty.call(a,i)&&a[i]===t)return i}e=e.nodeType==_o?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){var e=this;while(e){var a=e._nsMap;if(a){if(Object.prototype.hasOwnProperty.call(a,t))return a[t]}e=e.nodeType==_o?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){var e=this.lookupPrefix(t);return e==null}};function CA(t){return t=="<"&&"&lt;"||t==">"&&"&gt;"||t=="&"&&"&amp;"||t=='"'&&"&quot;"||"&#"+t.charCodeAt()+";"}f2(Os,fa);f2(Os,fa.prototype);function U5(t,e){return _i(t,null,{enter:function(a){return e(a)?_i.STOP:!0}})===_i.STOP}function _i(t,e,a){var i=[{node:t,context:e,phase:_i.ENTER}];while(i.length>0){var s=i.pop();if(s.phase===_i.ENTER){var n=a.enter(s.node,s.context);if(n===_i.STOP)return _i.STOP;if(i.push({node:s.node,context:n,phase:_i.EXIT}),n===null||n===void 0)continue;var l=s.node.lastChild;while(l)i.push({node:l,context:n,phase:_i.ENTER}),l=l.previousSibling}else if(a.exit)a.exit(s.node,s.context)}}_i.STOP=Symbol("walkDOM.STOP");_i.ENTER=0;_i.EXIT=1;function r2(){this.ownerDocument=this}function sz(t,e,a){t&&t._inc++;var i=a.namespaceURI;if(i===n2.XMLNS)e._nsMap[a.prefix?a.localName:""]=a.value}function _A(t,e,a,i){t&&t._inc++;var s=a.namespaceURI;if(s===n2.XMLNS)delete e._nsMap[a.prefix?a.localName:""]}function L8(t,e,a){if(t&&t._inc){t._inc++;var i=e.childNodes;if(a)i[i.length++]=a;else{var s=e.firstChild,n=0;while(s)i[n++]=s,s=s.nextSibling;i.length=n,delete i[i.length]}}}function FA(t,e){var{previousSibling:a,nextSibling:i}=e;if(a)a.nextSibling=i;else t.firstChild=i;if(i)i.previousSibling=a;else t.lastChild=a;return e.parentNode=null,e.previousSibling=null,e.nextSibling=null,L8(t.ownerDocument,t),e}function nz(t){return t&&(t.nodeType===fa.DOCUMENT_NODE||t.nodeType===fa.DOCUMENT_FRAGMENT_NODE||t.nodeType===fa.ELEMENT_NODE)}function lz(t){return t&&(m0(t)||V8(t)||c1(t)||t.nodeType===fa.DOCUMENT_FRAGMENT_NODE||t.nodeType===fa.COMMENT_NODE||t.nodeType===fa.PROCESSING_INSTRUCTION_NODE)}function c1(t){return t&&t.nodeType===fa.DOCUMENT_TYPE_NODE}function m0(t){return t&&t.nodeType===fa.ELEMENT_NODE}function V8(t){return t&&t.nodeType===fa.TEXT_NODE}function bA(t,e){var a=t.childNodes||[];if(u0(a,m0)||c1(e))return!1;var i=u0(a,c1);return!(e&&i&&a.indexOf(i)>a.indexOf(e))}function pA(t,e){var a=t.childNodes||[];function i(n){return m0(n)&&n!==e}if(u0(a,i))return!1;var s=u0(a,c1);return!(e&&s&&a.indexOf(s)>a.indexOf(e))}function fz(t,e,a){if(!nz(t))throw new ma(Fs,"Unexpected parent node type "+t.nodeType);if(a&&a.parentNode!==t)throw new ma(SA,"child not in parent");if(!lz(e)||c1(e)&&t.nodeType!==fa.DOCUMENT_NODE)throw new ma(Fs,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function rz(t,e,a){var i=t.childNodes||[],s=e.childNodes||[];if(e.nodeType===fa.DOCUMENT_FRAGMENT_NODE){var n=s.filter(m0);if(n.length>1||u0(s,V8))throw new ma(Fs,"More than one element or text in fragment");if(n.length===1&&!bA(t,a))throw new ma(Fs,"Element in fragment can not be inserted before doctype")}if(m0(e)){if(!bA(t,a))throw new ma(Fs,"Only one element can be added and only after doctype")}if(c1(e)){if(u0(i,c1))throw new ma(Fs,"Only one doctype is allowed");var l=u0(i,m0);if(a&&i.indexOf(l)<i.indexOf(a))throw new ma(Fs,"Doctype can only be inserted before an element");if(!a&&l)throw new ma(Fs,"Doctype can not be appended since element is present")}}function BA(t,e,a){var i=t.childNodes||[],s=e.childNodes||[];if(e.nodeType===fa.DOCUMENT_FRAGMENT_NODE){var n=s.filter(m0);if(n.length>1||u0(s,V8))throw new ma(Fs,"More than one element or text in fragment");if(n.length===1&&!pA(t,a))throw new ma(Fs,"Element in fragment can not be inserted before doctype")}if(m0(e)){if(!pA(t,a))throw new ma(Fs,"Only one element can be added and only after doctype")}if(c1(e)){let o=function(c){return c1(c)&&c!==a};var f=o;if(u0(i,o))throw new ma(Fs,"Only one doctype is allowed");var l=u0(i,m0);if(a&&i.indexOf(l)<i.indexOf(a))throw new ma(Fs,"Doctype can only be inserted before an element")}}function I5(t,e,a,i){if(fz(t,e,a),t.nodeType===fa.DOCUMENT_NODE)(i||rz)(t,e,a);var s=e.parentNode;if(s)s.removeChild(e);if(e.nodeType===o1){var n=e.firstChild;if(n==null)return e;var l=e.lastChild}else n=l=e;var f=a?a.previousSibling:t.lastChild;if(n.previousSibling=f,l.nextSibling=a,f)f.nextSibling=n;else t.firstChild=n;if(a==null)t.lastChild=l;else a.previousSibling=l;do{n.parentNode=t;var o=t.ownerDocument||t;l2(n,o)}while(n!==l&&(n=n.nextSibling));if(L8(t.ownerDocument||t,t),e.nodeType==o1)e.firstChild=e.lastChild=null;return e}function l2(t,e){if(t.ownerDocument===e)return;if(t.ownerDocument=e,t.nodeType===vn&&t.attributes)for(var a=0;a<t.attributes.length;a++){var i=t.attributes.item(a);if(i)i.ownerDocument=e}var s=t.firstChild;while(s)l2(s,e),s=s.nextSibling}function oz(t,e){if(e.parentNode)e.parentNode.removeChild(e);if(e.parentNode=t,e.previousSibling=t.lastChild,e.nextSibling=null,e.previousSibling)e.previousSibling.nextSibling=e;else t.firstChild=e;t.lastChild=e,L8(t.ownerDocument,t,e);var a=t.ownerDocument||t;return l2(e,a),e}r2.prototype={nodeName:"#document",nodeType:AA,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType==o1){var a=t.firstChild;while(a){var i=a.nextSibling;this.insertBefore(a,e),a=i}return t}if(I5(this,t,e),l2(t,this),this.documentElement===null&&t.nodeType===vn)this.documentElement=t;return t},removeChild:function(t){if(this.documentElement==t)this.documentElement=null;return FA(this,t)},replaceChild:function(t,e){if(I5(this,t,e,BA),l2(t,this),e)this.removeChild(e);if(m0(t))this.documentElement=t},importNode:function(t,e){return hz(this,t,e)},getElementById:function(t){var e=null;return U5(this.documentElement,function(a){if(a.nodeType==vn){if(a.getAttribute("id")==t)return e=a,!0}}),e},getElementsByClassName:function(t){var e=cA(t);return new Fo(this,function(a){var i=[];if(e.length>0)U5(a.documentElement,function(s){if(s!==a&&s.nodeType===vn){var n=s.getAttribute("class");if(n){var l=t===n;if(!l){var f=cA(n);l=e.every(tz(f))}if(l)i.push(s)}}});return i})},createElement:function(t){var e=new xf;e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new h1;var a=e.attributes=new x5;return a._ownerElement=e,e},createDocumentFragment:function(){var t=new K5;return t.ownerDocument=this,t.childNodes=new h1,t},createTextNode:function(t){var e=new Y8;return e.ownerDocument=this,e.appendData(t),e},createComment:function(t){var e=new J8;return e.ownerDocument=this,e.appendData(t),e},createCDATASection:function(t){if(t.indexOf("]]>")!==-1)throw new ma(iz,'data contains "]]>"');var e=new Q8;return e.ownerDocument=this,e.appendData(t),e},createProcessingInstruction:function(t,e){var a=new $8;return a.ownerDocument=this,a.tagName=a.nodeName=a.target=t,a.nodeValue=a.data=e,a},createAttribute:function(t){var e=new G5;return e.ownerDocument=this,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){var e=new Z8;return e.ownerDocument=this,e.nodeName=t,e},createElementNS:function(t,e){var a=new xf,i=e.split(":"),s=a.attributes=new x5;if(a.childNodes=new h1,a.ownerDocument=this,a.nodeName=e,a.tagName=e,a.namespaceURI=t,i.length==2)a.prefix=i[0],a.localName=i[1];else a.localName=e;return s._ownerElement=a,a},createAttributeNS:function(t,e){var a=new G5,i=e.split(":");if(a.ownerDocument=this,a.nodeName=e,a.name=e,a.namespaceURI=t,a.specified=!0,i.length==2)a.prefix=i[0],a.localName=i[1];else a.localName=e;return a}};Bs(r2,fa);function xf(){this._nsMap={}}xf.prototype={nodeType:vn,hasAttribute:function(t){return this.getAttributeNode(t)!=null},getAttribute:function(t){var e=this.getAttributeNode(t);return e&&e.value||""},getAttributeNode:function(t){return this.attributes.getNamedItem(t)},setAttribute:function(t,e){var a=this.ownerDocument.createAttribute(t);a.value=a.nodeValue=""+e,this.setAttributeNode(a)},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},appendChild:function(t){if(t.nodeType===o1)return this.insertBefore(t,null);else return oz(this,t)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var a=this.getAttributeNodeNS(t,e);a&&this.removeAttributeNode(a)},hasAttributeNS:function(t,e){return this.getAttributeNodeNS(t,e)!=null},getAttributeNS:function(t,e){var a=this.getAttributeNodeNS(t,e);return a&&a.value||""},setAttributeNS:function(t,e,a){var i=this.ownerDocument.createAttributeNS(t,e);i.value=i.nodeValue=""+a,this.setAttributeNode(i)},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByTagName:function(t){return new Fo(this,function(e){var a=[];return U5(e,function(i){if(i!==e&&i.nodeType==vn&&(t==="*"||i.tagName==t))a.push(i)}),a})},getElementsByTagNameNS:function(t,e){return new Fo(this,function(a){var i=[];return U5(a,function(s){if(s!==a&&s.nodeType===vn&&(t==="*"||s.namespaceURI===t)&&(e==="*"||s.localName==e))i.push(s)}),i})}};r2.prototype.getElementsByTagName=xf.prototype.getElementsByTagName;r2.prototype.getElementsByTagNameNS=xf.prototype.getElementsByTagNameNS;Bs(xf,fa);function G5(){}G5.prototype.nodeType=_o;Bs(G5,fa);function o2(){}o2.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},appendChild:function(t){throw Error(Fi[Fs])},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,a){var i=this.data.substring(0,t),s=this.data.substring(t+e);a=i+a+s,this.nodeValue=this.data=a,this.length=a.length}};Bs(o2,fa);function Y8(){}Y8.prototype={nodeName:"#text",nodeType:E5,splitText:function(t){var e=this.data,a=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var i=this.ownerDocument.createTextNode(a);if(this.parentNode)this.parentNode.insertBefore(i,this.nextSibling);return i}};Bs(Y8,o2);function J8(){}J8.prototype={nodeName:"#comment",nodeType:X8};Bs(J8,o2);function Q8(){}Q8.prototype={nodeName:"#cdata-section",nodeType:dA};Bs(Q8,o2);function X5(){}X5.prototype.nodeType=vA;Bs(X5,fa);function OA(){}OA.prototype.nodeType=az;Bs(OA,fa);function HA(){}HA.prototype.nodeType=ez;Bs(HA,fa);function Z8(){}Z8.prototype.nodeType=qA;Bs(Z8,fa);function K5(){}K5.prototype.nodeName="#document-fragment";K5.prototype.nodeType=o1;Bs(K5,fa);function $8(){}$8.prototype.nodeType=G8;Bs($8,fa);function MA(){}MA.prototype.serializeToString=function(t,e,a,i){return DA.call(t,e,a,i)};fa.prototype.toString=DA;function DA(t,e,a){var i=!!a&&!!a.requireWellFormed,s=[],n=this.nodeType==9&&this.documentElement||this,l=n.prefix,f=n.namespaceURI;if(f&&l==null){var l=n.lookupPrefix(f);if(l==null)var o=[{namespace:f,prefix:null}]}return W8(this,s,t,e,o,i),s.join("")}function wA(t,e,a){var i=t.prefix||"",s=t.namespaceURI;if(!s)return!1;if(i==="xml"&&s===n2.XML||s===n2.XMLNS)return!1;var n=a.length;while(n--){var l=a[n];if(l.prefix===i)return l.namespace!==s}return!0}function z5(t,e,a){t.push(" ",e,'="',a.replace(/[<>&"\t\n\r]/g,CA),'"')}function W8(t,e,a,i,s,n){if(!s)s=[];_i(t,{ns:s,isHTML:a},{enter:function(l,f){var{ns:o,isHTML:c}=f;if(i)if(l=i(l),l){if(typeof l=="string")return e.push(l),null}else return null;switch(l.nodeType){case vn:var u=l.attributes,m=u.length,p=l.tagName;c=n2.isHTML(l.namespaceURI)||c;var w=p;if(!c&&!l.prefix&&l.namespaceURI){var d;for(var v=0;v<u.length;v++)if(u.item(v).name==="xmlns"){d=u.item(v).value;break}if(!d)for(var k=o.length-1;k>=0;k--){var y=o[k];if(y.prefix===""&&y.namespace===l.namespaceURI){d=y.namespace;break}}if(d!==l.namespaceURI)for(var k=o.length-1;k>=0;k--){var y=o[k];if(y.namespace===l.namespaceURI){if(y.prefix)w=y.prefix+":"+p;break}}}e.push("<",w);var B=o.slice();for(var H=0;H<m;H++){var M=u.item(H);if(M.prefix=="xmlns")B.push({prefix:M.localName,namespace:M.value});else if(M.nodeName=="xmlns")B.push({prefix:"",namespace:M.value})}for(var H=0;H<m;H++){var M=u.item(H);if(wA(M,c,B)){var D=M.prefix||"",T=M.namespaceURI;z5(e,D?"xmlns:"+D:"xmlns",T),B.push({prefix:D,namespace:T})}var z=i?i(M):M;if(z)if(typeof z==="string")e.push(z);else z5(e,z.name,z.value)}if(p===w&&wA(l,c,B)){var E=l.prefix||"",T=l.namespaceURI;z5(e,E?"xmlns:"+E:"xmlns",T),B.push({prefix:E,namespace:T})}var V=l.firstChild;if(V||c&&!/^(?:meta|link|img|br|hr|input)$/i.test(p)){if(e.push(">"),c&&/^script$/i.test(p)){while(V){if(V.data)e.push(V.data);else W8(V,e,c,i,B.slice(),n);V=V.nextSibling}return e.push("</",p,">"),null}return{ns:B,isHTML:c,tag:w}}else return e.push("/>"),null;case AA:case o1:return{ns:o.slice(),isHTML:c,tag:null};case _o:return z5(e,l.name,l.value),null;case E5:return e.push(l.data.replace(/[<&>]/g,CA)),null;case dA:if(n&&l.data.indexOf("]]>")!==-1)throw new ma(Co,'The CDATASection data contains "]]>"');return e.push("<![CDATA[",l.data.replace(/]]>/g,"]]]]><![CDATA[>"),"]]>"),null;case X8:if(n&&l.data.indexOf("-->")!==-1)throw new ma(Co,'The comment node data contains "-->"');return e.push("<!--",l.data,"-->"),null;case vA:if(n){if(l.publicId&&!/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(l.publicId))throw new ma(Co,"DocumentType publicId is not a valid PubidLiteral");if(l.systemId&&!/^("[^"]*"|'[^']*')$/.test(l.systemId))throw new ma(Co,"DocumentType systemId is not a valid SystemLiteral");if(l.internalSubset&&l.internalSubset.indexOf("]>")!==-1)throw new ma(Co,'DocumentType internalSubset contains "]>"')}var{publicId:tt,systemId:at}=l;if(e.push("<!DOCTYPE ",l.name),tt){if(e.push(" PUBLIC ",tt),at&&at!=".")e.push(" ",at);e.push(">")}else if(at&&at!=".")e.push(" SYSTEM ",at,">");else{var Q=l.internalSubset;if(Q)e.push(" [",Q,"]");e.push(">")}return null;case G8:if(n&&l.data.indexOf("?>")!==-1)throw new ma(Co,'The ProcessingInstruction data contains "?>"');return e.push("<?",l.target," ",l.data,"?>"),null;case qA:return e.push("&",l.nodeName,";"),null;default:return e.push("??",l.nodeName),null}},exit:function(l,f){if(f&&f.tag)e.push("</",f.tag,">")}})}function hz(t,e,a){var i;return _i(e,null,{enter:function(s,n){var l=s.cloneNode(!1);if(l.ownerDocument=t,l.parentNode=null,n===null)i=l;else n.appendChild(l);var f=s.nodeType===_o||a;return f?l:null}}),i}function TA(t,e,a){var i;return _i(e,null,{enter:function(s,n){var l=new s.constructor;for(var f in s)if(Object.prototype.hasOwnProperty.call(s,f)){var o=s[f];if(typeof o!="object"){if(o!=l[f])l[f]=o}}if(s.childNodes)l.childNodes=new h1;l.ownerDocument=t;var c=a;switch(l.nodeType){case vn:var u=s.attributes,m=l.attributes=new x5,p=u.length;m._ownerElement=l;for(var w=0;w<p;w++)l.setAttributeNode(TA(t,u.item(w),!0));break;case _o:c=!0}if(n!==null)n.appendChild(l);else i=l;return c?l:null}}),i}function RA(t,e,a){t[e]=a}try{if(Object.defineProperty)Object.defineProperty(Fo.prototype,"length",{get:function(){return K8(this),this.$$length}}),Object.defineProperty(fa.prototype,"textContent",{get:function(){if(this.nodeType===vn||this.nodeType===o1){var t=[];return _i(this,null,{enter:function(e){if(e.nodeType===vn||e.nodeType===o1)return!0;if(e.nodeType===G8||e.nodeType===X8)return null;t.push(e.nodeValue)}}),t.join("")}return this.nodeValue},set:function(t){switch(this.nodeType){case vn:case o1:while(this.firstChild)this.removeChild(this.firstChild);if(t||String(t))this.appendChild(this.ownerDocument.createTextNode(t));break;default:this.data=t,this.value=t,this.nodeValue=t}}}),RA=function(t,e,a){t["$$"+e]=a}}catch(t){}cz.DocumentType=X5;cz.DOMException=ma;cz.DOMImplementation=kA;cz.Element=xf;cz.Node=fa;cz.NodeList=h1;cz.walkDOM=_i;cz.XMLSerializer=MA});var EA=Me((qz)=>{var NA=s2().freeze;qz.XML_ENTITIES=NA({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});qz.HTML_ENTITIES=NA({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:`
12
- `,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:"‌"});qz.entityMap=qz.HTML_ENTITIES});var VA=Me((Oz)=>{var m2=s2().NAMESPACE,tg=/[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]/,xA=new RegExp("[\\-\\.0-9"+tg.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),UA=new RegExp("^"+tg.source+xA.source+"*(?::"+tg.source+xA.source+"*)?$"),h2=0,bl=1,Bo=2,c2=3,Oo=4,Ho=5,u2=6,L5=7;function Mo(t,e){if(this.message=t,this.locator=e,Error.captureStackTrace)Error.captureStackTrace(this,Mo)}Mo.prototype=Error();Mo.prototype.name=Mo.name;function XA(){}XA.prototype={parse:function(t,e,a){var i=this.domBuilder;i.startDocument(),KA(e,e={}),Sz(t,e,a,i,this.errorHandler),i.endDocument()}};function Sz(t,e,a,i,s){function n(W){if(W>65535){W-=65536;var ft=55296+(W>>10),nt=56320+(W&1023);return String.fromCharCode(ft,nt)}else return String.fromCharCode(W)}function l(W){var ft=W.slice(1,-1);if(Object.hasOwnProperty.call(a,ft))return a[ft];else if(ft.charAt(0)==="#")return n(parseInt(ft.substr(1).replace("x","0x")));else return s.error("entity not found:"+W),W}function f(W){if(W>v){var ft=t.substring(v,W).replace(/&#?\w+;/g,l);p&&o(v),i.characters(ft,0,W-v),v=W}}function o(W,ft){while(W>=u&&(ft=m.exec(t)))c=ft.index,u=c+ft[0].length,p.lineNumber++;p.columnNumber=W-c+1}var c=0,u=0,m=/.*(?:\r\n?|\n)|.*$/g,p=i.locator,w=[{currentNSMap:e}],d={},v=0;while(!0){try{var k=t.indexOf("<",v);if(k<0){if(!t.substr(v).match(/^\s*$/)){var y=i.doc,B=y.createTextNode(t.substr(v));y.appendChild(B),i.currentElement=B}return}if(k>v)f(k);switch(t.charAt(k+1)){case"/":var at=t.indexOf(">",k+3),H=t.substring(k+2,at).replace(/[ \t\n\r]+$/g,""),M=w.pop();if(at<0)H=t.substring(k+2).replace(/[\s<].*/,""),s.error("end tag name: "+H+" is not complete:"+M.tagName),at=k+1+H.length;else if(H.match(/\s</))H=H.replace(/[\s<].*/,""),s.error("end tag name: "+H+" maybe not complete"),at=k+1+H.length;var D=M.localNSMap,T=M.tagName==H,z=T||M.tagName&&M.tagName.toLowerCase()==H.toLowerCase();if(z){if(i.endElement(M.uri,M.localName,H),D){for(var E in D)if(Object.prototype.hasOwnProperty.call(D,E))i.endPrefixMapping(E)}if(!T)s.fatalError("end tag name: "+H+" is not match the current start tagName:"+M.tagName)}else w.push(M);at++;break;case"?":p&&o(k),at=Fz(t,k,i);break;case"!":p&&o(k),at=_z(t,k,i,s);break;default:p&&o(k);var V=new LA,tt=w[w.length-1].currentNSMap,at=yz(t,k,V,tt,l,s),Q=V.length;if(!V.closed&&Cz(t,at,V.tagName,d)){if(V.closed=!0,!a.nbsp)s.warning("unclosed xml attribute")}if(p&&Q){var Z=IA(p,{});for(var J=0;J<Q;J++){var Y=V[J];o(Y.offset),Y.locator=IA(p,{})}if(i.locator=Z,GA(V,i,tt))w.push(V);i.locator=p}else if(GA(V,i,tt))w.push(V);if(m2.isHTML(V.uri)&&!V.closed)at=kz(t,at,V.tagName,l,i);else at++}}catch(W){if(W instanceof Mo)throw W;s.error("element parse error: "+W),at=-1}if(at>v)v=at;else f(Math.max(k,v)+1)}}function IA(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function yz(t,e,a,i,s,n){function l(w,d,v){if(a.attributeNames.hasOwnProperty(w))n.fatalError("Attribute "+w+" redefined");a.addValue(w,d.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,s),v)}var f,o,c=++e,u=h2;while(!0){var m=t.charAt(c);switch(m){case"=":if(u===bl)f=t.slice(e,c),u=c2;else if(u===Bo)u=c2;else throw Error("attribute equal must after attrName");break;case"'":case'"':if(u===c2||u===bl){if(u===bl)n.warning('attribute value must after "="'),f=t.slice(e,c);if(e=c+1,c=t.indexOf(m,e),c>0)o=t.slice(e,c),l(f,o,e-1),u=Ho;else throw Error("attribute value no end '"+m+"' match")}else if(u==Oo)o=t.slice(e,c),l(f,o,e),n.warning('attribute "'+f+'" missed start quot('+m+")!!"),e=c+1,u=Ho;else throw Error('attribute value must after "="');break;case"/":switch(u){case h2:a.setTagName(t.slice(e,c));case Ho:case u2:case L5:u=L5,a.closed=!0;case Oo:case bl:break;case Bo:a.closed=!0;break;default:throw Error("attribute invalid close char('/')")}break;case"":if(n.error("unexpected end of input"),u==h2)a.setTagName(t.slice(e,c));return c;case">":switch(u){case h2:a.setTagName(t.slice(e,c));case Ho:case u2:case L5:break;case Oo:case bl:if(o=t.slice(e,c),o.slice(-1)==="/")a.closed=!0,o=o.slice(0,-1);case Bo:if(u===Bo)o=f;if(u==Oo)n.warning('attribute "'+o+'" missed quot(")!'),l(f,o,e);else{if(!m2.isHTML(i[""])||!o.match(/^(?:disabled|checked|selected)$/i))n.warning('attribute "'+o+'" missed value!! "'+o+'" instead!!');l(o,o,e)}break;case c2:throw Error("attribute value missed!!")}return c;case"€":m=" ";default:if(m<=" ")switch(u){case h2:a.setTagName(t.slice(e,c)),u=u2;break;case bl:f=t.slice(e,c),u=Bo;break;case Oo:var o=t.slice(e,c);n.warning('attribute "'+o+'" missed quot(")!!'),l(f,o,e);case Ho:u=u2;break}else switch(u){case Bo:var p=a.tagName;if(!m2.isHTML(i[""])||!f.match(/^(?:disabled|checked|selected)$/i))n.warning('attribute "'+f+'" missed value!! "'+f+'" instead2!!');l(f,f,e),e=c,u=bl;break;case Ho:n.warning('attribute space is required"'+f+'"!!');case u2:u=bl,e=c;break;case c2:u=Oo,e=c;break;case L5:throw Error("elements closed character '/' and '>' must be connected to")}}c++}}function GA(t,e,a){var i=t.tagName,s=null,m=t.length;while(m--){var n=t[m],l=n.qName,f=n.value,p=l.indexOf(":");if(p>0)var o=n.prefix=l.slice(0,p),c=l.slice(p+1),u=o==="xmlns"&&c;else c=l,o=null,u=l==="xmlns"&&"";if(n.localName=c,u!==!1){if(s==null)s={},KA(a,a={});a[u]=s[u]=f,n.uri=m2.XMLNS,e.startPrefixMapping(u,f)}}var m=t.length;while(m--){n=t[m];var o=n.prefix;if(o){if(o==="xml")n.uri=m2.XML;if(o!=="xmlns")n.uri=a[o||""]}}var p=i.indexOf(":");if(p>0)o=t.prefix=i.slice(0,p),c=t.localName=i.slice(p+1);else o=null,c=t.localName=i;var w=t.uri=a[o||""];if(e.startElement(w,c,i,t),t.closed){if(e.endElement(w,c,i),s){for(o in s)if(Object.prototype.hasOwnProperty.call(s,o))e.endPrefixMapping(o)}}else return t.currentNSMap=a,t.localNSMap=s,!0}function kz(t,e,a,i,s){if(/^(?:script|textarea)$/i.test(a)){var n=t.indexOf("</"+a+">",e),l=t.substring(e+1,n);if(/[&<]/.test(l)){if(/^script$/i.test(a))return s.characters(l,0,l.length),n;return l=l.replace(/&#?\w+;/g,i),s.characters(l,0,l.length),n}}return e+1}function Cz(t,e,a,i){var s=i[a];if(s==null){if(s=t.lastIndexOf("</"+a+">"),s<e)s=t.lastIndexOf("</"+a);i[a]=s}return s<e}function KA(t,e){for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a))e[a]=t[a]}function _z(t,e,a,i){var s=t.charAt(e+2);switch(s){case"-":if(t.charAt(e+3)==="-"){var n=t.indexOf("-->",e+4);if(n>e)return a.comment(t,e+4,n-e-4),n+3;else return i.error("Unclosed comment"),-1}else return-1;default:if(t.substr(e+3,6)=="CDATA["){var n=t.indexOf("]]>",e+9);return a.startCDATA(),a.characters(t,e+9,n-e-9),a.endCDATA(),n+3}var l=Bz(t,e),f=l.length;if(f>1&&/!doctype/i.test(l[0][0])){var o=l[1][0],c=!1,u=!1;if(f>3){if(/^public$/i.test(l[2][0]))c=l[3][0],u=f>4&&l[4][0];else if(/^system$/i.test(l[2][0]))u=l[3][0]}var m=l[f-1];return a.startDTD(o,c,u),a.endDTD(),m.index+m[0].length}}return-1}function Fz(t,e,a){var i=t.indexOf("?>",e);if(i){var s=t.substring(e,i).match(/^<\?(\S*)\s*([\s\S]*?)$/);if(s){var n=s[0].length;return a.processingInstruction(s[1],s[2]),i+2}else return-1}return-1}function LA(){this.attributeNames={}}LA.prototype={setTagName:function(t){if(!UA.test(t))throw Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,a){if(!UA.test(t))throw Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:a}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}};function Bz(t,e){var a,i=[],s=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;s.lastIndex=e,s.exec(t);while(a=s.exec(t))if(i.push(a),a[1])return i}Oz.XMLReader=XA;Oz.ParseError=Mo});var PA=Me((xz)=>{var Dz=s2(),Tz=P8(),YA=EA(),ZA=VA(),Rz=Tz.DOMImplementation,JA=Dz.NAMESPACE,Nz=ZA.ParseError,zz=ZA.XMLReader;function $A(t){return t.replace(/\r[\n\u0085]/g,`
13
- `).replace(/[\r\u0085\u2028]/g,`
14
- `)}function WA(t){this.options=t||{locator:{}}}WA.prototype.parseFromString=function(t,e){var a=this.options,i=new zz,s=a.domBuilder||new g2,n=a.errorHandler,l=a.locator,f=a.xmlns||{},o=/\/x?html?$/.test(e),c=o?YA.HTML_ENTITIES:YA.XML_ENTITIES;if(l)s.setDocumentLocator(l);if(i.errorHandler=Ez(n,s,l),i.domBuilder=a.domBuilder||s,o)f[""]=JA.HTML;f.xml=f.xml||JA.XML;var u=a.normalizeLineEndings||$A;if(t&&typeof t==="string")i.parse(u(t),f,c);else i.errorHandler.error("invalid doc source");return s.doc};function Ez(t,e,a){if(!t){if(e instanceof g2)return e;t=e}var i={},s=t instanceof Function;a=a||{};function n(l){var f=t[l];if(!f&&s)f=t.length==2?function(o){t(l,o)}:t;i[l]=f&&function(o){f("[xmldom "+l+"]\t"+o+eg(a))}||function(){}}return n("warning"),n("error"),n("fatalError"),i}function g2(){this.cdata=!1}function Do(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}g2.prototype={startDocument:function(){if(this.doc=new Rz().createDocument(null,null,null),this.locator)this.doc.documentURI=this.locator.systemId},startElement:function(t,e,a,i){var s=this.doc,n=s.createElementNS(t,a||e),l=i.length;V5(this,n),this.currentElement=n,this.locator&&Do(this.locator,n);for(var f=0;f<l;f++){var t=i.getURI(f),o=i.getValue(f),a=i.getQName(f),c=s.createAttributeNS(t,a);this.locator&&Do(i.getLocator(f),c),c.value=c.nodeValue=o,n.setAttributeNode(c)}},endElement:function(t,e,a){var i=this.currentElement,s=i.tagName;this.currentElement=i.parentNode},startPrefixMapping:function(t,e){},endPrefixMapping:function(t){},processingInstruction:function(t,e){var a=this.doc.createProcessingInstruction(t,e);this.locator&&Do(this.locator,a),V5(this,a)},ignorableWhitespace:function(t,e,a){},characters:function(t,e,a){if(t=QA.apply(this,arguments),t){if(this.cdata)var i=this.doc.createCDATASection(t);else var i=this.doc.createTextNode(t);if(this.currentElement)this.currentElement.appendChild(i);else if(/^\s*$/.test(t))this.doc.appendChild(i);this.locator&&Do(this.locator,i)}},skippedEntity:function(t){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(t){if(this.locator=t)t.lineNumber=0},comment:function(t,e,a){t=QA.apply(this,arguments);var i=this.doc.createComment(t);this.locator&&Do(this.locator,i),V5(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(t,e,a){var i=this.doc.implementation;if(i&&i.createDocumentType){var s=i.createDocumentType(t,e,a);this.locator&&Do(this.locator,s),V5(this,s),this.doc.doctype=s}},warning:function(t){console.warn("[xmldom warning]\t"+t,eg(this.locator))},error:function(t){console.error("[xmldom error]\t"+t,eg(this.locator))},fatalError:function(t){throw new Nz(t,this.locator)}};function eg(t){if(t)return`
15
- @`+(t.systemId||"")+"#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}function QA(t,e,a){if(typeof t=="string")return t.substr(e,a);else{if(t.length>=e+a||e)return new java.lang.String(t,e,a)+"";return t}}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(t){g2.prototype[t]=function(){return null}});function V5(t,e){if(!t.currentElement)t.doc.appendChild(e);else t.currentElement.appendChild(e)}xz.__DOMHandler=g2;xz.normalizeLineEndings=$A;xz.DOMParser=WA});var jv=Me((Nat,wv)=>{var pv=Math.pow(2,32),NE=function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),a;if(e.getBigUint64){if(a=e.getBigUint64(0),a<Number.MAX_SAFE_INTEGER)return Number(a);return a}return e.getUint32(0)*pv+e.getUint32(4)};wv.exports={getUint64:NE,MAX_UINT32:pv}});var Av=Me((zat,qv)=>{var dv=jv().getUint64,zE=function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),a={version:t[0],flags:new Uint8Array(t.subarray(1,4)),references:[],referenceId:e.getUint32(4),timescale:e.getUint32(8)},i=12;if(a.version===0)a.earliestPresentationTime=e.getUint32(i),a.firstOffset=e.getUint32(i+4),i+=8;else a.earliestPresentationTime=dv(t.subarray(i)),a.firstOffset=dv(t.subarray(i+8)),i+=16;i+=2;var s=e.getUint16(i);i+=2;for(;s>0;i+=12,s--)a.references.push({referenceType:(t[i]&128)>>>7,referencedSize:e.getUint32(i)&2147483647,subsegmentDuration:e.getUint32(i+4),startsWithSap:!!(t[i+8]&128),sapType:(t[i+8]&112)>>>4,sapDeltaTime:e.getUint32(i+8)&268435455});return a};qv.exports=zE});var Rv=Me((fit,Tv)=>{var cg=90000,ug,mg,$5,gg,Hv,Mv,Dv;ug=function(t){return t*cg};mg=function(t,e){return t*e};$5=function(t){return t/cg};gg=function(t,e){return t/e};Hv=function(t,e){return ug(gg(t,e))};Mv=function(t,e){return mg($5(t),e)};Dv=function(t,e,a){return $5(a?t:t-e)};Tv.exports={ONE_SECOND_IN_TS:cg,secondsToVideoTs:ug,secondsToAudioTs:mg,videoTsToSeconds:$5,audioTsToSeconds:gg,audioTsToVideoTs:Hv,videoTsToAudioTs:Mv,metadataTsToSeconds:Dv}});var F_=Me((wft,a9)=>{__();var _b=Ie(Pa());a9.exports=function(t){function e(r,h,g,j){return new L(r,h,g,j)}function a(){}function i(r){var h="https://react.dev/errors/"+r;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+r+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(r){var h=r,g=r;if(r.alternate)for(;h.return;)h=h.return;else{r=h;do h=r,(h.flags&4098)!==0&&(g=h.return),r=h.return;while(r)}return h.tag===3?g:null}function n(r){if(s(r)!==r)throw Error(i(188))}function l(r){var h=r.alternate;if(!h){if(h=s(r),h===null)throw Error(i(188));return h!==r?null:r}for(var g=r,j=h;;){var C=g.return;if(C===null)break;var F=C.alternate;if(F===null){if(j=C.return,j!==null){g=j;continue}break}if(C.child===F.child){for(F=C.child;F;){if(F===g)return n(C),r;if(F===j)return n(C),h;F=F.sibling}throw Error(i(188))}if(g.return!==j.return)g=C,j=F;else{for(var N=!1,P=C.child;P;){if(P===g){N=!0,g=C,j=F;break}if(P===j){N=!0,j=C,g=F;break}P=P.sibling}if(!N){for(P=F.child;P;){if(P===g){N=!0,g=F,j=C;break}if(P===j){N=!0,j=F,g=C;break}P=P.sibling}if(!N)throw Error(i(189))}}if(g.alternate!==j)throw Error(i(190))}if(g.tag!==3)throw Error(i(188));return g.stateNode.current===g?r:h}function f(r){var h=r.tag;if(h===5||h===26||h===27||h===6)return r;for(r=r.child;r!==null;){if(h=f(r),h!==null)return h;r=r.sibling}return null}function o(r){var h=r.tag;if(h===5||h===26||h===27||h===6)return r;for(r=r.child;r!==null;){if(r.tag!==4&&(h=o(r),h!==null))return h;r=r.sibling}return null}function c(r){if(r===null||typeof r!=="object")return null;return r=Op&&r[Op]||r["@@iterator"],typeof r==="function"?r:null}function u(r){if(r==null)return null;if(typeof r==="function")return r.$$typeof===jO?null:r.displayName||r.name||null;if(typeof r==="string")return r;switch(r){case zr:return"Fragment";case _6:return"Profiler";case Fp:return"StrictMode";case B6:return"Suspense";case O6:return"SuspenseList";case M6:return"Activity"}if(typeof r==="object")switch(r.$$typeof){case Nr:return"Portal";case Q1:return r.displayName||"Context";case Bp:return(r._context.displayName||"Context")+".Consumer";case F6:var h=r.render;return r=r.displayName,r||(r=h.displayName||h.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case H6:return h=r.displayName||null,h!==null?h:u(r.type)||"Memo";case Z1:h=r._payload,r=r._init;try{return u(r(h))}catch(g){}}return null}function m(r){return{current:r}}function p(r){0>Ur||(r.current=E6[Ur],E6[Ur]=null,Ur--)}function w(r,h){Ur++,E6[Ur]=r.current,r.current=h}function d(r){return r>>>=0,r===0?32:31-(VH(r)/YH|0)|0}function v(r){var h=r&42;if(h!==0)return h;switch(r&-r){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 r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function k(r,h,g){var j=r.pendingLanes;if(j===0)return 0;var C=0,F=r.suspendedLanes,N=r.pingedLanes;r=r.warmLanes;var P=j&134217727;return P!==0?(j=P&~F,j!==0?C=v(j):(N&=P,N!==0?C=v(N):g||(g=P&~r,g!==0&&(C=v(g))))):(P=j&~F,P!==0?C=v(P):N!==0?C=v(N):g||(g=j&~r,g!==0&&(C=v(g)))),C===0?0:h!==0&&h!==C&&(h&F)===0&&(F=C&-C,g=h&-h,F>=g||F===32&&(g&4194048)!==0)?h:C}function y(r,h){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&h)===0}function B(r,h){switch(r){case 1:case 2:case 4:case 8:case 64:return h+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 h+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 H(){var r=Fu;return Fu<<=1,(Fu&62914560)===0&&(Fu=4194304),r}function M(r){for(var h=[],g=0;31>g;g++)h.push(r);return h}function D(r,h){r.pendingLanes|=h,h!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function T(r,h,g,j,C,F){var N=r.pendingLanes;r.pendingLanes=g,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=g,r.entangledLanes&=g,r.errorRecoveryDisabledLanes&=g,r.shellSuspendCounter=0;var{entanglements:P,expirationTimes:gt,hiddenUpdates:yt}=r;for(g=N&~g;0<g;){var xt=31-Ls(g),Tt=1<<xt;P[xt]=0,gt[xt]=-1;var Vt=yt[xt];if(Vt!==null)for(yt[xt]=null,xt=0;xt<Vt.length;xt++){var Ae=Vt[xt];Ae!==null&&(Ae.lane&=-536870913)}g&=~Tt}j!==0&&z(r,j,0),F!==0&&C===0&&r.tag!==0&&(r.suspendedLanes|=F&~(N&~h))}function z(r,h,g){r.pendingLanes|=h,r.suspendedLanes&=~h;var j=31-Ls(h);r.entangledLanes|=h,r.entanglements[j]=r.entanglements[j]|1073741824|g&261930}function E(r,h){var g=r.entangledLanes|=h;for(r=r.entanglements;g;){var j=31-Ls(g),C=1<<j;C&h|r[j]&h&&(r[j]|=h),g&=~C}}function V(r,h){var g=h&-h;return g=(g&42)!==0?1:tt(g),(g&(r.suspendedLanes|h))!==0?0:g}function tt(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=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:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function at(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Q(r){if(typeof WH==="function"&&PH(r),Vs&&typeof Vs.setStrictMode==="function")try{Vs.setStrictMode(dc,r)}catch(h){}}function Z(r,h){return r===h&&(r!==0||1/r===1/h)||r!==r&&h!==h}function J(r){if(I6===void 0)try{throw Error()}catch(g){var h=g.stack.trim().match(/\n( *(at )?)/);I6=h&&h[1]||"",aw=-1<g.stack.indexOf(`
16
- at`)?" (<anonymous>)":-1<g.stack.indexOf("@")?"@unknown:0:0":""}return`
17
- `+I6+r+aw}function Y(r,h){if(!r||G6)return"";G6=!0;var g=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var j={DetermineComponentFrameRoot:function(){try{if(h){var Tt=function(){throw Error()};if(Object.defineProperty(Tt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==="object"&&Reflect.construct){try{Reflect.construct(Tt,[])}catch(Ae){var Vt=Ae}Reflect.construct(r,[],Tt)}else{try{Tt.call()}catch(Ae){Vt=Ae}r.call(Tt.prototype)}}else{try{throw Error()}catch(Ae){Vt=Ae}(Tt=r())&&typeof Tt.catch==="function"&&Tt.catch(function(){})}}catch(Ae){if(Ae&&Vt&&typeof Ae.stack==="string")return[Ae.stack,Vt.stack]}return[null,null]}};j.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var C=Object.getOwnPropertyDescriptor(j.DetermineComponentFrameRoot,"name");C&&C.configurable&&Object.defineProperty(j.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var F=j.DetermineComponentFrameRoot(),N=F[0],P=F[1];if(N&&P){var gt=N.split(`
18
- `),yt=P.split(`
19
- `);for(C=j=0;j<gt.length&&!gt[j].includes("DetermineComponentFrameRoot");)j++;for(;C<yt.length&&!yt[C].includes("DetermineComponentFrameRoot");)C++;if(j===gt.length||C===yt.length)for(j=gt.length-1,C=yt.length-1;1<=j&&0<=C&&gt[j]!==yt[C];)C--;for(;1<=j&&0<=C;j--,C--)if(gt[j]!==yt[C]){if(j!==1||C!==1)do if(j--,C--,0>C||gt[j]!==yt[C]){var xt=`
20
- `+gt[j].replace(" at new "," at ");return r.displayName&&xt.includes("<anonymous>")&&(xt=xt.replace("<anonymous>",r.displayName)),xt}while(1<=j&&0<=C);break}}}finally{G6=!1,Error.prepareStackTrace=g}return(g=r?r.displayName||r.name:"")?J(g):""}function W(r,h){switch(r.tag){case 26:case 27:case 5:return J(r.type);case 16:return J("Lazy");case 13:return r.child!==h&&h!==null?J("Suspense Fallback"):J("Suspense");case 19:return J("SuspenseList");case 0:case 15:return Y(r.type,!1);case 11:return Y(r.type.render,!1);case 1:return Y(r.type,!0);case 31:return J("Activity");default:return""}}function ft(r){try{var h="",g=null;do h+=W(r,g),g=r,r=r.return;while(r);return h}catch(j){return`
21
- Error generating stack: `+j.message+`
22
- `+j.stack}}function nt(r,h){if(typeof r==="object"&&r!==null){var g=iw.get(r);if(g!==void 0)return g;return h={value:r,source:h,stack:ft(h)},iw.set(r,h),h}return{value:r,source:h,stack:ft(h)}}function qt(r,h){Gr[Xr++]=qc,Gr[Xr++]=Ou,Ou=r,qc=h}function R(r,h,g){bn[pn++]=r0,bn[pn++]=o0,bn[pn++]=$1,$1=r;var j=r0;r=o0;var C=32-Ls(j)-1;j&=~(1<<C),g+=1;var F=32-Ls(h)+C;if(30<F){var N=C-C%5;F=(j&(1<<N)-1).toString(32),j>>=N,C-=N,r0=1<<32-Ls(h)+C|g<<C|j,o0=F+r}else r0=1<<F|g<<C|j,o0=r}function ct(r){r.return!==null&&(qt(r,1),R(r,1,0))}function pt(r){for(;r===Ou;)Ou=Gr[--Xr],Gr[Xr]=null,qc=Gr[--Xr],Gr[Xr]=null;for(;r===$1;)$1=bn[--pn],bn[pn]=null,o0=bn[--pn],bn[pn]=null,r0=bn[--pn],bn[pn]=null}function G(r,h){bn[pn++]=r0,bn[pn++]=o0,bn[pn++]=$1,r0=h.id,o0=h.overflow,$1=r}function Ct(r,h){w(W1,h),w(Ac,r),w(xi,null),r=AO(h),p(xi),w(xi,r)}function Kt(){p(xi),p(Ac),p(W1)}function le(r){r.memoizedState!==null&&w(Hu,r);var h=xi.current,g=vO(h,r.type);h!==g&&(w(Ac,r),w(xi,g))}function Ft(r){Ac.current===r&&(p(xi),p(Ac)),Hu.current===r&&(p(Hu),$0?pf._currentValue=Er:pf._currentValue2=Er)}function Et(r){var h=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ae(nt(h,r)),X6}function $t(r,h){if(!Pi)throw Error(i(175));vH(r.stateNode,r.type,r.memoizedProps,h,r)||Et(r,!0)}function Dt(r){for(Ui=r.return;Ui;)switch(Ui.tag){case 5:case 31:case 13:wn=!1;return;case 27:case 3:wn=!0;return;default:Ui=Ui.return}}function Mt(r){if(!Pi||r!==Ui)return!1;if(!Ke)return Dt(r),Ke=!0,!1;var h=r.tag;if(gi?h!==3&&h!==27&&(h!==5||Xp(r.type)&&!ku(r.type,r.memoizedProps))&&Ta&&Et(r):h!==3&&(h!==5||Xp(r.type)&&!ku(r.type,r.memoizedProps))&&Ta&&Et(r),Dt(r),h===13){if(!Pi)throw Error(i(316));if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Ta=_H(r)}else if(h===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Ta=CH(r)}else Ta=gi&&h===27?uH(r.type,Ta):Ui?Gp(r.stateNode):null;return!0}function Xt(){Pi&&(Ta=Ui=null,Ke=!1)}function Gt(){var r=P1;return r!==null&&(ks===null?ks=r:ks.push.apply(ks,r),P1=null),r}function ae(r){P1===null?P1=[r]:P1.push(r)}function Xe(r,h,g){$0?(w(Mu,h._currentValue),h._currentValue=g):(w(Mu,h._currentValue2),h._currentValue2=g)}function Re(r){var h=Mu.current;$0?r._currentValue=h:r._currentValue2=h,p(Mu)}function da(r,h,g){for(;r!==null;){var j=r.alternate;if((r.childLanes&h)!==h?(r.childLanes|=h,j!==null&&(j.childLanes|=h)):j!==null&&(j.childLanes&h)!==h&&(j.childLanes|=h),r===g)break;r=r.return}}function Ve(r,h,g,j){var C=r.child;C!==null&&(C.return=r);for(;C!==null;){var F=C.dependencies;if(F!==null){var N=C.child;F=F.firstContext;t:for(;F!==null;){var P=F;F=C;for(var gt=0;gt<h.length;gt++)if(P.context===h[gt]){F.lanes|=g,P=F.alternate,P!==null&&(P.lanes|=g),da(F.return,g,r),j||(N=null);break t}F=P.next}}else if(C.tag===18){if(N=C.return,N===null)throw Error(i(341));N.lanes|=g,F=N.alternate,F!==null&&(F.lanes|=g),da(N,g,r),N=null}else N=C.child;if(N!==null)N.return=C;else for(N=C;N!==null;){if(N===r){N=null;break}if(C=N.sibling,C!==null){C.return=N.return,N=C;break}N=N.return}C=N}}function va(r,h,g,j){r=null;for(var C=h,F=!1;C!==null;){if(!F){if((C.flags&524288)!==0)F=!0;else if((C.flags&262144)!==0)break}if(C.tag===10){var N=C.alternate;if(N===null)throw Error(i(387));if(N=N.memoizedProps,N!==null){var P=C.type;Ys(C.pendingProps.value,N.value)||(r!==null?r.push(P):r=[P])}}else if(C===Hu.current){if(N=C.alternate,N===null)throw Error(i(387));N.memoizedState.memoizedState!==C.memoizedState.memoizedState&&(r!==null?r.push(pf):r=[pf])}C=C.return}r!==null&&Ve(h,r,g,j),h.flags|=262144}function ce(r){for(r=r.firstContext;r!==null;){var h=r.context;if(!Ys($0?h._currentValue:h._currentValue2,r.memoizedValue))return!0;r=r.next}return!1}function ii(r){wf=r,P0=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Ee(r){return mi(wf,r)}function Ri(r,h){return wf===null&&ii(r),mi(r,h)}function mi(r,h){var g=$0?h._currentValue:h._currentValue2;if(h={context:h,memoizedValue:g,next:null},P0===null){if(r===null)throw Error(i(308));P0=h,r.dependencies={lanes:0,firstContext:h},r.flags|=524288}else P0=P0.next=h;return g}function ji(){return{controller:new eM,data:new Map,refCount:0}}function mt(r){r.refCount--,r.refCount===0&&aM(iM,function(){r.controller.abort()})}function kt(){}function Zt(r){r!==Kr&&r.next===null&&(Kr===null?Du=Kr=r:Kr=Kr.next=r),Tu=!0,K6||(K6=!0,ca())}function ne(r,h){if(!L6&&Tu){L6=!0;do{var g=!1;for(var j=Du;j!==null;){if(!h)if(r!==0){var C=j.pendingLanes;if(C===0)var F=0;else{var{suspendedLanes:N,pingedLanes:P}=j;F=(1<<31-Ls(42|r)+1)-1,F&=C&~(N&~P),F=F&201326741?F&201326741|1:F?F|2:0}F!==0&&(g=!0,_e(j,F))}else F=Ue,F=k(j,j===pa?F:0,j.cancelPendingCommit!==null||j.timeoutHandle!==bf),(F&3)===0||y(j,F)||(g=!0,_e(j,F));j=j.next}}while(g);L6=!1}}function ye(){dt()}function dt(){Tu=K6=!1;var r=0;jf!==0&&HO()&&(r=jf);for(var h=Ss(),g=null,j=Du;j!==null;){var C=j.next,F=Ut(j,h);if(F===0)j.next=null,g===null?Du=C:g.next=C,C===null&&(Kr=g);else if(g=j,r!==0||(F&3)!==0)Tu=!0;j=C}bi!==0&&bi!==5||ne(r,!1),jf!==0&&(jf=0)}function Ut(r,h){for(var{suspendedLanes:g,pingedLanes:j,expirationTimes:C}=r,F=r.pendingLanes&-62914561;0<F;){var N=31-Ls(F),P=1<<N,gt=C[N];if(gt===-1){if((P&g)===0||(P&j)!==0)C[N]=B(P,h)}else gt<=h&&(r.expiredLanes|=P);F&=~P}if(h=pa,g=Ue,g=k(r,r===h?g:0,r.cancelPendingCommit!==null||r.timeoutHandle!==bf),j=r.callbackNode,g===0||r===h&&(na===2||na===9)||r.cancelPendingCommit!==null)return j!==null&&j!==null&&x6(j),r.callbackNode=null,r.callbackPriority=0;if((g&3)===0||y(r,g)){if(h=g&-g,h===r.callbackPriority)return h;switch(j!==null&&x6(j),at(g)){case 2:case 8:g=ZH;break;case 32:g=U6;break;case 268435456:g=$H;break;default:g=U6}return j=ie.bind(null,r),g=Bu(g,j),r.callbackPriority=h,r.callbackNode=g,h}return j!==null&&j!==null&&x6(j),r.callbackPriority=2,r.callbackNode=null,2}function ie(r,h){if(bi!==0&&bi!==5)return r.callbackNode=null,r.callbackPriority=0,null;var g=r.callbackNode;if(Z0()&&r.callbackNode!==g)return null;var j=Ue;if(j=k(r,r===pa?j:0,r.cancelPendingCommit!==null||r.timeoutHandle!==bf),j===0)return null;return gc(r,j,h),Ut(r,Ss()),r.callbackNode!=null&&r.callbackNode===g?ie.bind(null,r):null}function _e(r,h){if(Z0())return null;gc(r,h,!0)}function ca(){EO?xO(function(){(Ne&6)!==0?Bu(tw,ye):dt()}):Bu(tw,ye)}function Be(){if(jf===0){var r=Lr;r===0&&(r=Cu,Cu<<=1,(Cu&261888)===0&&(Cu=256)),jf=r}return jf}function Sa(r,h){if(vc===null){var g=vc=[];V6=0,Lr=Be(),Vr={status:"pending",value:void 0,then:function(j){g.push(j)}}}return V6++,h.then(ia,ia),h}function ia(){if(--V6===0&&vc!==null){Vr!==null&&(Vr.status="fulfilled");var r=vc;vc=null,Lr=0,Vr=null;for(var h=0;h<r.length;h++)(0,r[h])()}}function on(r,h){var g=[],j={status:"pending",value:null,reason:null,then:function(C){g.push(C)}};return r.then(function(){j.status="fulfilled",j.value=h;for(var C=0;C<g.length;C++)(0,g[C])(h)},function(C){j.status="rejected",j.reason=C;for(C=0;C<g.length;C++)(0,g[C])(void 0)}),j}function Yt(){var r=df.current;return r!==null?r:pa.pooledCache}function Pt(r,h){h===null?w(df,df.current):w(df,h.pool)}function _t(){var r=Yt();return r===null?null:{parent:$0?Ra._currentValue:Ra._currentValue2,pool:r}}function Ht(r,h){if(Ys(r,h))return!0;if(typeof r!=="object"||r===null||typeof h!=="object"||h===null)return!1;var g=Object.keys(r),j=Object.keys(h);if(g.length!==j.length)return!1;for(j=0;j<g.length;j++){var C=g[j];if(!tM.call(h,C)||!Ys(r[C],h[C]))return!1}return!0}function Wt(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Oe(r,h,g){switch(g=r[g],g===void 0?r.push(h):g!==h&&(h.then(kt,kt),h=g),h.status){case"fulfilled":return h.value;case"rejected":throw r=h.reason,ur(r),r;default:if(typeof h.status==="string")h.then(kt,kt);else{if(r=pa,r!==null&&100<r.shellSuspendCounter)throw Error(i(482));r=h,r.status="pending",r.then(function(j){if(h.status==="pending"){var C=h;C.status="fulfilled",C.value=j}},function(j){if(h.status==="pending"){var C=h;C.status="rejected",C.reason=j}})}switch(h.status){case"fulfilled":return h.value;case"rejected":throw r=h.reason,ur(r),r}throw qf=h,Yr}}function Ma(r){try{var h=r._init;return h(r._payload)}catch(g){if(g!==null&&typeof g==="object"&&typeof g.then==="function")throw qf=g,Yr;throw g}}function En(){if(qf===null)throw Error(i(459));var r=qf;return qf=null,r}function ur(r){if(r===Yr||r===Ru)throw Error(i(483))}function mr(r){var h=Sc;return Sc+=1,Jr===null&&(Jr=[]),Oe(Jr,r,h)}function Nl(r,h){h=h.props.ref,r.ref=h!==void 0?h:null}function gr(r,h){if(h.$$typeof===pO)throw Error(i(525));throw r=Object.prototype.toString.call(h),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(h).join(", ")+"}":r))}function Hh(r){function h(ot,st){if(r){var ut=ot.deletions;ut===null?(ot.deletions=[st],ot.flags|=16):ut.push(st)}}function g(ot,st){if(!r)return null;for(;st!==null;)h(ot,st),st=st.sibling;return null}function j(ot){for(var st=new Map;ot!==null;)ot.key!==null?st.set(ot.key,ot):st.set(ot.index,ot),ot=ot.sibling;return st}function C(ot,st){return ot=ht(ot,st),ot.index=0,ot.sibling=null,ot}function F(ot,st,ut){if(ot.index=ut,!r)return ot.flags|=1048576,st;if(ut=ot.alternate,ut!==null)return ut=ut.index,ut<st?(ot.flags|=67108866,st):ut;return ot.flags|=67108866,st}function N(ot){return r&&ot.alternate===null&&(ot.flags|=67108866),ot}function P(ot,st,ut,Rt){if(st===null||st.tag!==6)return st=oe(ut,ot.mode,Rt),st.return=ot,st;return st=C(st,ut),st.return=ot,st}function gt(ot,st,ut,Rt){var re=ut.type;if(re===zr)return xt(ot,st,ut.props.children,Rt,ut.key);if(st!==null&&(st.elementType===re||typeof re==="object"&&re!==null&&re.$$typeof===Z1&&Ma(re)===st.type))return st=C(st,ut.props),Nl(st,ut),st.return=ot,st;return st=wt(ut.type,ut.key,ut.props,null,ot.mode,Rt),Nl(st,ut),st.return=ot,st}function yt(ot,st,ut,Rt){if(st===null||st.tag!==4||st.stateNode.containerInfo!==ut.containerInfo||st.stateNode.implementation!==ut.implementation)return st=Ei(ut,ot.mode,Rt),st.return=ot,st;return st=C(st,ut.children||[]),st.return=ot,st}function xt(ot,st,ut,Rt,re){if(st===null||st.tag!==7)return st=te(ut,ot.mode,Rt,re),st.return=ot,st;return st=C(st,ut),st.return=ot,st}function Tt(ot,st,ut){if(typeof st==="string"&&st!==""||typeof st==="number"||typeof st==="bigint")return st=oe(""+st,ot.mode,ut),st.return=ot,st;if(typeof st==="object"&&st!==null){switch(st.$$typeof){case Su:return ut=wt(st.type,st.key,st.props,null,ot.mode,ut),Nl(ut,st),ut.return=ot,ut;case Nr:return st=Ei(st,ot.mode,ut),st.return=ot,st;case Z1:return st=Ma(st),Tt(ot,st,ut)}if(yu(st)||c(st))return st=te(st,ot.mode,ut,null),st.return=ot,st;if(typeof st.then==="function")return Tt(ot,mr(st),ut);if(st.$$typeof===Q1)return Tt(ot,Ri(ot,st),ut);gr(ot,st)}return null}function Vt(ot,st,ut,Rt){var re=st!==null?st.key:null;if(typeof ut==="string"&&ut!==""||typeof ut==="number"||typeof ut==="bigint")return re!==null?null:P(ot,st,""+ut,Rt);if(typeof ut==="object"&&ut!==null){switch(ut.$$typeof){case Su:return ut.key===re?gt(ot,st,ut,Rt):null;case Nr:return ut.key===re?yt(ot,st,ut,Rt):null;case Z1:return ut=Ma(ut),Vt(ot,st,ut,Rt)}if(yu(ut)||c(ut))return re!==null?null:xt(ot,st,ut,Rt,null);if(typeof ut.then==="function")return Vt(ot,st,mr(ut),Rt);if(ut.$$typeof===Q1)return Vt(ot,st,Ri(ot,ut),Rt);gr(ot,ut)}return null}function Ae(ot,st,ut,Rt,re){if(typeof Rt==="string"&&Rt!==""||typeof Rt==="number"||typeof Rt==="bigint")return ot=ot.get(ut)||null,P(st,ot,""+Rt,re);if(typeof Rt==="object"&&Rt!==null){switch(Rt.$$typeof){case Su:return ot=ot.get(Rt.key===null?ut:Rt.key)||null,gt(st,ot,Rt,re);case Nr:return ot=ot.get(Rt.key===null?ut:Rt.key)||null,yt(st,ot,Rt,re);case Z1:return Rt=Ma(Rt),Ae(ot,st,ut,Rt,re)}if(yu(Rt)||c(Rt))return ot=ot.get(ut)||null,xt(st,ot,Rt,re,null);if(typeof Rt.then==="function")return Ae(ot,st,ut,mr(Rt),re);if(Rt.$$typeof===Q1)return Ae(ot,st,ut,Ri(st,Rt),re);gr(st,Rt)}return null}function Ii(ot,st,ut,Rt){for(var re=null,Na=null,ue=st,Ye=st=0,ki=null;ue!==null&&Ye<ut.length;Ye++){ue.index>Ye?(ki=ue,ue=null):ki=ue.sibling;var Je=Vt(ot,ue,ut[Ye],Rt);if(Je===null){ue===null&&(ue=ki);break}r&&ue&&Je.alternate===null&&h(ot,ue),st=F(Je,st,Ye),Na===null?re=Je:Na.sibling=Je,Na=Je,ue=ki}if(Ye===ut.length)return g(ot,ue),Ke&&qt(ot,Ye),re;if(ue===null){for(;Ye<ut.length;Ye++)ue=Tt(ot,ut[Ye],Rt),ue!==null&&(st=F(ue,st,Ye),Na===null?re=ue:Na.sibling=ue,Na=ue);return Ke&&qt(ot,Ye),re}for(ue=j(ue);Ye<ut.length;Ye++)ki=Ae(ue,ot,Ye,ut[Ye],Rt),ki!==null&&(r&&ki.alternate!==null&&ue.delete(ki.key===null?Ye:ki.key),st=F(ki,st,Ye),Na===null?re=ki:Na.sibling=ki,Na=ki);return r&&ue.forEach(function(nl){return h(ot,nl)}),Ke&&qt(ot,Ye),re}function Oc(ot,st,ut,Rt){if(ut==null)throw Error(i(151));for(var re=null,Na=null,ue=st,Ye=st=0,ki=null,Je=ut.next();ue!==null&&!Je.done;Ye++,Je=ut.next()){ue.index>Ye?(ki=ue,ue=null):ki=ue.sibling;var nl=Vt(ot,ue,Je.value,Rt);if(nl===null){ue===null&&(ue=ki);break}r&&ue&&nl.alternate===null&&h(ot,ue),st=F(nl,st,Ye),Na===null?re=nl:Na.sibling=nl,Na=nl,ue=ki}if(Je.done)return g(ot,ue),Ke&&qt(ot,Ye),re;if(ue===null){for(;!Je.done;Ye++,Je=ut.next())Je=Tt(ot,Je.value,Rt),Je!==null&&(st=F(Je,st,Ye),Na===null?re=Je:Na.sibling=Je,Na=Je);return Ke&&qt(ot,Ye),re}for(ue=j(ue);!Je.done;Ye++,Je=ut.next())Je=Ae(ue,ot,Ye,Je.value,Rt),Je!==null&&(r&&Je.alternate!==null&&ue.delete(Je.key===null?Ye:Je.key),st=F(Je,st,Ye),Na===null?re=Je:Na.sibling=Je,Na=Je);return r&&ue.forEach(function(fM){return h(ot,fM)}),Ke&&qt(ot,Ye),re}function yf(ot,st,ut,Rt){if(typeof ut==="object"&&ut!==null&&ut.type===zr&&ut.key===null&&(ut=ut.props.children),typeof ut==="object"&&ut!==null){switch(ut.$$typeof){case Su:t:{for(var re=ut.key;st!==null;){if(st.key===re){if(re=ut.type,re===zr){if(st.tag===7){g(ot,st.sibling),Rt=C(st,ut.props.children),Rt.return=ot,ot=Rt;break t}}else if(st.elementType===re||typeof re==="object"&&re!==null&&re.$$typeof===Z1&&Ma(re)===st.type){g(ot,st.sibling),Rt=C(st,ut.props),Nl(Rt,ut),Rt.return=ot,ot=Rt;break t}g(ot,st);break}else h(ot,st);st=st.sibling}ut.type===zr?(Rt=te(ut.props.children,ot.mode,Rt,ut.key),Rt.return=ot,ot=Rt):(Rt=wt(ut.type,ut.key,ut.props,null,ot.mode,Rt),Nl(Rt,ut),Rt.return=ot,ot=Rt)}return N(ot);case Nr:t:{for(re=ut.key;st!==null;){if(st.key===re)if(st.tag===4&&st.stateNode.containerInfo===ut.containerInfo&&st.stateNode.implementation===ut.implementation){g(ot,st.sibling),Rt=C(st,ut.children||[]),Rt.return=ot,ot=Rt;break t}else{g(ot,st);break}else h(ot,st);st=st.sibling}Rt=Ei(ut,ot.mode,Rt),Rt.return=ot,ot=Rt}return N(ot);case Z1:return ut=Ma(ut),yf(ot,st,ut,Rt)}if(yu(ut))return Ii(ot,st,ut,Rt);if(c(ut)){if(re=c(ut),typeof re!=="function")throw Error(i(150));return ut=re.call(ut),Oc(ot,st,ut,Rt)}if(typeof ut.then==="function")return yf(ot,st,mr(ut),Rt);if(ut.$$typeof===Q1)return yf(ot,st,Ri(ot,ut),Rt);gr(ot,ut)}return typeof ut==="string"&&ut!==""||typeof ut==="number"||typeof ut==="bigint"?(ut=""+ut,st!==null&&st.tag===6?(g(ot,st.sibling),Rt=C(st,ut),Rt.return=ot,ot=Rt):(g(ot,st),Rt=oe(ut,ot.mode,Rt),Rt.return=ot,ot=Rt),N(ot)):g(ot,st)}return function(ot,st,ut,Rt){try{Sc=0;var re=yf(ot,st,ut,Rt);return Jr=null,re}catch(ue){if(ue===Yr||ue===Ru)throw ue;var Na=e(29,ue,null,ot.mode);return Na.lanes=Rt,Na.return=ot,Na}finally{}}}function _1(){for(var r=Qr,h=J6=Qr=0;h<r;){var g=jn[h];jn[h++]=null;var j=jn[h];jn[h++]=null;var C=jn[h];jn[h++]=null;var F=jn[h];if(jn[h++]=null,j!==null&&C!==null){var N=j.pending;N===null?C.next=C:(C.next=N.next,N.next=C),j.pending=C}F!==0&&y9(g,C,F)}}function z0(r,h,g,j){jn[Qr++]=r,jn[Qr++]=h,jn[Qr++]=g,jn[Qr++]=j,J6|=j,r.lanes|=j,r=r.alternate,r!==null&&(r.lanes|=j)}function di(r,h,g,j){return z0(r,h,g,j),x0(r)}function E0(r,h){return z0(r,null,null,h),x0(r)}function y9(r,h,g){r.lanes|=g;var j=r.alternate;j!==null&&(j.lanes|=g);for(var C=!1,F=r.return;F!==null;)F.childLanes|=g,j=F.alternate,j!==null&&(j.childLanes|=g),F.tag===22&&(r=F.stateNode,r===null||r._visibility&1||(C=!0)),r=F,F=F.return;return r.tag===3?(F=r.stateNode,C&&h!==null&&(C=31-Ls(g),r=F.hiddenUpdates,j=r[C],j===null?r[C]=[h]:j.push(h),h.lane=g|536870912),F):null}function x0(r){if(50<Bc)throw Bc=0,l4=null,Error(i(185));for(var h=r.return;h!==null;)r=h,h=r.return;return r.tag===3?r.stateNode:null}function Us(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function F1(r,h){r=r.updateQueue,h.updateQueue===r&&(h.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function xe(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Pn(r,h,g){var j=r.updateQueue;if(j===null)return null;if(j=j.shared,(Ne&2)!==0){var C=j.pending;return C===null?h.next=h:(h.next=C.next,C.next=h),j.pending=h,h=x0(r),y9(r,null,g),h}return z0(r,j,h,g),x0(r)}function t0(r,h,g){if(h=h.updateQueue,h!==null&&(h=h.shared,(g&4194048)!==0)){var j=h.lanes;j&=r.pendingLanes,g|=j,h.lanes=g,E(r,g)}}function B1(r,h){var{updateQueue:g,alternate:j}=r;if(j!==null&&(j=j.updateQueue,g===j)){var C=null,F=null;if(g=g.firstBaseUpdate,g!==null){do{var N={lane:g.lane,tag:g.tag,payload:g.payload,callback:null,next:null};F===null?C=F=N:F=F.next=N,g=g.next}while(g!==null);F===null?C=F=h:F=F.next=h}else C=F=h;g={baseState:j.baseState,firstBaseUpdate:C,lastBaseUpdate:F,shared:j.shared,callbacks:j.callbacks},r.updateQueue=g;return}r=g.lastBaseUpdate,r===null?g.firstBaseUpdate=h:r.next=h,g.lastBaseUpdate=h}function zl(){if(Q6){var r=Vr;if(r!==null)throw r}}function Is(r,h,g,j){Q6=!1;var C=r.updateQueue;tl=!1;var{firstBaseUpdate:F,lastBaseUpdate:N}=C,P=C.shared.pending;if(P!==null){C.shared.pending=null;var gt=P,yt=gt.next;gt.next=null,N===null?F=yt:N.next=yt,N=gt;var xt=r.alternate;xt!==null&&(xt=xt.updateQueue,P=xt.lastBaseUpdate,P!==N&&(P===null?xt.firstBaseUpdate=yt:P.next=yt,xt.lastBaseUpdate=gt))}if(F!==null){var Tt=C.baseState;N=0,xt=yt=gt=null,P=F;do{var Vt=P.lane&-536870913,Ae=Vt!==P.lane;if(Ae?(Ue&Vt)===Vt:(j&Vt)===Vt){Vt!==0&&Vt===Lr&&(Q6=!0),xt!==null&&(xt=xt.next={lane:0,tag:P.tag,payload:P.payload,callback:null,next:null});t:{var Ii=r,Oc=P;Vt=h;var yf=g;switch(Oc.tag){case 1:if(Ii=Oc.payload,typeof Ii==="function"){Tt=Ii.call(yf,Tt,Vt);break t}Tt=Ii;break t;case 3:Ii.flags=Ii.flags&-65537|128;case 0:if(Ii=Oc.payload,Vt=typeof Ii==="function"?Ii.call(yf,Tt,Vt):Ii,Vt===null||Vt===void 0)break t;Tt=fs({},Tt,Vt);break t;case 2:tl=!0}}Vt=P.callback,Vt!==null&&(r.flags|=64,Ae&&(r.flags|=8192),Ae=C.callbacks,Ae===null?C.callbacks=[Vt]:Ae.push(Vt))}else Ae={lane:Vt,tag:P.tag,payload:P.payload,callback:P.callback,next:null},xt===null?(yt=xt=Ae,gt=Tt):xt=xt.next=Ae,N|=Vt;if(P=P.next,P===null)if(P=C.shared.pending,P===null)break;else Ae=P,P=Ae.next,Ae.next=null,C.lastBaseUpdate=Ae,C.shared.pending=null}while(1);xt===null&&(gt=Tt),C.baseState=gt,C.firstBaseUpdate=yt,C.lastBaseUpdate=xt,F===null&&(C.shared.lanes=0),al|=N,r.lanes=N,r.memoizedState=Tt}}function ba(r,h){if(typeof r!=="function")throw Error(i(191,r));r.call(h)}function Mh(r,h){var g=r.callbacks;if(g!==null)for(r.callbacks=null,r=0;r<g.length;r++)ba(g[r],h)}function El(r,h){r=a1,w(zu,r),w(Zr,h),a1=r|h.baseLanes}function Dh(){w(zu,a1),w(Zr,Zr.current)}function Th(){a1=zu.current,p(Zr),p(zu)}function e0(r){var h=r.alternate;w($a,$a.current&1),w(Js,r),dn===null&&(h===null||Zr.current!==null?dn=r:h.memoizedState!==null&&(dn=r))}function br(r){w($a,$a.current),w(Js,r),dn===null&&(dn=r)}function pr(r){r.tag===22?(w($a,$a.current),w(Js,r),dn===null&&(dn=r)):hn(r)}function hn(){w($a,$a.current),w(Js,Js.current)}function Zi(r){p(Js),dn===r&&(dn=null),p($a)}function wr(r){for(var h=r;h!==null;){if(h.tag===13){var g=h.memoizedState;if(g!==null&&(g=g.dehydrated,g===null||R6(g)||N6(g)))return h}else if(h.tag===19&&(h.memoizedProps.revealOrder==="forwards"||h.memoizedProps.revealOrder==="backwards"||h.memoizedProps.revealOrder==="unstable_legacy-backwards"||h.memoizedProps.revealOrder==="together")){if((h.flags&128)!==0)return h}else if(h.child!==null){h.child.return=h,h=h.child;continue}if(h===r)break;for(;h.sibling===null;){if(h.return===null||h.return===r)return null;h=h.return}h.sibling.return=h.return,h=h.sibling}return null}function Ba(){throw Error(i(321))}function O1(r,h){if(h===null)return!1;for(var g=0;g<h.length&&g<r.length;g++)if(!Ys(r[g],h[g]))return!1;return!0}function H1(r,h,g,j,C,F){return t1=F,ke=h,h.memoizedState=null,h.updateQueue=null,h.lanes=0,fe.H=r===null||r.memoizedState===null?lw:Z6,vf=!1,F=g(j,C),vf=!1,$r&&(F=M1(h,g,j,C)),Rh(r),F}function Rh(r){fe.H=kc;var h=ua!==null&&ua.next!==null;if(t1=0,ni=ua=ke=null,Eu=!1,yc=0,Wr=null,h)throw Error(i(300));r===null||li||(r=r.dependencies,r!==null&&ce(r)&&(li=!0))}function M1(r,h,g,j){ke=r;var C=0;do{if($r&&(Wr=null),yc=0,$r=!1,25<=C)throw Error(i(301));if(C+=1,ni=ua=null,r.updateQueue!=null){var F=r.updateQueue;F.lastEffect=null,F.events=null,F.stores=null,F.memoCache!=null&&(F.memoCache.index=0)}fe.H=fw,F=h(g,j)}while($r);return F}function xl(){var r=fe.H,h=r.useState()[0];return h=typeof h.then==="function"?ds(h):h,r=r.useState()[0],(ua!==null?ua.memoizedState:null)!==r&&(ke.flags|=1024),h}function U0(){var r=xu!==0;return xu=0,r}function I0(r,h,g){h.updateQueue=r.updateQueue,h.flags&=-2053,r.lanes&=~g}function Nh(r){if(Eu){for(r=r.memoizedState;r!==null;){var h=r.queue;h!==null&&(h.pending=null),r=r.next}Eu=!1}t1=0,ni=ua=ke=null,$r=!1,yc=xu=0,Wr=null}function qi(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ni===null?ke.memoizedState=ni=r:ni=ni.next=r,ni}function Da(){if(ua===null){var r=ke.alternate;r=r!==null?r.memoizedState:null}else r=ua.next;var h=ni===null?ke.memoizedState:ni.next;if(h!==null)ni=h,ua=r;else{if(r===null){if(ke.alternate===null)throw Error(i(467));throw Error(i(310))}ua=r,r={memoizedState:ua.memoizedState,baseState:ua.baseState,baseQueue:ua.baseQueue,queue:ua.queue,next:null},ni===null?ke.memoizedState=ni=r:ni=ni.next=r}return ni}function jr(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ds(r){var h=yc;return yc+=1,Wr===null&&(Wr=[]),r=Oe(Wr,r,h),h=ke,(ni===null?h.memoizedState:ni.next)===null&&(h=h.alternate,fe.H=h===null||h.memoizedState===null?lw:Z6),r}function G0(r){if(r!==null&&typeof r==="object"){if(typeof r.then==="function")return ds(r);if(r.$$typeof===Q1)return Ee(r)}throw Error(i(438,String(r)))}function zh(r){var h=null,g=ke.updateQueue;if(g!==null&&(h=g.memoCache),h==null){var j=ke.alternate;j!==null&&(j=j.updateQueue,j!==null&&(j=j.memoCache,j!=null&&(h={data:j.data.map(function(C){return C.slice()}),index:0})))}if(h==null&&(h={data:[],index:0}),g===null&&(g=jr(),ke.updateQueue=g),g.memoCache=h,g=h.data[h.index],g===void 0)for(g=h.data[h.index]=Array(r),j=0;j<r;j++)g[j]=wO;return h.index++,g}function Gs(r,h){return typeof h==="function"?h(r):h}function D1(r){var h=Da();return ss(h,ua,r)}function ss(r,h,g){var j=r.queue;if(j===null)throw Error(i(311));j.lastRenderedReducer=g;var C=r.baseQueue,F=j.pending;if(F!==null){if(C!==null){var N=C.next;C.next=F.next,F.next=N}h.baseQueue=C=F,j.pending=null}if(F=r.baseState,C===null)r.memoizedState=F;else{h=C.next;var P=N=null,gt=null,yt=h,xt=!1;do{var Tt=yt.lane&-536870913;if(Tt!==yt.lane?(Ue&Tt)===Tt:(t1&Tt)===Tt){var Vt=yt.revertLane;if(Vt===0)gt!==null&&(gt=gt.next={lane:0,revertLane:0,gesture:null,action:yt.action,hasEagerState:yt.hasEagerState,eagerState:yt.eagerState,next:null}),Tt===Lr&&(xt=!0);else if((t1&Vt)===Vt){yt=yt.next,Vt===Lr&&(xt=!0);continue}else Tt={lane:0,revertLane:yt.revertLane,gesture:null,action:yt.action,hasEagerState:yt.hasEagerState,eagerState:yt.eagerState,next:null},gt===null?(P=gt=Tt,N=F):gt=gt.next=Tt,ke.lanes|=Vt,al|=Vt;Tt=yt.action,vf&&g(F,Tt),F=yt.hasEagerState?yt.eagerState:g(F,Tt)}else Vt={lane:Tt,revertLane:yt.revertLane,gesture:yt.gesture,action:yt.action,hasEagerState:yt.hasEagerState,eagerState:yt.eagerState,next:null},gt===null?(P=gt=Vt,N=F):gt=gt.next=Vt,ke.lanes|=Tt,al|=Tt;yt=yt.next}while(yt!==null&&yt!==h);if(gt===null?N=F:gt.next=P,!Ys(F,r.memoizedState)&&(li=!0,xt&&(g=Vr,g!==null)))throw g;r.memoizedState=F,r.baseState=N,r.baseQueue=gt,j.lastRenderedState=F}return C===null&&(j.lanes=0),[r.memoizedState,j.dispatch]}function Eh(r){var h=Da(),g=h.queue;if(g===null)throw Error(i(311));g.lastRenderedReducer=r;var{dispatch:j,pending:C}=g,F=h.memoizedState;if(C!==null){g.pending=null;var N=C=C.next;do F=r(F,N.action),N=N.next;while(N!==C);Ys(F,h.memoizedState)||(li=!0),h.memoizedState=F,h.baseQueue===null&&(h.baseState=F),g.lastRenderedState=F}return[F,j]}function Ul(r,h,g){var j=ke,C=Da(),F=Ke;if(F){if(g===void 0)throw Error(i(407));g=g()}else g=h();var N=!Ys((ua||C).memoizedState,g);if(N&&(C.memoizedState=g,li=!0),C=C.queue,qr(X0.bind(null,j,C,r),[r]),C.getSnapshot!==h||N||ni!==null&&ni.memoizedState.tag&1){if(j.flags|=2048,R1(9,{destroy:void 0},Il.bind(null,j,C,g,h),null),pa===null)throw Error(i(349));F||(t1&127)!==0||T1(j,h,g)}return g}function T1(r,h,g){r.flags|=16384,r={getSnapshot:h,value:g},h=ke.updateQueue,h===null?(h=jr(),ke.updateQueue=h,h.stores=[r]):(g=h.stores,g===null?h.stores=[r]:g.push(r))}function Il(r,h,g,j){h.value=g,h.getSnapshot=j,dr(h)&&xh(r)}function X0(r,h,g){return g(function(){dr(h)&&xh(r)})}function dr(r){var h=r.getSnapshot;r=r.value;try{var g=h();return!Ys(r,g)}catch(j){return!0}}function xh(r){var h=E0(r,2);h!==null&&vi(h,r,2)}function Gl(r){var h=qi();if(typeof r==="function"){var g=r;if(r=g(),vf){Q(!0);try{g()}finally{Q(!1)}}}return h.memoizedState=h.baseState=r,h.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gs,lastRenderedState:r},h}function k9(r,h,g,j){return r.baseState=g,ss(r,ua,typeof j==="function"?j:Gs)}function A6(r,h,g,j,C){if(K0(r))throw Error(i(485));if(r=h.action,r!==null){var F={payload:C,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(N){F.listeners.push(N)}};fe.T!==null?g(!0):F.isTransition=!1,j(F),g=h.pending,g===null?(F.next=h.pending=F,C9(h,F)):(F.next=g.next,h.pending=g.next=F)}}function C9(r,h){var{action:g,payload:j}=h,C=r.state;if(h.isTransition){var F=fe.T,N={};fe.T=N;try{var P=g(C,j),gt=fe.S;gt!==null&&gt(N,P),Xl(r,h,P)}catch(yt){Ih(r,h,yt)}finally{F!==null&&N.types!==null&&(F.types=N.types),fe.T=F}}else try{F=g(C,j),Xl(r,h,F)}catch(yt){Ih(r,h,yt)}}function Xl(r,h,g){g!==null&&typeof g==="object"&&typeof g.then==="function"?g.then(function(j){Uh(r,h,j)},function(j){return Ih(r,h,j)}):Uh(r,h,g)}function Uh(r,h,g){h.status="fulfilled",h.value=g,Gh(h),r.state=g,h=r.pending,h!==null&&(g=h.next,g===h?r.pending=null:(g=g.next,h.next=g,C9(r,g)))}function Ih(r,h,g){var j=r.pending;if(r.pending=null,j!==null){j=j.next;do h.status="rejected",h.reason=g,Gh(h),h=h.next;while(h!==j)}r.action=null}function Gh(r){r=r.listeners;for(var h=0;h<r.length;h++)(0,r[h])()}function _9(r,h){return h}function Xh(r,h){if(Ke){var g=pa.formState;if(g!==null){t:{var j=ke;if(Ke){if(Ta){var C=hH(Ta,wn);if(C){Ta=Gp(C),j=cH(C);break t}}Et(j)}j=!1}j&&(h=g[0])}}g=qi(),g.memoizedState=g.baseState=h,j={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_9,lastRenderedState:h},g.queue=j,g=Wl.bind(null,ke,j),j.dispatch=g,j=Gl(!1);var F=Xs.bind(null,ke,!1,j.queue);return j=qi(),C={state:h,dispatch:null,action:r,pending:null},j.queue=C,g=A6.bind(null,ke,C,F,g),C.dispatch=g,j.memoizedState=r,[h,g,!1]}function F9(r){var h=Da();return Kl(h,ua,r)}function Kl(r,h,g){if(h=ss(r,h,_9)[0],r=D1(Gs)[0],typeof h==="object"&&h!==null&&typeof h.then==="function")try{var j=ds(h)}catch(N){if(N===Yr)throw Ru;throw N}else j=h;h=Da();var C=h.queue,F=C.dispatch;return g!==h.memoizedState&&(ke.flags|=2048,R1(9,{destroy:void 0},Ll.bind(null,C,g),null)),[j,F,r]}function Ll(r,h){r.action=h}function Kh(r){var h=Da(),g=ua;if(g!==null)return Kl(h,g,r);Da(),h=h.memoizedState,g=Da();var j=g.queue.dispatch;return g.memoizedState=r,[h,j,!1]}function R1(r,h,g,j){return r={tag:r,create:g,deps:j,inst:h,next:null},h=ke.updateQueue,h===null&&(h=jr(),ke.updateQueue=h),g=h.lastEffect,g===null?h.lastEffect=r.next=r:(j=g.next,g.next=r,r.next=j,h.lastEffect=r),r}function B9(){return Da().memoizedState}function Vl(r,h,g,j){var C=qi();ke.flags|=r,C.memoizedState=R1(1|h,{destroy:void 0},g,j===void 0?null:j)}function Yl(r,h,g,j){var C=Da();j=j===void 0?null:j;var F=C.memoizedState.inst;ua!==null&&j!==null&&O1(j,ua.memoizedState.deps)?C.memoizedState=R1(h,F,g,j):(ke.flags|=r,C.memoizedState=R1(1|h,F,g,j))}function O9(r,h){Vl(8390656,8,r,h)}function qr(r,h){Yl(2048,8,r,h)}function v6(r){ke.flags|=4;var h=ke.updateQueue;if(h===null)h=jr(),ke.updateQueue=h,h.events=[r];else{var g=h.events;g===null?h.events=[r]:g.push(r)}}function H9(r){var h=Da().memoizedState;return v6({ref:h,nextImpl:r}),function(){if((Ne&2)!==0)throw Error(i(440));return h.impl.apply(void 0,arguments)}}function M9(r,h){return Yl(4,2,r,h)}function D9(r,h){return Yl(4,4,r,h)}function T9(r,h){if(typeof h==="function"){r=r();var g=h(r);return function(){typeof g==="function"?g():h(null)}}if(h!==null&&h!==void 0)return r=r(),h.current=r,function(){h.current=null}}function R9(r,h,g){g=g!==null&&g!==void 0?g.concat([r]):null,Yl(4,4,T9.bind(null,h,r),g)}function Jl(){}function N9(r,h){var g=Da();h=h===void 0?null:h;var j=g.memoizedState;if(h!==null&&O1(h,j[1]))return j[0];return g.memoizedState=[r,h],r}function Lh(r,h){var g=Da();h=h===void 0?null:h;var j=g.memoizedState;if(h!==null&&O1(h,j[1]))return j[0];if(j=r(),vf){Q(!0);try{r()}finally{Q(!1)}}return g.memoizedState=[j,h],j}function N1(r,h,g){if(g===void 0||(t1&1073741824)!==0&&(Ue&261930)===0)return r.memoizedState=h;return r.memoizedState=g,r=mc(),ke.lanes|=r,al|=r,g}function z9(r,h,g,j){if(Ys(g,h))return g;if(Zr.current!==null)return r=N1(r,g,j),Ys(r,h)||(li=!0),r;if((t1&42)===0||(t1&1073741824)!==0&&(Ue&261930)===0)return li=!0,r.memoizedState=g;return r=mc(),ke.lanes|=r,al|=r,h}function E9(r,h,g,j,C){var F=W0();Si(F!==0&&8>F?F:8);var N=fe.T,P={};fe.T=P,Xs(r,!1,h,g);try{var gt=C(),yt=fe.S;if(yt!==null&&yt(P,gt),gt!==null&&typeof gt==="object"&&typeof gt.then==="function"){var xt=on(gt,j);Ni(r,h,xt,vs(r))}else Ni(r,h,j,vs(r))}catch(Tt){Ni(r,h,{then:function(){},status:"rejected",reason:Tt},vs())}finally{Si(F),N!==null&&P.types!==null&&(N.types=P.types),fe.T=N}}function x9(r){var h=r.memoizedState;if(h!==null)return h;h={memoizedState:Er,baseState:Er,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gs,lastRenderedState:Er},next:null};var g={};return h.next={memoizedState:g,baseState:g,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gs,lastRenderedState:g},next:null},r.memoizedState=h,r=r.alternate,r!==null&&(r.memoizedState=h),h}function Vh(){return Ee(pf)}function U9(){return Da().memoizedState}function Ql(){return Da().memoizedState}function Zl(r){for(var h=r.return;h!==null;){switch(h.tag){case 24:case 3:var g=vs();r=xe(g);var j=Pn(h,r,g);j!==null&&(vi(j,h,g),t0(j,h,g)),h={cache:ji()},r.payload=h;return}h=h.return}}function $l(r,h,g){var j=vs();g={lane:j,revertLane:0,gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},K0(r)?Yh(h,g):(g=di(r,h,g,j),g!==null&&(vi(g,r,j),I9(g,h,j)))}function Wl(r,h,g){var j=vs();Ni(r,h,g,j)}function Ni(r,h,g,j){var C={lane:j,revertLane:0,gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null};if(K0(r))Yh(h,C);else{var F=r.alternate;if(r.lanes===0&&(F===null||F.lanes===0)&&(F=h.lastRenderedReducer,F!==null))try{var N=h.lastRenderedState,P=F(N,g);if(C.hasEagerState=!0,C.eagerState=P,Ys(P,N))return z0(r,h,C,0),pa===null&&_1(),!1}catch(gt){}finally{}if(g=di(r,h,C,j),g!==null)return vi(g,r,j),I9(g,h,j),!0}return!1}function Xs(r,h,g,j){if(j={lane:2,revertLane:Be(),gesture:null,action:j,hasEagerState:!1,eagerState:null,next:null},K0(r)){if(h)throw Error(i(479))}else h=di(r,g,j,2),h!==null&&vi(h,r,2)}function K0(r){var h=r.alternate;return r===ke||h!==null&&h===ke}function Yh(r,h){$r=Eu=!0;var g=r.pending;g===null?h.next=h:(h.next=g.next,g.next=h),r.pending=h}function I9(r,h,g){if((g&4194048)!==0){var j=h.lanes;j&=r.pendingLanes,g|=j,h.lanes=g,E(r,g)}}function Jh(r,h,g,j){h=r.memoizedState,g=g(j,h),g=g===null||g===void 0?h:fs({},h,g),r.memoizedState=g,r.lanes===0&&(r.updateQueue.baseState=g)}function G9(r,h,g,j,C,F,N){return r=r.stateNode,typeof r.shouldComponentUpdate==="function"?r.shouldComponentUpdate(j,F,N):h.prototype&&h.prototype.isPureReactComponent?!Ht(g,j)||!Ht(C,F):!0}function X9(r,h,g,j){r=h.state,typeof h.componentWillReceiveProps==="function"&&h.componentWillReceiveProps(g,j),typeof h.UNSAFE_componentWillReceiveProps==="function"&&h.UNSAFE_componentWillReceiveProps(g,j),h.state!==r&&$6.enqueueReplaceState(h,h.state,null)}function xn(r,h){var g=h;if("ref"in h){g={};for(var j in h)j!=="ref"&&(g[j]=h[j])}if(r=r.defaultProps){g===h&&(g=fs({},g));for(var C in r)g[C]===void 0&&(g[C]=r[C])}return g}function z1(r,h){try{var g=r.onUncaughtError;g(h.value,{componentStack:h.stack})}catch(j){setTimeout(function(){throw j})}}function E1(r,h,g){try{var j=r.onCaughtError;j(g.value,{componentStack:g.stack,errorBoundary:h.tag===1?h.stateNode:null})}catch(C){setTimeout(function(){throw C})}}function a0(r,h,g){return g=xe(g),g.tag=3,g.payload={element:null},g.callback=function(){z1(r,h)},g}function Pl(r){return r=xe(r),r.tag=3,r}function i0(r,h,g,j){var C=g.type.getDerivedStateFromError;if(typeof C==="function"){var F=j.value;r.payload=function(){return C(F)},r.callback=function(){E1(h,g,j)}}var N=g.stateNode;N!==null&&typeof N.componentDidCatch==="function"&&(r.callback=function(){E1(h,g,j),typeof C!=="function"&&(il===null?il=new Set([this]):il.add(this));var P=j.stack;this.componentDidCatch(j.value,{componentStack:P!==null?P:""})})}function S6(r,h,g,j,C){if(g.flags|=32768,j!==null&&typeof j==="object"&&typeof j.then==="function"){if(h=g.alternate,h!==null&&va(h,g,C,!0),g=Js.current,g!==null){switch(g.tag){case 31:case 13:return dn===null?mf():g.alternate===null&&Ka===0&&(Ka=3),g.flags&=-257,g.flags|=65536,g.lanes=C,j===Nu?g.flags|=16384:(h=g.updateQueue,h===null?g.updateQueue=new Set([j]):h.add(j),S(r,j,C)),!1;case 22:return g.flags|=65536,j===Nu?g.flags|=16384:(h=g.updateQueue,h===null?(h={transitions:null,markerInstances:null,retryQueue:new Set([j])},g.updateQueue=h):(g=h.retryQueue,g===null?h.retryQueue=new Set([j]):g.add(j)),S(r,j,C)),!1}throw Error(i(435,g.tag))}return S(r,j,C),mf(),!1}if(Ke)return h=Js.current,h!==null?((h.flags&65536)===0&&(h.flags|=256),h.flags|=65536,h.lanes=C,j!==X6&&(r=Error(i(422),{cause:j}),ae(nt(r,g)))):(j!==X6&&(h=Error(i(423),{cause:j}),ae(nt(h,g))),r=r.current.alternate,r.flags|=65536,C&=-C,r.lanes|=C,j=nt(j,g),C=a0(r.stateNode,j,C),B1(r,C),Ka!==4&&(Ka=2)),!1;var F=Error(i(520),{cause:j});if(F=nt(F,g),_c===null?_c=[F]:_c.push(F),Ka!==4&&(Ka=2),h===null)return!0;j=nt(j,g),g=h;do{switch(g.tag){case 3:return g.flags|=65536,r=C&-C,g.lanes|=r,r=a0(g.stateNode,j,r),B1(g,r),!1;case 1:if(h=g.type,F=g.stateNode,(g.flags&128)===0&&(typeof h.getDerivedStateFromError==="function"||F!==null&&typeof F.componentDidCatch==="function"&&(il===null||!il.has(F))))return g.flags|=65536,C&=-C,g.lanes|=C,C=Pl(C),i0(C,r,g,j),B1(g,C),!1}g=g.return}while(g!==null);return!1}function si(r,h,g,j){h.child=r===null?nw(h,null,g,j):Af(h,r.child,g,j)}function Qh(r,h,g,j,C){g=g.render;var F=h.ref;if("ref"in j){var N={};for(var P in j)P!=="ref"&&(N[P]=j[P])}else N=j;if(ii(h),j=H1(r,h,g,N,F,C),P=U0(),r!==null&&!li)return I0(r,h,C),cn(r,h,C);return Ke&&P&&ct(h),h.flags|=1,si(r,h,j,C),h.child}function Ar(r,h,g,j,C){if(r===null){var F=g.type;if(typeof F==="function"&&!it(F)&&F.defaultProps===void 0&&g.compare===null)return h.tag=15,h.type=F,K9(r,h,F,j,C);return r=wt(g.type,null,j,h,h.mode,C),r.ref=h.ref,r.return=h,h.child=r}if(F=r.child,!Ph(r,C)){var N=F.memoizedProps;if(g=g.compare,g=g!==null?g:Ht,g(N,j)&&r.ref===h.ref)return cn(r,h,C)}return h.flags|=1,r=ht(F,j),r.ref=h.ref,r.return=h,h.child=r}function K9(r,h,g,j,C){if(r!==null){var F=r.memoizedProps;if(Ht(F,j)&&r.ref===h.ref)if(li=!1,h.pendingProps=j=F,Ph(r,C))(r.flags&131072)!==0&&(li=!0);else return h.lanes=r.lanes,cn(r,h,C)}return kr(r,h,g,j,C)}function L9(r,h,g,j){var C=j.children,F=r!==null?r.memoizedState:null;if(r===null&&h.stateNode===null&&(h.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),j.mode==="hidden"){if((h.flags&128)!==0){if(F=F!==null?F.baseLanes|g:g,r!==null){j=h.child=r.child;for(C=0;j!==null;)C=C|j.lanes|j.childLanes,j=j.sibling;j=C&~F}else j=0,h.child=null;return ef(r,h,F,g,j)}if((g&536870912)!==0)h.memoizedState={baseLanes:0,cachePool:null},r!==null&&Pt(h,F!==null?F.cachePool:null),F!==null?El(h,F):Dh(),pr(h);else return j=h.lanes=536870912,ef(r,h,F!==null?F.baseLanes|g:g,g,j)}else F!==null?(Pt(h,F.cachePool),El(h,F),hn(h),h.memoizedState=null):(r!==null&&Pt(h,null),Dh(),hn(h));return si(r,h,C,g),h.child}function tf(r,h){return r!==null&&r.tag===22||h.stateNode!==null||(h.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.sibling}function ef(r,h,g,j,C){var F=Yt();return F=F===null?null:{parent:$0?Ra._currentValue:Ra._currentValue2,pool:F},h.memoizedState={baseLanes:g,cachePool:F},r!==null&&Pt(h,null),Dh(),pr(h),r!==null&&va(r,h,j,!0),h.childLanes=C,null}function vr(r,h){return h=lf({mode:h.mode,children:h.children},r.mode),h.ref=r.ref,r.child=h,h.return=r,h}function Sr(r,h,g){return Af(h,r.child,null,g),r=vr(h,h.pendingProps),r.flags|=2,Zi(h),h.memoizedState=null,r}function y6(r,h,g){var j=h.pendingProps,C=(h.flags&128)!==0;if(h.flags&=-129,r===null){if(Ke){if(j.mode==="hidden")return r=vr(h,j),h.lanes=536870912,tf(null,r);if(br(h),(r=Ta)?(r=qH(r,wn),r!==null&&(h.memoizedState={dehydrated:r,treeContext:$1!==null?{id:r0,overflow:o0}:null,retryLane:536870912,hydrationErrors:null},g=Za(r),g.return=h,h.child=g,Ui=h,Ta=null)):r=null,r===null)throw Et(h);return h.lanes=536870912,null}return vr(h,j)}var F=r.memoizedState;if(F!==null){var N=F.dehydrated;if(br(h),C)if(h.flags&256)h.flags&=-257,h=Sr(r,h,g);else if(h.memoizedState!==null)h.child=r.child,h.flags|=128,h=null;else throw Error(i(558));else if(li||va(r,h,g,!1),C=(g&r.childLanes)!==0,li||C){if(j=pa,j!==null&&(N=V(j,g),N!==0&&N!==F.retryLane))throw F.retryLane=N,E0(r,N),vi(j,r,N),W6;mf(),h=Sr(r,h,g)}else r=F.treeContext,Pi&&(Ta=bH(N),Ui=h,Ke=!0,P1=null,wn=!1,r!==null&&G(h,r)),h=vr(h,j),h.flags|=4096;return h}return r=ht(r.child,{mode:j.mode,children:j.children}),r.ref=h.ref,h.child=r,r.return=h,r}function yr(r,h){var g=h.ref;if(g===null)r!==null&&r.ref!==null&&(h.flags|=4194816);else{if(typeof g!=="function"&&typeof g!=="object")throw Error(i(284));if(r===null||r.ref!==g)h.flags|=4194816}}function kr(r,h,g,j,C){if(ii(h),g=H1(r,h,g,j,void 0,C),j=U0(),r!==null&&!li)return I0(r,h,C),cn(r,h,C);return Ke&&j&&ct(h),h.flags|=1,si(r,h,g,C),h.child}function af(r,h,g,j,C,F){if(ii(h),h.updateQueue=null,g=M1(h,j,g,C),Rh(r),j=U0(),r!==null&&!li)return I0(r,h,F),cn(r,h,F);return Ke&&j&&ct(h),h.flags|=1,si(r,h,g,F),h.child}function V9(r,h,g,j,C){if(ii(h),h.stateNode===null){var F=Ir,N=g.contextType;typeof N==="object"&&N!==null&&(F=Ee(N)),F=new g(j,F),h.memoizedState=F.state!==null&&F.state!==void 0?F.state:null,F.updater=$6,h.stateNode=F,F._reactInternals=h,F=h.stateNode,F.props=j,F.state=h.memoizedState,F.refs={},Us(h),N=g.contextType,F.context=typeof N==="object"&&N!==null?Ee(N):Ir,F.state=h.memoizedState,N=g.getDerivedStateFromProps,typeof N==="function"&&(Jh(h,g,N,j),F.state=h.memoizedState),typeof g.getDerivedStateFromProps==="function"||typeof F.getSnapshotBeforeUpdate==="function"||typeof F.UNSAFE_componentWillMount!=="function"&&typeof F.componentWillMount!=="function"||(N=F.state,typeof F.componentWillMount==="function"&&F.componentWillMount(),typeof F.UNSAFE_componentWillMount==="function"&&F.UNSAFE_componentWillMount(),N!==F.state&&$6.enqueueReplaceState(F,F.state,null),Is(h,j,F,C),zl(),F.state=h.memoizedState),typeof F.componentDidMount==="function"&&(h.flags|=4194308),j=!0}else if(r===null){F=h.stateNode;var P=h.memoizedProps,gt=xn(g,P);F.props=gt;var yt=F.context,xt=g.contextType;N=Ir,typeof xt==="object"&&xt!==null&&(N=Ee(xt));var Tt=g.getDerivedStateFromProps;xt=typeof Tt==="function"||typeof F.getSnapshotBeforeUpdate==="function",P=h.pendingProps!==P,xt||typeof F.UNSAFE_componentWillReceiveProps!=="function"&&typeof F.componentWillReceiveProps!=="function"||(P||yt!==N)&&X9(h,F,j,N),tl=!1;var Vt=h.memoizedState;F.state=Vt,Is(h,j,F,C),zl(),yt=h.memoizedState,P||Vt!==yt||tl?(typeof Tt==="function"&&(Jh(h,g,Tt,j),yt=h.memoizedState),(gt=tl||G9(h,g,gt,j,Vt,yt,N))?(xt||typeof F.UNSAFE_componentWillMount!=="function"&&typeof F.componentWillMount!=="function"||(typeof F.componentWillMount==="function"&&F.componentWillMount(),typeof F.UNSAFE_componentWillMount==="function"&&F.UNSAFE_componentWillMount()),typeof F.componentDidMount==="function"&&(h.flags|=4194308)):(typeof F.componentDidMount==="function"&&(h.flags|=4194308),h.memoizedProps=j,h.memoizedState=yt),F.props=j,F.state=yt,F.context=N,j=gt):(typeof F.componentDidMount==="function"&&(h.flags|=4194308),j=!1)}else{F=h.stateNode,F1(r,h),N=h.memoizedProps,xt=xn(g,N),F.props=xt,Tt=h.pendingProps,Vt=F.context,yt=g.contextType,gt=Ir,typeof yt==="object"&&yt!==null&&(gt=Ee(yt)),P=g.getDerivedStateFromProps,(yt=typeof P==="function"||typeof F.getSnapshotBeforeUpdate==="function")||typeof F.UNSAFE_componentWillReceiveProps!=="function"&&typeof F.componentWillReceiveProps!=="function"||(N!==Tt||Vt!==gt)&&X9(h,F,j,gt),tl=!1,Vt=h.memoizedState,F.state=Vt,Is(h,j,F,C),zl();var Ae=h.memoizedState;N!==Tt||Vt!==Ae||tl||r!==null&&r.dependencies!==null&&ce(r.dependencies)?(typeof P==="function"&&(Jh(h,g,P,j),Ae=h.memoizedState),(xt=tl||G9(h,g,xt,j,Vt,Ae,gt)||r!==null&&r.dependencies!==null&&ce(r.dependencies))?(yt||typeof F.UNSAFE_componentWillUpdate!=="function"&&typeof F.componentWillUpdate!=="function"||(typeof F.componentWillUpdate==="function"&&F.componentWillUpdate(j,Ae,gt),typeof F.UNSAFE_componentWillUpdate==="function"&&F.UNSAFE_componentWillUpdate(j,Ae,gt)),typeof F.componentDidUpdate==="function"&&(h.flags|=4),typeof F.getSnapshotBeforeUpdate==="function"&&(h.flags|=1024)):(typeof F.componentDidUpdate!=="function"||N===r.memoizedProps&&Vt===r.memoizedState||(h.flags|=4),typeof F.getSnapshotBeforeUpdate!=="function"||N===r.memoizedProps&&Vt===r.memoizedState||(h.flags|=1024),h.memoizedProps=j,h.memoizedState=Ae),F.props=j,F.state=Ae,F.context=gt,j=xt):(typeof F.componentDidUpdate!=="function"||N===r.memoizedProps&&Vt===r.memoizedState||(h.flags|=4),typeof F.getSnapshotBeforeUpdate!=="function"||N===r.memoizedProps&&Vt===r.memoizedState||(h.flags|=1024),j=!1)}return F=j,yr(r,h),j=(h.flags&128)!==0,F||j?(F=h.stateNode,g=j&&typeof g.getDerivedStateFromError!=="function"?null:F.render(),h.flags|=1,r!==null&&j?(h.child=Af(h,r.child,null,C),h.child=Af(h,null,g,C)):si(r,h,g,C),h.memoizedState=F.state,r=h.child):r=cn(r,h,C),r}function Y9(r,h,g,j){return Xt(),h.flags|=256,si(r,h,g,j),h.child}function Zh(r){return{baseLanes:r,cachePool:_t()}}function sf(r,h,g){return r=r!==null?r.childLanes&~g:0,h&&(r|=Zs),r}function J9(r,h,g){var j=h.pendingProps,C=!1,F=(h.flags&128)!==0,N;if((N=F)||(N=r!==null&&r.memoizedState===null?!1:($a.current&2)!==0),N&&(C=!0,h.flags&=-129),N=(h.flags&32)!==0,h.flags&=-33,r===null){if(Ke){if(C?e0(h):hn(h),(r=Ta)?(r=AH(r,wn),r!==null&&(h.memoizedState={dehydrated:r,treeContext:$1!==null?{id:r0,overflow:o0}:null,retryLane:536870912,hydrationErrors:null},g=Za(r),g.return=h,h.child=g,Ui=h,Ta=null)):r=null,r===null)throw Et(h);return N6(r)?h.lanes=32:h.lanes=536870912,null}var P=j.children;if(j=j.fallback,C)return hn(h),C=h.mode,P=lf({mode:"hidden",children:P},C),j=te(j,C,g,null),P.return=h,j.return=h,P.sibling=j,h.child=P,j=h.child,j.memoizedState=Zh(g),j.childLanes=sf(r,N,g),h.memoizedState=P6,tf(null,j);return e0(h),nf(h,P)}var gt=r.memoizedState;if(gt!==null&&(P=gt.dehydrated,P!==null)){if(F)h.flags&256?(e0(h),h.flags&=-257,h=$h(r,h,g)):h.memoizedState!==null?(hn(h),h.child=r.child,h.flags|=128,h=null):(hn(h),P=j.fallback,C=h.mode,j=lf({mode:"visible",children:j.children},C),P=te(P,C,g,null),P.flags|=2,j.return=h,P.return=h,j.sibling=P,h.child=j,Af(h,r.child,null,g),j=h.child,j.memoizedState=Zh(g),j.childLanes=sf(r,N,g),h.memoizedState=P6,h=tf(null,j));else if(e0(h),N6(P))N=rH(P).digest,j=Error(i(419)),j.stack="",j.digest=N,ae({value:j,source:null,stack:null}),h=$h(r,h,g);else if(li||va(r,h,g,!1),N=(g&r.childLanes)!==0,li||N){if(N=pa,N!==null&&(j=V(N,g),j!==0&&j!==gt.retryLane))throw gt.retryLane=j,E0(r,j),vi(N,r,j),W6;R6(P)||mf(),h=$h(r,h,g)}else R6(P)?(h.flags|=192,h.child=r.child,h=null):(r=gt.treeContext,Pi&&(Ta=pH(P),Ui=h,Ke=!0,P1=null,wn=!1,r!==null&&G(h,r)),h=nf(h,j.children),h.flags|=4096);return h}if(C)return hn(h),P=j.fallback,C=h.mode,gt=r.child,F=gt.sibling,j=ht(gt,{mode:"hidden",children:j.children}),j.subtreeFlags=gt.subtreeFlags&65011712,F!==null?P=ht(F,P):(P=te(P,C,g,null),P.flags|=2),P.return=h,j.return=h,j.sibling=P,h.child=j,tf(null,j),j=h.child,P=r.child.memoizedState,P===null?P=Zh(g):(C=P.cachePool,C!==null?(gt=$0?Ra._currentValue:Ra._currentValue2,C=C.parent!==gt?{parent:gt,pool:gt}:C):C=_t(),P={baseLanes:P.baseLanes|g,cachePool:C}),j.memoizedState=P,j.childLanes=sf(r,N,g),h.memoizedState=P6,tf(r.child,j);return e0(h),g=r.child,r=g.sibling,g=ht(g,{mode:"visible",children:j.children}),g.return=h,g.sibling=null,r!==null&&(N=h.deletions,N===null?(h.deletions=[r],h.flags|=16):N.push(r)),h.child=g,h.memoizedState=null,g}function nf(r,h){return h=lf({mode:"visible",children:h},r.mode),h.return=r,r.child=h}function lf(r,h){return r=e(22,r,null,h),r.lanes=0,r}function $h(r,h,g){return Af(h,r.child,null,g),r=nf(h,h.pendingProps.children),r.flags|=2,h.memoizedState=null,r}function Q9(r,h,g){r.lanes|=h;var j=r.alternate;j!==null&&(j.lanes|=h),da(r.return,h,g)}function Wh(r,h,g,j,C,F){var N=r.memoizedState;N===null?r.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:j,tail:g,tailMode:C,treeForkCount:F}:(N.isBackwards=h,N.rendering=null,N.renderingStartTime=0,N.last=j,N.tail=g,N.tailMode=C,N.treeForkCount=F)}function Z9(r,h,g){var j=h.pendingProps,C=j.revealOrder,F=j.tail;j=j.children;var N=$a.current,P=(N&2)!==0;if(P?(N=N&1|2,h.flags|=128):N&=1,w($a,N),si(r,h,j,g),j=Ke?qc:0,!P&&r!==null&&(r.flags&128)!==0)t:for(r=h.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Q9(r,g,h);else if(r.tag===19)Q9(r,g,h);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===h)break t;for(;r.sibling===null;){if(r.return===null||r.return===h)break t;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(C){case"forwards":g=h.child;for(C=null;g!==null;)r=g.alternate,r!==null&&wr(r)===null&&(C=g),g=g.sibling;g=C,g===null?(C=h.child,h.child=null):(C=g.sibling,g.sibling=null),Wh(h,!1,C,g,F,j);break;case"backwards":case"unstable_legacy-backwards":g=null,C=h.child;for(h.child=null;C!==null;){if(r=C.alternate,r!==null&&wr(r)===null){h.child=C;break}r=C.sibling,C.sibling=g,g=C,C=r}Wh(h,!0,g,null,F,j);break;case"together":Wh(h,!1,null,null,void 0,j);break;default:h.memoizedState=null}return h.child}function cn(r,h,g){if(r!==null&&(h.dependencies=r.dependencies),al|=h.lanes,(g&h.childLanes)===0)if(r!==null){if(va(r,h,g,!1),(g&h.childLanes)===0)return null}else return null;if(r!==null&&h.child!==r.child)throw Error(i(153));if(h.child!==null){r=h.child,g=ht(r,r.pendingProps),h.child=g;for(g.return=h;r.sibling!==null;)r=r.sibling,g=g.sibling=ht(r,r.pendingProps),g.return=h;g.sibling=null}return h.child}function Ph(r,h){if((r.lanes&h)!==0)return!0;return r=r.dependencies,r!==null&&ce(r)?!0:!1}function $9(r,h,g){switch(h.tag){case 3:Ct(h,h.stateNode.containerInfo),Xe(h,Ra,r.memoizedState.cache),Xt();break;case 27:case 5:le(h);break;case 4:Ct(h,h.stateNode.containerInfo);break;case 10:Xe(h,h.type,h.memoizedProps.value);break;case 31:if(h.memoizedState!==null)return h.flags|=128,br(h),null;break;case 13:var j=h.memoizedState;if(j!==null){if(j.dehydrated!==null)return e0(h),h.flags|=128,null;if((g&h.child.childLanes)!==0)return J9(r,h,g);return e0(h),r=cn(r,h,g),r!==null?r.sibling:null}e0(h);break;case 19:var C=(r.flags&128)!==0;if(j=(g&h.childLanes)!==0,j||(va(r,h,g,!1),j=(g&h.childLanes)!==0),C){if(j)return Z9(r,h,g);h.flags|=128}if(C=h.memoizedState,C!==null&&(C.rendering=null,C.tail=null,C.lastEffect=null),w($a,$a.current),j)break;else return null;case 22:return h.lanes=0,L9(r,h,g,h.pendingProps);case 24:Xe(h,Ra,r.memoizedState.cache)}return cn(r,h,g)}function W9(r,h,g){if(r!==null)if(r.memoizedProps!==h.pendingProps)li=!0;else{if(!Ph(r,g)&&(h.flags&128)===0)return li=!1,$9(r,h,g);li=(r.flags&131072)!==0?!0:!1}else li=!1,Ke&&(h.flags&1048576)!==0&&R(h,qc,h.index);switch(h.lanes=0,h.tag){case 16:t:{var j=h.pendingProps;if(r=Ma(h.elementType),h.type=r,typeof r==="function")it(r)?(j=xn(r,j),h.tag=1,h=V9(null,h,r,j,g)):(h.tag=0,h=kr(null,h,r,j,g));else{if(r!==void 0&&r!==null){var C=r.$$typeof;if(C===F6){h.tag=11,h=Qh(null,h,r,j,g);break t}else if(C===H6){h.tag=14,h=Ar(null,h,r,j,g);break t}}throw h=u(r)||r,Error(i(306,h,""))}}return h;case 0:return kr(r,h,h.type,h.pendingProps,g);case 1:return j=h.type,C=xn(j,h.pendingProps),V9(r,h,j,C,g);case 3:t:{if(Ct(h,h.stateNode.containerInfo),r===null)throw Error(i(387));var F=h.pendingProps;C=h.memoizedState,j=C.element,F1(r,h),Is(h,F,null,g);var N=h.memoizedState;if(F=N.cache,Xe(h,Ra,F),F!==C.cache&&Ve(h,[Ra],g,!0),zl(),F=N.element,Pi&&C.isDehydrated)if(C={element:F,isDehydrated:!1,cache:N.cache},h.updateQueue.baseState=C,h.memoizedState=C,h.flags&256){h=Y9(r,h,F,g);break t}else if(F!==j){j=nt(Error(i(424)),h),ae(j),h=Y9(r,h,F,g);break t}else for(Pi&&(Ta=gH(h.stateNode.containerInfo),Ui=h,Ke=!0,P1=null,wn=!0),g=nw(h,null,F,g),h.child=g;g;)g.flags=g.flags&-3|4096,g=g.sibling;else{if(Xt(),F===j){h=cn(r,h,g);break t}si(r,h,F,g)}h=h.child}return h;case 26:if(Gn)return yr(r,h),r===null?(g=Lp(h.type,null,h.pendingProps,null))?h.memoizedState=g:Ke||(h.stateNode=IH(h.type,h.pendingProps,W1.current,h)):h.memoizedState=Lp(h.type,r.memoizedProps,h.pendingProps,r.memoizedState),null;case 27:if(gi)return le(h),r===null&&gi&&Ke&&(j=h.stateNode=$p(h.type,h.pendingProps,W1.current,xi.current,!1),Ui=h,wn=!0,Ta=wH(h.type,j,Ta)),si(r,h,h.pendingProps.children,g),yr(r,h),r===null&&(h.flags|=4194304),h.child;case 5:if(r===null&&Ke){if(EH(h.type,h.pendingProps,xi.current),C=j=Ta)j=jH(j,h.type,h.pendingProps,wn),j!==null?(h.stateNode=j,Ui=h,Ta=mH(j),wn=!1,C=!0):C=!1;C||Et(h)}return le(h),C=h.type,F=h.pendingProps,N=r!==null?r.memoizedProps:null,j=F.children,ku(C,F)?j=null:N!==null&&ku(C,N)&&(h.flags|=32),h.memoizedState!==null&&(C=H1(r,h,xl,null,null,g),$0?pf._currentValue=C:pf._currentValue2=C),yr(r,h),si(r,h,j,g),h.child;case 6:if(r===null&&Ke){if(xH(h.pendingProps,xi.current),r=g=Ta)g=dH(g,h.pendingProps,wn),g!==null?(h.stateNode=g,Ui=h,Ta=null,r=!0):r=!1;r||Et(h)}return null;case 13:return J9(r,h,g);case 4:return Ct(h,h.stateNode.containerInfo),j=h.pendingProps,r===null?h.child=Af(h,null,j,g):si(r,h,j,g),h.child;case 11:return Qh(r,h,h.type,h.pendingProps,g);case 7:return si(r,h,h.pendingProps,g),h.child;case 8:return si(r,h,h.pendingProps.children,g),h.child;case 12:return si(r,h,h.pendingProps.children,g),h.child;case 10:return j=h.pendingProps,Xe(h,h.type,j.value),si(r,h,j.children,g),h.child;case 9:return C=h.type._context,j=h.pendingProps.children,ii(h),C=Ee(C),j=j(C),h.flags|=1,si(r,h,j,g),h.child;case 14:return Ar(r,h,h.type,h.pendingProps,g);case 15:return K9(r,h,h.type,h.pendingProps,g);case 19:return Z9(r,h,g);case 31:return y6(r,h,g);case 22:return L9(r,h,g,h.pendingProps);case 24:return ii(h),j=Ee(Ra),r===null?(C=Yt(),C===null&&(C=pa,F=ji(),C.pooledCache=F,F.refCount++,F!==null&&(C.pooledCacheLanes|=g),C=F),h.memoizedState={parent:j,cache:C},Us(h),Xe(h,Ra,C)):((r.lanes&g)!==0&&(F1(r,h),Is(h,null,null,g),zl()),C=r.memoizedState,F=h.memoizedState,C.parent!==j?(C={parent:j,cache:j},h.memoizedState=C,h.lanes===0&&(h.memoizedState=h.updateQueue.baseState=C),Xe(h,Ra,j)):(j=F.cache,Xe(h,Ra,j),j!==C.cache&&Ve(h,[Ra],g,!0))),si(r,h,h.pendingProps.children,g),h.child;case 29:throw h.pendingProps}throw Error(i(156,h.tag))}function qs(r){r.flags|=4}function Qa(r){f0&&(r.flags|=8)}function Cr(r,h){if(r!==null&&r.child===h.child)return!1;if((h.flags&16)!==0)return!0;for(r=h.child;r!==null;){if((r.flags&8218)!==0||(r.subtreeFlags&8218)!==0)return!0;r=r.sibling}return!1}function $i(r,h,g,j){if(Wi)for(g=h.child;g!==null;){if(g.tag===5||g.tag===6)D6(r,g.stateNode);else if(!(g.tag===4||gi&&g.tag===27)&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===h)break;for(;g.sibling===null;){if(g.return===null||g.return===h)return;g=g.return}g.sibling.return=g.return,g=g.sibling}else if(f0)for(var C=h.child;C!==null;){if(C.tag===5){var F=C.stateNode;g&&j&&(F=Up(F,C.type,C.memoizedProps)),D6(r,F)}else if(C.tag===6)F=C.stateNode,g&&j&&(F=Ip(F,C.memoizedProps)),D6(r,F);else if(C.tag!==4){if(C.tag===22&&C.memoizedState!==null)F=C.child,F!==null&&(F.return=C),$i(r,C,!0,!0);else if(C.child!==null){C.child.return=C,C=C.child;continue}}if(C===h)break;for(;C.sibling===null;){if(C.return===null||C.return===h)return;C=C.return}C.sibling.return=C.return,C=C.sibling}}function x1(r,h,g,j){var C=!1;if(f0)for(var F=h.child;F!==null;){if(F.tag===5){var N=F.stateNode;g&&j&&(N=Up(N,F.type,F.memoizedProps)),Ep(r,N)}else if(F.tag===6)N=F.stateNode,g&&j&&(N=Ip(N,F.memoizedProps)),Ep(r,N);else if(F.tag!==4){if(F.tag===22&&F.memoizedState!==null)C=F.child,C!==null&&(C.return=F),x1(r,F,!0,!0),C=!0;else if(F.child!==null){F.child.return=F,F=F.child;continue}}if(F===h)break;for(;F.sibling===null;){if(F.return===null||F.return===h)return C;F=F.return}F.sibling.return=F.return,F=F.sibling}return C}function P9(r,h){if(f0&&Cr(r,h)){r=h.stateNode;var g=r.containerInfo,j=zp();x1(j,h,!1,!1),r.pendingChildren=j,qs(h),fH(g,j)}}function tc(r,h,g,j){if(Wi)r.memoizedProps!==j&&qs(h);else if(f0){var{stateNode:C,memoizedProps:F}=r;if((r=Cr(r,h))||F!==j){var N=xi.current;F=lH(C,g,F,j,!r,null),F===C?h.stateNode=C:(Qa(h),Mp(F,g,j,N)&&qs(h),h.stateNode=F,r&&$i(F,h,!1,!1))}else h.stateNode=C}}function un(r,h,g,j,C){if((r.mode&32)!==0&&(g===null?DO(h,j):TO(h,g,j))){if(r.flags|=16777216,(C&335544128)===C||T6(h,j))if(Tp(r.stateNode,h,j))r.flags|=8192;else if(Tr())r.flags|=8192;else throw qf=Nu,Y6}else r.flags&=-16777217}function ec(r,h){if(XH(h)){if(r.flags|=16777216,!Zp(h))if(Tr())r.flags|=8192;else throw qf=Nu,Y6}else r.flags&=-16777217}function _r(r,h){h!==null&&(r.flags|=4),r.flags&16384&&(h=r.tag!==22?H():536870912,r.lanes|=h,eo|=h)}function ff(r,h){if(!Ke)switch(r.tailMode){case"hidden":h=r.tail;for(var g=null;h!==null;)h.alternate!==null&&(g=h),h=h.sibling;g===null?r.tail=null:g.sibling=null;break;case"collapsed":g=r.tail;for(var j=null;g!==null;)g.alternate!==null&&(j=g),g=g.sibling;j===null?h||r.tail===null?r.tail=null:r.tail.sibling=null:j.sibling=null}}function Pe(r){var h=r.alternate!==null&&r.alternate.child===r.child,g=0,j=0;if(h)for(var C=r.child;C!==null;)g|=C.lanes|C.childLanes,j|=C.subtreeFlags&65011712,j|=C.flags&65011712,C.return=r,C=C.sibling;else for(C=r.child;C!==null;)g|=C.lanes|C.childLanes,j|=C.subtreeFlags,j|=C.flags,C.return=r,C=C.sibling;return r.subtreeFlags|=j,r.childLanes=g,h}function k6(r,h,g){var j=h.pendingProps;switch(pt(h),h.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pe(h),null;case 1:return Pe(h),null;case 3:if(g=h.stateNode,j=null,r!==null&&(j=r.memoizedState.cache),h.memoizedState.cache!==j&&(h.flags|=2048),Re(Ra),Kt(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),r===null||r.child===null)Mt(h)?qs(h):r===null||r.memoizedState.isDehydrated&&(h.flags&256)===0||(h.flags|=1024,Gt());return P9(r,h),Pe(h),null;case 26:if(Gn){var{type:C,memoizedState:F}=h;return r===null?(qs(h),F!==null?(Pe(h),ec(h,F)):(Pe(h),un(h,C,null,j,g))):F?F!==r.memoizedState?(qs(h),Pe(h),ec(h,F)):(Pe(h),h.flags&=-16777217):(F=r.memoizedProps,Wi?F!==j&&qs(h):tc(r,h,C,j),Pe(h),un(h,C,F,j,g)),null}case 27:if(gi){if(Ft(h),g=W1.current,C=h.type,r!==null&&h.stateNode!=null)Wi?r.memoizedProps!==j&&qs(h):tc(r,h,C,j);else{if(!j){if(h.stateNode===null)throw Error(i(166));return Pe(h),null}r=xi.current,Mt(h)?$t(h,r):(r=$p(C,j,g,r,!0),h.stateNode=r,qs(h))}return Pe(h),null}case 5:if(Ft(h),C=h.type,r!==null&&h.stateNode!=null)tc(r,h,C,j);else{if(!j){if(h.stateNode===null)throw Error(i(166));return Pe(h),null}if(F=xi.current,Mt(h))$t(h,F),MH(h.stateNode,C,j,F)&&(h.flags|=64);else{var N=kO(C,j,W1.current,F,h);Qa(h),$i(N,h,!1,!1),h.stateNode=N,Mp(N,C,j,F)&&qs(h)}}return Pe(h),un(h,h.type,r===null?null:r.memoizedProps,h.pendingProps,g),null;case 6:if(r&&h.stateNode!=null)g=r.memoizedProps,Wi?g!==j&&qs(h):f0&&(g!==j?(r=W1.current,g=xi.current,Qa(h),h.stateNode=Dp(j,r,g,h)):h.stateNode=r.stateNode);else{if(typeof j!=="string"&&h.stateNode===null)throw Error(i(166));if(r=W1.current,g=xi.current,Mt(h)){if(!Pi)throw Error(i(176));if(r=h.stateNode,g=h.memoizedProps,j=null,C=Ui,C!==null)switch(C.tag){case 27:case 5:j=C.memoizedProps}SH(r,g,h,j)||Et(h,!0)}else Qa(h),h.stateNode=Dp(j,r,g,h)}return Pe(h),null;case 31:if(g=h.memoizedState,r===null||r.memoizedState!==null){if(j=Mt(h),g!==null){if(r===null){if(!j)throw Error(i(318));if(!Pi)throw Error(i(556));if(r=h.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));yH(r,h)}else Xt(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;Pe(h),r=!1}else g=Gt(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=g),r=!0;if(!r){if(h.flags&256)return Zi(h),h;return Zi(h),null}if((h.flags&128)!==0)throw Error(i(558))}return Pe(h),null;case 13:if(j=h.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(C=Mt(h),j!==null&&j.dehydrated!==null){if(r===null){if(!C)throw Error(i(318));if(!Pi)throw Error(i(344));if(C=h.memoizedState,C=C!==null?C.dehydrated:null,!C)throw Error(i(317));kH(C,h)}else Xt(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;Pe(h),C=!1}else C=Gt(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=C),C=!0;if(!C){if(h.flags&256)return Zi(h),h;return Zi(h),null}}if(Zi(h),(h.flags&128)!==0)return h.lanes=g,h;return g=j!==null,r=r!==null&&r.memoizedState!==null,g&&(j=h.child,C=null,j.alternate!==null&&j.alternate.memoizedState!==null&&j.alternate.memoizedState.cachePool!==null&&(C=j.alternate.memoizedState.cachePool.pool),F=null,j.memoizedState!==null&&j.memoizedState.cachePool!==null&&(F=j.memoizedState.cachePool.pool),F!==C&&(j.flags|=2048)),g!==r&&g&&(h.child.flags|=8192),_r(h,h.updateQueue),Pe(h),null;case 4:return Kt(),P9(r,h),r===null&&BO(h.stateNode.containerInfo),Pe(h),null;case 10:return Re(h.type),Pe(h),null;case 19:if(p($a),j=h.memoizedState,j===null)return Pe(h),null;if(C=(h.flags&128)!==0,F=j.rendering,F===null)if(C)ff(j,!1);else{if(Ka!==0||r!==null&&(r.flags&128)!==0)for(r=h.child;r!==null;){if(F=wr(r),F!==null){h.flags|=128,ff(j,!1),r=F.updateQueue,h.updateQueue=r,_r(h,r),h.subtreeFlags=0,r=g;for(g=h.child;g!==null;)zt(g,r),g=g.sibling;return w($a,$a.current&1|2),Ke&&qt(h,j.treeForkCount),h.child}r=r.sibling}j.tail!==null&&Ss()>Fc&&(h.flags|=128,C=!0,ff(j,!1),h.lanes=4194304)}else{if(!C)if(r=wr(F),r!==null){if(h.flags|=128,C=!0,r=r.updateQueue,h.updateQueue=r,_r(h,r),ff(j,!0),j.tail===null&&j.tailMode==="hidden"&&!F.alternate&&!Ke)return Pe(h),null}else 2*Ss()-j.renderingStartTime>Fc&&g!==536870912&&(h.flags|=128,C=!0,ff(j,!1),h.lanes=4194304);j.isBackwards?(F.sibling=h.child,h.child=F):(r=j.last,r!==null?r.sibling=F:h.child=F,j.last=F)}if(j.tail!==null)return r=j.tail,j.rendering=r,j.tail=r.sibling,j.renderingStartTime=Ss(),r.sibling=null,g=$a.current,w($a,C?g&1|2:g&1),Ke&&qt(h,j.treeForkCount),r;return Pe(h),null;case 22:case 23:return Zi(h),Th(),j=h.memoizedState!==null,r!==null?r.memoizedState!==null!==j&&(h.flags|=8192):j&&(h.flags|=8192),j?(g&536870912)!==0&&(h.flags&128)===0&&(Pe(h),h.subtreeFlags&6&&(h.flags|=8192)):Pe(h),g=h.updateQueue,g!==null&&_r(h,g.retryQueue),g=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(g=r.memoizedState.cachePool.pool),j=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(j=h.memoizedState.cachePool.pool),j!==g&&(h.flags|=2048),r!==null&&p(df),null;case 24:return g=null,r!==null&&(g=r.memoizedState.cache),h.memoizedState.cache!==g&&(h.flags|=2048),Re(Ra),Pe(h),null;case 25:return null;case 30:return null}throw Error(i(156,h.tag))}function C6(r,h){switch(pt(h),h.tag){case 1:return r=h.flags,r&65536?(h.flags=r&-65537|128,h):null;case 3:return Re(Ra),Kt(),r=h.flags,(r&65536)!==0&&(r&128)===0?(h.flags=r&-65537|128,h):null;case 26:case 27:case 5:return Ft(h),null;case 31:if(h.memoizedState!==null){if(Zi(h),h.alternate===null)throw Error(i(340));Xt()}return r=h.flags,r&65536?(h.flags=r&-65537|128,h):null;case 13:if(Zi(h),r=h.memoizedState,r!==null&&r.dehydrated!==null){if(h.alternate===null)throw Error(i(340));Xt()}return r=h.flags,r&65536?(h.flags=r&-65537|128,h):null;case 19:return p($a),null;case 4:return Kt(),null;case 10:return Re(h.type),null;case 22:case 23:return Zi(h),Th(),r!==null&&p(df),r=h.flags,r&65536?(h.flags=r&-65537|128,h):null;case 24:return Re(Ra),null;case 25:return null;default:return null}}function tu(r,h){switch(pt(h),h.tag){case 3:Re(Ra),Kt();break;case 26:case 27:case 5:Ft(h);break;case 4:Kt();break;case 31:h.memoizedState!==null&&Zi(h);break;case 13:Zi(h);break;case 19:p($a);break;case 10:Re(h.type);break;case 22:case 23:Zi(h),Th(),r!==null&&p(df);break;case 24:Re(Ra)}}function rf(r,h){try{var g=h.updateQueue,j=g!==null?g.lastEffect:null;if(j!==null){var C=j.next;g=C;do{if((g.tag&r)===r){j=void 0;var{create:F,inst:N}=g;j=F(),N.destroy=j}g=g.next}while(g!==C)}}catch(P){A(h,h.return,P)}}function Un(r,h,g){try{var j=h.updateQueue,C=j!==null?j.lastEffect:null;if(C!==null){var F=C.next;j=F;do{if((j.tag&r)===r){var N=j.inst,P=N.destroy;if(P!==void 0){N.destroy=void 0,C=h;var gt=g,yt=P;try{yt()}catch(xt){A(C,gt,xt)}}}j=j.next}while(j!==F)}}catch(xt){A(h,h.return,xt)}}function eu(r){var h=r.updateQueue;if(h!==null){var g=r.stateNode;try{Mh(h,g)}catch(j){A(r,r.return,j)}}}function U1(r,h,g){g.props=xn(r.type,r.memoizedProps),g.state=r.memoizedState;try{g.componentWillUnmount()}catch(j){A(r,h,j)}}function I1(r,h){try{var g=r.ref;if(g!==null){switch(r.tag){case 26:case 27:case 5:var j=pc(r.stateNode);break;case 30:j=r.stateNode;break;default:j=r.stateNode}typeof g==="function"?r.refCleanup=g(j):g.current=j}}catch(C){A(r,h,C)}}function ns(r,h){var{ref:g,refCleanup:j}=r;if(g!==null)if(typeof j==="function")try{j()}catch(C){A(r,h,C)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof g==="function")try{g(null)}catch(C){A(r,h,C)}else g.current=null}function G1(r){var{type:h,memoizedProps:g,stateNode:j}=r;try{QO(j,h,g,r)}catch(C){A(r,r.return,C)}}function ya(r,h,g){try{ZO(r.stateNode,r.type,g,h,r)}catch(j){A(r,r.return,j)}}function L0(r){return r.tag===5||r.tag===3||(Gn?r.tag===26:!1)||(gi?r.tag===27&&xr(r.type):!1)||r.tag===4}function of(r){t:for(;;){for(;r.sibling===null;){if(r.return===null||L0(r.return))return null;r=r.return}r.sibling.return=r.return;for(r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(gi&&r.tag===27&&xr(r.type))continue t;if(r.flags&2)continue t;if(r.child===null||r.tag===4)continue t;else r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function ac(r,h,g){var j=r.tag;if(j===5||j===6)r=r.stateNode,h?WO(g,r,h):YO(g,r);else if(j!==4&&(gi&&j===27&&xr(r.type)&&(g=r.stateNode,h=null),r=r.child,r!==null))for(ac(r,h,g),r=r.sibling;r!==null;)ac(r,h,g),r=r.sibling}function Fr(r,h,g){var j=r.tag;if(j===5||j===6)r=r.stateNode,h?$O(g,r,h):VO(g,r);else if(j!==4&&(gi&&j===27&&xr(r.type)&&(g=r.stateNode),r=r.child,r!==null))for(Fr(r,h,g),r=r.sibling;r!==null;)Fr(r,h,g),r=r.sibling}function au(r,h,g){r=r.containerInfo;try{xp(r,g)}catch(j){A(h,h.return,j)}}function iu(r){var{stateNode:h,memoizedProps:g}=r;try{LH(r.type,g,h,r)}catch(j){A(r,r.return,j)}}function su(r,h){SO(r.containerInfo);for(yi=h;yi!==null;)if(r=yi,h=r.child,(r.subtreeFlags&1028)!==0&&h!==null)h.return=r,yi=h;else for(;yi!==null;){r=yi;var g=r.alternate;switch(h=r.flags,r.tag){case 0:if((h&4)!==0&&(h=r.updateQueue,h=h!==null?h.events:null,h!==null))for(var j=0;j<h.length;j++){var C=h[j];C.ref.impl=C.nextImpl}break;case 11:case 15:break;case 1:if((h&1024)!==0&&g!==null){h=void 0,j=r,C=g.memoizedProps,g=g.memoizedState;var F=j.stateNode;try{var N=xn(j.type,C);h=F.getSnapshotBeforeUpdate(N,g),F.__reactInternalSnapshotBeforeUpdate=h}catch(P){A(j,j.return,P)}}break;case 3:(h&1024)!==0&&Wi&&nH(r.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((h&1024)!==0)throw Error(i(163))}if(h=r.sibling,h!==null){h.return=r.return,yi=h;break}yi=r.return}}function ic(r,h,g){var j=g.flags;switch(g.tag){case 0:case 11:case 15:In(r,g),j&4&&rf(5,g);break;case 1:if(In(r,g),j&4)if(r=g.stateNode,h===null)try{r.componentDidMount()}catch(N){A(g,g.return,N)}else{var C=xn(g.type,h.memoizedProps);h=h.memoizedState;try{r.componentDidUpdate(C,h,r.__reactInternalSnapshotBeforeUpdate)}catch(N){A(g,g.return,N)}}j&64&&eu(g),j&512&&I1(g,g.return);break;case 3:if(In(r,g),j&64&&(j=g.updateQueue,j!==null)){if(r=null,g.child!==null)switch(g.child.tag){case 27:case 5:r=pc(g.child.stateNode);break;case 1:r=g.child.stateNode}try{Mh(j,r)}catch(N){A(g,g.return,N)}}break;case 27:gi&&h===null&&j&4&&iu(g);case 26:case 5:if(In(r,g),h===null){if(j&4)G1(g);else if(j&64){r=g.type,h=g.memoizedProps,C=g.stateNode;try{FH(C,r,h,g)}catch(N){A(g,g.return,N)}}}j&512&&I1(g,g.return);break;case 12:In(r,g);break;case 31:In(r,g),j&4&&Or(r,g);break;case 13:In(r,g),j&4&&nc(r,g),j&64&&(j=g.memoizedState,j!==null&&(j=j.dehydrated,j!==null&&(g=U.bind(null,g),oH(j,g))));break;case 22:if(j=g.memoizedState!==null||e1,!j){h=h!==null&&h.memoizedState!==null||fi,C=e1;var F=fi;e1=j,(fi=h)&&!F?mn(r,g,(g.subtreeFlags&8772)!==0):In(r,g),e1=C,fi=F}break;case 30:break;default:In(r,g)}}function sc(r){var h=r.alternate;h!==null&&(r.alternate=null,sc(h)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(h=r.stateNode,h!==null&&MO(h)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function As(r,h,g){for(g=g.child;g!==null;)Br(r,h,g),g=g.sibling}function Br(r,h,g){if(Vs&&typeof Vs.onCommitFiberUnmount==="function")try{Vs.onCommitFiberUnmount(dc,g)}catch(F){}switch(g.tag){case 26:if(Gn){fi||ns(g,h),As(r,h,g),g.memoizedState?Yp(g.memoizedState):g.stateNode&&Qp(g.stateNode);break}case 27:if(gi){fi||ns(g,h);var j=ri,C=ys;xr(g.type)&&(ri=g.stateNode,ys=!1),As(r,h,g),Wp(g.stateNode),ri=j,ys=C;break}case 5:fi||ns(g,h);case 6:if(Wi){if(j=ri,C=ys,ri=null,As(r,h,g),ri=j,ys=C,ri!==null)if(ys)try{tH(ri,g.stateNode)}catch(F){A(g,h,F)}else try{PO(ri,g.stateNode)}catch(F){A(g,h,F)}}else As(r,h,g);break;case 18:Wi&&ri!==null&&(ys?RH(ri,g.stateNode):TH(ri,g.stateNode));break;case 4:Wi?(j=ri,C=ys,ri=g.stateNode.containerInfo,ys=!0,As(r,h,g),ri=j,ys=C):(f0&&au(g.stateNode,g,zp()),As(r,h,g));break;case 0:case 11:case 14:case 15:Un(2,g,h),fi||Un(4,g,h),As(r,h,g);break;case 1:fi||(ns(g,h),j=g.stateNode,typeof j.componentWillUnmount==="function"&&U1(g,h,j)),As(r,h,g);break;case 21:As(r,h,g);break;case 22:fi=(j=fi)||g.memoizedState!==null,As(r,h,g),fi=j;break;default:As(r,h,g)}}function Or(r,h){if(Pi&&h.memoizedState===null&&(r=h.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{OH(r)}catch(g){A(h,h.return,g)}}}function nc(r,h){if(Pi&&h.memoizedState===null&&(r=h.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{HH(r)}catch(g){A(h,h.return,g)}}function lc(r){switch(r.tag){case 31:case 13:case 19:var h=r.stateNode;return h===null&&(h=r.stateNode=new rw),h;case 22:return r=r.stateNode,h=r._retryCache,h===null&&(h=r._retryCache=new rw),h;default:throw Error(i(435,r.tag))}}function Hr(r,h){var g=lc(r);h.forEach(function(j){if(!g.has(j)){g.add(j);var C=I.bind(null,r,j);j.then(C,C)}})}function Xa(r,h){var g=h.deletions;if(g!==null)for(var j=0;j<g.length;j++){var C=g[j],F=r,N=h;if(Wi){var P=N;t:for(;P!==null;){switch(P.tag){case 27:if(gi){if(xr(P.type)){ri=P.stateNode,ys=!1;break t}break}case 5:ri=P.stateNode,ys=!1;break t;case 3:case 4:ri=P.stateNode.containerInfo,ys=!0;break t}P=P.return}if(ri===null)throw Error(i(160));Br(F,N,C),ri=null,ys=!1}else Br(F,N,C);F=C.alternate,F!==null&&(F.return=null),C.return=null}if(h.subtreeFlags&13886)for(h=h.child;h!==null;)nu(h,r),h=h.sibling}function nu(r,h){var{alternate:g,flags:j}=r;switch(r.tag){case 0:case 11:case 14:case 15:Xa(h,r),Ai(r),j&4&&(Un(3,r,r.return),rf(3,r),Un(5,r,r.return));break;case 1:Xa(h,r),Ai(r),j&512&&(fi||g===null||ns(g,g.return)),j&64&&e1&&(r=r.updateQueue,r!==null&&(j=r.callbacks,j!==null&&(g=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=g===null?j:g.concat(j))));break;case 26:if(Gn){var C=Xn;if(Xa(h,r),Ai(r),j&512&&(fi||g===null||ns(g,g.return)),j&4){j=g!==null?g.memoizedState:null;var F=r.memoizedState;g===null?F===null?r.stateNode===null?r.stateNode=UH(C,r.type,r.memoizedProps,r):Jp(C,r.type,r.stateNode):r.stateNode=Vp(C,F,r.memoizedProps):j!==F?(j===null?g.stateNode!==null&&Qp(g.stateNode):Yp(j),F===null?Jp(C,r.type,r.stateNode):Vp(C,F,r.memoizedProps)):F===null&&r.stateNode!==null&&ya(r,r.memoizedProps,g.memoizedProps)}break}case 27:if(gi){Xa(h,r),Ai(r),j&512&&(fi||g===null||ns(g,g.return)),g!==null&&j&4&&ya(r,r.memoizedProps,g.memoizedProps);break}case 5:if(Xa(h,r),Ai(r),j&512&&(fi||g===null||ns(g,g.return)),Wi){if(r.flags&32){C=r.stateNode;try{Np(C)}catch(Tt){A(r,r.return,Tt)}}j&4&&r.stateNode!=null&&(C=r.memoizedProps,ya(r,C,g!==null?g.memoizedProps:C)),j&1024&&(t4=!0)}else f0&&r.alternate!==null&&(r.alternate.stateNode=r.stateNode);break;case 6:if(Xa(h,r),Ai(r),j&4&&Wi){if(r.stateNode===null)throw Error(i(162));j=r.memoizedProps,g=g!==null?g.memoizedProps:j,C=r.stateNode;try{JO(C,g,j)}catch(Tt){A(r,r.return,Tt)}}break;case 3:if(Gn?(GH(),C=Xn,Xn=z6(h.containerInfo),Xa(h,r),Xn=C):Xa(h,r),Ai(r),j&4){if(Wi&&Pi&&g!==null&&g.memoizedState.isDehydrated)try{BH(h.containerInfo)}catch(Tt){A(r,r.return,Tt)}if(f0){j=h.containerInfo,g=h.pendingChildren;try{xp(j,g)}catch(Tt){A(r,r.return,Tt)}}}t4&&(t4=!1,fc(r));break;case 4:Gn?(g=Xn,Xn=z6(r.stateNode.containerInfo),Xa(h,r),Ai(r),Xn=g):(Xa(h,r),Ai(r)),j&4&&f0&&au(r.stateNode,r,r.stateNode.pendingChildren);break;case 12:Xa(h,r),Ai(r);break;case 31:Xa(h,r),Ai(r),j&4&&(j=r.updateQueue,j!==null&&(r.updateQueue=null,Hr(r,j)));break;case 13:Xa(h,r),Ai(r),r.child.flags&8192&&r.memoizedState!==null!==(g!==null&&g.memoizedState!==null)&&(Lu=Ss()),j&4&&(j=r.updateQueue,j!==null&&(r.updateQueue=null,Hr(r,j)));break;case 22:C=r.memoizedState!==null;var N=g!==null&&g.memoizedState!==null,P=e1,gt=fi;if(e1=P||C,fi=gt||N,Xa(h,r),fi=gt,e1=P,Ai(r),j&8192&&(h=r.stateNode,h._visibility=C?h._visibility&-2:h._visibility|1,C&&(g===null||N||e1||fi||V0(r)),Wi)){t:if(g=null,Wi)for(h=r;;){if(h.tag===5||Gn&&h.tag===26){if(g===null){N=g=h;try{F=N.stateNode,C?eH(F):iH(N.stateNode,N.memoizedProps)}catch(Tt){A(N,N.return,Tt)}}}else if(h.tag===6){if(g===null){N=h;try{var yt=N.stateNode;C?aH(yt):sH(yt,N.memoizedProps)}catch(Tt){A(N,N.return,Tt)}}}else if(h.tag===18){if(g===null){N=h;try{var xt=N.stateNode;C?NH(xt):zH(N.stateNode)}catch(Tt){A(N,N.return,Tt)}}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===r)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===r)break t;for(;h.sibling===null;){if(h.return===null||h.return===r)break t;g===h&&(g=null),h=h.return}g===h&&(g=null),h.sibling.return=h.return,h=h.sibling}}j&4&&(j=r.updateQueue,j!==null&&(g=j.retryQueue,g!==null&&(j.retryQueue=null,Hr(r,g))));break;case 19:Xa(h,r),Ai(r),j&4&&(j=r.updateQueue,j!==null&&(r.updateQueue=null,Hr(r,j)));break;case 30:break;case 21:break;default:Xa(h,r),Ai(r)}}function Ai(r){var h=r.flags;if(h&2){try{for(var g,j=r.return;j!==null;){if(L0(j)){g=j;break}j=j.return}if(Wi){if(g==null)throw Error(i(160));switch(g.tag){case 27:if(gi){var C=g.stateNode,F=of(r);Fr(r,F,C);break}case 5:var N=g.stateNode;g.flags&32&&(Np(N),g.flags&=-33);var P=of(r);Fr(r,P,N);break;case 3:case 4:var gt=g.stateNode.containerInfo,yt=of(r);ac(r,yt,gt);break;default:throw Error(i(161))}}}catch(xt){A(r,r.return,xt)}r.flags&=-3}h&4096&&(r.flags&=-4097)}function fc(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var h=r;fc(h),h.tag===5&&h.flags&1024&&zO(h.stateNode),r=r.sibling}}function In(r,h){if(h.subtreeFlags&8772)for(h=h.child;h!==null;)ic(r,h.alternate,h),h=h.sibling}function V0(r){for(r=r.child;r!==null;){var h=r;switch(h.tag){case 0:case 11:case 14:case 15:Un(4,h,h.return),V0(h);break;case 1:ns(h,h.return);var g=h.stateNode;typeof g.componentWillUnmount==="function"&&U1(h,h.return,g),V0(h);break;case 27:gi&&Wp(h.stateNode);case 26:case 5:ns(h,h.return),V0(h);break;case 22:h.memoizedState===null&&V0(h);break;case 30:V0(h);break;default:V0(h)}r=r.sibling}}function mn(r,h,g){g=g&&(h.subtreeFlags&8772)!==0;for(h=h.child;h!==null;){var j=h.alternate,C=r,F=h,N=F.flags;switch(F.tag){case 0:case 11:case 15:mn(C,F,g),rf(4,F);break;case 1:if(mn(C,F,g),j=F,C=j.stateNode,typeof C.componentDidMount==="function")try{C.componentDidMount()}catch(yt){A(j,j.return,yt)}if(j=F,C=j.updateQueue,C!==null){var P=j.stateNode;try{var gt=C.shared.hiddenCallbacks;if(gt!==null)for(C.shared.hiddenCallbacks=null,C=0;C<gt.length;C++)ba(gt[C],P)}catch(yt){A(j,j.return,yt)}}g&&N&64&&eu(F),I1(F,F.return);break;case 27:gi&&iu(F);case 26:case 5:mn(C,F,g),g&&j===null&&N&4&&G1(F),I1(F,F.return);break;case 12:mn(C,F,g);break;case 31:mn(C,F,g),g&&N&4&&Or(C,F);break;case 13:mn(C,F,g),g&&N&4&&nc(C,F);break;case 22:F.memoizedState===null&&mn(C,F,g),I1(F,F.return);break;case 30:break;default:mn(C,F,g)}h=h.sibling}}function rc(r,h){var g=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(g=r.memoizedState.cachePool.pool),r=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(r=h.memoizedState.cachePool.pool),r!==g&&(r!=null&&r.refCount++,g!=null&&mt(g))}function oc(r,h){r=null,h.alternate!==null&&(r=h.alternate.memoizedState.cache),h=h.memoizedState.cache,h!==r&&(h.refCount++,r!=null&&mt(r))}function ls(r,h,g,j){if(h.subtreeFlags&10256)for(h=h.child;h!==null;)lu(r,h,g,j),h=h.sibling}function lu(r,h,g,j){var C=h.flags;switch(h.tag){case 0:case 11:case 15:ls(r,h,g,j),C&2048&&rf(9,h);break;case 1:ls(r,h,g,j);break;case 3:ls(r,h,g,j),C&2048&&(r=null,h.alternate!==null&&(r=h.alternate.memoizedState.cache),h=h.memoizedState.cache,h!==r&&(h.refCount++,r!=null&&mt(r)));break;case 12:if(C&2048){ls(r,h,g,j),r=h.stateNode;try{var F=h.memoizedProps,N=F.id,P=F.onPostCommit;typeof P==="function"&&P(N,h.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(gt){A(h,h.return,gt)}}else ls(r,h,g,j);break;case 31:ls(r,h,g,j);break;case 13:ls(r,h,g,j);break;case 23:break;case 22:F=h.stateNode,N=h.alternate,h.memoizedState!==null?F._visibility&2?ls(r,h,g,j):hf(r,h):F._visibility&2?ls(r,h,g,j):(F._visibility|=2,X1(r,h,g,j,(h.subtreeFlags&10256)!==0||!1)),C&2048&&rc(N,h);break;case 24:ls(r,h,g,j),C&2048&&oc(h.alternate,h);break;default:ls(r,h,g,j)}}function X1(r,h,g,j,C){C=C&&((h.subtreeFlags&10256)!==0||!1);for(h=h.child;h!==null;){var F=r,N=h,P=g,gt=j,yt=N.flags;switch(N.tag){case 0:case 11:case 15:X1(F,N,P,gt,C),rf(8,N);break;case 23:break;case 22:var xt=N.stateNode;N.memoizedState!==null?xt._visibility&2?X1(F,N,P,gt,C):hf(F,N):(xt._visibility|=2,X1(F,N,P,gt,C)),C&&yt&2048&&rc(N.alternate,N);break;case 24:X1(F,N,P,gt,C),C&&yt&2048&&oc(N.alternate,N);break;default:X1(F,N,P,gt,C)}h=h.sibling}}function hf(r,h){if(h.subtreeFlags&10256)for(h=h.child;h!==null;){var g=r,j=h,C=j.flags;switch(j.tag){case 22:hf(g,j),C&2048&&rc(j.alternate,j);break;case 24:hf(g,j),C&2048&&oc(j.alternate,j);break;default:hf(g,j)}h=h.sibling}}function Y0(r,h,g){if(r.subtreeFlags&Pr)for(r=r.child;r!==null;)fu(r,h,g),r=r.sibling}function fu(r,h,g){switch(r.tag){case 26:if(Y0(r,h,g),r.flags&Pr)if(r.memoizedState!==null)KH(g,Xn,r.memoizedState,r.memoizedProps);else{var{stateNode:j,type:C}=r;r=r.memoizedProps,((h&335544128)===h||T6(C,r))&&Rp(g,j,C,r)}break;case 5:Y0(r,h,g),r.flags&Pr&&(j=r.stateNode,C=r.type,r=r.memoizedProps,((h&335544128)===h||T6(C,r))&&Rp(g,j,C,r));break;case 3:case 4:Gn?(j=Xn,Xn=z6(r.stateNode.containerInfo),Y0(r,h,g),Xn=j):Y0(r,h,g);break;case 22:r.memoizedState===null&&(j=r.alternate,j!==null&&j.memoizedState!==null?(j=Pr,Pr=16777216,Y0(r,h,g),Pr=j):Y0(r,h,g));break;default:Y0(r,h,g)}}function ru(r){var h=r.alternate;if(h!==null&&(r=h.child,r!==null)){h.child=null;do h=r.sibling,r.sibling=null,r=h;while(r!==null)}}function cf(r){var h=r.deletions;if((r.flags&16)!==0){if(h!==null)for(var g=0;g<h.length;g++){var j=h[g];yi=j,hu(j,r)}ru(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)ou(r),r=r.sibling}function ou(r){switch(r.tag){case 0:case 11:case 15:cf(r),r.flags&2048&&Un(9,r,r.return);break;case 3:cf(r);break;case 12:cf(r);break;case 22:var h=r.stateNode;r.memoizedState!==null&&h._visibility&2&&(r.return===null||r.return.tag!==13)?(h._visibility&=-3,Mr(r)):cf(r);break;default:cf(r)}}function Mr(r){var h=r.deletions;if((r.flags&16)!==0){if(h!==null)for(var g=0;g<h.length;g++){var j=h[g];yi=j,hu(j,r)}ru(r)}for(r=r.child;r!==null;){switch(h=r,h.tag){case 0:case 11:case 15:Un(8,h,h.return),Mr(h);break;case 22:g=h.stateNode,g._visibility&2&&(g._visibility&=-3,Mr(h));break;default:Mr(h)}r=r.sibling}}function hu(r,h){for(;yi!==null;){var g=yi;switch(g.tag){case 0:case 11:case 15:Un(8,g,h);break;case 23:case 22:if(g.memoizedState!==null&&g.memoizedState.cachePool!==null){var j=g.memoizedState.cachePool.pool;j!=null&&j.refCount++}break;case 24:mt(g.memoizedState.cache)}if(j=g.child,j!==null)j.return=g,yi=j;else t:for(g=r;yi!==null;){j=yi;var{sibling:C,return:F}=j;if(sc(j),j===g){yi=null;break t}if(C!==null){C.return=F,yi=C;break t}yi=F}}}function hc(r){var h=FO(r);if(h!=null){if(typeof h.memoizedProps["data-testname"]!=="string")throw Error(i(364));return h}if(r=UO(r),r===null)throw Error(i(362));return r.stateNode.current}function gn(r,h){var g=r.tag;switch(h.$$typeof){case Uu:if(r.type===h.value)return!0;break;case Iu:t:{h=h.value,r=[r,0];for(g=0;g<r.length;){var j=r[g++],C=j.tag,F=r[g++],N=h[F];if(C!==5&&C!==26&&C!==27||!jc(j)){for(;N!=null&&gn(j,N);)F++,N=h[F];if(F===h.length){h=!0;break t}else for(j=j.child;j!==null;)r.push(j,F),j=j.sibling}}h=!1}return h;case Gu:if((g===5||g===26||g===27)&&XO(r.stateNode,h.value))return!0;break;case Ku:if(g===5||g===6||g===26||g===27){if(r=GO(r),r!==null&&0<=r.indexOf(h.value))return!0}break;case Xu:if(g===5||g===26||g===27){if(r=r.memoizedProps["data-testname"],typeof r==="string"&&r.toLowerCase()===h.value.toLowerCase())return!0}break;default:throw Error(i(365))}return!1}function cc(r){switch(r.$$typeof){case Uu:return"<"+(u(r.value)||"Unknown")+">";case Iu:return":has("+(cc(r)||"")+")";case Gu:return'[role="'+r.value+'"]';case Ku:return'"'+r.value+'"';case Xu:return'[data-testname="'+r.value+'"]';default:throw Error(i(365))}}function cu(r,h){var g=[];r=[r,0];for(var j=0;j<r.length;){var C=r[j++],F=C.tag,N=r[j++],P=h[N];if(F!==5&&F!==26&&F!==27||!jc(C)){for(;P!=null&&gn(C,P);)N++,P=h[N];if(N===h.length)g.push(C);else for(C=C.child;C!==null;)r.push(C,N),C=C.sibling}}return g}function uc(r,h){if(!wc)throw Error(i(363));r=hc(r),r=cu(r,h),h=[],r=Array.from(r);for(var g=0;g<r.length;){var j=r[g++],C=j.tag;if(C===5||C===26||C===27)jc(j)||h.push(j.stateNode);else for(j=j.child;j!==null;)r.push(j),j=j.sibling}return h}function vs(){return(Ne&2)!==0&&Ue!==0?Ue&-Ue:fe.T!==null?Be():OO()}function mc(){if(Zs===0)if((Ue&536870912)===0||Ke){var r=_u;_u<<=1,(_u&3932160)===0&&(_u=262144),Zs=r}else Zs=536870912;return r=Js.current,r!==null&&(r.flags|=32),Zs}function vi(r,h,g){if(r===pa&&(na===2||na===9)||r.cancelPendingCommit!==null)K1(r,0),s0(r,Ue,Zs,!1);if(D(r,g),(Ne&2)===0||r!==pa)r===pa&&((Ne&2)===0&&(Sf|=g),Ka===4&&s0(r,Ue,Zs,!1)),Zt(r)}function gc(r,h,g){if((Ne&6)!==0)throw Error(i(327));var j=!g&&(h&127)===0&&(h&r.expiredLanes)===0||y(r,h),C=j?J0(r,h):n0(r,h,!0),F=j;do{if(C===0){to&&!j&&s0(r,h,0,!1);break}else{if(g=r.current.alternate,F&&!Dr(g)){C=n0(r,h,!1),F=!1;continue}if(C===2){if(F=h,r.errorRecoveryDisabledLanes&F)var N=0;else N=r.pendingLanes&-536870913,N=N!==0?N:N&536870912?536870912:0;if(N!==0){h=N;t:{var P=r;C=_c;var gt=Pi&&P.current.memoizedState.isDehydrated;if(gt&&(K1(P,N).flags|=256),N=n0(P,N,!1),N!==2){if(e4&&!gt){P.errorRecoveryDisabledLanes|=F,Sf|=F,C=4;break t}F=ks,ks=C,F!==null&&(ks===null?ks=F:ks.push.apply(ks,F))}C=N}if(F=!1,C!==2)continue}}if(C===1){K1(r,0),s0(r,h,0,!0);break}t:{switch(j=r,F=C,F){case 0:case 1:throw Error(i(345));case 4:if((h&4194048)!==h)break;case 6:s0(j,h,Zs,!el);break t;case 2:ks=null;break;case 3:case 5:break;default:throw Error(i(329))}if((h&62914560)===h&&(C=Lu+300-Ss(),10<C)){if(s0(j,h,Zs,!el),k(j,0,!0)!==0)break t;i1=h,j.timeoutHandle=CO(uf.bind(null,j,g,ks,Vu,i4,h,Zs,Sf,eo,el,F,"Throttled",-0,0),C);break t}uf(j,g,ks,Vu,i4,h,Zs,Sf,eo,el,F,null,-0,0)}}break}while(1);Zt(r)}function uf(r,h,g,j,C,F,N,P,gt,yt,xt,Tt,Vt,Ae){if(r.timeoutHandle=bf,Tt=h.subtreeFlags,Tt&8192||(Tt&16785408)===16785408){Tt=RO(),fu(h,F,Tt);var Ii=(F&62914560)===F?Lu-Ss():(F&4194048)===F?ow-Ss():0;if(Ii=NO(Tt,Ii),Ii!==null){i1=F,r.cancelPendingCommit=Ii(ju.bind(null,r,h,F,g,j,C,N,P,gt,xt,Tt,null,Vt,Ae)),s0(r,F,N,!yt);return}}ju(r,h,F,g,j,C,N,P,gt)}function Dr(r){for(var h=r;;){var g=h.tag;if((g===0||g===11||g===15)&&h.flags&16384&&(g=h.updateQueue,g!==null&&(g=g.stores,g!==null)))for(var j=0;j<g.length;j++){var C=g[j],F=C.getSnapshot;C=C.value;try{if(!Ys(F(),C))return!1}catch(N){return!1}}if(g=h.child,h.subtreeFlags&16384&&g!==null)g.return=h,h=g;else{if(h===r)break;for(;h.sibling===null;){if(h.return===null||h.return===r)return!0;h=h.return}h.sibling.return=h.return,h=h.sibling}}return!0}function s0(r,h,g,j){h&=~a4,h&=~Sf,r.suspendedLanes|=h,r.pingedLanes&=~h,j&&(r.warmLanes|=h),j=r.expirationTimes;for(var C=h;0<C;){var F=31-Ls(C),N=1<<F;j[F]=-1,C&=~N}g!==0&&z(r,g,h)}function uu(){return(Ne&6)===0?(ne(0,!1),!1):!0}function bc(){if(ze!==null){if(na===0)var r=ze.return;else r=ze,P0=wf=null,Nh(r),Jr=null,Sc=0,r=ze;for(;r!==null;)tu(r.alternate,r),r=r.return;ze=null}}function K1(r,h){var g=r.timeoutHandle;g!==bf&&(r.timeoutHandle=bf,_O(g)),g=r.cancelPendingCommit,g!==null&&(r.cancelPendingCommit=null,g()),i1=0,bc(),pa=r,ze=g=ht(r.current,null),Ue=h,na=0,Qs=null,el=!1,to=y(r,h),e4=!1,eo=Zs=a4=Sf=al=Ka=0,ks=_c=null,i4=!1,(h&8)!==0&&(h|=h&32);var j=r.entangledLanes;if(j!==0)for(r=r.entanglements,j&=h;0<j;){var C=31-Ls(j),F=1<<C;h|=r[C],j&=~F}return a1=h,_1(),g}function mu(r,h){ke=null,fe.H=kc,h===Yr||h===Ru?(h=En(),na=3):h===Y6?(h=En(),na=4):na=h===W6?8:h!==null&&typeof h==="object"&&typeof h.then==="function"?6:1,Qs=h,ze===null&&(Ka=1,z1(r,nt(h,r.current)))}function Tr(){var r=Js.current;return r===null?!0:(Ue&4194048)===Ue?dn===null?!0:!1:(Ue&62914560)===Ue||(Ue&536870912)!==0?r===dn:!1}function gu(){var r=fe.H;return fe.H=kc,r===null?kc:r}function bu(){var r=fe.A;return fe.A=nM,r}function mf(){Ka=4,el||(Ue&4194048)!==Ue&&Js.current!==null||(to=!0),(al&134217727)===0&&(Sf&134217727)===0||pa===null||s0(pa,Ue,Zs,!1)}function n0(r,h,g){var j=Ne;Ne|=2;var C=gu(),F=bu();if(pa!==r||Ue!==h)Vu=null,K1(r,h);h=!1;var N=Ka;t:do try{if(na!==0&&ze!==null){var P=ze,gt=Qs;switch(na){case 8:bc(),N=6;break t;case 3:case 2:case 9:case 6:Js.current===null&&(h=!0);var yt=na;if(na=0,Qs=null,Q0(r,P,gt,yt),g&&to){N=0;break t}break;default:yt=na,na=0,Qs=null,Q0(r,P,gt,yt)}}Ze(),N=Ka;break}catch(xt){mu(r,xt)}while(1);return h&&r.shellSuspendCounter++,P0=wf=null,Ne=j,fe.H=C,fe.A=F,ze===null&&(pa=null,Ue=0,_1()),N}function Ze(){for(;ze!==null;)Ks(ze)}function J0(r,h){var g=Ne;Ne|=2;var j=gu(),C=bu();pa!==r||Ue!==h?(Vu=null,Fc=Ss()+500,K1(r,h)):to=y(r,h);t:do try{if(na!==0&&ze!==null){h=ze;var F=Qs;e:switch(na){case 1:na=0,Qs=null,Q0(r,h,F,1);break;case 2:case 9:if(Wt(F)){na=0,Qs=null,pu(h);break}h=function(){na!==2&&na!==9||pa!==r||(na=7),Zt(r)},F.then(h,h);break t;case 3:na=7;break t;case 4:na=5;break t;case 7:Wt(F)?(na=0,Qs=null,pu(h)):(na=0,Qs=null,Q0(r,h,F,7));break;case 5:var N=null;switch(ze.tag){case 26:N=ze.memoizedState;case 5:case 27:var P=ze,gt=P.type,yt=P.pendingProps;if(N?Zp(N):Tp(P.stateNode,gt,yt)){na=0,Qs=null;var xt=P.sibling;if(xt!==null)ze=xt;else{var Tt=P.return;Tt!==null?(ze=Tt,Rr(Tt)):ze=null}break e}}na=0,Qs=null,Q0(r,h,F,5);break;case 6:na=0,Qs=null,Q0(r,h,F,6);break;case 8:bc(),Ka=6;break t;default:throw Error(i(462))}}zi();break}catch(Vt){mu(r,Vt)}while(1);if(P0=wf=null,fe.H=j,fe.A=C,Ne=g,ze!==null)return 0;return pa=null,Ue=0,_1(),Ka}function zi(){for(;ze!==null&&!JH();)Ks(ze)}function Ks(r){var h=W9(r.alternate,r,a1);r.memoizedProps=r.pendingProps,h===null?Rr(r):ze=h}function pu(r){var h=r,g=h.alternate;switch(h.tag){case 15:case 0:h=af(g,h,h.pendingProps,h.type,void 0,Ue);break;case 11:h=af(g,h,h.pendingProps,h.type.render,h.ref,Ue);break;case 5:Nh(h);default:tu(g,h),h=ze=zt(h,a1),h=W9(g,h,a1)}r.memoizedProps=r.pendingProps,h===null?Rr(r):ze=h}function Q0(r,h,g,j){P0=wf=null,Nh(h),Jr=null,Sc=0;var C=h.return;try{if(S6(r,C,h,g,Ue)){Ka=1,z1(r,nt(g,r.current)),ze=null;return}}catch(F){if(C!==null)throw ze=C,F;Ka=1,z1(r,nt(g,r.current)),ze=null;return}if(h.flags&32768){if(Ke||j===1)r=!0;else if(to||(Ue&536870912)!==0)r=!1;else if(el=r=!0,j===2||j===9||j===3||j===6)j=Js.current,j!==null&&j.tag===13&&(j.flags|=16384);wu(h,r)}else Rr(h)}function Rr(r){var h=r;do{if((h.flags&32768)!==0){wu(h,el);return}r=h.return;var g=k6(h.alternate,h,a1);if(g!==null){ze=g;return}if(h=h.sibling,h!==null){ze=h;return}ze=h=r}while(h!==null);Ka===0&&(Ka=5)}function wu(r,h){do{var g=C6(r.alternate,r);if(g!==null){g.flags&=32767,ze=g;return}if(g=r.return,g!==null&&(g.flags|=32768,g.subtreeFlags=0,g.deletions=null),!h&&(r=r.sibling,r!==null)){ze=r;return}ze=r=g}while(r!==null);Ka=6,ze=null}function ju(r,h,g,j,C,F,N,P,gt){r.cancelPendingCommit=null;do Z0();while(bi!==0);if((Ne&6)!==0)throw Error(i(327));if(h!==null){if(h===r.current)throw Error(i(177));if(F=h.lanes|h.childLanes,F|=J6,T(r,g,F,N,P,gt),r===pa&&(ze=pa=null,Ue=0),ao=h,sl=r,i1=g,s4=F,n4=C,hw=j,(h.subtreeFlags&10256)!==0||(h.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,K(U6,function(){return b(),null})):(r.callbackNode=null,r.callbackPriority=0),j=(h.flags&13878)!==0,(h.subtreeFlags&13878)!==0||j){j=fe.T,fe.T=null,C=W0(),Si(2),N=Ne,Ne|=4;try{su(r,h,g)}finally{Ne=N,Si(C),fe.T=j}}bi=1,du(),qu(),Au()}}function du(){if(bi===1){bi=0;var r=sl,h=ao,g=(h.flags&13878)!==0;if((h.subtreeFlags&13878)!==0||g){g=fe.T,fe.T=null;var j=W0();Si(2);var C=Ne;Ne|=4;try{nu(h,r),yO(r.containerInfo)}finally{Ne=C,Si(j),fe.T=g}}r.current=h,bi=2}}function qu(){if(bi===2){bi=0;var r=sl,h=ao,g=(h.flags&8772)!==0;if((h.subtreeFlags&8772)!==0||g){g=fe.T,fe.T=null;var j=W0();Si(2);var C=Ne;Ne|=4;try{ic(r,h.alternate,h)}finally{Ne=C,Si(j),fe.T=g}}bi=3}}function Au(){if(bi===4||bi===3){bi=0,QH();var r=sl,h=ao,g=i1,j=hw;(h.subtreeFlags&10256)!==0||(h.flags&10256)!==0?bi=5:(bi=0,ao=sl=null,vu(r,r.pendingLanes));var C=r.pendingLanes;if(C===0&&(il=null),at(g),h=h.stateNode,Vs&&typeof Vs.onCommitFiberRoot==="function")try{Vs.onCommitFiberRoot(dc,h,void 0,(h.current.flags&128)===128)}catch(gt){}if(j!==null){h=fe.T,C=W0(),Si(2),fe.T=null;try{for(var F=r.onRecoverableError,N=0;N<j.length;N++){var P=j[N];F(P.value,{componentStack:P.stack})}}finally{fe.T=h,Si(C)}}(i1&3)!==0&&Z0(),Zt(r),C=r.pendingLanes,(g&261930)!==0&&(C&42)!==0?r===l4?Bc++:(Bc=0,l4=r):Bc=0,Pi&&DH(),ne(0,!1)}}function vu(r,h){(r.pooledCacheLanes&=h)===0&&(h=r.pooledCache,h!=null&&(r.pooledCache=null,mt(h)))}function Z0(){return du(),qu(),Au(),b()}function b(){if(bi!==5)return!1;var r=sl,h=s4;s4=0;var g=at(i1),j=32>g?32:g;g=fe.T;var C=W0();try{Si(j),fe.T=null,j=n4,n4=null;var F=sl,N=i1;if(bi=0,ao=sl=null,i1=0,(Ne&6)!==0)throw Error(i(331));var P=Ne;if(Ne|=4,ou(F.current),lu(F,F.current,N,j),Ne=P,ne(0,!1),Vs&&typeof Vs.onPostCommitFiberRoot==="function")try{Vs.onPostCommitFiberRoot(dc,F)}catch(gt){}return!0}finally{Si(C),fe.T=g,vu(r,h)}}function q(r,h,g){h=nt(g,h),h=a0(r.stateNode,h,2),r=Pn(r,h,2),r!==null&&(D(r,2),Zt(r))}function A(r,h,g){if(r.tag===3)q(r,r,g);else for(;h!==null;){if(h.tag===3){q(h,r,g);break}else if(h.tag===1){var j=h.stateNode;if(typeof h.type.getDerivedStateFromError==="function"||typeof j.componentDidCatch==="function"&&(il===null||!il.has(j))){r=nt(g,r),g=Pl(2),j=Pn(h,g,2),j!==null&&(i0(g,j,h,r),D(j,2),Zt(j));break}}h=h.return}}function S(r,h,g){var j=r.pingCache;if(j===null){j=r.pingCache=new lM;var C=new Set;j.set(h,C)}else C=j.get(h),C===void 0&&(C=new Set,j.set(h,C));C.has(g)||(e4=!0,C.add(g),r=_.bind(null,r,h,g),h.then(r,r))}function _(r,h,g){var j=r.pingCache;j!==null&&j.delete(h),r.pingedLanes|=r.suspendedLanes&g,r.warmLanes&=~g,pa===r&&(Ue&g)===g&&(Ka===4||Ka===3&&(Ue&62914560)===Ue&&300>Ss()-Lu?(Ne&2)===0&&K1(r,0):a4|=g,eo===Ue&&(eo=0)),Zt(r)}function O(r,h){h===0&&(h=H()),r=E0(r,h),r!==null&&(D(r,h),Zt(r))}function U(r){var h=r.memoizedState,g=0;h!==null&&(g=h.retryLane),O(r,g)}function I(r,h){var g=0;switch(r.tag){case 31:case 13:var{stateNode:j,memoizedState:C}=r;C!==null&&(g=C.retryLane);break;case 19:j=r.stateNode;break;case 22:j=r.stateNode._retryCache;break;default:throw Error(i(314))}j!==null&&j.delete(h),O(r,g)}function K(r,h){return Bu(r,h)}function L(r,h,g,j){this.tag=r,this.key=g,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=h,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=j,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function it(r){return r=r.prototype,!(!r||!r.isReactComponent)}function ht(r,h){var g=r.alternate;return g===null?(g=e(r.tag,h,r.key,r.mode),g.elementType=r.elementType,g.type=r.type,g.stateNode=r.stateNode,g.alternate=r,r.alternate=g):(g.pendingProps=h,g.type=r.type,g.flags=0,g.subtreeFlags=0,g.deletions=null),g.flags=r.flags&65011712,g.childLanes=r.childLanes,g.lanes=r.lanes,g.child=r.child,g.memoizedProps=r.memoizedProps,g.memoizedState=r.memoizedState,g.updateQueue=r.updateQueue,h=r.dependencies,g.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext},g.sibling=r.sibling,g.index=r.index,g.ref=r.ref,g.refCleanup=r.refCleanup,g}function zt(r,h){r.flags&=65011714;var g=r.alternate;return g===null?(r.childLanes=0,r.lanes=h,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=g.childLanes,r.lanes=g.lanes,r.child=g.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=g.memoizedProps,r.memoizedState=g.memoizedState,r.updateQueue=g.updateQueue,r.type=g.type,h=g.dependencies,r.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext}),r}function wt(r,h,g,j,C,F){var N=0;if(j=r,typeof r==="function")it(r)&&(N=1);else if(typeof r==="string")N=Gn&&gi?Kp(r,g,xi.current)?26:Pp(r)?27:5:Gn?Kp(r,g,xi.current)?26:5:gi?Pp(r)?27:5:5;else t:switch(r){case M6:return r=e(31,g,h,C),r.elementType=M6,r.lanes=F,r;case zr:return te(g.children,C,F,h);case Fp:N=8,C|=24;break;case _6:return r=e(12,g,h,C|2),r.elementType=_6,r.lanes=F,r;case B6:return r=e(13,g,h,C),r.elementType=B6,r.lanes=F,r;case O6:return r=e(19,g,h,C),r.elementType=O6,r.lanes=F,r;default:if(typeof r==="object"&&r!==null)switch(r.$$typeof){case Q1:N=10;break t;case Bp:N=9;break t;case F6:N=11;break t;case H6:N=14;break t;case Z1:N=16,j=null;break t}N=29,g=Error(i(130,r===null?"null":typeof r,"")),j=null}return h=e(N,g,h,C),h.elementType=r,h.type=j,h.lanes=F,h}function te(r,h,g,j){return r=e(7,r,j,h),r.lanes=g,r}function oe(r,h,g){return r=e(6,r,null,h),r.lanes=g,r}function Za(r){var h=e(18,null,null,0);return h.stateNode=r,h}function Ei(r,h,g){return h=e(4,r.children!==null?r.children:[],r.key,h),h.lanes=g,h.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},h}function l0(r,h,g,j,C,F,N,P,gt){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=bf,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=M(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=M(0),this.hiddenUpdates=M(null),this.identifierPrefix=j,this.onUncaughtError=C,this.onCaughtError=F,this.onRecoverableError=N,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=gt,this.incompleteTransitions=new Map}function L1(r,h,g,j,C,F,N,P,gt,yt,xt,Tt){return r=new l0(r,h,g,N,gt,yt,xt,Tt,P),h=1,F===!0&&(h|=24),F=e(3,null,null,h),r.current=F,F.stateNode=r,h=ji(),h.refCount++,r.pooledCache=h,h.refCount++,F.memoizedState={element:j,isDehydrated:g,cache:h},Us(F),r}function V1(r){if(!r)return Ir;return r=Ir,r}function Y1(r){var h=r._reactInternals;if(h===void 0){if(typeof r.render==="function")throw Error(i(188));throw r=Object.keys(r).join(","),Error(i(268,r))}return r=l(h),r=r!==null?f(r):null,r===null?null:pc(r.stateNode)}function J1(r,h,g,j,C,F){C=V1(C),j.context===null?j.context=C:j.pendingContext=C,j=xe(h),j.payload={element:g},F=F===void 0?null:F,F!==null&&(j.callback=F),g=Pn(r,j,h),g!==null&&(vi(g,r,h),t0(g,r,h))}function gf(r,h){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var g=r.retryLane;r.retryLane=g!==0&&g<h?g:h}}function sa(r,h){gf(r,h),(r=r.alternate)&&gf(r,h)}var qe={},fs=Object.assign,pO=Symbol.for("react.element"),Su=Symbol.for("react.transitional.element"),Nr=Symbol.for("react.portal"),zr=Symbol.for("react.fragment"),Fp=Symbol.for("react.strict_mode"),_6=Symbol.for("react.profiler"),Bp=Symbol.for("react.consumer"),Q1=Symbol.for("react.context"),F6=Symbol.for("react.forward_ref"),B6=Symbol.for("react.suspense"),O6=Symbol.for("react.suspense_list"),H6=Symbol.for("react.memo"),Z1=Symbol.for("react.lazy"),M6=Symbol.for("react.activity"),wO=Symbol.for("react.memo_cache_sentinel"),Op=Symbol.iterator,jO=Symbol.for("react.client.reference"),yu=Array.isArray,fe=_b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,dO=t.rendererVersion,qO=t.rendererPackageName,Hp=t.extraDevToolsConfig,pc=t.getPublicInstance,AO=t.getRootHostContext,vO=t.getChildHostContext,SO=t.prepareForCommit,yO=t.resetAfterCommit,kO=t.createInstance;t.cloneMutableInstance;var{appendInitialChild:D6,finalizeInitialChildren:Mp,shouldSetTextContent:ku,createTextInstance:Dp}=t;t.cloneMutableTextInstance;var{scheduleTimeout:CO,cancelTimeout:_O,noTimeout:bf,isPrimaryRenderer:$0}=t;t.warnsIfNotActing;var{supportsMutation:Wi,supportsPersistence:f0,supportsHydration:Pi,getInstanceFromNode:FO}=t;t.beforeActiveInstanceBlur;var BO=t.preparePortalMount;t.prepareScopeUpdate,t.getInstanceFromScope;var{setCurrentUpdatePriority:Si,getCurrentUpdatePriority:W0,resolveUpdatePriority:OO}=t;t.trackSchedulerEvent,t.resolveEventType,t.resolveEventTimeStamp;var{shouldAttemptEagerTransition:HO,detachDeletedInstance:MO}=t;t.requestPostPaintCallback;var{maySuspendCommit:DO,maySuspendCommitOnUpdate:TO,maySuspendCommitInSyncRender:T6,preloadInstance:Tp,startSuspendingCommit:RO,suspendInstance:Rp}=t;t.suspendOnActiveViewTransition;var NO=t.waitForCommitToBeReady;t.getSuspendedCommitReason;var{NotPendingTransition:Er,HostTransitionContext:pf,resetFormInstance:zO}=t;t.bindToConsole;var{supportsMicrotasks:EO,scheduleMicrotask:xO,supportsTestSelectors:wc,findFiberRoot:UO,getBoundingRect:IO,getTextContent:GO,isHiddenSubtree:jc,matchAccessibilityRole:XO,setFocusIfFocusable:KO,setupIntersectionObserver:LO,appendChild:VO,appendChildToContainer:YO,commitTextUpdate:JO,commitMount:QO,commitUpdate:ZO,insertBefore:$O,insertInContainerBefore:WO,removeChild:PO,removeChildFromContainer:tH,resetTextContent:Np,hideInstance:eH,hideTextInstance:aH,unhideInstance:iH,unhideTextInstance:sH}=t;t.cancelViewTransitionName,t.cancelRootViewTransitionName,t.restoreRootViewTransitionName,t.cloneRootViewTransitionContainer,t.removeRootViewTransitionClone,t.measureClonedInstance,t.hasInstanceChanged,t.hasInstanceAffectedParent,t.startViewTransition,t.startGestureTransition,t.stopViewTransition,t.getCurrentGestureOffset,t.createViewTransitionInstance;var nH=t.clearContainer;t.createFragmentInstance,t.updateFragmentInstanceFiber,t.commitNewChildToFragmentInstance,t.deleteChildFromFragmentInstance;var{cloneInstance:lH,createContainerChildSet:zp,appendChildToContainerChildSet:Ep,finalizeContainerChildren:fH,replaceContainerChildren:xp,cloneHiddenInstance:Up,cloneHiddenTextInstance:Ip,isSuspenseInstancePending:R6,isSuspenseInstanceFallback:N6,getSuspenseInstanceFallbackErrorDetails:rH,registerSuspenseInstanceRetry:oH,canHydrateFormStateMarker:hH,isFormStateMarkerMatching:cH,getNextHydratableSibling:Gp,getNextHydratableSiblingAfterSingleton:uH,getFirstHydratableChild:mH,getFirstHydratableChildWithinContainer:gH,getFirstHydratableChildWithinActivityInstance:bH,getFirstHydratableChildWithinSuspenseInstance:pH,getFirstHydratableChildWithinSingleton:wH,canHydrateInstance:jH,canHydrateTextInstance:dH,canHydrateActivityInstance:qH,canHydrateSuspenseInstance:AH,hydrateInstance:vH,hydrateTextInstance:SH,hydrateActivityInstance:yH,hydrateSuspenseInstance:kH,getNextHydratableInstanceAfterActivityInstance:CH,getNextHydratableInstanceAfterSuspenseInstance:_H,commitHydratedInstance:FH,commitHydratedContainer:BH,commitHydratedActivityInstance:OH,commitHydratedSuspenseInstance:HH,finalizeHydratedChildren:MH,flushHydrationEvents:DH}=t;t.clearActivityBoundary;var TH=t.clearSuspenseBoundary;t.clearActivityBoundaryFromContainer;var{clearSuspenseBoundaryFromContainer:RH,hideDehydratedBoundary:NH,unhideDehydratedBoundary:zH,shouldDeleteUnhydratedTailInstances:Xp}=t;t.diffHydratedPropsForDevWarnings,t.diffHydratedTextForDevWarnings,t.describeHydratableInstanceForDevWarnings;var{validateHydratableInstance:EH,validateHydratableTextInstance:xH,supportsResources:Gn,isHostHoistableType:Kp,getHoistableRoot:z6,getResource:Lp,acquireResource:Vp,releaseResource:Yp,hydrateHoistable:UH,mountHoistable:Jp,unmountHoistable:Qp,createHoistableInstance:IH,prepareToCommitHoistables:GH,mayResourceSuspendCommit:XH,preloadResource:Zp,suspendResource:KH,supportsSingletons:gi,resolveSingletonInstance:$p,acquireSingletonInstance:LH,releaseSingletonInstance:Wp,isHostSingletonType:Pp,isSingletonScope:xr}=t,E6=[],Ur=-1,Ir={},Ls=Math.clz32?Math.clz32:d,VH=Math.log,YH=Math.LN2,Cu=256,_u=262144,Fu=4194304,Bu=Cb,x6=y_,JH=C_,QH=k_,Ss=C3,tw=v_,ZH=S_,U6=kb,$H=_3,WH=void 0,PH=void 0,dc=null,Vs=null,Ys=typeof Object.is==="function"?Object.is:Z,ew=typeof reportError==="function"?reportError:function(r){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var h=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r==="object"&&r!==null&&typeof r.message==="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(h))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",r);return}console.error(r)},tM=Object.prototype.hasOwnProperty,I6,aw,G6=!1,iw=new WeakMap,Gr=[],Xr=0,Ou=null,qc=0,bn=[],pn=0,$1=null,r0=1,o0="",xi=m(null),Ac=m(null),W1=m(null),Hu=m(null),Ui=null,Ta=null,Ke=!1,P1=null,wn=!1,X6=Error(i(519)),Mu=m(null),wf=null,P0=null,eM=typeof AbortController<"u"?AbortController:function(){var r=[],h=this.signal={aborted:!1,addEventListener:function(g,j){r.push(j)}};this.abort=function(){h.aborted=!0,r.forEach(function(g){return g()})}},aM=Cb,iM=kb,Ra={$$typeof:Q1,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},Du=null,Kr=null,K6=!1,Tu=!1,L6=!1,jf=0,vc=null,V6=0,Lr=0,Vr=null,sw=fe.S;fe.S=function(r,h){ow=Ss(),typeof h==="object"&&h!==null&&typeof h.then==="function"&&Sa(r,h),sw!==null&&sw(r,h)};var df=m(null),Yr=Error(i(460)),Y6=Error(i(474)),Ru=Error(i(542)),Nu={then:function(){}},qf=null,Jr=null,Sc=0,Af=Hh(!0),nw=Hh(!1),jn=[],Qr=0,J6=0,tl=!1,Q6=!1,Zr=m(null),zu=m(0),Js=m(null),dn=null,$a=m(0),t1=0,ke=null,ua=null,ni=null,Eu=!1,$r=!1,vf=!1,xu=0,yc=0,Wr=null,sM=0,kc={readContext:Ee,use:G0,useCallback:Ba,useContext:Ba,useEffect:Ba,useImperativeHandle:Ba,useLayoutEffect:Ba,useInsertionEffect:Ba,useMemo:Ba,useReducer:Ba,useRef:Ba,useState:Ba,useDebugValue:Ba,useDeferredValue:Ba,useTransition:Ba,useSyncExternalStore:Ba,useId:Ba,useHostTransitionStatus:Ba,useFormState:Ba,useActionState:Ba,useOptimistic:Ba,useMemoCache:Ba,useCacheRefresh:Ba};kc.useEffectEvent=Ba;var lw={readContext:Ee,use:G0,useCallback:function(r,h){return qi().memoizedState=[r,h===void 0?null:h],r},useContext:Ee,useEffect:O9,useImperativeHandle:function(r,h,g){g=g!==null&&g!==void 0?g.concat([r]):null,Vl(4194308,4,T9.bind(null,h,r),g)},useLayoutEffect:function(r,h){return Vl(4194308,4,r,h)},useInsertionEffect:function(r,h){Vl(4,2,r,h)},useMemo:function(r,h){var g=qi();h=h===void 0?null:h;var j=r();if(vf){Q(!0);try{r()}finally{Q(!1)}}return g.memoizedState=[j,h],j},useReducer:function(r,h,g){var j=qi();if(g!==void 0){var C=g(h);if(vf){Q(!0);try{g(h)}finally{Q(!1)}}}else C=h;return j.memoizedState=j.baseState=C,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:C},j.queue=r,r=r.dispatch=$l.bind(null,ke,r),[j.memoizedState,r]},useRef:function(r){var h=qi();return r={current:r},h.memoizedState=r},useState:function(r){r=Gl(r);var h=r.queue,g=Wl.bind(null,ke,h);return h.dispatch=g,[r.memoizedState,g]},useDebugValue:Jl,useDeferredValue:function(r,h){var g=qi();return N1(g,r,h)},useTransition:function(){var r=Gl(!1);return r=E9.bind(null,ke,r.queue,!0,!1),qi().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,h,g){var j=ke,C=qi();if(Ke){if(g===void 0)throw Error(i(407));g=g()}else{if(g=h(),pa===null)throw Error(i(349));(Ue&127)!==0||T1(j,h,g)}C.memoizedState=g;var F={value:g,getSnapshot:h};return C.queue=F,O9(X0.bind(null,j,F,r),[r]),j.flags|=2048,R1(9,{destroy:void 0},Il.bind(null,j,F,g,h),null),g},useId:function(){var r=qi(),h=pa.identifierPrefix;if(Ke){var g=o0,j=r0;g=(j&~(1<<32-Ls(j)-1)).toString(32)+g,h="_"+h+"R_"+g,g=xu++,0<g&&(h+="H"+g.toString(32)),h+="_"}else g=sM++,h="_"+h+"r_"+g.toString(32)+"_";return r.memoizedState=h},useHostTransitionStatus:Vh,useFormState:Xh,useActionState:Xh,useOptimistic:function(r){var h=qi();h.memoizedState=h.baseState=r;var g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return h.queue=g,h=Xs.bind(null,ke,!0,g),g.dispatch=h,[r,h]},useMemoCache:zh,useCacheRefresh:function(){return qi().memoizedState=Zl.bind(null,ke)},useEffectEvent:function(r){var h=qi(),g={impl:r};return h.memoizedState=g,function(){if((Ne&2)!==0)throw Error(i(440));return g.impl.apply(void 0,arguments)}}},Z6={readContext:Ee,use:G0,useCallback:N9,useContext:Ee,useEffect:qr,useImperativeHandle:R9,useInsertionEffect:M9,useLayoutEffect:D9,useMemo:Lh,useReducer:D1,useRef:B9,useState:function(){return D1(Gs)},useDebugValue:Jl,useDeferredValue:function(r,h){var g=Da();return z9(g,ua.memoizedState,r,h)},useTransition:function(){var r=D1(Gs)[0],h=Da().memoizedState;return[typeof r==="boolean"?r:ds(r),h]},useSyncExternalStore:Ul,useId:U9,useHostTransitionStatus:Vh,useFormState:F9,useActionState:F9,useOptimistic:function(r,h){var g=Da();return k9(g,ua,r,h)},useMemoCache:zh,useCacheRefresh:Ql};Z6.useEffectEvent=H9;var fw={readContext:Ee,use:G0,useCallback:N9,useContext:Ee,useEffect:qr,useImperativeHandle:R9,useInsertionEffect:M9,useLayoutEffect:D9,useMemo:Lh,useReducer:Eh,useRef:B9,useState:function(){return Eh(Gs)},useDebugValue:Jl,useDeferredValue:function(r,h){var g=Da();return ua===null?N1(g,r,h):z9(g,ua.memoizedState,r,h)},useTransition:function(){var r=Eh(Gs)[0],h=Da().memoizedState;return[typeof r==="boolean"?r:ds(r),h]},useSyncExternalStore:Ul,useId:U9,useHostTransitionStatus:Vh,useFormState:Kh,useActionState:Kh,useOptimistic:function(r,h){var g=Da();if(ua!==null)return k9(g,ua,r,h);return g.baseState=r,[r,g.queue.dispatch]},useMemoCache:zh,useCacheRefresh:Ql};fw.useEffectEvent=H9;var $6={enqueueSetState:function(r,h,g){r=r._reactInternals;var j=vs(),C=xe(j);C.payload=h,g!==void 0&&g!==null&&(C.callback=g),h=Pn(r,C,j),h!==null&&(vi(h,r,j),t0(h,r,j))},enqueueReplaceState:function(r,h,g){r=r._reactInternals;var j=vs(),C=xe(j);C.tag=1,C.payload=h,g!==void 0&&g!==null&&(C.callback=g),h=Pn(r,C,j),h!==null&&(vi(h,r,j),t0(h,r,j))},enqueueForceUpdate:function(r,h){r=r._reactInternals;var g=vs(),j=xe(g);j.tag=2,h!==void 0&&h!==null&&(j.callback=h),h=Pn(r,j,g),h!==null&&(vi(h,r,g),t0(h,r,g))}},W6=Error(i(461)),li=!1,P6={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},e1=!1,fi=!1,t4=!1,rw=typeof WeakSet==="function"?WeakSet:Set,yi=null,ri=null,ys=!1,Xn=null,Pr=8192,nM={getCacheForType:function(r){var h=Ee(Ra),g=h.data.get(r);return g===void 0&&(g=r(),h.data.set(r,g)),g},cacheSignal:function(){return Ee(Ra).controller.signal}},Uu=0,Iu=1,Gu=2,Xu=3,Ku=4;if(typeof Symbol==="function"&&Symbol.for){var Cc=Symbol.for;Uu=Cc("selector.component"),Iu=Cc("selector.has_pseudo_class"),Gu=Cc("selector.role"),Xu=Cc("selector.test_id"),Ku=Cc("selector.text")}var lM=typeof WeakMap==="function"?WeakMap:Map,Ne=0,pa=null,ze=null,Ue=0,na=0,Qs=null,el=!1,to=!1,e4=!1,a1=0,Ka=0,al=0,Sf=0,a4=0,Zs=0,eo=0,_c=null,ks=null,i4=!1,Lu=0,ow=0,Fc=1/0,Vu=null,il=null,bi=0,sl=null,ao=null,i1=0,s4=0,n4=null,hw=null,Bc=0,l4=null;return qe.attemptContinuousHydration=function(r){if(r.tag===13||r.tag===31){var h=E0(r,67108864);h!==null&&vi(h,r,67108864),sa(r,67108864)}},qe.attemptHydrationAtCurrentPriority=function(r){if(r.tag===13||r.tag===31){var h=vs();h=tt(h);var g=E0(r,h);g!==null&&vi(g,r,h),sa(r,h)}},qe.attemptSynchronousHydration=function(r){switch(r.tag){case 3:if(r=r.stateNode,r.current.memoizedState.isDehydrated){var h=v(r.pendingLanes);if(h!==0){r.pendingLanes|=2;for(r.entangledLanes|=2;h;){var g=1<<31-Ls(h);r.entanglements[1]|=g,h&=~g}Zt(r),(Ne&6)===0&&(Fc=Ss()+500,ne(0,!1))}}break;case 31:case 13:h=E0(r,2),h!==null&&vi(h,r,2),uu(),sa(r,2)}},qe.batchedUpdates=function(r,h){return r(h)},qe.createComponentSelector=function(r){return{$$typeof:Uu,value:r}},qe.createContainer=function(r,h,g,j,C,F,N,P,gt,yt){return L1(r,h,!1,null,g,j,F,null,N,P,gt,yt)},qe.createHasPseudoClassSelector=function(r){return{$$typeof:Iu,value:r}},qe.createHydrationContainer=function(r,h,g,j,C,F,N,P,gt,yt,xt,Tt,Vt,Ae){return r=L1(g,j,!0,r,C,F,P,Ae,gt,yt,xt,Tt),r.context=V1(null),g=r.current,j=vs(),j=tt(j),C=xe(j),C.callback=h!==void 0&&h!==null?h:null,Pn(g,C,j),h=j,r.current.lanes=h,D(r,h),Zt(r),r},qe.createPortal=function(r,h,g){var j=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Nr,key:j==null?null:""+j,children:r,containerInfo:h,implementation:g}},qe.createRoleSelector=function(r){return{$$typeof:Gu,value:r}},qe.createTestNameSelector=function(r){return{$$typeof:Xu,value:r}},qe.createTextSelector=function(r){return{$$typeof:Ku,value:r}},qe.defaultOnCaughtError=function(r){console.error(r)},qe.defaultOnRecoverableError=function(r){ew(r)},qe.defaultOnUncaughtError=function(r){ew(r)},qe.deferredUpdates=function(r){var h=fe.T,g=W0();try{return Si(32),fe.T=null,r()}finally{Si(g),fe.T=h}},qe.discreteUpdates=function(r,h,g,j,C){var F=fe.T,N=W0();try{return Si(2),fe.T=null,r(h,g,j,C)}finally{Si(N),fe.T=F,Ne===0&&(Fc=Ss()+500)}},qe.findAllNodes=uc,qe.findBoundingRects=function(r,h){if(!wc)throw Error(i(363));h=uc(r,h),r=[];for(var g=0;g<h.length;g++)r.push(IO(h[g]));for(h=r.length-1;0<h;h--){g=r[h];for(var j=g.x,C=j+g.width,F=g.y,N=F+g.height,P=h-1;0<=P;P--)if(h!==P){var gt=r[P],yt=gt.x,xt=yt+gt.width,Tt=gt.y,Vt=Tt+gt.height;if(j>=yt&&F>=Tt&&C<=xt&&N<=Vt){r.splice(h,1);break}else if(!(j!==yt||g.width!==gt.width||Vt<F||Tt>N)){Tt>F&&(gt.height+=Tt-F,gt.y=F),Vt<N&&(gt.height=N-Tt),r.splice(h,1);break}else if(!(F!==Tt||g.height!==gt.height||xt<j||yt>C)){yt>j&&(gt.width+=yt-j,gt.x=j),xt<C&&(gt.width=C-yt),r.splice(h,1);break}}}return r},qe.findHostInstance=Y1,qe.findHostInstanceWithNoPortals=function(r){return r=l(r),r=r!==null?o(r):null,r===null?null:pc(r.stateNode)},qe.findHostInstanceWithWarning=function(r){return Y1(r)},qe.flushPassiveEffects=Z0,qe.flushSyncFromReconciler=function(r){var h=Ne;Ne|=1;var g=fe.T,j=W0();try{if(Si(2),fe.T=null,r)return r()}finally{Si(j),fe.T=g,Ne=h,(Ne&6)===0&&ne(0,!1)}},qe.flushSyncWork=uu,qe.focusWithin=function(r,h){if(!wc)throw Error(i(363));r=hc(r),h=cu(r,h),h=Array.from(h);for(r=0;r<h.length;){var g=h[r++],j=g.tag;if(!jc(g)){if((j===5||j===26||j===27)&&KO(g.stateNode))return!0;for(g=g.child;g!==null;)h.push(g),g=g.sibling}}return!1},qe.getFindAllNodesFailureDescription=function(r,h){if(!wc)throw Error(i(363));var g=0,j=[];r=[hc(r),0];for(var C=0;C<r.length;){var F=r[C++],N=F.tag,P=r[C++],gt=h[P];if(N!==5&&N!==26&&N!==27||!jc(F)){if(gn(F,gt)&&(j.push(cc(gt)),P++,P>g&&(g=P)),P<h.length)for(F=F.child;F!==null;)r.push(F,P),F=F.sibling}}if(g<h.length){for(r=[];g<h.length;g++)r.push(cc(h[g]));return`findAllNodes was able to match part of the selector:
23
- `+(j.join(" > ")+`
24
-
25
- No matching component was found for:
26
- `)+r.join(" > ")}return null},qe.getPublicRootInstance=function(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 27:case 5:return pc(r.child.stateNode);default:return r.child.stateNode}},qe.injectIntoDevTools=function(){var r={bundleType:0,version:dO,rendererPackageName:qO,currentDispatcherRef:fe,reconcilerVersion:"19.2.0"};if(Hp!==null&&(r.rendererConfig=Hp),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")r=!1;else{var h=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(h.isDisabled||!h.supportsFiber)r=!0;else{try{dc=h.inject(r),Vs=h}catch(g){}r=h.checkDCE?!0:!1}}return r},qe.isAlreadyRendering=function(){return(Ne&6)!==0},qe.observeVisibleRects=function(r,h,g,j){if(!wc)throw Error(i(363));r=uc(r,h);var C=LO(r,g,j).disconnect;return{disconnect:function(){C()}}},qe.shouldError=function(){return null},qe.shouldSuspend=function(){return!1},qe.startHostTransition=function(r,h,g,j){if(r.tag!==5)throw Error(i(476));var C=x9(r).queue;E9(r,C,h,Er,g===null?a:function(){var F=x9(r);return F.next===null&&(F=r.alternate.memoizedState),Ni(r,F.next.queue,{},vs()),g(j)})},qe.updateContainer=function(r,h,g,j){var C=h.current,F=vs();return J1(C,F,r,h,g,j),F},qe.updateContainerSync=function(r,h,g,j){return J1(h.current,2,r,h,g,j),2},qe};a9.exports.default=a9.exports;Object.defineProperty(a9.exports,"__esModule",{value:!0})});var V_=Me((zft,L_)=>{var B0=Ie(Pa());L_.exports=function(e,a,i){let s=B0.useRef("loading"),n=B0.useRef(),[l,f]=B0.useState(0),o=B0.useRef(),c=B0.useRef(),u=B0.useRef();if(o.current!==e||c.current!==a||u.current!==i)s.current="loading",n.current=void 0,o.current=e,c.current=a,u.current=i;return B0.useLayoutEffect(function(){if(!e)return;var m=document.createElement("img");function p(){m.decode().catch(()=>{}).finally(()=>{s.current="loaded",n.current=m,f(Math.random())})}function w(){s.current="failed",n.current=void 0,f(Math.random())}return m.addEventListener("load",p),m.addEventListener("error",w),a&&(m.crossOrigin=a),i&&(m.referrerPolicy=i),m.src=e,function(){m.removeEventListener("load",p),m.removeEventListener("error",w)}},[e,a,i]),[n.current,s.current]}});function tY(t){if(!t||t.length<2)return null;let e=[...t].sort((a,i)=>i.version-a.version);return{left:e[0],right:e[1]}}function cw(t,e){return Math.max(0,Math.min(t,Math.max(0,e-1)))}var zn=Ie(Pa(),1);var bo=Ie(Pa(),1);function rs(){}function Yu(){}function uw(t,e){let a=e||{};return(t[t.length-1]===""?[...t,""]:t).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}var rM=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,oM=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hM={};function Ju(t,e){return((e||hM).jsx?oM:rM).test(t)}var cM=/[ \t\n\f\r]/g;function f4(t){return typeof t==="object"?t.type==="text"?mw(t.value):!1:mw(t)}function mw(t){return t.replace(cM,"")===""}class ll{constructor(t,e,a){if(this.normal=e,this.property=t,a)this.space=a}}ll.prototype.normal={};ll.prototype.property={};ll.prototype.space=void 0;function r4(t,e){let a={},i={};for(let s of t)Object.assign(a,s.property),Object.assign(i,s.normal);return new ll(a,i,e)}function Hc(t){return t.toLowerCase()}class Gi{constructor(t,e){this.attribute=e,this.property=t}}Gi.prototype.attribute="";Gi.prototype.booleanish=!1;Gi.prototype.boolean=!1;Gi.prototype.commaOrSpaceSeparated=!1;Gi.prototype.commaSeparated=!1;Gi.prototype.defined=!1;Gi.prototype.mustUseProperty=!1;Gi.prototype.number=!1;Gi.prototype.overloadedBoolean=!1;Gi.prototype.property="";Gi.prototype.spaceSeparated=!1;Gi.prototype.space=void 0;var Mc={};o4(Mc,{spaceSeparated:()=>ta,overloadedBoolean:()=>Qu,number:()=>Bt,commaSeparated:()=>s1,commaOrSpaceSeparated:()=>Cs,booleanish:()=>La,boolean:()=>me});var uM=0,me=kf(),La=kf(),Qu=kf(),Bt=kf(),ta=kf(),s1=kf(),Cs=kf();function kf(){return 2**++uM}var h4=Object.keys(Mc);class io extends Gi{constructor(t,e,a,i){let s=-1;super(t,e);if(gw(this,"space",i),typeof a==="number")while(++s<h4.length){let n=h4[s];gw(this,h4[s],(a&Mc[n])===Mc[n])}}}io.prototype.defined=!0;function gw(t,e,a){if(a)t[e]=a}function qn(t){let e={},a={};for(let[i,s]of Object.entries(t.properties)){let n=new io(i,t.transform(t.attributes||{},i),s,t.space);if(t.mustUseProperty&&t.mustUseProperty.includes(i))n.mustUseProperty=!0;e[i]=n,a[Hc(i)]=i,a[Hc(n.attribute)]=i}return new ll(e,a,t.space)}var c4=qn({properties:{ariaActiveDescendant:null,ariaAtomic:La,ariaAutoComplete:null,ariaBusy:La,ariaChecked:La,ariaColCount:Bt,ariaColIndex:Bt,ariaColSpan:Bt,ariaControls:ta,ariaCurrent:null,ariaDescribedBy:ta,ariaDetails:null,ariaDisabled:La,ariaDropEffect:ta,ariaErrorMessage:null,ariaExpanded:La,ariaFlowTo:ta,ariaGrabbed:La,ariaHasPopup:null,ariaHidden:La,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ta,ariaLevel:Bt,ariaLive:null,ariaModal:La,ariaMultiLine:La,ariaMultiSelectable:La,ariaOrientation:null,ariaOwns:ta,ariaPlaceholder:null,ariaPosInSet:Bt,ariaPressed:La,ariaReadOnly:La,ariaRelevant:null,ariaRequired:La,ariaRoleDescription:ta,ariaRowCount:Bt,ariaRowIndex:Bt,ariaRowSpan:Bt,ariaSelected:La,ariaSetSize:Bt,ariaSort:null,ariaValueMax:Bt,ariaValueMin:Bt,ariaValueNow:Bt,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function Zu(t,e){return e in t?t[e]:e}function $u(t,e){return Zu(t,e.toLowerCase())}var bw=qn({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:s1,acceptCharset:ta,accessKey:ta,action:null,allow:null,allowFullScreen:me,allowPaymentRequest:me,allowUserMedia:me,alpha:me,alt:null,as:null,async:me,autoCapitalize:null,autoComplete:ta,autoFocus:me,autoPlay:me,blocking:ta,capture:null,charSet:null,checked:me,cite:null,className:ta,closedBy:null,colorSpace:null,cols:Bt,colSpan:Bt,command:null,commandFor:null,content:null,contentEditable:La,controls:me,controlsList:ta,coords:Bt|s1,crossOrigin:null,data:null,dateTime:null,decoding:null,default:me,defer:me,dir:null,dirName:null,disabled:me,download:Qu,draggable:La,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:me,formTarget:null,headers:ta,height:Bt,hidden:Qu,high:Bt,href:null,hrefLang:null,htmlFor:ta,httpEquiv:ta,id:null,imageSizes:null,imageSrcSet:null,inert:me,inputMode:null,integrity:null,is:null,isMap:me,itemId:null,itemProp:ta,itemRef:ta,itemScope:me,itemType:ta,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:me,low:Bt,manifest:null,max:null,maxLength:Bt,media:null,method:null,min:null,minLength:Bt,multiple:me,muted:me,name:null,nonce:null,noModule:me,noValidate:me,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:me,optimum:Bt,pattern:null,ping:ta,placeholder:null,playsInline:me,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:me,referrerPolicy:null,rel:ta,required:me,reversed:me,rows:Bt,rowSpan:Bt,sandbox:ta,scope:null,scoped:me,seamless:me,selected:me,shadowRootClonable:me,shadowRootCustomElementRegistry:me,shadowRootDelegatesFocus:me,shadowRootMode:null,shadowRootSerializable:me,shape:null,size:Bt,sizes:null,slot:null,span:Bt,spellCheck:La,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Bt,step:null,style:null,tabIndex:Bt,target:null,title:null,translate:null,type:null,typeMustMatch:me,useMap:null,value:La,width:Bt,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ta,axis:null,background:null,bgColor:null,border:Bt,borderColor:null,bottomMargin:Bt,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:me,declare:me,event:null,face:null,frame:null,frameBorder:null,hSpace:Bt,leftMargin:Bt,link:null,longDesc:null,lowSrc:null,marginHeight:Bt,marginWidth:Bt,noResize:me,noHref:me,noShade:me,noWrap:me,object:null,profile:null,prompt:null,rev:null,rightMargin:Bt,rules:null,scheme:null,scrolling:La,standby:null,summary:null,text:null,topMargin:Bt,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Bt,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:me,disablePictureInPicture:me,disableRemotePlayback:me,exportParts:s1,part:ta,prefix:null,property:null,results:Bt,security:null,unselectable:null},space:"html",transform:$u});var pw=qn({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Cs,accentHeight:Bt,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Bt,amplitude:Bt,arabicForm:null,ascent:Bt,attributeName:null,attributeType:null,azimuth:Bt,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Bt,by:null,calcMode:null,capHeight:Bt,className:ta,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Bt,diffuseConstant:Bt,direction:null,display:null,dur:null,divisor:Bt,dominantBaseline:null,download:me,dx:null,dy:null,edgeMode:null,editable:null,elevation:Bt,enableBackground:null,end:null,event:null,exponent:Bt,externalResourcesRequired:null,fill:null,fillOpacity:Bt,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:s1,g2:s1,glyphName:s1,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Bt,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Bt,horizOriginX:Bt,horizOriginY:Bt,id:null,ideographic:Bt,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Bt,k:Bt,k1:Bt,k2:Bt,k3:Bt,k4:Bt,kernelMatrix:Cs,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Bt,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Bt,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Bt,overlineThickness:Bt,paintOrder:null,panose1:null,path:null,pathLength:Bt,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ta,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Bt,pointsAtY:Bt,pointsAtZ:Bt,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Cs,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Cs,rev:Cs,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Cs,requiredFeatures:Cs,requiredFonts:Cs,requiredFormats:Cs,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Bt,specularExponent:Bt,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Bt,strikethroughThickness:Bt,string:null,stroke:null,strokeDashArray:Cs,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Bt,strokeOpacity:Bt,strokeWidth:null,style:null,surfaceScale:Bt,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Cs,tabIndex:Bt,tableValues:null,target:null,targetX:Bt,targetY:Bt,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Cs,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Bt,underlineThickness:Bt,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Bt,values:null,vAlphabetic:Bt,vMathematical:Bt,vectorEffect:null,vHanging:Bt,vIdeographic:Bt,version:null,vertAdvY:Bt,vertOriginX:Bt,vertOriginY:Bt,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Bt,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Zu});var u4=qn({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}});var m4=qn({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:$u});var g4=qn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}});var b4={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};var mM=/[A-Z]/g,ww=/-[a-z]/g,gM=/^data[-\w.:]+$/i;function p4(t,e){let a=Hc(e),i=e,s=Gi;if(a in t.normal)return t.property[t.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&gM.test(e)){if(e.charAt(4)==="-"){let n=e.slice(5).replace(ww,pM);i="data"+n.charAt(0).toUpperCase()+n.slice(1)}else{let n=e.slice(4);if(!ww.test(n)){let l=n.replace(mM,bM);if(l.charAt(0)!=="-")l="-"+l;e="data"+l}}s=io}return new s(i,e)}function bM(t){return"-"+t.toLowerCase()}function pM(t){return t.charAt(1).toUpperCase()}var jw=r4([c4,bw,u4,m4,g4],"html"),Wu=r4([c4,pw,u4,m4,g4],"svg");function dw(t){return t.join(" ").trim()}var Nw=Ie(Mw(),1);var Pu=Dw("end"),so=Dw("start");function Dw(t){return e;function e(a){let i=a&&a.position&&a.position[t]||{};if(typeof i.line==="number"&&i.line>0&&typeof i.column==="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset==="number"&&i.offset>-1?i.offset:void 0}}}function d4(t){let e=so(t),a=Pu(t);if(e&&a)return{start:e,end:a}}function fl(t){if(!t||typeof t!=="object")return"";if("position"in t||"type"in t)return Tw(t.position);if("start"in t||"end"in t)return Tw(t);if("line"in t||"column"in t)return q4(t);return""}function q4(t){return Rw(t&&t.line)+":"+Rw(t&&t.column)}function Tw(t){return q4(t&&t.start)+"-"+q4(t&&t.end)}function Rw(t){return t&&typeof t==="number"?t:1}class oi extends Error{constructor(t,e,a){super();if(typeof e==="string")a=e,e=void 0;let i="",s={},n=!1;if(e)if("line"in e&&"column"in e)s={place:e};else if("start"in e&&"end"in e)s={place:e};else if("type"in e)s={ancestors:[e],place:e.position};else s={...e};if(typeof t==="string")i=t;else if(!s.cause&&t)n=!0,i=t.message,s.cause=t;if(!s.ruleId&&!s.source&&typeof a==="string"){let f=a.indexOf(":");if(f===-1)s.ruleId=a;else s.source=a.slice(0,f),s.ruleId=a.slice(f+1)}if(!s.place&&s.ancestors&&s.ancestors){let f=s.ancestors[s.ancestors.length-1];if(f)s.place=f.position}let l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=fl(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=n&&s.cause&&typeof s.cause.stack==="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}oi.prototype.file="";oi.prototype.name="";oi.prototype.reason="";oi.prototype.message="";oi.prototype.stack="";oi.prototype.column=void 0;oi.prototype.line=void 0;oi.prototype.ancestors=void 0;oi.prototype.cause=void 0;oi.prototype.fatal=void 0;oi.prototype.place=void 0;oi.prototype.ruleId=void 0;oi.prototype.source=void 0;var A4={}.hasOwnProperty,GM=new Map,XM=/[A-Z]/g,KM=new Set(["table","tbody","thead","tfoot","tr"]),LM=new Set(["td","th"]),zw="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function v4(t,e){if(!e||e.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let a=e.filePath||void 0,i;if(e.development){if(typeof e.jsxDEV!=="function")throw TypeError("Expected `jsxDEV` in options when `development: true`");i=PM(a,e.jsxDEV)}else{if(typeof e.jsx!=="function")throw TypeError("Expected `jsx` in production options");if(typeof e.jsxs!=="function")throw TypeError("Expected `jsxs` in production options");i=WM(a,e.jsx,e.jsxs)}let s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:i,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?Wu:jw,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},n=Ew(s,t,void 0);if(n&&typeof n!=="string")return n;return s.create(t,s.Fragment,{children:n||void 0},void 0)}function Ew(t,e,a){if(e.type==="element")return VM(t,e,a);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return YM(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return QM(t,e,a);if(e.type==="mdxjsEsm")return JM(t,e);if(e.type==="root")return ZM(t,e,a);if(e.type==="text")return $M(t,e)}function VM(t,e,a){let i=t.schema,s=i;if(e.tagName.toLowerCase()==="svg"&&i.space==="html")s=Wu,t.schema=s;t.ancestors.push(e);let n=Uw(t,e.tagName,!1),l=tD(t,e),f=y4(t,e);if(KM.has(e.tagName))f=f.filter(function(o){return typeof o==="string"?!f4(o):!0});return xw(t,l,n,e),S4(l,f),t.ancestors.pop(),t.schema=i,t.create(e,n,l,a)}function YM(t,e){if(e.data&&e.data.estree&&t.evaluater){let i=e.data.estree.body[0];return rs(i.type==="ExpressionStatement"),t.evaluater.evaluateExpression(i.expression)}Tc(t,e.position)}function JM(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Tc(t,e.position)}function QM(t,e,a){let i=t.schema,s=i;if(e.name==="svg"&&i.space==="html")s=Wu,t.schema=s;t.ancestors.push(e);let n=e.name===null?t.Fragment:Uw(t,e.name,!0),l=eD(t,e),f=y4(t,e);return xw(t,l,n,e),S4(l,f),t.ancestors.pop(),t.schema=i,t.create(e,n,l,a)}function ZM(t,e,a){let i={};return S4(i,y4(t,e)),t.create(e,t.Fragment,i,a)}function $M(t,e){return e.value}function xw(t,e,a,i){if(typeof a!=="string"&&a!==t.Fragment&&t.passNode)e.node=i}function S4(t,e){if(e.length>0){let a=e.length>1?e:e[0];if(a)t.children=a}}function WM(t,e,a){return i;function i(s,n,l,f){let c=Array.isArray(l.children)?a:e;return f?c(n,l,f):c(n,l)}}function PM(t,e){return a;function a(i,s,n,l){let f=Array.isArray(n.children),o=so(i);return e(s,n,l,f,{columnNumber:o?o.column-1:void 0,fileName:t,lineNumber:o?o.line:void 0},void 0)}}function tD(t,e){let a={},i,s;for(s in e.properties)if(s!=="children"&&A4.call(e.properties,s)){let n=aD(t,s,e.properties[s]);if(n){let[l,f]=n;if(t.tableCellAlignToStyle&&l==="align"&&typeof f==="string"&&LM.has(e.tagName))i=f;else a[l]=f}}if(i){let n=a.style||(a.style={});n[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return a}function eD(t,e){let a={};for(let i of e.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&t.evaluater){let n=i.data.estree.body[0];rs(n.type==="ExpressionStatement");let l=n.expression;rs(l.type==="ObjectExpression");let f=l.properties[0];rs(f.type==="SpreadElement"),Object.assign(a,t.evaluater.evaluateExpression(f.argument))}else Tc(t,e.position);else{let s=i.name,n;if(i.value&&typeof i.value==="object")if(i.value.data&&i.value.data.estree&&t.evaluater){let f=i.value.data.estree.body[0];rs(f.type==="ExpressionStatement"),n=t.evaluater.evaluateExpression(f.expression)}else Tc(t,e.position);else n=i.value===null?!0:i.value;a[s]=n}return a}function y4(t,e){let a=[],i=-1,s=t.passKeys?new Map:GM;while(++i<e.children.length){let n=e.children[i],l;if(t.passKeys){let o=n.type==="element"?n.tagName:n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement"?n.name:void 0;if(o){let c=s.get(o)||0;l=o+"-"+c,s.set(o,c+1)}}let f=Ew(t,n,l);if(f!==void 0)a.push(f)}return a}function aD(t,e,a){let i=p4(t.schema,e);if(a===null||a===void 0||typeof a==="number"&&Number.isNaN(a))return;if(Array.isArray(a))a=i.commaSeparated?uw(a):dw(a);if(i.property==="style"){let s=typeof a==="object"?a:iD(t,String(a));if(t.stylePropertyNameCase==="css")s=sD(s);return["style",s]}return[t.elementAttributeNameCase==="react"&&i.space?b4[i.property]||i.property:i.attribute,a]}function iD(t,e){try{return Nw.default(e,{reactCompat:!0})}catch(a){if(t.ignoreInvalidStyle)return{};let i=a,s=new oi("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=t.filePath||void 0,s.url=zw+"#cannot-parse-style-attribute",s}}function Uw(t,e,a){let i;if(!a)i={type:"Literal",value:e};else if(e.includes(".")){let s=e.split("."),n=-1,l;while(++n<s.length){let f=Ju(s[n])?{type:"Identifier",name:s[n]}:{type:"Literal",value:s[n]};l=l?{type:"MemberExpression",object:l,property:f,computed:Boolean(n&&f.type==="Literal"),optional:!1}:f}rs(l,"always a result"),i=l}else i=Ju(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(i.type==="Literal"){let s=i.value;return A4.call(t.components,s)?t.components[s]:s}if(t.evaluater)return t.evaluater.evaluateExpression(i);Tc(t)}function Tc(t,e){let a=new oi("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw a.file=t.filePath||void 0,a.url=zw+"#cannot-handle-mdx-estrees-without-createevaluater",a}function sD(t){let e={},a;for(a in t)if(A4.call(t,a))e[nD(a)]=t[a];return e}function nD(t){let e=t.replace(XM,lD);if(e.slice(0,3)==="ms-")e="-"+e;return e}function lD(t){return"-"+t.toLowerCase()}var Rc={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]};var ud=Ie(Pa(),1);var fD={};function k4(t,e){let a=e||fD,i=typeof a.includeImageAlt==="boolean"?a.includeImageAlt:!0,s=typeof a.includeHtml==="boolean"?a.includeHtml:!0;return Gw(t,i,s)}function Gw(t,e,a){if(rD(t)){if("value"in t)return t.type==="html"&&!a?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return Iw(t.children,e,a)}if(Array.isArray(t))return Iw(t,e,a);return""}function Iw(t,e,a){let i=[],s=-1;while(++s<t.length)i[s]=Gw(t[s],e,a);return i.join("")}function rD(t){return Boolean(t&&typeof t==="object")}var Xw=document.createElement("i");function no(t){let e="&"+t+";";Xw.innerHTML=e;let a=Xw.textContent;if(a.charCodeAt(a.length-1)===59&&t!=="semi")return!1;return a===e?!1:a}function Xi(t,e,a,i){let s=t.length,n=0,l;if(e<0)e=-e>s?0:s+e;else e=e>s?s:e;if(a=a>0?a:0,i.length<1e4)l=Array.from(i),l.unshift(e,a),t.splice(...l);else{if(a)t.splice(e,a);while(n<i.length)l=i.slice(n,n+1e4),l.unshift(e,0),t.splice(...l),n+=1e4,e+=1e4}}function os(t,e){if(t.length>0)return Xi(t,t.length,0,e),t;return e}var Kw={}.hasOwnProperty;function Lw(t){let e={},a=-1;while(++a<t.length)oD(e,t[a]);return e}function oD(t,e){let a;for(a in e){let s=(Kw.call(t,a)?t[a]:void 0)||(t[a]={}),n=e[a],l;if(n)for(l in n){if(!Kw.call(s,l))s[l]=[];let f=n[l];hD(s[l],Array.isArray(f)?f:f?[f]:[])}}}function hD(t,e){let a=-1,i=[];while(++a<e.length)(e[a].add==="after"?t:i).push(e[a]);Xi(t,0,0,i)}function t5(t,e){let a=Number.parseInt(t,e);if(a<9||a===11||a>13&&a<32||a>126&&a<160||a>55295&&a<57344||a>64975&&a<65008||(a&65535)===65535||(a&65535)===65534||a>1114111)return"�";return String.fromCodePoint(a)}function n1(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var $s=rl(/[A-Za-z]/),Ci=rl(/[\dA-Za-z]/),Vw=rl(/[#-'*+\--9=?A-Z^-~]/);function Nc(t){return t!==null&&(t<32||t===127)}var zc=rl(/\d/),Yw=rl(/[\dA-Fa-f]/),Jw=rl(/[!-/:-@[-`{-~]/);function Qt(t){return t!==null&&t<-2}function Wa(t){return t!==null&&(t<0||t===32)}function pe(t){return t===-2||t===-1||t===32}var Qw=rl(/\p{P}|\p{S}/u),Zw=rl(/\s/);function rl(t){return e;function e(a){return a!==null&&a>-1&&t.test(String.fromCharCode(a))}}function An(t){let e=[],a=-1,i=0,s=0;while(++a<t.length){let n=t.charCodeAt(a),l="";if(n===37&&Ci(t.charCodeAt(a+1))&&Ci(t.charCodeAt(a+2)))s=2;else if(n<128){if(!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(n)))l=String.fromCharCode(n)}else if(n>55295&&n<57344){let f=t.charCodeAt(a+1);if(n<56320&&f>56319&&f<57344)l=String.fromCharCode(n,f),s=1;else l="�"}else l=String.fromCharCode(n);if(l)e.push(t.slice(i,a),encodeURIComponent(l)),i=a+s+1,l="";if(s)a+=s,s=0}return e.join("")+t.slice(i)}function ve(t,e,a,i){let s=i?i-1:Number.POSITIVE_INFINITY,n=0;return l;function l(o){if(pe(o))return t.enter(a),f(o);return e(o)}function f(o){if(pe(o)&&n++<s)return t.consume(o),f;return t.exit(a),e(o)}}var $w={tokenize:cD};function cD(t){let e=t.attempt(this.parser.constructs.contentInitial,i,s),a;return e;function i(f){if(f===null){t.consume(f);return}return t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),ve(t,e,"linePrefix")}function s(f){return t.enter("paragraph"),n(f)}function n(f){let o=t.enter("chunkText",{contentType:"text",previous:a});if(a)a.next=o;return a=o,l(f)}function l(f){if(f===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(f);return}if(Qt(f))return t.consume(f),t.exit("chunkText"),n;return t.consume(f),l}}var Pw={tokenize:uD},Ww={tokenize:mD};function uD(t){let e=this,a=[],i=0,s,n,l;return f;function f(H){if(i<a.length){let M=a[i];return e.containerState=M[1],t.attempt(M[0].continuation,o,c)(H)}return c(H)}function o(H){if(i++,e.containerState._closeFlow){if(e.containerState._closeFlow=void 0,s)B();let M=e.events.length,D=M,T;while(D--)if(e.events[D][0]==="exit"&&e.events[D][1].type==="chunkFlow"){T=e.events[D][1].end;break}y(i);let z=M;while(z<e.events.length)e.events[z][1].end={...T},z++;return Xi(e.events,D+1,0,e.events.slice(M)),e.events.length=z,c(H)}return f(H)}function c(H){if(i===a.length){if(!s)return p(H);if(s.currentConstruct&&s.currentConstruct.concrete)return d(H);e.interrupt=Boolean(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(Ww,u,m)(H)}function u(H){if(s)B();return y(i),p(H)}function m(H){return e.parser.lazy[e.now().line]=i!==a.length,l=e.now().offset,d(H)}function p(H){return e.containerState={},t.attempt(Ww,w,d)(H)}function w(H){return i++,a.push([e.currentConstruct,e.containerState]),p(H)}function d(H){if(H===null){if(s)B();y(0),t.consume(H);return}return s=s||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:n}),v(H)}function v(H){if(H===null){k(t.exit("chunkFlow"),!0),y(0),t.consume(H);return}if(Qt(H))return t.consume(H),k(t.exit("chunkFlow")),i=0,e.interrupt=void 0,f;return t.consume(H),v}function k(H,M){let D=e.sliceStream(H);if(M)D.push(null);if(H.previous=n,n)n.next=H;if(n=H,s.defineSkip(H.start),s.write(D),e.parser.lazy[H.start.line]){let T=s.events.length;while(T--)if(s.events[T][1].start.offset<l&&(!s.events[T][1].end||s.events[T][1].end.offset>l))return;let z=e.events.length,E=z,V,tt;while(E--)if(e.events[E][0]==="exit"&&e.events[E][1].type==="chunkFlow"){if(V){tt=e.events[E][1].end;break}V=!0}y(i),T=z;while(T<e.events.length)e.events[T][1].end={...tt},T++;Xi(e.events,E+1,0,e.events.slice(z)),e.events.length=T}}function y(H){let M=a.length;while(M-- >H){let D=a[M];e.containerState=D[1],D[0].exit.call(e,t)}a.length=H}function B(){s.write([null]),n=void 0,s=void 0,e.containerState._closeFlow=void 0}}function mD(t,e,a){return ve(t,t.attempt(this.parser.constructs.document,e,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function C4(t){if(t===null||Wa(t)||Zw(t))return 1;if(Qw(t))return 2}function lo(t,e,a){let i=[],s=-1;while(++s<t.length){let n=t[s].resolveAll;if(n&&!i.includes(n))e=n(e,a),i.push(n)}return e}var Ec={name:"attention",resolveAll:gD,tokenize:bD};function gD(t,e){let a=-1,i,s,n,l,f,o,c,u;while(++a<t.length)if(t[a][0]==="enter"&&t[a][1].type==="attentionSequence"&&t[a][1]._close){i=a;while(i--)if(t[i][0]==="exit"&&t[i][1].type==="attentionSequence"&&t[i][1]._open&&e.sliceSerialize(t[i][1]).charCodeAt(0)===e.sliceSerialize(t[a][1]).charCodeAt(0)){if((t[i][1]._close||t[a][1]._open)&&(t[a][1].end.offset-t[a][1].start.offset)%3&&!((t[i][1].end.offset-t[i][1].start.offset+t[a][1].end.offset-t[a][1].start.offset)%3))continue;o=t[i][1].end.offset-t[i][1].start.offset>1&&t[a][1].end.offset-t[a][1].start.offset>1?2:1;let m={...t[i][1].end},p={...t[a][1].start};if(tj(m,-o),tj(p,o),l={type:o>1?"strongSequence":"emphasisSequence",start:m,end:{...t[i][1].end}},f={type:o>1?"strongSequence":"emphasisSequence",start:{...t[a][1].start},end:p},n={type:o>1?"strongText":"emphasisText",start:{...t[i][1].end},end:{...t[a][1].start}},s={type:o>1?"strong":"emphasis",start:{...l.start},end:{...f.end}},t[i][1].end={...l.start},t[a][1].start={...f.end},c=[],t[i][1].end.offset-t[i][1].start.offset)c=os(c,[["enter",t[i][1],e],["exit",t[i][1],e]]);if(c=os(c,[["enter",s,e],["enter",l,e],["exit",l,e],["enter",n,e]]),c=os(c,lo(e.parser.constructs.insideSpan.null,t.slice(i+1,a),e)),c=os(c,[["exit",n,e],["enter",f,e],["exit",f,e],["exit",s,e]]),t[a][1].end.offset-t[a][1].start.offset)u=2,c=os(c,[["enter",t[a][1],e],["exit",t[a][1],e]]);else u=0;Xi(t,i-1,a-i+3,c),a=i+c.length-u-2;break}}a=-1;while(++a<t.length)if(t[a][1].type==="attentionSequence")t[a][1].type="data";return t}function bD(t,e){let a=this.parser.constructs.attentionMarkers.null,i=this.previous,s=C4(i),n;return l;function l(o){return n=o,t.enter("attentionSequence"),f(o)}function f(o){if(o===n)return t.consume(o),f;let c=t.exit("attentionSequence"),u=C4(o),m=!u||u===2&&s||a.includes(o),p=!s||s===2&&u||a.includes(i);return c._open=Boolean(n===42?m:m&&(s||!p)),c._close=Boolean(n===42?p:p&&(u||!m)),e(o)}}function tj(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}var _4={name:"autolink",tokenize:pD};function pD(t,e,a){let i=0;return s;function s(w){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(w),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),n}function n(w){if($s(w))return t.consume(w),l;if(w===64)return a(w);return c(w)}function l(w){if(w===43||w===45||w===46||Ci(w))return i=1,f(w);return c(w)}function f(w){if(w===58)return t.consume(w),i=0,o;if((w===43||w===45||w===46||Ci(w))&&i++<32)return t.consume(w),f;return i=0,c(w)}function o(w){if(w===62)return t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(w),t.exit("autolinkMarker"),t.exit("autolink"),e;if(w===null||w===32||w===60||Nc(w))return a(w);return t.consume(w),o}function c(w){if(w===64)return t.consume(w),u;if(Vw(w))return t.consume(w),c;return a(w)}function u(w){return Ci(w)?m(w):a(w)}function m(w){if(w===46)return t.consume(w),i=0,u;if(w===62)return t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(w),t.exit("autolinkMarker"),t.exit("autolink"),e;return p(w)}function p(w){if((w===45||Ci(w))&&i++<63){let d=w===45?p:m;return t.consume(w),d}return a(w)}}var ol={partial:!0,tokenize:wD};function wD(t,e,a){return i;function i(n){return pe(n)?ve(t,s,"linePrefix")(n):s(n)}function s(n){return n===null||Qt(n)?e(n):a(n)}}var e5={continuation:{tokenize:dD},exit:qD,name:"blockQuote",tokenize:jD};function jD(t,e,a){let i=this;return s;function s(l){if(l===62){let f=i.containerState;if(!f.open)t.enter("blockQuote",{_container:!0}),f.open=!0;return t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(l),t.exit("blockQuoteMarker"),n}return a(l)}function n(l){if(pe(l))return t.enter("blockQuotePrefixWhitespace"),t.consume(l),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e;return t.exit("blockQuotePrefix"),e(l)}}function dD(t,e,a){let i=this;return s;function s(l){if(pe(l))return ve(t,n,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l);return n(l)}function n(l){return t.attempt(e5,e,a)(l)}}function qD(t){t.exit("blockQuote")}var a5={name:"characterEscape",tokenize:AD};function AD(t,e,a){return i;function i(n){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(n),t.exit("escapeMarker"),s}function s(n){if(Jw(n))return t.enter("characterEscapeValue"),t.consume(n),t.exit("characterEscapeValue"),t.exit("characterEscape"),e;return a(n)}}var i5={name:"characterReference",tokenize:vD};function vD(t,e,a){let i=this,s=0,n,l;return f;function f(m){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),o}function o(m){if(m===35)return t.enter("characterReferenceMarkerNumeric"),t.consume(m),t.exit("characterReferenceMarkerNumeric"),c;return t.enter("characterReferenceValue"),n=31,l=Ci,u(m)}function c(m){if(m===88||m===120)return t.enter("characterReferenceMarkerHexadecimal"),t.consume(m),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),n=6,l=Yw,u;return t.enter("characterReferenceValue"),n=7,l=zc,u(m)}function u(m){if(m===59&&s){let p=t.exit("characterReferenceValue");if(l===Ci&&!no(i.sliceSerialize(p)))return a(m);return t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),t.exit("characterReference"),e}if(l(m)&&s++<n)return t.consume(m),u;return a(m)}}var ej={partial:!0,tokenize:yD},s5={concrete:!0,name:"codeFenced",tokenize:SD};function SD(t,e,a){let i=this,s={partial:!0,tokenize:D},n=0,l=0,f;return o;function o(T){return c(T)}function c(T){let z=i.events[i.events.length-1];return n=z&&z[1].type==="linePrefix"?z[2].sliceSerialize(z[1],!0).length:0,f=T,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(T)}function u(T){if(T===f)return l++,t.consume(T),u;if(l<3)return a(T);return t.exit("codeFencedFenceSequence"),pe(T)?ve(t,m,"whitespace")(T):m(T)}function m(T){if(T===null||Qt(T))return t.exit("codeFencedFence"),i.interrupt?e(T):t.check(ej,v,M)(T);return t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),p(T)}function p(T){if(T===null||Qt(T))return t.exit("chunkString"),t.exit("codeFencedFenceInfo"),m(T);if(pe(T))return t.exit("chunkString"),t.exit("codeFencedFenceInfo"),ve(t,w,"whitespace")(T);if(T===96&&T===f)return a(T);return t.consume(T),p}function w(T){if(T===null||Qt(T))return m(T);return t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),d(T)}function d(T){if(T===null||Qt(T))return t.exit("chunkString"),t.exit("codeFencedFenceMeta"),m(T);if(T===96&&T===f)return a(T);return t.consume(T),d}function v(T){return t.attempt(s,M,k)(T)}function k(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),y}function y(T){return n>0&&pe(T)?ve(t,B,"linePrefix",n+1)(T):B(T)}function B(T){if(T===null||Qt(T))return t.check(ej,v,M)(T);return t.enter("codeFlowValue"),H(T)}function H(T){if(T===null||Qt(T))return t.exit("codeFlowValue"),B(T);return t.consume(T),H}function M(T){return t.exit("codeFenced"),e(T)}function D(T,z,E){let V=0;return tt;function tt(Y){return T.enter("lineEnding"),T.consume(Y),T.exit("lineEnding"),at}function at(Y){return T.enter("codeFencedFence"),pe(Y)?ve(T,Q,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Y):Q(Y)}function Q(Y){if(Y===f)return T.enter("codeFencedFenceSequence"),Z(Y);return E(Y)}function Z(Y){if(Y===f)return V++,T.consume(Y),Z;if(V>=l)return T.exit("codeFencedFenceSequence"),pe(Y)?ve(T,J,"whitespace")(Y):J(Y);return E(Y)}function J(Y){if(Y===null||Qt(Y))return T.exit("codeFencedFence"),z(Y);return E(Y)}}}function yD(t,e,a){let i=this;return s;function s(l){if(l===null)return a(l);return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),n}function n(l){return i.parser.lazy[i.now().line]?a(l):e(l)}}var xc={name:"codeIndented",tokenize:CD},kD={partial:!0,tokenize:_D};function CD(t,e,a){let i=this;return s;function s(c){return t.enter("codeIndented"),ve(t,n,"linePrefix",5)(c)}function n(c){let u=i.events[i.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?l(c):a(c)}function l(c){if(c===null)return o(c);if(Qt(c))return t.attempt(kD,l,o)(c);return t.enter("codeFlowValue"),f(c)}function f(c){if(c===null||Qt(c))return t.exit("codeFlowValue"),l(c);return t.consume(c),f}function o(c){return t.exit("codeIndented"),e(c)}}function _D(t,e,a){let i=this;return s;function s(l){if(i.parser.lazy[i.now().line])return a(l);if(Qt(l))return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),s;return ve(t,n,"linePrefix",5)(l)}function n(l){let f=i.events[i.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?e(l):Qt(l)?s(l):a(l)}}var F4={name:"codeText",previous:BD,resolve:FD,tokenize:OD};function FD(t){let e=t.length-4,a=3,i,s;if((t[a][1].type==="lineEnding"||t[a][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){i=a;while(++i<e)if(t[i][1].type==="codeTextData"){t[a][1].type="codeTextPadding",t[e][1].type="codeTextPadding",a+=2,e-=2;break}}i=a-1,e++;while(++i<=e)if(s===void 0){if(i!==e&&t[i][1].type!=="lineEnding")s=i}else if(i===e||t[i][1].type==="lineEnding"){if(t[s][1].type="codeTextData",i!==s+2)t[s][1].end=t[i-1][1].end,t.splice(s+2,i-s-2),e-=i-s-2,i=s+2;s=void 0}return t}function BD(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function OD(t,e,a){let i=this,s=0,n,l;return f;function f(p){return t.enter("codeText"),t.enter("codeTextSequence"),o(p)}function o(p){if(p===96)return t.consume(p),s++,o;return t.exit("codeTextSequence"),c(p)}function c(p){if(p===null)return a(p);if(p===32)return t.enter("space"),t.consume(p),t.exit("space"),c;if(p===96)return l=t.enter("codeTextSequence"),n=0,m(p);if(Qt(p))return t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),c;return t.enter("codeTextData"),u(p)}function u(p){if(p===null||p===32||p===96||Qt(p))return t.exit("codeTextData"),c(p);return t.consume(p),u}function m(p){if(p===96)return t.consume(p),n++,m;if(n===s)return t.exit("codeTextSequence"),t.exit("codeText"),e(p);return l.type="codeTextData",u(p)}}class B4{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");if(t<this.left.length)return this.left[t];return this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,e){let a=e===null||e===void 0?Number.POSITIVE_INFINITY:e;if(a<this.left.length)return this.left.slice(t,a);if(t>this.left.length)return this.right.slice(this.right.length-a+this.left.length,this.right.length-t+this.left.length).reverse();return this.left.slice(t).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(t,e,a){let i=e||0;this.setCursor(Math.trunc(t));let s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);if(a)Uc(this.left,a);return s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Uc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Uc(this.right,t.reverse())}setCursor(t){if(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0)return;if(t<this.left.length){let e=this.left.splice(t,Number.POSITIVE_INFINITY);Uc(this.right,e.reverse())}else{let e=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Uc(this.left,e.reverse())}}}function Uc(t,e){let a=0;if(e.length<1e4)t.push(...e);else while(a<e.length)t.push(...e.slice(a,a+1e4)),a+=1e4}function n5(t){let e={},a=-1,i,s,n,l,f,o,c,u=new B4(t);while(++a<u.length){while(a in e)a=e[a];if(i=u.get(a),a&&i[1].type==="chunkFlow"&&u.get(a-1)[1].type==="listItemPrefix"){if(o=i[1]._tokenizer.events,n=0,n<o.length&&o[n][1].type==="lineEndingBlank")n+=2;if(n<o.length&&o[n][1].type==="content")while(++n<o.length){if(o[n][1].type==="content")break;if(o[n][1].type==="chunkText")o[n][1]._isInFirstContentOfListItem=!0,n++}}if(i[0]==="enter"){if(i[1].contentType)Object.assign(e,HD(u,a)),a=e[a],c=!0}else if(i[1]._container){n=a,s=void 0;while(n--)if(l=u.get(n),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank"){if(l[0]==="enter"){if(s)u.get(s)[1].type="lineEndingBlank";l[1].type="lineEnding",s=n}}else if(l[1].type==="linePrefix"||l[1].type==="listItemIndent");else break;if(s)i[1].end={...u.get(s)[1].start},f=u.slice(s,a),f.unshift(i),u.splice(s,a-s+1,f)}}return Xi(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function HD(t,e){let a=t.get(e)[1],i=t.get(e)[2],s=e-1,n=[],l=a._tokenizer;if(!l){if(l=i.parser[a.contentType](a.start),a._contentTypeTextTrailing)l._contentTypeTextTrailing=!0}let f=l.events,o=[],c={},u,m,p=-1,w=a,d=0,v=0,k=[v];while(w){while(t.get(++s)[1]!==w);if(n.push(s),!w._tokenizer){if(u=i.sliceStream(w),!w.next)u.push(null);if(m)l.defineSkip(w.start);if(w._isInFirstContentOfListItem)l._gfmTasklistFirstContentOfListItem=!0;if(l.write(u),w._isInFirstContentOfListItem)l._gfmTasklistFirstContentOfListItem=void 0}m=w,w=w.next}w=a;while(++p<f.length)if(f[p][0]==="exit"&&f[p-1][0]==="enter"&&f[p][1].type===f[p-1][1].type&&f[p][1].start.line!==f[p][1].end.line)v=p+1,k.push(v),w._tokenizer=void 0,w.previous=void 0,w=w.next;if(l.events=[],w)w._tokenizer=void 0,w.previous=void 0;else k.pop();p=k.length;while(p--){let y=f.slice(k[p],k[p+1]),B=n.pop();o.push([B,B+y.length-1]),t.splice(B,2,y)}o.reverse(),p=-1;while(++p<o.length)c[d+o[p][0]]=d+o[p][1],d+=o[p][1]-o[p][0]-1;return c}var O4={resolve:DD,tokenize:TD},MD={partial:!0,tokenize:RD};function DD(t){return n5(t),t}function TD(t,e){let a;return i;function i(f){return t.enter("content"),a=t.enter("chunkContent",{contentType:"content"}),s(f)}function s(f){if(f===null)return n(f);if(Qt(f))return t.check(MD,l,n)(f);return t.consume(f),s}function n(f){return t.exit("chunkContent"),t.exit("content"),e(f)}function l(f){return t.consume(f),t.exit("chunkContent"),a.next=t.enter("chunkContent",{contentType:"content",previous:a}),a=a.next,s}}function RD(t,e,a){let i=this;return s;function s(l){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),ve(t,n,"linePrefix")}function n(l){if(l===null||Qt(l))return a(l);let f=i.events[i.events.length-1];if(!i.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4)return e(l);return t.interrupt(i.parser.constructs.flow,a,e)(l)}}function l5(t,e,a,i,s,n,l,f,o){let c=o||Number.POSITIVE_INFINITY,u=0;return m;function m(y){if(y===60)return t.enter(i),t.enter(s),t.enter(n),t.consume(y),t.exit(n),p;if(y===null||y===32||y===41||Nc(y))return a(y);return t.enter(i),t.enter(l),t.enter(f),t.enter("chunkString",{contentType:"string"}),v(y)}function p(y){if(y===62)return t.enter(n),t.consume(y),t.exit(n),t.exit(s),t.exit(i),e;return t.enter(f),t.enter("chunkString",{contentType:"string"}),w(y)}function w(y){if(y===62)return t.exit("chunkString"),t.exit(f),p(y);if(y===null||y===60||Qt(y))return a(y);return t.consume(y),y===92?d:w}function d(y){if(y===60||y===62||y===92)return t.consume(y),w;return w(y)}function v(y){if(!u&&(y===null||y===41||Wa(y)))return t.exit("chunkString"),t.exit(f),t.exit(l),t.exit(i),e(y);if(u<c&&y===40)return t.consume(y),u++,v;if(y===41)return t.consume(y),u--,v;if(y===null||y===32||y===40||Nc(y))return a(y);return t.consume(y),y===92?k:v}function k(y){if(y===40||y===41||y===92)return t.consume(y),v;return v(y)}}function f5(t,e,a,i,s,n){let l=this,f=0,o;return c;function c(w){return t.enter(i),t.enter(s),t.consume(w),t.exit(s),t.enter(n),u}function u(w){if(f>999||w===null||w===91||w===93&&!o||w===94&&!f&&"_hiddenFootnoteSupport"in l.parser.constructs)return a(w);if(w===93)return t.exit(n),t.enter(s),t.consume(w),t.exit(s),t.exit(i),e;if(Qt(w))return t.enter("lineEnding"),t.consume(w),t.exit("lineEnding"),u;return t.enter("chunkString",{contentType:"string"}),m(w)}function m(w){if(w===null||w===91||w===93||Qt(w)||f++>999)return t.exit("chunkString"),u(w);if(t.consume(w),!o)o=!pe(w);return w===92?p:m}function p(w){if(w===91||w===92||w===93)return t.consume(w),f++,m;return m(w)}}function r5(t,e,a,i,s,n){let l;return f;function f(p){if(p===34||p===39||p===40)return t.enter(i),t.enter(s),t.consume(p),t.exit(s),l=p===40?41:p,o;return a(p)}function o(p){if(p===l)return t.enter(s),t.consume(p),t.exit(s),t.exit(i),e;return t.enter(n),c(p)}function c(p){if(p===l)return t.exit(n),o(l);if(p===null)return a(p);if(Qt(p))return t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),ve(t,c,"linePrefix");return t.enter("chunkString",{contentType:"string"}),u(p)}function u(p){if(p===l||p===null||Qt(p))return t.exit("chunkString"),c(p);return t.consume(p),p===92?m:u}function m(p){if(p===l||p===92)return t.consume(p),u;return u(p)}}function _f(t,e){let a;return i;function i(s){if(Qt(s))return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),a=!0,i;if(pe(s))return ve(t,i,a?"linePrefix":"lineSuffix")(s);return e(s)}}var H4={name:"definition",tokenize:zD},ND={partial:!0,tokenize:ED};function zD(t,e,a){let i=this,s;return n;function n(w){return t.enter("definition"),l(w)}function l(w){return f5.call(i,t,f,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function f(w){if(s=n1(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),w===58)return t.enter("definitionMarker"),t.consume(w),t.exit("definitionMarker"),o;return a(w)}function o(w){return Wa(w)?_f(t,c)(w):c(w)}function c(w){return l5(t,u,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function u(w){return t.attempt(ND,m,m)(w)}function m(w){return pe(w)?ve(t,p,"whitespace")(w):p(w)}function p(w){if(w===null||Qt(w))return t.exit("definition"),i.parser.defined.push(s),e(w);return a(w)}}function ED(t,e,a){return i;function i(f){return Wa(f)?_f(t,s)(f):a(f)}function s(f){return r5(t,n,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function n(f){return pe(f)?ve(t,l,"whitespace")(f):l(f)}function l(f){return f===null||Qt(f)?e(f):a(f)}}var M4={name:"hardBreakEscape",tokenize:xD};function xD(t,e,a){return i;function i(n){return t.enter("hardBreakEscape"),t.consume(n),s}function s(n){if(Qt(n))return t.exit("hardBreakEscape"),e(n);return a(n)}}var D4={name:"headingAtx",resolve:UD,tokenize:ID};function UD(t,e){let a=t.length-2,i=3,s,n;if(t[i][1].type==="whitespace")i+=2;if(a-2>i&&t[a][1].type==="whitespace")a-=2;if(t[a][1].type==="atxHeadingSequence"&&(i===a-1||a-4>i&&t[a-2][1].type==="whitespace"))a-=i+1===a?2:4;if(a>i)s={type:"atxHeadingText",start:t[i][1].start,end:t[a][1].end},n={type:"chunkText",start:t[i][1].start,end:t[a][1].end,contentType:"text"},Xi(t,i,a-i+1,[["enter",s,e],["enter",n,e],["exit",n,e],["exit",s,e]]);return t}function ID(t,e,a){let i=0;return s;function s(u){return t.enter("atxHeading"),n(u)}function n(u){return t.enter("atxHeadingSequence"),l(u)}function l(u){if(u===35&&i++<6)return t.consume(u),l;if(u===null||Wa(u))return t.exit("atxHeadingSequence"),f(u);return a(u)}function f(u){if(u===35)return t.enter("atxHeadingSequence"),o(u);if(u===null||Qt(u))return t.exit("atxHeading"),e(u);if(pe(u))return ve(t,f,"whitespace")(u);return t.enter("atxHeadingText"),c(u)}function o(u){if(u===35)return t.consume(u),o;return t.exit("atxHeadingSequence"),f(u)}function c(u){if(u===null||u===35||Wa(u))return t.exit("atxHeadingText"),f(u);return t.consume(u),c}}var aj=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],T4=["pre","script","style","textarea"];var R4={concrete:!0,name:"htmlFlow",resolveTo:KD,tokenize:LD},GD={partial:!0,tokenize:YD},XD={partial:!0,tokenize:VD};function KD(t){let e=t.length;while(e--)if(t[e][0]==="enter"&&t[e][1].type==="htmlFlow")break;if(e>1&&t[e-2][1].type==="linePrefix")t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2);return t}function LD(t,e,a){let i=this,s,n,l,f,o;return c;function c(G){return u(G)}function u(G){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(G),m}function m(G){if(G===33)return t.consume(G),p;if(G===47)return t.consume(G),n=!0,v;if(G===63)return t.consume(G),s=3,i.interrupt?e:R;if($s(G))return t.consume(G),l=String.fromCharCode(G),k;return a(G)}function p(G){if(G===45)return t.consume(G),s=2,w;if(G===91)return t.consume(G),s=5,f=0,d;if($s(G))return t.consume(G),s=4,i.interrupt?e:R;return a(G)}function w(G){if(G===45)return t.consume(G),i.interrupt?e:R;return a(G)}function d(G){if(G==="CDATA[".charCodeAt(f++)){if(t.consume(G),f===6)return i.interrupt?e:Q;return d}return a(G)}function v(G){if($s(G))return t.consume(G),l=String.fromCharCode(G),k;return a(G)}function k(G){if(G===null||G===47||G===62||Wa(G)){let Ct=G===47,Kt=l.toLowerCase();if(!Ct&&!n&&T4.includes(Kt))return s=1,i.interrupt?e(G):Q(G);if(aj.includes(l.toLowerCase())){if(s=6,Ct)return t.consume(G),y;return i.interrupt?e(G):Q(G)}return s=7,i.interrupt&&!i.parser.lazy[i.now().line]?a(G):n?B(G):H(G)}if(G===45||Ci(G))return t.consume(G),l+=String.fromCharCode(G),k;return a(G)}function y(G){if(G===62)return t.consume(G),i.interrupt?e:Q;return a(G)}function B(G){if(pe(G))return t.consume(G),B;return tt(G)}function H(G){if(G===47)return t.consume(G),tt;if(G===58||G===95||$s(G))return t.consume(G),M;if(pe(G))return t.consume(G),H;return tt(G)}function M(G){if(G===45||G===46||G===58||G===95||Ci(G))return t.consume(G),M;return D(G)}function D(G){if(G===61)return t.consume(G),T;if(pe(G))return t.consume(G),D;return H(G)}function T(G){if(G===null||G===60||G===61||G===62||G===96)return a(G);if(G===34||G===39)return t.consume(G),o=G,z;if(pe(G))return t.consume(G),T;return E(G)}function z(G){if(G===o)return t.consume(G),o=null,V;if(G===null||Qt(G))return a(G);return t.consume(G),z}function E(G){if(G===null||G===34||G===39||G===47||G===60||G===61||G===62||G===96||Wa(G))return D(G);return t.consume(G),E}function V(G){if(G===47||G===62||pe(G))return H(G);return a(G)}function tt(G){if(G===62)return t.consume(G),at;return a(G)}function at(G){if(G===null||Qt(G))return Q(G);if(pe(G))return t.consume(G),at;return a(G)}function Q(G){if(G===45&&s===2)return t.consume(G),W;if(G===60&&s===1)return t.consume(G),ft;if(G===62&&s===4)return t.consume(G),ct;if(G===63&&s===3)return t.consume(G),R;if(G===93&&s===5)return t.consume(G),qt;if(Qt(G)&&(s===6||s===7))return t.exit("htmlFlowData"),t.check(GD,pt,Z)(G);if(G===null||Qt(G))return t.exit("htmlFlowData"),Z(G);return t.consume(G),Q}function Z(G){return t.check(XD,J,pt)(G)}function J(G){return t.enter("lineEnding"),t.consume(G),t.exit("lineEnding"),Y}function Y(G){if(G===null||Qt(G))return Z(G);return t.enter("htmlFlowData"),Q(G)}function W(G){if(G===45)return t.consume(G),R;return Q(G)}function ft(G){if(G===47)return t.consume(G),l="",nt;return Q(G)}function nt(G){if(G===62){let Ct=l.toLowerCase();if(T4.includes(Ct))return t.consume(G),ct;return Q(G)}if($s(G)&&l.length<8)return t.consume(G),l+=String.fromCharCode(G),nt;return Q(G)}function qt(G){if(G===93)return t.consume(G),R;return Q(G)}function R(G){if(G===62)return t.consume(G),ct;if(G===45&&s===2)return t.consume(G),R;return Q(G)}function ct(G){if(G===null||Qt(G))return t.exit("htmlFlowData"),pt(G);return t.consume(G),ct}function pt(G){return t.exit("htmlFlow"),e(G)}}function VD(t,e,a){let i=this;return s;function s(l){if(Qt(l))return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),n;return a(l)}function n(l){return i.parser.lazy[i.now().line]?a(l):e(l)}}function YD(t,e,a){return i;function i(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(ol,e,a)}}var N4={name:"htmlText",tokenize:JD};function JD(t,e,a){let i=this,s,n,l;return f;function f(R){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(R),o}function o(R){if(R===33)return t.consume(R),c;if(R===47)return t.consume(R),D;if(R===63)return t.consume(R),H;if($s(R))return t.consume(R),E;return a(R)}function c(R){if(R===45)return t.consume(R),u;if(R===91)return t.consume(R),n=0,d;if($s(R))return t.consume(R),B;return a(R)}function u(R){if(R===45)return t.consume(R),w;return a(R)}function m(R){if(R===null)return a(R);if(R===45)return t.consume(R),p;if(Qt(R))return l=m,ft(R);return t.consume(R),m}function p(R){if(R===45)return t.consume(R),w;return m(R)}function w(R){return R===62?W(R):R===45?p(R):m(R)}function d(R){if(R==="CDATA[".charCodeAt(n++))return t.consume(R),n===6?v:d;return a(R)}function v(R){if(R===null)return a(R);if(R===93)return t.consume(R),k;if(Qt(R))return l=v,ft(R);return t.consume(R),v}function k(R){if(R===93)return t.consume(R),y;return v(R)}function y(R){if(R===62)return W(R);if(R===93)return t.consume(R),y;return v(R)}function B(R){if(R===null||R===62)return W(R);if(Qt(R))return l=B,ft(R);return t.consume(R),B}function H(R){if(R===null)return a(R);if(R===63)return t.consume(R),M;if(Qt(R))return l=H,ft(R);return t.consume(R),H}function M(R){return R===62?W(R):H(R)}function D(R){if($s(R))return t.consume(R),T;return a(R)}function T(R){if(R===45||Ci(R))return t.consume(R),T;return z(R)}function z(R){if(Qt(R))return l=z,ft(R);if(pe(R))return t.consume(R),z;return W(R)}function E(R){if(R===45||Ci(R))return t.consume(R),E;if(R===47||R===62||Wa(R))return V(R);return a(R)}function V(R){if(R===47)return t.consume(R),W;if(R===58||R===95||$s(R))return t.consume(R),tt;if(Qt(R))return l=V,ft(R);if(pe(R))return t.consume(R),V;return W(R)}function tt(R){if(R===45||R===46||R===58||R===95||Ci(R))return t.consume(R),tt;return at(R)}function at(R){if(R===61)return t.consume(R),Q;if(Qt(R))return l=at,ft(R);if(pe(R))return t.consume(R),at;return V(R)}function Q(R){if(R===null||R===60||R===61||R===62||R===96)return a(R);if(R===34||R===39)return t.consume(R),s=R,Z;if(Qt(R))return l=Q,ft(R);if(pe(R))return t.consume(R),Q;return t.consume(R),J}function Z(R){if(R===s)return t.consume(R),s=void 0,Y;if(R===null)return a(R);if(Qt(R))return l=Z,ft(R);return t.consume(R),Z}function J(R){if(R===null||R===34||R===39||R===60||R===61||R===96)return a(R);if(R===47||R===62||Wa(R))return V(R);return t.consume(R),J}function Y(R){if(R===47||R===62||Wa(R))return V(R);return a(R)}function W(R){if(R===62)return t.consume(R),t.exit("htmlTextData"),t.exit("htmlText"),e;return a(R)}function ft(R){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),nt}function nt(R){return pe(R)?ve(t,qt,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):qt(R)}function qt(R){return t.enter("htmlTextData"),l(R)}}var Ff={name:"labelEnd",resolveAll:WD,resolveTo:PD,tokenize:tT},QD={tokenize:eT},ZD={tokenize:aT},$D={tokenize:iT};function WD(t){let e=-1,a=[];while(++e<t.length){let i=t[e][1];if(a.push(t[e]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){let s=i.type==="labelImage"?4:2;i.type="data",e+=s}}if(t.length!==a.length)Xi(t,0,t.length,a);return t}function PD(t,e){let a=t.length,i=0,s,n,l,f;while(a--)if(s=t[a][1],n){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;if(t[a][0]==="enter"&&s.type==="labelLink")s._inactive=!0}else if(l){if(t[a][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced){if(n=a,s.type!=="labelLink"){i=2;break}}}else if(s.type==="labelEnd")l=a;let o={type:t[n][1].type==="labelLink"?"link":"image",start:{...t[n][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[n][1].start},end:{...t[l][1].end}},u={type:"labelText",start:{...t[n+i+2][1].end},end:{...t[l-2][1].start}};return f=[["enter",o,e],["enter",c,e]],f=os(f,t.slice(n+1,n+i+3)),f=os(f,[["enter",u,e]]),f=os(f,lo(e.parser.constructs.insideSpan.null,t.slice(n+i+4,l-3),e)),f=os(f,[["exit",u,e],t[l-2],t[l-1],["exit",c,e]]),f=os(f,t.slice(l+1)),f=os(f,[["exit",o,e]]),Xi(t,n,t.length,f),t}function tT(t,e,a){let i=this,s=i.events.length,n,l;while(s--)if((i.events[s][1].type==="labelImage"||i.events[s][1].type==="labelLink")&&!i.events[s][1]._balanced){n=i.events[s][1];break}return f;function f(p){if(!n)return a(p);if(n._inactive)return m(p);return l=i.parser.defined.includes(n1(i.sliceSerialize({start:n.end,end:i.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(p),t.exit("labelMarker"),t.exit("labelEnd"),o}function o(p){if(p===40)return t.attempt(QD,u,l?u:m)(p);if(p===91)return t.attempt(ZD,u,l?c:m)(p);return l?u(p):m(p)}function c(p){return t.attempt($D,u,m)(p)}function u(p){return e(p)}function m(p){return n._balanced=!0,a(p)}}function eT(t,e,a){return i;function i(m){return t.enter("resource"),t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),s}function s(m){return Wa(m)?_f(t,n)(m):n(m)}function n(m){if(m===41)return u(m);return l5(t,l,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function l(m){return Wa(m)?_f(t,o)(m):u(m)}function f(m){return a(m)}function o(m){if(m===34||m===39||m===40)return r5(t,c,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(m);return u(m)}function c(m){return Wa(m)?_f(t,u)(m):u(m)}function u(m){if(m===41)return t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),t.exit("resource"),e;return a(m)}}function aT(t,e,a){let i=this;return s;function s(f){return f5.call(i,t,n,l,"reference","referenceMarker","referenceString")(f)}function n(f){return i.parser.defined.includes(n1(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?e(f):a(f)}function l(f){return a(f)}}function iT(t,e,a){return i;function i(n){return t.enter("reference"),t.enter("referenceMarker"),t.consume(n),t.exit("referenceMarker"),s}function s(n){if(n===93)return t.enter("referenceMarker"),t.consume(n),t.exit("referenceMarker"),t.exit("reference"),e;return a(n)}}var z4={name:"labelStartImage",resolveAll:Ff.resolveAll,tokenize:sT};function sT(t,e,a){let i=this;return s;function s(f){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(f),t.exit("labelImageMarker"),n}function n(f){if(f===91)return t.enter("labelMarker"),t.consume(f),t.exit("labelMarker"),t.exit("labelImage"),l;return a(f)}function l(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?a(f):e(f)}}var E4={name:"labelStartLink",resolveAll:Ff.resolveAll,tokenize:nT};function nT(t,e,a){let i=this;return s;function s(l){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(l),t.exit("labelMarker"),t.exit("labelLink"),n}function n(l){return l===94&&"_hiddenFootnoteSupport"in i.parser.constructs?a(l):e(l)}}var Ic={name:"lineEnding",tokenize:lT};function lT(t,e){return a;function a(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),ve(t,e,"linePrefix")}}var Bf={name:"thematicBreak",tokenize:fT};function fT(t,e,a){let i=0,s;return n;function n(c){return t.enter("thematicBreak"),l(c)}function l(c){return s=c,f(c)}function f(c){if(c===s)return t.enter("thematicBreakSequence"),o(c);if(i>=3&&(c===null||Qt(c)))return t.exit("thematicBreak"),e(c);return a(c)}function o(c){if(c===s)return t.consume(c),i++,o;return t.exit("thematicBreakSequence"),pe(c)?ve(t,f,"whitespace")(c):f(c)}}var ts={continuation:{tokenize:cT},exit:mT,name:"list",tokenize:hT},rT={partial:!0,tokenize:gT},oT={partial:!0,tokenize:uT};function hT(t,e,a){let i=this,s=i.events[i.events.length-1],n=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,l=0;return f;function f(w){let d=i.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(d==="listUnordered"?!i.containerState.marker||w===i.containerState.marker:zc(w)){if(!i.containerState.type)i.containerState.type=d,t.enter(d,{_container:!0});if(d==="listUnordered")return t.enter("listItemPrefix"),w===42||w===45?t.check(Bf,a,c)(w):c(w);if(!i.interrupt||w===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),o(w)}return a(w)}function o(w){if(zc(w)&&++l<10)return t.consume(w),o;if((!i.interrupt||l<2)&&(i.containerState.marker?w===i.containerState.marker:w===41||w===46))return t.exit("listItemValue"),c(w);return a(w)}function c(w){return t.enter("listItemMarker"),t.consume(w),t.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||w,t.check(ol,i.interrupt?a:u,t.attempt(rT,p,m))}function u(w){return i.containerState.initialBlankLine=!0,n++,p(w)}function m(w){if(pe(w))return t.enter("listItemPrefixWhitespace"),t.consume(w),t.exit("listItemPrefixWhitespace"),p;return a(w)}function p(w){return i.containerState.size=n+i.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(w)}}function cT(t,e,a){let i=this;return i.containerState._closeFlow=void 0,t.check(ol,s,n);function s(f){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,ve(t,e,"listItemIndent",i.containerState.size+1)(f)}function n(f){if(i.containerState.furtherBlankLines||!pe(f))return i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,l(f);return i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,t.attempt(oT,e,l)(f)}function l(f){return i.containerState._closeFlow=!0,i.interrupt=void 0,ve(t,t.attempt(ts,e,a),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function uT(t,e,a){let i=this;return ve(t,s,"listItemIndent",i.containerState.size+1);function s(n){let l=i.events[i.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===i.containerState.size?e(n):a(n)}}function mT(t){t.exit(this.containerState.type)}function gT(t,e,a){let i=this;return ve(t,s,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(n){let l=i.events[i.events.length-1];return!pe(n)&&l&&l[1].type==="listItemPrefixWhitespace"?e(n):a(n)}}var o5={name:"setextUnderline",resolveTo:bT,tokenize:pT};function bT(t,e){let a=t.length,i,s,n;while(a--)if(t[a][0]==="enter"){if(t[a][1].type==="content"){i=a;break}if(t[a][1].type==="paragraph")s=a}else{if(t[a][1].type==="content")t.splice(a,1);if(!n&&t[a][1].type==="definition")n=a}let l={type:"setextHeading",start:{...t[i][1].start},end:{...t[t.length-1][1].end}};if(t[s][1].type="setextHeadingText",n)t.splice(s,0,["enter",l,e]),t.splice(n+1,0,["exit",t[i][1],e]),t[i][1].end={...t[n][1].end};else t[i][1]=l;return t.push(["exit",l,e]),t}function pT(t,e,a){let i=this,s;return n;function n(c){let u=i.events.length,m;while(u--)if(i.events[u][1].type!=="lineEnding"&&i.events[u][1].type!=="linePrefix"&&i.events[u][1].type!=="content"){m=i.events[u][1].type==="paragraph";break}if(!i.parser.lazy[i.now().line]&&(i.interrupt||m))return t.enter("setextHeadingLine"),s=c,l(c);return a(c)}function l(c){return t.enter("setextHeadingLineSequence"),f(c)}function f(c){if(c===s)return t.consume(c),f;return t.exit("setextHeadingLineSequence"),pe(c)?ve(t,o,"lineSuffix")(c):o(c)}function o(c){if(c===null||Qt(c))return t.exit("setextHeadingLine"),e(c);return a(c)}}var ij={tokenize:wT};function wT(t){let e=this,a=t.attempt(ol,i,t.attempt(this.parser.constructs.flowInitial,s,ve(t,t.attempt(this.parser.constructs.flow,s,t.attempt(O4,s)),"linePrefix")));return a;function i(n){if(n===null){t.consume(n);return}return t.enter("lineEndingBlank"),t.consume(n),t.exit("lineEndingBlank"),e.currentConstruct=void 0,a}function s(n){if(n===null){t.consume(n);return}return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),e.currentConstruct=void 0,a}}var sj={resolveAll:rj()},nj=fj("string"),lj=fj("text");function fj(t){return{resolveAll:rj(t==="text"?jT:void 0),tokenize:e};function e(a){let i=this,s=this.parser.constructs[t],n=a.attempt(s,l,f);return l;function l(u){return c(u)?n(u):f(u)}function f(u){if(u===null){a.consume(u);return}return a.enter("data"),a.consume(u),o}function o(u){if(c(u))return a.exit("data"),n(u);return a.consume(u),o}function c(u){if(u===null)return!0;let m=s[u],p=-1;if(m)while(++p<m.length){let w=m[p];if(!w.previous||w.previous.call(i,i.previous))return!0}return!1}}}function rj(t){return e;function e(a,i){let s=-1,n;while(++s<=a.length)if(n===void 0){if(a[s]&&a[s][1].type==="data")n=s,s++}else if(!a[s]||a[s][1].type!=="data"){if(s!==n+2)a[n][1].end=a[s-1][1].end,a.splice(n+2,s-n-2),s=n+2;n=void 0}return t?t(a,i):a}}function jT(t,e){let a=0;while(++a<=t.length)if((a===t.length||t[a][1].type==="lineEnding")&&t[a-1][1].type==="data"){let i=t[a-1][1],s=e.sliceStream(i),n=s.length,l=-1,f=0,o;while(n--){let c=s[n];if(typeof c==="string"){l=c.length;while(c.charCodeAt(l-1)===32)f++,l--;if(l)break;l=-1}else if(c===-2)o=!0,f++;else if(c===-1);else{n++;break}}if(e._contentTypeTextTrailing&&a===t.length)f=0;if(f){let c={type:a===t.length||o||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:n?l:i.start._bufferIndex+l,_index:i.start._index+n,line:i.end.line,column:i.end.column-f,offset:i.end.offset-f},end:{...i.end}};if(i.end={...c.start},i.start.offset===i.end.offset)Object.assign(i,c);else t.splice(a,0,["enter",c,e],["exit",c,e]),a+=2}a++}return t}var x4={};o4(x4,{text:()=>yT,string:()=>ST,insideSpan:()=>kT,flowInitial:()=>AT,flow:()=>vT,document:()=>dT,disable:()=>_T,contentInitial:()=>qT,attentionMarkers:()=>CT});var dT={[42]:ts,[43]:ts,[45]:ts,[48]:ts,[49]:ts,[50]:ts,[51]:ts,[52]:ts,[53]:ts,[54]:ts,[55]:ts,[56]:ts,[57]:ts,[62]:e5},qT={[91]:H4},AT={[-2]:xc,[-1]:xc,[32]:xc},vT={[35]:D4,[42]:Bf,[45]:[o5,Bf],[60]:R4,[61]:o5,[95]:Bf,[96]:s5,[126]:s5},ST={[38]:i5,[92]:a5},yT={[-5]:Ic,[-4]:Ic,[-3]:Ic,[33]:z4,[38]:i5,[42]:Ec,[60]:[_4,N4],[91]:E4,[92]:[M4,a5],[93]:Ff,[95]:Ec,[96]:F4},kT={null:[Ec,sj]},CT={null:[42,95]},_T={null:[]};function oj(t,e,a){let i={_bufferIndex:-1,_index:0,line:a&&a.line||1,column:a&&a.column||1,offset:a&&a.offset||0},s={},n=[],l=[],f=[],o=!0,c={attempt:V(z),check:V(E),consume:M,enter:D,exit:T,interrupt:V(E,{interrupt:!0})},u={code:null,containerState:{},defineSkip:y,events:[],now:k,parser:t,previous:null,sliceSerialize:d,sliceStream:v,write:w},m=e.tokenize.call(u,c),p;if(e.resolveAll)n.push(e);return u;function w(Z){if(l=os(l,Z),B(),l[l.length-1]!==null)return[];return tt(e,0),u.events=lo(n,u.events,u),u.events}function d(Z,J){return BT(v(Z),J)}function v(Z){return FT(l,Z)}function k(){let{_bufferIndex:Z,_index:J,line:Y,column:W,offset:ft}=i;return{_bufferIndex:Z,_index:J,line:Y,column:W,offset:ft}}function y(Z){s[Z.line]=Z.column,Q()}function B(){let Z;while(i._index<l.length){let J=l[i._index];if(typeof J==="string"){if(Z=i._index,i._bufferIndex<0)i._bufferIndex=0;while(i._index===Z&&i._bufferIndex<J.length)H(J.charCodeAt(i._bufferIndex))}else H(J)}}function H(Z){o=void 0,p=Z,m=m(Z)}function M(Z){if(Qt(Z))i.line++,i.column=1,i.offset+=Z===-3?2:1,Q();else if(Z!==-1)i.column++,i.offset++;if(i._bufferIndex<0)i._index++;else if(i._bufferIndex++,i._bufferIndex===l[i._index].length)i._bufferIndex=-1,i._index++;u.previous=Z,o=!0}function D(Z,J){let Y=J||{};return Y.type=Z,Y.start=k(),u.events.push(["enter",Y,u]),f.push(Y),Y}function T(Z){let J=f.pop();return J.end=k(),u.events.push(["exit",J,u]),J}function z(Z,J){tt(Z,J.from)}function E(Z,J){J.restore()}function V(Z,J){return Y;function Y(W,ft,nt){let qt,R,ct,pt;return Array.isArray(W)?Ct(W):("tokenize"in W)?Ct([W]):G(W);function G(Et){return $t;function $t(Dt){let Mt=Dt!==null&&Et[Dt],Xt=Dt!==null&&Et.null,Gt=[...Array.isArray(Mt)?Mt:Mt?[Mt]:[],...Array.isArray(Xt)?Xt:Xt?[Xt]:[]];return Ct(Gt)(Dt)}}function Ct(Et){if(qt=Et,R=0,Et.length===0)return nt;return Kt(Et[R])}function Kt(Et){return $t;function $t(Dt){if(pt=at(),ct=Et,!Et.partial)u.currentConstruct=Et;if(Et.name&&u.parser.constructs.disable.null.includes(Et.name))return Ft(Dt);return Et.tokenize.call(J?Object.assign(Object.create(u),J):u,c,le,Ft)(Dt)}}function le(Et){return o=!0,Z(ct,pt),ft}function Ft(Et){if(o=!0,pt.restore(),++R<qt.length)return Kt(qt[R]);return nt}}}function tt(Z,J){if(Z.resolveAll&&!n.includes(Z))n.push(Z);if(Z.resolve)Xi(u.events,J,u.events.length-J,Z.resolve(u.events.slice(J),u));if(Z.resolveTo)u.events=Z.resolveTo(u.events,u)}function at(){let Z=k(),J=u.previous,Y=u.currentConstruct,W=u.events.length,ft=Array.from(f);return{from:W,restore:nt};function nt(){i=Z,u.previous=J,u.currentConstruct=Y,u.events.length=W,f=ft,Q()}}function Q(){if(i.line in s&&i.column<2)i.column=s[i.line],i.offset+=s[i.line]-1}}function FT(t,e){let a=e.start._index,i=e.start._bufferIndex,s=e.end._index,n=e.end._bufferIndex,l;if(a===s)l=[t[a].slice(i,n)];else{if(l=t.slice(a,s),i>-1){let f=l[0];if(typeof f==="string")l[0]=f.slice(i);else l.shift()}if(n>0)l.push(t[s].slice(0,n))}return l}function BT(t,e){let a=-1,i=[],s;while(++a<t.length){let n=t[a],l;if(typeof n==="string")l=n;else switch(n){case-5:{l="\r";break}case-4:{l=`
27
- `;break}case-3:{l=`\r
28
- `;break}case-2:{l=e?" ":"\t";break}case-1:{if(!e&&s)continue;l=" ";break}default:l=String.fromCharCode(n)}s=n===-2,i.push(l)}return i.join("")}function U4(t){let i={constructs:Lw([x4,...(t||{}).extensions||[]]),content:s($w),defined:[],document:s(Pw),flow:s(ij),lazy:{},string:s(nj),text:s(lj)};return i;function s(n){return l;function l(f){return oj(i,n,f)}}}function I4(t){while(!n5(t));return t}var hj=/[\0\t\n\r]/g;function G4(){let t=1,e="",a=!0,i;return s;function s(n,l,f){let o=[],c,u,m,p,w;if(n=e+(typeof n==="string"?n.toString():new TextDecoder(l||void 0).decode(n)),m=0,e="",a){if(n.charCodeAt(0)===65279)m++;a=void 0}while(m<n.length){if(hj.lastIndex=m,c=hj.exec(n),p=c&&c.index!==void 0?c.index:n.length,w=n.charCodeAt(p),!c){e=n.slice(m);break}if(w===10&&m===p&&i)o.push(-3),i=void 0;else{if(i)o.push(-5),i=void 0;if(m<p)o.push(n.slice(m,p)),t+=p-m;switch(w){case 0:{o.push(65533),t++;break}case 9:{u=Math.ceil(t/4)*4,o.push(-2);while(t++<u)o.push(-1);break}case 10:{o.push(-4),t=1;break}default:i=!0,t=1}}m=p+1}if(f){if(i)o.push(-5);if(e)o.push(e);o.push(null)}return o}}var OT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function cj(t){return t.replace(OT,HT)}function HT(t,e,a){if(e)return e;if(a.charCodeAt(0)===35){let s=a.charCodeAt(1),n=s===120||s===88;return t5(a.slice(n?2:1),n?16:10)}return no(a)||t}var mj={}.hasOwnProperty;function X4(t,e,a){if(e&&typeof e==="object")a=e,e=void 0;return MT(a)(I4(U4(a).document().write(G4()(t,e,!0))))}function MT(t){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:n(va),autolinkProtocol:V,autolinkEmail:V,atxHeading:n(Xe),blockQuote:n(Dt),characterEscape:V,characterReference:V,codeFenced:n(Mt),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:n(Mt,l),codeText:n(Xt,l),codeTextData:V,data:V,codeFlowValue:V,definition:n(Gt),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:n(ae),hardBreakEscape:n(Re),hardBreakTrailing:n(Re),htmlFlow:n(da,l),htmlFlowData:V,htmlText:n(da,l),htmlTextData:V,image:n(Ve),label:l,link:n(va),listItem:n(ii),listItemValue:p,listOrdered:n(ce,m),listUnordered:n(ce),paragraph:n(Ee),reference:G,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:n(Xe),strong:n(Ri),thematicBreak:n(ji)},exit:{atxHeading:o(),atxHeadingSequence:D,autolink:o(),autolinkEmail:$t,autolinkProtocol:Et,blockQuote:o(),characterEscapeValue:tt,characterReferenceMarkerHexadecimal:Kt,characterReferenceMarkerNumeric:Kt,characterReferenceValue:le,characterReference:Ft,codeFenced:o(k),codeFencedFence:v,codeFencedFenceInfo:w,codeFencedFenceMeta:d,codeFlowValue:tt,codeIndented:o(y),codeText:o(Y),codeTextData:tt,data:tt,definition:o(),definitionDestinationString:M,definitionLabelString:B,definitionTitleString:H,emphasis:o(),hardBreakEscape:o(Q),hardBreakTrailing:o(Q),htmlFlow:o(Z),htmlFlowData:tt,htmlText:o(J),htmlTextData:tt,image:o(ft),label:qt,labelText:nt,lineEnding:at,link:o(W),listItem:o(),listOrdered:o(),listUnordered:o(),paragraph:o(),referenceString:Ct,resourceDestinationString:R,resourceTitleString:ct,resource:pt,setextHeading:o(E),setextHeadingLineSequence:z,setextHeadingText:T,strong:o(),thematicBreak:o()}};gj(e,(t||{}).mdastExtensions||[]);let a={};return i;function i(mt){let kt={type:"root",children:[]},Zt={stack:[kt],tokenStack:[],config:e,enter:f,exit:c,buffer:l,resume:u,data:a},ne=[],ye=-1;while(++ye<mt.length)if(mt[ye][1].type==="listOrdered"||mt[ye][1].type==="listUnordered")if(mt[ye][0]==="enter")ne.push(ye);else{let dt=ne.pop();ye=s(mt,dt,ye)}ye=-1;while(++ye<mt.length){let dt=e[mt[ye][0]];if(mj.call(dt,mt[ye][1].type))dt[mt[ye][1].type].call(Object.assign({sliceSerialize:mt[ye][2].sliceSerialize},Zt),mt[ye][1])}if(Zt.tokenStack.length>0){let dt=Zt.tokenStack[Zt.tokenStack.length-1];(dt[1]||uj).call(Zt,void 0,dt[0])}kt.position={start:hl(mt.length>0?mt[0][1].start:{line:1,column:1,offset:0}),end:hl(mt.length>0?mt[mt.length-2][1].end:{line:1,column:1,offset:0})},ye=-1;while(++ye<e.transforms.length)kt=e.transforms[ye](kt)||kt;return kt}function s(mt,kt,Zt){let ne=kt-1,ye=-1,dt=!1,Ut,ie,_e,ca;while(++ne<=Zt){let Be=mt[ne];switch(Be[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{if(Be[0]==="enter")ye++;else ye--;ca=void 0;break}case"lineEndingBlank":{if(Be[0]==="enter"){if(Ut&&!ca&&!ye&&!_e)_e=ne;ca=void 0}break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ca=void 0}if(!ye&&Be[0]==="enter"&&Be[1].type==="listItemPrefix"||ye===-1&&Be[0]==="exit"&&(Be[1].type==="listUnordered"||Be[1].type==="listOrdered")){if(Ut){let Sa=ne;ie=void 0;while(Sa--){let ia=mt[Sa];if(ia[1].type==="lineEnding"||ia[1].type==="lineEndingBlank"){if(ia[0]==="exit")continue;if(ie)mt[ie][1].type="lineEndingBlank",dt=!0;ia[1].type="lineEnding",ie=Sa}else if(ia[1].type==="linePrefix"||ia[1].type==="blockQuotePrefix"||ia[1].type==="blockQuotePrefixWhitespace"||ia[1].type==="blockQuoteMarker"||ia[1].type==="listItemIndent");else break}if(_e&&(!ie||_e<ie))Ut._spread=!0;Ut.end=Object.assign({},ie?mt[ie][1].start:Be[1].end),mt.splice(ie||ne,0,["exit",Ut,Be[2]]),ne++,Zt++}if(Be[1].type==="listItemPrefix"){let Sa={type:"listItem",_spread:!1,start:Object.assign({},Be[1].start),end:void 0};Ut=Sa,mt.splice(ne,0,["enter",Sa,Be[2]]),ne++,Zt++,_e=void 0,ca=!0}}}return mt[kt][1]._spread=dt,Zt}function n(mt,kt){return Zt;function Zt(ne){if(f.call(this,mt(ne),ne),kt)kt.call(this,ne)}}function l(){this.stack.push({type:"fragment",children:[]})}function f(mt,kt,Zt){this.stack[this.stack.length-1].children.push(mt),this.stack.push(mt),this.tokenStack.push([kt,Zt||void 0]),mt.position={start:hl(kt.start),end:void 0}}function o(mt){return kt;function kt(Zt){if(mt)mt.call(this,Zt);c.call(this,Zt)}}function c(mt,kt){let Zt=this.stack.pop(),ne=this.tokenStack.pop();if(!ne)throw Error("Cannot close `"+mt.type+"` ("+fl({start:mt.start,end:mt.end})+"): it’s not open");else if(ne[0].type!==mt.type)if(kt)kt.call(this,mt,ne[0]);else(ne[1]||uj).call(this,mt,ne[0]);Zt.position.end=hl(mt.end)}function u(){return k4(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function p(mt){if(this.data.expectingFirstListItemValue){let kt=this.stack[this.stack.length-2];kt.start=Number.parseInt(this.sliceSerialize(mt),10),this.data.expectingFirstListItemValue=void 0}}function w(){let mt=this.resume(),kt=this.stack[this.stack.length-1];kt.lang=mt}function d(){let mt=this.resume(),kt=this.stack[this.stack.length-1];kt.meta=mt}function v(){if(this.data.flowCodeInside)return;this.buffer(),this.data.flowCodeInside=!0}function k(){let mt=this.resume(),kt=this.stack[this.stack.length-1];kt.value=mt.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){let mt=this.resume(),kt=this.stack[this.stack.length-1];kt.value=mt.replace(/(\r?\n|\r)$/g,"")}function B(mt){let kt=this.resume(),Zt=this.stack[this.stack.length-1];Zt.label=kt,Zt.identifier=n1(this.sliceSerialize(mt)).toLowerCase()}function H(){let mt=this.resume(),kt=this.stack[this.stack.length-1];kt.title=mt}function M(){let mt=this.resume(),kt=this.stack[this.stack.length-1];kt.url=mt}function D(mt){let kt=this.stack[this.stack.length-1];if(!kt.depth){let Zt=this.sliceSerialize(mt).length;kt.depth=Zt}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function z(mt){let kt=this.stack[this.stack.length-1];kt.depth=this.sliceSerialize(mt).codePointAt(0)===61?1:2}function E(){this.data.setextHeadingSlurpLineEnding=void 0}function V(mt){let Zt=this.stack[this.stack.length-1].children,ne=Zt[Zt.length-1];if(!ne||ne.type!=="text")ne=mi(),ne.position={start:hl(mt.start),end:void 0},Zt.push(ne);this.stack.push(ne)}function tt(mt){let kt=this.stack.pop();kt.value+=this.sliceSerialize(mt),kt.position.end=hl(mt.end)}function at(mt){let kt=this.stack[this.stack.length-1];if(this.data.atHardBreak){let Zt=kt.children[kt.children.length-1];Zt.position.end=hl(mt.end),this.data.atHardBreak=void 0;return}if(!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(kt.type))V.call(this,mt),tt.call(this,mt)}function Q(){this.data.atHardBreak=!0}function Z(){let mt=this.resume(),kt=this.stack[this.stack.length-1];kt.value=mt}function J(){let mt=this.resume(),kt=this.stack[this.stack.length-1];kt.value=mt}function Y(){let mt=this.resume(),kt=this.stack[this.stack.length-1];kt.value=mt}function W(){let mt=this.stack[this.stack.length-1];if(this.data.inReference){let kt=this.data.referenceType||"shortcut";mt.type+="Reference",mt.referenceType=kt,delete mt.url,delete mt.title}else delete mt.identifier,delete mt.label;this.data.referenceType=void 0}function ft(){let mt=this.stack[this.stack.length-1];if(this.data.inReference){let kt=this.data.referenceType||"shortcut";mt.type+="Reference",mt.referenceType=kt,delete mt.url,delete mt.title}else delete mt.identifier,delete mt.label;this.data.referenceType=void 0}function nt(mt){let kt=this.sliceSerialize(mt),Zt=this.stack[this.stack.length-2];Zt.label=cj(kt),Zt.identifier=n1(kt).toLowerCase()}function qt(){let mt=this.stack[this.stack.length-1],kt=this.resume(),Zt=this.stack[this.stack.length-1];if(this.data.inReference=!0,Zt.type==="link"){let ne=mt.children;Zt.children=ne}else Zt.alt=kt}function R(){let mt=this.resume(),kt=this.stack[this.stack.length-1];kt.url=mt}function ct(){let mt=this.resume(),kt=this.stack[this.stack.length-1];kt.title=mt}function pt(){this.data.inReference=void 0}function G(){this.data.referenceType="collapsed"}function Ct(mt){let kt=this.resume(),Zt=this.stack[this.stack.length-1];Zt.label=kt,Zt.identifier=n1(this.sliceSerialize(mt)).toLowerCase(),this.data.referenceType="full"}function Kt(mt){this.data.characterReferenceType=mt.type}function le(mt){let kt=this.sliceSerialize(mt),Zt=this.data.characterReferenceType,ne;if(Zt)ne=t5(kt,Zt==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0;else ne=no(kt);let ye=this.stack[this.stack.length-1];ye.value+=ne}function Ft(mt){let kt=this.stack.pop();kt.position.end=hl(mt.end)}function Et(mt){tt.call(this,mt);let kt=this.stack[this.stack.length-1];kt.url=this.sliceSerialize(mt)}function $t(mt){tt.call(this,mt);let kt=this.stack[this.stack.length-1];kt.url="mailto:"+this.sliceSerialize(mt)}function Dt(){return{type:"blockquote",children:[]}}function Mt(){return{type:"code",lang:null,meta:null,value:""}}function Xt(){return{type:"inlineCode",value:""}}function Gt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ae(){return{type:"emphasis",children:[]}}function Xe(){return{type:"heading",depth:0,children:[]}}function Re(){return{type:"break"}}function da(){return{type:"html",value:""}}function Ve(){return{type:"image",title:null,url:"",alt:null}}function va(){return{type:"link",title:null,url:"",children:[]}}function ce(mt){return{type:"list",ordered:mt.type==="listOrdered",start:null,spread:mt._spread,children:[]}}function ii(mt){return{type:"listItem",spread:mt._spread,checked:null,children:[]}}function Ee(){return{type:"paragraph",children:[]}}function Ri(){return{type:"strong",children:[]}}function mi(){return{type:"text",value:""}}function ji(){return{type:"thematicBreak"}}}function hl(t){return{line:t.line,column:t.column,offset:t.offset}}function gj(t,e){let a=-1;while(++a<e.length){let i=e[a];if(Array.isArray(i))gj(t,i);else DT(t,i)}}function DT(t,e){let a;for(a in e)if(mj.call(e,a))switch(a){case"canContainEols":{let i=e[a];if(i)t[a].push(...i);break}case"transforms":{let i=e[a];if(i)t[a].push(...i);break}case"enter":case"exit":{let i=e[a];if(i)Object.assign(t[a],i);break}}}function uj(t,e){if(t)throw Error("Cannot close `"+t.type+"` ("+fl({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+fl({start:e.start,end:e.end})+") is open");else throw Error("Cannot close document, a token (`"+e.type+"`, "+fl({start:e.start,end:e.end})+") is still open")}function h5(t){let e=this;e.parser=a;function a(i){return X4(i,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}var c5=-1,fo=0,Of=1,ro=2,Gc=3,Xc=4,Kc=5,Lc=6,u5=7,m5=8;var TT=typeof self==="object"?self:globalThis,bj=(t,e)=>{switch(t){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw TypeError("unable to deserialize "+t)}return new TT[t](e)},RT=(t,e)=>{let a=(s,n)=>{return t.set(n,s),s},i=(s)=>{if(t.has(s))return t.get(s);let[n,l]=e[s];switch(n){case fo:case c5:return a(l,s);case Of:{let f=a([],s);for(let o of l)f.push(i(o));return f}case ro:{let f=a({},s);for(let[o,c]of l)f[i(o)]=i(c);return f}case Gc:return a(new Date(l),s);case Xc:{let{source:f,flags:o}=l;return a(new RegExp(f,o),s)}case Kc:{let f=a(new Map,s);for(let[o,c]of l)f.set(i(o),i(c));return f}case Lc:{let f=a(new Set,s);for(let o of l)f.add(i(o));return f}case u5:{let{name:f,message:o}=l;return a(bj(f,o),s)}case m5:return a(BigInt(l),s);case"BigInt":return a(Object(BigInt(l)),s);case"ArrayBuffer":return a(new Uint8Array(l).buffer,l);case"DataView":{let{buffer:f}=new Uint8Array(l);return a(new DataView(f),l)}}return a(bj(n,l),s)};return i},K4=(t)=>RT(new Map,t)(0);var oo="",{toString:NT}={},{keys:zT}=Object,Vc=(t)=>{let e=typeof t;if(e!=="object"||!t)return[fo,e];let a=NT.call(t).slice(8,-1);switch(a){case"Array":return[Of,oo];case"Object":return[ro,oo];case"Date":return[Gc,oo];case"RegExp":return[Xc,oo];case"Map":return[Kc,oo];case"Set":return[Lc,oo];case"DataView":return[Of,a]}if(a.includes("Array"))return[Of,a];if(a.includes("Error"))return[u5,a];return[ro,a]},g5=([t,e])=>t===fo&&(e==="function"||e==="symbol"),ET=(t,e,a,i)=>{let s=(l,f)=>{let o=i.push(l)-1;return a.set(f,o),o},n=(l)=>{if(a.has(l))return a.get(l);let[f,o]=Vc(l);switch(f){case fo:{let u=l;switch(o){case"bigint":f=m5,u=l.toString();break;case"function":case"symbol":if(t)throw TypeError("unable to serialize "+o);u=null;break;case"undefined":return s([c5],l)}return s([f,u],l)}case Of:{if(o){let p=l;if(o==="DataView")p=new Uint8Array(l.buffer);else if(o==="ArrayBuffer")p=new Uint8Array(l);return s([o,[...p]],l)}let u=[],m=s([f,u],l);for(let p of l)u.push(n(p));return m}case ro:{if(o)switch(o){case"BigInt":return s([o,l.toString()],l);case"Boolean":case"Number":case"String":return s([o,l.valueOf()],l)}if(e&&"toJSON"in l)return n(l.toJSON());let u=[],m=s([f,u],l);for(let p of zT(l))if(t||!g5(Vc(l[p])))u.push([n(p),n(l[p])]);return m}case Gc:return s([f,l.toISOString()],l);case Xc:{let{source:u,flags:m}=l;return s([f,{source:u,flags:m}],l)}case Kc:{let u=[],m=s([f,u],l);for(let[p,w]of l)if(t||!(g5(Vc(p))||g5(Vc(w))))u.push([n(p),n(w)]);return m}case Lc:{let u=[],m=s([f,u],l);for(let p of l)if(t||!g5(Vc(p)))u.push(n(p));return m}}let{message:c}=l;return s([f,{name:o,message:c}],l)};return n},L4=(t,{json:e,lossy:a}={})=>{let i=[];return ET(!(e||a),!!e,new Map,i)(t),i};var ho=typeof structuredClone==="function"?(t,e)=>e&&(("json"in e)||("lossy"in e))?K4(L4(t,e)):structuredClone(t):(t,e)=>K4(L4(t,e));function xT(t,e){let a=[{type:"text",value:"↩"}];if(e>1)a.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]});return a}function UT(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function pj(t){let e=typeof t.options.clobberPrefix==="string"?t.options.clobberPrefix:"user-content-",a=t.options.footnoteBackContent||xT,i=t.options.footnoteBackLabel||UT,s=t.options.footnoteLabel||"Footnotes",n=t.options.footnoteLabelTagName||"h2",l=t.options.footnoteLabelProperties||{className:["sr-only"]},f=[],o=-1;while(++o<t.footnoteOrder.length){let c=t.footnoteById.get(t.footnoteOrder[o]);if(!c)continue;let u=t.all(c),m=String(c.identifier).toUpperCase(),p=An(m.toLowerCase()),w=0,d=[],v=t.footnoteCounts.get(m);while(v!==void 0&&++w<=v){if(d.length>0)d.push({type:"text",value:" "});let B=typeof a==="string"?a:a(o,w);if(typeof B==="string")B={type:"text",value:B};d.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+p+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof i==="string"?i:i(o,w),className:["data-footnote-backref"]},children:Array.isArray(B)?B:[B]})}let k=u[u.length-1];if(k&&k.type==="element"&&k.tagName==="p"){let B=k.children[k.children.length-1];if(B&&B.type==="text")B.value+=" ";else k.children.push({type:"text",value:" "});k.children.push(...d)}else u.push(...d);let y={type:"element",tagName:"li",properties:{id:e+"fn-"+p},children:t.wrap(u,!0)};t.patch(c,y),f.push(y)}if(f.length===0)return;return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:n,properties:{...ho(l),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
29
- `},{type:"element",tagName:"ol",properties:{},children:t.wrap(f,!0)},{type:"text",value:`
30
- `}]}}var b5=function(t){if(t===null||t===void 0)return KT;if(typeof t==="function")return p5(t);if(typeof t==="object")return Array.isArray(t)?IT(t):GT(t);if(typeof t==="string")return XT(t);throw Error("Expected function, string, or object as test")};function IT(t){let e=[],a=-1;while(++a<t.length)e[a]=b5(t[a]);return p5(i);function i(...s){let n=-1;while(++n<e.length)if(e[n].apply(this,s))return!0;return!1}}function GT(t){let e=t;return p5(a);function a(i){let s=i,n;for(n in t)if(s[n]!==e[n])return!1;return!0}}function XT(t){return p5(e);function e(a){return a&&a.type===t}}function p5(t){return e;function e(a,i,s){return Boolean(LT(a)&&t.call(this,a,typeof i==="number"?i:void 0,s||void 0))}}function KT(){return!0}function LT(t){return t!==null&&typeof t==="object"&&"type"in t}function wj(t){return t}var jj=[],V4=!0,w5=!1,Y4="skip";function J4(t,e,a,i){let s;if(typeof e==="function"&&typeof a!=="function")i=a,a=e;else s=e;let n=b5(s),l=i?-1:1;f(t,void 0,[])();function f(o,c,u){let m=o&&typeof o==="object"?o:{};if(typeof m.type==="string"){let w=typeof m.tagName==="string"?m.tagName:typeof m.name==="string"?m.name:void 0;Object.defineProperty(p,"name",{value:"node ("+wj(o.type+(w?"<"+w+">":""))+")"})}return p;function p(){let w=jj,d,v,k;if(!e||n(o,c,u[u.length-1]||void 0)){if(w=VT(a(o,u)),w[0]===w5)return w}if("children"in o&&o.children){let y=o;if(y.children&&w[0]!==Y4){v=(i?y.children.length:-1)+l,k=u.concat(y);while(v>-1&&v<y.children.length){let B=y.children[v];if(d=f(B,v,k)(),d[0]===w5)return d;v=typeof d[1]==="number"?d[1]:v+l}}}return w}}}function VT(t){if(Array.isArray(t))return t;if(typeof t==="number")return[V4,t];return t===null||t===void 0?jj:[t]}function Yc(t,e,a,i){let s,n,l;if(typeof e==="function"&&typeof a!=="function")n=void 0,l=e,s=a;else n=e,l=a,s=i;J4(t,n,f,s);function f(o,c){let u=c[c.length-1],m=u?u.children.indexOf(o):void 0;return l(o,m,u)}}function dj(t,e){let a={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,a),t.applyData(e,a)}function qj(t,e){let a={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,a),[t.applyData(e,a),{type:"text",value:`
31
- `}]}function Aj(t,e){let a=e.value?e.value+`
32
- `:"",i={},s=e.lang?e.lang.split(/\s+/):[];if(s.length>0)i.className=["language-"+s[0]];let n={type:"element",tagName:"code",properties:i,children:[{type:"text",value:a}]};if(e.meta)n.data={meta:e.meta};return t.patch(e,n),n=t.applyData(e,n),n={type:"element",tagName:"pre",properties:{},children:[n]},t.patch(e,n),n}function vj(t,e){let a={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,a),t.applyData(e,a)}function Sj(t,e){let a={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,a),t.applyData(e,a)}function yj(t,e){let a=typeof t.options.clobberPrefix==="string"?t.options.clobberPrefix:"user-content-",i=String(e.identifier).toUpperCase(),s=An(i.toLowerCase()),n=t.footnoteOrder.indexOf(i),l,f=t.footnoteCounts.get(i);if(f===void 0)f=0,t.footnoteOrder.push(i),l=t.footnoteOrder.length;else l=n+1;f+=1,t.footnoteCounts.set(i,f);let o={type:"element",tagName:"a",properties:{href:"#"+a+"fn-"+s,id:a+"fnref-"+s+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};t.patch(e,o);let c={type:"element",tagName:"sup",properties:{},children:[o]};return t.patch(e,c),t.applyData(e,c)}function kj(t,e){let a={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,a),t.applyData(e,a)}function Cj(t,e){if(t.options.allowDangerousHtml){let a={type:"raw",value:e.value};return t.patch(e,a),t.applyData(e,a)}return}function j5(t,e){let a=e.referenceType,i="]";if(a==="collapsed")i+="[]";else if(a==="full")i+="["+(e.label||e.identifier)+"]";if(e.type==="imageReference")return[{type:"text",value:"!["+e.alt+i}];let s=t.all(e),n=s[0];if(n&&n.type==="text")n.value="["+n.value;else s.unshift({type:"text",value:"["});let l=s[s.length-1];if(l&&l.type==="text")l.value+=i;else s.push({type:"text",value:i});return s}function _j(t,e){let a=String(e.identifier).toUpperCase(),i=t.definitionById.get(a);if(!i)return j5(t,e);let s={src:An(i.url||""),alt:e.alt};if(i.title!==null&&i.title!==void 0)s.title=i.title;let n={type:"element",tagName:"img",properties:s,children:[]};return t.patch(e,n),t.applyData(e,n)}function Fj(t,e){let a={src:An(e.url)};if(e.alt!==null&&e.alt!==void 0)a.alt=e.alt;if(e.title!==null&&e.title!==void 0)a.title=e.title;let i={type:"element",tagName:"img",properties:a,children:[]};return t.patch(e,i),t.applyData(e,i)}function Bj(t,e){let a={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,a);let i={type:"element",tagName:"code",properties:{},children:[a]};return t.patch(e,i),t.applyData(e,i)}function Oj(t,e){let a=String(e.identifier).toUpperCase(),i=t.definitionById.get(a);if(!i)return j5(t,e);let s={href:An(i.url||"")};if(i.title!==null&&i.title!==void 0)s.title=i.title;let n={type:"element",tagName:"a",properties:s,children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Hj(t,e){let a={href:An(e.url)};if(e.title!==null&&e.title!==void 0)a.title=e.title;let i={type:"element",tagName:"a",properties:a,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function Mj(t,e,a){let i=t.all(e),s=a?YT(a):Dj(e),n={},l=[];if(typeof e.checked==="boolean"){let u=i[0],m;if(u&&u.type==="element"&&u.tagName==="p")m=u;else m={type:"element",tagName:"p",properties:{},children:[]},i.unshift(m);if(m.children.length>0)m.children.unshift({type:"text",value:" "});m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),n.className=["task-list-item"]}let f=-1;while(++f<i.length){let u=i[f];if(s||f!==0||u.type!=="element"||u.tagName!=="p")l.push({type:"text",value:`
33
- `});if(u.type==="element"&&u.tagName==="p"&&!s)l.push(...u.children);else l.push(u)}let o=i[i.length-1];if(o&&(s||o.type!=="element"||o.tagName!=="p"))l.push({type:"text",value:`
34
- `});let c={type:"element",tagName:"li",properties:n,children:l};return t.patch(e,c),t.applyData(e,c)}function YT(t){let e=!1;if(t.type==="list"){e=t.spread||!1;let a=t.children,i=-1;while(!e&&++i<a.length)e=Dj(a[i])}return e}function Dj(t){let e=t.spread;return e===null||e===void 0?t.children.length>1:e}function Tj(t,e){let a={},i=t.all(e),s=-1;if(typeof e.start==="number"&&e.start!==1)a.start=e.start;while(++s<i.length){let l=i[s];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){a.className=["contains-task-list"];break}}let n={type:"element",tagName:e.ordered?"ol":"ul",properties:a,children:t.wrap(i,!0)};return t.patch(e,n),t.applyData(e,n)}function Rj(t,e){let a={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,a),t.applyData(e,a)}function Nj(t,e){let a={type:"root",children:t.wrap(t.all(e))};return t.patch(e,a),t.applyData(e,a)}function zj(t,e){let a={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,a),t.applyData(e,a)}function Ej(t,e){let a=t.all(e),i=a.shift(),s=[];if(i){let l={type:"element",tagName:"thead",properties:{},children:t.wrap([i],!0)};t.patch(e.children[0],l),s.push(l)}if(a.length>0){let l={type:"element",tagName:"tbody",properties:{},children:t.wrap(a,!0)},f=so(e.children[1]),o=Pu(e.children[e.children.length-1]);if(f&&o)l.position={start:f,end:o};s.push(l)}let n={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,n),t.applyData(e,n)}function xj(t,e,a){let i=a?a.children:void 0,n=(i?i.indexOf(e):1)===0?"th":"td",l=a&&a.type==="table"?a.align:void 0,f=l?l.length:e.children.length,o=-1,c=[];while(++o<f){let m=e.children[o],p={},w=l?l[o]:void 0;if(w)p.align=w;let d={type:"element",tagName:n,properties:p,children:[]};if(m)d.children=t.all(m),t.patch(m,d),d=t.applyData(m,d);c.push(d)}let u={type:"element",tagName:"tr",properties:{},children:t.wrap(c,!0)};return t.patch(e,u),t.applyData(e,u)}function Uj(t,e){let a={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,a),t.applyData(e,a)}function Gj(t){let e=String(t),a=/\r?\n|\r/g,i=a.exec(e),s=0,n=[];while(i)n.push(Ij(e.slice(s,i.index),s>0,!0),i[0]),s=i.index+i[0].length,i=a.exec(e);return n.push(Ij(e.slice(s),s>0,!1)),n.join("")}function Ij(t,e,a){let i=0,s=t.length;if(e){let n=t.codePointAt(i);while(n===9||n===32)i++,n=t.codePointAt(i)}if(a){let n=t.codePointAt(s-1);while(n===9||n===32)s--,n=t.codePointAt(s-1)}return s>i?t.slice(i,s):""}function Xj(t,e){let a={type:"text",value:Gj(String(e.value))};return t.patch(e,a),t.applyData(e,a)}function Kj(t,e){let a={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,a),t.applyData(e,a)}var Lj={blockquote:dj,break:qj,code:Aj,delete:vj,emphasis:Sj,footnoteReference:yj,heading:kj,html:Cj,imageReference:_j,image:Fj,inlineCode:Bj,linkReference:Oj,link:Hj,listItem:Mj,list:Tj,paragraph:Rj,root:Nj,strong:zj,table:Ej,tableCell:Uj,tableRow:xj,text:Xj,thematicBreak:Kj,toml:d5,yaml:d5,definition:d5,footnoteDefinition:d5};function d5(){return}var Q4={}.hasOwnProperty,JT={};function Yj(t,e){let a=e||JT,i=new Map,s=new Map,n=new Map,l={...Lj,...a.handlers},f={all:c,applyData:ZT,definitionById:i,footnoteById:s,footnoteCounts:n,footnoteOrder:[],handlers:l,one:o,options:a,patch:QT,wrap:WT};return Yc(t,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){let m=u.type==="definition"?i:s,p=String(u.identifier).toUpperCase();if(!m.has(p))m.set(p,u)}}),f;function o(u,m){let p=u.type,w=f.handlers[p];if(Q4.call(f.handlers,p)&&w)return w(f,u,m);if(f.options.passThrough&&f.options.passThrough.includes(p)){if("children"in u){let{children:v,...k}=u,y=ho(k);return y.children=f.all(u),y}return ho(u)}return(f.options.unknownHandler||$T)(f,u,m)}function c(u){let m=[];if("children"in u){let p=u.children,w=-1;while(++w<p.length){let d=f.one(p[w],u);if(d){if(w&&p[w-1].type==="break"){if(!Array.isArray(d)&&d.type==="text")d.value=Vj(d.value);if(!Array.isArray(d)&&d.type==="element"){let v=d.children[0];if(v&&v.type==="text")v.value=Vj(v.value)}}if(Array.isArray(d))m.push(...d);else m.push(d)}}}return m}}function QT(t,e){if(t.position)e.position=d4(t)}function ZT(t,e){let a=e;if(t&&t.data){let i=t.data.hName,s=t.data.hChildren,n=t.data.hProperties;if(typeof i==="string")if(a.type==="element")a.tagName=i;else{let l="children"in a?a.children:[a];a={type:"element",tagName:i,properties:{},children:l}}if(a.type==="element"&&n)Object.assign(a.properties,ho(n));if("children"in a&&a.children&&s!==null&&s!==void 0)a.children=s}return a}function $T(t,e){let a=e.data||{},i="value"in e&&!(Q4.call(a,"hProperties")||Q4.call(a,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function WT(t,e){let a=[],i=-1;if(e)a.push({type:"text",value:`
35
- `});while(++i<t.length){if(i)a.push({type:"text",value:`
36
- `});a.push(t[i])}if(e&&t.length>0)a.push({type:"text",value:`
37
- `});return a}function Vj(t){let e=0,a=t.charCodeAt(e);while(a===9||a===32)e++,a=t.charCodeAt(e);return t.slice(e)}function q5(t,e){let a=Yj(t,e),i=a.one(t,void 0),s=pj(a),n=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};if(s)rs("children"in n),n.children.push({type:"text",value:`
38
- `},s);return n}function A5(t,e){if(t&&"run"in t)return async function(a,i){let s=q5(a,{file:i,...e});await t.run(s,i)};return function(a,i){return q5(a,{file:i,...t||e})}}function Z4(t){if(t)throw t}var y5=Ie(ad(),1);function Jc(t){if(typeof t!=="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function $4(){let t=[],e={run:a,use:i};return e;function a(...s){let n=-1,l=s.pop();if(typeof l!=="function")throw TypeError("Expected function as last argument, not "+l);f(null,...s);function f(o,...c){let u=t[++n],m=-1;if(o){l(o);return}while(++m<s.length)if(c[m]===null||c[m]===void 0)c[m]=s[m];if(s=c,u)id(u,f)(...c);else l(null,...c)}}function i(s){if(typeof s!=="function")throw TypeError("Expected `middelware` to be a function, not "+s);return t.push(s),e}}function id(t,e){let a;return i;function i(...l){let f=t.length>l.length,o;if(f)l.push(s);try{o=t.apply(this,l)}catch(c){let u=c;if(f&&a)throw u;return s(u)}if(!f)if(o&&o.then&&typeof o.then==="function")o.then(n,s);else if(o instanceof Error)s(o);else n(o)}function s(l,...f){if(!a)a=!0,e(l,...f)}function n(l){s(null,l)}}var Kn={basename:PT,dirname:tR,extname:eR,join:aR,sep:"/"};function PT(t,e){if(e!==void 0&&typeof e!=="string")throw TypeError('"ext" argument must be a string');Qc(t);let a=0,i=-1,s=t.length,n;if(e===void 0||e.length===0||e.length>t.length){while(s--)if(t.codePointAt(s)===47){if(n){a=s+1;break}}else if(i<0)n=!0,i=s+1;return i<0?"":t.slice(a,i)}if(e===t)return"";let l=-1,f=e.length-1;while(s--)if(t.codePointAt(s)===47){if(n){a=s+1;break}}else{if(l<0)n=!0,l=s+1;if(f>-1)if(t.codePointAt(s)===e.codePointAt(f--)){if(f<0)i=s}else f=-1,i=l}if(a===i)i=l;else if(i<0)i=t.length;return t.slice(a,i)}function tR(t){if(Qc(t),t.length===0)return".";let e=-1,a=t.length,i;while(--a)if(t.codePointAt(a)===47){if(i){e=a;break}}else if(!i)i=!0;return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function eR(t){Qc(t);let e=t.length,a=-1,i=0,s=-1,n=0,l;while(e--){let f=t.codePointAt(e);if(f===47){if(l){i=e+1;break}continue}if(a<0)l=!0,a=e+1;if(f===46){if(s<0)s=e;else if(n!==1)n=1}else if(s>-1)n=-1}if(s<0||a<0||n===0||n===1&&s===a-1&&s===i+1)return"";return t.slice(s,a)}function aR(...t){let e=-1,a;while(++e<t.length)if(Qc(t[e]),t[e])a=a===void 0?t[e]:a+"/"+t[e];return a===void 0?".":iR(a)}function iR(t){Qc(t);let e=t.codePointAt(0)===47,a=sR(t,!e);if(a.length===0&&!e)a=".";if(a.length>0&&t.codePointAt(t.length-1)===47)a+="/";return e?"/"+a:a}function sR(t,e){let a="",i=0,s=-1,n=0,l=-1,f,o;while(++l<=t.length){if(l<t.length)f=t.codePointAt(l);else if(f===47)break;else f=47;if(f===47){if(s===l-1||n===1);else if(s!==l-1&&n===2){if(a.length<2||i!==2||a.codePointAt(a.length-1)!==46||a.codePointAt(a.length-2)!==46){if(a.length>2){if(o=a.lastIndexOf("/"),o!==a.length-1){if(o<0)a="",i=0;else a=a.slice(0,o),i=a.length-1-a.lastIndexOf("/");s=l,n=0;continue}}else if(a.length>0){a="",i=0,s=l,n=0;continue}}if(e)a=a.length>0?a+"/..":"..",i=2}else{if(a.length>0)a+="/"+t.slice(s+1,l);else a=t.slice(s+1,l);i=l-s-1}s=l,n=0}else if(f===46&&n>-1)n++;else n=-1}return a}function Qc(t){if(typeof t!=="string")throw TypeError("Path must be a string. Received "+JSON.stringify(t))}var sd={cwd:nR};function nR(){return"/"}function co(t){return Boolean(t!==null&&typeof t==="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function nd(t){if(typeof t==="string")t=new URL(t);else if(!co(t)){let e=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return lR(t)}function lR(t){if(t.hostname!==""){let i=TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}let e=t.pathname,a=-1;while(++a<e.length)if(e.codePointAt(a)===37&&e.codePointAt(a+1)===50){let i=e.codePointAt(a+2);if(i===70||i===102){let s=TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(e)}var W4=["history","path","basename","stem","extname","dirname"];class uo{constructor(t){let e;if(!t)e={};else if(co(t))e={path:t};else if(typeof t==="string"||fR(t))e={value:t};else e=t;this.cwd="cwd"in e?"":sd.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;while(++a<W4.length){let s=W4[a];if(s in e&&e[s]!==void 0&&e[s]!==null)this[s]=s==="history"?[...e[s]]:e[s]}let i;for(i in e)if(!W4.includes(i))this[i]=e[i]}get basename(){return typeof this.path==="string"?Kn.basename(this.path):void 0}set basename(t){t8(t,"basename"),P4(t,"basename"),this.path=Kn.join(this.dirname||"",t)}get dirname(){return typeof this.path==="string"?Kn.dirname(this.path):void 0}set dirname(t){ld(this.basename,"dirname"),this.path=Kn.join(t||"",this.basename)}get extname(){return typeof this.path==="string"?Kn.extname(this.path):void 0}set extname(t){if(P4(t,"extname"),ld(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(t.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=Kn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){if(co(t))t=nd(t);if(t8(t,"path"),this.path!==t)this.history.push(t)}get stem(){return typeof this.path==="string"?Kn.basename(this.path,this.extname):void 0}set stem(t){t8(t,"stem"),P4(t,"stem"),this.path=Kn.join(this.dirname||"",t+(this.extname||""))}fail(t,e,a){let i=this.message(t,e,a);throw i.fatal=!0,i}info(t,e,a){let i=this.message(t,e,a);return i.fatal=void 0,i}message(t,e,a){let i=new oi(t,e,a);if(this.path)i.name=this.path+":"+i.name,i.file=this.path;return i.fatal=!1,this.messages.push(i),i}toString(t){if(this.value===void 0)return"";if(typeof this.value==="string")return this.value;return new TextDecoder(t||void 0).decode(this.value)}}function P4(t,e){if(t&&t.includes(Kn.sep))throw Error("`"+e+"` cannot be a path: did not expect `"+Kn.sep+"`")}function t8(t,e){if(!t)throw Error("`"+e+"` cannot be empty")}function ld(t,e){if(!t)throw Error("Setting `"+e+"` requires `path` to be set too")}function fR(t){return Boolean(t&&typeof t==="object"&&"byteLength"in t&&"byteOffset"in t)}var fd=function(t){let i=this.constructor.prototype,s=i[t],n=function(){return s.apply(n,arguments)};return Object.setPrototypeOf(n,i),n};var rR={}.hasOwnProperty;class s8 extends fd{constructor(){super("copy");this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=$4()}copy(){let t=new s8,e=-1;while(++e<this.attachers.length){let a=this.attachers[e];t.use(...a)}return t.data(y5.default(!0,{},this.namespace)),t}data(t,e){if(typeof t==="string"){if(arguments.length===2)return i8("data",this.frozen),this.namespace[t]=e,this;return rR.call(this.namespace,t)&&this.namespace[t]||void 0}if(t)return i8("data",this.frozen),this.namespace=t,this;return this.namespace}freeze(){if(this.frozen)return this;let t=this;while(++this.freezeIndex<this.attachers.length){let[e,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;if(a[0]===!0)a[0]=void 0;let i=e.call(t,...a);if(typeof i==="function")this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();let e=S5(t),a=this.parser||this.Parser;return e8("parse",a),a(String(e),e)}process(t,e){let a=this;return this.freeze(),e8("process",this.parser||this.Parser),a8("process",this.compiler||this.Compiler),e?i(void 0,e):new Promise(i);function i(s,n){let l=S5(t),f=a.parse(l);a.run(f,l,function(c,u,m){if(c||!u||!m)return o(c);let p=u,w=a.stringify(p,m);if(hR(w))m.value=w;else m.result=w;o(c,m)});function o(c,u){if(c||!u)n(c);else if(s)s(u);else rs(e,"`done` is defined if `resolve` is not"),e(void 0,u)}}}processSync(t){let e=!1,a;return this.freeze(),e8("processSync",this.parser||this.Parser),a8("processSync",this.compiler||this.Compiler),this.process(t,i),od("processSync","process",e),rs(a,"we either bailed on an error or have a tree"),a;function i(s,n){e=!0,Z4(s),a=n}}run(t,e,a){rd(t),this.freeze();let i=this.transformers;if(!a&&typeof e==="function")a=e,e=void 0;return a?s(void 0,a):new Promise(s);function s(n,l){rs(typeof e!=="function","`file` can’t be a `done` anymore, we checked");let f=S5(e);i.run(t,f,o);function o(c,u,m){let p=u||t;if(c)l(c);else if(n)n(p);else rs(a,"`done` is defined if `resolve` is not"),a(void 0,p,m)}}}runSync(t,e){let a=!1,i;return this.run(t,e,s),od("runSync","run",a),rs(i,"we either bailed on an error or have a tree"),i;function s(n,l){Z4(n),i=l,a=!0}}stringify(t,e){this.freeze();let a=S5(e),i=this.compiler||this.Compiler;return a8("stringify",i),rd(t),i(t,a)}use(t,...e){let a=this.attachers,i=this.namespace;if(i8("use",this.frozen),t===null||t===void 0);else if(typeof t==="function")f(t,e);else if(typeof t==="object")if(Array.isArray(t))l(t);else n(t);else throw TypeError("Expected usable value, not `"+t+"`");return this;function s(o){if(typeof o==="function")f(o,[]);else if(typeof o==="object")if(Array.isArray(o)){let[c,...u]=o;f(c,u)}else n(o);else throw TypeError("Expected usable value, not `"+o+"`")}function n(o){if(!("plugins"in o)&&!("settings"in o))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");if(l(o.plugins),o.settings)i.settings=y5.default(!0,i.settings,o.settings)}function l(o){let c=-1;if(o===null||o===void 0);else if(Array.isArray(o))while(++c<o.length){let u=o[c];s(u)}else throw TypeError("Expected a list of plugins, not `"+o+"`")}function f(o,c){let u=-1,m=-1;while(++u<a.length)if(a[u][0]===o){m=u;break}if(m===-1)a.push([o,...c]);else if(c.length>0){let[p,...w]=c,d=a[m][1];if(Jc(d)&&Jc(p))p=y5.default(!0,d,p);a[m]=[o,p,...w]}}}}var n8=new s8().freeze();function e8(t,e){if(typeof e!=="function")throw TypeError("Cannot `"+t+"` without `parser`")}function a8(t,e){if(typeof e!=="function")throw TypeError("Cannot `"+t+"` without `compiler`")}function i8(t,e){if(e)throw Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function rd(t){if(!Jc(t)||typeof t.type!=="string")throw TypeError("Expected node, got `"+t+"`")}function od(t,e,a){if(!a)throw Error("`"+t+"` finished async. Use `"+e+"` instead")}function S5(t){return oR(t)?t:new uo(t)}function oR(t){return Boolean(t&&typeof t==="object"&&"message"in t&&"messages"in t)}function hR(t){return typeof t==="string"||cR(t)}function cR(t){return Boolean(t&&typeof t==="object"&&"byteLength"in t&&"byteOffset"in t)}var uR="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",hd=[],cd={allowDangerousHtml:!0},mR=/^(https?|ircs?|mailto|xmpp)$/i,gR=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function go(t){let e=bR(t),a=pR(t);return wR(e.runSync(e.parse(a),a),t)}function bR(t){let e=t.rehypePlugins||hd,a=t.remarkPlugins||hd,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...cd}:cd;return n8().use(h5).use(a).use(A5,i).use(e)}function pR(t){let e=t.children||"",a=new uo;if(typeof e==="string")a.value=e;else Yu("Unexpected value `"+e+"` for `children` prop, expected `string`");return a}function wR(t,e){let{allowedElements:a,allowElement:i,components:s,disallowedElements:n,skipHtml:l,unwrapDisallowed:f}=e,o=e.urlTransform||md;for(let u of gR)if(Object.hasOwn(e,u.from))Yu("Unexpected `"+u.from+"` prop, "+(u.to?"use `"+u.to+"` instead":"remove it")+" (see <"+uR+"#"+u.id+"> for more info)");if(a&&n)Yu("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other");return Yc(t,c),v4(t,{Fragment:mo,components:s,ignoreInvalidStyle:!0,jsx:x,jsxs:rt,passKeys:!0,passNode:!0});function c(u,m,p){if(u.type==="raw"&&p&&typeof m==="number"){if(l)p.children.splice(m,1);else p.children[m]={type:"text",value:u.value};return m}if(u.type==="element"){let w;for(w in Rc)if(Object.hasOwn(Rc,w)&&Object.hasOwn(u.properties,w)){let d=u.properties[w],v=Rc[w];if(v===null||v.includes(u.tagName))u.properties[w]=o(String(d||""),w,u)}}if(u.type==="element"){let w=a?!a.includes(u.tagName):n?n.includes(u.tagName):!1;if(!w&&i&&typeof m==="number")w=!i(u,m,p);if(w&&p&&typeof m==="number"){if(f&&u.children)p.children.splice(m,1,...u.children);else p.children.splice(m,1);return m}}}}function md(t){let e=t.indexOf(":"),a=t.indexOf("?"),i=t.indexOf("#"),s=t.indexOf("/");if(e===-1||s!==-1&&e>s||a!==-1&&e>a||i!==-1&&e>i||mR.test(t.slice(0,e)))return t;return""}var jR=(t)=>rt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...t,children:[x("circle",{cx:"12",cy:"12",r:"10"}),x("path",{d:"m9 12 2 2 4-4"})]}),dR=(t)=>rt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",...t,children:[x("circle",{cx:"12",cy:"12",r:"10"}),x("path",{d:"m9 12 2 2 4-4",fill:"none",stroke:"white",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),gd={__CHAT__:"Generating...",__AUTOFILL__:"Autofilling metadata...",__EMBEDDING__:"Generating embeddings...",__RUNNING__:"Generating..."},f8=({teamId:t,message:e,isReply:a,hasReplies:i,isLastReply:s,getUser:n,onReply:l,onViewAttachment:f,isSelected:o,onSelect:c,frameRate:u,startTimecode:m,formatTimestamp:p})=>{let w=e,d=!!w.annotations&&Array.isArray(w.annotations)&&w.annotations.length>0,v=w.creator,k=!!w.sessionId&&!!w.message&&w.message in gd,y=w.message&&gd[w.message]||"Generating...",[B,H]=bo.default.useState(!1),{videoTimeDisplayMode:M}=wo(),D=bo.default.useMemo(()=>{if(w.second===null||w.second===void 0)return"";if(p)return p(w.second);if(!u)return"";let R=Math.round(w.second*u);return cl(R,u,M,m)},[w.second,u,M,m,p]),{data:T}=po({queryKey:["teams",t,"me"],queryFn:async()=>{let R=await Le.api.teams[":teamId"].me.$get({param:{teamId:t}});if(!R.ok)throw Error("Failed to fetch current member info");return await R.json()},enabled:!!t,staleTime:300000}),z=T?.role==="owner",E=k5(),{mutate:V}=Hf({mutationFn:async()=>{let R=await Le.api.comments[":commentId"].complete.$post({param:{commentId:w.id},json:{isCompleted:!w.isCompleted}});if(!R.ok)throw Error("Failed to update comment completion status");return await R.json()},onSuccess:()=>{E.invalidateQueries({predicate:(R)=>R.queryKey.includes("comments")})}}),[tt,at]=bo.default.useState(!1),{mutate:Q,isPending:Z}=Hf({mutationFn:async()=>{let R=await Le.api.comments[":commentId"].$delete({param:{commentId:w.id}});if(!R.ok)throw Error("Failed to delete comment");return await R.json()},onSuccess:()=>{E.invalidateQueries({predicate:(R)=>R.queryKey.includes("comments")}),at(!1)}}),J=bo.default.useMemo(()=>{if(!T)return!1;if(T.role==="owner")return!0;if(w.creator?.id===T.id)return!0;return!1},[T,w.creator?.id]),{data:Y,isLoading:W}=po({queryKey:["agent-sessions",w.sessionId,"entries"],queryFn:async()=>{let R=await Le.api["agent-sessions"][":sessionId"].entries.$get({param:{sessionId:w.sessionId}});if(!R.ok)throw Error("Failed to fetch session logs");return await R.json()},enabled:B&&!!w.sessionId}),ft=(R)=>{return R.split(/(<@[a-zA-Z0-9_-]+>)/g).map((pt,G)=>{if(pt.match(/^<@[a-zA-Z0-9_-]+>$/)){let Ct=pt.slice(2,-1),Kt=w.mentions?.find((le)=>le.id===Ct)||n(Ct);return rt("span",{className:"text-primary font-medium hover:underline cursor-pointer",children:["@",Kt?.name||"Unknown"]},G)}return x("span",{children:pt},G)})},nt=(R)=>{return R.replace(/<@([a-zA-Z0-9_-]+)>/g,"@$1").replace(/^\[([^\]]+)\]:/gm,"\\[$1\\]:")},qt=()=>{l(w)};return rt("div",{onClick:c,className:`relative flex gap-4 ${a?"mt-[-1px]":"mt-3"} mr-3 group p-3 py-4 border transition-all duration-200 cursor-pointer ${a?s?"rounded-b-xl rounded-t-none":"rounded-none":i?"rounded-t-xl rounded-b-none":"rounded-xl"} ${o?"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:[rt("div",{className:"flex flex-col items-center shrink-0 w-8 relative",children:[a&&x("div",{className:"absolute top-[-1rem] h-8 w-0.5 bg-foreground/10 left-1/2 -translate-x-1/2 z-0"}),(i&&!a||a&&!s)&&x("div",{className:"absolute top-4 bottom-[-1rem] w-0.5 bg-foreground/10 left-1/2 -translate-x-1/2 z-0"}),rt(Ad,{className:"z-10 relative",children:[v?.image&&x(vd,{src:v.image,alt:v.name||"",className:"object-cover"}),x(Sd,{className:"bg-rose-400 text-black",children:v?.name?.[0]?.toUpperCase()||"U"})]})]}),rt("div",{className:"flex-1 min-w-0",children:[rt("div",{className:"flex items-center justify-between w-full mb-1",children:[rt("div",{className:"flex items-center gap-2",children:[x("span",{className:"font-semibold text-sm",children:v?.name||"Unknown"}),x("span",{className:"text-xs text-gray-400",children:new Date(w.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),J&&x("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:rt(Mf,{modal:!1,children:[x(Df,{asChild:!0,children:x(Ln,{size:"icon-xs",variant:"ghost",className:"h-6 w-6 cursor-pointer",onClick:(R)=>R.stopPropagation(),children:x(bd,{className:"h-4 w-4 text-foreground/70"})})}),x(Tf,{align:"end",onClick:(R)=>R.stopPropagation(),children:rt(l1,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:(R)=>{R.stopPropagation(),at(!0)},children:[x(pd,{className:"mr-2 h-4 w-4"}),x("span",{children:It.delete()})]})})]})})]}),rt("div",{className:"flow-root mt-1",children:[w.second!==null&&w.second!==void 0&&u&&x("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:D}),d&&x("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:x(_5,{className:"w-3.5 h-3.5"})}),k?rt("div",{className:"space-y-2",children:[x(hi,{className:"h-4 w-3/4"}),x(hi,{className:"h-4 w-1/2"}),x("span",{className:"text-xs text-muted-foreground animate-pulse",children:y})]}):w.sessionId?x("div",{className:"text-sm leading-[1.8] prose prose-sm dark:prose-invert max-w-none break-words",children:x(go,{children:nt(w.message)})}):x("div",{className:"text-sm leading-[1.8] whitespace-pre-wrap break-words text-wrap break-all",children:ft(w.message)})]}),w.attachments&&w.attachments.length>0&&x("div",{className:"flex flex-wrap gap-2 mt-3",children:w.attachments.map((R)=>{let ct=R.proxyType==="image",pt=R.url?.split("/").pop()?.split("?")[0]||"file";return rt("div",{className:"relative group rounded-lg overflow-hidden border bg-white shadow-sm hover:shadow-md transition-shadow w-48 h-32",onClick:()=>ct&&f(R),children:[ct?x("img",{src:R.url,alt:pt,className:"w-full h-full object-cover cursor-pointer"}):rt("div",{className:"w-full h-full bg-gray-100 flex flex-col items-center justify-center p-2 text-center",children:[x(C5,{className:"w-8 h-8 text-gray-500 mb-2"}),x("span",{className:"text-xs font-medium text-gray-700 break-all line-clamp-2",children:pt})]}),x("a",{href:R.url,target:"_blank",rel:"noreferrer",download:pt,className:"absolute right-2 bottom-2 bg-black/60 text-white hover:bg-black/80 p-1.5 rounded-full opacity-0 group-hover:opacity-100 transition-opacity",onClick:(G)=>G.stopPropagation(),children:x(Vn,{className:"w-4 h-4"})})]},R.id)})}),w.sessionId&&rt("div",{className:"mt-3 pt-2 border-t border-foreground/5 flex items-center justify-between text-xs text-muted-foreground/60",children:[x("span",{className:"flex items-center gap-1.5 font-medium text-muted-foreground/80",children:"Created by Agent"}),z&&x(Ln,{variant:"outline",size:"xs",onClick:()=>H(!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"})]}),rt("div",{className:"mt-2 flex items-center justify-between w-full",children:[x("button",{onClick:qt,className:"text-xs font-medium text-gray-500 hover:text-blue-600 flex items-center gap-1 cursor-pointer",children:It.reply()}),x(wd,{children:rt(jd,{children:[x(dd,{asChild:!0,children:x("button",{onClick:(R)=>{R.stopPropagation(),V()},className:`flex items-center justify-center p-1 rounded-full transition-colors cursor-pointer ${w.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:w.isCompleted?x(dR,{className:"w-5 h-5"}):x(jR,{className:"w-5 h-5"})})}),x(qd,{children:w.isCompleted?It.mark_as_incomplete():It.mark_as_complete()})]})})]})]}),x(kd,{open:B,onOpenChange:H,children:rt(Cd,{className:"sm:max-w-2xl max-h-[80vh] flex flex-col p-6 overflow-hidden bg-background/95 backdrop-blur-md border border-foreground/15 shadow-2xl",children:[rt(_d,{className:"pb-4 border-b border-foreground/15",children:[rt(Fd,{className:"flex items-center gap-2 text-xl font-bold",children:[x(l8,{className:"w-5 h-5 text-violet-500"}),It.agent_session_logs()]}),x(Bd,{children:It.agent_logs_description()})]}),x("div",{className:"flex-1 overflow-y-auto pr-1 py-4 space-y-4 min-h-0 select-text",children:W?rt("div",{className:"space-y-4",children:[rt("div",{className:"flex gap-4",children:[x(hi,{className:"h-5 w-5 rounded-full shrink-0"}),rt("div",{className:"flex-1 space-y-2",children:[x(hi,{className:"h-4 w-1/4"}),x(hi,{className:"h-20 w-full"})]})]}),rt("div",{className:"flex gap-4",children:[x(hi,{className:"h-5 w-5 rounded-full shrink-0"}),rt("div",{className:"flex-1 space-y-2",children:[x(hi,{className:"h-4 w-1/4"}),x(hi,{className:"h-12 w-full"})]})]})]}):Y&&Y.length>0?x("div",{className:"flex flex-col",children:Y.map((R)=>{let ct=R.entry,pt=ct?.timestamp||R.timestamp,G="";if(typeof pt==="string"||typeof pt==="number"){let Ct=new Date(pt);if(!isNaN(Ct.getTime()))G=yd(Ct.toISOString())}if(ct&&typeof ct==="object"){if(ct.type==="message"&&ct.message){let Ct=ct.message,Kt="bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200",le=String(Ct.role||"");if(Ct.role==="user")Kt="bg-slate-100 text-slate-800 dark:bg-slate-900/30 dark:text-slate-300",le=It.role_user();else if(Ct.role==="assistant")Kt="bg-violet-100 text-violet-800 dark:bg-violet-900/30 dark:text-violet-300",le=It.role_agent();else if(Ct.role==="toolResult")Kt=Ct.isError?"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300":"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-300",le=It.tool_result_with_name({name:String(Ct.toolName||It.unknown())});else if(Ct.role==="thought")Kt="bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-300",le=It.role_thinking();let Ft=($t)=>{let Dt=$t;if(typeof $t==="string")try{Dt=JSON.parse($t)}catch{}if(Dt&&typeof Dt==="object"&&!Array.isArray(Dt))return x("div",{className:"mt-1 space-y-1.5 pt-3",children:Object.entries(Dt).map(([Xt,Gt])=>{let ae=Gt&&typeof Gt==="object"?JSON.stringify(Gt,null,2):String(Gt);return rt("div",{className:"text-xs leading-relaxed break-words",children:[rt("span",{className:"font-semibold text-violet-600 dark:text-violet-400",children:[Xt,":"]})," ",x("span",{className:"text-foreground/90 font-mono whitespace-pre-wrap",children:ae})]},Xt)})});return x("div",{className:"text-xs font-mono whitespace-pre-wrap",children:String($t)})},Et=()=>{let $t=Ct.content;if(!$t)return null;if(typeof $t==="string"){if(!$t.trim())return null;return x("div",{className:"text-xs text-foreground/80 dark:text-foreground/95 leading-relaxed prose prose-sm dark:prose-invert max-w-none break-words",children:x(go,{children:nt($t)})})}if(Array.isArray($t)){let Dt=[];if($t.forEach((Mt,Xt)=>{if(!Mt)return;if(typeof Mt==="string"){if(!Mt.trim())return;Dt.push(x("div",{className:"text-xs text-foreground/80 dark:text-foreground/95 leading-relaxed prose prose-sm dark:prose-invert max-w-none break-words",children:x(go,{children:nt(Mt)})},`str-${Xt}`));return}if(typeof Mt==="object"){let Gt=Mt,ae=Gt.type;if(ae==="text"){let Re=Gt.text;if(typeof Re!=="string"||!Re.trim())return;Dt.push(x("div",{className:"text-xs text-foreground/80 dark:text-foreground/95 leading-relaxed prose prose-sm dark:prose-invert max-w-none break-words",children:x(go,{children:nt(Re)})},`txt-${Xt}`));return}if(ae==="toolCall"){let Re=String(Gt.name||Gt.toolName||It.unknown()),da=Gt.arguments||Gt.args;Dt.push(rt("div",{className:"text-xs space-y-2 py-1",children:[rt("div",{className:"font-semibold text-violet-600 dark:text-violet-400 flex items-center gap-1.5",children:[It.calling_tool()," ",x("span",{className:"font-mono bg-violet-500/10 px-1 py-0.5 rounded text-[11px]",children:Re})]}),!!da&&rt("div",{className:"space-y-1 pt-3",children:[x("div",{className:"text-[10px] text-muted-foreground/60 uppercase font-bold tracking-wider",children:It.tool_arguments()}),Ft(da)]})]},`tool-${Xt}`));return}if(ae==="image"){Dt.push(x("div",{className:"text-xs text-muted-foreground italic flex items-center gap-1.5 py-1",children:It.image_object()},`img-${Xt}`));return}let Xe=JSON.stringify(Mt,null,2);if(Xe==="{}")return;Dt.push(x("pre",{className:"text-xs text-foreground/80 font-mono whitespace-pre-wrap break-words bg-muted/20 p-2 rounded",children:Xe},`other-${Xt}`))}}),Dt.length===0)return null;return x("div",{className:"space-y-3 w-full",children:Dt.map((Mt,Xt)=>rt(bo.default.Fragment,{children:[Xt>0&&x(Ed,{className:"my-3 opacity-50"}),Mt]},Xt))})}return null};return rt("div",{className:"relative pl-6 pb-6 last:pb-0",children:[x("div",{className:"absolute left-[9px] top-2 bottom-0 w-0.5 bg-foreground/10 last:hidden"}),x("div",{className:`absolute left-0 top-1.5 h-5 w-5 rounded-full border-4 border-background flex items-center justify-center ${Ct.role==="user"?"bg-slate-500":Ct.role==="assistant"?"bg-violet-500":Ct.role==="toolResult"?Ct.isError?"bg-red-500":"bg-emerald-500":"bg-amber-500"}`}),rt("div",{className:"flex flex-col gap-1.5 bg-muted/30 dark:bg-muted/10 p-3 rounded-lg border border-foreground/5 backdrop-blur-xs w-full",children:[rt("div",{className:"flex items-center justify-between gap-2",children:[x("span",{className:`text-[10px] px-2 py-0.5 rounded-full font-semibold uppercase tracking-wider ${Kt}`,children:le}),x("span",{className:"text-[10px] text-muted-foreground/60",children:G})]}),Et()]})]},R.id)}}return rt("div",{className:"relative pl-6 pb-6 last:pb-0",children:[x("div",{className:"absolute left-[9px] top-2 bottom-0 w-0.5 bg-foreground/10 last:hidden"}),x("div",{className:"absolute left-0 top-1.5 h-5 w-5 rounded-full border-4 border-background bg-gray-400"}),rt("div",{className:"bg-muted/30 p-3 rounded-lg border border-foreground/5",children:[x("div",{className:"text-[10px] text-muted-foreground/60",children:G}),x("pre",{className:"text-xs text-foreground/80 font-mono whitespace-pre-wrap break-words",children:JSON.stringify(R.entry,null,2)})]})]},R.id)})}):rt("div",{className:"flex flex-col items-center justify-center py-12 text-center text-muted-foreground",children:[x(l8,{className:"w-8 h-8 text-muted-foreground/40 mb-2 animate-pulse"}),x("p",{className:"text-sm font-medium",children:It.no_logs_found()}),x("p",{className:"text-xs text-muted-foreground/60 mt-1",children:It.session_no_entries_yet()})]})})]})}),x(Od,{open:tt,onOpenChange:at,children:rt(Hd,{onClick:(R)=>R.stopPropagation(),children:[rt(Md,{children:[x(Td,{children:It.delete_comment_confirm()}),x(Rd,{children:It.delete_comment_description()})]}),rt(Dd,{children:[x(zd,{disabled:Z,onClick:(R)=>{R.stopPropagation(),at(!1)},children:It.cancel()}),x(Nd,{className:"bg-destructive hover:bg-destructive/90 text-white",disabled:Z,onClick:(R)=>{R.stopPropagation(),Q()},children:It.delete()})]})]})})]})};var _s=xd((t,e)=>({isDrawing:!1,currentTool:"arrow",currentColor:"#ef4444",annotations:[],history:[[]],historyIndex:0,setIsDrawing:(a)=>t({isDrawing:a}),setTool:(a)=>t({currentTool:a}),setColor:(a)=>t({currentColor:a}),addAnnotation:(a)=>{let{annotations:i,history:s,historyIndex:n}=e(),l=[...i,a],f=s.slice(0,n+1);f.push(l),t({annotations:l,history:f,historyIndex:f.length-1})},setAnnotations:(a)=>{t({annotations:a,history:[a],historyIndex:0})},undo:()=>{let{historyIndex:a,history:i}=e();if(a>0){let s=a-1;t({annotations:i[s],historyIndex:s})}},redo:()=>{let{historyIndex:a,history:i}=e();if(a<i.length-1){let s=a+1;t({annotations:i[s],historyIndex:s})}},reset:()=>t({isDrawing:!1,currentTool:"arrow",annotations:[],history:[[]],historyIndex:0})}));var ka=Ie(Pa(),1);var qR=["#ef4444","#f97316","#eab308","#22c55e","#3b82f6","#a855f7","#ec4899","#000000","#ffffff"],o8=ka.default.forwardRef(({projectId:t,onSendMessage:e,replyingTo:a,onCancelReply:i,bots:s=[],initialText:n="",hideAnnotationControl:l=!1,disableMentions:f=!1,currentTime:o,frameRate:c,startTimecode:u,formatTimestamp:m,onTyping:p},w)=>{let[d,v]=ka.useState([]),[k,y]=ka.useState(null),[B,H]=ka.useState(!0),{videoTimeDisplayMode:M}=wo(),D=ka.default.useMemo(()=>{if(o===void 0)return"";if(m)return m(o);if(!c)return"";let dt=Math.round(o*c);return cl(dt,c,M,u)},[o,c,M,u,m]),{teamId:T,ensureTeamIdForProject:z}=Yd(),{members:E,loading:V,fetchMembers:tt}=Qd();ka.useEffect(()=>{if(t&&!T)z(t)},[t,T,z]);let{isDrawing:at,setIsDrawing:Q,currentTool:Z,setTool:J,currentColor:Y,setColor:W,undo:ft,redo:nt,history:qt,historyIndex:R,annotations:ct,reset:pt}=_s(),[G,Ct]=ka.useState(!1),[Kt,le]=ka.useState(""),[Ft,Et]=ka.useState(0),[$t,Dt]=ka.useState({bots:!1,users:!1}),[Mt,Xt]=ka.useState(!1),Gt=ka.default.useMemo(()=>{if(!B||o===void 0||!m&&!c||Mt)return"";if(M==="timecode")return"pl-[120px]";return"pl-[85px]"},[B,o,c,Mt,M]),ae=ka.useRef(null),Xe=ka.useRef(null),Re=ka.useRef(null),{mutateAsync:da}=Hf({mutationFn:async({projectId:dt,data:Ut})=>{let ie=await Le.api.projects[":projectId"].attachments.$post({param:{projectId:dt},json:Ut});if(!ie.ok)throw Error("Failed to create attachment");return await ie.json()}});ka.useEffect(()=>{if(n&&ae.current){ae.current.innerText=n,Xt(!!n.trim()),ae.current.focus();let dt=document.createRange(),Ut=window.getSelection();dt.selectNodeContents(ae.current),dt.collapse(!1),Ut?.removeAllRanges(),Ut?.addRange(dt)}},[n]),ka.useEffect(()=>{if(a&&ae.current){ae.current.focus();let dt=document.createRange(),Ut=window.getSelection();dt.selectNodeContents(ae.current),dt.collapse(!1),Ut?.removeAllRanges(),Ut?.addRange(dt)}},[a]),ka.useEffect(()=>{return()=>{Q(!1)}},[Q]);let Ve=[...E.filter((dt)=>dt.type==="agent"&&dt.name?.toLowerCase().startsWith(Kt.toLowerCase())).map((dt)=>({type:"user",data:dt})),...s.filter((dt)=>dt.name?.toLowerCase().startsWith(Kt.toLowerCase())).map((dt)=>({type:"bot",data:dt}))],va=E.filter((dt)=>dt.type!=="agent"&&dt.name?.toLowerCase().startsWith(Kt.toLowerCase())).map((dt)=>({type:"user",data:dt})),ce=[...$t.bots?[]:Ve,...$t.users?[]:va];ka.useEffect(()=>{Et(0)},[Kt,G,$t]);let ii=()=>{if(!ae.current)return;if(Xt(!!ae.current.innerText.trim()),p?.(),f){Ct(!1),Re.current=null;return}let dt=window.getSelection();if(!dt||dt.rangeCount===0)return;let Ut=dt.getRangeAt(0),ie=Ut.startContainer,_e=Ut.startOffset;if(ie.nodeType===Node.TEXT_NODE){let Be=(ie.textContent||"").slice(0,_e),Sa=Be.lastIndexOf("@");if(Sa!==-1){let ia=Sa===0,on=Be[Sa-1];if(ia||/\s/.test(on)){let Pt=Be.slice(Sa+1);if(!/\s/.test(Pt)){if(le(Pt),Ct(!0),T)tt(T,!0,!0);let _t=document.createRange();_t.setStart(ie,Sa),_t.setEnd(ie,_e),Re.current=_t;return}}}}Ct(!1),Re.current=null},Ee=(dt)=>{if(!Re.current||!ae.current)return;let Ut=Re.current;Ut.deleteContents();let ie=document.createElement("span");ie.contentEditable="false",ie.dataset.type="mention",ie.dataset.id=dt.data.id,ie.className="inline-block bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300 px-1.5 py-0.5 rounded-md text-sm font-medium align-middle select-none mx-0.5",ie.innerText=`@${dt.data.name}`,Ut.insertNode(ie);let _e=document.createTextNode(" ");ie.after(_e);let ca=document.createRange(),Be=window.getSelection();ca.setStartAfter(_e),ca.collapse(!0),Be?.removeAllRanges(),Be?.addRange(ca),Ct(!1),Re.current=null,Xt(!0),ae.current.focus()},Ri=(dt)=>{if(dt.nativeEvent.isComposing)return;if(G&&ce.length>0){if(dt.key==="ArrowUp"){dt.preventDefault(),Et((Ut)=>Ut>0?Ut-1:ce.length-1);return}if(dt.key==="ArrowDown"){dt.preventDefault(),Et((Ut)=>Ut<ce.length-1?Ut+1:0);return}if(dt.key==="Enter"||dt.key==="Tab"){dt.preventDefault(),Ee(ce[Ft]);return}if(dt.key==="Escape"){dt.preventDefault(),Ct(!1);return}}if(dt.key==="Enter"&&!dt.shiftKey)dt.preventDefault(),mt()},mi=ka.useCallback(async(dt)=>{if(!dt.target.files)return;let Ut=Array.from(dt.target.files);for(let ie of Ut){let _e=`${Date.now()}-${ie.name}`,ca={id:_e,file:ie,progress:0};v((Be)=>[...Be,ca]);try{let Be=await da({projectId:t,data:{fileName:ie.name,contentType:ie.type,size:ie.size}});if(Be.uploadUrl&&Be.id)await fetch(Be.uploadUrl,{method:"PUT",body:ie,headers:{"Content-Type":ie.type}}),v((Sa)=>Sa.map((ia)=>ia.id===_e?{...ia,progress:100,attachmentId:Be.id}:ia))}catch(Be){v((Sa)=>Sa.map((ia)=>ia.id===_e?{...ia,error:Be instanceof Error?Be.message:"Upload failed"}:ia))}}if(Xe.current)Xe.current.value=""},[t,da]),ji=(dt)=>{v((Ut)=>Ut.filter((ie)=>ie.id!==dt))},mt=()=>{if(!ae.current)return;if(d.some((_e)=>!_e.attachmentId&&!_e.error))return;let Ut=d.map((_e)=>_e.attachmentId).filter((_e)=>!!_e),ie="";if(ae.current.childNodes.forEach((_e)=>{if(_e.nodeType===Node.TEXT_NODE)ie+=_e.textContent;else if(_e.nodeType===Node.ELEMENT_NODE){let ca=_e;if(ca.dataset.type==="mention")ie+=`<@${ca.dataset.id}>`;else if(ca.tagName==="BR")ie+=`
39
- `;else if(ca.tagName==="DIV"||ca.tagName==="P")ie+=`
40
- `+ca.innerText;else ie+=ca.innerText}}),ie=ie.trim(),!ie&&Ut.length===0&&ct.length===0)return;if(e(ie,Ut,ct,a?.id,B?o:void 0),ae.current.innerHTML="",Xt(!1),v([]),y(null),Q(!1),pt(),Ct(!1),i)i()},kt=d.some((dt)=>!dt.attachmentId&&!dt.error),Zt=d.some((dt)=>!!dt.attachmentId),ne=Mt||Zt||ct.length>0,ye=d.length>0||!!a;return rt("div",{ref:w,className:"relative flex flex-col w-full border border-foreground/35 rounded-3xl shadow-sm transition-all duration-200",children:[x("style",{children:`
41
- [contenteditable]:empty:before {
42
- content: attr(data-placeholder);
43
- color: #9ca3af;
44
- cursor: text;
45
- }
46
- `}),G&&(V||Ve.length>0||va.length>0)&&x("div",{className:"absolute bottom-full left-4 mb-2 w-64 rounded-xl shadow-lg border border-border overflow-hidden z-20 bg-popover text-popover-foreground animate-in fade-in slide-in-from-bottom-2 duration-200",children:x("div",{className:"h-64 overflow-y-auto",children:V?rt("div",{className:"p-2 space-y-4 animate-pulse",children:[rt("div",{className:"space-y-2",children:[x("div",{className:"px-3 py-1.5 bg-muted/50 border-b border-border",children:x(hi,{className:"h-3 w-16"})}),rt("div",{className:"flex items-center gap-2 px-3 py-2",children:[x(hi,{className:"w-6 h-6 rounded-full"}),x(hi,{className:"h-4 w-28"})]}),rt("div",{className:"flex items-center gap-2 px-3 py-2",children:[x(hi,{className:"w-6 h-6 rounded-full"}),x(hi,{className:"h-4 w-20"})]})]}),rt("div",{className:"space-y-2",children:[x("div",{className:"px-3 py-1.5 bg-muted/50 border-b border-border",children:x(hi,{className:"h-3 w-16"})}),rt("div",{className:"flex items-center gap-2 px-3 py-2",children:[x(hi,{className:"w-6 h-6 rounded-full"}),x(hi,{className:"h-4 w-32"})]}),rt("div",{className:"flex items-center gap-2 px-3 py-2",children:[x(hi,{className:"w-6 h-6 rounded-full"}),x(hi,{className:"h-4 w-24"})]})]})]}):rt(mo,{children:[Ve.length>0&&rt(mo,{children:[rt("button",{onClick:(dt)=>{dt.preventDefault(),dt.stopPropagation(),Dt((Ut)=>({...Ut,bots:!Ut.bots}))},className:"w-full text-xs font-semibold text-muted-foreground px-3 py-2 bg-muted/50 border-b border-border sticky top-0 flex items-center justify-between hover:bg-muted transition-colors",children:[x("span",{children:"Agents"}),x(jo,{className:`w-3 h-3 transition-transform ${$t.bots?"-rotate-90":""}`})]}),!$t.bots&&Ve.map((dt,Ut)=>{let ie=Ut;return rt("button",{onClick:()=>Ee(dt),onMouseEnter:()=>Et(ie),className:`w-full flex items-center gap-2 px-3 py-2 transition-colors text-left ${ie===Ft?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,children:[x("div",{className:"w-6 h-6 rounded-full bg-purple-100 dark:bg-purple-900/40 flex items-center justify-center text-xs font-bold text-purple-600 dark:text-purple-300",children:dt.data.name?.[0]}),x("span",{className:"text-sm",children:dt.data.name})]},dt.data.id)})]}),va.length>0&&rt(mo,{children:[rt("button",{onClick:(dt)=>{dt.preventDefault(),dt.stopPropagation(),Dt((Ut)=>({...Ut,users:!Ut.users}))},className:"w-full text-xs font-semibold text-muted-foreground px-3 py-2 bg-muted/50 border-b border-border sticky top-0 flex items-center justify-between hover:bg-muted transition-colors",children:[x("span",{children:"Members"}),x(jo,{className:`w-3 h-3 transition-transform ${$t.users?"-rotate-90":""}`})]}),!$t.users&&va.map((dt,Ut)=>{let ie=($t.bots?0:Ve.length)+Ut;return rt("button",{onClick:()=>Ee(dt),onMouseEnter:()=>Et(ie),className:`w-full flex items-center gap-2 px-3 py-2 transition-colors text-left ${ie===Ft?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,children:[x("div",{className:"w-6 h-6 rounded-full bg-blue-100 dark:bg-blue-900/40 flex items-center justify-center text-xs font-bold text-blue-600 dark:text-blue-300",children:dt.data.name?.[0]}),x("span",{className:"text-sm",children:dt.data.name})]},dt.data.id)})]})]})})}),ye&&rt("div",{className:"flex flex-col gap-2 p-3 pb-0 animate-in fade-in slide-in-from-bottom-2 duration-200",children:[a&&rt("div",{className:"flex items-center justify-between bg-muted p-2 px-3 rounded-lg border border-border",children:[x("div",{className:"text-xs text-muted-foreground truncate mr-2",children:It.reply_to_message({message:a.message||""})}),x("button",{onClick:i,className:"text-muted-foreground hover:text-foreground p-1 rounded-full hover:bg-muted-foreground/10 shrink-0",children:x(qo,{className:"w-3.5 h-3.5"})})]}),d.length>0&&x("div",{className:"flex gap-3 overflow-x-auto py-2 px-1 scrollbar-hide",children:d.map((dt)=>rt("div",{className:"relative group flex-shrink-0",children:[rt("div",{className:"w-16 h-16 rounded-lg border border-gray-200 overflow-hidden bg-gray-50 flex items-center justify-center",children:[dt.file.type.startsWith("image/")?x("img",{src:URL.createObjectURL(dt.file),alt:"preview",onClick:()=>y(dt.file),className:`w-full h-full object-cover ${!dt.attachmentId?"opacity-50":""}`}):x(C5,{className:"w-8 h-8 text-gray-400"}),kt&&!dt.attachmentId&&!dt.error&&x("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50",children:x(Jd,{progress:dt.progress,className:"w-10 h-10"})})]}),x("button",{onClick:()=>ji(dt.id),className:"absolute -top-1.5 -right-1.5 bg-gray-500 text-white rounded-full p-0.5 shadow-md opacity-0 group-hover:opacity-100 transition-opacity hover:bg-red-500 z-10",children:x(qo,{className:"w-3 h-3"})}),x("span",{className:"text-[10px] text-gray-500 mt-1 block max-w-[4rem] truncate text-center",children:dt.file.name})]},dt.id))})]}),rt("div",{onClick:()=>ae.current?.focus(),className:"w-full px-4 pt-1 pb-1 cursor-text flow-root max-h-60 overflow-y-auto",children:[B&&o!==void 0&&c!==void 0&&x("div",{onClick:(dt)=>{dt.stopPropagation(),ae.current?.focus()},className:"float-left select-none bg-blue-100 dark:bg-blue-900/40 text-blue-600 dark:text-blue-300 px-2.5 py-0.5 mt-3 mr-2 rounded-sm text-xs font-mono font-bold flex items-center gap-1 cursor-text",children:D}),x("div",{ref:ae,contentEditable:!0,suppressContentEditableWarning:!0,onInput:ii,onKeyDown:Ri,"data-placeholder":a?It.reply_placeholder():It.message_placeholder(),className:`bg-transparent border-none focus:ring-0 resize-none min-h-[40px] leading-relaxed py-2 focus:outline-none block ${Gt}`})]}),rt("div",{className:"flex justify-between items-center px-2 pb-2",children:[at?rt("div",{className:"flex items-center gap-2 overflow-x-auto scrollbar-hide w-full mr-2",children:[x(Ln,{onClick:()=>{Q(!1),pt()},variant:"ghost",size:"icon",className:"p-2 rounded-full cursor-pointer text-gray-500 hover:text-gray-700 hover:bg-gray-100 mr-2",title:"Back",children:x(Ud,{className:"w-4 h-4"})}),x("div",{className:"h-4 w-px bg-gray-300 mx-1"}),x("button",{onClick:()=>J("arrow"),className:`p-1.5 rounded hover:bg-gray-100 ${Z==="arrow"?"text-blue-500 bg-blue-50":"text-gray-500"}`,title:"Arrow",children:x(r8,{size:16,className:"rotate-45"})}),x("button",{onClick:()=>J("line"),className:`p-1.5 rounded hover:bg-gray-100 ${Z==="line"?"text-blue-500 bg-blue-50":"text-gray-500"}`,title:"Line",children:x(ul,{size:16,className:"-rotate-45"})}),x("button",{onClick:()=>J("box"),className:`p-1.5 rounded hover:bg-gray-100 ${Z==="box"?"text-blue-500 bg-blue-50":"text-gray-500"}`,title:"Box",children:x(Ld,{size:16})}),x("button",{onClick:()=>J("freehand"),className:`p-1.5 rounded hover:bg-gray-100 ${Z==="freehand"?"text-blue-500 bg-blue-50":"text-gray-500"}`,title:"Freehand",children:x(Id,{size:16})}),x("div",{className:"h-4 w-px bg-gray-300 mx-1"}),rt(F5,{children:[x(B5,{asChild:!0,children:rt("button",{className:"flex items-center gap-1 p-1 rounded hover:bg-gray-100",children:[x("div",{className:"w-4 h-4 rounded-full border border-gray-200",style:{backgroundColor:Y}}),x(jo,{size:12,className:"text-gray-500"})]})}),x(O5,{className:"w-auto p-2",align:"center",side:"top",children:x("div",{className:"flex items-center gap-1",children:qR.map((dt)=>x("button",{onClick:()=>W(dt),className:`w-6 h-6 rounded-full border border-gray-200 transition-transform hover:scale-110 ${Y===dt?"ring-2 ring-blue-500 ring-offset-1":""}`,style:{backgroundColor:dt}},dt))})})]}),x("div",{className:"h-4 w-px bg-gray-300 mx-1"}),x("button",{onClick:ft,disabled:R<=0,className:"p-1.5 rounded hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed text-gray-500",children:x(Vd,{size:16})}),x("button",{onClick:nt,disabled:R>=qt.length-1,className:"p-1.5 rounded hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed text-gray-500",children:x(Kd,{size:16})})]}):rt("div",{className:"flex items-center gap-1",children:[x("input",{type:"file",ref:Xe,className:"hidden",multiple:!0,onChange:mi}),o!==void 0&&c!==void 0&&x(Ln,{onClick:()=>H(!B),variant:B?"secondary":"ghost",size:"icon",className:`p-2 rounded-full cursor-pointer ${B?"text-blue-600 bg-blue-50 dark:bg-blue-900/20":""}`,title:B?It.disable_timestamp():It.enable_timestamp(),children:x(Gd,{className:"w-4 h-4"})}),x(Ln,{onClick:()=>Xe.current?.click(),className:"p-2 rounded-full cursor-pointer",variant:"ghost",size:"icon",title:It.attach_files(),children:x(Xd,{className:"w-4 h-4"})}),!l&&x(Ln,{onClick:()=>Q(!0),variant:"ghost",size:"icon",className:"p-2 rounded-full cursor-pointer",title:It.toggle_annotation(),children:x(_5,{className:"w-4 h-4"})})]}),x("button",{onClick:mt,disabled:!ne||kt,className:`p-2 rounded-full transition-all duration-200 flex items-center justify-center shrink-0 ${ne&&!kt?"bg-blue-600 text-white shadow-md hover:bg-blue-700 hover:shadow-lg transform hover:-translate-y-0.5":"bg-gray-400 cursor-not-allowed"}`,children:x(r8,{className:"w-4 h-4"})})]}),k&&rt("div",{className:"fixed inset-0 z-[100] bg-black/95 flex flex-col items-center justify-center p-4 animate-in fade-in duration-200",onClick:()=>y(null),children:[x("button",{className:"absolute top-4 right-4 text-white/70 hover:text-white hover:bg-white/20 rounded-full p-2 transition-colors z-50",children:x(qo,{className:"w-8 h-8"})}),x("div",{className:"w-full h-full flex items-center justify-center p-2",children:x("img",{src:URL.createObjectURL(k),alt:"Enlarged view",className:"max-w-full max-h-[85vh] object-contain rounded shadow-2xl cursor-zoom-out",onClick:(dt)=>{dt.stopPropagation(),y(null)}})}),x("div",{className:"absolute bottom-6 text-white text-sm font-medium bg-black/50 px-4 py-2 rounded-full backdrop-blur-sm",children:k.name})]})]})});o8.displayName="ChatInput";var Zc=Ie(Pa(),1);function $d({isOpen:t,onClose:e,onSuccess:a,children:i}){let[s,n]=Zc.useState(""),[l,f]=Zc.useState(""),[o,c]=Zc.useState(!1),[u,m]=Zc.useState(null);return rt(F5,{open:t,onOpenChange:(w)=>!w&&e(),children:[x(B5,{asChild:!0,children:i}),x(O5,{className:"w-80",align:"end",side:"top",children:rt("form",{onSubmit:async(w)=>{w.preventDefault(),c(!0),m(null);try{let d=await Le.api.identify.$post({json:{username:s,email:l}});if(!d.ok){let k=await d.json();throw Error(k.error||"Failed to identify")}let{id:v}=await d.json();localStorage.setItem("guest_user_id",v),a(v),e()}catch(d){m(d.message)}finally{c(!1)}},className:"space-y-4",children:[rt("div",{className:"space-y-2",children:[x("h4",{className:"font-medium leading-none",children:It.enter_your_details()}),x("p",{className:"text-sm text-muted-foreground",children:It.provide_name_email_for_comment()})]}),rt("div",{className:"grid gap-2",children:[rt("div",{className:"grid gap-1",children:[x(c8,{htmlFor:"name",children:It.name()}),x(h8,{id:"name",value:s,onChange:(w)=>n(w.target.value),placeholder:It.name_placeholder(),size:32,required:!0})]}),rt("div",{className:"grid gap-1",children:[x(c8,{htmlFor:"email",children:It.email()}),x(h8,{id:"email",type:"email",value:l,onChange:(w)=>f(w.target.value),placeholder:It.email_field_placeholder(),required:!0})]}),u&&x("p",{className:"text-xs text-destructive",children:u})]}),rt("div",{className:"flex justify-end gap-2",children:[x(Ln,{type:"button",variant:"outline",size:"sm",onClick:e,children:It.cancel()}),rt(Ln,{type:"submit",size:"sm",disabled:o,children:[o&&x(Zd,{className:"mr-2 h-3 w-3 animate-spin"}),It.confirm()]})]})]})})]})}var He=Ie(Pa(),1);var $=Ie(h0(),1),Ot=Ie(A8(),1),a7=Ie(zq(),1),Og=Ie($q(),1);function za(){return za=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var i in a)({}).hasOwnProperty.call(a,i)&&(t[i]=a[i])}return t},za.apply(null,arguments)}var So=Ie(h0(),1),Wq="https://example.com",HN=function(e,a){if(/^[a-z]+:/i.test(a))return a;if(/^data:/.test(e))e=So.default.location&&So.default.location.href||"";var i=/^\/\//.test(e),s=!So.default.location&&!/\/\//i.test(e);e=new So.default.URL(e,So.default.location||Wq);var n=new URL(a,e);if(s)return n.href.slice(Wq.length);else if(i)return n.href.slice(n.protocol.length);return n.href},yo=HN;var T5=function(){function t(){this.listeners={}}var e=t.prototype;return e.on=function(i,s){if(!this.listeners[i])this.listeners[i]=[];this.listeners[i].push(s)},e.off=function(i,s){if(!this.listeners[i])return!1;var n=this.listeners[i].indexOf(s);return this.listeners[i]=this.listeners[i].slice(0),this.listeners[i].splice(n,1),n>-1},e.trigger=function(i){var s=this.listeners[i];if(!s)return;if(arguments.length===2){var n=s.length;for(var l=0;l<n;++l)s[l].call(this,arguments[1])}else{var f=Array.prototype.slice.call(arguments,1),o=s.length;for(var c=0;c<o;++c)s[c].apply(this,f)}},e.dispose=function(){this.listeners={}},e.pipe=function(i){this.on("data",function(s){i.push(s)})},t}();var B8=Ie(h0(),1),MN=function(e){return B8.default.atob?B8.default.atob(e):Buffer.from(e,"base64").toString("binary")};function i2(t){var e=MN(t),a=new Uint8Array(e.length);for(var i=0;i<e.length;i++)a[i]=e.charCodeAt(i);return a}/*! @name m3u8-parser @version 7.2.0 @license Apache-2.0 */class tA extends T5{constructor(){super();this.buffer=""}push(t){let e;this.buffer+=t,e=this.buffer.indexOf(`
47
- `);for(;e>-1;e=this.buffer.indexOf(`
48
- `))this.trigger("data",this.buffer.substring(0,e)),this.buffer=this.buffer.substring(e+1)}}var DN=String.fromCharCode(9),O8=function(t){let e=/([0-9.]*)?@?([0-9.]*)?/.exec(t||""),a={};if(e[1])a.length=parseInt(e[1],10);if(e[2])a.offset=parseInt(e[2],10);return a},TN=function(){return new RegExp("(?:^|,)("+'(?:[^=]*)=(?:"[^"]*"|[^,]*)'+")")},cs=function(t){let e={};if(!t)return e;let a=t.split(TN()),i=a.length,s;while(i--){if(a[i]==="")continue;s=/([^=]*)=(.*)/.exec(a[i]).slice(1),s[0]=s[0].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^['"](.*)['"]$/g,"$1"),e[s[0]]=s[1]}return e},Pq=(t)=>{let e=t.split("x"),a={};if(e[0])a.width=parseInt(e[0],10);if(e[1])a.height=parseInt(e[1],10);return a};class eA extends T5{constructor(){super();this.customParsers=[],this.tagMappers=[]}push(t){let e,a;if(t=t.trim(),t.length===0)return;if(t[0]!=="#"){this.trigger("data",{type:"uri",uri:t});return}this.tagMappers.reduce((s,n)=>{let l=n(t);if(l===t)return s;return s.concat([l])},[t]).forEach((s)=>{for(let n=0;n<this.customParsers.length;n++)if(this.customParsers[n].call(this,s))return;if(s.indexOf("#EXT")!==0){this.trigger("data",{type:"comment",text:s.slice(1)});return}if(s=s.replace("\r",""),e=/^#EXTM3U/.exec(s),e){this.trigger("data",{type:"tag",tagType:"m3u"});return}if(e=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(s),e){if(a={type:"tag",tagType:"inf"},e[1])a.duration=parseFloat(e[1]);if(e[2])a.title=e[2];this.trigger("data",a);return}if(e=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(s),e){if(a={type:"tag",tagType:"targetduration"},e[1])a.duration=parseInt(e[1],10);this.trigger("data",a);return}if(e=/^#EXT-X-VERSION:([0-9.]*)?/.exec(s),e){if(a={type:"tag",tagType:"version"},e[1])a.version=parseInt(e[1],10);this.trigger("data",a);return}if(e=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(s),e){if(a={type:"tag",tagType:"media-sequence"},e[1])a.number=parseInt(e[1],10);this.trigger("data",a);return}if(e=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(s),e){if(a={type:"tag",tagType:"discontinuity-sequence"},e[1])a.number=parseInt(e[1],10);this.trigger("data",a);return}if(e=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(s),e){if(a={type:"tag",tagType:"playlist-type"},e[1])a.playlistType=e[1];this.trigger("data",a);return}if(e=/^#EXT-X-BYTERANGE:(.*)?$/.exec(s),e){a=za(O8(e[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",a);return}if(e=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(s),e){if(a={type:"tag",tagType:"allow-cache"},e[1])a.allowed=!/NO/.test(e[1]);this.trigger("data",a);return}if(e=/^#EXT-X-MAP:(.*)$/.exec(s),e){if(a={type:"tag",tagType:"map"},e[1]){let n=cs(e[1]);if(n.URI)a.uri=n.URI;if(n.BYTERANGE)a.byterange=O8(n.BYTERANGE)}this.trigger("data",a);return}if(e=/^#EXT-X-STREAM-INF:(.*)$/.exec(s),e){if(a={type:"tag",tagType:"stream-inf"},e[1]){if(a.attributes=cs(e[1]),a.attributes.RESOLUTION)a.attributes.RESOLUTION=Pq(a.attributes.RESOLUTION);if(a.attributes.BANDWIDTH)a.attributes.BANDWIDTH=parseInt(a.attributes.BANDWIDTH,10);if(a.attributes["FRAME-RATE"])a.attributes["FRAME-RATE"]=parseFloat(a.attributes["FRAME-RATE"]);if(a.attributes["PROGRAM-ID"])a.attributes["PROGRAM-ID"]=parseInt(a.attributes["PROGRAM-ID"],10)}this.trigger("data",a);return}if(e=/^#EXT-X-MEDIA:(.*)$/.exec(s),e){if(a={type:"tag",tagType:"media"},e[1])a.attributes=cs(e[1]);this.trigger("data",a);return}if(e=/^#EXT-X-ENDLIST/.exec(s),e){this.trigger("data",{type:"tag",tagType:"endlist"});return}if(e=/^#EXT-X-DISCONTINUITY/.exec(s),e){this.trigger("data",{type:"tag",tagType:"discontinuity"});return}if(e=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(s),e){if(a={type:"tag",tagType:"program-date-time"},e[1])a.dateTimeString=e[1],a.dateTimeObject=new Date(e[1]);this.trigger("data",a);return}if(e=/^#EXT-X-KEY:(.*)$/.exec(s),e){if(a={type:"tag",tagType:"key"},e[1]){if(a.attributes=cs(e[1]),a.attributes.IV){if(a.attributes.IV.substring(0,2).toLowerCase()==="0x")a.attributes.IV=a.attributes.IV.substring(2);a.attributes.IV=a.attributes.IV.match(/.{8}/g),a.attributes.IV[0]=parseInt(a.attributes.IV[0],16),a.attributes.IV[1]=parseInt(a.attributes.IV[1],16),a.attributes.IV[2]=parseInt(a.attributes.IV[2],16),a.attributes.IV[3]=parseInt(a.attributes.IV[3],16),a.attributes.IV=new Uint32Array(a.attributes.IV)}}this.trigger("data",a);return}if(e=/^#EXT-X-START:(.*)$/.exec(s),e){if(a={type:"tag",tagType:"start"},e[1])a.attributes=cs(e[1]),a.attributes["TIME-OFFSET"]=parseFloat(a.attributes["TIME-OFFSET"]),a.attributes.PRECISE=/YES/.test(a.attributes.PRECISE);this.trigger("data",a);return}if(e=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(s),e){if(a={type:"tag",tagType:"cue-out-cont"},e[1])a.data=e[1];else a.data="";this.trigger("data",a);return}if(e=/^#EXT-X-CUE-OUT:(.*)?$/.exec(s),e){if(a={type:"tag",tagType:"cue-out"},e[1])a.data=e[1];else a.data="";this.trigger("data",a);return}if(e=/^#EXT-X-CUE-IN:?(.*)?$/.exec(s),e){if(a={type:"tag",tagType:"cue-in"},e[1])a.data=e[1];else a.data="";this.trigger("data",a);return}if(e=/^#EXT-X-SKIP:(.*)$/.exec(s),e&&e[1]){if(a={type:"tag",tagType:"skip"},a.attributes=cs(e[1]),a.attributes.hasOwnProperty("SKIPPED-SEGMENTS"))a.attributes["SKIPPED-SEGMENTS"]=parseInt(a.attributes["SKIPPED-SEGMENTS"],10);if(a.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES"))a.attributes["RECENTLY-REMOVED-DATERANGES"]=a.attributes["RECENTLY-REMOVED-DATERANGES"].split(DN);this.trigger("data",a);return}if(e=/^#EXT-X-PART:(.*)$/.exec(s),e&&e[1]){if(a={type:"tag",tagType:"part"},a.attributes=cs(e[1]),["DURATION"].forEach(function(n){if(a.attributes.hasOwnProperty(n))a.attributes[n]=parseFloat(a.attributes[n])}),["INDEPENDENT","GAP"].forEach(function(n){if(a.attributes.hasOwnProperty(n))a.attributes[n]=/YES/.test(a.attributes[n])}),a.attributes.hasOwnProperty("BYTERANGE"))a.attributes.byterange=O8(a.attributes.BYTERANGE);this.trigger("data",a);return}if(e=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(s),e&&e[1]){a={type:"tag",tagType:"server-control"},a.attributes=cs(e[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(n){if(a.attributes.hasOwnProperty(n))a.attributes[n]=parseFloat(a.attributes[n])}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(n){if(a.attributes.hasOwnProperty(n))a.attributes[n]=/YES/.test(a.attributes[n])}),this.trigger("data",a);return}if(e=/^#EXT-X-PART-INF:(.*)$/.exec(s),e&&e[1]){a={type:"tag",tagType:"part-inf"},a.attributes=cs(e[1]),["PART-TARGET"].forEach(function(n){if(a.attributes.hasOwnProperty(n))a.attributes[n]=parseFloat(a.attributes[n])}),this.trigger("data",a);return}if(e=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(s),e&&e[1]){a={type:"tag",tagType:"preload-hint"},a.attributes=cs(e[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(n){if(a.attributes.hasOwnProperty(n)){a.attributes[n]=parseInt(a.attributes[n],10);let l=n==="BYTERANGE-LENGTH"?"length":"offset";a.attributes.byterange=a.attributes.byterange||{},a.attributes.byterange[l]=a.attributes[n],delete a.attributes[n]}}),this.trigger("data",a);return}if(e=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(s),e&&e[1]){a={type:"tag",tagType:"rendition-report"},a.attributes=cs(e[1]),["LAST-MSN","LAST-PART"].forEach(function(n){if(a.attributes.hasOwnProperty(n))a.attributes[n]=parseInt(a.attributes[n],10)}),this.trigger("data",a);return}if(e=/^#EXT-X-DATERANGE:(.*)$/.exec(s),e&&e[1]){a={type:"tag",tagType:"daterange"},a.attributes=cs(e[1]),["ID","CLASS"].forEach(function(l){if(a.attributes.hasOwnProperty(l))a.attributes[l]=String(a.attributes[l])}),["START-DATE","END-DATE"].forEach(function(l){if(a.attributes.hasOwnProperty(l))a.attributes[l]=new Date(a.attributes[l])}),["DURATION","PLANNED-DURATION"].forEach(function(l){if(a.attributes.hasOwnProperty(l))a.attributes[l]=parseFloat(a.attributes[l])}),["END-ON-NEXT"].forEach(function(l){if(a.attributes.hasOwnProperty(l))a.attributes[l]=/YES/i.test(a.attributes[l])}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(l){if(a.attributes.hasOwnProperty(l))a.attributes[l]=a.attributes[l].toString(16)});let n=/^X-([A-Z]+-)+[A-Z]+$/;for(let l in a.attributes){if(!n.test(l))continue;let f=/[0-9A-Fa-f]{6}/g.test(a.attributes[l]),o=/^\d+(\.\d+)?$/.test(a.attributes[l]);a.attributes[l]=f?a.attributes[l].toString(16):o?parseFloat(a.attributes[l]):String(a.attributes[l])}this.trigger("data",a);return}if(e=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(s),e){this.trigger("data",{type:"tag",tagType:"independent-segments"});return}if(e=/^#EXT-X-I-FRAMES-ONLY/.exec(s),e){this.trigger("data",{type:"tag",tagType:"i-frames-only"});return}if(e=/^#EXT-X-CONTENT-STEERING:(.*)$/.exec(s),e){a={type:"tag",tagType:"content-steering"},a.attributes=cs(e[1]),this.trigger("data",a);return}if(e=/^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(s),e){if(a={type:"tag",tagType:"i-frame-playlist"},a.attributes=cs(e[1]),a.attributes.URI)a.uri=a.attributes.URI;if(a.attributes.BANDWIDTH)a.attributes.BANDWIDTH=parseInt(a.attributes.BANDWIDTH,10);if(a.attributes.RESOLUTION)a.attributes.RESOLUTION=Pq(a.attributes.RESOLUTION);if(a.attributes["AVERAGE-BANDWIDTH"])a.attributes["AVERAGE-BANDWIDTH"]=parseInt(a.attributes["AVERAGE-BANDWIDTH"],10);if(a.attributes["FRAME-RATE"])a.attributes["FRAME-RATE"]=parseFloat(a.attributes["FRAME-RATE"]);this.trigger("data",a);return}if(e=/^#EXT-X-DEFINE:(.*)$/.exec(s),e){a={type:"tag",tagType:"define"},a.attributes=cs(e[1]),this.trigger("data",a);return}this.trigger("data",{type:"tag",data:s.slice(4)})})}addParser({expression:t,customType:e,dataParser:a,segment:i}){if(typeof a!=="function")a=(s)=>s;this.customParsers.push((s)=>{if(t.exec(s))return this.trigger("data",{type:"custom",data:a(s),customType:e,segment:i}),!0})}addTagMapper({expression:t,map:e}){let a=(i)=>{if(t.test(i))return e(i);return i};this.tagMappers.push(a)}}var RN=(t)=>t.toLowerCase().replace(/-(\w)/g,(e)=>e[1].toUpperCase()),gl=function(t){let e={};return Object.keys(t).forEach(function(a){e[RN(a)]=t[a]}),e},H8=function(t){let{serverControl:e,targetDuration:a,partTargetDuration:i}=t;if(!e)return;let s="#EXT-X-SERVER-CONTROL",n="holdBack",l="partHoldBack",f=a&&a*3,o=i&&i*2;if(a&&!e.hasOwnProperty(n))e[n]=f,this.trigger("info",{message:`${s} defaulting HOLD-BACK to targetDuration * 3 (${f}).`});if(f&&e[n]<f)this.trigger("warn",{message:`${s} clamping HOLD-BACK (${e[n]}) to targetDuration * 3 (${f})`}),e[n]=f;if(i&&!e.hasOwnProperty(l))e[l]=i*3,this.trigger("info",{message:`${s} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${e[l]}).`});if(i&&e[l]<o)this.trigger("warn",{message:`${s} clamping PART-HOLD-BACK (${e[l]}) to partTargetDuration * 2 (${o}).`}),e[l]=o};class M8 extends T5{constructor(t={}){super();this.lineStream=new tA,this.parseStream=new eA,this.lineStream.pipe(this.parseStream),this.mainDefinitions=t.mainDefinitions||{},this.params=new URL(t.uri,"https://a.com").searchParams,this.lastProgramDateTime=null;let e=this,a=[],i={},s,n,l=!1,f=function(){},o={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},c="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",u=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};let m=0,p=0,w={};this.on("end",()=>{if(i.uri||!i.parts&&!i.preloadHints)return;if(!i.map&&s)i.map=s;if(!i.key&&n)i.key=n;if(!i.timeline&&typeof u==="number")i.timeline=u;this.manifest.preloadSegment=i}),this.parseStream.on("data",function(d){let v,k;if(e.manifest.definitions)for(let y in e.manifest.definitions){if(d.uri)d.uri=d.uri.replace(`{$${y}}`,e.manifest.definitions[y]);if(d.attributes){for(let B in d.attributes)if(typeof d.attributes[B]==="string")d.attributes[B]=d.attributes[B].replace(`{$${y}}`,e.manifest.definitions[y])}}({tag(){({version(){if(d.version)this.manifest.version=d.version},"allow-cache"(){if(this.manifest.allowCache=d.allowed,!("allowed"in d))this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0},byterange(){let y={};if("length"in d){if(i.byterange=y,y.length=d.length,!("offset"in d))d.offset=m}if("offset"in d)i.byterange=y,y.offset=d.offset;m=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(d.title)i.title=d.title;if(d.duration>0)i.duration=d.duration;if(d.duration===0)i.duration=0.01,this.trigger("info",{message:"updating zero segment duration to a small value"});this.manifest.segments=a},key(){if(!d.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(d.attributes.METHOD==="NONE"){n=null;return}if(!d.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(d.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:d.attributes};return}if(d.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:d.attributes.URI};return}if(d.attributes.KEYFORMAT===c){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(d.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(d.attributes.METHOD==="SAMPLE-AES-CENC")this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"});if(d.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(d.attributes.KEYID&&d.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:d.attributes.KEYFORMAT,keyId:d.attributes.KEYID.substring(2)},pssh:i2(d.attributes.URI.split(",")[1])};return}if(!d.attributes.METHOD)this.trigger("warn",{message:"defaulting key method to AES-128"});if(n={method:d.attributes.METHOD||"AES-128",uri:d.attributes.URI},typeof d.attributes.IV<"u")n.iv=d.attributes.IV},"media-sequence"(){if(!isFinite(d.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+d.number});return}this.manifest.mediaSequence=d.number},"discontinuity-sequence"(){if(!isFinite(d.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+d.number});return}this.manifest.discontinuitySequence=d.number,u=d.number},"playlist-type"(){if(!/VOD|EVENT/.test(d.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+d.playlist});return}this.manifest.playlistType=d.playlistType},map(){if(s={},d.uri)s.uri=d.uri;if(d.byterange)s.byterange=d.byterange;if(n)s.key=n},"stream-inf"(){if(this.manifest.playlists=a,this.manifest.mediaGroups=this.manifest.mediaGroups||o,!d.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}if(!i.attributes)i.attributes={};za(i.attributes,d.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||o,!(d.attributes&&d.attributes.TYPE&&d.attributes["GROUP-ID"]&&d.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}let y=this.manifest.mediaGroups[d.attributes.TYPE];if(y[d.attributes["GROUP-ID"]]=y[d.attributes["GROUP-ID"]]||{},v=y[d.attributes["GROUP-ID"]],k={default:/yes/i.test(d.attributes.DEFAULT)},k.default)k.autoselect=!0;else k.autoselect=/yes/i.test(d.attributes.AUTOSELECT);if(d.attributes.LANGUAGE)k.language=d.attributes.LANGUAGE;if(d.attributes.URI)k.uri=d.attributes.URI;if(d.attributes["INSTREAM-ID"])k.instreamId=d.attributes["INSTREAM-ID"];if(d.attributes.CHARACTERISTICS)k.characteristics=d.attributes.CHARACTERISTICS;if(d.attributes.FORCED)k.forced=/yes/i.test(d.attributes.FORCED);v[d.attributes.NAME]=k},discontinuity(){u+=1,i.discontinuity=!0,this.manifest.discontinuityStarts.push(a.length)},"program-date-time"(){if(typeof this.manifest.dateTimeString>"u")this.manifest.dateTimeString=d.dateTimeString,this.manifest.dateTimeObject=d.dateTimeObject;i.dateTimeString=d.dateTimeString,i.dateTimeObject=d.dateTimeObject;let{lastProgramDateTime:y}=this;if(this.lastProgramDateTime=new Date(d.dateTimeString).getTime(),y===null)this.manifest.segments.reduceRight((B,H)=>{return H.programDateTime=B-H.duration*1000,H.programDateTime},this.lastProgramDateTime)},targetduration(){if(!isFinite(d.duration)||d.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+d.duration});return}this.manifest.targetDuration=d.duration,H8.call(this,this.manifest)},start(){if(!d.attributes||isNaN(d.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:d.attributes["TIME-OFFSET"],precise:d.attributes.PRECISE}},"cue-out"(){i.cueOut=d.data},"cue-out-cont"(){i.cueOutCont=d.data},"cue-in"(){i.cueIn=d.data},skip(){this.manifest.skip=gl(d.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",d.attributes,["SKIPPED-SEGMENTS"])},part(){l=!0;let y=this.manifest.segments.length,B=gl(d.attributes);if(i.parts=i.parts||[],i.parts.push(B),B.byterange){if(!B.byterange.hasOwnProperty("offset"))B.byterange.offset=p;p=B.byterange.offset+B.byterange.length}let H=i.parts.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PART #${H} for segment #${y}`,d.attributes,["URI","DURATION"]),this.manifest.renditionReports)this.manifest.renditionReports.forEach((M,D)=>{if(!M.hasOwnProperty("lastPart"))this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${D} lacks required attribute(s): LAST-PART`})})},"server-control"(){let y=this.manifest.serverControl=gl(d.attributes);if(!y.hasOwnProperty("canBlockReload"))y.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"});if(H8.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,B=gl(d.attributes),H=B.type&&B.type==="PART";if(i.preloadHints=i.preloadHints||[],i.preloadHints.push(B),B.byterange){if(!B.byterange.hasOwnProperty("offset")){if(B.byterange.offset=H?p:0,H)p=B.byterange.offset+B.byterange.length}}let M=i.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${M} for segment #${y}`,d.attributes,["TYPE","URI"]),!B.type)return;for(let D=0;D<i.preloadHints.length-1;D++){let T=i.preloadHints[D];if(!T.type)continue;if(T.type===B.type)this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${M} for segment #${y} has the same TYPE ${B.type} as preload hint #${D}`})}},"rendition-report"(){let y=gl(d.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(y);let B=this.manifest.renditionReports.length-1,H=["LAST-MSN","URI"];if(l)H.push("LAST-PART");this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${B}`,d.attributes,H)},"part-inf"(){if(this.manifest.partInf=gl(d.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",d.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget)this.manifest.partTargetDuration=this.manifest.partInf.partTarget;H8.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(gl(d.attributes));let y=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${y}`,d.attributes,["ID","START-DATE"]);let B=this.manifest.dateRanges[y];if(B.endDate&&B.startDate&&new Date(B.endDate)<new Date(B.startDate))this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"});if(B.duration&&B.duration<0)this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"});if(B.plannedDuration&&B.plannedDuration<0)this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});let H=!!B.endOnNext;if(H&&!B.class)this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"});if(H&&(B.duration||B.endDate))this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"});if(B.duration&&B.endDate){let D=B.startDate.getTime()+B.duration*1000;this.manifest.dateRanges[y].endDate=new Date(D)}if(!w[B.id])w[B.id]=B;else{for(let D in w[B.id])if(!!B[D]&&JSON.stringify(w[B.id][D])!==JSON.stringify(B[D])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}let M=this.manifest.dateRanges.findIndex((D)=>D.id===B.id);this.manifest.dateRanges[M]=za(this.manifest.dateRanges[M],B),w[B.id]=za(w[B.id],B),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=gl(d.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",d.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};let y=(B,H)=>{if(B in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${B}`});return}this.manifest.definitions[B]=H};if("QUERYPARAM"in d.attributes){if("NAME"in d.attributes||"IMPORT"in d.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}let B=this.params.get(d.attributes.QUERYPARAM);if(!B){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${d.attributes.QUERYPARAM}`});return}y(d.attributes.QUERYPARAM,decodeURIComponent(B));return}if("NAME"in d.attributes){if("IMPORT"in d.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in d.attributes)||typeof d.attributes.VALUE!=="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${d.attributes.NAME}`});return}y(d.attributes.NAME,d.attributes.VALUE);return}if("IMPORT"in d.attributes){if(!this.mainDefinitions[d.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${d.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}y(d.attributes.IMPORT,this.mainDefinitions[d.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:d.attributes,uri:d.uri,timeline:u}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",d.attributes,["BANDWIDTH","URI"])}}[d.tagType]||f).call(e)},uri(){if(i.uri=d.uri,a.push(i),this.manifest.targetDuration&&!("duration"in i))this.trigger("warn",{message:"defaulting segment duration to the target duration"}),i.duration=this.manifest.targetDuration;if(n)i.key=n;if(i.timeline=u,s)i.map=s;if(p=0,this.lastProgramDateTime!==null)i.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=i.duration*1000;i={}},comment(){},custom(){if(d.segment)i.custom=i.custom||{},i.custom[d.customType]=d.data;else this.manifest.custom=this.manifest.custom||{},this.manifest.custom[d.customType]=d.data}})[d.type].call(e)})}requiredCompatibilityversion(t,e){if(t<e||!t)this.trigger("warn",{message:`manifest must be at least version ${e}`})}warnOnMissingAttributes_(t,e,a){let i=[];if(a.forEach(function(s){if(!e.hasOwnProperty(s))i.push(s)}),i.length)this.trigger("warn",{message:`${t} lacks required attribute(s): ${i.join(", ")}`})}push(t){this.lineStream.push(t)}end(){if(this.lineStream.push(`
49
- `),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(t){this.parseStream.addParser(t)}addTagMapper(t){this.parseStream.addTagMapper(t)}}var Nf=Ie(h0(),1),zf={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^/},NN=["video","audio","text"],aA=["Video","Audio","Text"],D8=function(e){if(!e)return e;return e.replace(/avc1\.(\d+)\.(\d+)/i,function(a,i,s){var n=("00"+Number(i).toString(16)).slice(-2),l=("00"+Number(s).toString(16)).slice(-2);return"avc1."+n+"00"+l})};var Yn=function(e){if(e===void 0)e="";var a=e.split(","),i=[];return a.forEach(function(s){s=s.trim();var n;if(NN.forEach(function(l){var f=zf[l].exec(s.toLowerCase());if(!f||f.length<=1)return;n=l;var o=s.substring(0,f[1].length),c=s.replace(o,"");i.push({type:o,details:c,mediaType:l})}),!n)i.push({type:s,details:"",mediaType:"unknown"})}),i},iA=function(e,a){if(!e.mediaGroups.AUDIO||!a)return null;var i=e.mediaGroups.AUDIO[a];if(!i)return null;for(var s in i){var n=i[s];if(n.default&&n.playlists)return Yn(n.playlists[0].attributes.CODECS)}return null};var T8=function(e){if(e===void 0)e="";return zf.audio.test(e.trim().toLowerCase())},zN=function(e){if(e===void 0)e="";return zf.text.test(e.trim().toLowerCase())},Ef=function(e){if(!e||typeof e!=="string")return;var a=e.toLowerCase().split(",").map(function(n){return D8(n.trim())}),i="video";if(a.length===1&&T8(a[0]))i="audio";else if(a.length===1&&zN(a[0]))i="application";var s="mp4";if(a.every(function(n){return zf.mp4.test(n)}))s="mp4";else if(a.every(function(n){return zf.webm.test(n)}))s="webm";else if(a.every(function(n){return zf.ogg.test(n)}))s="ogg";return i+"/"+s+';codecs="'+e+'"'},ko=function(e,a){if(e===void 0)e="";if(a===void 0)a=!1;return Nf.default.MediaSource&&Nf.default.MediaSource.isTypeSupported&&Nf.default.MediaSource.isTypeSupported(Ef(e))||a&&Nf.default.ManagedMediaSource&&Nf.default.ManagedMediaSource.isTypeSupported&&Nf.default.ManagedMediaSource.isTypeSupported(Ef(e))||!1},R5=function(e){if(e===void 0)e="";return e.toLowerCase().split(",").every(function(a){a=a.trim();for(var i=0;i<aA.length;i++){var s=aA[i];if(zf["muxer"+s].test(a))return!0}return!1})},R8="mp4a.40.2",sA="avc1.4d400d";var EN=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,xN=/^application\/dash\+xml/i,N8=function(e){if(EN.test(e))return"hls";if(xN.test(e))return"dash";if(e==="application/vnd.videojs.vhs+json")return"vhs-json";return null};var nA=Ie(h0(),1);var UN=function(e){return e.toString(2).length},IN=function(e){return Math.ceil(UN(e)/8)};var E8=function(e){if(ArrayBuffer.isView==="function")return ArrayBuffer.isView(e);return e&&e.buffer instanceof ArrayBuffer},GN=function(e){return E8(e)},ee=function(e){if(e instanceof Uint8Array)return e;if(!Array.isArray(e)&&!GN(e)&&!(e instanceof ArrayBuffer))if(typeof e!=="number"||typeof e==="number"&&e!==e)e=0;else e=[e];return new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0)};var Ki=nA.default.BigInt||Number,z8=[Ki("0x1"),Ki("0x100"),Ki("0x10000"),Ki("0x1000000"),Ki("0x100000000"),Ki("0x10000000000"),Ki("0x1000000000000"),Ki("0x100000000000000"),Ki("0x10000000000000000")],uat=function(){var t=new Uint16Array([65484]),e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);if(e[0]===255)return"big";if(e[0]===204)return"little";return"unknown"}();var x8=function(e,a){var i=a===void 0?{}:a,s=i.signed,n=s===void 0?!1:s,l=i.le,f=l===void 0?!1:l;e=ee(e);var o=f?"reduce":"reduceRight",c=e[o]?e[o]:Array.prototype[o],u=c.call(e,function(p,w,d){var v=f?d:Math.abs(d+1-e.length);return p+Ki(w)*z8[v]},Ki(0));if(n){var m=z8[e.length]/Ki(2)-Ki(1);if(u=Ki(u),u>m)u-=m,u-=m,u-=Ki(2)}return Number(u)},lA=function(e,a){var i=a===void 0?{}:a,s=i.le,n=s===void 0?!1:s;if(typeof e!=="bigint"&&typeof e!=="number"||typeof e==="number"&&e!==e)e=0;e=Ki(e);var l=IN(e),f=new Uint8Array(new ArrayBuffer(l));for(var o=0;o<l;o++){var c=n?o:Math.abs(o+1-f.length);if(f[c]=Number(e/z8[o]&Ki(255)),e<0)f[c]=Math.abs(~f[c]),f[c]-=o===0?1:2}return f},U8=function(e){if(!e)return"";e=Array.prototype.slice.call(e);var a=String.fromCharCode.apply(null,ee(e));try{return decodeURIComponent(escape(a))}catch(i){}return a},N5=function(e,a){if(typeof e!=="string"&&e&&typeof e.toString==="function")e=e.toString();if(typeof e!=="string")return new Uint8Array;if(!a)e=unescape(encodeURIComponent(e));var i=new Uint8Array(e.length);for(var s=0;s<e.length;s++)i[s]=e.charCodeAt(s);return i},fA=function(){for(var e=arguments.length,a=Array(e),i=0;i<e;i++)a[i]=arguments[i];if(a=a.filter(function(f){return f&&(f.byteLength||f.length)&&typeof f!=="string"}),a.length<=1)return ee(a[0]);var s=a.reduce(function(f,o,c){return f+(o.byteLength||o.length)},0),n=new Uint8Array(s),l=0;return a.forEach(function(f){f=ee(f),n.set(f,l),l+=f.byteLength}),n},la=function(e,a,i){var s=i===void 0?{}:i,n=s.offset,l=n===void 0?0:n,f=s.mask,o=f===void 0?[]:f;e=ee(e),a=ee(a);var c=a.every?a.every:Array.prototype.every;return a.length&&e.length-l>=a.length&&c.call(a,function(u,m){var p=o[m]?o[m]&e[l+m]:e[l+m];return u===p})};var us=Ie(h0(),1);var rA=function(e,a,i){a.forEach(function(s){for(var n in e.mediaGroups[s])for(var l in e.mediaGroups[s][n]){var f=e.mediaGroups[s][n][l];i(f,s,n,l)}})};var tv=P8();var{DOMImplementation:Xz,XMLSerializer:Kz}=tv,ag=PA().DOMParser;/*! @name mpd-parser @version 1.3.1 @license Apache-2.0 */var ev=(t)=>{return!!t&&typeof t==="object"},Bi=(...t)=>{return t.reduce((e,a)=>{if(typeof a!=="object")return e;return Object.keys(a).forEach((i)=>{if(Array.isArray(e[i])&&Array.isArray(a[i]))e[i]=e[i].concat(a[i]);else if(ev(e[i])&&ev(a[i]))e[i]=Bi(e[i],a[i]);else e[i]=a[i]}),e},{})},rv=(t)=>Object.keys(t).map((e)=>t[e]),Lz=(t,e)=>{let a=[];for(let i=t;i<e;i++)a.push(i);return a},Ro=(t)=>t.reduce((e,a)=>e.concat(a),[]),ov=(t)=>{if(!t.length)return[];let e=[];for(let a=0;a<t.length;a++)e.push(t[a]);return e},Vz=(t,e)=>t.reduce((a,i,s)=>{if(i[e])a.push(s);return a},[]),Yz=(t,e)=>{return rv(t.reduce((a,i)=>{return i.forEach((s)=>{a[e(s)]=s}),a},{}))},No={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"},b2=({baseUrl:t="",source:e="",range:a="",indexRange:i=""})=>{let s={uri:e,resolvedUri:yo(t||"",e)};if(a||i){let l=(a?a:i).split("-"),f=us.default.BigInt?us.default.BigInt(l[0]):parseInt(l[0],10),o=us.default.BigInt?us.default.BigInt(l[1]):parseInt(l[1],10);if(f<Number.MAX_SAFE_INTEGER&&typeof f==="bigint")f=Number(f);if(o<Number.MAX_SAFE_INTEGER&&typeof o==="bigint")o=Number(o);let c;if(typeof o==="bigint"||typeof f==="bigint")c=us.default.BigInt(o)-us.default.BigInt(f)+us.default.BigInt(1);else c=o-f+1;if(typeof c==="bigint"&&c<Number.MAX_SAFE_INTEGER)c=Number(c);s.byterange={length:c,offset:f}}return s},Jz=(t)=>{let e;if(typeof t.offset==="bigint"||typeof t.length==="bigint")e=us.default.BigInt(t.offset)+us.default.BigInt(t.length)-us.default.BigInt(1);else e=t.offset+t.length-1;return`${t.offset}-${e}`},av=(t)=>{if(t&&typeof t!=="number")t=parseInt(t,10);if(isNaN(t))return null;return t},Qz={static(t){let{duration:e,timescale:a=1,sourceDuration:i,periodDuration:s}=t,n=av(t.endNumber),l=e/a;if(typeof n==="number")return{start:0,end:n};if(typeof s==="number")return{start:0,end:s/l};return{start:0,end:i/l}},dynamic(t){let{NOW:e,clientOffset:a,availabilityStartTime:i,timescale:s=1,duration:n,periodStart:l=0,minimumUpdatePeriod:f=0,timeShiftBufferDepth:o=1/0}=t,c=av(t.endNumber),u=(e+a)/1000,m=i+l,w=u+f-m,d=Math.ceil(w*s/n),v=Math.floor((u-m-o)*s/n),k=Math.floor((u-m)*s/n);return{start:Math.max(0,v),end:typeof c==="number"?c:Math.min(d,k)}}},Zz=(t)=>(e)=>{let{duration:a,timescale:i=1,periodStart:s,startNumber:n=1}=t;return{number:n+e,duration:a/i,timeline:s,time:e*a}},sg=(t)=>{let{type:e,duration:a,timescale:i=1,periodDuration:s,sourceDuration:n}=t,{start:l,end:f}=Qz[e](t),o=Lz(l,f).map(Zz(t));if(e==="static"){let c=o.length-1,u=typeof s==="number"?s:n;o[c].duration=u-a/i*c}return o},hv=(t)=>{let{baseUrl:e,initialization:a={},sourceDuration:i,indexRange:s="",periodStart:n,presentationTime:l,number:f=0,duration:o}=t;if(!e)throw Error(No.NO_BASE_URL);let c=b2({baseUrl:e,source:a.sourceURL,range:a.range}),u=b2({baseUrl:e,source:e,indexRange:s});if(u.map=c,o){let m=sg(t);if(m.length)u.duration=m[0].duration,u.timeline=m[0].timeline}else if(i)u.duration=i,u.timeline=n;return u.presentationTime=l||n,u.number=f,[u]},Y5=(t,e,a)=>{let i=t.sidx.map?t.sidx.map:null,s=t.sidx.duration,n=t.timeline||0,l=t.sidx.byterange,f=l.offset+l.length,o=e.timescale,c=e.references.filter((k)=>k.referenceType!==1),u=[],m=t.endList?"static":"dynamic",p=t.sidx.timeline,w=p,d=t.mediaSequence||0,v;if(typeof e.firstOffset==="bigint")v=us.default.BigInt(f)+e.firstOffset;else v=f+e.firstOffset;for(let k=0;k<c.length;k++){let y=e.references[k],B=y.referencedSize,H=y.subsegmentDuration,M;if(typeof v==="bigint")M=v+us.default.BigInt(B)-us.default.BigInt(1);else M=v+B-1;let D=`${v}-${M}`,z=hv({baseUrl:a,timescale:o,timeline:n,periodStart:p,presentationTime:w,number:d,duration:H,sourceDuration:s,indexRange:D,type:m})[0];if(i)z.map=i;if(u.push(z),typeof v==="bigint")v+=us.default.BigInt(B);else v+=B;w+=H/o,d++}return t.segments=u,t},$z=["AUDIO","SUBTITLES"],Wz=0.016666666666666666,cv=(t)=>{return Yz(t,({timeline:e})=>e).sort((e,a)=>e.timeline>a.timeline?1:-1)},Pz=(t,e)=>{for(let a=0;a<t.length;a++)if(t[a].attributes.NAME===e)return t[a];return null},iv=(t)=>{let e=[];return rA(t,$z,(a,i,s,n)=>{e=e.concat(a.playlists||[])}),e},sv=({playlist:t,mediaSequence:e})=>{t.mediaSequence=e,t.segments.forEach((a,i)=>{a.number=t.mediaSequence+i})},tE=({oldPlaylists:t,newPlaylists:e,timelineStarts:a})=>{e.forEach((i)=>{i.discontinuitySequence=a.findIndex(function({timeline:o}){return o===i.timeline});let s=Pz(t,i.attributes.NAME);if(!s)return;if(i.sidx)return;let n=i.segments[0],l=s.segments.findIndex(function(o){return Math.abs(o.presentationTime-n.presentationTime)<Wz});if(l===-1){if(sv({playlist:i,mediaSequence:s.mediaSequence+s.segments.length}),i.segments[0].discontinuity=!0,i.discontinuityStarts.unshift(0),!s.segments.length&&i.timeline>s.timeline||s.segments.length&&i.timeline>s.segments[s.segments.length-1].timeline)i.discontinuitySequence--;return}if(s.segments[l].discontinuity&&!n.discontinuity)n.discontinuity=!0,i.discontinuityStarts.unshift(0),i.discontinuitySequence--;sv({playlist:i,mediaSequence:s.segments[l].number})})},eE=({oldManifest:t,newManifest:e})=>{let a=t.playlists.concat(iv(t)),i=e.playlists.concat(iv(e));return e.timelineStarts=cv([t.timelineStarts,e.timelineStarts]),tE({oldPlaylists:a,newPlaylists:i,timelineStarts:e.timelineStarts}),e},p2=(t)=>t&&t.uri+"-"+Jz(t.byterange),ig=(t)=>{let e=t.reduce(function(i,s){if(!i[s.attributes.baseUrl])i[s.attributes.baseUrl]=[];return i[s.attributes.baseUrl].push(s),i},{}),a=[];return Object.values(e).forEach((i)=>{let s=rv(i.reduce((n,l)=>{let f=l.attributes.id+(l.attributes.lang||"");if(!n[f])n[f]=l,n[f].attributes.timelineStarts=[];else{if(l.segments){if(l.segments[0])l.segments[0].discontinuity=!0;n[f].segments.push(...l.segments)}if(l.attributes.contentProtection)n[f].attributes.contentProtection=l.attributes.contentProtection}return n[f].attributes.timelineStarts.push({start:l.attributes.periodStart,timeline:l.attributes.periodStart}),n},{}));a=a.concat(s)}),a.map((i)=>{return i.discontinuityStarts=Vz(i.segments||[],"discontinuity"),i})},ng=(t,e)=>{let a=p2(t.sidx),i=a&&e[a]&&e[a].sidx;if(i)Y5(t,i,t.sidx.resolvedUri);return t},aE=(t,e={})=>{if(!Object.keys(e).length)return t;for(let a in t)t[a]=ng(t[a],e);return t},iE=({attributes:t,segments:e,sidx:a,mediaSequence:i,discontinuitySequence:s,discontinuityStarts:n},l)=>{let f={attributes:{NAME:t.id,BANDWIDTH:t.bandwidth,CODECS:t.codecs,["PROGRAM-ID"]:1},uri:"",endList:t.type==="static",timeline:t.periodStart,resolvedUri:t.baseUrl||"",targetDuration:t.duration,discontinuitySequence:s,discontinuityStarts:n,timelineStarts:t.timelineStarts,mediaSequence:i,segments:e};if(t.contentProtection)f.contentProtection=t.contentProtection;if(t.serviceLocation)f.attributes.serviceLocation=t.serviceLocation;if(a)f.sidx=a;if(l)f.attributes.AUDIO="audio",f.attributes.SUBTITLES="subs";return f},sE=({attributes:t,segments:e,mediaSequence:a,discontinuityStarts:i,discontinuitySequence:s})=>{if(typeof e>"u")e=[{uri:t.baseUrl,timeline:t.periodStart,resolvedUri:t.baseUrl||"",duration:t.sourceDuration,number:0}],t.duration=t.sourceDuration;let n={NAME:t.id,BANDWIDTH:t.bandwidth,["PROGRAM-ID"]:1};if(t.codecs)n.CODECS=t.codecs;let l={attributes:n,uri:"",endList:t.type==="static",timeline:t.periodStart,resolvedUri:t.baseUrl||"",targetDuration:t.duration,timelineStarts:t.timelineStarts,discontinuityStarts:i,discontinuitySequence:s,mediaSequence:a,segments:e};if(t.serviceLocation)l.attributes.serviceLocation=t.serviceLocation;return l},nE=(t,e={},a=!1)=>{let i,s=t.reduce((n,l)=>{let f=l.attributes.role&&l.attributes.role.value||"",o=l.attributes.lang||"",c=l.attributes.label||"main";if(o&&!l.attributes.label){let m=f?` (${f})`:"";c=`${l.attributes.lang}${m}`}if(!n[c])n[c]={language:o,autoselect:!0,default:f==="main",playlists:[],uri:""};let u=ng(iE(l,a),e);if(n[c].playlists.push(u),typeof i>"u"&&f==="main")i=l,i.default=!0;return n},{});if(!i){let n=Object.keys(s)[0];s[n].default=!0}return s},lE=(t,e={})=>{return t.reduce((a,i)=>{let s=i.attributes.label||i.attributes.lang||"text",n=i.attributes.lang||"und";if(!a[s])a[s]={language:n,default:!1,autoselect:!1,playlists:[],uri:""};return a[s].playlists.push(ng(sE(i),e)),a},{})},fE=(t)=>t.reduce((e,a)=>{if(!a)return e;return a.forEach((i)=>{let{channel:s,language:n}=i;if(e[n]={autoselect:!1,default:!1,instreamId:s,language:n},i.hasOwnProperty("aspectRatio"))e[n].aspectRatio=i.aspectRatio;if(i.hasOwnProperty("easyReader"))e[n].easyReader=i.easyReader;if(i.hasOwnProperty("3D"))e[n]["3D"]=i["3D"]}),e},{}),rE=({attributes:t,segments:e,sidx:a,discontinuityStarts:i})=>{let s={attributes:{NAME:t.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:t.width,height:t.height},CODECS:t.codecs,BANDWIDTH:t.bandwidth,["PROGRAM-ID"]:1},uri:"",endList:t.type==="static",timeline:t.periodStart,resolvedUri:t.baseUrl||"",targetDuration:t.duration,discontinuityStarts:i,timelineStarts:t.timelineStarts,segments:e};if(t.frameRate)s.attributes["FRAME-RATE"]=t.frameRate;if(t.contentProtection)s.contentProtection=t.contentProtection;if(t.serviceLocation)s.attributes.serviceLocation=t.serviceLocation;if(a)s.sidx=a;return s},oE=({attributes:t})=>t.mimeType==="video/mp4"||t.mimeType==="video/webm"||t.contentType==="video",hE=({attributes:t})=>t.mimeType==="audio/mp4"||t.mimeType==="audio/webm"||t.contentType==="audio",cE=({attributes:t})=>t.mimeType==="text/vtt"||t.contentType==="text",uE=(t,e)=>{t.forEach((a)=>{if(a.mediaSequence=0,a.discontinuitySequence=e.findIndex(function({timeline:i}){return i===a.timeline}),!a.segments)return;a.segments.forEach((i,s)=>{i.number=s})})},nv=(t)=>{if(!t)return[];return Object.keys(t).reduce((e,a)=>{let i=t[a];return e.concat(i.playlists)},[])},mE=({dashPlaylists:t,locations:e,contentSteering:a,sidxMapping:i={},previousManifest:s,eventStream:n})=>{if(!t.length)return{};let{sourceDuration:l,type:f,suggestedPresentationDelay:o,minimumUpdatePeriod:c}=t[0].attributes,u=ig(t.filter(oE)).map(rE),m=ig(t.filter(hE)),p=ig(t.filter(cE)),w=t.map((M)=>M.attributes.captionServices).filter(Boolean),d={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},["CLOSED-CAPTIONS"]:{},SUBTITLES:{}},uri:"",duration:l,playlists:aE(u,i)};if(c>=0)d.minimumUpdatePeriod=c*1000;if(e)d.locations=e;if(a)d.contentSteering=a;if(f==="dynamic")d.suggestedPresentationDelay=o;if(n&&n.length>0)d.eventStream=n;let v=d.playlists.length===0,k=m.length?nE(m,i,v):null,y=p.length?lE(p,i):null,B=u.concat(nv(k),nv(y)),H=B.map(({timelineStarts:M})=>M);if(d.timelineStarts=cv(H),uE(B,d.timelineStarts),k)d.mediaGroups.AUDIO.audio=k;if(y)d.mediaGroups.SUBTITLES.subs=y;if(w.length)d.mediaGroups["CLOSED-CAPTIONS"].cc=fE(w);if(s)return eE({oldManifest:s,newManifest:d});return d},gE=(t,e,a)=>{let{NOW:i,clientOffset:s,availabilityStartTime:n,timescale:l=1,periodStart:f=0,minimumUpdatePeriod:o=0}=t,c=(i+s)/1000,u=n+f,p=c+o-u;return Math.ceil((p*l-e)/a)},uv=(t,e)=>{let{type:a,minimumUpdatePeriod:i=0,media:s="",sourceDuration:n,timescale:l=1,startNumber:f=1,periodStart:o}=t,c=[],u=-1;for(let m=0;m<e.length;m++){let p=e[m],w=p.d,d=p.r||0,v=p.t||0;if(u<0)u=v;if(v&&v>u)u=v;let k;if(d<0){let H=m+1;if(H===e.length)if(a==="dynamic"&&i>0&&s.indexOf("$Number$")>0)k=gE(t,u,w);else k=(n*l-u)/w;else k=(e[H].t-u)/w}else k=d+1;let y=f+c.length+k,B=f+c.length;while(B<y)c.push({number:B,duration:w/l,time:u,timeline:o}),u+=w,B++}return c},bE=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,pE=(t)=>(e,a,i,s)=>{if(e==="$$")return"$";if(typeof t[a]>"u")return e;let n=""+t[a];if(a==="RepresentationID")return n;if(!i)s=1;else s=parseInt(s,10);if(n.length>=s)return n;return`${Array(s-n.length+1).join("0")}${n}`},lv=(t,e)=>t.replace(bE,pE(e)),wE=(t,e)=>{if(!t.duration&&!e)return[{number:t.startNumber||1,duration:t.sourceDuration,time:0,timeline:t.periodStart}];if(t.duration)return sg(t);return uv(t,e)},jE=(t,e)=>{let a={RepresentationID:t.id,Bandwidth:t.bandwidth||0},{initialization:i={sourceURL:"",range:""}}=t,s=b2({baseUrl:t.baseUrl,source:lv(i.sourceURL,a),range:i.range});return wE(t,e).map((l)=>{a.Number=l.number,a.Time=l.time;let f=lv(t.media||"",a),o=t.timescale||1,c=t.presentationTimeOffset||0,u=t.periodStart+(l.time-c)/o;return{uri:f,timeline:l.timeline,duration:l.duration,resolvedUri:yo(t.baseUrl||"",f),map:s,number:l.number,presentationTime:u}})},dE=(t,e)=>{let{baseUrl:a,initialization:i={}}=t,s=b2({baseUrl:a,source:i.sourceURL,range:i.range}),n=b2({baseUrl:a,source:e.media,range:e.mediaRange});return n.map=s,n},qE=(t,e)=>{let{duration:a,segmentUrls:i=[],periodStart:s}=t;if(!a&&!e||a&&e)throw Error(No.SEGMENT_TIME_UNSPECIFIED);let n=i.map((o)=>dE(t,o)),l;if(a)l=sg(t);if(e)l=uv(t,e);return l.map((o,c)=>{if(n[c]){let u=n[c],m=t.timescale||1,p=t.presentationTimeOffset||0;return u.timeline=o.timeline,u.duration=o.duration,u.number=o.number,u.presentationTime=s+(o.time-p)/m,u}}).filter((o)=>o)},AE=({attributes:t,segmentInfo:e})=>{let a,i;if(e.template)i=jE,a=Bi(t,e.template);else if(e.base)i=hv,a=Bi(t,e.base);else if(e.list)i=qE,a=Bi(t,e.list);let s={attributes:t};if(!i)return s;let n=i(a,e.segmentTimeline);if(a.duration){let{duration:l,timescale:f=1}=a;a.duration=l/f}else if(n.length)a.duration=n.reduce((l,f)=>{return Math.max(l,Math.ceil(f.duration))},0);else a.duration=0;if(s.attributes=a,s.segments=n,e.base&&a.indexRange)s.sidx=n[0],s.segments=[];return s},vE=(t)=>t.map(AE),Oa=(t,e)=>ov(t.childNodes).filter(({tagName:a})=>a===e),w2=(t)=>t.textContent.trim(),SE=(t)=>{return parseFloat(t.split("/").reduce((e,a)=>e/a))},To=(t)=>{let f=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(t);if(!f)return 0;let[o,c,u,m,p,w]=f.slice(1);return parseFloat(o||0)*31536000+parseFloat(c||0)*2592000+parseFloat(u||0)*86400+parseFloat(m||0)*3600+parseFloat(p||0)*60+parseFloat(w||0)},yE=(t)=>{if(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t))t+="Z";return Date.parse(t)},fv={mediaPresentationDuration(t){return To(t)},availabilityStartTime(t){return yE(t)/1000},minimumUpdatePeriod(t){return To(t)},suggestedPresentationDelay(t){return To(t)},type(t){return t},timeShiftBufferDepth(t){return To(t)},start(t){return To(t)},width(t){return parseInt(t,10)},height(t){return parseInt(t,10)},bandwidth(t){return parseInt(t,10)},frameRate(t){return SE(t)},startNumber(t){return parseInt(t,10)},timescale(t){return parseInt(t,10)},presentationTimeOffset(t){return parseInt(t,10)},duration(t){let e=parseInt(t,10);if(isNaN(e))return To(t);return e},d(t){return parseInt(t,10)},t(t){return parseInt(t,10)},r(t){return parseInt(t,10)},presentationTime(t){return parseInt(t,10)},DEFAULT(t){return t}},ci=(t)=>{if(!(t&&t.attributes))return{};return ov(t.attributes).reduce((e,a)=>{let i=fv[a.name]||fv.DEFAULT;return e[a.name]=i(a.value),e},{})},kE={"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"},J5=(t,e)=>{if(!e.length)return t;return Ro(t.map(function(a){return e.map(function(i){let s=w2(i),n=yo(a.baseUrl,s),l=Bi(ci(i),{baseUrl:n});if(n!==s&&!l.serviceLocation&&a.serviceLocation)l.serviceLocation=a.serviceLocation;return l})}))},lg=(t)=>{let e=Oa(t,"SegmentTemplate")[0],a=Oa(t,"SegmentList")[0],i=a&&Oa(a,"SegmentURL").map((m)=>Bi({tag:"SegmentURL"},ci(m))),s=Oa(t,"SegmentBase")[0],n=a||e,l=n&&Oa(n,"SegmentTimeline")[0],f=a||s||e,o=f&&Oa(f,"Initialization")[0],c=e&&ci(e);if(c&&o)c.initialization=o&&ci(o);else if(c&&c.initialization)c.initialization={sourceURL:c.initialization};let u={template:c,segmentTimeline:l&&Oa(l,"S").map((m)=>ci(m)),list:a&&Bi(ci(a),{segmentUrls:i,initialization:ci(o)}),base:s&&Bi(ci(s),{initialization:ci(o)})};return Object.keys(u).forEach((m)=>{if(!u[m])delete u[m]}),u},CE=(t,e,a)=>(i)=>{let s=Oa(i,"BaseURL"),n=J5(e,s),l=Bi(t,ci(i)),f=lg(i);return n.map((o)=>{return{segmentInfo:Bi(a,f),attributes:Bi(l,o)}})},_E=(t)=>{return t.reduce((e,a)=>{let i=ci(a);if(i.schemeIdUri)i.schemeIdUri=i.schemeIdUri.toLowerCase();let s=kE[i.schemeIdUri];if(s){e[s]={attributes:i};let n=Oa(a,"cenc:pssh")[0];if(n){let l=w2(n);e[s].pssh=l&&i2(l)}}return e},{})},FE=(t)=>{if(t.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof t.value!=="string"?[]:t.value.split(";")).map((a)=>{let i,s;if(s=a,/^CC\d=/.test(a))[i,s]=a.split("=");else if(/^CC\d$/.test(a))i=a;return{channel:i,language:s}});else if(t.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof t.value!=="string"?[]:t.value.split(";")).map((a)=>{let i={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(a)){let[s,n=""]=a.split("=");i.channel=s,i.language=a,n.split(",").forEach((l)=>{let[f,o]=l.split(":");if(f==="lang")i.language=o;else if(f==="er")i.easyReader=Number(o);else if(f==="war")i.aspectRatio=Number(o);else if(f==="3D")i["3D"]=Number(o)})}else i.language=a;if(i.channel)i.channel="SERVICE"+i.channel;return i})},BE=(t)=>{return Ro(Oa(t.node,"EventStream").map((e)=>{let a=ci(e),i=a.schemeIdUri;return Oa(e,"Event").map((s)=>{let n=ci(s),l=n.presentationTime||0,f=a.timescale||1,o=n.duration||0,c=l/f+t.attributes.start;return{schemeIdUri:i,value:a.value,id:n.id,start:c,end:c+o/f,messageData:w2(s)||n.messageData,contentEncoding:a.contentEncoding,presentationTimeOffset:a.presentationTimeOffset||0}})}))},OE=(t,e,a)=>(i)=>{let s=ci(i),n=J5(e,Oa(i,"BaseURL")),l=Oa(i,"Role")[0],f={role:ci(l)},o=Bi(t,s,f),c=Oa(i,"Accessibility")[0],u=FE(ci(c));if(u)o=Bi(o,{captionServices:u});let m=Oa(i,"Label")[0];if(m&&m.childNodes.length){let k=m.childNodes[0].nodeValue.trim();o=Bi(o,{label:k})}let p=_E(Oa(i,"ContentProtection"));if(Object.keys(p).length)o=Bi(o,{contentProtection:p});let w=lg(i),d=Oa(i,"Representation"),v=Bi(a,w);return Ro(d.map(CE(o,n,v)))},HE=(t,e)=>(a,i)=>{let s=J5(e,Oa(a.node,"BaseURL")),n=Bi(t,{periodStart:a.attributes.start});if(typeof a.attributes.duration==="number")n.periodDuration=a.attributes.duration;let l=Oa(a.node,"AdaptationSet"),f=lg(a.node);return Ro(l.map(OE(n,s,f)))},ME=(t,e)=>{if(t.length>1)e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"});if(!t.length)return null;let a=Bi({serverURL:w2(t[0])},ci(t[0]));return a.queryBeforeStart=a.queryBeforeStart==="true",a},DE=({attributes:t,priorPeriodAttributes:e,mpdType:a})=>{if(typeof t.start==="number")return t.start;if(e&&typeof e.start==="number"&&typeof e.duration==="number")return e.start+e.duration;if(!e&&a==="static")return 0;return null},TE=(t,e={})=>{let{manifestUri:a="",NOW:i=Date.now(),clientOffset:s=0,eventHandler:n=function(){}}=e,l=Oa(t,"Period");if(!l.length)throw Error(No.INVALID_NUMBER_OF_PERIOD);let f=Oa(t,"Location"),o=ci(t),c=J5([{baseUrl:a}],Oa(t,"BaseURL")),u=Oa(t,"ContentSteering");if(o.type=o.type||"static",o.sourceDuration=o.mediaPresentationDuration||0,o.NOW=i,o.clientOffset=s,f.length)o.locations=f.map(w2);let m=[];return l.forEach((p,w)=>{let d=ci(p),v=m[w-1];d.start=DE({attributes:d,priorPeriodAttributes:v?v.attributes:null,mpdType:o.type}),m.push({node:p,attributes:d})}),{locations:o.locations,contentSteeringInfo:ME(u,n),representationInfo:Ro(m.map(HE(o,c))),eventStream:Ro(m.map(BE))}},mv=(t)=>{if(t==="")throw Error(No.DASH_EMPTY_MANIFEST);let e=new ag,a,i;try{a=e.parseFromString(t,"application/xml"),i=a&&a.documentElement.tagName==="MPD"?a.documentElement:null}catch(s){}if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw Error(No.DASH_INVALID_XML);return i},RE=(t)=>{let e=Oa(t,"UTCTiming")[0];if(!e)return null;let a=ci(e);switch(a.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":a.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":a.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":a.method="DIRECT",a.value=Date.parse(a.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(No.UNSUPPORTED_UTC_TIMING_SCHEME)}return a};var gv=(t,e={})=>{let a=TE(mv(t),e),i=vE(a.representationInfo);return mE({dashPlaylists:i,locations:a.locations,contentSteering:a.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:a.eventStream})},bv=(t)=>RE(mv(t));var kS=Ie(Av(),1);var EE=ee([73,68,51]),xE=function(e,a){if(a===void 0)a=0;e=ee(e);var i=e[a+5],s=e[a+6]<<21|e[a+7]<<14|e[a+8]<<7|e[a+9],n=(i&16)>>4;if(n)return s+20;return s+10},Uf=function t(e,a){if(a===void 0)a=0;if(e=ee(e),e.length-a<10||!la(e,EE,{offset:a}))return a;return a+=xE(e,a),t(e,a)};var Xat=new Uint8Array([79,112,117,115,72,101,97,100]);var Sv=function(e){if(typeof e==="string")return N5(e);if(typeof e==="number")return e;return e},KE=function(e){if(!Array.isArray(e))return[Sv(e)];return e.map(function(a){return Sv(a)})},fg,yv=function(e){e=ee(e);var a=[],i=0;while(e.length>i){var s=e[i],n=0,l=0;l++;var f=e[l];l++;while(f&128)n=(f&127)<<7,f=e[l],l++;n+=f&127;for(var o=0;o<fg.length;o++){var c=fg[o],u=c.id,m=c.parser;if(s===u){a.push(m(e.subarray(l,l+n)));break}}i+=n+l}return a};fg=[{id:3,parser:function(e){var a={tag:3,id:e[0]<<8|e[1],flags:e[2],size:3,dependsOnEsId:0,ocrEsId:0,descriptors:[],url:""};if(a.flags&128)a.dependsOnEsId=e[a.size]<<8|e[a.size+1],a.size+=2;if(a.flags&64){var i=e[a.size];a.url=U8(e.subarray(a.size+1,a.size+1+i)),a.size+=i}if(a.flags&32)a.ocrEsId=e[a.size]<<8|e[a.size+1],a.size+=2;return a.descriptors=yv(e.subarray(a.size))||[],a}},{id:4,parser:function(e){var a={tag:4,oti:e[0],streamType:e[1],bufferSize:e[2]<<16|e[3]<<8|e[4],maxBitrate:e[5]<<24|e[6]<<16|e[7]<<8|e[8],avgBitrate:e[9]<<24|e[10]<<16|e[11]<<8|e[12],descriptors:yv(e.subarray(13))};return a}},{id:5,parser:function(e){return{tag:5,bytes:e}}},{id:6,parser:function(e){return{tag:6,bytes:e}}}];var kv=function t(e,a,i){if(i===void 0)i=!1;a=KE(a),e=ee(e);var s=[];if(!a.length)return s;var n=0;while(n<e.length){var l=(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])>>>0,f=e.subarray(n+4,n+8);if(l===0)break;var o=n+l;if(o>e.length){if(i)break;o=e.length}var c=e.subarray(n+8,o);if(la(f,a[0]))if(a.length===1)s.push(c);else s.push.apply(s,t(c,a.slice(1),i));n=o}return s};var j2={EBML:ee([26,69,223,163]),DocType:ee([66,130]),Segment:ee([24,83,128,103]),SegmentInfo:ee([21,73,169,102]),Tracks:ee([22,84,174,107]),Track:ee([174]),TrackNumber:ee([215]),DefaultDuration:ee([35,227,131]),TrackEntry:ee([174]),TrackType:ee([131]),FlagDefault:ee([136]),CodecID:ee([134]),CodecPrivate:ee([99,162]),VideoTrack:ee([224]),AudioTrack:ee([225]),Cluster:ee([31,67,182,117]),Timestamp:ee([231]),TimestampScale:ee([42,215,177]),BlockGroup:ee([160]),BlockDuration:ee([155]),Block:ee([161]),SimpleBlock:ee([163])},rg=[128,64,32,16,8,4,2,1],LE=function(e){var a=1;for(var i=0;i<rg.length;i++){if(e&rg[i])break;a++}return a},Q5=function(e,a,i,s){if(i===void 0)i=!0;if(s===void 0)s=!1;var n=LE(e[a]),l=e.subarray(a,a+n);if(i)l=Array.prototype.slice.call(e,a,a+n),l[0]^=rg[n-1];return{length:n,value:x8(l,{signed:s}),bytes:l}},Cv=function t(e){if(typeof e==="string")return e.match(/.{1,2}/g).map(function(a){return t(a)});if(typeof e==="number")return lA(e);return e},VE=function(e){if(!Array.isArray(e))return[Cv(e)];return e.map(function(a){return Cv(a)})},YE=function t(e,a,i){if(i>=a.length)return a.length;var s=Q5(a,i,!1);if(la(e.bytes,s.bytes))return i;var n=Q5(a,i+s.length);return t(e,a,i+n.length+n.value+s.length)},og=function t(e,a){a=VE(a),e=ee(e);var i=[];if(!a.length)return i;var s=0;while(s<e.length){var n=Q5(e,s,!1),l=Q5(e,s+n.length),f=s+n.length+l.length;if(l.value===127){if(l.value=YE(n,e,f),l.value!==e.length)l.value-=f}var o=f+l.value>e.length?e.length:f+l.value,c=e.subarray(f,o);if(la(a[0],n.bytes))if(a.length===1)i.push(c);else i=i.concat(t(c,a.slice(1)));var u=n.length+l.length+c.length;s+=u}return i};var JE=ee([0,0,0,1]),QE=ee([0,0,1]),ZE=ee([0,0,3]),$E=function(e){var a=[],i=1;while(i<e.length-2){if(la(e.subarray(i,i+3),ZE))a.push(i+2),i++;i++}if(a.length===0)return e;var s=e.length-a.length,n=new Uint8Array(s),l=0;for(i=0;i<s;l++,i++){if(l===a[0])l++,a.shift();n[i]=e[l]}return n},_v=function(e,a,i,s){if(s===void 0)s=1/0;e=ee(e),i=[].concat(i);var n=0,l,f=0;while(n<e.length&&(f<s||l)){var o=void 0;if(la(e.subarray(n),JE))o=4;else if(la(e.subarray(n),QE))o=3;if(!o){n++;continue}if(f++,l)return $E(e.subarray(l,n));var c=void 0;if(a==="h264")c=e[n+o]&31;else if(a==="h265")c=e[n+o]>>1&63;if(i.indexOf(c)!==-1)l=n+o;n+=o+(a==="h264"?1:2)}return e.subarray(0,0)},Fv=function(e,a,i){return _v(e,"h264",a,i)},Bv=function(e,a,i){return _v(e,"h265",a,i)};var ms={webm:ee([119,101,98,109]),matroska:ee([109,97,116,114,111,115,107,97]),flac:ee([102,76,97,67]),ogg:ee([79,103,103,83]),ac3:ee([11,119]),riff:ee([82,73,70,70]),avi:ee([65,86,73]),wav:ee([87,65,86,69]),"3gp":ee([102,116,121,112,51,103]),mp4:ee([102,116,121,112]),fmp4:ee([115,116,121,112]),mov:ee([102,116,121,112,113,116]),moov:ee([109,111,111,118]),moof:ee([109,111,111,102])},zo={aac:function(e){var a=Uf(e);return la(e,[255,16],{offset:a,mask:[255,22]})},mp3:function(e){var a=Uf(e);return la(e,[255,2],{offset:a,mask:[255,6]})},webm:function(e){var a=og(e,[j2.EBML,j2.DocType])[0];return la(a,ms.webm)},mkv:function(e){var a=og(e,[j2.EBML,j2.DocType])[0];return la(a,ms.matroska)},mp4:function(e){if(zo["3gp"](e)||zo.mov(e))return!1;if(la(e,ms.mp4,{offset:4})||la(e,ms.fmp4,{offset:4}))return!0;if(la(e,ms.moof,{offset:4})||la(e,ms.moov,{offset:4}))return!0},mov:function(e){return la(e,ms.mov,{offset:4})},"3gp":function(e){return la(e,ms["3gp"],{offset:4})},ac3:function(e){var a=Uf(e);return la(e,ms.ac3,{offset:a})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;var a=0;while(a+188<e.length&&a<188){if(e[a]===71&&e[a+188]===71)return!0;a+=1}return!1},flac:function(e){var a=Uf(e);return la(e,ms.flac,{offset:a})},ogg:function(e){return la(e,ms.ogg)},avi:function(e){return la(e,ms.riff)&&la(e,ms.avi,{offset:8})},wav:function(e){return la(e,ms.riff)&&la(e,ms.wav,{offset:8})},h264:function(e){return Fv(e,7,3).length},h265:function(e){return Bv(e,[32,33],3).length}},hg=Object.keys(zo).filter(function(t){return t!=="ts"&&t!=="h264"&&t!=="h265"}).concat(["ts","h264","h265"]);hg.forEach(function(t){var e=zo[t];zo[t]=function(a){return e(ee(a))}});var WE=zo,Z5=function(e){e=ee(e);for(var a=0;a<hg.length;a++){var i=hg[a];if(WE[i](e))return i}return""},Ov=function(e){return kv(e,["moof"]).length>0};var ql=Ie(Rv(),1),Hg="8.23.7",m1={},vl=function(t,e){if(m1[t]=m1[t]||[],e)m1[t]=m1[t].concat(e);return m1[t]},PE=function(t,e){vl(t,e)},CS=function(t,e){let a=vl(t).indexOf(e);if(a<=-1)return!1;return m1[t]=m1[t].slice(),m1[t].splice(a,1),!0},tx=function(t,e){vl(t,[].concat(e).map((a)=>{let i=(...s)=>{return CS(t,i),a(...s)};return i}))},nm={prefixed:!0},am=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],Nv=am[0],v2;for(let t=0;t<am.length;t++)if(am[t][1]in Ot.default){v2=am[t];break}if(v2){for(let t=0;t<v2.length;t++)nm[Nv[t]]=v2[t];nm.prefixed=v2[0]!==Nv[0]}var Hs=[],ex=(t,e,a)=>(i,s,n)=>{let l=e.levels[s],f=new RegExp(`^(${l})$`),o=t;if(i!=="log")n.unshift(i.toUpperCase()+":");if(a)o=`%c${t}`,n.unshift(a);if(n.unshift(o+":"),Hs){Hs.push([].concat(n));let u=Hs.length-1000;Hs.splice(0,u>0?u:0)}if(!$.default.console)return;let c=$.default.console[i];if(!c&&i==="debug")c=$.default.console.info||$.default.console.log;if(!c||!l||!f.test(i))return;c[Array.isArray(n)?"apply":"call"]($.default.console,n)};function Mg(t,e=":",a=""){let i="info",s;function n(...l){s("log",i,l)}return s=ex(t,n,a),n.createLogger=(l,f,o)=>{let c=f!==void 0?f:e,u=o!==void 0?o:a,m=`${t} ${c} ${l}`;return Mg(m,c,u)},n.createNewLogger=(l,f,o)=>{return Mg(l,f,o)},n.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:i},n.level=(l)=>{if(typeof l==="string"){if(!n.levels.hasOwnProperty(l))throw Error(`"${l}" in not a valid log level`);i=l}return i},n.history=()=>Hs?[].concat(Hs):[],n.history.filter=(l)=>{return(Hs||[]).filter((f)=>{return new RegExp(`.*${l}.*`).test(f[0])})},n.history.clear=()=>{if(Hs)Hs.length=0},n.history.disable=()=>{if(Hs!==null)Hs.length=0,Hs=null},n.history.enable=()=>{if(Hs===null)Hs=[]},n.error=(...l)=>s("error",i,l),n.warn=(...l)=>s("warn",i,l),n.debug=(...l)=>s("debug",i,l),n}var De=Mg("VIDEOJS"),_S=De.createLogger,ax=Object.prototype.toString,FS=function(t){return q0(t)?Object.keys(t):[]};function Go(t,e){FS(t).forEach((a)=>e(t[a],a))}function BS(t,e,a=0){return FS(t).reduce((i,s)=>e(i,t[s],s),a)}function q0(t){return!!t&&typeof t==="object"}function $o(t){return q0(t)&&ax.call(t)==="[object Object]"&&t.constructor===Object}function ga(...t){let e={};return t.forEach((a)=>{if(!a)return;Go(a,(i,s)=>{if(!$o(i)){e[s]=i;return}if(!$o(e[s]))e[s]={};e[s]=ga(e[s],i)})}),e}function OS(t={}){let e=[];for(let a in t)if(t.hasOwnProperty(a)){let i=t[a];e.push(i)}return e}function Cm(t,e,a,i=!0){let s=(l)=>Object.defineProperty(t,e,{value:l,enumerable:!0,writable:!0}),n={configurable:!0,enumerable:!0,get(){let l=a();return s(l),l}};if(i)n.set=s;return Object.defineProperty(t,e,n)}var ix=Object.freeze({__proto__:null,each:Go,reduce:BS,isObject:q0,isPlain:$o,merge:ga,values:OS,defineLazyProperty:Cm}),i7=!1,HS=null,Qn=!1,MS,DS=!1,Xo=!1,Ko=!1,A0=!1,s7=null,_m=null,sx=Boolean($.default.cast&&$.default.cast.framework&&$.default.cast.framework.CastReceiverContext),TS=null,lm=!1,Fm=!1,fm=!1,Bm=!1,rm=!1,om=!1,hm=!1,B2=Boolean(ah()&&(("ontouchstart"in $.default)||$.default.navigator.maxTouchPoints||$.default.DocumentTouch&&$.default.document instanceof $.default.DocumentTouch)),pl=$.default.navigator&&$.default.navigator.userAgentData;if(pl&&pl.platform&&pl.brands)Qn=pl.platform==="Android",Xo=Boolean(pl.brands.find((t)=>t.brand==="Microsoft Edge")),Ko=Boolean(pl.brands.find((t)=>t.brand==="Chromium")),A0=!Xo&&Ko,s7=_m=(pl.brands.find((t)=>t.brand==="Chromium")||{}).version||null,Fm=pl.platform==="Windows";if(!Ko){let t=$.default.navigator&&$.default.navigator.userAgent||"";i7=/iPod/i.test(t),HS=function(){let e=t.match(/OS (\d+)_/i);if(e&&e[1])return e[1];return null}(),Qn=/Android/i.test(t),MS=function(){let e=t.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;let a=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);if(a&&i)return parseFloat(e[1]+"."+e[2]);else if(a)return a;return null}(),DS=/Firefox/i.test(t),Xo=/Edg/i.test(t),Ko=/Chrome/i.test(t)||/CriOS/i.test(t),A0=!Xo&&Ko,s7=_m=function(){let e=t.match(/(Chrome|CriOS)\/(\d+)/);if(e&&e[2])return parseFloat(e[2]);return null}(),TS=function(){let e=/MSIE\s(\d+)\.\d/.exec(t),a=e&&parseFloat(e[1]);if(!a&&/Trident\/7.0/i.test(t)&&/rv:11.0/.test(t))a=11;return a}(),rm=/Tizen/i.test(t),om=/Web0S/i.test(t),hm=rm||om,lm=/Safari/i.test(t)&&!A0&&!Qn&&!Xo&&!hm,Fm=/Windows/i.test(t),fm=/iPad/i.test(t)||lm&&B2&&!/iPhone/i.test(t),Bm=/iPhone/i.test(t)&&!fm}var as=Bm||fm||i7,Om=(lm||as)&&!A0,RS=Object.freeze({__proto__:null,get IS_IPOD(){return i7},get IOS_VERSION(){return HS},get IS_ANDROID(){return Qn},get ANDROID_VERSION(){return MS},get IS_FIREFOX(){return DS},get IS_EDGE(){return Xo},get IS_CHROMIUM(){return Ko},get IS_CHROME(){return A0},get CHROMIUM_VERSION(){return s7},get CHROME_VERSION(){return _m},IS_CHROMECAST_RECEIVER:sx,get IE_VERSION(){return TS},get IS_SAFARI(){return lm},get IS_WINDOWS(){return Fm},get IS_IPAD(){return fm},get IS_IPHONE(){return Bm},get IS_TIZEN(){return rm},get IS_WEBOS(){return om},get IS_SMART_TV(){return hm},TOUCH_ENABLED:B2,IS_IOS:as,IS_ANY_SAFARI:Om});function zv(t){return typeof t==="string"&&Boolean(t.trim())}function nx(t){if(t.indexOf(" ")>=0)throw Error("class has illegal whitespace characters")}function ah(){return Ot.default===$.default.document}function ih(t){return q0(t)&&t.nodeType===1}function NS(){try{return $.default.parent!==$.default.self}catch(t){return!0}}function zS(t){return function(e,a){if(!zv(e))return Ot.default[t](null);if(zv(a))a=Ot.default.querySelector(a);let i=ih(a)?a:Ot.default;return i[t]&&i[t](e)}}function he(t="div",e={},a={},i){let s=Ot.default.createElement(t);if(Object.getOwnPropertyNames(e).forEach(function(n){let l=e[n];if(n==="textContent")kl(s,l);else if(s[n]!==l||n==="tabIndex")s[n]=l}),Object.getOwnPropertyNames(a).forEach(function(n){s.setAttribute(n,a[n])}),i)n7(s,i);return s}function kl(t,e){if(typeof t.textContent>"u")t.innerText=e;else t.textContent=e;return t}function Dg(t,e){if(e.firstChild)e.insertBefore(t,e.firstChild);else e.appendChild(t)}function y2(t,e){return nx(e),t.classList.contains(e)}function Vf(t,...e){return t.classList.add(...e.reduce((a,i)=>a.concat(i.split(/\s+/)),[])),t}function Hm(t,...e){if(!t)return De.warn("removeClass was called with an element that doesn't exist"),null;return t.classList.remove(...e.reduce((a,i)=>a.concat(i.split(/\s+/)),[])),t}function ES(t,e,a){if(typeof a==="function")a=a(t,e);if(typeof a!=="boolean")a=void 0;return e.split(/\s+/).forEach((i)=>t.classList.toggle(i,a)),t}function xS(t,e){Object.getOwnPropertyNames(e).forEach(function(a){let i=e[a];if(i===null||typeof i>"u"||i===!1)t.removeAttribute(a);else t.setAttribute(a,i===!0?"":i)})}function jl(t){let e={},a=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(t&&t.attributes&&t.attributes.length>0){let i=t.attributes;for(let s=i.length-1;s>=0;s--){let n=i[s].name,l=i[s].value;if(a.includes(n))l=l!==null?!0:!1;e[n]=l}}return e}function US(t,e){return t.getAttribute(e)}function Wo(t,e,a){t.setAttribute(e,a)}function Mm(t,e){t.removeAttribute(e)}function IS(){Ot.default.body.focus(),Ot.default.onselectstart=function(){return!1}}function GS(){Ot.default.onselectstart=function(){return!0}}function Po(t){if(t&&t.getBoundingClientRect&&t.parentNode){let e=t.getBoundingClientRect(),a={};if(["bottom","height","left","right","top","width"].forEach((i)=>{if(e[i]!==void 0)a[i]=e[i]}),!a.height)a.height=parseFloat(th(t,"height"));if(!a.width)a.width=parseFloat(th(t,"width"));return a}}function O2(t){if(!t||t&&!t.offsetParent)return{left:0,top:0,width:0,height:0};let{offsetWidth:e,offsetHeight:a}=t,i=0,s=0;while(t.offsetParent&&t!==Ot.default[nm.fullscreenElement])i+=t.offsetLeft,s+=t.offsetTop,t=t.offsetParent;return{left:i,top:s,width:e,height:a}}function Dm(t,e){let a={x:0,y:0};if(as){let u=t;while(u&&u.nodeName.toLowerCase()!=="html"){let m=th(u,"transform");if(/^matrix/.test(m)){let p=m.slice(7,-1).split(/,\s/).map(Number);a.x+=p[4],a.y+=p[5]}else if(/^matrix3d/.test(m)){let p=m.slice(9,-1).split(/,\s/).map(Number);a.x+=p[12],a.y+=p[13]}if(u.assignedSlot&&u.assignedSlot.parentElement&&$.default.WebKitCSSMatrix){let p=$.default.getComputedStyle(u.assignedSlot.parentElement).transform,w=new $.default.WebKitCSSMatrix(p);a.x+=w.m41,a.y+=w.m42}u=u.parentNode||u.host}}let i={},s=O2(e.target),n=O2(t),l=n.width,f=n.height,o=e.offsetY-(n.top-s.top),c=e.offsetX-(n.left-s.left);if(e.changedTouches){if(c=e.changedTouches[0].pageX-n.left,o=e.changedTouches[0].pageY+n.top,as)c-=a.x,o-=a.y}return i.y=1-Math.max(0,Math.min(1,o/f)),i.x=Math.max(0,Math.min(1,c/l)),i}function XS(t){return q0(t)&&t.nodeType===3}function Tm(t){while(t.firstChild)t.removeChild(t.firstChild);return t}function KS(t){if(typeof t==="function")t=t();return(Array.isArray(t)?t:[t]).map((e)=>{if(typeof e==="function")e=e();if(ih(e)||XS(e))return e;if(typeof e==="string"&&/\S/.test(e))return Ot.default.createTextNode(e)}).filter((e)=>e)}function n7(t,e){return KS(e).forEach((a)=>t.appendChild(a)),t}function LS(t,e){return n7(Tm(t),e)}function H2(t){if(t.button===void 0&&t.buttons===void 0)return!0;if(t.button===0&&t.buttons===void 0)return!0;if(t.type==="mouseup"&&t.button===0&&t.buttons===0)return!0;if(t.type==="mousedown"&&t.button===0&&t.buttons===0)return!0;if(t.button!==0||t.buttons!==1)return!1;return!0}var Sl=zS("querySelector"),VS=zS("querySelectorAll");function th(t,e){if(!t||!e)return"";if(typeof $.default.getComputedStyle==="function"){let a;try{a=$.default.getComputedStyle(t)}catch(i){return""}return a?a.getPropertyValue(e)||a[e]:""}return""}function YS(t){[...Ot.default.styleSheets].forEach((e)=>{try{let a=[...e.cssRules].map((s)=>s.cssText).join(""),i=Ot.default.createElement("style");i.textContent=a,t.document.head.appendChild(i)}catch(a){let i=Ot.default.createElement("link");i.rel="stylesheet",i.type=e.type,i.media=e.media.mediaText,i.href=e.href,t.document.head.appendChild(i)}})}var JS=Object.freeze({__proto__:null,isReal:ah,isEl:ih,isInFrame:NS,createEl:he,textContent:kl,prependTo:Dg,hasClass:y2,addClass:Vf,removeClass:Hm,toggleClass:ES,setAttributes:xS,getAttributes:jl,getAttribute:US,setAttribute:Wo,removeAttribute:Mm,blockTextSelection:IS,unblockTextSelection:GS,getBoundingClientRect:Po,findPosition:O2,getPointerPosition:Dm,isTextNode:XS,emptyEl:Tm,normalizeContent:KS,appendContent:n7,insertContent:LS,isSingleLeftClick:H2,$:Sl,$$:VS,computedStyle:th,copyStyleSheetsToWindow:YS}),QS=!1,Tg,lx=function(){if(Tg.options.autoSetup===!1)return;let t=Array.prototype.slice.call(Ot.default.getElementsByTagName("video")),e=Array.prototype.slice.call(Ot.default.getElementsByTagName("audio")),a=Array.prototype.slice.call(Ot.default.getElementsByTagName("video-js")),i=t.concat(e,a);if(i&&i.length>0)for(let s=0,n=i.length;s<n;s++){let l=i[s];if(l&&l.getAttribute){if(l.player===void 0){if(l.getAttribute("data-setup")!==null)Tg(l)}}else{Rg(1);break}}else if(!QS)Rg(1)};function Rg(t,e){if(!ah())return;if(e)Tg=e;$.default.setTimeout(lx,t)}function Ng(){QS=!0,$.default.removeEventListener("load",Ng)}if(ah())if(Ot.default.readyState==="complete")Ng();else $.default.addEventListener("load",Ng);var ZS=function(t){let e=Ot.default.createElement("style");return e.className=t,e},$S=function(t,e){if(t.styleSheet)t.styleSheet.cssText=e;else t.textContent=e},bs=new WeakMap,fx=3,rx=fx;function kn(){return rx++}function Ev(t,e){if(!bs.has(t))return;let a=bs.get(t);if(a.handlers[e].length===0){if(delete a.handlers[e],t.removeEventListener)t.removeEventListener(e,a.dispatcher,!1);else if(t.detachEvent)t.detachEvent("on"+e,a.dispatcher)}if(Object.getOwnPropertyNames(a.handlers).length<=0)delete a.handlers,delete a.dispatcher,delete a.disabled;if(Object.getOwnPropertyNames(a).length===0)bs.delete(t)}function l7(t,e,a,i){a.forEach(function(s){t(e,s,i)})}function Rm(t){if(t.fixed_)return t;function e(){return!0}function a(){return!1}if(!t||!t.isPropagationStopped||!t.isImmediatePropagationStopped){let i=t||$.default.event;t={};let s=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(let n in i)if(!s.includes(n)){if(!(n==="returnValue"&&i.preventDefault))t[n]=i[n]}if(!t.target)t.target=t.srcElement||Ot.default;if(!t.relatedTarget)t.relatedTarget=t.fromElement===t.target?t.toElement:t.fromElement;if(t.preventDefault=function(){if(i.preventDefault)i.preventDefault();t.returnValue=!1,i.returnValue=!1,t.defaultPrevented=!0},t.defaultPrevented=!1,t.stopPropagation=function(){if(i.stopPropagation)i.stopPropagation();t.cancelBubble=!0,i.cancelBubble=!0,t.isPropagationStopped=e},t.isPropagationStopped=a,t.stopImmediatePropagation=function(){if(i.stopImmediatePropagation)i.stopImmediatePropagation();t.isImmediatePropagationStopped=e,t.stopPropagation()},t.isImmediatePropagationStopped=a,t.clientX!==null&&t.clientX!==void 0){let n=Ot.default.documentElement,l=Ot.default.body;t.pageX=t.clientX+(n&&n.scrollLeft||l&&l.scrollLeft||0)-(n&&n.clientLeft||l&&l.clientLeft||0),t.pageY=t.clientY+(n&&n.scrollTop||l&&l.scrollTop||0)-(n&&n.clientTop||l&&l.clientTop||0)}if(t.which=t.charCode||t.keyCode,t.button!==null&&t.button!==void 0)t.button=t.button&1?0:t.button&4?1:t.button&2?2:0}return t.fixed_=!0,t}var W5,ox=function(){if(typeof W5!=="boolean"){W5=!1;try{let t=Object.defineProperty({},"passive",{get(){W5=!0}});$.default.addEventListener("test",null,t),$.default.removeEventListener("test",null,t)}catch(t){}}return W5},hx=["touchstart","touchmove"];function an(t,e,a){if(Array.isArray(e))return l7(an,t,e,a);if(!bs.has(t))bs.set(t,{});let i=bs.get(t);if(!i.handlers)i.handlers={};if(!i.handlers[e])i.handlers[e]=[];if(!a.guid)a.guid=kn();if(i.handlers[e].push(a),!i.dispatcher)i.disabled=!1,i.dispatcher=function(s,n){if(i.disabled)return;s=Rm(s);let l=i.handlers[s.type];if(l){let f=l.slice(0);for(let o=0,c=f.length;o<c;o++)if(s.isImmediatePropagationStopped())break;else try{f[o].call(t,s,n)}catch(u){De.error(u)}}};if(i.handlers[e].length===1){if(t.addEventListener){let s=!1;if(ox()&&hx.indexOf(e)>-1)s={passive:!0};t.addEventListener(e,i.dispatcher,s)}else if(t.attachEvent)t.attachEvent("on"+e,i.dispatcher)}}function is(t,e,a){if(!bs.has(t))return;let i=bs.get(t);if(!i.handlers)return;if(Array.isArray(e))return l7(is,t,e,a);let s=function(l,f){i.handlers[f]=[],Ev(l,f)};if(e===void 0){for(let l in i.handlers)if(Object.prototype.hasOwnProperty.call(i.handlers||{},l))s(t,l);return}let n=i.handlers[e];if(!n)return;if(!a){s(t,e);return}if(a.guid){for(let l=0;l<n.length;l++)if(n[l].guid===a.guid)n.splice(l--,1)}Ev(t,e)}function sh(t,e,a){let i=bs.has(t)?bs.get(t):{},s=t.parentNode||t.ownerDocument;if(typeof e==="string")e={type:e,target:t};else if(!e.target)e.target=t;if(e=Rm(e),i.dispatcher)i.dispatcher.call(t,e,a);if(s&&!e.isPropagationStopped()&&e.bubbles===!0)sh.call(null,s,e,a);else if(!s&&!e.defaultPrevented&&e.target&&e.target[e.type]){if(!bs.has(e.target))bs.set(e.target,{});let n=bs.get(e.target);if(e.target[e.type]){if(n.disabled=!0,typeof e.target[e.type]==="function")e.target[e.type]();n.disabled=!1}}return!e.defaultPrevented}function Nm(t,e,a){if(Array.isArray(e))return l7(Nm,t,e,a);let i=function(){is(t,e,i),a.apply(this,arguments)};i.guid=a.guid=a.guid||kn(),an(t,e,i)}function f7(t,e,a){let i=function(){is(t,e,i),a.apply(this,arguments)};i.guid=a.guid=a.guid||kn(),an(t,e,i)}var cx=Object.freeze({__proto__:null,fixEvent:Rm,on:an,off:is,trigger:sh,one:Nm,any:f7}),Cn=30,qa=function(t,e,a){if(!e.guid)e.guid=kn();let i=e.bind(t);return i.guid=a?a+"_"+e.guid:e.guid,i},v0=function(t,e){let a=$.default.performance.now();return function(...s){let n=$.default.performance.now();if(n-a>=e)t(...s),a=n}},WS=function(t,e,a,i=$.default){let s,n=()=>{i.clearTimeout(s),s=null},l=function(){let f=this,o=arguments,c=function(){if(s=null,c=null,!a)t.apply(f,o)};if(!s&&a)t.apply(f,o);i.clearTimeout(s),s=i.setTimeout(c,e)};return l.cancel=n,l},ux=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Cn,bind_:qa,throttle:v0,debounce:WS}),d2;class Rs{on(t,e){let a=this.addEventListener;this.addEventListener=()=>{},an(this,t,e),this.addEventListener=a}off(t,e){is(this,t,e)}one(t,e){let a=this.addEventListener;this.addEventListener=()=>{},Nm(this,t,e),this.addEventListener=a}any(t,e){let a=this.addEventListener;this.addEventListener=()=>{},f7(this,t,e),this.addEventListener=a}trigger(t){let e=t.type||t;if(typeof t==="string")t={type:e};if(t=Rm(t),this.allowedEvents_[e]&&this["on"+e])this["on"+e](t);sh(this,t)}queueTrigger(t){if(!d2)d2=new Map;let e=t.type||t,a=d2.get(this);if(!a)a=new Map,d2.set(this,a);let i=a.get(e);a.delete(e),$.default.clearTimeout(i);let s=$.default.setTimeout(()=>{if(a.delete(e),a.size===0)a=null,d2.delete(this);this.trigger(t)},0);a.set(e,s)}}Rs.prototype.allowedEvents_={};Rs.prototype.addEventListener=Rs.prototype.on;Rs.prototype.removeEventListener=Rs.prototype.off;Rs.prototype.dispatchEvent=Rs.prototype.trigger;var zm=(t)=>{if(typeof t.name==="function")return t.name();if(typeof t.name==="string")return t.name;if(t.name_)return t.name_;if(t.constructor&&t.constructor.name)return t.constructor.name;return typeof t},b1=(t)=>t instanceof Rs||!!t.eventBusEl_&&["on","one","off","trigger"].every((e)=>typeof t[e]==="function"),mx=(t,e)=>{if(b1(t))e();else{if(!t.eventedCallbacks)t.eventedCallbacks=[];t.eventedCallbacks.push(e)}},zg=(t)=>typeof t==="string"&&/\S/.test(t)||Array.isArray(t)&&!!t.length,cm=(t,e,a)=>{if(!t||!t.nodeName&&!b1(t))throw Error(`Invalid target for ${zm(e)}#${a}; must be a DOM node or evented object.`)},PS=(t,e,a)=>{if(!zg(t))throw Error(`Invalid event type for ${zm(e)}#${a}; must be a non-empty string or array.`)},ty=(t,e,a)=>{if(typeof t!=="function")throw Error(`Invalid listener for ${zm(e)}#${a}; must be a function.`)},bg=(t,e,a)=>{let i=e.length<3||e[0]===t||e[0]===t.eventBusEl_,s,n,l;if(i){if(s=t.eventBusEl_,e.length>=3)e.shift();[n,l]=e}else s=e[0],n=e[1],l=e[2];return cm(s,t,a),PS(n,t,a),ty(l,t,a),l=qa(t,l),{isTargetingSelf:i,target:s,type:n,listener:l}},If=(t,e,a,i)=>{if(cm(t,t,e),t.nodeName)cx[e](t,a,i);else t[e](a,i)},gx={on(...t){let{isTargetingSelf:e,target:a,type:i,listener:s}=bg(this,t,"on");if(If(a,"on",i,s),!e){let n=()=>this.off(a,i,s);n.guid=s.guid;let l=()=>this.off("dispose",n);l.guid=s.guid,If(this,"on","dispose",n),If(a,"on","dispose",l)}},one(...t){let{isTargetingSelf:e,target:a,type:i,listener:s}=bg(this,t,"one");if(e)If(a,"one",i,s);else{let n=(...l)=>{this.off(a,i,n),s.apply(null,l)};n.guid=s.guid,If(a,"one",i,n)}},any(...t){let{isTargetingSelf:e,target:a,type:i,listener:s}=bg(this,t,"any");if(e)If(a,"any",i,s);else{let n=(...l)=>{this.off(a,i,n),s.apply(null,l)};n.guid=s.guid,If(a,"any",i,n)}},off(t,e,a){if(!t||zg(t))is(this.eventBusEl_,t,e);else{let i=t,s=e;if(cm(i,this,"off"),PS(s,this,"off"),ty(a,this,"off"),a=qa(this,a),this.off("dispose",a),i.nodeName)is(i,s,a),is(i,"dispose",a);else if(b1(i))i.off(s,a),i.off("dispose",a)}},trigger(t,e){cm(this.eventBusEl_,this,"trigger");let a=t&&typeof t!=="string"?t.type:t;if(!zg(a))throw Error(`Invalid event type for ${zm(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return sh(this.eventBusEl_,t,e)}};function r7(t,e={}){let{eventBusKey:a}=e;if(a){if(!t[a].nodeName)throw Error(`The eventBusKey "${a}" does not refer to an element.`);t.eventBusEl_=t[a]}else t.eventBusEl_=he("span",{className:"vjs-event-bus"});if(Object.assign(t,gx),t.eventedCallbacks)t.eventedCallbacks.forEach((i)=>{i()});return t.on("dispose",()=>{t.off(),[t,t.el_,t.eventBusEl_].forEach(function(i){if(i&&bs.has(i))bs.delete(i)}),$.default.setTimeout(()=>{t.eventBusEl_=null},0)}),t}var bx={state:{},setState(t){if(typeof t==="function")t=t();let e;if(Go(t,(a,i)=>{if(this.state[i]!==a)e=e||{},e[i]={from:this.state[i],to:a};this.state[i]=a}),e&&b1(this))this.trigger({changes:e,type:"statechanged"});return e}};function ey(t,e){if(Object.assign(t,bx),t.state=Object.assign({},t.state,e),typeof t.handleStateChanged==="function"&&b1(t))t.on("statechanged",t.handleStateChanged);return t}var k2=function(t){if(typeof t!=="string")return t;return t.replace(/./,(e)=>e.toLowerCase())},Va=function(t){if(typeof t!=="string")return t;return t.replace(/./,(e)=>e.toUpperCase())},ay=function(t,e){return Va(t)===Va(e)},px=Object.freeze({__proto__:null,toLowerCase:k2,toTitleCase:Va,titleCaseEquals:ay});class bt{constructor(t,e,a){if(!t&&this.play)this.player_=t=this;else this.player_=t;if(this.isDisposed_=!1,this.parentComponent_=null,this.options_=ga({},this.options_),e=this.options_=ga(this.options_,e),this.id_=e.id||e.el&&e.el.id,!this.id_){let i=t&&t.id&&t.id()||"no_player";this.id_=`${i}_component_${kn()}`}if(this.name_=e.name||null,e.el)this.el_=e.el;else if(e.createEl!==!1)this.el_=this.createEl();if(e.className&&this.el_)e.className.split(" ").forEach((i)=>this.addClass(i));if(["on","off","one","any","trigger"].forEach((i)=>{this[i]=void 0}),e.evented!==!1)r7(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange);if(ey(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,e.initChildren!==!1)this.initChildren();if(this.ready(a),e.reportTouchActivity!==!1)this.enableTouchActivity()}dispose(t={}){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 e=this.children_.length-1;e>=0;e--)if(this.children_[e].dispose)this.children_[e].dispose()}if(this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_){if(this.el_.parentNode)if(t.restoreEl)this.el_.parentNode.replaceChild(t.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(t){if(!t)return this.options_;return this.options_=ga(this.options_,t),this.options_}el(){return this.el_}createEl(t,e,a){return he(t,e,a)}localize(t,e,a=t){let i=this.player_.language&&this.player_.language(),s=this.player_.languages&&this.player_.languages(),n=s&&s[i],l=i&&i.split("-")[0],f=s&&s[l],o=a;if(n&&n[t])o=n[t];else if(f&&f[t])o=f[t];if(e)o=o.replace(/\{(\d+)\}/g,function(c,u){let m=e[u-1],p=m;if(typeof m>"u")p=c;return p});return o}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(t){return this.childIndex_[t]}getChild(t){if(!t)return;return this.childNameIndex_[t]}getDescendant(...t){t=t.reduce((a,i)=>a.concat(i),[]);let e=this;for(let a=0;a<t.length;a++)if(e=e.getChild(t[a]),!e||!e.getChild)return;return e}setIcon(t,e=this.el()){if(!this.player_.options_.experimentalSvgIcons)return;let a="http://www.w3.org/2000/svg",i=he("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),s=Ot.default.createElementNS(a,"svg");s.setAttributeNS(null,"viewBox","0 0 512 512");let n=Ot.default.createElementNS(a,"use");if(s.appendChild(n),n.setAttributeNS(null,"href",`#vjs-icon-${t}`),i.appendChild(s),this.iconIsSet_)e.replaceChild(i,e.querySelector(".vjs-icon-placeholder"));else e.appendChild(i);return this.iconIsSet_=!0,i}addChild(t,e={},a=this.children_.length){let i,s;if(typeof t==="string"){s=Va(t);let n=e.componentClass||s;e.name=s;let l=bt.getComponent(n);if(!l)throw Error(`Component ${n} does not exist`);if(typeof l!=="function")return null;i=new l(this.player_||this,e)}else i=t;if(i.parentComponent_)i.parentComponent_.removeChild(i);if(this.children_.splice(a,0,i),i.parentComponent_=this,typeof i.id==="function")this.childIndex_[i.id()]=i;if(s=s||i.name&&Va(i.name()),s)this.childNameIndex_[s]=i,this.childNameIndex_[k2(s)]=i;if(typeof i.el==="function"&&i.el()){let n=null;if(this.children_[a+1]){if(this.children_[a+1].el_)n=this.children_[a+1].el_;else if(ih(this.children_[a+1]))n=this.children_[a+1]}this.contentEl().insertBefore(i.el(),n)}return i}removeChild(t){if(typeof t==="string")t=this.getChild(t);if(!t||!this.children_)return;let e=!1;for(let i=this.children_.length-1;i>=0;i--)if(this.children_[i]===t){e=!0,this.children_.splice(i,1);break}if(!e)return;t.parentComponent_=null,this.childIndex_[t.id()]=null,this.childNameIndex_[Va(t.name())]=null,this.childNameIndex_[k2(t.name())]=null;let a=t.el();if(a&&a.parentNode===this.contentEl())this.contentEl().removeChild(t.el())}initChildren(){let t=this.options_.children;if(t){let e=this.options_,a=(n)=>{let{name:l,opts:f}=n;if(e[l]!==void 0)f=e[l];if(f===!1)return;if(f===!0)f={};f.playerOptions=this.options_.playerOptions;let o=this.addChild(l,f);if(o)this[l]=o},i,s=bt.getComponent("Tech");if(Array.isArray(t))i=t;else i=Object.keys(t);i.concat(Object.keys(this.options_).filter(function(n){return!i.some(function(l){if(typeof l==="string")return n===l;return n===l.name})})).map((n)=>{let l,f;if(typeof n==="string")l=n,f=t[l]||this.options_[l]||{};else l=n.name,f=n;return{name:l,opts:f}}).filter((n)=>{let l=bt.getComponent(n.opts.componentClass||Va(n.name));return l&&!s.isTech(l)}).forEach(a)}}buildCSSClass(){return""}ready(t,e=!1){if(!t)return;if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(t);return}if(e)t.call(this);else this.setTimeout(t,1)}triggerReady(){this.isReady_=!0,this.setTimeout(function(){let t=this.readyQueue_;if(this.readyQueue_=[],t&&t.length>0)t.forEach(function(e){e.call(this)},this);this.trigger("ready")},1)}$(t,e){return Sl(t,e||this.contentEl())}$$(t,e){return VS(t,e||this.contentEl())}hasClass(t){return y2(this.el_,t)}addClass(...t){Vf(this.el_,...t)}removeClass(...t){Hm(this.el_,...t)}toggleClass(t,e){ES(this.el_,t,e)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(t){return US(this.el_,t)}setAttribute(t,e){Wo(this.el_,t,e)}removeAttribute(t){Mm(this.el_,t)}width(t,e){return this.dimension("width",t,e)}height(t,e){return this.dimension("height",t,e)}dimensions(t,e){this.width(t,!0),this.height(e)}dimension(t,e,a){if(e!==void 0){if(e===null||e!==e)e=0;if((""+e).indexOf("%")!==-1||(""+e).indexOf("px")!==-1)this.el_.style[t]=e;else if(e==="auto")this.el_.style[t]="";else this.el_.style[t]=e+"px";if(!a)this.trigger("componentresize");return}if(!this.el_)return 0;let i=this.el_.style[t],s=i.indexOf("px");if(s!==-1)return parseInt(i.slice(0,s),10);return parseInt(this.el_["offset"+Va(t)],10)}currentDimension(t){let e=0;if(t!=="width"&&t!=="height")throw Error("currentDimension only accepts width or height value");if(e=th(this.el_,t),e=parseFloat(e),e===0||isNaN(e)){let a=`offset${Va(t)}`;e=this.el_[a]}return e}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){let t=this.el_.getBoundingClientRect(),e={x:t.x,y:t.y,width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left},a={x:t.left+t.width/2,y:t.top+t.height/2,width:0,height:0,top:t.top+t.height/2,right:t.left+t.width/2,bottom:t.top+t.height/2,left:t.left+t.width/2};return{boundingClientRect:e,center:a}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(t){if(this.player_){if(t.key!=="Tab"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled))t.stopPropagation();this.player_.handleKeyDown(t)}}handleKeyPress(t){this.handleKeyDown(t)}emitTapEvents(){let t=0,e=null,a=10,i=200,s;this.on("touchstart",function(l){if(l.touches.length===1)e={pageX:l.touches[0].pageX,pageY:l.touches[0].pageY},t=$.default.performance.now(),s=!0}),this.on("touchmove",function(l){if(l.touches.length>1)s=!1;else if(e){let f=l.touches[0].pageX-e.pageX,o=l.touches[0].pageY-e.pageY;if(Math.sqrt(f*f+o*o)>a)s=!1}});let n=function(){s=!1};this.on("touchleave",n),this.on("touchcancel",n),this.on("touchend",function(l){if(e=null,s===!0){if($.default.performance.now()-t<i)l.preventDefault(),this.trigger("tap")}})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;let t=qa(this.player(),this.player().reportUserActivity),e;this.on("touchstart",function(){t(),this.clearInterval(e),e=this.setInterval(t,250)});let a=function(i){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",a),this.on("touchcancel",a)}setTimeout(t,e){var a;return t=qa(this,t),this.clearTimersOnDispose_(),a=$.default.setTimeout(()=>{if(this.setTimeoutIds_.has(a))this.setTimeoutIds_.delete(a);t()},e),this.setTimeoutIds_.add(a),a}clearTimeout(t){if(this.setTimeoutIds_.has(t))this.setTimeoutIds_.delete(t),$.default.clearTimeout(t);return t}setInterval(t,e){t=qa(this,t),this.clearTimersOnDispose_();let a=$.default.setInterval(t,e);return this.setIntervalIds_.add(a),a}clearInterval(t){if(this.setIntervalIds_.has(t))this.setIntervalIds_.delete(t),$.default.clearInterval(t);return t}requestAnimationFrame(t){this.clearTimersOnDispose_();var e;return t=qa(this,t),e=$.default.requestAnimationFrame(()=>{if(this.rafIds_.has(e))this.rafIds_.delete(e);t()}),this.rafIds_.add(e),e}requestNamedAnimationFrame(t,e){if(this.namedRafs_.has(t))this.cancelNamedAnimationFrame(t);this.clearTimersOnDispose_(),e=qa(this,e);let a=this.requestAnimationFrame(()=>{if(e(),this.namedRafs_.has(t))this.namedRafs_.delete(t)});return this.namedRafs_.set(t,a),t}cancelNamedAnimationFrame(t){if(!this.namedRafs_.has(t))return;this.cancelAnimationFrame(this.namedRafs_.get(t)),this.namedRafs_.delete(t)}cancelAnimationFrame(t){if(this.rafIds_.has(t))this.rafIds_.delete(t),$.default.cancelAnimationFrame(t);return t}clearTimersOnDispose_(){if(this.clearingTimersOnDispose_)return;this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([t,e])=>{this[t].forEach((a,i)=>this[e](i))}),this.clearingTimersOnDispose_=!1})}getIsDisabled(){return Boolean(this.el_.disabled)}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(t){return(t||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(t){function e(s){let n=$.default.getComputedStyle(s,null),l=n.getPropertyValue("visibility");return n.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(l)}function a(s){if(!e(s.parentElement))return!1;if(!e(s)||s.style.opacity==="0"||$.default.getComputedStyle(s).height==="0px"||$.default.getComputedStyle(s).width==="0px")return!1;return!0}function i(s){if(s.offsetWidth+s.offsetHeight+s.getBoundingClientRect().height+s.getBoundingClientRect().width===0)return!1;let n={x:s.getBoundingClientRect().left+s.offsetWidth/2,y:s.getBoundingClientRect().top+s.offsetHeight/2};if(n.x<0)return!1;if(n.x>(Ot.default.documentElement.clientWidth||$.default.innerWidth))return!1;if(n.y<0)return!1;if(n.y>(Ot.default.documentElement.clientHeight||$.default.innerHeight))return!1;let l=Ot.default.elementFromPoint(n.x,n.y);while(l){if(l===s)return!0;if(l.parentNode)l=l.parentNode;else return!1}}if(!t)t=this.el();if(i(t)&&a(t)&&(!t.parentElement||t.tabIndex>=0))return!0;return!1}static registerComponent(t,e){if(typeof t!=="string"||!t)throw Error(`Illegal component name, "${t}"; must be a non-empty string.`);let a=bt.getComponent("Tech"),i=a&&a.isTech(e),s=bt===e||bt.prototype.isPrototypeOf(e.prototype);if(i||!s){let l;if(i)l="techs must be registered using Tech.registerTech()";else l="must be a Component subclass";throw Error(`Illegal component, "${t}"; ${l}.`)}if(t=Va(t),!bt.components_)bt.components_={};let n=bt.getComponent("Player");if(t==="Player"&&n&&n.players){let l=n.players,f=Object.keys(l);if(l&&f.length>0){for(let o=0;o<f.length;o++)if(l[f[o]]!==null)throw Error("Can not register Player component after player has been created.")}}return bt.components_[t]=e,bt.components_[k2(t)]=e,e}static getComponent(t){if(!t||!bt.components_)return;return bt.components_[t]}}bt.registerComponent("Component",bt);function wx(t,e,a){if(typeof e!=="number"||e<0||e>a)throw Error(`Failed to execute '${t}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${a}).`)}function xv(t,e,a,i){return wx(t,i,a.length-1),a[i][e]}function pg(t){let e;if(t===void 0||t.length===0)e={length:0,start(){throw Error("This TimeRanges object is empty")},end(){throw Error("This TimeRanges object is empty")}};else e={length:t.length,start:xv.bind(null,"start",0,t),end:xv.bind(null,"end",1,t)};if($.default.Symbol&&$.default.Symbol.iterator)e[$.default.Symbol.iterator]=()=>(t||[]).values();return e}function Jn(t,e){if(Array.isArray(t))return pg(t);else if(t===void 0||e===void 0)return pg();return pg([[t,e]])}var iy=function(t,e){t=t<0?0:t;let a=Math.floor(t%60),i=Math.floor(t/60%60),s=Math.floor(t/3600),n=Math.floor(e/60%60),l=Math.floor(e/3600);if(isNaN(t)||t===1/0)s=i=a="-";return s=s>0||l>0?s+":":"",i=((s||n>=10)&&i<10?"0"+i:i)+":",a=a<10?"0"+a:a,s+i+a},o7=iy;function sy(t){o7=t}function ny(){o7=iy}function Qf(t,e=t){return o7(t,e)}var jx=Object.freeze({__proto__:null,createTimeRanges:Jn,createTimeRange:Jn,setFormatTime:sy,resetFormatTime:ny,formatTime:Qf});function ly(t,e){let a=0,i,s;if(!e)return 0;if(!t||!t.length)t=Jn(0,0);for(let n=0;n<t.length;n++){if(i=t.start(n),s=t.end(n),s>e)s=e;a+=s-i}return a/e}function xa(t){if(t instanceof xa)return t;if(typeof t==="number")this.code=t;else if(typeof t==="string")this.message=t;else if(q0(t)){if(typeof t.code==="number")this.code=t.code;Object.assign(this,t)}if(!this.message)this.message=xa.defaultMessages[this.code]||""}xa.prototype.code=0;xa.prototype.message="";xa.prototype.status=null;xa.prototype.metadata=null;xa.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];xa.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."};xa.MEDIA_ERR_CUSTOM=0;xa.prototype.MEDIA_ERR_CUSTOM=0;xa.MEDIA_ERR_ABORTED=1;xa.prototype.MEDIA_ERR_ABORTED=1;xa.MEDIA_ERR_NETWORK=2;xa.prototype.MEDIA_ERR_NETWORK=2;xa.MEDIA_ERR_DECODE=3;xa.prototype.MEDIA_ERR_DECODE=3;xa.MEDIA_ERR_SRC_NOT_SUPPORTED=4;xa.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;xa.MEDIA_ERR_ENCRYPTED=5;xa.prototype.MEDIA_ERR_ENCRYPTED=5;function C2(t){return t!==void 0&&t!==null&&typeof t.then==="function"}function p0(t){if(C2(t))t.then(null,(e)=>{})}var Eg=function(t){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((a,i,s)=>{if(t[i])a[i]=t[i];return a},{cues:t.cues&&Array.prototype.map.call(t.cues,function(a){return{startTime:a.startTime,endTime:a.endTime,text:a.text,id:a.id}})})},dx=function(t){let e=t.$$("track"),a=Array.prototype.map.call(e,(s)=>s.track);return Array.prototype.map.call(e,function(s){let n=Eg(s.track);if(s.src)n.src=s.src;return n}).concat(Array.prototype.filter.call(t.textTracks(),function(s){return a.indexOf(s)===-1}).map(Eg))},qx=function(t,e){return t.forEach(function(a){let i=e.addRemoteTextTrack(a).track;if(!a.src&&a.cues)a.cues.forEach((s)=>i.addCue(s))}),e.textTracks()},xg={textTracksToJson:dx,jsonToTextTracks:qx,trackToJson:Eg},wg="vjs-modal-dialog";class Zf extends bt{constructor(t,e){super(t,e);this.handleKeyDown_=(a)=>this.handleKeyDown(a),this.close_=(a)=>this.close(a),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=he("div",{className:`${wg}-content`},{role:"document"}),this.descEl_=he("p",{className:`${wg}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),kl(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`${wg} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let t=this.options_.description||this.localize("This is a modal window.");if(this.closeable())t+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.");return t}open(){if(this.opened_){if(this.options_.fillAlways)this.fill();return}let t=this.player();if(this.trigger("beforemodalopen"),this.opened_=!0,this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)this.fill();if(this.wasPlaying_=!t.paused(),this.options_.pauseOnOpen&&this.wasPlaying_)t.pause();this.on("keydown",this.handleKeyDown_),this.hadControls_=t.controls(),t.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(t){if(typeof t==="boolean")this[t?"open":"close"]();return this.opened_}close(){if(!this.opened_)return;let t=this.player();if(this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen)t.play();if(this.off("keydown",this.handleKeyDown_),this.hadControls_)t.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(t){if(typeof t==="boolean"){let e=this.closeable_=!!t,a=this.getChild("closeButton");if(e&&!a){let i=this.contentEl_;this.contentEl_=this.el_,a=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=i,this.on(a,"close",this.close_)}if(!e&&a)this.off(a,"close",this.close_),this.removeChild(a),a.dispose()}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(t){let e=this.contentEl(),a=e.parentNode,i=e.nextSibling;if(this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,a.removeChild(e),this.empty(),LS(e,t),this.trigger("modalfill"),i)a.insertBefore(e,i);else a.appendChild(e);let s=this.getChild("closeButton");if(s)a.appendChild(s.el_);this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),Tm(this.contentEl()),this.trigger("modalempty")}content(t){if(typeof t<"u")this.content_=t;return this.content_}conditionalFocus_(){let t=Ot.default.activeElement,e=this.player_.el_;if(this.previouslyActiveEl_=null,e.contains(t)||e===t)this.previouslyActiveEl_=t,this.focus()}conditionalBlur_(){if(this.previouslyActiveEl_)this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null}handleKeyDown(t){if(this.trigger({type:"modalKeydown",originalEvent:t,target:this,bubbles:!0}),t.stopPropagation(),t.key==="Escape"&&this.closeable()){t.preventDefault(),this.close();return}if(t.key!=="Tab")return;let e=this.focusableEls_(),a=this.el_.querySelector(":focus"),i;for(let s=0;s<e.length;s++)if(a===e[s]){i=s;break}if(Ot.default.activeElement===this.el_)i=0;if(t.shiftKey&&i===0)e[e.length-1].focus(),t.preventDefault();else if(!t.shiftKey&&i===e.length-1)e[0].focus(),t.preventDefault()}focusableEls_(){let t=this.el_.querySelectorAll("*");return Array.prototype.filter.call(t,(e)=>{return(e instanceof $.default.HTMLAnchorElement||e instanceof $.default.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof $.default.HTMLInputElement||e instanceof $.default.HTMLSelectElement||e instanceof $.default.HTMLTextAreaElement||e instanceof $.default.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof $.default.HTMLIFrameElement||e instanceof $.default.HTMLObjectElement||e instanceof $.default.HTMLEmbedElement||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!==-1||e.hasAttribute("contenteditable")})}}Zf.prototype.options_={pauseOnOpen:!0,temporary:!0};bt.registerComponent("ModalDialog",Zf);class yl extends Rs{constructor(t=[]){super();this.tracks_=[];for(let e=0;e<t.length;e++)this.addTrack(t[e])}get length(){return this.tracks_.length}addTrack(t){let e=this.tracks_.length;if(!(""+e in this))Object.defineProperty(this,e,{get(){return this.tracks_[e]}});if(this.tracks_.indexOf(t)===-1)this.tracks_.push(t),this.trigger({track:t,type:"addtrack",target:this});if(t.labelchange_=()=>{this.trigger({track:t,type:"labelchange",target:this})},b1(t))t.addEventListener("labelchange",t.labelchange_)}removeTrack(t){let e;for(let a=0,i=this.length;a<i;a++)if(this[a]===t){if(e=this[a],e.off)e.off();this.tracks_.splice(a,1);break}if(!e)return;this.trigger({track:e,type:"removetrack",target:this})}getTrackById(t){let e=null;for(let a=0,i=this.length;a<i;a++){let s=this[a];if(s.id===t){e=s;break}}return e}}yl.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(let t in yl.prototype.allowedEvents_)yl.prototype["on"+t]=null;var jg=function(t,e){for(let a=0;a<t.length;a++){if(!Object.keys(t[a]).length||e.id===t[a].id)continue;t[a].enabled=!1}};class h7 extends yl{constructor(t=[]){for(let e=t.length-1;e>=0;e--)if(t[e].enabled){jg(t,t[e]);break}super(t);this.changing_=!1}addTrack(t){if(t.enabled)jg(this,t);if(super.addTrack(t),!t.addEventListener)return;t.enabledChange_=()=>{if(this.changing_)return;this.changing_=!0,jg(this,t),this.changing_=!1,this.trigger("change")},t.addEventListener("enabledchange",t.enabledChange_)}removeTrack(t){if(super.removeTrack(t),t.removeEventListener&&t.enabledChange_)t.removeEventListener("enabledchange",t.enabledChange_),t.enabledChange_=null}}var dg=function(t,e){for(let a=0;a<t.length;a++){if(!Object.keys(t[a]).length||e.id===t[a].id)continue;t[a].selected=!1}};class c7 extends yl{constructor(t=[]){for(let e=t.length-1;e>=0;e--)if(t[e].selected){dg(t,t[e]);break}super(t);this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set(){}})}addTrack(t){if(t.selected)dg(this,t);if(super.addTrack(t),!t.addEventListener)return;t.selectedChange_=()=>{if(this.changing_)return;this.changing_=!0,dg(this,t),this.changing_=!1,this.trigger("change")},t.addEventListener("selectedchange",t.selectedChange_)}removeTrack(t){if(super.removeTrack(t),t.removeEventListener&&t.selectedChange_)t.removeEventListener("selectedchange",t.selectedChange_),t.selectedChange_=null}}class Em extends yl{addTrack(t){if(super.addTrack(t),!this.queueChange_)this.queueChange_=()=>this.queueTrigger("change");if(!this.triggerSelectedlanguagechange)this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange");if(t.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(t.kind)===-1)t.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(t){if(super.removeTrack(t),t.removeEventListener){if(this.queueChange_)t.removeEventListener("modechange",this.queueChange_);if(this.selectedlanguagechange_)t.removeEventListener("modechange",this.triggerSelectedlanguagechange_)}}toJSON(){return this.tracks_.map((t)=>t.toJSON())}}class fy{constructor(t=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let e=0,a=t.length;e<a;e++)this.addTrackElement_(t[e])}addTrackElement_(t){let e=this.trackElements_.length;if(!(""+e in this))Object.defineProperty(this,e,{get(){return this.trackElements_[e]}});if(this.trackElements_.indexOf(t)===-1)this.trackElements_.push(t)}getTrackElementByTrack_(t){let e;for(let a=0,i=this.trackElements_.length;a<i;a++)if(t===this.trackElements_[a].track){e=this.trackElements_[a];break}return e}removeTrackElement_(t){for(let e=0,a=this.trackElements_.length;e<a;e++)if(t===this.trackElements_[e]){if(this.trackElements_[e].track&&typeof this.trackElements_[e].track.off==="function")this.trackElements_[e].track.off();if(typeof this.trackElements_[e].off==="function")this.trackElements_[e].off();this.trackElements_.splice(e,1);break}}}class um{constructor(t){um.prototype.setCues_.call(this,t),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(t){let e=this.length||0,a=0,i=t.length;this.cues_=t,this.length_=t.length;let s=function(n){if(!(""+n in this))Object.defineProperty(this,""+n,{get(){return this.cues_[n]}})};if(e<i){a=e;for(;a<i;a++)s.call(this,a)}}getCueById(t){let e=null;for(let a=0,i=this.length;a<i;a++){let s=this[a];if(s.id===t){e=s;break}}return e}}var Ax={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},vx={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},Sx={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Uv={disabled:"disabled",hidden:"hidden",showing:"showing"};class xm extends Rs{constructor(t={}){super();let e={id:t.id||"vjs_track_"+kn(),kind:t.kind||"",language:t.language||""},a=t.label||"";for(let i in e)Object.defineProperty(this,i,{get(){return e[i]},set(){}});Object.defineProperty(this,"label",{get(){return a},set(i){if(i!==a)a=i,this.trigger("labelchange")}})}}var u7=function(t){return new URL(t,Ot.default.baseURI)},ry=function(t){return new URL(t,Ot.default.baseURI).href},m7=function(t){if(typeof t==="string"){let a=t.split("?")[0].replace(/\/+$/,"").match(/\.([^.\/]+)$/);return a?a[1].toLowerCase():""}return""},Um=function(t,e=$.default.location){return u7(t).origin!==e.origin},yx=Object.freeze({__proto__:null,parseUrl:u7,getAbsoluteURL:ry,getFileExtension:m7,isCrossOrigin:Um}),Iv=function(t,e){let a=new $.default.WebVTT.Parser($.default,$.default.vttjs,$.default.WebVTT.StringDecoder()),i=[];if(a.oncue=function(s){e.addCue(s)},a.onparsingerror=function(s){i.push(s)},a.onflush=function(){e.trigger({type:"loadeddata",target:e})},a.parse(t),i.length>0){if($.default.console&&$.default.console.groupCollapsed)$.default.console.groupCollapsed(`Text Track parsing errors for ${e.src}`);if(i.forEach((s)=>De.error(s)),$.default.console&&$.default.console.groupEnd)$.default.console.groupEnd()}a.flush()},Gv=function(t,e){let a={uri:t},i=Um(t);if(i)a.cors=i;let s=e.tech_.crossOrigin()==="use-credentials";if(s)a.withCredentials=s;a7.default(a,qa(this,function(n,l,f){if(n)return De.error(n,l);if(e.loaded_=!0,typeof $.default.WebVTT!=="function"){if(e.tech_)e.tech_.any(["vttjsloaded","vttjserror"],(o)=>{if(o.type==="vttjserror"){De.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return Iv(f,e)})}else Iv(f,e)}))};class nh extends xm{constructor(t={}){if(!t.tech)throw Error("A tech was not provided.");let e=ga(t,{kind:Sx[t.kind]||"subtitles",language:t.language||t.srclang||""}),a=Uv[e.mode]||"disabled",i=e.default;if(e.kind==="metadata"||e.kind==="chapters")a="hidden";super(e);this.tech_=e.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;let s=new um(this.cues_),n=new um(this.activeCues_),l=!1;this.timeupdateHandler=qa(this,function(o={}){if(this.tech_.isDisposed())return;if(!this.tech_.isReady_){if(o.type!=="timeupdate")this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler);return}if(this.activeCues=this.activeCues,l)this.trigger("cuechange"),l=!1;if(o.type!=="timeupdate")this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)});let f=()=>{this.stopTracking()};if(this.tech_.one("dispose",f),a!=="disabled")this.startTracking();if(Object.defineProperties(this,{default:{get(){return i},set(){}},mode:{get(){return a},set(o){if(!Uv[o])return;if(a===o)return;if(a=o,!this.preload_&&a!=="disabled"&&this.cues.length===0)Gv(this.src,this);if(this.stopTracking(),a!=="disabled")this.startTracking();this.trigger("modechange")}},cues:{get(){if(!this.loaded_)return null;return s},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return n;let o=this.tech_.currentTime(),c=[];for(let u=0,m=this.cues.length;u<m;u++){let p=this.cues[u];if(p.startTime<=o&&p.endTime>=o)c.push(p)}if(l=!1,c.length!==this.activeCues_.length)l=!0;else for(let u=0;u<c.length;u++)if(this.activeCues_.indexOf(c[u])===-1)l=!0;return this.activeCues_=c,n.setCues_(this.activeCues_),n},set(){}}}),e.src){if(this.src=e.src,!this.preload_)this.loaded_=!0;if(this.preload_||e.kind!=="subtitles"&&e.kind!=="captions")Gv(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(t){let e=t;if(!("getCueAsHTML"in e)){e=new $.default.vttjs.VTTCue(t.startTime,t.endTime,t.text);for(let i in t)if(!(i in e))e[i]=t[i];e.id=t.id,e.originalCue_=t}let a=this.tech_.textTracks();for(let i=0;i<a.length;i++)if(a[i]!==this)a[i].removeCue(e);this.cues_.push(e),this.cues.setCues_(this.cues_)}toJSON(){return xg.trackToJson(this)}removeCue(t){let e=this.cues_.length;while(e--){let a=this.cues_[e];if(a===t||a.originalCue_&&a.originalCue_===t){this.cues_.splice(e,1),this.cues.setCues_(this.cues_);break}}}}nh.prototype.allowedEvents_={cuechange:"cuechange"};class g7 extends xm{constructor(t={}){let e=ga(t,{kind:vx[t.kind]||""});super(e);let a=!1;if(Object.defineProperty(this,"enabled",{get(){return a},set(i){if(typeof i!=="boolean"||i===a)return;a=i,this.trigger("enabledchange")}}),e.enabled)this.enabled=e.enabled;this.loaded_=!0}}class b7 extends xm{constructor(t={}){let e=ga(t,{kind:Ax[t.kind]||""});super(e);let a=!1;if(Object.defineProperty(this,"selected",{get(){return a},set(i){if(typeof i!=="boolean"||i===a)return;a=i,this.trigger("selectedchange")}}),e.selected)this.selected=e.selected}}class p1 extends Rs{constructor(t={}){super();let e,a=new nh(t);this.kind=a.kind,this.src=a.src,this.srclang=a.language,this.label=a.label,this.default=a.default,Object.defineProperties(this,{readyState:{get(){return e}},track:{get(){return a}}}),e=p1.NONE,a.addEventListener("loadeddata",()=>{e=p1.LOADED,this.trigger({type:"load",target:this})})}}p1.prototype.allowedEvents_={load:"load"};p1.NONE=0;p1.LOADING=1;p1.LOADED=2;p1.ERROR=3;var yn={audio:{ListClass:h7,TrackClass:g7,capitalName:"Audio"},video:{ListClass:c7,TrackClass:b7,capitalName:"Video"},text:{ListClass:Em,TrackClass:nh,capitalName:"Text"}};Object.keys(yn).forEach(function(t){yn[t].getterName=`${t}Tracks`,yn[t].privateName=`${t}Tracks_`});var eh={remoteText:{ListClass:Em,TrackClass:nh,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:fy,TrackClass:p1,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},gs=Object.assign({},yn,eh);eh.names=Object.keys(eh);yn.names=Object.keys(yn);gs.names=[].concat(eh.names).concat(yn.names);function kx(t,e,a,i,s={}){let n=t.textTracks();if(s.kind=e,a)s.label=a;if(i)s.language=i;s.tech=t;let l=new gs.text.TrackClass(s);return n.addTrack(l),l}class Se extends bt{constructor(t={},e=function(){}){t.reportTouchActivity=!1;super(null,t,e);if(this.onDurationChange_=(a)=>this.onDurationChange(a),this.trackProgress_=(a)=>this.trackProgress(a),this.trackCurrentTime_=(a)=>this.trackCurrentTime(a),this.stopTrackingCurrentTime_=(a)=>this.stopTrackingCurrentTime(a),this.disposeSourceHandler_=(a)=>this.disposeSourceHandler(a),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),gs.names.forEach((a)=>{let i=gs[a];if(t&&t[i.getterName])this[i.privateName]=t[i.getterName]}),!this.featuresProgressEvents)this.manualProgressOn();if(!this.featuresTimeupdateEvents)this.manualTimeUpdatesOn();if(["Text","Audio","Video"].forEach((a)=>{if(t[`native${a}Tracks`]===!1)this[`featuresNative${a}Tracks`]=!1}),t.nativeCaptions===!1||t.nativeTextTracks===!1)this.featuresNativeTextTracks=!1;else if(t.nativeCaptions===!0||t.nativeTextTracks===!0)this.featuresNativeTextTracks=!0;if(!this.featuresNativeTextTracks)this.emulateTextTracks();if(this.preloadTextTracks=t.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new gs.text.ListClass,this.initTrackListeners(),!t.nativeControlsForTouch)this.emitTapEvents();if(this.constructor)this.name_=this.constructor.name||"Unknown Tech"}triggerSourceset(t){if(!this.isReady_)this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(t),1));this.trigger({src:t,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(t){this.stopTrackingProgress(),this.progressInterval=this.setInterval(qa(this,function(){let e=this.bufferedPercent();if(this.bufferedPercent_!==e)this.trigger("progress");if(this.bufferedPercent_=e,e===1)this.stopTrackingProgress()}),500)}onDurationChange(t){this.duration_=this.duration()}buffered(){return Jn(0,0)}bufferedPercent(){return ly(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(yn.names),this.manualProgress)this.manualProgressOff();if(this.manualTimeUpdates)this.manualTimeUpdatesOff();super.dispose()}clearTracks(t){t=[].concat(t),t.forEach((e)=>{let a=this[`${e}Tracks`]()||[],i=a.length;while(i--){let s=a[i];if(e==="text")this.removeRemoteTextTrack(s);a.removeTrack(s)}})}cleanupAutoTextTracks(){let t=this.autoRemoteTextTracks_||[],e=t.length;while(e--){let a=t[e];this.removeRemoteTextTrack(a)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(t){if(t!==void 0)this.error_=new xa(t),this.trigger("error");return this.error_}played(){if(this.hasStarted_)return Jn(0,0);return Jn()}play(){}setScrubbing(t){}scrubbing(){}setCurrentTime(t){if(this.manualTimeUpdates)this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){yn.names.forEach((t)=>{let e=yn[t],a=()=>{this.trigger(`${t}trackchange`)},i=this[e.getterName]();i.addEventListener("removetrack",a),i.addEventListener("addtrack",a),this.on("dispose",()=>{i.removeEventListener("removetrack",a),i.removeEventListener("addtrack",a)})})}addWebVttScript_(){if($.default.WebVTT)return;if(Ot.default.body.contains(this.el())){if(!this.options_["vtt.js"]&&$o(Og.default)&&Object.keys(Og.default).length>0){this.trigger("vttjsloaded");return}let t=Ot.default.createElement("script");t.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",t.onload=()=>{this.trigger("vttjsloaded")},t.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{t.onload=null,t.onerror=null}),$.default.WebVTT=!0,this.el().parentNode.appendChild(t)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){let t=this.textTracks(),e=this.remoteTextTracks(),a=(l)=>t.addTrack(l.track),i=(l)=>t.removeTrack(l.track);e.on("addtrack",a),e.on("removetrack",i),this.addWebVttScript_();let s=()=>this.trigger("texttrackchange"),n=()=>{s();for(let l=0;l<t.length;l++){let f=t[l];if(f.removeEventListener("cuechange",s),f.mode==="showing")f.addEventListener("cuechange",s)}};n(),t.addEventListener("change",n),t.addEventListener("addtrack",n),t.addEventListener("removetrack",n),this.on("dispose",function(){e.off("addtrack",a),e.off("removetrack",i),t.removeEventListener("change",n),t.removeEventListener("addtrack",n),t.removeEventListener("removetrack",n);for(let l=0;l<t.length;l++)t[l].removeEventListener("cuechange",s)})}addTextTrack(t,e,a){if(!t)throw Error("TextTrack kind is required but was not provided");return kx(this,t,e,a)}createRemoteTextTrack(t){let e=ga(t,{tech:this});return new eh.remoteTextEl.TrackClass(e)}addRemoteTextTrack(t={},e){let a=this.createRemoteTextTrack(t);if(typeof e!=="boolean")e=!1;if(this.remoteTextTrackEls().addTrackElement_(a),this.remoteTextTracks().addTrack(a.track),e===!1)this.ready(()=>this.autoRemoteTextTracks_.addTrack(a.track));return a}removeRemoteTextTrack(t){let e=this.remoteTextTrackEls().getTrackElementByTrack_(t);this.remoteTextTrackEls().removeTrackElement_(e),this.remoteTextTracks().removeTrack(t),this.autoRemoteTextTracks_.removeTrack(t)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(t){let e=kn();if(!this.isReady_||this.paused())this.queuedHanders_.add(e),this.one("playing",()=>{if(this.queuedHanders_.has(e))this.queuedHanders_.delete(e),t()});else this.requestNamedAnimationFrame(e,t);return e}cancelVideoFrameCallback(t){if(this.queuedHanders_.has(t))this.queuedHanders_.delete(t);else this.cancelNamedAnimationFrame(t)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(t){}overrideNativeVideoTracks(t){}canPlayType(t){return""}static canPlayType(t){return""}static canPlaySource(t,e){return Se.canPlayType(t.type)}static isTech(t){return t.prototype instanceof Se||t instanceof Se||t===Se}static registerTech(t,e){if(!Se.techs_)Se.techs_={};if(!Se.isTech(e))throw Error(`Tech ${t} must be a Tech`);if(!Se.canPlayType)throw Error("Techs must have a static canPlayType method on them");if(!Se.canPlaySource)throw Error("Techs must have a static canPlaySource method on them");if(t=Va(t),Se.techs_[t]=e,Se.techs_[k2(t)]=e,t!=="Tech")Se.defaultTechOrder_.push(t);return e}static getTech(t){if(!t)return;if(Se.techs_&&Se.techs_[t])return Se.techs_[t];if(t=Va(t),$.default&&$.default.videojs&&$.default.videojs[t])return De.warn(`The ${t} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),$.default.videojs[t]}}gs.names.forEach(function(t){let e=gs[t];Se.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});Se.prototype.featuresVolumeControl=!0;Se.prototype.featuresMuteControl=!0;Se.prototype.featuresFullscreenResize=!1;Se.prototype.featuresPlaybackRate=!1;Se.prototype.featuresProgressEvents=!1;Se.prototype.featuresSourceset=!1;Se.prototype.featuresTimeupdateEvents=!1;Se.prototype.featuresNativeTextTracks=!1;Se.prototype.featuresVideoFrameCallback=!1;Se.withSourceHandlers=function(t){t.registerSourceHandler=function(a,i){let s=t.sourceHandlers;if(!s)s=t.sourceHandlers=[];if(i===void 0)i=s.length;s.splice(i,0,a)},t.canPlayType=function(a){let i=t.sourceHandlers||[],s;for(let n=0;n<i.length;n++)if(s=i[n].canPlayType(a),s)return s;return""},t.selectSourceHandler=function(a,i){let s=t.sourceHandlers||[],n;for(let l=0;l<s.length;l++)if(n=s[l].canHandleSource(a,i),n)return s[l];return null},t.canPlaySource=function(a,i){let s=t.selectSourceHandler(a,i);if(s)return s.canHandleSource(a,i);return""},["seekable","seeking","duration"].forEach(function(a){let i=this[a];if(typeof i!=="function")return;this[a]=function(){if(this.sourceHandler_&&this.sourceHandler_[a])return this.sourceHandler_[a].apply(this.sourceHandler_,arguments);return i.apply(this,arguments)}},t.prototype),t.prototype.setSource=function(a){let i=t.selectSourceHandler(a,this.options_);if(!i)if(t.nativeSourceHandler)i=t.nativeSourceHandler;else De.error("No source handler found for the current source.");if(this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),i!==t.nativeSourceHandler)this.currentSource_=a;this.sourceHandler_=i.handleSource(a,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},t.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}}};bt.registerComponent("Tech",Se);Se.registerTech("Tech",Se);Se.defaultTechOrder_=[];var Yf={},mm={},gm={};function Cx(t,e){Yf[t]=Yf[t]||[],Yf[t].push(e)}function _x(t,e,a){t.setTimeout(()=>Gf(e,Yf[e.type],a,t),1)}function Fx(t,e){t.forEach((a)=>a.setTech&&a.setTech(e))}function Bx(t,e,a){return t.reduceRight(p7(a),e[a]())}function Ox(t,e,a,i){return e[a](t.reduce(p7(a),i))}function Xv(t,e,a,i=null){let s="call"+Va(a),n=t.reduce(p7(s),i),l=n===gm,f=l?null:e[a](n);return Dx(t,a,f,l),f}var Hx={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},Mx={setCurrentTime:1,setMuted:1,setVolume:1},Kv={play:1,pause:1};function p7(t){return(e,a)=>{if(e===gm)return gm;if(a[t])return a[t](e);return e}}function Dx(t,e,a,i){for(let s=t.length-1;s>=0;s--){let n=t[s];if(n[e])n[e](i,a)}}function Tx(t){if(mm.hasOwnProperty(t.id()))delete mm[t.id()]}function Rx(t,e){let a=mm[t.id()],i=null;if(a===void 0||a===null)return i=e(t),mm[t.id()]=[[e,i]],i;for(let s=0;s<a.length;s++){let[n,l]=a[s];if(n!==e)continue;i=l}if(i===null)i=e(t),a.push([e,i]);return i}function Gf(t={},e=[],a,i,s=[],n=!1){let[l,...f]=e;if(typeof l==="string")Gf(t,Yf[l],a,i,s,n);else if(l){let o=Rx(i,l);if(!o.setSource)return s.push(o),Gf(t,f,a,i,s,n);o.setSource(Object.assign({},t),function(c,u){if(c)return Gf(t,f,a,i,s,n);s.push(o),Gf(u,t.type===u.type?f:Yf[u.type],a,i,s,n)})}else if(f.length)Gf(t,f,a,i,s,n);else if(n)a(t,s);else Gf(t,Yf["*"],a,i,s,!0)}var Nx={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"},bm=function(t=""){let e=m7(t);return Nx[e.toLowerCase()]||""},zx=(t,e)=>{if(!e)return"";if(t.cache_.source.src===e&&t.cache_.source.type)return t.cache_.source.type;let a=t.cache_.sources.filter((s)=>s.src===e);if(a.length)return a[0].type;let i=t.$$("source");for(let s=0;s<i.length;s++){let n=i[s];if(n.type&&n.src&&n.src===e)return n.type}return bm(e)},oy=function(t){if(Array.isArray(t)){let e=[];t.forEach(function(a){if(a=oy(a),Array.isArray(a))e=e.concat(a);else if(q0(a))e.push(a)}),t=e}else if(typeof t==="string"&&t.trim())t=[Lv({src:t})];else if(q0(t)&&typeof t.src==="string"&&t.src&&t.src.trim())t=[Lv(t)];else t=[];return t};function Lv(t){if(!t.type){let e=bm(t.src);if(e)t.type=e}return t}var Ex=`<svg xmlns="http://www.w3.org/2000/svg">
50
- <defs>
51
- <symbol viewBox="0 0 48 48" id="vjs-icon-play">
52
- <path d="M16 10v28l22-14z"></path>
53
- </symbol>
54
- <symbol viewBox="0 0 48 48" id="vjs-icon-pause">
55
- <path d="M12 38h8V10h-8v28zm16-28v28h8V10h-8z"></path>
56
- </symbol>
57
- <symbol viewBox="0 0 48 48" id="vjs-icon-audio">
58
- <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>
59
- </symbol>
60
- <symbol viewBox="0 0 48 48" id="vjs-icon-captions">
61
- <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>
62
- </symbol>
63
- <symbol viewBox="0 0 48 48" id="vjs-icon-subtitles">
64
- <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>
65
- </symbol>
66
- <symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-enter">
67
- <path d="M14 28h-4v10h10v-4h-6v-6zm-4-8h4v-6h6v-4H10v10zm24 14h-6v4h10V28h-4v6zm-6-24v4h6v6h4V10H28z"></path>
68
- </symbol>
69
- <symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-exit">
70
- <path d="M10 32h6v6h4V28H10v4zm6-16h-6v4h10V10h-4v6zm12 22h4v-6h6v-4H28v10zm4-22v-6h-4v10h10v-4h-6z"></path>
71
- </symbol>
72
- <symbol viewBox="0 0 48 48" id="vjs-icon-play-circle">
73
- <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>
74
- </symbol>
75
- <symbol viewBox="0 0 48 48" id="vjs-icon-volume-mute">
76
- <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>
77
- </symbol>
78
- <symbol viewBox="0 0 48 48" id="vjs-icon-volume-low">
79
- <path d="M14 18v12h8l10 10V8L22 18h-8z"></path>
80
- </symbol>
81
- <symbol viewBox="0 0 48 48" id="vjs-icon-volume-medium">
82
- <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>
83
- </symbol>
84
- <symbol viewBox="0 0 48 48" id="vjs-icon-volume-high">
85
- <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>
86
- </symbol>
87
- <symbol viewBox="0 0 48 48" id="vjs-icon-spinner">
88
- <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>
89
- </symbol>
90
- <symbol viewBox="0 0 24 24" id="vjs-icon-hd">
91
- <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>
92
- </symbol>
93
- <symbol viewBox="0 0 48 48" id="vjs-icon-chapters">
94
- <path d="M6 26h4v-4H6v4zm0 8h4v-4H6v4zm0-16h4v-4H6v4zm8 8h28v-4H14v4zm0 8h28v-4H14v4zm0-20v4h28v-4H14z"></path>
95
- </symbol>
96
- <symbol viewBox="0 0 40 40" id="vjs-icon-downloading">
97
- <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>
98
- </symbol>
99
- <symbol viewBox="0 0 48 48" id="vjs-icon-file-download">
100
- <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>
101
- </symbol>
102
- <symbol viewBox="0 0 48 48" id="vjs-icon-file-download-done">
103
- <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>
104
- </symbol>
105
- <symbol viewBox="0 0 48 48" id="vjs-icon-file-download-off">
106
- <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>
107
- </symbol>
108
- <symbol viewBox="0 0 48 48" id="vjs-icon-share">
109
- <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>
110
- </symbol>
111
- <symbol viewBox="0 0 48 48" id="vjs-icon-cog">
112
- <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>
113
- </symbol>
114
- <symbol viewBox="0 0 48 48" id="vjs-icon-square">
115
- <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>
116
- </symbol>
117
- <symbol viewBox="0 0 48 48" id="vjs-icon-circle">
118
- <circle cx="24" cy="24" r="20"></circle>
119
- </symbol>
120
- <symbol viewBox="0 0 48 48" id="vjs-icon-circle-outline">
121
- <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>
122
- </symbol>
123
- <symbol viewBox="0 0 48 48" id="vjs-icon-circle-inner-circle">
124
- <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>
125
- </symbol>
126
- <symbol viewBox="0 0 48 48" id="vjs-icon-cancel">
127
- <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>
128
- </symbol>
129
- <symbol viewBox="0 0 48 48" id="vjs-icon-replay">
130
- <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>
131
- </symbol>
132
- <symbol viewBox="0 0 48 48" id="vjs-icon-repeat">
133
- <path d="M14 14h20v6l8-8-8-8v6H10v12h4v-8zm20 20H14v-6l-8 8 8 8v-6h24V26h-4v8z"></path>
134
- </symbol>
135
- <symbol viewBox="0 96 48 48" id="vjs-icon-replay-5">
136
- <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>
137
- </symbol>
138
- <symbol viewBox="0 96 48 48" id="vjs-icon-replay-10">
139
- <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>
140
- </symbol>
141
- <symbol viewBox="0 96 48 48" id="vjs-icon-replay-30">
142
- <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>
143
- </symbol>
144
- <symbol viewBox="0 96 48 48" id="vjs-icon-forward-5">
145
- <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>
146
- </symbol>
147
- <symbol viewBox="0 96 48 48" id="vjs-icon-forward-10">
148
- <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>
149
- </symbol>
150
- <symbol viewBox="0 96 48 48" id="vjs-icon-forward-30">
151
- <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>
152
- </symbol>
153
- <symbol viewBox="0 0 512 512" id="vjs-icon-audio-description">
154
- <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>
155
- </symbol>
156
- <symbol viewBox="0 0 48 48" id="vjs-icon-next-item">
157
- <path d="M12 36l17-12-17-12v24zm20-24v24h4V12h-4z"></path>
158
- </symbol>
159
- <symbol viewBox="0 0 48 48" id="vjs-icon-previous-item">
160
- <path d="M12 12h4v24h-4zm7 12l17 12V12z"></path>
161
- </symbol>
162
- <symbol viewBox="0 0 48 48" id="vjs-icon-shuffle">
163
- <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>
164
- </symbol>
165
- <symbol viewBox="0 0 48 48" id="vjs-icon-cast">
166
- <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>
167
- </symbol>
168
- <symbol viewBox="0 0 48 48" id="vjs-icon-picture-in-picture-enter">
169
- <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>
170
- </symbol>
171
- <symbol viewBox="0 0 22 18" id="vjs-icon-picture-in-picture-exit">
172
- <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>
173
- <path fill="none" d="M-1-3h24v24H-1z"></path>
174
- </symbol>
175
- <symbol viewBox="0 0 1792 1792" id="vjs-icon-facebook">
176
- <path d="M1343 12v264h-157q-86 0-116 36t-30 108v189h293l-39 296h-254v759H734V905H479V609h255V391q0-186 104-288.5T1115 0q147 0 228 12z"></path>
177
- </symbol>
178
- <symbol viewBox="0 0 1792 1792" id="vjs-icon-linkedin">
179
- <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>
180
- </symbol>
181
- <symbol viewBox="0 0 1200 1227" id="vjs-icon-twitter">
182
- <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"/>
183
- </symbol>
184
- <symbol viewBox="0 0 1792 1792" id="vjs-icon-tumblr">
185
- <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>
186
- </symbol>
187
- <symbol viewBox="0 0 1792 1792" id="vjs-icon-pinterest">
188
- <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>
189
- </symbol>
190
- </defs>
191
- </svg>`,Vv=rm?10009:om?461:8,Eo={codes:{play:415,pause:19,ff:417,rw:412,back:Vv},names:{415:"play",19:"pause",417:"ff",412:"rw",[Vv]:"back"},isEventKey(t,e){if(e=e.toLowerCase(),this.names[t.keyCode]&&this.names[t.keyCode]===e)return!0;return!1},getEventName(t){if(this.names[t.keyCode])return this.names[t.keyCode];else if(this.codes[t.code]){let e=this.codes[t.code];return this.names[e]}return null}},Yv=5;class hy extends Rs{constructor(t){super();this.player_=t,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_(t){let e=t.originalEvent?t.originalEvent:t;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)){if(this.isPaused_)return;e.preventDefault();let a=e.key.substring(5).toLowerCase();this.move(a)}else if(Eo.isEventKey(e,"play")||Eo.isEventKey(e,"pause")||Eo.isEventKey(e,"ff")||Eo.isEventKey(e,"rw")){e.preventDefault();let a=Eo.getEventName(e);this.performMediaAction_(a)}else if(Eo.isEventKey(e,"Back")&&t.target&&typeof t.target.closeable==="function"&&t.target.closeable())e.preventDefault(),t.target.close()}performMediaAction_(t){if(this.player_)switch(t){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()+Yv);break;case"rw":this.userSeek_(this.player_.currentTime()-Yv);break}}userSeek_(t){if(this.player_.liveTracker&&this.player_.liveTracker.isLive())this.player_.liveTracker.nextSeekedFromUser();this.player_.currentTime(t)}pause(){this.isPaused_=!0}resume(){this.isPaused_=!1}handlePlayerBlur_(t){let e=t.relatedTarget,a=null,i=this.getCurrentComponent(t.target);if(e){if(a=Boolean(e.closest(".video-js")),e.classList.contains("vjs-text-track-settings")&&!this.isPaused_)this.searchForTrackSelect_()}if(!t.currentTarget.contains(t.relatedTarget)&&!a||!e){if(i&&i.name()==="CloseButton")this.refocusComponent();else if(this.pause(),i&&i.el())this.lastFocusedComponent_=i}}handlePlayerFocus_(){if(this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable())this.resume()}updateFocusableComponents(){let t=this.player_,e=[];function a(i){for(let s of i){if(s.hasOwnProperty("el_")&&s.getIsFocusable()&&s.getIsAvailableToBeFocused(s.el()))e.push(s);if(s.hasOwnProperty("children_")&&s.children_.length>0)a(s.children_)}}return t.children_.forEach((i)=>{if(i.hasOwnProperty("el_")){if(i.getIsFocusable&&i.getIsAvailableToBeFocused&&i.getIsFocusable()&&i.getIsAvailableToBeFocused(i.el())){e.push(i);return}else if(i.hasOwnProperty("children_")&&i.children_.length>0)a(i.children_);else if(i.hasOwnProperty("items")&&i.items.length>0)a(i.items);else if(this.findSuitableDOMChild(i))e.push(i)}if(i.name_==="ErrorDisplay"&&i.opened_){let s=i.el_.querySelector(".vjs-errors-ok-button-container");if(s)s.querySelectorAll("button").forEach((l,f)=>{e.push({name:()=>{return"ModalButton"+(f+1)},el:()=>l,getPositions:()=>{let o=l.getBoundingClientRect(),c={x:o.x,y:o.y,width:o.width,height:o.height,top:o.top,right:o.right,bottom:o.bottom,left:o.left},u={x:o.left+o.width/2,y:o.top+o.height/2,width:0,height:0,top:o.top+o.height/2,right:o.left+o.width/2,bottom:o.top+o.height/2,left:o.left+o.width/2};return{boundingClientRect:c,center:u}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:(o)=>!0,focus:()=>l.focus()})})}}),this.focusableComponents=e,this.focusableComponents}findSuitableDOMChild(t){function e(a){if(t.getIsFocusable(a)&&t.getIsAvailableToBeFocused(a))return a;for(let i=0;i<a.children.length;i++){let s=a.children[i],n=e(s);if(n)return n}return null}if(t.el())return e(t.el());return null}getCurrentComponent(t){this.updateFocusableComponents();let e=t||document.activeElement;if(this.focusableComponents.length){for(let a of this.focusableComponents)if(a.el()===e)return a}}add(t){let e=[...this.focusableComponents];if(t.hasOwnProperty("el_")&&t.getIsFocusable()&&t.getIsAvailableToBeFocused(t.el()))e.push(t);this.focusableComponents=e,this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents})}remove(t){for(let e=0;e<this.focusableComponents.length;e++)if(this.focusableComponents[e].name()===t.name()){this.focusableComponents.splice(e,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(t){let e=this.getCurrentComponent();if(!e)return;let a=e.getPositions(),i=this.focusableComponents.filter((n)=>n!==e&&this.isInDirection_(a.boundingClientRect,n.getPositions().boundingClientRect,t)),s=this.findBestCandidate_(a.center,i,t);if(s)this.focus(s);else this.trigger({type:"endOfFocusableComponents",direction:t,focusedComponent:e})}findBestCandidate_(t,e,a){let i=1/0,s=null;for(let n of e){let l=n.getPositions().center,f=this.calculateDistance_(t,l,a);if(f<i)i=f,s=n}return s}isInDirection_(t,e,a){switch(a){case"right":return e.left>=t.right;case"left":return e.right<=t.left;case"down":return e.top>=t.bottom;case"up":return e.bottom<=t.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){if(!this.player_.userActive())this.player_.userActive(!0);this.updateFocusableComponents();for(let t=0;t<this.focusableComponents.length;t++)if(this.focusableComponents[t].name()===this.lastFocusedComponent_.name()){this.focus(this.focusableComponents[t]);return}}else this.focus(this.updateFocusableComponents()[0])}focus(t){if(typeof t!=="object")return;if(t.getIsAvailableToBeFocused(t.el()))t.focus();else if(this.findSuitableDOMChild(t))this.findSuitableDOMChild(t).focus()}calculateDistance_(t,e,a){let i=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y),n;switch(a){case"right":case"left":n=i+s*100;break;case"up":n=s*2+i*0.5;break;case"down":n=s*5+i;break;default:n=i+s}return n}searchForTrackSelect_(){let t=this;for(let e of t.updateFocusableComponents())if(e.constructor.name==="TextTrackSelect"){t.focus(e);break}}}class cy extends bt{constructor(t,e,a){let i=ga({createEl:!1},e);super(t,i,a);if(!e.playerOptions.sources||e.playerOptions.sources.length===0)for(let s=0,n=e.playerOptions.techOrder;s<n.length;s++){let l=Va(n[s]),f=Se.getTech(l);if(!l)f=bt.getComponent(l);if(f&&f.isSupported()){t.loadTech_(l);break}}else t.src(e.playerOptions.sources)}}bt.registerComponent("MediaLoader",cy);class T2 extends bt{constructor(t,e){super(t,e);if(this.options_.controlText)this.controlText(this.options_.controlText);this.handleMouseOver_=(a)=>this.handleMouseOver(a),this.handleMouseOut_=(a)=>this.handleMouseOut(a),this.handleClick_=(a)=>this.handleClick(a),this.handleKeyDown_=(a)=>this.handleKeyDown(a),this.emitTapEvents(),this.enable()}createEl(t="div",e={},a={}){if(e=Object.assign({className:this.buildCSSClass(),tabIndex:0},e),t==="button")De.error(`Creating a ClickableComponent with an HTML element of ${t} is not supported; use a Button instead.`);a=Object.assign({role:"button"},a),this.tabIndex_=e.tabIndex;let i=he(t,e,a);if(!this.player_.options_.experimentalSvgIcons)i.appendChild(he("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0}));return this.createControlTextEl(i),i}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(t){if(this.controlTextEl_=he("span",{className:"vjs-control-text"},{"aria-live":"polite"}),t)t.appendChild(this.controlTextEl_);return this.controlText(this.controlText_,t),this.controlTextEl_}controlText(t,e=this.el()){if(t===void 0)return this.controlText_||"Need Text";let a=this.localize(t);if(this.controlText_=t,kl(this.controlTextEl_,a),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes)e.setAttribute("title",a)}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(t){if(this.options_.clickHandler)this.options_.clickHandler.call(this,arguments)}handleKeyDown(t){if(t.key===" "||t.key==="Enter")t.preventDefault(),t.stopPropagation(),this.trigger("click");else super.handleKeyDown(t)}}bt.registerComponent("ClickableComponent",T2);class pm extends T2{constructor(t,e){super(t,e);this.update(),this.update_=(a)=>this.update(a),t.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return he("div",{className:"vjs-poster"})}crossOrigin(t){if(typeof t>"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(t!==null&&t!=="anonymous"&&t!=="use-credentials"){this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${t}"`);return}if(this.$("img"))this.$("img").crossOrigin=t;return}update(t){let e=this.player().poster();if(this.setSrc(e),e)this.show();else this.hide()}setSrc(t){if(!t){this.el_.textContent="";return}if(!this.$("img"))this.el_.appendChild(he("picture",{className:"vjs-poster",tabIndex:-1},{},he("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""})));this.$("img").src=t}handleClick(t){if(!this.player_.controls())return;if(this.player_.tech(!0))this.player_.tech(!0).focus();if(this.player_.paused())p0(this.player_.play());else this.player_.pause()}}pm.prototype.crossorigin=pm.prototype.crossOrigin;bt.registerComponent("PosterImage",pm);var Sn="#222",Jv="#ccc",xx={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 qg(t,e){let a;if(t.length===4)a=t[1]+t[1]+t[2]+t[2]+t[3]+t[3];else if(t.length===7)a=t.slice(1);else throw Error("Invalid color code provided, "+t+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(a.slice(0,2),16)+","+parseInt(a.slice(2,4),16)+","+parseInt(a.slice(4,6),16)+","+e+")"}function g0(t,e,a){try{t.style[e]=a}catch(i){return}}function Qv(t){return t?`${t}px`:""}class uy extends bt{constructor(t,e,a){super(t,e,a);let i=(n)=>this.updateDisplay(n),s=(n)=>{this.updateDisplayOverlay(),this.updateDisplay(n)};t.on("loadstart",(n)=>this.toggleDisplay(n)),t.on("useractive",i),t.on("userinactive",i),t.on("texttrackchange",i),t.on("loadedmetadata",(n)=>{this.updateDisplayOverlay(),this.preselectTrack(n)}),t.ready(qa(this,function(){if(t.tech_&&t.tech_.featuresNativeTextTracks){this.hide();return}t.on("fullscreenchange",s),t.on("playerresize",s);let n=$.default.screen.orientation||$.default,l=$.default.screen.orientation?"change":"orientationchange";n.addEventListener(l,s),t.on("dispose",()=>n.removeEventListener(l,s));let f=this.options_.playerOptions.tracks||[];for(let o=0;o<f.length;o++)this.player_.addRemoteTextTrack(f[o],!0);this.preselectTrack()}))}preselectTrack(){let t={captions:1,subtitles:1},e=this.player_.textTracks(),a=this.player_.cache_.selectedLanguage,i,s,n;for(let l=0;l<e.length;l++){let f=e[l];if(a&&a.enabled&&a.language&&a.language===f.language&&f.kind in t){if(f.kind===a.kind)n=f;else if(!n)n=f}else if(a&&!a.enabled)n=null,i=null,s=null;else if(f.default){if(f.kind==="descriptions"&&!i)i=f;else if(f.kind in t&&!s)s=f}}if(n)n.mode="showing";else if(s)s.mode="showing";else if(i)i.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 $.default.WebVTT==="function")$.default.WebVTT.processCues($.default,[],this.el_)}updateDisplay(){let t=this.player_.textTracks(),e=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),e){let n=[];for(let l=0;l<t.length;++l){let f=t[l];if(f.mode!=="showing")continue;n.push(f)}this.updateForTrack(n);return}let a=null,i=null,s=t.length;while(s--){let n=t[s];if(n.mode==="showing")if(n.kind==="descriptions")a=n;else i=n}if(i){if(this.getAttribute("aria-live")!=="off")this.setAttribute("aria-live","off");this.updateForTrack(i)}else if(a){if(this.getAttribute("aria-live")!=="assertive")this.setAttribute("aria-live","assertive");this.updateForTrack(a)}if(!($.default.CSS!==void 0&&$.default.CSS.supports("inset","10px"))){let n=this.el_,l=n.querySelectorAll(".vjs-text-track-cue"),f=this.player_.controlBar.el_.getBoundingClientRect().height,o=this.player_.el_.getBoundingClientRect().height;if(n.style="",g0(n,"position","relative"),g0(n,"height",o-f+"px"),g0(n,"top","unset"),hm)g0(n,"bottom",o+"px");else g0(n,"bottom","0px");if(l.length>0)l.forEach((c)=>{if(c.style.inset){let u=c.style.inset.split(" ");if(u.length===3)Object.assign(c.style,{top:u[0],right:u[1],bottom:u[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!($.default.CSS!==void 0&&$.default.CSS.supports("inset-inline: 10px")))return;let t=this.player_.currentWidth(),e=this.player_.currentHeight(),a=t/e,i=this.player_.videoWidth()/this.player_.videoHeight(),s=0,n=0;if(Math.abs(a-i)>0.1)if(a>i)s=Math.round((t-e*i)/2);else n=Math.round((e-t/i)/2);g0(this.el_,"insetInline",Qv(s)),g0(this.el_,"insetBlock",Qv(n))}updateDisplayState(t){let e=this.player_.textTrackSettings.getValues(),a=t.activeCues,i=a.length;while(i--){let s=a[i];if(!s)continue;let n=s.displayState;if(e.color)n.firstChild.style.color=e.color;if(e.textOpacity)g0(n.firstChild,"color",qg(e.color||"#fff",e.textOpacity));if(e.backgroundColor)n.firstChild.style.backgroundColor=e.backgroundColor;if(e.backgroundOpacity)g0(n.firstChild,"backgroundColor",qg(e.backgroundColor||"#000",e.backgroundOpacity));if(e.windowColor)if(e.windowOpacity)g0(n,"backgroundColor",qg(e.windowColor,e.windowOpacity));else n.style.backgroundColor=e.windowColor;if(e.edgeStyle){if(e.edgeStyle==="dropshadow")n.firstChild.style.textShadow=`2px 2px 3px ${Sn}, 2px 2px 4px ${Sn}, 2px 2px 5px ${Sn}`;else if(e.edgeStyle==="raised")n.firstChild.style.textShadow=`1px 1px ${Sn}, 2px 2px ${Sn}, 3px 3px ${Sn}`;else if(e.edgeStyle==="depressed")n.firstChild.style.textShadow=`1px 1px ${Jv}, 0 1px ${Jv}, -1px -1px ${Sn}, 0 -1px ${Sn}`;else if(e.edgeStyle==="uniform")n.firstChild.style.textShadow=`0 0 4px ${Sn}, 0 0 4px ${Sn}, 0 0 4px ${Sn}, 0 0 4px ${Sn}`}if(e.fontPercent&&e.fontPercent!==1){let l=$.default.parseFloat(n.style.fontSize);n.style.fontSize=l*e.fontPercent+"px",n.style.height="auto",n.style.top="auto"}if(e.fontFamily&&e.fontFamily!=="default")if(e.fontFamily==="small-caps")n.firstChild.style.fontVariant="small-caps";else n.firstChild.style.fontFamily=xx[e.fontFamily]}}updateForTrack(t){if(!Array.isArray(t))t=[t];if(typeof $.default.WebVTT!=="function"||t.every((a)=>{return!a.activeCues}))return;let e=[];for(let a=0;a<t.length;++a){let i=t[a];for(let s=0;s<i.activeCues.length;++s)e.push(i.activeCues[s])}$.default.WebVTT.processCues($.default,e,this.el_);for(let a=0;a<t.length;++a){let i=t[a];for(let s=0;s<i.activeCues.length;++s){let n=i.activeCues[s].displayState;if(Vf(n,"vjs-text-track-cue","vjs-text-track-cue-"+(i.language?i.language:a)),i.language)Wo(n,"lang",i.language)}if(this.player_.textTrackSettings)this.updateDisplayState(i)}}}bt.registerComponent("TextTrackDisplay",uy);class my extends bt{createEl(){let t=this.player_.isAudio(),e=this.localize(t?"Audio Player":"Video Player"),a=he("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[e])}),i=super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"});return i.appendChild(a),i}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}bt.registerComponent("LoadingSpinner",my);class Li extends T2{createEl(t,e={},a={}){t="button",e=Object.assign({className:this.buildCSSClass()},e),a=Object.assign({type:"button"},a);let i=he(t,e,a);if(!this.player_.options_.experimentalSvgIcons)i.appendChild(he("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0}));return this.createControlTextEl(i),i}addChild(t,e={}){let a=this.constructor.name;return De.warn(`Adding an actionable (user controllable) child to a Button (${a}) is not supported; use a ClickableComponent instead.`),bt.prototype.addChild.call(this,t,e)}enable(){super.enable(),this.el_.removeAttribute("disabled")}disable(){super.disable(),this.el_.setAttribute("disabled","disabled")}handleKeyDown(t){if(t.key===" "||t.key==="Enter"){t.stopPropagation();return}super.handleKeyDown(t)}}bt.registerComponent("Button",Li);class w7 extends Li{constructor(t,e){super(t,e);this.mouseused_=!1,this.setIcon("play"),this.on("mousedown",(a)=>this.handleMouseDown(a))}buildCSSClass(){return"vjs-big-play-button"}handleClick(t){let e=this.player_.play();if(t.type==="tap"||this.mouseused_&&"clientX"in t&&"clientY"in t){if(p0(e),this.player_.tech(!0))this.player_.tech(!0).focus();return}let a=this.player_.getChild("controlBar"),i=a&&a.getChild("playToggle");if(!i){this.player_.tech(!0).focus();return}let s=()=>i.focus();if(C2(e))e.then(s,()=>{});else this.setTimeout(s,1)}handleKeyDown(t){this.mouseused_=!1,super.handleKeyDown(t)}handleMouseDown(t){this.mouseused_=!0}}w7.prototype.controlText_="Play Video";bt.registerComponent("BigPlayButton",w7);class gy extends Li{constructor(t,e){super(t,e);this.setIcon("cancel"),this.controlText(e&&e.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(t){this.trigger({type:"close",bubbles:!1})}handleKeyDown(t){if(t.key==="Escape")t.preventDefault(),t.stopPropagation(),this.trigger("click");else super.handleKeyDown(t)}}bt.registerComponent("CloseButton",gy);class j7 extends Li{constructor(t,e={}){super(t,e);if(e.replay=e.replay===void 0||e.replay,this.setIcon("play"),this.on(t,"play",(a)=>this.handlePlay(a)),this.on(t,"pause",(a)=>this.handlePause(a)),e.replay)this.on(t,"ended",(a)=>this.handleEnded(a))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(t){if(this.player_.paused())p0(this.player_.play());else this.player_.pause()}handleSeeked(t){if(this.removeClass("vjs-ended"),this.player_.paused())this.handlePause(t);else this.handlePlay(t)}handlePlay(t){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(t){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(t){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",(e)=>this.handleSeeked(e))}}j7.prototype.controlText_="Play";bt.registerComponent("PlayToggle",j7);class $f extends bt{constructor(t,e){super(t,e);this.on(t,["timeupdate","ended","seeking"],(a)=>this.update(a)),this.updateTextNode_()}createEl(){let t=this.buildCSSClass(),e=super.createEl("div",{className:`${t} vjs-time-control vjs-control`}),a=he("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return e.appendChild(a),this.contentEl_=he("span",{className:`${t}-display`},{role:"presentation"}),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(t){if(!this.player_.options_.enableSmoothSeeking&&t.type==="seeking")return;this.updateContent(t)}updateTextNode_(t=0){if(t=Qf(t),this.formattedTime_===t)return;this.formattedTime_=t,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let e=this.textNode_;if(e&&this.contentEl_.firstChild!==e)e=null,De.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_=Ot.default.createTextNode(this.formattedTime_),!this.textNode_)return;if(e)this.contentEl_.replaceChild(this.textNode_,e);else this.contentEl_.appendChild(this.textNode_)})}updateContent(t){}}$f.prototype.labelText_="Time";$f.prototype.controlText_="Time";bt.registerComponent("TimeDisplay",$f);class Im extends $f{buildCSSClass(){return"vjs-current-time"}updateContent(t){let e;if(this.player_.ended())e=this.player_.duration();else if(t&&t.target&&typeof t.target.pendingSeekTime==="function"&&t.target.pendingSeekTime()!==null)e=t.target.pendingSeekTime();else e=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();this.updateTextNode_(e)}}Im.prototype.labelText_="Current Time";Im.prototype.controlText_="Current Time";bt.registerComponent("CurrentTimeDisplay",Im);class Gm extends $f{constructor(t,e){super(t,e);let a=(i)=>this.updateContent(i);this.on(t,"durationchange",a),this.on(t,"loadstart",a),this.on(t,"loadedmetadata",a)}buildCSSClass(){return"vjs-duration"}updateContent(t){let e=this.player_.duration();this.updateTextNode_(e)}}Gm.prototype.labelText_="Duration";Gm.prototype.controlText_="Duration";bt.registerComponent("DurationDisplay",Gm);class by extends bt{createEl(){let t=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),e=super.createEl("div"),a=super.createEl("span",{textContent:"/"});return e.appendChild(a),t.appendChild(e),t}}bt.registerComponent("TimeDivider",by);class Xm extends $f{constructor(t,e){super(t,e);this.on(t,"durationchange",(a)=>this.updateContent(a))}buildCSSClass(){return"vjs-remaining-time"}createEl(){let t=super.createEl();if(this.options_.displayNegative!==!1)t.insertBefore(he("span",{},{"aria-hidden":!0},"-"),this.contentEl_);return t}updateContent(t){if(typeof this.player_.duration()!=="number")return;let e;if(this.player_.ended())e=0;else if(this.player_.remainingTimeDisplay)e=this.player_.remainingTimeDisplay();else e=this.player_.remainingTime();this.updateTextNode_(e)}}Xm.prototype.labelText_="Remaining Time";Xm.prototype.controlText_="Remaining Time";bt.registerComponent("RemainingTimeDisplay",Xm);class py extends bt{constructor(t,e){super(t,e);this.updateShowing(),this.on(this.player(),"durationchange",(a)=>this.updateShowing(a))}createEl(){let t=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=he("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(he("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(Ot.default.createTextNode(this.localize("LIVE"))),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,super.dispose()}updateShowing(t){if(this.player().duration()===1/0)this.show();else this.hide()}}bt.registerComponent("LiveDisplay",py);class d7 extends Li{constructor(t,e){super(t,e);if(this.updateLiveEdgeStatus(),this.player_.liveTracker)this.updateLiveEdgeStatusHandler_=(a)=>this.updateLiveEdgeStatus(a),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_)}createEl(){let t=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",t),this.textEl_=he("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),t.appendChild(this.textEl_),t}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()}}d7.prototype.controlText_="Seek to live, currently playing live";bt.registerComponent("SeekToLive",d7);function R2(t,e,a){return t=Number(t),Math.min(a,Math.max(e,isNaN(t)?e:t))}var Ux=Object.freeze({__proto__:null,clamp:R2});class Km extends bt{constructor(t,e){super(t,e);this.handleMouseDown_=(a)=>this.handleMouseDown(a),this.handleMouseUp_=(a)=>this.handleMouseUp(a),this.handleKeyDown_=(a)=>this.handleKeyDown(a),this.handleClick_=(a)=>this.handleClick(a),this.handleMouseMove_=(a)=>this.handleMouseMove(a),this.update_=(a)=>this.update(a),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 t=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(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent)this.off(this.player_,this.playerEvent,this.update);this.enabled_=!1}createEl(t,e={},a={}){return e.className=e.className+" vjs-slider",e=Object.assign({tabIndex:0},e),a=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},a),super.createEl(t,e,a)}handleMouseDown(t){let e=this.bar.el_.ownerDocument;if(t.type==="mousedown")t.preventDefault();if(t.type==="touchstart"&&!A0)t.preventDefault();IS(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(e,"mousemove",this.handleMouseMove_),this.on(e,"mouseup",this.handleMouseUp_),this.on(e,"touchmove",this.handleMouseMove_),this.on(e,"touchend",this.handleMouseUp_),this.handleMouseMove(t,!0)}handleMouseMove(t){}handleMouseUp(t){let e=this.bar.el_.ownerDocument;GS(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),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.update()}update(){if(!this.el_||!this.bar)return;let t=this.getProgress();if(t===this.progress_)return t;return this.progress_=t,this.requestNamedAnimationFrame("Slider#update",()=>{let e=this.vertical()?"height":"width";this.bar.el().style[e]=(t*100).toFixed(2)+"%"}),t}getProgress(){return Number(R2(this.getPercent(),0,1).toFixed(4))}calculateDistance(t){let e=Dm(this.el_,t);if(this.vertical())return e.y;return e.x}handleKeyDown(t){let e=this.options_.playerOptions.spatialNavigation,a=e&&e.enabled,i=e&&e.horizontalSeek;if(a)if(i&&t.key==="ArrowLeft"||!i&&t.key==="ArrowDown")t.preventDefault(),t.stopPropagation(),this.stepBack();else if(i&&t.key==="ArrowRight"||!i&&t.key==="ArrowUp")t.preventDefault(),t.stopPropagation(),this.stepForward();else{if(this.pendingSeekTime())this.pendingSeekTime(null),this.userSeek_(this.player_.currentTime());super.handleKeyDown(t)}else if(t.key==="ArrowLeft"||t.key==="ArrowDown")t.preventDefault(),t.stopPropagation(),this.stepBack();else if(t.key==="ArrowUp"||t.key==="ArrowRight")t.preventDefault(),t.stopPropagation(),this.stepForward();else super.handleKeyDown(t)}handleClick(t){t.stopPropagation(),t.preventDefault()}vertical(t){if(t===void 0)return this.vertical_||!1;if(this.vertical_=!!t,this.vertical_)this.addClass("vjs-slider-vertical");else this.addClass("vjs-slider-horizontal")}}bt.registerComponent("Slider",Km);var Ag=(t,e)=>R2(t/e*100,0,100).toFixed(2)+"%";class wy extends bt{constructor(t,e){super(t,e);this.partEls_=[],this.on(t,"progress",(a)=>this.update(a))}createEl(){let t=super.createEl("div",{className:"vjs-load-progress"}),e=he("span",{className:"vjs-control-text"}),a=he("span",{textContent:this.localize("Loaded")}),i=Ot.default.createTextNode(": ");return this.percentageEl_=he("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),t.appendChild(e),e.appendChild(a),e.appendChild(i),e.appendChild(this.percentageEl_),t}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(t){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{let e=this.player_.liveTracker,a=this.player_.buffered(),i=e&&e.isLive()?e.seekableEnd():this.player_.duration(),s=this.player_.bufferedEnd(),n=this.partEls_,l=Ag(s,i);if(this.percent_!==l)this.el_.style.width=l,kl(this.percentageEl_,l),this.percent_=l;for(let f=0;f<a.length;f++){let o=a.start(f),c=a.end(f),u=n[f];if(!u)u=this.el_.appendChild(he()),n[f]=u;if(u.dataset.start===o&&u.dataset.end===c)continue;u.dataset.start=o,u.dataset.end=c,u.style.left=Ag(o,s),u.style.width=Ag(c-o,s)}for(let f=n.length;f>a.length;f--)this.el_.removeChild(n[f-1]);n.length=a.length})}}bt.registerComponent("LoadProgressBar",wy);class jy extends bt{constructor(t,e){super(t,e);this.update=v0(qa(this,this.update),Cn)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(t,e,a){let i=O2(this.el_),s=Po(this.player_.el()),n=t.width*e;if(!s||!i)return;let l=t.left-s.left+n,f=t.width-n+(s.right-t.right);if(!f)f=t.width-n,l=n;let o=i.width/2;if(l<o)o+=o-l;else if(f<o)o=f;if(o<0)o=0;else if(o>i.width)o=i.width;o=Math.round(o),this.el_.style.right=`-${o}px`,this.write(a)}write(t){kl(this.el_,t)}updateTime(t,e,a,i){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let s,n=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){let l=this.player_.liveTracker.liveWindow(),f=l-e*l;s=(f<1?"":"-")+Qf(f,l)}else s=Qf(a,n);if(this.update(t,e,s),i)i()})}}bt.registerComponent("TimeTooltip",jy);class Lm extends bt{constructor(t,e){super(t,e);this.setIcon("circle"),this.update=v0(qa(this,this.update),Cn)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(t,e,a){let i=this.getChild("timeTooltip");if(!i)return;let s=a&&a.target&&typeof a.target.pendingSeekTime==="function"?a.target.pendingSeekTime():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(t,e,s)}}Lm.prototype.options_={children:[]};if(!as&&!Qn)Lm.prototype.options_.children.push("timeTooltip");bt.registerComponent("PlayProgressBar",Lm);class q7 extends bt{constructor(t,e){super(t,e);this.update=v0(qa(this,this.update),Cn)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(t,e){let a=e*this.player_.duration();this.getChild("timeTooltip").updateTime(t,e,a,()=>{this.el_.style.left=`${t.width*e}px`})}}q7.prototype.options_={children:["timeTooltip"]};bt.registerComponent("MouseTimeDisplay",q7);class Vm extends Km{constructor(t,e){e=ga(Vm.prototype.options_,e),e.children=[...e.children];let a=t.options_.disableSeekWhileScrubbingOnMobile&&(as||Qn)||t.options_.disableSeekWhileScrubbingOnSTV;if(!as&&!Qn||a)e.children.splice(1,0,"mouseTimeDisplay");super(t,e);this.shouldDisableSeekWhileScrubbing_=a,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){if(this.update_=qa(this,this.update),this.update=v0(this.update_,Cn),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_=(t)=>this.enableInterval_(t),this.disableIntervalHandler_=(t)=>this.disableInterval_(t),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in Ot.default&&"visibilityState"in Ot.default)this.on(Ot.default,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(t){if(Ot.default.visibilityState==="hidden")this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(t);else{if(!this.player_.ended()&&!this.player_.paused())this.enableInterval_();this.update()}}enableInterval_(){if(this.updateInterval)return;this.updateInterval=this.setInterval(this.update,Cn)}disableInterval_(t){if(this.player_.liveTracker&&this.player_.liveTracker.isLive()&&t&&t.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(t){if(Ot.default.visibilityState==="hidden")return;let e=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{let a=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),i=this.player_.liveTracker,s=this.player_.duration();if(i&&i.isLive())s=this.player_.liveTracker.liveCurrentTime();if(this.percent_!==e)this.el_.setAttribute("aria-valuenow",(e*100).toFixed(2)),this.percent_=e;if(this.currentTime_!==a||this.duration_!==s)this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Qf(a,s),Qf(s,s)],"{1} of {2}")),this.currentTime_=a,this.duration_=s;if(this.bar)this.bar.update(Po(this.el()),this.getProgress(),t)}),e}userSeek_(t){if(this.player_.liveTracker&&this.player_.liveTracker.isLive())this.player_.liveTracker.nextSeekedFromUser();this.player_.currentTime(t)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}pendingSeekTime(t){if(t!==void 0)if(t!==null){let e=this.player_.duration();this.pendingSeekTime_=Math.max(0,Math.min(t,e))}else this.pendingSeekTime_=null;return this.pendingSeekTime_}getPercent(){if(this.pendingSeekTime()!==null)return this.pendingSeekTime()/this.player_.duration();let t=this.getCurrentTime_(),e,a=this.player_.liveTracker;if(a&&a.isLive()){if(e=(t-a.seekableStart())/a.liveWindow(),a.atLiveEdge())e=1}else e=t/this.player_.duration();return e}handleMouseDown(t){if(!H2(t))return;if(t.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),!this.shouldDisableSeekWhileScrubbing_)this.player_.pause();super.handleMouseDown(t)}handleMouseMove(t,e=!1){if(!H2(t)||isNaN(this.player_.duration()))return;if(!e&&!this.player_.scrubbing())this.player_.scrubbing(!0);let a,i=this.calculateDistance(t),s=this.player_.liveTracker;if(!s||!s.isLive()){if(a=i*this.player_.duration(),a===this.player_.duration())a=a-0.1}else{if(i>=0.99){s.seekToLiveEdge();return}let n=s.seekableStart(),l=s.liveCurrentTime();if(a=n+i*s.liveWindow(),a>=l)a=l;if(a<=n)a=n+0.1;if(a===1/0)return}if(this.shouldDisableSeekWhileScrubbing_)this.pendingSeekTime(a);else this.userSeek_(a);if(this.player_.options_.enableSmoothSeeking)this.update()}enable(){super.enable();let t=this.getChild("mouseTimeDisplay");if(!t)return;t.show()}disable(){super.disable();let t=this.getChild("mouseTimeDisplay");if(!t)return;t.hide()}handleMouseUp(t){if(super.handleMouseUp(t),t)t.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)p0(this.player_.play());else this.update_()}handlePendingSeek_(t){if(!this.player_.paused())this.player_.pause();let e=this.pendingSeekTime()!==null?this.pendingSeekTime():this.player_.currentTime();this.pendingSeekTime(e+t),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(t){if(this.pendingSeekTime()!==null)this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null);if(this.player_.paused())this.player_.play();else this.player_.pause()}handleKeyDown(t){let e=this.player_.liveTracker;if(t.key===" "||t.key==="Enter")t.preventDefault(),t.stopPropagation(),this.handleAction(t);else if(t.key==="Home")t.preventDefault(),t.stopPropagation(),this.userSeek_(0);else if(t.key==="End")if(t.preventDefault(),t.stopPropagation(),e&&e.isLive())this.userSeek_(e.liveCurrentTime());else this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(t.key)){t.preventDefault(),t.stopPropagation();let a=parseInt(t.key,10)*0.1;if(e&&e.isLive())this.userSeek_(e.seekableStart()+e.liveWindow()*a);else this.userSeek_(this.player_.duration()*a)}else if(t.key==="PageDown")t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()-this.options().stepSeconds*this.options().pageMultiplier);else if(t.key==="PageUp")t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()+this.options().stepSeconds*this.options().pageMultiplier);else super.handleKeyDown(t)}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 Ot.default&&"visibilityState"in Ot.default)this.off(Ot.default,"visibilitychange",this.toggleVisibility_);super.dispose()}}Vm.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar",stepSeconds:5,pageMultiplier:12};bt.registerComponent("SeekBar",Vm);class A7 extends bt{constructor(t,e){super(t,e);this.handleMouseMove=v0(qa(this,this.handleMouseMove),Cn),this.throttledHandleMouseSeek=v0(qa(this,this.handleMouseSeek),Cn),this.handleMouseUpHandler_=(a)=>this.handleMouseUp(a),this.handleMouseDownHandler_=(a)=>this.handleMouseDown(a),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(t){let e=this.getChild("seekBar");if(!e)return;let a=e.getChild("playProgressBar"),i=e.getChild("mouseTimeDisplay");if(!a&&!i)return;let s=e.el(),n=O2(s),l=Dm(s,t).x;if(l=R2(l,0,1),i)i.update(n,l);if(a)a.update(n,e.getProgress())}handleMouseSeek(t){let e=this.getChild("seekBar");if(e)e.handleMouseMove(t)}enabled(){return this.enabled_}disable(){if(this.children().forEach((t)=>t.disable&&t.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 t=this.getChild("seekBar");if(this.player_.scrubbing(!1),t.videoWasPlaying)p0(this.player_.play())}}enable(){if(this.children().forEach((t)=>t.enable&&t.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 t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseSeek),this.off(t,"touchmove",this.throttledHandleMouseSeek),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseDown(t){let e=this.el_.ownerDocument,a=this.getChild("seekBar");if(a)a.handleMouseDown(t);this.on(e,"mousemove",this.throttledHandleMouseSeek),this.on(e,"touchmove",this.throttledHandleMouseSeek),this.on(e,"mouseup",this.handleMouseUpHandler_),this.on(e,"touchend",this.handleMouseUpHandler_)}handleMouseUp(t){let e=this.getChild("seekBar");if(e)e.handleMouseUp(t);this.removeListenersAddedOnMousedownAndTouchstart()}}A7.prototype.options_={children:["seekBar"]};bt.registerComponent("ProgressControl",A7);class v7 extends Li{constructor(t,e){super(t,e);this.setIcon("picture-in-picture-enter"),this.on(t,["enterpictureinpicture","leavepictureinpicture"],(a)=>this.handlePictureInPictureChange(a)),this.on(t,["disablepictureinpicturechanged","loadedmetadata"],(a)=>this.handlePictureInPictureEnabledChange(a)),this.on(t,["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(Ot.default.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in $.default)this.enable();else this.disable()}handlePictureInPictureChange(t){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(t){if(!this.player_.isInPictureInPicture())this.player_.requestPictureInPicture();else this.player_.exitPictureInPicture()}show(){if(typeof Ot.default.exitPictureInPicture!=="function")return;super.show()}}v7.prototype.controlText_="Picture-in-Picture";bt.registerComponent("PictureInPictureToggle",v7);class S7 extends Li{constructor(t,e){super(t,e);if(this.setIcon("fullscreen-enter"),this.on(t,"fullscreenchange",(a)=>this.handleFullscreenChange(a)),Ot.default[t.fsApi_.fullscreenEnabled]===!1)this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(t){if(this.player_.isFullscreen())this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit");else this.controlText("Fullscreen"),this.setIcon("fullscreen-enter")}handleClick(t){if(!this.player_.isFullscreen())this.player_.requestFullscreen();else this.player_.exitFullscreen()}}S7.prototype.controlText_="Fullscreen";bt.registerComponent("FullscreenToggle",S7);var Ix=function(t,e){if(e.tech_&&!e.tech_.featuresVolumeControl)t.addClass("vjs-hidden");t.on(e,"loadstart",function(){if(!e.tech_.featuresVolumeControl)t.addClass("vjs-hidden");else t.removeClass("vjs-hidden")})};class dy extends bt{createEl(){let t=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",t),t.appendChild(super.createEl("span",{className:"vjs-control-text"})),t}}bt.registerComponent("VolumeLevel",dy);class qy extends bt{constructor(t,e){super(t,e);this.update=v0(qa(this,this.update),Cn)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(t,e,a,i){if(!a){let s=Po(this.el_),n=Po(this.player_.el()),l=t.width*e;if(!n||!s)return;let f=t.left-n.left+l,o=t.width-l+(n.right-t.right),c=s.width/2;if(f<c)c+=c-f;else if(o<c)c=o;if(c<0)c=0;else if(c>s.width)c=s.width;this.el_.style.right=`-${c}px`}this.write(`${i}%`)}write(t){kl(this.el_,t)}updateVolume(t,e,a,i,s){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{if(this.update(t,e,a,i.toFixed(0)),s)s()})}}bt.registerComponent("VolumeLevelTooltip",qy);class y7 extends bt{constructor(t,e){super(t,e);this.update=v0(qa(this,this.update),Cn)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(t,e,a){let i=100*e;this.getChild("volumeLevelTooltip").updateVolume(t,e,a,i,()=>{if(a)this.el_.style.bottom=`${t.height*e}px`;else this.el_.style.left=`${t.width*e}px`})}}y7.prototype.options_={children:["volumeLevelTooltip"]};bt.registerComponent("MouseVolumeLevelDisplay",y7);class N2 extends Km{constructor(t,e){super(t,e);this.on("slideractive",(a)=>this.updateLastVolume_(a)),this.on(t,"volumechange",(a)=>this.updateARIAAttributes(a)),t.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(t){if(!H2(t))return;super.handleMouseDown(t)}handleMouseMove(t){let e=this.getChild("mouseVolumeLevelDisplay");if(e){let a=this.el(),i=Po(a),s=this.vertical(),n=Dm(a,t);n=s?n.y:n.x,n=R2(n,0,1),e.update(i,n,s)}if(!H2(t))return;this.checkMuted(),this.player_.volume(this.calculateDistance(t))}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(t){let e=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",e),this.el_.setAttribute("aria-valuetext",e+"%")}volumeAsPercentage_(){return Math.round(this.player_.volume()*100)}updateLastVolume_(){let t=this.player_.volume();this.one("sliderinactive",()=>{if(this.player_.volume()===0)this.player_.lastVolume_(t)})}}N2.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};if(!as&&!Qn)N2.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");N2.prototype.playerEvent="volumechange";bt.registerComponent("VolumeBar",N2);class k7 extends bt{constructor(t,e={}){if(e.vertical=e.vertical||!1,typeof e.volumeBar>"u"||$o(e.volumeBar))e.volumeBar=e.volumeBar||{},e.volumeBar.vertical=e.vertical;super(t,e);Ix(this,t),this.throttledHandleMouseMove=v0(qa(this,this.handleMouseMove),Cn),this.handleMouseUpHandler_=(a)=>this.handleMouseUp(a),this.on("mousedown",(a)=>this.handleMouseDown(a)),this.on("touchstart",(a)=>this.handleMouseDown(a)),this.on("mousemove",(a)=>this.handleMouseMove(a)),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 t="vjs-volume-horizontal";if(this.options_.vertical)t="vjs-volume-vertical";return super.createEl("div",{className:`vjs-volume-control vjs-control ${t}`})}handleMouseDown(t){let e=this.el_.ownerDocument;this.on(e,"mousemove",this.throttledHandleMouseMove),this.on(e,"touchmove",this.throttledHandleMouseMove),this.on(e,"mouseup",this.handleMouseUpHandler_),this.on(e,"touchend",this.handleMouseUpHandler_)}handleMouseUp(t){let e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseMove),this.off(e,"touchmove",this.throttledHandleMouseMove),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseMove(t){this.volumeBar.handleMouseMove(t)}}k7.prototype.options_={children:["volumeBar"]};bt.registerComponent("VolumeControl",k7);var Gx=function(t,e){if(e.tech_&&!e.tech_.featuresMuteControl)t.addClass("vjs-hidden");t.on(e,"loadstart",function(){if(!e.tech_.featuresMuteControl)t.addClass("vjs-hidden");else t.removeClass("vjs-hidden")})};class C7 extends Li{constructor(t,e){super(t,e);Gx(this,t),this.on(t,["loadstart","volumechange"],(a)=>this.update(a))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(t){let e=this.player_.volume(),a=this.player_.lastVolume_();if(e===0){let i=a<0.1?0.1:a;this.player_.volume(i),this.player_.muted(!1)}else this.player_.muted(this.player_.muted()?!1:!0)}update(t){this.updateIcon_(),this.updateControlText_()}updateIcon_(){let t=this.player_.volume(),e=3;if(this.setIcon("volume-high"),as&&this.player_.tech_&&this.player_.tech_.el_)this.player_.muted(this.player_.tech_.el_.muted);if(t===0||this.player_.muted())this.setIcon("volume-mute"),e=0;else if(t<0.33)this.setIcon("volume-low"),e=1;else if(t<0.67)this.setIcon("volume-medium"),e=2;Hm(this.el_,[0,1,2,3].reduce((a,i)=>a+`${i?" ":""}vjs-vol-${i}`,"")),Vf(this.el_,`vjs-vol-${e}`)}updateControlText_(){let e=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";if(this.controlText()!==e)this.controlText(e)}}C7.prototype.controlText_="Mute";bt.registerComponent("MuteToggle",C7);class _7 extends bt{constructor(t,e={}){if(typeof e.inline<"u")e.inline=e.inline;else e.inline=!0;if(typeof e.volumeControl>"u"||$o(e.volumeControl))e.volumeControl=e.volumeControl||{},e.volumeControl.vertical=!e.inline;super(t,e);this.handleKeyPressHandler_=(a)=>this.handleKeyPress(a),this.on(t,["loadstart"],(a)=>this.volumePanelState_(a)),this.on(this.muteToggle,"keyup",(a)=>this.handleKeyPress(a)),this.on(this.volumeControl,"keyup",(a)=>this.handleVolumeControlKeyUp(a)),this.on("keydown",(a)=>this.handleKeyPress(a)),this.on("mouseover",(a)=>this.handleMouseOver(a)),this.on("mouseout",(a)=>this.handleMouseOut(a)),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 t="vjs-volume-panel-horizontal";if(!this.options_.inline)t="vjs-volume-panel-vertical";return super.createEl("div",{className:`vjs-volume-panel vjs-control ${t}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(t){if(t.key==="Escape")this.muteToggle.focus()}handleMouseOver(t){this.addClass("vjs-hover"),an(Ot.default,"keyup",this.handleKeyPressHandler_)}handleMouseOut(t){this.removeClass("vjs-hover"),is(Ot.default,"keyup",this.handleKeyPressHandler_)}handleKeyPress(t){if(t.key==="Escape")this.handleMouseOut()}}_7.prototype.options_={children:["muteToggle","volumeControl"]};bt.registerComponent("VolumePanel",_7);class F7 extends Li{constructor(t,e){super(t,e);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(t.language())])),this.show();else this.hide()}getSkipForwardTime(){let t=this.options_.playerOptions;return t.controlBar&&t.controlBar.skipButtons&&t.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(t){if(isNaN(this.player_.duration()))return;let e=this.player_.currentTime(),a=this.player_.liveTracker,i=a&&a.isLive()?a.seekableEnd():this.player_.duration(),s;if(e+this.skipTime<=i)s=e+this.skipTime;else s=i;this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}F7.prototype.controlText_="Skip Forward";bt.registerComponent("SkipForward",F7);class B7 extends Li{constructor(t,e){super(t,e);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(t.language())])),this.show();else this.hide()}getSkipBackwardTime(){let t=this.options_.playerOptions;return t.controlBar&&t.controlBar.skipButtons&&t.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(t){let e=this.player_.currentTime(),a=this.player_.liveTracker,i=a&&a.isLive()&&a.seekableStart(),s;if(i&&e-this.skipTime<=i)s=i;else if(e>=this.skipTime)s=e-this.skipTime;else s=0;this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}B7.prototype.controlText_="Skip Backward";bt.registerComponent("SkipBackward",B7);class O7 extends bt{constructor(t,e){super(t,e);if(e)this.menuButton_=e.menuButton;this.focusedChild_=-1,this.on("keydown",(a)=>this.handleKeyDown(a)),this.boundHandleBlur_=(a)=>this.handleBlur(a),this.boundHandleTapClick_=(a)=>this.handleTapClick(a)}addEventListenerForItem(t){if(!(t instanceof bt))return;this.on(t,"blur",this.boundHandleBlur_),this.on(t,["tap","click"],this.boundHandleTapClick_)}removeEventListenerForItem(t){if(!(t instanceof bt))return;this.off(t,"blur",this.boundHandleBlur_),this.off(t,["tap","click"],this.boundHandleTapClick_)}removeChild(t){if(typeof t==="string")t=this.getChild(t);this.removeEventListenerForItem(t),super.removeChild(t)}addItem(t){let e=this.addChild(t);if(e)this.addEventListenerForItem(e)}createEl(){let t=this.options_.contentElType||"ul";this.contentEl_=he(t,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");let e=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return e.appendChild(this.contentEl_),an(e,"click",function(a){a.preventDefault(),a.stopImmediatePropagation()}),e}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(t){let e=t.relatedTarget||Ot.default.activeElement;if(!this.children().some((a)=>{return a.el()===e})){let a=this.menuButton_;if(a&&a.buttonPressed_&&e!==a.el().firstChild)a.unpressButton()}}handleTapClick(t){if(this.menuButton_){this.menuButton_.unpressButton();let e=this.children();if(!Array.isArray(e))return;let a=e.filter((i)=>i.el()===t.target)[0];if(!a)return;if(a.name()!=="CaptionSettingsMenuItem")this.menuButton_.focus()}}handleKeyDown(t){if(t.key==="ArrowLeft"||t.key==="ArrowDown")t.preventDefault(),t.stopPropagation(),this.stepForward();else if(t.key==="ArrowRight"||t.key==="ArrowUp")t.preventDefault(),t.stopPropagation(),this.stepBack()}stepForward(){let t=0;if(this.focusedChild_!==void 0)t=this.focusedChild_+1;this.focus(t)}stepBack(){let t=0;if(this.focusedChild_!==void 0)t=this.focusedChild_-1;this.focus(t)}focus(t=0){let e=this.children().slice();if(e.length&&e[0].hasClass("vjs-menu-title"))e.shift();if(e.length>0){if(t<0)t=0;else if(t>=e.length)t=e.length-1;this.focusedChild_=t,e[t].el_.focus()}}}bt.registerComponent("Menu",O7);class Ym extends bt{constructor(t,e={}){super(t,e);this.menuButton_=new Li(t,e),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");let a=Li.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+a,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;let i=(s)=>this.handleClick(s);this.handleMenuKeyUp_=(s)=>this.handleMenuKeyUp(s),this.on(this.menuButton_,"tap",i),this.on(this.menuButton_,"click",i),this.on(this.menuButton_,"keydown",(s)=>this.handleKeyDown(s)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),an(Ot.default,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",(s)=>this.handleMouseLeave(s)),this.on("keydown",(s)=>this.handleSubmenuKeyDown(s))}update(){let t=this.createMenu();if(this.menu)this.menu.dispose(),this.removeChild(this.menu);if(this.menu=t,this.addChild(t),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 t=new O7(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){let e=he("li",{className:"vjs-menu-title",textContent:Va(this.options_.title),tabIndex:-1}),a=new bt(this.player_,{el:e});t.addItem(a)}if(this.items=this.createItems(),this.items)for(let e=0;e<this.items.length;e++)t.addItem(this.items[e]);return t}createItems(){}createEl(){return super.createEl("div",{className:this.buildWrapperCSSClass()},{})}setIcon(t){return super.setIcon(t,this.menuButton_.el_)}buildWrapperCSSClass(){let t="vjs-menu-button";if(this.options_.inline===!0)t+="-inline";else t+="-popup";let e=Li.prototype.buildCSSClass();return`vjs-menu-button ${t} ${e} ${super.buildCSSClass()}`}buildCSSClass(){let t="vjs-menu-button";if(this.options_.inline===!0)t+="-inline";else t+="-popup";return`vjs-menu-button ${t} ${super.buildCSSClass()}`}controlText(t,e=this.menuButton_.el()){return this.menuButton_.controlText(t,e)}dispose(){this.handleMouseLeave(),super.dispose()}handleClick(t){if(this.buttonPressed_)this.unpressButton();else this.pressButton()}handleMouseLeave(t){this.removeClass("vjs-hover"),is(Ot.default,"keyup",this.handleMenuKeyUp_)}focus(){this.menuButton_.focus()}blur(){this.menuButton_.blur()}handleKeyDown(t){if(t.key==="Escape"||t.key==="Tab"){if(this.buttonPressed_)this.unpressButton();if(!t.key==="Tab")t.preventDefault(),this.menuButton_.focus()}else if(t.key==="Up"||t.key==="Down"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)){if(!this.buttonPressed_)t.preventDefault(),this.pressButton()}}handleMenuKeyUp(t){if(t.key==="Escape"||t.key==="Tab")this.removeClass("vjs-hover")}handleSubmenuKeyPress(t){this.handleSubmenuKeyDown(t)}handleSubmenuKeyDown(t){if(t.key==="Escape"||t.key==="Tab"){if(this.buttonPressed_)this.unpressButton();if(!t.key==="Tab")t.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"),as&&NS())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()}}bt.registerComponent("MenuButton",Ym);class Jm extends Ym{constructor(t,e){let a=e.tracks;super(t,e);if(this.items.length<=1)this.hide();if(!a)return;let i=qa(this,this.update);a.addEventListener("removetrack",i),a.addEventListener("addtrack",i),a.addEventListener("labelchange",i),this.player_.on("ready",i),this.player_.on("dispose",function(){a.removeEventListener("removetrack",i),a.removeEventListener("addtrack",i),a.removeEventListener("labelchange",i)})}}bt.registerComponent("TrackButton",Jm);class lh extends T2{constructor(t,e){super(t,e);if(this.selectable=e.selectable,this.isSelected_=e.selected||!1,this.multiSelectable=e.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(t,e,a){this.nonIconControl=!0;let i=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},e),a),s=he("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)});if(this.player_.options_.experimentalSvgIcons)i.appendChild(s);else i.replaceChild(s,i.querySelector(".vjs-icon-placeholder"));return i}handleKeyDown(t){if(!["Tab","Escape","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"].includes(t.key))super.handleKeyDown(t)}handleClick(t){this.selected(!0)}selected(t){if(this.selectable)if(t)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}}bt.registerComponent("MenuItem",lh);class fh extends lh{constructor(t,e){let a=e.track,i=t.textTracks();e.label=a.label||a.language||"Unknown",e.selected=a.mode==="showing";super(t,e);this.track=a,this.kinds=(e.kinds||[e.kind||this.track.kind]).filter(Boolean);let s=(...l)=>{this.handleTracksChange.apply(this,l)},n=(...l)=>{this.handleSelectedLanguageChange.apply(this,l)};if(t.on(["loadstart","texttrackchange"],s),i.addEventListener("change",s),i.addEventListener("selectedlanguagechange",n),this.on("dispose",function(){t.off(["loadstart","texttrackchange"],s),i.removeEventListener("change",s),i.removeEventListener("selectedlanguagechange",n)}),i.onchange===void 0){let l;this.on(["tap","click"],function(){if(typeof $.default.Event!=="object")try{l=new $.default.Event("change")}catch(f){}if(!l)l=Ot.default.createEvent("Event"),l.initEvent("change",!0,!0);i.dispatchEvent(l)})}this.handleTracksChange()}handleClick(t){let e=this.track,a=this.player_.textTracks();if(super.handleClick(t),!a)return;for(let i=0;i<a.length;i++){let s=a[i];if(this.kinds.indexOf(s.kind)===-1)continue;if(s===e){if(s.mode!=="showing")s.mode="showing"}else if(s.mode!=="disabled")s.mode="disabled"}}handleTracksChange(t){let e=this.track.mode==="showing";if(e!==this.isSelected_)this.selected(e)}handleSelectedLanguageChange(t){if(this.track.mode==="showing"){let e=this.player_.cache_.selectedLanguage;if(e&&e.enabled&&e.language===this.track.language&&e.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()}}bt.registerComponent("TextTrackMenuItem",fh);class H7 extends fh{constructor(t,e){if(e.track={player:t,kind:e.kind,kinds:e.kinds,default:!1,mode:"disabled"},!e.kinds)e.kinds=[e.kind];if(e.label)e.track.label=e.label;else e.track.label=e.kinds.join(" and ")+" off";e.selectable=!0,e.multiSelectable=!1;super(t,e)}handleTracksChange(t){let e=this.player().textTracks(),a=!0;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(this.options_.kinds.indexOf(n.kind)>-1&&n.mode==="showing"){a=!1;break}}if(a!==this.isSelected_)this.selected(a)}handleSelectedLanguageChange(t){let e=this.player().textTracks(),a=!0;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(["captions","descriptions","subtitles"].indexOf(n.kind)>-1&&n.mode==="showing"){a=!1;break}}if(a)this.player_.cache_.selectedLanguage={enabled:!1}}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}bt.registerComponent("OffTextTrackMenuItem",H7);class Wf extends Jm{constructor(t,e={}){e.tracks=t.textTracks();super(t,e)}createItems(t=[],e=fh){let a;if(this.label_)a=`${this.label_} off`;t.push(new H7(this.player_,{kinds:this.kinds_,kind:this.kind_,label:a})),this.hideThreshold_+=1;let i=this.player_.textTracks();if(!Array.isArray(this.kinds_))this.kinds_=[this.kind_];for(let s=0;s<i.length;s++){let n=i[s];if(this.kinds_.indexOf(n.kind)>-1){let l=new e(this.player_,{track:n,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});l.addClass(`vjs-${n.kind}-menu-item`),t.push(l)}}return t}}bt.registerComponent("TextTrackButton",Wf);class M7 extends lh{constructor(t,e){let{track:a,cue:i}=e,s=t.currentTime();e.selectable=!0,e.multiSelectable=!1,e.label=i.text,e.selected=i.startTime<=s&&s<i.endTime;super(t,e);this.track=a,this.cue=i}handleClick(t){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}bt.registerComponent("ChaptersTrackMenuItem",M7);class Qm extends Wf{constructor(t,e,a){super(t,e,a);this.setIcon("chapters"),this.selectCurrentItem_=()=>{this.items.forEach((i)=>{i.selected(this.track_.activeCues[0]===i.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(t){if(t&&t.track&&t.track.kind!=="chapters")return;let e=this.findChaptersTrack();if(e!==this.track_)this.setTrack(e),super.update();else if(!this.items||e&&e.cues&&e.cues.length!==this.items.length)super.update()}setTrack(t){if(this.track_===t)return;if(!this.updateHandler_)this.updateHandler_=this.update.bind(this);if(this.track_){let e=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);if(e)e.removeEventListener("load",this.updateHandler_);this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=t,this.track_){this.track_.mode="hidden";let e=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);if(e)e.addEventListener("load",this.updateHandler_);this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}findChaptersTrack(){let t=this.player_.textTracks()||[];for(let e=t.length-1;e>=0;e--){let a=t[e];if(a.kind===this.kind_)return a}}getMenuCaption(){if(this.track_&&this.track_.label)return this.track_.label;return this.localize(Va(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){let t=[];if(!this.track_)return t;let e=this.track_.cues;if(!e)return t;for(let a=0,i=e.length;a<i;a++){let s=e[a],n=new M7(this.player_,{track:this.track_,cue:s});t.push(n)}return t}}Qm.prototype.kind_="chapters";Qm.prototype.controlText_="Chapters";bt.registerComponent("ChaptersButton",Qm);class Zm extends Wf{constructor(t,e,a){super(t,e,a);this.setIcon("audio-description");let i=t.textTracks(),s=qa(this,this.handleTracksChange);i.addEventListener("change",s),this.on("dispose",function(){i.removeEventListener("change",s)})}handleTracksChange(t){let e=this.player().textTracks(),a=!1;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.kind!==this.kind_&&n.mode==="showing"){a=!0;break}}if(a)this.disable();else this.enable()}buildCSSClass(){return`vjs-descriptions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-descriptions-button ${super.buildWrapperCSSClass()}`}}Zm.prototype.kind_="descriptions";Zm.prototype.controlText_="Descriptions";bt.registerComponent("DescriptionsButton",Zm);class $m extends Wf{constructor(t,e,a){super(t,e,a);this.setIcon("subtitles")}buildCSSClass(){return`vjs-subtitles-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subtitles-button ${super.buildWrapperCSSClass()}`}}$m.prototype.kind_="subtitles";$m.prototype.controlText_="Subtitles";bt.registerComponent("SubtitlesButton",$m);class Wm extends fh{constructor(t,e){e.track={player:t,kind:e.kind,label:e.kind+" settings",selectable:!1,default:!1,mode:"disabled"},e.selectable=!1,e.name="CaptionSettingsMenuItem";super(t,e);this.addClass("vjs-texttrack-settings"),this.controlText(", opens "+e.kind+" settings dialog")}handleClick(t){this.player().getChild("textTrackSettings").open()}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.kind+" settings"),super.handleLanguagechange()}}bt.registerComponent("CaptionSettingsMenuItem",Wm);class Pm extends Wf{constructor(t,e,a){super(t,e,a);this.setIcon("captions")}buildCSSClass(){return`vjs-captions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-captions-button ${super.buildWrapperCSSClass()}`}createItems(){let t=[];if(!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings"))t.push(new Wm(this.player_,{kind:this.kind_})),this.hideThreshold_+=1;return super.createItems(t)}}Pm.prototype.kind_="captions";Pm.prototype.controlText_="Captions";bt.registerComponent("CaptionsButton",Pm);class D7 extends fh{createEl(t,e,a){let i=super.createEl(t,e,a),s=i.querySelector(".vjs-menu-item-text");if(this.options_.track.kind==="captions"){if(this.player_.options_.experimentalSvgIcons)this.setIcon("captions",i);else s.appendChild(he("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0}));s.appendChild(he("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))}return i}}bt.registerComponent("SubsCapsMenuItem",D7);class t3 extends Wf{constructor(t,e={}){super(t,e);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(Va(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let t=[];if(!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings"))t.push(new Wm(this.player_,{kind:this.label_})),this.hideThreshold_+=1;return t=super.createItems(t,D7),t}}t3.prototype.kinds_=["captions","subtitles"];t3.prototype.controlText_="Subtitles";bt.registerComponent("SubsCapsButton",t3);class T7 extends lh{constructor(t,e){let a=e.track,i=t.audioTracks();e.label=a.label||a.language||"Unknown",e.selected=a.enabled;super(t,e);this.track=a,this.addClass(`vjs-${a.kind}-menu-item`);let s=(...n)=>{this.handleTracksChange.apply(this,n)};i.addEventListener("change",s),this.on("dispose",()=>{i.removeEventListener("change",s)})}createEl(t,e,a){let i=super.createEl(t,e,a),s=i.querySelector(".vjs-menu-item-text");if(["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0)s.appendChild(he("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),s.appendChild(he("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}));return i}handleClick(t){if(super.handleClick(t),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){let e=this.player_.audioTracks();for(let a=0;a<e.length;a++){let i=e[a];if(i===this.track)continue;i.enabled=i===this.track}}}handleTracksChange(t){this.selected(this.track.enabled)}}bt.registerComponent("AudioTrackMenuItem",T7);class R7 extends Jm{constructor(t,e={}){e.tracks=t.audioTracks();super(t,e);this.setIcon("audio")}buildCSSClass(){return`vjs-audio-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-audio-button ${super.buildWrapperCSSClass()}`}createItems(t=[]){this.hideThreshold_=1;let e=this.player_.audioTracks();for(let a=0;a<e.length;a++){let i=e[a];t.push(new T7(this.player_,{track:i,selectable:!0,multiSelectable:!1}))}return t}}R7.prototype.controlText_="Audio Track";bt.registerComponent("AudioTrackButton",R7);class e3 extends lh{constructor(t,e){let a=e.rate,i=parseFloat(a,10);e.label=a,e.selected=i===t.playbackRate(),e.selectable=!0,e.multiSelectable=!1;super(t,e);this.label=a,this.rate=i,this.on(t,"ratechange",(s)=>this.update(s))}handleClick(t){super.handleClick(),this.player().playbackRate(this.rate)}update(t){this.selected(this.player().playbackRate()===this.rate)}}e3.prototype.contentElType="button";bt.registerComponent("PlaybackRateMenuItem",e3);class N7 extends Ym{constructor(t,e){super(t,e);this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(t,"loadstart",(a)=>this.updateVisibility(a)),this.on(t,"ratechange",(a)=>this.updateLabel(a)),this.on(t,"playbackrateschange",(a)=>this.handlePlaybackRateschange(a))}createEl(){let t=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=he("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),t.appendChild(this.labelEl_),t}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){let t=this.playbackRates(),e=[];for(let a=t.length-1;a>=0;a--)e.push(new e3(this.player(),{rate:t[a]+"x"}));return e}handlePlaybackRateschange(t){this.update()}playbackRates(){let t=this.player();return t.playbackRates&&t.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(t){if(this.playbackRateSupported())this.removeClass("vjs-hidden");else this.addClass("vjs-hidden")}updateLabel(t){if(this.playbackRateSupported())this.labelEl_.textContent=this.player().playbackRate()+"x"}}N7.prototype.controlText_="Playback Rate";bt.registerComponent("PlaybackRateMenuButton",N7);class z7 extends bt{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(t="div",e={},a={}){if(!e.className)e.className=this.buildCSSClass();return super.createEl(t,e,a)}}bt.registerComponent("Spacer",z7);class Ay extends z7{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}bt.registerComponent("CustomControlSpacer",Ay);class E7 extends bt{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}E7.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};bt.registerComponent("ControlBar",E7);class x7 extends Zf{constructor(t,e){super(t,e);this.on(t,"error",(a)=>{this.open(a)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){let t=this.player().error();return t?this.localize(t.message):""}}x7.prototype.options_=Object.assign({},Zf.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});bt.registerComponent("ErrorDisplay",x7);class U7 extends bt{constructor(t,e={}){super(t,e);this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),he("select",{id:this.options_.id},{},this.options_.SelectOptions.map((e)=>{let a=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${kn()}`)+"-"+e[1].replace(/\W+/g,""),i=he("option",{id:a,value:this.localize(e[0]),textContent:this.localize(e[1])});return i.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${a}`),i}))}}bt.registerComponent("TextTrackSelect",U7);class Al extends bt{constructor(t,e={}){super(t,e);let a=he("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(a);let i=this.options_.selects;for(let s of i){let n=this.options_.selectConfigs[s],l=n.className,f=n.id.replace("%s",this.options_.id_),o=null,c=`vjs_select_${kn()}`;if(this.options_.type==="colors"){o=he("span",{className:l});let m=he("label",{id:f,className:"vjs-label",textContent:this.localize(n.label)});m.setAttribute("for",c),o.appendChild(m)}let u=new U7(t,{SelectOptions:n.options,legendId:this.options_.legendId,id:c,labelId:f});if(this.addChild(u),this.options_.type==="colors")o.appendChild(u.el()),this.el().appendChild(o)}}createEl(){return he("fieldset",{className:this.options_.className})}}bt.registerComponent("TextTrackFieldset",Al);class I7 extends bt{constructor(t,e={}){super(t,e);let a=this.options_.textTrackComponentid,i=new Al(t,{id_:a,legendId:`captions-text-legend-${a}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(i);let s=new Al(t,{id_:a,legendId:`captions-background-${a}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(s);let n=new Al(t,{id_:a,legendId:`captions-window-${a}`,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(n)}createEl(){return he("div",{className:"vjs-track-settings-colors"})}}bt.registerComponent("TextTrackSettingsColors",I7);class G7 extends bt{constructor(t,e={}){super(t,e);let a=this.options_.textTrackComponentid,i=new Al(t,{id_:a,legendId:`captions-font-size-${a}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(i);let s=new Al(t,{id_:a,legendId:`captions-edge-style-${a}`,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(s);let n=new Al(t,{id_:a,legendId:`captions-font-family-${a}`,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(n)}createEl(){return he("div",{className:"vjs-track-settings-font"})}}bt.registerComponent("TextTrackSettingsFont",G7);class X7 extends bt{constructor(t,e={}){super(t,e);let a=new Li(t,{controlText:this.localize("restore all settings to the default values"),className:"vjs-default-button"});a.el().classList.remove("vjs-control","vjs-button"),a.el().textContent=this.localize("Reset"),this.addChild(a);let i=this.localize("Done"),s=new Li(t,{controlText:i,className:"vjs-done-button"});s.el().classList.remove("vjs-control","vjs-button"),s.el().textContent=i,this.addChild(s)}createEl(){return he("div",{className:"vjs-track-settings-controls"})}}bt.registerComponent("TrackSettingsControls",X7);var vg="vjs-text-track-settings",Zv=["#000","Black"],$v=["#00F","Blue"],Wv=["#0FF","Cyan"],Pv=["#0F0","Green"],tS=["#F0F","Magenta"],eS=["#F00","Red"],aS=["#FFF","White"],iS=["#FF0","Yellow"],Sg=["1","Opaque"],yg=["0.5","Semi-Transparent"],sS=["0","Transparent"],dl={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Zv,aS,eS,Pv,$v,iS,tS,Wv],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[Sg,yg,sS],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[aS,Zv,eS,Pv,$v,iS,tS,Wv],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:(t)=>t==="1.00"?null:Number(t)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[Sg,yg],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:[sS,yg,Sg],className:"vjs-window-opacity vjs-opacity"}};dl.windowColor.options=dl.backgroundColor.options;function vy(t,e){if(e)t=e(t);if(t&&t!=="none")return t}function Xx(t,e){let a=t.options[t.options.selectedIndex].value;return vy(a,e)}function Kx(t,e,a){if(!e)return;for(let i=0;i<t.options.length;i++)if(vy(t.options[i].value,a)===e){t.selectedIndex=i;break}}class Sy extends Zf{constructor(t,e){e.temporary=!1;super(t,e);if(this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.renderModalComponents(t),this.endDialog=he("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),e.persistTextTrackSettings===void 0)this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings;if(this.bindFunctionsToSelectsAndButtons(),this.options_.persistTextTrackSettings)this.restoreSettings()}renderModalComponents(t){let e=new I7(t,{textTrackComponentid:this.id_,selectConfigs:dl,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(e);let a=new G7(t,{textTrackComponentid:this.id_,selectConfigs:dl,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(a);let i=new X7(t);this.addChild(i)}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()}),Go(dl,(t)=>{this.on(this.$(t.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 BS(dl,(t,e,a)=>{let i=Xx(this.$(e.selector),e.parser);if(i!==void 0)t[a]=i;return t},{})}setValues(t){Go(dl,(e,a)=>{Kx(this.$(e.selector),t[a],e.parser)})}setDefaults(){Go(dl,(t)=>{let e=t.hasOwnProperty("default")?t.default:0;this.$(t.selector).selectedIndex=e})}restoreSettings(){let t;try{t=JSON.parse($.default.localStorage.getItem(vg))}catch(e){De.warn(e)}if(t)this.setValues(t)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;let t=this.getValues();try{if(Object.keys(t).length)$.default.localStorage.setItem(vg,JSON.stringify(t));else $.default.localStorage.removeItem(vg)}catch(e){De.warn(e)}}updateDisplay(){let t=this.player_.getChild("textTrackDisplay");if(t)t.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}bt.registerComponent("TextTrackSettings",Sy);class yy extends bt{constructor(t,e){let a=e.ResizeObserver||$.default.ResizeObserver;if(e.ResizeObserver===null)a=!1;let i=ga({createEl:!a,reportTouchActivity:!1},e);super(t,i);if(this.ResizeObserver=e.ResizeObserver||$.default.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=WS(()=>{this.resizeHandler()},100,!1,this),a)this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(t.el());else this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;let s=this.debouncedHandler_,n=this.unloadListener_=function(){is(this,"resize",s),is(this,"unload",n),n=null};an(this.el_.contentWindow,"unload",n),an(this.el_.contentWindow,"resize",s)},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()}}bt.registerComponent("ResizeManager",yy);var Lx={trackingThreshold:20,liveTolerance:15};class ky extends bt{constructor(t,e){let a=ga(Lx,e,{createEl:!1});super(t,a);this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=(i)=>this.handlePlay(i),this.handleFirstTimeupdate_=(i)=>this.handleFirstTimeupdate(i),this.handleSeeked_=(i)=>this.handleSeeked(i),this.seekToLiveEdge_=(i)=>this.seekToLiveEdge(i),this.reset_(),this.on(this.player_,"durationchange",(i)=>this.handleDurationchange(i)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){let t=this.player_.seekable();if(!t||!t.length)return;let e=Number($.default.performance.now().toFixed(4)),a=this.lastTime_===-1?0:(e-this.lastTime_)/1000;this.lastTime_=e,this.pastSeekEnd_=this.pastSeekEnd()+a;let i=this.liveCurrentTime(),s=this.player_.currentTime(),n=this.player_.paused()||this.seekedBehindLive_||Math.abs(i-s)>this.options_.liveTolerance;if(!this.timeupdateSeen_||i===1/0)n=!1;if(n!==this.behindLiveEdge_)this.behindLiveEdge_=n,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_,Cn),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 t=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&t>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 t=this.player_.seekable(),e=[],a=t?t.length:0;while(a--)e.push(t.end(a));return e.length?e.sort()[e.length-1]:1/0}seekableStart(){let t=this.player_.seekable(),e=[],a=t?t.length:0;while(a--)e.push(t.start(a));return e.length?e.sort()[0]:0}liveWindow(){let t=this.liveCurrentTime();if(t===1/0)return 0;return t-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){let t=this.seekableEnd();if(this.lastSeekEnd_!==-1&&t!==this.lastSeekEnd_)this.pastSeekEnd_=0;return this.lastSeekEnd_=t,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()}}bt.registerComponent("LiveTracker",ky);class Cy extends bt{constructor(t,e){super(t,e);this.on("statechanged",(a)=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:he("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${kn()}`}),description:he("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${kn()}`})},he("div",{className:"vjs-title-bar"},{},OS(this.els))}updateDom_(){let t=this.player_.tech_,e=t&&t.el_,a={title:"aria-labelledby",description:"aria-describedby"};if(["title","description"].forEach((i)=>{let s=this.state[i],n=this.els[i],l=a[i];if(Tm(n),s)kl(n,s);if(e){if(e.removeAttribute(l),s)e.setAttribute(l,n.id)}}),this.state.title||this.state.description)this.show();else this.hide()}update(t){this.setState(t)}dispose(){let t=this.player_.tech_,e=t&&t.el_;if(e)e.removeAttribute("aria-labelledby"),e.removeAttribute("aria-describedby");super.dispose(),this.els=null}}bt.registerComponent("TitleBar",Cy);var Vx={initialDisplay:4000,position:[],takeFocus:!1};class _y extends Li{constructor(t,e){e=ga(Vx,e);super(t,e);this.controlText(e.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],(a)=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map((t)=>`vjs-${t}`).join(" ")}`}createEl(){let t=he("button",{},{type:"button",class:this.buildCSSClass()},he("span"));return this.controlTextEl_=t.querySelector("span"),t}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()}}bt.registerComponent("TransientButton",_y);var Ug=(t)=>{let e=t.el();if(e.hasAttribute("src"))return t.triggerSourceset(e.src),!0;let a=t.$$("source"),i=[],s="";if(!a.length)return!1;for(let n=0;n<a.length;n++){let l=a[n].src;if(l&&i.indexOf(l)===-1)i.push(l)}if(!i.length)return!1;if(i.length===1)s=i[0];return t.triggerSourceset(s),!0},Yx=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(t){let e=Ot.default.createElement(this.nodeName.toLowerCase());e.innerHTML=t;let a=Ot.default.createDocumentFragment();while(e.childNodes.length)a.appendChild(e.childNodes[0]);return this.innerText="",$.default.Element.prototype.appendChild.call(this,a),this.innerHTML}}),Fy=(t,e)=>{let a={};for(let i=0;i<t.length;i++)if(a=Object.getOwnPropertyDescriptor(t[i],e),a&&a.set&&a.get)break;return a.enumerable=!0,a.configurable=!0,a},Jx=(t)=>Fy([t.el(),$.default.HTMLMediaElement.prototype,$.default.Element.prototype,Yx],"innerHTML"),nS=function(t){let e=t.el();if(e.resetSourceWatch_)return;let a={},i=Jx(t),s=(n)=>(...l)=>{let f=n.apply(e,l);return Ug(t),f};["append","appendChild","insertAdjacentHTML"].forEach((n)=>{if(!e[n])return;a[n]=e[n],e[n]=s(a[n])}),Object.defineProperty(e,"innerHTML",ga(i,{set:s(i.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(a).forEach((n)=>{e[n]=a[n]}),Object.defineProperty(e,"innerHTML",i)},t.one("sourceset",e.resetSourceWatch_)},Qx=Object.defineProperty({},"src",{get(){if(this.hasAttribute("src"))return ry($.default.Element.prototype.getAttribute.call(this,"src"));return""},set(t){return $.default.Element.prototype.setAttribute.call(this,"src",t),t}}),Zx=(t)=>Fy([t.el(),$.default.HTMLMediaElement.prototype,Qx],"src"),$x=function(t){if(!t.featuresSourceset)return;let e=t.el();if(e.resetSourceset_)return;let a=Zx(t),i=e.setAttribute,s=e.load;if(Object.defineProperty(e,"src",ga(a,{set:(n)=>{let l=a.set.call(e,n);return t.triggerSourceset(e.src),l}})),e.setAttribute=(n,l)=>{let f=i.call(e,n,l);if(/src/i.test(n))t.triggerSourceset(e.src);return f},e.load=()=>{let n=s.call(e);if(!Ug(t))t.triggerSourceset(""),nS(t);return n},e.currentSrc)t.triggerSourceset(e.currentSrc);else if(!Ug(t))nS(t);e.resetSourceset_=()=>{if(e.resetSourceset_=null,e.load=s,e.setAttribute=i,Object.defineProperty(e,"src",a),e.resetSourceWatch_)e.resetSourceWatch_()}};class Lt extends Se{constructor(t,e){super(t,e);let a=t.source,i=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",a&&(this.el_.currentSrc!==a.src||t.tag&&t.tag.initNetworkState_===3))this.setSource(a);else this.handleLateInit_(this.el_);if(t.enableSourceset)this.setupSourcesetHandling_();if(this.isScrubbing_=!1,this.el_.hasChildNodes()){let s=this.el_.childNodes,n=s.length,l=[];while(n--){let f=s[n];if(f.nodeName.toLowerCase()==="track"){if(!this.featuresNativeTextTracks)l.push(f);else if(this.remoteTextTrackEls().addTrackElement_(f),this.remoteTextTracks().addTrack(f.track),this.textTracks().addTrack(f.track),!i&&!this.el_.hasAttribute("crossorigin")&&Um(f.src))i=!0}}for(let f=0;f<l.length;f++)this.el_.removeChild(l[f])}if(this.proxyNativeTracks_(),this.featuresNativeTextTracks&&i)De.warn(`Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.
192
- This may prevent text tracks from loading.`);if(this.restoreMetadataTracksInIOSNativePlayer_(),(B2||Bm)&&t.nativeControlsForTouch===!0)this.setControls(!0);this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){if(this.el_&&this.el_.resetSourceset_)this.el_.resetSourceset_();Lt.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){$x(this)}restoreMetadataTracksInIOSNativePlayer_(){let t=this.textTracks(),e,a=()=>{e=[];for(let s=0;s<t.length;s++){let n=t[s];if(n.kind==="metadata")e.push({track:n,storedMode:n.mode})}};a(),t.addEventListener("change",a),this.on("dispose",()=>t.removeEventListener("change",a));let i=()=>{for(let s=0;s<e.length;s++){let n=e[s];if(n.track.mode==="disabled"&&n.track.mode!==n.storedMode)n.track.mode=n.storedMode}t.removeEventListener("change",i)};this.on("webkitbeginfullscreen",()=>{t.removeEventListener("change",a),t.removeEventListener("change",i),t.addEventListener("change",i)}),this.on("webkitendfullscreen",()=>{t.removeEventListener("change",a),t.addEventListener("change",a),t.removeEventListener("change",i)})}overrideNative_(t,e){if(e!==this[`featuresNative${t}Tracks`])return;let a=t.toLowerCase();if(this[`${a}TracksListeners_`])Object.keys(this[`${a}TracksListeners_`]).forEach((i)=>{this.el()[`${a}Tracks`].removeEventListener(i,this[`${a}TracksListeners_`][i])});this[`featuresNative${t}Tracks`]=!e,this[`${a}TracksListeners_`]=null,this.proxyNativeTracksForType_(a)}overrideNativeAudioTracks(t){this.overrideNative_("Audio",t)}overrideNativeVideoTracks(t){this.overrideNative_("Video",t)}proxyNativeTracksForType_(t){let e=yn[t],a=this.el()[e.getterName],i=this[e.getterName]();if(!this[`featuresNative${e.capitalName}Tracks`]||!a||!a.addEventListener)return;let s={change:(l)=>{let f={type:"change",target:i,currentTarget:i,srcElement:i};if(i.trigger(f),t==="text")this[eh.remoteText.getterName]().trigger(f)},addtrack(l){i.addTrack(l.track)},removetrack(l){i.removeTrack(l.track)}},n=function(){let l=[];for(let f=0;f<i.length;f++){let o=!1;for(let c=0;c<a.length;c++)if(a[c]===i[f]){o=!0;break}if(!o)l.push(i[f])}while(l.length)i.removeTrack(l.shift())};this[e.getterName+"Listeners_"]=s,Object.keys(s).forEach((l)=>{let f=s[l];a.addEventListener(l,f),this.on("dispose",(o)=>a.removeEventListener(l,f))}),this.on("loadstart",n),this.on("dispose",(l)=>this.off("loadstart",n))}proxyNativeTracks_(){yn.names.forEach((t)=>{this.proxyNativeTracksForType_(t)})}createEl(){let t=this.options_.tag;if(!t||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(t){let a=t.cloneNode(!0);if(t.parentNode)t.parentNode.insertBefore(a,t);Lt.disposeMediaElement(t),t=a}else{t=Ot.default.createElement("video");let a=this.options_.tag&&jl(this.options_.tag),i=ga({},a);if(!B2||this.options_.nativeControlsForTouch!==!0)delete i.controls;xS(t,Object.assign(i,{id:this.options_.techId,class:"vjs-tech"}))}t.playerId=this.options_.playerId}if(typeof this.options_.preload<"u")Wo(t,"preload",this.options_.preload);if(this.options_.disablePictureInPicture!==void 0)t.disablePictureInPicture=this.options_.disablePictureInPicture;let e=["loop","muted","playsinline","autoplay"];for(let a=0;a<e.length;a++){let i=e[a],s=this.options_[i];if(typeof s<"u"){if(s)Wo(t,i,i);else Mm(t,i);t[i]=s}}return t}handleLateInit_(t){if(t.networkState===0||t.networkState===3)return;if(t.readyState===0){let a=!1,i=function(){a=!0};this.on("loadstart",i);let s=function(){if(!a)this.trigger("loadstart")};this.on("loadedmetadata",s),this.ready(function(){if(this.off("loadstart",i),this.off("loadedmetadata",s),!a)this.trigger("loadstart")});return}let e=["loadstart"];if(e.push("loadedmetadata"),t.readyState>=2)e.push("loadeddata");if(t.readyState>=3)e.push("canplay");if(t.readyState>=4)e.push("canplaythrough");this.ready(function(){e.forEach(function(a){this.trigger(a)},this)})}setScrubbing(t){this.isScrubbing_=t}scrubbing(){return this.isScrubbing_}setCurrentTime(t){try{if(this.isScrubbing_&&this.el_.fastSeek&&Om)this.el_.fastSeek(t);else this.el_.currentTime=t}catch(e){De(e,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&Qn&&A0&&this.el_.currentTime===0){let t=()=>{if(this.el_.currentTime>0){if(this.el_.duration===1/0)this.trigger("durationchange");this.off("timeupdate",t)}};return this.on("timeupdate",t),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;let t=function(){if(this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls())this.el_.controls=!1},e=function(){if("webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture")this.one("webkitendfullscreen",t),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0})};this.on("webkitbeginfullscreen",e),this.on("dispose",()=>{this.off("webkitbeginfullscreen",e),this.off("webkitendfullscreen",t)})}supportsFullScreen(){return typeof this.el_.webkitEnterFullScreen==="function"}enterFullScreen(){let t=this.el_;if(t.paused&&t.networkState<=t.HAVE_METADATA)p0(this.el_.play()),this.setTimeout(function(){t.pause();try{t.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}},0);else try{t.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(t){if(this.featuresVideoFrameCallback&&!this.el_.webkitKeys)return this.el_.requestVideoFrameCallback(t);return super.requestVideoFrameCallback(t)}cancelVideoFrameCallback(t){if(this.featuresVideoFrameCallback&&!this.el_.webkitKeys)this.el_.cancelVideoFrameCallback(t);else super.cancelVideoFrameCallback(t)}src(t){if(t===void 0)return this.el_.src;this.setSrc(t)}addSourceElement(t,e){if(!t)return De.error("Invalid source URL."),!1;let a={src:t};if(e)a.type=e;let i=he("source",{},a);return this.el_.appendChild(i),!0}removeSourceElement(t){if(!t)return De.error("Source URL is required to remove the source element."),!1;let e=this.el_.querySelectorAll("source");for(let a of e)if(a.src===t)return this.el_.removeChild(a),!0;return De.warn(`No matching source element found with src: ${t}`),!1}reset(){Lt.resetMediaElement(this.el_)}currentSrc(){if(this.currentSource_)return this.currentSource_.src;return this.el_.currentSrc}setControls(t){this.el_.controls=!!t}addTextTrack(t,e,a){if(!this.featuresNativeTextTracks)return super.addTextTrack(t,e,a);return this.el_.addTextTrack(t,e,a)}createRemoteTextTrack(t){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(t);let e=Ot.default.createElement("track");if(t.kind)e.kind=t.kind;if(t.label)e.label=t.label;if(t.language||t.srclang)e.srclang=t.language||t.srclang;if(t.default)e.default=t.default;if(t.id)e.id=t.id;if(t.src)e.src=t.src;return e}addRemoteTextTrack(t,e){let a=super.addRemoteTextTrack(t,e);if(this.featuresNativeTextTracks)this.el().appendChild(a);return a}removeRemoteTextTrack(t){if(super.removeRemoteTextTrack(t),this.featuresNativeTextTracks){let e=this.$$("track"),a=e.length;while(a--)if(t===e[a]||t===e[a].track)this.el().removeChild(e[a])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality==="function")return this.el().getVideoPlaybackQuality();let t={};if(typeof this.el().webkitDroppedFrameCount<"u"&&typeof this.el().webkitDecodedFrameCount<"u")t.droppedVideoFrames=this.el().webkitDroppedFrameCount,t.totalVideoFrames=this.el().webkitDecodedFrameCount;if($.default.performance)t.creationTime=$.default.performance.now();return t}}Cm(Lt,"TEST_VID",function(){if(!ah())return;let t=Ot.default.createElement("video"),e=Ot.default.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",t.appendChild(e),t});Lt.isSupported=function(){try{Lt.TEST_VID.volume=0.5}catch(t){return!1}return!!(Lt.TEST_VID&&Lt.TEST_VID.canPlayType)};Lt.canPlayType=function(t){return Lt.TEST_VID.canPlayType(t)};Lt.canPlaySource=function(t,e){return Lt.canPlayType(t.type)};Lt.canControlVolume=function(){try{let t=Lt.TEST_VID.volume;Lt.TEST_VID.volume=t/2+0.1;let e=t!==Lt.TEST_VID.volume;if(e&&as)return $.default.setTimeout(()=>{if(Lt&&Lt.prototype)Lt.prototype.featuresVolumeControl=t!==Lt.TEST_VID.volume}),!1;return e}catch(t){return!1}};Lt.canMuteVolume=function(){try{let t=Lt.TEST_VID.muted;if(Lt.TEST_VID.muted=!t,Lt.TEST_VID.muted)Wo(Lt.TEST_VID,"muted","muted");else Mm(Lt.TEST_VID,"muted","muted");return t!==Lt.TEST_VID.muted}catch(t){return!1}};Lt.canControlPlaybackRate=function(){if(Qn&&A0&&_m<58)return!1;try{let t=Lt.TEST_VID.playbackRate;return Lt.TEST_VID.playbackRate=t/2+0.1,t!==Lt.TEST_VID.playbackRate}catch(t){return!1}};Lt.canOverrideAttributes=function(){try{let t=()=>{};Object.defineProperty(Ot.default.createElement("video"),"src",{get:t,set:t}),Object.defineProperty(Ot.default.createElement("audio"),"src",{get:t,set:t}),Object.defineProperty(Ot.default.createElement("video"),"innerHTML",{get:t,set:t}),Object.defineProperty(Ot.default.createElement("audio"),"innerHTML",{get:t,set:t})}catch(t){return!1}return!0};Lt.supportsNativeTextTracks=function(){return Om||as&&A0};Lt.supportsNativeVideoTracks=function(){return!!(Lt.TEST_VID&&Lt.TEST_VID.videoTracks)};Lt.supportsNativeAudioTracks=function(){return!!(Lt.TEST_VID&&Lt.TEST_VID.audioTracks)};Lt.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([t,e]){Cm(Lt.prototype,t,()=>Lt[e](),!0)});Lt.prototype.featuresVolumeControl=Lt.canControlVolume();Lt.prototype.movingMediaElementInDOM=!as;Lt.prototype.featuresFullscreenResize=!0;Lt.prototype.featuresProgressEvents=!0;Lt.prototype.featuresTimeupdateEvents=!0;Lt.prototype.featuresVideoFrameCallback=!!(Lt.TEST_VID&&Lt.TEST_VID.requestVideoFrameCallback);Lt.disposeMediaElement=function(t){if(!t)return;if(t.parentNode)t.parentNode.removeChild(t);while(t.hasChildNodes())t.removeChild(t.firstChild);if(t.removeAttribute("src"),typeof t.load==="function")(function(){try{t.load()}catch(e){}})()};Lt.resetMediaElement=function(t){if(!t)return;let e=t.querySelectorAll("source"),a=e.length;while(a--)t.removeChild(e[a]);if(t.removeAttribute("src"),typeof t.load==="function")(function(){try{t.load()}catch(i){}})()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(t){Lt.prototype[t]=function(){return this.el_[t]||this.el_.hasAttribute(t)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(t){Lt.prototype["set"+Va(t)]=function(e){if(this.el_[t]=e,e)this.el_.setAttribute(t,t);else this.el_.removeAttribute(t)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(t){Lt.prototype[t]=function(){return this.el_[t]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(t){Lt.prototype["set"+Va(t)]=function(e){this.el_[t]=e}});["pause","load","play"].forEach(function(t){Lt.prototype[t]=function(){return this.el_[t]()}});Se.withSourceHandlers(Lt);Lt.nativeSourceHandler={};Lt.nativeSourceHandler.canPlayType=function(t){try{return Lt.TEST_VID.canPlayType(t)}catch(e){return""}};Lt.nativeSourceHandler.canHandleSource=function(t,e){if(t.type)return Lt.nativeSourceHandler.canPlayType(t.type);else if(t.src){let a=m7(t.src);return Lt.nativeSourceHandler.canPlayType(`video/${a}`)}return""};Lt.nativeSourceHandler.handleSource=function(t,e,a){e.setSrc(t.src)};Lt.nativeSourceHandler.dispose=function(){};Lt.registerSourceHandler(Lt.nativeSourceHandler);Se.registerTech("Html5",Lt);var By=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],kg={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Ig=["tiny","xsmall","small","medium","large","xlarge","huge"],im={};Ig.forEach((t)=>{let e=t.charAt(0)==="x"?`x-${t.substring(1)}`:t;im[t]=`vjs-layout-${e}`});var Wx={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class ea extends bt{constructor(t,e,a){if(t.id=t.id||e.id||`vjs_video_${kn()}`,e=Object.assign(ea.getTagSettings(t),e),e.initChildren=!1,e.createEl=!1,e.evented=!1,e.reportTouchActivity=!1,!e.language){let n=t.closest("[lang]");if(n)e.language=n.getAttribute("lang")}super(null,e,a);if(this.boundDocumentFullscreenChange_=(n)=>this.documentFullscreenChange_(n),this.boundFullWindowOnEscKey_=(n)=>this.fullWindowOnEscKey(n),this.boundUpdateStyleEl_=(n)=>this.updateStyleEl_(n),this.boundApplyInitTime_=(n)=>this.applyInitTime_(n),this.boundUpdateCurrentBreakpoint_=(n)=>this.updateCurrentBreakpoint_(n),this.boundHandleTechClick_=(n)=>this.handleTechClick_(n),this.boundHandleTechDoubleClick_=(n)=>this.handleTechDoubleClick_(n),this.boundHandleTechTouchStart_=(n)=>this.handleTechTouchStart_(n),this.boundHandleTechTouchMove_=(n)=>this.handleTechTouchMove_(n),this.boundHandleTechTouchEnd_=(n)=>this.handleTechTouchEnd_(n),this.boundHandleTechTap_=(n)=>this.handleTechTap_(n),this.boundUpdatePlayerHeightOnAudioOnlyMode_=(n)=>this.updatePlayerHeightOnAudioOnlyMode_(n),this.isFullscreen_=!1,this.log=_S(this.id_),this.fsApi_=nm,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=t,this.tagAttributes=t&&jl(t),this.language(this.options_.language),e.languages){let n={};Object.getOwnPropertyNames(e.languages).forEach(function(l){n[l.toLowerCase()]=e.languages[l]}),this.languages_=n}else this.languages_=ea.prototype.options_.languages;if(this.resetCache_(),this.poster_=e.poster||"",this.controls_=!!e.controls,t.controls=!1,t.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],t.hasAttribute("autoplay"))this.autoplay(!0);else this.autoplay(this.options_.autoplay);if(e.plugins)Object.keys(e.plugins).forEach((n)=>{if(typeof this[n]!=="function")throw Error(`plugin "${n}" does not exist`)});if(this.scrubbing_=!1,this.el_=this.createEl(),r7(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen)an(Ot.default,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_);if(this.fluid_)this.on(["playerreset","resize"],this.boundUpdateStyleEl_);let i=ga(this.options_);if(e.plugins)Object.keys(e.plugins).forEach((n)=>{this[n](e.plugins[n])});if(e.debug)this.debug(!0);if(this.options_.playerOptions=i,this.middleware_=[],this.playbackRates(e.playbackRates),e.experimentalSvgIcons){let l=new $.default.DOMParser().parseFromString(Ex,"image/svg+xml");if(l.querySelector("parsererror"))De.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{let o=l.documentElement;o.style.display="none",this.el_.appendChild(o),this.addClass("vjs-svg-icons-enabled")}}if(this.initChildren(),this.isAudio(t.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(e.spatialNavigation&&e.spatialNavigation.enabled)this.spatialNavigation=new hy(this),this.addClass("vjs-spatial-navigation-enabled");if(B2)this.addClass("vjs-touch-enabled");if(!as)this.addClass("vjs-workinghover");ea.players[this.id_]=this;let s=Hg.split(".")[0];this.addClass(`vjs-v${s}`),this.userActive(!0),this.reportUserActivity(),this.one("play",(n)=>this.listenForUserActivity_(n)),this.on("keydown",(n)=>this.handleKeyDown(n)),this.on("languagechange",(n)=>this.handleLanguagechange(n)),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"),is(Ot.default,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),is(Ot.default,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode)this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null;if(ea.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;Tx(this),gs.names.forEach((t)=>{let e=gs[t],a=this[e.getterName]();if(a&&a.off)a.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let t=this.tag,e,a=this.playerElIngest_=t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player"),i=this.tag.tagName.toLowerCase()==="video-js";if(a)e=this.el_=t.parentNode;else if(!i)e=this.el_=super.createEl("div");let s=jl(t);if(i){e=this.el_=t,t=this.tag=Ot.default.createElement("video");while(e.children.length)t.appendChild(e.firstChild);if(!y2(e,"video-js"))Vf(e,"video-js");e.appendChild(t),a=this.playerElIngest_=e,Object.keys(e).forEach((f)=>{try{t[f]=e[f]}catch(o){}})}if(t.setAttribute("tabindex","-1"),s.tabindex="-1",A0&&Fm)t.setAttribute("role","application"),s.role="application";if(t.removeAttribute("width"),t.removeAttribute("height"),"width"in s)delete s.width;if("height"in s)delete s.height;Object.getOwnPropertyNames(s).forEach(function(f){if(!(i&&f==="class"))e.setAttribute(f,s[f]);if(i)t.setAttribute(f,s[f])}),t.playerId=t.id,t.id+="_html5_api",t.className="vjs-tech",t.player=e.player=this,this.addClass("vjs-paused");let n=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter((f)=>RS[f]).map((f)=>{return"vjs-device-"+f.substring(3).toLowerCase().replace(/\_/g,"-")});if(this.addClass(...n),$.default.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=ZS("vjs-styles-dimensions");let f=Sl(".vjs-styles-defaults"),o=Sl("head");o.insertBefore(this.styleEl_,f?f.nextSibling:o.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=t.getElementsByTagName("a");for(let f=0;f<l.length;f++){let o=l.item(f);Vf(o,"vjs-hidden"),o.setAttribute("hidden","hidden")}if(t.initNetworkState_=t.networkState,t.parentNode&&!a)t.parentNode.insertBefore(e,t);return Dg(t,e),this.children_.unshift(t),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=e,e}crossOrigin(t){if(typeof t>"u")return this.techGet_("crossOrigin");if(t!==null&&t!=="anonymous"&&t!=="use-credentials"){De.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${t}"`);return}if(this.techCall_("setCrossOrigin",t),this.posterImage)this.posterImage.crossOrigin(t);return}width(t){return this.dimension("width",t)}height(t){return this.dimension("height",t)}dimension(t,e){let a=t+"_";if(e===void 0)return this[a]||0;if(e===""||e==="auto"){this[a]=void 0,this.updateStyleEl_();return}let i=parseFloat(e);if(isNaN(i)){De.error(`Improper value "${e}" supplied for for ${t}`);return}this[a]=i,this.updateStyleEl_()}fluid(t){if(t===void 0)return!!this.fluid_;if(this.fluid_=!!t,b1(this))this.off(["playerreset","resize"],this.boundUpdateStyleEl_);if(t)this.addClass("vjs-fluid"),this.fill(!1),mx(this,()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)});else this.removeClass("vjs-fluid");this.updateStyleEl_()}fill(t){if(t===void 0)return!!this.fill_;if(this.fill_=!!t,t)this.addClass("vjs-fill"),this.fluid(!1);else this.removeClass("vjs-fill")}aspectRatio(t){if(t===void 0)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(t))throw Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=t,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if($.default.VIDEOJS_NO_DYNAMIC_STYLE===!0){let l=typeof this.width_==="number"?this.width_:this.options_.width,f=typeof this.height_==="number"?this.height_:this.options_.height,o=this.tech_&&this.tech_.el();if(o){if(l>=0)o.width=l;if(f>=0)o.height=f}return}let t,e,a,i;if(this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto")a=this.aspectRatio_;else if(this.videoWidth()>0)a=this.videoWidth()+":"+this.videoHeight();else a="16:9";let s=a.split(":"),n=s[1]/s[0];if(this.width_!==void 0)t=this.width_;else if(this.height_!==void 0)t=this.height_/n;else t=this.videoWidth()||300;if(this.height_!==void 0)e=this.height_;else e=t*n;if(/^[^a-zA-Z]/.test(this.id()))i="dimensions-"+this.id();else i=this.id()+"-dimensions";this.addClass(i),$S(this.styleEl_,`
193
- .${i} {
194
- width: ${t}px;
195
- height: ${e}px;
196
- }
197
-
198
- .${i}.vjs-fluid:not(.vjs-audio-only-mode) {
199
- padding-top: ${n*100}%;
200
- }
201
- `)}loadTech_(t,e){if(this.tech_)this.unloadTech_();let a=Va(t),i=t.charAt(0).toLowerCase()+t.slice(1);if(a!=="Html5"&&this.tag)Se.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null;this.techName_=a,this.isReady_=!1;let s=this.autoplay();if(typeof this.autoplay()==="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)s=!1;let n={source:e,autoplay:s,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${i}_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(gs.names.forEach((f)=>{let o=gs[f];n[o.getterName]=this[o.privateName]}),Object.assign(n,this.options_[a]),Object.assign(n,this.options_[i]),Object.assign(n,this.options_[t.toLowerCase()]),this.tag)n.tag=this.tag;if(e&&e.src===this.cache_.src&&this.cache_.currentTime>0)n.startTime=this.cache_.currentTime;let l=Se.getTech(t);if(!l)throw Error(`No Tech named '${a}' exists! '${a}' should be registered using videojs.registerTech()'`);if(this.tech_=new l(n),this.tech_.ready(qa(this,this.handleTechReady_),!0),xg.jsonToTextTracks(this.textTracksJson_||[],this.tech_),By.forEach((f)=>{this.on(this.tech_,f,(o)=>this[`handleTech${Va(f)}_`](o))}),Object.keys(kg).forEach((f)=>{this.on(this.tech_,f,(o)=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${kg[f]}_`].bind(this),event:o});return}this[`handleTech${kg[f]}_`](o)})}),this.on(this.tech_,"loadstart",(f)=>this.handleTechLoadStart_(f)),this.on(this.tech_,"sourceset",(f)=>this.handleTechSourceset_(f)),this.on(this.tech_,"waiting",(f)=>this.handleTechWaiting_(f)),this.on(this.tech_,"ended",(f)=>this.handleTechEnded_(f)),this.on(this.tech_,"seeking",(f)=>this.handleTechSeeking_(f)),this.on(this.tech_,"play",(f)=>this.handleTechPlay_(f)),this.on(this.tech_,"pause",(f)=>this.handleTechPause_(f)),this.on(this.tech_,"durationchange",(f)=>this.handleTechDurationChange_(f)),this.on(this.tech_,"fullscreenchange",(f,o)=>this.handleTechFullscreenChange_(f,o)),this.on(this.tech_,"fullscreenerror",(f,o)=>this.handleTechFullscreenError_(f,o)),this.on(this.tech_,"enterpictureinpicture",(f)=>this.handleTechEnterPictureInPicture_(f)),this.on(this.tech_,"leavepictureinpicture",(f)=>this.handleTechLeavePictureInPicture_(f)),this.on(this.tech_,"error",(f)=>this.handleTechError_(f)),this.on(this.tech_,"posterchange",(f)=>this.handleTechPosterChange_(f)),this.on(this.tech_,"textdata",(f)=>this.handleTechTextData_(f)),this.on(this.tech_,"ratechange",(f)=>this.handleTechRateChange_(f)),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()&&(a!=="Html5"||!this.tag))Dg(this.tech_.el(),this.el());if(this.tag)this.tag.player=null,this.tag=null}unloadTech_(){if(gs.names.forEach((t)=>{let e=gs[t];this[e.privateName]=this[e.getterName]()}),this.textTracksJson_=xg.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_)this.poster_="",this.trigger("posterchange");this.isPosterFromTech_=!1}tech(t){if(t===void 0)De.warn(`Using the tech directly can be dangerous. I hope you know what you're doing.
202
- See https://github.com/videojs/video.js/issues/2617 for more info.
203
- `);return this.tech_}version(){return{"video.js":Hg}}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_(t){if(!this.tech_||typeof t!=="string")return;let e=()=>{let i=this.muted();this.muted(!0);let s=()=>{this.muted(i)};this.playTerminatedQueue_.push(s);let n=this.play();if(!C2(n))return;return n.catch((l)=>{throw s(),Error(`Rejection at manualAutoplay. Restoring muted value. ${l?l:""}`)})},a;if(t==="any"&&!this.muted()){if(a=this.play(),C2(a))a=a.catch(e)}else if(t==="muted"&&!this.muted())a=e();else a=this.play();if(!C2(a))return;return a.then(()=>{this.trigger({type:"autoplay-success",autoplay:t})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:t})})}updateSourceCaches_(t=""){let e=t,a="";if(typeof e!=="string")e=t.src,a=t.type;if(this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],e&&!a)a=zx(this,e);this.cache_.source=ga({},t,{src:e,type:a});let i=this.cache_.sources.filter((f)=>f.src&&f.src===e),s=[],n=this.$$("source"),l=[];for(let f=0;f<n.length;f++){let o=jl(n[f]);if(s.push(o),o.src&&o.src===e)l.push(o.src)}if(l.length&&!i.length)this.cache_.sources=s;else if(!i.length)this.cache_.sources=[this.cache_.source];this.cache_.src=e}handleTechSourceset_(t){if(!this.changingSrc_){let e=(s)=>this.updateSourceCaches_(s),a=this.currentSource().src,i=t.src;if(a&&!/^blob:/.test(a)&&/^blob:/.test(i)){if(!this.lastSource_||this.lastSource_.tech!==i&&this.lastSource_.player!==a)e=()=>{}}if(e(i),!t.src)this.tech_.any(["sourceset","loadstart"],(s)=>{if(s.type==="sourceset")return;let n=this.techGet_("currentSrc");this.lastSource_.tech=n,this.updateSourceCaches_(n)})}this.lastSource_={player:this.currentSource().src,tech:t.src},this.trigger({src:t.src,type:"sourceset"})}hasStarted(t){if(t===void 0)return this.hasStarted_;if(t===this.hasStarted_)return;if(this.hasStarted_=t,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((t)=>t.callback(t.event)),this.queuedCallbacks_=[];this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");let t=this.currentTime(),e=()=>{if(t!==this.currentTime())this.removeClass("vjs-waiting"),this.off("timeupdate",e)};this.on("timeupdate",e)}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_(t){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,t);else if(this.paused())p0(this.play());else this.pause()}handleTechDoubleClick_(t){if(!this.controls_)return;if(!Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),(a)=>a.contains(t.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,t);else if(this.isInPictureInPicture()&&!Ot.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_(t){if(t.cancelable)t.preventDefault()}toggleFullscreenClass_(){if(this.isFullscreen())this.addClass("vjs-fullscreen");else this.removeClass("vjs-fullscreen")}documentFullscreenChange_(t){let e=t.target.player;if(e&&e!==this)return;let a=this.el(),i=Ot.default[this.fsApi_.fullscreenElement]===a;if(!i&&a.matches)i=a.matches(":"+this.fsApi_.fullscreen);this.isFullscreen(i)}handleTechFullscreenChange_(t,e){if(e){if(e.nativeIOSFullscreen)this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")});this.isFullscreen(e.isFullscreen)}}handleTechFullscreenError_(t,e){this.trigger("fullscreenerror",e)}togglePictureInPictureClass_(){if(this.isInPictureInPicture())this.addClass("vjs-picture-in-picture");else this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(t){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(t){this.isInPictureInPicture(!1)}handleTechError_(){let t=this.tech_.error();if(t)this.error(t)}handleTechTextData_(){let t=null;if(arguments.length>1)t=arguments[1];this.trigger("textdata",t)}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_(t,e){this.ready(function(){if(t in Mx)return Ox(this.middleware_,this.tech_,t,e);else if(t in Kv)return Xv(this.middleware_,this.tech_,t,e);try{if(this.tech_)this.tech_[t](e)}catch(a){throw De(a),a}},!0)}techGet_(t){if(!this.tech_||!this.tech_.isReady_)return;if(t in Hx)return Bx(this.middleware_,this.tech_,t);else if(t in Kv)return Xv(this.middleware_,this.tech_,t);try{return this.tech_[t]()}catch(e){if(this.tech_[t]===void 0)throw De(`Video.js: ${t} method not defined for ${this.techName_} playback technology.`,e),e;if(e.name==="TypeError")throw De(`Video.js: ${t} unavailable on ${this.techName_} playback technology element.`,e),this.tech_.isReady_=!1,e;throw De(e),e}}play(){return new Promise((t)=>{this.play_(t)})}play_(t=p0){this.playCallbacks_.push(t);let e=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),a=Boolean(Om||as);if(this.waitToPlay_)this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null;if(!this.isReady_||!e){if(this.waitToPlay_=(n)=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!e&&a)this.load();return}let i=this.techGet_("play");if(a&&this.hasClass("vjs-ended"))this.resetProgressBar_();if(i===null)this.runPlayTerminatedQueue_();else this.runPlayCallbacks_(i)}runPlayTerminatedQueue_(){let t=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],t.forEach(function(e){e()})}runPlayCallbacks_(t){let e=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],e.forEach(function(a){a(t)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")===!1?!1:!0}played(){return this.techGet_("played")||Jn(0,0)}scrubbing(t){if(typeof t>"u")return this.scrubbing_;if(this.scrubbing_=!!t,this.techCall_("setScrubbing",this.scrubbing_),t)this.addClass("vjs-scrubbing");else this.removeClass("vjs-scrubbing")}currentTime(t){if(t===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(t<0)t=0;if(!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=t,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}if(this.techCall_("setCurrentTime",t),this.cache_.initTime=0,isFinite(t))this.cache_.currentTime=Number(t)}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(t){if(t===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;if(t=parseFloat(t),t<0)t=1/0;if(t!==this.cache_.duration){if(this.cache_.duration=t,t===1/0)this.addClass("vjs-live");else this.removeClass("vjs-live");if(!isNaN(t))this.trigger("durationchange")}}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let t=this.techGet_("buffered");if(!t||!t.length)t=Jn(0,0);return t}seekable(){let t=this.techGet_("seekable");if(!t||!t.length)t=Jn(0,0);return t}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return ly(this.buffered(),this.duration())}bufferedEnd(){let t=this.buffered(),e=this.duration(),a=t.end(t.length-1);if(a>e)a=e;return a}volume(t){let e;if(t!==void 0){if(e=Math.max(0,Math.min(1,t)),this.cache_.volume=e,this.techCall_("setVolume",e),e>0)this.lastVolume_(e);return}return e=parseFloat(this.techGet_("volume")),isNaN(e)?1:e}muted(t){if(t!==void 0){this.techCall_("setMuted",t);return}return this.techGet_("muted")||!1}defaultMuted(t){if(t!==void 0)this.techCall_("setDefaultMuted",t);return this.techGet_("defaultMuted")||!1}lastVolume_(t){if(t!==void 0&&t!==0){this.cache_.lastVolume=t;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(t){if(t!==void 0){let e=this.isFullscreen_;if(this.isFullscreen_=Boolean(t),this.isFullscreen_!==e&&this.fsApi_.prefixed)this.trigger("fullscreenchange");this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(t){if(this.isInPictureInPicture())this.exitPictureInPicture();let e=this;return new Promise((a,i)=>{function s(){e.off("fullscreenerror",l),e.off("fullscreenchange",n)}function n(){s(),a()}function l(o,c){s(),i(c)}e.one("fullscreenchange",n),e.one("fullscreenerror",l);let f=e.requestFullscreenHelper_(t);if(f)f.then(s,s),f.then(a,i)})}requestFullscreenHelper_(t){let e;if(!this.fsApi_.prefixed){if(e=this.options_.fullscreen&&this.options_.fullscreen.options||{},t!==void 0)e=t}if(this.fsApi_.requestFullscreen){let a=this.el_[this.fsApi_.requestFullscreen](e);if(a)a.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1));return a}else if(this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow===!0)this.techCall_("enterFullScreen");else this.enterFullWindow()}exitFullscreen(){let t=this;return new Promise((e,a)=>{function i(){t.off("fullscreenerror",n),t.off("fullscreenchange",s)}function s(){i(),e()}function n(f,o){i(),a(o)}t.one("fullscreenchange",s),t.one("fullscreenerror",n);let l=t.exitFullscreenHelper_();if(l)l.then(i,i),l.then(e,a)})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){let t=Ot.default[this.fsApi_.exitFullscreen]();if(t)p0(t.then(()=>this.isFullscreen(!1)));return t}else if(this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow===!0)this.techCall_("exitFullScreen");else this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=Ot.default.documentElement.style.overflow,an(Ot.default,"keydown",this.boundFullWindowOnEscKey_),Ot.default.documentElement.style.overflow="hidden",Vf(Ot.default.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(t){if(t.key==="Escape"){if(this.isFullscreen()===!0)if(!this.isFullWindow)this.exitFullscreen();else this.exitFullWindow()}}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,is(Ot.default,"keydown",this.boundFullWindowOnEscKey_),Ot.default.documentElement.style.overflow=this.docOrigOverflow,Hm(Ot.default.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(t){if(t===void 0)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",t),this.options_.disablePictureInPicture=t,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(t){if(t!==void 0){this.isInPictureInPicture_=!!t,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&$.default.documentPictureInPicture){let t=Ot.default.createElement(this.el().tagName);if(t.classList=this.el().classList,t.classList.add("vjs-pip-container"),this.posterImage)t.appendChild(this.posterImage.el().cloneNode(!0));if(this.titleBar)t.appendChild(this.titleBar.el().cloneNode(!0));return t.appendChild(he("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),$.default.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then((e)=>{return YS(e),this.el_.parentNode.insertBefore(t,this.el_),e.document.body.appendChild(this.el_),e.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:e}),e.addEventListener("pagehide",(a)=>{let i=a.target.querySelector(".video-js");t.parentNode.replaceChild(i,t),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),e})}if("pictureInPictureEnabled"in Ot.default&&this.disablePictureInPicture()===!1)return this.techGet_("requestPictureInPicture");return Promise.reject("No PiP mode is available")}exitPictureInPicture(){if($.default.documentPictureInPicture&&$.default.documentPictureInPicture.window)return $.default.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in Ot.default)return Ot.default.exitPictureInPicture()}handleKeyDown(t){let{userActions:e}=this.options_;if(!e||!e.hotkeys)return;if(((i)=>{let s=i.tagName.toLowerCase();if(i.isContentEditable)return!0;let n=["button","checkbox","hidden","radio","reset","submit"];if(s==="input")return n.indexOf(i.type)===-1;return["textarea"].indexOf(s)!==-1})(this.el_.ownerDocument.activeElement))return;if(typeof e.hotkeys==="function")e.hotkeys.call(this,t);else this.handleHotkeys(t)}handleHotkeys(t){let e=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:a=(n)=>t.key.toLowerCase()==="f",muteKey:i=(n)=>t.key.toLowerCase()==="m",playPauseKey:s=(n)=>t.key.toLowerCase()==="k"||t.key.toLowerCase()===" "}=e;if(a.call(this,t)){t.preventDefault(),t.stopPropagation();let n=bt.getComponent("FullscreenToggle");if(Ot.default[this.fsApi_.fullscreenEnabled]!==!1)n.prototype.handleClick.call(this,t)}else if(i.call(this,t))t.preventDefault(),t.stopPropagation(),bt.getComponent("MuteToggle").prototype.handleClick.call(this,t);else if(s.call(this,t))t.preventDefault(),t.stopPropagation(),bt.getComponent("PlayToggle").prototype.handleClick.call(this,t)}canPlayType(t){let e;for(let a=0,i=this.options_.techOrder;a<i.length;a++){let s=i[a],n=Se.getTech(s);if(!n)n=bt.getComponent(s);if(!n){De.error(`The "${s}" tech is undefined. Skipped browser support check for that tech.`);continue}if(n.isSupported()){if(e=n.canPlayType(t),e)return e}}return""}selectSource(t){let e=this.options_.techOrder.map((l)=>{return[l,Se.getTech(l)]}).filter(([l,f])=>{if(f)return f.isSupported();return De.error(`The "${l}" tech is undefined. Skipped browser support check for that tech.`),!1}),a=function(l,f,o){let c;return l.some((u)=>{return f.some((m)=>{if(c=o(u,m),c)return!0})}),c},i,s=(l)=>(f,o)=>l(o,f),n=([l,f],o)=>{if(f.canPlaySource(o,this.options_[l.toLowerCase()]))return{source:o,tech:l}};if(this.options_.sourceOrder)i=a(t,e,s(n));else i=a(e,t,n);return i||!1}handleSrc_(t,e){if(typeof t>"u")return this.cache_.src||"";if(this.resetRetryOnError_)this.resetRetryOnError_();let a=oy(t);if(!a.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,!e)this.cache_.sources=a;if(this.updateSourceCaches_(a[0]),_x(this,a[0],(i,s)=>{if(this.middleware_=s,!e)this.cache_.sources=a;if(this.updateSourceCaches_(i),this.src_(i)){if(a.length>1)return this.handleSrc_(a.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}Fx(s,this.tech_)}),a.length>1){let i=()=>{this.error(null),this.handleSrc_(a.slice(1),!0)},s=()=>{this.off("error",i)};this.one("error",i),this.one("playing",s),this.resetRetryOnError_=()=>{this.off("error",i),this.off("playing",s)}}}src(t){return this.handleSrc_(t,!1)}src_(t){let e=this.selectSource([t]);if(!e)return!0;if(!ay(e.tech,this.techName_))return this.changingSrc_=!0,this.loadTech_(e.tech,e.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1;return this.ready(function(){if(this.tech_.constructor.prototype.hasOwnProperty("setSource"))this.techCall_("setSource",t);else this.techCall_("src",t.src);this.changingSrc_=!1},!0),!1}addSourceElement(t,e){if(!this.tech_)return!1;return this.tech_.addSourceElement(t,e)}removeSourceElement(t){if(!this.tech_)return!1;return this.tech_.removeSourceElement(t)}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{let t=this.play();p0(t.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(b1(this))this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);let{currentTimeDisplay:t,durationDisplay:e,progressControl:a,remainingTimeDisplay:i}=this.controlBar||{},{seekBar:s}=a||{};if(t)t.updateContent();if(e)e.updateContent();if(i)i.updateContent();if(s){if(s.update(),s.loadProgressBar)s.loadProgressBar.update()}}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){let t=this.currentSource(),e=[];if(Object.keys(t).length!==0)e.push(t);return this.cache_.sources||e}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(t){if(t!==void 0){this.techCall_("setPreload",t),this.options_.preload=t;return}return this.techGet_("preload")}autoplay(t){if(t===void 0)return this.options_.autoplay||!1;let e;if(typeof t==="string"&&/(any|play|muted)/.test(t)||t===!0&&this.options_.normalizeAutoplay)this.options_.autoplay=t,this.manualAutoplay_(typeof t==="string"?t:"play"),e=!1;else if(!t)this.options_.autoplay=!1;else this.options_.autoplay=!0;if(e=typeof e>"u"?this.options_.autoplay:e,this.tech_)this.techCall_("setAutoplay",e)}playsinline(t){if(t!==void 0)this.techCall_("setPlaysinline",t),this.options_.playsinline=t;return this.techGet_("playsinline")}loop(t){if(t!==void 0){this.techCall_("setLoop",t),this.options_.loop=t;return}return this.techGet_("loop")}poster(t){if(t===void 0)return this.poster_;if(!t)t="";if(t===this.poster_)return;this.poster_=t,this.techCall_("setPoster",t),this.isPosterFromTech_=!1,this.trigger("posterchange")}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){let t=this.tech_.poster()||"";if(t!==this.poster_)this.poster_=t,this.isPosterFromTech_=!0,this.trigger("posterchange")}}controls(t){if(t===void 0)return!!this.controls_;if(t=!!t,this.controls_===t)return;if(this.controls_=t,this.usingNativeControls())this.techCall_("setControls",t);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(t){if(t===void 0)return!!this.usingNativeControls_;if(t=!!t,this.usingNativeControls_===t)return;if(this.usingNativeControls_=t,this.usingNativeControls_)this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols");else this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")}error(t){if(t===void 0)return this.error_||null;if(vl("beforeerror").forEach((e)=>{let a=e(this,t);if(!(q0(a)&&!Array.isArray(a)||typeof a==="string"||typeof a==="number"||a===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}t=a}),this.options_.suppressNotSupportedError&&t&&t.code===4){let e=function(){this.error(t)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],e),this.one("loadstart",function(){this.off(["click","touchstart"],e)});return}if(t===null){if(this.error_=null,this.removeClass("vjs-error"),this.errorDisplay)this.errorDisplay.close();return}this.error_=new xa(t),this.addClass("vjs-error"),De.error(`(CODE:${this.error_.code} ${xa.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),vl("error").forEach((e)=>e(this,this.error_));return}reportUserActivity(t){this.userActivity_=!0}userActive(t){if(t===void 0)return this.userActive_;if(t=!!t,t===this.userActive_)return;if(this.userActive_=t,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(e){e.stopPropagation(),e.preventDefault()});this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}listenForUserActivity_(){let t,e,a,i=qa(this,this.reportUserActivity),s=function(u){if(u.screenX!==e||u.screenY!==a)e=u.screenX,a=u.screenY,i()},n=function(){i(),this.clearInterval(t),t=this.setInterval(i,250)},l=function(u){i(),this.clearInterval(t)};this.on("mousedown",n),this.on("mousemove",s),this.on("mouseup",l),this.on("mouseleave",l);let f=this.getChild("controlBar");if(f&&!as&&!Qn)f.on("mouseenter",function(u){if(this.player().options_.inactivityTimeout!==0)this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout;this.player().options_.inactivityTimeout=0}),f.on("mouseleave",function(u){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout});this.on("keydown",i),this.on("keyup",i);let o,c=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(o);let u=this.options_.inactivityTimeout;if(u<=0)return;o=this.setTimeout(function(){if(!this.userActivity_)this.userActive(!1)},u)};this.setInterval(c,250)}playbackRate(t){if(t!==void 0){this.techCall_("setPlaybackRate",t);return}if(this.tech_&&this.tech_.featuresPlaybackRate)return this.cache_.lastPlaybackRate||this.techGet_("playbackRate");return 1}defaultPlaybackRate(t){if(t!==void 0)return this.techCall_("setDefaultPlaybackRate",t);if(this.tech_&&this.tech_.featuresPlaybackRate)return this.techGet_("defaultPlaybackRate");return 1}isAudio(t){if(t!==void 0){this.isAudio_=!!t;return}return!!this.isAudio_}updatePlayerHeightOnAudioOnlyMode_(){let t=this.getChild("ControlBar");if(!t||this.audioOnlyCache_.controlBarHeight===t.currentHeight())return;this.audioOnlyCache_.controlBarHeight=t.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight)}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");let t=this.children(),e=this.getChild("ControlBar"),a=e&&e.currentHeight();t.forEach((i)=>{if(i===e)return;if(i.el_&&!i.hasClass("vjs-hidden"))i.hide(),this.audioOnlyCache_.hiddenChildren.push(i)}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=a,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(a),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach((t)=>t.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(t){if(typeof t!=="boolean"||t===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=t,t){let e=[];if(this.isInPictureInPicture())e.push(this.exitPictureInPicture());if(this.isFullscreen())e.push(this.exitFullscreen());if(this.audioPosterMode())e.push(this.audioPosterMode(!1));return Promise.all(e).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(t){if(typeof t!=="boolean"||t===this.audioPosterMode_)return this.audioPosterMode_;if(this.audioPosterMode_=t,t){if(this.audioOnlyMode())return this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()});return Promise.resolve().then(()=>{this.enablePosterModeUI_()})}return Promise.resolve().then(()=>{this.disablePosterModeUI_()})}addTextTrack(t,e,a){if(this.tech_)return this.tech_.addTextTrack(t,e,a)}addRemoteTextTrack(t,e){if(this.tech_)return this.tech_.addRemoteTextTrack(t,e)}removeRemoteTextTrack(t={}){let{track:e}=t;if(!e)e=t;if(this.tech_)return this.tech_.removeRemoteTextTrack(e)}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(t){if(t===void 0)return this.language_;if(this.language_!==String(t).toLowerCase()){if(this.language_=String(t).toLowerCase(),b1(this))this.trigger("languagechange")}}languages(){return ga(ea.prototype.options_.languages,this.languages_)}toJSON(){let t=ga(this.options_),e=t.tracks;t.tracks=[];for(let a=0;a<e.length;a++){let i=e[a];i=ga(i),i.player=void 0,t.tracks[a]=i}return t}createModal(t,e){e=e||{},e.content=t||"";let a=new Zf(this,e);return this.addChild(a),a.on("dispose",()=>{this.removeChild(a)}),a.open(),a}updateCurrentBreakpoint_(){if(!this.responsive())return;let t=this.currentBreakpoint(),e=this.currentWidth();for(let a=0;a<Ig.length;a++){let i=Ig[a],s=this.breakpoints_[i];if(e<=s){if(t===i)return;if(t)this.removeClass(im[t]);this.addClass(im[i]),this.breakpoint_=i;break}}}removeCurrentBreakpoint_(){let t=this.currentBreakpointClass();if(this.breakpoint_="",t)this.removeClass(t)}breakpoints(t){if(t===void 0)return Object.assign(this.breakpoints_);return this.breakpoint_="",this.breakpoints_=Object.assign({},Wx,t),this.updateCurrentBreakpoint_(),Object.assign(this.breakpoints_)}responsive(t){if(t===void 0)return this.responsive_;t=Boolean(t);let e=this.responsive_;if(t===e)return;if(this.responsive_=t,t)this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_();else this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_();return t}currentBreakpoint(){return this.breakpoint_}currentBreakpointClass(){return im[this.breakpoint_]||""}loadMedia(t,e){if(!t||typeof t!=="object")return;let a=this.crossOrigin();this.reset(),this.cache_.media=ga(t);let{artist:i,artwork:s,description:n,poster:l,src:f,textTracks:o,title:c}=this.cache_.media;if(!s&&l)this.cache_.media.artwork=[{src:l,type:bm(l)}];if(a)this.crossOrigin(a);if(f)this.src(f);if(l)this.poster(l);if(Array.isArray(o))o.forEach((u)=>this.addRemoteTextTrack(u,!1));if(this.titleBar)this.titleBar.update({title:c,description:n||i||""});this.ready(e)}getMedia(){if(!this.cache_.media){let t=this.poster(),e=this.currentSources(),a=Array.prototype.map.call(this.remoteTextTracks(),(s)=>({kind:s.kind,label:s.label,language:s.language,src:s.src})),i={src:e,textTracks:a};if(t)i.poster=t,i.artwork=[{src:i.poster,type:bm(i.poster)}];return i}return ga(this.cache_.media)}static getTagSettings(t){let e={sources:[],tracks:[]},a=jl(t),i=a["data-setup"];if(y2(t,"vjs-fill"))a.fill=!0;if(y2(t,"vjs-fluid"))a.fluid=!0;if(i!==null)try{Object.assign(a,JSON.parse(i||"{}"))}catch(s){De.error("data-setup",s)}if(Object.assign(e,a),t.hasChildNodes()){let s=t.childNodes;for(let n=0,l=s.length;n<l;n++){let f=s[n],o=f.nodeName.toLowerCase();if(o==="source")e.sources.push(jl(f));else if(o==="track")e.tracks.push(jl(f))}}return e}debug(t){if(t===void 0)return this.debugEnabled_;if(t)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(t){if(t===void 0)return this.cache_.playbackRates;if(!Array.isArray(t))return;if(!t.every((e)=>typeof e==="number"))return;this.cache_.playbackRates=t,this.trigger("playbackrateschange")}}ea.prototype.videoTracks=()=>{};ea.prototype.audioTracks=()=>{};ea.prototype.textTracks=()=>{};ea.prototype.remoteTextTracks=()=>{};ea.prototype.remoteTextTrackEls=()=>{};gs.names.forEach(function(t){let e=gs[t];ea.prototype[e.getterName]=function(){if(this.tech_)return this.tech_[e.getterName]();return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});ea.prototype.crossorigin=ea.prototype.crossOrigin;ea.players={};var q2=$.default.navigator;ea.prototype.options_={techOrder:Se.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2000,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:q2&&(q2.languages&&q2.languages[0]||q2.userLanguage||q2.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};By.forEach(function(t){ea.prototype[`handleTech${Va(t)}_`]=function(){return this.trigger(t)}});bt.registerComponent("Player",ea);var wm="plugin",Lo="activePlugins_",Uo={},jm=(t)=>Uo.hasOwnProperty(t),sm=(t)=>jm(t)?Uo[t]:void 0,Oy=(t,e)=>{t[Lo]=t[Lo]||{},t[Lo][e]=!0},dm=(t,e,a)=>{let i=(a?"before":"")+"pluginsetup";t.trigger(i,e),t.trigger(i+":"+e.name,e)},Px=function(t,e){let a=function(){dm(this,{name:t,plugin:e,instance:null},!0);let i=e.apply(this,arguments);return Oy(this,t),dm(this,{name:t,plugin:e,instance:i}),i};return Object.keys(e).forEach(function(i){a[i]=e[i]}),a},lS=(t,e)=>{return e.prototype.name=t,function(...a){dm(this,{name:t,plugin:e,instance:null},!0);let i=new e(...[this,...a]);return this[t]=()=>i,dm(this,i.getEventHash()),i}};class Ts{constructor(t){if(this.constructor===Ts)throw Error("Plugin must be sub-classed; not directly instantiated.");if(this.player=t,!this.log)this.log=this.player.log.createLogger(this.name);r7(this),delete this.trigger,ey(this,this.constructor.defaultState),Oy(t,this.name),this.dispose=this.dispose.bind(this),t.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(t={}){return t.name=this.name,t.plugin=this.constructor,t.instance=this,t}trigger(t,e={}){return sh(this.eventBusEl_,t,this.getEventHash(e))}handleStateChanged(t){}dispose(){let{name:t,player:e}=this;this.trigger("dispose"),this.off(),e.off("dispose",this.dispose),e[Lo][t]=!1,this.player=this.state=null,e[t]=lS(t,Uo[t])}static isBasic(t){let e=typeof t==="string"?sm(t):t;return typeof e==="function"&&!Ts.prototype.isPrototypeOf(e.prototype)}static registerPlugin(t,e){if(typeof t!=="string")throw Error(`Illegal plugin name, "${t}", must be a string, was ${typeof t}.`);if(jm(t))De.warn(`A plugin named "${t}" already exists. You may want to avoid re-registering plugins!`);else if(ea.prototype.hasOwnProperty(t))throw Error(`Illegal plugin name, "${t}", cannot share a name with an existing player method!`);if(typeof e!=="function")throw Error(`Illegal plugin for "${t}", must be a function, was ${typeof e}.`);if(Uo[t]=e,t!==wm)if(Ts.isBasic(e))ea.prototype[t]=Px(t,e);else ea.prototype[t]=lS(t,e);return e}static deregisterPlugin(t){if(t===wm)throw Error("Cannot de-register base plugin.");if(jm(t))delete Uo[t],delete ea.prototype[t]}static getPlugins(t=Object.keys(Uo)){let e;return t.forEach((a)=>{let i=sm(a);if(i)e=e||{},e[a]=i}),e}static getPluginVersion(t){let e=sm(t);return e&&e.VERSION||""}}Ts.getPlugin=sm;Ts.BASE_PLUGIN_NAME=wm;Ts.registerPlugin(wm,Ts);ea.prototype.usingPlugin=function(t){return!!this[Lo]&&this[Lo][t]===!0};ea.prototype.hasPlugin=function(t){return!!jm(t)};function tU(t,e){let a=!1;return function(...i){if(!a)De.warn(t);return a=!0,e.apply(this,i)}}function Zn(t,e,a,i){return tU(`${e} is deprecated and will be removed in ${t}.0; please use ${a} instead.`,i)}var eU={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"},Hy=(t)=>t.indexOf("#")===0?t.slice(1):t;function lt(t,e,a){let i=lt.getPlayer(t);if(i){if(e)De.warn(`Player "${t}" is already initialised. Options will not be applied.`);if(a)i.ready(a);return i}let s=typeof t==="string"?Sl("#"+Hy(t)):t;if(!ih(s))throw TypeError("The element or ID supplied is not valid. (videojs)");let l=("getRootNode"in s?s.getRootNode()instanceof $.default.ShadowRoot:!1)?s.getRootNode():s.ownerDocument.body;if(!s.ownerDocument.defaultView||!l.contains(s))De.warn("The element supplied is not included in the DOM");if(e=e||{},e.restoreEl===!0)e.restoreEl=(s.parentNode&&s.parentNode.hasAttribute&&s.parentNode.hasAttribute("data-vjs-player")?s.parentNode:s).cloneNode(!0);return vl("beforesetup").forEach((o)=>{let c=o(s,ga(e));if(!q0(c)||Array.isArray(c)){De.error("please return an object in beforesetup hooks");return}e=ga(e,c)}),i=new(bt.getComponent("Player"))(s,e,a),vl("setup").forEach((o)=>o(i)),i}lt.hooks_=m1;lt.hooks=vl;lt.hook=PE;lt.hookOnce=tx;lt.removeHook=CS;if($.default.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&ah()){let t=Sl(".vjs-styles-defaults");if(!t){t=ZS("vjs-styles-defaults");let e=Sl("head");if(e)e.insertBefore(t,e.firstChild);$S(t,`
204
- .video-js {
205
- width: 300px;
206
- height: 150px;
207
- }
208
-
209
- .vjs-fluid:not(.vjs-audio-only-mode) {
210
- padding-top: 56.25%
211
- }
212
- `)}}Rg(1,lt);lt.VERSION=Hg;lt.options=ea.prototype.options_;lt.getPlayers=()=>ea.players;lt.getPlayer=(t)=>{let e=ea.players,a;if(typeof t==="string"){let i=Hy(t),s=e[i];if(s)return s;a=Sl("#"+i)}else a=t;if(ih(a)){let{player:i,playerId:s}=a;if(i||e[s])return i||e[s]}};lt.getAllPlayers=()=>Object.keys(ea.players).map((t)=>ea.players[t]).filter(Boolean);lt.players=ea.players;lt.getComponent=bt.getComponent;lt.registerComponent=(t,e)=>{if(Se.isTech(e))De.warn(`The ${t} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`);return bt.registerComponent.call(bt,t,e)};lt.getTech=Se.getTech;lt.registerTech=Se.registerTech;lt.use=Cx;Object.defineProperty(lt,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(lt.middleware,"TERMINATOR",{value:gm,writeable:!1,enumerable:!0});lt.browser=RS;lt.obj=ix;lt.mergeOptions=Zn(9,"videojs.mergeOptions","videojs.obj.merge",ga);lt.defineLazyProperty=Zn(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Cm);lt.bind=Zn(9,"videojs.bind","native Function.prototype.bind",qa);lt.registerPlugin=Ts.registerPlugin;lt.deregisterPlugin=Ts.deregisterPlugin;lt.plugin=(t,e)=>{return De.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Ts.registerPlugin(t,e)};lt.getPlugins=Ts.getPlugins;lt.getPlugin=Ts.getPlugin;lt.getPluginVersion=Ts.getPluginVersion;lt.addLanguage=function(t,e){return t=(""+t).toLowerCase(),lt.options.languages=ga(lt.options.languages,{[t]:e}),lt.options.languages[t]};lt.log=De;lt.createLogger=_S;lt.time=jx;lt.createTimeRange=Zn(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Jn);lt.createTimeRanges=Zn(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Jn);lt.formatTime=Zn(9,"videojs.formatTime","videojs.time.formatTime",Qf);lt.setFormatTime=Zn(9,"videojs.setFormatTime","videojs.time.setFormatTime",sy);lt.resetFormatTime=Zn(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",ny);lt.parseUrl=Zn(9,"videojs.parseUrl","videojs.url.parseUrl",u7);lt.isCrossOrigin=Zn(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",Um);lt.EventTarget=Rs;lt.any=f7;lt.on=an;lt.one=Nm;lt.off=is;lt.trigger=sh;lt.xhr=a7.default;lt.TrackList=yl;lt.TextTrack=nh;lt.TextTrackList=Em;lt.AudioTrack=g7;lt.AudioTrackList=h7;lt.VideoTrack=b7;lt.VideoTrackList=c7;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach((t)=>{lt[t]=function(){return De.warn(`videojs.${t}() is deprecated; use videojs.dom.${t}() instead`),JS[t].apply(null,arguments)}});lt.computedStyle=Zn(9,"videojs.computedStyle","videojs.dom.computedStyle",th);lt.dom=JS;lt.fn=ux;lt.num=Ux;lt.str=px;lt.url=yx;lt.Error=eU;/*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */class My{constructor(t){let e=this;return e.id=t.id,e.label=e.id,e.width=t.width,e.height=t.height,e.bitrate=t.bandwidth,e.frameRate=t.frameRate,e.enabled_=t.enabled,Object.defineProperty(e,"enabled",{get(){return e.enabled_()},set(a){e.enabled_(a)}}),e}}class M2 extends lt.EventTarget{constructor(){super();let t=this;return t.levels_=[],t.selectedIndex_=-1,Object.defineProperty(t,"selectedIndex",{get(){return t.selectedIndex_}}),Object.defineProperty(t,"length",{get(){return t.levels_.length}}),t[Symbol.iterator]=()=>t.levels_.values(),t}addQualityLevel(t){let e=this.getQualityLevelById(t.id);if(e)return e;let a=this.levels_.length;if(e=new My(t),!(""+a in this))Object.defineProperty(this,a,{get(){return this.levels_[a]}});return this.levels_.push(e),this.trigger({qualityLevel:e,type:"addqualitylevel"}),e}removeQualityLevel(t){let e=null;for(let a=0,i=this.length;a<i;a++)if(this[a]===t){if(e=this.levels_.splice(a,1)[0],this.selectedIndex_===a)this.selectedIndex_=-1;else if(this.selectedIndex_>a)this.selectedIndex_--;break}if(e)this.trigger({qualityLevel:t,type:"removequalitylevel"});return e}getQualityLevelById(t){for(let e=0,a=this.length;e<a;e++){let i=this[e];if(i.id===t)return i}return null}dispose(){this.selectedIndex_=-1,this.levels_.length=0}}M2.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(let t in M2.prototype.allowedEvents_)M2.prototype["on"+t]=null;var Dy="4.1.0",aU=function(t,e){let a=t.qualityLevels,i=new M2,s=function(){i.dispose(),t.qualityLevels=a,t.off("dispose",s)};return t.on("dispose",s),t.qualityLevels=()=>i,t.qualityLevels.VERSION=Dy,i},Ty=function(t){return aU(this,lt.obj.merge({},t))};lt.registerPlugin("qualityLevels",Ty);Ty.VERSION=Dy;/*! @name @videojs/http-streaming @version 3.17.3 @license Apache-2.0 */var Ms=yo,qm=(t,e)=>{if(e&&e.responseURL&&t!==e.responseURL)return e.responseURL;return t},_n=(t)=>{if(lt.log.debug)return lt.log.debug.bind(lt,"VHS:",`${t} >`);return function(){}};function aa(...t){let e=lt.obj||lt;return(e.merge||e.mergeOptions).apply(e,t)}function Hi(...t){let e=lt.time||lt;return(e.createTimeRanges||e.createTimeRanges).apply(e,t)}function iU(t){if(t.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges:
213
- `;for(let a=0;a<t.length;a++){let i=t.start(a),s=t.end(a);e+=`${i} --> ${s}. Duration (${s-i})
214
- `}return e}var w0=0.03333333333333333,j0=w0*3,Ry=function(t,e){let a=[],i;if(t&&t.length){for(i=0;i<t.length;i++)if(e(t.start(i),t.end(i)))a.push([t.start(i),t.end(i)])}return Hi(a)},Io=function(t,e){return Ry(t,function(a,i){return a-j0<=e&&i+j0>=e})},P5=function(t,e){return Ry(t,function(a){return a-w0>=e})},sU=function(t){if(t.length<2)return Hi();let e=[];for(let a=1;a<t.length;a++){let i=t.end(a-1),s=t.start(a);e.push([i,s])}return Hi(e)},nU=function(t,e){let a=null,i=null,s=0,n=[],l=[];if(!t||!t.length||!e||!e.length)return Hi();let f=t.length;while(f--)n.push({time:t.start(f),type:"start"}),n.push({time:t.end(f),type:"end"});f=e.length;while(f--)n.push({time:e.start(f),type:"start"}),n.push({time:e.end(f),type:"end"});n.sort(function(o,c){return o.time-c.time});for(f=0;f<n.length;f++){if(n[f].type==="start"){if(s++,s===2)a=n[f].time}else if(n[f].type==="end"){if(s--,s===1)i=n[f].time}if(a!==null&&i!==null)l.push([a,i]),a=null,i=null}return Hi(l)},Ny=(t)=>{let e=[];if(!t||!t.length)return"";for(let a=0;a<t.length;a++)e.push(t.start(a)+" => "+t.end(a));return e.join(", ")},lU=function(t,e,a=1){return((t.length?t.end(t.length-1):0)-e)/a},Kf=(t)=>{let e=[];for(let a=0;a<t.length;a++)e.push({start:t.start(a),end:t.end(a)});return e},fU=function(t,e){if(t===e)return!1;if(!t&&e||!e&&t)return!0;if(t.length!==e.length)return!0;for(let a=0;a<t.length;a++)if(t.start(a)!==e.start(a)||t.end(a)!==e.end(a))return!0;return!1},Cg=function(t){if(!t||!t.length||!t.end)return;return t.end(t.length-1)},K7=function(t,e){let a=0;if(!t||!t.length)return a;for(let i=0;i<t.length;i++){let s=t.start(i),n=t.end(i);if(e>n)continue;if(e>s&&e<=n){a+=n-e;continue}a+=n-s}return a},L7=(t,e)=>{if(!e.preload)return e.duration;let a=0;return(e.parts||[]).forEach(function(i){a+=i.duration}),(e.preloadHints||[]).forEach(function(i){if(i.type==="PART")a+=t.partTargetDuration}),a},Gg=(t)=>(t.segments||[]).reduce((e,a,i)=>{if(a.parts)a.parts.forEach(function(s,n){e.push({duration:s.duration,segmentIndex:i,partIndex:n,part:s,segment:a})});else e.push({duration:a.duration,segmentIndex:i,partIndex:null,segment:a,part:null});return e},[]),zy=(t)=>{let e=t.segments&&t.segments.length&&t.segments[t.segments.length-1];return e&&e.parts||[]},Ey=({preloadSegment:t})=>{if(!t)return;let{parts:e,preloadHints:a}=t,i=(a||[]).reduce((s,n)=>s+(n.type==="PART"?1:0),0);return i+=e&&e.length?e.length:0,i},xy=(t,e)=>{if(e.endList)return 0;if(t&&t.suggestedPresentationDelay)return t.suggestedPresentationDelay;let a=zy(e).length>0;if(a&&e.serverControl&&e.serverControl.partHoldBack)return e.serverControl.partHoldBack;else if(a&&e.partTargetDuration)return e.partTargetDuration*3;else if(e.serverControl&&e.serverControl.holdBack)return e.serverControl.holdBack;else if(e.targetDuration)return e.targetDuration*3;return 0},rU=function(t,e){let a=0,i=e-t.mediaSequence,s=t.segments[i];if(s){if(typeof s.start<"u")return{result:s.start,precise:!0};if(typeof s.end<"u")return{result:s.end-s.duration,precise:!0}}while(i--){if(s=t.segments[i],typeof s.end<"u")return{result:a+s.end,precise:!0};if(a+=L7(t,s),typeof s.start<"u")return{result:a+s.start,precise:!0}}return{result:a,precise:!1}},oU=function(t,e){let a=0,i,s=e-t.mediaSequence;for(;s<t.segments.length;s++){if(i=t.segments[s],typeof i.start<"u")return{result:i.start-a,precise:!0};if(a+=L7(t,i),typeof i.end<"u")return{result:i.end-a,precise:!0}}return{result:-1,precise:!1}},Uy=function(t,e,a){if(typeof e>"u")e=t.mediaSequence+t.segments.length;if(e<t.mediaSequence)return 0;let i=rU(t,e);if(i.precise)return i.result;let s=oU(t,e);if(s.precise)return s.result;return i.result+a},Iy=function(t,e,a){if(!t)return 0;if(typeof a!=="number")a=0;if(typeof e>"u"){if(t.totalDuration)return t.totalDuration;if(!t.endList)return $.default.Infinity}return Uy(t,e,a)},_2=function({defaultDuration:t,durationList:e,startIndex:a,endIndex:i}){let s=0;if(a>i)[a,i]=[i,a];if(a<0){for(let n=a;n<Math.min(0,i);n++)s+=t;a=0}for(let n=a;n<i;n++)s+=e[n].duration;return s},Gy=function(t,e,a,i){if(!t||!t.segments)return null;if(t.endList)return Iy(t);if(e===null)return null;e=e||0;let s=Uy(t,t.mediaSequence+t.segments.length,e);if(a)i=typeof i==="number"?i:xy(null,t),s-=i;return Math.max(0,s)},hU=function(t,e,a){let s=e||0,n=Gy(t,e,!0,a);if(n===null)return Hi();if(n<s)n=s;return Hi(s,n)},cU=function({playlist:t,currentTime:e,startingSegmentIndex:a,startingPartIndex:i,startTime:s,exactManifestTimings:n}){let l=e-s,f=Gg(t),o=0;for(let c=0;c<f.length;c++){let u=f[c];if(a!==u.segmentIndex)continue;if(typeof i==="number"&&typeof u.partIndex==="number"&&i!==u.partIndex)continue;o=c;break}if(l<0){if(o>0)for(let c=o-1;c>=0;c--){let u=f[c];if(l+=u.duration,n){if(l<0)continue}else if(l+w0<=0)continue;return{partIndex:u.partIndex,segmentIndex:u.segmentIndex,startTime:s-_2({defaultDuration:t.targetDuration,durationList:f,startIndex:o,endIndex:c})}}return{partIndex:f[0]&&f[0].partIndex||null,segmentIndex:f[0]&&f[0].segmentIndex||0,startTime:e}}if(o<0){for(let c=o;c<0;c++)if(l-=t.targetDuration,l<0)return{partIndex:f[0]&&f[0].partIndex||null,segmentIndex:f[0]&&f[0].segmentIndex||0,startTime:e};o=0}for(let c=o;c<f.length;c++){let u=f[c];l-=u.duration;let m=u.duration>w0,p=l===0,w=m&&l+w0>=0;if(p||w){if(c!==f.length-1)continue}if(n){if(l>0)continue}else if(l-w0>=0)continue;return{partIndex:u.partIndex,segmentIndex:u.segmentIndex,startTime:s+_2({defaultDuration:t.targetDuration,durationList:f,startIndex:o,endIndex:c})}}return{segmentIndex:f[f.length-1].segmentIndex,partIndex:f[f.length-1].partIndex,startTime:e}},Xy=function(t){return t.excludeUntil&&t.excludeUntil>Date.now()},V7=function(t){return t.excludeUntil&&t.excludeUntil===1/0},a3=function(t){let e=Xy(t);return!t.disabled&&!e},uU=function(t){return t.disabled},mU=function(t){for(let e=0;e<t.segments.length;e++)if(t.segments[e].key)return!0;return!1},Ky=function(t,e){return e.attributes&&e.attributes[t]},gU=function(t,e,a,i=0){if(!Ky("BANDWIDTH",a))return NaN;return(t*a.attributes.BANDWIDTH-i*8)/e},Xg=(t,e)=>{if(t.playlists.length===1)return!0;let a=e.attributes.BANDWIDTH||Number.MAX_VALUE;return t.playlists.filter((i)=>{if(!a3(i))return!1;return(i.attributes.BANDWIDTH||0)<a}).length===0},Y7=(t,e)=>{if(!t&&!e||!t&&e||t&&!e)return!1;if(t===e)return!0;if(t.id&&e.id&&t.id===e.id)return!0;if(t.resolvedUri&&e.resolvedUri&&t.resolvedUri===e.resolvedUri)return!0;if(t.uri&&e.uri&&t.uri===e.uri)return!0;return!1},fS=function(t,e){let a=t&&t.mediaGroups&&t.mediaGroups.AUDIO||{},i=!1;for(let s in a){for(let n in a[s])if(i=e(a[s][n]),i)break;if(i)break}return!!i},z2=(t)=>{if(!t||!t.playlists||!t.playlists.length)return fS(t,(a)=>a.playlists&&a.playlists.length||a.uri);for(let e=0;e<t.playlists.length;e++){let a=t.playlists[e],i=a.attributes&&a.attributes.CODECS;if(i&&i.split(",").every((n)=>T8(n)))continue;if(fS(t,(n)=>Y7(a,n)))continue;return!1}return!0},Ds={liveEdgeDelay:xy,duration:Iy,seekable:hU,getMediaInfoForTime:cU,isEnabled:a3,isDisabled:uU,isExcluded:Xy,isIncompatible:V7,playlistEnd:Gy,isAes:mU,hasAttribute:Ky,estimateSegmentRequestTime:gU,isLowestEnabledRendition:Xg,isAudioOnly:z2,playlistMatch:Y7,segmentDurationWithParts:L7},{log:Ly}=lt,Vo=(t,e)=>{return`${t}-${e}`},Vy=(t,e,a)=>{return`placeholder-uri-${t}-${e}-${a}`},bU=({onwarn:t,oninfo:e,manifestString:a,customTagParsers:i=[],customTagMappers:s=[],llhls:n})=>{let l=new M8;if(t)l.on("warn",t);if(e)l.on("info",e);i.forEach((c)=>l.addParser(c)),s.forEach((c)=>l.addTagMapper(c)),l.push(a),l.end();let f=l.manifest;if(!n){if(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(c){if(f.hasOwnProperty(c))delete f[c]}),f.segments)f.segments.forEach(function(c){["parts","preloadHints"].forEach(function(u){if(c.hasOwnProperty(u))delete c[u]})})}if(!f.targetDuration){let c=10;if(f.segments&&f.segments.length)c=f.segments.reduce((u,m)=>Math.max(u,m.duration),0);if(t)t({message:`manifest has no targetDuration defaulting to ${c}`});f.targetDuration=c}let o=zy(f);if(o.length&&!f.partTargetDuration){let c=o.reduce((u,m)=>Math.max(u,m.duration),0);if(t)t({message:`manifest has no partTargetDuration defaulting to ${c}`}),Ly.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.");f.partTargetDuration=c}return f},rh=(t,e)=>{if(!t.mediaGroups)return;["AUDIO","SUBTITLES"].forEach((a)=>{if(!t.mediaGroups[a])return;for(let i in t.mediaGroups[a])for(let s in t.mediaGroups[a][i]){let n=t.mediaGroups[a][i][s];e(n,a,i,s)}})},Yy=({playlist:t,uri:e,id:a})=>{if(t.id=a,t.playlistErrors_=0,e)t.uri=e;t.attributes=t.attributes||{}},pU=(t)=>{let e=t.playlists.length;while(e--){let a=t.playlists[e];if(Yy({playlist:a,id:Vo(e,a.uri)}),a.resolvedUri=Ms(t.uri,a.uri),t.playlists[a.id]=a,t.playlists[a.uri]=a,!a.attributes.BANDWIDTH)Ly.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},wU=(t)=>{rh(t,(e)=>{if(e.uri)e.resolvedUri=Ms(t.uri,e.uri)})},jU=(t,e)=>{let a=Vo(0,e),i={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:$.default.location.href,resolvedUri:$.default.location.href,playlists:[{uri:e,id:a,resolvedUri:e,attributes:{}}]};return i.playlists[a]=i.playlists[0],i.playlists[e]=i.playlists[0],i},Jy=(t,e,a=Vy)=>{t.uri=e;for(let s=0;s<t.playlists.length;s++)if(!t.playlists[s].uri){let n=`placeholder-uri-${s}`;t.playlists[s].uri=n}let i=z2(t);rh(t,(s,n,l,f)=>{if(!s.playlists||!s.playlists.length){if(i&&n==="AUDIO"&&!s.uri)for(let o=0;o<t.playlists.length;o++){let c=t.playlists[o];if(c.attributes&&c.attributes.AUDIO&&c.attributes.AUDIO===l)return}s.playlists=[za({},s)]}s.playlists.forEach(function(o,c){let u=a(n,l,f,o),m=Vo(c,u);if(o.uri)o.resolvedUri=o.resolvedUri||Ms(t.uri,o.uri);else o.uri=c===0?u:m,o.resolvedUri=o.uri;o.id=o.id||m,o.attributes=o.attributes||{},t.playlists[o.id]=o,t.playlists[o.uri]=o})}),pU(t),wU(t)};class Kg{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(t=[]){if(this.offset_!==null)return;if(!t.length)return;let[e]=t;if(e.programDateTime===void 0)return;this.offset_=e.programDateTime/1000}setPendingDateRanges(t=[]){if(!t.length)return;let[e]=t,a=e.startDate.getTime();this.trimProcessedDateRanges_(a),this.pendingDateRanges_=t.reduce((i,s)=>{return i.set(s.id,s),i},new Map)}processDateRange(t){this.pendingDateRanges_.delete(t.id),this.processedDateRanges_.set(t.id,t)}getDateRangesToProcess(){if(this.offset_===null)return[];let t={},e=[];this.pendingDateRanges_.forEach((a,i)=>{if(this.processedDateRanges_.has(i))return;if(a.startTime=a.startDate.getTime()/1000-this.offset_,a.processDateRange=()=>this.processDateRange(a),e.push(a),!a.class)return;if(t[a.class]){let s=t[a.class].push(a);a.classListIndex=s-1}else t[a.class]=[a],a.classListIndex=0});for(let a of e){let i=t[a.class]||[];if(a.endDate)a.endTime=a.endDate.getTime()/1000-this.offset_;else if(a.endOnNext&&i[a.classListIndex+1])a.endTime=i[a.classListIndex+1].startTime;else if(a.duration)a.endTime=a.startTime+a.duration;else if(a.plannedDuration)a.endTime=a.startTime+a.plannedDuration;else a.endTime=a.startTime}return e}trimProcessedDateRanges_(t){new Map(this.processedDateRanges_).forEach((a,i)=>{if(a.startDate.getTime()<t)this.processedDateRanges_.delete(i)})}}var Qy=22,Jf=({requestType:t,request:e,error:a,parseFailure:i})=>{let s=e.status<200||e.status>299,n=e.status>=400&&e.status<=499,l={uri:e.uri,requestType:t},f=s&&!n||i;if(a&&n)l.error=za({},a),l.errorType=lt.Error.NetworkRequestFailed;else if(e.aborted)l.errorType=lt.Error.NetworkRequestAborted;else if(e.timedout)l.errorType=lt.Error.NetworkRequestTimeout;else if(f){let o=i?lt.Error.NetworkBodyParserFailed:lt.Error.NetworkBadStatus;l.errorType=o,l.status=e.status,l.headers=e.headers}return l},dU=_n("CodecUtils"),Zy=function(t){let e=t.attributes||{};if(e.CODECS)return Yn(e.CODECS)},$y=(t,e)=>{let a=e.attributes||{};return t&&t.mediaGroups&&t.mediaGroups.AUDIO&&a.AUDIO&&t.mediaGroups.AUDIO[a.AUDIO]},qU=(t,e)=>{if(!$y(t,e))return!0;let a=e.attributes||{},i=t.mediaGroups.AUDIO[a.AUDIO];for(let s in i)if(!i[s].uri&&!i[s].playlists)return!0;return!1},D2=function(t){let e={};return t.forEach(({mediaType:a,type:i,details:s})=>{e[a]=e[a]||[],e[a].push(D8(`${i}${s}`))}),Object.keys(e).forEach(function(a){if(e[a].length>1){dU(`multiple ${a} codecs found as attributes: ${e[a].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),e[a]=null;return}e[a]=e[a][0]}),e},rS=function(t){let e=0;if(t.audio)e++;if(t.video)e++;return e},F2=function(t,e){let a=e.attributes||{},i=D2(Zy(e)||[]);if($y(t,e)&&!i.audio){if(!qU(t,e)){let s=D2(iA(t,a.AUDIO)||[]);if(s.audio)i.audio=s.audio}}return i},{EventTarget:AU}=lt,vU=(t,e)=>{if(e.endList||!e.serverControl)return t;let a={};if(e.serverControl.canBlockReload){let{preloadSegment:i}=e,s=e.mediaSequence+e.segments.length;if(i){let n=i.parts||[],l=Ey(e)-1;if(l>-1&&l!==n.length-1)a._HLS_part=l;if(l>-1||n.length)s--}a._HLS_msn=s}if(e.serverControl&&e.serverControl.canSkipUntil)a._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES";if(Object.keys(a).length){let i=new $.default.URL(t);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(s){if(!a.hasOwnProperty(s))return;i.searchParams.set(s,a[s])}),t=i.toString()}return t},SU=(t,e)=>{if(!t)return e;let a=aa(t,e);if(t.preloadHints&&!e.preloadHints)delete a.preloadHints;if(t.parts&&!e.parts)delete a.parts;else if(t.parts&&e.parts){for(let i=0;i<e.parts.length;i++)if(t.parts&&t.parts[i])a.parts[i]=aa(t.parts[i],e.parts[i])}if(!t.skipped&&e.skipped)a.skipped=!1;if(t.preload&&!e.preload)a.preload=!1;return a},yU=(t,e,a)=>{let i=t.slice(),s=e.slice();a=a||0;let n=[],l;for(let f=0;f<s.length;f++){let o=i[f+a],c=s[f];if(o)l=o.map||l,n.push(SU(o,c));else{if(l&&!c.map)c.map=l;n.push(c)}}return n},Wy=(t,e)=>{if(!t.resolvedUri&&t.uri)t.resolvedUri=Ms(e,t.uri);if(t.key&&!t.key.resolvedUri)t.key.resolvedUri=Ms(e,t.key.uri);if(t.map&&!t.map.resolvedUri)t.map.resolvedUri=Ms(e,t.map.uri);if(t.map&&t.map.key&&!t.map.key.resolvedUri)t.map.key.resolvedUri=Ms(e,t.map.key.uri);if(t.parts&&t.parts.length)t.parts.forEach((a)=>{if(a.resolvedUri)return;a.resolvedUri=Ms(e,a.uri)});if(t.preloadHints&&t.preloadHints.length)t.preloadHints.forEach((a)=>{if(a.resolvedUri)return;a.resolvedUri=Ms(e,a.uri)})},Py=function(t){let e=t.segments||[],a=t.preloadSegment;if(a&&a.parts&&a.parts.length){if(a.preloadHints){for(let i=0;i<a.preloadHints.length;i++)if(a.preloadHints[i].type==="MAP")return e}a.duration=t.targetDuration,a.preload=!0,e.push(a)}return e},tk=(t,e)=>t===e||t.segments&&e.segments&&t.segments.length===e.segments.length&&t.endList===e.endList&&t.mediaSequence===e.mediaSequence&&t.preloadSegment===e.preloadSegment,Lg=(t,e,a=tk)=>{let i=aa(t,{}),s=i.playlists[e.id];if(!s)return null;if(a(s,e))return null;e.segments=Py(e);let n=aa(s,e);if(n.preloadSegment&&!e.preloadSegment)delete n.preloadSegment;if(s.segments){if(e.skip){e.segments=e.segments||[];for(let l=0;l<e.skip.skippedSegments;l++)e.segments.unshift({skipped:!0})}n.segments=yU(s.segments,e.segments,e.mediaSequence-s.mediaSequence)}n.segments.forEach((l)=>{Wy(l,n.resolvedUri)});for(let l=0;l<i.playlists.length;l++)if(i.playlists[l].id===e.id)i.playlists[l]=n;return i.playlists[e.id]=n,i.playlists[e.uri]=n,rh(t,(l,f,o,c)=>{if(!l.playlists)return;for(let u=0;u<l.playlists.length;u++)if(e.id===l.playlists[u].id)l.playlists[u]=n}),i},Vg=(t,e)=>{let a=t.segments||[],i=a[a.length-1],s=i&&i.parts&&i.parts[i.parts.length-1],n=s&&s.duration||i&&i.duration;if(e&&n)return n*1000;return(t.partTargetDuration||t.targetDuration||10)*500},oS=(t,e,a)=>{if(!t)return;let i=[];return t.forEach((s)=>{if(!s.attributes)return;let{BANDWIDTH:n,RESOLUTION:l,CODECS:f}=s.attributes;i.push({id:s.id,bandwidth:n,resolution:l,codecs:f})}),{type:e,isLive:a,renditions:i}};class Lf extends AU{constructor(t,e,a={}){super();if(!t)throw Error("A non-empty playlist URL or object is required");this.logger_=_n("PlaylistLoader");let{withCredentials:i=!1}=a;this.src=t,this.vhs_=e,this.withCredentials=i,this.addDateRangesToTextTrack_=a.addDateRangesToTextTrack;let s=e.options_;this.customTagParsers=s&&s.customTagParsers||[],this.customTagMappers=s&&s.customTagMappers||[],this.llhls=s&&s.llhls,this.dateRangesStorage_=new Kg,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){let t=this.media();if(!t)return;this.dateRangesStorage_.setOffset(t.segments),this.dateRangesStorage_.setPendingDateRanges(t.dateRanges);let e=this.dateRangesStorage_.getDateRangesToProcess();if(!e.length||!this.addDateRangesToTextTrack_)return;this.addDateRangesToTextTrack_(e)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;let t=this.media(),e=Ms(this.main.uri,t.uri);if(this.llhls)e=vU(e,t);this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:e,withCredentials:this.withCredentials,requestType:"hls-playlist"},(a,i)=>{if(!this.request)return;if(a)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})})}playlistRequestError(t,e,a){let{uri:i,id:s}=e;if(this.request=null,a)this.state=a;this.error={playlist:this.main.playlists[s],status:t.status,message:`HLS playlist request error at URL: ${i}.`,responseText:t.responseText,code:t.status>=500?4:2,metadata:Jf({requestType:t.requestType,request:t,error:t.error})},this.trigger("error")}parseManifest_({url:t,manifestString:e}){try{let a=bU({onwarn:({message:i})=>this.logger_(`m3u8-parser warn for ${t}: ${i}`),oninfo:({message:i})=>this.logger_(`m3u8-parser info for ${t}: ${i}`),manifestString:e,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls});if(!a.playlists||!a.playlists.length)return a;return this.excludeAudioOnlyVariants(a.playlists),a}catch(a){this.error=a,this.error.metadata={errorType:lt.Error.StreamingHlsPlaylistParserError,error:a}}}excludeAudioOnlyVariants(t){let e=(a)=>{let i=a.attributes||{},{width:s,height:n}=i.RESOLUTION||{};if(s&&n)return!0;let l=Zy(a)||[],f=D2(l);return Boolean(f.video)};if(t.some(e))t.forEach((a)=>{if(!e(a))a.excludeUntil=1/0})}haveMetadata({playlistString:t,playlistObject:e,url:a,id:i}){this.request=null,this.state="HAVE_METADATA";let s={playlistInfo:{type:"media",uri:a}};this.trigger({type:"playlistparsestart",metadata:s});let n=e||this.parseManifest_({url:a,manifestString:t});n.lastRequest=Date.now(),Yy({playlist:n,uri:a,id:i});let l=Lg(this.main,n);if(this.targetDuration=n.partTargetDuration||n.targetDuration,this.pendingMedia_=null,l)this.main=l,this.media_=this.main.playlists[i];else this.trigger("playlistunchanged");this.updateMediaUpdateTimeout_(Vg(this.media(),!!l)),s.parsedPlaylist=oS(this.main.playlists,s.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:s}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),$.default.clearTimeout(this.mediaUpdateTimeout),$.default.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new Kg,this.off()}stopRequest(){if(this.request){let t=this.request;this.request=null,t.onreadystatechange=null,t.abort()}}media(t,e){if(!t)return this.media_;if(this.state==="HAVE_NOTHING")throw Error("Cannot switch media playlist from "+this.state);if(typeof t==="string"){if(!this.main.playlists[t])throw Error("Unknown playlist URI: "+t);t=this.main.playlists[t]}if($.default.clearTimeout(this.finalRenditionTimeout),e){let l=(t.partTargetDuration||t.targetDuration)/2*1000||5000;this.finalRenditionTimeout=$.default.setTimeout(this.media.bind(this,t,!1),l);return}let a=this.state,i=!this.media_||t.id!==this.media_.id,s=this.main.playlists[t.id];if(s&&s.endList||t.endList&&t.segments.length){if(this.request)this.request.onreadystatechange=null,this.request.abort(),this.request=null;if(this.state="HAVE_METADATA",this.media_=t,i)if(this.trigger("mediachanging"),a==="HAVE_MAIN_MANIFEST")this.trigger("loadedmetadata");else this.trigger("mediachange");return}if(this.updateMediaUpdateTimeout_(Vg(t,!0)),!i)return;if(this.state="SWITCHING_MEDIA",this.request){if(t.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}if(this.media_)this.trigger("mediachanging");this.pendingMedia_=t;let n={playlistInfo:{type:"media",uri:t.uri}};this.trigger({type:"playlistrequeststart",metadata:n}),this.request=this.vhs_.xhr({uri:t.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(l,f)=>{if(!this.request)return;if(t.lastRequest=Date.now(),t.resolvedUri=qm(t.resolvedUri,f),l)return this.playlistRequestError(this.request,t,a);if(this.trigger({type:"playlistrequestcomplete",metadata:n}),this.haveMetadata({playlistString:f.responseText,url:t.uri,id:t.id}),a==="HAVE_MAIN_MANIFEST")this.trigger("loadedmetadata");else this.trigger("mediachange")})}pause(){if(this.mediaUpdateTimeout)$.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(t){if(this.mediaUpdateTimeout)$.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;let e=this.media();if(t){let a=e?(e.partTargetDuration||e.targetDuration)/2*1000:5000;this.mediaUpdateTimeout=$.default.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},a);return}if(!this.started){this.start();return}if(e&&!e.endList)this.trigger("mediaupdatetimeout");else this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(t){if(this.mediaUpdateTimeout)$.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;if(!this.media()||this.media().endList)return;this.mediaUpdateTimeout=$.default.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(t)},t)}start(){if(this.started=!0,typeof this.src==="object"){if(!this.src.uri)this.src.uri=$.default.location.href;this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}let t={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(e,a)=>{if(!this.request)return;if(this.request=null,e){if(this.error={status:a.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:a.responseText,code:2,metadata:Jf({requestType:a.requestType,request:a,error:e})},this.state==="HAVE_NOTHING")this.started=!1;return this.trigger("error")}this.trigger({type:"playlistrequestcomplete",metadata:t}),this.src=qm(this.src,a),this.trigger({type:"playlistparsestart",metadata:t});let i=this.parseManifest_({manifestString:a.responseText,url:this.src});t.parsedPlaylist=oS(i.playlists,t.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:t}),this.setupInitialPlaylist(i)})}srcUri(){return typeof this.src==="string"?this.src:this.src.uri}setupInitialPlaylist(t){if(this.state="HAVE_MAIN_MANIFEST",t.playlists){if(this.main=t,Jy(this.main,this.srcUri()),t.playlists.forEach((a)=>{a.segments=Py(a),a.segments.forEach((i)=>{Wy(i,a.resolvedUri)})}),this.trigger("loadedplaylist"),!this.request)this.media(this.main.playlists[0]);return}let e=this.srcUri()||$.default.location.href;this.main=jU(t,e),this.haveMetadata({playlistObject:t,url:e,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(t,e){let a=this.main,i=t.ID,s=a.playlists.length;while(s--){let n=a.playlists[s];if(n.attributes["PATHWAY-ID"]===i){let{resolvedUri:l,id:f}=n;if(e){let o=this.createCloneURI_(n.resolvedUri,t),c=Vo(i,o),u=this.createCloneAttributes_(i,n.attributes),m=this.createClonePlaylist_(n,c,t,u);a.playlists[s]=m,a.playlists[c]=m,a.playlists[o]=m}else a.playlists.splice(s,1);delete a.playlists[f],delete a.playlists[l]}}this.updateOrDeleteCloneMedia(t,e)}updateOrDeleteCloneMedia(t,e){let a=this.main,i=t.ID;if(["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((s)=>{if(!a.mediaGroups[s]||!a.mediaGroups[s][i])return;for(let n in a.mediaGroups[s])if(n===i){for(let l in a.mediaGroups[s][n])a.mediaGroups[s][n][l].playlists.forEach((o,c)=>{let u=a.playlists[o.id],m=u.id,p=u.resolvedUri;delete a.playlists[m],delete a.playlists[p]});delete a.mediaGroups[s][n]}}),e)this.createClonedMediaGroups_(t)}addClonePathway(t,e={}){let a=this.main,i=a.playlists.length,s=this.createCloneURI_(e.resolvedUri,t),n=Vo(t.ID,s),l=this.createCloneAttributes_(t.ID,e.attributes),f=this.createClonePlaylist_(e,n,t,l);a.playlists[i]=f,a.playlists[n]=f,a.playlists[s]=f,this.createClonedMediaGroups_(t)}createClonedMediaGroups_(t){let e=t.ID,a=t["BASE-ID"],i=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((s)=>{if(!i.mediaGroups[s]||i.mediaGroups[s][e])return;for(let n in i.mediaGroups[s]){if(n===a)i.mediaGroups[s][e]={};else continue;for(let l in i.mediaGroups[s][n]){let f=i.mediaGroups[s][n][l];i.mediaGroups[s][e][l]=za({},f);let o=i.mediaGroups[s][e][l],c=this.createCloneURI_(f.resolvedUri,t);o.resolvedUri=c,o.uri=c,o.playlists=[],f.playlists.forEach((u,m)=>{let p=i.playlists[u.id],w=Vy(s,e,l),d=Vo(e,w);if(p&&!i.playlists[d]){let v=this.createClonePlaylist_(p,d,t),k=v.resolvedUri;i.playlists[d]=v,i.playlists[k]=v}o.playlists[m]=this.createClonePlaylist_(u,d,t)})}}})}createClonePlaylist_(t,e,a,i){let s=this.createCloneURI_(t.resolvedUri,a),n={resolvedUri:s,uri:s,id:e};if(t.segments)n.segments=[];if(i)n.attributes=i;return aa(t,n)}createCloneURI_(t,e){let a=new URL(t);a.hostname=e["URI-REPLACEMENT"].HOST;let i=e["URI-REPLACEMENT"].PARAMS;for(let s of Object.keys(i))a.searchParams.set(s,i[s]);return a.href}createCloneAttributes_(t,e){let a={["PATHWAY-ID"]:t};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((i)=>{if(e[i])a[i]=t}),a}getKeyIdSet(t){let e=new Set;if(!t||!t.contentProtection)return e;for(let a in t.contentProtection)if(t.contentProtection[a]&&t.contentProtection[a].attributes&&t.contentProtection[a].attributes.keyId){let i=t.contentProtection[a].attributes.keyId;e.add(i.toLowerCase())}return e}}var Yg=function(t,e,a,i){let s=t.responseType==="arraybuffer"?t.response:t.responseText;if(!e&&s){if(t.responseTime=Date.now(),t.roundTripTime=t.responseTime-t.requestTime,t.bytesReceived=s.byteLength||s.length,!t.bandwidth)t.bandwidth=Math.floor(t.bytesReceived/t.roundTripTime*8*1000)}if(a.headers)t.responseHeaders=a.headers;if(e&&e.code==="ETIMEDOUT")t.timedout=!0;if(!e&&!t.aborted&&a.statusCode!==200&&a.statusCode!==206&&a.statusCode!==0)e=Error("XHR Failed with a response of: "+(t&&(s||t.responseText)));i(e,t)},kU=(t,e)=>{if(!t||!t.size)return;let a=e;return t.forEach((i)=>{a=i(a)}),a},CU=(t,e,a,i)=>{if(!t||!t.size)return;t.forEach((s)=>{s(e,a,i)})},ek=function(){let t=function e(a,i){a=aa({timeout:45000},a);let s=e.beforeRequest||lt.Vhs.xhr.beforeRequest,n=e._requestCallbackSet||lt.Vhs.xhr._requestCallbackSet||new Set,l=e._responseCallbackSet||lt.Vhs.xhr._responseCallbackSet;if(s&&typeof s==="function")lt.log.warn("beforeRequest is deprecated, use onRequest instead."),n.add(s);let f=lt.Vhs.xhr.original===!0?lt.xhr:lt.Vhs.xhr,o=kU(n,a);n.delete(s);let c=f(o||a,function(m,p){return CU(l,c,m,p),Yg(c,m,p,i)}),u=c.abort;return c.abort=function(){return c.aborted=!0,u.apply(c,arguments)},c.uri=a.uri,c.requestType=a.requestType,c.requestTime=Date.now(),c};return t.original=!0,t},_U=function(t){let e,a=t.offset;if(typeof t.offset==="bigint"||typeof t.length==="bigint")e=$.default.BigInt(t.offset)+$.default.BigInt(t.length)-$.default.BigInt(1);else e=t.offset+t.length-1;return"bytes="+a+"-"+e},Jg=function(t){let e={};if(t.byterange)e.Range=_U(t.byterange);return e},FU=function(t,e){return t.start(e)+"-"+t.end(e)},BU=function(t,e){let a=t.toString(16);return"00".substring(0,2-a.length)+a+(e%2?" ":"")},OU=function(t){if(t>=32&&t<126)return String.fromCharCode(t);return"."},ak=function(t){let e={};return Object.keys(t).forEach((a)=>{let i=t[a];if(E8(i))e[a]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength};else e[a]=i}),e},Am=function(t){let e=t.byterange||{length:1/0,offset:0};return[e.length,e.offset,t.resolvedUri].join(",")},ik=function(t){return t.resolvedUri},sk=(t)=>{let e=Array.prototype.slice.call(t),a=16,i="",s,n;for(let l=0;l<e.length/16;l++)s=e.slice(l*16,l*16+16).map(BU).join(""),n=e.slice(l*16,l*16+16).map(OU).join(""),i+=s+" "+n+`
215
- `;return i},HU=({bytes:t})=>sk(t),MU=(t)=>{let e="",a;for(a=0;a<t.length;a++)e+=FU(t,a)+" ";return e},DU=Object.freeze({__proto__:null,createTransferableMessage:ak,initSegmentId:Am,segmentKeyId:ik,hexDump:sk,tagDump:HU,textRanges:MU}),nk=0.25,TU=(t,e)=>{if(!e.dateTimeObject)return null;let a=e.videoTimingInfo.transmuxerPrependedSeconds,s=e.videoTimingInfo.transmuxedPresentationStart+a,n=t-s;return new Date(e.dateTimeObject.getTime()+n*1000)},RU=(t)=>{return t.transmuxedPresentationEnd-t.transmuxedPresentationStart-t.transmuxerPrependedSeconds},NU=(t,e)=>{let a;try{a=new Date(t)}catch(o){return null}if(!e||!e.segments||e.segments.length===0)return null;let i=e.segments[0];if(a<new Date(i.dateTimeObject))return null;for(let o=0;o<e.segments.length-1;o++){i=e.segments[o];let c=new Date(e.segments[o+1].dateTimeObject);if(a<c)break}let s=e.segments[e.segments.length-1],n=s.dateTimeObject,l=s.videoTimingInfo?RU(s.videoTimingInfo):s.duration+s.duration*nk,f=new Date(n.getTime()+l*1000);if(a>f)return null;if(a>new Date(n))i=s;return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:Ds.duration(e,e.mediaSequence+e.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"}},zU=(t,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let a=0,i;for(let n=0;n<e.segments.length;n++)if(i=e.segments[n],a=i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationEnd:a+i.duration,t<=a)break;let s=e.segments[e.segments.length-1];if(s.videoTimingInfo&&s.videoTimingInfo.transmuxedPresentationEnd<t)return null;if(t>a){if(t>a+s.duration*nk)return null;i=s}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:a-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},EU=(t,e)=>{let a,i;try{a=new Date(t),i=new Date(e)}catch(l){}let s=a.getTime();return(i.getTime()-s)/1000},xU=(t)=>{if(!t.segments||t.segments.length===0)return!1;for(let e=0;e<t.segments.length;e++)if(!t.segments[e].dateTimeObject)return!1;return!0},UU=({playlist:t,time:e=void 0,callback:a})=>{if(!a)throw Error("getProgramTime: callback must be provided");if(!t||e===void 0)return a({message:"getProgramTime: playlist and time must be provided"});let i=zU(e,t);if(!i)return a({message:"valid programTime was not found"});if(i.type==="estimate")return a({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:i.estimatedStart});let s={mediaSeconds:e},n=TU(e,i.segment);if(n)s.programDateTime=n.toISOString();return a(null,s)},lk=({programTime:t,playlist:e,retryCount:a=2,seekTo:i,pauseAfterSeek:s=!0,tech:n,callback:l})=>{if(!l)throw Error("seekToProgramTime: callback must be provided");if(typeof t>"u"||!e||!i)return l({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!n.hasStarted_)return l({message:"player must be playing a live stream to start buffering"});if(!xU(e))return l({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});let f=NU(t,e);if(!f)return l({message:`${t} was not found in the stream`});let o=f.segment,c=EU(o.dateTimeObject,t);if(f.type==="estimate"){if(a===0)return l({message:`${t} is not buffered yet. Try again`});i(f.estimatedStart+c),n.one("seeked",()=>{lk({programTime:t,playlist:e,retryCount:a-1,seekTo:i,pauseAfterSeek:s,tech:n,callback:l})});return}let u=o.start+c,m=()=>{return l(null,n.currentTime())};if(n.one("seeked",m),s)n.pause();i(u)},_g=(t,e)=>{if(t.readyState===4)return e();return},IU=(t,e,a,i)=>{let s=[],n,l=!1,f=function(m,p,w,d){return p.abort(),l=!0,a(m,p,w,d)},o=function(m,p){if(l)return;if(m)return m.metadata=Jf({requestType:i,request:p,error:m}),f(m,p,"",s);let w=p.responseText.substring(s&&s.byteLength||0,p.responseText.length);if(s=fA(s,N5(w,!0)),n=n||Uf(s),s.length<10||n&&s.length<n+2)return _g(p,()=>f(m,p,"",s));let d=Z5(s);if(d==="ts"&&s.length<188)return _g(p,()=>f(m,p,"",s));if(!d&&s.length<376)return _g(p,()=>f(m,p,"",s));return f(null,p,d,s)},u=e({uri:t,beforeSend(m){m.overrideMimeType("text/plain; charset=x-user-defined"),m.addEventListener("progress",function({total:p,loaded:w}){return Yg(m,null,{statusCode:m.status},o)})}},function(m,p){return Yg(u,m,p,o)});return u},{EventTarget:GU}=lt,hS=function(t,e){if(!tk(t,e))return!1;if(t.sidx&&e.sidx&&(t.sidx.offset!==e.sidx.offset||t.sidx.length!==e.sidx.length))return!1;else if(!t.sidx&&e.sidx||t.sidx&&!e.sidx)return!1;if(t.segments&&!e.segments||!t.segments&&e.segments)return!1;if(!t.segments&&!e.segments)return!0;for(let a=0;a<t.segments.length;a++){let i=t.segments[a],s=e.segments[a];if(i.uri!==s.uri)return!1;if(!i.byterange&&!s.byterange)continue;let n=i.byterange,l=s.byterange;if(n&&!l||!n&&l)return!1;if(n.offset!==l.offset||n.length!==l.length)return!1}return!0},XU=(t,e,a,i)=>{let s=i.attributes.NAME||a;return`placeholder-uri-${t}-${e}-${s}`},KU=({mainXml:t,srcUrl:e,clientOffset:a,sidxMapping:i,previousManifest:s})=>{let n=gv(t,{manifestUri:e,clientOffset:a,sidxMapping:i,previousManifest:s});return Jy(n,e,XU),n},LU=(t,e)=>{rh(t,(a,i,s,n)=>{if(!e.mediaGroups[i][s]||!(n in e.mediaGroups[i][s]))delete t.mediaGroups[i][s][n]})},VU=(t,e,a)=>{let i=!0,s=aa(t,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let n=0;n<e.playlists.length;n++){let l=e.playlists[n];if(l.sidx){let o=p2(l.sidx);if(a&&a[o]&&a[o].sidx)Y5(l,a[o].sidx,l.sidx.resolvedUri)}let f=Lg(s,l,hS);if(f)s=f,i=!1}if(rh(e,(n,l,f,o)=>{if(n.playlists&&n.playlists.length){let c=n.playlists[0].id,u=Lg(s,n.playlists[0],hS);if(u){if(s=u,!(o in s.mediaGroups[l][f]))s.mediaGroups[l][f][o]=n;s.mediaGroups[l][f][o].playlists[0]=s.playlists[c],i=!1}}}),LU(s,e),e.minimumUpdatePeriod!==t.minimumUpdatePeriod)i=!1;if(i)return null;return s},YU=(t,e)=>{return(Boolean(!t.map&&!e.map)||Boolean(t.map&&e.map&&t.map.byterange.offset===e.map.byterange.offset&&t.map.byterange.length===e.map.byterange.length))&&t.uri===e.uri&&t.byterange.offset===e.byterange.offset&&t.byterange.length===e.byterange.length},cS=(t,e)=>{let a={};for(let i in t){let n=t[i].sidx;if(n){let l=p2(n);if(!e[l])break;let f=e[l].sidxInfo;if(YU(f,n))a[l]=e[l]}}return a},JU=(t,e)=>{let i=cS(t.playlists,e);return rh(t,(s,n,l,f)=>{if(s.playlists&&s.playlists.length){let o=s.playlists;i=aa(i,cS(o,e))}}),i};class vm extends GU{constructor(t,e,a={},i){super();if(this.isPaused_=!0,this.mainPlaylistLoader_=i||this,!i)this.isMain_=!0;let{withCredentials:s=!1}=a;if(this.vhs_=e,this.withCredentials=s,this.addMetadataToTextTrack=a.addMetadataToTextTrack,!t)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_=_n("DashPlaylistLoader"),this.isMain_)this.mainPlaylistLoader_.srcUrl=t,this.mainPlaylistLoader_.sidxMapping_={};else this.childPlaylist_=t}get isPaused(){return this.isPaused_}requestErrored_(t,e,a){if(!this.request)return!0;if(this.request=null,t){if(this.error=typeof t==="object"&&!(t instanceof Error)?t:{status:e.status,message:"DASH request error at URL: "+e.uri,response:e.response,code:2,metadata:t.metadata},a)this.state=a;return this.trigger("error"),!0}}addSidxSegments_(t,e,a){let i=t.sidx&&p2(t.sidx);if(!t.sidx||!i||this.mainPlaylistLoader_.sidxMapping_[i]){$.default.clearTimeout(this.mediaRequest_),this.mediaRequest_=$.default.setTimeout(()=>a(!1),0);return}let s=qm(t.sidx.resolvedUri),n=(f,o)=>{if(this.requestErrored_(f,o,e))return;let c=this.mainPlaylistLoader_.sidxMapping_,{requestType:u}=o,m;try{m=kS.default(ee(o.response).subarray(8))}catch(p){p.metadata=Jf({requestType:u,request:o,parseFailure:!0}),this.requestErrored_(p,o,e);return}return c[i]={sidxInfo:t.sidx,sidx:m},Y5(t,m,t.sidx.resolvedUri),a(!0)},l="dash-sidx";this.request=IU(s,this.vhs_.xhr,(f,o,c,u)=>{if(f)return n(f,o);if(!c||c!=="mp4"){let w=c||"unknown";return n({status:o.status,message:`Unsupported ${w} container type for sidx segment at URL: ${s}`,response:"",playlist:t,internal:!0,playlistExclusionDuration:1/0,code:2},o)}let{offset:m,length:p}=t.sidx.byterange;if(u.length>=p+m)return n(f,{response:u.subarray(m,m+p),status:o.status,uri:o.uri});this.request=this.vhs_.xhr({uri:s,responseType:"arraybuffer",requestType:"dash-sidx",headers:Jg({byterange:t.sidx.byterange})},n)},l)}dispose(){if(this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},$.default.clearTimeout(this.minimumUpdatePeriodTimeout_),$.default.clearTimeout(this.mediaRequest_),$.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 t=this.request;this.request=null,t.onreadystatechange=null,t.abort()}}media(t){if(!t)return this.media_;if(this.state==="HAVE_NOTHING")throw Error("Cannot switch media playlist from "+this.state);let e=this.state;if(typeof t==="string"){if(!this.mainPlaylistLoader_.main.playlists[t])throw Error("Unknown playlist URI: "+t);t=this.mainPlaylistLoader_.main.playlists[t]}let a=!this.media_||t.id!==this.media_.id;if(a&&this.loadedPlaylists_[t.id]&&this.loadedPlaylists_[t.id].endList){if(this.state="HAVE_METADATA",this.media_=t,a)this.trigger("mediachanging"),this.trigger("mediachange");return}if(!a)return;if(this.media_)this.trigger("mediachanging");this.addSidxSegments_(t,e,(i)=>{this.haveMetadata({startingState:e,playlist:t})})}haveMetadata({startingState:t,playlist:e}){if(this.state="HAVE_METADATA",this.loadedPlaylists_[e.id]=e,$.default.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(e.id),t==="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(),$.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_)$.default.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null;if(this.state==="HAVE_NOTHING")this.started=!1}load(t){this.isPaused_=!1,$.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;let e=this.media();if(t){let a=e?e.targetDuration/2*1000:5000;this.mediaUpdateTimeout=$.default.setTimeout(()=>this.load(),a);return}if(!this.started){this.start();return}if(e&&!e.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_){$.default.clearTimeout(this.mediaRequest_),this.mediaRequest_=$.default.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((t,e)=>{if(this.haveMain_(),!this.hasPendingRequest()&&!this.media_)this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(t){let e={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(a,i)=>{if(a){let{requestType:n}=i;a.metadata=Jf({requestType:n,request:i,error:a})}if(this.requestErrored_(a,i)){if(this.state==="HAVE_NOTHING")this.started=!1;return}this.trigger({type:"manifestrequestcomplete",metadata:e});let s=i.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=i.responseText,i.responseHeaders&&i.responseHeaders.date)this.mainLoaded_=Date.parse(i.responseHeaders.date);else this.mainLoaded_=Date.now();if(this.mainPlaylistLoader_.srcUrl=qm(this.mainPlaylistLoader_.srcUrl,i),s){this.handleMain_(),this.syncClientServerClock_(()=>{return t(i,s)});return}return t(i,s)})}syncClientServerClock_(t){let e=bv(this.mainPlaylistLoader_.mainXml_);if(e===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),t();if(e.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=e.value-Date.now(),t();this.request=this.vhs_.xhr({uri:Ms(this.mainPlaylistLoader_.srcUrl,e.value),method:e.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(a,i)=>{if(!this.request)return;if(a){let{requestType:n}=i;return this.error.metadata=Jf({requestType:n,request:i,error:a}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),t()}let s;if(e.method==="HEAD")if(!i.responseHeaders||!i.responseHeaders.date)s=this.mainLoaded_;else s=Date.parse(i.responseHeaders.date);else s=Date.parse(i.responseText);this.mainPlaylistLoader_.clientOffset_=s-Date.now(),t()})}haveMain_(){if(this.state="HAVE_MAIN_MANIFEST",this.isMain_)this.trigger("loadedplaylist");else if(!this.media_)this.media(this.childPlaylist_)}handleMain_(){$.default.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;let t=this.mainPlaylistLoader_.main,e={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:e});let a;try{a=KU({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:t})}catch(s){this.error=s,this.error.metadata={errorType:lt.Error.StreamingDashManifestParserError,error:s},this.trigger("error")}if(t)a=VU(t,a,this.mainPlaylistLoader_.sidxMapping_);this.mainPlaylistLoader_.main=a?a:t;let i=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(i&&i!==this.mainPlaylistLoader_.srcUrl)this.mainPlaylistLoader_.srcUrl=i;if(!t||a&&a.minimumUpdatePeriod!==t.minimumUpdatePeriod)this.updateMinimumUpdatePeriodTimeout_();if(this.addEventStreamToMetadataTrack_(a),a){let{duration:s,endList:n}=a,l=[];a.playlists.forEach((o)=>{l.push({id:o.id,bandwidth:o.attributes.BANDWIDTH,resolution:o.attributes.RESOLUTION,codecs:o.attributes.CODECS})});let f={duration:s,isLive:!n,renditions:l};e.parsedManifest=f,this.trigger({type:"manifestparsecomplete",metadata:e})}return Boolean(a)}updateMinimumUpdatePeriodTimeout_(){let t=this.mainPlaylistLoader_;if(t.createMupOnMedia_)t.off("loadedmetadata",t.createMupOnMedia_),t.createMupOnMedia_=null;if(t.minimumUpdatePeriodTimeout_)$.default.clearTimeout(t.minimumUpdatePeriodTimeout_),t.minimumUpdatePeriodTimeout_=null;let e=t.main&&t.main.minimumUpdatePeriod;if(e===0)if(t.media())e=t.media().targetDuration*1000;else t.createMupOnMedia_=t.updateMinimumUpdatePeriodTimeout_,t.one("loadedmetadata",t.createMupOnMedia_);if(typeof e!=="number"||e<=0){if(e<0)this.logger_(`found invalid minimumUpdatePeriod of ${e}, not setting a timeout`);return}this.createMUPTimeout_(e)}createMUPTimeout_(t){let e=this.mainPlaylistLoader_;e.minimumUpdatePeriodTimeout_=$.default.setTimeout(()=>{e.minimumUpdatePeriodTimeout_=null,e.trigger("minimumUpdatePeriod"),e.createMUPTimeout_(t)},t)}refreshXml_(){this.requestMain_((t,e)=>{if(!e)return;if(this.media_)this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id];this.mainPlaylistLoader_.sidxMapping_=JU(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,(a)=>{this.refreshMedia_(this.media().id)})})}refreshMedia_(t){if(!t)throw Error("refreshMedia_ must take a media id");if(this.media_&&this.isMain_)this.handleMain_();let e=this.mainPlaylistLoader_.main.playlists,a=!this.media_||this.media_!==e[t];if(a)this.media_=e[t];else this.trigger("playlistunchanged");if(!this.mediaUpdateTimeout){let i=()=>{if(this.media().endList)return;this.mediaUpdateTimeout=$.default.setTimeout(()=>{this.trigger("mediaupdatetimeout"),i()},Vg(this.media(),Boolean(a)))};i()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(t){if(t&&this.mainPlaylistLoader_.main.eventStream){let e=this.mainPlaylistLoader_.main.eventStream.map((a)=>{return{cueTime:a.start,frames:[{data:a.messageData}]}});this.addMetadataToTextTrack("EventStream",e,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(t){if(t.contentProtection){let e=new Set;for(let a in t.contentProtection){let i=t.contentProtection[a].attributes["cenc:default_KID"];if(i)e.add(i.replace(/-/g,"").toLowerCase())}return e}}}var Oi={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},QU=(t)=>{let e=new Uint8Array(new ArrayBuffer(t.length));for(let a=0;a<t.length;a++)e[a]=t.charCodeAt(a);return e.buffer},fk=function(t){return t.on=t.addEventListener,t.off=t.removeEventListener,t},ZU=function(t){try{return URL.createObjectURL(new Blob([t],{type:"application/javascript"}))}catch(e){let a=new BlobBuilder;return a.append(t),URL.createObjectURL(a.getBlob())}},rk=function(t){return function(){let e=ZU(t),a=fk(new Worker(e));a.objURL=e;let i=a.terminate;return a.on=a.addEventListener,a.off=a.removeEventListener,a.terminate=function(){return URL.revokeObjectURL(e),i.call(this)},a}},ok=function(t){return`var browserWorkerPolyFill = ${fk.toString()};
216
- browserWorkerPolyFill(self);
217
- `+t},hk=function(t){return t.toString().replace(/^function.+?{/,"").slice(0,-1)},$U=ok(hk(function(){var t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=function(){this.init=function(){var b={};this.on=function(q,A){if(!b[q])b[q]=[];b[q]=b[q].concat(A)},this.off=function(q,A){var S;if(!b[q])return!1;return S=b[q].indexOf(A),b[q]=b[q].slice(),b[q].splice(S,1),S>-1},this.trigger=function(q){var A,S,_,O;if(A=b[q],!A)return;if(arguments.length===2){_=A.length;for(S=0;S<_;++S)A[S].call(this,arguments[1])}else{O=[],S=arguments.length;for(S=1;S<arguments.length;++S)O.push(arguments[S]);_=A.length;for(S=0;S<_;++S)A[S].apply(this,O)}},this.dispose=function(){b={}}}};e.prototype.pipe=function(b){return this.on("data",function(q){b.push(q)}),this.on("done",function(q){b.flush(q)}),this.on("partialdone",function(q){b.partialFlush(q)}),this.on("endedtimeline",function(q){b.endTimeline(q)}),this.on("reset",function(q){b.reset(q)}),b},e.prototype.push=function(b){this.trigger("data",b)},e.prototype.flush=function(b){this.trigger("done",b)},e.prototype.partialFlush=function(b){this.trigger("partialdone",b)},e.prototype.endTimeline=function(b){this.trigger("endedtimeline",b)},e.prototype.reset=function(b){this.trigger("reset",b)};var a=e,i=Math.pow(2,32),s=function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength),A;if(q.getBigUint64){if(A=q.getBigUint64(0),A<Number.MAX_SAFE_INTEGER)return Number(A);return A}return q.getUint32(0)*i+q.getUint32(4)},n={getUint64:s,MAX_UINT32:i},l=n.MAX_UINT32,f,o,c,u,m,p,w,d,v,k,y,B,H,M,D,T,z,E,V,tt,at,Q,Z,J,Y,W,ft,nt,qt,R,ct,pt,G,Ct,Kt,le;(function(){var b;if(Z={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(b in Z)if(Z.hasOwnProperty(b))Z[b]=[b.charCodeAt(0),b.charCodeAt(1),b.charCodeAt(2),b.charCodeAt(3)];J=new Uint8Array([105,115,111,109]),W=new Uint8Array([97,118,99,49]),Y=new Uint8Array([0,0,0,1]),ft=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]),nt=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]),qt={video:ft,audio:nt},pt=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]),G=new Uint8Array([0,0,0,0,0,0,0,0]),Ct=G,Kt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),le=G,R=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])})(),f=function(b){var q=[],A=0,S,_,O;for(S=1;S<arguments.length;S++)q.push(arguments[S]);S=q.length;while(S--)A+=q[S].byteLength;_=new Uint8Array(A+8),O=new DataView(_.buffer,_.byteOffset,_.byteLength),O.setUint32(0,_.byteLength),_.set(b,4);for(S=0,A=8;S<q.length;S++)_.set(q[S],A),A+=q[S].byteLength;return _},o=function(){return f(Z.dinf,f(Z.dref,pt))},c=function(b){return f(Z.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,b.audioobjecttype<<3|b.samplingfrequencyindex>>>1,b.samplingfrequencyindex<<7|b.channelcount<<3,6,1,2]))},u=function(){return f(Z.ftyp,J,Y,J,W)},T=function(b){return f(Z.hdlr,qt[b])},m=function(b){return f(Z.mdat,b)},D=function(b){var q=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,b.duration>>>24&255,b.duration>>>16&255,b.duration>>>8&255,b.duration&255,85,196,0,0]);if(b.samplerate)q[12]=b.samplerate>>>24&255,q[13]=b.samplerate>>>16&255,q[14]=b.samplerate>>>8&255,q[15]=b.samplerate&255;return f(Z.mdhd,q)},M=function(b){return f(Z.mdia,D(b),T(b.type),w(b))},p=function(b){return f(Z.mfhd,new Uint8Array([0,0,0,0,(b&4278190080)>>24,(b&16711680)>>16,(b&65280)>>8,b&255]))},w=function(b){return f(Z.minf,b.type==="video"?f(Z.vmhd,R):f(Z.smhd,ct),o(),E(b))},d=function(b,q){var A=[],S=q.length;while(S--)A[S]=tt(q[S]);return f.apply(null,[Z.moof,p(b)].concat(A))},v=function(b){var q=b.length,A=[];while(q--)A[q]=B(b[q]);return f.apply(null,[Z.moov,y(4294967295)].concat(A).concat(k(b)))},k=function(b){var q=b.length,A=[];while(q--)A[q]=at(b[q]);return f.apply(null,[Z.mvex].concat(A))},y=function(b){var q=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(b&4278190080)>>24,(b&16711680)>>16,(b&65280)>>8,b&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 f(Z.mvhd,q)},z=function(b){var q=b.samples||[],A=new Uint8Array(4+q.length),S,_;for(_=0;_<q.length;_++)S=q[_].flags,A[_+4]=S.dependsOn<<4|S.isDependedOn<<2|S.hasRedundancy;return f(Z.sdtp,A)},E=function(b){return f(Z.stbl,V(b),f(Z.stts,le),f(Z.stsc,Ct),f(Z.stsz,Kt),f(Z.stco,G))},function(){var b,q;V=function(A){return f(Z.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),A.type==="video"?b(A):q(A))},b=function(A){var S=A.sps||[],_=A.pps||[],O=[],U=[],I,K;for(I=0;I<S.length;I++)O.push((S[I].byteLength&65280)>>>8),O.push(S[I].byteLength&255),O=O.concat(Array.prototype.slice.call(S[I]));for(I=0;I<_.length;I++)U.push((_[I].byteLength&65280)>>>8),U.push(_[I].byteLength&255),U=U.concat(Array.prototype.slice.call(_[I]));if(K=[Z.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,(A.width&65280)>>8,A.width&255,(A.height&65280)>>8,A.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]),f(Z.avcC,new Uint8Array([1,A.profileIdc,A.profileCompatibility,A.levelIdc,255].concat([S.length],O,[_.length],U))),f(Z.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],A.sarRatio){var L=A.sarRatio[0],it=A.sarRatio[1];K.push(f(Z.pasp,new Uint8Array([(L&4278190080)>>24,(L&16711680)>>16,(L&65280)>>8,L&255,(it&4278190080)>>24,(it&16711680)>>16,(it&65280)>>8,it&255])))}return f.apply(null,K)},q=function(A){return f(Z.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(A.channelcount&65280)>>8,A.channelcount&255,(A.samplesize&65280)>>8,A.samplesize&255,0,0,0,0,(A.samplerate&65280)>>8,A.samplerate&255,0,0]),c(A))}}(),H=function(b){var q=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(b.id&4278190080)>>24,(b.id&16711680)>>16,(b.id&65280)>>8,b.id&255,0,0,0,0,(b.duration&4278190080)>>24,(b.duration&16711680)>>16,(b.duration&65280)>>8,b.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,(b.width&65280)>>8,b.width&255,0,0,(b.height&65280)>>8,b.height&255,0,0]);return f(Z.tkhd,q)},tt=function(b){var q,A,S,_,O,U,I;if(q=f(Z.tfhd,new Uint8Array([0,0,0,58,(b.id&4278190080)>>24,(b.id&16711680)>>16,(b.id&65280)>>8,b.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),U=Math.floor(b.baseMediaDecodeTime/l),I=Math.floor(b.baseMediaDecodeTime%l),A=f(Z.tfdt,new Uint8Array([1,0,0,0,U>>>24&255,U>>>16&255,U>>>8&255,U&255,I>>>24&255,I>>>16&255,I>>>8&255,I&255])),O=92,b.type==="audio")return S=Q(b,O),f(Z.traf,q,A,S);return _=z(b),S=Q(b,_.length+O),f(Z.traf,q,A,S,_)},B=function(b){return b.duration=b.duration||4294967295,f(Z.trak,H(b),M(b))},at=function(b){var q=new Uint8Array([0,0,0,0,(b.id&4278190080)>>24,(b.id&16711680)>>16,(b.id&65280)>>8,b.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);if(b.type!=="video")q[q.length-1]=0;return f(Z.trex,q)},function(){var b,q,A;A=function(S,_){var O=0,U=0,I=0,K=0;if(S.length){if(S[0].duration!==void 0)O=1;if(S[0].size!==void 0)U=2;if(S[0].flags!==void 0)I=4;if(S[0].compositionTimeOffset!==void 0)K=8}return[0,0,O|U|I|K,1,(S.length&4278190080)>>>24,(S.length&16711680)>>>16,(S.length&65280)>>>8,S.length&255,(_&4278190080)>>>24,(_&16711680)>>>16,(_&65280)>>>8,_&255]},q=function(S,_){var O,U,I,K,L,it;K=S.samples||[],_+=20+16*K.length,I=A(K,_),U=new Uint8Array(I.length+K.length*16),U.set(I),O=I.length;for(it=0;it<K.length;it++)L=K[it],U[O++]=(L.duration&4278190080)>>>24,U[O++]=(L.duration&16711680)>>>16,U[O++]=(L.duration&65280)>>>8,U[O++]=L.duration&255,U[O++]=(L.size&4278190080)>>>24,U[O++]=(L.size&16711680)>>>16,U[O++]=(L.size&65280)>>>8,U[O++]=L.size&255,U[O++]=L.flags.isLeading<<2|L.flags.dependsOn,U[O++]=L.flags.isDependedOn<<6|L.flags.hasRedundancy<<4|L.flags.paddingValue<<1|L.flags.isNonSyncSample,U[O++]=L.flags.degradationPriority&61440,U[O++]=L.flags.degradationPriority&15,U[O++]=(L.compositionTimeOffset&4278190080)>>>24,U[O++]=(L.compositionTimeOffset&16711680)>>>16,U[O++]=(L.compositionTimeOffset&65280)>>>8,U[O++]=L.compositionTimeOffset&255;return f(Z.trun,U)},b=function(S,_){var O,U,I,K,L,it;K=S.samples||[],_+=20+8*K.length,I=A(K,_),O=new Uint8Array(I.length+K.length*8),O.set(I),U=I.length;for(it=0;it<K.length;it++)L=K[it],O[U++]=(L.duration&4278190080)>>>24,O[U++]=(L.duration&16711680)>>>16,O[U++]=(L.duration&65280)>>>8,O[U++]=L.duration&255,O[U++]=(L.size&4278190080)>>>24,O[U++]=(L.size&16711680)>>>16,O[U++]=(L.size&65280)>>>8,O[U++]=L.size&255;return f(Z.trun,O)},Q=function(S,_){if(S.type==="audio")return b(S,_);return q(S,_)}}();var Ft={ftyp:u,mdat:m,moof:d,moov:v,initSegment:function(b){var q=u(),A=v(b),S;return S=new Uint8Array(q.byteLength+A.byteLength),S.set(q),S.set(A,q.byteLength),S}},Et=function(b){var q,A,S=[],_=[];_.byteLength=0,_.nalCount=0,_.duration=0,S.byteLength=0;for(q=0;q<b.length;q++)if(A=b[q],A.nalUnitType==="access_unit_delimiter_rbsp"){if(S.length)S.duration=A.dts-S.dts,_.byteLength+=S.byteLength,_.nalCount+=S.length,_.duration+=S.duration,_.push(S);S=[A],S.byteLength=A.data.byteLength,S.pts=A.pts,S.dts=A.dts}else{if(A.nalUnitType==="slice_layer_without_partitioning_rbsp_idr")S.keyFrame=!0;S.duration=A.dts-S.dts,S.byteLength+=A.data.byteLength,S.push(A)}if(_.length&&(!S.duration||S.duration<=0))S.duration=_[_.length-1].duration;return _.byteLength+=S.byteLength,_.nalCount+=S.length,_.duration+=S.duration,_.push(S),_},$t=function(b){var q,A,S=[],_=[];S.byteLength=0,S.nalCount=0,S.duration=0,S.pts=b[0].pts,S.dts=b[0].dts,_.byteLength=0,_.nalCount=0,_.duration=0,_.pts=b[0].pts,_.dts=b[0].dts;for(q=0;q<b.length;q++)if(A=b[q],A.keyFrame){if(S.length)_.push(S),_.byteLength+=S.byteLength,_.nalCount+=S.nalCount,_.duration+=S.duration;S=[A],S.nalCount=A.length,S.byteLength=A.byteLength,S.pts=A.pts,S.dts=A.dts,S.duration=A.duration}else S.duration+=A.duration,S.nalCount+=A.length,S.byteLength+=A.byteLength,S.push(A);if(_.length&&S.duration<=0)S.duration=_[_.length-1].duration;return _.byteLength+=S.byteLength,_.nalCount+=S.nalCount,_.duration+=S.duration,_.push(S),_},Dt=function(b){var q;if(!b[0][0].keyFrame&&b.length>1)q=b.shift(),b.byteLength-=q.byteLength,b.nalCount-=q.nalCount,b[0][0].dts=q.dts,b[0][0].pts=q.pts,b[0][0].duration+=q.duration;return b},Mt=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Xt=function(b,q){var A=Mt();if(A.dataOffset=q,A.compositionTimeOffset=b.pts-b.dts,A.duration=b.duration,A.size=4*b.length,A.size+=b.byteLength,b.keyFrame)A.flags.dependsOn=2,A.flags.isNonSyncSample=0;return A},Gt=function(b,q){var A,S,_,O,U,I=q||0,K=[];for(A=0;A<b.length;A++){O=b[A];for(S=0;S<O.length;S++)U=O[S],_=Xt(U,I),I+=_.size,K.push(_)}return K},ae=function(b){var q,A,S,_,O,U,I=0,K=b.byteLength,L=b.nalCount,it=K+4*L,ht=new Uint8Array(it),zt=new DataView(ht.buffer);for(q=0;q<b.length;q++){_=b[q];for(A=0;A<_.length;A++){O=_[A];for(S=0;S<O.length;S++)U=O[S],zt.setUint32(I,U.data.byteLength),I+=4,ht.set(U.data,I),I+=U.data.byteLength}}return ht},Xe=function(b,q){var A,S=q||0,_=[];return A=Xt(b,S),_.push(A),_},Re=function(b){var q,A,S=0,_=b.byteLength,O=b.length,U=_+4*O,I=new Uint8Array(U),K=new DataView(I.buffer);for(q=0;q<b.length;q++)A=b[q],K.setUint32(S,A.data.byteLength),S+=4,I.set(A.data,S),S+=A.data.byteLength;return I},da={groupNalsIntoFrames:Et,groupFramesIntoGops:$t,extendFirstKeyFrame:Dt,generateSampleTable:Gt,concatenateNalData:ae,generateSampleTableForFrame:Xe,concatenateNalDataForFrame:Re},Ve=[33,16,5,32,164,27],va=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],ce=function(b){var q=[];while(b--)q.push(0);return q},ii=function(b){return Object.keys(b).reduce(function(q,A){return q[A]=new Uint8Array(b[A].reduce(function(S,_){return S.concat(_)},[])),q},{})},Ee,Ri=function(){if(!Ee){var b={96000:[Ve,[227,64],ce(154),[56]],88200:[Ve,[231],ce(170),[56]],64000:[Ve,[248,192],ce(240),[56]],48000:[Ve,[255,192],ce(268),[55,148,128],ce(54),[112]],44100:[Ve,[255,192],ce(268),[55,163,128],ce(84),[112]],32000:[Ve,[255,192],ce(268),[55,234],ce(226),[112]],24000:[Ve,[255,192],ce(268),[55,255,128],ce(268),[111,112],ce(126),[224]],16000:[Ve,[255,192],ce(268),[55,255,128],ce(268),[111,255],ce(269),[223,108],ce(195),[1,192]],12000:[va,ce(268),[3,127,248],ce(268),[6,255,240],ce(268),[13,255,224],ce(268),[27,253,128],ce(259),[56]],11025:[va,ce(268),[3,127,248],ce(268),[6,255,240],ce(268),[13,255,224],ce(268),[27,255,192],ce(268),[55,175,128],ce(108),[112]],8000:[va,ce(268),[3,121,16],ce(47),[7]]};Ee=ii(b)}return Ee},mi=90000,ji,mt,kt,Zt,ne,ye,dt;ji=function(b){return b*mi},mt=function(b,q){return b*q},kt=function(b){return b/mi},Zt=function(b,q){return b/q},ne=function(b,q){return ji(Zt(b,q))},ye=function(b,q){return mt(kt(b),q)},dt=function(b,q,A){return kt(A?b:b-q)};var Ut={ONE_SECOND_IN_TS:mi,secondsToVideoTs:ji,secondsToAudioTs:mt,videoTsToSeconds:kt,audioTsToSeconds:Zt,audioTsToVideoTs:ne,videoTsToAudioTs:ye,metadataTsToSeconds:dt},ie=Ri,_e=Ut,ca=function(b){var q,A,S=0;for(q=0;q<b.length;q++)A=b[q],S+=A.data.byteLength;return S},Be=function(b,q,A,S){var _,O=0,U=0,I=0,K=0,L,it,ht;if(!q.length)return;if(_=_e.audioTsToVideoTs(b.baseMediaDecodeTime,b.samplerate),O=Math.ceil(_e.ONE_SECOND_IN_TS/(b.samplerate/1024)),A&&S)U=_-Math.max(A,S),I=Math.floor(U/O),K=I*O;if(I<1||K>_e.ONE_SECOND_IN_TS/2)return;if(L=ie()[b.samplerate],!L)L=q[0].data;for(it=0;it<I;it++)ht=q[0],q.splice(0,0,{data:L,dts:ht.dts-O,pts:ht.pts-O});return b.baseMediaDecodeTime-=Math.floor(_e.videoTsToAudioTs(K,b.samplerate)),K},Sa=function(b,q,A){if(q.minSegmentDts>=A)return b;return q.minSegmentDts=1/0,b.filter(function(S){if(S.dts>=A)return q.minSegmentDts=Math.min(q.minSegmentDts,S.dts),q.minSegmentPts=q.minSegmentDts,!0;return!1})},ia=function(b){var q,A,S=[];for(q=0;q<b.length;q++)A=b[q],S.push({size:A.data.byteLength,duration:1024});return S},on=function(b){var q,A,S=0,_=new Uint8Array(ca(b));for(q=0;q<b.length;q++)A=b[q],_.set(A.data,S),S+=A.data.byteLength;return _},Yt={prefixWithSilence:Be,trimAdtsFramesByEarliestDts:Sa,generateSampleTable:ia,concatenateFrameData:on},Pt=Ut.ONE_SECOND_IN_TS,_t=function(b,q){if(typeof q.pts==="number"){if(b.timelineStartInfo.pts===void 0)b.timelineStartInfo.pts=q.pts;if(b.minSegmentPts===void 0)b.minSegmentPts=q.pts;else b.minSegmentPts=Math.min(b.minSegmentPts,q.pts);if(b.maxSegmentPts===void 0)b.maxSegmentPts=q.pts;else b.maxSegmentPts=Math.max(b.maxSegmentPts,q.pts)}if(typeof q.dts==="number"){if(b.timelineStartInfo.dts===void 0)b.timelineStartInfo.dts=q.dts;if(b.minSegmentDts===void 0)b.minSegmentDts=q.dts;else b.minSegmentDts=Math.min(b.minSegmentDts,q.dts);if(b.maxSegmentDts===void 0)b.maxSegmentDts=q.dts;else b.maxSegmentDts=Math.max(b.maxSegmentDts,q.dts)}},Ht=function(b){delete b.minSegmentDts,delete b.maxSegmentDts,delete b.minSegmentPts,delete b.maxSegmentPts},Wt=function(b,q){var A,S,_=b.minSegmentDts;if(!q)_-=b.timelineStartInfo.dts;if(A=b.timelineStartInfo.baseMediaDecodeTime,A+=_,A=Math.max(0,A),b.type==="audio")S=b.samplerate/Pt,A*=S,A=Math.floor(A);return A},Oe={clearDtsInfo:Ht,calculateTrackBaseMediaDecodeTime:Wt,collectDtsInfo:_t},Ma=4,En=128,ur=function(b){var q=0,A={payloadType:-1,payloadSize:0},S=0,_=0;while(q<b.byteLength){if(b[q]===En)break;while(b[q]===255)S+=255,q++;S+=b[q++];while(b[q]===255)_+=255,q++;if(_+=b[q++],!A.payload&&S===Ma){var O=String.fromCharCode(b[q+3],b[q+4],b[q+5],b[q+6]);if(O==="GA94"){A.payloadType=S,A.payloadSize=_,A.payload=b.subarray(q,q+_);break}else A.payload=void 0}q+=_,S=0,_=0}return A},mr=function(b){if(b.payload[0]!==181)return null;if((b.payload[1]<<8|b.payload[2])!==49)return null;if(String.fromCharCode(b.payload[3],b.payload[4],b.payload[5],b.payload[6])!=="GA94")return null;if(b.payload[7]!==3)return null;return b.payload.subarray(8,b.payload.length-1)},Nl=function(b,q){var A=[],S,_,O,U;if(!(q[0]&64))return A;_=q[0]&31;for(S=0;S<_;S++)if(O=S*3,U={type:q[O+2]&3,pts:b},q[O+2]&4)U.ccData=q[O+3]<<8|q[O+4],A.push(U);return A},gr=function(b){var q=b.byteLength,A=[],S=1,_,O;while(S<q-2)if(b[S]===0&&b[S+1]===0&&b[S+2]===3)A.push(S+2),S+=2;else S++;if(A.length===0)return b;_=q-A.length,O=new Uint8Array(_);var U=0;for(S=0;S<_;U++,S++){if(U===A[0])U++,A.shift();O[S]=b[U]}return O},Hh={parseSei:ur,parseUserData:mr,parseCaptionPackets:Nl,discardEmulationPreventionBytes:gr,USER_DATA_REGISTERED_ITU_T_T35:Ma},_1=a,z0=Hh,di=function(b){if(b=b||{},di.prototype.init.call(this),this.parse708captions_=typeof b.parse708captions==="boolean"?b.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new ba(0,0),new ba(0,1),new ba(1,0),new ba(1,1)],this.parse708captions_)this.cc708Stream_=new xe({captionServices:b.captionServices});if(this.reset(),this.ccStreams_.forEach(function(q){q.on("data",this.trigger.bind(this,"data")),q.on("partialdone",this.trigger.bind(this,"partialdone")),q.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"))};di.prototype=new _1,di.prototype.push=function(b){var q,A,S;if(b.nalUnitType!=="sei_rbsp")return;if(q=z0.parseSei(b.escapedRBSP),!q.payload)return;if(q.payloadType!==z0.USER_DATA_REGISTERED_ITU_T_T35)return;if(A=z0.parseUserData(q),!A)return;if(b.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(b.dts===this.latestDts_&&this.ignoreNextEqualDts_){if(this.numSameDts_--,!this.numSameDts_)this.ignoreNextEqualDts_=!1;return}if(S=z0.parseCaptionPackets(b.pts,A),this.captionPackets_=this.captionPackets_.concat(S),this.latestDts_!==b.dts)this.numSameDts_=0;this.numSameDts_++,this.latestDts_=b.dts},di.prototype.flushCCStreams=function(b){this.ccStreams_.forEach(function(q){return b==="flush"?q.flush():q.partialFlush()},this)},di.prototype.flushStream=function(b){if(!this.captionPackets_.length){this.flushCCStreams(b);return}this.captionPackets_.forEach(function(q,A){q.presortIndex=A}),this.captionPackets_.sort(function(q,A){if(q.pts===A.pts)return q.presortIndex-A.presortIndex;return q.pts-A.pts}),this.captionPackets_.forEach(function(q){if(q.type<2)this.dispatchCea608Packet(q);else this.dispatchCea708Packet(q)},this),this.captionPackets_.length=0,this.flushCCStreams(b)},di.prototype.flush=function(){return this.flushStream("flush")},di.prototype.partialFlush=function(){return this.flushStream("partialFlush")},di.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(b){b.reset()})},di.prototype.dispatchCea608Packet=function(b){if(this.setsTextOrXDSActive(b))this.activeCea608Channel_[b.type]=null;else if(this.setsChannel1Active(b))this.activeCea608Channel_[b.type]=0;else if(this.setsChannel2Active(b))this.activeCea608Channel_[b.type]=1;if(this.activeCea608Channel_[b.type]===null)return;this.ccStreams_[(b.type<<1)+this.activeCea608Channel_[b.type]].push(b)},di.prototype.setsChannel1Active=function(b){return(b.ccData&30720)===4096},di.prototype.setsChannel2Active=function(b){return(b.ccData&30720)===6144},di.prototype.setsTextOrXDSActive=function(b){return(b.ccData&28928)===256||(b.ccData&30974)===4138||(b.ccData&30974)===6186},di.prototype.dispatchCea708Packet=function(b){if(this.parse708captions_)this.cc708Stream_.push(b)};var E0={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},y9=function(b){var q=E0[b]||b;if(b&4096&&b===q)return"";return String.fromCharCode(q)},x0=function(b){return 32<=b&&b<=127||160<=b&&b<=255},Us=function(b){this.windowNum=b,this.reset()};Us.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},Us.prototype.getText=function(){return this.rows.join(`
218
- `)},Us.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},Us.prototype.newLine=function(b){if(this.rows.length>=this.virtualRowCount&&typeof this.beforeRowOverflow==="function")this.beforeRowOverflow(b);if(this.rows.length>0)this.rows.push(""),this.rowIdx++;while(this.rows.length>this.virtualRowCount)this.rows.shift(),this.rowIdx--},Us.prototype.isEmpty=function(){if(this.rows.length===0)return!0;else if(this.rows.length===1)return this.rows[0]==="";return!1},Us.prototype.addText=function(b){this.rows[this.rowIdx]+=b},Us.prototype.backspace=function(){if(!this.isEmpty()){var b=this.rows[this.rowIdx];this.rows[this.rowIdx]=b.substr(0,b.length-1)}};var F1=function(b,q,A){if(this.serviceNum=b,this.text="",this.currentWindow=new Us(-1),this.windows=[],this.stream=A,typeof q==="string")this.createTextDecoder(q)};F1.prototype.init=function(b,q){this.startPts=b;for(var A=0;A<8;A++)if(this.windows[A]=new Us(A),typeof q==="function")this.windows[A].beforeRowOverflow=q},F1.prototype.setCurrentWindow=function(b){this.currentWindow=this.windows[b]},F1.prototype.createTextDecoder=function(b){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(b)}catch(q){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+b+" encoding. "+q})}};var xe=function(b){b=b||{},xe.prototype.init.call(this);var q=this,A=b.captionServices||{},S={},_;Object.keys(A).forEach((O)=>{if(_=A[O],/^SERVICE/.test(O))S[O]=_.encoding}),this.serviceEncodings=S,this.current708Packet=null,this.services={},this.push=function(O){if(O.type===3)q.new708Packet(),q.add708Bytes(O);else{if(q.current708Packet===null)q.new708Packet();q.add708Bytes(O)}}};xe.prototype=new _1,xe.prototype.new708Packet=function(){if(this.current708Packet!==null)this.push708Packet();this.current708Packet={data:[],ptsVals:[]}},xe.prototype.add708Bytes=function(b){var q=b.ccData,A=q>>>8,S=q&255;this.current708Packet.ptsVals.push(b.pts),this.current708Packet.data.push(A),this.current708Packet.data.push(S)},xe.prototype.push708Packet=function(){var b=this.current708Packet,q=b.data,A=null,S=null,_=0,O=q[_++];b.seq=O>>6,b.sizeCode=O&63;for(;_<q.length;_++){if(O=q[_++],A=O>>5,S=O&31,A===7&&S>0)O=q[_++],A=O;if(this.pushServiceBlock(A,_,S),S>0)_+=S-1}},xe.prototype.pushServiceBlock=function(b,q,A){var S,_=q,O=this.current708Packet.data,U=this.services[b];if(!U)U=this.initService(b,_);for(;_<q+A&&_<O.length;_++)if(S=O[_],x0(S))_=this.handleText(_,U);else if(S===24)_=this.multiByteCharacter(_,U);else if(S===16)_=this.extendedCommands(_,U);else if(128<=S&&S<=135)_=this.setCurrentWindow(_,U);else if(152<=S&&S<=159)_=this.defineWindow(_,U);else if(S===136)_=this.clearWindows(_,U);else if(S===140)_=this.deleteWindows(_,U);else if(S===137)_=this.displayWindows(_,U);else if(S===138)_=this.hideWindows(_,U);else if(S===139)_=this.toggleWindows(_,U);else if(S===151)_=this.setWindowAttributes(_,U);else if(S===144)_=this.setPenAttributes(_,U);else if(S===145)_=this.setPenColor(_,U);else if(S===146)_=this.setPenLocation(_,U);else if(S===143)U=this.reset(_,U);else if(S===8)U.currentWindow.backspace();else if(S===12)U.currentWindow.clearText();else if(S===13)U.currentWindow.pendingNewLine=!0;else if(S===14)U.currentWindow.clearText();else if(S===141)_++},xe.prototype.extendedCommands=function(b,q){var A=this.current708Packet.data,S=A[++b];if(x0(S))b=this.handleText(b,q,{isExtended:!0});return b},xe.prototype.getPts=function(b){return this.current708Packet.ptsVals[Math.floor(b/2)]},xe.prototype.initService=function(b,q){var S="SERVICE"+b,A=this,S,_;if(S in this.serviceEncodings)_=this.serviceEncodings[S];return this.services[b]=new F1(b,_,A),this.services[b].init(this.getPts(q),function(O){A.flushDisplayed(O,A.services[b])}),this.services[b]},xe.prototype.handleText=function(b,q,A){var S=A&&A.isExtended,_=A&&A.isMultiByte,O=this.current708Packet.data,U=S?4096:0,I=O[b],K=O[b+1],L=q.currentWindow,it,ht;function zt(wt){return wt.map((te)=>{return("0"+(te&255).toString(16)).slice(-2)}).join("")}if(_)ht=[I,K],b++;else ht=[I];if(q.textDecoder_&&!S)it=q.textDecoder_.decode(new Uint8Array(ht));else if(_){let wt=zt(ht);it=String.fromCharCode(parseInt(wt,16))}else it=y9(U|I);if(L.pendingNewLine&&!L.isEmpty())L.newLine(this.getPts(b));return L.pendingNewLine=!1,L.addText(it),b},xe.prototype.multiByteCharacter=function(b,q){var A=this.current708Packet.data,S=A[b+1],_=A[b+2];if(x0(S)&&x0(_))b=this.handleText(++b,q,{isMultiByte:!0});return b},xe.prototype.setCurrentWindow=function(b,q){var A=this.current708Packet.data,S=A[b],_=S&7;return q.setCurrentWindow(_),b},xe.prototype.defineWindow=function(b,q){var A=this.current708Packet.data,S=A[b],_=S&7;q.setCurrentWindow(_);var O=q.currentWindow;return S=A[++b],O.visible=(S&32)>>5,O.rowLock=(S&16)>>4,O.columnLock=(S&8)>>3,O.priority=S&7,S=A[++b],O.relativePositioning=(S&128)>>7,O.anchorVertical=S&127,S=A[++b],O.anchorHorizontal=S,S=A[++b],O.anchorPoint=(S&240)>>4,O.rowCount=S&15,S=A[++b],O.columnCount=S&63,S=A[++b],O.windowStyle=(S&56)>>3,O.penStyle=S&7,O.virtualRowCount=O.rowCount+1,b},xe.prototype.setWindowAttributes=function(b,q){var A=this.current708Packet.data,S=A[b],_=q.currentWindow.winAttr;return S=A[++b],_.fillOpacity=(S&192)>>6,_.fillRed=(S&48)>>4,_.fillGreen=(S&12)>>2,_.fillBlue=S&3,S=A[++b],_.borderType=(S&192)>>6,_.borderRed=(S&48)>>4,_.borderGreen=(S&12)>>2,_.borderBlue=S&3,S=A[++b],_.borderType+=(S&128)>>5,_.wordWrap=(S&64)>>6,_.printDirection=(S&48)>>4,_.scrollDirection=(S&12)>>2,_.justify=S&3,S=A[++b],_.effectSpeed=(S&240)>>4,_.effectDirection=(S&12)>>2,_.displayEffect=S&3,b},xe.prototype.flushDisplayed=function(b,q){var A=[];for(var S=0;S<8;S++)if(q.windows[S].visible&&!q.windows[S].isEmpty())A.push(q.windows[S].getText());q.endPts=b,q.text=A.join(`
219
-
220
- `),this.pushCaption(q),q.startPts=b},xe.prototype.pushCaption=function(b){if(b.text!=="")this.trigger("data",{startPts:b.startPts,endPts:b.endPts,text:b.text,stream:"cc708_"+b.serviceNum}),b.text="",b.startPts=b.endPts},xe.prototype.displayWindows=function(b,q){var A=this.current708Packet.data,S=A[++b],_=this.getPts(b);this.flushDisplayed(_,q);for(var O=0;O<8;O++)if(S&1<<O)q.windows[O].visible=1;return b},xe.prototype.hideWindows=function(b,q){var A=this.current708Packet.data,S=A[++b],_=this.getPts(b);this.flushDisplayed(_,q);for(var O=0;O<8;O++)if(S&1<<O)q.windows[O].visible=0;return b},xe.prototype.toggleWindows=function(b,q){var A=this.current708Packet.data,S=A[++b],_=this.getPts(b);this.flushDisplayed(_,q);for(var O=0;O<8;O++)if(S&1<<O)q.windows[O].visible^=1;return b},xe.prototype.clearWindows=function(b,q){var A=this.current708Packet.data,S=A[++b],_=this.getPts(b);this.flushDisplayed(_,q);for(var O=0;O<8;O++)if(S&1<<O)q.windows[O].clearText();return b},xe.prototype.deleteWindows=function(b,q){var A=this.current708Packet.data,S=A[++b],_=this.getPts(b);this.flushDisplayed(_,q);for(var O=0;O<8;O++)if(S&1<<O)q.windows[O].reset();return b},xe.prototype.setPenAttributes=function(b,q){var A=this.current708Packet.data,S=A[b],_=q.currentWindow.penAttr;return S=A[++b],_.textTag=(S&240)>>4,_.offset=(S&12)>>2,_.penSize=S&3,S=A[++b],_.italics=(S&128)>>7,_.underline=(S&64)>>6,_.edgeType=(S&56)>>3,_.fontStyle=S&7,b},xe.prototype.setPenColor=function(b,q){var A=this.current708Packet.data,S=A[b],_=q.currentWindow.penColor;return S=A[++b],_.fgOpacity=(S&192)>>6,_.fgRed=(S&48)>>4,_.fgGreen=(S&12)>>2,_.fgBlue=S&3,S=A[++b],_.bgOpacity=(S&192)>>6,_.bgRed=(S&48)>>4,_.bgGreen=(S&12)>>2,_.bgBlue=S&3,S=A[++b],_.edgeRed=(S&48)>>4,_.edgeGreen=(S&12)>>2,_.edgeBlue=S&3,b},xe.prototype.setPenLocation=function(b,q){var A=this.current708Packet.data,S=A[b],_=q.currentWindow.penLoc;return q.currentWindow.pendingNewLine=!0,S=A[++b],_.row=S&15,S=A[++b],_.column=S&63,b},xe.prototype.reset=function(b,q){var A=this.getPts(b);return this.flushDisplayed(A,q),this.initService(q.serviceNum,b)};var Pn={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},t0=function(b){if(b===null)return"";return b=Pn[b]||b,String.fromCharCode(b)},B1=14,zl=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Is=function(){var b=[],q=B1+1;while(q--)b.push({text:"",indent:0,offset:0});return b},ba=function(b,q){ba.prototype.init.call(this),this.field_=b||0,this.dataChannel_=q||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(A){var S,_,O,U,I;if(S=A.ccData&32639,S===this.lastControlCode_){this.lastControlCode_=null;return}if((S&61440)===4096)this.lastControlCode_=S;else if(S!==this.PADDING_)this.lastControlCode_=null;if(O=S>>>8,U=S&255,S===this.PADDING_)return;else if(S===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(S===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(A.pts),this.flushDisplayed(A.pts),_=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=_,this.startPts_=A.pts;else if(S===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(A.pts);else if(S===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(A.pts);else if(S===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(A.pts);else if(S===this.CARRIAGE_RETURN_)this.clearFormatting(A.pts),this.flushDisplayed(A.pts),this.shiftRowsUp_(),this.startPts_=A.pts;else if(S===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(S===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(A.pts),this.displayed_=Is();else if(S===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Is();else if(S===this.RESUME_DIRECT_CAPTIONING_){if(this.mode_!=="paintOn")this.flushDisplayed(A.pts),this.displayed_=Is();this.mode_="paintOn",this.startPts_=A.pts}else if(this.isSpecialCharacter(O,U))O=(O&3)<<8,I=t0(O|U),this[this.mode_](A.pts,I),this.column_++;else if(this.isExtCharacter(O,U)){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);O=(O&3)<<8,I=t0(O|U),this[this.mode_](A.pts,I),this.column_++}else if(this.isMidRowCode(O,U)){if(this.clearFormatting(A.pts),this[this.mode_](A.pts," "),this.column_++,(U&14)===14)this.addFormatting(A.pts,["i"]);if((U&1)===1)this.addFormatting(A.pts,["u"])}else if(this.isOffsetControlCode(O,U)){let L=U&3;this.nonDisplayed_[this.row_].offset=L,this.column_+=L}else if(this.isPAC(O,U)){var K=zl.indexOf(S&7968);if(this.mode_==="rollUp"){if(K-this.rollUpRows_+1<0)K=this.rollUpRows_-1;this.setRollUp(A.pts,K)}if(K!==this.row_&&K>=0&&K<=14)this.clearFormatting(A.pts),this.row_=K;if(U&1&&this.formatting_.indexOf("u")===-1)this.addFormatting(A.pts,["u"]);if((S&16)===16){let L=(S&14)>>1;this.column_=L*4,this.nonDisplayed_[this.row_].indent+=L}if(this.isColorPAC(U)){if((U&14)===14)this.addFormatting(A.pts,["i"])}}else if(this.isNormalChar(O)){if(U===0)U=null;I=t0(O),I+=t0(U),this[this.mode_](A.pts,I),this.column_+=I.length}}};ba.prototype=new _1,ba.prototype.flushDisplayed=function(b){let q=(S)=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+S+"."})},A=[];if(this.displayed_.forEach((S,_)=>{if(S&&S.text&&S.text.length){try{S.text=S.text.trim()}catch(O){q(_)}if(S.text.length)A.push({text:S.text,line:_+1,position:10+Math.min(70,S.indent*10)+S.offset*2.5})}else if(S===void 0||S===null)q(_)}),A.length)this.trigger("data",{startPts:this.startPts_,endPts:b,content:A,stream:this.name_})},ba.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Is(),this.nonDisplayed_=Is(),this.lastControlCode_=null,this.column_=0,this.row_=B1,this.rollUpRows_=2,this.formatting_=[]},ba.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},ba.prototype.isSpecialCharacter=function(b,q){return b===this.EXT_&&q>=48&&q<=63},ba.prototype.isExtCharacter=function(b,q){return(b===this.EXT_+1||b===this.EXT_+2)&&q>=32&&q<=63},ba.prototype.isMidRowCode=function(b,q){return b===this.EXT_&&q>=32&&q<=47},ba.prototype.isOffsetControlCode=function(b,q){return b===this.OFFSET_&&q>=33&&q<=35},ba.prototype.isPAC=function(b,q){return b>=this.BASE_&&b<this.BASE_+8&&q>=64&&q<=127},ba.prototype.isColorPAC=function(b){return b>=64&&b<=79||b>=96&&b<=127},ba.prototype.isNormalChar=function(b){return b>=32&&b<=127},ba.prototype.setRollUp=function(b,q){if(this.mode_!=="rollUp")this.row_=B1,this.mode_="rollUp",this.flushDisplayed(b),this.nonDisplayed_=Is(),this.displayed_=Is();if(q!==void 0&&q!==this.row_)for(var A=0;A<this.rollUpRows_;A++)this.displayed_[q-A]=this.displayed_[this.row_-A],this.displayed_[this.row_-A]={text:"",indent:0,offset:0};if(q===void 0)q=this.row_;this.topRow_=q-this.rollUpRows_+1},ba.prototype.addFormatting=function(b,q){this.formatting_=this.formatting_.concat(q);var A=q.reduce(function(S,_){return S+"<"+_+">"},"");this[this.mode_](b,A)},ba.prototype.clearFormatting=function(b){if(!this.formatting_.length)return;var q=this.formatting_.reverse().reduce(function(A,S){return A+"</"+S+">"},"");this.formatting_=[],this[this.mode_](b,q)},ba.prototype.popOn=function(b,q){var A=this.nonDisplayed_[this.row_].text;A+=q,this.nonDisplayed_[this.row_].text=A},ba.prototype.rollUp=function(b,q){var A=this.displayed_[this.row_].text;A+=q,this.displayed_[this.row_].text=A},ba.prototype.shiftRowsUp_=function(){var b;for(b=0;b<this.topRow_;b++)this.displayed_[b]={text:"",indent:0,offset:0};for(b=this.row_+1;b<B1+1;b++)this.displayed_[b]={text:"",indent:0,offset:0};for(b=this.topRow_;b<this.row_;b++)this.displayed_[b]=this.displayed_[b+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},ba.prototype.paintOn=function(b,q){var A=this.displayed_[this.row_].text;A+=q,this.displayed_[this.row_].text=A};var Mh={CaptionStream:di,Cea608Stream:ba,Cea708Stream:xe},El={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Dh=a,Th=8589934592,e0=4294967296,br="shared",pr=function(b,q){var A=1;if(b>q)A=-1;while(Math.abs(q-b)>e0)b+=A*Th;return b},hn=function(b){var q,A;hn.prototype.init.call(this),this.type_=b||br,this.push=function(S){if(S.type==="metadata"){this.trigger("data",S);return}if(this.type_!==br&&S.type!==this.type_)return;if(A===void 0)A=S.dts;S.dts=pr(S.dts,A),S.pts=pr(S.pts,A),q=S.dts,this.trigger("data",S)},this.flush=function(){A=q,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){A=void 0,q=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};hn.prototype=new Dh;var Zi={TimestampRolloverStream:hn,handleRollover:pr},wr=(b,q,A)=>{if(!b)return-1;var S=A;for(;S<b.length;S++)if(b[S]===q)return S;return-1},Ba={typedArrayIndexOf:wr},O1=Ba.typedArrayIndexOf,H1={Iso88591:0,Utf16:1,Utf16be:2,Utf8:3},Rh=function(b,q,A){var S,_="";for(S=q;S<A;S++)_+="%"+("00"+b[S].toString(16)).slice(-2);return _},M1=function(b,q,A){return decodeURIComponent(Rh(b,q,A))},xl=function(b,q,A){return unescape(Rh(b,q,A))},U0=function(b){return b[0]<<21|b[1]<<14|b[2]<<7|b[3]},I0={APIC:function(b){var q=1,A,S,_="-->";if(b.data[0]!==H1.Utf8)return;if(A=O1(b.data,0,q),A<0)return;if(b.mimeType=xl(b.data,q,A),q=A+1,b.pictureType=b.data[q],q++,S=O1(b.data,0,q),S<0)return;if(b.description=M1(b.data,q,S),q=S+1,b.mimeType===_)b.url=xl(b.data,q,b.data.length);else b.pictureData=b.data.subarray(q,b.data.length)},"T*":function(b){if(b.data[0]!==H1.Utf8)return;b.value=M1(b.data,1,b.data.length).replace(/\0*$/,""),b.values=b.value.split("\x00")},TXXX:function(b){var q;if(b.data[0]!==H1.Utf8)return;if(q=O1(b.data,0,1),q===-1)return;b.description=M1(b.data,1,q),b.value=M1(b.data,q+1,b.data.length).replace(/\0*$/,""),b.data=b.value},"W*":function(b){b.url=xl(b.data,0,b.data.length).replace(/\0.*$/,"")},WXXX:function(b){var q;if(b.data[0]!==H1.Utf8)return;if(q=O1(b.data,0,1),q===-1)return;b.description=M1(b.data,1,q),b.url=xl(b.data,q+1,b.data.length).replace(/\0.*$/,"")},PRIV:function(b){var q;for(q=0;q<b.data.length;q++)if(b.data[q]===0){b.owner=xl(b.data,0,q);break}b.privateData=b.data.subarray(q+1),b.data=b.privateData}},Nh=function(b){var q,A,S=10,_=0,O=[];if(b.length<10||b[0]!==73||b[1]!==68||b[2]!==51)return;_=U0(b.subarray(6,10)),_+=10;var U=b[5]&64;if(U)S+=4,S+=U0(b.subarray(10,14)),_-=U0(b.subarray(16,20));do{if(q=U0(b.subarray(S+4,S+8)),q<1)break;A=String.fromCharCode(b[S],b[S+1],b[S+2],b[S+3]);var I={id:A,data:b.subarray(S+10,S+q+10)};if(I.key=I.id,I0[I.id])I0[I.id](I);else if(I.id[0]==="T")I0["T*"](I);else if(I.id[0]==="W")I0["W*"](I);O.push(I),S+=10,S+=q}while(S<_);return O},qi={parseId3Frames:Nh,parseSyncSafeInteger:U0,frameParsers:I0},Da=a,jr=El,ds=qi,G0;G0=function(b){var q={descriptor:b&&b.descriptor},A=0,S=[],_=0,O;if(G0.prototype.init.call(this),this.dispatchType=jr.METADATA_STREAM_TYPE.toString(16),q.descriptor)for(O=0;O<q.descriptor.length;O++)this.dispatchType+=("00"+q.descriptor[O].toString(16)).slice(-2);this.push=function(U){var I,K,L,it,ht,zt;if(U.type!=="timed-metadata")return;if(U.dataAlignmentIndicator)_=0,S.length=0;if(S.length===0&&(U.data.length<10||U.data[0]!==73||U.data[1]!==68||U.data[2]!==51)){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}if(S.push(U),_+=U.data.byteLength,S.length===1)A=ds.parseSyncSafeInteger(U.data.subarray(6,10)),A+=10;if(_<A)return;I={data:new Uint8Array(A),frames:[],pts:S[0].pts,dts:S[0].dts};for(ht=0;ht<A;)I.data.set(S[0].data.subarray(0,A-ht),ht),ht+=S[0].data.byteLength,_-=S[0].data.byteLength,S.shift();if(K=10,I.data[5]&64)K+=4,K+=ds.parseSyncSafeInteger(I.data.subarray(10,14)),A-=ds.parseSyncSafeInteger(I.data.subarray(16,20));do{if(L=ds.parseSyncSafeInteger(I.data.subarray(K+4,K+8)),L<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(zt=String.fromCharCode(I.data[K],I.data[K+1],I.data[K+2],I.data[K+3]),it={id:zt,data:I.data.subarray(K+10,K+L+10)},it.key=it.id,ds.frameParsers[it.id])ds.frameParsers[it.id](it);else if(it.id[0]==="T")ds.frameParsers["T*"](it);else if(it.id[0]==="W")ds.frameParsers["W*"](it);if(it.owner==="com.apple.streaming.transportStreamTimestamp"){var wt=it.data,te=(wt[3]&1)<<30|wt[4]<<22|wt[5]<<14|wt[6]<<6|wt[7]>>>2;if(te*=4,te+=wt[7]&3,it.timeStamp=te,I.pts===void 0&&I.dts===void 0)I.pts=it.timeStamp,I.dts=it.timeStamp;this.trigger("timestamp",it)}I.frames.push(it),K+=10,K+=L}while(K<A);this.trigger("data",I)}},G0.prototype=new Da;var zh=G0,Gs=a,D1=Mh,ss=El,Eh=Zi.TimestampRolloverStream,Ul,T1,Il,X0=188,dr=71;Ul=function(){var b=new Uint8Array(X0),q=0;Ul.prototype.init.call(this),this.push=function(A){var S=0,_=X0,O;if(q)O=new Uint8Array(A.byteLength+q),O.set(b.subarray(0,q)),O.set(A,q),q=0;else O=A;while(_<O.byteLength){if(O[S]===dr&&O[_]===dr){this.trigger("data",O.subarray(S,_)),S+=X0,_+=X0;continue}S++,_++}if(S<O.byteLength)b.set(O.subarray(S),0),q=O.byteLength-S},this.flush=function(){if(q===X0&&b[0]===dr)this.trigger("data",b),q=0;this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){q=0,this.trigger("reset")}},Ul.prototype=new Gs,T1=function(){var b,q,A,S;T1.prototype.init.call(this),S=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,b=function(_,O){var U=0;if(O.payloadUnitStartIndicator)U+=_[U]+1;if(O.type==="pat")q(_.subarray(U),O);else A(_.subarray(U),O)},q=function(_,O){O.section_number=_[7],O.last_section_number=_[8],S.pmtPid=(_[10]&31)<<8|_[11],O.pmtPid=S.pmtPid},A=function(_,O){var U,I,K,L;if(!(_[5]&1))return;S.programMapTable={video:null,audio:null,"timed-metadata":{}},U=(_[1]&15)<<8|_[2],I=3+U-4,K=(_[10]&15)<<8|_[11],L=12+K;while(L<I){var it=_[L],ht=(_[L+1]&31)<<8|_[L+2];if(it===ss.H264_STREAM_TYPE&&S.programMapTable.video===null)S.programMapTable.video=ht;else if(it===ss.ADTS_STREAM_TYPE&&S.programMapTable.audio===null)S.programMapTable.audio=ht;else if(it===ss.METADATA_STREAM_TYPE)S.programMapTable["timed-metadata"][ht]=it;L+=((_[L+3]&15)<<8|_[L+4])+5}O.programMapTable=S.programMapTable},this.push=function(_){var O={},U=4;if(O.payloadUnitStartIndicator=!!(_[1]&64),O.pid=_[1]&31,O.pid<<=8,O.pid|=_[2],(_[3]&48)>>>4>1)U+=_[U]+1;if(O.pid===0)O.type="pat",b(_.subarray(U),O),this.trigger("data",O);else if(O.pid===this.pmtPid){O.type="pmt",b(_.subarray(U),O),this.trigger("data",O);while(this.packetsWaitingForPmt.length)this.processPes_.apply(this,this.packetsWaitingForPmt.shift())}else if(this.programMapTable===void 0)this.packetsWaitingForPmt.push([_,U,O]);else this.processPes_(_,U,O)},this.processPes_=function(_,O,U){if(U.pid===this.programMapTable.video)U.streamType=ss.H264_STREAM_TYPE;else if(U.pid===this.programMapTable.audio)U.streamType=ss.ADTS_STREAM_TYPE;else U.streamType=this.programMapTable["timed-metadata"][U.pid];U.type="pes",U.data=_.subarray(O),this.trigger("data",U)}},T1.prototype=new Gs,T1.STREAM_TYPES={h264:27,adts:15},Il=function(){var b=this,q=!1,A={data:[],size:0},S={data:[],size:0},_={data:[],size:0},O,U=function(K,L){var it;let ht=K[0]<<16|K[1]<<8|K[2];if(L.data=new Uint8Array,ht!==1)return;if(L.packetLength=6+(K[4]<<8|K[5]),L.dataAlignmentIndicator=(K[6]&4)!==0,it=K[7],it&192){if(L.pts=(K[9]&14)<<27|(K[10]&255)<<20|(K[11]&254)<<12|(K[12]&255)<<5|(K[13]&254)>>>3,L.pts*=4,L.pts+=(K[13]&6)>>>1,L.dts=L.pts,it&64)L.dts=(K[14]&14)<<27|(K[15]&255)<<20|(K[16]&254)<<12|(K[17]&255)<<5|(K[18]&254)>>>3,L.dts*=4,L.dts+=(K[18]&6)>>>1}L.data=K.subarray(9+K[8])},I=function(K,L,it){var ht=new Uint8Array(K.size),zt={type:L},wt=0,te=0,oe=!1,Za;if(!K.data.length||K.size<9)return;zt.trackId=K.data[0].pid;for(wt=0;wt<K.data.length;wt++)Za=K.data[wt],ht.set(Za.data,te),te+=Za.data.byteLength;if(U(ht,zt),oe=L==="video"||zt.packetLength<=K.size,it||oe)K.size=0,K.data.length=0;if(oe)b.trigger("data",zt)};Il.prototype.init.call(this),this.push=function(K){({pat:function(){},pes:function(){var L,it;switch(K.streamType){case ss.H264_STREAM_TYPE:L=A,it="video";break;case ss.ADTS_STREAM_TYPE:L=S,it="audio";break;case ss.METADATA_STREAM_TYPE:L=_,it="timed-metadata";break;default:return}if(K.payloadUnitStartIndicator)I(L,it,!0);L.data.push(K),L.size+=K.data.byteLength},pmt:function(){var L={type:"metadata",tracks:[]};if(O=K.programMapTable,O.video!==null)L.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+O.video,codec:"avc",type:"video"});if(O.audio!==null)L.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+O.audio,codec:"adts",type:"audio"});q=!0,b.trigger("data",L)}})[K.type]()},this.reset=function(){A.size=0,A.data.length=0,S.size=0,S.data.length=0,this.trigger("reset")},this.flushStreams_=function(){I(A,"video"),I(S,"audio"),I(_,"timed-metadata")},this.flush=function(){if(!q&&O){var K={type:"metadata",tracks:[]};if(O.video!==null)K.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+O.video,codec:"avc",type:"video"});if(O.audio!==null)K.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+O.audio,codec:"adts",type:"audio"});b.trigger("data",K)}q=!1,this.flushStreams_(),this.trigger("done")}},Il.prototype=new Gs;var xh={PAT_PID:0,MP2T_PACKET_LENGTH:X0,TransportPacketStream:Ul,TransportParseStream:T1,ElementaryStream:Il,TimestampRolloverStream:Eh,CaptionStream:D1.CaptionStream,Cea608Stream:D1.Cea608Stream,Cea708Stream:D1.Cea708Stream,MetadataStream:zh};for(var Gl in ss)if(ss.hasOwnProperty(Gl))xh[Gl]=ss[Gl];var k9=xh,A6=a,C9=Ut.ONE_SECOND_IN_TS,Xl,Uh=[96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000,7350];Xl=function(b){var q,A=0;Xl.prototype.init.call(this),this.skipWarn_=function(S,_){this.trigger("log",{level:"warn",message:`adts skiping bytes ${S} to ${_} in frame ${A} outside syncword`})},this.push=function(S){var _=0,O,U,I,K,L;if(!b)A=0;if(S.type!=="audio")return;if(q&&q.length)I=q,q=new Uint8Array(I.byteLength+S.data.byteLength),q.set(I),q.set(S.data,I.byteLength);else q=S.data;var it;while(_+7<q.length){if(q[_]!==255||(q[_+1]&246)!==240){if(typeof it!=="number")it=_;_++;continue}if(typeof it==="number")this.skipWarn_(it,_),it=null;if(U=(~q[_+1]&1)*2,O=(q[_+3]&3)<<11|q[_+4]<<3|(q[_+5]&224)>>5,K=((q[_+6]&3)+1)*1024,L=K*C9/Uh[(q[_+2]&60)>>>2],q.byteLength-_<O)break;this.trigger("data",{pts:S.pts+A*L,dts:S.dts+A*L,sampleCount:K,audioobjecttype:(q[_+2]>>>6&3)+1,channelcount:(q[_+2]&1)<<2|(q[_+3]&192)>>>6,samplerate:Uh[(q[_+2]&60)>>>2],samplingfrequencyindex:(q[_+2]&60)>>>2,samplesize:16,data:q.subarray(_+7+U,_+O)}),A++,_+=O}if(typeof it==="number")this.skipWarn_(it,_),it=null;q=q.subarray(_)},this.flush=function(){A=0,this.trigger("done")},this.reset=function(){q=void 0,this.trigger("reset")},this.endTimeline=function(){q=void 0,this.trigger("endedtimeline")}},Xl.prototype=new A6;var Ih=Xl,Gh;Gh=function(b){var q=b.byteLength,A=0,S=0;this.length=function(){return 8*q},this.bitsAvailable=function(){return 8*q+S},this.loadWord=function(){var _=b.byteLength-q,O=new Uint8Array(4),U=Math.min(4,q);if(U===0)throw Error("no bytes available");O.set(b.subarray(_,_+U)),A=new DataView(O.buffer).getUint32(0),S=U*8,q-=U},this.skipBits=function(_){var O;if(S>_)A<<=_,S-=_;else _-=S,O=Math.floor(_/8),_-=O*8,q-=O,this.loadWord(),A<<=_,S-=_},this.readBits=function(_){var O=Math.min(S,_),U=A>>>32-O;if(S-=O,S>0)A<<=O;else if(q>0)this.loadWord();if(O=_-O,O>0)return U<<O|this.readBits(O);return U},this.skipLeadingZeros=function(){var _;for(_=0;_<S;++_)if((A&2147483648>>>_)!==0)return A<<=_,S-=_,_;return this.loadWord(),_+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var _=this.skipLeadingZeros();return this.readBits(_+1)-1},this.readExpGolomb=function(){var _=this.readUnsignedExpGolomb();if(1&_)return 1+_>>>1;return-1*(_>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var _9=Gh,Xh=a,F9=_9,Kl,Ll,Kh;Ll=function(){var b=0,q,A;Ll.prototype.init.call(this),this.push=function(S){var _;if(!A)A=S.data;else _=new Uint8Array(A.byteLength+S.data.byteLength),_.set(A),_.set(S.data,A.byteLength),A=_;var O=A.byteLength;for(;b<O-3;b++)if(A[b+2]===1){q=b+5;break}while(q<O)switch(A[q]){case 0:if(A[q-1]!==0){q+=2;break}else if(A[q-2]!==0){q++;break}if(b+3!==q-2)this.trigger("data",A.subarray(b+3,q-2));do q++;while(A[q]!==1&&q<O);b=q-2,q+=3;break;case 1:if(A[q-1]!==0||A[q-2]!==0){q+=3;break}this.trigger("data",A.subarray(b+3,q-2)),b=q-2,q+=3;break;default:q+=3;break}A=A.subarray(b),q-=b,b=0},this.reset=function(){A=null,b=0,this.trigger("reset")},this.flush=function(){if(A&&A.byteLength>3)this.trigger("data",A.subarray(b+3));A=null,b=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},Ll.prototype=new Xh,Kh={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},Kl=function(){var b=new Ll,q,A,S,_,O,U,I;Kl.prototype.init.call(this),q=this,this.push=function(K){if(K.type!=="video")return;A=K.trackId,S=K.pts,_=K.dts,b.push(K)},b.on("data",function(K){var L={trackId:A,pts:S,dts:_,data:K,nalUnitTypeCode:K[0]&31};switch(L.nalUnitTypeCode){case 5:L.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:L.nalUnitType="sei_rbsp",L.escapedRBSP=O(K.subarray(1));break;case 7:L.nalUnitType="seq_parameter_set_rbsp",L.escapedRBSP=O(K.subarray(1)),L.config=U(L.escapedRBSP);break;case 8:L.nalUnitType="pic_parameter_set_rbsp";break;case 9:L.nalUnitType="access_unit_delimiter_rbsp";break}q.trigger("data",L)}),b.on("done",function(){q.trigger("done")}),b.on("partialdone",function(){q.trigger("partialdone")}),b.on("reset",function(){q.trigger("reset")}),b.on("endedtimeline",function(){q.trigger("endedtimeline")}),this.flush=function(){b.flush()},this.partialFlush=function(){b.partialFlush()},this.reset=function(){b.reset()},this.endTimeline=function(){b.endTimeline()},I=function(K,L){var it=8,ht=8,zt,wt;for(zt=0;zt<K;zt++){if(ht!==0)wt=L.readExpGolomb(),ht=(it+wt+256)%256;it=ht===0?it:ht}},O=function(K){var L=K.byteLength,it=[],ht=1,zt,wt;while(ht<L-2)if(K[ht]===0&&K[ht+1]===0&&K[ht+2]===3)it.push(ht+2),ht+=2;else ht++;if(it.length===0)return K;zt=L-it.length,wt=new Uint8Array(zt);var te=0;for(ht=0;ht<zt;te++,ht++){if(te===it[0])te++,it.shift();wt[ht]=K[te]}return wt},U=function(K){var L=0,it=0,ht=0,zt=0,wt,te,oe,Za,Ei,l0,L1,V1,Y1,J1,gf,sa=[1,1],qe,fs;if(wt=new F9(K),te=wt.readUnsignedByte(),Za=wt.readUnsignedByte(),oe=wt.readUnsignedByte(),wt.skipUnsignedExpGolomb(),Kh[te]){if(Ei=wt.readUnsignedExpGolomb(),Ei===3)wt.skipBits(1);if(wt.skipUnsignedExpGolomb(),wt.skipUnsignedExpGolomb(),wt.skipBits(1),wt.readBoolean()){gf=Ei!==3?8:12;for(fs=0;fs<gf;fs++)if(wt.readBoolean())if(fs<6)I(16,wt);else I(64,wt)}}if(wt.skipUnsignedExpGolomb(),l0=wt.readUnsignedExpGolomb(),l0===0)wt.readUnsignedExpGolomb();else if(l0===1){wt.skipBits(1),wt.skipExpGolomb(),wt.skipExpGolomb(),L1=wt.readUnsignedExpGolomb();for(fs=0;fs<L1;fs++)wt.skipExpGolomb()}if(wt.skipUnsignedExpGolomb(),wt.skipBits(1),V1=wt.readUnsignedExpGolomb(),Y1=wt.readUnsignedExpGolomb(),J1=wt.readBits(1),J1===0)wt.skipBits(1);if(wt.skipBits(1),wt.readBoolean())L=wt.readUnsignedExpGolomb(),it=wt.readUnsignedExpGolomb(),ht=wt.readUnsignedExpGolomb(),zt=wt.readUnsignedExpGolomb();if(wt.readBoolean()){if(wt.readBoolean()){switch(qe=wt.readUnsignedByte(),qe){case 1:sa=[1,1];break;case 2:sa=[12,11];break;case 3:sa=[10,11];break;case 4:sa=[16,11];break;case 5:sa=[40,33];break;case 6:sa=[24,11];break;case 7:sa=[20,11];break;case 8:sa=[32,11];break;case 9:sa=[80,33];break;case 10:sa=[18,11];break;case 11:sa=[15,11];break;case 12:sa=[64,33];break;case 13:sa=[160,99];break;case 14:sa=[4,3];break;case 15:sa=[3,2];break;case 16:sa=[2,1];break;case 255:{sa=[wt.readUnsignedByte()<<8|wt.readUnsignedByte(),wt.readUnsignedByte()<<8|wt.readUnsignedByte()];break}}if(sa)sa[0]/sa[1]}}return{profileIdc:te,levelIdc:oe,profileCompatibility:Za,width:(V1+1)*16-L*2-it*2,height:(2-J1)*(Y1+1)*16-ht*2-zt*2,sarRatio:sa}}},Kl.prototype=new Xh;var R1={H264Stream:Kl,NalByteStream:Ll},B9=[96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000,7350],Vl=function(b,q){var A=b[q+6]<<21|b[q+7]<<14|b[q+8]<<7|b[q+9],S=b[q+5],_=(S&16)>>4;if(A=A>=0?A:0,_)return A+20;return A+10},Yl=function(b,q){if(b.length-q<10||b[q]!==73||b[q+1]!==68||b[q+2]!==51)return q;return q+=Vl(b,q),Yl(b,q)},O9=function(b){var q=Yl(b,0);return b.length>=q+2&&(b[q]&255)===255&&(b[q+1]&240)===240&&(b[q+1]&22)===16},qr=function(b){return b[0]<<21|b[1]<<14|b[2]<<7|b[3]},v6=function(b,q,A){var S,_="";for(S=q;S<A;S++)_+="%"+("00"+b[S].toString(16)).slice(-2);return _},H9=function(b,q,A){return unescape(v6(b,q,A))},M9=function(b,q){var A=(b[q+5]&224)>>5,S=b[q+4]<<3,_=b[q+3]&6144;return _|S|A},D9=function(b,q){if(b[q]===73&&b[q+1]===68&&b[q+2]===51)return"timed-metadata";else if(b[q]&!0&&(b[q+1]&240)===240)return"audio";return null},T9=function(b){var q=0;while(q+5<b.length){if(b[q]!==255||(b[q+1]&246)!==240){q++;continue}return B9[(b[q+2]&60)>>>2]}return null},R9=function(b){var q,A,S,_;if(q=10,b[5]&64)q+=4,q+=qr(b.subarray(10,14));do{if(A=qr(b.subarray(q+4,q+8)),A<1)return null;if(_=String.fromCharCode(b[q],b[q+1],b[q+2],b[q+3]),_==="PRIV"){S=b.subarray(q+10,q+A+10);for(var O=0;O<S.byteLength;O++)if(S[O]===0){var U=H9(S,0,O);if(U==="com.apple.streaming.transportStreamTimestamp"){var I=S.subarray(O+1),K=(I[3]&1)<<30|I[4]<<22|I[5]<<14|I[6]<<6|I[7]>>>2;return K*=4,K+=I[7]&3,K}break}}q+=10,q+=A}while(q<b.byteLength);return null},Jl={isLikelyAacData:O9,parseId3TagSize:Vl,parseAdtsSize:M9,parseType:D9,parseSampleRate:T9,parseAacTimestamp:R9},N9=a,Lh=Jl,N1;N1=function(){var b=new Uint8Array,q=0;N1.prototype.init.call(this),this.setTimestamp=function(A){q=A},this.push=function(A){var S=0,_=0,O,U,I,K;if(b.length)K=b.length,b=new Uint8Array(A.byteLength+K),b.set(b.subarray(0,K)),b.set(A,K);else b=A;while(b.length-_>=3){if(b[_]===73&&b[_+1]===68&&b[_+2]===51){if(b.length-_<10)break;if(S=Lh.parseId3TagSize(b,_),_+S>b.length)break;U={type:"timed-metadata",data:b.subarray(_,_+S)},this.trigger("data",U),_+=S;continue}else if((b[_]&255)===255&&(b[_+1]&240)===240){if(b.length-_<7)break;if(S=Lh.parseAdtsSize(b,_),_+S>b.length)break;I={type:"audio",data:b.subarray(_,_+S),pts:q,dts:q},this.trigger("data",I),_+=S;continue}_++}if(O=b.length-_,O>0)b=b.subarray(_);else b=new Uint8Array},this.reset=function(){b=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){b=new Uint8Array,this.trigger("endedtimeline")}},N1.prototype=new N9;var z9=N1,E9=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],x9=E9,Vh=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],U9=Vh,Ql=a,Zl=Ft,$l=da,Wl=Yt,Ni=Oe,Xs=k9,K0=Ut,Yh=Ih,I9=R1.H264Stream,Jh=z9,G9=Jl.isLikelyAacData,X9=Ut.ONE_SECOND_IN_TS,xn=x9,z1=U9,E1,a0,Pl,i0,S6=function(b,q){q.stream=b,this.trigger("log",q)},si=function(b,q){var A=Object.keys(q);for(var S=0;S<A.length;S++){var _=A[S];if(_==="headOfPipeline"||!q[_].on)continue;q[_].on("log",S6.bind(b,_))}},Qh=function(b,q){var A;if(b.length!==q.length)return!1;for(A=0;A<b.length;A++)if(b[A]!==q[A])return!1;return!0},Ar=function(b,q,A,S,_,O){var U=A-q,I=S-q,K=_-A;return{start:{dts:b,pts:b+U},end:{dts:b+I,pts:b+K},prependedContentDuration:O,baseMediaDecodeTime:b}};a0=function(b,q){var A=[],S,_=0,O=0,U=1/0;q=q||{},S=q.firstSequenceNumber||0,a0.prototype.init.call(this),this.push=function(I){if(Ni.collectDtsInfo(b,I),b)xn.forEach(function(K){b[K]=I[K]});A.push(I)},this.setEarliestDts=function(I){_=I},this.setVideoBaseMediaDecodeTime=function(I){U=I},this.setAudioAppendStart=function(I){O=I},this.flush=function(){var I,K,L,it,ht,zt,wt;if(A.length===0){this.trigger("done","AudioSegmentStream");return}if(I=Wl.trimAdtsFramesByEarliestDts(A,b,_),b.baseMediaDecodeTime=Ni.calculateTrackBaseMediaDecodeTime(b,q.keepOriginalTimestamps),wt=Wl.prefixWithSilence(b,I,O,U),b.samples=Wl.generateSampleTable(I),L=Zl.mdat(Wl.concatenateFrameData(I)),A=[],K=Zl.moof(S,[b]),it=new Uint8Array(K.byteLength+L.byteLength),S++,it.set(K),it.set(L,K.byteLength),Ni.clearDtsInfo(b),ht=Math.ceil(X9*1024/b.samplerate),I.length)zt=I.length*ht,this.trigger("segmentTimingInfo",Ar(K0.audioTsToVideoTs(b.baseMediaDecodeTime,b.samplerate),I[0].dts,I[0].pts,I[0].dts+zt,I[0].pts+zt,wt||0)),this.trigger("timingInfo",{start:I[0].pts,end:I[0].pts+zt});this.trigger("data",{track:b,boxes:it}),this.trigger("done","AudioSegmentStream")},this.reset=function(){Ni.clearDtsInfo(b),A=[],this.trigger("reset")}},a0.prototype=new Ql,E1=function(b,q){var A,S=[],_=[],O,U;q=q||{},A=q.firstSequenceNumber||0,E1.prototype.init.call(this),delete b.minPTS,this.gopCache_=[],this.push=function(I){if(Ni.collectDtsInfo(b,I),I.nalUnitType==="seq_parameter_set_rbsp"&&!O)O=I.config,b.sps=[I.data],z1.forEach(function(K){b[K]=O[K]},this);if(I.nalUnitType==="pic_parameter_set_rbsp"&&!U)U=I.data,b.pps=[I.data];S.push(I)},this.flush=function(){var I,K,L,it,ht,zt,wt=0,te,oe;while(S.length){if(S[0].nalUnitType==="access_unit_delimiter_rbsp")break;S.shift()}if(S.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(I=$l.groupNalsIntoFrames(S),L=$l.groupFramesIntoGops(I),!L[0][0].keyFrame)if(K=this.getGopForFusion_(S[0],b),K)wt=K.duration,L.unshift(K),L.byteLength+=K.byteLength,L.nalCount+=K.nalCount,L.pts=K.pts,L.dts=K.dts,L.duration+=K.duration;else L=$l.extendFirstKeyFrame(L);if(_.length){var Za;if(q.alignGopsAtEnd)Za=this.alignGopsAtEnd_(L);else Za=this.alignGopsAtStart_(L);if(!Za){this.gopCache_.unshift({gop:L.pop(),pps:b.pps,sps:b.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),S=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}Ni.clearDtsInfo(b),L=Za}Ni.collectDtsInfo(b,L),b.samples=$l.generateSampleTable(L),ht=Zl.mdat($l.concatenateNalData(L)),b.baseMediaDecodeTime=Ni.calculateTrackBaseMediaDecodeTime(b,q.keepOriginalTimestamps),this.trigger("processedGopsInfo",L.map(function(Ei){return{pts:Ei.pts,dts:Ei.dts,byteLength:Ei.byteLength}})),te=L[0],oe=L[L.length-1],this.trigger("segmentTimingInfo",Ar(b.baseMediaDecodeTime,te.dts,te.pts,oe.dts+oe.duration,oe.pts+oe.duration,wt)),this.trigger("timingInfo",{start:L[0].pts,end:L[L.length-1].pts+L[L.length-1].duration}),this.gopCache_.unshift({gop:L.pop(),pps:b.pps,sps:b.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),S=[],this.trigger("baseMediaDecodeTime",b.baseMediaDecodeTime),this.trigger("timelineStartInfo",b.timelineStartInfo),it=Zl.moof(A,[b]),zt=new Uint8Array(it.byteLength+ht.byteLength),A++,zt.set(it),zt.set(ht,it.byteLength),this.trigger("data",{track:b,boxes:zt}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),S=[],this.gopCache_.length=0,_.length=0,this.trigger("reset")},this.resetStream_=function(){Ni.clearDtsInfo(b),O=void 0,U=void 0},this.getGopForFusion_=function(I){var K=45000,L=1e4,it=1/0,ht,zt,wt,te,oe;for(oe=0;oe<this.gopCache_.length;oe++){if(te=this.gopCache_[oe],wt=te.gop,!(b.pps&&Qh(b.pps[0],te.pps[0]))||!(b.sps&&Qh(b.sps[0],te.sps[0])))continue;if(wt.dts<b.timelineStartInfo.dts)continue;if(ht=I.dts-wt.dts-wt.duration,ht>=-L&&ht<=K){if(!zt||it>ht)zt=te,it=ht}}if(zt)return zt.gop;return null},this.alignGopsAtStart_=function(I){var K,L,it,ht,zt,wt,te,oe;zt=I.byteLength,wt=I.nalCount,te=I.duration,K=L=0;while(K<_.length&&L<I.length){if(it=_[K],ht=I[L],it.pts===ht.pts)break;if(ht.pts>it.pts){K++;continue}L++,zt-=ht.byteLength,wt-=ht.nalCount,te-=ht.duration}if(L===0)return I;if(L===I.length)return null;return oe=I.slice(L),oe.byteLength=zt,oe.duration=te,oe.nalCount=wt,oe.pts=oe[0].pts,oe.dts=oe[0].dts,oe},this.alignGopsAtEnd_=function(I){var K,L,it,ht,zt,wt;K=_.length-1,L=I.length-1,zt=null,wt=!1;while(K>=0&&L>=0){if(it=_[K],ht=I[L],it.pts===ht.pts){wt=!0;break}if(it.pts>ht.pts){K--;continue}if(K===_.length-1)zt=L;L--}if(!wt&&zt===null)return null;var te;if(wt)te=L;else te=zt;if(te===0)return I;var oe=I.slice(te),Za=oe.reduce(function(Ei,l0){return Ei.byteLength+=l0.byteLength,Ei.duration+=l0.duration,Ei.nalCount+=l0.nalCount,Ei},{byteLength:0,duration:0,nalCount:0});return oe.byteLength=Za.byteLength,oe.duration=Za.duration,oe.nalCount=Za.nalCount,oe.pts=oe[0].pts,oe.dts=oe[0].dts,oe},this.alignGopsWith=function(I){_=I}},E1.prototype=new Ql,i0=function(b,q){if(this.numberOfTracks=0,this.metadataStream=q,b=b||{},typeof b.remux<"u")this.remuxTracks=!!b.remux;else this.remuxTracks=!0;if(typeof b.keepOriginalTimestamps==="boolean")this.keepOriginalTimestamps=b.keepOriginalTimestamps;else this.keepOriginalTimestamps=!1;this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,i0.prototype.init.call(this),this.push=function(A){if(A.content||A.text)return this.pendingCaptions.push(A);if(A.frames)return this.pendingMetadata.push(A);if(this.pendingTracks.push(A.track),this.pendingBytes+=A.boxes.byteLength,A.track.type==="video")this.videoTrack=A.track,this.pendingBoxes.push(A.boxes);if(A.track.type==="audio")this.audioTrack=A.track,this.pendingBoxes.unshift(A.boxes)}},i0.prototype=new Ql,i0.prototype.flush=function(b){var q=0,A={captions:[],captionStreams:{},metadata:[],info:{}},S,_,O,U=0,I;if(this.pendingTracks.length<this.numberOfTracks){if(b!=="VideoSegmentStream"&&b!=="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)U=this.videoTrack.timelineStartInfo.pts,z1.forEach(function(K){A.info[K]=this.videoTrack[K]},this);else if(this.audioTrack)U=this.audioTrack.timelineStartInfo.pts,xn.forEach(function(K){A.info[K]=this.audioTrack[K]},this);if(this.videoTrack||this.audioTrack){if(this.pendingTracks.length===1)A.type=this.pendingTracks[0].type;else A.type="combined";this.emittedTracks+=this.pendingTracks.length,O=Zl.initSegment(this.pendingTracks),A.initSegment=new Uint8Array(O.byteLength),A.initSegment.set(O),A.data=new Uint8Array(this.pendingBytes);for(I=0;I<this.pendingBoxes.length;I++)A.data.set(this.pendingBoxes[I],q),q+=this.pendingBoxes[I].byteLength;for(I=0;I<this.pendingCaptions.length;I++)S=this.pendingCaptions[I],S.startTime=K0.metadataTsToSeconds(S.startPts,U,this.keepOriginalTimestamps),S.endTime=K0.metadataTsToSeconds(S.endPts,U,this.keepOriginalTimestamps),A.captionStreams[S.stream]=!0,A.captions.push(S);for(I=0;I<this.pendingMetadata.length;I++)_=this.pendingMetadata[I],_.cueTime=K0.metadataTsToSeconds(_.pts,U,this.keepOriginalTimestamps),A.metadata.push(_);A.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",A);for(I=0;I<A.captions.length;I++)S=A.captions[I],this.trigger("caption",S);for(I=0;I<A.metadata.length;I++)_=A.metadata[I],this.trigger("id3Frame",_)}if(this.emittedTracks>=this.numberOfTracks)this.trigger("done"),this.emittedTracks=0},i0.prototype.setRemux=function(b){this.remuxTracks=b},Pl=function(b){var q=this,A=!0,S,_;Pl.prototype.init.call(this),b=b||{},this.baseMediaDecodeTime=b.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var O={};this.transmuxPipeline_=O,O.type="aac",O.metadataStream=new Xs.MetadataStream,O.aacStream=new Jh,O.audioTimestampRolloverStream=new Xs.TimestampRolloverStream("audio"),O.timedMetadataTimestampRolloverStream=new Xs.TimestampRolloverStream("timed-metadata"),O.adtsStream=new Yh,O.coalesceStream=new i0(b,O.metadataStream),O.headOfPipeline=O.aacStream,O.aacStream.pipe(O.audioTimestampRolloverStream).pipe(O.adtsStream),O.aacStream.pipe(O.timedMetadataTimestampRolloverStream).pipe(O.metadataStream).pipe(O.coalesceStream),O.metadataStream.on("timestamp",function(U){O.aacStream.setTimestamp(U.timeStamp)}),O.aacStream.on("data",function(U){if(U.type!=="timed-metadata"&&U.type!=="audio"||O.audioSegmentStream)return;_=_||{timelineStartInfo:{baseMediaDecodeTime:q.baseMediaDecodeTime},codec:"adts",type:"audio"},O.coalesceStream.numberOfTracks++,O.audioSegmentStream=new a0(_,b),O.audioSegmentStream.on("log",q.getLogTrigger_("audioSegmentStream")),O.audioSegmentStream.on("timingInfo",q.trigger.bind(q,"audioTimingInfo")),O.adtsStream.pipe(O.audioSegmentStream).pipe(O.coalesceStream),q.trigger("trackinfo",{hasAudio:!!_,hasVideo:!!S})}),O.coalesceStream.on("data",this.trigger.bind(this,"data")),O.coalesceStream.on("done",this.trigger.bind(this,"done")),si(this,O)},this.setupTsPipeline=function(){var O={};this.transmuxPipeline_=O,O.type="ts",O.metadataStream=new Xs.MetadataStream,O.packetStream=new Xs.TransportPacketStream,O.parseStream=new Xs.TransportParseStream,O.elementaryStream=new Xs.ElementaryStream,O.timestampRolloverStream=new Xs.TimestampRolloverStream,O.adtsStream=new Yh,O.h264Stream=new I9,O.captionStream=new Xs.CaptionStream(b),O.coalesceStream=new i0(b,O.metadataStream),O.headOfPipeline=O.packetStream,O.packetStream.pipe(O.parseStream).pipe(O.elementaryStream).pipe(O.timestampRolloverStream),O.timestampRolloverStream.pipe(O.h264Stream),O.timestampRolloverStream.pipe(O.adtsStream),O.timestampRolloverStream.pipe(O.metadataStream).pipe(O.coalesceStream),O.h264Stream.pipe(O.captionStream).pipe(O.coalesceStream),O.elementaryStream.on("data",function(U){var I;if(U.type==="metadata"){I=U.tracks.length;while(I--)if(!S&&U.tracks[I].type==="video")S=U.tracks[I],S.timelineStartInfo.baseMediaDecodeTime=q.baseMediaDecodeTime;else if(!_&&U.tracks[I].type==="audio")_=U.tracks[I],_.timelineStartInfo.baseMediaDecodeTime=q.baseMediaDecodeTime;if(S&&!O.videoSegmentStream)O.coalesceStream.numberOfTracks++,O.videoSegmentStream=new E1(S,b),O.videoSegmentStream.on("log",q.getLogTrigger_("videoSegmentStream")),O.videoSegmentStream.on("timelineStartInfo",function(K){if(_&&!b.keepOriginalTimestamps)_.timelineStartInfo=K,O.audioSegmentStream.setEarliestDts(K.dts-q.baseMediaDecodeTime)}),O.videoSegmentStream.on("processedGopsInfo",q.trigger.bind(q,"gopInfo")),O.videoSegmentStream.on("segmentTimingInfo",q.trigger.bind(q,"videoSegmentTimingInfo")),O.videoSegmentStream.on("baseMediaDecodeTime",function(K){if(_)O.audioSegmentStream.setVideoBaseMediaDecodeTime(K)}),O.videoSegmentStream.on("timingInfo",q.trigger.bind(q,"videoTimingInfo")),O.h264Stream.pipe(O.videoSegmentStream).pipe(O.coalesceStream);if(_&&!O.audioSegmentStream)O.coalesceStream.numberOfTracks++,O.audioSegmentStream=new a0(_,b),O.audioSegmentStream.on("log",q.getLogTrigger_("audioSegmentStream")),O.audioSegmentStream.on("timingInfo",q.trigger.bind(q,"audioTimingInfo")),O.audioSegmentStream.on("segmentTimingInfo",q.trigger.bind(q,"audioSegmentTimingInfo")),O.adtsStream.pipe(O.audioSegmentStream).pipe(O.coalesceStream);q.trigger("trackinfo",{hasAudio:!!_,hasVideo:!!S})}}),O.coalesceStream.on("data",this.trigger.bind(this,"data")),O.coalesceStream.on("id3Frame",function(U){U.dispatchType=O.metadataStream.dispatchType,q.trigger("id3Frame",U)}),O.coalesceStream.on("caption",this.trigger.bind(this,"caption")),O.coalesceStream.on("done",this.trigger.bind(this,"done")),si(this,O)},this.setBaseMediaDecodeTime=function(O){var U=this.transmuxPipeline_;if(!b.keepOriginalTimestamps)this.baseMediaDecodeTime=O;if(_){if(_.timelineStartInfo.dts=void 0,_.timelineStartInfo.pts=void 0,Ni.clearDtsInfo(_),U.audioTimestampRolloverStream)U.audioTimestampRolloverStream.discontinuity()}if(S){if(U.videoSegmentStream)U.videoSegmentStream.gopCache_=[];S.timelineStartInfo.dts=void 0,S.timelineStartInfo.pts=void 0,Ni.clearDtsInfo(S),U.captionStream.reset()}if(U.timestampRolloverStream)U.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(O){if(_)this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(O)},this.setRemux=function(O){var U=this.transmuxPipeline_;if(b.remux=O,U&&U.coalesceStream)U.coalesceStream.setRemux(O)},this.alignGopsWith=function(O){if(S&&this.transmuxPipeline_.videoSegmentStream)this.transmuxPipeline_.videoSegmentStream.alignGopsWith(O)},this.getLogTrigger_=function(O){var U=this;return function(I){I.stream=O,U.trigger("log",I)}},this.push=function(O){if(A){var U=G9(O);if(U&&this.transmuxPipeline_.type!=="aac")this.setupAacPipeline();else if(!U&&this.transmuxPipeline_.type!=="ts")this.setupTsPipeline();A=!1}this.transmuxPipeline_.headOfPipeline.push(O)},this.flush=function(){A=!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()}},Pl.prototype=new Ql;var K9={Transmuxer:Pl,VideoSegmentStream:E1,AudioSegmentStream:a0,AUDIO_PROPERTIES:xn,VIDEO_PROPERTIES:z1,generateSegmentTimingInfo:Ar},L9=function(b){return b>>>0},tf=function(b){return("00"+b.toString(16)).slice(-2)},ef={toUnsigned:L9,toHexString:tf},vr=function(b){var q="";return q+=String.fromCharCode(b[0]),q+=String.fromCharCode(b[1]),q+=String.fromCharCode(b[2]),q+=String.fromCharCode(b[3]),q},Sr=vr,y6=ef.toUnsigned,yr=Sr,kr=function(b,q){var A=[],S,_,O,U,I;if(!q.length)return null;for(S=0;S<b.byteLength;){if(_=y6(b[S]<<24|b[S+1]<<16|b[S+2]<<8|b[S+3]),O=yr(b.subarray(S+4,S+8)),U=_>1?S+_:b.byteLength,O===q[0]){if(q.length===1)A.push(b.subarray(S+8,U));else if(I=kr(b.subarray(S+8,U),q.slice(1)),I.length)A=A.concat(I)}S=U}return A},af=kr,V9=ef.toUnsigned,Y9=n.getUint64,Zh=function(b){var q={version:b[0],flags:new Uint8Array(b.subarray(1,4))};if(q.version===1)q.baseMediaDecodeTime=Y9(b.subarray(4));else q.baseMediaDecodeTime=V9(b[4]<<24|b[5]<<16|b[6]<<8|b[7]);return q},sf=Zh,J9=function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength),A={version:b[0],flags:new Uint8Array(b.subarray(1,4)),trackId:q.getUint32(4)},S=A.flags[2]&1,_=A.flags[2]&2,O=A.flags[2]&8,U=A.flags[2]&16,I=A.flags[2]&32,K=A.flags[0]&65536,L=A.flags[0]&131072,it;if(it=8,S)it+=4,A.baseDataOffset=q.getUint32(12),it+=4;if(_)A.sampleDescriptionIndex=q.getUint32(it),it+=4;if(O)A.defaultSampleDuration=q.getUint32(it),it+=4;if(U)A.defaultSampleSize=q.getUint32(it),it+=4;if(I)A.defaultSampleFlags=q.getUint32(it);if(K)A.durationIsEmpty=!0;if(!S&&L)A.baseDataOffsetIsMoof=!0;return A},nf=J9,lf=n.getUint64,$h=function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength),A={version:b[0],flags:new Uint8Array(b.subarray(1,4)),references:[],referenceId:q.getUint32(4),timescale:q.getUint32(8)},S=12;if(A.version===0)A.earliestPresentationTime=q.getUint32(S),A.firstOffset=q.getUint32(S+4),S+=8;else A.earliestPresentationTime=lf(b.subarray(S)),A.firstOffset=lf(b.subarray(S+8)),S+=16;S+=2;var _=q.getUint16(S);S+=2;for(;_>0;S+=12,_--)A.references.push({referenceType:(b[S]&128)>>>7,referencedSize:q.getUint32(S)&2147483647,subsegmentDuration:q.getUint32(S+4),startsWithSap:!!(b[S+8]&128),sapType:(b[S+8]&112)>>>4,sapDeltaTime:q.getUint32(S+8)&268435455});return A},Q9=$h,Wh=function(b){return{isLeading:(b[0]&12)>>>2,dependsOn:b[0]&3,isDependedOn:(b[1]&192)>>>6,hasRedundancy:(b[1]&48)>>>4,paddingValue:(b[1]&14)>>>1,isNonSyncSample:b[1]&1,degradationPriority:b[2]<<8|b[3]}},Z9=Wh,cn=Z9,Ph=function(b){var q={version:b[0],flags:new Uint8Array(b.subarray(1,4)),samples:[]},A=new DataView(b.buffer,b.byteOffset,b.byteLength),S=q.flags[2]&1,_=q.flags[2]&4,O=q.flags[1]&1,U=q.flags[1]&2,I=q.flags[1]&4,K=q.flags[1]&8,L=A.getUint32(4),it=8,ht;if(S)q.dataOffset=A.getInt32(it),it+=4;if(_&&L){if(ht={flags:cn(b.subarray(it,it+4))},it+=4,O)ht.duration=A.getUint32(it),it+=4;if(U)ht.size=A.getUint32(it),it+=4;if(K){if(q.version===1)ht.compositionTimeOffset=A.getInt32(it);else ht.compositionTimeOffset=A.getUint32(it);it+=4}q.samples.push(ht),L--}while(L--){if(ht={},O)ht.duration=A.getUint32(it),it+=4;if(U)ht.size=A.getUint32(it),it+=4;if(I)ht.flags=cn(b.subarray(it,it+4)),it+=4;if(K){if(q.version===1)ht.compositionTimeOffset=A.getInt32(it);else ht.compositionTimeOffset=A.getUint32(it);it+=4}q.samples.push(ht)}return q},$9=Ph,W9=n,qs=W9.getUint64,Qa,Cr,$i=function(b){return new Date(b*1000-2082844800000)},x1=Sr,P9=af,tc=function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength),A=[],S,_;for(S=0;S+4<b.length;S+=_){if(_=q.getUint32(S),S+=4,_<=0){A.push("<span style='color:red;'>MALFORMED DATA</span>");continue}switch(b[S]&31){case 1:A.push("slice_layer_without_partitioning_rbsp");break;case 5:A.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:A.push("sei_rbsp");break;case 7:A.push("seq_parameter_set_rbsp");break;case 8:A.push("pic_parameter_set_rbsp");break;case 9:A.push("access_unit_delimiter_rbsp");break;default:A.push("UNKNOWN NAL - "+b[S]&31);break}}return A},un={avc1:function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength);return{dataReferenceIndex:q.getUint16(6),width:q.getUint16(24),height:q.getUint16(26),horizresolution:q.getUint16(28)+q.getUint16(30)/16,vertresolution:q.getUint16(32)+q.getUint16(34)/16,frameCount:q.getUint16(40),depth:q.getUint16(74),config:Qa(b.subarray(78,b.byteLength))}},avcC:function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength),A={configurationVersion:b[0],avcProfileIndication:b[1],profileCompatibility:b[2],avcLevelIndication:b[3],lengthSizeMinusOne:b[4]&3,sps:[],pps:[]},S=b[5]&31,_,O,U,I;U=6;for(I=0;I<S;I++)O=q.getUint16(U),U+=2,A.sps.push(new Uint8Array(b.subarray(U,U+O))),U+=O;_=b[U],U++;for(I=0;I<_;I++)O=q.getUint16(U),U+=2,A.pps.push(new Uint8Array(b.subarray(U,U+O))),U+=O;return A},btrt:function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength);return{bufferSizeDB:q.getUint32(0),maxBitrate:q.getUint32(4),avgBitrate:q.getUint32(8)}},edts:function(q){return{boxes:Qa(q)}},elst:function(q){var A=new DataView(q.buffer,q.byteOffset,q.byteLength),S={version:A.getUint8(0),flags:new Uint8Array(q.subarray(1,4)),edits:[]},_=A.getUint32(4),O;for(O=8;_;_--)if(S.version===0)S.edits.push({segmentDuration:A.getUint32(O),mediaTime:A.getInt32(O+4),mediaRate:A.getUint16(O+8)+A.getUint16(O+10)/65536}),O+=12;else S.edits.push({segmentDuration:qs(q.subarray(O)),mediaTime:qs(q.subarray(O+8)),mediaRate:A.getUint16(O+16)+A.getUint16(O+18)/65536}),O+=20;return S},esds:function(b){return{version:b[0],flags:new Uint8Array(b.subarray(1,4)),esId:b[6]<<8|b[7],streamPriority:b[8]&31,decoderConfig:{objectProfileIndication:b[11],streamType:b[12]>>>2&63,bufferSize:b[13]<<16|b[14]<<8|b[15],maxBitrate:b[16]<<24|b[17]<<16|b[18]<<8|b[19],avgBitrate:b[20]<<24|b[21]<<16|b[22]<<8|b[23],decoderConfigDescriptor:{tag:b[24],length:b[25],audioObjectType:b[26]>>>3&31,samplingFrequencyIndex:(b[26]&7)<<1|b[27]>>>7&1,channelConfiguration:b[27]>>>3&15}}}},ftyp:function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength),A={majorBrand:x1(b.subarray(0,4)),minorVersion:q.getUint32(4),compatibleBrands:[]},S=8;while(S<b.byteLength)A.compatibleBrands.push(x1(b.subarray(S,S+4))),S+=4;return A},dinf:function(b){return{boxes:Qa(b)}},dref:function(b){return{version:b[0],flags:new Uint8Array(b.subarray(1,4)),dataReferences:Qa(b.subarray(8))}},hdlr:function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength),A={version:q.getUint8(0),flags:new Uint8Array(b.subarray(1,4)),handlerType:x1(b.subarray(8,12)),name:""},S=8;for(S=24;S<b.byteLength;S++){if(b[S]===0){S++;break}A.name+=String.fromCharCode(b[S])}return A.name=decodeURIComponent(escape(A.name)),A},mdat:function(b){return{byteLength:b.byteLength,nals:tc(b)}},mdhd:function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength),A=4,S,_={version:q.getUint8(0),flags:new Uint8Array(b.subarray(1,4)),language:""};if(_.version===1)A+=4,_.creationTime=$i(q.getUint32(A)),A+=8,_.modificationTime=$i(q.getUint32(A)),A+=4,_.timescale=q.getUint32(A),A+=8,_.duration=q.getUint32(A);else _.creationTime=$i(q.getUint32(A)),A+=4,_.modificationTime=$i(q.getUint32(A)),A+=4,_.timescale=q.getUint32(A),A+=4,_.duration=q.getUint32(A);return A+=4,S=q.getUint16(A),_.language+=String.fromCharCode((S>>10)+96),_.language+=String.fromCharCode(((S&992)>>5)+96),_.language+=String.fromCharCode((S&31)+96),_},mdia:function(b){return{boxes:Qa(b)}},mfhd:function(b){return{version:b[0],flags:new Uint8Array(b.subarray(1,4)),sequenceNumber:b[4]<<24|b[5]<<16|b[6]<<8|b[7]}},minf:function(b){return{boxes:Qa(b)}},mp4a:function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength),A={dataReferenceIndex:q.getUint16(6),channelcount:q.getUint16(16),samplesize:q.getUint16(18),samplerate:q.getUint16(24)+q.getUint16(26)/65536};if(b.byteLength>28)A.streamDescriptor=Qa(b.subarray(28))[0];return A},moof:function(b){return{boxes:Qa(b)}},moov:function(b){return{boxes:Qa(b)}},mvex:function(b){return{boxes:Qa(b)}},mvhd:function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength),A=4,S={version:q.getUint8(0),flags:new Uint8Array(b.subarray(1,4))};if(S.version===1)A+=4,S.creationTime=$i(q.getUint32(A)),A+=8,S.modificationTime=$i(q.getUint32(A)),A+=4,S.timescale=q.getUint32(A),A+=8,S.duration=q.getUint32(A);else S.creationTime=$i(q.getUint32(A)),A+=4,S.modificationTime=$i(q.getUint32(A)),A+=4,S.timescale=q.getUint32(A),A+=4,S.duration=q.getUint32(A);return A+=4,S.rate=q.getUint16(A)+q.getUint16(A+2)/16,A+=4,S.volume=q.getUint8(A)+q.getUint8(A+1)/8,A+=2,A+=2,A+=8,S.matrix=new Uint32Array(b.subarray(A,A+36)),A+=36,A+=24,S.nextTrackId=q.getUint32(A),S},pdin:function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength);return{version:q.getUint8(0),flags:new Uint8Array(b.subarray(1,4)),rate:q.getUint32(4),initialDelay:q.getUint32(8)}},sdtp:function(b){var q={version:b[0],flags:new Uint8Array(b.subarray(1,4)),samples:[]},A;for(A=4;A<b.byteLength;A++)q.samples.push({dependsOn:(b[A]&48)>>4,isDependedOn:(b[A]&12)>>2,hasRedundancy:b[A]&3});return q},sidx:Q9,smhd:function(b){return{version:b[0],flags:new Uint8Array(b.subarray(1,4)),balance:b[4]+b[5]/256}},stbl:function(b){return{boxes:Qa(b)}},ctts:function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength),A={version:q.getUint8(0),flags:new Uint8Array(b.subarray(1,4)),compositionOffsets:[]},S=q.getUint32(4),_;for(_=8;S;_+=8,S--)A.compositionOffsets.push({sampleCount:q.getUint32(_),sampleOffset:q[A.version===0?"getUint32":"getInt32"](_+4)});return A},stss:function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength),A={version:q.getUint8(0),flags:new Uint8Array(b.subarray(1,4)),syncSamples:[]},S=q.getUint32(4),_;for(_=8;S;_+=4,S--)A.syncSamples.push(q.getUint32(_));return A},stco:function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength),A={version:b[0],flags:new Uint8Array(b.subarray(1,4)),chunkOffsets:[]},S=q.getUint32(4),_;for(_=8;S;_+=4,S--)A.chunkOffsets.push(q.getUint32(_));return A},stsc:function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength),A=q.getUint32(4),S={version:b[0],flags:new Uint8Array(b.subarray(1,4)),sampleToChunks:[]},_;for(_=8;A;_+=12,A--)S.sampleToChunks.push({firstChunk:q.getUint32(_),samplesPerChunk:q.getUint32(_+4),sampleDescriptionIndex:q.getUint32(_+8)});return S},stsd:function(b){return{version:b[0],flags:new Uint8Array(b.subarray(1,4)),sampleDescriptions:Qa(b.subarray(8))}},stsz:function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength),A={version:b[0],flags:new Uint8Array(b.subarray(1,4)),sampleSize:q.getUint32(4),entries:[]},S;for(S=12;S<b.byteLength;S+=4)A.entries.push(q.getUint32(S));return A},stts:function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength),A={version:b[0],flags:new Uint8Array(b.subarray(1,4)),timeToSamples:[]},S=q.getUint32(4),_;for(_=8;S;_+=8,S--)A.timeToSamples.push({sampleCount:q.getUint32(_),sampleDelta:q.getUint32(_+4)});return A},styp:function(b){return un.ftyp(b)},tfdt:sf,tfhd:nf,tkhd:function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength),A=4,S={version:q.getUint8(0),flags:new Uint8Array(b.subarray(1,4))};if(S.version===1)A+=4,S.creationTime=$i(q.getUint32(A)),A+=8,S.modificationTime=$i(q.getUint32(A)),A+=4,S.trackId=q.getUint32(A),A+=4,A+=8,S.duration=q.getUint32(A);else S.creationTime=$i(q.getUint32(A)),A+=4,S.modificationTime=$i(q.getUint32(A)),A+=4,S.trackId=q.getUint32(A),A+=4,A+=4,S.duration=q.getUint32(A);return A+=4,A+=8,S.layer=q.getUint16(A),A+=2,S.alternateGroup=q.getUint16(A),A+=2,S.volume=q.getUint8(A)+q.getUint8(A+1)/8,A+=2,A+=2,S.matrix=new Uint32Array(b.subarray(A,A+36)),A+=36,S.width=q.getUint16(A)+q.getUint16(A+2)/65536,A+=4,S.height=q.getUint16(A)+q.getUint16(A+2)/65536,S},traf:function(b){return{boxes:Qa(b)}},trak:function(b){return{boxes:Qa(b)}},trex:function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength);return{version:b[0],flags:new Uint8Array(b.subarray(1,4)),trackId:q.getUint32(4),defaultSampleDescriptionIndex:q.getUint32(8),defaultSampleDuration:q.getUint32(12),defaultSampleSize:q.getUint32(16),sampleDependsOn:b[20]&3,sampleIsDependedOn:(b[21]&192)>>6,sampleHasRedundancy:(b[21]&48)>>4,samplePaddingValue:(b[21]&14)>>1,sampleIsDifferenceSample:!!(b[21]&1),sampleDegradationPriority:q.getUint16(22)}},trun:$9,"url ":function(b){return{version:b[0],flags:new Uint8Array(b.subarray(1,4))}},vmhd:function(b){var q=new DataView(b.buffer,b.byteOffset,b.byteLength);return{version:b[0],flags:new Uint8Array(b.subarray(1,4)),graphicsmode:q.getUint16(4),opcolor:new Uint16Array([q.getUint16(6),q.getUint16(8),q.getUint16(10)])}}};Qa=function(b){var q=0,A=[],S,_,O,U,I,K=new ArrayBuffer(b.length),L=new Uint8Array(K);for(var it=0;it<b.length;++it)L[it]=b[it];S=new DataView(K);while(q<b.byteLength)_=S.getUint32(q),O=x1(b.subarray(q+4,q+8)),U=_>1?q+_:b.byteLength,I=(un[O]||function(ht){return{data:ht}})(b.subarray(q+8,U)),I.size=_,I.type=O,A.push(I),q=U;return A},Cr=function(b,q){var A;return q=q||0,A=Array(q*2+1).join(" "),b.map(function(S,_){return A+S.type+`
221
- `+Object.keys(S).filter(function(O){return O!=="type"&&O!=="boxes"}).map(function(O){var U=A+" "+O+": ",I=S[O];if(I instanceof Uint8Array||I instanceof Uint32Array){var K=Array.prototype.slice.call(new Uint8Array(I.buffer,I.byteOffset,I.byteLength)).map(function(L){return" "+("00"+L.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);if(!K)return U+"<>";if(K.length===1)return U+"<"+K.join("").slice(1)+">";return U+`<
222
- `+K.map(function(L){return A+" "+L}).join(`
223
- `)+`
224
- `+A+" >"}return U+JSON.stringify(I,null,2).split(`
225
- `).map(function(L,it){if(it===0)return L;return A+" "+L}).join(`
226
- `)}).join(`
227
- `)+(S.boxes?`
228
- `+Cr(S.boxes,q+1):"")}).join(`
229
- `)};var ec={inspect:Qa,textify:Cr,parseType:x1,findBox:P9,parseTraf:un.traf,parseTfdt:un.tfdt,parseHdlr:un.hdlr,parseTfhd:un.tfhd,parseTrun:un.trun,parseSidx:un.sidx},_r=function(b){var q=0,A=String.fromCharCode(b[q]),S="";while(A!=="\x00")S+=A,q++,A=String.fromCharCode(b[q]);return S+=A,S},ff={uint8ToCString:_r},Pe=ff.uint8ToCString,k6=n.getUint64,C6=function(b){var q=4,A=b[0],S,_,O,U,I,K,L,it;if(A===0){S=Pe(b.subarray(q)),q+=S.length,_=Pe(b.subarray(q)),q+=_.length;var ht=new DataView(b.buffer);O=ht.getUint32(q),q+=4,I=ht.getUint32(q),q+=4,K=ht.getUint32(q),q+=4,L=ht.getUint32(q),q+=4}else if(A===1){var ht=new DataView(b.buffer);O=ht.getUint32(q),q+=4,U=k6(b.subarray(q)),q+=8,K=ht.getUint32(q),q+=4,L=ht.getUint32(q),q+=4,S=Pe(b.subarray(q)),q+=S.length,_=Pe(b.subarray(q)),q+=_.length}it=new Uint8Array(b.subarray(q,b.byteLength));var zt={scheme_id_uri:S,value:_,timescale:O?O:1,presentation_time:U,presentation_time_delta:I,event_duration:K,id:L,message_data:it};return rf(A,zt)?zt:void 0},tu=function(b,q,A,S){return b||b===0?b/q:S+A/q},rf=function(b,q){var A=q.scheme_id_uri!=="\x00",S=b===0&&Un(q.presentation_time_delta)&&A,_=b===1&&Un(q.presentation_time)&&A;return!(b>1)&&S||_},Un=function(b){return b!==void 0||b!==null},eu={parseEmsgBox:C6,scaleTime:tu},U1;if(typeof window<"u")U1=window;else if(typeof t<"u")U1=t;else if(typeof self<"u")U1=self;else U1={};var I1=U1,ns=ef.toUnsigned,G1=ef.toHexString,ya=af,L0=Sr,of=eu,ac=nf,Fr=$9,au=sf,iu=n.getUint64,su,ic,sc,As,Br,Or,nc,lc=I1,Hr=qi.parseId3Frames;su=function(b){var q={},A=ya(b,["moov","trak"]);return A.reduce(function(S,_){var O,U,I,K,L;if(O=ya(_,["tkhd"])[0],!O)return null;if(U=O[0],I=U===0?12:20,K=ns(O[I]<<24|O[I+1]<<16|O[I+2]<<8|O[I+3]),L=ya(_,["mdia","mdhd"])[0],!L)return null;return U=L[0],I=U===0?12:20,S[K]=ns(L[I]<<24|L[I+1]<<16|L[I+2]<<8|L[I+3]),S},q)},ic=function(b,q){var A=ya(q,["moof","traf"]),S=A.reduce(function(_,O){var U=ya(O,["tfhd"])[0],I=ns(U[4]<<24|U[5]<<16|U[6]<<8|U[7]),K=b[I]||90000,L=ya(O,["tfdt"])[0],it=new DataView(L.buffer,L.byteOffset,L.byteLength),ht;if(L[0]===1)ht=iu(L.subarray(4,12));else ht=it.getUint32(4);let zt;if(typeof ht==="bigint")zt=ht/lc.BigInt(K);else if(typeof ht==="number"&&!isNaN(ht))zt=ht/K;if(zt<Number.MAX_SAFE_INTEGER)zt=Number(zt);if(zt<_)_=zt;return _},1/0);return typeof S==="bigint"||isFinite(S)?S:0},sc=function(b,q){var A=ya(q,["moof","traf"]),S=0,_=0,O;if(A&&A.length){var U=ya(A[0],["tfhd"])[0],I=ya(A[0],["trun"])[0],K=ya(A[0],["tfdt"])[0];if(U){var L=ac(U);O=L.trackId}if(K){var it=au(K);S=it.baseMediaDecodeTime}if(I){var ht=Fr(I);if(ht.samples&&ht.samples.length)_=ht.samples[0].compositionTimeOffset||0}}var zt=b[O]||90000;if(typeof S==="bigint")_=lc.BigInt(_),zt=lc.BigInt(zt);var wt=(S+_)/zt;if(typeof wt==="bigint"&&wt<Number.MAX_SAFE_INTEGER)wt=Number(wt);return wt},As=function(b){var q=ya(b,["moov","trak"]),A=[];return q.forEach(function(S){var _=ya(S,["mdia","hdlr"]),O=ya(S,["tkhd"]);_.forEach(function(U,I){var K=L0(U.subarray(8,12)),L=O[I],it,ht,zt;if(K==="vide")it=new DataView(L.buffer,L.byteOffset,L.byteLength),ht=it.getUint8(0),zt=ht===0?it.getUint32(12):it.getUint32(20),A.push(zt)})}),A},Or=function(b){var q=b[0],A=q===0?12:20;return ns(b[A]<<24|b[A+1]<<16|b[A+2]<<8|b[A+3])},Br=function(b){var q=ya(b,["moov","trak"]),A=[];return q.forEach(function(S){var _={},O=ya(S,["tkhd"])[0],U,I;if(O)U=new DataView(O.buffer,O.byteOffset,O.byteLength),I=U.getUint8(0),_.id=I===0?U.getUint32(12):U.getUint32(20);var K=ya(S,["mdia","hdlr"])[0];if(K){var L=L0(K.subarray(8,12));if(L==="vide")_.type="video";else if(L==="soun")_.type="audio";else _.type=L}var it=ya(S,["mdia","minf","stbl","stsd"])[0];if(it){var ht=it.subarray(8);_.codec=L0(ht.subarray(4,8));var zt=ya(ht,[_.codec])[0],wt,te;if(zt)if(/^[asm]vc[1-9]$/i.test(_.codec))if(wt=zt.subarray(78),te=L0(wt.subarray(4,8)),te==="avcC"&&wt.length>11)_.codec+=".",_.codec+=G1(wt[9]),_.codec+=G1(wt[10]),_.codec+=G1(wt[11]);else _.codec="avc1.4d400d";else if(/^mp4[a,v]$/i.test(_.codec))if(wt=zt.subarray(28),te=L0(wt.subarray(4,8)),te==="esds"&&wt.length>20&&wt[19]!==0)_.codec+="."+G1(wt[19]),_.codec+="."+G1(wt[20]>>>2&63).replace(/^0/,"");else _.codec="mp4a.40.2";else _.codec=_.codec.toLowerCase()}var oe=ya(S,["mdia","mdhd"])[0];if(oe)_.timescale=Or(oe);A.push(_)}),A},nc=function(b,q=0){var A=ya(b,["emsg"]);return A.map((S)=>{var _=of.parseEmsgBox(new Uint8Array(S)),O=Hr(_.message_data);return{cueTime:of.scaleTime(_.presentation_time,_.timescale,_.presentation_time_delta,q),duration:of.scaleTime(_.event_duration,_.timescale),frames:O}})};var Xa={findBox:ya,parseType:L0,timescale:su,startTime:ic,compositionStartTime:sc,videoTrackIds:As,tracks:Br,getTimescaleFromMediaHeader:Or,getEmsgID3:nc};let{parseTrun:nu}=ec,{findBox:Ai}=Xa;var fc=I1,In=function(b){var q=Ai(b,["moof","traf"]),A=Ai(b,["mdat"]),S=[];return A.forEach(function(_,O){var U=q[O];S.push({mdat:_,traf:U})}),S},V0=function(b,q,A){var S=q,_=A.defaultSampleDuration||0,O=A.defaultSampleSize||0,U=A.trackId,I=[];return b.forEach(function(K){var L=nu(K),it=L.samples;it.forEach(function(ht){if(ht.duration===void 0)ht.duration=_;if(ht.size===void 0)ht.size=O;if(ht.trackId=U,ht.dts=S,ht.compositionTimeOffset===void 0)ht.compositionTimeOffset=0;if(typeof S==="bigint")ht.pts=S+fc.BigInt(ht.compositionTimeOffset),S+=fc.BigInt(ht.duration);else ht.pts=S+ht.compositionTimeOffset,S+=ht.duration}),I=I.concat(it)}),I},mn={getMdatTrafPairs:In,parseSamples:V0},rc=Hh.discardEmulationPreventionBytes,oc=Mh.CaptionStream,ls=af,lu=sf,X1=nf,{getMdatTrafPairs:hf,parseSamples:Y0}=mn,fu=function(b,q){var A=b;for(var S=0;S<q.length;S++){var _=q[S];if(A<_.size)return _;A-=_.size}return null},ru=function(b,q,A){var S=new DataView(b.buffer,b.byteOffset,b.byteLength),_={logs:[],seiNals:[]},O,U,I,K;for(U=0;U+4<b.length;U+=I){if(I=S.getUint32(U),U+=4,I<=0)continue;switch(b[U]&31){case 6:var L=b.subarray(U+1,U+1+I),it=fu(U,q);if(O={nalUnitType:"sei_rbsp",size:I,data:L,escapedRBSP:rc(L),trackId:A},it)O.pts=it.pts,O.dts=it.dts,K=it;else if(K)O.pts=K.pts,O.dts=K.dts;else{_.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+U+" for trackId "+A+". See mux.js#223."});break}_.seiNals.push(O);break}}return _},cf=function(b,q){var A={},S=hf(b);return S.forEach(function(_){var{mdat:O,traf:U}=_,I=ls(U,["tfhd"]),K=X1(I[0]),L=K.trackId,it=ls(U,["tfdt"]),ht=it.length>0?lu(it[0]).baseMediaDecodeTime:0,zt=ls(U,["trun"]),wt,te;if(q===L&&zt.length>0){if(wt=Y0(zt,ht,K),te=ru(O,wt,L),!A[L])A[L]={seiNals:[],logs:[]};A[L].seiNals=A[L].seiNals.concat(te.seiNals),A[L].logs=A[L].logs.concat(te.logs)}}),A},ou=function(b,q,A){var S;if(q===null)return null;S=cf(b,q);var _=S[q]||{};return{seiNals:_.seiNals,logs:_.logs,timescale:A}},Mr=function(){var b=!1,q,A,S,_,O,U;this.isInitialized=function(){return b},this.init=function(I){q=new oc,b=!0,U=I?I.isPartial:!1,q.on("data",function(K){K.startTime=K.startPts/_,K.endTime=K.endPts/_,O.captions.push(K),O.captionStreams[K.stream]=!0}),q.on("log",function(K){O.logs.push(K)})},this.isNewInit=function(I,K){if(I&&I.length===0||K&&typeof K==="object"&&Object.keys(K).length===0)return!1;return S!==I[0]||_!==K[S]},this.parse=function(I,K,L){var it;if(!this.isInitialized())return null;else if(!K||!L)return null;else if(this.isNewInit(K,L))S=K[0],_=L[S];else if(S===null||!_)return A.push(I),null;while(A.length>0){var ht=A.shift();this.parse(ht,K,L)}if(it=ou(I,S,_),it&&it.logs)O.logs=O.logs.concat(it.logs);if(it===null||!it.seiNals){if(O.logs.length)return{logs:O.logs,captions:[],captionStreams:[]};return null}return this.pushNals(it.seiNals),this.flushStream(),O},this.pushNals=function(I){if(!this.isInitialized()||!I||I.length===0)return null;I.forEach(function(K){q.push(K)})},this.flushStream=function(){if(!this.isInitialized())return null;if(!U)q.flush();else q.partialFlush()},this.clearParsedCaptions=function(){O.captions=[],O.captionStreams={},O.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;q.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){if(A=[],S=null,_=null,!O)O={captions:[],captionStreams:{},logs:[]};else this.clearParsedCaptions();this.resetCaptionStream()},this.reset()},hu=Mr;let{parseTfdt:hc}=ec,gn=af,{getTimescaleFromMediaHeader:cc}=Xa,{parseSamples:cu,getMdatTrafPairs:uc}=mn;var mc=function(){let b=90000;this.init=function(q){let A=gn(q,["moov","trak","mdia","mdhd"])[0];if(A)b=cc(A)},this.parseSegment=function(q){let A=[],S=uc(q),_=0;return S.forEach(function(O){let{mdat:U,traf:I}=O,K=gn(I,["tfdt"])[0],L=gn(I,["tfhd"])[0],it=gn(I,["trun"]);if(K)_=hc(K).baseMediaDecodeTime;if(it.length&&L){let ht=cu(it,_,L),zt=0;ht.forEach(function(wt){let oe=new TextDecoder("utf-8"),Za=U.slice(zt,zt+wt.size);if(gn(Za,["vtte"])[0]){zt+=wt.size;return}gn(Za,["vttc"]).forEach(function(L1){let V1=gn(L1,["payl"])[0],Y1=gn(L1,["sttg"])[0],J1=wt.pts/b,gf=(wt.pts+wt.duration)/b,sa,qe;if(V1)try{sa=oe.decode(V1)}catch(fs){console.error(fs)}if(Y1)try{qe=oe.decode(Y1)}catch(fs){console.error(fs)}if(wt.duration&&sa)A.push({cueText:sa,start:J1,end:gf,settings:qe})}),zt+=wt.size})}}),A}},vi=El,gc=function(b){var q=b[1]&31;return q<<=8,q|=b[2],q},uf=function(b){return!!(b[1]&64)},Dr=function(b){var q=0;if((b[3]&48)>>>4>1)q+=b[4]+1;return q},s0=function(b,q){var A=gc(b);if(A===0)return"pat";else if(A===q)return"pmt";else if(q)return"pes";return null},uu=function(b){var q=uf(b),A=4+Dr(b);if(q)A+=b[A]+1;return(b[A+10]&31)<<8|b[A+11]},bc=function(b){var q={},A=uf(b),S=4+Dr(b);if(A)S+=b[S]+1;if(!(b[S+5]&1))return;var _,O,U;_=(b[S+1]&15)<<8|b[S+2],O=3+_-4,U=(b[S+10]&15)<<8|b[S+11];var I=12+U;while(I<O){var K=S+I;q[(b[K+1]&31)<<8|b[K+2]]=b[K],I+=((b[K+3]&15)<<8|b[K+4])+5}return q},K1=function(b,q){var A=gc(b),S=q[A];switch(S){case vi.H264_STREAM_TYPE:return"video";case vi.ADTS_STREAM_TYPE:return"audio";case vi.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},mu=function(b){var q=uf(b);if(!q)return null;var A=4+Dr(b);if(A>=b.byteLength)return null;var S=null,_;if(_=b[A+7],_&192){if(S={},S.pts=(b[A+9]&14)<<27|(b[A+10]&255)<<20|(b[A+11]&254)<<12|(b[A+12]&255)<<5|(b[A+13]&254)>>>3,S.pts*=4,S.pts+=(b[A+13]&6)>>>1,S.dts=S.pts,_&64)S.dts=(b[A+14]&14)<<27|(b[A+15]&255)<<20|(b[A+16]&254)<<12|(b[A+17]&255)<<5|(b[A+18]&254)>>>3,S.dts*=4,S.dts+=(b[A+18]&6)>>>1}return S},Tr=function(b){switch(b){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}},gu=function(b){var q=4+Dr(b),A=b.subarray(q),S=0,_=0,O=!1,U;for(;_<A.byteLength-3;_++)if(A[_+2]===1){S=_+5;break}while(S<A.byteLength)switch(A[S]){case 0:if(A[S-1]!==0){S+=2;break}else if(A[S-2]!==0){S++;break}if(_+3!==S-2){if(U=Tr(A[_+3]&31),U==="slice_layer_without_partitioning_rbsp_idr")O=!0}do S++;while(A[S]!==1&&S<A.length);_=S-2,S+=3;break;case 1:if(A[S-1]!==0||A[S-2]!==0){S+=3;break}if(U=Tr(A[_+3]&31),U==="slice_layer_without_partitioning_rbsp_idr")O=!0;_=S-2,S+=3;break;default:S+=3;break}if(A=A.subarray(_),S-=_,_=0,A&&A.byteLength>3){if(U=Tr(A[_+3]&31),U==="slice_layer_without_partitioning_rbsp_idr")O=!0}return O},bu={parseType:s0,parsePat:uu,parsePmt:bc,parsePayloadUnitStartIndicator:uf,parsePesType:K1,parsePesTime:mu,videoPacketContainsKeyFrame:gu},mf=El,n0=Zi.handleRollover,Ze={};Ze.ts=bu,Ze.aac=Jl;var J0=Ut.ONE_SECOND_IN_TS,zi=188,Ks=71,pu=function(b,q){var A=0,S=zi,_,O;while(S<b.byteLength){if(b[A]===Ks&&b[S]===Ks){switch(_=b.subarray(A,S),O=Ze.ts.parseType(_,q.pid),O){case"pat":q.pid=Ze.ts.parsePat(_);break;case"pmt":var U=Ze.ts.parsePmt(_);q.table=q.table||{},Object.keys(U).forEach(function(I){q.table[I]=U[I]});break}A+=zi,S+=zi;continue}A++,S++}},Q0=function(b,q,A){var S=0,_=zi,O,U,I,K,L,it=!1;while(_<=b.byteLength){if(b[S]===Ks&&(b[_]===Ks||_===b.byteLength)){switch(O=b.subarray(S,_),U=Ze.ts.parseType(O,q.pid),U){case"pes":if(I=Ze.ts.parsePesType(O,q.table),K=Ze.ts.parsePayloadUnitStartIndicator(O),I==="audio"&&K){if(L=Ze.ts.parsePesTime(O),L)L.type="audio",A.audio.push(L),it=!0}break}if(it)break;S+=zi,_+=zi;continue}S++,_++}_=b.byteLength,S=_-zi,it=!1;while(S>=0){if(b[S]===Ks&&(b[_]===Ks||_===b.byteLength)){switch(O=b.subarray(S,_),U=Ze.ts.parseType(O,q.pid),U){case"pes":if(I=Ze.ts.parsePesType(O,q.table),K=Ze.ts.parsePayloadUnitStartIndicator(O),I==="audio"&&K){if(L=Ze.ts.parsePesTime(O),L)L.type="audio",A.audio.push(L),it=!0}break}if(it)break;S-=zi,_-=zi;continue}S--,_--}},Rr=function(b,q,A){var S=0,_=zi,O,U,I,K,L,it,ht,zt,wt=!1,te={data:[],size:0};while(_<b.byteLength){if(b[S]===Ks&&b[_]===Ks){switch(O=b.subarray(S,_),U=Ze.ts.parseType(O,q.pid),U){case"pes":if(I=Ze.ts.parsePesType(O,q.table),K=Ze.ts.parsePayloadUnitStartIndicator(O),I==="video"){if(K&&!wt){if(L=Ze.ts.parsePesTime(O),L)L.type="video",A.video.push(L),wt=!0}if(!A.firstKeyFrame){if(K){if(te.size!==0){it=new Uint8Array(te.size),ht=0;while(te.data.length)zt=te.data.shift(),it.set(zt,ht),ht+=zt.byteLength;if(Ze.ts.videoPacketContainsKeyFrame(it)){var oe=Ze.ts.parsePesTime(it);if(oe)A.firstKeyFrame=oe,A.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.")}te.size=0}}te.data.push(O),te.size+=O.byteLength}}break}if(wt&&A.firstKeyFrame)break;S+=zi,_+=zi;continue}S++,_++}_=b.byteLength,S=_-zi,wt=!1;while(S>=0){if(b[S]===Ks&&b[_]===Ks){switch(O=b.subarray(S,_),U=Ze.ts.parseType(O,q.pid),U){case"pes":if(I=Ze.ts.parsePesType(O,q.table),K=Ze.ts.parsePayloadUnitStartIndicator(O),I==="video"&&K){if(L=Ze.ts.parsePesTime(O),L)L.type="video",A.video.push(L),wt=!0}break}if(wt)break;S-=zi,_-=zi;continue}S--,_--}},wu=function(b,q){if(b.audio&&b.audio.length){var A=q;if(typeof A>"u"||isNaN(A))A=b.audio[0].dts;b.audio.forEach(function(O){O.dts=n0(O.dts,A),O.pts=n0(O.pts,A),O.dtsTime=O.dts/J0,O.ptsTime=O.pts/J0})}if(b.video&&b.video.length){var S=q;if(typeof S>"u"||isNaN(S))S=b.video[0].dts;if(b.video.forEach(function(O){O.dts=n0(O.dts,S),O.pts=n0(O.pts,S),O.dtsTime=O.dts/J0,O.ptsTime=O.pts/J0}),b.firstKeyFrame){var _=b.firstKeyFrame;_.dts=n0(_.dts,S),_.pts=n0(_.pts,S),_.dtsTime=_.dts/J0,_.ptsTime=_.pts/J0}}},ju=function(b){var q=!1,A=0,S=null,_=null,O=0,U=0,I;while(b.length-U>=3){var K=Ze.aac.parseType(b,U);switch(K){case"timed-metadata":if(b.length-U<10){q=!0;break}if(O=Ze.aac.parseId3TagSize(b,U),O>b.length){q=!0;break}if(_===null)I=b.subarray(U,U+O),_=Ze.aac.parseAacTimestamp(I);U+=O;break;case"audio":if(b.length-U<7){q=!0;break}if(O=Ze.aac.parseAdtsSize(b,U),O>b.length){q=!0;break}if(S===null)I=b.subarray(U,U+O),S=Ze.aac.parseSampleRate(I);A++,U+=O;break;default:U++;break}if(q)return null}if(S===null||_===null)return null;var L=J0/S,it={audio:[{type:"audio",dts:_,pts:_},{type:"audio",dts:_+A*1024*L,pts:_+A*1024*L}]};return it},du=function(b){var q={pid:null,table:null},A={};pu(b,q);for(var S in q.table)if(q.table.hasOwnProperty(S)){var _=q.table[S];switch(_){case mf.H264_STREAM_TYPE:if(A.video=[],Rr(b,q,A),A.video.length===0)delete A.video;break;case mf.ADTS_STREAM_TYPE:if(A.audio=[],Q0(b,q,A),A.audio.length===0)delete A.audio;break}}return A},qu=function(b,q){var A=Ze.aac.isLikelyAacData(b),S;if(A)S=ju(b);else S=du(b);if(!S||!S.audio&&!S.video)return null;return wu(S,q),S},Au={inspect:qu,parseAudioPes_:Q0};let vu=function(b,q){q.on("data",function(A){let S=A.initSegment;A.initSegment={data:S.buffer,byteOffset:S.byteOffset,byteLength:S.byteLength};let _=A.data;A.data=_.buffer,b.postMessage({action:"data",segment:A,byteOffset:_.byteOffset,byteLength:_.byteLength},[A.data])}),q.on("done",function(A){b.postMessage({action:"done"})}),q.on("gopInfo",function(A){b.postMessage({action:"gopInfo",gopInfo:A})}),q.on("videoSegmentTimingInfo",function(A){let S={start:{decode:Ut.videoTsToSeconds(A.start.dts),presentation:Ut.videoTsToSeconds(A.start.pts)},end:{decode:Ut.videoTsToSeconds(A.end.dts),presentation:Ut.videoTsToSeconds(A.end.pts)},baseMediaDecodeTime:Ut.videoTsToSeconds(A.baseMediaDecodeTime)};if(A.prependedContentDuration)S.prependedContentDuration=Ut.videoTsToSeconds(A.prependedContentDuration);b.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:S})}),q.on("audioSegmentTimingInfo",function(A){let S={start:{decode:Ut.videoTsToSeconds(A.start.dts),presentation:Ut.videoTsToSeconds(A.start.pts)},end:{decode:Ut.videoTsToSeconds(A.end.dts),presentation:Ut.videoTsToSeconds(A.end.pts)},baseMediaDecodeTime:Ut.videoTsToSeconds(A.baseMediaDecodeTime)};if(A.prependedContentDuration)S.prependedContentDuration=Ut.videoTsToSeconds(A.prependedContentDuration);b.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:S})}),q.on("id3Frame",function(A){b.postMessage({action:"id3Frame",id3Frame:A})}),q.on("caption",function(A){b.postMessage({action:"caption",caption:A})}),q.on("trackinfo",function(A){b.postMessage({action:"trackinfo",trackInfo:A})}),q.on("audioTimingInfo",function(A){b.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:Ut.videoTsToSeconds(A.start),end:Ut.videoTsToSeconds(A.end)}})}),q.on("videoTimingInfo",function(A){b.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:Ut.videoTsToSeconds(A.start),end:Ut.videoTsToSeconds(A.end)}})}),q.on("log",function(A){b.postMessage({action:"log",log:A})})};class Z0{constructor(b,q){this.options=q||{},this.self=b,this.init()}init(){if(this.transmuxer)this.transmuxer.dispose();this.transmuxer=new K9.Transmuxer(this.options),vu(this.self,this.transmuxer)}pushMp4Captions(b){if(!this.captionParser)this.captionParser=new hu,this.captionParser.init();let q=new Uint8Array(b.data,b.byteOffset,b.byteLength),A=this.captionParser.parse(q,b.trackIds,b.timescales);this.self.postMessage({action:"mp4Captions",captions:A&&A.captions||[],logs:A&&A.logs||[],data:q.buffer},[q.buffer])}initMp4WebVttParser(b){if(!this.webVttParser)this.webVttParser=new mc;let q=new Uint8Array(b.data,b.byteOffset,b.byteLength);this.webVttParser.init(q)}getMp4WebVttText(b){if(!this.webVttParser)this.webVttParser=new mc;let q=new Uint8Array(b.data,b.byteOffset,b.byteLength),A=this.webVttParser.parseSegment(q);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:A||[],data:q.buffer},[q.buffer])}probeMp4StartTime({timescales:b,data:q}){let A=Xa.startTime(b,q);this.self.postMessage({action:"probeMp4StartTime",startTime:A,data:q},[q.buffer])}probeMp4Tracks({data:b}){let q=Xa.tracks(b);this.self.postMessage({action:"probeMp4Tracks",tracks:q,data:b},[b.buffer])}probeEmsgID3({data:b,offset:q}){let A=Xa.getEmsgID3(b,q);this.self.postMessage({action:"probeEmsgID3",id3Frames:A,emsgData:b},[b.buffer])}probeTs({data:b,baseStartTime:q}){let A=typeof q==="number"&&!isNaN(q)?q*Ut.ONE_SECOND_IN_TS:void 0,S=Au.inspect(b,A),_=null;if(S){if(_={hasVideo:S.video&&S.video.length===2||!1,hasAudio:S.audio&&S.audio.length===2||!1},_.hasVideo)_.videoStart=S.video[0].ptsTime;if(_.hasAudio)_.audioStart=S.audio[0].ptsTime}this.self.postMessage({action:"probeTs",result:_,data:b},[b.buffer])}clearAllMp4Captions(){if(this.captionParser)this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){if(this.captionParser)this.captionParser.clearParsedCaptions()}push(b){let q=new Uint8Array(b.data,b.byteOffset,b.byteLength);this.transmuxer.push(q)}reset(){this.transmuxer.reset()}setTimestampOffset(b){let q=b.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(Ut.secondsToVideoTs(q)))}setAudioAppendStart(b){this.transmuxer.setAudioAppendStart(Math.ceil(Ut.secondsToVideoTs(b.appendStart)))}setRemux(b){this.transmuxer.setRemux(b.remux)}flush(b){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(b){this.transmuxer.alignGopsWith(b.gopsToAlignWith.slice())}}self.onmessage=function(b){if(b.data.action==="init"&&b.data.options){this.messageHandlers=new Z0(self,b.data.options);return}if(!this.messageHandlers)this.messageHandlers=new Z0(self);if(b.data&&b.data.action&&b.data.action!=="init"){if(this.messageHandlers[b.data.action])this.messageHandlers[b.data.action](b.data)}}})),WU=rk($U),PU=(t,e,a)=>{let{type:i,initSegment:s,captions:n,captionStreams:l,metadata:f,videoFrameDtsTime:o,videoFramePtsTime:c}=t.data.segment;e.buffer.push({captions:n,captionStreams:l,metadata:f});let u=t.data.segment.boxes||{data:t.data.segment.data},m={type:i,data:new Uint8Array(u.data,u.data.byteOffset,u.data.byteLength),initSegment:new Uint8Array(s.data,s.byteOffset,s.byteLength)};if(typeof o<"u")m.videoFrameDtsTime=o;if(typeof c<"u")m.videoFramePtsTime=c;a(m)},tI=({transmuxedData:t,callback:e})=>{t.buffer=[],e(t)},eI=(t,e)=>{e.gopInfo=t.data.gopInfo},ck=(t)=>{let{transmuxer:e,bytes:a,audioAppendStart:i,gopsToAlignWith:s,remux:n,onData:l,onTrackInfo:f,onAudioTimingInfo:o,onVideoTimingInfo:c,onVideoSegmentTimingInfo:u,onAudioSegmentTimingInfo:m,onId3:p,onCaptions:w,onDone:d,onEndedTimeline:v,onTransmuxerLog:k,isEndOfTimeline:y,segment:B,triggerSegmentEventFn:H}=t,M={buffer:[]},D=y,T=(E)=>{if(e.currentTransmux!==t)return;if(E.data.action==="data")PU(E,M,l);if(E.data.action==="trackinfo")f(E.data.trackInfo);if(E.data.action==="gopInfo")eI(E,M);if(E.data.action==="audioTimingInfo")o(E.data.audioTimingInfo);if(E.data.action==="videoTimingInfo")c(E.data.videoTimingInfo);if(E.data.action==="videoSegmentTimingInfo")u(E.data.videoSegmentTimingInfo);if(E.data.action==="audioSegmentTimingInfo")m(E.data.audioSegmentTimingInfo);if(E.data.action==="id3Frame")p([E.data.id3Frame],E.data.id3Frame.dispatchType);if(E.data.action==="caption")w(E.data.caption);if(E.data.action==="endedtimeline")D=!1,v();if(E.data.action==="log")k(E.data.log);if(E.data.type!=="transmuxed")return;if(D)return;e.onmessage=null,tI({transmuxedData:M,callback:d}),uk(e)},z=()=>{let E={message:"Received an error message from the transmuxer worker",metadata:{errorType:lt.Error.StreamingFailedToTransmuxSegment,segmentInfo:Xf({segment:B})}};d(null,E)};if(e.onmessage=T,e.onerror=z,i)e.postMessage({action:"setAudioAppendStart",appendStart:i});if(Array.isArray(s))e.postMessage({action:"alignGopsWith",gopsToAlignWith:s});if(typeof n<"u")e.postMessage({action:"setRemux",remux:n});if(a.byteLength){let E=a instanceof ArrayBuffer?a:a.buffer,V=a instanceof ArrayBuffer?0:a.byteOffset;H({type:"segmenttransmuxingstart",segment:B}),e.postMessage({action:"push",data:E,byteOffset:V,byteLength:a.byteLength},[E])}if(y)e.postMessage({action:"endTimeline"});e.postMessage({action:"flush"})},uk=(t)=>{if(t.currentTransmux=null,t.transmuxQueue.length)if(t.currentTransmux=t.transmuxQueue.shift(),typeof t.currentTransmux==="function")t.currentTransmux();else ck(t.currentTransmux)},uS=(t,e)=>{t.postMessage({action:e}),uk(t)},mk=(t,e)=>{if(!e.currentTransmux){e.currentTransmux=t,uS(e,t);return}e.transmuxQueue.push(uS.bind(null,e,t))},aI=(t)=>{mk("reset",t)},iI=(t)=>{mk("endTimeline",t)},gk=(t)=>{if(!t.transmuxer.currentTransmux){t.transmuxer.currentTransmux=t,ck(t);return}t.transmuxer.transmuxQueue.push(t)},sI=(t)=>{let e=new WU;e.currentTransmux=null,e.transmuxQueue=[];let a=e.terminate;return e.terminate=()=>{return e.currentTransmux=null,e.transmuxQueue.length=0,a.call(e)},e.postMessage({action:"init",options:t}),e},Fg={reset:aI,endTimeline:iI,transmux:gk,createTransmuxer:sI},Yo=function(t){let e=t.transmuxer,a=t.endAction||t.action,i=t.callback,s=za({},t,{endAction:null,transmuxer:null,callback:null}),n=(l)=>{if(l.data.action!==a)return;if(e.removeEventListener("message",n),l.data.data){if(l.data.data=new Uint8Array(l.data.data,t.byteOffset||0,t.byteLength||l.data.data.byteLength),t.data)t.data=l.data.data}i(l.data)};if(e.addEventListener("message",n),t.data){let l=t.data instanceof ArrayBuffer;s.byteOffset=l?0:t.data.byteOffset,s.byteLength=t.data.byteLength;let f=[l?t.data:t.data.buffer];e.postMessage(s,f)}else e.postMessage(s)},d0={FAILURE:2,TIMEOUT:-101,ABORTED:-102},bk="wvtt",Qg=(t)=>{t.forEach((e)=>{e.abort()})},nI=(t)=>{return{bandwidth:t.bandwidth,bytesReceived:t.bytesReceived||0,roundTripTime:t.roundTripTime||0}},lI=(t)=>{let e=t.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return i.bytesReceived=t.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1000),i},J7=(t,e)=>{let{requestType:a}=e,i=Jf({requestType:a,request:e,error:t});if(e.timedout)return{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:d0.TIMEOUT,xhr:e,metadata:i};if(e.aborted)return{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:d0.ABORTED,xhr:e,metadata:i};if(t)return{status:e.status,message:"HLS request errored at URL: "+e.uri,code:d0.FAILURE,xhr:e,metadata:i};if(e.responseType==="arraybuffer"&&e.response.byteLength===0)return{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:d0.FAILURE,xhr:e,metadata:i};return null},mS=(t,e,a,i)=>(s,n)=>{let l=n.response,f=J7(s,n);if(f)return a(f,t);if(l.byteLength!==16)return a({status:n.status,message:"Invalid HLS key at URL: "+n.uri,code:d0.FAILURE,xhr:n},t);let o=new DataView(l),c=new Uint32Array([o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12)]);for(let m=0;m<e.length;m++)e[m].bytes=c;let u={uri:n.uri};return i({type:"segmentkeyloadcomplete",segment:t,keyInfo:u}),a(null,t)},fI=(t,e)=>{if(e===bk)t.transmuxer.postMessage({action:"initMp4WebVttParser",data:t.map.bytes})},rI=(t,e,a)=>{if(e===bk)Yo({action:"getMp4WebVttText",data:t.bytes,transmuxer:t.transmuxer,callback:({data:i,mp4VttCues:s})=>{t.bytes=i,a(null,t,{mp4VttCues:s})}})},pk=(t,e)=>{let a=Z5(t.map.bytes);if(a!=="mp4"){let i=t.map.resolvedUri||t.map.uri,s=a||"unknown";return e({internal:!0,message:`Found unsupported ${s} container for initialization segment at URL: ${i}`,code:d0.FAILURE,metadata:{mediaType:s}})}Yo({action:"probeMp4Tracks",data:t.map.bytes,transmuxer:t.transmuxer,callback:({tracks:i,data:s})=>{return t.map.bytes=s,i.forEach(function(n){if(t.map.tracks=t.map.tracks||{},t.map.tracks[n.type])return;if(t.map.tracks[n.type]=n,typeof n.id==="number"&&n.timescale)t.map.timescales=t.map.timescales||{},t.map.timescales[n.id]=n.timescale;if(n.type==="text")fI(t,n.codec)}),e(null)}})},oI=({segment:t,finishProcessingFn:e,triggerSegmentEventFn:a})=>(i,s)=>{let n=J7(i,s);if(n)return e(n,t);let l=new Uint8Array(s.response);if(a({type:"segmentloaded",segment:t}),t.map.key)return t.map.encryptedBytes=l,e(null,t);t.map.bytes=l,pk(t,function(f){if(f)return f.xhr=s,f.status=s.status,e(f,t);e(null,t)})},hI=({segment:t,finishProcessingFn:e,responseType:a,triggerSegmentEventFn:i})=>(s,n)=>{let l=J7(s,n);if(l)return e(l,t);i({type:"segmentloaded",segment:t});let f=a==="arraybuffer"||!n.responseText?n.response:QU(n.responseText.substring(t.lastReachedChar||0));if(t.stats=nI(n),t.key)t.encryptedBytes=new Uint8Array(f);else t.bytes=new Uint8Array(f);return e(null,t)},cI=({segment:t,bytes:e,trackInfoFn:a,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:l,captionsFn:f,isEndOfTimeline:o,endedTimelineFn:c,dataFn:u,doneFn:m,onTransmuxerLog:p,triggerSegmentEventFn:w})=>{let d=t.map&&t.map.tracks||{},v=Boolean(d.audio&&d.video),k=i.bind(null,t,"audio","start"),y=i.bind(null,t,"audio","end"),B=i.bind(null,t,"video","start"),H=i.bind(null,t,"video","end"),M=()=>gk({bytes:e,transmuxer:t.transmuxer,audioAppendStart:t.audioAppendStart,gopsToAlignWith:t.gopsToAlignWith,remux:v,onData:(D)=>{D.type=D.type==="combined"?"video":D.type,u(t,D)},onTrackInfo:(D)=>{if(a){if(v)D.isMuxed=!0;a(t,D)}},onAudioTimingInfo:(D)=>{if(k&&typeof D.start<"u")k(D.start),k=null;if(y&&typeof D.end<"u")y(D.end)},onVideoTimingInfo:(D)=>{if(B&&typeof D.start<"u")B(D.start),B=null;if(H&&typeof D.end<"u")H(D.end)},onVideoSegmentTimingInfo:(D)=>{let T={pts:{start:D.start.presentation,end:D.end.presentation},dts:{start:D.start.decode,end:D.end.decode}};w({type:"segmenttransmuxingtiminginfoavailable",segment:t,timingInfo:T}),s(D)},onAudioSegmentTimingInfo:(D)=>{let T={pts:{start:D.start.pts,end:D.end.pts},dts:{start:D.start.dts,end:D.end.dts}};w({type:"segmenttransmuxingtiminginfoavailable",segment:t,timingInfo:T}),n(D)},onId3:(D,T)=>{l(t,D,T)},onCaptions:(D)=>{f(t,[D])},isEndOfTimeline:o,onEndedTimeline:()=>{c()},onTransmuxerLog:p,onDone:(D,T)=>{if(!m)return;D.type=D.type==="combined"?"video":D.type,w({type:"segmenttransmuxingcomplete",segment:t}),m(T,t,D)},segment:t,triggerSegmentEventFn:w});Yo({action:"probeTs",transmuxer:t.transmuxer,data:e,baseStartTime:t.baseStartTime,callback:(D)=>{t.bytes=e=D.data;let T=D.result;if(T)a(t,{hasAudio:T.hasAudio,hasVideo:T.hasVideo,isMuxed:v}),a=null;M()}})},wk=({segment:t,bytes:e,trackInfoFn:a,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:l,captionsFn:f,isEndOfTimeline:o,endedTimelineFn:c,dataFn:u,doneFn:m,onTransmuxerLog:p,triggerSegmentEventFn:w})=>{let d=new Uint8Array(e);if(Ov(d)){t.isFmp4=!0;let{tracks:v}=t.map;if(v.text&&(!v.audio||!v.video)){u(t,{data:d,type:"text"}),rI(t,v.text.codec,m);return}let y={isFmp4:!0,hasVideo:!!v.video,hasAudio:!!v.audio};if(v.audio&&v.audio.codec&&v.audio.codec!=="enca")y.audioCodec=v.audio.codec;if(v.video&&v.video.codec&&v.video.codec!=="encv")y.videoCodec=v.video.codec;if(v.video&&v.audio)y.isMuxed=!0;a(t,y);let B=(H,M)=>{if(u(t,{data:d,type:y.hasAudio&&!y.isMuxed?"audio":"video"}),M&&M.length)l(t,M);if(H&&H.length)f(t,H);m(null,t,{})};Yo({action:"probeMp4StartTime",timescales:t.map.timescales,data:d,transmuxer:t.transmuxer,callback:({data:H,startTime:M})=>{if(e=H.buffer,t.bytes=d=H,y.hasAudio&&!y.isMuxed)i(t,"audio","start",M);if(y.hasVideo)i(t,"video","start",M);Yo({action:"probeEmsgID3",data:d,transmuxer:t.transmuxer,offset:M,callback:({emsgData:D,id3Frames:T})=>{if(e=D.buffer,t.bytes=d=D,!v.video||!D.byteLength||!t.transmuxer){B(void 0,T);return}Yo({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:t.transmuxer,data:d,timescales:t.map.timescales,trackIds:[v.video.id],callback:(z)=>{e=z.data.buffer,t.bytes=d=z.data,z.logs.forEach(function(E){p(aa(E,{stream:"mp4CaptionParser"}))}),B(z.captions,T)}})}})}});return}if(!t.transmuxer){m(null,t,{});return}if(typeof t.container>"u")t.container=Z5(d);if(t.container!=="ts"&&t.container!=="aac"){a(t,{hasAudio:!1,hasVideo:!1}),m(null,t,{});return}cI({segment:t,bytes:e,trackInfoFn:a,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:l,captionsFn:f,isEndOfTimeline:o,endedTimelineFn:c,dataFn:u,doneFn:m,onTransmuxerLog:p,triggerSegmentEventFn:w})},jk=function({id:t,key:e,encryptedBytes:a,decryptionWorker:i,segment:s,doneFn:n},l){let f=(c)=>{if(c.data.source===t){i.removeEventListener("message",f);let u=c.data.decrypted;l(new Uint8Array(u.bytes,u.byteOffset,u.byteLength))}};i.onerror=()=>{let u=Xf({segment:s}),m={message:"An error occurred in the decryption worker",metadata:{error:Error("An error occurred in the decryption worker"),errorType:lt.Error.StreamingFailedToDecryptSegment,segmentInfo:u,keyInfo:{uri:s.key.resolvedUri||s.map.key.resolvedUri}}};n(m,s)},i.addEventListener("message",f);let o;if(e.bytes.slice)o=e.bytes.slice();else o=new Uint32Array(Array.prototype.slice.call(e.bytes));i.postMessage(ak({source:t,encrypted:a,key:o,iv:e.iv}),[a.buffer,o.buffer])},uI=({decryptionWorker:t,segment:e,trackInfoFn:a,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:l,captionsFn:f,isEndOfTimeline:o,endedTimelineFn:c,dataFn:u,doneFn:m,onTransmuxerLog:p,triggerSegmentEventFn:w})=>{w({type:"segmentdecryptionstart"}),jk({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:t,segment:e,doneFn:m},(d)=>{e.bytes=d,w({type:"segmentdecryptioncomplete",segment:e}),wk({segment:e,bytes:e.bytes,trackInfoFn:a,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:l,captionsFn:f,isEndOfTimeline:o,endedTimelineFn:c,dataFn:u,doneFn:m,onTransmuxerLog:p,triggerSegmentEventFn:w})})},mI=({activeXhrs:t,decryptionWorker:e,trackInfoFn:a,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:l,captionsFn:f,isEndOfTimeline:o,endedTimelineFn:c,dataFn:u,doneFn:m,onTransmuxerLog:p,triggerSegmentEventFn:w})=>{let d=0,v=!1;return(k,y)=>{if(v)return;if(k)return v=!0,Qg(t),m(k,y);if(d+=1,d===t.length){let B=function(){if(y.encryptedBytes)return uI({decryptionWorker:e,segment:y,trackInfoFn:a,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:l,captionsFn:f,isEndOfTimeline:o,endedTimelineFn:c,dataFn:u,doneFn:m,onTransmuxerLog:p,triggerSegmentEventFn:w});wk({segment:y,bytes:y.bytes,trackInfoFn:a,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:l,captionsFn:f,isEndOfTimeline:o,endedTimelineFn:c,dataFn:u,doneFn:m,onTransmuxerLog:p,triggerSegmentEventFn:w})};if(y.endOfAllRequests=Date.now(),y.map&&y.map.encryptedBytes&&!y.map.bytes)return w({type:"segmentdecryptionstart",segment:y}),jk({decryptionWorker:e,id:y.requestId+"-init",encryptedBytes:y.map.encryptedBytes,key:y.map.key,segment:y,doneFn:m},(H)=>{y.map.bytes=H,w({type:"segmentdecryptioncomplete",segment:y}),pk(y,(M)=>{if(M)return Qg(t),m(M,y);B()})});B()}}},gI=({loadendState:t,abortFn:e})=>(a)=>{if(a.target.aborted&&e&&!t.calledAbortFn)e(),t.calledAbortFn=!0},bI=({segment:t,progressFn:e,trackInfoFn:a,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:l,captionsFn:f,isEndOfTimeline:o,endedTimelineFn:c,dataFn:u})=>(m)=>{if(m.target.aborted)return;if(t.stats=aa(t.stats,lI(m)),!t.stats.firstBytesReceivedAt&&t.stats.bytesReceived)t.stats.firstBytesReceivedAt=Date.now();return e(m,t)},pI=({xhr:t,xhrOptions:e,decryptionWorker:a,segment:i,abortFn:s,progressFn:n,trackInfoFn:l,timingInfoFn:f,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:c,id3Fn:u,captionsFn:m,isEndOfTimeline:p,endedTimelineFn:w,dataFn:d,doneFn:v,onTransmuxerLog:k,triggerSegmentEventFn:y})=>{let B=[],H=mI({activeXhrs:B,decryptionWorker:a,trackInfoFn:l,timingInfoFn:f,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:c,id3Fn:u,captionsFn:m,isEndOfTimeline:p,endedTimelineFn:w,dataFn:d,doneFn:v,onTransmuxerLog:k,triggerSegmentEventFn:y});if(i.key&&!i.key.bytes){let E=[i.key];if(i.map&&!i.map.bytes&&i.map.key&&i.map.key.resolvedUri===i.key.resolvedUri)E.push(i.map.key);let V=aa(e,{uri:i.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),tt=mS(i,E,H,y),at={uri:i.key.resolvedUri};y({type:"segmentkeyloadstart",segment:i,keyInfo:at});let Q=t(V,tt);B.push(Q)}if(i.map&&!i.map.bytes){if(i.map.key&&(!i.key||i.key.resolvedUri!==i.map.key.resolvedUri)){let Q=aa(e,{uri:i.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),Z=mS(i,[i.map.key],H,y),J={uri:i.map.key.resolvedUri};y({type:"segmentkeyloadstart",segment:i,keyInfo:J});let Y=t(Q,Z);B.push(Y)}let V=aa(e,{uri:i.map.resolvedUri,responseType:"arraybuffer",headers:Jg(i.map),requestType:"segment-media-initialization"}),tt=oI({segment:i,finishProcessingFn:H,triggerSegmentEventFn:y});y({type:"segmentloadstart",segment:i});let at=t(V,tt);B.push(at)}let M=aa(e,{uri:i.part&&i.part.resolvedUri||i.resolvedUri,responseType:"arraybuffer",headers:Jg(i),requestType:"segment"}),D=hI({segment:i,finishProcessingFn:H,responseType:M.responseType,triggerSegmentEventFn:y});y({type:"segmentloadstart",segment:i});let T=t(M,D);T.addEventListener("progress",bI({segment:i,progressFn:n,trackInfoFn:l,timingInfoFn:f,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:c,id3Fn:u,captionsFn:m,isEndOfTimeline:p,endedTimelineFn:w,dataFn:d})),B.push(T);let z={};return B.forEach((E)=>{E.addEventListener("loadend",gI({loadendState:z,abortFn:s}))}),()=>Qg(B)},tm=_n("PlaylistSelector"),gS=function(t){if(!t||!t.playlist)return;let e=t.playlist;return JSON.stringify({id:e.id,bandwidth:t.bandwidth,width:t.width,height:t.height,codecs:e.attributes&&e.attributes.CODECS||""})},Jo=function(t,e){if(!t)return"";let a=$.default.getComputedStyle(t);if(!a)return"";return a[e]},Qo=function(t,e){let a=t.slice();t.sort(function(i,s){let n=e(i,s);if(n===0)return a.indexOf(i)-a.indexOf(s);return n})},Q7=function(t,e){let a,i;if(t.attributes.BANDWIDTH)a=t.attributes.BANDWIDTH;if(a=a||$.default.Number.MAX_VALUE,e.attributes.BANDWIDTH)i=e.attributes.BANDWIDTH;return i=i||$.default.Number.MAX_VALUE,a-i},wI=function(t,e){let a,i;if(t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width)a=t.attributes.RESOLUTION.width;if(a=a||$.default.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width)i=e.attributes.RESOLUTION.width;if(i=i||$.default.Number.MAX_VALUE,a===i&&t.attributes.BANDWIDTH&&e.attributes.BANDWIDTH)return t.attributes.BANDWIDTH-e.attributes.BANDWIDTH;return a-i},dk=function(t){let{main:e,bandwidth:a,playerWidth:i,playerHeight:s,playerObjectFit:n,limitRenditionByPlayerDimensions:l,playlistController:f}=t;if(!e)return;let o={bandwidth:a,width:i,height:s,limitRenditionByPlayerDimensions:l},c=e.playlists;if(Ds.isAudioOnly(e))c=f.getAudioTrackPlaylists_(),o.audioOnly=!0;let u=c.map((z)=>{let E,V=z.attributes&&z.attributes.RESOLUTION&&z.attributes.RESOLUTION.width,tt=z.attributes&&z.attributes.RESOLUTION&&z.attributes.RESOLUTION.height;return E=z.attributes&&z.attributes.BANDWIDTH,E=E||$.default.Number.MAX_VALUE,{bandwidth:E,width:V,height:tt,playlist:z}});Qo(u,(z,E)=>z.bandwidth-E.bandwidth),u=u.filter((z)=>!Ds.isIncompatible(z.playlist));let m=u.filter((z)=>Ds.isEnabled(z.playlist));if(!m.length)m=u.filter((z)=>!Ds.isDisabled(z.playlist));let p=m.filter((z)=>z.bandwidth*Oi.BANDWIDTH_VARIANCE<a),w=p[p.length-1],d=p.filter((z)=>z.bandwidth===w.bandwidth)[0];if(l===!1){let z=d||m[0]||u[0];if(z&&z.playlist){let E="sortedPlaylistReps";if(d)E="bandwidthBestRep";if(m[0])E="enabledPlaylistReps";return tm(`choosing ${gS(z)} using ${E} with options`,o),z.playlist}return tm("could not choose a playlist with options",o),null}let v=p.filter((z)=>z.width&&z.height);Qo(v,(z,E)=>z.width-E.width);let k=v.filter((z)=>z.width===i&&z.height===s);w=k[k.length-1];let y=k.filter((z)=>z.bandwidth===w.bandwidth)[0],B,H,M;if(!y)B=v.filter((z)=>{if(n==="cover")return z.width>i&&z.height>s;return z.width>i||z.height>s}),H=B.filter((z)=>z.width===B[0].width&&z.height===B[0].height),w=H[H.length-1],M=H.filter((z)=>z.bandwidth===w.bandwidth)[0];let D;if(f.leastPixelDiffSelector){let z=v.map((E)=>{return E.pixelDiff=Math.abs(E.width-i)+Math.abs(E.height-s),E});Qo(z,(E,V)=>{if(E.pixelDiff===V.pixelDiff)return V.bandwidth-E.bandwidth;return E.pixelDiff-V.pixelDiff}),D=z[0]}let T=D||M||y||d||m[0]||u[0];if(T&&T.playlist){let z="sortedPlaylistReps";if(D)z="leastPixelDiffRep";else if(M)z="resolutionPlusOneRep";else if(y)z="resolutionBestRep";else if(d)z="bandwidthBestRep";else if(m[0])z="enabledPlaylistReps";return tm(`choosing ${gS(T)} using ${z} with options`,o),T.playlist}return tm("could not choose a playlist with options",o),null},bS=function(){let t=this.useDevicePixelRatio?$.default.devicePixelRatio||1:1;if(!isNaN(this.customPixelRatio))t=this.customPixelRatio;return dk({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(Jo(this.tech_.el(),"width"),10)*t,playerHeight:parseInt(Jo(this.tech_.el(),"height"),10)*t,playerObjectFit:this.usePlayerObjectFit?Jo(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},jI=function(t){let e=-1,a=-1;if(t<0||t>1)throw Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let i=this.useDevicePixelRatio?$.default.devicePixelRatio||1:1;if(!isNaN(this.customPixelRatio))i=this.customPixelRatio;if(e<0)e=this.systemBandwidth,a=this.systemBandwidth;if(this.systemBandwidth>0&&this.systemBandwidth!==a)e=t*this.systemBandwidth+(1-t)*e,a=this.systemBandwidth;return dk({main:this.playlists.main,bandwidth:e,playerWidth:parseInt(Jo(this.tech_.el(),"width"),10)*i,playerHeight:parseInt(Jo(this.tech_.el(),"height"),10)*i,playerObjectFit:this.usePlayerObjectFit?Jo(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},dI=function(t){let{main:e,currentTime:a,bandwidth:i,duration:s,segmentDuration:n,timeUntilRebuffer:l,currentTimeline:f,syncController:o}=t,c=e.playlists.filter((d)=>!Ds.isIncompatible(d)),u=c.filter(Ds.isEnabled);if(!u.length)u=c.filter((d)=>!Ds.isDisabled(d));let p=u.filter(Ds.hasAttribute.bind(null,"BANDWIDTH")).map((d)=>{let k=o.getSyncPoint(d,s,f,a)?1:2,B=Ds.estimateSegmentRequestTime(n,i,d)*k-l;return{playlist:d,rebufferingImpact:B}}),w=p.filter((d)=>d.rebufferingImpact<=0);if(Qo(w,(d,v)=>Q7(v.playlist,d.playlist)),w.length)return w[0];return Qo(p,(d,v)=>d.rebufferingImpact-v.rebufferingImpact),p[0]||null},qI=function(){let t=this.playlists.main.playlists.filter(Ds.isEnabled);return Qo(t,(a,i)=>Q7(a,i)),t.filter((a)=>!!F2(this.playlists.main,a).video)[0]||null},AI=(t)=>{let e=0,a;if(t.bytes)a=new Uint8Array(t.bytes),t.segments.forEach((i)=>{a.set(i,e),e+=i.byteLength});return a};function qk(t){try{return new URL(t).pathname.split("/").slice(-2).join("/")}catch(e){return""}}var vI=function(t,e,a){if(!t[a]){e.trigger({type:"usage",name:"vhs-608"});let i=a;if(/^cc708_/.test(a))i="SERVICE"+a.split("_")[1];let s=e.textTracks().getTrackById(i);if(s)t[a]=s;else{let n=e.options_.vhs&&e.options_.vhs.captionServices||{},l=a,f=a,o=!1,c=n[i];if(c)l=c.label,f=c.language,o=c.default;t[a]=e.addRemoteTextTrack({kind:"captions",id:i,default:o,label:l,language:f},!1).track}}},SI=function({inbandTextTracks:t,captionArray:e,timestampOffset:a}){if(!e)return;let i=$.default.WebKitDataCue||$.default.VTTCue;e.forEach((s)=>{let n=s.stream;if(s.content)s.content.forEach((l)=>{let f=new i(s.startTime+a,s.endTime+a,l.text);f.line=l.line,f.align="left",f.position=l.position,f.positionAlign="line-left",t[n].addCue(f)});else t[n].addCue(new i(s.startTime+a,s.endTime+a,s.text))})},yI=function(t){Object.defineProperties(t.frame,{id:{get(){return lt.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),t.value.key}},value:{get(){return lt.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),t.value.data}},privateData:{get(){return lt.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),t.value.data}}})},kI=({inbandTextTracks:t,metadataArray:e,timestampOffset:a,videoDuration:i})=>{if(!e)return;let s=$.default.WebKitDataCue||$.default.VTTCue,n=t.metadataTrack_;if(!n)return;if(e.forEach((u)=>{let m=u.cueTime+a;if(typeof m!=="number"||$.default.isNaN(m)||m<0||!(m<1/0))return;if(!u.frames||!u.frames.length)return;u.frames.forEach((p)=>{let w=new s(m,m,p.value||p.url||p.data||"");w.frame=p,w.value=p,yI(w),n.addCue(w)})}),!n.cues||!n.cues.length)return;let l=n.cues,f=[];for(let u=0;u<l.length;u++)if(l[u])f.push(l[u]);let o=f.reduce((u,m)=>{let p=u[m.startTime]||[];return p.push(m),u[m.startTime]=p,u},{}),c=Object.keys(o).sort((u,m)=>Number(u)-Number(m));c.forEach((u,m)=>{let p=o[u],w=isFinite(i)?i:u,d=Number(c[m+1])||w;p.forEach((v)=>{v.endTime=d})})},CI={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"},_I=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),FI=({inbandTextTracks:t,dateRanges:e})=>{let a=t.metadataTrack_;if(!a)return;let i=$.default.WebKitDataCue||$.default.VTTCue;e.forEach((s)=>{for(let n of Object.keys(s)){if(_I.has(n))continue;let l=new i(s.startTime,s.endTime,"");if(l.id=s.id,l.type="com.apple.quicktime.HLS",l.value={key:CI[n],data:s[n]},n==="scte35Out"||n==="scte35In")l.value.data=new Uint8Array(l.value.data.match(/[\da-f]{2}/gi)).buffer;a.addCue(l)}s.processDateRange()})},pS=(t,e,a)=>{if(t.metadataTrack_)return;if(t.metadataTrack_=a.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,!lt.browser.IS_ANY_SAFARI)t.metadataTrack_.inBandMetadataTrackDispatchType=e},S2=function(t,e,a){let i,s;if(!a)return;if(!a.cues)return;i=a.cues.length;while(i--)if(s=a.cues[i],s.startTime>=t&&s.endTime<=e)a.removeCue(s)},BI=function(t){let e=t.cues;if(!e)return;let a={};for(let i=e.length-1;i>=0;i--){let s=e[i],n=`${s.startTime}-${s.endTime}-${s.text}`;if(a[n])t.removeCue(s);else a[n]=s}},OI=(t,e,a)=>{if(typeof e>"u"||e===null||!t.length)return[];let i=Math.ceil((e-a+3)*ql.ONE_SECOND_IN_TS),s;for(s=0;s<t.length;s++)if(t[s].pts>i)break;return t.slice(s)},HI=(t,e,a)=>{if(!e.length)return t;if(a)return e.slice();let i=e[0].pts,s=0;for(s;s<t.length;s++)if(t[s].pts>=i)break;return t.slice(0,s).concat(e)},MI=(t,e,a,i)=>{let s=Math.ceil((e-i)*ql.ONE_SECOND_IN_TS),n=Math.ceil((a-i)*ql.ONE_SECOND_IN_TS),l=t.slice(),f=t.length;while(f--)if(t[f].pts<=n)break;if(f===-1)return l;let o=f+1;while(o--)if(t[o].pts<=s)break;return o=Math.max(o,0),l.splice(o,f-o+1),l},DI=function(t,e){if(!t&&!e||!t&&e||t&&!e)return!1;if(t===e)return!0;let a=Object.keys(t).sort(),i=Object.keys(e).sort();if(a.length!==i.length)return!1;for(let s=0;s<a.length;s++){let n=a[s];if(n!==i[s])return!1;if(t[n]!==e[n])return!1}return!0},TI=function(t,e,a){e=e||[];let i=[],s=0;for(let n=0;n<e.length;n++){let l=e[n];if(t===l.timeline){if(i.push(n),s+=l.duration,s>a)return n}}if(i.length===0)return 0;return i[i.length-1]},A2=1,RI=500,wS=(t)=>typeof t==="number"&&isFinite(t),em=0.016666666666666666,NI=(t,e,a)=>{if(t!=="main"||!e||!a)return null;if(!a.hasAudio&&!a.hasVideo)return"Neither audio nor video found in segment.";if(e.hasVideo&&!a.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(!e.hasVideo&&a.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},zI=(t,e,a)=>{let i=e-Oi.BACK_BUFFER_LENGTH;if(t.length)i=Math.max(i,t.start(0));let s=e-a;return Math.min(s,i)},xo=(t)=>{let{startOfSegment:e,duration:a,segment:i,part:s,playlist:{mediaSequence:n,id:l,segments:f=[]},mediaIndex:o,partIndex:c,timeline:u}=t,m=f.length-1,p="mediaIndex/partIndex increment";if(t.getMediaInfoForTime)p=`getMediaInfoForTime (${t.getMediaInfoForTime})`;else if(t.isSyncRequest)p="getSyncSegmentCandidate (isSyncRequest)";if(t.independent)p+=` with independent ${t.independent}`;let w=typeof c==="number",d=t.segment.uri?"segment":"pre-segment",v=w?Ey({preloadSegment:i})-1:0;return`${d} [${n+o}/${n+m}]`+(w?` part [${c}/${v}]`:"")+` segment start/end [${i.start} => ${i.end}]`+(w?` part start/end [${s.start} => ${s.end}]`:"")+` startOfSegment [${e}] duration [${a}] timeline [${u}] selected by [${p}] playlist [${l}]`},jS=(t)=>`${t}TimingInfo`,EI=({segmentTimeline:t,currentTimeline:e,startOfSegment:a,buffered:i,overrideCheck:s})=>{if(!s&&t===e)return null;if(t<e)return a;return i.length?i.end(i.length-1):a},Zg=({timelineChangeController:t,currentTimeline:e,segmentTimeline:a,loaderType:i,audioDisabled:s})=>{if(e===a)return!1;if(i==="audio"){let n=t.lastTimelineChange({type:"main"});return!n||n.to!==a}if(i==="main"&&s){let n=t.pendingTimelineChange({type:"audio"});if(n&&n.to===a)return!1;return!0}return!1},xI=(t)=>{if(!t)return!1;let e=t.pendingTimelineChange({type:"audio"}),a=t.pendingTimelineChange({type:"main"}),i=e&&a,s=i&&e.to!==a.to;if(i&&e.from!==-1&&a.from!==-1&&s)return!0;return!1},UI=(t)=>{let e=t.timelineChangeController_.pendingTimelineChange({type:"audio"}),a=t.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&a&&e.to<a.to},wl=(t)=>{let e=t.pendingSegment_;if(!e)return;if(Zg({timelineChangeController:t.timelineChangeController_,currentTimeline:t.currentTimeline_,segmentTimeline:e.timeline,loaderType:t.loaderType_,audioDisabled:t.audioDisabled_})&&xI(t.timelineChangeController_)){if(UI(t)){t.timelineChangeController_.trigger("audioTimelineBehind");return}t.timelineChangeController_.trigger("fixBadTimelineChange")}},II=(t)=>{let e=0;if(["video","audio"].forEach(function(a){let i=t[`${a}TimingInfo`];if(!i)return;let{start:s,end:n}=i,l;if(typeof s==="bigint"||typeof n==="bigint")l=$.default.BigInt(n)-$.default.BigInt(s);else if(typeof s==="number"&&typeof n==="number")l=n-s;if(typeof l<"u"&&l>e)e=l}),typeof e==="bigint"&&e<Number.MAX_SAFE_INTEGER)e=Number(e);return e},dS=({segmentDuration:t,maxDuration:e})=>{if(!t)return!1;return Math.round(t)>e+w0},GI=(t,e)=>{if(e!=="hls")return null;let a=II({audioTimingInfo:t.audioTimingInfo,videoTimingInfo:t.videoTimingInfo});if(!a)return null;let i=t.playlist.targetDuration,s=dS({segmentDuration:a,maxDuration:i*2}),n=dS({segmentDuration:a,maxDuration:i}),l=`Segment with index ${t.mediaIndex} from playlist ${t.playlist.id} has a duration of ${a} when the reported duration is ${t.duration} and the target duration is ${i}. 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(s||n)return{severity:s?"warn":"info",message:l};return null},Xf=({type:t,segment:e})=>{if(!e)return;let a=Boolean(e.key||e.map&&e.map.ke),i=Boolean(e.map&&!e.map.bytes),s=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:t||e.type,uri:e.resolvedUri||e.uri,start:s,duration:e.duration,isEncrypted:a,isMediaInitialization:i}};class Sm extends lt.EventTarget{constructor(t,e={}){super();if(!t)throw TypeError("Initialization settings are required");if(typeof t.currentTime!=="function")throw TypeError("No currentTime getter specified");if(!t.mediaSource)throw TypeError("No MediaSource specified");if(this.bandwidth=t.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=t.hasPlayed,this.currentTime_=t.currentTime,this.seekable_=t.seekable,this.seeking_=t.seeking,this.duration_=t.duration,this.mediaSource_=t.mediaSource,this.vhs_=t.vhs,this.loaderType_=t.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=t.segmentMetadataTrack,this.goalBufferLength_=t.goalBufferLength,this.sourceType_=t.sourceType,this.sourceUpdater_=t.sourceUpdater,this.inbandTextTracks_=t.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=t.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=t.parse708captions,this.useDtsForTimestampOffset_=t.useDtsForTimestampOffset,this.captionServices_=t.captionServices,this.exactManifestTimings=t.exactManifestTimings,this.addMetadataToTextTrack=t.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_=t.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=t.decrypter,this.syncController_=t.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_=_n(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(a){if(a!==this.state_)this.logger_(`${this.state_} -> ${a}`),this.state_=a,this.trigger("statechange")}}),this.sourceUpdater_.on("ready",()=>{if(this.hasEnoughInfoToAppend_())this.processCallQueue_();else wl(this)}),this.sourceUpdater_.on("codecschange",(a)=>{this.trigger(za({type:"codecschange"},a))}),this.loaderType_==="main")this.timelineChangeController_.on("pendingtimelinechange",()=>{if(this.hasEnoughInfoToAppend_())this.processCallQueue_();else wl(this)});if(this.loaderType_==="audio")this.timelineChangeController_.on("timelinechange",(a)=>{if(this.trigger(za({type:"timelinechange"},a)),this.hasEnoughInfoToLoad_())this.processLoadQueue_();else wl(this);if(this.hasEnoughInfoToAppend_())this.processCallQueue_();else wl(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return Fg.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_)$.default.clearTimeout(this.checkBufferTimeout_);if(this.syncController_&&this.triggerSyncInfoUpdate_)this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_);this.off()}setAudio(t){if(this.audioDisabled_=!t,t)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,$.default.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(t){if(this.state==="APPENDING"&&!this.pendingSegment_)return this.state="READY",!0;if(!this.pendingSegment_||this.pendingSegment_.requestId!==t)return!0;return!1}error(t){if(typeof t<"u")this.logger_("error occurred:",t),this.error_=t;return this.pendingSegment_=null,this.error_}endOfStream(){if(this.ended_=!0,this.transmuxer_)Fg.reset(this.transmuxer_);this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){let t=this.getMediaInfo_();if(!this.sourceUpdater_||!t)return Hi();if(this.loaderType_==="main"){let{hasAudio:e,hasVideo:a,isMuxed:i}=t;if(a&&e&&!this.audioDisabled_&&!i)return this.sourceUpdater_.buffered();if(a)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(t,e=!1){if(!t)return null;let a=Am(t),i=this.initSegments_[a];if(e&&!i&&t.bytes)this.initSegments_[a]=i={resolvedUri:t.resolvedUri,byterange:t.byterange,bytes:t.bytes,tracks:t.tracks,timescales:t.timescales};return i||t}segmentKey(t,e=!1){if(!t)return null;let a=ik(t),i=this.keyCache_[a];if(this.cacheEncryptionKeys_&&e&&!i&&t.bytes)this.keyCache_[a]=i={resolvedUri:t.resolvedUri,bytes:t.bytes};let s={resolvedUri:(i||t).resolvedUri};if(i)s.bytes=i.bytes;return s}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(t,e={}){if(!t)return;if(this.playlist_&&this.playlist_.endList&&t.endList&&this.playlist_.uri===t.uri)return;let a=this.playlist_,i=this.pendingSegment_;if(this.playlist_=t,this.xhrOptions_=e,this.state==="INIT"){if(t.syncInfo={mediaSequence:t.mediaSequence,time:0},this.loaderType_==="main")this.syncController_.setDateTimeMappingForStart(t)}let s=null;if(a){if(a.id)s=a.id;else if(a.uri)s=a.uri}if(this.logger_(`playlist update [${s} => ${t.id||t.uri}]`),this.mediaSequenceSync_)this.mediaSequenceSync_.update(t,this.currentTime_()),this.logger_(`Playlist update:
230
- currentTime: ${this.currentTime_()}
231
- bufferedEnd: ${Cg(this.buffered_())}
232
- `,this.mediaSequenceSync_.diagnostics);if(this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!a||a.uri!==t.uri){if(this.mediaIndex!==null)if(!t.endList&&typeof t.partTargetDuration==="number")this.resetLoader();else this.resyncLoader();this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}let n=t.mediaSequence-a.mediaSequence;if(this.logger_(`live window shift [${n}]`),this.mediaIndex!==null)if(this.mediaIndex-=n,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 f=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=f}}if(i)if(i.mediaIndex-=n,i.mediaIndex<0)i.mediaIndex=null,i.partIndex=null;else{if(i.mediaIndex>=0)i.segment=t.segments[i.mediaIndex];if(i.partIndex>=0&&i.segment.parts)i.part=i.segment.parts[i.partIndex]}this.syncController_.saveExpiredSegmentInfo(a,t)}pause(){if(this.checkBufferTimeout_)$.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null}paused(){return this.checkBufferTimeout_===null}resetEverything(t){if(this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,t),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_)Fg.reset(this.transmuxer_);this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;let t=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;if(this.sourceType_==="hls"&&!t)this.shouldForceTimestampOffsetAfterResync_=!0;if(this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_)this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(t,e,a=()=>{},i=!1){if(e===1/0)e=this.duration_();if(e<=t){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 s=1,n=()=>{if(s--,s===0)a()};if(i||!this.audioDisabled_)s++,this.sourceUpdater_.removeAudio(t,e,n);if(i||this.loaderType_==="main")this.gopBuffer_=MI(this.gopBuffer_,t,e,this.timeMapping_),s++,this.sourceUpdater_.removeVideo(t,e,n);for(let l in this.inbandTextTracks_)S2(t,e,this.inbandTextTracks_[l]);S2(t,e,this.segmentMetadataTrack_),n()}monitorBuffer_(){if(this.checkBufferTimeout_)$.default.clearTimeout(this.checkBufferTimeout_);this.checkBufferTimeout_=$.default.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){if(this.state==="READY")this.fillBuffer_();if(this.checkBufferTimeout_)$.default.clearTimeout(this.checkBufferTimeout_);this.checkBufferTimeout_=$.default.setTimeout(this.monitorBufferTick_.bind(this),RI)}fillBuffer_(){if(this.sourceUpdater_.updating())return;let t=this.chooseNextRequest_();if(!t)return;let e={segmentInfo:Xf({type:this.loaderType_,segment:t})};if(this.trigger({type:"segmentselected",metadata:e}),typeof t.timestampOffset==="number")this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:t.timeline});this.loadSegment_(t)}isEndOfStream_(t=this.mediaIndex,e=this.playlist_,a=this.partIndex){if(!e||!this.mediaSource_)return!1;let i=typeof t==="number"&&e.segments[t],s=t+1===e.segments.length,n=!i||!i.parts||a+1===i.parts.length;return e.endList&&this.mediaSource_.readyState==="open"&&s&&n}chooseNextRequest_(){let t=this.buffered_(),e=Cg(t)||0,a=K7(t,this.currentTime_()),i=!this.hasPlayed_()&&a>=1,s=a>=this.goalBufferLength_(),n=this.playlist_.segments;if(!n.length||i||s)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=TI(this.currentTimeline_,n,e),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${l.mediaIndex}`);else if(this.mediaIndex!==null){let m=n[this.mediaIndex],p=typeof this.partIndex==="number"?this.partIndex:-1;if(l.startOfSegment=m.end?m.end:e,m.parts&&m.parts[p+1])l.mediaIndex=this.mediaIndex,l.partIndex=p+1;else l.mediaIndex=this.mediaIndex+1}else{let m,p,w,d=this.fetchAtBuffer_?e:this.currentTime_();if(this.mediaSequenceSync_)this.logger_(`chooseNextRequest_ request after Quality Switch:
233
- For TargetTime: ${d}.
234
- CurrentTime: ${this.currentTime_()}
235
- BufferedEnd: ${e}
236
- Fetch At Buffer: ${this.fetchAtBuffer_}
237
- `,this.mediaSequenceSync_.diagnostics);if(this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){let v=this.getSyncInfoFromMediaSequenceSync_(d);if(!v)return this.error({message:"No sync info found while using media sequence sync",metadata:{errorType:lt.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 (${v.start} --> ${v.end})`),m=v.segmentIndex,p=v.partIndex,w=v.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");let v=Ds.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:d,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});m=v.segmentIndex,p=v.partIndex,w=v.startTime}l.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${d}`:`currentTime ${d}`,l.mediaIndex=m,l.startOfSegment=w,l.partIndex=p,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${l.mediaIndex} `)}let f=n[l.mediaIndex],o=f&&typeof l.partIndex==="number"&&f.parts&&f.parts[l.partIndex];if(!f||typeof l.partIndex==="number"&&!o)return null;if(typeof l.partIndex!=="number"&&f.parts)l.partIndex=0,o=f.parts[0];let c=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!a&&o&&!c&&!o.independent){if(l.partIndex===0){let m=n[l.mediaIndex-1],p=m.parts&&m.parts.length&&m.parts[m.parts.length-1];if(p&&p.independent)l.mediaIndex-=1,l.partIndex=m.parts.length-1,l.independent="previous segment"}else if(f.parts[l.partIndex-1].independent)l.partIndex-=1,l.independent="previous part"}let u=this.mediaSource_&&this.mediaSource_.readyState==="ended";if(l.mediaIndex>=n.length-1&&u&&!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_(t){if(!this.mediaSequenceSync_)return null;let e=Math.max(t,this.mediaSequenceSync_.start);if(t!==e)this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${t} to ${e}`);let a=this.mediaSequenceSync_.getSyncInfoForTime(e);if(!a)return null;if(!a.isAppended)return a;let i=this.mediaSequenceSync_.getSyncInfoForTime(a.end);if(!i)return null;if(i.isAppended)this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!");return i}generateSegmentInfo_(t){let{independent:e,playlist:a,mediaIndex:i,startOfSegment:s,isSyncRequest:n,partIndex:l,forceTimestampOffset:f,getMediaInfoForTime:o}=t,c=a.segments[i],u=typeof l==="number"&&c.parts[l],m={requestId:"segment-loader-"+Math.random(),uri:u&&u.resolvedUri||c.resolvedUri,mediaIndex:i,partIndex:u?l:null,isSyncRequest:n,startOfSegment:s,playlist:a,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:c.timeline,duration:u&&u.duration||c.duration,segment:c,part:u,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:o,independent:e},p=typeof f<"u"?f:this.isPendingTimestampOffset_;m.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:c.timeline,currentTimeline:this.currentTimeline_,startOfSegment:s,buffered:this.buffered_(),overrideCheck:p});let w=Cg(this.sourceUpdater_.audioBuffered());if(typeof w==="number")m.audioAppendStart=w-this.sourceUpdater_.audioTimestampOffset();if(this.sourceUpdater_.videoBuffered().length)m.gopsToAlignWith=OI(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_);return m}timestampOffsetForSegment_(t){return EI(t)}earlyAbortWhenNeeded_(t){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH)return;if(Date.now()-(t.firstBytesReceivedAt||Date.now())<1000)return;let e=this.currentTime_(),a=t.bandwidth,i=this.pendingSegment_.duration,s=Ds.estimateSegmentRequestTime(i,a,this.playlist_,t.bytesReceived),n=lU(this.buffered_(),e,this.vhs_.tech_.playbackRate())-1;if(s<=n)return;let l=dI({main:this.vhs_.playlists.main,currentTime:e,bandwidth:a,duration:this.duration_(),segmentDuration:i,timeUntilRebuffer:n,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!l)return;let o=s-n-l.rebufferingImpact,c=0.5;if(n<=w0)c=1;if(!l.playlist||l.playlist.uri===this.playlist_.uri||o<c)return;this.bandwidth=l.playlist.attributes.BANDWIDTH*Oi.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort")}handleAbort_(t){this.logger_(`Aborting ${xo(t)}`),this.mediaRequestsAborted+=1}handleProgress_(t,e){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;this.trigger("progress")}handleTrackInfo_(t,e){let{hasAudio:a,hasVideo:i}=e,s={segmentInfo:Xf({type:this.loaderType_,segment:t}),trackInfo:{hasAudio:a,hasVideo:i}};if(this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:s}),this.earlyAbortWhenNeeded_(t.stats),this.checkForAbort_(t.requestId))return;if(this.checkForIllegalMediaSwitch(e))return;if(e=e||{},!DI(this.currentMediaInfo_,e))this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=e,this.currentMediaInfo_=e,this.logger_("trackinfo update",e),this.trigger("trackinfo");if(this.checkForAbort_(t.requestId))return;if(this.pendingSegment_.trackInfo=e,this.hasEnoughInfoToAppend_())this.processCallQueue_();else wl(this)}handleTimingInfo_(t,e,a,i){if(this.earlyAbortWhenNeeded_(t.stats),this.checkForAbort_(t.requestId))return;let s=this.pendingSegment_,n=jS(e);if(s[n]=s[n]||{},s[n][a]=i,this.logger_(`timinginfo: ${e} - ${a} - ${i}`),this.hasEnoughInfoToAppend_())this.processCallQueue_();else wl(this)}handleCaptions_(t,e){if(this.earlyAbortWhenNeeded_(t.stats),this.checkForAbort_(t.requestId))return;if(e.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,t,e));return}let i=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),s={};if(e.forEach((n)=>{s[n.stream]=s[n.stream]||{startTime:1/0,captions:[],endTime:0};let l=s[n.stream];l.startTime=Math.min(l.startTime,n.startTime+i),l.endTime=Math.max(l.endTime,n.endTime+i),l.captions.push(n)}),Object.keys(s).forEach((n)=>{let{startTime:l,endTime:f,captions:o}=s[n],c=this.inbandTextTracks_;this.logger_(`adding cues from ${l} -> ${f} for ${n}`),vI(c,this.vhs_.tech_,n),S2(l,f,c[n]),SI({captionArray:o,inbandTextTracks:c,timestampOffset:i})}),this.transmuxer_)this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(t,e,a){if(this.earlyAbortWhenNeeded_(t.stats),this.checkForAbort_(t.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,t,e,a));return}this.addMetadataToTextTrack(a,e,this.duration_())}processMetadataQueue_(){this.metadataQueue_.id3.forEach((t)=>t()),this.metadataQueue_.caption.forEach((t)=>t()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){let t=this.callQueue_;this.callQueue_=[],t.forEach((e)=>e())}processLoadQueue_(){let t=this.loadQueue_;this.loadQueue_=[],t.forEach((e)=>e())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;let t=this.pendingSegment_;if(!t)return!1;if(!this.getCurrentMediaInfo_())return!0;if(Zg({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:t.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))return!1;return!0}getCurrentMediaInfo_(t=this.pendingSegment_){return t&&t.trackInfo||this.currentMediaInfo_}getMediaInfo_(t=this.pendingSegment_){return this.getCurrentMediaInfo_(t)||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 t=this.pendingSegment_,e=this.getCurrentMediaInfo_();if(!t||!e)return!1;let{hasAudio:a,hasVideo:i,isMuxed:s}=e;if(i&&!t.videoTimingInfo)return!1;if(a&&!this.audioDisabled_&&!s&&!t.audioTimingInfo)return!1;if(Zg({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:t.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))return!1;return!0}handleData_(t,e){if(this.earlyAbortWhenNeeded_(t.stats),this.checkForAbort_(t.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){wl(this),this.callQueue_.push(this.handleData_.bind(this,t,e));return}let a=this.pendingSegment_;if(this.setTimeMapping_(a.timeline),this.updateMediaSecondsLoaded_(a.part||a.segment),this.mediaSource_.readyState==="closed")return;if(t.map)t.map=this.initSegmentForMap(t.map,!0),a.segment.map=t.map;if(t.key)this.segmentKey(t.key,!0);if(a.isFmp4=t.isFmp4,a.timingInfo=a.timingInfo||{},a.isFmp4)this.trigger("fmp4"),a.timingInfo.start=a[jS(e.type)].start;else{let i=this.getCurrentMediaInfo_(),s=this.loaderType_==="main"&&i&&i.hasVideo,n;if(s)n=a.videoTimingInfo.start;a.timingInfo.start=this.trueSegmentStart_({currentStart:a.timingInfo.start,playlist:a.playlist,mediaIndex:a.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:s,firstVideoFrameTimeForData:n,videoTimingInfo:a.videoTimingInfo,audioTimingInfo:a.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(a,e.type),this.updateSourceBufferTimestampOffset_(a),a.isSyncRequest){this.updateTimingInfoEnd_(a),this.syncController_.saveSegmentTimingInfo({segmentInfo:a,shouldSaveTimelineMapping:this.loaderType_==="main"});let i=this.chooseNextRequest_();if(i.mediaIndex!==a.mediaIndex||i.partIndex!==a.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}a.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(a,e)}updateAppendInitSegmentStatus(t,e){if(this.loaderType_==="main"&&typeof t.timestampOffset==="number"&&!t.changedTimestampOffset)this.appendInitSegment_={audio:!0,video:!0};if(this.playlistOfLastInitSegment_[e]!==t.playlist)this.appendInitSegment_[e]=!0}getInitSegmentAndUpdateState_({type:t,initSegment:e,map:a,playlist:i}){if(a){let s=Am(a);if(this.activeInitSegmentId_===s)return null;e=this.initSegmentForMap(a,!0).bytes,this.activeInitSegmentId_=s}if(e&&this.appendInitSegment_[t])return this.playlistOfLastInitSegment_[t]=i,this.appendInitSegment_[t]=!1,this.activeInitSegmentId_=null,e;return null}handleQuotaExceededError_({segmentInfo:t,type:e,bytes:a},i){let s=this.sourceUpdater_.audioBuffered(),n=this.sourceUpdater_.videoBuffered();if(s.length>1)this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+Kf(s).join(", "));if(n.length>1)this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+Kf(n).join(", "));let l=s.length?s.start(0):0,f=s.length?s.end(s.length-1):0,o=n.length?n.start(0):0,c=n.length?n.end(n.length-1):0;if(f-l<=A2&&c-o<=A2){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${a.byteLength}, audio buffer: ${Kf(s).join(", ")}, video buffer: ${Kf(n).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:t,type:e,bytes:a}));let m=this.currentTime_()-A2;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${m}`),this.remove(0,m,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${A2}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=$.default.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},A2*1000)},!0)}handleAppendError_({segmentInfo:t,type:e,bytes:a},i){if(!i)return;if(i.code===Qy){this.handleQuotaExceededError_({segmentInfo:t,type:e,bytes:a});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",i),this.error({message:`${e} append of ${a.length}b failed for segment #${t.mediaIndex} in playlist ${t.playlist.id}`,metadata:{errorType:lt.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}appendToSourceBuffer_({segmentInfo:t,type:e,initSegment:a,data:i,bytes:s}){if(!s){let l=[i],f=i.byteLength;if(a)l.unshift(a),f+=a.byteLength;s=AI({bytes:f,segments:l})}let n={segmentInfo:Xf({type:this.loaderType_,segment:t})};this.trigger({type:"segmentappendstart",metadata:n}),this.sourceUpdater_.appendBuffer({segmentInfo:t,type:e,bytes:s},this.handleAppendError_.bind(this,{segmentInfo:t,type:e,bytes:s}))}handleSegmentTimingInfo_(t,e,a){if(!this.pendingSegment_||e!==this.pendingSegment_.requestId)return;let i=this.pendingSegment_.segment,s=`${t}TimingInfo`;if(!i[s])i[s]={};i[s].transmuxerPrependedSeconds=a.prependedContentDuration||0,i[s].transmuxedPresentationStart=a.start.presentation,i[s].transmuxedDecodeStart=a.start.decode,i[s].transmuxedPresentationEnd=a.end.presentation,i[s].transmuxedDecodeEnd=a.end.decode,i[s].baseMediaDecodeTime=a.baseMediaDecodeTime}appendData_(t,e){let{type:a,data:i}=e;if(!i||!i.byteLength)return;if(a==="audio"&&this.audioDisabled_)return;let s=this.getInitSegmentAndUpdateState_({type:a,initSegment:e.initSegment,playlist:t.playlist,map:t.isFmp4?t.segment.map:null});this.appendToSourceBuffer_({segmentInfo:t,type:a,initSegment:s,data:i})}loadSegment_(t){if(this.state="WAITING",this.pendingSegment_=t,this.trimBackBuffer_(t),typeof t.timestampOffset==="number"){if(this.transmuxer_)this.transmuxer_.postMessage({action:"clearAllMp4Captions"})}if(!this.hasEnoughInfoToLoad_()){wl(this),this.loadQueue_.push(()=>{let e=za({},t,{forceTimestampOffset:!0});za(t,this.generateSegmentInfo_(e)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(t)});return}this.updateTransmuxerAndRequestSegment_(t)}updateTransmuxerAndRequestSegment_(t){if(this.shouldUpdateTransmuxerTimestampOffset_(t.timestampOffset))this.gopBuffer_.length=0,t.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:t.timestampOffset});let e=this.createSimplifiedSegmentObj_(t),a=this.isEndOfStream_(t.mediaIndex,t.playlist,t.partIndex),i=this.mediaIndex!==null,s=t.timeline!==this.currentTimeline_&&t.timeline>0,n=a||i&&s;if(this.logger_(`Requesting
238
- ${qk(t.uri)}
239
- ${xo(t)}`),e.map&&!e.map.bytes)this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0};t.abortRequests=pI({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:e,abortFn:this.handleAbort_.bind(this,t),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",t.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",t.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:n,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:f,stream:o})=>{this.logger_(`${xo(t)} logged from transmuxer stream ${o} as a ${f}: ${l}`)},triggerSegmentEventFn:({type:l,segment:f,keyInfo:o,trackInfo:c,timingInfo:u})=>{let p={segmentInfo:Xf({segment:f})};if(o)p.keyInfo=o;if(c)p.trackInfo=c;if(u)p.timingInfo=u;this.trigger({type:l,metadata:p})}})}trimBackBuffer_(t){let e=zI(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);if(e>0)this.remove(0,e)}createSimplifiedSegmentObj_(t){let{segment:e,part:a}=t,i=t.segment.key||t.segment.map&&t.segment.map.key,s=t.segment.map&&!t.segment.map.bytes,n={resolvedUri:a?a.resolvedUri:e.resolvedUri,byterange:a?a.byterange:e.byterange,requestId:t.requestId,transmuxer:t.transmuxer,audioAppendStart:t.audioAppendStart,gopsToAlignWith:t.gopsToAlignWith,part:t.part,type:this.loaderType_,start:t.startOfSegment,duration:t.duration,isEncrypted:i,isMediaInitialization:s},l=t.playlist.segments[t.mediaIndex-1];if(l&&l.timeline===e.timeline){if(l.videoTimingInfo)n.baseStartTime=l.videoTimingInfo.transmuxedDecodeEnd;else if(l.audioTimingInfo)n.baseStartTime=l.audioTimingInfo.transmuxedDecodeEnd}if(e.key){let f=e.key.iv||new Uint32Array([0,0,0,t.mediaIndex+t.playlist.mediaSequence]);n.key=this.segmentKey(e.key),n.key.iv=f}if(e.map)n.map=this.initSegmentForMap(e.map);return n}saveTransferStats_(t){if(this.mediaRequests+=1,t)this.mediaBytesTransferred+=t.bytesReceived,this.mediaTransferDuration+=t.roundTripTime}saveBandwidthRelatedStats_(t,e){if(this.pendingSegment_.byteLength=e.bytesReceived,t<em){this.logger_(`Ignoring segment's bandwidth because its duration of ${t} is less than the min to record ${em}`);return}let a={bandwidthInfo:{from:this.bandwidth,to:e.bandwidth}};this.trigger({type:"bandwidthupdated",metadata:a}),this.bandwidth=e.bandwidth,this.roundTrip=e.roundTripTime}handleTimeout_(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}segmentRequestFinished_(t,e,a){if(this.callQueue_.length){this.callQueue_.push(this.segmentRequestFinished_.bind(this,t,e,a));return}if(this.saveTransferStats_(e.stats),!this.pendingSegment_)return;if(e.requestId!==this.pendingSegment_.requestId)return;if(t){if(this.pendingSegment_=null,this.state="READY",t.code===d0.ABORTED)return;if(this.pause(),t.code===d0.TIMEOUT){this.handleTimeout_();return}this.mediaRequestsErrored+=1,this.error(t),this.trigger("error");return}let i=this.pendingSegment_;if(this.saveBandwidthRelatedStats_(i.duration,e.stats),i.endOfAllRequests=e.endOfAllRequests,a.gopInfo)this.gopBuffer_=HI(this.gopBuffer_,a.gopInfo,this.safeAppend_);this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(i)}setTimeMapping_(t){let e=this.syncController_.mappingForTimeline(t);if(e!==null)this.timeMapping_=e}updateMediaSecondsLoaded_(t){if(typeof t.start==="number"&&typeof t.end==="number")this.mediaSecondsLoaded+=t.end-t.start;else this.mediaSecondsLoaded+=t.duration}shouldUpdateTransmuxerTimestampOffset_(t){if(t===null)return!1;if(this.loaderType_==="main"&&t!==this.sourceUpdater_.videoTimestampOffset())return!0;if(!this.audioDisabled_&&t!==this.sourceUpdater_.audioTimestampOffset())return!0;return!1}trueSegmentStart_({currentStart:t,playlist:e,mediaIndex:a,firstVideoFrameTimeForData:i,currentVideoTimestampOffset:s,useVideoTimingInfo:n,videoTimingInfo:l,audioTimingInfo:f}){if(typeof t<"u")return t;if(!n)return f.start;let o=e.segments[a-1];if(a===0||!o||typeof o.start>"u"||o.end!==i+s)return i;return l.start}waitForAppendsToComplete_(t){let e=this.getCurrentMediaInfo_(t);if(!e){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}let{hasAudio:a,hasVideo:i,isMuxed:s}=e,n=this.loaderType_==="main"&&i,l=!this.audioDisabled_&&a&&!s;if(t.waitingOnAppends=0,!t.hasAppendedData_){if(!t.timingInfo&&typeof t.timestampOffset==="number")this.isPendingTimestampOffset_=!0;if(t.timingInfo={start:0},t.waitingOnAppends++,!this.isPendingTimestampOffset_)this.updateSourceBufferTimestampOffset_(t),this.processMetadataQueue_();this.checkAppendsDone_(t);return}if(n)t.waitingOnAppends++;if(l)t.waitingOnAppends++;if(n)this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,t));if(l)this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,t))}checkAppendsDone_(t){if(this.checkForAbort_(t.requestId))return;if(t.waitingOnAppends--,t.waitingOnAppends===0)this.handleAppendsDone_()}checkForIllegalMediaSwitch(t){let e=NI(this.loaderType_,this.getCurrentMediaInfo_(),t);if(e)return this.error({message:e,playlistExclusionDuration:1/0}),this.trigger("error"),!0;return!1}updateSourceBufferTimestampOffset_(t){if(t.timestampOffset===null||typeof t.timingInfo.start!=="number"||t.changedTimestampOffset||this.loaderType_!=="main")return;let e=!1;if(t.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:t.segment.videoTimingInfo,audioTimingInfo:t.segment.audioTimingInfo,timingInfo:t.timingInfo}),t.changedTimestampOffset=!0,t.timestampOffset!==this.sourceUpdater_.videoTimestampOffset())this.sourceUpdater_.videoTimestampOffset(t.timestampOffset),e=!0;if(t.timestampOffset!==this.sourceUpdater_.audioTimestampOffset())this.sourceUpdater_.audioTimestampOffset(t.timestampOffset),e=!0;if(e)this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:t,audioTimingInfo:e,timingInfo:a}){if(!this.useDtsForTimestampOffset_)return a.start;if(t&&typeof t.transmuxedDecodeStart==="number")return t.transmuxedDecodeStart;if(e&&typeof e.transmuxedDecodeStart==="number")return e.transmuxedDecodeStart;return a.start}updateTimingInfoEnd_(t){t.timingInfo=t.timingInfo||{};let e=this.getMediaInfo_(),i=this.loaderType_==="main"&&e&&e.hasVideo&&t.videoTimingInfo?t.videoTimingInfo:t.audioTimingInfo;if(!i)return;t.timingInfo.end=typeof i.end==="number"?i.end:i.start+t.duration}handleAppendsDone_(){if(this.pendingSegment_){let f={segmentInfo:Xf({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:f})}if(!this.pendingSegment_){if(this.state="READY",!this.paused())this.monitorBuffer_();return}let t=this.pendingSegment_;if(t.part&&t.part.syncInfo)t.part.syncInfo.markAppended();else if(t.segment.syncInfo)t.segment.syncInfo.markAppended();if(this.updateTimingInfoEnd_(t),this.shouldSaveSegmentTimingInfo_)this.syncController_.saveSegmentTimingInfo({segmentInfo:t,shouldSaveTimelineMapping:this.loaderType_==="main"});let e=GI(t,this.sourceType_);if(e)if(e.severity==="warn")lt.log.warn(e.message);else this.logger_(e.message);if(this.recordThroughput_(t),this.pendingSegment_=null,this.state="READY",t.isSyncRequest){if(this.trigger("syncinfoupdate"),!t.hasAppendedData_){this.logger_(`Throwing away un-appended sync request ${xo(t)}`);return}}if(this.logger_(`Appended ${xo(t)}`),this.addSegmentMetadataCue_(t),this.fetchAtBuffer_=!0,this.currentTimeline_!==t.timeline){if(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:t.timeline}),this.loaderType_==="main"&&!this.audioDisabled_)this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:t.timeline})}this.currentTimeline_=t.timeline,this.trigger("syncinfoupdate");let{segment:a,part:i}=t,s=a.end&&this.currentTime_()-a.end>t.playlist.targetDuration*3,n=i&&i.end&&this.currentTime_()-i.end>t.playlist.partTargetDuration*3;if(s||n){this.logger_(`bad ${s?"segment":"part"} ${xo(t)}`),this.resetEverything();return}if(this.mediaIndex!==null)this.trigger("bandwidthupdate");if(this.trigger("progress"),this.mediaIndex=t.mediaIndex,this.partIndex=t.partIndex,this.isEndOfStream_(t.mediaIndex,t.playlist,t.partIndex))this.endOfStream();if(this.trigger("appended"),t.hasAppendedData_)this.mediaAppends++;if(!this.paused())this.monitorBuffer_()}recordThroughput_(t){if(t.duration<em){this.logger_(`Ignoring segment's throughput because its duration of ${t.duration} is less than the min to record ${em}`);return}let e=this.throughput.rate,a=Date.now()-t.endOfAllRequests+1,i=Math.floor(t.byteLength/a*8*1000);this.throughput.rate+=(i-e)/++this.throughput.count}addSegmentMetadataCue_(t){if(!this.segmentMetadataTrack_)return;let e=t.segment,a=e.start,i=e.end;if(!wS(a)||!wS(i))return;S2(a,i,this.segmentMetadataTrack_);let s=$.default.WebKitDataCue||$.default.VTTCue,n={custom:e.custom,dateTimeObject:e.dateTimeObject,dateTimeString:e.dateTimeString,programDateTime:e.programDateTime,bandwidth:t.playlist.attributes.BANDWIDTH,resolution:t.playlist.attributes.RESOLUTION,codecs:t.playlist.attributes.CODECS,byteLength:t.byteLength,uri:t.uri,timeline:t.timeline,playlist:t.playlist.id,start:a,end:i},l=JSON.stringify(n),f=new s(a,i,l);f.value=n,this.segmentMetadataTrack_.addCue(f)}}function g1(){}var Ak=function(t){if(typeof t!=="string")return t;return t.replace(/./,(e)=>e.toUpperCase())},XI=["video","audio"],$g=(t,e)=>{let a=e[`${t}Buffer`];return a&&a.updating||e.queuePending[t]},KI=(t,e)=>{for(let a=0;a<e.length;a++){let i=e[a];if(i.type==="mediaSource")return null;if(i.type===t)return a}return null},Zo=(t,e)=>{if(e.queue.length===0)return;let a=0,i=e.queue[a];if(i.type==="mediaSource"){if(!e.updating()&&e.mediaSource.readyState!=="closed"){if(e.queue.shift(),i.action(e),i.doneFn)i.doneFn();Zo("audio",e),Zo("video",e)}return}if(t==="mediaSource")return;if(!e.ready()||e.mediaSource.readyState==="closed"||$g(t,e))return;if(i.type!==t){if(a=KI(t,e.queue),a===null)return;i=e.queue[a]}if(e.queue.splice(a,1),e.queuePending[t]=i,i.action(t,e),!i.doneFn){e.queuePending[t]=null,Zo(t,e);return}},vk=(t,e)=>{let a=e[`${t}Buffer`],i=Ak(t);if(!a)return;a.removeEventListener("updateend",e[`on${i}UpdateEnd_`]),a.removeEventListener("error",e[`on${i}Error_`]),e.codecs[t]=null,e[`${t}Buffer`]=null},b0=(t,e)=>t&&e&&Array.prototype.indexOf.call(t.sourceBuffers,e)!==-1,tn={appendBuffer:(t,e,a)=>(i,s)=>{let n=s[`${i}Buffer`];if(!b0(s.mediaSource,n))return;s.logger_(`Appending segment ${e.mediaIndex}'s ${t.length} bytes to ${i}Buffer`);try{n.appendBuffer(t)}catch(l){s.logger_(`Error with code ${l.code} `+(l.code===Qy?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${i}Buffer`),s.queuePending[i]=null,a(l)}},remove:(t,e)=>(a,i)=>{let s=i[`${a}Buffer`];if(!b0(i.mediaSource,s))return;i.logger_(`Removing ${t} to ${e} from ${a}Buffer`);try{s.remove(t,e)}catch(n){i.logger_(`Remove ${t} to ${e} from ${a}Buffer failed`)}},timestampOffset:(t)=>(e,a)=>{let i=a[`${e}Buffer`];if(!b0(a.mediaSource,i))return;a.logger_(`Setting ${e}timestampOffset to ${t}`),i.timestampOffset=t},callback:(t)=>(e,a)=>{t()},endOfStream:(t)=>(e)=>{if(e.mediaSource.readyState!=="open")return;e.logger_(`Calling mediaSource endOfStream(${t||""})`);try{e.mediaSource.endOfStream(t)}catch(a){lt.log.warn("Failed to call media source endOfStream",a)}},duration:(t)=>(e)=>{e.logger_(`Setting mediaSource duration to ${t}`);try{e.mediaSource.duration=t}catch(a){lt.log.warn("Failed to set media source duration",a)}},abort:()=>(t,e)=>{if(e.mediaSource.readyState!=="open")return;let a=e[`${t}Buffer`];if(!b0(e.mediaSource,a))return;e.logger_(`calling abort on ${t}Buffer`);try{a.abort()}catch(i){lt.log.warn(`Failed to abort on ${t}Buffer`,i)}},addSourceBuffer:(t,e)=>(a)=>{let i=Ak(t),s=Ef(e);a.logger_(`Adding ${t}Buffer with codec ${e} to mediaSource`);let n=a.mediaSource.addSourceBuffer(s);n.addEventListener("updateend",a[`on${i}UpdateEnd_`]),n.addEventListener("error",a[`on${i}Error_`]),a.codecs[t]=e,a[`${t}Buffer`]=n},removeSourceBuffer:(t)=>(e)=>{let a=e[`${t}Buffer`];if(vk(t,e),!b0(e.mediaSource,a))return;e.logger_(`Removing ${t}Buffer with codec ${e.codecs[t]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(a)}catch(i){lt.log.warn(`Failed to removeSourceBuffer ${t}Buffer`,i)}},changeType:(t)=>(e,a)=>{let i=a[`${e}Buffer`],s=Ef(t);if(!b0(a.mediaSource,i))return;let n=t.substring(0,t.indexOf(".")),l=a.codecs[e];if(l.substring(0,l.indexOf("."))===n)return;let o={codecsChangeInfo:{from:l,to:t}};a.trigger({type:"codecschange",metadata:o}),a.logger_(`changing ${e}Buffer codec from ${l} to ${t}`);try{i.changeType(s),a.codecs[e]=t}catch(c){o.errorType=lt.Error.StreamingCodecsChangeError,o.error=c,c.metadata=o,a.error_=c,a.trigger("error"),lt.log.warn(`Failed to changeType on ${e}Buffer`,c)}}},en=({type:t,sourceUpdater:e,action:a,doneFn:i,name:s})=>{e.queue.push({type:t,action:a,doneFn:i,name:s}),Zo(t,e)},qS=(t,e)=>(a)=>{let i=e[`${t}Buffered`](),s=iU(i);if(e.logger_(`received "updateend" event for ${t} Source Buffer: `,s),e.queuePending[t]){let n=e.queuePending[t].doneFn;if(e.queuePending[t]=null,n)n(e[`${t}Error_`])}Zo(t,e)};class Z7 extends lt.EventTarget{constructor(t){super();this.mediaSource=t,this.sourceopenListener_=()=>Zo("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=_n("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=qS("video",this),this.onAudioUpdateEnd_=qS("audio",this),this.onVideoError_=(e)=>{this.videoError_=e},this.onAudioError_=(e)=>{this.audioError_=e},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(t){if(this.hasCreatedSourceBuffers())return;this.addOrChangeSourceBuffers(t),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady()}triggerReady(){if(this.ready()&&!this.triggeredReady_)this.triggeredReady_=!0,this.trigger("ready")}addSourceBuffer(t,e){en({type:"mediaSource",sourceUpdater:this,action:tn.addSourceBuffer(t,e),name:"addSourceBuffer"})}abort(t){en({type:t,sourceUpdater:this,action:tn.abort(t),name:"abort"})}removeSourceBuffer(t){if(!this.canRemoveSourceBuffer()){lt.log.error("removeSourceBuffer is not supported!");return}en({type:"mediaSource",sourceUpdater:this,action:tn.removeSourceBuffer(t),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!lt.browser.IS_FIREFOX&&$.default.MediaSource&&$.default.MediaSource.prototype&&typeof $.default.MediaSource.prototype.removeSourceBuffer==="function"}static canChangeType(){return $.default.SourceBuffer&&$.default.SourceBuffer.prototype&&typeof $.default.SourceBuffer.prototype.changeType==="function"}canChangeType(){return this.constructor.canChangeType()}changeType(t,e){if(!this.canChangeType()){lt.log.error("changeType is not supported!");return}en({type:t,sourceUpdater:this,action:tn.changeType(e),name:"changeType"})}addOrChangeSourceBuffers(t){if(!t||typeof t!=="object"||Object.keys(t).length===0)throw Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(t).forEach((e)=>{let a=t[e];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(e,a);if(this.canChangeType())this.changeType(e,a)})}appendBuffer(t,e){let{segmentInfo:a,type:i,bytes:s}=t;if(this.processedAppend_=!0,i==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([t,e]),this.logger_(`delayed audio append of ${s.length} until video append`);return}let n=e;if(en({type:i,sourceUpdater:this,action:tn.appendBuffer(s,a||{mediaIndex:-1},n),doneFn:e,name:"appendBuffer"}),i==="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((f)=>{this.appendBuffer.apply(this,f)})}}audioBuffered(){if(!b0(this.mediaSource,this.audioBuffer))return Hi();return this.audioBuffer.buffered?this.audioBuffer.buffered:Hi()}videoBuffered(){if(!b0(this.mediaSource,this.videoBuffer))return Hi();return this.videoBuffer.buffered?this.videoBuffer.buffered:Hi()}buffered(){let t=b0(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,e=b0(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;if(e&&!t)return this.audioBuffered();if(t&&!e)return this.videoBuffered();return nU(this.audioBuffered(),this.videoBuffered())}setDuration(t,e=g1){en({type:"mediaSource",sourceUpdater:this,action:tn.duration(t),name:"duration",doneFn:e})}endOfStream(t=null,e=g1){if(typeof t!=="string")t=void 0;en({type:"mediaSource",sourceUpdater:this,action:tn.endOfStream(t),name:"endOfStream",doneFn:e})}removeAudio(t,e,a=g1){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){a();return}en({type:"audio",sourceUpdater:this,action:tn.remove(t,e),doneFn:a,name:"remove"})}removeVideo(t,e,a=g1){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){a();return}en({type:"video",sourceUpdater:this,action:tn.remove(t,e),doneFn:a,name:"remove"})}updating(){if($g("audio",this)||$g("video",this))return!0;return!1}audioTimestampOffset(t){if(typeof t<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==t)en({type:"audio",sourceUpdater:this,action:tn.timestampOffset(t),name:"timestampOffset"}),this.audioTimestampOffset_=t;return this.audioTimestampOffset_}videoTimestampOffset(t){if(typeof t<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==t)en({type:"video",sourceUpdater:this,action:tn.timestampOffset(t),name:"timestampOffset"}),this.videoTimestampOffset_=t;return this.videoTimestampOffset_}audioQueueCallback(t){if(!this.audioBuffer)return;en({type:"audio",sourceUpdater:this,action:tn.callback(t),name:"callback"})}videoQueueCallback(t){if(!this.videoBuffer)return;en({type:"video",sourceUpdater:this,action:tn.callback(t),name:"callback"})}dispose(){if(this.trigger("dispose"),XI.forEach((t)=>{if(this.abort(t),this.canRemoveSourceBuffer())this.removeSourceBuffer(t);else this[`${t}QueueCallback`](()=>vk(t,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_)this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_);this.off()}}var AS=(t)=>decodeURIComponent(escape(String.fromCharCode.apply(null,t))),LI=(t)=>{let e=new Uint8Array(t);return Array.from(e).map((a)=>a.toString(16).padStart(2,"0")).join("")},vS=new Uint8Array(`
240
-
241
- `.split("").map((t)=>t.charCodeAt(0)));class Sk extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class yk extends Sm{constructor(t,e={}){super(t,e);this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=t.featuresNativeTextTracks,this.loadVttJs=t.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return Hi();let t=this.subtitlesTrack_.cues,e=t[0].startTime,a=t[t.length-1].startTime;return Hi([[e,a]])}initSegmentForMap(t,e=!1){if(!t)return null;let a=Am(t),i=this.initSegments_[a];if(e&&!i&&t.bytes){let s=vS.byteLength+t.bytes.byteLength,n=new Uint8Array(s);n.set(t.bytes),n.set(vS,t.bytes.byteLength),this.initSegments_[a]=i={resolvedUri:t.resolvedUri,byterange:t.byterange,bytes:n}}return i||t}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(t){if(typeof t>"u")return this.subtitlesTrack_;if(this.subtitlesTrack_=t,this.state==="INIT"&&this.couldBeginLoading_())this.init_();return this.subtitlesTrack_}remove(t,e){S2(t,e,this.subtitlesTrack_)}fillBuffer_(){let t=this.chooseNextRequest_();if(!t)return;if(this.syncController_.timestampOffsetForTimeline(t.timeline)===null){let e=()=>{if(this.state="READY",!this.paused())this.monitorBuffer_()};this.syncController_.one("timestampoffset",e),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(t)}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(t){while(t&&t.segment.empty){if(t.mediaIndex+1>=t.playlist.segments.length){t=null;break}t=this.generateSegmentInfo_({playlist:t.playlist,mediaIndex:t.mediaIndex+1,startOfSegment:t.startOfSegment+t.duration,isSyncRequest:t.isSyncRequest})}return t}stopForError(t){this.error(t),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(t,e,a){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(e.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(t){if(t.code===d0.TIMEOUT)this.handleTimeout_();if(t.code===d0.ABORTED)this.mediaRequestsAborted+=1;else this.mediaRequestsErrored+=1;this.stopForError(t);return}let i=this.pendingSegment_,s=a.mp4VttCues&&a.mp4VttCues.length;if(s)i.mp4VttCues=a.mp4VttCues;if(this.saveBandwidthRelatedStats_(i.duration,e.stats),e.key)this.segmentKey(e.key,!0);this.state="APPENDING",this.trigger("appending");let n=i.segment;if(n.map)n.map.bytes=e.map.bytes;if(i.bytes=e.bytes,typeof $.default.WebVTT!=="function"&&typeof this.loadVttJs==="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(t,e,a),()=>this.stopForError({message:"Error loading vtt.js"}));return}n.requested=!0;try{this.parseVTTCues_(i)}catch(l){this.stopForError({message:l.message,metadata:{errorType:lt.Error.StreamingVttParserError,error:l}});return}if(!s)this.updateTimeMapping_(i,this.syncController_.timelines[i.timeline],this.playlist_);if(i.cues.length)i.timingInfo={start:i.cues[0].startTime,end:i.cues[i.cues.length-1].endTime};else i.timingInfo={start:i.startOfSegment,end:i.startOfSegment+i.duration};if(i.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}i.byteLength=i.bytes.byteLength,this.mediaSecondsLoaded+=n.duration,i.cues.forEach((l)=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new $.default.VTTCue(l.startTime,l.endTime,l.text):l)}),BI(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(t,e){let a=t&&t.type==="vtt",i=e&&e.type==="text";if(a&&i)super.handleData_(t,e)}updateTimingInfoEnd_(){}parseMp4VttCues_(t){let e=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();t.mp4VttCues.forEach((a)=>{let i=a.start+e,s=a.end+e,n=new $.default.VTTCue(i,s,a.cueText);if(a.settings)a.settings.split(" ").forEach((l)=>{let f=l.split(":"),o=f[0],c=f[1];n[o]=isNaN(c)?c:Number(c)});t.cues.push(n)})}parseVTTCues_(t){let e,a=!1;if(typeof $.default.WebVTT!=="function")throw new Sk;if(t.cues=[],t.timestampmap={MPEGTS:0,LOCAL:0},t.mp4VttCues){this.parseMp4VttCues_(t);return}if(typeof $.default.TextDecoder==="function")e=new $.default.TextDecoder("utf8");else e=$.default.WebVTT.StringDecoder(),a=!0;let i=new $.default.WebVTT.Parser($.default,$.default.vttjs,e);if(i.oncue=t.cues.push.bind(t.cues),i.ontimestampmap=(n)=>{t.timestampmap=n},i.onparsingerror=(n)=>{lt.log.warn("Error encountered when parsing cues: "+n.message)},t.segment.map){let n=t.segment.map.bytes;if(a)n=AS(n);i.parse(n)}let s=t.bytes;if(a)s=AS(s);i.parse(s),i.flush()}updateTimeMapping_(t,e,a){let i=t.segment;if(!e)return;if(!t.cues.length){i.empty=!0;return}let{MPEGTS:s,LOCAL:n}=t.timestampmap,f=s/ql.ONE_SECOND_IN_TS-n+e.mapping;if(t.cues.forEach((o)=>{let c=o.endTime-o.startTime,u=this.handleRollover_(o.startTime+f,e.time);o.startTime=Math.max(u,0),o.endTime=Math.max(u+c,0)}),!a.syncInfo){let o=t.cues[0].startTime,c=t.cues[t.cues.length-1].startTime;a.syncInfo={mediaSequence:a.mediaSequence+t.mediaIndex,time:Math.min(o,c-i.duration)}}}handleRollover_(t,e){if(e===null)return t;let a=t*ql.ONE_SECOND_IN_TS,i=e*ql.ONE_SECOND_IN_TS,s;if(i<a)s=-8589934592;else s=8589934592;while(Math.abs(a-i)>4294967296)a+=s;return a/ql.ONE_SECOND_IN_TS}}var VI=function(t,e){let a=t.cues;for(let i=0;i<a.length;i++){let s=a[i];if(e>=s.adStartTime&&e<=s.adEndTime)return s}return null},YI=function(t,e,a=0){if(!t.segments)return;let i=a,s;for(let n=0;n<t.segments.length;n++){let l=t.segments[n];if(!s)s=VI(e,i+l.duration/2);if(s){if("cueIn"in l){s.endTime=i,s.adEndTime=i,i+=l.duration,s=null;continue}if(i<s.endTime){i+=l.duration;continue}s.endTime+=l.duration}else{if("cueOut"in l)s=new $.default.VTTCue(i,i+l.duration,l.cueOut),s.adStartTime=i,s.adEndTime=i+parseFloat(l.cueOut),e.addCue(s);if("cueOutCont"in l){let[f,o]=l.cueOutCont.split("/").map(parseFloat);s=new $.default.VTTCue(i,i+l.duration,""),s.adStartTime=i-f,s.adEndTime=s.adStartTime+o,e.addCue(s)}}i+=l.duration}};class Wg{constructor({start:t,end:e,segmentIndex:a,partIndex:i=null,appended:s=!1}){this.start_=t,this.end_=e,this.segmentIndex_=a,this.partIndex_=i,this.appended_=s}isInRange(t){return t>=this.start&&t<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 kk{constructor(t,e=[]){this.segmentSyncInfo_=t,this.partsSyncInfo_=e}get segmentSyncInfo(){return this.segmentSyncInfo_}get partsSyncInfo(){return this.partsSyncInfo_}get hasPartsSyncInfo(){return this.partsSyncInfo_.length>0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach((t)=>t.resetAppendedStatus())}}class $7{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((t)=>t.resetAppendStatus())}update(t,e){let{mediaSequence:a,segments:i}=t;if(this.isReliable_=this.isReliablePlaylist_(a,i),!this.isReliable_)return;return this.updateStorage_(i,a,this.calculateBaseTime_(a,i,e))}getSyncInfoForTime(t){for(let{segmentSyncInfo:e,partsSyncInfo:a}of this.storage_.values())if(!a.length){if(e.isInRange(t))return e}else for(let i of a)if(i.isInRange(t))return i;return null}getSyncInfoForMediaSequence(t){return this.storage_.get(t)}updateStorage_(t,e,a){let i=new Map,s=`
242
- `,n=a,l=e;this.start_=n,t.forEach((f,o)=>{let c=this.storage_.get(l),u=n,m=u+f.duration,p=Boolean(c&&c.segmentSyncInfo&&c.segmentSyncInfo.isAppended),w=new Wg({start:u,end:m,appended:p,segmentIndex:o});f.syncInfo=w;let d=n,v=(f.parts||[]).map((k,y)=>{let B=d,H=d+k.duration,M=Boolean(c&&c.partsSyncInfo&&c.partsSyncInfo[y]&&c.partsSyncInfo[y].isAppended),D=new Wg({start:B,end:H,appended:M,segmentIndex:o,partIndex:y});return d=H,s+=`Media Sequence: ${l}.${y} | Range: ${B} --> ${H} | Appended: ${M}
243
- `,k.syncInfo=D,D});i.set(l,new kk(w,v)),s+=`${qk(f.resolvedUri)} | Media Sequence: ${l} | Range: ${u} --> ${m} | Appended: ${p}
244
- `,l++,n=m}),this.end_=n,this.storage_=i,this.diagnostics_=s}calculateBaseTime_(t,e,a){if(!this.storage_.size)return 0;if(this.storage_.has(t))return this.storage_.get(t).segmentSyncInfo.start;let i=Math.min(...this.storage_.keys());if(t<i){let s=i-t,n=this.storage_.get(i).segmentSyncInfo.start;for(let l=0;l<s;l++){let f=e[l];n-=f.duration}return n}return a}isReliablePlaylist_(t,e){return t!==void 0&&t!==null&&Array.isArray(e)&&e.length}}class Pg extends $7{constructor(t){super();this.parent_=t}calculateBaseTime_(t,e,a){if(!this.storage_.size){let i=this.parent_.getSyncInfoForMediaSequence(t);if(i)return i.segmentSyncInfo.start;return 0}return super.calculateBaseTime_(t,e,a)}}var JI=86400,Bg=[{name:"VOD",run:(t,e,a,i,s)=>{if(a!==1/0)return{time:0,segmentIndex:0,partIndex:null};return null}},{name:"MediaSequence",run:(t,e,a,i,s,n)=>{let l=t.getMediaSequenceSync(n);if(!l)return null;if(!l.isReliable)return null;let f=l.getSyncInfoForTime(s);if(!f)return null;return{time:f.start,partIndex:f.partIndex,segmentIndex:f.segmentIndex}}},{name:"ProgramDateTime",run:(t,e,a,i,s)=>{if(!Object.keys(t.timelineToDatetimeMappings).length)return null;let n=null,l=null,f=Gg(e);s=s||0;for(let o=0;o<f.length;o++){let c=e.endList||s===0?o:f.length-(o+1),u=f[c],m=u.segment,p=t.timelineToDatetimeMappings[m.timeline];if(!p||!m.dateTimeObject)continue;let d=m.dateTimeObject.getTime()/1000+p;if(m.parts&&typeof u.partIndex==="number")for(let k=0;k<u.partIndex;k++)d+=m.parts[k].duration;let v=Math.abs(s-d);if(l!==null&&(v===0||l<v))break;l=v,n={time:d,segmentIndex:u.segmentIndex,partIndex:u.partIndex}}return n}},{name:"Segment",run:(t,e,a,i,s)=>{let n=null,l=null;s=s||0;let f=Gg(e);for(let o=0;o<f.length;o++){let c=e.endList||s===0?o:f.length-(o+1),u=f[c],m=u.segment,p=u.part&&u.part.start||m&&m.start;if(m.timeline===i&&typeof p<"u"){let w=Math.abs(s-p);if(l!==null&&l<w)break;if(!n||l===null||l>=w)l=w,n={time:p,segmentIndex:u.segmentIndex,partIndex:u.partIndex}}}return n}},{name:"Discontinuity",run:(t,e,a,i,s)=>{let n=null;if(s=s||0,e.discontinuityStarts&&e.discontinuityStarts.length){let l=null;for(let f=0;f<e.discontinuityStarts.length;f++){let o=e.discontinuityStarts[f],c=e.discontinuitySequence+f+1,u=t.discontinuities[c];if(u){let m=Math.abs(s-u.time);if(l!==null&&l<m)break;if(!n||l===null||l>=m)l=m,n={time:u.time,segmentIndex:o,partIndex:null}}}}return n}},{name:"Playlist",run:(t,e,a,i,s)=>{if(e.syncInfo)return{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null};return null}}];class Ck extends lt.EventTarget{constructor(t={}){super();this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};let e=new $7,a=new Pg(e),i=new Pg(e);this.mediaSequenceStorage_={main:e,audio:a,vtt:i},this.logger_=_n("SyncController")}getMediaSequenceSync(t){return this.mediaSequenceStorage_[t]||null}getSyncPoint(t,e,a,i,s){if(e!==1/0)return Bg.find(({name:f})=>f==="VOD").run(this,t,e);let n=this.runStrategies_(t,e,a,i,s);if(!n.length)return null;for(let l of n){let{syncPoint:f,strategy:o}=l,{segmentIndex:c,time:u}=f;if(c<0)continue;let m=t.segments[c],p=u,w=p+m.duration;if(this.logger_(`Strategy: ${o}. Current time: ${i}. selected segment: ${c}. Time: [${p} -> ${w}]}`),i>=p&&i<w)return this.logger_("Found sync point with exact match: ",f),f}return this.selectSyncPoint_(n,{key:"time",value:i})}getExpiredTime(t,e){if(!t||!t.segments)return null;let a=this.runStrategies_(t,e,t.discontinuitySequence,0);if(!a.length)return null;let i=this.selectSyncPoint_(a,{key:"segmentIndex",value:0});if(i.segmentIndex>0)i.time*=-1;return Math.abs(i.time+_2({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:i.segmentIndex,endIndex:0}))}runStrategies_(t,e,a,i,s){let n=[];for(let l=0;l<Bg.length;l++){let f=Bg[l],o=f.run(this,t,e,a,i,s);if(o)o.strategy=f.name,n.push({strategy:f.name,syncPoint:o})}return n}selectSyncPoint_(t,e){let a=t[0].syncPoint,i=Math.abs(t[0].syncPoint[e.key]-e.value),s=t[0].strategy;for(let n=1;n<t.length;n++){let l=Math.abs(t[n].syncPoint[e.key]-e.value);if(l<i)i=l,a=t[n].syncPoint,s=t[n].strategy}return this.logger_(`syncPoint for [${e.key}: ${e.value}] chosen with strategy [${s}]: [time:${a.time}, segmentIndex:${a.segmentIndex}`+(typeof a.partIndex==="number"?`,partIndex:${a.partIndex}`:"")+"]"),a}saveExpiredSegmentInfo(t,e){let a=e.mediaSequence-t.mediaSequence;if(a>JI){lt.log.warn(`Not saving expired segment info. Media sequence gap ${a} is too large.`);return}for(let i=a-1;i>=0;i--){let s=t.segments[i];if(s&&typeof s.start<"u"){e.syncInfo={mediaSequence:t.mediaSequence+i,time:s.start},this.logger_(`playlist refresh sync: [time:${e.syncInfo.time}, mediaSequence: ${e.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(t){if(this.timelineToDatetimeMappings={},t.segments&&t.segments.length&&t.segments[0].dateTimeObject){let e=t.segments[0],a=e.dateTimeObject.getTime()/1000;this.timelineToDatetimeMappings[e.timeline]=-a}}saveSegmentTimingInfo({segmentInfo:t,shouldSaveTimelineMapping:e}){let a=this.calculateSegmentTimeMapping_(t,t.timingInfo,e),i=t.segment;if(a){if(this.saveDiscontinuitySyncInfo_(t),!t.playlist.syncInfo)t.playlist.syncInfo={mediaSequence:t.playlist.mediaSequence+t.mediaIndex,time:i.start}}let s=i.dateTimeObject;if(i.discontinuity&&e&&s)this.timelineToDatetimeMappings[i.timeline]=-(s.getTime()/1000)}timestampOffsetForTimeline(t){if(typeof this.timelines[t]>"u")return null;return this.timelines[t].time}mappingForTimeline(t){if(typeof this.timelines[t]>"u")return null;return this.timelines[t].mapping}calculateSegmentTimeMapping_(t,e,a){let{segment:i,part:s}=t,n=this.timelines[t.timeline],l,f;if(typeof t.timestampOffset==="number"){if(n={time:t.startOfSegment,mapping:t.startOfSegment-e.start},a)this.timelines[t.timeline]=n,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${t.timeline}: [time: ${n.time}] [mapping: ${n.mapping}]`);l=t.startOfSegment,f=e.end+n.mapping}else if(n)l=e.start+n.mapping,f=e.end+n.mapping;else return!1;if(s)s.start=l,s.end=f;if(!i.start||l<i.start)i.start=l;return i.end=f,!0}saveDiscontinuitySyncInfo_(t){let{playlist:e,segment:a}=t;if(a.discontinuity)this.discontinuities[a.timeline]={time:a.start,accuracy:0};else if(e.discontinuityStarts&&e.discontinuityStarts.length)for(let i=0;i<e.discontinuityStarts.length;i++){let s=e.discontinuityStarts[i],n=e.discontinuitySequence+i+1,l=s-t.mediaIndex,f=Math.abs(l);if(!this.discontinuities[n]||this.discontinuities[n].accuracy>f){let o;if(l<0)o=a.start-_2({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:t.mediaIndex,endIndex:s});else o=a.end+_2({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:t.mediaIndex+1,endIndex:s});this.discontinuities[n]={time:o,accuracy:f}}}}dispose(){this.trigger("dispose"),this.off()}}class _k extends lt.EventTarget{constructor(){super();this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(t){this.pendingTimelineChanges_[t]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:t,from:e,to:a}){if(typeof e==="number"&&typeof a==="number")this.pendingTimelineChanges_[t]={type:t,from:e,to:a},this.trigger("pendingtimelinechange");return this.pendingTimelineChanges_[t]}lastTimelineChange({type:t,from:e,to:a}){if(typeof e==="number"&&typeof a==="number"){this.lastTimelineChanges_[t]={type:t,from:e,to:a},delete this.pendingTimelineChanges_[t];let i={timelineChangeInfo:{from:e,to:a}};this.trigger({type:"timelinechange",metadata:i})}return this.lastTimelineChanges_[t]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}var QI=ok(hk(function(){var t=function(){function v(){this.listeners={}}var k=v.prototype;return k.on=function(B,H){if(!this.listeners[B])this.listeners[B]=[];this.listeners[B].push(H)},k.off=function(B,H){if(!this.listeners[B])return!1;var M=this.listeners[B].indexOf(H);return this.listeners[B]=this.listeners[B].slice(0),this.listeners[B].splice(M,1),M>-1},k.trigger=function(B){var H=this.listeners[B];if(!H)return;if(arguments.length===2){var M=H.length;for(var D=0;D<M;++D)H[D].call(this,arguments[1])}else{var T=Array.prototype.slice.call(arguments,1),z=H.length;for(var E=0;E<z;++E)H[E].apply(this,T)}},k.dispose=function(){this.listeners={}},k.pipe=function(B){this.on("data",function(H){B.push(H)})},v}();/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */function e(v){return v.subarray(0,v.byteLength-v[v.byteLength-1])}/*! @name aes-decrypter @version 4.0.2 @license Apache-2.0 */let a=function(){let v=[[[],[],[],[],[]],[[],[],[],[],[]]],k=v[0],y=v[1],B=k[4],H=y[4],M,D,T,z=[],E=[],V,tt,at,Q,Z,J;for(M=0;M<256;M++)E[(z[M]=M<<1^(M>>7)*283)^M]=M;for(D=T=0;!B[D];D^=V||1,T=E[T]||1){Q=T^T<<1^T<<2^T<<3^T<<4,Q=Q>>8^Q&255^99,B[D]=Q,H[Q]=D,at=z[tt=z[V=z[D]]],J=at*16843009^tt*65537^V*257^D*16843008,Z=z[Q]*257^Q*16843008;for(M=0;M<4;M++)k[M][D]=Z=Z<<24^Z>>>8,y[M][Q]=J=J<<24^J>>>8}for(M=0;M<5;M++)k[M]=k[M].slice(0),y[M]=y[M].slice(0);return v},i=null;class s{constructor(v){if(!i)i=a();this._tables=[[i[0][0].slice(),i[0][1].slice(),i[0][2].slice(),i[0][3].slice(),i[0][4].slice()],[i[1][0].slice(),i[1][1].slice(),i[1][2].slice(),i[1][3].slice(),i[1][4].slice()]];let k,y,B,H=this._tables[0][4],M=this._tables[1],D=v.length,T=1;if(D!==4&&D!==6&&D!==8)throw Error("Invalid aes key size");let z=v.slice(0),E=[];this._key=[z,E];for(k=D;k<4*D+28;k++){if(B=z[k-1],k%D===0||D===8&&k%D===4){if(B=H[B>>>24]<<24^H[B>>16&255]<<16^H[B>>8&255]<<8^H[B&255],k%D===0)B=B<<8^B>>>24^T<<24,T=T<<1^(T>>7)*283}z[k]=z[k-D]^B}for(y=0;k;y++,k--)if(B=z[y&3?k:k-4],k<=4||y<4)E[y]=B;else E[y]=M[0][H[B>>>24]]^M[1][H[B>>16&255]]^M[2][H[B>>8&255]]^M[3][H[B&255]]}decrypt(v,k,y,B,H,M){let D=this._key[1],T=v^D[0],z=B^D[1],E=y^D[2],V=k^D[3],tt,at,Q,Z=D.length/4-2,J,Y=4,W=this._tables[1],ft=W[0],nt=W[1],qt=W[2],R=W[3],ct=W[4];for(J=0;J<Z;J++)tt=ft[T>>>24]^nt[z>>16&255]^qt[E>>8&255]^R[V&255]^D[Y],at=ft[z>>>24]^nt[E>>16&255]^qt[V>>8&255]^R[T&255]^D[Y+1],Q=ft[E>>>24]^nt[V>>16&255]^qt[T>>8&255]^R[z&255]^D[Y+2],V=ft[V>>>24]^nt[T>>16&255]^qt[z>>8&255]^R[E&255]^D[Y+3],Y+=4,T=tt,z=at,E=Q;for(J=0;J<4;J++)H[(3&-J)+M]=ct[T>>>24]<<24^ct[z>>16&255]<<16^ct[E>>8&255]<<8^ct[V&255]^D[Y++],tt=T,T=z,z=E,E=V,V=tt}}class n extends t{constructor(){super(t);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(v){if(this.jobs.push(v),!this.timeout_)this.timeout_=setTimeout(this.processJob_.bind(this),this.delay)}}let l=function(v){return v<<24|(v&65280)<<8|(v&16711680)>>8|v>>>24},f=function(v,k,y){let B=new Int32Array(v.buffer,v.byteOffset,v.byteLength>>2),H=new s(Array.prototype.slice.call(k)),M=new Uint8Array(v.byteLength),D=new Int32Array(M.buffer),T,z,E,V,tt,at,Q,Z,J;T=y[0],z=y[1],E=y[2],V=y[3];for(J=0;J<B.length;J+=4)tt=l(B[J]),at=l(B[J+1]),Q=l(B[J+2]),Z=l(B[J+3]),H.decrypt(tt,at,Q,Z,D,J),D[J]=l(D[J]^T),D[J+1]=l(D[J+1]^z),D[J+2]=l(D[J+2]^E),D[J+3]=l(D[J+3]^V),T=tt,z=at,E=Q,V=Z;return M};class o{constructor(v,k,y,B){let H=o.STEP,M=new Int32Array(v.buffer),D=new Uint8Array(v.byteLength),T=0;this.asyncStream_=new n,this.asyncStream_.push(this.decryptChunk_(M.subarray(T,T+H),k,y,D));for(T=H;T<M.length;T+=H)y=new Uint32Array([l(M[T-4]),l(M[T-3]),l(M[T-2]),l(M[T-1])]),this.asyncStream_.push(this.decryptChunk_(M.subarray(T,T+H),k,y,D));this.asyncStream_.push(function(){B(null,e(D))})}static get STEP(){return 32000}decryptChunk_(v,k,y,B){return function(){let H=f(v,k,y);B.set(H,v.byteOffset)}}}var c=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},u;if(typeof window<"u")u=window;else if(typeof c<"u")u=c;else if(typeof self<"u")u=self;else u={};var m=u,p=function(k){if(ArrayBuffer.isView==="function")return ArrayBuffer.isView(k);return k&&k.buffer instanceof ArrayBuffer},w=m.BigInt||Number;w("0x1"),w("0x100"),w("0x10000"),w("0x1000000"),w("0x100000000"),w("0x10000000000"),w("0x1000000000000"),w("0x100000000000000"),w("0x10000000000000000"),function(){var v=new Uint16Array([65484]),k=new Uint8Array(v.buffer,v.byteOffset,v.byteLength);if(k[0]===255)return"big";if(k[0]===204)return"little";return"unknown"}();let d=function(v){let k={};return Object.keys(v).forEach((y)=>{let B=v[y];if(p(B))k[y]={bytes:B.buffer,byteOffset:B.byteOffset,byteLength:B.byteLength};else k[y]=B}),k};self.onmessage=function(v){let k=v.data,y=new Uint8Array(k.encrypted.bytes,k.encrypted.byteOffset,k.encrypted.byteLength),B=new Uint32Array(k.key.bytes,k.key.byteOffset,k.key.byteLength/4),H=new Uint32Array(k.iv.bytes,k.iv.byteOffset,k.iv.byteLength/4);new o(y,B,H,function(M,D){self.postMessage(d({source:k.source,decrypted:D}),[D.buffer])})}})),ZI=rk(QI),$I=(t)=>{let e=t.default?"main":"alternative";if(t.characteristics&&t.characteristics.indexOf("public.accessibility.describes-video")>=0)e="main-desc";return e},Fk=(t,e)=>{if(t.abort(),t.pause(),e&&e.activePlaylistLoader)e.activePlaylistLoader.pause(),e.activePlaylistLoader=null},t7=(t,e)=>{e.activePlaylistLoader=t,t.load()},WI=(t,e)=>()=>{let{segmentLoaders:{[t]:a,main:i},mediaTypes:{[t]:s}}=e,n=s.activeTrack(),l=s.getActiveGroup(),f=s.activePlaylistLoader,o=s.lastGroup_;if(l&&o&&l.id===o.id)return;if(s.lastGroup_=l,s.lastTrack_=n,Fk(a,s),!l||l.isMainPlaylist)return;if(!l.playlistLoader){if(f)i.resetEverything();return}a.resyncLoader(),t7(l.playlistLoader,s)},PI=(t,e)=>()=>{let{segmentLoaders:{[t]:a},mediaTypes:{[t]:i}}=e;i.lastGroup_=null,a.abort(),a.pause()},tG=(t,e)=>()=>{let{mainPlaylistLoader:a,segmentLoaders:{[t]:i,main:s},mediaTypes:{[t]:n}}=e,l=n.activeTrack(),f=n.getActiveGroup(),o=n.activePlaylistLoader,c=n.lastTrack_;if(c&&l&&c.id===l.id)return;if(n.lastGroup_=f,n.lastTrack_=l,Fk(i,n),!f)return;if(f.isMainPlaylist){if(!l||!c||l.id===c.id)return;let u=e.vhs.playlistController_,m=u.selectPlaylist();if(u.media()===m)return;n.logger_(`track change. Switching main audio from ${c.id} to ${l.id}`),a.pause(),s.resetEverything(),u.fastQualityChange_(m);return}if(t==="AUDIO"){if(!f.playlistLoader){s.setAudio(!0),s.resetEverything();return}i.setAudio(!0),s.setAudio(!1)}if(o===f.playlistLoader){t7(f.playlistLoader,n);return}if(i.track)i.track(l);i.resetEverything(),t7(f.playlistLoader,n)},ym={AUDIO:(t,e)=>()=>{let{mediaTypes:{[t]:a},excludePlaylist:i}=e,s=a.activeTrack(),n=a.activeGroup(),l=(n.filter((o)=>o.default)[0]||n[0]).id,f=a.tracks[l];if(s===f){i({error:{message:"Problem encountered loading the default audio track."}});return}lt.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(let o in a.tracks)a.tracks[o].enabled=a.tracks[o]===f;a.onTrackChanged()},SUBTITLES:(t,e)=>()=>{let{mediaTypes:{[t]:a}}=e;lt.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");let i=a.activeTrack();if(i)i.mode="disabled";a.onTrackChanged()}},SS={AUDIO:(t,e,a)=>{if(!e)return;let{tech:i,requestOptions:s,segmentLoaders:{[t]:n}}=a;e.on("loadedmetadata",()=>{let l=e.media();if(n.playlist(l,s),!i.paused()||l.endList&&i.preload()!=="none")n.load()}),e.on("loadedplaylist",()=>{if(n.playlist(e.media(),s),!i.paused())n.load()}),e.on("error",ym[t](t,a))},SUBTITLES:(t,e,a)=>{let{tech:i,requestOptions:s,segmentLoaders:{[t]:n},mediaTypes:{[t]:l}}=a;e.on("loadedmetadata",()=>{let f=e.media();if(n.playlist(f,s),n.track(l.activeTrack()),!i.paused()||f.endList&&i.preload()!=="none")n.load()}),e.on("loadedplaylist",()=>{if(n.playlist(e.media(),s),!i.paused())n.load()}),e.on("error",ym[t](t,a))}},eG={AUDIO:(t,e)=>{let{vhs:a,sourceType:i,segmentLoaders:{[t]:s},requestOptions:n,main:{mediaGroups:l},mediaTypes:{[t]:{groups:f,tracks:o,logger_:c}},mainPlaylistLoader:u}=e,m=z2(u.main);if(!l[t]||Object.keys(l[t]).length===0){if(l[t]={main:{default:{default:!0}}},m)l[t].main.default.playlists=u.main.playlists}for(let p in l[t]){if(!f[p])f[p]=[];for(let w in l[t][p]){let d=l[t][p][w],v;if(m)c(`AUDIO group '${p}' label '${w}' is a main playlist`),d.isMainPlaylist=!0,v=null;else if(i==="vhs-json"&&d.playlists)v=new Lf(d.playlists[0],a,n);else if(d.resolvedUri)v=new Lf(d.resolvedUri,a,n);else if(d.playlists&&i==="dash")v=new vm(d.playlists[0],a,n,u);else v=null;if(d=aa({id:w,playlistLoader:v},d),SS[t](t,d.playlistLoader,e),f[p].push(d),typeof o[w]>"u"){let k=new lt.AudioTrack({id:w,kind:$I(d),enabled:!1,language:d.language,default:d.default,label:w});o[w]=k}}}s.on("error",ym[t](t,e))},SUBTITLES:(t,e)=>{let{tech:a,vhs:i,sourceType:s,segmentLoaders:{[t]:n},requestOptions:l,main:{mediaGroups:f},mediaTypes:{[t]:{groups:o,tracks:c}},mainPlaylistLoader:u}=e;for(let m in f[t]){if(!o[m])o[m]=[];for(let p in f[t][m]){if(!i.options_.useForcedSubtitles&&f[t][m][p].forced)continue;let w=f[t][m][p],d;if(s==="hls")d=new Lf(w.resolvedUri,i,l);else if(s==="dash"){if(!w.playlists.filter((k)=>k.excludeUntil!==1/0).length)return;d=new vm(w.playlists[0],i,l,u)}else if(s==="vhs-json")d=new Lf(w.playlists?w.playlists[0]:w.resolvedUri,i,l);if(w=aa({id:p,playlistLoader:d},w),SS[t](t,w.playlistLoader,e),o[m].push(w),typeof c[p]>"u"){let v=a.addRemoteTextTrack({id:p,kind:"subtitles",default:w.default&&w.autoselect,language:w.language,label:p},!1).track;c[p]=v}}}n.on("error",ym[t](t,e))},"CLOSED-CAPTIONS":(t,e)=>{let{tech:a,main:{mediaGroups:i},mediaTypes:{[t]:{groups:s,tracks:n}}}=e;for(let l in i[t]){if(!s[l])s[l]=[];for(let f in i[t][l]){let o=i[t][l][f];if(!/^(?:CC|SERVICE)/.test(o.instreamId))continue;let c=a.options_.vhs&&a.options_.vhs.captionServices||{},u={label:f,language:o.language,instreamId:o.instreamId,default:o.default&&o.autoselect};if(c[u.instreamId])u=aa(u,c[u.instreamId]);if(u.default===void 0)delete u.default;if(s[l].push(aa({id:f},o)),typeof n[f]>"u"){let m=a.addRemoteTextTrack({id:u.instreamId,kind:"captions",default:u.default,language:u.language,label:u.label},!1).track;n[f]=m}}}}},Bk=(t,e)=>{for(let a=0;a<t.length;a++){if(Y7(e,t[a]))return!0;if(t[a].playlists&&Bk(t[a].playlists,e))return!0}return!1},aG=(t,e)=>(a)=>{let{mainPlaylistLoader:i,mediaTypes:{[t]:{groups:s}}}=e,n=i.media();if(!n)return null;let l=null;if(n.attributes[t])l=s[n.attributes[t]];let f=Object.keys(s);if(!l){if(t==="AUDIO"&&f.length>1&&z2(e.main))for(let o=0;o<f.length;o++){let c=s[f[o]];if(Bk(c,n)){l=c;break}}else if(s.main)l=s.main;else if(f.length===1)l=s[f[0]]}if(typeof a>"u")return l;if(a===null||!l)return null;return l.filter((o)=>o.id===a.id)[0]||null},iG={AUDIO:(t,e)=>()=>{let{mediaTypes:{[t]:{tracks:a}}}=e;for(let i in a)if(a[i].enabled)return a[i];return null},SUBTITLES:(t,e)=>()=>{let{mediaTypes:{[t]:{tracks:a}}}=e;for(let i in a)if(a[i].mode==="showing"||a[i].mode==="hidden")return a[i];return null}},sG=(t,{mediaTypes:e})=>()=>{let a=e[t].activeTrack();if(!a)return null;return e[t].activeGroup(a)},nG=(t)=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((c)=>{eG[c](c,t)});let{mediaTypes:e,mainPlaylistLoader:a,tech:i,vhs:s,segmentLoaders:{["AUDIO"]:n,main:l}}=t;["AUDIO","SUBTITLES"].forEach((c)=>{e[c].activeGroup=aG(c,t),e[c].activeTrack=iG[c](c,t),e[c].onGroupChanged=WI(c,t),e[c].onGroupChanging=PI(c,t),e[c].onTrackChanged=tG(c,t),e[c].getActiveGroup=sG(c,t)});let f=e.AUDIO.activeGroup();if(f){let c=(f.filter((m)=>m.default)[0]||f[0]).id;if(e.AUDIO.tracks[c].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),!e.AUDIO.getActiveGroup().playlistLoader)l.setAudio(!0);else l.setAudio(!1),n.setAudio(!0)}a.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach((c)=>e[c].onGroupChanged())}),a.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach((c)=>e[c].onGroupChanging())});let o=()=>{e.AUDIO.onTrackChanged(),i.trigger({type:"usage",name:"vhs-audio-change"})};i.audioTracks().addEventListener("change",o),i.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),s.on("dispose",()=>{i.audioTracks().removeEventListener("change",o),i.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),i.clearTracks("audio");for(let c in e.AUDIO.tracks)i.audioTracks().addTrack(e.AUDIO.tracks[c])},lG=()=>{let t={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((e)=>{t[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:g1,activeTrack:g1,getActiveGroup:g1,onGroupChanged:g1,onTrackChanged:g1,lastTrack_:null,logger_:_n(`MediaGroups[${e}]`)}}),t};class e7{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(t){if(t===1)this.version_=t}set ttl(t){this.ttl_=t||300}set reloadUri(t){if(t)this.reloadUri_=Ms(this.reloadUri_,t)}set priority(t){if(t&&t.length)this.priority_=t}set pathwayClones(t){if(t&&t.length)this.pathwayClones_=new Map(t.map((e)=>[e.ID,e]))}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 Ok extends lt.EventTarget{constructor(t,e){super();this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new e7,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_=_n("Content Steering"),this.xhr_=t,this.getBandwidth_=e}assignTagProperties(t,e){this.manifestType_=e.serverUri?"HLS":"DASH";let a=e.serverUri||e.serverURL;if(!a){this.logger_(`steering manifest URL is ${a}, cannot request steering manifest.`),this.trigger("error");return}if(a.startsWith("data:")){this.decodeDataUriManifest_(a.substring(a.indexOf(",")+1));return}if(this.steeringManifest.reloadUri=Ms(t,a),this.defaultPathway=e.pathwayId||e.defaultServiceLocation,this.queryBeforeStart=e.queryBeforeStart,this.proxyServerUrl_=e.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart)this.trigger("content-steering")}requestSteeringManifest(t){let e=this.steeringManifest.reloadUri;if(!e)return;let a=t?e:this.getRequestURI(e);if(!a){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}let i={contentSteeringInfo:{uri:a}};this.trigger({type:"contentsteeringloadstart",metadata:i}),this.request_=this.xhr_({uri:a,requestType:"content-steering-manifest"},(s,n)=>{if(s){if(n.status===410){this.logger_(`manifest request 410 ${s}.`),this.logger_(`There will be no more content steering requests to ${a} this session.`),this.excludedSteeringManifestURLs.add(a);return}if(n.status===429){let o=n.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${s}.`),this.logger_(`content steering will retry in ${o} seconds.`),this.startTTLTimeout_(parseInt(o,10));return}this.logger_(`manifest failed to load ${s}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:i});let l;try{l=JSON.parse(this.request_.responseText)}catch(o){let c={errorType:lt.Error.StreamingContentSteeringParserError,error:o};this.trigger({type:"error",metadata:c})}this.assignSteeringProperties_(l);let f={contentSteeringInfo:i.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:f}),this.startTTLTimeout_()})}setProxyServerUrl_(t){let e=new $.default.URL(t),a=new $.default.URL(this.proxyServerUrl_);return a.searchParams.set("url",encodeURI(e.toString())),this.setSteeringParams_(a.toString())}decodeDataUriManifest_(t){let e=JSON.parse($.default.atob(t));this.assignSteeringProperties_(e)}setSteeringParams_(t){let e=new $.default.URL(t),a=this.getPathway(),i=this.getBandwidth_();if(a){let s=`_${this.manifestType_}_pathway`;e.searchParams.set(s,a)}if(i){let s=`_${this.manifestType_}_throughput`;e.searchParams.set(s,i)}return e.toString()}assignSteeringProperties_(t){if(this.steeringManifest.version=t.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${t.VERSION}, which is not supported.`),this.trigger("error");return}if(this.steeringManifest.ttl=t.TTL,this.steeringManifest.reloadUri=t["RELOAD-URI"],this.steeringManifest.priority=t["PATHWAY-PRIORITY"]||t["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=t["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 a=((i)=>{for(let s of i)if(this.availablePathways_.has(s))return s;return[...this.availablePathways_][0]})(this.steeringManifest.priority);if(this.currentPathway!==a)this.currentPathway=a,this.trigger("content-steering")}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(t){if(!t)return null;let e=(i)=>this.excludedSteeringManifestURLs.has(i);if(this.proxyServerUrl_){let i=this.setProxyServerUrl_(t);if(!e(i))return i}let a=this.setSteeringParams_(t);if(!e(a))return a;return null}startTTLTimeout_(t=this.steeringManifest.ttl){let e=t*1000;this.ttlTimeout_=$.default.setTimeout(()=>{this.requestSteeringManifest()},e)}clearTTLTimeout_(){$.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 e7}addAvailablePathway(t){if(t)this.availablePathways_.add(t)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(t){return this.availablePathways_.delete(t)}didDASHTagChange(t,e){return!e&&this.steeringManifest.reloadUri||e&&(Ms(t,e.serverURL)!==this.steeringManifest.reloadUri||e.defaultServiceLocation!==this.defaultPathway||e.queryBeforeStart!==this.queryBeforeStart||e.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}var fG=(t,e)=>{let a=null;return(...i)=>{clearTimeout(a),a=setTimeout(()=>{t.apply(null,i)},e)}},rG=10,u1,oG=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],hG=function(t){return this.audioSegmentLoader_[t]+this.mainSegmentLoader_[t]},cG=function({currentPlaylist:t,buffered:e,currentTime:a,nextPlaylist:i,bufferLowWaterLine:s,bufferHighWaterLine:n,duration:l,bufferBasedABR:f,log:o}){if(!i)return lt.log.warn("We received no playlist to switch to. Please check your stream."),!1;let c=`allowing switch ${t&&t.id||"null"} -> ${i.id}`;if(!t)return o(`${c} as current playlist is not set`),!0;if(i.id===t.id)return!1;let u=Boolean(Io(e,a).length);if(!t.endList){if(!u&&typeof t.partTargetDuration==="number")return o(`not ${c} as current playlist is live llhls, but currentTime isn't in buffered.`),!1;return o(`${c} as current playlist is live`),!0}let m=K7(e,a),p=f?Oi.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Oi.MAX_BUFFER_LOW_WATER_LINE;if(l<p)return o(`${c} as duration < max low water line (${l} < ${p})`),!0;let w=i.attributes.BANDWIDTH,d=t.attributes.BANDWIDTH;if(w<d&&(!f||m<n)){let v=`${c} as next bandwidth < current bandwidth (${w} < ${d})`;if(f)v+=` and forwardBuffer < bufferHighWaterLine (${m} < ${n})`;return o(v),!0}if((!f||w>d)&&m>=s){let v=`${c} as forwardBuffer >= bufferLowWaterLine (${m} >= ${s})`;if(f)v+=` and next bandwidth > current bandwidth (${w} > ${d})`;return o(v),!0}return o(`not ${c} as no switching criteria met`),!1};class Hk extends lt.EventTarget{constructor(t){super();this.fastQualityChange_=fG(this.fastQualityChange_.bind(this),100);let{src:e,withCredentials:a,tech:i,bandwidth:s,externVhs:n,useCueTags:l,playlistExclusionDuration:f,enableLowInitialPlaylist:o,sourceType:c,cacheEncryptionKeys:u,bufferBasedABR:m,leastPixelDiffSelector:p,captionServices:w,experimentalUseMMS:d}=t;if(!e)throw Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:v}=t;if(v===null||typeof v>"u")v=1/0;if(u1=n,this.bufferBasedABR=Boolean(m),this.leastPixelDiffSelector=Boolean(p),this.withCredentials=a,this.tech_=i,this.vhs_=i.vhs,this.player_=t.player_,this.sourceType_=c,this.useCueTags_=l,this.playlistExclusionDuration=f,this.maxPlaylistRetries=v,this.enableLowInitialPlaylist=o,this.usingManagedMediaSource_=!1,this.useCueTags_)this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType="";if(this.requestOptions_={withCredentials:a,maxPlaylistRetries:v,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=lG(),d&&$.default.ManagedMediaSource)this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new $.default.ManagedMediaSource,this.usingManagedMediaSource_=!0,lt.log("Using ManagedMediaSource");else if($.default.MediaSource)this.mediaSource=new $.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_=Hi(),this.hasPlayed_=!1,this.syncController_=new Ck(t),this.segmentMetadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new ZI,this.sourceUpdater_=new Z7(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new _k,this.keyStatusMap_=new Map;let k={vhs:this.vhs_,parse708captions:t.parse708captions,useDtsForTimestampOffset:t.useDtsForTimestampOffset,captionServices:w,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:s,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:u,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:t.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new vm(e,this.vhs_,aa(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new Lf(e,this.vhs_,aa(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Sm(aa(k,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),t),this.audioSegmentLoader_=new Sm(aa(k,{loaderType:"audio"}),t),this.subtitleSegmentLoader_=new yk(aa(k,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((H,M)=>{function D(){i.off("vttjserror",T),H()}function T(){i.off("vttjsloaded",D),M()}i.one("vttjsloaded",D),i.one("vttjserror",T),i.addWebVttScript_()})}),t);let y=()=>{return this.mainSegmentLoader_.bandwidth};if(this.contentSteeringController_=new Ok(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(oG.forEach((H)=>{this[H+"_"]=hG.bind(this,H)}),this.logger_=_n("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 B=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(B,()=>{let H=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-H,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){let t=this.mainAppendsToLoadedData_(),e=this.audioAppendsToLoadedData_();if(t===-1||e===-1)return-1;return t+e}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(t="abr"){let e=this.selectPlaylist();if(e&&this.shouldSwitchToMedia_(e))this.switchMedia_(e,t)}switchMedia_(t,e,a){let i=this.media(),s=i&&(i.id||i.uri),n=t&&(t.id||t.uri);if(s&&s!==n){this.logger_(`switch media ${s} -> ${n} from ${e}`);let l={renditionInfo:{id:n,bandwidth:t.attributes.BANDWIDTH,resolution:t.attributes.RESOLUTION,codecs:t.attributes.CODECS},cause:e};this.trigger({type:"renditionselected",metadata:l}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${e}`})}this.mainPlaylistLoader_.media(t,a)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((t)=>{let e=this.mediaTypes_[t],a=e?e.activeGroup():null,i=this.contentSteeringController_.getPathway();if(a&&i){let n=(a.length?a[0].playlists:a.playlists).filter((l)=>l.attributes.serviceLocation===i);if(n.length)this.mediaTypes_[t].activePlaylistLoader.media(n[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=$.default.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){if(this.tech_.scrubbing&&this.tech_.scrubbing())return;$.default.clearInterval(this.abrTimer_),this.abrTimer_=null}getAudioTrackPlaylists_(){let t=this.main(),e=t&&t.playlists||[];if(!t||!t.mediaGroups||!t.mediaGroups.AUDIO)return e;let a=t.mediaGroups.AUDIO,i=Object.keys(a),s;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)s=this.mediaTypes_.AUDIO.activeTrack();else{let l=a.main||i.length&&a[i[0]];for(let f in l)if(l[f].default){s={label:f};break}}if(!s)return e;let n=[];for(let l in a)if(a[l][s.label]){let f=a[l][s.label];if(f.playlists&&f.playlists.length)n.push.apply(n,f.playlists);else if(f.uri)n.push(f);else if(t.playlists.length)for(let o=0;o<t.playlists.length;o++){let c=t.playlists[o];if(c.attributes&&c.attributes.AUDIO&&c.attributes.AUDIO===l)n.push(c)}}if(!n.length)return e;return n}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{let e=this.mainPlaylistLoader_.media(),a=e.targetDuration*1.5*1000;if(Xg(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media()))this.requestOptions_.timeout=0;else this.requestOptions_.timeout=a;if(e.endList&&this.tech_.preload()!=="none")this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load();if(nG({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(),e),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 e=this.mainPlaylistLoader_.media();if(!e){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let a;if(this.enableLowInitialPlaylist)a=this.selectInitialPlaylist();if(!a)a=this.selectPlaylist();if(!a||!this.shouldSwitchToMedia_(a))return;if(this.initialMedia_=a,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)}),this.mainPlaylistLoader_.on("error",()=>{let e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{let e=this.mainPlaylistLoader_.media(),a=e.targetDuration*1.5*1000;if(Xg(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media()))this.requestOptions_.timeout=0;else this.requestOptions_.timeout=a;if(this.sourceType_==="dash"){if(this.mainPlaylistLoader_.isPaused)this.mainPlaylistLoader_.load()}if(this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_)this.runFastQualitySwitch_();else this.mainSegmentLoader_.load();this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{let e=this.mainPlaylistLoader_.media();if(e.lastExcludeReason_==="playlist-unchanged")return;if(this.stuckAtPlaylistEnd_(e))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((e)=>{this.mainPlaylistLoader_.on(e,(a)=>{this.player_.trigger(za({},a))})})}handleUpdatedMediaPlaylist(t){if(this.useCueTags_)this.updateAdCues_(t);if(this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_)this.runFastQualitySwitch_();if(this.updateDuration(!t.endList),!this.tech_.paused()){if(this.mainSegmentLoader_.load(),this.audioSegmentLoader_)this.audioSegmentLoader_.load()}}triggerPresenceUsage_(t,e){let a=t.mediaGroups||{},i=!0,s=Object.keys(a.AUDIO);for(let n in a.AUDIO)for(let l in a.AUDIO[n])if(!a.AUDIO[n][l].uri)i=!1;if(i)this.tech_.trigger({type:"usage",name:"vhs-demuxed"});if(Object.keys(a.SUBTITLES).length)this.tech_.trigger({type:"usage",name:"vhs-webvtt"});if(u1.Playlist.isAes(e))this.tech_.trigger({type:"usage",name:"vhs-aes"});if(s.length&&Object.keys(a.AUDIO[s[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_(t){let e=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,a=this.tech_.currentTime(),i=this.bufferLowWaterLine(),s=this.bufferHighWaterLine(),n=this.tech_.buffered();return cG({buffered:n,currentTime:a,currentPlaylist:e,nextPlaylist:t,bufferLowWaterLine:i,bufferHighWaterLine:s,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 a=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:a.playlist,error:a})}),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 a=this.audioSegmentLoader_.pendingSegment_;if(!a||!a.segment||!a.segment.syncInfo)return;let i=a.segment.syncInfo.end+0.01;this.tech_.setCurrentTime(i)}),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",(a)=>{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:rG})});let t=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();let a=this.getCodecsOrExclude_();if(!a)return;this.sourceUpdater_.addOrChangeSourceBuffers(a)};this.mainSegmentLoader_.on("trackinfo",t),this.audioSegmentLoader_.on("trackinfo",t),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((a)=>{this.mainSegmentLoader_.on(a,(i)=>{this.player_.trigger(za({},i))}),this.audioSegmentLoader_.on(a,(i)=>{this.player_.trigger(za({},i))}),this.subtitleSegmentLoader_.on(a,(i)=>{this.player_.trigger(za({},i))})})}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_(t=this.selectPlaylist()){if(t&&t===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(t,"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 t=this.tech_.seekable();if(this.tech_.duration()===1/0){if(this.tech_.currentTime()<t.start(0))return this.tech_.setCurrentTime(t.end(t.length-1))}}setupFirstPlay(){let t=this.mainPlaylistLoader_.media();if(!t||this.tech_.paused()||this.hasPlayed_)return!1;if(!t.endList||t.start){let e=this.seekable();if(!e.length)return!1;let a=e.end(0),i=a;if(t.start){let s=t.start.timeOffset;if(s<0){let n=this.mainPlaylistLoader_.main,l=u1.Playlist.liveEdgeDelay(n,t),f=a+l;i=Math.max(Math.min(f+s,a),e.start(0))}else i=Math.min(a,s)}this.trigger("firstplay"),this.tech_.setCurrentTime(i)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){let t=this.tech_.play();if(typeof t<"u"&&typeof t.then==="function")t.then(null,(e)=>{})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;let t=this.inbandTextTracks_.metadataTrack_.cues;if(!t||!t.length)return;let e=this.duration();t[t.length-1].endTime=isNaN(e)||Math.abs(e)===1/0?Number.MAX_VALUE:e}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let t=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){let e=this.mainSegmentLoader_.getCurrentMediaInfo_();if(!e||e.hasVideo)t=t&&this.audioSegmentLoader_.ended_;else t=this.audioSegmentLoader_.ended_}if(!t)return;this.stopABRTimer_(),this.sourceUpdater_.endOfStream()}stuckAtPlaylistEnd_(t){if(!this.seekable().length)return!1;let a=this.syncController_.getExpiredTime(t,this.duration());if(a===null)return!1;let i=u1.Playlist.playlistEnd(t,a),s=this.tech_.currentTime(),n=this.tech_.buffered();if(!n.length)return i-s<=j0;let l=n.end(n.length-1);return l-s<=j0&&i-l<=j0}excludePlaylist({playlistToExclude:t=this.mainPlaylistLoader_.media(),error:e={},playlistExclusionDuration:a}){if(t=t||this.mainPlaylistLoader_.media(),a=a||e.playlistExclusionDuration||this.playlistExclusionDuration,!t){if(this.error=e,this.mediaSource.readyState!=="open")this.trigger("error");else this.sourceUpdater_.endOfStream("network");return}t.playlistErrors_++;let i=this.mainPlaylistLoader_.main.playlists,s=i.filter(a3),n=s.length===1&&s[0]===t;if(i.length===1&&a!==1/0)return lt.log.warn(`Problem encountered with playlist ${t.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(n);if(n){if(this.main().contentSteering){let w=this.pathwayAttribute_(t),d=this.contentSteeringController_.steeringManifest.ttl*1000;this.contentSteeringController_.excludePathway(w),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(w)},d);return}let p=!1;if(i.forEach((w)=>{if(w===t)return;let d=w.excludeUntil;if(typeof d<"u"&&d!==1/0)p=!0,delete w.excludeUntil}),p)lt.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(t.playlistErrors_>this.maxPlaylistRetries)l=1/0;else l=Date.now()+a*1000;if(t.excludeUntil=l,e.reason)t.lastExcludeReason_=e.reason;this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});let f=this.selectPlaylist();if(!f){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}let o=e.internal?this.logger_:lt.log.warn,c=e.message?" "+e.message:"";if(o(`${e.internal?"Internal problem":"Problem"} encountered with playlist ${t.id}.${c} Switching to playlist ${f.id}.`),f.attributes.AUDIO!==t.attributes.AUDIO)this.delegateLoaders_("audio",["abort","pause"]);if(f.attributes.SUBTITLES!==t.attributes.SUBTITLES)this.delegateLoaders_("subtitle",["abort","pause"]);this.delegateLoaders_("main",["abort","pause"]);let u=f.targetDuration/2*1000||5000,m=typeof f.lastRequest==="number"&&Date.now()-f.lastRequest<=u;return this.switchMedia_(f,"exclude",n||m)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(t,e){let a=[],i=t==="all";if(i||t==="main")a.push(this.mainPlaylistLoader_);let s=[];if(i||t==="audio")s.push("AUDIO");if(i||t==="subtitle")s.push("CLOSED-CAPTIONS"),s.push("SUBTITLES");s.forEach((n)=>{let l=this.mediaTypes_[n]&&this.mediaTypes_[n].activePlaylistLoader;if(l)a.push(l)}),["main","audio","subtitle"].forEach((n)=>{let l=this[`${n}SegmentLoader_`];if(l&&(t===n||t==="all"))a.push(l)}),a.forEach((n)=>e.forEach((l)=>{if(typeof n[l]==="function")n[l]()}))}setCurrentTime(t){let e=Io(this.tech_.buffered(),t);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()))return 0;if(!this.mainPlaylistLoader_.media().segments)return 0;if(e&&e.length)return t;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 t=this.mainPlaylistLoader_.media();if(!t)return 0;if(!t.endList)return 1/0;if(this.mediaSource)return this.mediaSource.duration;return u1.Playlist.duration(t)}seekable(){return this.seekable_}getSeekableRange_(t,e){let a=t.media();if(!a)return null;let i=this.syncController_.getMediaSequenceSync(e);if(i&&i.isReliable){let{start:l,end:f}=i;if(!isFinite(l)||!isFinite(f))return null;let o=u1.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,a),c=Math.max(l,f-o);return Hi([[l,c]])}let s=this.syncController_.getExpiredTime(a,this.duration());if(s===null)return null;let n=u1.Playlist.seekable(a,s,u1.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,a));return n.length?n:null}computeFinalSeekable_(t,e){if(!e)return t;let a=t.start(0),i=t.end(0),s=e.start(0),n=e.end(0);if(s>i||a>n)return t;return Hi([[Math.max(a,s),Math.min(i,n)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;let t=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!t)return;let e;if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(e=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!e)return}let a=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(t,e),!this.seekable_)return;if(a&&a.length&&this.seekable_.length){if(a.start(0)===this.seekable_.start(0)&&a.end(0)===this.seekable_.end(0))return}this.logger_(`seekable updated [${Ny(this.seekable_)}]`);let i={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:i}),this.tech_.trigger("seekablechanged")}updateDuration(t){if(this.updateDuration_)this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null;if(this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,t),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(t){let i=this.seekable();if(!i.length)return;if(isNaN(this.mediaSource.duration)||this.mediaSource.duration<i.end(i.length-1))this.sourceUpdater_.setDuration(i.end(i.length-1));return}let e=this.tech_.buffered(),a=u1.Playlist.duration(this.mainPlaylistLoader_.media());if(e.length>0)a=Math.max(a,e.end(e.length-1));if(this.mediaSource.duration!==a)this.sourceUpdater_.setDuration(a)}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((t)=>{let e=this.mediaTypes_[t].groups;for(let a in e)e[a].forEach((i)=>{if(i.playlistLoader)i.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 t=!!this.mediaTypes_.AUDIO.activePlaylistLoader,e=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),a=!t?!0:!!this.audioSegmentLoader_.getCurrentMediaInfo_();if(!e||!a)return!1;return!0}getCodecsOrExclude_(){let t={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},e=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();t.video=t.main;let a=F2(this.main(),e),i={},s=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo)i.video=a.video||t.main.videoCodec||sA;if(t.main.isMuxed)i.video+=`,${a.audio||t.main.audioCodec||R8}`;if(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||s)i.audio=a.audio||t.main.audioCodec||t.audio.audioCodec||R8,t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4;if(!i.audio&&!i.video){this.excludePlaylist({playlistToExclude:e,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}let n=(o,c)=>o?ko(c,this.usingManagedMediaSource_):R5(c),l={},f;if(["video","audio"].forEach(function(o){if(i.hasOwnProperty(o)&&!n(t[o].isFmp4,i[o])){let c=t[o].isFmp4?"browser":"muxer";if(l[c]=l[c]||[],l[c].push(i[o]),o==="audio")f=c}}),s&&f&&e.attributes.AUDIO){let o=e.attributes.AUDIO;this.main().playlists.forEach((c)=>{if((c.attributes&&c.attributes.AUDIO)===o&&c!==e)c.excludeUntil=1/0}),this.logger_(`excluding audio group ${o} as ${f} does not support codec(s): "${i.audio}"`)}if(Object.keys(l).length){let o=Object.keys(l).reduce((c,u)=>{if(c)c+=", ";return c+=`${u} does not support codec(s): "${l[u].join(",")}"`,c},"")+".";this.excludePlaylist({playlistToExclude:e,error:{internal:!0,message:o},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){let o=[];if(["video","audio"].forEach((c)=>{let u=(Yn(this.sourceUpdater_.codecs[c]||"")[0]||{}).type,m=(Yn(i[c]||"")[0]||{}).type;if(u&&m&&u.toLowerCase()!==m.toLowerCase())o.push(`"${this.sourceUpdater_.codecs[c]}" -> "${i[c]}"`)}),o.length){this.excludePlaylist({playlistToExclude:e,error:{message:`Codec switching not supported: ${o.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return i}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers())return;if(!this.areMediaTypesKnown_())return;let t=this.getCodecsOrExclude_();if(!t)return;this.sourceUpdater_.createSourceBuffers(t);let e=[t.video,t.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(e)}excludeUnsupportedVariants_(){let t=this.main().playlists,e=[];Object.keys(t).forEach((a)=>{let i=t[a];if(e.indexOf(i.id)!==-1)return;e.push(i.id);let s=F2(this.main,i),n=[];if(s.audio&&!R5(s.audio)&&!ko(s.audio,this.usingManagedMediaSource_))n.push(`audio codec ${s.audio}`);if(s.video&&!R5(s.video)&&!ko(s.video,this.usingManagedMediaSource_))n.push(`video codec ${s.video}`);if(s.text&&s.text==="stpp.ttml.im1t")n.push(`text codec ${s.text}`);if(n.length)i.excludeUntil=1/0,this.logger_(`excluding ${i.id} for unsupported: ${n.join(", ")}`)})}excludeIncompatibleVariants_(t){let e=[],a=this.main().playlists,i=D2(Yn(t)),s=rS(i),n=i.video&&Yn(i.video)[0]||null,l=i.audio&&Yn(i.audio)[0]||null;Object.keys(a).forEach((f)=>{let o=a[f];if(e.indexOf(o.id)!==-1||o.excludeUntil===1/0)return;e.push(o.id);let c=[],u=F2(this.mainPlaylistLoader_.main,o),m=rS(u);if(!u.audio&&!u.video)return;if(m!==s)c.push(`codec count "${m}" !== "${s}"`);if(!this.sourceUpdater_.canChangeType()){let p=u.video&&Yn(u.video)[0]||null,w=u.audio&&Yn(u.audio)[0]||null;if(p&&n&&p.type.toLowerCase()!==n.type.toLowerCase())c.push(`video codec "${p.type}" !== "${n.type}"`);if(w&&l&&w.type.toLowerCase()!==l.type.toLowerCase())c.push(`audio codec "${w.type}" !== "${l.type}"`)}if(c.length)o.excludeUntil=1/0,this.logger_(`excluding ${o.id}: ${c.join(" && ")}`)})}updateAdCues_(t){let e=0,a=this.seekable();if(a.length)e=a.start(0);YI(t,this.cueTagsTrack_,e)}goalBufferLength(){let t=this.tech_.currentTime(),e=Oi.GOAL_BUFFER_LENGTH,a=Oi.GOAL_BUFFER_LENGTH_RATE,i=Math.max(e,Oi.MAX_GOAL_BUFFER_LENGTH);return Math.min(e+t*a,i)}bufferLowWaterLine(){let t=this.tech_.currentTime(),e=Oi.BUFFER_LOW_WATER_LINE,a=Oi.BUFFER_LOW_WATER_LINE_RATE,i=Math.max(e,Oi.MAX_BUFFER_LOW_WATER_LINE),s=Math.max(e,Oi.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(e+t*a,this.bufferBasedABR?s:i)}bufferHighWaterLine(){return Oi.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(t){pS(this.inbandTextTracks_,"com.apple.streaming",this.tech_),FI({inbandTextTracks:this.inbandTextTracks_,dateRanges:t})}addMetadataToTextTrack(t,e,a){let i=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();pS(this.inbandTextTracks_,t,this.tech_),kI({inbandTextTracks:this.inbandTextTracks_,metadataArray:e,timestampOffset:i,videoDuration:a})}pathwayAttribute_(t){return t.attributes["PATHWAY-ID"]||t.attributes.serviceLocation}initContentSteeringController_(){let t=this.main();if(!t.contentSteering)return;for(let e of t.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(e));if(this.contentSteeringController_.assignTagProperties(t.uri,t.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((e)=>{this.contentSteeringController_.on(e,(a)=>{this.trigger(za({},a))})}),this.sourceType_==="dash")this.mainPlaylistLoader_.on("loadedplaylist",()=>{let e=this.main();if(this.contentSteeringController_.didDASHTagChange(e.uri,e.contentSteering)||(()=>{let s=this.contentSteeringController_.getAvailablePathways(),n=[];for(let l of e.playlists){let f=l.attributes.serviceLocation;if(f){if(n.push(f),!s.has(f))return!0}}if(!n.length&&s.size)return!0;return!1})())this.resetContentSteeringController_()})}excludeThenChangePathway_(){let t=this.contentSteeringController_.getPathway();if(!t)return;this.handlePathwayClones_();let a=this.main().playlists,i=new Set,s=!1;if(Object.keys(a).forEach((n)=>{let l=a[n],f=this.pathwayAttribute_(l),o=f&&t!==f;if(l.excludeUntil===1/0&&l.lastExcludeReason_==="content-steering"&&!o)delete l.excludeUntil,delete l.lastExcludeReason_,s=!0;let u=!l.excludeUntil&&l.excludeUntil!==1/0;if(!(!i.has(l.id)&&o&&u))return;i.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((n)=>{let l=this.mediaTypes_[n];if(l.activePlaylistLoader){let f=l.activePlaylistLoader.media_;if(f&&f.attributes.serviceLocation!==t)s=!0}});if(s)this.changeSegmentPathway_()}handlePathwayClones_(){let e=this.main().playlists,a=this.contentSteeringController_.currentPathwayClones,i=this.contentSteeringController_.nextPathwayClones;if(!(a&&a.size||i&&i.size))return;for(let[n,l]of a.entries())if(!i.get(n))this.mainPlaylistLoader_.updateOrDeleteClone(l),this.contentSteeringController_.excludePathway(n);for(let[n,l]of i.entries()){let f=a.get(n);if(!f){e.filter((c)=>{return c.attributes["PATHWAY-ID"]===l["BASE-ID"]}).forEach((c)=>{this.mainPlaylistLoader_.addClonePathway(l,c)}),this.contentSteeringController_.addAvailablePathway(n);continue}if(this.equalPathwayClones_(f,l))continue;this.mainPlaylistLoader_.updateOrDeleteClone(l,!0),this.contentSteeringController_.addAvailablePathway(n)}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...i])))}equalPathwayClones_(t,e){if(t["BASE-ID"]!==e["BASE-ID"]||t.ID!==e.ID||t["URI-REPLACEMENT"].HOST!==e["URI-REPLACEMENT"].HOST)return!1;let a=t["URI-REPLACEMENT"].PARAMS,i=e["URI-REPLACEMENT"].PARAMS;for(let s in a)if(a[s]!==i[s])return!1;for(let s in i)if(a[s]!==i[s])return!1;return!0}changeSegmentPathway_(){let t=this.selectPlaylist();if(this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH")this.switchMediaForDASHContentSteering_();this.switchMedia_(t,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let t=0,e="non-usable";if(this.mainPlaylistLoader_.main.playlists.forEach((a)=>{let i=this.mainPlaylistLoader_.getKeyIdSet(a);if(!i||!i.size)return;i.forEach((s)=>{let l=this.keyStatusMap_.has(s)&&this.keyStatusMap_.get(s)==="usable",f=a.lastExcludeReason_===e&&a.excludeUntil===1/0;if(!l){if(a.excludeUntil!==1/0&&a.lastExcludeReason_!==e)a.excludeUntil=1/0,a.lastExcludeReason_=e,this.logger_(`excluding playlist ${a.id} because the key ID ${s} doesn't exist in the keyStatusMap or is not usable`);t++}else if(l&&f)delete a.excludeUntil,delete a.lastExcludeReason_,this.logger_(`enabling playlist ${a.id} because key ID ${s} is usable`)})}),t>=this.mainPlaylistLoader_.main.playlists.length)this.mainPlaylistLoader_.main.playlists.forEach((a)=>{let i=a&&a.attributes&&a.attributes.RESOLUTION&&a.attributes.RESOLUTION.height<720,s=a.excludeUntil===1/0&&a.lastExcludeReason_===e;if(i&&s)delete a.excludeUntil,lt.log.warn(`enabling non-HD playlist ${a.id} because all playlists were excluded due to ${e} key IDs`)})}addKeyStatus_(t,e){let s=(typeof t==="string"?t:LI(t)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${e}' with key ID ${s} added to the keyStatusMap`),this.keyStatusMap_.set(s,e)}updatePlaylistByKeyStatus(t,e){if(this.addKeyStatus_(t,e),!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 uG=(t,e,a)=>(i)=>{let s=t.main.playlists[e],n=V7(s),l=a3(s);if(typeof i>"u")return l;if(i)delete s.disabled;else s.disabled=!0;let f={renditionInfo:{id:e,bandwidth:s.attributes.BANDWIDTH,resolution:s.attributes.RESOLUTION,codecs:s.attributes.CODECS},cause:"fast-quality"};if(i!==l&&!n)if(i)a(s),t.trigger({type:"renditionenabled",metadata:f});else t.trigger({type:"renditiondisabled",metadata:f});return i};class Mk{constructor(t,e,a){let{playlistController_:i}=t,s=i.fastQualityChange_.bind(i);if(e.attributes){let n=e.attributes.RESOLUTION;this.width=n&&n.width,this.height=n&&n.height,this.bandwidth=e.attributes.BANDWIDTH,this.frameRate=e.attributes["FRAME-RATE"]}this.codecs=F2(i.main(),e),this.playlist=e,this.id=a,this.enabled=uG(t.playlists,e.id,s)}}var mG=function(t){t.representations=()=>{let e=t.playlistController_.main(),a=z2(e)?t.playlistController_.getAudioTrackPlaylists_():e.playlists;if(!a)return[];return a.filter((i)=>!V7(i)).map((i,s)=>new Mk(t,i,i.id))}},yS=["seeking","seeked","pause","playing","error"];class Dk extends lt.EventTarget{constructor(t){super();this.playlistController_=t.playlistController,this.tech_=t.tech,this.seekable=t.seekable,this.allowSeeksWithinUnsafeLiveWindow=t.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=t.liveRangeSafeTimeDelta,this.media=t.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=_n("PlaybackWatcher"),this.logger_("initialize");let e=()=>this.monitorCurrentTime_(),a=()=>this.monitorCurrentTime_(),i=()=>this.techWaiting_(),s=()=>this.resetTimeUpdate_(),n=this.playlistController_,l=["main","subtitle","audio"],f={};l.forEach((c)=>{f[c]={reset:()=>this.resetSegmentDownloads_(c),updateend:()=>this.checkSegmentDownloads_(c)},n[`${c}SegmentLoader_`].on("appendsdone",f[c].updateend),n[`${c}SegmentLoader_`].on("playlistupdate",f[c].reset),this.tech_.on(["seeked","seeking"],f[c].reset)});let o=(c)=>{["main","audio"].forEach((u)=>{n[`${u}SegmentLoader_`][c]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{if(this.fixesBadSeeks_())this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),o("off")},this.clearSeekingAppendCheck_=()=>o("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),o("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",i),this.tech_.on(yS,s),this.tech_.on("canplay",a),this.tech_.one("play",e),this.dispose=()=>{if(this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",i),this.tech_.off(yS,s),this.tech_.off("canplay",a),this.tech_.off("play",e),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),l.forEach((c)=>{n[`${c}SegmentLoader_`].off("appendsdone",f[c].updateend),n[`${c}SegmentLoader_`].off("playlistupdate",f[c].reset),this.tech_.off(["seeked","seeking"],f[c].reset)}),this.checkCurrentTimeTimeout_)$.default.clearTimeout(this.checkCurrentTimeTimeout_);this.resetTimeUpdate_()}}monitorCurrentTime_(){if(this.checkCurrentTime_(),this.checkCurrentTimeTimeout_)$.default.clearTimeout(this.checkCurrentTimeTimeout_);this.checkCurrentTimeTimeout_=$.default.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(t){let e=this.playlistController_[`${t}SegmentLoader_`];if(this[`${t}StalledDownloads_`]>0)this.logger_(`resetting possible stalled download count for ${t} loader`);this[`${t}StalledDownloads_`]=0,this[`${t}Buffered_`]=e.buffered_()}checkSegmentDownloads_(t){let e=this.playlistController_,a=e[`${t}SegmentLoader_`],i=a.buffered_(),s=fU(this[`${t}Buffered_`],i);if(this[`${t}Buffered_`]=i,s){let n={bufferedRanges:i};e.trigger({type:"bufferedrangeschanged",metadata:n}),this.resetSegmentDownloads_(t);return}if(this[`${t}StalledDownloads_`]++,this.logger_(`found #${this[`${t}StalledDownloads_`]} ${t} appends that did not increase buffer (possible stalled download)`,{playlistId:a.playlist_&&a.playlist_.id,buffered:Kf(i)}),this[`${t}StalledDownloads_`]<10)return;if(this.logger_(`${t} loader stalled download exclusion`),this.resetSegmentDownloads_(t),this.tech_.trigger({type:"usage",name:`vhs-${t}-download-exclusion`}),t==="subtitle")return;e.excludePlaylist({error:{message:`Excessive ${t} segment downloading detected.`},playlistExclusionDuration:1/0})}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;let t=this.tech_.currentTime(),e=this.tech_.buffered();if(this.lastRecordedTime===t&&(!e.length||t+j0>=e.end(e.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&t===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(t===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(Hi([this.lastRecordedTime,t]));let a={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:a}),this.consecutiveUpdates=0,this.lastRecordedTime=t}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;let e=this.seekable(),a=this.tech_.currentTime(),i=this.afterSeekableWindow_(e,a,this.media(),this.allowSeeksWithinUnsafeLiveWindow),s;if(i)s=e.end(e.length-1);if(this.beforeSeekableWindow_(e,a)){let w=e.start(0);s=w+(w===e.end(0)?0:j0)}if(typeof s<"u")return this.logger_(`Trying to seek outside of seekable at time ${a} with seekable range ${Ny(e)}. Seeking to ${s}.`),this.tech_.setCurrentTime(s),!0;let n=this.playlistController_.sourceUpdater_,l=this.tech_.buffered(),f=n.audioBuffer?n.audioBuffered():null,o=n.videoBuffer?n.videoBuffered():null,c=this.media(),u=c.partTargetDuration?c.partTargetDuration:(c.targetDuration-w0)*2,m=[f,o];for(let w=0;w<m.length;w++){if(!m[w])continue;if(K7(m[w],a)<u)return!1}let p=P5(l,a);if(p.length===0)return!1;return s=p.start(0)+j0,this.logger_(`Buffered region starts (${p.start(0)}) just beyond seek point (${a}). Seeking to ${s}.`),this.tech_.setCurrentTime(s),!0}waiting_(){if(this.techWaiting_())return;let t=this.tech_.currentTime(),e=this.tech_.buffered(),a=Io(e,t);if(a.length&&t+3<=a.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.logger_(`Stopped at ${t} while inside a buffered region [${a.start(0)} -> ${a.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){let t=this.seekable(),e=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(t,e)){let l=t.end(t.length-1);return this.logger_(`Fell out of live window at time ${e}. Seeking to live point (seekable end) ${l}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(l),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}let a=this.tech_.vhs.playlistController_.sourceUpdater_,i=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:a.audioBuffered(),videoBuffered:a.videoBuffered(),currentTime:e}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;let n=P5(i,e);if(n.length>0)return this.logger_(`Stopped at ${e} and seeking to ${n.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(e),!0;return!1}afterSeekableWindow_(t,e,a,i=!1){if(!t.length)return!1;let s=t.end(t.length-1)+j0,n=!a.endList,l=typeof a.partTargetDuration==="number";if(n&&(l||i))s=t.end(t.length-1)+a.targetDuration*3;if(e>s)return!0;return!1}beforeSeekableWindow_(t,e){if(t.length&&t.start(0)>0&&e<t.start(0)-this.liveRangeSafeTimeDelta)return!0;return!1}videoUnderflow_({videoBuffered:t,audioBuffered:e,currentTime:a}){if(!t)return;let i;if(t.length&&e.length){let s=Io(t,a-3),n=Io(t,a),l=Io(e,a);if(l.length&&!n.length&&s.length)i={start:s.end(0),end:l.end(0)}}else if(!P5(t,a).length)i=this.gapFromVideoUnderflow_(t,a);if(i)return this.logger_(`Encountered a gap in video from ${i.start} to ${i.end}. Seeking to current time ${a}`),!0;return!1}skipTheGap_(t){let e=this.tech_.buffered(),a=this.tech_.currentTime(),i=P5(e,a);if(this.resetTimeUpdate_(),i.length===0||a!==t)return;this.logger_("skipTheGap_:","currentTime:",a,"scheduled currentTime:",t,"nextRange start:",i.start(0)),this.tech_.setCurrentTime(i.start(0)+w0);let s={gapInfo:{from:a,to:i.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:s}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(t,e){let a=sU(t);for(let i=0;i<a.length;i++){let s=a.start(i),n=a.end(i);if(e-s<4&&e-s>2)return{start:s,end:n}}return null}}var gG={errorInterval:30,getSource(t){let a=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return t(a)}},Tk=function(t,e){let a=0,i=0,s=aa(gG,e);t.ready(()=>{t.trigger({type:"usage",name:"vhs-error-reload-initialized"})});let n=function(){if(i)t.currentTime(i)},l=function(u){if(u===null||u===void 0)return;i=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",n),t.src(u),t.trigger({type:"usage",name:"vhs-error-reload"}),t.play()},f=function(){if(Date.now()-a<s.errorInterval*1000){t.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!s.getSource||typeof s.getSource!=="function"){lt.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return a=Date.now(),s.getSource.call(t,l)},o=function(){t.off("loadedmetadata",n),t.off("error",f),t.off("dispose",o)},c=function(u){o(),Tk(t,u)};t.on("error",f),t.on("dispose",o),t.reloadSourceOnError=c},bG=function(t){Tk(this,t)},Rk="3.17.3",pG="7.1.0",wG="1.3.1",jG="7.2.0",dG="4.0.2",Ea={PlaylistLoader:Lf,Playlist:Ds,utils:DU,STANDARD_PLAYLIST_SELECTOR:bS,INITIAL_PLAYLIST_SELECTOR:qI,lastBandwidthSelector:bS,movingAverageBandwidthSelector:jI,comparePlaylistBandwidth:Q7,comparePlaylistResolution:wI,xhr:ek()};Object.keys(Oi).forEach((t)=>{Object.defineProperty(Ea,t,{get(){return lt.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),Oi[t]},set(e){if(lt.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),typeof e!=="number"||e<0){lt.log.warn(`value of Vhs.${t} must be greater than or equal to 0`);return}Oi[t]=e}})});var Nk="videojs-vhs",zk=function(t,e){let a=e.media(),i=-1;for(let s=0;s<t.length;s++)if(t[s].id===a.id){i=s;break}t.selectedIndex_=i,t.trigger({selectedIndex:i,type:"change"})},qG=function(t,e){e.representations().forEach((a)=>{t.addQualityLevel(a)}),zk(t,e.playlists)};Ea.canPlaySource=function(){return lt.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};var AG=(t,e,a)=>{if(!t)return t;let i={};if(e&&e.attributes&&e.attributes.CODECS)i=D2(Yn(e.attributes.CODECS));if(a&&a.attributes&&a.attributes.CODECS)i.audio=a.attributes.CODECS;let s=Ef(i.video),n=Ef(i.audio),l={};for(let f in t){if(l[f]={},n)l[f].audioContentType=n;if(s)l[f].videoContentType=s;if(e.contentProtection&&e.contentProtection[f]&&e.contentProtection[f].pssh)l[f].pssh=e.contentProtection[f].pssh;if(typeof t[f]==="string")l[f].url=t[f]}return aa(t,l)},vG=(t,e)=>{return t.reduce((a,i)=>{if(!i.contentProtection)return a;let s=e.reduce((n,l)=>{let f=i.contentProtection[l];if(f&&f.pssh)n[l]={pssh:f.pssh};return n},{});if(Object.keys(s).length)a.push(s);return a},[])},SG=({player:t,sourceKeySystems:e,audioMedia:a,mainPlaylists:i})=>{if(!t.eme.initializeMediaKeys)return Promise.resolve();let s=a?i.concat([a]):i,n=vG(s,Object.keys(e)),l=[],f=[];return n.forEach((o)=>{f.push(new Promise((c,u)=>{t.tech_.one("keysessioncreated",c)})),l.push(new Promise((c,u)=>{t.eme.initializeMediaKeys({keySystems:o},(m)=>{if(m){u(m);return}c()})}))}),Promise.race([Promise.all(l),Promise.race(f)])},yG=({player:t,sourceKeySystems:e,media:a,audioMedia:i})=>{let s=AG(e,a,i);if(!s)return!1;if(t.currentSource().keySystems=s,s&&!t.eme)return lt.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1;return!0},Ek=()=>{if(!$.default.localStorage)return null;let t=$.default.localStorage.getItem(Nk);if(!t)return null;try{return JSON.parse(t)}catch(e){return null}},kG=(t)=>{if(!$.default.localStorage)return!1;let e=Ek();e=e?aa(e,t):t;try{$.default.localStorage.setItem(Nk,JSON.stringify(e))}catch(a){return!1}return e},CG=(t)=>{if(t.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0)return JSON.parse(t.substring(t.indexOf(",")+1));return t},xk=(t,e)=>{if(!t._requestCallbackSet)t._requestCallbackSet=new Set;t._requestCallbackSet.add(e)},Uk=(t,e)=>{if(!t._responseCallbackSet)t._responseCallbackSet=new Set;t._responseCallbackSet.add(e)},Ik=(t,e)=>{if(!t._requestCallbackSet)return;if(t._requestCallbackSet.delete(e),!t._requestCallbackSet.size)delete t._requestCallbackSet},Gk=(t,e)=>{if(!t._responseCallbackSet)return;if(t._responseCallbackSet.delete(e),!t._responseCallbackSet.size)delete t._responseCallbackSet};Ea.supportsNativeHls=function(){if(!Ot.default||!Ot.default.createElement)return!1;let t=Ot.default.createElement("video");if(!lt.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(a){return/maybe|probably/i.test(t.canPlayType(a))})}();Ea.supportsNativeDash=function(){if(!Ot.default||!Ot.default.createElement||!lt.getTech("Html5").isSupported())return!1;return/maybe|probably/i.test(Ot.default.createElement("video").canPlayType("application/dash+xml"))}();Ea.supportsTypeNatively=(t)=>{if(t==="hls")return Ea.supportsNativeHls;if(t==="dash")return Ea.supportsNativeDash;return!1};Ea.isSupported=function(){return lt.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Ea.xhr.onRequest=function(t){xk(Ea.xhr,t)};Ea.xhr.onResponse=function(t){Uk(Ea.xhr,t)};Ea.xhr.offRequest=function(t){Ik(Ea.xhr,t)};Ea.xhr.offResponse=function(t){Gk(Ea.xhr,t)};var _G=lt.getComponent("Component");class W7 extends _G{constructor(t,e,a){super(e,a.vhs);if(typeof a.initialBandwidth==="number")this.options_.bandwidth=a.initialBandwidth;if(this.logger_=_n("VhsHandler"),e.options_&&e.options_.playerId){let i=lt.getPlayer(e.options_.playerId);this.player_=i}if(this.tech_=e,this.source_=t,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&e.overrideNativeAudioTracks&&e.overrideNativeVideoTracks)e.overrideNativeAudioTracks(!0),e.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(e.featuresNativeVideoTracks||e.featuresNativeAudioTracks))throw Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(Ot.default,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(i)=>{let s=Ot.default.fullscreenElement||Ot.default.webkitFullscreenElement||Ot.default.mozFullScreenElement||Ot.default.msFullscreenElement;if(s&&s.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_(t={}){if(this.options_=aa(this.options_,t),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 a=Ek();if(a&&a.bandwidth)this.options_.bandwidth=a.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"});if(a&&a.throughput)this.options_.throughput=a.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"})}}if(typeof this.options_.bandwidth!=="number")this.options_.bandwidth=Oi.INITIAL_BANDWIDTH;this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Oi.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","usePlayerObjectFit","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach((a)=>{if(typeof this.source_[a]<"u")this.options_[a]=this.source_[a]}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio,this.usePlayerObjectFit=this.options_.usePlayerObjectFit;let e=this.options_.customPixelRatio;if(typeof e==="number"&&e>=0)this.customPixelRatio=e}setOptions(t={}){this.setOptions_(t)}src(t,e){if(!t)return;this.setOptions_(),this.options_.src=CG(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Ea,this.options_.sourceType=N8(e),this.options_.seekTo=(s)=>{this.tech_.setCurrentTime(s)},this.options_.player_=this.player_,this.playlistController_=new Hk(this.options_);let a=aa({liveRangeSafeTimeDelta:j0},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new Dk(a),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{let s=lt.players[this.tech_.options_.playerId],n=this.playlistController_.error;if(typeof n==="object"&&!n.code)n.code=3;else if(typeof n==="string")n={message:n,code:3};s.error(n)});let i=this.options_.bufferBasedABR?Ea.movingAverageBandwidthSelector(0.55):Ea.STANDARD_PLAYLIST_SELECTOR;if(this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):i.bind(this),this.playlistController_.selectInitialPlaylist=Ea.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(s){this.playlistController_.selectPlaylist=s.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(s){this.playlistController_.mainSegmentLoader_.throughput.rate=s,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let s=this.playlistController_.mainSegmentLoader_.bandwidth,n=$.default.navigator.connection||$.default.navigator.mozConnection||$.default.navigator.webkitConnection,l=1e7;if(this.options_.useNetworkInformationApi&&n){let f=n.downlink*1000*1000;if(f>=l&&s>=l)s=Math.max(s,f);else s=f}return s},set(s){this.playlistController_.mainSegmentLoader_.bandwidth=s,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){let s=1/(this.bandwidth||1),n;if(this.throughput>0)n=1/this.throughput;else n=0;return Math.floor(1/(s+n))},set(){lt.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:()=>Kf(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:()=>Kf(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)kG({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{mG(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_=$.default.URL.createObjectURL(this.playlistController_.mediaSource),(lt.browser.IS_ANY_SAFARI||lt.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 t=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),SG({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:t&&t.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch((e)=>{this.logger_("error while creating EME key session",e),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 t=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,e=yG({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:t&&t.media()});if(this.player_.tech_.on("keystatuschange",(a)=>{this.playlistController_.updatePlaylistByKeyStatus(a.keyId,a.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!e){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){let t=lt.players[this.tech_.options_.playerId];if(!t||!t.qualityLevels||this.qualityLevels_)return;this.qualityLevels_=t.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{qG(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{zk(this.qualityLevels_,this.playlists)})}static version(){return{"@videojs/http-streaming":Rk,"mux.js":pG,"mpd-parser":wG,"m3u8-parser":jG,"aes-decrypter":dG}}version(){return this.constructor.version()}canChangeType(){return Z7.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(t){this.playlistController_.setCurrentTime(t)}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_&&$.default.URL.revokeObjectURL)$.default.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null;if(this.tech_)this.tech_.off("waitingforkey",this.handleWaitingForKey_);super.dispose()}convertToProgramTime(t,e){return UU({playlist:this.playlistController_.media(),time:t,callback:e})}seekToProgramTime(t,e,a=!0,i=2){return lk({programTime:t,playlist:this.playlistController_.media(),retryCount:i,pauseAfterSeek:a,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:e})}setupXhrHooks_(){this.xhr.onRequest=(t)=>{xk(this.xhr,t)},this.xhr.onResponse=(t)=>{Uk(this.xhr,t)},this.xhr.offRequest=(t)=>{Ik(this.xhr,t)},this.xhr.offResponse=(t)=>{Gk(this.xhr,t)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){let t=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],e=["gapjumped","playedrangeschanged"];t.forEach((a)=>{this.playlistController_.on(a,(i)=>{this.player_.trigger(za({},i))})}),e.forEach((a)=>{this.playbackWatcher_.on(a,(i)=>{this.player_.trigger(za({},i))})})}}var km={name:"videojs-http-streaming",VERSION:Rk,canHandleSource(t,e={}){let a=aa(lt.options,e);if(!a.vhs.experimentalUseMMS&&!ko("avc1.4d400d,mp4a.40.2",!1))return!1;return km.canPlayType(t.type,a)},handleSource(t,e,a={}){let i=aa(lt.options,a);return e.vhs=new W7(t,e,i),e.vhs.xhr=ek(),e.vhs.setupXhrHooks_(),e.vhs.src(t.src,t.type),e.vhs},canPlayType(t,e){let a=N8(t);if(!a)return"";let i=km.getOverrideNative(e);return!Ea.supportsTypeNatively(a)||i?"maybe":""},getOverrideNative(t={}){let{vhs:e={}}=t,a=!(lt.browser.IS_ANY_SAFARI||lt.browser.IS_IOS),{overrideNative:i=a}=e;return i}},FG=()=>{return ko("avc1.4d400d,mp4a.40.2",!0)};if(FG())lt.getTech("Html5").registerSourceHandler(km,0);lt.VhsHandler=W7;lt.VhsSourceHandler=km;lt.Vhs=Ea;if(!lt.use)lt.registerComponent("Vhs",Ea);lt.options.vhs=lt.options.vhs||{};if(!lt.getPlugin||!lt.getPlugin("reloadSourceOnError"))lt.registerPlugin("reloadSourceOnError",bG);var Ns=Ie(Pa(),1);var BG=1000;function s3(t,e,a,i){let[s,n]=Ns.useState(0),l=Ns.useRef(!1),f=Ns.useRef(!1),o=Ns.useRef(null),c=Ns.useRef(s);c.current=s,Ns.useEffect(()=>{let m=t.current;if(!m)return;let p=()=>{f.current=!0},w=()=>{f.current=!1};return m.addEventListener("play",p),m.addEventListener("pause",w),f.current=!m.paused,()=>{m.removeEventListener("play",p),m.removeEventListener("pause",w)}},[t.current]),Ns.useEffect(()=>{let m=t.current;if(!m)return;let p=null,w=null,d=!0,v=Date.now(),k=!1,y=-1,B=()=>{v=Date.now(),k=!1,y=-1},H=()=>{if(!d)return;if(m.paused||m.ended)return;let z=m,E=!!z.requestVideoFrameCallback,V=P7(e),tt=Date.now()-v,at=k&&tt>V,Q=!k&&tt>BG;if(i||!E||at||Q){let J=Math.floor(m.currentTime*e+0.45),Y=Math.max(0,Math.min(J,a-1));n(Y)}if(w=requestAnimationFrame(H),z.requestVideoFrameCallback&&p===null)p=z.requestVideoFrameCallback((J,Y)=>{p=null,v=Date.now(),k=!0,y=Y.mediaTime;let W=Math.floor(Y.mediaTime*e+0.45),ft=Math.max(0,Math.min(W,a-1));n(ft)})},M=()=>{B(),H()},D=()=>{if(p!==null){let Q=m;if(Q.cancelVideoFrameCallback)try{Q.cancelVideoFrameCallback(p)}catch{}p=null}if(w!==null)cancelAnimationFrame(w),w=null;let z=P7(e),V=k&&y>=0&&Date.now()-v<=z?y:m.currentTime,tt=Math.floor(V*e+0.45),at=Math.max(0,Math.min(tt,a-1));if(n(at),!m.ended){let Q=i3(at,e);m.currentTime=Q}},T=()=>{n(a-1)};if(m.addEventListener("play",M),m.addEventListener("pause",D),m.addEventListener("ended",T),!m.paused)B(),H();return()=>{if(d=!1,m.removeEventListener("play",M),m.removeEventListener("pause",D),m.removeEventListener("ended",T),p!==null){let z=m;if(z.cancelVideoFrameCallback)try{z.cancelVideoFrameCallback(p)}catch{}}if(w!==null)cancelAnimationFrame(w)}},[t.current,e,a]);let u=Ns.useCallback(async(m)=>{let p=t.current;if(!p)return;let w=Math.round(m),d=Math.max(0,Math.min(w,a-1));if(l.current){o.current=d,n(d);return}l.current=!0,n(d);let v=async(k)=>{let y=i3(k,e),B=!p.paused;if(p.currentTime=y,await new Promise((T)=>{let z=null,E=()=>{if(z)clearTimeout(z);p.removeEventListener("seeked",E),T()};p.addEventListener("seeked",E),z=setTimeout(()=>{p.removeEventListener("seeked",E),T()},500)}),!B&&!f.current)p.pause();let H=Math.floor(p.currentTime*e+0.45),M=Math.max(0,Math.min(H,a-1));n(M);let D=p;if(D.requestVideoFrameCallback)D.requestVideoFrameCallback((T,z)=>{let E=Math.floor(z.mediaTime*e+0.45),V=Math.max(0,Math.min(E,a-1));n(V)});if(o.current!==null){let T=o.current;o.current=null,await v(T)}else l.current=!1};await v(d)},[t,e,a]);return Ns.useEffect(()=>{let m=(p)=>{let w=p.target;if(w instanceof HTMLInputElement||w instanceof HTMLTextAreaElement||w.isContentEditable)return;if(p.key==="ArrowRight"){p.preventDefault();let d=p.shiftKey?10:1;u(c.current+d)}else if(p.key==="ArrowLeft"){p.preventDefault();let d=p.shiftKey?10:1;u(c.current-d)}};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m)}},[u]),Ns.useEffect(()=>{let m=t.current;if(!m)return;let p=()=>{if(!l.current){let w=Math.floor(m.currentTime*e+0.45),d=Math.max(0,Math.min(w,a-1));n(d);let v=i3(d,e),k=1/e;if(Math.abs(m.currentTime-v)>k/4)m.currentTime=v}};return m.addEventListener("seeked",p),()=>{m.removeEventListener("seeked",p)}},[t.current,e,a]),{currentFrame:s,setCurrentFrame:n,seekToFrame:u,isSeeking:l}}var Xk=Ie(Pa(),1);function Kk({className:t,defaultValue:e,value:a,min:i=0,max:s=100,...n}){let l=Xk.useMemo(()=>Array.isArray(a)?a:Array.isArray(e)?e:[i,s],[a,e,i,s]);return rt(E2.Root,{"data-slot":"slider",defaultValue:e,value:a,min:i,max:s,className:Mi("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",t),...n,children:[x(E2.Track,{"data-slot":"slider-track",className:Mi("relative grow overflow-hidden rounded-full bg-muted data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"),children:x(E2.Range,{"data-slot":"slider-range",className:Mi("absolute bg-primary data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),Array.from({length:l.length},(f,o)=>x(E2.Thumb,{"data-slot":"slider-thumb",className:"block size-4 shrink-0 rounded-full border border-primary bg-white shadow-sm ring-ring/50 transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"},o))]})}var ps=Ie(Pa(),1);var OG=(t)=>{if(isNaN(t))return"00:00";let e=new Date(t*1000),a=e.getUTCHours(),i=e.getUTCMinutes(),s=e.getUTCSeconds().toString().padStart(2,"0");if(a)return`${a}:${i.toString().padStart(2,"0")}:${s}`;return`${i}:${s}`},HG=({totalFrames:t,currentFrame:e,fps:a,previewUrl:i,onSeek:s,buffered:n=0,metadata:l})=>{let f=ps.useRef(null),o=ps.useRef(null),[c,u]=ps.useState(null),[m,p]=ps.useState(!1),[w,d]=ps.useState(!1),v=ps.useRef(s);ps.useEffect(()=>{v.current=s},[s]),ps.useEffect(()=>{if(o.current&&i)o.current.load()},[i]);let k=ps.useCallback((tt)=>{if(!f.current)return 0;let at=f.current.getBoundingClientRect();return Math.max(0,Math.min(tt-at.left,at.width))/at.width},[]),y=ps.useCallback((tt)=>{if(w)return;if(!f.current)return;let at=f.current.getBoundingClientRect(),Z=Math.max(0,Math.min(tt.clientX-at.left,at.width))/at.width;if(u(Z),p(!0),o.current&&t){let J=Z*t,Y=1/a,W=J*Y+Y/2,ft=o.current;if(Number.isFinite(W))ft.currentTime=W}},[t,a,w]),B=()=>{if(!w)p(!1),u(null)},H=(tt)=>{if(tt.button!==0)return;tt.preventDefault(),d(!0);let at=k(tt.clientX);u(at),p(!0),v.current(at*t)},M=(tt)=>{d(!0);let at=k(tt.touches[0].clientX);u(at),p(!0),v.current(at*t)};ps.useEffect(()=>{if(!w)return;let tt=(J)=>{let Y=k(J.clientX);if(u(Y),p(!0),o.current&&t){let W=Y*t,ft=1/a,nt=W*ft+ft/2,qt=o.current;if(Number.isFinite(nt))qt.currentTime=nt}v.current(Y*t)},at=(J)=>{d(!1);let Y=!1;if(f.current){let ft=f.current.getBoundingClientRect();Y=J.clientX>=ft.left&&J.clientX<=ft.right&&J.clientY>=ft.top&&J.clientY<=ft.bottom}if(!Y)p(!1),u(null);let W=k(J.clientX);v.current(W*t)},Q=(J)=>{if(J.touches.length===0)return;let Y=k(J.touches[0].clientX);if(u(Y),p(!0),o.current&&t){let W=Y*t,ft=1/a,nt=W*ft+ft/2,qt=o.current;if(Number.isFinite(nt))qt.currentTime=nt}v.current(Y*t)},Z=(J)=>{d(!1);let Y=J.changedTouches.length>0?J.changedTouches[0].clientX:null,W=J.changedTouches.length>0?J.changedTouches[0].clientY:null,ft=!1;if(Y!==null&&W!==null&&f.current){let nt=f.current.getBoundingClientRect();ft=Y>=nt.left&&Y<=nt.right&&W>=nt.top&&W<=nt.bottom}if(!ft)p(!1),u(null);if(Y!==null){let nt=k(Y);v.current(nt*t)}};return window.addEventListener("mousemove",tt),window.addEventListener("mouseup",at),window.addEventListener("touchmove",Q,{passive:!0}),window.addEventListener("touchend",Z),()=>{window.removeEventListener("mousemove",tt),window.removeEventListener("mouseup",at),window.removeEventListener("touchmove",Q),window.removeEventListener("touchend",Z)}},[w,t,a,k]);let D=w&&c!==null?c*100:t>0?e/t*100:0,T=c!==null?c*100:0,z=()=>{if(c===null)return{};return{left:`${T}%`,transform:`translateX(-${T}%)`}},E=180,V={width:`${E}px`,height:"auto"};if(l&&l.originalWidth&&l.originalHeight){let{originalWidth:tt,originalHeight:at}=l;if(tt>=at){let Q=E*at/tt;V={width:`${E}px`,height:`${Q}px`}}else V={width:`${E*tt/at}px`,height:`${E}px`}}return rt("div",{ref:f,className:"group relative h-1.5 w-full cursor-pointer touch-none rounded-full bg-muted transition-colors duration-200",onMouseMove:y,onMouseLeave:B,onMouseDown:H,onTouchStart:M,"data-testid":"seekbar",children:[x("video",{ref:o,src:i,className:"hidden",preload:"auto",muted:!0,playsInline:!0}),m&&t>0&&x("div",{className:"pointer-events-none absolute bottom-full z-50 mb-3 flex w-max flex-col",style:z(),children:rt("div",{className:"relative overflow-hidden rounded-lg border-2 border-border bg-popover shadow-2xl",children:[x("video",{src:i,className:"bg-black object-cover",style:V,muted:!0,ref:(tt)=>{if(tt&&o.current)tt.currentTime=o.current.currentTime}}),x("div",{className:"absolute bottom-0 w-full bg-popover/80 py-0.5 text-center text-xs font-medium text-popover-foreground",children:OG(c*t/a)})]})}),x("div",{className:"absolute top-0 left-0 h-full rounded-full bg-muted-foreground/30 transition-all duration-200",style:{width:`${n}%`}}),m&&x("div",{className:"absolute top-0 left-0 h-full rounded-full bg-primary/30",style:{width:`${T}%`}}),x("div",{className:"relative absolute top-0 left-0 h-full rounded-full bg-primary",style:{width:`${D}%`},"data-testid":"seekbar-fill",children:x("div",{className:Mi("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",m||w?"scale-100":"scale-0 group-hover:scale-100")})})]})},Lk=HG;var Wk=({state:t,zoom:e,isControlsVisible:a,buffered:i,data:s,resolutions:n,togglePlay:l,toggleLoop:f,toggleMute:o,handleVolumeChange:c,changePlaybackRate:u,changeResolution:m,handleDownload:p,toggleFullScreen:w,onZoomChange:d,onZoomReset:v,frameRate:k,totalFrames:y,currentFrame:B,seekToFrame:H,floatOverlayInFullScreen:M=!0,onMouseEnter:D,onMouseLeave:T})=>{let{videoTimeDisplayMode:z,setVideoTimeDisplayMode:E}=wo();if(!s.media?.metadata)return null;let V=t.isFullScreen&&M,tt=s.proxyType==="audio",at=n.filter((Y)=>!Y.isRaw),Q=s.media?.metadata?.startTimecode,Z=Math.max(0,y-1),J=z==="frames"?`${B} / ${Z} fr`:z==="standard"?`${cl(B,k,"standard")} / ${$k(y/k)}`:`${cl(B,k,z,Q)} / ${cl(Z,k,z,Q)}`;return rt("div",{className:Mi("transition-all duration-300 ease-in-out z-20 text-foreground",V?"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",a?"opacity-100 translate-y-0":"opacity-0 translate-y-4 pointer-events-none"),onMouseEnter:D,onMouseLeave:T,children:[x("div",{className:"mb-4 px-1",children:x(Lk,{totalFrames:y,currentFrame:B,fps:k,buffered:i,previewUrl:s.media.videoPreview?.url,onSeek:H,metadata:{...s.media.metadata,frameRate:k}})}),rt("div",{className:"flex items-center justify-between text-foreground",children:[rt("div",{className:"flex items-center gap-4",children:[x("button",{onClick:l,className:"hover:text-primary transition-colors","data-testid":"play-toggle","data-playing":t.isPlaying,"aria-label":t.isPlaying?"Pause":"Play",children:t.isPlaying?x(Vk,{className:"w-6 h-6 fill-current"}):x(hh,{className:"w-6 h-6 fill-current"})}),x("button",{onClick:f,className:Mi("transition-colors",t.isLooping?"text-primary":"text-muted-foreground"),title:"Loop",children:x(Yk,{className:"w-5 h-5"})}),rt("div",{className:"flex items-center gap-3 group/vol",children:[x("button",{onClick:o,className:"hover:text-primary",children:t.isMuted||t.volume===0?x(Zk,{className:"w-6 h-6"}):x(Qk,{className:"w-6 h-6"})}),x("div",{className:"w-0 overflow-hidden group-hover/vol:w-24 transition-all duration-300 ease-in-out",children:x("div",{className:"w-24 px-1",children:x(Kk,{value:t.isMuted?[0]:[t.volume],onValueChange:(Y)=>c(Y[0]),max:1,step:0.05})})})]}),rt("div",{className:"flex items-center gap-1 text-sm font-medium tabular-nums select-none min-w-[100px]",children:[x("span",{className:"text-muted-foreground font-mono","data-testid":"time-readout",children:J}),rt(Mf,{modal:!1,children:[x(Df,{asChild:!0,children:x("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:x(jo,{className:"h-3.5 w-3.5"})})}),rt(Tf,{align:"start",className:"w-40 z-30",children:[x(n3,{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-wider",children:"Format"}),rt(l1,{onClick:()=>E("standard"),className:"flex items-center justify-between cursor-pointer text-xs",children:[x("span",{children:"Standard Time"}),z==="standard"&&x(oh,{className:"h-3.5 w-3.5 text-primary"})]}),rt(l1,{onClick:()=>E("frames"),className:"flex items-center justify-between cursor-pointer text-xs",children:[x("span",{children:"Frames"}),z==="frames"&&x(oh,{className:"h-3.5 w-3.5 text-primary"})]}),rt(l1,{onClick:()=>E("timecode"),className:"flex items-center justify-between cursor-pointer text-xs",children:[x("span",{children:"Timecode"}),z==="timecode"&&x(oh,{className:"h-3.5 w-3.5 text-primary"})]})]})]})]})]}),rt("div",{className:"relative flex items-center gap-3",children:[!tt&&rt("div",{className:"flex items-center gap-1",children:[rt("div",{className:"flex items-center gap-1 rounded-md bg-muted p-0.5",children:[x("button",{onClick:()=>d(e*0.8),className:"p-1 hover:text-primary rounded",title:It.zoom_out(),children:x(ul,{size:14})}),rt("span",{className:"text-xs w-8 text-center tabular-nums",children:[Math.round(e*100),"%"]}),x("button",{onClick:()=>d(e*1.2),className:"p-1 hover:text-primary rounded",title:It.zoom_in(),children:x(ch,{size:14})})]}),x("button",{onClick:v,className:"text-xs font-medium px-2 py-1 rounded bg-muted hover:text-primary transition-colors",children:It.fit()})]}),rt(Mf,{children:[x(Df,{asChild:!0,children:rt("button",{className:"w-8 text-sm font-bold hover:text-primary",children:[t.playbackRate,"x"]})}),x(Tf,{children:[0.5,1,1.5,2].map((Y)=>rt(l1,{onClick:()=>u(Y),className:Mi("rounded py-1 px-2 text-left text-xs",t.playbackRate===Y?"bg-primary text-primary-foreground focus:bg-primary focus:text-primary-foreground":"text-foreground"),children:[Y,"x"]},Y))})]}),!tt&&at.length>0&&rt(Mf,{children:[x(Df,{asChild:!0,children:rt("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:[x(Jk,{className:"h-3.5 w-3.5"}),x("span",{children:t.currentResolution==="Original"?It.original():t.currentResolution})]})}),rt(Tf,{children:[x(n3,{children:It.quality()}),at.map((Y)=>rt(l1,{onClick:()=>m(Y),className:Mi("flex w-full items-center justify-between",t.currentResolution===Y.resolution?"text-primary font-medium":"text-foreground"),children:[x("span",{children:Y.resolution==="Original"?It.original():Y.resolution}),rt("span",{className:"pl-5 text-xs text-muted-foreground",children:[Y.width,"x",Y.height]})]},Y.resolution))]})]}),tt?x("button",{onClick:()=>p(s.media?.original?.key||""),className:"transition-colors hover:text-primary",title:It.download(),disabled:!s.media?.original?.key,children:x(Vn,{className:"h-5 w-5"})}):rt(Mf,{children:[x(Df,{asChild:!0,children:x("button",{className:"transition-colors hover:text-primary",title:It.download(),children:x(Vn,{className:"h-5 w-5"})})}),rt(Tf,{children:[x(n3,{children:It.download()}),n.map((Y)=>rt(l1,{onClick:()=>p(Y.key??""),className:"flex w-full items-center justify-between px-3 py-2 text-left text-sm text-foreground",children:[x("span",{children:Y.resolution==="Original"?It.original():Y.resolution}),x("span",{className:"text-xs text-muted-foreground",children:Y.isRaw?s.name?.split(".").pop()?.toUpperCase()||"RAW":"MP4"})]},Y.resolution))]})]}),x("button",{onClick:w,className:"transition-colors hover:text-primary",title:It.fullscreen(),children:t.isFullScreen?x(f3,{className:"h-6 w-6"}):x(l3,{className:"h-6 w-6"})})]})]})]})};var MG=Math.PI/180;function DG(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}var Cl=typeof global<"u"?global:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},St={_global:Cl,version:"10.3.0",isBrowser:DG(),isUnminified:/param/.test(function(t){}.toString()),dblClickWindow:400,getAngle(t){return St.angleDeg?t*MG:t},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 St.DD.isDragging},isTransforming(){var t,e;return(e=(t=St.Transformer)===null||t===void 0?void 0:t.isTransforming())!==null&&e!==void 0?e:!1},isDragReady(){return!!St.DD.node},releaseCanvasOnDestroy:!0,document:Cl.document,_injectGlobal(t){if(typeof Cl.Konva<"u")console.error("Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment.");Cl.Konva=t}},we=(t)=>{St[t.prototype.getClassName()]=t};St._injectGlobal(St);var TG=`Konva.js unsupported environment.
245
-
246
- Looks like you are trying to use Konva.js in Node.js environment. because "document" object is undefined.
247
-
248
- To use Konva.js in Node.js environment, you need to use the "canvas-backend" or "skia-backend" module.
249
-
250
- bash: npm install canvas
251
- js: import "konva/canvas-backend";
252
-
253
- or
254
-
255
- bash: npm install skia-canvas
256
- js: import "konva/skia-backend";
257
- `,Pk=()=>{if(typeof document>"u")throw Error(TG)};class Vi{constructor(t=[1,0,0,1,0,0]){this.dirty=!1,this.m=t&&t.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 Vi(this.m)}copyInto(t){t.m[0]=this.m[0],t.m[1]=this.m[1],t.m[2]=this.m[2],t.m[3]=this.m[3],t.m[4]=this.m[4],t.m[5]=this.m[5]}point(t){let e=this.m;return{x:e[0]*t.x+e[2]*t.y+e[4],y:e[1]*t.x+e[3]*t.y+e[5]}}translate(t,e){return this.m[4]+=this.m[0]*t+this.m[2]*e,this.m[5]+=this.m[1]*t+this.m[3]*e,this}scale(t,e){return this.m[0]*=t,this.m[1]*=t,this.m[2]*=e,this.m[3]*=e,this}rotate(t){let e=Math.cos(t),a=Math.sin(t),i=this.m[0]*e+this.m[2]*a,s=this.m[1]*e+this.m[3]*a,n=this.m[0]*-a+this.m[2]*e,l=this.m[1]*-a+this.m[3]*e;return this.m[0]=i,this.m[1]=s,this.m[2]=n,this.m[3]=l,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(t,e){let a=this.m[0]+this.m[2]*e,i=this.m[1]+this.m[3]*e,s=this.m[2]+this.m[0]*t,n=this.m[3]+this.m[1]*t;return this.m[0]=a,this.m[1]=i,this.m[2]=s,this.m[3]=n,this}multiply(t){let e=this.m[0]*t.m[0]+this.m[2]*t.m[1],a=this.m[1]*t.m[0]+this.m[3]*t.m[1],i=this.m[0]*t.m[2]+this.m[2]*t.m[3],s=this.m[1]*t.m[2]+this.m[3]*t.m[3],n=this.m[0]*t.m[4]+this.m[2]*t.m[5]+this.m[4],l=this.m[1]*t.m[4]+this.m[3]*t.m[5]+this.m[5];return this.m[0]=e,this.m[1]=a,this.m[2]=i,this.m[3]=s,this.m[4]=n,this.m[5]=l,this}invert(){let t=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),e=this.m[3]*t,a=-this.m[1]*t,i=-this.m[2]*t,s=this.m[0]*t,n=t*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),l=t*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=e,this.m[1]=a,this.m[2]=i,this.m[3]=s,this.m[4]=n,this.m[5]=l,this}getMatrix(){return this.m}decompose(){let t=this.m[0],e=this.m[1],a=this.m[2],i=this.m[3],s=this.m[4],n=this.m[5],l=t*i-e*a,f={x:s,y:n,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(t!=0||e!=0){let o=Math.sqrt(t*t+e*e);f.rotation=e>0?Math.acos(t/o):-Math.acos(t/o),f.scaleX=o,f.scaleY=l/o,f.skewX=(t*a+e*i)/l,f.skewY=0}else if(a!=0||i!=0){let o=Math.sqrt(a*a+i*i);f.rotation=Math.PI/2-(i>0?Math.acos(-a/o):-Math.acos(a/o)),f.scaleX=l/o,f.scaleY=o,f.skewX=0,f.skewY=(t*a+e*i)/l}return f.rotation=et._getRotation(f.rotation),f}}var RG="[object Array]",NG="[object Number]",zG="[object String]",EG="[object Boolean]",xG=Math.PI/180,UG=180/Math.PI,x2="#",IG="",GG="0",XG="Konva warning: ",tC="Konva error: ",KG="rgb(",tb={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,132,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,255,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,203],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:[119,128,144],slategrey:[119,128,144],snow:[255,255,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,5]},LG=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,r3=[],U2=null,VG=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(t){setTimeout(t,16)},et={_isElement(t){return!!(t&&t.nodeType==1)},_isFunction(t){return!!(t&&t.constructor&&t.call&&t.apply)},_isPlainObject(t){return!!t&&t.constructor===Object},_isArray(t){return Object.prototype.toString.call(t)===RG},_isNumber(t){return Object.prototype.toString.call(t)===NG&&!isNaN(t)&&isFinite(t)},_isString(t){return Object.prototype.toString.call(t)===zG},_isBoolean(t){return Object.prototype.toString.call(t)===EG},isObject(t){return t instanceof Object},isValidSelector(t){if(typeof t!=="string")return!1;let e=t[0];return e==="#"||e==="."||e===e.toUpperCase()},_sign(t){if(t===0)return 1;if(t>0)return 1;else return-1},requestAnimFrame(t){if(r3.push(t),r3.length===1)VG(function(){let e=r3;r3=[],e.forEach(function(a){a()})})},createCanvasElement(){Pk();let t=document.createElement("canvas");try{t.style=t.style||{}}catch(e){}return t},createImageElement(){return Pk(),document.createElement("img")},_isInDocument(t){while(t=t.parentNode)if(t==document)return!0;return!1},_urlToImage(t,e){let a=et.createImageElement();a.onload=function(){e(a)},a.src=t},_rgbToHex(t,e,a){return(16777216+(t<<16)+(e<<8)+a).toString(16).slice(1)},_hexToRgb(t){t=t.replace(x2,IG);let e=parseInt(t,16);return{r:e>>16&255,g:e>>8&255,b:e&255}},getRandomColor(){let t=(Math.random()*16777215<<0).toString(16);while(t.length<6)t=GG+t;return x2+t},isCanvasFarblingActive(){if(U2!==null)return U2;if(typeof document>"u")return U2=!1,!1;let t=this.createCanvasElement();t.width=10,t.height=10;let e=t.getContext("2d",{willReadFrequently:!0});e.clearRect(0,0,10,10),e.fillStyle="#282828",e.fillRect(0,0,10,10);let a=e.getImageData(0,0,10,10).data,i=!1;for(let s=0;s<100;s++)if(a[s*4]!==40||a[s*4+1]!==40||a[s*4+2]!==40||a[s*4+3]!==255){i=!0;break}return U2=i,this.releaseCanvas(t),U2},getHitColor(){let t=this.getRandomColor();return this.isCanvasFarblingActive()?this.getSnappedHexColor(t):t},getHitColorKey(t,e,a){if(this.isCanvasFarblingActive())t=Math.round(t/5)*5,e=Math.round(e/5)*5,a=Math.round(a/5)*5;return x2+this._rgbToHex(t,e,a)},getSnappedHexColor(t){let e=this._hexToRgb(t);return x2+this._rgbToHex(Math.round(e.r/5)*5,Math.round(e.g/5)*5,Math.round(e.b/5)*5)},getRGB(t){let e;if(t in tb)return e=tb[t],{r:e[0],g:e[1],b:e[2]};else if(t[0]===x2)return this._hexToRgb(t.substring(1));else if(t.substr(0,4)===KG)return e=LG.exec(t.replace(/ /g,"")),{r:parseInt(e[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10)};else return{r:0,g:0,b:0}},colorToRGBA(t){return t=t||"black",et._namedColorToRBA(t)||et._hex3ColorToRGBA(t)||et._hex4ColorToRGBA(t)||et._hex6ColorToRGBA(t)||et._hex8ColorToRGBA(t)||et._rgbColorToRGBA(t)||et._rgbaColorToRGBA(t)||et._hslColorToRGBA(t)},_namedColorToRBA(t){let e=tb[t.toLowerCase()];if(!e)return null;return{r:e[0],g:e[1],b:e[2],a:1}},_rgbColorToRGBA(t){if(t.indexOf("rgb(")===0){t=t.match(/rgb\(([^)]+)\)/)[1];let e=t.split(/ *, */).map(Number);return{r:e[0],g:e[1],b:e[2],a:1}}},_rgbaColorToRGBA(t){if(t.indexOf("rgba(")===0){t=t.match(/rgba\(([^)]+)\)/)[1];let e=t.split(/ *, */).map((a,i)=>{if(a.slice(-1)==="%")return i===3?parseInt(a)/100:parseInt(a)/100*255;return Number(a)});return{r:e[0],g:e[1],b:e[2],a:e[3]}}},_hex8ColorToRGBA(t){if(t[0]==="#"&&t.length===9)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:parseInt(t.slice(7,9),16)/255}},_hex6ColorToRGBA(t){if(t[0]==="#"&&t.length===7)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:1}},_hex4ColorToRGBA(t){if(t[0]==="#"&&t.length===5)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:parseInt(t[4]+t[4],16)/255}},_hex3ColorToRGBA(t){if(t[0]==="#"&&t.length===4)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:1}},_hslColorToRGBA(t){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(t)){let[e,...a]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t),i=Number(a[0])/360,s=Number(a[1])/100,n=Number(a[2])/100,l,f,o;if(s===0)return o=n*255,{r:Math.round(o),g:Math.round(o),b:Math.round(o),a:1};if(n<0.5)l=n*(1+s);else l=n+s-n*s;let c=2*n-l,u=[0,0,0];for(let m=0;m<3;m++){if(f=i+0.3333333333333333*-(m-1),f<0)f++;if(f>1)f--;if(6*f<1)o=c+(l-c)*6*f;else if(2*f<1)o=l;else if(3*f<2)o=c+(l-c)*(0.6666666666666666-f)*6;else o=c;u[m]=o*255}return{r:Math.round(u[0]),g:Math.round(u[1]),b:Math.round(u[2]),a:1}}},haveIntersection(t,e){return!(e.x>t.x+t.width||e.x+e.width<t.x||e.y>t.y+t.height||e.y+e.height<t.y)},cloneObject(t){let e={};for(let a in t)if(this._isPlainObject(t[a]))e[a]=this.cloneObject(t[a]);else if(this._isArray(t[a]))e[a]=this.cloneArray(t[a]);else e[a]=t[a];return e},cloneArray(t){return t.slice(0)},degToRad(t){return t*xG},radToDeg(t){return t*UG},_degToRad(t){return et.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),et.degToRad(t)},_radToDeg(t){return et.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),et.radToDeg(t)},_getRotation(t){return St.angleDeg?et.radToDeg(t):t},_capitalize(t){return t.charAt(0).toUpperCase()+t.slice(1)},throw(t){throw Error(tC+t)},error(t){console.error(tC+t)},warn(t){if(!St.showWarnings)return;console.warn(XG+t)},each(t,e){for(let a in t)e(a,t[a])},_inRange(t,e,a){return e<=t&&t<a},_getProjectionToSegment(t,e,a,i,s,n){let l,f,o,c=(t-a)*(t-a)+(e-i)*(e-i);if(c==0)l=t,f=e,o=(s-a)*(s-a)+(n-i)*(n-i);else{let u=((s-t)*(a-t)+(n-e)*(i-e))/c;if(u<0)l=t,f=e,o=(t-s)*(t-s)+(e-n)*(e-n);else if(u>1)l=a,f=i,o=(a-s)*(a-s)+(i-n)*(i-n);else l=t+u*(a-t),f=e+u*(i-e),o=(l-s)*(l-s)+(f-n)*(f-n)}return[l,f,o]},_getProjectionToLine(t,e,a){let i=et.cloneObject(t),s=Number.MAX_VALUE;return e.forEach(function(n,l){if(!a&&l===e.length-1)return;let f=e[(l+1)%e.length],o=et._getProjectionToSegment(n.x,n.y,f.x,f.y,t.x,t.y),c=o[0],u=o[1],m=o[2];if(m<s)i.x=c,i.y=u,s=m}),i},_prepareArrayForTween(t,e,a){let i=[],s=[];if(t.length>e.length){let l=e;e=t,t=l}for(let l=0;l<t.length;l+=2)i.push({x:t[l],y:t[l+1]});for(let l=0;l<e.length;l+=2)s.push({x:e[l],y:e[l+1]});let n=[];return s.forEach(function(l){let f=et._getProjectionToLine(l,i,a);n.push(f.x),n.push(f.y)}),n},_prepareToStringify(t){let e;t.visitedByCircularReferenceRemoval=!0;for(let a in t){if(!(t.hasOwnProperty(a)&&t[a]&&typeof t[a]=="object"))continue;if(e=Object.getOwnPropertyDescriptor(t,a),t[a].visitedByCircularReferenceRemoval||et._isElement(t[a]))if(e.configurable)delete t[a];else return null;else if(et._prepareToStringify(t[a])===null)if(e.configurable)delete t[a];else return null}return delete t.visitedByCircularReferenceRemoval,t},_assign(t,e){for(let a in e)t[a]=e[a];return t},_getFirstPointerId(t){if(!t.touches)return t.pointerId||999;else return t.changedTouches[0].identifier},releaseCanvas(...t){if(!St.releaseCanvasOnDestroy)return;t.forEach((e)=>{e.width=0,e.height=0})},drawRoundedRectPath(t,e,a,i){let s=e<0?e:0,n=a<0?a:0;e=Math.abs(e),a=Math.abs(a);let l=0,f=0,o=0,c=0;if(typeof i==="number")l=f=o=c=Math.min(i,e/2,a/2);else l=Math.min(i[0]||0,e/2,a/2),f=Math.min(i[1]||0,e/2,a/2),c=Math.min(i[2]||0,e/2,a/2),o=Math.min(i[3]||0,e/2,a/2);t.moveTo(s+l,n),t.lineTo(s+e-f,n),t.arc(s+e-f,n+f,f,Math.PI*3/2,0,!1),t.lineTo(s+e,n+a-c),t.arc(s+e-c,n+a-c,c,0,Math.PI/2,!1),t.lineTo(s+o,n+a),t.arc(s+o,n+a-o,o,Math.PI/2,Math.PI,!1),t.lineTo(s,n+l),t.arc(s+l,n+l,l,Math.PI,Math.PI*3/2,!1)},drawRoundedPolygonPath(t,e,a,i,s){i=Math.abs(i);for(let n=0;n<a;n++){let l=e[(n-1+a)%a],f=e[n],o=e[(n+1)%a],c={x:f.x-l.x,y:f.y-l.y},u={x:o.x-f.x,y:o.y-f.y},m=Math.hypot(c.x,c.y),p=Math.hypot(u.x,u.y),w;if(typeof s==="number")w=s;else w=n<s.length?s[n]:0;w=i*Math.cos(Math.PI/a)*Math.min(1,w/i*2);let v={x:c.x/m,y:c.y/m},k={x:u.x/p,y:u.y/p},y={x:f.x-v.x*w,y:f.y-v.y*w},B={x:f.x+k.x*w,y:f.y+k.y*w};if(n===0)t.moveTo(y.x,y.y);else t.lineTo(y.x,y.y);t.arcTo(f.x,f.y,B.x,B.y,w)}}};function YG(t){let e=[],a=t.length,i=et;for(let s=0;s<a;s++){let n=t[s];if(i._isNumber(n))n=Math.round(n*1000)/1000;else if(!i._isString(n))n=n+"";e.push(n)}return e}var eC=",",JG="(",QG=")",ZG="([",$G="])",WG=";",PG="()",tX="=",aC=["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"],eX=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","filter"],aX=100,o3=null;function eb(){if(o3!==null)return o3;try{let e=et.createCanvasElement().getContext("2d");if(!e)return o3=!1,!1;return!!e&&"filter"in e}catch(t){return o3=!1,!1}}class uh{constructor(t){if(this.canvas=t,St.enableTrace)this.traceArr=[],this._enableTrace()}fillShape(t){if(t.fillEnabled())this._fill(t)}_fill(t){}strokeShape(t){if(t.hasStroke())this._stroke(t)}_stroke(t){}fillStrokeShape(t){if(t.attrs.fillAfterStrokeEnabled)this.strokeShape(t),this.fillShape(t);else this.fillShape(t),this.strokeShape(t)}getTrace(t,e){let a=this.traceArr,i=a.length,s="",n,l,f,o;for(n=0;n<i;n++){if(l=a[n],f=l.method,f)if(o=l.args,s+=f,t)s+=PG;else if(et._isArray(o[0]))s+=ZG+o.join(eC)+$G;else{if(e)o=o.map((c)=>typeof c==="number"?Math.floor(c):c);s+=JG+o.join(eC)+QG}else if(s+=l.property,!t)s+=tX+l.val;s+=WG}return s}clearTrace(){this.traceArr=[]}_trace(t){let e=this.traceArr,a;if(e.push(t),a=e.length,a>=aX)e.shift()}reset(){let t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){let e=this.getCanvas();if(t)this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0);else this.clearRect(0,0,e.getWidth()/e.pixelRatio,e.getHeight()/e.pixelRatio)}_applyLineCap(t){let e=t.attrs.lineCap;if(e)this.setAttr("lineCap",e)}_applyOpacity(t){let e=t.getAbsoluteOpacity();if(e!==1)this.setAttr("globalAlpha",e)}_applyLineJoin(t){let e=t.attrs.lineJoin;if(e)this.setAttr("lineJoin",e)}_applyMiterLimit(t){let e=t.attrs.miterLimit;if(e!=null)this.setAttr("miterLimit",e)}setAttr(t,e){this._context[t]=e}arc(t,e,a,i,s,n){this._context.arc(t,e,a,i,s,n)}arcTo(t,e,a,i,s){this._context.arcTo(t,e,a,i,s)}beginPath(){this._context.beginPath()}bezierCurveTo(t,e,a,i,s,n){this._context.bezierCurveTo(t,e,a,i,s,n)}clearRect(t,e,a,i){this._context.clearRect(t,e,a,i)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,e){let a=arguments;if(a.length===2)return this._context.createImageData(t,e);else if(a.length===1)return this._context.createImageData(t)}createLinearGradient(t,e,a,i){return this._context.createLinearGradient(t,e,a,i)}createPattern(t,e){return this._context.createPattern(t,e)}createRadialGradient(t,e,a,i,s,n){return this._context.createRadialGradient(t,e,a,i,s,n)}drawImage(t,e,a,i,s,n,l,f,o){let c=arguments,u=this._context;if(c.length===3)u.drawImage(t,e,a);else if(c.length===5)u.drawImage(t,e,a,i,s);else if(c.length===9)u.drawImage(t,e,a,i,s,n,l,f,o)}ellipse(t,e,a,i,s,n,l,f){this._context.ellipse(t,e,a,i,s,n,l,f)}isPointInPath(t,e,a,i){if(a)return this._context.isPointInPath(a,t,e,i);return this._context.isPointInPath(t,e,i)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,e,a,i){this._context.fillRect(t,e,a,i)}strokeRect(t,e,a,i){this._context.strokeRect(t,e,a,i)}fillText(t,e,a,i){if(i)this._context.fillText(t,e,a,i);else this._context.fillText(t,e,a)}measureText(t){return this._context.measureText(t)}getImageData(t,e,a,i){return this._context.getImageData(t,e,a,i)}lineTo(t,e){this._context.lineTo(t,e)}moveTo(t,e){this._context.moveTo(t,e)}rect(t,e,a,i){this._context.rect(t,e,a,i)}roundRect(t,e,a,i,s){this._context.roundRect(t,e,a,i,s)}putImageData(t,e,a){this._context.putImageData(t,e,a)}quadraticCurveTo(t,e,a,i){this._context.quadraticCurveTo(t,e,a,i)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,e){this._context.scale(t,e)}setLineDash(t){if(this._context.setLineDash)this._context.setLineDash(t);else if("mozDash"in this._context)this._context.mozDash=t;else if("webkitLineDash"in this._context)this._context.webkitLineDash=t}getLineDash(){return this._context.getLineDash()}setTransform(t,e,a,i,s,n){this._context.setTransform(t,e,a,i,s,n)}stroke(t){if(t)this._context.stroke(t);else this._context.stroke()}strokeText(t,e,a,i){this._context.strokeText(t,e,a,i)}transform(t,e,a,i,s,n){this._context.transform(t,e,a,i,s,n)}translate(t,e){this._context.translate(t,e)}_enableTrace(){let t=this,e=aC.length,a=this.setAttr,i,s,n=function(l){let f=t[l],o;t[l]=function(){return s=YG(Array.prototype.slice.call(arguments,0)),o=f.apply(t,arguments),t._trace({method:l,args:s}),o}};for(i=0;i<e;i++)n(aC[i]);t.setAttr=function(){a.apply(t,arguments);let l=arguments[0],f=arguments[1];if(l==="shadowOffsetX"||l==="shadowOffsetY"||l==="shadowBlur")f=f/this.canvas.getPixelRatio();t._trace({property:l,val:f})}}_applyGlobalCompositeOperation(t){let e=t.attrs.globalCompositeOperation;if(!(!e||e==="source-over"))this.setAttr("globalCompositeOperation",e)}}eX.forEach(function(t){Object.defineProperty(uh.prototype,t,{get(){return this._context[t]},set(e){this._context[t]=e}})});class ab extends uh{constructor(t,{willReadFrequently:e=!1}={}){super(t);this._context=t._canvas.getContext("2d",{willReadFrequently:e})}_fillColor(t){let e=t.fill();this.setAttr("fillStyle",e),t._fillFunc(this)}_fillPattern(t){this.setAttr("fillStyle",t._getFillPattern()),t._fillFunc(this)}_fillLinearGradient(t){let e=t._getLinearGradient();if(e)this.setAttr("fillStyle",e),t._fillFunc(this)}_fillRadialGradient(t){let e=t._getRadialGradient();if(e)this.setAttr("fillStyle",e),t._fillFunc(this)}_fill(t){let e=t.fill(),a=t.getFillPriority();if(e&&a==="color"){this._fillColor(t);return}let i=t.getFillPatternImage();if(i&&a==="pattern"){this._fillPattern(t);return}let s=t.getFillLinearGradientColorStops();if(s&&a==="linear-gradient"){this._fillLinearGradient(t);return}let n=t.getFillRadialGradientColorStops();if(n&&a==="radial-gradient"){this._fillRadialGradient(t);return}if(e)this._fillColor(t);else if(i)this._fillPattern(t);else if(s)this._fillLinearGradient(t);else if(n)this._fillRadialGradient(t)}_strokeLinearGradient(t){let e=t.getStrokeLinearGradientStartPoint(),a=t.getStrokeLinearGradientEndPoint(),i=t.getStrokeLinearGradientColorStops(),s=this.createLinearGradient(e.x,e.y,a.x,a.y);if(i){for(let n=0;n<i.length;n+=2)s.addColorStop(i[n],i[n+1]);this.setAttr("strokeStyle",s)}}_stroke(t){let e=t.dash(),a=t.getStrokeScaleEnabled();if(t.hasStroke()){if(!a){this.save();let s=this.getCanvas().getPixelRatio();this.setTransform(s,0,0,s,0,0)}if(this._applyLineCap(t),e&&t.dashEnabled())this.setLineDash(e),this.setAttr("lineDashOffset",t.dashOffset());if(this.setAttr("lineWidth",t.strokeWidth()),!t.getShadowForStrokeEnabled())this.setAttr("shadowColor","rgba(0,0,0,0)");if(t.getStrokeLinearGradientColorStops())this._strokeLinearGradient(t);else this.setAttr("strokeStyle",t.stroke());if(t._strokeFunc(this),!a)this.restore()}}_applyShadow(t){var e,a,i;let s=(e=t.getShadowRGBA())!==null&&e!==void 0?e:"black",n=(a=t.getShadowBlur())!==null&&a!==void 0?a:5,l=(i=t.getShadowOffset())!==null&&i!==void 0?i:{x:0,y:0},f=t.getAbsoluteScale(),o=this.canvas.getPixelRatio(),c=f.x*o,u=f.y*o;this.setAttr("shadowColor",s),this.setAttr("shadowBlur",n*Math.min(Math.abs(c),Math.abs(u))),this.setAttr("shadowOffsetX",l.x*c),this.setAttr("shadowOffsetY",l.y*u)}}class ib extends uh{constructor(t){super(t);this._context=t._canvas.getContext("2d",{willReadFrequently:!0})}_fill(t){this.save(),this.setAttr("fillStyle",t.colorKey),t._fillFuncHit(this),this.restore()}strokeShape(t){if(t.hasHitStroke())this._stroke(t)}_stroke(t){if(t.hasHitStroke()){let e=t.getStrokeScaleEnabled();if(!e){this.save();let s=this.getCanvas().getPixelRatio();this.setTransform(s,0,0,s,0,0)}this._applyLineCap(t);let a=t.hitStrokeWidth(),i=a==="auto"?t.strokeWidth():a;if(this.setAttr("lineWidth",i),this.setAttr("strokeStyle",t.colorKey),t._strokeFuncHit(this),!e)this.restore()}}}var h3;function iX(){if(h3)return h3;let t=et.createCanvasElement(),e=t.getContext("2d");return h3=function(){let a=St._global.devicePixelRatio||1,i=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return a/i}(),et.releaseCanvas(t),h3}class I2{constructor(t){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;let a=(t||{}).pixelRatio||St.pixelRatio||iX();this.pixelRatio=a,this._canvas=et.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(t){let e=this.pixelRatio;this.pixelRatio=t,this.setSize(this.getWidth()/e,this.getHeight()/e)}setWidth(t){this.width=this._canvas.width=t*this.pixelRatio,this._canvas.style.width=t+"px";let e=this.pixelRatio;this.getContext()._context.scale(e,e)}setHeight(t){this.height=this._canvas.height=t*this.pixelRatio,this._canvas.style.height=t+"px";let e=this.pixelRatio;this.getContext()._context.scale(e,e)}getWidth(){return this.width}getHeight(){return this.height}setSize(t,e){this.setWidth(t||0),this.setHeight(e||0)}toDataURL(t,e){try{return this._canvas.toDataURL(t,e)}catch(a){try{return this._canvas.toDataURL()}catch(i){return et.error("Unable to get data URL. "+i.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}class Fn extends I2{constructor(t={width:0,height:0,willReadFrequently:!1}){super(t);this.context=new ab(this,{willReadFrequently:t.willReadFrequently}),this.setSize(t.width,t.height)}}class Pf extends I2{constructor(t={width:0,height:0}){super(t);this.hitCanvas=!0,this.context=new ib(this),this.setSize(t.width,t.height)}}var Ge={get isDragging(){let t=!1;return Ge._dragElements.forEach((e)=>{if(e.dragStatus==="dragging")t=!0}),t},justDragged:!1,get node(){let t;return Ge._dragElements.forEach((e)=>{t=e.node}),t},_dragElements:new Map,_drag(t){let e=[];Ge._dragElements.forEach((a,i)=>{let{node:s}=a,n=s.getStage();if(n.setPointersPositions(t),a.pointerId===void 0)a.pointerId=et._getFirstPointerId(t);let l=n._changedPointerPositions.find((f)=>f.id===a.pointerId);if(!l)return;if(a.dragStatus!=="dragging"){let f=s.dragDistance();if(Math.max(Math.abs(l.x-a.startPointerPos.x),Math.abs(l.y-a.startPointerPos.y))<f)return;if(s.startDrag({evt:t}),!s.isDragging())return}s._setDragPosition(t,a),e.push(s)}),e.forEach((a)=>{if(!a.getStage())return;a.fire("dragmove",{type:"dragmove",target:a,evt:t},!0)})},_endDragBefore(t){let e=[];Ge._dragElements.forEach((a)=>{let{node:i}=a,s=i.getStage();if(t)s.setPointersPositions(t);if(!s._changedPointerPositions.find((f)=>f.id===a.pointerId))return;if(a.dragStatus==="dragging"||a.dragStatus==="stopped")Ge.justDragged=!0,St._mouseListenClick=!1,St._touchListenClick=!1,St._pointerListenClick=!1,a.dragStatus="stopped";let l=a.node.getLayer()||a.node instanceof St.Stage&&a.node;if(l&&e.indexOf(l)===-1)e.push(l)}),e.forEach((a)=>{a.draw()})},_endDragAfter(t){Ge._dragElements.forEach((e,a)=>{if(e.dragStatus==="stopped")e.node.fire("dragend",{type:"dragend",target:e.node,evt:t},!0);if(e.dragStatus!=="dragging")Ge._dragElements.delete(a)})}};if(St.isBrowser)window.addEventListener("mouseup",Ge._endDragBefore,!0),window.addEventListener("touchend",Ge._endDragBefore,!0),window.addEventListener("touchcancel",Ge._endDragBefore,!0),window.addEventListener("mousemove",Ge._drag),window.addEventListener("touchmove",Ge._drag),window.addEventListener("mouseup",Ge._endDragAfter,!1),window.addEventListener("touchend",Ge._endDragAfter,!1),window.addEventListener("touchcancel",Ge._endDragAfter,!1);function _l(t){if(et._isString(t))return'"'+t+'"';if(Object.prototype.toString.call(t)==="[object Number]")return t;if(et._isBoolean(t))return t;return Object.prototype.toString.call(t)}function c3(t){if(t>255)return 255;else if(t<0)return 0;return Math.round(t)}function jt(){if(St.isUnminified)return function(t,e){if(!et._isNumber(t))et.warn(_l(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.');return t}}function Fl(t){if(St.isUnminified)return function(e,a){let i=et._isNumber(e),s=et._isArray(e)&&e.length==t;if(!i&&!s)et.warn(_l(e)+' is a not valid value for "'+a+'" attribute. The value should be a number or Array<number>('+t+")");return e}}function G2(){if(St.isUnminified)return function(t,e){if(!(et._isNumber(t)||t==="auto"))et.warn(_l(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".');return t}}function S0(){if(St.isUnminified)return function(t,e){if(!et._isString(t))et.warn(_l(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.');return t}}function sb(){if(St.isUnminified)return function(t,e){let a=et._isString(t),i=Object.prototype.toString.call(t)==="[object CanvasGradient]"||t&&t.addColorStop;if(!(a||i))et.warn(_l(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.');return t}}function iC(){if(St.isUnminified)return function(t,e){let a=Int8Array?Object.getPrototypeOf(Int8Array):null;if(a&&t instanceof a)return t;if(!et._isArray(t))et.warn(_l(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.');else t.forEach(function(i){if(!et._isNumber(i))et.warn('"'+e+'" attribute has non numeric element '+i+". Make sure that all elements are numbers.")});return t}}function Yi(){if(St.isUnminified)return function(t,e){if(!(t===!0||t===!1))et.warn(_l(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.');return t}}function sC(t){if(St.isUnminified)return function(e,a){if(e===void 0||e===null)return e;if(!et.isObject(e))et.warn(_l(e)+' is a not valid value for "'+a+'" attribute. The value should be an object with properties '+t);return e}}var X2="get",K2="set",X={addGetterSetter(t,e,a,i,s){X.addGetter(t,e,a),X.addSetter(t,e,i,s),X.addOverloadedGetterSetter(t,e)},addGetter(t,e,a){let i=X2+et._capitalize(e);t.prototype[i]=t.prototype[i]||function(){let s=this.attrs[e];return s===void 0?a:s}},addSetter(t,e,a,i){let s=K2+et._capitalize(e);if(!t.prototype[s])X.overWriteSetter(t,e,a,i)},overWriteSetter(t,e,a,i){let s=K2+et._capitalize(e);t.prototype[s]=function(n){if(a&&n!==void 0&&n!==null)n=a.call(this,n,e);if(this._setAttr(e,n),i)i.call(this);return this}},addComponentsGetterSetter(t,e,a,i,s){let n=a.length,l=et._capitalize,f=X2+l(e),o=K2+l(e);t.prototype[f]=function(){let u={};for(let m=0;m<n;m++){let p=a[m];u[p]=this.getAttr(e+l(p))}return u};let c=sC(a);t.prototype[o]=function(u){let m=this.attrs[e];if(i)u=i.call(this,u,e);if(c)c.call(this,u,e);for(let p in u){if(!u.hasOwnProperty(p))continue;this._setAttr(e+l(p),u[p])}if(!u)a.forEach((p)=>{this._setAttr(e+l(p),void 0)});if(this._fireChangeEvent(e,m,u),s)s.call(this);return this},X.addOverloadedGetterSetter(t,e)},addOverloadedGetterSetter(t,e){let a=et._capitalize(e),i=K2+a,s=X2+a;t.prototype[e]=function(){if(arguments.length)return this[i](arguments[0]),this;return this[s]()}},addDeprecatedGetterSetter(t,e,a,i){et.error("Adding deprecated "+e);let s=X2+et._capitalize(e),n=e+" property is deprecated and will be removed soon. Look at Konva change log for more information.";t.prototype[s]=function(){et.error(n);let l=this.attrs[e];return l===void 0?a:l},X.addSetter(t,e,i,function(){et.error(n)}),X.addOverloadedGetterSetter(t,e)},backCompat(t,e){et.each(e,function(a,i){let s=t.prototype[i],n=X2+et._capitalize(a),l=K2+et._capitalize(a);function f(){s.apply(this,arguments),et.error('"'+a+'" method is deprecated and will be removed soon. Use ""'+i+'" instead.')}t.prototype[a]=f,t.prototype[n]=f,t.prototype[l]=f})},afterSetFilter(){this._filterUpToDate=!1}};function sX(t){let e=/(\w+)\(([^)]+)\)/g,a;while((a=e.exec(t))!==null){let[,i,s]=a;switch(i){case"blur":{let n=parseFloat(s.replace("px",""));return function(l){this.blurRadius(n*0.5);let f=St.Filters;if(f&&f.Blur)f.Blur.call(this,l)}}case"brightness":{let n=s.includes("%")?parseFloat(s)/100:parseFloat(s);return function(l){this.brightness(n);let f=St.Filters;if(f&&f.Brightness)f.Brightness.call(this,l)}}case"contrast":{let n=parseFloat(s);return function(l){let f=100*(Math.sqrt(n)-1);this.contrast(f);let o=St.Filters;if(o&&o.Contrast)o.Contrast.call(this,l)}}case"grayscale":return function(n){let l=St.Filters;if(l&&l.Grayscale)l.Grayscale.call(this,n)};case"sepia":return function(n){let l=St.Filters;if(l&&l.Sepia)l.Sepia.call(this,n)};case"invert":return function(n){let l=St.Filters;if(l&&l.Invert)l.Invert.call(this,n)};default:et.warn(`CSS filter "${i}" is not supported in fallback mode. Consider using function filters for better compatibility.`);break}}return()=>{}}var u3="absoluteOpacity",nC="allEventListeners",w1="absoluteTransform",lC="absoluteScale",tr="canvas",nX="Change",lX="children",fX="konva",nb="listening",rX="mouseenter",oX="mouseleave",hX="pointerenter",cX="pointerleave",uX="touchenter",mX="touchleave";var fC="set",rC="Shape",m3=" ",oC="stage",Bl="transform",gX="Stage",lb="visible",bX=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(m3),pX=1;class vt{constructor(t){this._id=pX++,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(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){if((t===Bl||t===w1)&&this._cache.get(t))this._cache.get(t).dirty=!0;else if(t)this._cache.delete(t);else this._cache.clear()}_getCache(t,e){let a=this._cache.get(t);if(a===void 0||(t===Bl||t===w1)&&a.dirty===!0)a=e.call(this),this._cache.set(t,a);return a}_calculate(t,e,a){if(!this._attachedDepsListeners.get(t)){let i=e.map((s)=>s+"Change.konva").join(m3);this.on(i,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,a)}_getCanvasCache(){return this._cache.get(tr)}_clearSelfAndDescendantCache(t){if(this._clearCache(t),t===w1)this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(tr)){let{scene:t,filter:e,hit:a}=this._cache.get(tr);et.releaseCanvas(t._canvas,e._canvas,a._canvas),this._cache.delete(tr)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){let e=t||{},a={};if(e.x===void 0||e.y===void 0||e.width===void 0||e.height===void 0)a=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0});let i=Math.ceil(e.width||a.width),s=Math.ceil(e.height||a.height),n=e.pixelRatio,l=e.x===void 0?Math.floor(a.x):e.x,f=e.y===void 0?Math.floor(a.y):e.y,o=e.offset||0,c=e.drawBorder||!1,u=e.hitCanvasPixelRatio||1;if(!i||!s){et.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}let m=Math.abs(Math.round(a.x)-l)>0.5?1:0,p=Math.abs(Math.round(a.y)-f)>0.5?1:0;i+=o*2+m,s+=o*2+p,l-=o,f-=o;let w=new Fn({pixelRatio:n,width:i,height:s}),d=new Fn({pixelRatio:n,width:0,height:0,willReadFrequently:!0}),v=new Pf({pixelRatio:u,width:i,height:s}),k=w.getContext(),y=v.getContext(),B=new Fn({width:w.width/w.pixelRatio+Math.abs(l),height:w.height/w.pixelRatio+Math.abs(f),pixelRatio:w.pixelRatio}),H=B.getContext();if(v.isCache=!0,w.isCache=!0,this._cache.delete(tr),this._filterUpToDate=!1,e.imageSmoothingEnabled===!1)w.getContext()._context.imageSmoothingEnabled=!1,d.getContext()._context.imageSmoothingEnabled=!1;if(k.save(),y.save(),H.save(),k.translate(-l,-f),y.translate(-l,-f),H.translate(-l,-f),B.x=l,B.y=f,this._isUnderCache=!0,this._clearSelfAndDescendantCache(u3),this._clearSelfAndDescendantCache(lC),this.drawScene(w,this,B),this.drawHit(v,this),this._isUnderCache=!1,k.restore(),y.restore(),c)k.save(),k.beginPath(),k.rect(0,0,i,s),k.closePath(),k.setAttr("strokeStyle","red"),k.setAttr("lineWidth",5),k.stroke(),k.restore();return et.releaseCanvas(B._canvas),this._cache.set(tr,{scene:w,filter:d,hit:v,x:l,y:f}),this._requestDraw(),this}isCached(){return this._cache.has(tr)}getClientRect(t){throw Error('abstract "getClientRect" method call')}_transformedRect(t,e){let a=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],i=1/0,s=1/0,n=-1/0,l=-1/0,f=this.getAbsoluteTransform(e);return a.forEach(function(o){let c=f.point(o);if(i===void 0)i=n=c.x,s=l=c.y;i=Math.min(i,c.x),s=Math.min(s,c.y),n=Math.max(n,c.x),l=Math.max(l,c.y)}),{x:i,y:s,width:n-i,height:l-s}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);let e=this._getCanvasCache();t.translate(e.x,e.y);let a=this._getCachedSceneCanvas(),i=a.pixelRatio;t.drawImage(a._canvas,0,0,a.width/i,a.height/i),t.restore()}_drawCachedHitCanvas(t){let e=this._getCanvasCache(),a=e.hit;t.save(),t.translate(e.x,e.y),t.drawImage(a._canvas,0,0,a.width/a.pixelRatio,a.height/a.pixelRatio),t.restore()}_getCachedSceneCanvas(){let t=this.filters(),e=this._getCanvasCache(),a=e.scene,i=e.filter,s=i.getContext(),n,l,f,o;if(!t||t.length===0)return a;if(this._filterUpToDate)return i;let c=!0;for(let m=0;m<t.length;m++){let p=typeof t[m]==="string"&&!eb();if(typeof t[m]!=="string"||!eb()){c=!1;break}}let u=a.pixelRatio;if(i.setSize(a.width/a.pixelRatio,a.height/a.pixelRatio),c){let m=t.join(" ");return s.save(),s.setAttr("filter",m),s.drawImage(a._canvas,0,0,a.getWidth()/u,a.getHeight()/u),s.restore(),this._filterUpToDate=!0,i}try{n=t.length,s.clear(),s.drawImage(a._canvas,0,0,a.getWidth()/u,a.getHeight()/u),l=s.getImageData(0,0,i.getWidth(),i.getHeight());for(f=0;f<n;f++){if(o=t[f],typeof o==="string")o=sX(o);o.call(this,l),s.putImageData(l,0,0)}}catch(m){et.error("Unable to apply filter. "+m.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}return this._filterUpToDate=!0,i}on(...t){let e=t[0],a=t[1],i=t[2];if(this._cache)this._cache.delete(nC);if(t.length===3)return this._delegate.apply(this,t);let s=e.split(m3);for(let n=0;n<s.length;n++){let f=s[n].split("."),o=f[0],c=f[1]||"";if(!this.eventListeners[o])this.eventListeners[o]=[];this.eventListeners[o].push({name:c,handler:a})}return this}off(t,e){let a=(t||"").split(m3),i=a.length,s,n,l,f,o,c;if(this._cache&&this._cache.delete(nC),!t)for(n in this.eventListeners)this._off(n);for(s=0;s<i;s++)if(l=a[s],f=l.split("."),o=f[0],c=f[1],o){if(this.eventListeners[o])this._off(o,c,e)}else for(n in this.eventListeners)this._off(n,c,e);return this}dispatchEvent(t){let e={target:this,type:t.type,evt:t};return this.fire(t.type,e),this}addEventListener(t,e){return this.on(t,function(a){e.call(this,a.evt)}),this}removeEventListener(t){return this.off(t),this}_delegate(t,e,a){let i=this;return this.on(t,function(s){let n=s.target.findAncestors(e,!0,i);for(let l=0;l<n.length;l++)s=et.cloneObject(s),s.currentTarget=n[l],a.call(n[l],s)}),this}remove(){if(this.isDragging())this.stopDrag();return Ge._dragElements.delete(this._id),Ge._dragElements.forEach((t,e)=>{if(this.isAncestorOf(t.node))Ge._dragElements.delete(e)}),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(w1),this._clearSelfAndDescendantCache(u3),this._clearSelfAndDescendantCache(lC),this._clearSelfAndDescendantCache(oC),this._clearSelfAndDescendantCache(lb),this._clearSelfAndDescendantCache(nb)}_remove(){this._clearCaches();let t=this.getParent();if(t&&t.children)t.children.splice(this.index,1),t._setChildrenIndices(),this.parent=null}destroy(){return this.remove(),this.clearCache(),this}getAttr(t){let e="get"+et._capitalize(t);if(et._isFunction(this[e]))return this[e]();return this.attrs[t]}getAncestors(){let t=this.getParent(),e=[];while(t)e.push(t),t=t.getParent();return e}getAttrs(){return this.attrs||{}}setAttrs(t){return this._batchTransformChanges(()=>{let e,a;if(!t)return this;for(e in t){if(e===lX)continue;if(a=fC+et._capitalize(e),et._isFunction(this[a]))this[a](t[e]);else this._setAttr(e,t[e])}}),this}isListening(){return this._getCache(nb,this._isListening)}_isListening(t){if(!this.listening())return!1;let a=this.getParent();if(a&&a!==t&&this!==t)return a._isListening(t);else return!0}isVisible(){return this._getCache(lb,this._isVisible)}_isVisible(t){if(!this.visible())return!1;let a=this.getParent();if(a&&a!==t&&this!==t)return a._isVisible(t);else return!0}shouldDrawHit(t,e=!1){if(t)return this._isVisible(t)&&this._isListening(t);let a=this.getLayer(),i=!1;Ge._dragElements.forEach((n)=>{if(n.dragStatus!=="dragging")return;else if(n.node.nodeType==="Stage")i=!0;else if(n.node.getLayer()===a)i=!0});let s=!e&&!St.hitOnDragEnabled&&(i||St.isTransforming());return this.isListening()&&this.isVisible()&&!s}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let t=this.getDepth(),e=this,a=0,i,s,n,l;function f(c){i=[],s=c.length;for(n=0;n<s;n++){if(l=c[n],a++,l.nodeType!==rC)i=i.concat(l.getChildren().slice());if(l._id===e._id)n=s}if(i.length>0&&i[0].getDepth()<=t)f(i)}let o=this.getStage();if(e.nodeType!==gX&&o)f(o.getChildren());return a}getDepth(){let t=0,e=this.parent;while(e)t++,e=e.parent;return t}_batchTransformChanges(t){if(this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache)this._clearCache(Bl),this._clearSelfAndDescendantCache(w1);this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){let t=this.getStage();if(!t)return null;let e=t.getPointerPosition();if(!e)return null;let a=this.getAbsoluteTransform().copy();return a.invert(),a.point(e)}getAbsolutePosition(t){let e=!1,a=this.parent;while(a){if(a.isCached()){e=!0;break}a=a.parent}if(e&&!t)t=!0;let i=this.getAbsoluteTransform(t).getMatrix(),s=new Vi,n=this.offset();return s.m=i.slice(),s.translate(n.x,n.y),s.getTranslation()}setAbsolutePosition(t){let{x:e,y:a,...i}=this._clearTransform();this.attrs.x=e,this.attrs.y=a,this._clearCache(Bl);let s=this._getAbsoluteTransform().copy();return s.invert(),s.translate(t.x,t.y),t={x:this.attrs.x+s.getTranslation().x,y:this.attrs.y+s.getTranslation().y},this._setTransform(i),this.setPosition({x:t.x,y:t.y}),this._clearCache(Bl),this._clearSelfAndDescendantCache(w1),this}_setTransform(t){let e;for(e in t)this.attrs[e]=t[e]}_clearTransform(){let t={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,t}move(t){let{x:e,y:a}=t,i=this.x(),s=this.y();if(e!==void 0)i+=e;if(a!==void 0)s+=a;return this.setPosition({x:i,y:s}),this}_eachAncestorReverse(t,e){let a=[],i=this.getParent(),s,n;if(e&&e._id===this._id)return;a.unshift(this);while(i&&(!e||i._id!==e._id))a.unshift(i),i=i.parent;s=a.length;for(n=0;n<s;n++)t(a[n])}rotate(t){return this.rotation(this.rotation()+t),this}moveToTop(){if(!this.parent)return et.warn("Node has no parent. moveToTop function is ignored."),!1;let t=this.index,e=this.parent.getChildren().length;if(t<e-1)return this.parent.children.splice(t,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0;return!1}moveUp(){if(!this.parent)return et.warn("Node has no parent. moveUp function is ignored."),!1;let t=this.index,e=this.parent.getChildren().length;if(t<e-1)return this.parent.children.splice(t,1),this.parent.children.splice(t+1,0,this),this.parent._setChildrenIndices(),!0;return!1}moveDown(){if(!this.parent)return et.warn("Node has no parent. moveDown function is ignored."),!1;let t=this.index;if(t>0)return this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0;return!1}moveToBottom(){if(!this.parent)return et.warn("Node has no parent. moveToBottom function is ignored."),!1;let t=this.index;if(t>0)return this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0;return!1}setZIndex(t){if(!this.parent)return et.warn("Node has no parent. zIndex parameter is ignored."),this;if(t<0||t>=this.parent.children.length)et.warn("Unexpected value "+t+" 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 e=this.index;return this.parent.children.splice(e,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(u3,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let t=this.opacity(),e=this.getParent();if(e&&!e._isUnderCache)t*=e.getAbsoluteOpacity();return t}moveTo(t){if(this.getParent()!==t)this._remove(),t.add(this);return this}toObject(){let t=this.getAttrs(),e,a,i,s,n,l={attrs:{},className:this.getClassName()};for(e in t){if(a=t[e],n=et.isObject(a)&&!et._isPlainObject(a)&&!et._isArray(a),n)continue;if(i=typeof this[e]==="function"&&this[e],delete t[e],s=i?i.call(this):null,t[e]=a,s!==a)l.attrs[e]=a}return et._prepareToStringify(l)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,e,a){let i=[];if(e&&this._isMatch(t))i.push(this);let s=this.parent;while(s){if(s===a)return i;if(s._isMatch(t))i.push(s);s=s.parent}return i}isAncestorOf(t){return!1}findAncestor(t,e,a){return this.findAncestors(t,e,a)[0]}_isMatch(t){if(!t)return!1;if(typeof t==="function")return t(this);let e=t.replace(/ /g,"").split(","),a=e.length,i,s;for(i=0;i<a;i++){if(s=e[i],!et.isValidSelector(s))et.warn('Selector "'+s+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),et.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),et.warn("Konva is awesome, right?");if(s.charAt(0)==="#"){if(this.id()===s.slice(1))return!0}else if(s.charAt(0)==="."){if(this.hasName(s.slice(1)))return!0}else if(this.className===s||this.nodeType===s)return!0}return!1}getLayer(){let t=this.getParent();return t?t.getLayer():null}getStage(){return this._getCache(oC,this._getStage)}_getStage(){let t=this.getParent();if(t)return t.getStage();else return null}fire(t,e={},a){if(e.target=e.target||this,a)this._fireAndBubble(t,e);else this._fire(t,e);return this}getAbsoluteTransform(t){if(t)return this._getAbsoluteTransform(t);else return this._getCache(w1,this._getAbsoluteTransform)}_getAbsoluteTransform(t){let e;if(t)return e=new Vi,this._eachAncestorReverse(function(a){let i=a.transformsEnabled();if(i==="all")e.multiply(a.getTransform());else if(i==="position")e.translate(a.x()-a.offsetX(),a.y()-a.offsetY())},t),e;else{if(e=this._cache.get(w1)||new Vi,this.parent)this.parent.getAbsoluteTransform().copyInto(e);else e.reset();let a=this.transformsEnabled();if(a==="all")e.multiply(this.getTransform());else if(a==="position"){let i=this.attrs.x||0,s=this.attrs.y||0,n=this.attrs.offsetX||0,l=this.attrs.offsetY||0;e.translate(i-n,s-l)}return e.dirty=!1,e}}getAbsoluteScale(t){let e=this;while(e){if(e._isUnderCache)t=e;e=e.getParent()}let i=this.getAbsoluteTransform(t).decompose();return{x:i.scaleX,y:i.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(Bl,this._getTransform)}_getTransform(){var t,e;let a=this._cache.get(Bl)||new Vi;a.reset();let i=this.x(),s=this.y(),n=St.getAngle(this.rotation()),l=(t=this.attrs.scaleX)!==null&&t!==void 0?t:1,f=(e=this.attrs.scaleY)!==null&&e!==void 0?e:1,o=this.attrs.skewX||0,c=this.attrs.skewY||0,u=this.attrs.offsetX||0,m=this.attrs.offsetY||0;if(i!==0||s!==0)a.translate(i,s);if(n!==0)a.rotate(n);if(o!==0||c!==0)a.skew(o,c);if(l!==1||f!==1)a.scale(l,f);if(u!==0||m!==0)a.translate(-1*u,-1*m);return a.dirty=!1,a}clone(t){let e=et.cloneObject(this.attrs),a,i,s,n,l;for(a in t)e[a]=t[a];let f=new this.constructor(e);for(a in this.eventListeners){i=this.eventListeners[a],s=i.length;for(n=0;n<s;n++)if(l=i[n],l.name.indexOf(fX)<0){if(!f.eventListeners[a])f.eventListeners[a]=[];f.eventListeners[a].push(l)}}return f}_toKonvaCanvas(t){t=t||{};let e=this.getClientRect(),a=this.getStage(),i=t.x!==void 0?t.x:Math.floor(e.x),s=t.y!==void 0?t.y:Math.floor(e.y),n=t.pixelRatio||1,l=new Fn({width:t.width||Math.ceil(e.width)||(a?a.width():0),height:t.height||Math.ceil(e.height)||(a?a.height():0),pixelRatio:n}),f=l.getContext(),o=new Fn({width:l.width/l.pixelRatio+Math.abs(i),height:l.height/l.pixelRatio+Math.abs(s),pixelRatio:l.pixelRatio});if(t.imageSmoothingEnabled===!1)f._context.imageSmoothingEnabled=!1;if(f.save(),i||s)f.translate(-1*i,-1*s);return this.drawScene(l,void 0,o),f.restore(),l}toCanvas(t){return this._toKonvaCanvas(t)._canvas}toDataURL(t){t=t||{};let e=t.mimeType||null,a=t.quality||null,i=this._toKonvaCanvas(t).toDataURL(e,a);if(t.callback)t.callback(i);return i}toImage(t){return new Promise((e,a)=>{try{let i=t===null||t===void 0?void 0:t.callback;if(i)delete t.callback;et._urlToImage(this.toDataURL(t),function(s){e(s),i===null||i===void 0||i(s)})}catch(i){a(i)}})}toBlob(t){return new Promise((e,a)=>{try{let i=t===null||t===void 0?void 0:t.callback;if(i)delete t.callback;this.toCanvas(t).toBlob((s)=>{e(s),i===null||i===void 0||i(s)},t===null||t===void 0?void 0:t.mimeType,t===null||t===void 0?void 0:t.quality)}catch(i){a(i)}})}setSize(t){return this.width(t.width),this.height(t.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 St.dragDistance}_off(t,e,a){let i=this.eventListeners[t],s,n,l;for(s=0;s<i.length;s++)if(n=i[s].name,l=i[s].handler,(n!=="konva"||e==="konva")&&(!e||n===e)&&(!a||a===l)){if(i.splice(s,1),i.length===0){delete this.eventListeners[t];break}s--}}_fireChangeEvent(t,e,a){this._fire(t+nX,{oldVal:e,newVal:a})}addName(t){if(!this.hasName(t)){let e=this.name(),a=e?e+" "+t:t;this.name(a)}return this}hasName(t){if(!t)return!1;let e=this.name();if(!e)return!1;return(e||"").split(/\s/g).indexOf(t)!==-1}removeName(t){let e=(this.name()||"").split(/\s/g),a=e.indexOf(t);if(a!==-1)e.splice(a,1),this.name(e.join(" "));return this}setAttr(t,e){let a=this[fC+et._capitalize(t)];if(et._isFunction(a))a.call(this,e);else this._setAttr(t,e);return this}_requestDraw(){if(St.autoDrawEnabled){let t=this.getLayer()||this.getStage();t===null||t===void 0||t.batchDraw()}}_setAttr(t,e){let a=this.attrs[t];if(a===e&&!et.isObject(e))return;if(e===void 0||e===null)delete this.attrs[t];else this.attrs[t]=e;if(this._shouldFireChangeEvents)this._fireChangeEvent(t,a,e);this._requestDraw()}_setComponentAttr(t,e,a){let i;if(a!==void 0){if(i=this.attrs[t],!i)this.attrs[t]=this.getAttr(t);this.attrs[t][e]=a,this._fireChangeEvent(t,i,a)}}_fireAndBubble(t,e,a){if(e&&this.nodeType===rC)e.target=this;let i=[rX,oX,hX,cX,uX,mX];if(!(i.indexOf(t)!==-1&&(a&&(this===a||this.isAncestorOf&&this.isAncestorOf(a))||this.nodeType==="Stage"&&!a))){this._fire(t,e);let n=i.indexOf(t)!==-1&&a&&a.isAncestorOf&&a.isAncestorOf(this)&&!a.isAncestorOf(this.parent);if((e&&!e.cancelBubble||!e)&&this.parent&&this.parent.isListening()&&!n)if(a&&a.parent)this._fireAndBubble.call(this.parent,t,e,a);else this._fireAndBubble.call(this.parent,t,e)}}_getProtoListeners(t){var e,a;let{nodeType:i}=this,s=vt.protoListenerMap.get(i)||{},n=s===null||s===void 0?void 0:s[t];if(n===void 0){n=[];let l=Object.getPrototypeOf(this);while(l){let f=(a=(e=l.eventListeners)===null||e===void 0?void 0:e[t])!==null&&a!==void 0?a:[];n.push(...f),l=Object.getPrototypeOf(l)}s[t]=n,vt.protoListenerMap.set(i,s)}return n}_fire(t,e){e=e||{},e.currentTarget=this,e.type=t;let a=this._getProtoListeners(t);if(a){let s=a.slice();for(let n=0;n<s.length;n++)s[n].handler.call(this,e)}let i=this.eventListeners[t];if(i){let s=i.slice(),n=s.length;for(let f=0;f<s.length;f++)s[f].handler.call(this,e);let l=this.eventListeners[t];if(l)for(let f=n;f<l.length;f++)l[f].handler.call(this,e)}}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(t){let e=t?t.pointerId:void 0,a=this.getStage(),i=this.getAbsolutePosition();if(!a)return;let s=a._getPointerById(e)||a._changedPointerPositions[0]||i;Ge._dragElements.set(this._id,{node:this,startPointerPos:s,offset:{x:s.x-i.x,y:s.y-i.y},dragStatus:"ready",pointerId:e,startEvent:t})}startDrag(t,e=!0){if(!Ge._dragElements.has(this._id))this._createDragElement(t);let a=Ge._dragElements.get(this._id);a.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:a.startEvent&&a.startEvent.evt||t&&t.evt},e)}_setDragPosition(t,e){let a=this.getStage()._getPointerById(e.pointerId);if(!a)return;let i={x:a.x-e.offset.x,y:a.y-e.offset.y},s=this.dragBoundFunc();if(s!==void 0){let n=s.call(this,i,t);if(!n)et.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.");else i=n}if(!this._lastPos||this._lastPos.x!==i.x||this._lastPos.y!==i.y)this.setAbsolutePosition(i),this._requestDraw();this._lastPos=i}stopDrag(t){let e=Ge._dragElements.get(this._id);if(e)e.dragStatus="stopped";Ge._endDragBefore(t),Ge._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){let t=Ge._dragElements.get(this._id);return t?t.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(t){if(!(t.evt.button===void 0||St.dragButtons.indexOf(t.evt.button)>=0))return;if(this.isDragging())return;let i=!1;if(Ge._dragElements.forEach((s)=>{if(this.isAncestorOf(s.node))i=!0}),!i)this._createDragElement(t)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;let e=Ge._dragElements.get(this._id),a=e&&e.dragStatus==="dragging",i=e&&e.dragStatus==="ready";if(a)this.stopDrag();else if(i)Ge._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){let e=this.getStage();if(!e)return!1;let a={x:-t.x,y:-t.y,width:e.width()+2*t.x,height:e.height()+2*t.y};return et.haveIntersection(a,this.getClientRect())}static create(t,e){if(et._isString(t))t=JSON.parse(t);return this._createNode(t,e)}static _createNode(t,e){let a=vt.prototype.getClassName.call(t),i=t.children,s,n,l;if(e)t.attrs.container=e;if(!St[a])et.warn('Can not find a node with class name "'+a+'". Fallback to "Shape".'),a="Shape";if(s=new St[a](t.attrs),i){n=i.length;for(l=0;l<n;l++)s.add(vt._createNode(i[l]))}return s}}vt.protoListenerMap=new Map;vt.prototype.nodeType="Node";vt.prototype._attrsAffectingSize=[];vt.prototype.eventListeners={};vt.prototype.on(bX,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(Bl),this._clearSelfAndDescendantCache(w1)});vt.prototype.on("visibleChange.konva",function(){this._clearSelfAndDescendantCache(lb)});vt.prototype.on("listeningChange.konva",function(){this._clearSelfAndDescendantCache(nb)});vt.prototype.on("opacityChange.konva",function(){this._clearSelfAndDescendantCache(u3)});var wa=X.addGetterSetter;wa(vt,"zIndex");wa(vt,"absolutePosition");wa(vt,"position");wa(vt,"x",0,jt());wa(vt,"y",0,jt());wa(vt,"globalCompositeOperation","source-over",S0());wa(vt,"opacity",1,jt());wa(vt,"name","",S0());wa(vt,"id","",S0());wa(vt,"rotation",0,jt());X.addComponentsGetterSetter(vt,"scale",["x","y"]);wa(vt,"scaleX",1,jt());wa(vt,"scaleY",1,jt());X.addComponentsGetterSetter(vt,"skew",["x","y"]);wa(vt,"skewX",0,jt());wa(vt,"skewY",0,jt());X.addComponentsGetterSetter(vt,"offset",["x","y"]);wa(vt,"offsetX",0,jt());wa(vt,"offsetY",0,jt());wa(vt,"dragDistance",void 0,jt());wa(vt,"width",0,jt());wa(vt,"height",0,jt());wa(vt,"listening",!0,Yi());wa(vt,"preventDefault",!0,Yi());wa(vt,"filters",void 0,function(t){return this._filterUpToDate=!1,t});wa(vt,"visible",!0,Yi());wa(vt,"transformsEnabled","all",S0());wa(vt,"size");wa(vt,"dragBoundFunc");wa(vt,"draggable",!1,Yi());X.backCompat(vt,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});class Di extends vt{constructor(){super(...arguments);this.children=[]}getChildren(t){let e=this.children||[];if(t)return e.filter(t);return e}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach((t)=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach((t)=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(t.length===0)return this;if(t.length>1){for(let a=0;a<t.length;a++)this.add(t[a]);return this}let e=t[0];if(e.getParent())return e.moveTo(this),this;return this._validateAdd(e),e.index=this.getChildren().length,e.parent=this,e._clearCaches(),this.getChildren().push(e),this._fire("add",{child:e}),this._requestDraw(),this}destroy(){if(this.hasChildren())this.destroyChildren();return super.destroy(),this}find(t){return this._generalFind(t,!1)}findOne(t){let e=this._generalFind(t,!0);return e.length>0?e[0]:void 0}_generalFind(t,e){let a=[];return this._descendants((i)=>{let s=i._isMatch(t);if(s)a.push(i);if(s&&e)return!0;return!1}),a}_descendants(t){let e=!1,a=this.getChildren();for(let i of a){if(e=t(i),e)return!0;if(!i.hasChildren())continue;if(e=i._descendants(t),e)return!0}return!1}toObject(){let t=vt.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach((e)=>{t.children.push(e.toObject())}),t}isAncestorOf(t){let e=t.getParent();while(e){if(e._id===this._id)return!0;e=e.getParent()}return!1}clone(t){let e=vt.prototype.clone.call(this,t);return this.getChildren().forEach(function(a){e.add(a.clone())}),e}getAllIntersections(t){let e=[];return this.find("Shape").forEach((a)=>{if(a.isVisible()&&a.intersects(t))e.push(a)}),e}_clearSelfAndDescendantCache(t){var e;if(super._clearSelfAndDescendantCache(t),this.isCached())return;(e=this.children)===null||e===void 0||e.forEach(function(a){a._clearSelfAndDescendantCache(t)})}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(e,a){e.index=a}),this._requestDraw()}drawScene(t,e,a){let i=this.getLayer(),s=t||i&&i.getCanvas(),n=s&&s.getContext(),l=this._getCanvasCache(),f=l&&l.scene,o=s&&s.isCache;if(!this.isVisible()&&!o)return this;if(f){n.save();let c=this.getAbsoluteTransform(e).getMatrix();n.transform(c[0],c[1],c[2],c[3],c[4],c[5]),this._drawCachedSceneCanvas(n),n.restore()}else this._drawChildren("drawScene",s,e,a);return this}drawHit(t,e){if(!this.shouldDrawHit(e))return this;let a=this.getLayer(),i=t||a&&a.hitCanvas,s=i&&i.getContext(),n=this._getCanvasCache();if(n&&n.hit){s.save();let f=this.getAbsoluteTransform(e).getMatrix();s.transform(f[0],f[1],f[2],f[3],f[4],f[5]),this._drawCachedHitCanvas(s),s.restore()}else this._drawChildren("drawHit",i,e);return this}_drawChildren(t,e,a,i){var s;let n=e&&e.getContext(),l=this.clipWidth(),f=this.clipHeight(),o=this.clipFunc(),c=typeof l==="number"&&typeof f==="number"||o,u=a===this;if(c){n.save();let p=this.getAbsoluteTransform(a),w=p.getMatrix();n.transform(w[0],w[1],w[2],w[3],w[4],w[5]),n.beginPath();let d;if(o)d=o.call(this,n,this);else{let v=this.clipX(),k=this.clipY();n.rect(v||0,k||0,l,f)}n.clip.apply(n,d),w=p.copy().invert().getMatrix(),n.transform(w[0],w[1],w[2],w[3],w[4],w[5])}let m=!u&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";if(m)n.save(),n._applyGlobalCompositeOperation(this);if((s=this.children)===null||s===void 0||s.forEach(function(p){p[t](e,a,i)}),m)n.restore();if(c)n.restore()}getClientRect(t={}){var e;let{skipTransform:a,relativeTo:i}=t,s,n,l,f,o={x:1/0,y:1/0,width:0,height:0},c=this;(e=this.children)===null||e===void 0||e.forEach(function(p){if(!p.visible())return;let w=p.getClientRect({relativeTo:c,skipShadow:t.skipShadow,skipStroke:t.skipStroke});if(w.width===0&&w.height===0)return;if(s===void 0)s=w.x,n=w.y,l=w.x+w.width,f=w.y+w.height;else s=Math.min(s,w.x),n=Math.min(n,w.y),l=Math.max(l,w.x+w.width),f=Math.max(f,w.y+w.height)});let u=this.find("Shape"),m=!1;for(let p=0;p<u.length;p++)if(u[p]._isVisible(this)){m=!0;break}if(m&&s!==void 0)o={x:s,y:n,width:l-s,height:f-n};else o={x:0,y:0,width:0,height:0};if(!a)return this._transformedRect(o,i);return o}}X.addComponentsGetterSetter(Di,"clip",["x","y","width","height"]);X.addGetterSetter(Di,"clipX",void 0,jt());X.addGetterSetter(Di,"clipY",void 0,jt());X.addGetterSetter(Di,"clipWidth",void 0,jt());X.addGetterSetter(Di,"clipHeight",void 0,jt());X.addGetterSetter(Di,"clipFunc");var L2=new Map,hC=St._global.PointerEvent!==void 0;function g3(t){return L2.get(t)}function b3(t){return{evt:t,pointerId:t.pointerId}}function p3(t,e){return L2.get(t)===e}function w3(t,e){if(er(t),!e.getStage())return;if(L2.set(t,e),hC)e._fire("gotpointercapture",b3(new PointerEvent("gotpointercapture")))}function er(t,e){let a=L2.get(t);if(!a)return;let i=a.getStage();if(i&&i.content);if(L2.delete(t),hC)a._fire("lostpointercapture",b3(new PointerEvent("lostpointercapture")))}var wX="Stage",jX="string",uC="px",dX="mouseout",gC="mouseleave",bC="mouseover",pC="mouseenter",wC="mousemove",jC="mousedown",dC="mouseup",V2="pointermove",Y2="pointerdown",gh="pointerup",J2="pointercancel",qX="lostpointercapture",j3="pointerout",Q2="pointerleave",d3="pointerover",q3="pointerenter",rb="contextmenu",qC="touchstart",AC="touchend",vC="touchmove",SC="touchcancel",ob="wheel",AX=5,vX=[[pC,"_pointerenter"],[jC,"_pointerdown"],[wC,"_pointermove"],[dC,"_pointerup"],[gC,"_pointerleave"],[qC,"_pointerdown"],[vC,"_pointermove"],[AC,"_pointerup"],[SC,"_pointercancel"],[bC,"_pointerover"],[ob,"_wheel"],[rb,"_contextmenu"],[Y2,"_pointerdown"],[V2,"_pointermove"],[gh,"_pointerup"],[J2,"_pointercancel"],[Q2,"_pointerleave"],[qX,"_lostpointercapture"]],fb={mouse:{[j3]:dX,[Q2]:gC,[d3]:bC,[q3]:pC,[V2]:wC,[Y2]:jC,[gh]:dC,[J2]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[j3]:"touchout",[Q2]:"touchleave",[d3]:"touchover",[q3]:"touchenter",[V2]:vC,[Y2]:qC,[gh]:AC,[J2]:SC,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[j3]:j3,[Q2]:Q2,[d3]:d3,[q3]:q3,[V2]:V2,[Y2]:Y2,[gh]:gh,[J2]:J2,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},Z2=(t)=>{if(t.indexOf("pointer")>=0)return"pointer";if(t.indexOf("touch")>=0)return"touch";return"mouse"},mh=(t)=>{let e=Z2(t);if(e==="pointer")return St.pointerEventsEnabled&&fb.pointer;if(e==="touch")return fb.touch;if(e==="mouse")return fb.mouse};function mC(t={}){if(t.clipFunc||t.clipWidth||t.clipHeight)et.warn("Stage does not support clipping. Please use clip for Layers or Groups.");return t}var SX="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);",bh=[];class ph extends Di{constructor(t){super(mC(t));this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),bh.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{mC(this.attrs)}),this._checkVisibility()}_validateAdd(t){let e=t.getType()==="Layer",a=t.getType()==="FastLayer";if(!(e||a))et.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;let t=this.visible()?"":"none";this.content.style.display=t}setContainer(t){if(typeof t===jX){let e;if(t.charAt(0)==="."){let a=t.slice(1);t=document.getElementsByClassName(a)[0]}else{if(t.charAt(0)!=="#")e=t;else e=t.slice(1);t=document.getElementById(e)}if(!t)throw"Can not find container in document with id "+e}if(this._setAttr("container",t),this.content){if(this.content.parentElement)this.content.parentElement.removeChild(this.content);t.appendChild(this.content)}return this}shouldDrawHit(){return!0}clear(){let t=this.children,e=t.length;for(let a=0;a<e;a++)t[a].clear();return this}clone(t){if(!t)t={};return t.container=typeof document<"u"&&document.createElement("div"),Di.prototype.clone.call(this,t)}destroy(){super.destroy();let t=this.content;if(t&&et._isInDocument(t))this.container().removeChild(t);let e=bh.indexOf(this);if(e>-1)bh.splice(e,1);return et.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){let t=this._pointerPositions[0]||this._changedPointerPositions[0];if(!t)return et.warn(SX),null;return{x:t.x,y:t.y}}_getPointerById(t){return this._pointerPositions.find((e)=>e.id===t)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(t){t={...t},t.x=t.x||0,t.y=t.y||0,t.width=t.width||this.width(),t.height=t.height||this.height();let e=new Fn({width:t.width,height:t.height,pixelRatio:t.pixelRatio||1}),a=e.getContext()._context,i=this.children;if(t.x||t.y)a.translate(-1*t.x,-1*t.y);return i.forEach(function(s){if(!s.isVisible())return;let n=s._toKonvaCanvas(t);a.drawImage(n._canvas,t.x,t.y,n.getWidth()/n.getPixelRatio(),n.getHeight()/n.getPixelRatio())}),e}getIntersection(t){if(!t)return null;let e=this.children,a=e.length,i=a-1;for(let s=i;s>=0;s--){let n=e[s].getIntersection(t);if(n)return n}return null}_resizeDOM(){let t=this.width(),e=this.height();if(this.content)this.content.style.width=t+uC,this.content.style.height=e+uC;this.bufferCanvas.setSize(t,e),this.bufferHitCanvas.setSize(t,e),this.children.forEach((a)=>{a.setSize({width:t,height:e}),a.draw()})}add(t,...e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.add(arguments[i]);return this}super.add(t);let a=this.children.length;if(a>AX)et.warn("The stage has "+a+" 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(t.setSize({width:this.width(),height:this.height()}),t.draw(),St.isBrowser)this.content.appendChild(t.canvas._canvas);return this}getParent(){return null}getLayer(){return null}hasPointerCapture(t){return p3(t,this)}setPointerCapture(t){w3(t,this)}releaseCapture(t){er(t,this)}getLayers(){return this.children}_bindContentEvents(){if(!St.isBrowser)return;vX.forEach(([t,e])=>{this.content.addEventListener(t,(a)=>{this[e](a)},{passive:!1})})}_pointerenter(t){this.setPointersPositions(t);let e=mh(t.type);if(e)this._fire(e.pointerenter,{evt:t,target:this,currentTarget:this})}_pointerover(t){this.setPointersPositions(t);let e=mh(t.type);if(e)this._fire(e.pointerover,{evt:t,target:this,currentTarget:this})}_getTargetShape(t){let e=this[t+"targetShape"];if(e&&!e.getStage())e=null;return e}_pointerleave(t){let e=mh(t.type),a=Z2(t.type);if(!e)return;this.setPointersPositions(t);let i=this._getTargetShape(a),s=!(St.isDragging()||St.isTransforming())||St.hitOnDragEnabled;if(i&&s)i._fireAndBubble(e.pointerout,{evt:t}),i._fireAndBubble(e.pointerleave,{evt:t}),this._fire(e.pointerleave,{evt:t,target:this,currentTarget:this}),this[a+"targetShape"]=null;else if(s)this._fire(e.pointerleave,{evt:t,target:this,currentTarget:this}),this._fire(e.pointerout,{evt:t,target:this,currentTarget:this});this.pointerPos=null,this._pointerPositions=[]}_pointerdown(t){let e=mh(t.type),a=Z2(t.type);if(!e)return;this.setPointersPositions(t);let i=!1;if(this._changedPointerPositions.forEach((s)=>{let n=this.getIntersection(s);if(Ge.justDragged=!1,St["_"+a+"ListenClick"]=!0,!n||!n.isListening()){this[a+"ClickStartShape"]=void 0;return}if(St.capturePointerEventsEnabled)n.setPointerCapture(s.id);this[a+"ClickStartShape"]=n,n._fireAndBubble(e.pointerdown,{evt:t,pointerId:s.id}),i=!0;let l=t.type.indexOf("touch")>=0;if(n.preventDefault()&&t.cancelable&&l)t.preventDefault()}),!i)this._fire(e.pointerdown,{evt:t,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(t){let e=mh(t.type),a=Z2(t.type);if(!e)return;let i=t.type.indexOf("touch")>=0||t.pointerType==="touch";if(St.isDragging()&&Ge.node.preventDefault()&&t.cancelable&&i)t.preventDefault();if(this.setPointersPositions(t),!(!(St.isDragging()||St.isTransforming())||St.hitOnDragEnabled))return;let n={},l=!1,f=this._getTargetShape(a);if(this._changedPointerPositions.forEach((o)=>{let c=g3(o.id)||this.getIntersection(o),u=o.id,m={evt:t,pointerId:u},p=f!==c;if(p&&f)f._fireAndBubble(e.pointerout,{...m},c),f._fireAndBubble(e.pointerleave,{...m},c);if(c){if(n[c._id])return;n[c._id]=!0}if(c&&c.isListening()){if(l=!0,p)c._fireAndBubble(e.pointerover,{...m},f),c._fireAndBubble(e.pointerenter,{...m},f),this[a+"targetShape"]=c;c._fireAndBubble(e.pointermove,{...m})}else if(f)this._fire(e.pointerover,{evt:t,target:this,currentTarget:this,pointerId:u}),this[a+"targetShape"]=null}),!l)this._fire(e.pointermove,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(t){let e=mh(t.type),a=Z2(t.type);if(!e)return;this.setPointersPositions(t);let i=this[a+"ClickStartShape"],s=this[a+"ClickEndShape"],n={},l=!1;if(this._changedPointerPositions.forEach((f)=>{let o=g3(f.id)||this.getIntersection(f);if(o){if(o.releaseCapture(f.id),n[o._id])return;n[o._id]=!0}let c=f.id,u={evt:t,pointerId:c},m=!1;if(St["_"+a+"InDblClickWindow"])m=!0,clearTimeout(this[a+"DblTimeout"]);else if(!Ge.justDragged)St["_"+a+"InDblClickWindow"]=!0,clearTimeout(this[a+"DblTimeout"]);if(this[a+"DblTimeout"]=setTimeout(function(){St["_"+a+"InDblClickWindow"]=!1},St.dblClickWindow),o&&o.isListening()){if(l=!0,this[a+"ClickEndShape"]=o,o._fireAndBubble(e.pointerup,{...u}),St["_"+a+"ListenClick"]&&i&&i===o){if(o._fireAndBubble(e.pointerclick,{...u}),m&&s&&s===o)o._fireAndBubble(e.pointerdblclick,{...u})}}else{if(this[a+"ClickEndShape"]=null,!l)this._fire(e.pointerup,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),l=!0;if(St["_"+a+"ListenClick"])this._fire(e.pointerclick,{evt:t,target:this,currentTarget:this,pointerId:c});if(m)this._fire(e.pointerdblclick,{evt:t,target:this,currentTarget:this,pointerId:c})}}),!l)this._fire(e.pointerup,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id});if(St["_"+a+"ListenClick"]=!1,t.cancelable&&a!=="touch"&&a!=="pointer")t.preventDefault()}_contextmenu(t){this.setPointersPositions(t);let e=this.getIntersection(this.getPointerPosition());if(e&&e.isListening())e._fireAndBubble(rb,{evt:t});else this._fire(rb,{evt:t,target:this,currentTarget:this})}_wheel(t){this.setPointersPositions(t);let e=this.getIntersection(this.getPointerPosition());if(e&&e.isListening())e._fireAndBubble(ob,{evt:t});else this._fire(ob,{evt:t,target:this,currentTarget:this})}_pointercancel(t){this.setPointersPositions(t);let e=g3(t.pointerId)||this.getIntersection(this.getPointerPosition());if(e)e._fireAndBubble(gh,b3(t));er(t.pointerId)}_lostpointercapture(t){er(t.pointerId)}setPointersPositions(t){let e=this._getContentPosition(),a=null,i=null;if(t=t?t:window.event,t.touches!==void 0)this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(t.touches,(s)=>{this._pointerPositions.push({id:s.identifier,x:(s.clientX-e.left)/e.scaleX,y:(s.clientY-e.top)/e.scaleY})}),Array.prototype.forEach.call(t.changedTouches||t.touches,(s)=>{this._changedPointerPositions.push({id:s.identifier,x:(s.clientX-e.left)/e.scaleX,y:(s.clientY-e.top)/e.scaleY})});else a=(t.clientX-e.left)/e.scaleX,i=(t.clientY-e.top)/e.scaleY,this.pointerPos={x:a,y:i},this._pointerPositions=[{x:a,y:i,id:et._getFirstPointerId(t)}],this._changedPointerPositions=[{x:a,y:i,id:et._getFirstPointerId(t)}]}_setPointerPosition(t){et.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(t)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};let t=this.content.getBoundingClientRect();return{top:t.top,left:t.left,scaleX:t.width/this.content.clientWidth||1,scaleY:t.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new Fn({width:this.width(),height:this.height()}),this.bufferHitCanvas=new Pf({pixelRatio:1,width:this.width(),height:this.height()}),!St.isBrowser)return;let t=this.container();if(!t)throw"Stage has no container. A container is required.";t.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),t.appendChild(this.content),this._resizeDOM()}cache(){return et.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(t){t.batchDraw()}),this}}ph.prototype.nodeType=wX;we(ph);X.addGetterSetter(ph,"container");if(St.isBrowser)document.addEventListener("visibilitychange",()=>{bh.forEach((t)=>{t.batchDraw()})});var yC="hasShadow",kC="shadowRGBA",CC="patternImage",_C="linearGradient",FC="radialGradient",A3;function hb(){if(A3)return A3;return A3=et.createCanvasElement().getContext("2d"),A3}var ar={};function yX(t){let e=this.attrs.fillRule;if(e)t.fill(e);else t.fill()}function kX(t){t.stroke()}function CX(t){let e=this.attrs.fillRule;if(e)t.fill(e);else t.fill()}function _X(t){t.stroke()}function FX(){this._clearCache(yC)}function BX(){this._clearCache(kC)}function OX(){this._clearCache(CC)}function HX(){this._clearCache(_C)}function MX(){this._clearCache(FC)}class At extends vt{constructor(t){super(t);let e,a=0;while(!0){if(e=et.getHitColor(),e&&!(e in ar))break;if(a++,a>=1e4){et.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."),e=et.getRandomColor();break}}this.colorKey=e,ar[e]=this}getContext(){return et.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return et.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(yC,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(CC,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){let e=hb().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){let a=new Vi;a.translate(this.fillPatternX(),this.fillPatternY()),a.rotate(St.getAngle(this.fillPatternRotation())),a.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),a.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());let i=a.getMatrix(),s=typeof DOMMatrix>"u"?{a:i[0],b:i[1],c:i[2],d:i[3],e:i[4],f:i[5]}:new DOMMatrix(i);e.setTransform(s)}return e}}_getLinearGradient(){return this._getCache(_C,this.__getLinearGradient)}__getLinearGradient(){let t=this.fillLinearGradientColorStops();if(t){let e=hb(),a=this.fillLinearGradientStartPoint(),i=this.fillLinearGradientEndPoint(),s=e.createLinearGradient(a.x,a.y,i.x,i.y);for(let n=0;n<t.length;n+=2)s.addColorStop(t[n],t[n+1]);return s}}_getRadialGradient(){return this._getCache(FC,this.__getRadialGradient)}__getRadialGradient(){let t=this.fillRadialGradientColorStops();if(t){let e=hb(),a=this.fillRadialGradientStartPoint(),i=this.fillRadialGradientEndPoint(),s=e.createRadialGradient(a.x,a.y,this.fillRadialGradientStartRadius(),i.x,i.y,this.fillRadialGradientEndRadius());for(let n=0;n<t.length;n+=2)s.addColorStop(t[n],t[n+1]);return s}}getShadowRGBA(){return this._getCache(kC,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;let t=et.colorToRGBA(this.shadowColor());if(t)return"rgba("+t.r+","+t.g+","+t.b+","+t.a*(this.shadowOpacity()||1)+")"}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>{return this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops())})}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>{return this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops())})}hasHitStroke(){let t=this.hitStrokeWidth();if(t==="auto")return this.hasStroke();return this.strokeEnabled()&&!!t}intersects(t){let e=this.getStage();if(!e)return!1;let a=e.bufferHitCanvas;return a.getContext().clear(),this.drawHit(a,void 0,!0),a.context.getImageData(Math.round(t.x),Math.round(t.y),1,1).data[3]>0}destroy(){return vt.prototype.destroy.call(this),delete ar[this.colorKey],delete this.colorKey,this}_useBufferCanvas(t){var e;if(!((e=this.attrs.perfectDrawEnabled)!==null&&e!==void 0?e:!0))return!1;let i=t||this.hasFill(),s=this.hasStroke(),n=this.getAbsoluteOpacity()!==1;if(i&&s&&n)return!0;let l=this.hasShadow(),f=this.shadowForStrokeEnabled();if(i&&s&&l&&f)return!0;return!1}setStrokeHitEnabled(t){if(et.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),t)this.hitStrokeWidth("auto");else this.hitStrokeWidth(0)}getStrokeHitEnabled(){if(this.hitStrokeWidth()===0)return!1;else return!0}getSelfRect(){let t=this.size();return{x:this._centroid?-t.width/2:0,y:this._centroid?-t.height/2:0,width:t.width,height:t.height}}getClientRect(t={}){let e=!1,a=this.getParent();while(a){if(a.isCached()){e=!0;break}a=a.getParent()}let i=t.skipTransform,s=t.relativeTo||e&&this.getStage()||void 0,n=this.getSelfRect(),f=!t.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,o=n.width+f,c=n.height+f,u=!t.skipShadow&&this.hasShadow(),m=u?this.shadowOffsetX():0,p=u?this.shadowOffsetY():0,w=o+Math.abs(m),d=c+Math.abs(p),v=u&&this.shadowBlur()||0,k=w+v*2,y=d+v*2,B={width:k,height:y,x:-(f/2+v)+Math.min(m,0)+n.x,y:-(f/2+v)+Math.min(p,0)+n.y};if(!i)return this._transformedRect(B,s);return B}drawScene(t,e,a){let i=this.getLayer(),s=t||i.getCanvas(),n=s.getContext(),l=this._getCanvasCache(),f=this.getSceneFunc(),o=this.hasShadow(),c,u=!1,m=e===this;if(!this.isVisible()&&!m)return this;if(l){n.save();let p=this.getAbsoluteTransform(e).getMatrix();return n.transform(p[0],p[1],p[2],p[3],p[4],p[5]),this._drawCachedSceneCanvas(n),n.restore(),this}if(!f)return this;if(n.save(),this._useBufferCanvas()){c=this.getStage();let p=a||c.bufferCanvas,w=p.getContext();if(a)w.save(),w.setTransform(1,0,0,1,0,0),w.clearRect(0,0,p.width,p.height),w.restore();else w.clear();w.save(),w._applyLineJoin(this),w._applyMiterLimit(this);let d=this.getAbsoluteTransform(e).getMatrix();w.transform(d[0],d[1],d[2],d[3],d[4],d[5]),f.call(this,w,this),w.restore();let v=p.pixelRatio;if(o)n._applyShadow(this);if(!m)n._applyOpacity(this),n._applyGlobalCompositeOperation(this);n.drawImage(p._canvas,p.x||0,p.y||0,p.width/v,p.height/v)}else{if(n._applyLineJoin(this),n._applyMiterLimit(this),!m){let p=this.getAbsoluteTransform(e).getMatrix();n.transform(p[0],p[1],p[2],p[3],p[4],p[5]),n._applyOpacity(this),n._applyGlobalCompositeOperation(this)}if(o)n._applyShadow(this);f.call(this,n,this)}return n.restore(),this}drawHit(t,e,a=!1){if(!this.shouldDrawHit(e,a))return this;let i=this.getLayer(),s=t||i.hitCanvas,n=s&&s.getContext(),l=this.hitFunc()||this.sceneFunc(),f=this._getCanvasCache(),o=f&&f.hit;if(!this.colorKey)et.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(o){n.save();let u=this.getAbsoluteTransform(e).getMatrix();return n.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedHitCanvas(n),n.restore(),this}if(!l)return this;if(n.save(),n._applyLineJoin(this),n._applyMiterLimit(this),this!==e){let u=this.getAbsoluteTransform(e).getMatrix();n.transform(u[0],u[1],u[2],u[3],u[4],u[5])}return l.call(this,n,this),n.restore(),this}drawHitFromCache(t=0){let e=this._getCanvasCache(),a=this._getCachedSceneCanvas(),i=e.hit,s=i.getContext(),n=i.getWidth(),l=i.getHeight();s.clear(),s.drawImage(a._canvas,0,0,n,l);try{let f=s.getImageData(0,0,n,l),o=f.data,c=o.length,u=et._hexToRgb(this.colorKey);for(let m=0;m<c;m+=4)if(o[m+3]>t)o[m]=u.r,o[m+1]=u.g,o[m+2]=u.b,o[m+3]=255;else o[m+3]=0;s.putImageData(f,0,0)}catch(f){et.error("Unable to draw hit graph from cached scene canvas. "+f.message)}return this}hasPointerCapture(t){return p3(t,this)}setPointerCapture(t){w3(t,this)}releaseCapture(t){er(t,this)}}At.prototype._fillFunc=yX;At.prototype._strokeFunc=kX;At.prototype._fillFuncHit=CX;At.prototype._strokeFuncHit=_X;At.prototype._centroid=!1;At.prototype.nodeType="Shape";we(At);At.prototype.eventListeners={};At.prototype.on("shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",FX);At.prototype.on("shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",BX);At.prototype.on("fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",OX);At.prototype.on("fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",HX);At.prototype.on("fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",MX);X.addGetterSetter(At,"stroke",void 0,sb());X.addGetterSetter(At,"strokeWidth",2,jt());X.addGetterSetter(At,"fillAfterStrokeEnabled",!1);X.addGetterSetter(At,"hitStrokeWidth","auto",G2());X.addGetterSetter(At,"strokeHitEnabled",!0,Yi());X.addGetterSetter(At,"perfectDrawEnabled",!0,Yi());X.addGetterSetter(At,"shadowForStrokeEnabled",!0,Yi());X.addGetterSetter(At,"lineJoin");X.addGetterSetter(At,"lineCap");X.addGetterSetter(At,"miterLimit");X.addGetterSetter(At,"sceneFunc");X.addGetterSetter(At,"hitFunc");X.addGetterSetter(At,"dash");X.addGetterSetter(At,"dashOffset",0,jt());X.addGetterSetter(At,"shadowColor",void 0,S0());X.addGetterSetter(At,"shadowBlur",0,jt());X.addGetterSetter(At,"shadowOpacity",1,jt());X.addComponentsGetterSetter(At,"shadowOffset",["x","y"]);X.addGetterSetter(At,"shadowOffsetX",0,jt());X.addGetterSetter(At,"shadowOffsetY",0,jt());X.addGetterSetter(At,"fillPatternImage");X.addGetterSetter(At,"fill",void 0,sb());X.addGetterSetter(At,"fillPatternX",0,jt());X.addGetterSetter(At,"fillPatternY",0,jt());X.addGetterSetter(At,"fillLinearGradientColorStops");X.addGetterSetter(At,"strokeLinearGradientColorStops");X.addGetterSetter(At,"fillRadialGradientStartRadius",0);X.addGetterSetter(At,"fillRadialGradientEndRadius",0);X.addGetterSetter(At,"fillRadialGradientColorStops");X.addGetterSetter(At,"fillPatternRepeat","repeat");X.addGetterSetter(At,"fillEnabled",!0);X.addGetterSetter(At,"strokeEnabled",!0);X.addGetterSetter(At,"shadowEnabled",!0);X.addGetterSetter(At,"dashEnabled",!0);X.addGetterSetter(At,"strokeScaleEnabled",!0);X.addGetterSetter(At,"fillPriority","color");X.addComponentsGetterSetter(At,"fillPatternOffset",["x","y"]);X.addGetterSetter(At,"fillPatternOffsetX",0,jt());X.addGetterSetter(At,"fillPatternOffsetY",0,jt());X.addComponentsGetterSetter(At,"fillPatternScale",["x","y"]);X.addGetterSetter(At,"fillPatternScaleX",1,jt());X.addGetterSetter(At,"fillPatternScaleY",1,jt());X.addComponentsGetterSetter(At,"fillLinearGradientStartPoint",["x","y"]);X.addComponentsGetterSetter(At,"strokeLinearGradientStartPoint",["x","y"]);X.addGetterSetter(At,"fillLinearGradientStartPointX",0);X.addGetterSetter(At,"strokeLinearGradientStartPointX",0);X.addGetterSetter(At,"fillLinearGradientStartPointY",0);X.addGetterSetter(At,"strokeLinearGradientStartPointY",0);X.addComponentsGetterSetter(At,"fillLinearGradientEndPoint",["x","y"]);X.addComponentsGetterSetter(At,"strokeLinearGradientEndPoint",["x","y"]);X.addGetterSetter(At,"fillLinearGradientEndPointX",0);X.addGetterSetter(At,"strokeLinearGradientEndPointX",0);X.addGetterSetter(At,"fillLinearGradientEndPointY",0);X.addGetterSetter(At,"strokeLinearGradientEndPointY",0);X.addComponentsGetterSetter(At,"fillRadialGradientStartPoint",["x","y"]);X.addGetterSetter(At,"fillRadialGradientStartPointX",0);X.addGetterSetter(At,"fillRadialGradientStartPointY",0);X.addComponentsGetterSetter(At,"fillRadialGradientEndPoint",["x","y"]);X.addGetterSetter(At,"fillRadialGradientEndPointX",0);X.addGetterSetter(At,"fillRadialGradientEndPointY",0);X.addGetterSetter(At,"fillPatternRotation",0);X.addGetterSetter(At,"fillRule",void 0,S0());X.backCompat(At,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var DX="beforeDraw",TX="draw",BC=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],RX=BC.length;class y0 extends Di{constructor(t){super(t);this.canvas=new Fn,this.hitCanvas=new Pf({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(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);let e=this.getStage();if(e&&e.content)if(e.content.removeChild(this.getNativeCanvasElement()),t<e.children.length-1)e.content.insertBefore(this.getNativeCanvasElement(),e.children[t+1].getCanvas()._canvas);else e.content.appendChild(this.getNativeCanvasElement());return this}moveToTop(){vt.prototype.moveToTop.call(this);let t=this.getStage();if(t&&t.content)t.content.removeChild(this.getNativeCanvasElement()),t.content.appendChild(this.getNativeCanvasElement());return!0}moveUp(){if(!vt.prototype.moveUp.call(this))return!1;let e=this.getStage();if(!e||!e.content)return!1;if(e.content.removeChild(this.getNativeCanvasElement()),this.index<e.children.length-1)e.content.insertBefore(this.getNativeCanvasElement(),e.children[this.index+1].getCanvas()._canvas);else e.content.appendChild(this.getNativeCanvasElement());return!0}moveDown(){if(vt.prototype.moveDown.call(this)){let t=this.getStage();if(t){let e=t.children;if(t.content)t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[this.index+1].getCanvas()._canvas)}return!0}return!1}moveToBottom(){if(vt.prototype.moveToBottom.call(this)){let t=this.getStage();if(t){let e=t.children;if(t.content)t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[1].getCanvas()._canvas)}return!0}return!1}getLayer(){return this}remove(){let t=this.getNativeCanvasElement();if(vt.prototype.remove.call(this),t&&t.parentNode&&et._isInDocument(t))t.parentNode.removeChild(t);return this}getStage(){return this.parent}setSize({width:t,height:e}){return this.canvas.setSize(t,e),this.hitCanvas.setSize(t,e),this._setSmoothEnabled(),this}_validateAdd(t){let e=t.getType();if(e!=="Group"&&e!=="Shape")et.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(t){return t={...t},t.width=t.width||this.getWidth(),t.height=t.height||this.getHeight(),t.x=t.x!==void 0?t.x:this.x(),t.y=t.y!==void 0?t.y:this.y(),vt.prototype._toKonvaCanvas.call(this,t)}_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(){et.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){et.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){if(!this._waitingForDraw)this._waitingForDraw=!0,et.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1});return this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;let e=1,a=!1;while(!0){for(let i=0;i<RX;i++){let s=BC[i],n=this._getIntersection({x:t.x+s.x*e,y:t.y+s.y*e}),l=n.shape;if(l)return l;if(a=!!n.antialiased,!n.antialiased)break}if(a)e+=1;else return null}}_getIntersection(t){let e=this.hitCanvas.pixelRatio,a=this.hitCanvas.context.getImageData(Math.round(t.x*e),Math.round(t.y*e),1,1).data,i=a[3];if(i===255){let s=et.getHitColorKey(a[0],a[1],a[2]),n=ar[s];if(n)return{shape:n};return{antialiased:!0}}else if(i>0)return{antialiased:!0};return{}}drawScene(t,e,a){let i=this.getLayer(),s=t||i&&i.getCanvas();if(this._fire(DX,{node:this}),this.clearBeforeDraw())s.getContext().clear();return Di.prototype.drawScene.call(this,s,e,a),this._fire(TX,{node:this}),this}drawHit(t,e){let a=this.getLayer(),i=t||a&&a.hitCanvas;if(a&&a.clearBeforeDraw())a.getHitCanvas().getContext().clear();return Di.prototype.drawHit.call(this,i,e),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){et.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return et.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;let t=this.parent;if(!!this.hitCanvas._canvas.parentNode)t.content.removeChild(this.hitCanvas._canvas);else t.content.appendChild(this.hitCanvas._canvas)}destroy(){return et.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}y0.prototype.nodeType="Layer";we(y0);X.addGetterSetter(y0,"imageSmoothingEnabled",!0);X.addGetterSetter(y0,"clearBeforeDraw",!0);X.addGetterSetter(y0,"hitGraphEnabled",!0,Yi());class $2 extends y0{constructor(t){super(t);this.listening(!1),et.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}$2.prototype.nodeType="FastLayer";we($2);class k0 extends Di{_validateAdd(t){let e=t.getType();if(e!=="Group"&&e!=="Shape")et.throw("You may only add groups and shapes to groups.")}}k0.prototype.nodeType="Group";we(k0);var cb=function(){if(Cl.performance&&Cl.performance.now)return function(){return Cl.performance.now()};return function(){return new Date().getTime()}}();class ws{constructor(t,e){this.id=ws.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:cb(),frameRate:0},this.func=t,this.setLayers(e)}setLayers(t){let e=[];if(t)e=Array.isArray(t)?t:[t];return this.layers=e,this}getLayers(){return this.layers}addLayer(t){let e=this.layers,a=e.length;for(let i=0;i<a;i++)if(e[i]._id===t._id)return!1;return this.layers.push(t),!0}isRunning(){let e=ws.animations,a=e.length;for(let i=0;i<a;i++)if(e[i].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=cb(),ws._addAnimation(this),this}stop(){return ws._removeAnimation(this),this}_updateFrameObject(t){this.frame.timeDiff=t-this.frame.lastTime,this.frame.lastTime=t,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1000/this.frame.timeDiff}static _addAnimation(t){this.animations.push(t),this._handleAnimation()}static _removeAnimation(t){let e=t.id,a=this.animations,i=a.length;for(let s=0;s<i;s++)if(a[s].id===e){this.animations.splice(s,1);break}}static _runFrames(){let t={},e=this.animations;for(let a=0;a<e.length;a++){let i=e[a],s=i.layers,n=i.func;i._updateFrameObject(cb());let l=s.length,f;if(n)f=n.call(i,i.frame)!==!1;else f=!0;if(!f)continue;for(let o=0;o<l;o++){let c=s[o];if(c._id!==void 0)t[c._id]=c}}for(let a in t){if(!t.hasOwnProperty(a))continue;t[a].batchDraw()}}static _animationLoop(){let t=ws;if(t.animations.length)t._runFrames(),et.requestAnimFrame(t._animationLoop);else t.animRunning=!1}static _handleAnimation(){if(!this.animRunning)this.animRunning=!0,et.requestAnimFrame(this._animationLoop)}}ws.animations=[];ws.animIdCounter=0;ws.animRunning=!1;var NX={node:1,duration:1,easing:1,onFinish:1,yoyo:1},zX=1,OC=2,HC=3,MC=["fill","stroke","shadowColor"],EX=0;class DC{constructor(t,e,a,i,s,n,l){this.prop=t,this.propFunc=e,this.begin=i,this._pos=i,this.duration=n,this._change=0,this.prevPos=0,this.yoyo=l,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=a,this._change=s-this.begin,this.pause()}fire(t){let e=this[t];if(e)e()}setTime(t){if(t>this.duration)if(this.yoyo)this._time=this.duration,this.reverse();else this.finish();else if(t<0)if(this.yoyo)this._time=0,this.play();else this.reset();else this._time=t,this.update()}getTime(){return this._time}setPosition(t){this.prevPos=this._pos,this.propFunc(t),this._pos=t}getPosition(t){if(t===void 0)t=this._time;return this.func(t,this.begin,this._change,this.duration)}play(){this.state=OC,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=HC,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(t){this.pause(),this._time=t,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 t=this.getTimer()-this._startTime;if(this.state===OC)this.setTime(t);else if(this.state===HC)this.setTime(this.duration-t)}pause(){this.state=zX,this.fire("onPause")}getTimer(){return new Date().getTime()}}class ja{constructor(t){let e=this,a=t.node,i=a._id,s=t.easing||wh.Linear,n=!!t.yoyo,l,f;if(typeof t.duration>"u")l=0.3;else if(t.duration===0)l=0.001;else l=t.duration;this.node=a,this._id=EX++;let o=a.getLayer()||(a instanceof St.Stage?a.getLayers():null);if(!o)et.error("Tween constructor have `node` that is not in a layer. Please add node into layer first.");if(this.anim=new ws(function(){e.tween.onEnterFrame()},o),this.tween=new DC(f,function(c){e._tweenFunc(c)},s,0,1,l*1000,n),this._addListeners(),!ja.attrs[i])ja.attrs[i]={};if(!ja.attrs[i][this._id])ja.attrs[i][this._id]={};if(!ja.tweens[i])ja.tweens[i]={};for(f in t)if(NX[f]===void 0)this._addAttr(f,t[f]);this.reset(),this.onFinish=t.onFinish,this.onReset=t.onReset,this.onUpdate=t.onUpdate}_addAttr(t,e){let a=this.node,i=a._id,s,n,l,f,o,c=ja.tweens[i][t];if(c)delete ja.attrs[i][c][t];let u=a.getAttr(t);if(et._isArray(e)){if(s=[],n=Math.max(e.length,u.length),t==="points"&&e.length!==u.length)if(e.length>u.length)f=u,u=et._prepareArrayForTween(u,e,a.closed());else l=e,e=et._prepareArrayForTween(e,u,a.closed());if(t.indexOf("fill")===0)for(let m=0;m<n;m++)if(m%2===0)s.push(e[m]-u[m]);else{let p=et.colorToRGBA(u[m]);o=et.colorToRGBA(e[m]),u[m]=p,s.push({r:o.r-p.r,g:o.g-p.g,b:o.b-p.b,a:o.a-p.a})}else for(let m=0;m<n;m++)s.push(e[m]-u[m])}else if(MC.indexOf(t)!==-1)u=et.colorToRGBA(u),o=et.colorToRGBA(e),s={r:o.r-u.r,g:o.g-u.g,b:o.b-u.b,a:o.a-u.a};else s=e-u;ja.attrs[i][this._id][t]={start:u,diff:s,end:e,trueEnd:l,trueStart:f},ja.tweens[i][t]=this._id}_tweenFunc(t){let e=this.node,a=ja.attrs[e._id][this._id],i,s,n,l,f,o,c,u;for(i in a){if(s=a[i],n=s.start,l=s.diff,u=s.end,et._isArray(n))if(f=[],c=Math.max(n.length,u.length),i.indexOf("fill")===0)for(o=0;o<c;o++)if(o%2===0)f.push((n[o]||0)+l[o]*t);else f.push("rgba("+Math.round(n[o].r+l[o].r*t)+","+Math.round(n[o].g+l[o].g*t)+","+Math.round(n[o].b+l[o].b*t)+","+(n[o].a+l[o].a*t)+")");else for(o=0;o<c;o++)f.push((n[o]||0)+l[o]*t);else if(MC.indexOf(i)!==-1)f="rgba("+Math.round(n.r+l.r*t)+","+Math.round(n.g+l.g*t)+","+Math.round(n.b+l.b*t)+","+(n.a+l.a*t)+")";else f=n+l*t;e.setAttr(i,f)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{let t=this.node,e=ja.attrs[t._id][this._id];if(e.points&&e.points.trueEnd)t.setAttr("points",e.points.trueEnd);if(this.onFinish)this.onFinish.call(this)},this.tween.onReset=()=>{let t=this.node,e=ja.attrs[t._id][this._id];if(e.points&&e.points.trueStart)t.points(e.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(t){return this.tween.seek(t*1000),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){let t=this.node._id,e=this._id,a=ja.tweens[t];if(this.pause(),this.anim)this.anim.stop();for(let i in a)delete ja.tweens[t][i];if(delete ja.attrs[t][e],ja.tweens[t]){if(Object.keys(ja.tweens[t]).length===0)delete ja.tweens[t];if(Object.keys(ja.attrs[t]).length===0)delete ja.attrs[t]}}}ja.attrs={};ja.tweens={};vt.prototype.to=function(t){let e=t.onFinish;t.node=this,t.onFinish=function(){if(this.destroy(),e)e()},new ja(t).play()};var wh={BackEaseIn(t,e,a,i){return a*(t/=i)*t*(2.70158*t-1.70158)+e},BackEaseOut(t,e,a,i){return a*((t=t/i-1)*t*(2.70158*t+1.70158)+1)+e},BackEaseInOut(t,e,a,i){let s=1.70158;if((t/=i/2)<1)return a/2*(t*t*(((s*=1.525)+1)*t-s))+e;return a/2*((t-=2)*t*(((s*=1.525)+1)*t+s)+2)+e},ElasticEaseIn(t,e,a,i,s,n){let l=0;if(t===0)return e;if((t/=i)===1)return e+a;if(!n)n=i*0.3;if(!s||s<Math.abs(a))s=a,l=n/4;else l=n/(2*Math.PI)*Math.asin(a/s);return-(s*Math.pow(2,10*(t-=1))*Math.sin((t*i-l)*(2*Math.PI)/n))+e},ElasticEaseOut(t,e,a,i,s,n){let l=0;if(t===0)return e;if((t/=i)===1)return e+a;if(!n)n=i*0.3;if(!s||s<Math.abs(a))s=a,l=n/4;else l=n/(2*Math.PI)*Math.asin(a/s);return s*Math.pow(2,-10*t)*Math.sin((t*i-l)*(2*Math.PI)/n)+a+e},ElasticEaseInOut(t,e,a,i,s,n){let l=0;if(t===0)return e;if((t/=i/2)===2)return e+a;if(!n)n=i*0.44999999999999996;if(!s||s<Math.abs(a))s=a,l=n/4;else l=n/(2*Math.PI)*Math.asin(a/s);if(t<1)return-0.5*(s*Math.pow(2,10*(t-=1))*Math.sin((t*i-l)*(2*Math.PI)/n))+e;return s*Math.pow(2,-10*(t-=1))*Math.sin((t*i-l)*(2*Math.PI)/n)*0.5+a+e},BounceEaseOut(t,e,a,i){if((t/=i)<0.36363636363636365)return a*(7.5625*t*t)+e;else if(t<0.7272727272727273)return a*(7.5625*(t-=0.5454545454545454)*t+0.75)+e;else if(t<0.9090909090909091)return a*(7.5625*(t-=0.8181818181818182)*t+0.9375)+e;else return a*(7.5625*(t-=0.9545454545454546)*t+0.984375)+e},BounceEaseIn(t,e,a,i){return a-wh.BounceEaseOut(i-t,0,a,i)+e},BounceEaseInOut(t,e,a,i){if(t<i/2)return wh.BounceEaseIn(t*2,0,a,i)*0.5+e;else return wh.BounceEaseOut(t*2-i,0,a,i)*0.5+a*0.5+e},EaseIn(t,e,a,i){return a*(t/=i)*t+e},EaseOut(t,e,a,i){return-a*(t/=i)*(t-2)+e},EaseInOut(t,e,a,i){if((t/=i/2)<1)return a/2*t*t+e;return-a/2*(--t*(t-2)-1)+e},StrongEaseIn(t,e,a,i){return a*(t/=i)*t*t*t*t+e},StrongEaseOut(t,e,a,i){return a*((t=t/i-1)*t*t*t*t+1)+e},StrongEaseInOut(t,e,a,i){if((t/=i/2)<1)return a/2*t*t*t*t*t+e;return a/2*((t-=2)*t*t*t*t+2)+e},Linear(t,e,a,i){return a*t/i+e}};var jh=et._assign(St,{Util:et,Transform:Vi,Node:vt,Container:Di,Stage:ph,stages:bh,Layer:y0,FastLayer:$2,Group:k0,DD:Ge,Shape:At,shapes:ar,Animation:ws,Tween:ja,Easings:wh,Context:uh,Canvas:I2});class $n extends At{_sceneFunc(t){let e=St.getAngle(this.angle()),a=this.clockwise();t.beginPath(),t.arc(0,0,this.outerRadius(),0,e,a),t.arc(0,0,this.innerRadius(),e,0,!a),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}getSelfRect(){let t=this.innerRadius(),e=this.outerRadius(),a=this.clockwise(),i=St.getAngle(a?360-this.angle():this.angle()),s=Math.cos(Math.min(i,Math.PI)),n=1,l=Math.sin(Math.min(Math.max(Math.PI,i),3*Math.PI/2)),f=Math.sin(Math.min(i,Math.PI/2)),o=s*(s>0?t:e),c=1*e,u=l*(l>0?t:e),m=f*(f>0?e:t);return{x:o,y:a?-1*m:u,width:c-o,height:m-u}}}$n.prototype._centroid=!0;$n.prototype.className="Arc";$n.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"];we($n);X.addGetterSetter($n,"innerRadius",0,jt());X.addGetterSetter($n,"outerRadius",0,jt());X.addGetterSetter($n,"angle",0,jt());X.addGetterSetter($n,"clockwise",!1,Yi());function ub(t,e,a,i,s,n,l){let f=Math.sqrt(Math.pow(a-t,2)+Math.pow(i-e,2)),o=Math.sqrt(Math.pow(s-a,2)+Math.pow(n-i,2)),c=l*f/(f+o),u=l*o/(f+o),m=a-c*(s-t),p=i-c*(n-e),w=a+u*(s-t),d=i+u*(n-e);return[m,p,w,d]}function TC(t,e){let a=t.length,i=[];for(let s=2;s<a-2;s+=2){let n=ub(t[s-2],t[s-1],t[s],t[s+1],t[s+2],t[s+3],e);if(isNaN(n[0]))continue;i.push(n[0]),i.push(n[1]),i.push(t[s]),i.push(t[s+1]),i.push(n[2]),i.push(n[3])}return i}function xX(t){let e=[[t[0],t[2],t[4],t[6]],[t[1],t[3],t[5],t[7]]],a=[];for(let i of e){let s=-3*i[0]+9*i[1]-9*i[2]+3*i[3];if(s!==0){let n=6*i[0]-12*i[1]+6*i[2],l=-3*i[0]+3*i[1],f=n*n-4*s*l;if(f>=0){let o=Math.sqrt(f);a.push((-n+o)/(2*s)),a.push((-n-o)/(2*s))}}}return a.filter((i)=>i>0&&i<1).flatMap((i)=>e.map((s)=>{let n=1-i;return n*n*n*s[0]+3*n*n*i*s[1]+3*n*i*i*s[2]+i*i*i*s[3]}))}class Bn extends At{constructor(t){super(t);this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(t){let e=this.points(),a=e.length,i=this.tension(),s=this.closed(),n=this.bezier();if(!a)return;let l=0;if(t.beginPath(),t.moveTo(e[0],e[1]),i!==0&&a>4){let f=this.getTensionPoints(),o=f.length;if(l=s?0:4,!s)t.quadraticCurveTo(f[0],f[1],f[2],f[3]);while(l<o-2)t.bezierCurveTo(f[l++],f[l++],f[l++],f[l++],f[l++],f[l++]);if(!s)t.quadraticCurveTo(f[o-2],f[o-1],e[a-2],e[a-1])}else if(n){l=2;while(l<a)t.bezierCurveTo(e[l++],e[l++],e[l++],e[l++],e[l++],e[l++])}else for(l=2;l<a;l+=2)t.lineTo(e[l],e[l+1]);if(s)t.closePath(),t.fillStrokeShape(this);else t.strokeShape(this)}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){if(this.closed())return this._getTensionPointsClosed();else return TC(this.points(),this.tension())}_getTensionPointsClosed(){let t=this.points(),e=t.length,a=this.tension(),i=ub(t[e-2],t[e-1],t[0],t[1],t[2],t[3],a),s=ub(t[e-4],t[e-3],t[e-2],t[e-1],t[0],t[1],a),n=TC(t,a);return[i[2],i[3]].concat(n).concat([s[0],s[1],t[e-2],t[e-1],s[2],s[3],i[0],i[1],t[0],t[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let t=this.points();if(t.length<4)return{x:t[0]||0,y:t[1]||0,width:0,height:0};if(this.tension()!==0)t=[t[0],t[1],...this._getTensionPoints(),t[t.length-2],t[t.length-1]];else if(this.bezier())t=[t[0],t[1],...xX(this.points()),t[t.length-2],t[t.length-1]];else t=this.points();let e=t[0],a=t[0],i=t[1],s=t[1],n,l;for(let f=0;f<t.length/2;f++)n=t[f*2],l=t[f*2+1],e=Math.min(e,n),a=Math.max(a,n),i=Math.min(i,l),s=Math.max(s,l);return{x:e,y:i,width:a-e,height:s-i}}}Bn.prototype.className="Line";Bn.prototype._attrsAffectingSize=["points","bezier","tension"];we(Bn);X.addGetterSetter(Bn,"closed",!1);X.addGetterSetter(Bn,"bezier",!1);X.addGetterSetter(Bn,"tension",0,jt());X.addGetterSetter(Bn,"points",[],iC());var UX=[[],[],[-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]],IX=[[],[],[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]],GX=[[1],[1,1],[1,2,1],[1,3,3,1]],gb=(t,e,a)=>{let i,s,n=20,l=a/2;i=0;for(let f=0;f<20;f++)s=l*UX[20][f]+l,i+=IX[20][f]*XX(t,e,s);return l*i},bb=(t,e,a)=>{if(a===void 0)a=1;let i=t[0]-2*t[1]+t[2],s=e[0]-2*e[1]+e[2],n=2*t[1]-2*t[0],l=2*e[1]-2*e[0],f=4*(i*i+s*s),o=4*(i*n+s*l),c=n*n+l*l;if(f===0)return a*Math.sqrt(Math.pow(t[2]-t[0],2)+Math.pow(e[2]-e[0],2));let u=o/(2*f),m=c/f,p=a+u,w=m-u*u,d=p*p+w>0?Math.sqrt(p*p+w):0,v=u*u+w>0?Math.sqrt(u*u+w):0,k=u+Math.sqrt(u*u+w)!==0?w*Math.log(Math.abs((p+d)/(u+v))):0;return Math.sqrt(f)/2*(p*d-u*v+k)};function XX(t,e,a){let i=mb(1,a,t),s=mb(1,a,e),n=i*i+s*s;return Math.sqrt(n)}var mb=(t,e,a)=>{let i=a.length-1,s,n;if(i===0)return 0;if(t===0){n=0;for(let l=0;l<=i;l++)n+=GX[i][l]*Math.pow(1-e,i-l)*Math.pow(e,l)*a[l];return n}else{s=Array(i);for(let l=0;l<i;l++)s[l]=i*(a[l+1]-a[l]);return mb(t-1,e,s)}},pb=(t,e,a)=>{let i=1,s=t/e,n=(t-a(s))/e,l=0;while(i>0.001){let f=a(s+n),o=Math.abs(t-f)/e;if(o<i)i=o,s+=n;else{let c=a(s-n),u=Math.abs(t-c)/e;if(u<i)i=u,s-=n;else n/=2}if(l++,l>500)break}return s};class ra extends At{constructor(t){super(t);this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=ra.parsePathData(this.data()),this.pathLength=ra.getPathLength(this.dataArray)}_sceneFunc(t){let e=this.dataArray;t.beginPath();let a=!1;for(let i=0;i<e.length;i++){let s=e[i].command,n=e[i].points;switch(s){case"L":t.lineTo(n[0],n[1]);break;case"M":t.moveTo(n[0],n[1]);break;case"C":t.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5]);break;case"Q":t.quadraticCurveTo(n[0],n[1],n[2],n[3]);break;case"A":let l=n[0],f=n[1],o=n[2],c=n[3],u=n[4],m=n[5],p=n[6],w=n[7],d=o>c?o:c,v=o>c?1:o/c,k=o>c?c/o:1;t.translate(l,f),t.rotate(p),t.scale(v,k),t.arc(0,0,d,u,u+m,1-w),t.scale(1/v,1/k),t.rotate(-p),t.translate(-l,-f);break;case"z":a=!0,t.closePath();break}}if(!a&&!this.hasFill())t.strokeShape(this);else t.fillStrokeShape(this)}getSelfRect(){let t=[];this.dataArray.forEach(function(f){if(f.command==="A"){let o=f.points[4],c=f.points[5],u=f.points[4]+c,m=Math.PI/180;if(Math.abs(o-u)<m)m=Math.abs(o-u);if(c<0)for(let p=o-m;p>u;p-=m){let w=ra.getPointOnEllipticalArc(f.points[0],f.points[1],f.points[2],f.points[3],p,0);t.push(w.x,w.y)}else for(let p=o+m;p<u;p+=m){let w=ra.getPointOnEllipticalArc(f.points[0],f.points[1],f.points[2],f.points[3],p,0);t.push(w.x,w.y)}}else if(f.command==="C")for(let o=0;o<=1;o+=0.01){let c=ra.getPointOnCubicBezier(o,f.start.x,f.start.y,f.points[0],f.points[1],f.points[2],f.points[3],f.points[4],f.points[5]);t.push(c.x,c.y)}else t=t.concat(f.points)});let e=t[0],a=t[0],i=t[1],s=t[1],n,l;for(let f=0;f<t.length/2;f++){if(n=t[f*2],l=t[f*2+1],!isNaN(n))e=Math.min(e,n),a=Math.max(a,n);if(!isNaN(l))i=Math.min(i,l),s=Math.max(s,l)}return{x:e,y:i,width:a-e,height:s-i}}getLength(){return this.pathLength}getPointAtLength(t){return ra.getPointAtLengthOfDataArray(t,this.dataArray)}static getLineLength(t,e,a,i){return Math.sqrt((a-t)*(a-t)+(i-e)*(i-e))}static getPathLength(t){let e=0;for(let a=0;a<t.length;++a)e+=t[a].pathLength;return e}static getPointAtLengthOfDataArray(t,e){let a,i=0,s=e.length;if(!s)return null;while(i<s&&t>e[i].pathLength)t-=e[i].pathLength,++i;if(i===s)return a=e[i-1].points.slice(-2),{x:a[0],y:a[1]};if(t<0.01)if(e[i].command==="M")return a=e[i].points.slice(0,2),{x:a[0],y:a[1]};else return{x:e[i].start.x,y:e[i].start.y};let n=e[i],l=n.points;switch(n.command){case"L":return ra.getPointOnLine(t,n.start.x,n.start.y,l[0],l[1]);case"C":return ra.getPointOnCubicBezier(pb(t,ra.getPathLength(e),(d)=>{return gb([n.start.x,l[0],l[2],l[4]],[n.start.y,l[1],l[3],l[5]],d)}),n.start.x,n.start.y,l[0],l[1],l[2],l[3],l[4],l[5]);case"Q":return ra.getPointOnQuadraticBezier(pb(t,ra.getPathLength(e),(d)=>{return bb([n.start.x,l[0],l[2]],[n.start.y,l[1],l[3]],d)}),n.start.x,n.start.y,l[0],l[1],l[2],l[3]);case"A":let f=l[0],o=l[1],c=l[2],u=l[3],m=l[5],p=l[6],w=l[4];return w+=m*t/n.pathLength,ra.getPointOnEllipticalArc(f,o,c,u,w,p)}return null}static getPointOnLine(t,e,a,i,s,n,l){n=n!==null&&n!==void 0?n:e,l=l!==null&&l!==void 0?l:a;let f=this.getLineLength(e,a,i,s);if(f<0.0000000001)return{x:e,y:a};if(i===e)return{x:n,y:l+(s>a?t:-t)};let o=(s-a)/(i-e),c=Math.sqrt(t*t/(1+o*o))*(i<e?-1:1),u=o*c;if(Math.abs(l-a-o*(n-e))<0.0000000001)return{x:n+c,y:l+u};let m=((n-e)*(i-e)+(l-a)*(s-a))/(f*f),p=e+m*(i-e),w=a+m*(s-a),d=this.getLineLength(n,l,p,w),v=Math.sqrt(t*t-d*d),k=Math.sqrt(v*v/(1+o*o))*(i<e?-1:1),y=o*k;return{x:p+k,y:w+y}}static getPointOnCubicBezier(t,e,a,i,s,n,l,f,o){function c(v){return v*v*v}function u(v){return 3*v*v*(1-v)}function m(v){return 3*v*(1-v)*(1-v)}function p(v){return(1-v)*(1-v)*(1-v)}let w=f*c(t)+n*u(t)+i*m(t)+e*p(t),d=o*c(t)+l*u(t)+s*m(t)+a*p(t);return{x:w,y:d}}static getPointOnQuadraticBezier(t,e,a,i,s,n,l){function f(p){return p*p}function o(p){return 2*p*(1-p)}function c(p){return(1-p)*(1-p)}let u=n*f(t)+i*o(t)+e*c(t),m=l*f(t)+s*o(t)+a*c(t);return{x:u,y:m}}static getPointOnEllipticalArc(t,e,a,i,s,n){let l=Math.cos(n),f=Math.sin(n),o={x:a*Math.cos(s),y:i*Math.sin(s)};return{x:t+(o.x*l-o.y*f),y:e+(o.x*f+o.y*l)}}static parsePathData(t){if(!t)return[];let e=t,a=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];e=e.replace(new RegExp(" ","g"),",");for(let u=0;u<a.length;u++)e=e.replace(new RegExp(a[u],"g"),"|"+a[u]);let i=e.split("|"),s=[],n=[],l=0,f=0,o=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi,c;for(let u=1;u<i.length;u++){let m=i[u],p=m.charAt(0);m=m.slice(1),n.length=0;while(c=o.exec(m))n.push(c[0]);let w=[],d=p==="A"||p==="a"?0:-1;for(let v=0,k=n.length;v<k;v++){let y=n[v];if(y==="00"){if(w.push(0,0),d>=0){if(d+=2,d>=7)d-=7}continue}if(d>=0){if(d===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(y)){if(w.push(parseInt(y[0],10)),w.push(parseInt(y[1],10)),w.push(parseFloat(y.slice(2))),d+=3,d>=7)d-=7;continue}if(y==="11"||y==="10"||y==="01"){if(w.push(parseInt(y[0],10)),w.push(parseInt(y[1],10)),d+=2,d>=7)d-=7;continue}if(y==="0"||y==="1"){if(w.push(parseInt(y,10)),d+=1,d>=7)d-=7;continue}}else if(d===4){if(/^[01]\d+(?:\.\d+)?$/.test(y)){if(w.push(parseInt(y[0],10)),w.push(parseFloat(y.slice(1))),d+=2,d>=7)d-=7;continue}if(y==="0"||y==="1"){if(w.push(parseInt(y,10)),d+=1,d>=7)d-=7;continue}}let B=parseFloat(y);if(!isNaN(B))w.push(B);else w.push(0);if(d+=1,d>=7)d-=7}else{let B=parseFloat(y);if(!isNaN(B))w.push(B);else w.push(0)}}while(w.length>0){if(isNaN(w[0]))break;let v="",k=[],y=l,B=f,H,M,D,T,z,E,V,tt,at,Q;switch(p){case"l":l+=w.shift(),f+=w.shift(),v="L",k.push(l,f);break;case"L":l=w.shift(),f=w.shift(),k.push(l,f);break;case"m":let Z=w.shift(),J=w.shift();if(l+=Z,f+=J,v="M",s.length>2&&s[s.length-1].command==="z"){for(let Y=s.length-2;Y>=0;Y--)if(s[Y].command==="M"){l=s[Y].points[0]+Z,f=s[Y].points[1]+J;break}}k.push(l,f),p="l";break;case"M":l=w.shift(),f=w.shift(),v="M",k.push(l,f),p="L";break;case"h":l+=w.shift(),v="L",k.push(l,f);break;case"H":l=w.shift(),v="L",k.push(l,f);break;case"v":f+=w.shift(),v="L",k.push(l,f);break;case"V":f=w.shift(),v="L",k.push(l,f);break;case"C":k.push(w.shift(),w.shift(),w.shift(),w.shift()),l=w.shift(),f=w.shift(),k.push(l,f);break;case"c":k.push(l+w.shift(),f+w.shift(),l+w.shift(),f+w.shift()),l+=w.shift(),f+=w.shift(),v="C",k.push(l,f);break;case"S":if(M=l,D=f,H=s[s.length-1],H.command==="C")M=l+(l-H.points[2]),D=f+(f-H.points[3]);k.push(M,D,w.shift(),w.shift()),l=w.shift(),f=w.shift(),v="C",k.push(l,f);break;case"s":if(M=l,D=f,H=s[s.length-1],H.command==="C")M=l+(l-H.points[2]),D=f+(f-H.points[3]);k.push(M,D,l+w.shift(),f+w.shift()),l+=w.shift(),f+=w.shift(),v="C",k.push(l,f);break;case"Q":k.push(w.shift(),w.shift()),l=w.shift(),f=w.shift(),k.push(l,f);break;case"q":k.push(l+w.shift(),f+w.shift()),l+=w.shift(),f+=w.shift(),v="Q",k.push(l,f);break;case"T":if(M=l,D=f,H=s[s.length-1],H.command==="Q")M=l+(l-H.points[0]),D=f+(f-H.points[1]);l=w.shift(),f=w.shift(),v="Q",k.push(M,D,l,f);break;case"t":if(M=l,D=f,H=s[s.length-1],H.command==="Q")M=l+(l-H.points[0]),D=f+(f-H.points[1]);l+=w.shift(),f+=w.shift(),v="Q",k.push(M,D,l,f);break;case"A":T=w.shift(),z=w.shift(),E=w.shift(),V=w.shift(),tt=w.shift(),at=l,Q=f,l=w.shift(),f=w.shift(),v="A",k=this.convertEndpointToCenterParameterization(at,Q,l,f,V,tt,T,z,E);break;case"a":T=w.shift(),z=w.shift(),E=w.shift(),V=w.shift(),tt=w.shift(),at=l,Q=f,l+=w.shift(),f+=w.shift(),v="A",k=this.convertEndpointToCenterParameterization(at,Q,l,f,V,tt,T,z,E);break}s.push({command:v||p,points:k,start:{x:y,y:B},pathLength:this.calcLength(y,B,v||p,k)})}if(p==="z"||p==="Z")s.push({command:"z",points:[],start:void 0,pathLength:0})}return s}static calcLength(t,e,a,i){let s,n,l,f,o=ra;switch(a){case"L":return o.getLineLength(t,e,i[0],i[1]);case"C":return gb([t,i[0],i[2],i[4]],[e,i[1],i[3],i[5]],1);case"Q":return bb([t,i[0],i[2]],[e,i[1],i[3]],1);case"A":s=0;let c=i[4],u=i[5],m=i[4]+u,p=Math.PI/180;if(Math.abs(c-m)<p)p=Math.abs(c-m);if(n=o.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],c,0),u<0)for(f=c-p;f>m;f-=p)l=o.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],f,0),s+=o.getLineLength(n.x,n.y,l.x,l.y),n=l;else for(f=c+p;f<m;f+=p)l=o.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],f,0),s+=o.getLineLength(n.x,n.y,l.x,l.y),n=l;return l=o.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],m,0),s+=o.getLineLength(n.x,n.y,l.x,l.y),s}return 0}static convertEndpointToCenterParameterization(t,e,a,i,s,n,l,f,o){let c=o*(Math.PI/180),u=Math.cos(c)*(t-a)/2+Math.sin(c)*(e-i)/2,m=-1*Math.sin(c)*(t-a)/2+Math.cos(c)*(e-i)/2,p=u*u/(l*l)+m*m/(f*f);if(p>1)l*=Math.sqrt(p),f*=Math.sqrt(p);let w=Math.sqrt((l*l*(f*f)-l*l*(m*m)-f*f*(u*u))/(l*l*(m*m)+f*f*(u*u)));if(s===n)w*=-1;if(isNaN(w))w=0;let d=w*l*m/f,v=w*-f*u/l,k=(t+a)/2+Math.cos(c)*d-Math.sin(c)*v,y=(e+i)/2+Math.sin(c)*d+Math.cos(c)*v,B=function(V){return Math.sqrt(V[0]*V[0]+V[1]*V[1])},H=function(V,tt){return(V[0]*tt[0]+V[1]*tt[1])/(B(V)*B(tt))},M=function(V,tt){return(V[0]*tt[1]<V[1]*tt[0]?-1:1)*Math.acos(H(V,tt))},D=M([1,0],[(u-d)/l,(m-v)/f]),T=[(u-d)/l,(m-v)/f],z=[(-1*u-d)/l,(-1*m-v)/f],E=M(T,z);if(H(T,z)<=-1)E=Math.PI;if(H(T,z)>=1)E=0;if(n===0&&E>0)E=E-2*Math.PI;if(n===1&&E<0)E=E+2*Math.PI;return[k,y,l,f,D,E,c,n]}}ra.prototype.className="Path";ra.prototype._attrsAffectingSize=["data"];we(ra);X.addGetterSetter(ra,"data");class j1 extends Bn{_sceneFunc(t){super._sceneFunc(t);let e=Math.PI*2,a=this.points(),i=a,s=this.tension()!==0&&a.length>4;if(s)i=this.getTensionPoints();let n=this.pointerLength(),l=a.length,f,o;if(s){let m=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],a[l-2],a[l-1]],p=ra.calcLength(i[i.length-4],i[i.length-3],"C",m),w=ra.getPointOnQuadraticBezier(Math.min(1,1-n/p),m[0],m[1],m[2],m[3],m[4],m[5]);f=a[l-2]-w.x,o=a[l-1]-w.y}else f=a[l-2]-a[l-4],o=a[l-1]-a[l-3];let c=(Math.atan2(o,f)+e)%e,u=this.pointerWidth();if(this.pointerAtEnding())t.save(),t.beginPath(),t.translate(a[l-2],a[l-1]),t.rotate(c),t.moveTo(0,0),t.lineTo(-n,u/2),t.lineTo(-n,-u/2),t.closePath(),t.restore(),this.__fillStroke(t);if(this.pointerAtBeginning()){if(t.save(),t.beginPath(),t.translate(a[0],a[1]),s)f=(i[0]+i[2])/2-a[0],o=(i[1]+i[3])/2-a[1];else f=a[2]-a[0],o=a[3]-a[1];t.rotate((Math.atan2(-o,-f)+e)%e),t.moveTo(0,0),t.lineTo(-n,u/2),t.lineTo(-n,-u/2),t.closePath(),t.restore(),this.__fillStroke(t)}}__fillStroke(t){let e=this.dashEnabled();if(e)this.attrs.dashEnabled=!1,t.setLineDash([]);if(t.fillStrokeShape(this),e)this.attrs.dashEnabled=!0}getSelfRect(){let t=super.getSelfRect(),e=this.pointerWidth()/2;return{x:t.x,y:t.y-e,width:t.width,height:t.height+e*2}}}j1.prototype.className="Arrow";we(j1);X.addGetterSetter(j1,"pointerLength",10,jt());X.addGetterSetter(j1,"pointerWidth",10,jt());X.addGetterSetter(j1,"pointerAtBeginning",!1);X.addGetterSetter(j1,"pointerAtEnding",!0);class Ol extends At{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){if(this.radius()!==t/2)this.radius(t/2)}setHeight(t){if(this.radius()!==t/2)this.radius(t/2)}}Ol.prototype._centroid=!0;Ol.prototype.className="Circle";Ol.prototype._attrsAffectingSize=["radius"];we(Ol);X.addGetterSetter(Ol,"radius",0,jt());class C0 extends At{_sceneFunc(t){let e=this.radiusX(),a=this.radiusY();if(t.beginPath(),t.save(),e!==a)t.scale(1,a/e);t.arc(0,0,e,0,Math.PI*2,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}C0.prototype.className="Ellipse";C0.prototype._centroid=!0;C0.prototype._attrsAffectingSize=["radiusX","radiusY"];we(C0);X.addComponentsGetterSetter(C0,"radius",["x","y"]);X.addGetterSetter(C0,"radiusX",0,jt());X.addGetterSetter(C0,"radiusY",0,jt());class zs extends At{constructor(t){super(t);this._loadListener=()=>{this._requestDraw()},this.on("imageChange.konva",(e)=>{this._removeImageLoad(e.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){let t=this.image();if(t&&t.complete)return;if(t&&t.readyState===4)return;if(t&&t.addEventListener)t.addEventListener("load",this._loadListener)}_removeImageLoad(t){if(t&&t.removeEventListener)t.removeEventListener("load",this._loadListener)}destroy(){return this._removeImageLoad(this.image()),super.destroy(),this}_useBufferCanvas(){let t=!!this.cornerRadius(),e=this.hasShadow();if(t&&e)return!0;return super._useBufferCanvas(!0)}_sceneFunc(t){let e=this.getWidth(),a=this.getHeight(),i=this.cornerRadius(),s=this.attrs.image,n;if(s){let l=this.attrs.cropWidth,f=this.attrs.cropHeight;if(l&&f)n=[s,this.cropX(),this.cropY(),l,f,0,0,e,a];else n=[s,0,0,e,a]}if(this.hasFill()||this.hasStroke()||i)t.beginPath(),i?et.drawRoundedRectPath(t,e,a,i):t.rect(0,0,e,a),t.closePath(),t.fillStrokeShape(this);if(s){if(i)t.clip();t.drawImage.apply(t,n)}}_hitFunc(t){let e=this.width(),a=this.height(),i=this.cornerRadius();if(t.beginPath(),!i)t.rect(0,0,e,a);else et.drawRoundedRectPath(t,e,a,i);t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,e,a;return(a=(t=this.attrs.width)!==null&&t!==void 0?t:(e=this.image())===null||e===void 0?void 0:e.width)!==null&&a!==void 0?a:0}getHeight(){var t,e,a;return(a=(t=this.attrs.height)!==null&&t!==void 0?t:(e=this.image())===null||e===void 0?void 0:e.height)!==null&&a!==void 0?a:0}static fromURL(t,e,a=null){let i=et.createImageElement();i.onload=function(){let s=new zs({image:i});e(s)},i.onerror=a,i.crossOrigin="Anonymous",i.src=t}}zs.prototype.className="Image";zs.prototype._attrsAffectingSize=["image"];we(zs);X.addGetterSetter(zs,"cornerRadius",0,Fl(4));X.addGetterSetter(zs,"image");X.addComponentsGetterSetter(zs,"crop",["x","y","width","height"]);X.addGetterSetter(zs,"cropX",0,jt());X.addGetterSetter(zs,"cropY",0,jt());X.addGetterSetter(zs,"cropWidth",0,jt());X.addGetterSetter(zs,"cropHeight",0,jt());var RC=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],KX="Change.konva",LX="none",wb="up",jb="right",db="down",qb="left",VX=RC.length;class W2 extends k0{constructor(t){super(t);this.on("add.konva",function(e){this._addListeners(e.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){let e=this,a,i=function(){e._sync()};for(a=0;a<VX;a++)t.on(RC[a]+KX,i)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let t=this.getText(),e=this.getTag(),a,i,s,n,l,f,o;if(t&&e){switch(a=t.width(),i=t.height(),s=e.pointerDirection(),n=e.pointerWidth(),o=e.pointerHeight(),l=0,f=0,s){case wb:l=a/2,f=-1*o;break;case jb:l=a+n,f=i/2;break;case db:l=a/2,f=i+o;break;case qb:l=-1*n,f=i/2;break}e.setAttrs({x:-1*l,y:-1*f,width:a,height:i}),t.setAttrs({x:-1*l,y:-1*f})}}}W2.prototype.className="Label";we(W2);class d1 extends At{_sceneFunc(t){let e=this.width(),a=this.height(),i=this.pointerDirection(),s=this.pointerWidth(),n=this.pointerHeight(),l=this.cornerRadius(),f=0,o=0,c=0,u=0;if(typeof l==="number")f=o=c=u=Math.min(l,e/2,a/2);else f=Math.min(l[0]||0,e/2,a/2),o=Math.min(l[1]||0,e/2,a/2),u=Math.min(l[2]||0,e/2,a/2),c=Math.min(l[3]||0,e/2,a/2);if(t.beginPath(),t.moveTo(f,0),i===wb)t.lineTo((e-s)/2,0),t.lineTo(e/2,-1*n),t.lineTo((e+s)/2,0);if(t.lineTo(e-o,0),t.arc(e-o,o,o,Math.PI*3/2,0,!1),i===jb)t.lineTo(e,(a-n)/2),t.lineTo(e+s,a/2),t.lineTo(e,(a+n)/2);if(t.lineTo(e,a-u),t.arc(e-u,a-u,u,0,Math.PI/2,!1),i===db)t.lineTo((e+s)/2,a),t.lineTo(e/2,a+n),t.lineTo((e-s)/2,a);if(t.lineTo(c,a),t.arc(c,a-c,c,Math.PI/2,Math.PI,!1),i===qb)t.lineTo(0,(a+n)/2),t.lineTo(-1*s,a/2),t.lineTo(0,(a-n)/2);t.lineTo(0,f),t.arc(f,f,f,Math.PI,Math.PI*3/2,!1),t.closePath(),t.fillStrokeShape(this)}getSelfRect(){let t=0,e=0,a=this.pointerWidth(),i=this.pointerHeight(),s=this.pointerDirection(),n=this.width(),l=this.height();if(s===wb)e-=i,l+=i;else if(s===db)l+=i;else if(s===qb)t-=a*1.5,n+=a;else if(s===jb)n+=a*1.5;return{x:t,y:e,width:n,height:l}}}d1.prototype.className="Tag";we(d1);X.addGetterSetter(d1,"pointerDirection",LX);X.addGetterSetter(d1,"pointerWidth",0,jt());X.addGetterSetter(d1,"pointerHeight",0,jt());X.addGetterSetter(d1,"cornerRadius",0,Fl(4));class Hl extends At{_sceneFunc(t){let e=this.cornerRadius(),a=this.width(),i=this.height();if(t.beginPath(),!e)t.rect(0,0,a,i);else et.drawRoundedRectPath(t,a,i,e);t.closePath(),t.fillStrokeShape(this)}}Hl.prototype.className="Rect";we(Hl);X.addGetterSetter(Hl,"cornerRadius",0,Fl(4));class _0 extends At{_sceneFunc(t){let e=this._getPoints(),a=this.radius(),i=this.sides(),s=this.cornerRadius();if(t.beginPath(),!s){t.moveTo(e[0].x,e[0].y);for(let n=1;n<e.length;n++)t.lineTo(e[n].x,e[n].y)}else et.drawRoundedPolygonPath(t,e,i,a,s);t.closePath(),t.fillStrokeShape(this)}_getPoints(){let t=this.attrs.sides,e=this.attrs.radius||0,a=[];for(let i=0;i<t;i++)a.push({x:e*Math.sin(i*2*Math.PI/t),y:-1*e*Math.cos(i*2*Math.PI/t)});return a}getSelfRect(){let t=this._getPoints(),e=t[0].x,a=t[0].x,i=t[0].y,s=t[0].y;return t.forEach((n)=>{e=Math.min(e,n.x),a=Math.max(a,n.x),i=Math.min(i,n.y),s=Math.max(s,n.y)}),{x:e,y:i,width:a-e,height:s-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}_0.prototype.className="RegularPolygon";_0.prototype._centroid=!0;_0.prototype._attrsAffectingSize=["radius"];we(_0);X.addGetterSetter(_0,"radius",0,jt());X.addGetterSetter(_0,"sides",0,jt());X.addGetterSetter(_0,"cornerRadius",0,Fl(4));var NC=Math.PI*2;class q1 extends At{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,NC,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),NC,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}q1.prototype.className="Ring";q1.prototype._centroid=!0;q1.prototype._attrsAffectingSize=["innerRadius","outerRadius"];we(q1);X.addGetterSetter(q1,"innerRadius",0,jt());X.addGetterSetter(q1,"outerRadius",0,jt());class On extends At{constructor(t){super(t);this._updated=!0,this.anim=new ws(()=>{let e=this._updated;return this._updated=!1,e}),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(t){let e=this.animation(),a=this.frameIndex(),i=a*4,s=this.animations()[e],n=this.frameOffsets(),l=s[i+0],f=s[i+1],o=s[i+2],c=s[i+3],u=this.image();if(this.hasFill()||this.hasStroke())t.beginPath(),t.rect(0,0,o,c),t.closePath(),t.fillStrokeShape(this);if(u)if(n){let m=n[e],p=a*2;t.drawImage(u,l,f,o,c,m[p+0],m[p+1],o,c)}else t.drawImage(u,l,f,o,c,0,0,o,c)}_hitFunc(t){let e=this.animation(),a=this.frameIndex(),i=a*4,s=this.animations()[e],n=this.frameOffsets(),l=s[i+2],f=s[i+3];if(t.beginPath(),n){let o=n[e],c=a*2;t.rect(o[c+0],o[c+1],l,f)}else t.rect(0,0,l,f);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){let t=this;this.interval=setInterval(function(){t._updateIndex()},1000/this.frameRate())}start(){if(this.isRunning())return;let t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){let t=this.frameIndex(),e=this.animation(),a=this.animations(),i=a[e],s=i.length/4;if(t<s-1)this.frameIndex(t+1);else this.frameIndex(0)}}On.prototype.className="Sprite";we(On);X.addGetterSetter(On,"animation");X.addGetterSetter(On,"animations");X.addGetterSetter(On,"frameOffsets");X.addGetterSetter(On,"image");X.addGetterSetter(On,"frameIndex",0,jt());X.addGetterSetter(On,"frameRate",17,jt());X.backCompat(On,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});class F0 extends At{_sceneFunc(t){let e=this.innerRadius(),a=this.outerRadius(),i=this.numPoints();t.beginPath(),t.moveTo(0,0-a);for(let s=1;s<i*2;s++){let n=s%2===0?a:e,l=n*Math.sin(s*Math.PI/i),f=-1*n*Math.cos(s*Math.PI/i);t.lineTo(l,f)}t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}F0.prototype.className="Star";F0.prototype._centroid=!0;F0.prototype._attrsAffectingSize=["innerRadius","outerRadius"];we(F0);X.addGetterSetter(F0,"numPoints",5,jt());X.addGetterSetter(F0,"innerRadius",0,jt());X.addGetterSetter(F0,"outerRadius",0,jt());function A1(t){return[...t].reduce((e,a,i,s)=>{if(/\p{Emoji}/u.test(a)){let n=s[i+1];if(n&&/\p{Emoji_Modifier}|\u200D/u.test(n))e.push(a+n),s[i+1]="";else e.push(a)}else if(/\p{Regional_Indicator}{2}/u.test(a+(s[i+1]||"")))e.push(a+s[i+1]);else if(i>0&&/\p{Mn}|\p{Me}|\p{Mc}/u.test(a))e[e.length-1]+=a;else if(a)e.push(a);return e},[])}var dh="auto",YX="center",IC="inherit",P2="justify",JX="Change.konva",GC="2d",zC="-",XC="left",QX="text",ZX="Text",$X="top",WX="bottom",EC="middle",KC="normal",PX="px ",v3=" ",tK="right",xC="rtl",eK="word",aK="char",UC="none",Ab="…",LC=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],iK=LC.length,t9=null;function sK(){if(t9!==null)return t9;t9=!1;try{let t=document.createElement("canvas");t.width=10,t.height=10;let e=t.getContext(GC);if(e){e.globalAlpha=0,e.shadowColor="black",e.shadowBlur=5,e.shadowOffsetX=5,e.shadowOffsetY=5,e.fillStyle="black",e.font="10px Arial",e.fillText("X",0,10);let a=e.getImageData(0,0,10,10).data;for(let i=3;i<a.length;i+=4)if(a[i]>0){t9=!0;break}}}catch(t){}return t9}function nK(t){return t.split(",").map((e)=>{e=e.trim();let a=e.indexOf(" ")>=0,i=e.indexOf('"')>=0||e.indexOf("'")>=0;if(a&&!i)e=`"${e}"`;return e}).join(", ")}var S3;function vb(){if(S3)return S3;return S3=et.createCanvasElement().getContext(GC),S3}function lK(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)}function fK(t){t.setAttr("miterLimit",2),t.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function rK(t){if(t=t||{},!t.fillLinearGradientColorStops&&!t.fillRadialGradientColorStops&&!t.fillPatternImage)t.fill=t.fill||"black";return t}class oa extends At{constructor(t){super(rK(t));this._partialTextX=0,this._partialTextY=0;for(let e=0;e<iK;e++)this.on(LC[e]+JX,this._setTextData);this._setTextData()}_sceneFunc(t){var e,a;let i=this.textArr,s=i.length;if(!this.text())return;let n=this.padding(),l=this.fontSize(),f=this.lineHeight()*l,o=this.verticalAlign(),c=this.direction(),u=0,m=this.align(),p=this.getWidth(),w=this.letterSpacing(),d=this.charRenderFunc(),v=this.fill(),k=this.textDecoration(),y=this.underlineOffset(),B=k.indexOf("underline")!==-1,H=k.indexOf("line-through")!==-1,M;c=c===IC?t.direction:c;let D=f/2,T=EC;if(!St.legacyTextRendering){let z=this.measureSize("M");T="alphabetic";let E=(e=z.fontBoundingBoxAscent)!==null&&e!==void 0?e:z.actualBoundingBoxAscent,V=(a=z.fontBoundingBoxDescent)!==null&&a!==void 0?a:z.actualBoundingBoxDescent;D=(E-V)/2+f/2}if(c===xC)t.setAttr("direction",c);if(t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",T),t.setAttr("textAlign",XC),o===EC)u=(this.getHeight()-s*f-n*2)/2;else if(o===WX)u=this.getHeight()-s*f-n*2;t.translate(n,u+n);for(M=0;M<s;M++){let z=0,E=0,V=i[M],tt=V.text,at=V.width,Q=V.lastInParagraph;if(t.save(),m===tK)z+=p-at-n*2;else if(m===YX)z+=(p-at-n*2)/2;if(B){t.save(),t.beginPath();let J=y!==null&&y!==void 0?y:!St.legacyTextRendering?Math.round(l/4):Math.round(l/2),Y=z,W=D+E+J;t.moveTo(Y,W);let ft=m===P2&&!Q?p-n*2:at;t.lineTo(Y+Math.round(ft),W),t.lineWidth=l/15;let nt=this._getLinearGradient();t.strokeStyle=nt||v,t.stroke(),t.restore()}let Z=z;if(c!==xC&&(w!==0||m===P2||d)){let J=tt.split(" ").length-1,Y=A1(tt);for(let W=0;W<Y.length;W++){let ft=Y[W];if(ft===" "&&!Q&&m===P2)z+=(p-n*2-at)/J;if(this._partialTextX=z,this._partialTextY=D+E,this._partialText=ft,d){t.save();let qt=i.slice(0,M).reduce((ct,pt)=>ct+A1(pt.text).length,0),R=W+qt;d({char:ft,index:R,x:z,y:D+E,lineIndex:M,column:W,isLastInLine:Q,width:this.measureSize(ft).width,context:t})}if(t.fillStrokeShape(this),d)t.restore();z+=this.measureSize(ft).width+w}}else{if(w!==0)t.setAttr("letterSpacing",`${w}px`);this._partialTextX=z,this._partialTextY=D+E,this._partialText=tt,t.fillStrokeShape(this)}if(H){t.save(),t.beginPath();let J=!St.legacyTextRendering?-Math.round(l/4):0,Y=Z;t.moveTo(Y,D+E+J);let W=m===P2&&!Q?p-n*2:at;t.lineTo(Y+Math.round(W),D+E+J),t.lineWidth=l/15;let ft=this._getLinearGradient();t.strokeStyle=ft||v,t.stroke(),t.restore()}if(t.restore(),s>1)D+=f}}_hitFunc(t){let e=this.getWidth(),a=this.getHeight();t.beginPath(),t.rect(0,0,e,a),t.closePath(),t.fillStrokeShape(this)}setText(t){let e=et._isString(t)?t:t===null||t===void 0?"":t+"";return this._setAttr(QX,e),this}getWidth(){return this.attrs.width===dh||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===dh||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return et.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var e,a,i,s,n,l,f,o,c,u,m;let p=vb(),w=this.fontSize(),d;p.save(),p.font=this._getContextFont(),d=p.measureText(t),p.restore();let v=w/100;return{actualBoundingBoxAscent:(e=d.actualBoundingBoxAscent)!==null&&e!==void 0?e:71.58203125*v,actualBoundingBoxDescent:(a=d.actualBoundingBoxDescent)!==null&&a!==void 0?a:0,actualBoundingBoxLeft:(i=d.actualBoundingBoxLeft)!==null&&i!==void 0?i:-7.421875*v,actualBoundingBoxRight:(s=d.actualBoundingBoxRight)!==null&&s!==void 0?s:75.732421875*v,alphabeticBaseline:(n=d.alphabeticBaseline)!==null&&n!==void 0?n:0,emHeightAscent:(l=d.emHeightAscent)!==null&&l!==void 0?l:100*v,emHeightDescent:(f=d.emHeightDescent)!==null&&f!==void 0?f:-20*v,fontBoundingBoxAscent:(o=d.fontBoundingBoxAscent)!==null&&o!==void 0?o:91*v,fontBoundingBoxDescent:(c=d.fontBoundingBoxDescent)!==null&&c!==void 0?c:21*v,hangingBaseline:(u=d.hangingBaseline)!==null&&u!==void 0?u:72.80000305175781*v,ideographicBaseline:(m=d.ideographicBaseline)!==null&&m!==void 0?m:-21*v,width:d.width,height:w}}_getContextFont(){return this.fontStyle()+v3+this.fontVariant()+v3+(this.fontSize()+PX)+nK(this.fontFamily())}_addTextLine(t){if(this.align()===P2)t=t.trim();let a=this._getTextWidth(t);return this.textArr.push({text:t,width:a,lastInParagraph:!1})}_getTextWidth(t){let e=this.letterSpacing(),a=t.length;return vb().measureText(t).width+e*a}_setTextData(){let t=this.text().split(`
258
- `),e=+this.fontSize(),a=0,i=this.lineHeight()*e,s=this.attrs.width,n=this.attrs.height,l=s!==dh&&s!==void 0,f=n!==dh&&n!==void 0,o=this.padding(),c=s-o*2,u=n-o*2,m=0,p=this.wrap(),w=p!==UC,d=p!==aK&&w,v=this.ellipsis();this.textArr=[],vb().font=this._getContextFont();let k=v?this._getTextWidth(Ab):0;for(let y=0,B=t.length;y<B;++y){let H=t[y],M=this._getTextWidth(H);if(l&&M>c)while(H.length>0){let D=0,T=A1(H).length,z="",E=0;while(D<T){let V=D+T>>>1,tt=A1(H),at=tt.slice(0,V+1).join(""),Q=this._getTextWidth(at);if((v&&f&&m+i>u?Q+k:Q)<=c)D=V+1,z=at,E=Q;else T=V}if(z){if(d){let at=A1(H),Q=A1(z),Z=at[Q.length],J=Z===v3||Z===zC,Y;if(J&&E<=c)Y=Q.length;else{let W=Q.lastIndexOf(v3),ft=Q.lastIndexOf(zC);Y=Math.max(W,ft)+1}if(Y>0)D=Y,z=at.slice(0,D).join(""),E=this._getTextWidth(z)}if(z=z.trimRight(),this._addTextLine(z),a=Math.max(a,E),m+=i,this._shouldHandleEllipsis(m)){this._tryToAddEllipsisToLastLine();break}if(H=A1(H).slice(D).join("").trimLeft(),H.length>0){if(M=this._getTextWidth(H),M<=c){this._addTextLine(H),m+=i,a=Math.max(a,M);break}}}else break}else if(this._addTextLine(H),m+=i,a=Math.max(a,M),this._shouldHandleEllipsis(m)&&y<B-1)this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1])this.textArr[this.textArr.length-1].lastInParagraph=!0;if(f&&m+i>u)break}this.textHeight=e,this.textWidth=a}_shouldHandleEllipsis(t){let e=+this.fontSize(),a=this.lineHeight()*e,i=this.attrs.height,s=i!==dh&&i!==void 0,n=this.padding(),l=i-n*2;return this.wrap()===UC||s&&t+a>l}_tryToAddEllipsisToLastLine(){let t=this.attrs.width,e=t!==dh&&t!==void 0,a=this.padding(),i=t-a*2,s=this.ellipsis(),n=this.textArr[this.textArr.length-1];if(!n||!s)return;if(e){if(!(this._getTextWidth(n.text+Ab)<i))n.text=n.text.slice(0,n.text.length-3)}this.textArr.splice(this.textArr.length-1,1),this._addTextLine(n.text+Ab)}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){let t=this.textDecoration().indexOf("underline")!==-1||this.textDecoration().indexOf("line-through")!==-1,e=this.hasShadow();if(t&&e)return!0;if(e&&this.getAbsoluteOpacity()!==1&&sK())return!0;return super._useBufferCanvas()}}oa.prototype._fillFunc=lK;oa.prototype._strokeFunc=fK;oa.prototype.className=ZX;oa.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"];we(oa);X.overWriteSetter(oa,"width",G2());X.overWriteSetter(oa,"height",G2());X.addGetterSetter(oa,"direction",IC);X.addGetterSetter(oa,"fontFamily","Arial");X.addGetterSetter(oa,"fontSize",12,jt());X.addGetterSetter(oa,"fontStyle",KC);X.addGetterSetter(oa,"fontVariant",KC);X.addGetterSetter(oa,"padding",0,jt());X.addGetterSetter(oa,"align",XC);X.addGetterSetter(oa,"verticalAlign",$X);X.addGetterSetter(oa,"lineHeight",1,jt());X.addGetterSetter(oa,"wrap",eK);X.addGetterSetter(oa,"ellipsis",!1,Yi());X.addGetterSetter(oa,"letterSpacing",0,jt());X.addGetterSetter(oa,"text","",S0());X.addGetterSetter(oa,"textDecoration","");X.addGetterSetter(oa,"underlineOffset",void 0,jt());X.addGetterSetter(oa,"charRenderFunc",void 0);var oK="",VC="normal";function YC(t){t.fillText(this.partialText,0,0)}function JC(t){t.strokeText(this.partialText,0,0)}class Ya extends At{constructor(t){super(t);this.dummyCanvas=et.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 ra.getPathLength(this.dataArray)}_getPointAtLength(t){if(!this.attrs.data)return null;let e=this.pathLength;if(t>e)return null;return ra.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=ra.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();let e=this.textDecoration(),a=this.fill(),i=this.fontSize(),s=this.glyphInfo,n=e.indexOf("underline")!==-1,l=e.indexOf("line-through")!==-1;if(n)t.beginPath();for(let f=0;f<s.length;f++){t.save();let o=s[f].p0;if(t.translate(o.x,o.y),t.rotate(s[f].rotation),this.partialText=s[f].text,t.fillStrokeShape(this),n){if(f===0)t.moveTo(0,i/2+1);t.lineTo(s[f].width,i/2+1)}t.restore()}if(n)t.strokeStyle=a,t.lineWidth=i/20,t.stroke();if(l){t.beginPath();for(let f=0;f<s.length;f++){t.save();let o=s[f].p0;if(t.translate(o.x,o.y),t.rotate(s[f].rotation),f===0)t.moveTo(0,0);t.lineTo(s[f].width,0),t.restore()}t.strokeStyle=a,t.lineWidth=i/20,t.stroke()}t.restore()}_hitFunc(t){t.beginPath();let e=this.glyphInfo;if(e.length>=1){let a=e[0].p0;t.moveTo(a.x,a.y)}for(let a=0;a<e.length;a++){let i=e[a].p1;t.lineTo(i.x,i.y)}t.setAttr("lineWidth",this.fontSize()),t.setAttr("strokeStyle",this.colorKey),t.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return et.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(t){return oa.prototype.setText.call(this,t)}_getContextFont(){return oa.prototype._getContextFont.call(this)}_getTextSize(t){let a=this.dummyCanvas.getContext("2d");a.save(),a.font=this._getContextFont();let i=a.measureText(t);return a.restore(),{width:i.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){let t=A1(this.text());if(this.direction()==="rtl")t.reverse();let e=[],a=0;for(let p=0;p<t.length;p++)e.push({char:t[p],width:this._getTextSize(t[p]).width}),a+=e[p].width;let{width:i,height:s}=this._getTextSize(this.attrs.text);if(this.textWidth=a,this.textHeight=s,this.glyphInfo=[],!this.attrs.data)return null;let n=this.letterSpacing(),l=this.align(),f=this.kerningFunc(),o=Math.max(0,a-i),c=Math.max(this.textWidth+((this.attrs.text||"").length-1)*n,0),u=0;if(l==="center")u=Math.max(0,this.pathLength/2-c/2);if(l==="right")u=Math.max(0,this.pathLength-c);let m=u;for(let p=0;p<e.length;p++){let w=this._getPointAtLength(m);if(!w)return;let d=e[p].char,v=e[p].width+n;if(d===" "&&l==="justify"){let T=this.text().split(" ").length-1;v+=(this.pathLength-c)/T}let k=m+v,y=this._getPointAtLength(k>this.pathLength&&k-this.pathLength<=o?this.pathLength:k);if(!y)return;let B=ra.getLineLength(w.x,w.y,y.x,y.y),H=0;if(f)try{H=f(e[p-1].char,d)*this.fontSize()}catch(T){H=0}w.x+=H,y.x+=H,this.textWidth+=H;let M=ra.getPointOnLine(H+B/2,w.x,w.y,y.x,y.y),D=Math.atan2(y.y-w.y,y.x-w.x);this.glyphInfo.push({transposeX:M.x,transposeY:M.y,text:t[p],rotation:D,p0:w,p1:y,width:B}),m+=v}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};let t=[];this.glyphInfo.forEach(function(o){t.push(o.p0.x),t.push(o.p0.y),t.push(o.p1.x),t.push(o.p1.y)});let e=t[0]||0,a=t[0]||0,i=t[1]||0,s=t[1]||0,n,l;for(let o=0;o<t.length/2;o++)n=t[o*2],l=t[o*2+1],e=Math.min(e,n),a=Math.max(a,n),i=Math.min(i,l),s=Math.max(s,l);let f=this.fontSize();return{x:e-f/2,y:i-f/2,width:a-e+f,height:s-i+f}}destroy(){return et.releaseCanvas(this.dummyCanvas),super.destroy()}}Ya.prototype._fillFunc=YC;Ya.prototype._strokeFunc=JC;Ya.prototype._fillFuncHit=YC;Ya.prototype._strokeFuncHit=JC;Ya.prototype.className="TextPath";Ya.prototype._attrsAffectingSize=["text","fontSize","data"];we(Ya);X.addGetterSetter(Ya,"data");X.addGetterSetter(Ya,"fontFamily","Arial");X.addGetterSetter(Ya,"fontSize",12,jt());X.addGetterSetter(Ya,"fontStyle",VC);X.addGetterSetter(Ya,"align","left");X.addGetterSetter(Ya,"letterSpacing",0,jt());X.addGetterSetter(Ya,"textBaseline","middle");X.addGetterSetter(Ya,"fontVariant",VC);X.addGetterSetter(Ya,"text",oK);X.addGetterSetter(Ya,"textDecoration","");X.addGetterSetter(Ya,"kerningFunc",void 0);X.addGetterSetter(Ya,"direction","inherit");var $C="tr-konva",hK=["resizeEnabledChange","rotateAnchorOffsetChange","rotateAnchorAngleChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map((t)=>t+`.${$C}`).join(" "),QC="nodesRect",cK=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange","draggableChange"],uK={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},mK="ontouchstart"in St._global;function gK(t,e,a){if(t==="rotater")return a;e+=et.degToRad(uK[t]||0);let i=(et.radToDeg(e)%360+360)%360;if(et._inRange(i,337.5,360)||et._inRange(i,0,22.5))return"ns-resize";else if(et._inRange(i,22.5,67.5))return"nesw-resize";else if(et._inRange(i,67.5,112.5))return"ew-resize";else if(et._inRange(i,112.5,157.5))return"nwse-resize";else if(et._inRange(i,157.5,202.5))return"ns-resize";else if(et._inRange(i,202.5,247.5))return"nesw-resize";else if(et._inRange(i,247.5,292.5))return"ew-resize";else if(et._inRange(i,292.5,337.5))return"nwse-resize";else return et.error("Transformer has unknown angle for cursor detection: "+i),"pointer"}var y3=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],ZC=1e8;function bK(t){return{x:t.x+t.width/2*Math.cos(t.rotation)+t.height/2*Math.sin(-t.rotation),y:t.y+t.height/2*Math.cos(t.rotation)+t.width/2*Math.sin(t.rotation)}}function WC(t,e,a){let i=a.x+(t.x-a.x)*Math.cos(e)-(t.y-a.y)*Math.sin(e),s=a.y+(t.x-a.x)*Math.sin(e)+(t.y-a.y)*Math.cos(e);return{...t,rotation:t.rotation+e,x:i,y:s}}function pK(t,e){let a=bK(t);return WC(t,e,a)}function wK(t,e,a){let i=e;for(let s=0;s<t.length;s++){let n=St.getAngle(t[s]),l=Math.abs(n-e)%(Math.PI*2);if(Math.min(l,Math.PI*2-l)<a)i=n}return i}var Sb=0;class Te extends k0{constructor(t){super(t);if(this._movingAnchorName=null,this._transforming=!1,this._elementsCreated=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(hK,this.update),this.getNode())this.update()}attachTo(t){return this.setNode(t),this}setNode(t){return et.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([t])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return $C+this._id}setNodes(t=[]){if(this._nodes&&this._nodes.length)this.detach();let e=t.filter((i)=>{if(i.isAncestorOf(this))return et.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1;return!0});if(this._nodes=t=e,t.length===1&&this.useSingleNodeRotation())this.rotation(t[0].getAbsoluteRotation());else this.rotation(0);if(this._nodes.forEach((i)=>{let s=()=>{if(this.nodes().length===1&&this.useSingleNodeRotation())this.rotation(this.nodes()[0].getAbsoluteRotation());if(this._resetTransformCache(),!this._transforming&&!this.isDragging())this.update()};if(i._attrsAffectingSize.length){let n=i._attrsAffectingSize.map((l)=>l+"Change."+this._getEventNamespace()).join(" ");i.on(n,s)}i.on(cK.map((n)=>n+`.${this._getEventNamespace()}`).join(" "),s),i.on(`absoluteTransformChange.${this._getEventNamespace()}`,s),this._proxyDrag(i)}),this._resetTransformCache(),!!this.findOne(".top-left"))this.update();return this}_proxyDrag(t){let e;t.on(`dragstart.${this._getEventNamespace()}`,(a)=>{if(e=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back"))this.startDrag(a,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,(a)=>{if(!e)return;let i=t.getAbsolutePosition(),s=i.x-e.x,n=i.y-e.y;this.nodes().forEach((l)=>{if(l===t)return;if(l.isDragging())return;let f=l.getAbsolutePosition();l.setAbsolutePosition({x:f.x+s,y:f.y+n}),l.startDrag(a)}),e=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){if(this._nodes)this._nodes.forEach((t)=>{t.off("."+this._getEventNamespace())});this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(QC),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(QC,this.__getNodeRect)}__getNodeShape(t,e=this.rotation(),a){let i=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),s=t.getAbsoluteScale(a),n=t.getAbsolutePosition(a),l=i.x*s.x-t.offsetX()*s.x,f=i.y*s.y-t.offsetY()*s.y,o=(St.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),c={x:n.x+l*Math.cos(o)+f*Math.sin(-o),y:n.y+f*Math.cos(o)+l*Math.sin(o),width:i.width*s.x,height:i.height*s.y,rotation:o};return WC(c,-St.getAngle(e),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-ZC,y:-ZC,width:0,height:0,rotation:0};let e=[];this.nodes().map((o)=>{let c=o.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),u=[{x:c.x,y:c.y},{x:c.x+c.width,y:c.y},{x:c.x+c.width,y:c.y+c.height},{x:c.x,y:c.y+c.height}],m=o.getAbsoluteTransform();u.forEach(function(p){let w=m.point(p);e.push(w)})});let a=new Vi;a.rotate(-St.getAngle(this.rotation()));let i=1/0,s=1/0,n=-1/0,l=-1/0;e.forEach(function(o){let c=a.point(o);if(i===void 0)i=n=c.x,s=l=c.y;i=Math.min(i,c.x),s=Math.min(s,c.y),n=Math.max(n,c.x),l=Math.max(l,c.y)}),a.invert();let f=a.point({x:i,y:s});return{x:f.x,y:f.y,width:n-i,height:l-s,rotation:St.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(),y3.forEach((t)=>{this._createAnchor(t)}),this._createAnchor("rotater"),this._elementsCreated=!0}_createAnchor(t){let e=new Hl({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:mK?10:"auto"}),a=this;e.on("mousedown touchstart",function(i){a._handleMouseDown(i)}),e.on("dragstart",(i)=>{e.stopDrag(),i.cancelBubble=!0}),e.on("dragend",(i)=>{i.cancelBubble=!0}),e.on("mouseenter",()=>{let i=St.getAngle(this.rotation()),s=this.rotateAnchorCursor(),n=gK(t,i,s);e.getStage().content&&(e.getStage().content.style.cursor=n),this._cursorChange=!0}),e.on("mouseout",()=>{e.getStage().content&&(e.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(e)}_createBack(){let t=new At({name:"back",width:0,height:0,sceneFunc(e,a){let i=a.getParent(),s=i.padding(),n=a.width(),l=a.height();if(e.beginPath(),e.rect(-s,-s,n+s*2,l+s*2),i.rotateEnabled()&&i.rotateLineVisible()){let f=i.rotateAnchorAngle(),o=i.rotateAnchorOffset(),c=et.degToRad(f),u=Math.sin(c),m=-Math.cos(c),p=n/2,w=l/2,d=1/0;if(m<0)d=Math.min(d,-w/m);else if(m>0)d=Math.min(d,(l-w)/m);if(u<0)d=Math.min(d,-p/u);else if(u>0)d=Math.min(d,(n-p)/u);let v=p+u*d,k=w+m*d,y=et._sign(l),B=v+u*o*y,H=k+m*o*y;e.moveTo(v,k),e.lineTo(B,H)}e.fillStrokeShape(a)},hitFunc:(e,a)=>{if(!this.shouldOverdrawWholeArea())return;let i=this.padding();e.beginPath(),e.rect(-i,-i,a.width()+i*2,a.height()+i*2),e.fillStrokeShape(a)}});this.add(t),this._proxyDrag(t),t.on("dragstart",(e)=>{e.cancelBubble=!0}),t.on("dragmove",(e)=>{e.cancelBubble=!0}),t.on("dragend",(e)=>{e.cancelBubble=!0}),this.on("dragmove",(e)=>{this.update()})}_handleMouseDown(t){if(this._transforming)return;this._movingAnchorName=t.target.name().split(" ")[0];let e=this._getNodeRect(),a=e.width,i=e.height,s=Math.sqrt(Math.pow(a,2)+Math.pow(i,2));if(this.sin=Math.abs(i/s),this.cos=Math.abs(a/s),typeof window<"u")window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0);this._transforming=!0;let n=t.target.getAbsolutePosition(),l=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:l.x-n.x,y:l.y-n.y},Sb++,this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach((f)=>{f._fire("transformstart",{evt:t.evt,target:f})})}_handleMouseMove(t){let e,a,i,s=this.findOne("."+this._movingAnchorName),n=s.getStage();n.setPointersPositions(t);let l=n.getPointerPosition(),f={x:l.x-this._anchorDragOffset.x,y:l.y-this._anchorDragOffset.y},o=s.getAbsolutePosition();if(this.anchorDragBoundFunc())f=this.anchorDragBoundFunc()(o,f,t);s.setAbsolutePosition(f);let c=s.getAbsolutePosition();if(o.x===c.x&&o.y===c.y)return;if(this._movingAnchorName==="rotater"){let y=this._getNodeRect();e=s.x()-y.width/2,a=-s.y()+y.height/2;let B=St.getAngle(this.rotateAnchorAngle()),H=Math.atan2(-a,e)+Math.PI/2-B;if(y.height<0)H-=Math.PI;let D=St.getAngle(this.rotation())+H,T=St.getAngle(this.rotationSnapTolerance()),E=wK(this.rotationSnaps(),D,T)-y.rotation,V=pK(y,E);this._fitNodesInto(V,t);return}let u=this.shiftBehavior(),m;if(u==="inverted")m=this.keepRatio()&&!t.shiftKey;else if(u==="none")m=this.keepRatio();else m=this.keepRatio()||t.shiftKey;let p=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(m){let y=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(y.x-s.x(),2)+Math.pow(y.y-s.y(),2));let B=this.findOne(".top-left").x()>y.x?-1:1,H=this.findOne(".top-left").y()>y.y?-1:1;e=i*this.cos*B,a=i*this.sin*H,this.findOne(".top-left").x(y.x-e),this.findOne(".top-left").y(y.y-a)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(s.y());else if(this._movingAnchorName==="top-right"){if(m){let y=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};i=Math.sqrt(Math.pow(s.x()-y.x,2)+Math.pow(y.y-s.y(),2));let B=this.findOne(".top-right").x()<y.x?-1:1,H=this.findOne(".top-right").y()>y.y?-1:1;e=i*this.cos*B,a=i*this.sin*H,this.findOne(".top-right").x(y.x+e),this.findOne(".top-right").y(y.y-a)}var w=s.position();this.findOne(".top-left").y(w.y),this.findOne(".bottom-right").x(w.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(s.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(s.x());else if(this._movingAnchorName==="bottom-left"){if(m){let y=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};i=Math.sqrt(Math.pow(y.x-s.x(),2)+Math.pow(s.y()-y.y,2));let B=y.x<s.x()?-1:1,H=s.y()<y.y?-1:1;e=i*this.cos*B,a=i*this.sin*H,s.x(y.x-e),s.y(y.y+a)}w=s.position(),this.findOne(".top-left").x(w.x),this.findOne(".bottom-right").y(w.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(s.y());else if(this._movingAnchorName==="bottom-right"){if(m){let y=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};i=Math.sqrt(Math.pow(s.x()-y.x,2)+Math.pow(s.y()-y.y,2));let B=this.findOne(".bottom-right").x()<y.x?-1:1,H=this.findOne(".bottom-right").y()<y.y?-1:1;e=i*this.cos*B,a=i*this.sin*H,this.findOne(".bottom-right").x(y.x+e),this.findOne(".bottom-right").y(y.y+a)}}else console.error(Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(p=this.centeredScaling()||t.altKey,p){let y=this.findOne(".top-left"),B=this.findOne(".bottom-right"),H=y.x(),M=y.y(),D=this.getWidth()-B.x(),T=this.getHeight()-B.y();B.move({x:-H,y:-M}),y.move({x:D,y:T})}let d=this.findOne(".top-left").getAbsolutePosition();e=d.x,a=d.y;let v=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),k=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:e,y:a,width:v,height:k,rotation:St.getAngle(this.rotation())},t)}_handleMouseUp(t){this._removeEvents(t)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(t){var e;if(this._transforming){if(this._transforming=!1,typeof window<"u")window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0);let a=this.getNode();if(Sb--,this._fire("transformend",{evt:t,target:a}),(e=this.getLayer())===null||e===void 0||e.batchDraw(),a)this._nodes.forEach((i)=>{var s;i._fire("transformend",{evt:t,target:i}),(s=i.getLayer())===null||s===void 0||s.batchDraw()});this._movingAnchorName=null}}_fitNodesInto(t,e){let a=this._getNodeRect(),i=1;if(et._inRange(t.width,-this.padding()*2-1,1)){this.update();return}if(et._inRange(t.height,-this.padding()*2-1,1)){this.update();return}let s=new Vi;if(s.rotate(St.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){let m=s.point({x:-this.padding()*2,y:0});t.x+=m.x,t.y+=m.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=m.x,this._anchorDragOffset.y-=m.y}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){let m=s.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=m.x,this._anchorDragOffset.y-=m.y,t.width+=this.padding()*2}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){let m=s.point({x:0,y:-this.padding()*2});t.x+=m.x,t.y+=m.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=m.x,this._anchorDragOffset.y-=m.y,t.height+=this.padding()*2}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){let m=s.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=m.x,this._anchorDragOffset.y-=m.y,t.height+=this.padding()*2}if(this.boundBoxFunc()){let m=this.boundBoxFunc()(a,t);if(m)t=m;else et.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}let n=1e7,l=new Vi;l.translate(a.x,a.y),l.rotate(a.rotation),l.scale(a.width/n,a.height/n);let f=new Vi,o=t.width/n,c=t.height/n;if(this.flipEnabled()===!1)f.translate(t.x,t.y),f.rotate(t.rotation),f.translate(t.width<0?t.width:0,t.height<0?t.height:0),f.scale(Math.abs(o),Math.abs(c));else f.translate(t.x,t.y),f.rotate(t.rotation),f.scale(o,c);let u=f.multiply(l.invert());this._nodes.forEach((m)=>{var p;if(!m.getStage())return;let w=m.getParent().getAbsoluteTransform(),d=m.getTransform().copy();d.translate(m.offsetX(),m.offsetY());let v=new Vi;v.multiply(w.copy().invert()).multiply(u).multiply(w).multiply(d);let k=v.decompose();m.setAttrs(k),(p=m.getLayer())===null||p===void 0||p.batchDraw()}),this.rotation(et._getRotation(t.rotation)),this._nodes.forEach((m)=>{this._fire("transform",{evt:e,target:m}),m._fire("transform",{evt:e,target:m})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,e){this.findOne(t).setAttrs(e)}update(){var t;let e=this._getNodeRect();this.rotation(et._getRotation(e.rotation));let{width:a,height:i}=e,s=this.enabledAnchors(),n=this.resizeEnabled(),l=this.padding(),f=this.anchorSize(),o=this.find("._anchor");o.forEach((D)=>{D.setAttrs({width:f,height:f,offsetX:f/2,offsetY:f/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:f/2+l,offsetY:f/2+l,visible:n&&s.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:a/2,y:0,offsetY:f/2+l,visible:n&&s.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:a,y:0,offsetX:f/2-l,offsetY:f/2+l,visible:n&&s.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:f/2+l,visible:n&&s.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:a,y:i/2,offsetX:f/2-l,visible:n&&s.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:f/2+l,offsetY:f/2-l,visible:n&&s.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:a/2,y:i,offsetY:f/2-l,visible:n&&s.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:a,y:i,offsetX:f/2-l,offsetY:f/2-l,visible:n&&s.indexOf("bottom-right")>=0});let c=this.rotateAnchorAngle(),u=this.rotateAnchorOffset(),m=et.degToRad(c),p=Math.sin(m),w=-Math.cos(m),d=a/2,v=i/2,k=1/0;if(w<0)k=Math.min(k,-v/w);else if(w>0)k=Math.min(k,(i-v)/w);if(p<0)k=Math.min(k,-d/p);else if(p>0)k=Math.min(k,(a-d)/p);let y=d+p*k,B=v+w*k,H=et._sign(i);this._batchChangeChild(".rotater",{x:y+p*u*H,y:B+w*u*H-l*w,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:a,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),draggable:this.nodes().some((D)=>D.draggable()),x:0,y:0});let M=this.anchorStyleFunc();if(M)o.forEach((D)=>{M(D)});(t=this.getLayer())===null||t===void 0||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();let t=this.findOne("."+this._movingAnchorName);if(t)t.stopDrag()}}destroy(){if(this.getStage()&&this._cursorChange)this.getStage().content&&(this.getStage().content.style.cursor="");return k0.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}add(...t){if(this._elementsCreated)return et.error("You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead."),this;return super.add(...t)}toObject(){return vt.prototype.toObject.call(this)}clone(t){return vt.prototype.clone.call(this,t)}getClientRect(){if(this.nodes().length>0)return super.getClientRect();else return{x:0,y:0,width:0,height:0}}}Te.isTransforming=()=>{return Sb>0};function jK(t){if(!(t instanceof Array))et.warn("enabledAnchors value should be an array");if(t instanceof Array)t.forEach(function(e){if(y3.indexOf(e)===-1)et.warn("Unknown anchor name: "+e+". Available names are: "+y3.join(", "))});return t||[]}Te.prototype.className="Transformer";we(Te);X.addGetterSetter(Te,"enabledAnchors",y3,jK);X.addGetterSetter(Te,"flipEnabled",!0,Yi());X.addGetterSetter(Te,"resizeEnabled",!0);X.addGetterSetter(Te,"anchorSize",10,jt());X.addGetterSetter(Te,"rotateEnabled",!0);X.addGetterSetter(Te,"rotateLineVisible",!0);X.addGetterSetter(Te,"rotationSnaps",[]);X.addGetterSetter(Te,"rotateAnchorOffset",50,jt());X.addGetterSetter(Te,"rotateAnchorAngle",0,jt());X.addGetterSetter(Te,"rotateAnchorCursor","crosshair");X.addGetterSetter(Te,"rotationSnapTolerance",5,jt());X.addGetterSetter(Te,"borderEnabled",!0);X.addGetterSetter(Te,"anchorStroke","rgb(0, 161, 255)");X.addGetterSetter(Te,"anchorStrokeWidth",1,jt());X.addGetterSetter(Te,"anchorFill","white");X.addGetterSetter(Te,"anchorCornerRadius",0,jt());X.addGetterSetter(Te,"borderStroke","rgb(0, 161, 255)");X.addGetterSetter(Te,"borderStrokeWidth",1,jt());X.addGetterSetter(Te,"borderDash");X.addGetterSetter(Te,"keepRatio",!0);X.addGetterSetter(Te,"shiftBehavior","default");X.addGetterSetter(Te,"centeredScaling",!1);X.addGetterSetter(Te,"ignoreStroke",!1);X.addGetterSetter(Te,"padding",0,jt());X.addGetterSetter(Te,"nodes");X.addGetterSetter(Te,"node");X.addGetterSetter(Te,"boundBoxFunc");X.addGetterSetter(Te,"anchorDragBoundFunc");X.addGetterSetter(Te,"anchorStyleFunc");X.addGetterSetter(Te,"shouldOverdrawWholeArea",!1);X.addGetterSetter(Te,"useSingleNodeRotation",!0);X.backCompat(Te,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class Wn extends At{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,St.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}Wn.prototype.className="Wedge";Wn.prototype._centroid=!0;Wn.prototype._attrsAffectingSize=["radius"];we(Wn);X.addGetterSetter(Wn,"radius",0,jt());X.addGetterSetter(Wn,"angle",0,jt());X.addGetterSetter(Wn,"clockwise",!1);X.backCompat(Wn,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function PC(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var dK=[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],qK=[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 AK(t,e){let{data:a,width:i,height:s}=t,n,l,f,o,c,u,m,p,w,d,v,k,y,B,H,M,D,T,z,E,V=e+e+1,tt=i-1,at=s-1,Q=e+1,Z=Q*(Q+1)/2,J=new PC,Y=dK[e],W=qK[e],ft=null,nt=J,qt=null,R=null;for(let ct=1;ct<V;ct++)if(nt=nt.next=new PC,ct===Q)ft=nt;nt.next=J,f=l=0;for(let ct=0;ct<s;ct++){k=y=B=H=o=c=u=m=0,p=Q*(M=a[l]),w=Q*(D=a[l+1]),d=Q*(T=a[l+2]),v=Q*(z=a[l+3]),o+=Z*M,c+=Z*D,u+=Z*T,m+=Z*z,nt=J;for(let pt=0;pt<Q;pt++)nt.r=M,nt.g=D,nt.b=T,nt.a=z,nt=nt.next;for(let pt=1;pt<Q;pt++)n=l+((tt<pt?tt:pt)<<2),o+=(nt.r=M=a[n])*(E=Q-pt),c+=(nt.g=D=a[n+1])*E,u+=(nt.b=T=a[n+2])*E,m+=(nt.a=z=a[n+3])*E,k+=M,y+=D,B+=T,H+=z,nt=nt.next;qt=J,R=ft;for(let pt=0;pt<i;pt++){if(a[l+3]=z=m*Y>>W,z!==0)z=255/z,a[l]=(o*Y>>W)*z,a[l+1]=(c*Y>>W)*z,a[l+2]=(u*Y>>W)*z;else a[l]=a[l+1]=a[l+2]=0;o-=p,c-=w,u-=d,m-=v,p-=qt.r,w-=qt.g,d-=qt.b,v-=qt.a,n=f+((n=pt+e+1)<tt?n:tt)<<2,k+=qt.r=a[n],y+=qt.g=a[n+1],B+=qt.b=a[n+2],H+=qt.a=a[n+3],o+=k,c+=y,u+=B,m+=H,qt=qt.next,p+=M=R.r,w+=D=R.g,d+=T=R.b,v+=z=R.a,k-=M,y-=D,B-=T,H-=z,R=R.next,l+=4}f+=i}for(let ct=0;ct<i;ct++){y=B=H=k=c=u=m=o=0,l=ct<<2,p=Q*(M=a[l]),w=Q*(D=a[l+1]),d=Q*(T=a[l+2]),v=Q*(z=a[l+3]),o+=Z*M,c+=Z*D,u+=Z*T,m+=Z*z,nt=J;for(let G=0;G<Q;G++)nt.r=M,nt.g=D,nt.b=T,nt.a=z,nt=nt.next;let pt=i;for(let G=1;G<=e;G++)if(l=pt+ct<<2,o+=(nt.r=M=a[l])*(E=Q-G),c+=(nt.g=D=a[l+1])*E,u+=(nt.b=T=a[l+2])*E,m+=(nt.a=z=a[l+3])*E,k+=M,y+=D,B+=T,H+=z,nt=nt.next,G<at)pt+=i;l=ct,qt=J,R=ft;for(let G=0;G<s;G++){if(n=l<<2,a[n+3]=z=m*Y>>W,z>0)z=255/z,a[n]=(o*Y>>W)*z,a[n+1]=(c*Y>>W)*z,a[n+2]=(u*Y>>W)*z;else a[n]=a[n+1]=a[n+2]=0;o-=p,c-=w,u-=d,m-=v,p-=qt.r,w-=qt.g,d-=qt.b,v-=qt.a,n=ct+((n=G+Q)<at?n:at)*i<<2,o+=k+=qt.r=a[n],c+=y+=qt.g=a[n+1],u+=B+=qt.b=a[n+2],m+=H+=qt.a=a[n+3],qt=qt.next,p+=M=R.r,w+=D=R.g,d+=T=R.b,v+=z=R.a,k-=M,y-=D,B-=T,H-=z,R=R.next,l+=i}}}var t_=function(e){let a=Math.round(this.blurRadius());if(a>0)AK(e,a)};X.addGetterSetter(vt,"blurRadius",0,jt(),X.afterSetFilter);var e_=function(t){let e=this.brightness()*255,a=t.data,i=a.length;for(let s=0;s<i;s+=4)a[s]+=e,a[s+1]+=e,a[s+2]+=e};X.addGetterSetter(vt,"brightness",0,jt(),X.afterSetFilter);var a_=function(t){let e=this.brightness(),a=t.data,i=a.length;for(let s=0;s<i;s+=4)a[s]=Math.min(255,a[s]*e),a[s+1]=Math.min(255,a[s+1]*e),a[s+2]=Math.min(255,a[s+2]*e)};var i_=function(t){let e=Math.pow((this.contrast()+100)/100,2),a=t.data,i=a.length,s=150,n=150,l=150;for(let f=0;f<i;f+=4)s=a[f],n=a[f+1],l=a[f+2],s/=255,s-=0.5,s*=e,s+=0.5,s*=255,n/=255,n-=0.5,n*=e,n+=0.5,n*=255,l/=255,l-=0.5,l*=e,l+=0.5,l*=255,s=s<0?0:s>255?255:s,n=n<0?0:n>255?255:n,l=l<0?0:l>255?255:l,a[f]=s,a[f+1]=n,a[f+2]=l};X.addGetterSetter(vt,"contrast",0,jt(),X.afterSetFilter);var s_=function(t){var e,a,i,s,n,l,f,o,c;let{data:u,width:m,height:p}=t,w=Math.min(1,Math.max(0,(a=(e=this.embossStrength)===null||e===void 0?void 0:e.call(this))!==null&&a!==void 0?a:0.5)),d=Math.min(1,Math.max(0,(s=(i=this.embossWhiteLevel)===null||i===void 0?void 0:i.call(this))!==null&&s!==void 0?s:0.5)),k=(f={"top-left":315,top:270,"top-right":225,right:180,"bottom-right":135,bottom:90,"bottom-left":45,left:0}[(l=(n=this.embossDirection)===null||n===void 0?void 0:n.call(this))!==null&&l!==void 0?l:"top-left"])!==null&&f!==void 0?f:315,y=!!((c=(o=this.embossBlend)===null||o===void 0?void 0:o.call(this))!==null&&c!==void 0?c:!1),B=w*10,H=d*255,M=k*Math.PI/180,D=Math.cos(M),T=Math.sin(M),z=0.12549019607843137*B,E=new Uint8ClampedArray(u),V=new Float32Array(m*p);for(let J=0,Y=0;Y<u.length;Y+=4,J++)V[J]=0.2126*E[Y]+0.7152*E[Y+1]+0.0722*E[Y+2];let tt=[-1,0,1,-2,0,2,-1,0,1],at=[-1,-2,-1,0,0,0,1,2,1],Q=[-m-1,-m,-m+1,-1,0,1,m-1,m,m+1],Z=(J)=>J<0?0:J>255?255:J;for(let J=1;J<p-1;J++)for(let Y=1;Y<m-1;Y++){let W=J*m+Y,ft=0,nt=0;ft+=V[W+Q[0]]*tt[0],nt+=V[W+Q[0]]*at[0],ft+=V[W+Q[1]]*tt[1],nt+=V[W+Q[1]]*at[1],ft+=V[W+Q[2]]*tt[2],nt+=V[W+Q[2]]*at[2],ft+=V[W+Q[3]]*tt[3],nt+=V[W+Q[3]]*at[3],ft+=V[W+Q[5]]*tt[5],nt+=V[W+Q[5]]*at[5],ft+=V[W+Q[6]]*tt[6],nt+=V[W+Q[6]]*at[6],ft+=V[W+Q[7]]*tt[7],nt+=V[W+Q[7]]*at[7],ft+=V[W+Q[8]]*tt[8],nt+=V[W+Q[8]]*at[8];let qt=D*ft+T*nt,R=Z(H+qt*z),ct=W*4;if(y){let pt=R-H;u[ct]=Z(E[ct]+pt),u[ct+1]=Z(E[ct+1]+pt),u[ct+2]=Z(E[ct+2]+pt),u[ct+3]=E[ct+3]}else u[ct]=u[ct+1]=u[ct+2]=R,u[ct+3]=E[ct+3]}for(let J=0;J<m;J++){let Y=J*4,W=((p-1)*m+J)*4;u[Y]=E[Y],u[Y+1]=E[Y+1],u[Y+2]=E[Y+2],u[Y+3]=E[Y+3],u[W]=E[W],u[W+1]=E[W+1],u[W+2]=E[W+2],u[W+3]=E[W+3]}for(let J=1;J<p-1;J++){let Y=J*m*4,W=(J*m+(m-1))*4;u[Y]=E[Y],u[Y+1]=E[Y+1],u[Y+2]=E[Y+2],u[Y+3]=E[Y+3],u[W]=E[W],u[W+1]=E[W+1],u[W+2]=E[W+2],u[W+3]=E[W+3]}return t};X.addGetterSetter(vt,"embossStrength",0.5,jt(),X.afterSetFilter);X.addGetterSetter(vt,"embossWhiteLevel",0.5,jt(),X.afterSetFilter);X.addGetterSetter(vt,"embossDirection","top-left",void 0,X.afterSetFilter);X.addGetterSetter(vt,"embossBlend",!1,void 0,X.afterSetFilter);function yb(t,e,a,i,s){let n=a-e,l=s-i;if(n===0)return i+l/2;if(l===0)return i;let f=(t-e)/n;return f=l*f+i,f}var n_=function(t){let e=t.data,a=e.length,i=e[0],s=i,n,l=e[1],f=l,o,c=e[2],u=c,m,p=this.enhance();if(p===0)return;for(let H=0;H<a;H+=4){if(n=e[H+0],n<i)i=n;else if(n>s)s=n;if(o=e[H+1],o<l)l=o;else if(o>f)f=o;if(m=e[H+2],m<c)c=m;else if(m>u)u=m}if(s===i)s=255,i=0;if(f===l)f=255,l=0;if(u===c)u=255,c=0;let w,d,v,k,y,B;if(p>0)w=s+p*(255-s),d=i-p*(i-0),v=f+p*(255-f),k=l-p*(l-0),y=u+p*(255-u),B=c-p*(c-0);else{let H=(s+i)*0.5;w=s+p*(s-H),d=i+p*(i-H);let M=(f+l)*0.5;v=f+p*(f-M),k=l+p*(l-M);let D=(u+c)*0.5;y=u+p*(u-D),B=c+p*(c-D)}for(let H=0;H<a;H+=4)e[H+0]=yb(e[H+0],i,s,d,w),e[H+1]=yb(e[H+1],l,f,k,v),e[H+2]=yb(e[H+2],c,u,B,y)};X.addGetterSetter(vt,"enhance",0,jt(),X.afterSetFilter);var l_=function(t){let e=t.data,a=e.length;for(let i=0;i<a;i+=4){let s=0.34*e[i]+0.5*e[i+1]+0.16*e[i+2];e[i]=s,e[i+1]=s,e[i+2]=s}};X.addGetterSetter(vt,"hue",0,jt(),X.afterSetFilter);X.addGetterSetter(vt,"saturation",0,jt(),X.afterSetFilter);X.addGetterSetter(vt,"luminance",0,jt(),X.afterSetFilter);var f_=function(t){let e=t.data,a=e.length,s=Math.pow(2,this.saturation()),n=Math.abs(this.hue()+360)%360,l=this.luminance()*127,f=1*s*Math.cos(n*Math.PI/180),o=1*s*Math.sin(n*Math.PI/180),c=0.299+0.701*f+0.167*o,u=0.587-0.587*f+0.33*o,m=0.114-0.114*f-0.497*o,p=0.299-0.299*f-0.328*o,w=0.587+0.413*f+0.035*o,d=0.114-0.114*f+0.293*o,v=0.299-0.3*f+1.25*o,k=0.587-0.586*f-1.05*o,y=0.114+0.886*f-0.2*o,B,H,M,D;for(let T=0;T<a;T+=4)B=e[T+0],H=e[T+1],M=e[T+2],D=e[T+3],e[T+0]=c*B+u*H+m*M+l,e[T+1]=p*B+w*H+d*M+l,e[T+2]=v*B+k*H+y*M+l,e[T+3]=D};var r_=function(t){let e=t.data,a=e.length,i=Math.pow(2,this.value()),s=Math.pow(2,this.saturation()),n=Math.abs(this.hue()+360)%360,l=i*s*Math.cos(n*Math.PI/180),f=i*s*Math.sin(n*Math.PI/180),o=0.299*i+0.701*l+0.167*f,c=0.587*i-0.587*l+0.33*f,u=0.114*i-0.114*l-0.497*f,m=0.299*i-0.299*l-0.328*f,p=0.587*i+0.413*l+0.035*f,w=0.114*i-0.114*l+0.293*f,d=0.299*i-0.3*l+1.25*f,v=0.587*i-0.586*l-1.05*f,k=0.114*i+0.886*l-0.2*f;for(let y=0;y<a;y+=4){let B=e[y+0],H=e[y+1],M=e[y+2],D=e[y+3];e[y+0]=o*B+c*H+u*M,e[y+1]=m*B+p*H+w*M,e[y+2]=d*B+v*H+k*M,e[y+3]=D}};X.addGetterSetter(vt,"hue",0,jt(),X.afterSetFilter);X.addGetterSetter(vt,"saturation",0,jt(),X.afterSetFilter);X.addGetterSetter(vt,"value",0,jt(),X.afterSetFilter);var o_=function(t){let e=t.data,a=e.length;for(let i=0;i<a;i+=4)e[i]=255-e[i],e[i+1]=255-e[i+1],e[i+2]=255-e[i+2]};var vK=function(t,e,a){let i=t.data,s=e.data,n=t.width,l=t.height,f=a.polarCenterX||n/2,o=a.polarCenterY||l/2,c=Math.sqrt(f*f+o*o),u=n-f,m=l-o,p=Math.sqrt(u*u+m*m);c=p>c?p:c;let w=l,d=n,v=360/d*Math.PI/180;for(let k=0;k<d;k+=1){let y=Math.sin(k*v),B=Math.cos(k*v);for(let H=0;H<w;H+=1){u=Math.floor(f+c*H/w*B),m=Math.floor(o+c*H/w*y);let M=(m*n+u)*4,D=i[M+0],T=i[M+1],z=i[M+2],E=i[M+3];M=(k+H*n)*4,s[M+0]=D,s[M+1]=T,s[M+2]=z,s[M+3]=E}}},SK=function(t,e,a){let i=t.data,s=e.data,n=t.width,l=t.height,f=a.polarCenterX||n/2,o=a.polarCenterY||l/2,c=Math.sqrt(f*f+o*o),u=n-f,m=l-o,p=Math.sqrt(u*u+m*m);c=p>c?p:c;let w=l,d=n,v=a.polarRotation||0,k,y;for(u=0;u<n;u+=1)for(m=0;m<l;m+=1){let B=u-f,H=m-o,M=Math.sqrt(B*B+H*H)*w/c,D=(Math.atan2(H,B)*180/Math.PI+360+v)%360;D=D*d/360,k=Math.floor(D),y=Math.floor(M);let T=(y*n+k)*4,z=i[T+0],E=i[T+1],V=i[T+2],tt=i[T+3];T=(m*n+u)*4,s[T+0]=z,s[T+1]=E,s[T+2]=V,s[T+3]=tt}},h_=function(t){let{width:e,height:a}=t,i,s,n,l,f,o,c,u,m,p,w=Math.round(this.kaleidoscopePower()),d=Math.round(this.kaleidoscopeAngle()),v=Math.floor(e*(d%360)/360);if(w<1)return;let k=et.createCanvasElement();k.width=e,k.height=a;let y=k.getContext("2d").getImageData(0,0,e,a);et.releaseCanvas(k),vK(t,y,{polarCenterX:e/2,polarCenterY:a/2});let B=e/Math.pow(2,w);while(B<=8)B=B*2,w-=1;B=Math.ceil(B);let H=B,M=0,D=H,T=1;if(v+B>e)M=H,D=0,T=-1;for(s=0;s<a;s+=1)for(i=M;i!==D;i+=T)n=Math.round(i+v)%e,m=(e*s+n)*4,f=y.data[m+0],o=y.data[m+1],c=y.data[m+2],u=y.data[m+3],p=(e*s+i)*4,y.data[p+0]=f,y.data[p+1]=o,y.data[p+2]=c,y.data[p+3]=u;for(s=0;s<a;s+=1){H=Math.floor(B);for(l=0;l<w;l+=1){for(i=0;i<H+1;i+=1)m=(e*s+i)*4,f=y.data[m+0],o=y.data[m+1],c=y.data[m+2],u=y.data[m+3],p=(e*s+H*2-i-1)*4,y.data[p+0]=f,y.data[p+1]=o,y.data[p+2]=c,y.data[p+3]=u;H*=2}}SK(y,t,{polarRotation:0})};X.addGetterSetter(vt,"kaleidoscopePower",2,jt(),X.afterSetFilter);X.addGetterSetter(vt,"kaleidoscopeAngle",0,jt(),X.afterSetFilter);function k3(t,e,a){let i=(a*t.width+e)*4,s=[];return s.push(t.data[i++],t.data[i++],t.data[i++],t.data[i++]),s}function e9(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2))}function yK(t){let e=[0,0,0];for(let a=0;a<t.length;a++)e[0]+=t[a][0],e[1]+=t[a][1],e[2]+=t[a][2];return e[0]/=t.length,e[1]/=t.length,e[2]/=t.length,e}function kK(t,e){let a=k3(t,0,0),i=k3(t,t.width-1,0),s=k3(t,0,t.height-1),n=k3(t,t.width-1,t.height-1),l=e||10;if(e9(a,i)<l&&e9(i,n)<l&&e9(n,s)<l&&e9(s,a)<l){let f=yK([i,a,n,s]),o=[];for(let c=0;c<t.width*t.height;c++){let u=e9(f,[t.data[c*4],t.data[c*4+1],t.data[c*4+2]]);o[c]=u<l?0:255}return o}}function CK(t,e){for(let a=0;a<t.width*t.height;a++)t.data[4*a+3]=e[a]}function _K(t,e,a){let i=[1,1,1,1,0,1,1,1,1],s=Math.round(Math.sqrt(i.length)),n=Math.floor(s/2),l=[];for(let f=0;f<a;f++)for(let o=0;o<e;o++){let c=f*e+o,u=0;for(let m=0;m<s;m++)for(let p=0;p<s;p++){let w=f+m-n,d=o+p-n;if(w>=0&&w<a&&d>=0&&d<e){let v=w*e+d,k=i[m*s+p];u+=t[v]*k}}l[c]=u===2040?255:0}return l}function FK(t,e,a){let i=[1,1,1,1,1,1,1,1,1],s=Math.round(Math.sqrt(i.length)),n=Math.floor(s/2),l=[];for(let f=0;f<a;f++)for(let o=0;o<e;o++){let c=f*e+o,u=0;for(let m=0;m<s;m++)for(let p=0;p<s;p++){let w=f+m-n,d=o+p-n;if(w>=0&&w<a&&d>=0&&d<e){let v=w*e+d,k=i[m*s+p];u+=t[v]*k}}l[c]=u>=1020?255:0}return l}function BK(t,e,a){let i=[0.1111111111111111,0.1111111111111111,0.1111111111111111,0.1111111111111111,0.1111111111111111,0.1111111111111111,0.1111111111111111,0.1111111111111111,0.1111111111111111],s=Math.round(Math.sqrt(i.length)),n=Math.floor(s/2),l=[];for(let f=0;f<a;f++)for(let o=0;o<e;o++){let c=f*e+o,u=0;for(let m=0;m<s;m++)for(let p=0;p<s;p++){let w=f+m-n,d=o+p-n;if(w>=0&&w<a&&d>=0&&d<e){let v=w*e+d,k=i[m*s+p];u+=t[v]*k}}l[c]=u}return l}var c_=function(t){let e=this.threshold(),a=kK(t,e);if(a)a=_K(a,t.width,t.height),a=FK(a,t.width,t.height),a=BK(a,t.width,t.height),CK(t,a);return t};X.addGetterSetter(vt,"threshold",0,jt(),X.afterSetFilter);var u_=function(t){let e=this.noise()*255,a=t.data,i=a.length,s=e/2;for(let n=0;n<i;n+=4)a[n+0]+=s-2*s*Math.random(),a[n+1]+=s-2*s*Math.random(),a[n+2]+=s-2*s*Math.random()};X.addGetterSetter(vt,"noise",0.2,jt(),X.afterSetFilter);var m_=function(t){let e=Math.ceil(this.pixelSize()),a=t.width,i=t.height,s=Math.ceil(a/e),n=Math.ceil(i/e),l=t.data;if(e<=0){et.error("pixelSize value can not be <= 0");return}for(let f=0;f<s;f+=1)for(let o=0;o<n;o+=1){let c=0,u=0,m=0,p=0,w=f*e,d=w+e,v=o*e,k=v+e,y=0;for(let B=w;B<d;B+=1){if(B>=a)continue;for(let H=v;H<k;H+=1){if(H>=i)continue;let M=(a*H+B)*4;c+=l[M+0],u+=l[M+1],m+=l[M+2],p+=l[M+3],y+=1}}c=c/y,u=u/y,m=m/y,p=p/y;for(let B=w;B<d;B+=1){if(B>=a)continue;for(let H=v;H<k;H+=1){if(H>=i)continue;let M=(a*H+B)*4;l[M+0]=c,l[M+1]=u,l[M+2]=m,l[M+3]=p}}}};X.addGetterSetter(vt,"pixelSize",8,jt(),X.afterSetFilter);var g_=function(t){let e=Math.round(this.levels()*254)+1,a=t.data,i=a.length,s=255/e;for(let n=0;n<i;n+=1)a[n]=Math.floor(a[n]/s)*s};X.addGetterSetter(vt,"levels",0.5,jt(),X.afterSetFilter);var b_=function(t){let e=t.data,a=e.length,i=this.red(),s=this.green(),n=this.blue();for(let l=0;l<a;l+=4){let f=(0.34*e[l]+0.5*e[l+1]+0.16*e[l+2])/255;e[l]=f*i,e[l+1]=f*s,e[l+2]=f*n,e[l+3]=e[l+3]}};X.addGetterSetter(vt,"red",0,function(t){if(this._filterUpToDate=!1,t>255)return 255;else if(t<0)return 0;else return Math.round(t)});X.addGetterSetter(vt,"green",0,function(t){if(this._filterUpToDate=!1,t>255)return 255;else if(t<0)return 0;else return Math.round(t)});X.addGetterSetter(vt,"blue",0,c3,X.afterSetFilter);var p_=function(t){let e=t.data,a=e.length,i=this.red(),s=this.green(),n=this.blue(),l=this.alpha();for(let f=0;f<a;f+=4){let o=1-l;e[f]=i*l+e[f]*o,e[f+1]=s*l+e[f+1]*o,e[f+2]=n*l+e[f+2]*o}};X.addGetterSetter(vt,"red",0,function(t){if(this._filterUpToDate=!1,t>255)return 255;else if(t<0)return 0;else return Math.round(t)});X.addGetterSetter(vt,"green",0,function(t){if(this._filterUpToDate=!1,t>255)return 255;else if(t<0)return 0;else return Math.round(t)});X.addGetterSetter(vt,"blue",0,c3,X.afterSetFilter);X.addGetterSetter(vt,"alpha",1,function(t){if(this._filterUpToDate=!1,t>1)return 1;else if(t<0)return 0;else return t});var w_=function(t){let e=t.data,a=e.length;for(let i=0;i<a;i+=4){let s=e[i+0],n=e[i+1],l=e[i+2];e[i+0]=Math.min(255,s*0.393+n*0.769+l*0.189),e[i+1]=Math.min(255,s*0.349+n*0.686+l*0.168),e[i+2]=Math.min(255,s*0.272+n*0.534+l*0.131)}};var j_=function(t){let a=t.data;for(let i=0;i<a.length;i+=4){let s=a[i],n=a[i+1],l=a[i+2];if(0.2126*s+0.7152*n+0.0722*l>=128)a[i]=255-s,a[i+1]=255-n,a[i+2]=255-l}return t};var d_=function(t){let e=this.threshold()*255,a=t.data,i=a.length;for(let s=0;s<i;s+=1)a[s]=a[s]<e?0:255};X.addGetterSetter(vt,"threshold",0.5,jt(),X.afterSetFilter);var q_=jh.Util._assign(jh,{Arc:$n,Arrow:j1,Circle:Ol,Ellipse:C0,Image:zs,Label:W2,Tag:d1,Line:Bn,Path:ra,Rect:Hl,RegularPolygon:_0,Ring:q1,Sprite:On,Star:F0,Text:oa,TextPath:Ya,Transformer:Te,Wedge:Wn,Filters:{Blur:t_,Brightness:a_,Brighten:e_,Contrast:i_,Emboss:s_,Enhance:n_,Grayscale:l_,HSL:f_,HSV:r_,Invert:o_,Kaleidoscope:h_,Mask:c_,Noise:u_,Pixelate:m_,Posterize:g_,RGB:b_,RGBA:p_,Sepia:w_,Solarize:j_,Threshold:d_}});var A_=q_;var Hn=Ie(Pa(),1);var pi=Ie(Pa(),1);var qh=jh;var U_=Ie(F_(),1);var Fb=1;var F3=32,Bb=2;var Ob={};o4(Ob,{warnsIfNotActing:()=>sL,waitForCommitToBeReady:()=>UL,unhideTextInstance:()=>dL,unhideInstance:()=>jL,trackSchedulerEvent:()=>ML,suspendInstance:()=>xL,supportsPersistence:()=>lL,supportsMutation:()=>nL,supportsMicrotasks:()=>PK,supportsHydration:()=>fL,startSuspendingCommit:()=>EL,shouldSetTextContent:()=>aL,shouldDeprioritizeSubtree:()=>JK,shouldAttemptEagerTransition:()=>HL,setCurrentUpdatePriority:()=>FL,scheduleTimeout:()=>$K,scheduleMicrotask:()=>tL,run:()=>M_,resolveUpdatePriority:()=>OL,resolveEventType:()=>DL,resolveEventTimeStamp:()=>TL,resetTextContent:()=>YK,resetFormInstance:()=>XL,resetAfterCommit:()=>VK,requestPostPaintCallback:()=>RL,removeChildFromContainer:()=>uL,removeChild:()=>cL,prepareUpdate:()=>LK,prepareScopeUpdate:()=>CL,preparePortalMount:()=>KK,prepareForCommit:()=>XK,preloadInstance:()=>zL,now:()=>C3,noTimeout:()=>eL,maySuspendCommit:()=>NL,isPrimaryRenderer:()=>iL,insertInContainerBefore:()=>hL,insertBefore:()=>N_,idlePriority:()=>_3,hideTextInstance:()=>wL,hideInstance:()=>pL,getRootHostContext:()=>QK,getPublicInstance:()=>GK,getInstanceFromScope:()=>_L,getInstanceFromNode:()=>vL,getCurrentUpdatePriority:()=>BL,getCurrentEventPriority:()=>kL,getChildHostContext:()=>ZK,finalizeInitialChildren:()=>IK,detachDeletedInstance:()=>AL,createTextInstance:()=>UK,createInstance:()=>xK,commitUpdate:()=>bL,commitTextUpdate:()=>mL,commitMount:()=>gL,clearContainer:()=>qL,cancelTimeout:()=>WK,beforeActiveInstanceBlur:()=>SL,appendInitialChild:()=>EK,appendChildToContainer:()=>oL,appendChild:()=>rL,afterActiveInstanceBlur:()=>yL,NotPendingTransition:()=>IL,HostTransitionContext:()=>GL});var D_=Ie(Pa(),1);var B_={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0},O_=!1,H_=!1,i9=".react-konva-event",DK=!1;var TK=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled.
259
- Position of a node will be changed during drag&drop, so you should update state of the react app as well.
260
- Consider to add onDragMove or onDragEnd events.
261
- For more info see: https://github.com/konvajs/react-konva/issues/256
262
- `,RK=`ReactKonva: You are using "zIndex" attribute for a Konva node.
263
- react-konva may get confused with ordering. Just define correct order of elements in your render function of a component.
264
- For more info see: https://github.com/konvajs/react-konva/issues/194
265
- `,NK={};function Ah(t,e,a=NK){if(!O_&&"zIndex"in e)console.warn(RK),O_=!0;if(!H_&&e.draggable){var i=e.x!==void 0||e.y!==void 0,s=e.onDragEnd||e.onDragMove;if(i&&!s)console.warn(TK),H_=!0}for(var n in a){if(B_[n])continue;var l=n.slice(0,2)==="on",f=a[n]!==e[n];if(l&&f){var o=n.substr(2).toLowerCase();if(o.substr(0,7)==="content")o="content"+o.substr(7,1).toUpperCase()+o.substr(8);t.off(o,a[n])}var c=!e.hasOwnProperty(n);if(c)t.setAttr(n,void 0)}var u=DK||e._useStrictMode,m={},p=!1;let w={};for(var n in e){if(B_[n])continue;var l=n.slice(0,2)==="on",d=a[n]!==e[n];if(l&&d){var o=n.substr(2).toLowerCase();if(o.substr(0,7)==="content")o="content"+o.substr(7,1).toUpperCase()+o.substr(8);if(e[n])w[o]=e[n]}if(!l&&(e[n]!==a[n]||u&&e[n]!==t.getAttr(n)))p=!0,m[n]=e[n]}if(p)t.setAttrs(m),v1(t);for(var o in w)t.off(o+i9),t.on(o+i9,w[o])}function v1(t){if(!St.autoDrawEnabled){var e=t.getLayer()||t.getStage();e&&e.batchDraw()}}__();var T_={},zK={};qh.Node.prototype._applyProps=Ah;var R_=F3;function EK(t,e){if(typeof e==="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${e}`);return}t.add(e),v1(t)}function xK(t,e,a){let i=qh[t];if(!i)console.error(`Konva has no node with the type ${t}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${t}" 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`),i=qh.Group;let s={},n={};for(var l in e){if(l==="ref")continue;var f=l.slice(0,2)==="on";if(f)n[l]=e[l];else s[l]=e[l]}let o=new i(s);return Ah(o,n),o}function UK(t,e,a){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${t}"`)}function IK(t,e,a){return!1}function GK(t){return t}function XK(){return null}function KK(){return null}function LK(t,e,a,i){return zK}function VK(){}function YK(t){}function JK(t,e){return!1}function QK(){return T_}function ZK(){return T_}var $K=setTimeout,WK=clearTimeout,PK=!0,tL=typeof queueMicrotask==="function"?queueMicrotask:(t)=>Promise.resolve(null).then(t),eL=-1;function aL(t,e){return!1}var iL=!1,sL=!1,nL=!0,lL=!1,fL=!1;function rL(t,e){if(e.parent===t)e.moveToTop();else t.add(e);v1(t)}function oL(t,e){if(e.parent===t)e.moveToTop();else t.add(e);v1(t)}function N_(t,e,a){e._remove(),t.add(e),e.setZIndex(a.getZIndex()),v1(t)}function hL(t,e,a){N_(t,e,a)}function cL(t,e){e.destroy(),e.off(i9),v1(t)}function uL(t,e){e.destroy(),e.off(i9),v1(t)}function mL(t,e,a){console.error(`Text components are not yet supported in ReactKonva. You text is: "${a}"`)}function gL(t,e,a){}function bL(t,e,a,i){Ah(t,i,a)}function pL(t){t.hide(),v1(t)}function wL(t){}function jL(t,e){if(e.visible==null||e.visible)t.show()}function dL(t,e){}function qL(t){}function AL(){}function vL(){return null}function SL(){}function yL(){}function kL(){return F3}function CL(){}function _L(){return null}function FL(t){R_=t}function BL(){return R_}function OL(){return Bb}function HL(){return!1}function ML(){}function DL(){return null}function TL(){return-1.1}function RL(){}function NL(){return!1}function zL(){return!0}function EL(){}function xL(){}function UL(){return null}var IL=null,GL=D_.default.createContext(null);function XL(){}var Ua=Ie(Pa(),1);function z_(t,e,a){if(!t)return;if(a(t)===!0)return t;let i=e?t.return:t.child;for(;i;){let s=z_(i,e,a);if(s)return s;i=e?null:i.sibling}}function E_(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch(e){return t}}var Hb=E_(Ua.createContext(null));class B3 extends Ua.Component{render(){return Ua.createElement(Hb.Provider,{value:this._reactInternals},this.props.children)}}function KL(){let t=Ua.useContext(Hb);if(t===null)throw Error("its-fine: useFiber must be called within a <FiberProvider />!");let e=Ua.useId();return Ua.useMemo(()=>{for(let a of[t,t==null?void 0:t.alternate]){if(!a)continue;let i=z_(a,!1,(s)=>{let n=s.memoizedState;for(;n;){if(n.memoizedState===e)return!0;n=n.next}});if(i)return i}},[t,e])}var LL=Symbol.for("react.context"),VL=(t)=>t!==null&&typeof t=="object"&&("$$typeof"in t)&&t.$$typeof===LL;function YL(){let t=KL(),[e]=Ua.useState(()=>new Map);e.clear();let a=t;for(;a;){let i=a.type;VL(i)&&i!==Hb&&!e.has(i)&&e.set(i,Ua.use(E_(i))),a=a.return}return e}function x_(){let t=YL();return Ua.useMemo(()=>Array.from(t.keys()).reduce((e,a)=>(i)=>Ua.createElement(e,null,Ua.createElement(a.Provider,{...i,value:t.get(a)})),(e)=>Ua.createElement(B3,{...e})),[t])}if(pi.default.version.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 JL(t){let e=pi.default.useRef({});return pi.default.useLayoutEffect(()=>{e.current=t}),pi.default.useLayoutEffect(()=>{return()=>{e.current={}}},[]),e.current}var QL=()=>{let t=pi.default.useRef(0);return pi.default.useMemo(()=>{t.current++},[]),t.current>1},ZL=(t)=>{let e=pi.default.useRef(null),a=pi.default.useRef(null),i=pi.default.useRef(null),s=JL(t),n=x_(),l=pi.default.useRef(null),f=(u)=>{let{forwardedRef:m}=t;if(!m)return;if(typeof m==="function")m(u);else m.current=u},o=QL(),c=()=>{f(null),vh.flushSyncFromReconciler(()=>{vh.updateContainer(null,i.current,null)}),a.current?.destroy(),a.current=null};return pi.default.useLayoutEffect(()=>{if(l.current)clearTimeout(l.current),l.current=null;if(a.current)f(a.current);else a.current=new qh.Stage({width:t.width,height:t.height,container:e.current}),f(a.current),i.current=vh.createContainer(a.current,Fb,null,!1,null,"",console.error,console.error,console.error,null),vh.updateContainer(pi.default.createElement(n,{},t.children),i.current,null,()=>{});return()=>{if(o)l.current=setTimeout(c,0);else c()}},[]),pi.default.useLayoutEffect(()=>{f(a.current),Ah(a.current,t,s),vh.updateContainer(pi.default.createElement(n,{},t.children),i.current,null),vh.flushSyncWork()}),pi.default.createElement("div",{ref:e,id:t.id,accessKey:t.accessKey,className:t.className,role:t.role,style:t.style,tabIndex:t.tabIndex,title:t.title})},I_="Layer";var G_="Group";var Mb="Rect";var Db="Line";var X_="Image";var Tb="Arrow";var vh=U_.default(Ob),K_=pi.default.forwardRef((t,e)=>{return pi.default.createElement(B3,{},pi.default.createElement(ZL,{...t,forwardedRef:e}))});var Y_=Ie(V_(),1);var $L=({width:t,height:e,mediaDimensions:a,imageUrl:i,videoElement:s,annotations:n,scale:l,offset:f,onPan:o,onClick:c,className:u,isDrawing:m=!1,currentTool:p="arrow",currentColor:w="#ef4444",onAddAnnotation:d})=>{let[v]=Y_.default(i||"","anonymous"),k=Hn.useRef(null),y=Hn.useRef(!1),B=Hn.useRef({x:0,y:0}),H=Hn.useRef(null),M=Hn.useRef(null),D=Hn.useRef(null),T=Hn.useRef(null);Hn.useEffect(()=>{if(s&&k.current){let Q=k.current.getLayer();if(!Q)return;let Z=new A_.Animation(()=>{},Q);return Z.start(),()=>{Z.stop()}}},[s]);let z=(Q,Z=!1,J)=>{let Y=Q.getAbsoluteTransform().copy();Y.invert();let W=J||Q.getStage()?.getPointerPosition();if(W){let ft=Y.point(W);if(Z)return{x:Math.max(0,Math.min(a.width,ft.x)),y:Math.max(0,Math.min(a.height,ft.y))};return ft}return null},E=Hn.useRef({isDrawing:m,currentTool:p,currentColor:w,onPan:o,offset:f,scale:l,mediaDimensions:a,onAddAnnotation:d});E.current={isDrawing:m,currentTool:p,currentColor:w,onPan:o,offset:f,scale:l,mediaDimensions:a,onAddAnnotation:d};let V=()=>{if(!y.current)return;y.current=!1;let{isDrawing:Q,onAddAnnotation:Z,mediaDimensions:J,currentTool:Y,currentColor:W}=E.current;if(Q&&Z){let{width:ft,height:nt}=J,qt=(R,ct)=>R/ct;if(Y==="freehand"&&M.current){M.current.visible(!1);let R=M.current.points(),ct=[];for(let pt=0;pt<R.length;pt+=2)ct.push([qt(R[pt],ft),qt(R[pt+1],nt)]);if(ct.length>1)Z({type:"freehand",color:W,points:ct})}else if(Y==="line"&&M.current){M.current.visible(!1);let R=M.current.points(),ct={type:"line",color:W,points:[[qt(R[0],ft),qt(R[1],nt)],[qt(R[2],ft),qt(R[3],nt)]]};Z(ct)}else if(Y==="box"&&D.current){D.current.visible(!1);let R=D.current.x(),ct=D.current.y(),pt=D.current.width(),G=D.current.height(),Ct=[qt(R,ft),qt(ct,nt)],Kt=[qt(R+pt,ft),qt(ct+G,nt)];Z({type:"box",color:W,points:[Ct,Kt]})}else if(Y==="arrow"&&T.current){T.current.visible(!1);let R=T.current.points(),ct={type:"arrow",color:W,points:[[qt(R[0],ft),qt(R[1],nt)],[qt(R[2],ft),qt(R[3],nt)]]};Z(ct)}}};Hn.useEffect(()=>{let Q=(J)=>{if(!y.current)return;let Y=k.current?.getStage();if(!Y)return;let ft=Y.container().getBoundingClientRect(),nt,qt;if("clientX"in J)nt=J.clientX,qt=J.clientY;else nt=J.touches[0].clientX,qt=J.touches[0].clientY;let R={x:nt-ft.left,y:qt-ft.top},{isDrawing:ct,currentTool:pt,onPan:G,offset:Ct}=E.current;if(ct){if(pt==="select")return;let Kt=z(k.current,!0,R);if(!Kt||!H.current)return;let le=H.current,Ft=k.current?.getLayer();if(pt==="freehand"&&M.current){let Et=M.current.points().concat([Kt.x,Kt.y]);M.current.points(Et)}else if(pt==="line"&&M.current)M.current.points([le.x,le.y,Kt.x,Kt.y]);else if(pt==="box"&&D.current)D.current.width(Kt.x-le.x),D.current.height(Kt.y-le.y);else if(pt==="arrow"&&T.current)T.current.points([le.x,le.y,Kt.x,Kt.y]);Ft?.batchDraw()}else{if(!G)return;let Kt=R.x-B.current.x,le=R.y-B.current.y;B.current=R,G({x:Ct.x+Kt,y:Ct.y+le})}},Z=()=>{V()};return window.addEventListener("mousemove",Q),window.addEventListener("mouseup",Z),window.addEventListener("touchmove",Q),window.addEventListener("touchend",Z),()=>{window.removeEventListener("mousemove",Q),window.removeEventListener("mouseup",Z),window.removeEventListener("touchmove",Q),window.removeEventListener("touchend",Z)}},[]);let tt=(Q)=>{if(m){if(p==="select")return;if(!Q.target.getStage())return;let J=z(k.current);if(!J)return;if(J.x<0||J.x>a.width||J.y<0||J.y>a.height)return;y.current=!0,H.current=J;let Y=k.current?.getLayer();if(!Y)return;if(p==="freehand"&&M.current)M.current.points([J.x,J.y]),M.current.stroke(w),M.current.visible(!0);else if(p==="line"&&M.current)M.current.points([J.x,J.y,J.x,J.y]),M.current.stroke(w),M.current.visible(!0);else if(p==="box"&&D.current)D.current.position(J),D.current.width(0),D.current.height(0),D.current.stroke(w),D.current.visible(!0);else if(p==="arrow"&&T.current)T.current.points([J.x,J.y,J.x,J.y]),T.current.stroke(w),T.current.fill(w),T.current.visible(!0);Y.batchDraw()}else{if(!o)return;y.current=!0;let Z=Q.target.getStage();if(Z){let J=Z.getPointerPosition();if(J)B.current=J}}},at=(Q,Z)=>{let{width:J,height:Y}=a;switch(Q.type){case"box":{let[W,ft]=Q.points,nt=Math.min(W[0],ft[0])*J,qt=Math.min(W[1],ft[1])*Y,R=Math.abs(ft[0]-W[0])*J,ct=Math.abs(ft[1]-W[1])*Y;return x(Mb,{x:nt,y:qt,width:R,height:ct,stroke:Q.color,strokeWidth:2.6/l,listening:!1},Z)}case"arrow":{let W=Q.points.flat().map((ft,nt)=>nt%2===0?ft*J:ft*Y);return x(Tb,{points:W,stroke:Q.color,strokeWidth:2.6/l,fill:Q.color,pointerLength:10/l,pointerWidth:10/l,listening:!1},Z)}case"line":case"freehand":{let W=Q.points.flat().map((ft,nt)=>nt%2===0?ft*J:ft*Y);return x(Db,{points:W,stroke:Q.color,strokeWidth:2.6/l,tension:0.5,lineCap:"round",lineJoin:"round",listening:!1},Z)}default:return null}};return x("div",{className:u,style:{width:t,height:e,overflow:"hidden",pointerEvents:!m&&!o?"none":"auto",cursor:m&&p!=="select"?"crosshair":o?y.current?"grabbing":"grab":"default"},children:x(K_,{width:t,height:e,scaleX:l,scaleY:l,x:f.x,y:f.y,onMouseDown:tt,onClick:!m?c:void 0,onTap:!m?c:void 0,onTouchStart:tt,children:rt(I_,{children:[x(X_,{ref:k,image:s||v,width:a.width,height:a.height}),n.map(at),rt(G_,{listening:!1,children:[x(Db,{ref:M,strokeWidth:2.6/l,lineCap:"round",lineJoin:"round",visible:!1}),x(Mb,{ref:D,strokeWidth:2.6/l,visible:!1}),x(Tb,{ref:T,points:[],strokeWidth:2.6/l,pointerLength:10/l,pointerWidth:10/l,visible:!1})]})]})})})},O0=$L;var WL=He.default.forwardRef(({file:t,onPlay:e,onPause:a,onTimeUpdate:i,annotations:s,startTime:n,shareId:l,children:f},o)=>{let c=He.useRef(null),u=c,m=!!t.media?.original?.downloadUrl&&!!t.media?.metadata,p=He.useRef(null),w=He.useRef(null),d=He.useRef(null),v=He.useRef(null);He.useImperativeHandle(o,()=>({play:()=>{if(c.current)c.current.play()},pause:()=>{if(c.current)c.current.pause()},seekTo:(_t)=>{if(c.current)c.current.currentTime(_t)},getCurrentTime:()=>{return(c.current?c.current.currentTime():0)??0},getDuration:()=>{return(c.current?c.current.duration():0)??0}}));let k=He.useRef(!1),[y,B]=He.useState(void 0),H=He.useRef(null),[M,D]=He.useState(1),[T,z]=He.useState(!1),[E,V]=He.useState({width:0,height:0}),tt=(_t)=>{D(_t),z(!0)},at=()=>{z(!1)},{isDrawing:Q,currentTool:Z,currentColor:J,addAnnotation:Y,annotations:W}=_s(),ft=[...s||[],...W];He.useEffect(()=>{if(!w.current)return;let _t=new ResizeObserver((Ht)=>{let Wt=Ht[0];if(Wt)V({width:Wt.contentRect.width,height:Wt.contentRect.height})});return _t.observe(w.current),()=>_t.disconnect()},[]),He.useEffect(()=>{if(E.width>0&&E.height>0){let _t=t.media?.metadata?.originalWidth||1920,Ht=t.media?.metadata?.originalHeight||1080,Wt=Math.min(E.width/_t,E.height/Ht);if(!T)D(Wt)}},[E.width,E.height,t.media?.metadata,T]),He.useEffect(()=>{return()=>{H.current=null}},[]);let nt={id:"original",url:t.media?.original?.downloadUrl||"",key:t.media?.original?.key??"",width:t.media?.metadata?.originalWidth??0,height:t.media?.metadata?.originalHeight??0,size:0,isRaw:!0,resolution:"Original"},qt=(t.media?.videoTranscodes??[]).map((_t)=>{let Ht=Math.max(_t.width,_t.height),Wt=`${_t.height}p`;if(Ht>=3840)Wt="2160p";else if(Ht>=1920)Wt="1080p";else if(Ht>=1280)Wt="720p";else if(Ht>=960)Wt="540p";else if(Ht>=640)Wt="360p";else if(Ht>=320)Wt="180p";return{..._t,resolution:_t.isRaw?"Original":Wt}}),R=qt.filter((_t)=>!_t.isRaw),pt=(()=>{if(R.length===0)return nt;if(typeof window>"u")return R[0];let _t=window.innerWidth*(window.devicePixelRatio||1),Ht=[...R].sort((Oe,Ma)=>{let En=Oe.width??0,ur=Ma.width??0;return En-ur});return Ht.find((Oe)=>(Oe.width??0)>=_t)||Ht[Ht.length-1]})(),[G,Ct]=He.useState({isPlaying:!1,progress:0,currentTime:0,duration:t.media?.metadata?.duration||0,volume:1,isMuted:!1,isLooping:!1,playbackRate:1,isFullScreen:!1,showFrames:!1,currentResolution:pt?.resolution||"Original",currentSrc:pt?.url||""}),[Kt,le]=He.useState(0),[Ft,Et]=He.useState(!0),[$t,Dt]=He.useState(!1),Mt=He.useRef(null),Xt=t.media?.metadata,Gt=Xt?.frameRate||30,ae=Xt?.totalFrames||0,Xe=Xt?.duration||0,Re=t.proxyType==="audio",da=H3({dbTotalFrames:ae,containerDuration:Xe,frameRate:Gt}),{currentFrame:Ve,seekToFrame:va}=s3(H,Gt,da,Re),ce=Ve/Gt,ii=da/Gt,Ee=ii>0?ce/ii*100:0,Ri={...G,currentTime:ce,duration:ii,progress:Ee};He.useEffect(()=>{if(i)i(Ve/Gt)},[Ve,Gt,i]),He.useEffect(()=>{if(!p.current)return;let _t=document.createElement("video-js");_t.classList.add("vjs-big-play-centered","!h-full","!w-full"),_t.style.opacity="0",_t.style.pointerEvents="none",p.current.appendChild(_t);let Ht=u.current=lt(_t,{controls:!1,autoplay:!1,preload:"auto",playsinline:!0,sources:[{src:G.currentSrc,type:"video/mp4"}]}),Wt=_t.querySelector("video");if(Wt)B(Wt),H.current=Wt;else Ht.ready(()=>{let Oe=Ht.tech({iWillNotUseThisInPlugins:!0})?.el();if(Oe)B(Oe),H.current=Oe});return Ht.on("play",()=>{Ct((Oe)=>({...Oe,isPlaying:!0})),e?.()}),Ht.on("pause",()=>{Ct((Oe)=>({...Oe,isPlaying:!1})),a?.()}),Ht.on("ended",()=>Ct((Oe)=>({...Oe,isPlaying:!1}))),Ht.on("loadedmetadata",()=>{Dt(!0)}),Ht.on("loadstart",()=>{Dt(!1)}),Ht.on("timeupdate",()=>{let Oe=Ht.duration()||t.media?.metadata?.duration||0,Ma=Ht.bufferedEnd();if(Oe>0)le(Ma/Oe*100)}),Ht.on("volumechange",()=>{let Oe=Ht.volume(),Ma=Ht.muted();Ct((En)=>({...En,volume:Oe||0,isMuted:Ma||!1}))}),Ht.on("ratechange",()=>{Ct((Oe)=>({...Oe,playbackRate:Ht.playbackRate()||1}))}),Ht.on("error",()=>{console.error("VideoJS Error:",Ht.error())}),Ht.volume(G.volume),()=>{if(Ht&&!Ht.isDisposed())Ht.dispose(),u.current=null,H.current=null}},[t]),He.useEffect(()=>{if(!$t)return;if(n!==void 0&&n!==null&&n>0){if(n!==Mt.current){Mt.current=n;let _t=Math.floor(n*Gt+0.45);va(_t)}}},[n,Gt,va,$t]);let mi=He.useCallback(()=>{if(v.current)clearTimeout(v.current);if(G.isFullScreen&&!k.current)v.current=setTimeout(()=>{Et(!1)},1200)},[G.isFullScreen]),ji=He.useCallback(()=>{Et(!0),mi()},[mi]),mt=He.useCallback(()=>{if(k.current=!0,v.current)clearTimeout(v.current);Et(!0)},[]),kt=He.useCallback(()=>{k.current=!1,mi()},[mi]),Zt=He.useCallback(()=>{if(G.isFullScreen){if(v.current)clearTimeout(v.current);Et(!1)}},[G.isFullScreen]);He.useEffect(()=>{return()=>{if(v.current)clearTimeout(v.current)}},[]),He.useEffect(()=>{if(!G.isFullScreen){if(Et(!0),v.current)clearTimeout(v.current)}else ji()},[G.isPlaying,G.isFullScreen,ji]);let ne=He.useCallback(()=>{if(_s.getState().isDrawing)return;let _t=u.current;if(!_t)return;if(_t.paused()||_t.ended()){let Ht=_t.play();if(Ht!==void 0)Ht.catch((Wt)=>{if(Wt.name==="AbortError")return;console.error("Play failed:",Wt)})}else _t.pause()},[]);He.useEffect(()=>{let _t=(Ht)=>{let Wt=document.activeElement;if(Wt&&(Wt.tagName==="INPUT"||Wt.tagName==="TEXTAREA"||Wt instanceof HTMLElement&&Wt.isContentEditable))return;let Oe=Ht.key===" ",Ma=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(Oe&&Ma)return;if(Ht.key===" "||Ht.key.toLowerCase()==="k")Ht.preventDefault(),ne()};return window.addEventListener("keydown",_t),()=>{window.removeEventListener("keydown",_t)}},[ne]);let ye=()=>{let _t=u.current;if(!_t)return;let Ht=!G.isLooping;_t.loop(Ht),Ct((Wt)=>({...Wt,isLooping:Ht}))},dt=(_t)=>{Ct((Wt)=>({...Wt,volume:_t,isMuted:_t===0}));let Ht=u.current;if(!Ht)return;if(Ht.volume(_t),_t>0&&Ht.muted())Ht.muted(!1);else if(_t===0&&!Ht.muted())Ht.muted(!0)},Ut=()=>{let _t=u.current;if(!_t)return;if(_t.muted()){if(_t.muted(!1),_t.volume()===0)_t.volume(0.5)}else _t.muted(!0)},ie=(_t)=>{let Ht=u.current;if(!Ht)return;Ht.playbackRate(_t)},_e=(_t)=>{let Ht=u.current;if(!Ht)return;let Wt=!Ht.paused(),Oe=Ht.currentTime();Ct((Ma)=>({...Ma,currentResolution:_t.resolution,currentSrc:_t.url})),Ht.src({type:"video/mp4",src:_t.url}),Ht.one("loadedmetadata",()=>{if(Ht.currentTime(Oe),Wt){let Ma=Ht.play();if(Ma!==void 0)Ma.catch((En)=>{if(En.name==="AbortError")return;console.error("Play after seek failed:",En)})}Ht.playbackRate(G.playbackRate)})},ca=()=>{if(!d.current)return;if(!document.fullscreenElement)d.current.requestFullscreen(),Ct((_t)=>({..._t,isFullScreen:!0}));else document.exitFullscreen(),Ct((_t)=>({..._t,isFullScreen:!1}))},Be=async(_t)=>{try{let Ht=l?await Le.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:l,fileId:t.id},json:{key:_t}}):await Le.api.files["download-url"].$post({json:{key:_t,assetId:t.id}});if(!Ht.ok)return;let{url:Wt}=await Ht.json(),Oe=document.createElement("a");Oe.href=Wt,Oe.download="",document.body.appendChild(Oe),Oe.click(),document.body.removeChild(Oe)}catch{}};He.useEffect(()=>{let _t=()=>{Ct((Ht)=>({...Ht,isFullScreen:!!document.fullscreenElement}))};return document.addEventListener("fullscreenchange",_t),()=>document.removeEventListener("fullscreenchange",_t)},[]);let Sa=t.media?.metadata?.originalWidth||1920,ia=t.media?.metadata?.originalHeight||1080,on=M,Yt=(E.width-Sa*on)/2,Pt=(E.height-ia*on)/2;if(!m)return x("div",{className:"flex h-full w-full items-center justify-center",children:x("p",{className:"text-muted-foreground",children:"Media is not available."})});return rt("div",{ref:d,className:Mi("group shadow-2xl font-sans select-none flex flex-col mx-auto transition-all duration-300 relative",G.isFullScreen?"h-full w-full rounded-none bg-black":"w-full h-full",!Ft&&G.isFullScreen?"cursor-none":""),onMouseMove:ji,onMouseLeave:Zt,children:[rt("div",{className:"flex-1 flex flex-col-reverse md:flex-row min-h-0 relative",children:[!G.isFullScreen&&f,rt("div",{ref:w,className:Mi("flex-1 bg-black cursor-pointer relative flex items-center justify-center overflow-hidden min-h-0"),onClick:ne,"data-vjs-player":!0,"data-testid":"video-area",children:[x("div",{ref:p,className:"absolute inset-0 z-[-1]"}),Re?x("div",{className:"flex flex-col items-center justify-center text-muted-foreground w-full h-full pointer-events-none select-none",children:x(O3,{className:Mi("w-16 h-16 text-foreground/75 transition-transform duration-500",G.isPlaying?"animate-pulse scale-110 text-primary":"")})}):y&&E.width>0&&x(O0,{width:E.width,height:E.height,mediaDimensions:{width:Sa,height:ia},videoElement:y,annotations:ft,scale:on,offset:{x:Yt,y:Pt},className:"absolute inset-0",onClick:ne,isDrawing:Q,currentTool:Z,currentColor:J,onAddAnnotation:Y}),!G.isPlaying&&!Q&&x("div",{className:"absolute inset-0 flex items-center justify-center bg-black/20 pointer-events-none z-10",children:x("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:x(hh,{className:"w-10 h-10 text-white ml-1 fill-white"})})})]})]}),x(Wk,{state:Ri,zoom:M,isControlsVisible:Ft,buffered:Kt,data:t,resolutions:qt,togglePlay:ne,toggleLoop:ye,toggleMute:Ut,handleVolumeChange:dt,changePlaybackRate:ie,changeResolution:_e,handleDownload:Be,toggleFullScreen:ca,onZoomChange:tt,onZoomReset:at,frameRate:Gt,totalFrames:da,currentFrame:Ve,seekToFrame:va,onMouseEnter:mt,onMouseLeave:kt})]})}),J_=WL;var Fe=Ie(Pa(),1);function PL(t){let e=t.media?.original?.downloadUrl?{id:"original",url:t.media.original.downloadUrl,key:t.media.original.key??"",width:t.media?.metadata?.originalWidth??0,height:t.media?.metadata?.originalHeight??0,size:0,isRaw:!0,resolution:"Original"}:null,a=(t.media?.videoTranscodes??[]).map((s)=>{let n=Math.max(s.width,s.height),l=`${s.height}p`;if(n>=3840)l="2160p";else if(n>=1920)l="1080p";else if(n>=1280)l="720p";else if(n>=960)l="540p";else if(n>=640)l="360p";else if(n>=320)l="180p";return{...s,resolution:s.isRaw?"Original":l}});if(!a.some((s)=>s.isRaw)&&e)return[...a,e];return a}var Q_=Fe.forwardRef(function({file:e,shareId:a,isActive:i,muted:s=!0,volume:n=1,annotations:l,onStateChange:f,onActivate:o,onRequestTogglePlay:c,onTimeUpdate:u,onPlay:m},p){let w=Fe.useRef(null),d=Fe.useRef(null),v=Fe.useRef(null),k=Fe.useRef(null),[y,B]=Fe.useState(void 0),{isDrawing:H,currentTool:M,currentColor:D,addAnnotation:T,annotations:z}=_s(),[E,V]=Fe.useState({width:0,height:0}),[tt,at]=Fe.useState(1),[Q,Z]=Fe.useState(!1),[J,Y]=Fe.useState(null),[W,ft]=Fe.useState(!1),[nt,qt]=Fe.useState(!1),[R,ct]=Fe.useState(1),[pt,G]=Fe.useState(0),[Ct,Kt]=Fe.useState(n),[le,Ft]=Fe.useState(s),[Et,$t]=Fe.useState(!1),Dt=e.media?.metadata,Mt=Dt?.frameRate||30,Xt=Dt?.totalFrames||0,Gt=Dt?.duration||0,ae=H3({dbTotalFrames:Xt,containerDuration:Gt,frameRate:Mt}),Xe=PL(e),da=Xe.filter((Yt)=>!Yt.isRaw)[0]??Xe[0],[Ve,va]=Fe.useState(da?.resolution??"Original"),ce=Fe.useRef(da?.url),ii=e.proxyType==="audio",{currentFrame:Ee,seekToFrame:Ri}=s3(k,Mt,ae,ii),mi=Fe.useRef(tt);mi.current=tt;let ji=Fe.useRef(Ee);ji.current=Ee,Fe.useEffect(()=>{if(!v.current)return;let Yt=new ResizeObserver((Pt)=>{let _t=Pt[0];if(_t)V({width:_t.contentRect.width,height:_t.contentRect.height})});return Yt.observe(v.current),()=>Yt.disconnect()},[]);let mt=Dt?.originalWidth||1920,kt=Dt?.originalHeight||1080;Fe.useEffect(()=>{if(E.width>0&&E.height>0&&!Q){let Yt=Math.min(E.width/mt,E.height/kt);at(Yt)}},[E.width,E.height,mt,kt,Q]),Fe.useEffect(()=>{va(da?.resolution??"Original"),ce.current=da?.url},[e.id]),Fe.useEffect(()=>{if(!d.current)return;let Yt=document.createElement("video-js");Yt.classList.add("vjs-big-play-centered","!h-full","!w-full"),Yt.style.opacity="0",Yt.style.pointerEvents="none",d.current.appendChild(Yt);let Pt=w.current=lt(Yt,{controls:!1,autoplay:!1,preload:"auto",playsinline:!0,sources:[{src:ce.current??"",type:"video/mp4"}]}),_t=Yt.querySelector("video");if(_t)B(_t),k.current=_t;else Pt.ready(()=>{let Ht=Pt.tech({iWillNotUseThisInPlugins:!0})?.el();if(Ht)B(Ht),k.current=Ht});return Pt.on("play",()=>{ft(!0),m?.()}),Pt.on("pause",()=>ft(!1)),Pt.on("ended",()=>ft(!1)),Pt.on("loadedmetadata",()=>$t(!0)),Pt.on("loadstart",()=>$t(!1)),Pt.on("timeupdate",()=>{let Ht=Pt.duration()||Gt||0,Wt=Pt.bufferedEnd();if(Ht>0)G(Wt/Ht*100)}),Pt.on("volumechange",()=>{Kt(Pt.volume()||0),Ft(Pt.muted()||!1)}),Pt.on("ratechange",()=>ct(Pt.playbackRate()||1)),()=>{if(Pt&&!Pt.isDisposed())Pt.dispose(),w.current=null,k.current=null}},[e.id]),Fe.useEffect(()=>{let Yt=w.current;if(!Yt||!Et)return;Yt.muted(s),Yt.volume(n)},[s,n,Et]),Fe.useEffect(()=>{f({kind:"video",zoom:tt,video:{frameRate:Mt,totalFrames:ae,currentFrame:Ee,isPlaying:W,volume:Ct,isMuted:le,playbackRate:R,isLooping:nt,currentResolution:Ve,resolutions:Xe,buffered:pt}})},[tt,Mt,ae,Ee,W,Ct,le,R,nt,Ve,pt]),Fe.useEffect(()=>{if(i)u?.(Ee/Mt)},[Ee,Mt,i,u]);let Zt=Fe.useCallback((Yt)=>{let _t=mi.current*Yt;if(_t<0.01||_t>50)return;at(_t),Z(!0)},[]),ne=Fe.useCallback(()=>{Z(!1),Y(null)},[]),ye=Fe.useCallback((Yt)=>cw(Yt,ae),[ae]),dt=Fe.useCallback(async(Yt)=>{let Pt=Yt??e.media?.original?.key;if(!Pt||!e.id)return;try{let _t=a?await Le.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:a,fileId:e.id},json:{key:Pt}}):await Le.api.files["download-url"].$post({json:{key:Pt,assetId:e.id}});if(!_t.ok)return;let{url:Ht}=await _t.json(),Wt=document.createElement("a");Wt.href=Ht,Wt.download="",document.body.appendChild(Wt),Wt.click(),document.body.removeChild(Wt)}catch{}},[e.id,e.media?.original?.key,a]),Ut=Fe.useCallback((Yt)=>{let Pt=w.current;if(!Pt)return;let _t=Xe.find((Oe)=>Oe.resolution===Yt);if(!_t)return;let Ht=!Pt.paused(),Wt=Pt.currentTime();va(Yt),ce.current=_t.url,Pt.src({type:"video/mp4",src:_t.url}),Pt.one("loadedmetadata",()=>{if(Pt.currentTime(Wt),Ht){let Oe=Pt.play();if(Oe!==void 0)Oe.catch(()=>{})}})},[Xe]);Fe.useImperativeHandle(p,()=>({getKind:()=>"video",play:()=>{let Yt=w.current?.play();if(Yt!==void 0)Yt.catch(()=>{})},pause:()=>w.current?.pause(),togglePlay:()=>{let Yt=w.current;if(!Yt)return;if(Yt.paused()||Yt.ended()){let Pt=Yt.play();if(Pt!==void 0)Pt.catch(()=>{})}else Yt.pause()},seekToFrame:(Yt)=>Ri(ye(Yt)),seekToSecond:(Yt)=>{let Pt=Math.floor(Yt*Mt+0.45);Ri(ye(Pt))},stepFrame:(Yt)=>Ri(ye(ji.current+Yt)),setMuted:(Yt)=>w.current?.muted(Yt),setVolume:(Yt)=>{let Pt=w.current;if(!Pt)return;if(Pt.volume(Yt),Yt>0&&Pt.muted())Pt.muted(!1);else if(Yt===0&&!Pt.muted())Pt.muted(!0)},setPlaybackRate:(Yt)=>w.current?.playbackRate(Yt),toggleLoop:()=>{let Yt=w.current;if(!Yt)return;let Pt=!Yt.loop();Yt.loop(Pt),qt(Pt)},changeResolution:Ut,zoomBy:Zt,fit:ne,panBy:(Yt,Pt)=>Y((_t)=>{let Ht=mi.current,Wt=_t??{x:(E.width-mt*Ht)/2,y:(E.height-kt*Ht)/2};return{x:Wt.x+Yt,y:Wt.y+Pt}}),download:(Yt)=>dt(Yt)}),[Ri,ye,Mt,Zt,ne,Ut,dt,E.width,E.height,mt,kt]);let ie=[...l,...i?z:[]],_e=tt,ca=(E.width-mt*_e)/2,Be=(E.height-kt*_e)/2,Sa=J?.x??ca,ia=J?.y??Be,on=Fe.useCallback(()=>{if(_s.getState().isDrawing)return;if(!i){o?.();return}c?.()},[i,o,c]);if(!e.media?.original?.downloadUrl||!Dt)return x("div",{className:"flex h-full w-full items-center justify-center bg-black",children:x("p",{className:"text-muted-foreground",children:"Media is not available."})});return rt("div",{ref:v,className:Mi("relative flex flex-1 cursor-pointer items-center justify-center overflow-hidden bg-black"),onClick:on,"data-testid":"compare-video-area",children:[x("div",{ref:d,className:"absolute inset-0 z-[-1]"}),ii?x("div",{className:"flex flex-col items-center justify-center text-muted-foreground w-full h-full pointer-events-none select-none",children:x(O3,{className:Mi("w-16 h-16 text-foreground/75 transition-transform duration-500",W?"animate-pulse scale-110 text-primary":"")})}):y&&E.width>0&&x(O0,{width:E.width,height:E.height,mediaDimensions:{width:mt,height:kt},videoElement:y,annotations:ie,scale:_e,offset:{x:Sa,y:ia},className:"absolute inset-0",onClick:on,isDrawing:i&&H,currentTool:M,currentColor:D,onAddAnnotation:i?T:void 0}),!W&&!H&&x("div",{className:"pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-black/20",children:x("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:x(hh,{className:"ml-1 h-8 w-8 fill-white text-white"})})})]})});var Z_={id:"video",name:"Video",match:(t)=>t.proxyType==="video"||t.proxyType==="audio",viewer:J_,comparePane:Q_,commentsConfig:{hasTimestamp:!0,hasAnnotations:!0,hasAiBots:!0}};var M3=Ie(Pa(),1);function D3(){let[t,e]=M3.useState({width:window.innerWidth,height:window.innerHeight});return M3.useLayoutEffect(()=>{function a(){e({width:window.innerWidth,height:window.innerHeight})}return window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[]),t}function T3(t,e){if(!t||t.length===0)return null;let a=t.filter((l)=>!l.isRaw),s=[...a.length>0?a:t].sort((l,f)=>{let o=l.width??0,c=f.width??0;if(o!==c)return c-o;return(l.isRaw?1:0)-(f.isRaw?1:0)}),n=s.filter((l)=>(l.width??0)>=e);if(n.length>0)return n.sort((l,f)=>{let o=l.width??0,c=f.width??0;if(o!==c)return o-c;return(l.isRaw?1:0)-(f.isRaw?1:0)}),n[0];return s[0]}var js=Ie(Pa(),1);function W_({zoom:t,onZoomIn:e,onZoomOut:a,onFit:i,onDownload:s,canDownload:n,onCopy:l,copied:f=!1,canCopy:o=!0,fullscreen:c}){return rt("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:[rt("div",{className:"flex items-center gap-1 bg-gray-200/50 dark:bg-white/10 rounded-md p-0.5 mr-auto",children:[x("button",{onClick:a,className:"p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors",title:It.zoom_out(),children:x(ul,{size:16})}),rt("span",{className:"w-12 text-center text-xs font-mono font-medium text-gray-900 dark:text-gray-100 select-none",children:[Math.round(t*100),"%"]}),x("button",{onClick:e,className:"p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors",title:It.zoom_in(),children:x(ch,{size:16})})]}),x("button",{onClick:i,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:It.fit()}),l&&rt("button",{onClick:l,disabled:!o,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:It.copy_image_to_clipboard(),children:[f?x(oh,{size:14,className:"text-green-500"}):x($_,{size:14}),f?It.copied():It.copy()]}),rt("button",{onClick:s,disabled:!n,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:It.download_original_image(),children:[x(Vn,{size:14}),It.download()]}),c&&x("button",{onClick:c.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:It.fullscreen(),children:c.isFullScreen?x(f3,{size:16}):x(l3,{size:16})})]})}var tV=js.default.forwardRef(({file:t,annotations:e,shareId:a,children:i},s)=>{js.useImperativeHandle(s,()=>({play:()=>{},pause:()=>{},seekTo:()=>{}}));let{width:n}=D3(),{isDrawing:l,currentTool:f,currentColor:o,addAnnotation:c,annotations:u}=_s(),[m,p]=js.useState({width:0,height:0}),[w,d]=js.useState(1),[v,k]=js.useState({x:0,y:0}),[y,B]=js.useState(!1),H=js.useRef(null),M=js.useCallback((ft)=>{if(H.current)H.current.disconnect(),H.current=null;if(ft!==null){let nt=new ResizeObserver((qt)=>{let R=qt[0];if(R)p({width:R.contentRect.width,height:R.contentRect.height})});nt.observe(ft),H.current=nt}},[]),D=t.media?.metadata?.originalWidth??1920,T=t.media?.metadata?.originalHeight??1080,z=m.width,E=m.height,V=1;if(z>0&&E>0)V=Math.min(z/D,E/T);js.useEffect(()=>{if(z>0&&E>0){d(V);let ft=(z-D*V)/2,nt=(E-T*V)/2;k({x:ft,y:nt})}},[t.id,z,E,V,D,T]);let tt=(ft)=>{let nt=z/2,qt=E/2,R=w*ft;if(R<0.01||R>50)return;let ct=nt-(nt-v.x)*(R/w),pt=qt-(qt-v.y)*(R/w);d(R),k({x:ct,y:pt})},at=()=>{d(V);let ft=(z-D*V)/2,nt=(E-T*V)/2;k({x:ft,y:nt})},Q=t.media?.original?.downloadUrl,Z=T3(t.media?.imageTranscodes,n);if(Z?.url)Q=Z.url;let J=async()=>{let ft=t.media?.original?.key;if(!ft||!t.id)return;try{let nt=a?await Le.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:a,fileId:t.id},json:{key:ft}}):await Le.api.files["download-url"].$post({json:{key:ft,assetId:t.id}});if(!nt.ok)return;let{url:qt}=await nt.json(),R=document.createElement("a");R.href=qt,R.download="",document.body.appendChild(R),R.click(),document.body.removeChild(R)}catch{}},Y=async()=>{let ft=Q;if(!ft)return;try{let nt=(async()=>{let R=await(await fetch(ft)).blob(),ct=new Image;ct.crossOrigin="anonymous";let pt=URL.createObjectURL(R);ct.src=pt;try{await new Promise((le,Ft)=>{ct.onload=le,ct.onerror=(Et)=>Ft(Error("Failed to load image: "+String(Et)))});let G=document.createElement("canvas");G.width=ct.width,G.height=ct.height;let Ct=G.getContext("2d");if(!Ct)throw Error("Could not get canvas context");Ct.drawImage(ct,0,0);let Kt=await new Promise((le)=>{G.toBlob(le,"image/png")});if(!Kt)throw Error("Failed to convert image to PNG");return Kt}finally{URL.revokeObjectURL(pt)}})();await navigator.clipboard.write([new ClipboardItem({"image/png":nt})]),B(!0),setTimeout(()=>B(!1),2000)}catch(nt){console.error("Failed to copy image to clipboard:",nt)}},W=[...e||[],...u];return rt("div",{className:"flex flex-col flex-1 h-full overflow-hidden bg-gray-100 dark:bg-gray-950 relative",children:[rt("div",{className:"flex-1 flex flex-col-reverse md:flex-row min-h-0 relative",children:[i,x("div",{ref:M,className:"flex-1 relative overflow-hidden",children:x(O0,{width:z,height:E,mediaDimensions:{width:D,height:T},imageUrl:Q,annotations:W,scale:w,offset:v,onPan:k,className:"absolute inset-0 z-0",isDrawing:l,currentTool:f,currentColor:o,onAddAnnotation:c})})]}),x(W_,{zoom:w,onZoomIn:()=>tt(1.2),onZoomOut:()=>tt(0.8),onFit:at,onDownload:J,canDownload:!!t.media?.original?.key,onCopy:Y,copied:y,canCopy:!!Q})]})}),P_=tV;var ei=Ie(Pa(),1);var eV=0.01,aV=50,tF=ei.forwardRef(function({file:e,shareId:a,isActive:i,annotations:s,onStateChange:n,onUserPan:l,onActivate:f},o){let{width:c}=D3(),{isDrawing:u,currentTool:m,currentColor:p,addAnnotation:w,annotations:d}=_s(),[v,k]=ei.useState({width:0,height:0}),[y,B]=ei.useState(1),[H,M]=ei.useState({x:0,y:0}),D=ei.useRef(null),T=ei.useRef(y);T.current=y;let z=ei.useRef(H);z.current=H;let E=ei.useCallback((ct)=>{if(D.current)D.current.disconnect(),D.current=null;if(ct!==null){let pt=new ResizeObserver((G)=>{let Ct=G[0];if(Ct)k({width:Ct.contentRect.width,height:Ct.contentRect.height})});pt.observe(ct),D.current=pt}},[]),V=e.media?.metadata?.originalWidth??1920,tt=e.media?.metadata?.originalHeight??1080,at=v.width,Q=v.height,Z=1;if(at>0&&Q>0)Z=Math.min(at/V,Q/tt);ei.useEffect(()=>{if(at>0&&Q>0)B(Z),M({x:(at-V*Z)/2,y:(Q-tt*Z)/2})},[e.id,at,Q,Z,V,tt]);let J=ei.useCallback((ct)=>{let pt=at/2,G=Q/2,Ct=T.current,Kt=Ct*ct;if(Kt<eV||Kt>aV)return;let le=z.current;M({x:pt-(pt-le.x)*(Kt/Ct),y:G-(G-le.y)*(Kt/Ct)}),B(Kt)},[at,Q]),Y=ei.useCallback(()=>{B(Z),M({x:(at-V*Z)/2,y:(Q-tt*Z)/2})},[Z,at,Q,V,tt]),W=e.media?.original?.downloadUrl,ft=T3(e.media?.imageTranscodes,c);if(ft?.url)W=ft.url;let nt=ei.useCallback(async()=>{let ct=e.media?.original?.key;if(!ct||!e.id)return;try{let pt=a?await Le.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:a,fileId:e.id},json:{key:ct}}):await Le.api.files["download-url"].$post({json:{key:ct,assetId:e.id}});if(!pt.ok)return;let{url:G}=await pt.json(),Ct=document.createElement("a");Ct.href=G,Ct.download="",document.body.appendChild(Ct),Ct.click(),document.body.removeChild(Ct)}catch{}},[e.id,e.media?.original?.key,a]);ei.useImperativeHandle(o,()=>({getKind:()=>"image",play:()=>{},pause:()=>{},togglePlay:()=>{},seekToFrame:()=>{},seekToSecond:()=>{},stepFrame:()=>{},setMuted:()=>{},setVolume:()=>{},setPlaybackRate:()=>{},toggleLoop:()=>{},changeResolution:()=>{},zoomBy:(ct)=>J(ct),fit:Y,panBy:(ct,pt)=>M((G)=>({x:G.x+ct,y:G.y+pt})),download:nt}),[J,Y,nt]),ei.useEffect(()=>{n({kind:"image",zoom:y})},[y,n]);let qt=[...s,...i?d:[]],R=ei.useCallback((ct)=>{let pt=z.current,G=ct.x-pt.x,Ct=ct.y-pt.y;if(M(ct),G!==0||Ct!==0)l?.(G,Ct)},[l]);if(!W)return x("div",{className:"flex flex-1 items-center justify-center bg-gray-100 dark:bg-gray-950",children:x("p",{className:"text-muted-foreground",children:"Preview unavailable"})});return x("div",{ref:E,className:"relative flex-1 overflow-hidden bg-black",onMouseDown:f,children:x(O0,{width:at,height:Q,mediaDimensions:{width:V,height:tt},imageUrl:W,annotations:qt,scale:y,offset:H,onPan:R,className:"absolute inset-0 z-0",isDrawing:i&&u,currentTool:m,currentColor:p,onAddAnnotation:i?w:void 0})})});var eF={id:"image",name:"Image",match:(t)=>t.proxyType==="image",viewer:P_,comparePane:tF,commentsConfig:{hasTimestamp:!1,hasAnnotations:!0,hasAiBots:!0}};var ln=typeof process==="object"&&process+""==="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),y1=[1/0,1/0,-1/0,-1/0],lr=new Float32Array(y1),Ub=[0.001,0,0,0.001,0,0];var sn={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Dl={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};var je={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},Ce={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},iV={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 wi={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},X3={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Ja={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 yh={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};var i6={ERRORS:0,WARNINGS:1,INFOS:5},T0={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},s9={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},sV={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},s6=i6.WARNINGS;function nV(t){if(Number.isInteger(t))s6=t}function lV(){return s6}function n6(t){if(s6>=i6.INFOS)console.info(`Info: ${t}`)}function de(t){if(s6>=i6.WARNINGS)console.warn(`Warning: ${t}`)}function Qe(t){throw Error(t)}function Ga(t,e){if(!t)Qe(e)}function fV(t){switch(t?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function CF(t,e=null,a=null){if(!t)return null;if(a&&typeof t==="string"){if(a.addDefaultProtocol&&t.startsWith("www.")){if(t.match(/\./g)?.length>=2)t=`http://${t}`}if(a.tryConvertEncoding)try{t=oV(t)}catch{}}let i=e?URL.parse(t,e):URL.parse(t);return fV(i)?i:null}function _F(t,e,a=!1){let i=URL.parse(t);if(i)return i.hash=e,i.href;if(a&&CF(t,"http://example.com"))return t.split("#",1)[0]+`${e?`#${e}`:""}`;return""}function Ib(t){return t.substring(t.lastIndexOf("/")+1)}function be(t,e,a,i=!1){return Object.defineProperty(t,e,{value:a,enumerable:!i,configurable:!0,writable:!1}),a}var cr=function(){function e(a,i){this.message=a,this.name=i}return e.prototype=Error(),e.constructor=e,e}();class Y3 extends cr{constructor(t,e){super(t,"PasswordException");this.code=e}}class K3 extends cr{constructor(t,e){super(t,"UnknownErrorException");this.details=e}}class J3 extends cr{constructor(t){super(t,"InvalidPDFException")}}class c9 extends cr{constructor(t,e,a){super(t,"ResponseException");this.status=e,this.missing=a}}class FF extends cr{constructor(t){super(t,"FormatError")}}class C1 extends cr{constructor(t){super(t,"AbortException")}}function rV(t){if(typeof t!=="object"||t?.length===void 0)Qe("Invalid argument for bytesToString");let e=t.length,a=8192;if(e<a)return String.fromCharCode.apply(null,t);let i=[];for(let s=0;s<e;s+=a){let n=Math.min(s+a,e),l=t.subarray(s,n);i.push(String.fromCharCode.apply(null,l))}return i.join("")}function l6(t){if(typeof t!=="string")Qe("Invalid argument for stringToBytes");let e=t.length,a=new Uint8Array(e);for(let i=0;i<e;++i)a[i]=t.charCodeAt(i)&255;return a}class ha{static get isLittleEndian(){let t=new Uint8Array(4);t[0]=1;let e=new Uint32Array(t.buffer,0,1);return be(this,"isLittleEndian",e[0]===1)}static get isOffscreenCanvasSupported(){return be(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return be(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return be(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return be(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){let{platform:t,userAgent:e}=navigator;return be(this,"platform",{isAndroid:e.includes("Android"),isLinux:t.includes("Linux"),isMac:t.includes("Mac"),isWindows:t.includes("Win"),isFirefox:e.includes("Firefox")})}static get isCanvasFilterSupported(){let t;if(this.isOffscreenCanvasSupported)t=new OffscreenCanvas(1,1).getContext("2d");else if(typeof document<"u")t=document.createElement("canvas").getContext("2d");return be(this,"isCanvasFilterSupported",t?.filter!==void 0)}static get isAlphaColorInputSupported(){if(typeof document>"u")return be(this,"isAlphaColorInputSupported",!1);let t=document.createElement("input");return t.type="color",t.setAttribute("alpha",""),t.value="#ff000080",be(this,"isAlphaColorInputSupported",t.value!=="#ff0000")}static get isBackdropFilterSupported(){return be(this,"isBackdropFilterSupported",typeof CSS<"u"&&CSS.supports("backdrop-filter","blur(1px)"))}}class Nt{static get hexNums(){return be(this,"hexNums",Array.from(Array(256).keys(),(t)=>t.toString(16).padStart(2,"0")))}static makeHexColor(t,e,a){return`#${this.hexNums[t]}${this.hexNums[e]}${this.hexNums[a]}`}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static multiplyByDOMMatrix(t,e){return[t[0]*e.a+t[2]*e.b,t[1]*e.a+t[3]*e.b,t[0]*e.c+t[2]*e.d,t[1]*e.c+t[3]*e.d,t[0]*e.e+t[2]*e.f+t[4],t[1]*e.e+t[3]*e.f+t[5]]}static applyTransform(t,e,a=0){let i=t[a],s=t[a+1];t[a]=i*e[0]+s*e[2]+e[4],t[a+1]=i*e[1]+s*e[3]+e[5]}static applyTransformToBezier(t,e,a=0){let i=e[0],s=e[1],n=e[2],l=e[3],f=e[4],o=e[5];for(let c=0;c<6;c+=2){let u=t[a+c],m=t[a+c+1];t[a+c]=u*i+m*n+f,t[a+c+1]=u*s+m*l+o}}static applyInverseTransform(t,e){let a=t[0],i=t[1],s=e[0]*e[3]-e[1]*e[2];t[0]=(a*e[3]-i*e[2]+e[2]*e[5]-e[4]*e[3])/s,t[1]=(-a*e[1]+i*e[0]+e[4]*e[1]-e[5]*e[0])/s}static axialAlignedBoundingBox(t,e,a){let i=e[0],s=e[1],n=e[2],l=e[3],f=e[4],o=e[5],c=t[0],u=t[1],m=t[2],p=t[3],w=i*c+f,d=w,v=i*m+f,k=v,y=l*u+o,B=y,H=l*p+o,M=H;if(s!==0||n!==0){let D=s*c,T=s*m,z=n*u,E=n*p;w+=z,k+=z,v+=E,d+=E,y+=D,M+=D,H+=T,B+=T}a[0]=Math.min(a[0],w,v,d,k),a[1]=Math.min(a[1],y,H,B,M),a[2]=Math.max(a[2],w,v,d,k),a[3]=Math.max(a[3],y,H,B,M)}static inverseTransform(t){let e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t,e){let a=t[0],i=t[1],s=t[2],n=t[3],l=a**2+i**2,f=a*s+i*n,o=s**2+n**2,c=(l+o)/2,u=Math.sqrt(c**2-(l*o-f**2));e[0]=Math.sqrt(c+u||1),e[1]=Math.sqrt(c-u||1)}static normalizeRect(t){let e=t.slice(0);if(t[0]>t[2])e[0]=t[2],e[2]=t[0];if(t[1]>t[3])e[1]=t[3],e[3]=t[1];return e}static intersect(t,e){let a=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),i=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(a>i)return null;let s=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),n=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));if(s>n)return null;return[a,s,i,n]}static pointBoundingBox(t,e,a){a[0]=Math.min(a[0],t),a[1]=Math.min(a[1],e),a[2]=Math.max(a[2],t),a[3]=Math.max(a[3],e)}static rectBoundingBox(t,e,a,i,s){s[0]=Math.min(s[0],t,a),s[1]=Math.min(s[1],e,i),s[2]=Math.max(s[2],t,a),s[3]=Math.max(s[3],e,i)}static#t(t,e,a,i,s,n,l,f,o,c){if(o<=0||o>=1)return;let u=1-o,m=o*o,p=m*o,w=u*(u*(u*t+3*o*e)+3*m*a)+p*i,d=u*(u*(u*s+3*o*n)+3*m*l)+p*f;c[0]=Math.min(c[0],w),c[1]=Math.min(c[1],d),c[2]=Math.max(c[2],w),c[3]=Math.max(c[3],d)}static#e(t,e,a,i,s,n,l,f,o,c,u,m){if(Math.abs(o)<0.000000000001){if(Math.abs(c)>=0.000000000001)this.#t(t,e,a,i,s,n,l,f,-u/c,m);return}let p=c**2-4*u*o;if(p<0)return;let w=Math.sqrt(p),d=2*o;this.#t(t,e,a,i,s,n,l,f,(-c+w)/d,m),this.#t(t,e,a,i,s,n,l,f,(-c-w)/d,m)}static bezierBoundingBox(t,e,a,i,s,n,l,f,o){o[0]=Math.min(o[0],t,l),o[1]=Math.min(o[1],e,f),o[2]=Math.max(o[2],t,l),o[3]=Math.max(o[3],e,f),this.#e(t,a,s,l,e,i,n,f,3*(-t+3*(a-s)+l),6*(t-2*a+s),3*(a-t),o),this.#e(t,a,s,l,e,i,n,f,3*(-e+3*(i-n)+f),6*(e-2*i+n),3*(i-e),o)}}function oV(t){return decodeURIComponent(escape(t))}var Rb=null,aF=null;function hV(t){if(!Rb)Rb=/([\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,aF=new Map([["ſt","ſt"]]);return t.replaceAll(Rb,(e,a,i)=>a?a.normalize("NFKC"):aF.get(i))}function BF(){if(typeof crypto.randomUUID==="function")return crypto.randomUUID();let t=new Uint8Array(32);return crypto.getRandomValues(t),rV(t)}function cV(t,e,a){if(!Array.isArray(a)||a.length<2)return!1;let[i,s,...n]=a;if(!t(i)&&!Number.isInteger(i))return!1;if(!e(s))return!1;let l=n.length,f=!0;switch(s.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;f=!1;break;default:return!1}for(let o of n){if(typeof o==="number"||f&&o===null)continue;return!1}return!0}var w9=()=>[],$b=()=>new Map,Gb=()=>Object.create(null);function _a(t,e,a){return Math.min(Math.max(t,e),a)}class j9{constructor({viewBox:t,userUnit:e,scale:a,rotation:i,offsetX:s=0,offsetY:n=0,dontFlip:l=!1}){this.viewBox=t,this.userUnit=e,this.scale=a,this.rotation=i,this.offsetX=s,this.offsetY=n,a*=e;let f=(t[2]+t[0])/2,o=(t[3]+t[1])/2,c,u,m,p;if(i%=360,i<0)i+=360;switch(i){case 180:c=-1,u=0,m=0,p=1;break;case 90:c=0,u=1,m=1,p=0;break;case 270:c=0,u=-1,m=-1,p=0;break;case 0:c=1,u=0,m=0,p=-1;break;default:throw Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}if(l)m=-m,p=-p;let w,d,v,k;if(c===0)w=Math.abs(o-t[1])*a+s,d=Math.abs(f-t[0])*a+n,v=(t[3]-t[1])*a,k=(t[2]-t[0])*a;else w=Math.abs(f-t[0])*a+s,d=Math.abs(o-t[1])*a+n,v=(t[2]-t[0])*a,k=(t[3]-t[1])*a;this.transform=[c*a,u*a,m*a,p*a,w-c*a*f-m*a*o,d-u*a*f-p*a*o],this.width=v,this.height=k}get rawDims(){let t=this.viewBox;return be(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:a=this.offsetX,offsetY:i=this.offsetY,dontFlip:s=!1}={}){return new j9({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:a,offsetY:i,dontFlip:s})}convertToViewportPoint(t,e){let a=[t,e];return Nt.applyTransform(a,this.transform),a}convertToPdfPoint(t,e){let a=[t,e];return Nt.applyInverseTransform(a,this.transform),a}}class u9{static textContent(t){let e=[],a={items:e,styles:Object.create(null)};function i(s){if(!s)return;let n=null,l=s.name;if(l==="#text")n=s.value;else if(!u9.shouldBuildText(l))return;else if(s?.attributes?.textContent)n=s.attributes.textContent;else if(s.value)n=s.value;if(n!==null)e.push({str:n});if(!s.children)return;for(let f of s.children)i(f)}return i(t),a}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}class Wb{static setupStorage(t,e,a,i,s){let n=i.getValue(e,{value:null});switch(a.name){case"textarea":if(n.value!==null)t.textContent=n.value;if(s==="print")break;t.addEventListener("input",(l)=>{i.setValue(e,{value:l.target.value})});break;case"input":if(a.attributes.type==="radio"||a.attributes.type==="checkbox"){if(n.value===a.attributes.xfaOn)t.setAttribute("checked",!0);else if(n.value===a.attributes.xfaOff)t.removeAttribute("checked");if(s==="print")break;t.addEventListener("change",(l)=>{i.setValue(e,{value:l.target.checked?l.target.getAttribute("xfaOn"):l.target.getAttribute("xfaOff")})})}else{if(n.value!==null)t.setAttribute("value",n.value);if(s==="print")break;t.addEventListener("input",(l)=>{i.setValue(e,{value:l.target.value})})}break;case"select":if(n.value!==null){t.setAttribute("value",n.value);for(let l of a.children)if(l.attributes.value===n.value)l.attributes.selected=!0;else if(Object.hasOwn(l.attributes,"selected"))delete l.attributes.selected}t.addEventListener("input",(l)=>{let f=l.target.options,o=f.selectedIndex===-1?"":f[f.selectedIndex].value;i.setValue(e,{value:o})});break}}static setAttributes({html:t,element:e,storage:a=null,intent:i,linkService:s}){let{attributes:n}=e,l=t instanceof HTMLAnchorElement;if(n.type==="radio")n.name=`${n.name}-${i}`;for(let[f,o]of Object.entries(n)){if(o===null||o===void 0)continue;switch(f){case"class":if(o.length)t.setAttribute(f,o.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",o);break;case"style":Object.assign(t.style,o);break;case"textContent":t.textContent=o;break;default:if(!l||f!=="href"&&f!=="newWindow")t.setAttribute(f,o)}}if(l)s.addLinkAttributes(t,n.href,n.newWindow);if(a&&n.dataId)this.setupStorage(t,n.dataId,e,a)}static render(t){let{annotationStorage:e,linkService:a,xfaHtml:i}=t,s=t.intent||"display",n=document.createElement(i.name);if(i.attributes)this.setAttributes({html:n,element:i,intent:s,linkService:a});let l=s!=="richText",f=t.div;if(f.append(n),t.viewport){let u=`matrix(${t.viewport.transform.join(",")})`;f.style.transform=u}if(l)f.setAttribute("class","xfaLayer xfaFont");let o=[];if(i.children.length===0){if(i.value){let u=document.createTextNode(i.value);if(n.append(u),l&&u9.shouldBuildText(i.name))o.push(u)}return{textDivs:o}}let c=[[i,-1,n]];while(c.length>0){let[u,m,p]=c.at(-1);if(m+1===u.children.length){c.pop();continue}let w=u.children[++c.at(-1)[1]];if(w===null)continue;let{name:d}=w;if(d==="#text"){let k=document.createTextNode(w.value);o.push(k),p.append(k);continue}let v=w?.attributes?.xmlns?document.createElementNS(w.attributes.xmlns,d):document.createElement(d);if(p.append(v),w.attributes)this.setAttributes({html:v,element:w,storage:e,intent:s,linkService:a});if(w.children?.length>0)c.push([w,-1,v]);else if(w.value){let k=document.createTextNode(w.value);if(l&&u9.shouldBuildText(d))o.push(k);v.append(k)}}for(let u of f.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))u.setAttribute("readOnly",!0);return{textDivs:o}}static update(t){let e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}static getPageViewport(t,{scale:e=1,rotation:a=0}){let{width:i,height:s}=t.attributes.style;return new j9({viewBox:[0,0,parseInt(i,10),parseInt(s,10)],userUnit:1,scale:e,rotation:a})}}class rr{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}async function Pb(t,e="text"){if(r9(t,document.baseURI)){let a=await fetch(t);if(!a.ok)throw Error(a.statusText);switch(e){case"blob":return a.blob();case"bytes":return a.bytes();case"json":return a.json()}return a.text()}return new Promise((a,i)=>{let s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType=e==="bytes"?"arraybuffer":e,s.onreadystatechange=()=>{if(s.readyState!==XMLHttpRequest.DONE)return;if(s.status===200||s.status===0){switch(e){case"bytes":a(new Uint8Array(s.response));return;case"blob":case"json":a(s.response);return}a(s.responseText);return}i(Error(s.statusText))},s.send(null)})}class f6 extends cr{constructor(t,e=0){super(t,"RenderingCancelledException");this.extraDelay=e}}function r6(t){let e=t.length,a=0;while(a<e&&t[a].trim()==="")a++;return t.substring(a,a+5).toLowerCase()==="data:"}function tp(t){return typeof t==="string"&&/\.pdf$/i.test(t)}function uV(t){return[t]=t.split(/[#?]/,1),Ib(t)}function mV(t,e="document.pdf"){if(typeof t!=="string")return e;if(r6(t))return de('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;let i=((f)=>{try{return new URL(f)}catch{}try{return new URL(decodeURIComponent(f))}catch{}try{return new URL(f,"https://foo.bar")}catch{}try{return new URL(decodeURIComponent(f),"https://foo.bar")}catch{}return null})(t);if(!i)return e;let s=(f)=>{try{let o=decodeURIComponent(f);if(o.includes("/")){if(o=Ib(o),o.length===4&&n.test(o))return f}return o}catch{return f}},n=/\.pdf$/i,l=Ib(i.pathname);if(n.test(l))return s(l);if(i.searchParams.size>0){let f=(c)=>[...c].findLast((u)=>n.test(u)),o=f(i.searchParams.values())??f(i.searchParams.keys());if(o)return s(o)}if(i.hash){let o=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(i.hash);if(o)return s(o[0])}return e}class Xb{#t=new Map;times=[];time(t){if(this.#t.has(t))de(`Timer is already running for ${t}`);this.#t.set(t,Date.now())}timeEnd(t){if(!this.#t.has(t))de(`Timer has not been started for ${t}`);this.times.push({name:t,start:this.#t.get(t),end:Date.now()}),this.#t.delete(t)}toString(){let t=Math.max(...this.times.map((e)=>e.name.length));return this.times.map((e)=>`${e.name.padEnd(t)} ${e.end-e.start}ms
266
- `).join("")}}function r9(t,e){let a=e?URL.parse(t,e):URL.parse(t);return/https?:/.test(a?.protocol??"")}function Nn(t){t.preventDefault()}function Ia(t){t.preventDefault(),t.stopPropagation()}class Q3{static#t;static toDateObject(t){if(t instanceof Date)return t;if(!t||typeof t!=="string")return null;this.#t||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+\\-])?(\\d{2})?'?(\\d{2})?'?");let e=this.#t.exec(t);if(!e)return null;let a=parseInt(e[1],10),i=parseInt(e[2],10);i=i>=1&&i<=12?i-1:0;let s=parseInt(e[3],10);s=s>=1&&s<=31?s:1;let n=parseInt(e[4],10);n=n>=0&&n<=23?n:0;let l=parseInt(e[5],10);l=l>=0&&l<=59?l:0;let f=parseInt(e[6],10);f=f>=0&&f<=59?f:0;let o=e[7]||"Z",c=parseInt(e[8],10);c=c>=0&&c<=23?c:0;let u=parseInt(e[9],10)||0;if(u=u>=0&&u<=59?u:0,o==="-")n+=c,l+=u;else if(o==="+")n-=c,l-=u;return new Date(Date.UTC(a,i,s,n,l,f))}}function d9(t){if(t.startsWith("#")){let a=t.slice(1);return[parseInt(a.slice(0,2),16),parseInt(a.slice(2,4),16),parseInt(a.slice(4,6),16),a.length>=8?parseInt(a.slice(6,8),16)/255:1]}if(t.startsWith("rgb(")){let[a,i,s]=t.slice(4,-1).split(",").map((n)=>parseInt(n,10));return[a,i,s,1]}if(t.startsWith("rgba(")){let a=t.slice(5,-1).split(",");return[parseInt(a[0],10),parseInt(a[1],10),parseInt(a[2],10),parseFloat(a[3])]}let e=t.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);if(e)return[Math.round(parseFloat(e[1])*255),Math.round(parseFloat(e[2])*255),Math.round(parseFloat(e[3])*255),e[4]!==void 0&&e[4]!=="none"?parseFloat(e[4]):1];return null}function q9(t){let e=d9(t);if(!e)return de(`Not a valid color format: "${t}"`),[0,0,0];return e.slice(0,3)}function gV(t){let e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(let a of t.keys()){e.style.color=a;let i=window.getComputedStyle(e).color;t.set(a,q9(i))}e.remove()}function Aa(t){let{a:e,b:a,c:i,d:s,e:n,f:l}=t.getTransform();return[e,a,i,s,n,l]}function H0(t){let{a:e,b:a,c:i,d:s,e:n,f:l}=t.getTransform().invertSelf();return[e,a,i,s,n,l]}function or(t,e,a=!1,i=!0){if(e instanceof j9){let{pageWidth:s,pageHeight:n}=e.rawDims,{style:l}=t,f=`round(down, var(--total-scale-factor) * ${s}px, var(--scale-round-x))`,o=`round(down, var(--total-scale-factor) * ${n}px, var(--scale-round-y))`;if(!a||e.rotation%180===0)l.width=f,l.height=o;else l.width=o,l.height=f}if(i)t.setAttribute("data-main-rotation",e.rotation)}class N0{constructor(){let{pixelRatio:t}=N0;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(t,e,a,i,s=-1){let n=1/0,l=1/0,f=1/0;if(a=N0.capPixels(a,s),a>0)n=Math.sqrt(a/(t*e));if(i!==-1)l=i/t,f=i/e;let o=Math.min(n,l,f);if(this.sx>o||this.sy>o)return this.sx=o,this.sy=o,!0;return!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(t,e){if(e>=0){let a=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,a):a}return t}}var Kb=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class OF{static get isDarkMode(){return be(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}}class HF{static get commentForegroundColor(){let t=document.createElement("span");t.classList.add("comment","sidebar");let{style:e}=t;e.width=e.height="0",e.display="none",e.color="var(--comment-fg-color)",document.body.append(t);let{color:a}=window.getComputedStyle(t);return t.remove(),be(this,"commentForegroundColor",q9(a))}}function bV(t,e){e=_a(e??1,0,1);let a=255*(1-e);return t.map((i)=>Math.round(i*e+a))}function iF(t,e){let a=t[0]/255,i=t[1]/255,s=t[2]/255,n=Math.max(a,i,s),l=Math.min(a,i,s),f=(n+l)/2;if(n===l)e[0]=e[1]=0;else{let o=n-l;switch(e[1]=f<0.5?o/(n+l):o/(2-n-l),n){case a:e[0]=((i-s)/o+(i<s?6:0))*60;break;case i:e[0]=((s-a)/o+2)*60;break;case s:e[0]=((a-i)/o+4)*60;break}}e[2]=f}function Lb(t,e){let a=t[0],i=t[1],s=t[2],n=(1-Math.abs(2*s-1))*i,l=n*(1-Math.abs(a/60%2-1)),f=s-n/2;switch(Math.floor(a/60)){case 0:e[0]=n+f,e[1]=l+f,e[2]=f;break;case 1:e[0]=l+f,e[1]=n+f,e[2]=f;break;case 2:e[0]=f,e[1]=n+f,e[2]=l+f;break;case 3:e[0]=f,e[1]=l+f,e[2]=n+f;break;case 4:e[0]=l+f,e[1]=f,e[2]=n+f;break;case 5:case 6:e[0]=n+f,e[1]=f,e[2]=l+f;break}}function sF(t){return t<=0.03928?t/12.92:((t+0.055)/1.055)**2.4}function nF(t,e,a){Lb(t,a),a.map(sF);let i=0.2126*a[0]+0.7152*a[1]+0.0722*a[2];Lb(e,a),a.map(sF);let s=0.2126*a[0]+0.7152*a[1]+0.0722*a[2];return i>s?(i+0.05)/(s+0.05):(s+0.05)/(i+0.05)}var lF=new Map;function pV(t,e){let a=t[0]+t[1]*256+t[2]*65536+e[0]*16777216+e[1]*4294967296+e[2]*1099511627776,i=lF.get(a);if(i)return i;let s=new Float32Array(9),n=s.subarray(0,3),l=s.subarray(3,6);iF(t,l);let f=s.subarray(6,9);iF(e,f);let o=f[2]<0.5,c=o?12:4.5;if(l[2]=o?Math.sqrt(l[2]):1-Math.sqrt(1-l[2]),nF(l,f,n)<c){let u,m;if(o)u=l[2],m=1;else u=0,m=l[2];let p=0.005;while(m-u>p){let w=l[2]=(u+m)/2;if(o===nF(l,f,n)<c)u=w;else m=w}l[2]=o?m:u}return Lb(l,n),i=Nt.makeHexColor(Math.round(n[0]*255),Math.round(n[1]*255),Math.round(n[2]*255)),lF.set(a,i),i}function MF({html:t,dir:e,className:a},i){let s=document.createDocumentFragment();if(typeof t==="string"){let n=document.createElement("p");n.dir=e||"auto";let l=t.split(/\r\n?|\n/);for(let f=0,o=l.length;f<o;++f){let c=l[f];if(n.append(document.createTextNode(c)),f<o-1)n.append(document.createElement("br"))}s.append(n)}else Wb.render({xfaHtml:t,div:s,intent:"richText"});s.firstElementChild.classList.add("richText",a),i.append(s)}function DF(t){let e=new Path2D;if(!t)return e;for(let a=0,i=t.length;a<i;)switch(t[a++]){case s9.moveTo:e.moveTo(t[a++],t[a++]);break;case s9.lineTo:e.lineTo(t[a++],t[a++]);break;case s9.curveTo:e.bezierCurveTo(t[a++],t[a++],t[a++],t[a++],t[a++],t[a++]);break;case s9.quadraticCurveTo:e.quadraticCurveTo(t[a++],t[a++],t[a++],t[a++]);break;case s9.closePath:e.closePath();break;default:de(`Unrecognized drawing path operator: ${t[a-1]}`);break}return e}class o9{#t=null;#e=null;#a;#i=null;#s=null;#l=null;#n=null;#f=null;static#o=null;constructor(t){this.#a=t,o9.#o||=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 t=this.#t=document.createElement("div");t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");let e=this.#a._uiManager._signal;if(e instanceof AbortSignal&&!e.aborted)t.addEventListener("contextmenu",Nn,{signal:e}),t.addEventListener("pointerdown",o9.#r,{signal:e});let a=this.#i=document.createElement("div");a.className="buttons",t.append(a);let i=this.#a.toolbarPosition;if(i){let{style:s}=t,n=this.#a._uiManager.direction==="ltr"?1-i[0]:i[0];s.insetInlineEnd=`${100*n}%`,s.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return t}get div(){return this.#t}static#r(t){t.stopPropagation()}#u(t){this.#a._focusEventsAllowed=!1,Ia(t)}#c(t){this.#a._focusEventsAllowed=!0,Ia(t)}#g(t){let e=this.#a._uiManager._signal;if(!(e instanceof AbortSignal)||e.aborted)return!1;return t.addEventListener("focusin",this.#u.bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",this.#c.bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",Nn,{signal:e}),!0}hide(){this.#t.classList.add("hidden"),this.#e?.hideDropdown()}show(){this.#t.classList.remove("hidden"),this.#s?.shown(),this.#l?.shown()}addDeleteButton(){let{editorType:t,_uiManager:e}=this.#a,a=document.createElement("button");if(a.classList.add("basic","deleteButton"),a.tabIndex=0,a.setAttribute("data-l10n-id",o9.#o[t]),this.#g(a))a.addEventListener("click",(i)=>{e.delete()},{signal:e._signal});this.#i.append(a)}get#p(){let t=document.createElement("div");return t.className="divider",t}async addAltText(t){let e=await t.render();this.#g(e),this.#i.append(e,this.#p),this.#s=t}addComment(t,e=null){if(this.#l)return;let a=t.renderForToolbar();if(!a)return;this.#g(a);let i=this.#n=this.#p;if(!e)this.#i.append(a,i);else this.#i.insertBefore(a,e),this.#i.insertBefore(i,e);this.#l=t,t.toolbar=this}addColorPicker(t){if(this.#e)return;this.#e=t;let e=t.renderButton();this.#g(e),this.#i.append(e,this.#p)}async addEditSignatureButton(t){let e=this.#f=await t.renderEditButton(this.#a);this.#g(e),this.#i.append(e,this.#p)}removeButton(t){switch(t){case"comment":this.#l?.removeToolbarCommentButton(),this.#l=null,this.#n?.remove(),this.#n=null;break}}async addButton(t,e){switch(t){case"colorPicker":if(e)this.addColorPicker(e);break;case"altText":if(e)await this.addAltText(e);break;case"editSignature":if(e)await this.addEditSignatureButton(e);break;case"delete":this.addDeleteButton();break;case"comment":if(e)this.addComment(e);break}}async addButtonBefore(t,e,a){if(!e&&t==="comment")return;let i=this.#i.querySelector(a);if(!i)return;if(t==="comment")this.addComment(e,i)}updateEditSignatureButton(t){if(this.#f)this.#f.title=t}remove(){this.#t.remove(),this.#e?.destroy(),this.#e=null}}class TF{#t=null;#e=null;#a;constructor(t){this.#a=t}#i(){let t=this.#e=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar");let e=this.#a._signal;if(e instanceof AbortSignal&&!e.aborted)t.addEventListener("contextmenu",Nn,{signal:e});let a=this.#t=document.createElement("div");if(a.className="buttons",t.append(a),this.#a.hasCommentManager())this.#l("commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{this.#a.commentSelection("floating_button")});return this.#l("highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{this.#a.highlightSelection("floating_button")}),t}#s(t,e){let a=0,i=0;for(let s of t){let n=s.y+s.height;if(n<a)continue;let l=s.x+(e?s.width:0);if(n>a){i=l,a=n;continue}if(e){if(l>i)i=l}else if(l<i)i=l}return[e?1-i:i,a]}show(t,e,a){let[i,s]=this.#s(e,a),{style:n}=this.#e||=this.#i();t.append(this.#e),n.insetInlineEnd=`${100*i}%`,n.top=`calc(${100*s}% + var(--editor-toolbar-vert-offset))`}hide(){this.#e.remove()}#l(t,e,a,i){let s=document.createElement("button");s.classList.add("basic",t),s.tabIndex=0,s.setAttribute("data-l10n-id",e);let n=document.createElement("span");s.append(n),n.className="visuallyHidden",n.setAttribute("data-l10n-id",a);let l=this.#a._signal;if(l instanceof AbortSignal&&!l.aborted)s.addEventListener("contextmenu",Nn,{signal:l}),s.addEventListener("click",i,{signal:l});this.#t.append(s)}}var wV="068f09d6-5b37-4f77-a97a-f8ff4f253b68",Nb=Object.freeze({internal:wV});function RF(t,e,a){for(let i of a)e.addEventListener(i,t[i].bind(t))}class We{static#t=NaN;static#e=null;static#a=NaN;static#i=null;static initializeAndAddPointerId(t){(We.#e||=new Set).add(t)}static setPointer(t,e){We.#t||=e,We.#i??=t}static setTimeStamp(t){We.#a=t}static isSamePointerId(t){return We.#t===t}static isSamePointerIdOrRemove(t){if(We.#t===t)return!0;return We.#e?.delete(t),!1}static isSamePointerType(t){return We.#i===t}static isInitializedAndDifferentPointerType(t){return We.#i!==null&&!We.isSamePointerType(t)}static isSameTimeStamp(t){return We.#a===t}static isUsingMultiplePointers(){return We.#e?.size>=1}static clearPointerType(){We.#i=null}static clearPointerIds(){We.#t=NaN,We.#e=null}static clearTimeStamp(){We.#a=NaN}}class NF{#t=0;get id(){return`pdfjs_internal_editor_${this.#t++}`}}class ep{#t=BF();#e=0;#a=null;static get _isSVGFittingCanvas(){let a=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),i=new Image;i.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 s=i.decode().then(()=>{return a.drawImage(i,0,0,1,1,0,0,1,3),new Uint32Array(a.getImageData(0,0,1,1).data.buffer)[0]===0});return be(this,"_isSVGFittingCanvas",s)}async#i(t,e){this.#a||=new Map;let a=this.#a.get(t);if(a===null)return null;if(a?.bitmap)return a.refCounter+=1,a;try{a||={bitmap:null,id:`image_${this.#t}_${this.#e++}`,refCounter:0,isSvg:!1};let i;if(typeof e==="string")a.url=e,i=await Pb(e,"blob");else if(e instanceof File)i=a.file=e;else if(e instanceof Blob)i=e;if(i.type==="image/svg+xml"){let s=ep._isSVGFittingCanvas,n=new FileReader,l=new Image,f=new Promise((o,c)=>{l.onload=()=>{a.bitmap=l,a.isSvg=!0,o()},n.onload=async()=>{let u=a.svgUrl=n.result;l.src=await s?`${u}#svgView(preserveAspectRatio(none))`:u},l.onerror=n.onerror=c});n.readAsDataURL(i),await f}else a.bitmap=await createImageBitmap(i);a.refCounter=1}catch(i){de(i),a=null}if(this.#a.set(t,a),a)this.#a.set(a.id,a);return a}async getFromFile(t){let{lastModified:e,name:a,size:i,type:s}=t;return this.#i(`${e}_${a}_${i}_${s}`,t)}async getFromUrl(t){return this.#i(t,t)}async getFromBlob(t,e){let a=await e;return this.#i(t,a)}async getFromId(t){this.#a||=new Map;let e=this.#a.get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){let{blobPromise:a}=e;return delete e.blobPromise,this.getFromBlob(e.id,a)}return this.getFromUrl(e.url)}getFromCanvas(t,e){this.#a||=new Map;let a=this.#a.get(t);if(a?.bitmap)return a.refCounter+=1,a;let i=new OffscreenCanvas(e.width,e.height);return i.getContext("2d").drawImage(e,0,0),a={bitmap:i.transferToImageBitmap(),id:`image_${this.#t}_${this.#e++}`,refCounter:1,isSvg:!1},this.#a.set(t,a),this.#a.set(a.id,a),a}getSvgUrl(t){let e=this.#a.get(t);if(!e?.isSvg)return null;return e.svgUrl}deleteId(t){this.#a||=new Map;let e=this.#a.get(t);if(!e)return;if(e.refCounter-=1,e.refCounter!==0)return;let{bitmap:a}=e;if(!e.url&&!e.file){let i=new OffscreenCanvas(a.width,a.height);i.getContext("bitmaprenderer").transferFromImageBitmap(a),e.blobPromise=i.convertToBlob()}a.close?.(),e.bitmap=null}isValidId(t){return t.startsWith(`image_${this.#t}_`)}}class zF{#t=[];#e=!1;#a;#i=-1;constructor(t=128){this.#a=t}add({cmd:t,undo:e,post:a,mustExec:i,type:s=NaN,overwriteIfSameType:n=!1,keepUndo:l=!1}){if(i)t();if(this.#e)return;let f={cmd:t,undo:e,post:a,type:s};if(this.#i===-1){if(this.#t.length>0)this.#t.length=0;this.#i=0,this.#t.push(f);return}if(n&&this.#t[this.#i].type===s){if(l)f.undo=this.#t[this.#i].undo;this.#t[this.#i]=f;return}let o=this.#i+1;if(o===this.#a)this.#t.splice(0,1);else if(this.#i=o,o<this.#t.length)this.#t.splice(o);this.#t.push(f)}undo(){if(this.#i===-1)return;this.#e=!0;let{undo:t,post:e}=this.#t[this.#i];t(),e?.(),this.#e=!1,this.#i-=1}redo(){if(this.#i<this.#t.length-1){this.#i+=1,this.#e=!0;let{cmd:t,post:e}=this.#t[this.#i];t(),e?.(),this.#e=!1}}hasSomethingToUndo(){return this.#i!==-1}hasSomethingToRedo(){return this.#i<this.#t.length-1}cleanType(t){if(this.#i===-1)return;for(let e=this.#i;e>=0;e--)if(this.#t[e].type!==t){this.#t.splice(e+1,this.#i-e),this.#i=e;return}this.#t.length=0,this.#i=-1}destroy(){this.#t=null}}class fn{static ALT=1;static CTRL=2;static META=4;static SHIFT=8;constructor(t){this.callbacks=new Map;let{isMac:e}=ha.platform;for(let[a,i,s={}]of t){let n=a.some((l)=>l.startsWith("mac+"));for(let l of a){let f=l;if(n){let u=l.startsWith("mac+");if(e!==u)continue;if(u)f=l.slice(4)}let[o,c]=fn.#t(f);if(o===null)continue;this.callbacks.getOrInsertComputed(o,w9).push({callback:i,options:s,modifiers:c})}}}static#t(t){let e=null,a=0;for(let i of t.split("+")){if(i=i.trim(),!i)continue;let s=i.toUpperCase(),n=fn[s];if(n){a|=n;continue}if(e!==null){de(`KeyboardManager: multiple keys in shortcut "${t}"`);break}e=s==="SPACE"?" ":i}if(e===null)de(`KeyboardManager: no key found in shortcut "${t}"`);return[e,a]}static#e(t){let e=/^(?:Key([A-Z])|(?:Digit|Numpad)(\d))$/.exec(t);if(!e)return null;return e[1]?.toLowerCase()??e[2]}exec(t,e){let a=this.callbacks.get(e.key);if(!a){if(/^[a-z]$/i.test(e.key))return;let c=fn.#e(e.code);if(c===null||c===e.key)return;if(a=this.callbacks.get(c),!a)return}let i=(e.altKey?fn.ALT:0)|(e.ctrlKey?fn.CTRL:0)|(e.metaKey?fn.META:0)|(e.shiftKey?fn.SHIFT:0),s=a.find((c)=>c.modifiers===i);if(!s)return;let{callback:n,options:{bubbles:l=!1,args:f=[],checker:o=null}}=s;if(o&&!o(t,e))return;if(n.bind(t,...f,e)(),!l)Ia(e)}}class ap{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){let t=new Map([["CanvasText",null],["Canvas",null]]);return gV(t),be(this,"_colors",t)}convert(t){let e=q9(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(let[a,i]of this._colors)if(i.every((s,n)=>s===e[n]))return ap._colorsMapping.get(a);return e}getHexCode(t){let e=this._colors.get(t);if(!e)return t;return Nt.makeHexColor(...e)}}class Tl{#t=new AbortController;#e=null;#a=null;#i=new Map;#s=new Map;#l=null;#n=null;#f=null;#o=null;#r=new zF;#u=null;#c=null;#g=null;#p=0;#b=new Set;#h=null;#m=null;#j=new Set;_editorUndoBar=null;#d=!1;#w=!1;#S=!1;#y=null;#q=null;#k=null;#v=null;#_=!1;#B=null;#O=new NF;#F=!1;#D=!1;#T=!1;#M=null;#R=null;#z=null;#x=null;#L=null;#C=je.NONE;#A=new Set;#N=null;#I=null;#X=null;#Q=null;#Y=null;#J={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#E=[0,0];#K=null;#V=null;#P=null;#tt=null;#U=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let t=Tl.prototype,e=(n)=>n.#V.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&n.hasSomethingToControl(),a=(n,{target:l})=>{if(l instanceof HTMLInputElement){let{type:f}=l;return f!=="text"&&f!=="number"}return!0},i=this.TRANSLATE_SMALL,s=this.TRANSLATE_BIG;return be(this,"_keyboardManager",new fn([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:a}],[["ctrl+z","mac+meta+z"],t.undo,{checker:a}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:a}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:a}],[["Enter"],t.addNewEditorFromKeyboard,{checker:(n,{target:l})=>!(l instanceof HTMLButtonElement)&&n.#V.contains(l)&&!n.isEnterHandled}],[["Space"],t.addNewEditorFromKeyboard,{checker:(n,{target:l})=>!(l instanceof HTMLButtonElement)&&n.#V.contains(document.activeElement)}],[["Escape"],t.unselectAll],[["ArrowLeft"],t.translateSelectedEditors,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:e}],[["ArrowRight"],t.translateSelectedEditors,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:e}],[["ArrowUp"],t.translateSelectedEditors,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:e}],[["ArrowDown"],t.translateSelectedEditors,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:e}]]))}constructor(t,e,a,i,s,n,l,f,o,c,u,m,p,w,d,v){let k=this._signal=this.#t.signal;this.#V=t,this.#P=e,this.#tt=a,this.#n=i,this.#u=s,this.#I=n,this.#Y=f,this._eventBus=l;let y={signal:k,...Nb};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",(B)=>this.updateParams(B.type,B.value),y),window.addEventListener("pointerdown",()=>{this.#D=!0},{capture:!0,signal:k}),window.addEventListener("pointerup",()=>{this.#D=!1},{capture:!0,signal:k}),window.addEventListener("beforeunload",this.#nt.bind(this),{capture:!0,signal:k}),this.#rt(),this.#gt(),this.#at(),this.#f=f.annotationStorage,this.#y=f.filterFactory,this.#X=o,this.#v=c||null,this.#d=u,this.#w=m,this.#S=p,this.#L=w||null,this.viewParameters={realScale:rr.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=d||null,this._supportsPinchToZoom=v!==!1,s?.setSidebarUiManager(this)}destroy(){this.#U?.resolve(),this.#U=null,this.#t?.abort(),this.#t=null,this._signal=null;for(let t of this.#s.values())t.destroy();if(this.#s.clear(),this.#i.clear(),this.#j.clear(),this.#x?.clear(),this.#e=null,this.#A.clear(),this.#r.destroy(),this.#n?.destroy(),this.#u?.destroy(),this.#I?.destroy(),this.#B?.hide(),this.#B=null,this.#z?.destroy(),this.#z=null,this.#a=null,this.#q)clearTimeout(this.#q),this.#q=null;if(this.#K)clearTimeout(this.#K),this.#K=null;this._editorUndoBar?.destroy(),this.#Y=null}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return this.#L}get useNewAltTextFlow(){return this.#w}get useNewAltTextWhenAddingImage(){return this.#S}get hcmFilter(){return be(this,"hcmFilter",this.#X?this.#y.addHCMFilter(this.#X.foreground,this.#X.background):"none")}get direction(){return be(this,"direction",getComputedStyle(this.#V).direction)}get _highlightColors(){return be(this,"_highlightColors",this.#v?new Map(this.#v.split(",").map((t)=>{return t=t.split("=").map((e)=>e.trim()),t[1]=t[1].toUpperCase(),t})):null)}get highlightColors(){let{_highlightColors:t}=this;if(!t)return be(this,"highlightColors",null);let e=new Map,a=!!this.#X;for(let[i,s]of t){let n=i.endsWith("_HCM");if(a&&n){e.set(i.replace("_HCM",""),s);continue}if(!a&&!n)e.set(i,s)}return be(this,"highlightColors",e)}get highlightColorNames(){return be(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,(t)=>t.reverse())):null)}getNonHCMColor(t){if(!this._highlightColors)return t;let e=this.highlightColorNames.get(t);return this._highlightColors.get(e)||t}getNonHCMColorName(t){return this.highlightColorNames.get(t)||t}setCurrentDrawingSession(t){if(t)this.unselectAll(),this.disableUserSelect(!0);else this.disableUserSelect(!1);this.#g=t}setMainHighlightColorPicker(t){this.#z=t}editAltText(t,e=!1){this.#n?.editAltText(this,t,e)}hasCommentManager(){return!!this.#u}editComment(t,e,a,i){this.#u?.showDialog(this,t,e,a,i)}selectComment(t,e){this.#s.get(t)?.getEditorByUID(e)?.toggleComment(!0,!0)}updateComment(t){this.#u?.updateComment(t.getData())}updatePopupColor(t){this.#u?.updatePopupColor(t)}removeComment(t){this.#u?.removeComments([t.uid])}deleteComment(t,e){let a=()=>{t.comment=e},i=()=>{this._editorUndoBar?.show(a,"comment"),this.toggleComment(null),t.comment=null};this.addCommands({cmd:i,undo:a,mustExec:!0})}toggleComment(t,e,a=void 0){this.#u?.toggleCommentPopup(t,e,a)}makeCommentColor(t,e){return t&&this.#u?.makeCommentColor(t,e)||null}getCommentDialogElement(){return this.#u?.dialogElement||null}async waitForEditorsRendered(t){if(this.#s.has(t-1))return;let{resolve:e,promise:a}=Promise.withResolvers(),i=(s)=>{if(s.pageNumber===t)this._eventBus.off("editorsrendered",i),e()};this._eventBus.on("editorsrendered",i,Nb),await a}getSignature(t){this.#I?.getSignature({uiManager:this,editor:t})}get signatureManager(){return this.#I}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal,...Nb}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference({name:t,value:e}){switch(t){case"enableNewAltTextWhenAddingImage":this.#S=e;break}}onPageChanging({pageNumber:t}){this.#p=t-1}deletePage(t){for(let e of this.getEditors(t))e.remove();if(this.#s.delete(t),this.#p===t)this.#p=0}focusMainContainer(){this.#V.focus()}findParent(t,e){for(let a of this.#s.values()){let{x:i,y:s,width:n,height:l}=a.div.getBoundingClientRect();if(t>=i&&t<=i+n&&e>=s&&e<=s+l)return a}return null}disableUserSelect(t=!1){this.#P.classList.toggle("noUserSelect",t)}addShouldRescale(t){this.#j.add(t)}removeShouldRescale(t){this.#j.delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*rr.PDF_TO_CSS_UNITS;for(let e of this.#j)e.onScaleChanging();this.#g?.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}#W({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t}#et(t){let{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(let a of this.#s.values())if(a.hasTextLayer(t))return a;return null}highlightSelection(t="",e=!1){let a=document.getSelection();if(!a||a.isCollapsed)return;let{anchorNode:i,anchorOffset:s,focusNode:n,focusOffset:l}=a,f=a.toString(),c=this.#W(a).closest(".textLayer"),u=this.getSelectionBoxes(c);if(!u)return;a.empty();let m=this.#et(c),p=this.#C===je.NONE,w=()=>{let d=m?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:u,anchorNode:i,anchorOffset:s,focusNode:n,focusOffset:l,text:f});if(p)this.showAllEditors("highlight",!0,!0);if(e)d?.editComment()};if(p){this.switchToMode(je.HIGHLIGHT,w);return}w()}commentSelection(t=""){this.highlightSelection(t,!0)}#nt(t){this.commitOrRemove(),this.currentLayer?.endDrawingSession(!1)}#lt(){let t=document.getSelection();if(!t||t.isCollapsed)return;let a=this.#W(t).closest(".textLayer"),i=this.getSelectionBoxes(a);if(!i)return;this.#B||=new TF(this),this.#B.show(a,i,this.direction==="ltr")}getAndRemoveDataFromAnnotationStorage(t){if(!this.#f)return null;let e=`pdfjs_internal_editor_${t}`,a=this.#f.getRawValue(e);if(a)this.#f.remove(e);return a}addToAnnotationStorage(t){if(!t.isEmpty()&&this.#f&&!this.#f.has(t.id))this.#f.setValue(t.id,t)}a11yAlert(t,e=null){let a=this.#tt;if(!a)return;if(a.setAttribute("data-l10n-id",t),e)a.setAttribute("data-l10n-args",JSON.stringify(e));else a.removeAttribute("data-l10n-args")}#ft(){let t=document.getSelection();if(!t||t.isCollapsed){if(this.#N)this.#B?.hide(),this.#N=null,this.#H({hasSelectedText:!1});return}let{anchorNode:e}=t;if(e===this.#N)return;let i=this.#W(t).closest(".textLayer");if(!i){if(this.#N)this.#B?.hide(),this.#N=null,this.#H({hasSelectedText:!1});return}if(this.#B?.hide(),this.#N=e,this.#H({hasSelectedText:!0}),this.#C!==je.HIGHLIGHT&&this.#C!==je.NONE)return;if(this.#C===je.HIGHLIGHT)this.showAllEditors("highlight",!0,!0);if(this.#_=this.isShiftKeyDown,!this.isShiftKeyDown){let s=this.#C===je.HIGHLIGHT?this.#et(i):null;if(s?.toggleDrawing(),this.#D){let n=new AbortController,l=this.combinedSignal(n),f=(o)=>{if(o.type==="pointerup"&&o.button!==0)return;if(n.abort(),s?.toggleDrawing(!0),o.type==="pointerup")this.#Z("main_toolbar")};window.addEventListener("pointerup",f,{signal:l}),window.addEventListener("blur",f,{signal:l})}else s?.toggleDrawing(!0),this.#Z("main_toolbar")}}#Z(t=""){if(this.#C===je.HIGHLIGHT)this.highlightSelection(t);else if(this.#d)this.#lt()}#rt(){document.addEventListener("selectionchange",this.#ft.bind(this),{signal:this._signal})}#ot(){if(this.#k)return;this.#k=new AbortController;let t=this.combinedSignal(this.#k);window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})}#ht(){this.#k?.abort(),this.#k=null}blur(){if(this.isShiftKeyDown=!1,this.#_)this.#_=!1,this.#Z("main_toolbar");if(!this.hasSelection)return;let{activeElement:t}=document;for(let e of this.#A)if(e.div.contains(t)){this.#R=[e,t],e._focusEventsAllowed=!1;break}}focus(){if(!this.#R)return;let[t,e]=this.#R;this.#R=null,e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}#at(){if(this.#M)return;this.#M=new AbortController;let t=this.combinedSignal(this.#M);window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})}#ct(){this.#M?.abort(),this.#M=null}#ut(){if(this.#c)return;this.#c=new AbortController;let t=this.combinedSignal(this.#c);document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})}#mt(){this.#c?.abort(),this.#c=null}#gt(){let t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}addEditListeners(){this.#at(),this.setEditingState(!0)}removeEditListeners(){this.#ct(),this.setEditingState(!1)}dragOver(t){for(let{type:e}of t.dataTransfer.items)for(let a of this.#m)if(a.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(let e of t.dataTransfer.items)for(let a of this.#m)if(a.isHandlingMimeForPasting(e.type)){a.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){if(t.preventDefault(),this.#e?.commitOrRemove(),!this.hasSelection)return;let e=[];for(let a of this.#A){let i=a.serialize(!0);if(i)e.push(i)}if(e.length===0)return;t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();let{clipboardData:e}=t;for(let s of e.items)for(let n of this.#m)if(n.isHandlingMimeForPasting(s.type)){n.paste(s,this.currentLayer);return}let a=e.getData("application/pdfjs");if(!a)return;try{a=JSON.parse(a)}catch(s){de(`paste: "${s.message}".`);return}if(!Array.isArray(a))return;this.unselectAll();let i=this.currentLayer;try{let s=[];for(let f of a){let o=await i.deserialize(f);if(!o)return;s.push(o)}let n=()=>{for(let f of s)this.#it(f);this.#st(s)},l=()=>{for(let f of s)f.remove()};this.addCommands({cmd:n,undo:l,mustExec:!0})}catch(s){de(`paste: "${s.message}".`)}}keydown(t){if(!this.isShiftKeyDown&&t.key==="Shift")this.isShiftKeyDown=!0;if(this.#C!==je.NONE&&!this.isEditorHandlingKeyboard)Tl._keyboardManager.exec(this,t)}keyup(t){if(this.isShiftKeyDown&&t.key==="Shift"){if(this.isShiftKeyDown=!1,this.#_)this.#_=!1,this.#Z("main_toolbar")}}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu");break}}updatePageIndex(t,e){for(let i of this.getEditors(t))i.pageIndex=e;let a=this.#l.get(t);if(a)if(a.pageIndex=e,this.#s.set(e,a),this.#F)a.enable();else a.disable()}startUpdatePages(){this.#l=new Map(this.#s),this.#s.clear()}endUpdatePages(){this.#l=null}clonePage(t,e){for(let a of this.getEditors(t)){let i=a.serialize(a.mode!==je.HIGHLIGHT);if(!i)continue;i.pageIndex=e,i.id=this.getId(),i.isClone=!0,delete i.popupRef,this.#f.setValue(i.id,i)}}findClonesForPage(t){let e=[],{pageIndex:a}=t;for(let[i,s]of this.#f)if(s.pageIndex===a&&s.isClone)this.#f.remove(i),e.push(t.deserialize(s).then((n)=>{if(n)n.isClone=!0,t.addOrRebuild(n)}));return Promise.all(e)}#H(t){if(Object.entries(t).some(([a,i])=>this.#J[a]!==i)){if(this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(this.#J,t)}),this.#C===je.HIGHLIGHT&&t.hasSelectedEditor===!1)this.#G([[Ce.HIGHLIGHT_FREE,!0]])}}#G(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){if(t)this.#ot(),this.#ut(),this.#H({isEditing:this.#C!==je.NONE,isEmpty:this.#$(),hasSomethingToUndo:this.#r.hasSomethingToUndo(),hasSomethingToRedo:this.#r.hasSomethingToRedo(),hasSelectedEditor:!1});else this.#ht(),this.#mt(),this.#H({isEditing:!1}),this.disableUserSelect(!1)}registerEditorTypes(t){if(this.#m)return;this.#m=t;for(let e of this.#m)this.#G(e.defaultPropertiesToUpdate)}getId(){return this.#O.id}get currentLayer(){return this.#s.get(this.#p)}getLayer(t){return this.#s.get(t)}get currentPageIndex(){return this.#p}addLayer(t){if(this.#s.set(t.pageIndex,t),this.#F)t.enable();else t.disable()}removeLayer(t){this.#s.delete(t.pageIndex)}async updateMode(t,e=null,a=!1,i=!1,s=!1,n=!1){if(this.#C===t)return;if(this.#U){if(await this.#U.promise,!this.#U)return}if(this.#U=Promise.withResolvers(),this.#g?.commitOrRemove(),this.#C===je.POPUP)this.#u?.hideSidebar();if(this.#u?.destroyPopup(),this.#C=t,t===je.NONE){this.setEditingState(!1),this.#pt();for(let l of this.#i.values())l.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),this.#U.resolve();return}for(let l of this.#i.values())l.addStandaloneCommentButton();if(t===je.SIGNATURE)await this.#I?.loadSignatures();if(a)We.clearPointerType();this.setEditingState(!0),await this.#bt(),this.unselectAll();for(let l of this.#s.values())l.updateMode(t);if(t===je.POPUP){this.#a||=await this.#Y.getAnnotationsByType(new Set(this.#m.map((o)=>o._editorType)));let l=new Set,f=[];for(let o of this.#i.values()){let{annotationElementId:c,hasComment:u,deleted:m}=o;if(c)l.add(c);if(u&&!m)f.push(o.getData())}for(let o of this.#a){let{id:c,popupRef:u,contentsObj:m}=o;if(u&&m?.str&&!l.has(c)&&!this.#b.has(c))f.push(o)}this.#u?.showSidebar(f)}if(!e){if(i)this.addNewEditorFromKeyboard();this.#U.resolve();return}for(let l of this.#i.values())if(l.uid===e)if(this.setSelected(l),n)l.editComment();else if(s)l.enterInEditMode();else l.focus();else l.unselect();this.#U.resolve()}addNewEditorFromKeyboard(){if(this.currentLayer.canCreateNewEmptyEditor())this.currentLayer.addNewEditor()}updateToolbar(t){if(t.mode===this.#C)return;this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){if(!this.#m)return;switch(t){case Ce.CREATE:this.currentLayer.addNewEditor(e);return;case Ce.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#Q||=new Map).set(t,e),this.showAllEditors("highlight",e);break}if(this.hasSelection)for(let a of this.#A)a.updateParams(t,e);else for(let a of this.#m)a.updateDefaultParams(t,e)}showAllEditors(t,e,a=!1){for(let s of this.#i.values())if(s.editorType===t)s.show(e);if((this.#Q?.get(Ce.HIGHLIGHT_SHOW_ALL)??!0)!==e)this.#G([[Ce.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(this.#T===t)return;this.#T=t;for(let e of this.#s.values()){if(t)e.disableClick();else e.enableClick();e.div.classList.toggle("waiting",t)}}async#bt(){if(!this.#F){this.#F=!0;let t=[];for(let e of this.#s.values())t.push(e.enable());await Promise.all(t);for(let e of this.#i.values())e.enable()}}#pt(){if(this.unselectAll(),this.#F){this.#F=!1;for(let t of this.#s.values())t.disable();for(let t of this.#i.values())t.disable()}}*getEditors(t){for(let e of this.#i.values())if(e.pageIndex===t)yield e}getEditor(t){return this.#i.get(t)}addEditor(t){this.#i.set(t.id,t)}removeEditor(t){if(t.div.contains(document.activeElement)){if(this.#q)clearTimeout(this.#q);this.#q=setTimeout(()=>{this.focusMainContainer(),this.#q=null},0)}if(this.#i.delete(t.id),t.annotationElementId)this.#x?.delete(t.annotationElementId);if(this.unselect(t),!t.annotationElementId||!this.#b.has(t.annotationElementId))this.#f?.remove(t.id)}addDeletedAnnotationElement(t){this.#b.add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return this.#b.has(t)}removeDeletedAnnotationElement(t){this.#b.delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}#it(t){let e=this.#s.get(t.pageIndex);if(e)e.addOrRebuild(t);else this.addEditor(t),this.addToAnnotationStorage(t)}setActiveEditor(t){if(this.#e===t)return;if(this.#e=t,t)this.#G(t.propertiesToUpdate)}get#wt(){let t=null;for(t of this.#A);return t}updateUI(t){if(this.#wt===t)this.#G(t.propertiesToUpdate)}updateUIForDefaultProperties(t){this.#G(t.defaultPropertiesToUpdate)}toggleSelected(t){if(this.#A.has(t)){this.#A.delete(t),t.unselect(),this.#H({hasSelectedEditor:this.hasSelection});return}this.#A.add(t),t.select(),this.#G(t.propertiesToUpdate),this.#H({hasSelectedEditor:!0})}setSelected(t){this.updateToolbar({mode:t.mode,editId:t.uid}),this.#g?.commitOrRemove();for(let e of this.#A)if(e!==t)e.unselect();this.#u?.destroyPopup(),this.#A.clear(),this.#A.add(t),t.select(),this.#G(t.propertiesToUpdate),this.#H({hasSelectedEditor:!0})}get firstSelectedEditor(){return this.#A.values().next().value}unselect(t){t.unselect(),this.#A.delete(t),this.#H({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#A.size!==0}get isEnterHandled(){return this.#A.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#r.undo(),this.#H({hasSomethingToUndo:this.#r.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#$()}),this._editorUndoBar?.hide()}redo(){this.#r.redo(),this.#H({hasSomethingToUndo:!0,hasSomethingToRedo:this.#r.hasSomethingToRedo(),isEmpty:this.#$()})}addCommands(t){this.#r.add(t),this.#H({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#$()})}cleanUndoStack(t){this.#r.cleanType(t)}#$(){if(this.#i.size===0)return!0;if(this.#i.size===1)for(let t of this.#i.values())return t.isEmpty();return!1}delete(){this.commitOrRemove();let t=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!t)return;let e=t?[t]:[...this.#A],a=()=>{this._editorUndoBar?.show(i,e.length===1?e[0].editorType:e.length);for(let s of e)s.remove()},i=()=>{for(let s of e)this.#it(s)};this.addCommands({cmd:a,undo:i,mustExec:!0})}commitOrRemove(){this.#e?.commitOrRemove()}hasSomethingToControl(){return this.#e||this.hasSelection}#st(t){for(let e of this.#A)e.unselect();this.#A.clear();for(let e of t){if(e.isEmpty())continue;this.#A.add(e),e.select()}this.#H({hasSelectedEditor:this.hasSelection})}selectAll(){for(let t of this.#A)t.commit();this.#st(this.#i.values())}unselectAll(){if(this.#e){if(this.#e.commitOrRemove(),this.#C!==je.NONE)return}if(this.#g?.commitOrRemove())return;if(this.#u?.destroyPopup(),!this.hasSelection)return;for(let t of this.#A)t.unselect();this.#A.clear(),this.#H({hasSelectedEditor:!1})}translateSelectedEditors(t,e,a=!1){if(!a)this.commitOrRemove();if(!this.hasSelection)return;this.#E[0]+=t,this.#E[1]+=e;let[i,s]=this.#E,n=[...this.#A],l=1000;if(this.#K)clearTimeout(this.#K);this.#K=setTimeout(()=>{this.#K=null,this.#E[0]=this.#E[1]=0,this.addCommands({cmd:()=>{for(let f of n)if(this.#i.has(f.id))f.translateInPage(i,s),f.translationDone()},undo:()=>{for(let f of n)if(this.#i.has(f.id))f.translateInPage(-i,-s),f.translationDone()},mustExec:!1})},l);for(let f of n)f.translateInPage(t,e),f.translationDone()}setUpDragSession(){if(!this.hasSelection)return;this.disableUserSelect(!0),this.#h=new Map;for(let t of this.#A)this.#h.set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}endDragSession(){if(!this.#h)return!1;this.disableUserSelect(!1);let t=this.#h;this.#h=null;let e=!1;for(let[{x:i,y:s,pageIndex:n},l]of t)l.newX=i,l.newY=s,l.newPageIndex=n,e||=i!==l.savedX||s!==l.savedY||n!==l.savedPageIndex;if(!e)return!1;let a=(i,s,n,l)=>{if(this.#i.has(i.id)){let f=this.#s.get(l);if(f)i._setParentAndPosition(f,s,n);else i.pageIndex=l,i.x=s,i.y=n}};return this.addCommands({cmd:()=>{for(let[i,{newX:s,newY:n,newPageIndex:l}]of t)a(i,s,n,l)},undo:()=>{for(let[i,{savedX:s,savedY:n,savedPageIndex:l}]of t)a(i,s,n,l)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(!this.#h)return;for(let a of this.#h.keys())a.drag(t,e)}rebuild(t){if(t.parent===null){let e=this.getLayer(t.pageIndex);if(e)e.changeParent(t),e.addOrRebuild(t);else this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild()}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#A.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return this.#e===t}getActive(){return this.#e}getMode(){return this.#C}isEditingMode(){return this.#C!==je.NONE}get imageManager(){return be(this,"imageManager",new ep)}getSelectionBoxes(t){if(!t)return null;let e=document.getSelection();for(let o=0,c=e.rangeCount;o<c;o++)if(!t.contains(e.getRangeAt(o).commonAncestorContainer))return null;let{x:a,y:i,width:s,height:n}=t.getBoundingClientRect(),l;switch(t.getAttribute("data-main-rotation")){case"90":l=(o,c,u,m)=>({x:(c-i)/n,y:1-(o+u-a)/s,width:m/n,height:u/s});break;case"180":l=(o,c,u,m)=>({x:1-(o+u-a)/s,y:1-(c+m-i)/n,width:u/s,height:m/n});break;case"270":l=(o,c,u,m)=>({x:1-(c+m-i)/n,y:(o-a)/s,width:m/n,height:u/s});break;default:l=(o,c,u,m)=>({x:(o-a)/s,y:(c-i)/n,width:u/s,height:m/n});break}let f=[];for(let o=0,c=e.rangeCount;o<c;o++){let u=e.getRangeAt(o);if(u.collapsed)continue;for(let{x:m,y:p,width:w,height:d}of u.getClientRects()){if(w===0||d===0)continue;f.push(l(m,p,w,d))}}return f.length===0?null:f}addChangedExistingAnnotation({annotationElementId:t,id:e}){(this.#o||=new Map).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){this.#o?.delete(t)}renderAnnotationElement(t){let e=this.#o?.get(t.data.id);if(!e)return;let a=this.#f.getRawValue(e);if(!a)return;if(this.#C===je.NONE&&!a.hasBeenModified)return;a.renderAnnotationElement(t)}setMissingCanvas(t,e,a){let i=this.#x?.get(t);if(!i)return;i.setCanvas(e,a),this.#x.delete(t)}addMissingCanvas(t,e){(this.#x||=new Map).set(t,e)}}class R0{#t=null;#e=!1;#a=null;#i=null;#s=null;#l=null;#n=!1;#f=null;#o=null;#r=null;#u=null;#c=!1;static#g=null;static _l10n=null;constructor(t){this.#o=t,this.#c=t._uiManager.useNewAltTextFlow,R0.#g||=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(t){R0._l10n??=t}async render(){let t=this.#a=document.createElement("button");t.className="altText",t.tabIndex="0";let e=this.#i=document.createElement("span");if(t.append(e),this.#c)t.classList.add("new"),t.setAttribute("data-l10n-id",R0.#g.missing),e.setAttribute("data-l10n-id",R0.#g["missing-label"]);else t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label");let a=this.#o._uiManager._signal;t.addEventListener("contextmenu",Nn,{signal:a}),t.addEventListener("pointerdown",(s)=>s.stopPropagation(),{signal:a});let i=(s)=>{if(s.preventDefault(),this.#o._uiManager.editAltText(this.#o),this.#c)this.#o._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#p}})};return t.addEventListener("click",i,{capture:!0,signal:a}),t.addEventListener("keydown",(s)=>{if(s.target===t&&s.key==="Enter")this.#n=!0,i(s)},{signal:a}),await this.#b(),t}get#p(){return this.#t&&"added"||this.#t===null&&this.guessedText&&"review"||"missing"}finish(){if(!this.#a)return;this.#a.focus({focusVisible:this.#n}),this.#n=!1}isEmpty(){if(this.#c)return this.#t===null;return!this.#t&&!this.#e}hasData(){if(this.#c)return this.#t!==null||!!this.#r;return this.isEmpty()}get guessedText(){return this.#r}async setGuessedText(t){if(this.#t!==null)return;this.#r=t,this.#u=await R0._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t}),this.#b()}toggleAltTextBadge(t=!1){if(!this.#c||this.#t){this.#f?.remove(),this.#f=null;return}if(!this.#f){let e=this.#f=document.createElement("div");e.className="noAltTextBadge",this.#o.div.append(e)}this.#f.classList.toggle("hidden",!t)}serialize(t){let e=this.#t;if(!t&&this.#r===e)e=this.#u;return{altText:e,decorative:this.#e,guessedText:this.#r,textWithDisclaimer:this.#u}}get data(){return{altText:this.#t,decorative:this.#e}}set data({altText:t,decorative:e,guessedText:a,textWithDisclaimer:i,cancel:s=!1}){if(a)this.#r=a,this.#u=i;if(this.#t===t&&this.#e===e)return;if(!s)this.#t=t,this.#e=e;this.#b()}toggle(t=!1){if(!this.#a)return;if(!t&&this.#l)clearTimeout(this.#l),this.#l=null;this.#a.disabled=!t}shown(){this.#o._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#p}})}destroy(){this.#a?.remove(),this.#a=null,this.#i=null,this.#s=null,this.#f?.remove(),this.#f=null}async#b(){let t=this.#a;if(!t)return;if(this.#c){if(t.classList.toggle("done",!!this.#t),t.setAttribute("data-l10n-id",R0.#g[this.#p]),this.#i?.setAttribute("data-l10n-id",R0.#g[`${this.#p}-label`]),!this.#t){this.#s?.remove();return}}else{if(!this.#t&&!this.#e){t.classList.remove("done"),this.#s?.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=this.#s;if(!e){this.#s=e=document.createElement("span"),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${this.#o.id}`;let i=100,s=this.#o._uiManager._signal;s.addEventListener("abort",()=>{clearTimeout(this.#l),this.#l=null},{once:!0}),t.addEventListener("mouseenter",()=>{this.#l=setTimeout(()=>{this.#l=null,this.#s.classList.add("show"),this.#o._reportTelemetry({action:"alt_text_tooltip"})},i)},{signal:s}),t.addEventListener("mouseleave",()=>{if(this.#l)clearTimeout(this.#l),this.#l=null;this.#s?.classList.remove("show")},{signal:s})}if(this.#e)e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip");else e.removeAttribute("data-l10n-id"),e.textContent=this.#t;if(!e.parentNode)t.append(e);this.#o.getElementForAltText()?.setAttribute("aria-describedby",e.id)}}class f9{#t=null;#e=null;#a=!1;#i=null;#s=null;#l=null;#n=null;#f=null;#o=!1;#r=null;constructor(t){this.#i=t}renderForToolbar(){let t=this.#e=document.createElement("button");return t.className="comment",this.#u(t,!1)}renderForStandalone(){let t=this.#t=document.createElement("button");t.className="annotationCommentButton";let e=this.#i.commentButtonPosition;if(e){let{style:a}=t;a.insetInlineEnd=`calc(${100*(this.#i._uiManager.direction==="ltr"?1-e[0]:e[0])}% - var(--comment-button-dim))`,a.top=`calc(${100*e[1]}% - var(--comment-button-dim))`;let i=this.#i.commentButtonColor;if(i)a.backgroundColor=i}return this.#u(t,!0)}focusButton(){setTimeout(()=>{(this.#t??this.#e)?.focus()},0)}onUpdatedColor(){if(!this.#t)return;let t=this.#i.commentButtonColor;if(t)this.#t.style.backgroundColor=t;this.#i._uiManager.updatePopupColor(this.#i)}get commentButtonWidth(){return(this.#t?.getBoundingClientRect().width??0)/this.#i.parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(this.#r)return this.#r;if(!this.#t)return null;let{x:t,y:e,height:a}=this.#t.getBoundingClientRect(),{x:i,y:s,width:n,height:l}=this.#i.parent.boundingClientRect;return[(t-i)/n,(e+a-s)/l]}set commentPopupPositionInLayer(t){this.#r=t}hasDefaultPopupPosition(){return this.#r===null}removeStandaloneCommentButton(){this.#t?.remove(),this.#t=null}removeToolbarCommentButton(){this.#e?.remove(),this.#e=null}setCommentButtonStates({selected:t,hasPopup:e}){if(!this.#t)return;this.#t.classList.toggle("selected",t),this.#t.ariaExpanded=e}#u(t,e){if(!this.#i._uiManager.hasCommentManager())return null;if(t.tabIndex="0",t.ariaHasPopup="dialog",e)t.ariaControls="commentPopup",t.setAttribute("data-l10n-id","pdfjs-show-comment-button");else t.ariaControlsElements=[this.#i._uiManager.getCommentDialogElement()],t.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button");let a=this.#i._uiManager._signal;if(!(a instanceof AbortSignal)||a.aborted)return t;if(t.addEventListener("contextmenu",Nn,{signal:a}),e)t.addEventListener("focusin",(s)=>{this.#i._focusEventsAllowed=!1,Ia(s)},{capture:!0,signal:a}),t.addEventListener("focusout",(s)=>{this.#i._focusEventsAllowed=!0,Ia(s)},{capture:!0,signal:a});t.addEventListener("pointerdown",(s)=>s.stopPropagation(),{signal:a});let i=(s)=>{if(s.preventDefault(),t===this.#e)this.edit();else this.#i.toggleComment(!0)};return t.addEventListener("click",i,{capture:!0,signal:a}),t.addEventListener("keydown",(s)=>{if(s.target===t&&s.key==="Enter")this.#a=!0,i(s)},{signal:a}),t.addEventListener("pointerenter",()=>{this.#i.toggleComment(!1,!0)},{signal:a}),t.addEventListener("pointerleave",()=>{this.#i.toggleComment(!1,!1)},{signal:a}),t}edit(t){let e=this.commentPopupPositionInLayer,a,i;if(e)[a,i]=e;else{[a,i]=this.#i.commentButtonPosition;let{width:c,height:u,x:m,y:p}=this.#i;a=m+a*c,i=p+i*u}let s=this.#i.parent.boundingClientRect,{x:n,y:l,width:f,height:o}=s;this.#i._uiManager.editComment(this.#i,n+a*f,l+i*o,{...t,parentDimensions:s})}finish(){if(!this.#e)return;this.#e.focus({focusVisible:this.#a}),this.#a=!1}isDeleted(){return this.#o||this.#n===""}isEmpty(){return this.#n===null}hasBeenEdited(){return this.isDeleted()||this.#n!==this.#s}serialize(){return this.data}get data(){return{text:this.#n,richText:this.#l,date:this.#f,deleted:this.isDeleted()}}set data(t){if(t!==this.#n)this.#l=null;if(t===null){this.#n="",this.#o=!0;return}this.#n=t,this.#f=new Date,this.#o=!1}restoreData({text:t,richText:e,date:a}){this.#n=t,this.#l=e,this.#f=a,this.#o=!1}setInitialText(t,e=null){this.#s=t,this.data=t,this.#f=null,this.#l=e}shown(){}destroy(){this.#e?.remove(),this.#e=null,this.#t?.remove(),this.#t=null,this.#n="",this.#l=null,this.#f=null,this.#i=null,this.#a=!1,this.#o=!1}}class o6{#t;#e=!1;#a=null;#i;#s;#l;#n;#f=null;#o;#r=null;#u;#c=null;constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:a=null,onPinchStart:i=null,onPinching:s=null,onPinchEnd:n=null,signal:l}){this.#t=t,this.#a=a,this.#i=e,this.#s=i,this.#l=s,this.#n=n,this.#u=new AbortController,this.#o=AbortSignal.any([l,this.#u.signal]),t.addEventListener("touchstart",this.#g.bind(this),{passive:!1,signal:this.#o})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/N0.pixelRatio}#g(t){if(this.#i?.())return;if(t.touches.length===1){if(this.#f)return;let i=this.#f=new AbortController,s=AbortSignal.any([this.#o,i.signal]),n=this.#t,l={capture:!0,signal:s,passive:!1},f=(o)=>{if(o.pointerType==="touch")this.#f?.abort(),this.#f=null};n.addEventListener("pointerdown",(o)=>{if(o.pointerType==="touch")Ia(o),f(o)},l),n.addEventListener("pointerup",f,l),n.addEventListener("pointercancel",f,l);return}if(!this.#c){this.#c=new AbortController;let i=AbortSignal.any([this.#o,this.#c.signal]),s=this.#t,n={signal:i,capture:!1,passive:!1};s.addEventListener("touchmove",this.#p.bind(this),n);let l=this.#b.bind(this);s.addEventListener("touchend",l,n),s.addEventListener("touchcancel",l,n),n.capture=!0,s.addEventListener("pointerdown",Ia,n),s.addEventListener("pointermove",Ia,n),s.addEventListener("pointercancel",Ia,n),s.addEventListener("pointerup",Ia,n),this.#s?.()}if(Ia(t),t.touches.length!==2||this.#a?.()){this.#r=null;return}let[e,a]=t.touches;if(e.identifier>a.identifier)[e,a]=[a,e];this.#r={touch0X:e.screenX,touch0Y:e.screenY,touch1X:a.screenX,touch1Y:a.screenY}}#p(t){if(!this.#r||t.touches.length!==2)return;Ia(t);let[e,a]=t.touches;if(e.identifier>a.identifier)[e,a]=[a,e];let{screenX:i,screenY:s}=e,{screenX:n,screenY:l}=a,f=this.#r,{touch0X:o,touch0Y:c,touch1X:u,touch1Y:m}=f,p=u-o,w=m-c,d=n-i,v=l-s,k=Math.hypot(d,v)||1,y=Math.hypot(p,w)||1;if(!this.#e&&Math.abs(y-k)<=o6.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(f.touch0X=i,f.touch0Y=s,f.touch1X=n,f.touch1Y=l,!this.#e){this.#e=!0;return}let B=[(i+n)/2,(s+l)/2];this.#l?.(B,y,k)}#b(t){if(t.touches.length>=2)return;if(this.#c)this.#c.abort(),this.#c=null,this.#n?.();if(!this.#r)return;Ia(t),this.#r=null,this.#e=!1}destroy(){this.#u?.abort(),this.#u=null,this.#f?.abort(),this.#f=null}}class se{#t=null;#e=null;#a=null;#i=null;#s=null;#l=!1;#n=null;#f="";#o=null;#r=null;#u=null;#c=null;#g=null;#p="";#b=!1;#h=null;#m=!1;#j=!1;#d=!1;#w=null;#S=0;#y=0;#q=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;#v=!1;#_=se._zIndex++;static _borderLineWidth=-1;static _colorManager=new ap;static _zIndex=1;static _telemetryTimeout=1000;static get _resizerKeyboardManager(){let t=se.prototype._resizeWithKeyboard,e=Tl.TRANSLATE_SMALL,a=Tl.TRANSLATE_BIG;return be(this,"_resizerKeyboardManager",new fn([[["ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-a,0]}],[["ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[a,0]}],[["ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-a]}],[["ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,a]}],[["Escape"],se.prototype._stopResizingWithKeyboard]]))}constructor(t){this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null,this.annotationElementId=t.annotationElementId||null,this.creationDate=t.creationDate||new Date,this.modificationDate=t.modificationDate||null,this.canAddComment=!0;let{rotation:e,rawDims:{pageWidth:a,pageHeight:i,pageX:s,pageY:n}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[a,i],this.pageTranslation=[s,n];let[l,f]=this.parentDimensions;this.x=t.x/l,this.y=t.y/f,this.isAttachedToDOM=!1,this.deleted=!1}updatePageIndex(t){this.pageIndex=t}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 be(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){let e=new EF({id:t._uiManager.getId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(se._l10n??=t,se._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"}),se._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"}),se._borderLineWidth!==-1)return;let a=getComputedStyle(document.documentElement);se._borderLineWidth=parseFloat(a.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){Qe("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#v}set _isDraggable(t){this.#v=t,this.div?.classList.toggle("draggable",t)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){let[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(t*2),this.y+=this.width*t/(e*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(t*2),this.y-=this.width*t/(e*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#_}setParent(t){if(t!==null)this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions;else this.#E(),this.#c?.remove(),this.#c=null;this.parent=t}focusin(t){if(!this._focusEventsAllowed)return;if(!this.#b)this.parent.setSelected(this);else this.#b=!1}focusout(t){if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;if(t.relatedTarget?.closest(`#${this.id}`))return;if(t.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(t,e,a,i){let[s,n]=this.parentDimensions;[a,i]=this.screenToPageTranslation(a,i),this.x=(t+a)/s,this.y=(e+i)/n,this.fixAndSetPosition()}_moveAfterPaste(t,e){if(this.isClone){delete this.isClone;return}let[a,i]=this.parentDimensions;this.setAt(t*a,e*i,this.width*a,this.height*i),this._onTranslated()}#B([t,e],a,i){[a,i]=this.screenToPageTranslation(a,i),this.x+=a/t,this.y+=i/e,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(t,e){this.#B(this.parentDimensions,t,e)}translateInPage(t,e){this.#h||=[this.x,this.y,this.width,this.height],this.#B(this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){this.#h||=[this.x,this.y,this.width,this.height];let{div:a,parentDimensions:[i,s]}=this;if(this.x+=t/i,this.y+=e/s,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:u,y:m}=this.div.getBoundingClientRect();if(this.parent.findNewParent(this,u,m))this.x-=Math.floor(this.x),this.y-=Math.floor(this.y)}let{x:n,y:l}=this,[f,o]=this.getBaseTranslation();n+=f,l+=o;let{style:c}=a;c.left=`${(100*n).toFixed(2)}%`,c.top=`${(100*l).toFixed(2)}%`,this._onTranslating(n,l),a.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!this.#h&&(this.#h[0]!==this.x||this.#h[1]!==this.y)}get _hasBeenResized(){return!!this.#h&&(this.#h[2]!==this.width||this.#h[3]!==this.height)}getBaseTranslation(){let[t,e]=this.parentDimensions,{_borderLineWidth:a}=se,i=a/t,s=a/e;switch(this.rotation){case 90:return[-i,s];case 180:return[i,s];case 270:return[i,-s];default:return[-i,-s]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){let{div:{style:e},pageDimensions:[a,i]}=this,{x:s,y:n,width:l,height:f}=this;if(l*=a,f*=i,s*=a,n*=i,this._mustFixPosition)switch(t){case 0:s=_a(s,0,a-l),n=_a(n,0,i-f);break;case 90:s=_a(s,0,a-f),n=_a(n,l,i);break;case 180:s=_a(s,l,a),n=_a(n,f,i);break;case 270:s=_a(s,f,a),n=_a(n,0,i-l);break}this.x=s/=a,this.y=n/=i;let[o,c]=this.getBaseTranslation();s+=o,n+=c,e.left=`${(100*s).toFixed(2)}%`,e.top=`${(100*n).toFixed(2)}%`,this.moveInDOM()}static#O(t,e,a){switch(a){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}screenToPageTranslation(t,e){return se.#O(t,e,this.parentRotation)}pageTranslationToScreen(t,e){return se.#O(t,e,360-this.parentRotation)}#F(t){switch(t){case 90:{let[e,a]=this.pageDimensions;return[0,-e/a,a/e,0]}case 180:return[-1,0,0,-1];case 270:{let[e,a]=this.pageDimensions;return[0,e/a,-a/e,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:t,pageDimensions:[e,a]}=this;return[e*t,a*t]}setDims(){let{div:{style:t},width:e,height:a}=this;t.width=`${(100*e).toFixed(2)}%`,t.height=`${(100*a).toFixed(2)}%`}getInitialTranslation(){return[0,0]}#D(){if(this.#o)return;this.#o=document.createElement("div"),this.#o.classList.add("resizers");let t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(let a of t){let i=document.createElement("div");this.#o.append(i),i.classList.add("resizer",a),i.setAttribute("data-resizer-name",a),i.addEventListener("pointerdown",this.#T.bind(this,a),{signal:e}),i.addEventListener("contextmenu",Nn,{signal:e}),i.tabIndex=-1}this.div.prepend(this.#o)}#T(t,e){e.preventDefault();let{isMac:a}=ha.platform;if(e.button!==0||e.ctrlKey&&a)return;this.#a?.toggle(!1);let i=this._isDraggable;this._isDraggable=!1,this.#r=[e.screenX,e.screenY];let s=new AbortController,n=this._uiManager.combinedSignal(s);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#z.bind(this,t),{passive:!0,capture:!0,signal:n}),window.addEventListener("touchmove",Ia,{passive:!1,signal:n}),window.addEventListener("contextmenu",Nn,{signal:n}),this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let l=this.parent.div.style.cursor,f=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;let o=()=>{s.abort(),this.parent.togglePointerEvents(!0),this.#a?.toggle(!0),this._isDraggable=i,this.parent.div.style.cursor=l,this.div.style.cursor=f,this.#R()};window.addEventListener("pointerup",o,{signal:n}),window.addEventListener("blur",o,{signal:n})}#M(t,e,a,i){this.width=a,this.height=i,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()}_onResized(){}#R(){if(!this.#u)return;let{savedX:t,savedY:e,savedWidth:a,savedHeight:i}=this.#u;this.#u=null;let s=this.x,n=this.y,l=this.width,f=this.height;if(s===t&&n===e&&l===a&&f===i)return;this.addCommands({cmd:this.#M.bind(this,s,n,l,f),undo:this.#M.bind(this,t,e,a,i),mustExec:!0})}static _round(t){return Math.round(t*1e4)/1e4}#z(t,e){let[a,i]=this.parentDimensions,s=this.x,n=this.y,l=this.width,f=this.height,o=se.MIN_SIZE/a,c=se.MIN_SIZE/i,u=this.#F(this.rotation),m=(Y,W)=>[u[0]*Y+u[2]*W,u[1]*Y+u[3]*W],p=this.#F(360-this.rotation),w=(Y,W)=>[p[0]*Y+p[2]*W,p[1]*Y+p[3]*W],d,v,k=!1,y=!1;switch(t){case"topLeft":k=!0,d=(Y,W)=>[0,0],v=(Y,W)=>[Y,W];break;case"topMiddle":d=(Y,W)=>[Y/2,0],v=(Y,W)=>[Y/2,W];break;case"topRight":k=!0,d=(Y,W)=>[Y,0],v=(Y,W)=>[0,W];break;case"middleRight":y=!0,d=(Y,W)=>[Y,W/2],v=(Y,W)=>[0,W/2];break;case"bottomRight":k=!0,d=(Y,W)=>[Y,W],v=(Y,W)=>[0,0];break;case"bottomMiddle":d=(Y,W)=>[Y/2,W],v=(Y,W)=>[Y/2,0];break;case"bottomLeft":k=!0,d=(Y,W)=>[0,W],v=(Y,W)=>[Y,0];break;case"middleLeft":y=!0,d=(Y,W)=>[0,W/2],v=(Y,W)=>[Y,W/2];break}let B=d(l,f),H=v(l,f),M=m(...H),D=se._round(s+M[0]),T=se._round(n+M[1]),z=1,E=1,V,tt;if(!e.fromKeyboard){let{screenX:Y,screenY:W}=e,[ft,nt]=this.#r;[V,tt]=this.screenToPageTranslation(Y-ft,W-nt),this.#r[0]=Y,this.#r[1]=W}else({deltaX:V,deltaY:tt}=e);if([V,tt]=w(V/a,tt/i),k){let Y=Math.hypot(l,f);z=E=Math.max(Math.min(Math.hypot(H[0]-B[0]-V,H[1]-B[1]-tt)/Y,1/l,1/f),o/l,c/f)}else if(y)z=_a(Math.abs(H[0]-B[0]-V),o,1)/l;else E=_a(Math.abs(H[1]-B[1]-tt),c,1)/f;let at=se._round(l*z),Q=se._round(f*E);M=m(...v(at,Q));let Z=D-M[0],J=T-M[1];this.#h||=[this.x,this.y,this.width,this.height],this.width=at,this.height=Q,this.x=Z,this.y=J,this.setDims(),this.fixAndSetPosition(),this._onResizing()}_onResizing(){}altTextFinish(){this.#a?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||this.#j)return this._editToolbar;this._editToolbar=new o9(this),this.div.append(this._editToolbar.render());let{toolbarButtons:t}=this;if(t)for(let[e,a]of t)await this._editToolbar.addButton(e,a);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.#a?.destroy()}addContainer(t){let e=this._editToolbar?.div;if(e)e.before(t);else this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){if(!this.#a){if(R0.initialize(se._l10n),this.#a=new R0(this),this.#t)this.#a.data=this.#t,this.#t=null}return this.#a}get altTextData(){return this.#a?.data}set altTextData(t){if(!this.#a)return;this.#a.data=t}get guessedAltText(){return this.#a?.guessedText}async setGuessedAltText(t){await this.#a?.setGuessedText(t)}serializeAltText(t){return this.#a?.serialize(t)}hasAltText(){return!!this.#a&&!this.#a.isEmpty()}hasAltTextData(){return this.#a?.hasData()??!1}focusCommentButton(){this.#i?.focusButton()}addCommentButton(){return this.canAddComment?this.#i||=new f9(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:t,text:e,date:a,deleted:i}}=this.#i;return{text:e,richText:t,date:a,deleted:i,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(t){if(this.#i||=new f9(this),typeof t==="object"&&t!==null)this.#i.restoreData(t);else this.#i.data=t;if(this.hasComment)this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this);else this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this)}setCommentData({comment:t,popupRef:e,richText:a}){if(!e)return;if(this.#i||=new f9(this),this.#i.setInitialText(t,a),!this.annotationElementId)return;let i=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);if(i)this.updateFromAnnotationLayer(i)}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(t){this.#i||=new f9(this),this.#i.edit(t)}toggleComment(t,e=void 0){if(this.hasComment)this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){this.#i.setSelectedButton(t)}addComment(t){if(this.hasEditedComment){let[,,,i]=t.rect,[s]=this.pageDimensions,[n]=this.pageTranslation,l=n+s+1,f=i-100,o=l+180;t.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[l,f,o,i]}}}updateFromAnnotationLayer({popup:{contents:t,deleted:e}}){this.#i.data=e?null:t}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){let t=this.div=document.createElement("div");if(t.setAttribute("data-editor-rotation",(360-this.rotation)%360),t.className=this.name,t.setAttribute("id",this.id),t.tabIndex=this.#l?-1:0,t.setAttribute("role","application"),this.defaultL10nId)t.setAttribute("data-l10n-id",this.defaultL10nId);if(!this._isVisible)t.classList.add("hidden");this.setInForeground(),this.#I();let[e,a]=this.parentDimensions;if(this.parentRotation%180!==0)t.style.maxWidth=`${(100*a/e).toFixed(2)}%`,t.style.maxHeight=`${(100*e/a).toFixed(2)}%`;let[i,s]=this.getInitialTranslation();if(this.translate(i,s),RF(this,t,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom)this.#k||=new o6({container:t,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#x.bind(this),onPinching:this.#L.bind(this),onPinchEnd:this.#C.bind(this),signal:this._uiManager._signal});return this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),t}#x(){this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#a?.toggle(!1),this.parent.togglePointerEvents(!1)}#L(t,e,a){let s=0.7*(a/e)+1-0.7;if(s===1)return;let n=this.#F(this.rotation),l=(D,T)=>[n[0]*D+n[2]*T,n[1]*D+n[3]*T],[f,o]=this.parentDimensions,c=this.x,u=this.y,m=this.width,p=this.height,w=se.MIN_SIZE/f,d=se.MIN_SIZE/o;s=Math.max(Math.min(s,1/m,1/p),w/m,d/p);let v=se._round(m*s),k=se._round(p*s);if(v===m&&k===p)return;this.#h||=[c,u,m,p];let y=l(m/2,p/2),B=se._round(c+y[0]),H=se._round(u+y[1]),M=l(v/2,k/2);this.x=B-M[0],this.y=H-M[1],this.width=v,this.height=k,this.setDims(),this.fixAndSetPosition(),this._onResizing()}#C(){this.#a?.toggle(!0),this.parent.togglePointerEvents(!0),this.#R()}pointerdown(t){let{isMac:e}=ha.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(this.#b=!0,this._isDraggable){this.#N(t);return}this.#A(t)}#A(t){let{isMac:e}=ha.platform;if(t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e)this.parent.toggleSelected(this);else this.parent.setSelected(this)}#N(t){let{isSelected:e}=this;this._uiManager.setUpDragSession();let a=!1,i=new AbortController,s=this._uiManager.combinedSignal(i),n={capture:!0,passive:!1,signal:s},l=(o)=>{if(i.abort(),this.#n=null,this.#b=!1,!this._uiManager.endDragSession())this.#A(o);if(a)this._onStopDragging()};if(e)this.#S=t.clientX,this.#y=t.clientY,this.#n=t.pointerId,this.#f=t.pointerType,window.addEventListener("pointermove",(o)=>{if(!a)a=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging();let{clientX:c,clientY:u,pointerId:m}=o;if(m!==this.#n){Ia(o);return}let[p,w]=this.screenToPageTranslation(c-this.#S,u-this.#y);this.#S=c,this.#y=u,this._uiManager.dragSelectedEditors(p,w)},n),window.addEventListener("touchmove",Ia,n),window.addEventListener("pointerdown",(o)=>{if(o.pointerType===this.#f){if(this.#k||o.isPrimary)l(o)}Ia(o)},n);let f=(o)=>{if(!this.#n||this.#n===o.pointerId){l(o);return}Ia(o)};window.addEventListener("pointerup",f,{signal:s}),window.addEventListener("blur",f,{signal:s})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){if(this.#w)clearTimeout(this.#w);this.#w=setTimeout(()=>{this.#w=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(t,e,a){t.changeParent(this),this.x=e,this.y=a,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e,a=this.rotation){let i=this.parentScale,[s,n]=this.pageDimensions,[l,f]=this.pageTranslation,o=t/i,c=e/i,u=this.x*s,m=this.y*n,p=this.width*s,w=this.height*n;switch(a){case 0:return[u+o+l,n-m-c-w+f,u+o+p+l,n-m-c+f];case 90:return[u+c+l,n-m+o+f,u+c+w+l,n-m+o+p+f];case 180:return[u-o-p+l,n-m+c+f,u-o+l,n-m+c+w+f];case 270:return[u-c-w+l,n-m-o-p+f,u-c+l,n-m-o+f];default:throw Error("Invalid rotation")}}getRectInCurrentCoords(t,e){let[a,i,s,n]=t,l=s-a,f=n-i;switch(this.rotation){case 0:return[a,e-n,l,f];case 90:return[a,e-i,f,l];case 180:return[s,e-i,l,f];case 270:return[s,e-n,f,l];default:throw Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&se._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){this.#i?.onUpdatedColor()}getData(){let{comment:{text:t,color:e,date:a,opacity:i,deleted:s,richText:n},uid:l,pageIndex:f,creationDate:o,modificationDate:c}=this;return{id:l,pageIndex:f,rect:this.getPDFRect(),richText:n,contentsObj:{str:t},creationDate:o,modificationDate:a||c,popupRef:!s,color:e,opacity:i}}onceAdded(t){}isEmpty(){return!1}enableEditMode(){if(this.isInEditMode())return!1;return this.parent.setEditingState(!1),this.#j=!0,!0}disableEditMode(){if(!this.isInEditMode())return!1;return this.parent.setEditingState(!0),this.#j=!1,!0}isInEditMode(){return this.#j}shouldGetKeyboardEvents(){return this.#d}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:t,left:e,bottom:a,right:i}=this.getClientDimensions(),{innerHeight:s,innerWidth:n}=window;return e<n&&i>0&&t<s&&a>0}#I(){if(this.#g||!this.div)return;this.#g=new AbortController;let t=this._uiManager.combinedSignal(this.#g);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})}rebuild(){this.#I()}rotate(t){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(t=!1,e=null){return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:this._initialData?.popupRef||""}}static async deserialize(t,e,a){let i=new this.prototype.constructor({parent:e,id:a.getId(),uiManager:a,annotationElementId:t.annotationElementId,creationDate:t.creationDate,modificationDate:t.modificationDate});i.rotation=t.rotation,i.#t=t.accessibilityData,i._isCopy=t.isCopy||!1;let[s,n]=i.pageDimensions,[l,f,o,c]=i.getRectInCurrentCoords(t.rect,n);return i.x=l/s,i.y=f/n,i.width=o/s,i.height=c/n,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.#g?.abort(),this.#g=null,!this.isEmpty())this.commit();if(this.parent)this.parent.remove(this);else this._uiManager.removeEditor(this);if(this.hideCommentPopup(),this.#w)clearTimeout(this.#w),this.#w=null;if(this.#E(),this.removeEditToolbar(),this.#q){for(let t of this.#q.values())clearTimeout(t);this.#q=null}this.parent=null,this.#k?.destroy(),this.#k=null,this.#c?.remove(),this.#c=null}get isResizable(){return!1}makeResizable(){if(this.isResizable)this.#D(),this.#o.classList.remove("hidden")}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction==="ltr"?[1,0]:[0,0]}get commentButtonPositionInPage(){let{commentButtonPosition:[t,e]}=this,[a,i,s,n]=this.getPDFRect();return[se._round(a+(s-a)*t),se._round(i+(n-i)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return this.#i.commentPopupPositionInLayer}set commentPopupPosition(t){this.#i.commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return this.#i.hasDefaultPopupPosition()}get commentButtonWidth(){return this.#i.commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){this.#i?.setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let e=this.#o.children;if(!this.#e){this.#e=Array.from(e);let n=this.#X.bind(this),l=this.#Q.bind(this),f=this._uiManager._signal;for(let o of this.#e){let c=o.getAttribute("data-resizer-name");o.setAttribute("role","spinbutton"),o.addEventListener("keydown",n,{signal:f}),o.addEventListener("blur",l,{signal:f}),o.addEventListener("focus",this.#Y.bind(this,c),{signal:f}),o.setAttribute("data-l10n-id",se._l10nResizer[c])}}let a=this.#e[0],i=0;for(let n of e){if(n===a)break;i++}let s=(360-this.rotation+this.parentRotation)%360/90*(this.#e.length/4);if(s!==i){if(s<i)for(let l=0;l<i-s;l++)this.#o.append(this.#o.firstElementChild);else if(s>i)for(let l=0;l<s-i;l++)this.#o.firstElementChild.before(this.#o.lastElementChild);let n=0;for(let l of e){let o=this.#e[n++].getAttribute("data-resizer-name");l.setAttribute("data-l10n-id",se._l10nResizer[o])}}this.#J(0),this.#d=!0,this.#o.firstElementChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#X(t){se._resizerKeyboardManager.exec(this,t)}#Q(t){if(this.#d&&t.relatedTarget?.parentNode!==this.#o)this.#E()}#Y(t){this.#p=this.#d?t:""}#J(t){if(!this.#e)return;for(let e of this.#e)e.tabIndex=t}_resizeWithKeyboard(t,e){if(!this.#d)return;this.#z(this.#p,{deltaX:t,deltaY:e,fromKeyboard:!0})}#E(){this.#d=!1,this.#J(-1),this.#R()}_stopResizingWithKeyboard(){this.#E(),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.#a?.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.#o?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement))this._uiManager.currentLayer.div.focus({preventScroll:!0});this._editToolbar?.hide(),this.#a?.toggleAltTextBadge(!0),this.hideCommentPopup()}hideCommentPopup(){if(this.hasComment)this._uiManager.toggleComment(null)}updateParams(t,e){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){if(!this.canChangeContent)return;this.enableEditMode(),this.div.focus()}dblclick(t){if(t.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.#m}set isEditing(t){if(this.#m=t,!this.parent)return;if(t)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(t,e=!1){if(e){this.#q||=new Map;let{action:a}=t,i=this.#q.get(a);if(i)clearTimeout(i);i=setTimeout(()=>{if(this._reportTelemetry(t),this.#q.delete(a),this.#q.size===0)this.#q=null},se._telemetryTimeout),this.#q.set(a,i);return}t.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){if(this.div)this.div.tabIndex=0;this.#l=!1}disable(){if(this.div)this.div.tabIndex=-1;this.#l=!0}updateFakeAnnotationElement(t){if(!this.#c&&!this.deleted){this.#c=t.addFakeAnnotation(this);return}if(this.deleted){this.#c.remove(),this.#c=null;return}if(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)this.#c.updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let e=t.container.querySelector(".annotationContent");if(!e)e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);else if(e.nodeName==="CANVAS"){let a=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),a.before(e)}return e}resetAnnotationElement(t){let{firstElementChild:e}=t.container;if(e?.nodeName==="DIV"&&e.classList.contains("annotationContent"))e.remove()}}class EF extends se{constructor(t){super(t);this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}var fF=3285377520,Mn=4294901760,M0=65535;class Z3{constructor(t){this.h1=t?t&4294967295:fF,this.h2=t?t&4294967295:fF}update(t){let e,a;if(typeof t==="string"){e=new Uint8Array(t.length*2),a=0;for(let d=0,v=t.length;d<v;d++){let k=t.charCodeAt(d);if(k<=255)e[a++]=k;else e[a++]=k>>>8,e[a++]=k&255}}else if(ArrayBuffer.isView(t))e=t.slice(),a=e.byteLength;else throw Error("Invalid data format, must be a string or TypedArray.");let i=a>>2,s=a-i*4,n=new Uint32Array(e.buffer,0,i),l=0,f=0,o=this.h1,c=this.h2,u=3432918353,m=461845907,p=u&M0,w=m&M0;for(let d=0;d<i;d++)if(d&1)l=n[d],l=l*u&Mn|l*p&M0,l=l<<15|l>>>17,l=l*m&Mn|l*w&M0,o^=l,o=o<<13|o>>>19,o=o*5+3864292196;else f=n[d],f=f*u&Mn|f*p&M0,f=f<<15|f>>>17,f=f*m&Mn|f*w&M0,c^=f,c=c<<13|c>>>19,c=c*5+3864292196;switch(l=0,s){case 3:l^=e[i*4+2]<<16;case 2:l^=e[i*4+1]<<8;case 1:if(l^=e[i*4],l=l*u&Mn|l*p&M0,l=l<<15|l>>>17,l=l*m&Mn|l*w&M0,i&1)o^=l;else c^=l}this.h1=o,this.h2=c}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&Mn|t*36045&M0,e=e*4283543511&Mn|((e<<16|t>>>16)*2950163797&Mn)>>>16,t^=e>>>1,t=t*444984403&Mn|t*60499&M0,e=e*3301882366&Mn|((e<<16|t>>>16)*3120437893&Mn)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}var m9=Object.freeze({map:null,hash:"",transfer:void 0});class h6{#t=!1;#e=null;#a=null;#i=new Map;onSetModified=null;onResetModified=null;onAnnotationEditor=null;getValue(t,e){let a=this.#i.get(t);if(a===void 0)return e;return Object.assign(e,a)}getRawValue(t){return this.#i.get(t)}remove(t){let e=this.#i.get(t);if(e===void 0)return;if(e instanceof se)this.#a.delete(e.annotationElementId);if(this.#i.delete(t),this.#i.size===0)this.resetModified();if(this.#i.values().some((a)=>a instanceof se))return;this.onAnnotationEditor?.(null)}setValue(t,e){let a=this.#i.get(t),i=!1;if(a!==void 0){for(let[s,n]of Object.entries(e))if(a[s]!==n)i=!0,a[s]=n}else i=!0,this.#i.set(t,e);if(i)this.#s();if(e instanceof se)(this.#a||=new Map).set(e.annotationElementId,e),this.onAnnotationEditor?.(e.constructor._type)}has(t){return this.#i.has(t)}get size(){return this.#i.size}#s(){if(!this.#t)this.#t=!0,this.onSetModified?.()}resetModified(){if(this.#t)this.#t=!1,this.onResetModified?.()}get print(){return new ip(this)}get serializable(){if(this.#i.size===0)return m9;let t=new Map,e=new Z3,a=[],i=Object.create(null),s=!1;for(let[n,l]of this.#i){let f=l instanceof se?l.serialize(!1,i):l;if(l.page)l.pageIndex=l.page._pageIndex,delete l.page;if(f)t.set(n,f),e.update(`${n}:${JSON.stringify(f)}`),s||=!!f.bitmap}if(s){for(let n of t.values())if(n.bitmap)a.push(n.bitmap)}return t.size>0?{map:t,hash:e.hexdigest(),transfer:a}:m9}get editorStats(){let t=null,e=new Map,a=0,i=0;for(let s of this.#i.values()){if(!(s instanceof se)){if(s.popup)if(s.popup.deleted)i+=1;else a+=1;continue}if(s.isCommentDeleted)i+=1;else if(s.hasEditedComment)a+=1;let n=s.telemetryFinalData;if(!n)continue;let{type:l}=n;e.getOrInsertComputed(l,()=>Object.getPrototypeOf(s).constructor),t||=Object.create(null);let f=t[l]||=new Map;for(let[o,c]of Object.entries(n)){if(o==="type")continue;let u=f.getOrInsertComputed(o,$b);u.set(c,(u.get(c)??0)+1)}}if(i>0||a>0)t||=Object.create(null),t.comments={deleted:i,edited:a};if(!t)return null;for(let[s,n]of e)t[s]=n.computeTelemetryFinalData(t[s]);return t}resetModifiedIds(){this.#e=null}updateEditor(t,e){let a=this.#a?.get(t);if(a)return a.updateFromAnnotationLayer(e),!0;return!1}getEditor(t){return this.#a?.get(t)||null}get modifiedIds(){if(this.#e)return this.#e;let t=[];if(this.#a)for(let a of this.#a.values()){if(!a.serialize())continue;t.push(a.annotationElementId)}let e="";if(t.length){let a=new Z3;a.update(t.join(",")),e=a.hexdigest()}return this.#e={ids:new Set(t),hash:e}}[Symbol.iterator](){return this.#i.entries()}}class ip extends h6{#t=m9;constructor(t){super();let{serializable:e}=t;if(e===m9)return;let{map:a,hash:i,transfer:s}=e,n=structuredClone(a,s?{transfer:s}:null);this.#t={map:n,hash:i,transfer:[]}}get print(){Qe("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#t}get modifiedIds(){return be(this,"modifiedIds",{ids:new Set,hash:""})}}var Sh="__forcedDependency",{floor:rF,ceil:oF}=Math;function hF(t,e,a,i,s,n){t[e*4+0]=Math.min(t[e*4+0],a),t[e*4+1]=Math.min(t[e*4+1],i),t[e*4+2]=Math.max(t[e*4+2],s),t[e*4+3]=Math.max(t[e*4+3],n)}function jV(t,e,a,i,s){let n;if(t){if(t<0)n=s[0],s[0]=s[2],s[2]=n;if(s[0]*=t,s[2]*=t,e<0)n=s[1],s[1]=s[3],s[3]=n;s[1]*=e,s[3]*=e}else s.fill(0);s[0]+=a,s[1]+=i,s[2]+=a,s[3]+=i}var Vb=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];class xF{#t;#e;constructor(t,e){this.#t=t,this.#e=e}get length(){return this.#t.length}isEmpty(t){return this.#t[t]===Vb}minX(t){return this.#e[t*4+0]/256}minY(t){return this.#e[t*4+1]/256}maxX(t){return(this.#e[t*4+2]+1)/256}maxY(t){return(this.#e[t*4+3]+1)/256}}var cF=(t,e)=>t?.getOrInsertComputed(e,()=>({dependencies:new Set,isRenderingOperation:!1}));class UF{#t=[[1,0,0,1,0,0]];#e=[-1/0,-1/0,1/0,1/0];#a=new Float64Array(y1);_pendingBBoxIdx=-1;#i;#s;#l;#n;_savesStack=[];_markedContentStack=[];constructor(t,e){this.#i=t.width,this.#s=t.height,this.#f(e)}growOperationsCount(t){if(t>=this.#n.length)this.#f(t,this.#n)}#f(t,e){let a=new ArrayBuffer(t*4);if(this.#l=new Uint8ClampedArray(a),this.#n=new Uint32Array(a),e&&e.length>0)this.#n.set(e),this.#n.fill(Vb,e.length);else this.#n.fill(Vb)}get clipBox(){return this.#e}save(t){return this.#e={__proto__:this.#e},this._savesStack.push(t),this}restore(t,e){let a=Object.getPrototypeOf(this.#e);if(a===null)return this;this.#e=a;let i=this._savesStack.pop();if(i!==void 0)e?.(i,t),this.#n[t]=this.#n[i];return this}recordOpenMarker(t){return this._savesStack.push(t),this}getOpenMarker(){if(this._savesStack.length===0)return null;return this._savesStack.at(-1)}recordCloseMarker(t,e){let a=this._savesStack.pop();if(a!==void 0)e?.(a,t),this.#n[t]=this.#n[a];return this}beginMarkedContent(t){return this._markedContentStack.push(t),this}endMarkedContent(t,e){let a=this._markedContentStack.pop();if(a!==void 0)e?.(a,t),this.#n[t]=this.#n[a];return this}pushBaseTransform(t){return this.#t.push(Nt.multiplyByDOMMatrix(this.#t.at(-1),t.getTransform())),this}popBaseTransform(){if(this.#t.length>1)this.#t.pop();return this}resetBBox(t){if(this._pendingBBoxIdx!==t)this._pendingBBoxIdx=t,this.#a.set(y1,0);return this}recordClipBox(t,e,a,i,s,n){let l=Nt.multiplyByDOMMatrix(this.#t.at(-1),e.getTransform()),f=y1.slice();Nt.axialAlignedBoundingBox([a,s,i,n],l,f);let o=Nt.intersect(this.#e,f);if(o)this.#e[0]=o[0],this.#e[1]=o[1],this.#e[2]=o[2],this.#e[3]=o[3];else this.#e[0]=this.#e[1]=1/0,this.#e[2]=this.#e[3]=-1/0;return this}recordBBox(t,e,a,i,s,n){let l=this.#e;if(l[0]===1/0)return this;let f=Nt.multiplyByDOMMatrix(this.#t.at(-1),e.getTransform());if(l[0]===-1/0)return Nt.axialAlignedBoundingBox([a,s,i,n],f,this.#a),this;let o=y1.slice();return Nt.axialAlignedBoundingBox([a,s,i,n],f,o),this.#a[0]=_a(o[0],l[0],this.#a[0]),this.#a[1]=_a(o[1],l[1],this.#a[1]),this.#a[2]=_a(o[2],this.#a[2],l[2]),this.#a[3]=_a(o[3],this.#a[3],l[3]),this}recordFullPageBBox(t){return this.#a[0]=Math.max(0,this.#e[0]),this.#a[1]=Math.max(0,this.#e[1]),this.#a[2]=Math.min(this.#i,this.#e[2]),this.#a[3]=Math.min(this.#s,this.#e[3]),this}recordOperation(t,e=!1,a){if(this._pendingBBoxIdx!==t)return this;let i=rF(this.#a[0]*256/this.#i),s=rF(this.#a[1]*256/this.#s),n=oF(this.#a[2]*256/this.#i),l=oF(this.#a[3]*256/this.#s);if(hF(this.#l,t,i,s,n,l),a){for(let f of a)for(let o of f)if(o!==t)hF(this.#l,o,i,s,n,l)}if(!e)this._pendingBBoxIdx=-1;return this}bboxToClipBoxDropOperation(t){if(this._pendingBBoxIdx===t)this._pendingBBoxIdx=-1,this.#e[0]=Math.max(this.#e[0],this.#a[0]),this.#e[1]=Math.max(this.#e[1],this.#a[1]),this.#e[2]=Math.min(this.#e[2],this.#a[2]),this.#e[3]=Math.min(this.#e[3],this.#a[3]);return this}take(){return new xF(this.#n,this.#l)}takeDebugMetadata(){throw Error("Unreachable")}recordSimpleData(t,e){return this}recordIncrementalData(t,e){return this}resetIncrementalData(t,e){return this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,a){return this}recordFutureForcedDependency(t,e){return this}inheritSimpleDataAsFutureForcedDependencies(t){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(t,e,a,i=1,s=0,n=0,l){return this}getSimpleIndex(t){return}recordDependencies(t,e){return this}recordNamedDependency(t,e){return this}recordShowTextOperation(t,e=!1){return this}}class IF{#t={__proto__:null};#e={__proto__:null,transform:[],moveText:[],sameLineText:[],[Sh]:[]};#a=new Map;#i=new Set;#s=new Map;#l;#n;#f;constructor(t,e=!1){if(this.#f=t,e)this.#l=new Map,this.#n=(a,i)=>{cF(this.#l,i).dependencies.add(a)}}get clipBox(){return this.#f.clipBox}growOperationsCount(t){this.#f.growOperationsCount(t)}save(t){return this.#t={__proto__:this.#t},this.#e={__proto__:this.#e,transform:{__proto__:this.#e.transform},moveText:{__proto__:this.#e.moveText},sameLineText:{__proto__:this.#e.sameLineText},[Sh]:{__proto__:this.#e[Sh]}},this.#f.save(t),this}restore(t){this.#f.restore(t,this.#n);let e=Object.getPrototypeOf(this.#t);if(e===null)return this;return this.#t=e,this.#e=Object.getPrototypeOf(this.#e),this}recordOpenMarker(t){return this.#f.recordOpenMarker(t,this.#n),this}getOpenMarker(){return this.#f.getOpenMarker()}recordCloseMarker(t){return this.#f.recordCloseMarker(t,this.#n),this}beginMarkedContent(t){return this.#f.beginMarkedContent(t),this}endMarkedContent(t){return this.#f.endMarkedContent(t,this.#n),this}pushBaseTransform(t){return this.#f.pushBaseTransform(t),this}popBaseTransform(){return this.#f.popBaseTransform(),this}recordSimpleData(t,e){return this.#t[t]=e,this}recordIncrementalData(t,e){return this.#e[t].push(e),this}resetIncrementalData(t,e){return this.#e[t].length=0,this}recordNamedData(t,e){return this.#a.set(t,e),this}recordSimpleDataFromNamed(t,e,a){this.#t[t]=this.#a.get(e)??a}recordFutureForcedDependency(t,e){return this.recordIncrementalData(Sh,e),this}inheritSimpleDataAsFutureForcedDependencies(t){for(let e of t)if(e in this.#t)this.recordFutureForcedDependency(e,this.#t[e]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let t of this.#i)this.recordFutureForcedDependency(Sh,t);return this}resetBBox(t){return this.#f.resetBBox(t),this}recordClipBox(t,e,a,i,s,n){return this.#f.recordClipBox(t,e,a,i,s,n),this}recordBBox(t,e,a,i,s,n){return this.#f.recordBBox(t,e,a,i,s,n),this}recordCharacterBBox(t,e,a,i=1,s=0,n=0,l){let f=a.bbox,o,c;if(f){if(o=f[2]!==f[0]&&f[3]!==f[1]&&this.#s.get(a),o!==!1){if(c=[0,0,0,0],Nt.axialAlignedBoundingBox(f,a.fontMatrix,c),i!==1||s!==0||n!==0)jV(i,-i,s,n,c);if(o)return this.recordBBox(t,e,c[0],c[2],c[1],c[3])}}if(!l)return this.recordFullPageBBox(t);let u=l();if(f&&c&&o===void 0){if(o=c[0]<=s-u.actualBoundingBoxLeft&&c[2]>=s+u.actualBoundingBoxRight&&c[1]<=n-u.actualBoundingBoxAscent&&c[3]>=n+u.actualBoundingBoxDescent,this.#s.set(a,o),o)return this.recordBBox(t,e,c[0],c[2],c[1],c[3])}return this.recordBBox(t,e,s-u.actualBoundingBoxLeft,s+u.actualBoundingBoxRight,n-u.actualBoundingBoxAscent,n+u.actualBoundingBoxDescent)}recordFullPageBBox(t){return this.#f.recordFullPageBBox(t),this}getSimpleIndex(t){return this.#t[t]}recordDependencies(t,e){let a=this.#i,i=this.#t,s=this.#e;for(let n of e)if(n in this.#t)a.add(i[n]);else if(n in s)s[n].forEach(a.add,a);return this}recordNamedDependency(t,e){if(this.#a.has(e))this.#i.add(this.#a.get(e));return this}recordOperation(t,e=!1){if(this.recordDependencies(t,[Sh]),this.#l){let i=cF(this.#l,t),{dependencies:s}=i;this.#i.forEach(s.add,s),this.#f._savesStack.forEach(s.add,s),this.#f._markedContentStack.forEach(s.add,s),s.delete(t),i.isRenderingOperation=!0}let a=!e&&t===this.#f._pendingBBoxIdx;if(this.#f.recordOperation(t,e,[this.#i,this.#f._savesStack,this.#f._markedContentStack]),a)this.#i.clear();return this}recordShowTextOperation(t,e=!1){let a=Array.from(this.#i);this.recordOperation(t,e),this.recordIncrementalData("sameLineText",t);for(let i of a)this.recordIncrementalData("sameLineText",i);return this}bboxToClipBoxDropOperation(t,e=!1){let a=!e&&t===this.#f._pendingBBoxIdx;if(this.#f.bboxToClipBoxDropOperation(t),a)this.#i.clear();return this}take(){return this.#s.clear(),this.#f.take()}takeDebugMetadata(){return this.#l}}class g9{#t;#e;#a;#i=0;#s=0;constructor(t,e,a){if(t instanceof g9&&t.#a===!!a)return t;this.#t=t,this.#e=e,this.#a=!!a}get clipBox(){return this.#t.clipBox}growOperationsCount(){throw Error("Unreachable")}save(t){return this.#s++,this.#t.save(this.#e),this}restore(t){if(this.#s>0)this.#t.restore(this.#e),this.#s--;return this}recordOpenMarker(t){return this.#i++,this}getOpenMarker(){return this.#i>0?this.#e:this.#t.getOpenMarker()}recordCloseMarker(t){return this.#i--,this}beginMarkedContent(t){return this}endMarkedContent(t){return this}pushBaseTransform(t){return this.#t.pushBaseTransform(t),this}popBaseTransform(){return this.#t.popBaseTransform(),this}recordSimpleData(t,e){return this.#t.recordSimpleData(t,this.#e),this}recordIncrementalData(t,e){return this.#t.recordIncrementalData(t,this.#e),this}resetIncrementalData(t,e){return this.#t.resetIncrementalData(t,this.#e),this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,a){return this.#t.recordSimpleDataFromNamed(t,e,this.#e),this}recordFutureForcedDependency(t,e){return this.#t.recordFutureForcedDependency(t,this.#e),this}inheritSimpleDataAsFutureForcedDependencies(t){return this.#t.inheritSimpleDataAsFutureForcedDependencies(t),this}inheritPendingDependenciesAsFutureForcedDependencies(){return this.#t.inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(t){if(!this.#a)this.#t.resetBBox(this.#e);return this}recordClipBox(t,e,a,i,s,n){if(!this.#a)this.#t.recordClipBox(this.#e,e,a,i,s,n);return this}recordBBox(t,e,a,i,s,n){if(!this.#a)this.#t.recordBBox(this.#e,e,a,i,s,n);return this}recordCharacterBBox(t,e,a,i,s,n,l){if(!this.#a)this.#t.recordCharacterBBox(this.#e,e,a,i,s,n,l);return this}recordFullPageBBox(t){if(!this.#a)this.#t.recordFullPageBBox(this.#e);return this}getSimpleIndex(t){return this.#t.getSimpleIndex(t)}recordDependencies(t,e){return this.#t.recordDependencies(this.#e,e),this}recordNamedDependency(t,e){return this.#t.recordNamedDependency(this.#e,e),this}recordOperation(t){return this.#t.recordOperation(this.#e,!0),this}recordShowTextOperation(t){return this.#t.recordShowTextOperation(this.#e,!0),this}bboxToClipBoxDropOperation(t){if(!this.#a)this.#t.bboxToClipBoxDropOperation(this.#e,!0);return this}take(){throw Error("Unreachable")}takeDebugMetadata(){throw Error("Unreachable")}}var Dn={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 $3{#t;#e;#a=4;#i=0;#s=new $3.#l(this.#a*6);static#l=ha.isFloat16ArraySupported?Float16Array:Float32Array;constructor(t){this.#t=t.width,this.#e=t.height}record(t,e,a,i){if(this.#i===this.#a){this.#a*=2;let l=new $3.#l(this.#a*6);l.set(this.#s),this.#s=l}let s=Aa(t),n;if(i[0]!==1/0){let l=y1.slice();Nt.axialAlignedBoundingBox([0,-a,e,0],s,l);let f=Nt.intersect(i,l);if(!f)return;let[o,c,u,m]=f;if(o!==l[0]||c!==l[1]||u!==l[2]||m!==l[3]){let p=Math.atan2(s[1],s[0]),w=Math.abs(Math.sin(p)),d=Math.abs(Math.cos(p));if(w<0.000001||d<0.000001||Math.abs(w-d)<0.000001)n=[o,c,o,m,u,c];else{let v=u-o,k=m-c,y=w*w,B=d*d,H=d*w,M=B-y,D=(k*B-v*H)/M,T=(k*H-v*y)/M;n=[o+T,c,o,c+D,u,m-D]}}}if(!n)n=[0,-a,0,0,e,-a],Nt.applyTransform(n,s,0),Nt.applyTransform(n,s,2),Nt.applyTransform(n,s,4);n[0]/=this.#t,n[1]/=this.#e,n[2]/=this.#t,n[3]/=this.#e,n[4]/=this.#t,n[5]/=this.#e,this.#s.set(n,this.#i*6),this.#i++}take(){return this.#s.subarray(0,this.#i*6)}}class GF{#t=new Set;#e=null;constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){let e=this.#a();e.insertRule(t,e.cssRules.length)}#a(){if(this.#e)return this.#e;let t=this._document.defaultView?.CSSStyleSheet||globalThis.CSSStyleSheet;if(!this.styleElement&&t){let{adoptedStyleSheets:e}=this._document;if(e){let a=new t;return e.push(a),this.#e=a}}if(!this.styleElement)this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement);return this.#e=this.styleElement.sheet}clear(){for(let t of this.nativeFontFaces)this._document.fonts.delete(t);if(this.nativeFontFaces.clear(),this.#t.clear(),this.#e){let{adoptedStyleSheets:t}=this._document;if(t?.includes(this.#e))this._document.adoptedStyleSheets=t.filter((e)=>e!==this.#e);this.#e=null}if(this.styleElement)this.styleElement.remove(),this.styleElement=null}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:a}){if(!t||this.#t.has(t.loadedName))return;if(Ga(!e,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:i,src:s,style:n}=t,l=new FontFace(i,s,n);this.addNativeFontFace(l);try{await l.load(),this.#t.add(i),a?.(t)}catch{de(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(l)}return}Qe("Not implemented: loadSystemFont without the Font Loading API.")}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo){await this.loadSystemFont(t);return}if(this.isFontLoadingAPISupported){let a=t.createNativeFontFace();if(a){this.addNativeFontFace(a);try{await a.loaded}catch(i){throw de(`Failed to load font '${a.family}': '${i}'.`),t.disableFontFace=!0,i}}return}let e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise((a)=>{let i=this._queueLoadingCallback(a);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){let t=!!this._document?.fonts;return be(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){return be(this,"isSyncFontLoadingSupported",ln||ha.platform.isFirefox)}_queueLoadingCallback(t){function e(){Ga(!i.done,"completeRequest() cannot be called twice."),i.done=!0;while(a.length>0&&a[0].done){let s=a.shift();setTimeout(s.callback,0)}}let{loadingRequests:a}=this,i={done:!1,complete:e,callback:t};return a.push(i),i}get _loadTestFont(){let t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return be(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function a(M,D){return M.charCodeAt(D)<<24|M.charCodeAt(D+1)<<16|M.charCodeAt(D+2)<<8|M.charCodeAt(D+3)&255}function i(M){return String.fromCharCode(M>>24&255,M>>16&255,M>>8&255,M&255)}function s(M,D,T,z){let E=M.substring(0,D),V=M.substring(D+T);return E+z+V}let n,l,f=this._document.createElement("canvas");f.width=1,f.height=1;let o=f.getContext("2d"),c=0;function u(M,D){if(++c>30){de("Load test font never loaded."),D();return}if(o.font="30px "+M,o.fillText(".",0,20),o.getImageData(0,0,1,1).data[3]>0){D();return}setTimeout(u.bind(null,M,D))}let m=`lt${Date.now()}${this.loadTestFontId++}`,p=this._loadTestFont;p=s(p,976,m.length,m);let d=16,v=1482184792,k=a(p,d);for(n=0,l=m.length-3;n<l;n+=4)k=k-v+a(m,n)|0;if(n<m.length)k=k-v+a(m+"XXX",n)|0;p=s(p,d,4,i(k));let y=`url(data:font/opentype;base64,${btoa(p)});`,B=`@font-face {font-family:"${m}";src:${y}}`;this.insertRule(B);let H=this._document.createElement("div");H.style.visibility="hidden",H.style.width=H.style.height="10px",H.style.position="absolute",H.style.top=H.style.left="0px";for(let M of[t.loadedName,m]){let D=this._document.createElement("span");D.textContent="Hi",D.style.fontFamily=M,H.append(D)}this._document.body.append(H),u(m,()=>{H.remove(),e.complete()})}}class XF{compiledGlyphs=Object.create(null);#t;constructor(t,e=null,a,i){if(this.#t=t,this._inspectFont=e,a)this.charProcOperatorList=a;if(i)Object.assign(this,i)}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{let e={weight:this.cssFontInfo.fontWeight};if(this.cssFontInfo.italicAngle)e.style=`oblique ${this.cssFontInfo.italicAngle}deg`;t=new FontFace(this.cssFontInfo.fontFamily,this.data,e)}return this._inspectFont?.(this),t}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;let t=`url(data:${this.mimetype};base64,${this.data.toBase64()});`,e;if(!this.cssFontInfo)e=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let a=`font-weight: ${this.cssFontInfo.fontWeight};`;if(this.cssFontInfo.italicAngle)a+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`;e=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${a}src:${t}}`}return this._inspectFont?.(this,t),e}getPathGenerator(t,e){if(this.compiledGlyphs[e]!==void 0)return this.compiledGlyphs[e];let a=this.loadedName+"_path_"+e,i;try{i=t.get(a)}catch(n){de(`getPathGenerator - ignoring character: "${n}".`)}let s=DF(i?.path);if(!this.fontExtraProperties)t.delete(a);return this.compiledGlyphs[e]=s}get black(){return this.#t.black}get bold(){return this.#t.bold}get disableFontFace(){return this.#t.disableFontFace}set disableFontFace(t){be(this,"disableFontFace",!!t)}get fontExtraProperties(){return this.#t.fontExtraProperties}get isInvalidPDFjsFont(){return this.#t.isInvalidPDFjsFont}get isType3Font(){return this.#t.isType3Font}get italic(){return this.#t.italic}get missingFile(){return this.#t.missingFile}get remeasure(){return this.#t.remeasure}get vertical(){return this.#t.vertical}get ascent(){return this.#t.ascent}get defaultWidth(){return this.#t.defaultWidth}get descent(){return this.#t.descent}get bbox(){return this.#t.bbox}get fontMatrix(){return this.#t.fontMatrix}get fallbackName(){return this.#t.fallbackName}get loadedName(){return this.#t.loadedName}get mimetype(){return this.#t.mimetype}get name(){return this.#t.name}get data(){return this.#t.data}clearData(){this.#t.clearData()}get cssFontInfo(){return this.#t.cssFontInfo}get systemFontInfo(){return this.#t.systemFontInfo}get defaultVMetrics(){return this.#t.defaultVMetrics}}class KF{static strings=["fontFamily","fontWeight","italicAngle"]}class LF{static strings=["css","loadedName","baseFontName","src"]}class Tn{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 Ml{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 VF{#t;#e=new TextDecoder;#a;constructor(t){this.#t=t,this.#a=new DataView(t)}#i(t){Ga(t<KF.strings.length,"Invalid string index");let e=0;for(let i=0;i<t;i++)e+=this.#a.getUint32(e)+4;let a=this.#a.getUint32(e);return this.#e.decode(new Uint8Array(this.#t,e+4,a))}get fontFamily(){return this.#i(0)}get fontWeight(){return this.#i(1)}get italicAngle(){return this.#i(2)}}class YF{#t;#e=new TextDecoder;#a;constructor(t){this.#t=t,this.#a=new DataView(t)}get guessFallback(){return this.#a.getUint8(0)!==0}#i(t){Ga(t<LF.strings.length,"Invalid string index");let e=5;for(let i=0;i<t;i++)e+=this.#a.getUint32(e)+4;let a=this.#a.getUint32(e);return this.#e.decode(new Uint8Array(this.#t,e+4,a))}get css(){return this.#i(0)}get loadedName(){return this.#i(1)}get baseFontName(){return this.#i(2)}get src(){return this.#i(3)}get style(){let t=1;t+=4+this.#a.getUint32(t);let e=this.#a.getUint32(t),a=this.#e.decode(new Uint8Array(this.#t,t+4,e));t+=4+e;let i=this.#a.getUint32(t),s=this.#e.decode(new Uint8Array(this.#t,t+4,i));return{style:a,weight:s}}}class JF{#t;#e=new TextDecoder;#a;constructor({buffer:t,extra:e}){if(this.#t=t,this.#a=new DataView(t),e)Object.assign(this,e)}#i(t){Ga(t<Tn.bools.length,"Invalid boolean index");let e=Math.floor(t/4),a=t*2%8,i=this.#a.getUint8(e)>>a&3;return i===0?void 0:i===2}get black(){return this.#i(0)}get bold(){return this.#i(1)}get disableFontFace(){return this.#i(2)}get fontExtraProperties(){return this.#i(3)}get isInvalidPDFjsFont(){return this.#i(4)}get isType3Font(){return this.#i(5)}get italic(){return this.#i(6)}get missingFile(){return this.#i(7)}get remeasure(){return this.#i(8)}get vertical(){return this.#i(9)}#s(t){return Ga(t<Tn.numbers.length,"Invalid number index"),this.#a.getFloat64(Tn.OFFSET_NUMBERS+t*8)}get ascent(){return this.#s(0)}get defaultWidth(){return this.#s(1)}get descent(){return this.#s(2)}#l(t,e,a,i){let s=this.#a.getUint8(t);if(s===0)return;Ga(s===e,"Invalid array length."),t+=1;let n=Array(s);for(let l=0;l<s;l++)n[l]=this.#a[a](t,!0),t+=i;return n}get bbox(){return this.#l(Tn.OFFSET_BBOX,4,"getInt16",2)}get fontMatrix(){return this.#l(Tn.OFFSET_FONT_MATRIX,6,"getFloat64",8)}get defaultVMetrics(){return this.#l(Tn.OFFSET_DEFAULT_VMETRICS,3,"getInt16",2)}#n(t){Ga(t<Tn.strings.length,"Invalid string index");let e=Tn.OFFSET_STRINGS+4;for(let i=0;i<t;i++)e+=this.#a.getUint32(e)+4;let a=this.#a.getUint32(e);return this.#e.decode(new Uint8Array(this.#t,e+4,a))}get fallbackName(){return this.#n(0)}get loadedName(){return this.#n(1)}get mimetype(){return this.#n(2)}get name(){return this.#n(3)}#f(){let t=Tn.OFFSET_STRINGS,e=this.#a.getUint32(t);t+=4+e;let a=this.#a.getUint32(t);t+=4+a;let i=this.#a.getUint32(t);t+=4+i;let s=this.#a.getUint32(t);return{offset:t,length:s}}get data(){let{offset:t,length:e}=this.#f();return e===0?void 0:new Uint8Array(this.#t,t+4,e)}clearData(){let{offset:t,length:e}=this.#f();if(e===0)return;this.#a.setUint32(t,0),this.#t=new Uint8Array(this.#t,0,t+4).slice().buffer,this.#a=new DataView(this.#t)}get cssFontInfo(){let t=Tn.OFFSET_STRINGS,e=this.#a.getUint32(t);t+=4+e;let a=this.#a.getUint32(t);t+=4+a;let i=this.#a.getUint32(t);if(i===0)return null;let s=new Uint8Array(i);return s.set(new Uint8Array(this.#t,t+4,i)),new VF(s.buffer)}get systemFontInfo(){let t=Tn.OFFSET_STRINGS,e=this.#a.getUint32(t);t+=4+e;let a=this.#a.getUint32(t);if(a===0)return null;let i=new Uint8Array(a);return i.set(new Uint8Array(this.#t,t+4,a)),new YF(i.buffer)}}class QF{constructor(t){this.buffer=t,this.view=new DataView(t),this.data=new Uint8Array(t)}getIR(){let t=this.view,e=this.data[Ml.KIND],a=!!this.data[Ml.HAS_BBOX],i=!!this.data[Ml.HAS_BACKGROUND],s=t.getUint32(Ml.N_COORD,!0),n=t.getUint32(Ml.N_COLOR,!0),l=t.getUint32(Ml.N_STOP,!0),f=20,o=new Float32Array(this.buffer,f,s*2);f+=s*8;let c=new Uint8Array(this.buffer,f,n*4);f+=n*4;let u=[];for(let w=0;w<l;++w){let d=t.getFloat32(f,!0);f+=4;let v=t.getUint32(f,!0);f+=4,u.push([d,`#${v.toString(16).padStart(6,"0")}`])}let m=null;if(a){m=[];for(let w=0;w<4;++w)m.push(t.getFloat32(f,!0)),f+=4}let p=null;if(i)p=new Uint8Array(this.buffer,f,3),f+=3;if(e===1)return["RadialAxial","axial",m,u,Array.from(o.slice(0,2)),Array.from(o.slice(2,4)),null,null];if(e===2)return["RadialAxial","radial",m,u,[o[0],o[1]],[o[3],o[4]],o[2],o[5]];if(e===3){let w=this.data[Ml.SHADING_TYPE],d=null;if(o.length>0){d=y1.slice();for(let v=0,k=o.length;v<k;v+=2)Nt.pointBoundingBox(o[v],o[v+1],d)}return["Mesh",w,o,c,s,d,m,p]}throw Error(`Unsupported pattern kind: ${e}`)}}class ZF{#t;constructor(t){this.#t=t}get path(){if(ha.isFloat16ArraySupported)return new Float16Array(this.#t);return new Float32Array(this.#t)}}function dV(t){if(t instanceof URL)return t;if(typeof t==="string"){if(ln){if(/^[a-z][a-z0-9\-+.]+:/i.test(t))return new URL(t);let a=process.getBuiltinModule("url");return new URL(a.pathToFileURL(t))}let e=URL.parse(t,window.location);if(e)return e}throw Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function qV(t){if(ln&&typeof Buffer<"u"&&t instanceof Buffer)throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if(typeof t==="string")return l6(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||typeof t==="object"&&!isNaN(t?.length))return new Uint8Array(t);throw Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function R3(t){if(typeof t!=="string")return null;if(t.endsWith("/"))return t;throw Error(`Invalid factory url: "${t}" must include trailing slash.`)}var Yb=(t)=>typeof t==="object"&&Number.isInteger(t?.num)&&t.num>=0&&Number.isInteger(t?.gen)&&t.gen>=0,AV=(t)=>typeof t==="object"&&typeof t?.name==="string",vV=cV.bind(null,Yb,AV);class $F{#t=new Map;#e=Promise.resolve();postMessage(t,e){let a={data:structuredClone(t,e?{transfer:e}:null)};this.#e.then(()=>{for(let[i]of this.#t)i.call(this,a)})}addEventListener(t,e,a=null){let i=null;if(a?.signal instanceof AbortSignal){let{signal:s}=a;if(s.aborted){de("LoopbackPort - cannot use an `aborted` signal.");return}let n=()=>this.removeEventListener(t,e);i=()=>s.removeEventListener("abort",n),s.addEventListener("abort",n)}this.#t.set(e,i)}removeEventListener(t,e){this.#t.get(e)?.(),this.#t.delete(e)}terminate(){for(let[,t]of this.#t)t?.();this.#t.clear()}}var N3={DATA:1,ERROR:2},ui={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function uF(){}function Es(t){if(t instanceof C1||t instanceof J3||t instanceof Y3||t instanceof c9||t instanceof K3)return t;if(!(t instanceof Error||typeof t==="object"&&t!==null))Qe('wrapReason: Expected "reason" to be a (possibly cloned) Error.');switch(t.name){case"AbortException":return new C1(t.message);case"InvalidPDFException":return new J3(t.message);case"PasswordException":return new Y3(t.message,t.code);case"ResponseException":return new c9(t.message,t.status,t.missing);case"UnknownErrorException":return new K3(t.message,t.details)}return new K3(t.message,t.toString())}class Ch{#t=new AbortController;constructor(t,e,a){this.sourceName=t,this.targetName=e,this.comObj=a,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),a.addEventListener("message",this.#e.bind(this),{signal:this.#t.signal})}#e({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){this.#i(t);return}if(t.callback){let a=t.callbackId,i=this.callbackCapabilities[a];if(!i)throw Error(`Cannot resolve callback ${a}`);if(delete this.callbackCapabilities[a],t.callback===N3.DATA)i.resolve(t.data);else if(t.callback===N3.ERROR)i.reject(Es(t.reason));else throw Error("Unexpected callback case");return}let e=this.actionHandler[t.action];if(!e)throw Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){let a=this.sourceName,i=t.sourceName,s=this.comObj;Promise.try(e,t.data).then(function(n){s.postMessage({sourceName:a,targetName:i,callback:N3.DATA,callbackId:t.callbackId,data:n})},function(n){s.postMessage({sourceName:a,targetName:i,callback:N3.ERROR,callbackId:t.callbackId,reason:Es(n)})});return}if(t.streamId){this.#a(t);return}e(t.data)}on(t,e){let a=this.actionHandler;if(a[t])throw Error(`There is already an actionName called "${t}"`);a[t]=e}send(t,e,a){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},a)}sendWithPromise(t,e,a){let i=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[i]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:i,data:e},a)}catch(n){s.reject(n)}return s.promise}sendWithStream(t,e,a,i){let s=this.streamId++,n=this.sourceName,l=this.targetName,f=this.comObj;return new ReadableStream({start:(o)=>{let c=Promise.withResolvers();return this.streamControllers[s]={controller:o,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},f.postMessage({sourceName:n,targetName:l,action:t,streamId:s,data:e,desiredSize:o.desiredSize},i),c.promise},pull:(o)=>{let c=Promise.withResolvers();return this.streamControllers[s].pullCall=c,f.postMessage({sourceName:n,targetName:l,stream:ui.PULL,streamId:s,desiredSize:o.desiredSize}),c.promise},cancel:(o)=>{Ga(o instanceof Error,"cancel must have a valid reason");let c=Promise.withResolvers();return this.streamControllers[s].cancelCall=c,this.streamControllers[s].isClosed=!0,f.postMessage({sourceName:n,targetName:l,stream:ui.CANCEL,streamId:s,reason:Es(o)}),c.promise}},a)}#a(t){let e=t.streamId,a=this.sourceName,i=t.sourceName,s=this.comObj,n=this,l=this.actionHandler[t.action],f={enqueue(o,c=1,u){if(this.isCancelled)return;let m=this.desiredSize;if(this.desiredSize-=c,m>0&&this.desiredSize<=0)this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise;s.postMessage({sourceName:a,targetName:i,stream:ui.ENQUEUE,streamId:e,chunk:o},u)},close(){if(this.isCancelled)return;this.isCancelled=!0,s.postMessage({sourceName:a,targetName:i,stream:ui.CLOSE,streamId:e}),delete n.streamSinks[e]},error(o){if(Ga(o instanceof Error,"error must have a valid reason"),this.isCancelled)return;this.isCancelled=!0,s.postMessage({sourceName:a,targetName:i,stream:ui.ERROR,streamId:e,reason:Es(o)})},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};f.sinkCapability.resolve(),f.ready=f.sinkCapability.promise,this.streamSinks[e]=f,Promise.try(l,t.data,f).then(function(){s.postMessage({sourceName:a,targetName:i,stream:ui.START_COMPLETE,streamId:e,success:!0})},function(o){s.postMessage({sourceName:a,targetName:i,stream:ui.START_COMPLETE,streamId:e,reason:Es(o)})})}#i(t){let e=t.streamId,a=this.sourceName,i=t.sourceName,s=this.comObj,n=this.streamControllers[e],l=this.streamSinks[e];switch(t.stream){case ui.START_COMPLETE:if(t.success)n.startCall.resolve();else n.startCall.reject(Es(t.reason));break;case ui.PULL_COMPLETE:if(t.success)n.pullCall.resolve();else n.pullCall.reject(Es(t.reason));break;case ui.PULL:if(!l){s.postMessage({sourceName:a,targetName:i,stream:ui.PULL_COMPLETE,streamId:e,success:!0});break}if(l.desiredSize<=0&&t.desiredSize>0)l.sinkCapability.resolve();l.desiredSize=t.desiredSize,Promise.try(l.onPull||uF).then(function(){s.postMessage({sourceName:a,targetName:i,stream:ui.PULL_COMPLETE,streamId:e,success:!0})},function(o){s.postMessage({sourceName:a,targetName:i,stream:ui.PULL_COMPLETE,streamId:e,reason:Es(o)})});break;case ui.ENQUEUE:if(Ga(n,"enqueue should have stream controller"),n.isClosed)break;n.controller.enqueue(t.chunk);break;case ui.CLOSE:if(Ga(n,"close should have stream controller"),n.isClosed)break;n.isClosed=!0,n.controller.close(),this.#s(n,e);break;case ui.ERROR:Ga(n,"error should have stream controller"),n.controller.error(Es(t.reason)),this.#s(n,e);break;case ui.CANCEL_COMPLETE:if(t.success)n.cancelCall.resolve();else n.cancelCall.reject(Es(t.reason));this.#s(n,e);break;case ui.CANCEL:if(!l)break;let f=Es(t.reason);Promise.try(l.onCancel||uF,f).then(function(){s.postMessage({sourceName:a,targetName:i,stream:ui.CANCEL_COMPLETE,streamId:e,success:!0})},function(o){s.postMessage({sourceName:a,targetName:i,stream:ui.CANCEL_COMPLETE,streamId:e,reason:Es(o)})}),l.sinkCapability.reject(f),l.isCancelled=!0,delete this.streamSinks[e];break;default:throw Error("Unexpected stream case")}}async#s(t,e){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[e]}destroy(){this.#t?.abort(),this.#t=null}}class sp{#t=Object.freeze({cMapUrl:"CMap",standardFontDataUrl:"font",wasmUrl:"wasm"});constructor({cMapUrl:t=null,standardFontDataUrl:e=null,wasmUrl:a=null}){this.cMapUrl=t,this.standardFontDataUrl=e,this.wasmUrl=a}async fetch({kind:t,filename:e}){switch(t){case"cMapUrl":case"standardFontDataUrl":case"wasmUrl":break;default:Qe(`Not implemented: ${t}`)}let a=this[t];if(!a)throw Error(`Ensure that the \`${t}\` API parameter is provided.`);let i=`${a}${e}`;return this._fetch(i,t).catch((s)=>{throw Error(`Unable to load ${this.#t[t]} data at: ${i}`)})}async _fetch(t,e){Qe("Abstract method `_fetch` called.")}}class Jb extends sp{async _fetch(t,e){let a=e==="cMapUrl"&&!t.endsWith(".bcmap")?"text":"bytes",i=await Pb(t,a);return i instanceof Uint8Array?i:l6(i)}}class np{#t=!1;constructor({enableHWA:t=!1}){this.#t=t}create(t,e){if(t<=0||e<=0)throw Error("Invalid canvas size");let a=this._createCanvas(t,e);return{canvas:a,context:a.getContext("2d",{willReadFrequently:!this.#t})}}reset({canvas:t},e,a){if(!t)throw Error("Canvas is not specified");if(e<=0||a<=0)throw Error("Invalid canvas size");t.width=e,t.height=a}destroy(t){let{canvas:e}=t;if(!e)throw Error("Canvas is not specified");e.width=e.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){Qe("Abstract method `_createCanvas` called.")}}class WF extends np{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e});this._document=t}_createCanvas(t,e){let a=this._document.createElement("canvas");return a.width=t,a.height=e,a}}class lp{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addKnockoutFilter(t=0){return"none"}addHighlightHCMFilter(t,e,a,i,s){return"none"}addSelectionHCMFilter(t,e){return"none"}addSelectionFilter(){return"none"}createSelectionStyle(t=null){return null}destroy(t=!1){}}class PF extends lp{#t;#e;#a;#i;#s;#l;#n=0;constructor({docId:t,ownerDocument:e=globalThis.document}){super();this.#i=t,this.#s=e}get#f(){return this.#e||=new Map}get#o(){return this.#l||=new Map}get#r(){if(!this.#a){let t=this.#s.createElement("div"),{style:e}=t;e.colorScheme="only light",e.visibility="hidden",e.contain="strict",e.width=e.height=0,e.position="absolute",e.top=e.left=0,e.zIndex=-1;let a=this.#s.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("width",0),a.setAttribute("height",0),this.#a=this.#s.createElementNS("http://www.w3.org/2000/svg","defs"),t.append(a),a.append(this.#a),this.#s.body.append(t)}return this.#a}#u(t){if(t.length===1){let f=t[0],o=Array(256);for(let u=0;u<256;u++)o[u]=f[u]/255;let c=o.join(",");return[c,c,c]}let[e,a,i]=t,s=Array(256),n=Array(256),l=Array(256);for(let f=0;f<256;f++)s[f]=e[f]/255,n[f]=a[f]/255,l[f]=i[f]/255;return[s.join(","),n.join(","),l.join(",")]}#c(t){if(this.#t===void 0){this.#t="";let e=this.#s.URL;if(e!==this.#s.baseURI)if(r6(e))de('#createUrl: ignore "data:"-URL for performance reasons.');else this.#t=_F(e,"")}return`url(${this.#t}#${t})`}addFilter(t){if(!t)return"none";let e=this.#f.get(t);if(e)return e;let[a,i,s]=this.#u(t),n=t.length===1?a:`${a}${i}${s}`;if(e=this.#f.get(n),e)return this.#f.set(t,e),e;let l=`g_${this.#i}_transfer_map_${this.#n++}`,f=this.#c(l);this.#f.set(t,f),this.#f.set(n,f);let o=this.#b(l);return this.#m(a,i,s,o),f}addHCMFilter(t,e){let a=`${t}-${e}`,i="base",s=this.#o.get("base");if(s?.key===a)return s.url;if(s)s.filter?.remove(),s.key=a,s.url="none",s.filter=null;else s={key:a,url:"none",filter:null},this.#o.set("base",s);if(!t||!e)return s.url;let n=this.#d(t);t=Nt.makeHexColor(...n);let l=this.#d(e);if(e=Nt.makeHexColor(...l),this.#r.style.color="",t==="#000000"&&e==="#ffffff"||t===e)return s.url;let f=Array(256);for(let p=0;p<=255;p++){let w=p/255;f[p]=w<=0.03928?w/12.92:((w+0.055)/1.055)**2.4}let o=f.join(","),c=`g_${this.#i}_hcm_filter`,u=s.filter=this.#b(c);this.#m(o,o,o,u),this.#p(u);let m=(p,w)=>{let d=n[p]/255,v=l[p]/255,k=Array(w+1);for(let y=0;y<=w;y++)k[y]=d+y/w*(v-d);return k.join(",")};return this.#m(m(0,5),m(1,5),m(2,5),u),s.url=this.#c(c),s.url}addSelectionHCMFilter(t,e){return this.addHighlightHCMFilter("selection",t,e,"HighlightText","Highlight")}addSelectionFilter(){return this.addHighlightHCMFilter("selection_default","black","white","HighlightText","Highlight")}createSelectionStyle(t=null){let e=t?this.addSelectionHCMFilter(t.foreground,t.background):this.addSelectionFilter();if(e==="none"||!ha.platform.isFirefox)return null;return{"backdrop-filter":e,"background-color":"transparent"}}addAlphaFilter(t){let e=this.#f.get(t);if(e)return e;let[a]=this.#u([t]),i=`alpha_${a}`;if(e=this.#f.get(i),e)return this.#f.set(t,e),e;let s=`g_${this.#i}_alpha_map_${this.#n++}`,n=this.#c(s);this.#f.set(t,n),this.#f.set(i,n);let l=this.#b(s);return this.#j(a,l),n}addLuminosityFilter(t){let e=this.#f.get(t||"luminosity");if(e)return e;let a,i;if(t)[a]=this.#u([t]),i=`luminosity_${a}`;else i="luminosity";if(e=this.#f.get(i),e)return this.#f.set(t,e),e;let s=`g_${this.#i}_luminosity_map_${this.#n++}`,n=this.#c(s);this.#f.set(t,n),this.#f.set(i,n);let l=this.#b(s);if(this.#g(l),t)this.#j(a,l);return n}addKnockoutFilter(t=0){let e=t>0?Math.min(1/t,1e6):1e6,a=`knockout_${e}`,i=this.#f.get(a);if(i)return i;let s=`g_${this.#i}_knockout_filter_${this.#n++}`,n=this.#c(s);this.#f.set(a,n);let l=this.#b(s),f=this.#s.createElementNS("http://www.w3.org/2000/svg","feComponentTransfer");l.append(f);let o=this.#s.createElementNS("http://www.w3.org/2000/svg","feFuncA");return o.setAttribute("type","linear"),o.setAttribute("slope",`${e}`),o.setAttribute("intercept","0"),f.append(o),n}addHighlightHCMFilter(t,e,a,i,s){let n=`${e}-${a}-${i}-${s}`,l=this.#o.get(t);if(l?.key===n)return l.url;if(l)l.filter?.remove(),l.key=n,l.url="none",l.filter=null;else l={key:n,url:"none",filter:null},this.#o.set(t,l);if(!e||!a)return l.url;let[f,o]=[e,a].map(this.#d.bind(this)),c=Math.round(0.2126*f[0]+0.7152*f[1]+0.0722*f[2]),u=Math.round(0.2126*o[0]+0.7152*o[1]+0.0722*o[2]),[m,p]=[i,s].map(this.#S.bind(this));if(u<c)[c,u,m,p]=[u,c,p,m];this.#r.style.color="";let w=(k,y,B)=>{let H=Array(256),M=(u-c)/B,D=k/255,T=(y-k)/(255*B),z=0;for(let E=0;E<=B;E++){let V=Math.round(c+E*M),tt=D+E*T;for(let at=z;at<=V;at++)H[at]=tt;z=V+1}for(let E=z;E<256;E++)H[E]=H[z-1];return H.join(",")},d=`g_${this.#i}_hcm_${t}_filter`,v=l.filter=this.#b(d);return this.#p(v),this.#m(w(m[0],p[0],5),w(m[1],p[1],5),w(m[2],p[2],5),v),l.url=this.#c(d),l.url}destroy(t=!1){if(t&&this.#l?.size)return;this.#a?.parentNode.parentNode.remove(),this.#a=null,this.#e?.clear(),this.#e=null,this.#l?.clear(),this.#l=null,this.#n=0}#g(t){let e=this.#s.createElementNS("http://www.w3.org/2000/svg","feColorMatrix");e.setAttribute("type","matrix"),e.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"),t.append(e)}#p(t){let e=this.#s.createElementNS("http://www.w3.org/2000/svg","feColorMatrix");e.setAttribute("type","matrix"),e.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"),t.append(e)}#b(t){let e=this.#s.createElementNS("http://www.w3.org/2000/svg","filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),this.#r.append(e),e}#h(t,e,a){let i=this.#s.createElementNS("http://www.w3.org/2000/svg",e);i.setAttribute("type","discrete"),i.setAttribute("tableValues",a),t.append(i)}#m(t,e,a,i){let s=this.#s.createElementNS("http://www.w3.org/2000/svg","feComponentTransfer");i.append(s),this.#h(s,"feFuncR",t),this.#h(s,"feFuncG",e),this.#h(s,"feFuncB",a)}#j(t,e){let a=this.#s.createElementNS("http://www.w3.org/2000/svg","feComponentTransfer");e.append(a),this.#h(a,"feFuncA",t)}#d(t){return this.#r.style.color=t,q9(getComputedStyle(this.#r).getPropertyValue("color"))}#w(t){return this.#r.style.color=t,d9(getComputedStyle(this.#r).getPropertyValue("color"))}#S(t){let[e,a,i,s]=this.#w(t);if(s===1)return[e,a,i];let[n,l,f]=this.#d("Canvas");return[zb(e,n,s),zb(a,l,s),zb(i,f,s)]}}function zb(t,e,a){return Math.round(a*t+(1-a)*e)}if(ln)de("Please use the `legacy` build in Node.js environments.");async function SV(t){let a=await process.getBuiltinModule("fs/promises").readFile(t);return new Uint8Array(a)}class tB extends lp{}class eB extends np{_createCanvas(t,e){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(t,e)}}class aB extends sp{async _fetch(t,e){return SV(t)}}function iB({src:t,srcPos:e=0,dest:a,width:i,height:s,nonBlackColor:n=4294967295,inverseDecode:l=!1}){let f=ha.isLittleEndian?4278190080:255,[o,c]=l?[n,f]:[f,n],u=i>>3,m=i&7,p=o^c,w=t.length;a=new Uint32Array(a.buffer);let d=0;for(let v=0;v<s;++v){for(let y=e+u;e<y;++e,d+=8){let B=t[e];a[d]=o^-(B>>7&1)&p,a[d+1]=o^-(B>>6&1)&p,a[d+2]=o^-(B>>5&1)&p,a[d+3]=o^-(B>>4&1)&p,a[d+4]=o^-(B>>3&1)&p,a[d+5]=o^-(B>>2&1)&p,a[d+6]=o^-(B>>1&1)&p,a[d+7]=o^-(B&1)&p}if(m===0)continue;let k=e<w?t[e++]:255;for(let y=0;y<m;++y,++d)a[d]=o^-(k>>7-y&1)&p}return{srcPos:e,destPos:d}}function yV({src:t,srcPos:e=0,dest:a,destPos:i=0,width:s,height:n}){let l=0,f=s*n*3,o=f>>2,c=new Uint32Array(t.buffer,e,o),u=ha.isLittleEndian?4278190080:255;if(ha.isLittleEndian){for(;l<o-2;l+=3,i+=4){let m=c[l],p=c[l+1],w=c[l+2];a[i]=m|u,a[i+1]=m>>>24|p<<8|u,a[i+2]=p>>>16|w<<16|u,a[i+3]=w>>>8|u}for(let m=l*4,p=e+f;m<p;m+=3)a[i++]=t[m]|t[m+1]<<8|t[m+2]<<16|u}else{for(;l<o-2;l+=3,i+=4){let m=c[l],p=c[l+1],w=c[l+2];a[i]=m|u,a[i+1]=m<<24|p>>>8|u,a[i+2]=p<<16|w>>>16|u,a[i+3]=w<<8|u}for(let m=l*4,p=e+f;m<p;m+=3)a[i++]=t[m]<<24|t[m+1]<<16|t[m+2]<<8|u}return{srcPos:e+f,destPos:i}}var kV=`
267
- struct Uniforms {
268
- offsetX : f32,
269
- offsetY : f32,
270
- scaleX : f32,
271
- scaleY : f32,
272
- paddedWidth : f32,
273
- paddedHeight : f32,
274
- borderSize : f32,
275
- _pad : f32,
276
- };
277
-
278
- @group(0) @binding(0) var<uniform> u : Uniforms;
279
-
280
- struct VertexInput {
281
- @location(0) position : vec2<f32>,
282
- @location(1) color : vec4<f32>,
283
- };
284
-
285
- struct VertexOutput {
286
- @builtin(position) position : vec4<f32>,
287
- @location(0) color : vec3<f32>,
288
- };
289
-
290
- @vertex
291
- fn vs_main(in : VertexInput) -> VertexOutput {
292
- var out : VertexOutput;
293
- let cx = (in.position.x + u.offsetX) * u.scaleX;
294
- let cy = (in.position.y + u.offsetY) * u.scaleY;
295
- out.position = vec4<f32>(
296
- ((cx + u.borderSize) / u.paddedWidth) * 2.0 - 1.0,
297
- 1.0 - ((cy + u.borderSize) / u.paddedHeight) * 2.0,
298
- 0.0,
299
- 1.0
300
- );
301
- out.color = in.color.rgb;
302
- return out;
303
- }
304
-
305
- @fragment
306
- fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
307
- return vec4<f32>(in.color, 1.0);
308
- }
309
- `;class sB{#t=null;#e=null;#a=null;#i=null;async#s(){if(!globalThis.navigator?.gpu)return!1;try{let t=await navigator.gpu.requestAdapter();if(!t)return!1;return this.#i=navigator.gpu.getPreferredCanvasFormat(),this.#e=await t.requestDevice(),!0}catch{return!1}}init(){return this.#t||=this.#s()}get isReady(){return this.#e!==null}loadMeshShader(){if(!this.#e||this.#a)return;let t=this.#e.createShaderModule({code:kV});this.#a=this.#e.createRenderPipeline({layout:"auto",vertex:{module:t,entryPoint:"vs_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]},{arrayStride:4,attributes:[{shaderLocation:1,offset:0,format:"unorm8x4"}]}]},fragment:{module:t,entryPoint:"fs_main",targets:[{format:this.#i}]},primitive:{topology:"triangle-list"}})}draw(t,e,a,i,s,n,l,f){this.loadMeshShader();let o=this.#e,{offsetX:c,offsetY:u,scaleX:m,scaleY:p}=i,w=o.createBuffer({size:Math.max(t.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});if(t.byteLength>0)o.queue.writeBuffer(w,0,t);let d=o.createBuffer({size:Math.max(e.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});if(e.byteLength>0)o.queue.writeBuffer(d,0,e);let v=o.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});o.queue.writeBuffer(v,0,new Float32Array([c,u,m,p,n,l,f,0]));let k=o.createBindGroup({layout:this.#a.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:v}}]}),y=new OffscreenCanvas(n,l),B=y.getContext("webgpu");B.configure({device:o,format:this.#i,alphaMode:s?"opaque":"premultiplied"});let H=s?{r:s[0]/255,g:s[1]/255,b:s[2]/255,a:1}:{r:0,g:0,b:0,a:0},M=o.createCommandEncoder(),D=M.beginRenderPass({colorAttachments:[{view:B.getCurrentTexture().createView(),clearValue:H,loadOp:"clear",storeOp:"store"}]});if(a>0)D.setPipeline(this.#a),D.setBindGroup(0,k),D.setVertexBuffer(0,w),D.setVertexBuffer(1,d),D.draw(a);return D.end(),o.queue.submit([M.finish()]),w.destroy(),d.destroy(),v.destroy(),y.transferToImageBitmap()}}var c6=new sB;function CV(){return c6.init()}function _V(){return c6.isReady}function FV(){c6.loadMeshShader()}function BV(t,e,a,i,s,n,l,f){return c6.draw(t,e,a,i,s,n,l,f)}var Qi={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function L3(t,e){if(!e)return;let a=e[2]-e[0],i=e[3]-e[1],s=new Path2D;s.rect(e[0],e[1],a,i),t.clip(s)}class u6{isModifyingCurrentTransform(){return!1}getPattern(){Qe("Abstract method `getPattern` called.")}}class nB extends u6{constructor(t){super();this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}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 t=Math.hypot(this._p0[0]-this._p1[0],this._p0[1]-this._p1[1]);return t+this._r1>this._r0&&t+this._r0>this._r1}_createGradient(t,e=null){let a,i=this._p0,s=this._p1;if(e)i=i.slice(),s=s.slice(),Nt.applyTransform(i,e),Nt.applyTransform(s,e);if(this._type==="axial")a=t.createLinearGradient(i[0],i[1],s[0],s[1]);else if(this._type==="radial"){let n=this._r0,l=this._r1;if(e){let f=new Float32Array(2);Nt.singularValueDecompose2dScale(e,f),n*=f[0],l*=f[0]}a=t.createRadialGradient(i[0],i[1],n,s[0],s[1],l)}for(let n of this._colorStops)a.addColorStop(n[0],n[1]);return a}_createReversedGradient(t,e=null){let a=this._p1,i=this._p0;if(e)a=a.slice(),i=i.slice(),Nt.applyTransform(a,e),Nt.applyTransform(i,e);let s=this._r1,n=this._r0;if(e){let o=new Float32Array(2);Nt.singularValueDecompose2dScale(e,o),s*=o[0],n*=o[0]}let l=t.createRadialGradient(a[0],a[1],s,i[0],i[1],n),f=this._colorStops.map(([o,c])=>[1-o,c]).reverse();for(let[o,c]of f)l.addColorStop(o,c);return l}getPattern(t,e,a,i){let s;if(i===Qi.STROKE||i===Qi.FILL){if(this.isOriginBased()){let m=Nt.transform(a,e.baseTransform);if(this.matrix)m=Nt.transform(m,this.matrix);let p=0.001,w=Math.hypot(m[0],m[1]),d=Math.hypot(m[2],m[3]),v=(m[0]*m[2]+m[1]*m[3])/(w*d);if(Math.abs(v)<p)if(this.isRadial()){if(Math.abs(w-d)<p)return this._createGradient(t,m)}else return this._createGradient(t,m)}let n=e.current.getClippedPathBoundingBox(i,Aa(t))||[0,0,0,0],l=Math.ceil(n[2]-n[0])||1,f=Math.ceil(n[3]-n[1])||1,o=e.canvasFactory.create(l,f),c=o.context;if(c.clearRect(0,0,c.canvas.width,c.canvas.height),c.beginPath(),c.rect(0,0,c.canvas.width,c.canvas.height),c.translate(-n[0],-n[1]),a=Nt.transform(a,[1,0,0,1,n[0],n[1]]),c.transform(...e.baseTransform),this.matrix)c.transform(...this.matrix);if(L3(c,this._bbox),this.areConic())c.fillStyle=this._createReversedGradient(c),c.fill();c.fillStyle=this._createGradient(c),c.fill(),s=t.createPattern(o.canvas,"no-repeat"),e.canvasFactory.destroy(o);let u=new DOMMatrix(a);s.setTransform(u)}else{if(this.areConic())t.save(),L3(t,this._bbox),t.fillStyle=this._createReversedGradient(t),t.fillRect(-10000000000,-10000000000,20000000000,20000000000),t.restore();L3(t,this._bbox),s=this._createGradient(t)}return s}}function OV(t,e,a,i,s,n,l,f){let{coords:o,colors:c}=e,u=t.data,m=t.width*4,p;if(o[a*2+1]>o[i*2+1])p=a,a=i,i=p,p=n,n=l,l=p;if(o[i*2+1]>o[s*2+1])p=i,i=s,s=p,p=l,l=f,f=p;if(o[a*2+1]>o[i*2+1])p=a,a=i,i=p,p=n,n=l,l=p;let w=(o[a*2]+e.offsetX)*e.scaleX,d=(o[a*2+1]+e.offsetY)*e.scaleY,v=(o[i*2]+e.offsetX)*e.scaleX,k=(o[i*2+1]+e.offsetY)*e.scaleY,y=(o[s*2]+e.offsetX)*e.scaleX,B=(o[s*2+1]+e.offsetY)*e.scaleY;if(d>=B)return;let H=c[n*4],M=c[n*4+1],D=c[n*4+2],T=c[l*4],z=c[l*4+1],E=c[l*4+2],V=c[f*4],tt=c[f*4+1],at=c[f*4+2],Q=Math.round(d),Z=Math.round(B),J,Y,W,ft,nt,qt,R,ct;for(let pt=Q;pt<=Z;pt++){if(pt<k){let Ft=pt<d?0:(d-pt)/(d-k);J=w-(w-v)*Ft,Y=H-(H-T)*Ft,W=M-(M-z)*Ft,ft=D-(D-E)*Ft}else{let Ft;if(pt>B)Ft=1;else if(k===B)Ft=0;else Ft=(k-pt)/(k-B);J=v-(v-y)*Ft,Y=T-(T-V)*Ft,W=z-(z-tt)*Ft,ft=E-(E-at)*Ft}let G;if(pt<d)G=0;else if(pt>B)G=1;else G=(d-pt)/(d-B);nt=w-(w-y)*G,qt=H-(H-V)*G,R=M-(M-tt)*G,ct=D-(D-at)*G;let Ct=Math.round(Math.min(J,nt)),Kt=Math.round(Math.max(J,nt)),le=m*pt+Ct*4;for(let Ft=Ct;Ft<=Kt;Ft++){if(G=(J-Ft)/(J-nt),G<0)G=0;else if(G>1)G=1;u[le++]=Y-(Y-qt)*G|0,u[le++]=W-(W-R)*G|0,u[le++]=ft-(ft-ct)*G|0,u[le++]=255}}}class lB extends u6{constructor(t){super();this._posData=t[2],this._colData=t[3],this._vertexCount=t[4],this._bounds=t[5],this._bbox=t[6],this._background=t[7],this.matrix=null,FV()}_createMeshCanvas(t,e,a){let l=Math.floor(this._bounds[0]),f=Math.floor(this._bounds[1]),o=Math.ceil(this._bounds[2])-l,c=Math.ceil(this._bounds[3])-f,u=Math.min(Math.ceil(Math.abs(o*t[0]*1.1)),3000)||1,m=Math.min(Math.ceil(Math.abs(c*t[1]*1.1)),3000)||1,p=o?o/u:1,w=c?c/m:1,d={coords:this._posData,colors:this._colData,offsetX:-l,offsetY:-f,scaleX:1/p,scaleY:1/w},v=u+4,k=m+4,y=a.create(v,k);if(_V()&&this._vertexCount>48)y.context.drawImage(BV(this._posData,this._colData,this._vertexCount,d,e,v,k,2),0,0);else{let B=y.context.createImageData(u,m);if(e){let H=B.data;for(let M=0,D=H.length;M<D;M+=4)H[M]=e[0],H[M+1]=e[1],H[M+2]=e[2],H[M+3]=255}for(let H=0,M=this._vertexCount;H<M;H+=3)OV(B,d,H,H+1,H+2,H,H+1,H+2);y.context.putImageData(B,2,2)}return{canvas:y.canvas,offsetX:l-2*p,offsetY:f-2*w,scaleX:p,scaleY:w}}isModifyingCurrentTransform(){return!0}getPattern(t,e,a,i){L3(t,this._bbox);let s=new Float32Array(2);if(i===Qi.SHADING)Nt.singularValueDecompose2dScale(Aa(t),s);else if(this.matrix){Nt.singularValueDecompose2dScale(this.matrix,s);let[f,o]=s;Nt.singularValueDecompose2dScale(e.baseTransform,s),s[0]*=f,s[1]*=o}else Nt.singularValueDecompose2dScale(e.baseTransform,s);let n=this._createMeshCanvas(s,i===Qi.SHADING?null:this._background,e.canvasFactory);if(i!==Qi.SHADING){if(t.setTransform(...e.baseTransform),this.matrix)t.transform(...this.matrix)}t.translate(n.offsetX,n.offsetY),t.scale(n.scaleX,n.scaleY);let l=t.createPattern(n.canvas,"no-repeat");return e.canvasFactory.destroy(n),l}}class fB extends u6{getPattern(){return"hotpink"}}function HV(t){switch(t[0]){case"RadialAxial":return new nB(t);case"Mesh":return new lB(t);case"Dummy":return new fB}throw Error(`Unknown IR type: ${t[0]}`)}var mF={COLORED:1,UNCOLORED:2};class h9{static MAX_PATTERN_SIZE=3000;constructor(t,e,a,i){this.color=t[1],this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.needsIsolation=t[9]??!0,this.ctx=e,this.canvasGraphicsFactory=a,this.baseTransform=i,this.patternBaseMatrix=this.matrix?Nt.transform(i,this.matrix):i}canSkipPatternCanvas([t,e,a,i]){let[s,n,l,f]=this.bbox,o=Math.abs(this.xstep),c=Math.abs(this.ystep);if(t>o+0.000001||e>c+0.000001)return null;let u=Math.floor((a-l)/o)+1,m=Math.ceil((a+t-s)/o)-1,p=Math.floor((i-f)/c)+1,w=Math.ceil((i+e-n)/c)-1;return m<=u&&w<=p?[u,p]:null}updatePatternDims(t,e){let a=Nt.inverseTransform(this.patternBaseMatrix),i=[t[0],t[1]],s=[t[2],t[3]];Nt.applyTransform(i,a),Nt.applyTransform(s,a),e[0]=Math.abs(s[0]-i[0]),e[1]=Math.abs(s[1]-i[1]),e[2]=Math.min(i[0],s[0]),e[3]=Math.min(i[1],s[1])}_renderTileCanvas(t,e,a,i){let[s,n,l,f]=this.bbox,o=t.canvasFactory.create(a.size,i.size),c=o.context,u=this.canvasGraphicsFactory.createCanvasGraphics(c,e);return u.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(u,this.paintType,this.color),c.translate(-a.scale*s,-i.scale*n),u.transform(0,a.scale,0,0,i.scale,0,0),c.save(),u.dependencyTracker?.save(),this.clipBbox(u,s,n,l,f),u.baseTransform=Aa(u.ctx),u.executeOperatorList(this.operatorList),u.endDrawing(),u.dependencyTracker?.restore(),c.restore(),o}_getCombinedScales(){let t=new Float32Array(2);Nt.singularValueDecompose2dScale(this.matrix,t);let[e,a]=t;return Nt.singularValueDecompose2dScale(this.baseTransform,t),[e*t[0],a*t[1]]}drawPattern(t,e,a=!1,[i,s],n){let[l,f,o,c]=this.bbox,u=t.dependencyTracker;if(u)t.dependencyTracker=new g9(u,n);if(t.save(),a)t.ctx.clip(e,"evenodd");else t.ctx.clip(e);if(t.ctx.setTransform(...this.patternBaseMatrix),t.ctx.translate(i*this.xstep,s*this.ystep),this.needsIsolation||t.ctx.globalAlpha!==1||t.ctx.globalCompositeOperation!=="source-over"||t.inSMaskMode){let m=o-l,p=c-f,[w,d]=this._getCombinedScales(),v=this.getSizeAndScale(m,this.ctx.canvas.width,w),k=this.getSizeAndScale(p,this.ctx.canvas.height,d),y=this._renderTileCanvas(t,n,v,k);t.ctx.drawImage(y.canvas,l,f,m,p),t.canvasFactory.destroy(y)}else this.setFillAndStrokeStyleToContext(t,this.paintType,this.color),this.clipBbox(t,l,f,o,c),t.baseTransformStack.push(t.baseTransform),t.baseTransform=Aa(t.ctx),t.executeOperatorList(this.operatorList),t.baseTransform=t.baseTransformStack.pop();if(t.restore(),u)t.dependencyTracker=u}createPatternCanvas(t,e){let[a,i,s,n]=this.bbox,l=s-a,f=n-i,{xstep:o,ystep:c}=this;o=Math.abs(o),c=Math.abs(c),n6("TilingType: "+this.tilingType);let[u,m]=this._getCombinedScales(),p=l,w=f,d=!1,v=!1;if(Math.ceil(o*u)>=Math.ceil(l*u))p=o;else d=!0;if(Math.ceil(c*m)>=Math.ceil(f*m))w=c;else v=!0;let k=this.getSizeAndScale(p,this.ctx.canvas.width,u),y=this.getSizeAndScale(w,this.ctx.canvas.height,m),B=this._renderTileCanvas(t,e,k,y);if(d||v){let H=B.canvas;if(d)p=o;if(v)w=c;let M=this.getSizeAndScale(p,this.ctx.canvas.width,u),D=this.getSizeAndScale(w,this.ctx.canvas.height,m),T=M.size,z=D.size,E=t.canvasFactory.create(T,z),V=E.context,tt=d?Math.floor(l/o):0,at=v?Math.floor(f/c):0;for(let Q=0;Q<=tt;Q++)for(let Z=0;Z<=at;Z++)V.drawImage(H,T*Q,z*Z,T,z,0,0,T,z);return t.canvasFactory.destroy(B),{canvas:E.canvas,canvasEntry:E,scaleX:M.scale,scaleY:D.scale,offsetX:a,offsetY:i}}return{canvas:B.canvas,canvasEntry:B,scaleX:k.scale,scaleY:y.scale,offsetX:a,offsetY:i}}getSizeAndScale(t,e,a){let i=Math.max(h9.MAX_PATTERN_SIZE,e),s=Math.ceil(t*a);if(s>=i)s=i;else a=s/t;return{scale:a,size:s}}clipBbox(t,e,a,i,s){let n=i-e,l=s-a,f=new Path2D;f.rect(e,a,n,l),Nt.axialAlignedBoundingBox([e,a,i,s],Aa(t.ctx),t.current.minMax),t.ctx.clip(f),t.current.updateClipFromPath()}setFillAndStrokeStyleToContext(t,e,a){let{ctx:i,current:s}=t;switch(s.patternFill=s.patternStroke=!1,e){case mF.COLORED:let{fillStyle:n,strokeStyle:l}=this.ctx;i.fillStyle=s.fillColor=n,i.strokeStyle=s.strokeColor=l;break;case mF.UNCOLORED:i.fillStyle=i.strokeStyle=a,s.fillColor=s.strokeColor=a;break;default:throw new FF(`Unsupported paint type: ${e}`)}}isModifyingCurrentTransform(){return!1}getPattern(t,e,a,i,s){let n=i!==Qi.SHADING?Nt.transform(a,this.patternBaseMatrix):a,l=this.createPatternCanvas(e,s),f=new DOMMatrix(n);f=f.translate(l.offsetX,l.offsetY),f=f.scale(1/l.scaleX,1/l.scaleY);let o=t.createPattern(l.canvas,"repeat");return e.canvasFactory.destroy(l.canvasEntry),o.setTransform(f),o}}var MV=16,DV=100,TV=15,gF=10,xs=16,Eb=new DOMMatrix,rn=new Float32Array(2);function bF(t,e){if(t._removeMirroring)throw Error("Context is already forwarding operations.");let a=new Map;for(let i of["save","restore","rotate","scale","translate","transform","setTransform","resetTransform","clip","moveTo","lineTo","bezierCurveTo","quadraticCurveTo","arc","arcTo","ellipse","rect","roundRect","closePath","beginPath"]){let s=t[i];if(typeof s!=="function"||typeof e[i]!=="function")continue;a.set(i,s),t[i]=function(...n){return e[i](...n),s.apply(this,n)}}t._removeMirroring=()=>{for(let[i,s]of a)t[i]=s;delete t._removeMirroring}}function z3(t,e,a,i,s,n,l,f,o,c){let[u,m,p,w,d,v]=Aa(t);if(m===0&&p===0){let B=l*u+d,H=Math.round(B),M=f*w+v,D=Math.round(M),T=(l+o)*u+d,z=Math.abs(Math.round(T)-H)||1,E=(f+c)*w+v,V=Math.abs(Math.round(E)-D)||1;return t.setTransform(Math.sign(u),0,0,Math.sign(w),H,D),t.drawImage(e,a,i,s,n,0,0,z,V),t.setTransform(u,m,p,w,d,v),[z,V]}if(u===0&&w===0){let B=f*p+d,H=Math.round(B),M=l*m+v,D=Math.round(M),T=(f+c)*p+d,z=Math.abs(Math.round(T)-H)||1,E=(l+o)*m+v,V=Math.abs(Math.round(E)-D)||1;return t.setTransform(0,Math.sign(m),Math.sign(p),0,H,D),t.drawImage(e,a,i,s,n,0,0,V,z),t.setTransform(u,m,p,w,d,v),[V,z]}t.drawImage(e,a,i,s,n,l,f,o,c);let k=Math.hypot(u,m),y=Math.hypot(p,w);return[k*o,y*c]}class Qb{alphaIsShape=!1;fontSize=0;fontSizeScale=1;textMatrix=null;textMatrixScale=1;fontMatrix=Ub;leading=0;x=0;y=0;lineX=0;lineY=0;charSpacing=0;wordSpacing=0;textHScale=1;textRenderingMode=wi.FILL;textRise=0;fillColor="#000000";strokeColor="#000000";tilingPatternDims=null;patternFill=!1;patternStroke=!1;fillAlpha=1;strokeAlpha=1;lineWidth=1;activeSMask=null;transferMaps="none";minMax=lr.slice();constructor(t,e){this.clipBox=new Float32Array([0,0,t,e])}clone(){let t=Object.create(this);return t.clipBox=this.clipBox.slice(),t.minMax=this.minMax.slice(),t.tilingPatternDims=this.tilingPatternDims?.slice(),t}getPathBoundingBox(t=Qi.FILL,e=null){let a=this.minMax.slice();if(t===Qi.STROKE){if(!e)Qe("Stroke bounding box must include transform.");Nt.singularValueDecompose2dScale(e,rn);let i=rn[0]*this.lineWidth/2,s=rn[1]*this.lineWidth/2;a[0]-=i,a[1]-=s,a[2]+=i,a[3]+=s}return a}updateClipFromPath(){let t=Nt.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(t){this.clipBox.set(t,0),this.minMax.set(lr,0)}getClippedPathBoundingBox(t=Qi.FILL,e=null){return Nt.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function pF(t,e){let{width:a,height:i,kind:s}=e,n=i%xs,l=(i-n)/xs,f=n===0?l:l+1,o=t.createImageData(a,xs),c=0,u=e.data,m=o.data,p;if(s===X3.GRAYSCALE_1BPP)for(p=0;p<f;p++)({srcPos:c}=iB({src:u,srcPos:c,dest:m,width:a,height:p<l?xs:n})),t.putImageData(o,0,p*xs);else if(s===X3.RGBA_32BPP){let w=0,d=a*xs*4;for(p=0;p<l;p++)m.set(u.subarray(c,c+d)),c+=d,t.putImageData(o,0,w),w+=xs;if(p<f)d=a*n*4,m.set(u.subarray(c,c+d)),t.putImageData(o,0,w)}else if(s===X3.RGB_24BPP)for(p=0;p<f;p++)({srcPos:c}=yV({src:u,srcPos:c,dest:new Uint32Array(m.buffer),width:a,height:p<l?xs:n})),t.putImageData(o,0,p*xs);else throw Error(`bad image kind: ${s}`)}function wF(t,e){if(e.bitmap){t.drawImage(e.bitmap,0,0);return}let{width:a,height:i}=e,s=i%xs,n=(i-s)/xs,l=s===0?n:n+1,f=t.createImageData(a,xs),o=0,c=e.data,u=f.data;for(let m=0;m<l;m++)({srcPos:o}=iB({src:c,srcPos:o,dest:u,width:a,height:m<n?xs:s,nonBlackColor:0})),t.putImageData(f,0,m*xs)}function ir(t,e){let a=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(let i of a)if(t[i]!==void 0)e[i]=t[i];if(t.setLineDash!==void 0)e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset}function E3(t){if(t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miterLimit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",t.setLineDash!==void 0)t.setLineDash([]),t.lineDashOffset=0;let{filter:e}=t;if(e!=="none"&&e!=="")t.filter="none"}function jF(t,e){if(e)return!0;Nt.singularValueDecompose2dScale(t,rn);let a=Math.fround(N0.pixelRatio*rr.PDF_TO_CSS_UNITS);return rn[0]<=a&&rn[1]<=a}var RV=["butt","round","square"],NV=["miter","round","bevel"],zV={},dF={};class Fh{#t=0;#e=0;#a=null;#i=null;#s=null;#l=null;#n=1;#f;#o=null;#r=[];constructor(t,e,a,i,s,{optionalContentConfig:n,markedContentStack:l=null},f,o,c,u){this.ctx=t,this.current=new Qb(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.commonObjs=e,this.objs=a,this.canvasFactory=i,this.filterFactory=s,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=n,this.cachedPatterns=new Map,this.annotationCanvasMap=f,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=o,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=c??null,this.imagesTracker=u??null}getObject(t,e,a=null){if(typeof e==="string")return this.dependencyTracker?.recordNamedDependency(t,e),e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e);return a}beginDrawing({transform:t,viewport:e,transparency:a=!1,background:i=null}){let s=this.ctx.canvas.width,n=this.ctx.canvas.height,l=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,s,n),this.ctx.fillStyle=l,a){let f=this.transparentCanvasEntry=this.canvasFactory.create(s,n);this.compositeCtx=this.ctx,{canvas:this.transparentCanvas,context:this.ctx}=f,this.ctx.save(),this.ctx.transform(...Aa(this.compositeCtx))}if(this.ctx.save(),E3(this.ctx),t)this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[3];this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=Aa(this.ctx)}executeOperatorList(t,e,a,i,s){let{argsArray:n,fnArray:l}=t,f=e||0,o=n.length;if(o===f)return f;let c=o-f>gF&&typeof a==="function",u=c?Date.now()+TV:0,m=0,p=this.commonObjs,w=this.objs,d,v;while(!0){if(i!==void 0){if(f===i.nextBreakPoint)return i.breakIt(f,a),f;if(i.shouldSkip(f)){if(++f===o)return f;continue}}if(!s||s(f))if(d=l[f],v=n[f]??null,d!==T0.dependency)if(v===null)this[d](f);else this[d](f,...v);else for(let k of v){this.dependencyTracker?.recordNamedData(k,f);let y=k.startsWith("g_")?p:w;if(!y.has(k))return y.get(k,a),f}if(f++,f===o)return f;if(c&&++m>gF){if(Date.now()>u)return a(),f;m=0}}}#u(){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.#u();for(let t of this.smaskGroupCanvases)this.canvasFactory.destroy(t);this.smaskGroupCanvases.length=0,this._clearPreparedSMask(),this.tempSMask=null,this.smaskStack.length=0;for(let t of this.#r)this.#w(t);this.#r.length=0,this.#a=null,this.#i=null,this.#s=null,this.#l=null,this.#n=1,this.#o=null,this.#e=0,this.#t=0,this.cachedPatterns.clear();for(let t of this._cachedBitmapsMap.values()){for(let e of t.values())if(typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement)e.width=e.height=0;t.clear()}this._cachedBitmapsMap.clear(),this.#c()}#c(){if(this.pageColors){let t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){let e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}}_scaleImage(t,e){let a=t.width??t.displayWidth,i=t.height??t.displayHeight,s=Math.max(Math.hypot(e[0],e[1]),1),n=Math.max(Math.hypot(e[2],e[3]),1),l=[],f=s,o=n,c=a,u=i;while(f>2&&c>1||o>2&&u>1){let k=c,y=u;if(f>2&&c>1)k=Math.ceil(c/2),f/=c/k;if(o>2&&u>1)y=Math.ceil(u/2),o/=u/y;l.push({newWidth:k,newHeight:y}),c=k,u=y}if(l.length===0)return{img:t,paintWidth:a,paintHeight:i,tmpCanvas:null};if(l.length===1){let{newWidth:k,newHeight:y}=l[0],B=this.canvasFactory.create(k,y);return B.context.drawImage(t,0,0,a,i,0,0,k,y),{img:B.canvas,paintWidth:k,paintHeight:y,tmpCanvas:B}}let m=this.canvasFactory.create(1,1),p=this.canvasFactory.create(1,1),w=a,d=i,v=t;for(let{newWidth:k,newHeight:y}of l)this.canvasFactory.reset(p,k,y),p.context.drawImage(v,0,0,w,d,0,0,k,y),[m,p]=[p,m],v=m.canvas,w=k,d=y;return this.canvasFactory.destroy(p),{img:m.canvas,paintWidth:w,paintHeight:d,tmpCanvas:m}}_createMaskCanvas(t,e){let a=this.ctx,{width:i,height:s}=e,n=this.current.fillColor,l=this.current.patternFill,f=Aa(a),o,c,u,m;if((e.bitmap||e.data)&&e.count>1){let tt=e.bitmap||e.data.buffer;c=JSON.stringify(l?f:[f.slice(0,4),n]),o=this._cachedBitmapsMap.getOrInsertComputed(tt,$b);let at=o.get(c);if(at&&!l){let Q=Math.round(Math.min(f[0],f[2])+f[4]),Z=Math.round(Math.min(f[1],f[3])+f[5]);return this.dependencyTracker?.recordDependencies(t,Dn.transformAndFill),{canvas:at,offsetX:Q,offsetY:Z}}u=at}if(!u)m=this.canvasFactory.create(i,s),wF(m.context,e);let p=Nt.transform(f,[1/i,0,0,-1/s,0,0]);p=Nt.transform(p,[1,0,0,1,0,-s]);let w=lr.slice();Nt.axialAlignedBoundingBox([0,0,i,s],p,w);let[d,v,k,y]=w,B=Math.round(k-d)||1,H=Math.round(y-v)||1,M=this.canvasFactory.create(B,H),D=M.context,T=d,z=v;D.translate(-T,-z),D.transform(...p);let E=null;if(!u){let tt=this._scaleImage(m.canvas,H0(D));if(u=tt.img,E=tt.tmpCanvas,u!==m.canvas)this.canvasFactory.destroy(m),m=null;if(o&&l)o.set(c,u),E=null,m=null}if(D.imageSmoothingEnabled=jF(Aa(D),e.interpolate),z3(D,u,0,0,u.width,u.height,0,0,i,s),E)this.canvasFactory.destroy(E);if(m)this.canvasFactory.destroy(m);D.globalCompositeOperation="source-in";let V=Nt.transform(H0(D),[1,0,0,1,-T,-z]);if(D.fillStyle=l?n.getPattern(a,this,V,Qi.FILL,t):n,D.fillRect(0,0,i,s),o&&!l)o.set(c,M.canvas);return this.dependencyTracker?.recordDependencies(t,Dn.transformAndFill),{canvas:M.canvas,canvasEntry:o&&!l?null:M,offsetX:Math.round(T),offsetY:Math.round(z)}}setLineWidth(t,e){if(this.dependencyTracker?.recordSimpleData("lineWidth",t),e!==this.current.lineWidth)this._cachedScaleForStroking[0]=-1;this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(t,e){this.dependencyTracker?.recordSimpleData("lineCap",t),this.ctx.lineCap=RV[e]}setLineJoin(t,e){this.dependencyTracker?.recordSimpleData("lineJoin",t),this.ctx.lineJoin=NV[e]}setMiterLimit(t,e){this.dependencyTracker?.recordSimpleData("miterLimit",t),this.ctx.miterLimit=e}setDash(t,e,a){this.dependencyTracker?.recordSimpleData("dash",t);let i=this.ctx;if(i.setLineDash!==void 0)i.setLineDash(e),i.lineDashOffset=a}setRenderingIntent(t,e){}setFlatness(t,e){}setGState(t,e){for(let[a,i]of e)switch(a){case"LW":this.setLineWidth(t,i);break;case"LC":this.setLineCap(t,i);break;case"LJ":this.setLineJoin(t,i);break;case"ML":this.setMiterLimit(t,i);break;case"D":this.setDash(t,i[0],i[1]);break;case"RI":this.setRenderingIntent(t,i);break;case"FL":this.setFlatness(t,i);break;case"Font":this.setFont(t,i[0],i[1]);break;case"CA":this.dependencyTracker?.recordSimpleData("strokeAlpha",t),this.current.strokeAlpha=i;break;case"ca":this.dependencyTracker?.recordSimpleData("fillAlpha",t),this.ctx.globalAlpha=this.current.fillAlpha=i;break;case"BM":this.dependencyTracker?.recordSimpleData("globalCompositeOperation",t),this.ctx.globalCompositeOperation=i;break;case"SMask":if(this.dependencyTracker?.recordSimpleData("SMask",t),this.current.activeSMask=i?this.tempSMask:null,this.current.activeSMask)this.current.activeSMask.blendMode=this.ctx.globalCompositeOperation;this.tempSMask=null,this.checkSMaskState(t);break;case"TR":this.dependencyTracker?.recordSimpleData("filter",t),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(i);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(t){if(t===this.smaskPreparedFor)return;this._clearPreparedSMask(),this._prepareSMaskCanvas(t)}checkSMaskState(t){let e=this.inSMaskMode;if(this.current.activeSMask&&!e)this.beginSMaskMode(t);else if(!this.current.activeSMask&&e)this.endSMaskMode();else if(this.current.activeSMask&&e)this._ensurePreparedSMask(this.current.activeSMask)}_prepareSMaskCanvas(t){let{canvas:e,subtype:a,backdrop:i,transferMap:s}=t,n=a==="Luminosity"||a==="Alpha"&&s;if(!n&&!(a==="Luminosity"&&i)){this.smaskPreparedFor=t;return}let l;if(a==="Luminosity"&&i){let[y,B,H]=d9(i),M=Math.round(0.3*y+0.59*B+0.11*H);l=s?.[M]??M}else l=s?.[0]??0;let f=4,{width:o,height:c}=this.ctx.canvas,u=e.width*e.height,m=o*c<f*u,p=n?{url:a==="Alpha"?this.filterFactory.addAlphaFilter(s):this.filterFactory.addLuminosityFilter(s),subtype:a,transferMap:s}:null,w=a==="Luminosity"?i:null,d,v,k;if(m)d=this._bakeSMaskCanvas(e,t.offsetX,t.offsetY,o,c,w,p),v=0,k=0;else d=this._bakeSMaskCanvas(e,0,0,e.width,e.height,w,p),v=t.offsetX,k=t.offsetY;this.smaskPreparedEntry=d,this.smaskPreparedFor=t,this.smaskPreparedOffsetX=v,this.smaskPreparedOffsetY=k,this.smaskPreparedOOBAlpha=!m&&l!==0?l:null}_bakeSMaskCanvas(t,e,a,i,s,n,l){if(!n&&!l)Qe("_bakeSMaskCanvas with neither backdrop nor filter");let f=this.canvasFactory.create(i,s),o=f.context;if(o.drawImage(t,e,a),n)o.globalCompositeOperation="destination-atop",o.fillStyle=n,o.fillRect(0,0,i,s);if(!l)return f;let c=this.canvasFactory.create(i,s),u=c.context;u.filter=l.url;let m=ha.isCanvasFilterSupported&&u.filter!=="none"&&u.filter!=="";if(u.drawImage(f.canvas,0,0),ha.isCanvasFilterSupported)u.filter="none";if(!m){let p=u.getImageData(0,0,i,s),{data:w}=p,{transferMap:d}=l;if(l.subtype==="Luminosity")for(let v=0,k=w.length;v<k;v+=4){let y=0.3*w[v]+0.59*w[v+1]+0.11*w[v+2]+0.5|0;w[v]=w[v+1]=w[v+2]=0,w[v+3]=d?.[y]??y}else for(let v=3,k=w.length;v<k;v+=4)w[v]=d[w[v]];u.putImageData(p,0,0)}return this.canvasFactory.destroy(f),c}beginSMaskMode(t){if(this.inSMaskMode)throw Error("beginSMaskMode called while already in smask mode");let{width:e,height:a}=this.ctx.canvas,i=this.canvasFactory.create(e,a);this.smaskScratchCanvas=i,this.suspendedCtx=this.ctx;let s=this.ctx=i.context;s.setTransform(this.suspendedCtx.getTransform()),ir(this.suspendedCtx,s),bF(s,this.suspendedCtx),this._ensurePreparedSMask(this.current.activeSMask),this.setGState(t,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),ir(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null,this.canvasFactory.destroy(this.smaskScratchCanvas),this.smaskScratchCanvas=null,this._clearPreparedSMask()}#g(t,e=null,a=1){let{width:i,height:s}=t,n=e??this.canvasFactory.create(i,s),l=n.context;a=Math.round(a*255)/255;let f=a<1;if(f&&this.#f===void 0)this.#f=ha.isCanvasFilterSupported?new Map:"none";let o="none";if(f&&this.#f instanceof Map)o=this.#f.getOrInsertComputed(a,()=>this.filterFactory.addKnockoutFilter(a));if(!f||o!=="none"){if(e)l.save(),l.setTransform(1,0,0,1,0,0),l.clearRect(0,0,i,s),l.restore();return l.filter=o,l.drawImage(t,0,0),l.filter="none",n}let c=t.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,i,s),u=l.createImageData(i,s),m=c.data,p=u.data,w=a>0?1/a:1e6;for(let d=3,v=m.length;d<v;d+=4)p[d]=Math.min(Math.round(m[d]*w),255);return l.putImageData(u,0,0),n}#p(t,e,a,i){let s=t?.[e]??null;if(s&&(s.canvas.width!==a||s.canvas.height!==i))this.canvasFactory.destroy(s),s=null;if(!s){if(s=this.canvasFactory.create(a,i),t)t[e]=s;return s}let n=s.context;return n.save(),n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,a,i),n.restore(),s}#b(t,e,a={}){let{backdropCanvas:i=null,destTransform:s=[1,0,0,1,0,0],backdropOffset:n=[0,0],reuseMaskEntry:l=null,poolMeta:f=null,sourceAlpha:o=1,sourceFilter:c="none",knockoutAlpha:u=1}=a,{width:m,height:p}=e,w=this.#g(e,l,u),d=t.globalCompositeOperation;if(t.save(),t.setTransform(...s),t.globalAlpha=1,ha.isCanvasFilterSupported)t.filter="none";if(t.globalCompositeOperation="destination-out",t.drawImage(w.canvas,0,0),i){let[v,k]=n,y=this.#p(f,"knockoutBackdropEntry",m,p),B=y.context;if(B.drawImage(i,v,k,m,p,0,0,m,p),B.globalCompositeOperation="destination-in",B.drawImage(w.canvas,0,0),B.globalCompositeOperation="source-over",t.globalCompositeOperation="destination-over",t.drawImage(y.canvas,0,0),!f)this.canvasFactory.destroy(y)}if(t.globalCompositeOperation=d,t.globalAlpha=o,ha.isCanvasFilterSupported)t.filter=c??"none";if(t.drawImage(e,0,0),t.restore(),!l)this.canvasFactory.destroy(w)}#h(t=1){if(this.#t===0||this.#e>0||!this.contentVisible)return!1;this.#e++,this.#n=t;let e=this.#r.at(-1),{canvas:a}=this.ctx,i=this.#p(e,"knockoutTempEntry",a.width,a.height);this.#a=i;let s=i.context;if(s.save(),s.setTransform(this.ctx.getTransform()),ir(this.ctx,s),this.#l=s.globalCompositeOperation,s.globalCompositeOperation="source-over",bF(s,this.ctx),this.#o=e,this.#i=this.ctx,this.#s=this.suspendedCtx,this.ctx=s,this.inSMaskMode)this.suspendedCtx=s;return!0}#m(t){if(!t)return;let e=this.#a,a=this.#i,i=this.#s,s=e.context;if(this.#a=null,this.#i=null,this.#s=null,this.inSMaskMode&&this.suspendedCtx===s&&this.ctx!==s)this.endSMaskMode();if(this.inSMaskMode)this.suspendedCtx=i;this.ctx._removeMirroring(),this.ctx.globalCompositeOperation=this.#l,this.#l=null,ir(this.ctx,a),this.ctx=a;let n=this.#o;this.#o=null;let l=this.#n;this.#n=1;try{this.#b(i??a,e.canvas,{backdropCanvas:n?.backdropCtx?.canvas??null,backdropOffset:n?.backdropCtx?[n.offsetX,n.offsetY]:[0,0],reuseMaskEntry:n?.knockoutMaskEntry??null,poolMeta:n,knockoutAlpha:l})}finally{if(s.restore(),this.#e--,!n)this.canvasFactory.destroy(e)}}compose(t){if(!this.current.activeSMask)return;t=t?[Math.floor(t[0]),Math.floor(t[1]),Math.ceil(t[2]),Math.ceil(t[3])]:[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let e=this.current.activeSMask,a=this.suspendedCtx,i=this.#e>0&&a===this.ctx;if(this.composeSMask(i?null:a,e,this.ctx,t),i)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(t,e,a,i){let s=i[0],n=i[1],l=i[2]-s,f=i[3]-n;if(l===0||f===0)return;let o=this.smaskPreparedEntry;if(o){let c=s,u=n,m=l,p=f,w=this.smaskPreparedOOBAlpha,d=w!==null;if(d){c=Math.max(s,e.offsetX),u=Math.max(n,e.offsetY);let v=Math.min(s+l,e.offsetX+e.canvas.width),k=Math.min(n+f,e.offsetY+e.canvas.height);m=v-c,p=k-u}if(m>0&&p>0){let v=c-this.smaskPreparedOffsetX,k=u-this.smaskPreparedOffsetY;a.save(),a.globalAlpha=1,a.setTransform(1,0,0,1,0,0);let y=new Path2D;y.rect(c,u,m,p),a.clip(y),a.globalCompositeOperation="destination-in",a.drawImage(o.canvas,v,k,m,p,c,u,m,p),a.restore()}if(d&&w<255)this._applySMaskOOBAlpha(a,s,n,l,f,c,u,c+m,u+p,w)}else this.genericComposeSMask(e,a,l,f,s,n);if(!t)return;t.save(),t.globalAlpha=1,t.globalCompositeOperation=e.blendMode||"source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(a.canvas,s,n,l,f,s,n,l,f),t.restore()}_applySMaskOOBAlpha(t,e,a,i,s,n,l,f,o,c){let u=n<f&&l<o;if(u&&n===e&&l===a&&f===e+i&&o===a+s)return;let m=new Path2D;if(m.rect(e,a,i,s),u)m.rect(n,l,f-n,o-l);t.save(),t.globalAlpha=c/255,t.setTransform(1,0,0,1,0,0),t.clip(m,"evenodd"),t.globalCompositeOperation="destination-in",t.fillStyle="#000000",t.fillRect(e,a,i,s),t.restore()}genericComposeSMask(t,e,a,i,s,n){let{context:l,offsetX:f,offsetY:o}=t;e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);let c=new Path2D;c.rect(s,n,a,i),e.clip(c),e.globalCompositeOperation="destination-in",e.drawImage(l.canvas,s-f,n-o,a,i,s,n,a,i),e.restore()}save(t){if(this.inSMaskMode)ir(this.ctx,this.suspendedCtx);this.ctx.save();let e=this.current;this.stateStack.push(e),this.current=e.clone(),this.dependencyTracker?.save(t)}restore(t){if(this.dependencyTracker?.restore(t),this.stateStack.length===0){if(this.inSMaskMode)this.endSMaskMode();return}if(this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode)ir(this.suspendedCtx,this.ctx),this.ctx.setTransform(this.suspendedCtx.getTransform());this.checkSMaskState(t),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(t,e,a,i,s,n,l){this.dependencyTracker?.recordIncrementalData("transform",t),this.ctx.transform(e,a,i,s,n,l),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,a,i){let[s]=a;if(!i){if(s||=a[0]=new Path2D,e!==T0.stroke&&e!==T0.closeStroke)this.current.tilingPatternDims=null;this[e](t,s);return}if(this.dependencyTracker!==null){let l=e===T0.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(t).recordBBox(t,this.ctx,i[0]-l,i[2]+l,i[1]-l,i[3]+l).recordDependencies(t,["transform"])}if(!(s instanceof Path2D))s=a[0]=DF(s);Nt.axialAlignedBoundingBox(i,Aa(this.ctx),this.current.minMax);let n=this.current.tilingPatternDims;if(n&&e!==T0.stroke&&e!==T0.closeStroke&&this.current.fillColor instanceof h9){let l=Nt.intersect(this.current.clipBox,this.current.minMax);if(!l)this.current.tilingPatternDims=null;else this.current.fillColor.updatePatternDims(l,n)}this[e](t,s),this._pathStartIdx=t}closePath(t){this.ctx.closePath()}stroke(t,e,a=!0){let i=a&&this.#h(this.current.strokeAlpha),s=this.ctx,n=this.current.strokeColor;if(s.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof n==="object"&&n?.getPattern){let l=n.isModifyingCurrentTransform()?s.getTransform():null;if(s.save(),s.strokeStyle=n.getPattern(s,this,H0(s),Qi.STROKE,t),l){let f=new Path2D;f.addPath(e,s.getTransform().invertSelf().multiplySelf(l)),e=f}this.rescaleAndStroke(e,!1),s.restore()}else this.rescaleAndStroke(e,!0);if(this.dependencyTracker?.recordDependencies(t,Dn.stroke),a)this.consumePath(t,e,this.current.getClippedPathBoundingBox(Qi.STROKE,Aa(this.ctx)));s.globalAlpha=this.current.fillAlpha,this.#m(i)}closeStroke(t,e){this.stroke(t,e)}fill(t,e,a=!0){let i=a&&this.#h(this.current.fillAlpha),s=this.ctx,n=this.current.fillColor,l=this.current.patternFill,f=!1,o=this.current.getClippedPathBoundingBox();if(this.dependencyTracker?.recordDependencies(t,Dn.fill),l){let c=this.current.tilingPatternDims,u=c&&n.canSkipPatternCanvas(c);if(u){if(n.drawPattern(this,e,this.pendingEOFill,u,t),this.pendingEOFill=!1,a)this.consumePath(t,e,o);this.current.tilingPatternDims=null,this.#m(i);return}let m=n.isModifyingCurrentTransform()?s.getTransform():null;if(this.dependencyTracker?.save(t),s.save(),s.fillStyle=n.getPattern(s,this,H0(s),Qi.FILL,t),m){let p=new Path2D;p.addPath(e,s.getTransform().invertSelf().multiplySelf(m)),e=p}f=!0}if(this.contentVisible&&o!==null)if(this.pendingEOFill)s.fill(e,"evenodd"),this.pendingEOFill=!1;else s.fill(e);if(f)s.restore(),this.dependencyTracker?.restore(t);if(a)this.consumePath(t,e,o);this.#m(i)}eoFill(t,e){this.pendingEOFill=!0,this.fill(t,e)}fillStroke(t,e){let a=this.#h(Math.min(this.current.fillAlpha,this.current.strokeAlpha));this.fill(t,e,!1),this.stroke(t,e,!1),this.consumePath(t,e),this.#m(a)}eoFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}closeFillStroke(t,e){this.fillStroke(t,e)}closeEOFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}endPath(t,e){this.consumePath(t,e)}rawFillPath(t,e){let a=this.#h(this.current.fillAlpha);this.ctx.fill(e),this.dependencyTracker?.recordDependencies(t,Dn.rawFillPath).recordOperation(t),this.#m(a)}clip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=zV}eoClip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=dF}beginText(t){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(t).resetIncrementalData("sameLineText").resetIncrementalData("moveText",t)}endText(t){let e=this.pendingTextPaths,a=this.ctx;if(this.dependencyTracker){let{dependencyTracker:i}=this;if(e!==void 0)i.recordFutureForcedDependency("textClip",i.getOpenMarker()).recordFutureForcedDependency("textClip",t);i.recordCloseMarker(t)}if(e!==void 0){let i=new Path2D,s=a.getTransform().invertSelf();for(let{transform:n,x:l,y:f,fontSize:o,path:c}of e){if(!c)continue;i.addPath(c,new DOMMatrix(n).preMultiplySelf(s).translate(l,f).scale(o,-o))}a.clip(i)}delete this.pendingTextPaths}setCharSpacing(t,e){this.dependencyTracker?.recordSimpleData("charSpacing",t),this.current.charSpacing=e}setWordSpacing(t,e){this.dependencyTracker?.recordSimpleData("wordSpacing",t),this.current.wordSpacing=e}setHScale(t,e){this.dependencyTracker?.recordSimpleData("hScale",t),this.current.textHScale=e/100}setLeading(t,e){this.dependencyTracker?.recordSimpleData("leading",t),this.current.leading=-e}setFont(t,e,a){this.dependencyTracker?.recordSimpleData("font",t).recordSimpleDataFromNamed("fontObj",e,t);let i=this.commonObjs.get(e),s=this.current;if(!i)throw Error(`Can't find font for ${e}`);if(s.fontMatrix=i.fontMatrix||Ub,s.fontMatrix[0]===0||s.fontMatrix[3]===0)de("Invalid font matrix for font "+e);if(a<0)a=-a,s.fontDirection=-1;else s.fontDirection=1;if(this.current.font=i,this.current.fontSize=a,i.isType3Font)return;let n=i.loadedName||"sans-serif",l=i.systemFontInfo?.css||`"${n}", ${i.fallbackName}`,f="normal";if(i.black)f="900";else if(i.bold)f="bold";let o=i.italic?"italic":"normal",c=_a(a,MV,DV);this.current.fontSizeScale=a/c,this.ctx.font=`${o} ${f} ${c}px ${l}`}setTextRenderingMode(t,e){this.dependencyTracker?.recordSimpleData("textRenderingMode",t),this.current.textRenderingMode=e}setTextRise(t,e){this.dependencyTracker?.recordSimpleData("textRise",t),this.current.textRise=e}moveText(t,e,a){this.dependencyTracker?.resetIncrementalData("sameLineText").recordIncrementalData("moveText",t),this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=a}setLeadingMoveText(t,e,a){this.setLeading(t,-a),this.moveText(t,e,a)}setTextMatrix(t,e){this.dependencyTracker?.resetIncrementalData("sameLineText").recordSimpleData("textMatrix",t);let{current:a}=this;a.textMatrix=e,a.textMatrixScale=Math.hypot(e[0],e[1]),a.x=a.lineX=0,a.y=a.lineY=0}nextLine(t){this.moveText(t,0,this.current.leading),this.dependencyTracker?.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??t)}#j(t,e,a){let i=new Path2D;return i.addPath(t,new DOMMatrix(a).invertSelf().multiplySelf(e)),i}paintChar(t,e,a,i,s,n){let l=this.ctx,f=this.current,o=f.font,c=f.textRenderingMode,u=f.fontSize/f.fontSizeScale,m=c&wi.FILL_STROKE_MASK,p=!!(c&wi.ADD_TO_PATH_FLAG),w=f.patternFill&&!o.missingFile,d=f.patternStroke&&!o.missingFile,v;if((o.disableFontFace||p||w||d)&&!o.missingFile)v=o.getPathGenerator(this.commonObjs,e);if(v&&(o.disableFontFace||w||d)){l.save(),l.translate(a,i),l.scale(u,-u),this.dependencyTracker?.recordCharacterBBox(t,l,o);let k;if(m===wi.FILL||m===wi.FILL_STROKE)if(s){k=l.getTransform(),l.setTransform(...s);let y=this.#j(v,k,s);l.fill(y)}else l.fill(v);if(m===wi.STROKE||m===wi.FILL_STROKE)if(n){k||=l.getTransform(),l.setTransform(...n);let{a:y,b:B,c:H,d:M}=k,D=Nt.inverseTransform(n),T=Nt.transform([y,B,H,M,0,0],D);Nt.singularValueDecompose2dScale(T,rn),l.lineWidth*=Math.max(rn[0],rn[1])/u,l.stroke(this.#j(v,k,n))}else l.lineWidth/=u,l.stroke(v);l.restore()}else{if(m===wi.FILL||m===wi.FILL_STROKE)l.fillText(e,a,i),this.dependencyTracker?.recordCharacterBBox(t,l,o,u,a,i,()=>l.measureText(e));if(m===wi.STROKE||m===wi.FILL_STROKE){if(this.dependencyTracker)this.dependencyTracker?.recordCharacterBBox(t,l,o,u,a,i,()=>l.measureText(e)).recordDependencies(t,Dn.stroke);l.strokeText(e,a,i)}}if(p)(this.pendingTextPaths||=[]).push({transform:Aa(l),x:a,y:i,fontSize:u,path:v}),this.dependencyTracker?.recordCharacterBBox(t,l,o,u,a,i)}get isFontSubpixelAAEnabled(){let t=this.canvasFactory.create(10,10),e=t.context;e.scale(1.5,1),e.fillText("I",0,10);let a=e.getImageData(0,0,10,10).data;this.canvasFactory.destroy(t);let i=!1;for(let s=3;s<a.length;s+=4)if(a[s]>0&&a[s]<255){i=!0;break}return be(this,"isFontSubpixelAAEnabled",i)}showText(t,e){if(this.dependencyTracker){if(this.dependencyTracker.recordDependencies(t,Dn.showText).resetBBox(t),this.current.textRenderingMode&wi.ADD_TO_PATH_FLAG)this.dependencyTracker.recordFutureForcedDependency("textClip",t).inheritPendingDependenciesAsFutureForcedDependencies()}let a=this.current,i=a.font;if(i.isType3Font){let at=this.#h(a.fillAlpha);this.showType3Text(t,e),this.dependencyTracker?.recordShowTextOperation(t),this.#m(at);return}let s=a.fontSize;if(s===0){this.dependencyTracker?.recordOperation(t);return}let n=this.#h(a.fillAlpha),l=this.ctx,f=a.fontSizeScale,o=a.charSpacing,c=a.wordSpacing,u=a.fontDirection,m=a.textHScale*u,p=e.length,w=i.vertical,d=w?1:-1,v=i.defaultVMetrics,k=s*a.fontMatrix[0],y=a.textRenderingMode===wi.FILL&&!i.disableFontFace&&!a.patternFill;if(l.save(),a.textMatrix)l.transform(...a.textMatrix);if(l.translate(a.x,a.y+a.textRise),u>0)l.scale(m,-1);else l.scale(m,1);let B,H,M=a.textRenderingMode&wi.FILL_STROKE_MASK,D=M===wi.FILL||M===wi.FILL_STROKE,T=M===wi.STROKE||M===wi.FILL_STROKE,z=a.lineWidth,E=a.textMatrixScale;if(E===0||z===0){if(T)z=this.getSinglePixelWidth()}else z/=E;if(f!==1)l.scale(f,f),z/=f;if(l.lineWidth=z,D&&a.patternFill){l.save();let at=a.fillColor.getPattern(l,this,H0(l),Qi.FILL,t);B=Aa(l),l.restore(),l.fillStyle=at}if(T&&a.patternStroke){l.save();let at=a.strokeColor.getPattern(l,this,H0(l),Qi.STROKE,t);H=Aa(l),l.restore(),l.strokeStyle=at}if(i.isInvalidPDFjsFont){let at=[],Q=0;for(let J of e)at.push(J.unicode),Q+=J.width;let Z=at.join("");if(l.fillText(Z,0,0),this.dependencyTracker!==null){let J=l.measureText(Z);this.dependencyTracker.recordBBox(t,this.ctx,-J.actualBoundingBoxLeft,J.actualBoundingBoxRight,-J.actualBoundingBoxAscent,J.actualBoundingBoxDescent).recordShowTextOperation(t)}a.x+=Q*k*m,l.restore(),this.compose(),this.#m(n);return}let V=0,tt;for(tt=0;tt<p;++tt){let at=e[tt];if(typeof at==="number"){V+=d*at*s/1000;continue}let Q=!1,Z=(at.isSpace?c:0)+o,J=at.fontChar,Y=at.accent,W,ft,nt=at.width;if(w){let ct=at.vmetric||v,pt=-(at.vmetric?ct[1]:nt*0.5)*k,G=ct[2]*k;nt=ct?-ct[0]:nt,W=pt/f,ft=(V+G)/f}else W=V/f,ft=0;let qt;if(i.remeasure&&nt>0){qt=l.measureText(J);let ct=qt.width*1000/s*f;if(nt<ct&&this.isFontSubpixelAAEnabled){let pt=nt/ct;Q=!0,l.save(),l.scale(pt,1),W/=pt}else if(nt!==ct)W+=(nt-ct)/2000*s/f}if(this.contentVisible&&(at.isInFont||i.missingFile)){if(y&&!Y)l.fillText(J,W,ft),this.dependencyTracker?.recordCharacterBBox(t,l,qt?{bbox:null}:i,s/f,W,ft,()=>qt??l.measureText(J));else if(this.paintChar(t,J,W,ft,B,H),Y){let ct=W+s*Y.offset.x/f,pt=ft-s*Y.offset.y/f;this.paintChar(t,Y.fontChar,ct,pt,B,H)}}let R=w?nt*k-Z*u:nt*k+Z*u;if(V+=R,Q)l.restore()}if(w)a.y-=V;else a.x+=V*m;l.restore(),this.compose(),this.dependencyTracker?.recordShowTextOperation(t),this.#m(n)}showType3Text(t,e){let a=this.ctx,i=this.current,s=i.font,n=i.fontSize,l=i.fontDirection,f=s.vertical?1:-1,o=i.charSpacing,c=i.wordSpacing,u=i.textHScale*l,m=i.fontMatrix||Ub,p=e.length,w=i.textRenderingMode===wi.INVISIBLE,d,v,k,y;if(w||n===0)return;if(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,a.save(),i.textMatrix)a.transform(...i.textMatrix);a.translate(i.x,i.y+i.textRise),a.scale(u,l);let B=this.dependencyTracker;this.dependencyTracker=B?new g9(B,t):null;for(d=0;d<p;++d){if(v=e[d],typeof v==="number"){y=f*v*n/1000,this.ctx.translate(y,0),i.x+=y*u;continue}let H=(v.isSpace?c:0)+o,M=s.charProcOperatorList[v.operatorListId];if(!M)de(`Type3 character "${v.operatorListId}" is not available.`);else if(this.contentVisible){if(this.save(),M.fnArray[0]===T0.setCharWidth)i.fillAlpha=i.strokeAlpha=1,a.globalAlpha=1;a.scale(n,n),a.transform(...m),this.executeOperatorList(M),this.restore()}let D=[v.width,0];Nt.applyTransform(D,m),k=D[0]*n+H,a.translate(k,0),i.x+=k*u}if(a.restore(),B)this.dependencyTracker=B}setCharWidth(t,e,a){}setCharWidthAndBounds(t,e,a,i,s,n,l){let f=new Path2D;f.rect(i,s,n-i,l-s),this.ctx.clip(f),this.dependencyTracker?.recordBBox(t,this.ctx,i,n,s,l).recordClipBox(t,this.ctx,i,n,s,l),this.endPath(t)}getColorN_Pattern(t,e){let a;if(e[0]==="TilingPattern"){let i=this.baseTransform||Aa(this.ctx),s={createCanvasGraphics:(n,l)=>new Fh(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new g9(this.dependencyTracker,l,!0):null)};a=new h9(e,this.ctx,s,i)}else a=this._getPattern(t,e[1],e[2]);return a}setStrokeColorN(t,...e){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.current.strokeColor=this.getColorN_Pattern(t,e),this.current.patternStroke=!0}setFillColorN(t,...e){this.dependencyTracker?.recordSimpleData("fillColor",t);let a=this.current.fillColor=this.getColorN_Pattern(t,e);this.current.patternFill=!0,this.current.tilingPatternDims=a instanceof h9?[0,0,0,0]:null}setStrokeRGBColor(t,e){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor=e,this.current.patternStroke=!1}setStrokeTransparent(t){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(t,e){this.dependencyTracker?.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor=e,this.current.patternFill=!1,this.current.tilingPatternDims=null}setFillTransparent(t){this.dependencyTracker?.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1,this.current.tilingPatternDims=null}_getPattern(t,e,a=null){let i;if(this.cachedPatterns.has(e))i=this.cachedPatterns.get(e);else i=HV(this.getObject(t,e)),this.cachedPatterns.set(e,i);if(a)i.matrix=a;return i}shadingFill(t,e){if(!this.contentVisible)return;let a=this.#h(this.current.fillAlpha),i=this.ctx;this.save(t);let s=this._getPattern(t,e);i.fillStyle=s.getPattern(i,this,H0(i),Qi.SHADING,t);let n=H0(i);if(n){let{width:l,height:f}=i.canvas,o=lr.slice();Nt.axialAlignedBoundingBox([0,0,l,f],n,o);let[c,u,m,p]=o;this.ctx.fillRect(c,u,m-c,p-u)}else this.ctx.fillRect(-10000000000,-10000000000,20000000000,20000000000);this.dependencyTracker?.resetBBox(t).recordFullPageBBox(t).recordDependencies(t,Dn.transform).recordDependencies(t,Dn.fill).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t),this.#m(a)}beginInlineImage(){Qe("Should not call beginInlineImage")}beginImageData(){Qe("Should not call beginImageData")}paintFormXObjectBegin(t,e,a){if(!this.contentVisible)return;if(this.save(t),this.baseTransformStack.push(this.baseTransform),e)this.transform(t,...e);if(this.baseTransform=Aa(this.ctx),a){Nt.axialAlignedBoundingBox(a,this.baseTransform,this.current.minMax);let[i,s,n,l]=a,f=new Path2D;f.rect(i,s,n-i,l-s),this.ctx.clip(f),this.dependencyTracker?.recordClipBox(t,this.ctx,i,n,s,l),this.endPath(t)}}paintFormXObjectEnd(t){if(!this.contentVisible)return;this.restore(t),this.baseTransform=this.baseTransformStack.pop()}beginGroup(t,e){if(!this.contentVisible)return;this.save(t);let{inSMaskMode:a}=this;if(a)this.endSMaskMode(),this.current.activeSMask=null;let i=this.ctx;if((!e.needsIsolation||!e.isolated&&!e.hasSoftMask)&&!e.knockout&&!e.isGray&&this.#t===0&&i.globalAlpha===1&&i.globalCompositeOperation==="source-over"&&!a){if(e.bbox){let y=new Path2D,[B,H,M,D]=e.bbox;if(y.rect(B,H,M-B,D-H),e.matrix){let T=new Path2D;T.addPath(y,new DOMMatrix(e.matrix)),y=T}i.clip(y)}this.groupStack.push(null),this.#r.push(null),this.groupLevel++;return}if(!e.isolated&&!e.knockout&&this.#t===0)n6("TODO: Fully support non-isolated non-knockout groups.");let s=Aa(i);if(e.matrix)i.transform(...e.matrix);let n=[0,0,i.canvas.width,i.canvas.height],l;if(e.bbox)l=lr.slice(),Nt.axialAlignedBoundingBox(e.bbox,Aa(i),l),l=Nt.intersect(l,n)||[0,0,0,0];else l=n;let f=Math.floor(l[0]),o=Math.floor(l[1]),c=Math.max(Math.ceil(l[2])-f,1),u=Math.max(Math.ceil(l[3])-o,1);this.current.startNewPathAndClipBox([0,0,c,u]);let m=this.canvasFactory.create(c,u);if(e.smask)this.smaskGroupCanvases.push(m);let p=m.context,w=e.knockout&&!e.isolated?i:null,d=!e.isolated&&!e.knockout&&!e.smask&&e.needsIsolation&&this.#t>0,v=e.knockout?this.canvasFactory.create(c,u):null,k=this.#t;if(e.knockout)this.#t++;else this.#t=0;if(p.translate(-f,-o),p.transform(...s),!e.isolated&&!e.smask&&a&&e.needsIsolation)p.save(),p.setTransform(1,0,0,1,0,0),p.drawImage(i.canvas,-f,-o),p.restore();if(e.bbox){let y=new Path2D,[B,H,M,D]=e.bbox;if(y.rect(B,H,M-B,D-H),e.matrix){let T=new Path2D;T.addPath(y,new DOMMatrix(e.matrix)),y=T}p.clip(y)}if(e.smask)this.smaskStack.push({canvas:m.canvas,context:p,offsetX:f,offsetY:o,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null});if(!e.smask||this.dependencyTracker)i.setTransform(1,0,0,1,0,0),i.translate(f,o),i.save();ir(i,p),this.ctx=p,this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(i),this.setGState(t,[["BM","source-over"],["ca",1],["CA",1],["TR",null]]),this.groupStack.push(i),this.#r.push({backdropCtx:w,savedKnockoutLevel:k,offsetX:f,offsetY:o,hasInnerBackdrop:d,knockoutMaskEntry:v,knockoutTempEntry:null,knockoutBackdropEntry:null}),this.groupLevel++}endGroup(t,e){if(!this.contentVisible)return;this.groupLevel--;let a=this.ctx,i=this.groupStack.pop(),s=this.#r.pop();if(s)this.#t=s.savedKnockoutLevel;if(i===null){this.restore(t);return}if(e.isGray)this.#d(a);if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,this.dependencyTracker?.popBaseTransform(),e.smask){if(this.tempSMask=this.smaskStack.pop(),this.restore(t),this.dependencyTracker){if(this.ctx.restore(),this.inSMaskMode)this.ctx.setTransform(this.suspendedCtx.getTransform())}this.#w(s)}else{this.ctx.restore();let n=Aa(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...n);let l=lr.slice();Nt.axialAlignedBoundingBox([0,0,a.canvas.width,a.canvas.height],n,l);let f=this.#r.at(-1);if(this.#t>0)if(s.hasInnerBackdrop){let{width:o,height:c}=a.canvas,u=this.canvasFactory.create(o,c),m=u.context;m.drawImage(i.canvas,s.offsetX,s.offsetY,o,c,0,0,o,c),m.globalCompositeOperation="source-over",m.drawImage(a.canvas,0,0);let p=this.#g(a.canvas);m.globalCompositeOperation="destination-in",m.drawImage(p.canvas,0,0);let w=this.ctx.globalCompositeOperation,d=this.ctx.globalAlpha,v=this.ctx.filter;if(this.ctx.save(),this.ctx.setTransform(...n),this.ctx.globalAlpha=1,ha.isCanvasFilterSupported)this.ctx.filter="none";if(this.ctx.globalCompositeOperation="destination-out",this.ctx.drawImage(p.canvas,0,0),this.ctx.globalCompositeOperation=w,this.ctx.globalAlpha=d,ha.isCanvasFilterSupported)this.ctx.filter=v??"none";this.ctx.drawImage(u.canvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(p),this.canvasFactory.destroy(u)}else{let o=f?.backdropCtx??null;this.#b(this.ctx,a.canvas,{backdropCanvas:o?.canvas??null,destTransform:n,backdropOffset:o?[f.offsetX+s.offsetX,f.offsetY+s.offsetY]:[0,0],sourceAlpha:this.ctx.globalAlpha,sourceFilter:this.ctx.filter})}else this.ctx.drawImage(a.canvas,0,0);this.ctx.restore(),this.canvasFactory.destroy({canvas:a.canvas,context:a}),this.#w(s),this.compose(l)}}#d(t){let{canvas:e}=t,{width:a,height:i}=e;if(ha.isCanvasFilterSupported){t.save(),t.setTransform(1,0,0,1,0,0),t.filter="grayscale(1)",t.globalAlpha=1,t.globalCompositeOperation="copy",t.drawImage(e,0,0),t.restore();return}let s=t.getImageData(0,0,a,i),{data:n}=s;for(let l=0,f=n.length;l<f;l+=4){let o=n[l]*0.2126+n[l+1]*0.7152+n[l+2]*0.0722+0.5|0;n[l]=n[l+1]=n[l+2]=o}t.putImageData(s,0,0)}#w(t){if(!t)return;if(t.knockoutMaskEntry)this.canvasFactory.destroy(t.knockoutMaskEntry),t.knockoutMaskEntry=null;if(t.knockoutTempEntry)this.canvasFactory.destroy(t.knockoutTempEntry),t.knockoutTempEntry=null;if(t.knockoutBackdropEntry)this.canvasFactory.destroy(t.knockoutBackdropEntry),t.knockoutBackdropEntry=null}beginAnnotation(t,e,a,i,s,n,l){if(this.#u(),E3(this.ctx),this.ctx.save(),this.save(t),this.baseTransform)this.ctx.setTransform(...this.baseTransform);if(a){let f=a[2]-a[0],o=a[3]-a[1];if(n&&this.annotationCanvasMap){i=i.slice(),i[4]-=a[0],i[5]-=a[1],a=a.slice(),a[0]=a[1]=0,a[2]=f,a[3]=o,Nt.singularValueDecompose2dScale(Aa(this.ctx),rn);let{viewportScale:c}=this,u=Math.ceil(f*this.outputScaleX*c),m=Math.ceil(o*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(u,m);let{canvas:p,context:w}=this.annotationCanvas;if(l){let d=this.annotationCanvasMap.getOrInsertComputed(e,w9);p.setAttribute("data-canvas-name",l);let v=d.findIndex((k)=>k.getAttribute("data-canvas-name")===l);if(v===-1)d.push(p);else d[v]=p}else this.annotationCanvasMap.set(e,p);this.annotationCanvas.savedCtx=this.ctx,this.ctx=w,this.ctx.save(),this.ctx.setTransform(rn[0],0,0,-rn[1],0,o*rn[1]),E3(this.ctx)}else{E3(this.ctx),this.endPath(t);let c=new Path2D;c.rect(a[0],a[1],f,o),this.ctx.clip(c)}}this.current=new Qb(this.ctx.canvas.width,this.ctx.canvas.height),this.baseTransformStack.push(this.baseTransform),this.transform(t,...i),this.transform(t,...s),this.baseTransform=Aa(this.ctx)}endAnnotation(t){if(this.annotationCanvas)this.ctx.restore(),this.#c(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas;this.baseTransform=this.baseTransformStack.pop()}paintImageMaskXObject(t,e){if(!this.contentVisible)return;let a=e.count;e=this.getObject(t,e.data,e),e.count=a;let i=this.#h(this.current.fillAlpha),s=this.ctx,n=this._createMaskCanvas(t,e),l=n.canvas;if(s.save(),s.setTransform(1,0,0,1,0,0),s.drawImage(l,n.offsetX,n.offsetY),this.dependencyTracker?.resetBBox(t).recordBBox(t,this.ctx,n.offsetX,n.offsetX+l.width,n.offsetY,n.offsetY+l.height).recordOperation(t),s.restore(),n.canvasEntry)this.canvasFactory.destroy(n.canvasEntry);this.compose(),this.#m(i)}paintImageMaskXObjectRepeat(t,e,a,i=0,s=0,n,l){if(!this.contentVisible)return;e=this.getObject(t,e.data,e);let f=this.#h(this.current.fillAlpha),o=this.ctx;o.save();let c=Aa(o);o.transform(a,i,s,n,0,0);let u=this._createMaskCanvas(t,e);o.setTransform(1,0,0,1,u.offsetX-c[4],u.offsetY-c[5]),this.dependencyTracker?.resetBBox(t);for(let m=0,p=l.length;m<p;m+=2){let w=Nt.transform(c,[a,i,s,n,l[m],l[m+1]]);o.drawImage(u.canvas,w[4],w[5]),this.dependencyTracker?.recordBBox(t,this.ctx,w[4],w[4]+u.canvas.width,w[5],w[5]+u.canvas.height)}if(o.restore(),u.canvasEntry)this.canvasFactory.destroy(u.canvasEntry);this.compose(),this.dependencyTracker?.recordOperation(t),this.#m(f)}paintImageMaskXObjectGroup(t,e){if(!this.contentVisible)return;let a=this.#h(this.current.fillAlpha),i=this.ctx,s=this.current.fillColor,n=this.current.patternFill;this.dependencyTracker?.resetBBox(t).recordDependencies(t,Dn.transformAndFill);for(let l of e){let{data:f,width:o,height:c,transform:u}=l,m=this.canvasFactory.create(o,c),p=m.context;p.save();let w=this.getObject(t,f,l);wF(p,w),p.globalCompositeOperation="source-in",p.fillStyle=n?s.getPattern(p,this,H0(i),Qi.FILL,t):s,p.fillRect(0,0,o,c),p.restore(),i.save(),i.transform(...u),i.scale(1,-1),z3(i,m.canvas,0,0,o,c,0,-1,1,1),this.canvasFactory.destroy(m),this.dependencyTracker?.recordBBox(t,i,0,o,0,c),i.restore()}this.compose(),this.dependencyTracker?.recordOperation(t),this.#m(a)}paintImageXObject(t,e){if(!this.contentVisible)return;let a=this.getObject(t,e);if(!a){de("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t,a)}paintImageXObjectRepeat(t,e,a,i,s){if(!this.contentVisible)return;let n=this.getObject(t,e);if(!n){de("Dependent image isn't ready yet");return}let{width:l,height:f}=n,o=[];for(let c=0,u=s.length;c<u;c+=2)o.push({transform:[a,0,0,i,s[c],s[c+1]],x:0,y:0,w:l,h:f});this.paintInlineImageXObjectGroup(t,n,o)}applyTransferMapsToCanvas(t){if(this.current.transferMaps!=="none")t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none";return t.canvas}applyTransferMapsToBitmap(t){if(this.current.transferMaps==="none")return{img:t.bitmap,canvasEntry:null};let{bitmap:e,width:a,height:i}=t,s=this.canvasFactory.create(a,i),n=s.context;return n.filter=this.current.transferMaps,n.drawImage(e,0,0),n.filter="none",{img:s.canvas,canvasEntry:s}}paintInlineImageXObject(t,e){if(!this.contentVisible)return;let{width:a,height:i}=e,s=this.#h(this.current.fillAlpha),n=this.ctx;this.save(t);let{filter:l}=n;if(l!=="none"&&l!=="")n.filter="none";n.scale(1/a,-1/i);let f,o=null;if(e.bitmap){let u=this.applyTransferMapsToBitmap(e);f=u.img,o=u.canvasEntry}else{let u=this.canvasFactory.create(a,i);pF(u.context,e),f=this.applyTransferMapsToCanvas(u.context),o=u}let c=this._scaleImage(f,H0(n));if(n.imageSmoothingEnabled=jF(Aa(n),e.interpolate),this.dependencyTracker)this.dependencyTracker.resetBBox(t).recordBBox(t,n,0,a,-i,0).recordDependencies(t,Dn.imageXObject).recordOperation(t),this.imagesTracker?.record(n,a,i,this.dependencyTracker.clipBox);if(z3(n,c.img,0,0,c.paintWidth,c.paintHeight,0,-i,a,i),c.tmpCanvas)this.canvasFactory.destroy(c.tmpCanvas);if(o)this.canvasFactory.destroy(o);this.compose(),this.restore(t),this.#m(s)}paintInlineImageXObjectGroup(t,e,a){if(!this.contentVisible)return;let i=this.#h(this.current.fillAlpha),s=this.ctx,n,l=null;if(e.bitmap)n=e.bitmap;else{let{width:f,height:o}=e,c=this.canvasFactory.create(f,o);pF(c.context,e),n=this.applyTransferMapsToCanvas(c.context),l=c}this.dependencyTracker?.resetBBox(t);for(let f of a)s.save(),s.transform(...f.transform),s.scale(1,-1),z3(s,n,f.x,f.y,f.w,f.h,0,-1,1,1),this.dependencyTracker?.recordBBox(t,s,0,1,-1,0),s.restore();if(l)this.canvasFactory.destroy(l);this.dependencyTracker?.recordOperation(t),this.compose(),this.#m(i)}paintSolidColorImageMask(t){if(!this.contentVisible)return;let e=this.#h(this.current.fillAlpha);this.dependencyTracker?.resetBBox(t).recordBBox(t,this.ctx,0,1,0,1).recordDependencies(t,Dn.fill).recordOperation(t),this.ctx.fillRect(0,0,1,1),this.compose(),this.#m(e)}markPoint(t,e){}markPointProps(t,e,a){}beginMarkedContent(t,e){this.dependencyTracker?.beginMarkedContent(t),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e,a){if(this.dependencyTracker?.beginMarkedContent(t),e==="OC")this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(a)});else this.markedContentStack.push({visible:!0});this.contentVisible=this.isContentVisible()}endMarkedContent(t){this.dependencyTracker?.endMarkedContent(t),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(t){}endCompat(t){}consumePath(t,e,a){let i=this.current.isEmptyClip();if(this.pendingClip)this.current.updateClipFromPath();if(!this.pendingClip)this.compose(a);let s=this.ctx;if(this.pendingClip){if(!i)if(this.pendingClip===dF)s.clip(e,"evenodd");else s.clip(e);this.pendingClip=null,this.dependencyTracker?.bboxToClipBoxDropOperation(t).recordFutureForcedDependency("clipPath",t)}else this.dependencyTracker?.recordOperation(t);this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let t=Aa(this.ctx);if(t[1]===0&&t[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{let e=Math.abs(t[0]*t[3]-t[2]*t[1]),a=Math.hypot(t[0],t[2]),i=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(a,i)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){let{lineWidth:t}=this.current,{a:e,b:a,c:i,d:s}=this.ctx.getTransform(),n,l;if(a===0&&i===0){let f=Math.abs(e),o=Math.abs(s);if(f===o)if(t===0)n=l=1/f;else{let c=f*t;n=l=c<1?1/c:1}else if(t===0)n=1/f,l=1/o;else{let c=f*t,u=o*t;n=c<1?1/c:1,l=u<1?1/u:1}}else{let f=Math.abs(e*s-a*i),o=Math.hypot(e,a),c=Math.hypot(i,s);if(t===0)n=c/f,l=o/f;else{let u=t*f;n=c>u?c/u:1,l=o>u?o/u:1}}this._cachedScaleForStroking[0]=n,this._cachedScaleForStroking[1]=l}return this._cachedScaleForStroking}rescaleAndStroke(t,e){let{ctx:a,current:{lineWidth:i}}=this,[s,n]=this.getScaleForStroking();if(s===n){a.lineWidth=(i||1)*s,a.stroke(t);return}let l=a.getLineDash();if(e)a.save();a.scale(s,n),Eb.a=1/s,Eb.d=1/n;let f=new Path2D;if(f.addPath(t,Eb),l.length>0){let o=Math.max(s,n);a.setLineDash(l.map((c)=>c/o)),a.lineDashOffset/=o}if(a.lineWidth=i||1,a.stroke(f),e)a.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}for(let t in T0)if(Fh.prototype[t]!==void 0)Fh.prototype[T0[t]]=Fh.prototype[t];class A9{#t=null;#e=null;_fullReader=null;_rangeReaders=new Set;_source=null;constructor(t,e,a){this._source=t,this.#t=e,this.#e=a}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){return Ga(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new this.#t(this)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let a=new this.#e(this,t,e);return this._rangeReaders.add(a),a}cancelAllRequests(t){this._fullReader?.cancel(t);for(let e of new Set(this._rangeReaders))e.cancel(t)}}class v9{onProgress=null;_contentLength=0;_filename=null;_headersCapability=Promise.withResolvers();_isRangeSupported=!1;_isStreamingSupported=!1;_loaded=0;_stream=null;constructor(t){this._stream=t}_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(){Qe("Abstract method `read` called")}cancel(t){Qe("Abstract method `cancel` called")}}class S9{_stream=null;constructor(t,e,a){this._stream=t}async read(){Qe("Abstract method `read` called")}cancel(t){Qe("Abstract method `cancel` called")}}function EV(t){let e=!0,a=i("filename\\*","i").exec(t);if(a){a=a[1];let u=f(a);return u=unescape(u),u=o(u),u=c(u),n(u)}if(a=l(t),a){let u=c(a);return n(u)}if(a=i("filename","i").exec(t),a){a=a[1];let u=f(a);return u=c(u),n(u)}function i(u,m){return new RegExp("(?:^|;)\\s*"+u+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',m)}function s(u,m){if(u){if(!/^[\x00-\xFF]+$/.test(m))return m;try{let p=new TextDecoder(u,{fatal:!0}),w=l6(m);m=p.decode(w),e=!1}catch{}}return m}function n(u){if(e&&/[\x80-\xff]/.test(u)){if(u=s("utf-8",u),e)u=s("iso-8859-1",u)}return u}function l(u){let m=[],p,w=i("filename\\*((?!0\\d)\\d+)(\\*?)","ig");while((p=w.exec(u))!==null){let[,v,k,y]=p;if(v=parseInt(v,10),v in m){if(v===0)break;continue}m[v]=[k,y]}let d=[];for(let v=0;v<m.length;++v){if(!(v in m))break;let[k,y]=m[v];if(y=f(y),k){if(y=unescape(y),v===0)y=o(y)}d.push(y)}return d.join("")}function f(u){if(u.startsWith('"')){let m=u.slice(1).split("\\\"");for(let p=0;p<m.length;++p){let w=m[p].indexOf('"');if(w!==-1)m[p]=m[p].slice(0,w),m.length=p+1;m[p]=m[p].replaceAll(/\\(.)/g,"$1")}u=m.join('"')}return u}function o(u){let m=u.indexOf("'");if(m===-1)return u;let p=u.slice(0,m),d=u.slice(m+1).replace(/^[^']*'/,"");return s(p,d)}function c(u){if(!u.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(u))return u;return u.replaceAll(/=\?([\w-]*)\?([QB])\?((?:[^?]|\?(?!=))*)\?=/gi,function(m,p,w,d){if(w==="q"||w==="Q")return d=d.replaceAll("_"," "),d=d.replaceAll(/=([0-9a-f]{2})/gi,function(v,k){return String.fromCharCode(parseInt(k,16))}),s(p,d);try{d=atob(d)}catch{}return s(p,d)})}return""}function rB(t,e){let a=new Headers;if(!t||!e||typeof e!=="object")return a;for(let i in e){let s=e[i];if(s!==void 0)a.append(i,s)}return a}function m6(t){return URL.parse(t)?.origin??null}function oB({responseHeaders:t,isHttp:e,rangeChunkSize:a,disableRange:i}){let s={contentLength:0,isRangeSupported:!1},n=parseInt(t.get("Content-Length"),10);if(!Number.isInteger(n))return s;if(s.contentLength=n,n<=2*a)return s;if(i||!e)return s;if(t.get("Accept-Ranges")!=="bytes")return s;if((t.get("Content-Encoding")||"identity")==="identity")s.isRangeSupported=!0;return s}function hB(t){let e=t.get("Content-Disposition");if(e){let a=EV(e);if(a.includes("%"))try{a=decodeURIComponent(a)}catch{}if(tp(a))return a}return null}function g6(t,e){return new c9(`Unexpected server response (${t}) while retrieving PDF "${e.href}".`,t,t===404||t===0&&e.protocol==="file:")}function cB(t,e){if(t!==e)throw Error(`Expected range response-origin "${t}" to match "${e}".`)}function uB(t,e,a,i){return fetch(t,{method:"GET",headers:e,signal:i.signal,mode:"cors",credentials:a?"include":"same-origin",redirect:"follow"})}function mB(t,e){if(t!==200&&t!==206)throw g6(t,e)}function b6(t){if(t instanceof Uint8Array)return t.buffer;if(t instanceof ArrayBuffer)return t;throw Error(`getArrayBuffer - unexpected data: ${t}`)}class gB extends A9{_responseOrigin=null;constructor(t){super(t,bB,pB);let{httpHeaders:e,url:a}=t;Ga(/https?:/.test(a.protocol),"PDFFetchStream only supports http(s):// URLs."),this.headers=rB(!0,e)}}class bB extends v9{_abortController=new AbortController;_reader=null;constructor(t){super(t);let{disableRange:e,disableStream:a,rangeChunkSize:i,url:s,withCredentials:n}=t._source;this._isStreamingSupported=!a;let l=new Headers(t.headers);uB(s,l,n,this._abortController).then((f)=>{t._responseOrigin=m6(f.url),mB(f.status,s),this._reader=f.body.getReader();let o=f.headers,{contentLength:c,isRangeSupported:u}=oB({responseHeaders:o,isHttp:!0,rangeChunkSize:i,disableRange:e});if(this._contentLength=c,this._isRangeSupported=u,this._filename=hB(o),!this._isStreamingSupported&&this._isRangeSupported)this.cancel(new C1("Streaming is disabled."));this._headersCapability.resolve()}).catch(this._headersCapability.reject)}async read(){await this._headersCapability.promise;let{value:t,done:e}=await this._reader.read();if(e)return{value:t,done:e};return this._loaded+=t.byteLength,this._callOnProgress(),{value:b6(t),done:!1}}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class pB extends S9{_abortController=new AbortController;_readCapability=Promise.withResolvers();_reader=null;constructor(t,e,a){super(t,e,a);let{url:i,withCredentials:s}=t._source,n=new Headers(t.headers);n.append("Range",`bytes=${e}-${a-1}`),uB(i,n,s,this._abortController).then((l)=>{let f=m6(l.url);cB(f,t._responseOrigin),mB(l.status,i),this._reader=l.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;let{value:t,done:e}=await this._reader.read();if(e)return{value:t,done:e};return{value:b6(t),done:!1}}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}function qF(t){return t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer}function p6(){for(let t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}class wB extends A9{_progressiveDone=!1;_queuedChunks=[];constructor(t){super(t,jB,dB);let{pdfDataRangeTransport:e}=t,{initialData:a,progressiveDone:i}=e;if(a?.length>0){let n=qF(a);this._queuedChunks.push(n)}this._progressiveDone=i;let s=(n)=>{switch(n.type){case"range":case"progressiveRead":this.#t(n.begin,n.chunk);break;case"progressiveDone":this._fullReader?.progressiveDone(),this._progressiveDone=!0;break}};e.transportReady(s)}#t(t,e){let a=qF(e);if(t===void 0)if(this._fullReader)this._fullReader._enqueue(a);else this._queuedChunks.push(a);else{let i=this._rangeReaders.keys().find((s)=>s._begin===t);Ga(i,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),i._enqueue(a)}}getFullReader(){let t=super.getFullReader();return this._queuedChunks=null,t}getRangeReader(t,e){let a=super.getRangeReader(t,e);if(a)a.onDone=()=>this._rangeReaders.delete(a),this._source.pdfDataRangeTransport.requestDataRange(t,e);return a}cancelAllRequests(t){super.cancelAllRequests(t),this._source.pdfDataRangeTransport.abort()}}class jB extends v9{#t=p6.bind(this);_done=!1;_queuedChunks=null;_requests=[];constructor(t){super(t);let{pdfDataRangeTransport:e,disableRange:a,disableStream:i}=t._source,{length:s,contentDispositionFilename:n}=e;this._queuedChunks=t._queuedChunks||[];for(let f of this._queuedChunks)this._loaded+=f.byteLength;if(this._done=t._progressiveDone,this._contentLength=s,this._isStreamingSupported=!i,this._isRangeSupported=!a,tp(n))this._filename=n;this._headersCapability.resolve();let l=this._loaded;Promise.resolve().then(()=>{if(l>0&&this._loaded===l)this._callOnProgress()})}_enqueue(t){if(this._done)return;if(this._requests.length>0)this._requests.shift().resolve({value:t,done:!1});else this._queuedChunks.push(t);this._loaded+=t.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 t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this.#t()}progressiveDone(){if(this._done||=!0,this._queuedChunks.length===0)this.#t()}}class dB extends S9{#t=p6.bind(this);onDone=null;_begin=-1;_done=!1;_queuedChunk=null;_requests=[];constructor(t,e,a){super(t,e,a);this._begin=e}_enqueue(t){if(this._done)return;if(this._requests.length===0)this._queuedChunk=t;else this._requests.shift().resolve({value:t,done:!1}),this.#t();this._done=!0,this.onDone?.()}async read(){if(this._queuedChunk){let e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this.#t(),this.onDone?.()}}var xb=200,AF=206;function xV(t){return typeof t!=="string"?t:l6(t).buffer}class qB extends A9{#t=new WeakMap;_responseOrigin=null;constructor(t){super(t,AB,vB);let{httpHeaders:e,url:a}=t;this.url=a,this.isHttp=/https?:/.test(a.protocol),this.headers=rB(this.isHttp,e)}_request(t){let e=new XMLHttpRequest,a={validateStatus:null,onHeadersReceived:t.onHeadersReceived,onDone:t.onDone,onError:t.onError,onProgress:t.onProgress};this.#t.set(e,a),e.open("GET",this.url),e.withCredentials=this._source.withCredentials;for(let[i,s]of this.headers)e.setRequestHeader(i,s);if(this.isHttp&&"begin"in t&&"end"in t)e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),a.validateStatus=(i)=>i===AF||i===xb;else a.validateStatus=(i)=>i===xb;return e.responseType="arraybuffer",Ga(t.onError,"Expected `onError` callback to be provided."),e.onerror=()=>t.onError(e.status),e.onreadystatechange=this.#a.bind(this,e),e.onprogress=this.#e.bind(this,e),e.send(null),e}#e(t,e){this.#t.get(t)?.onProgress?.(e)}#a(t,e){let a=this.#t.get(t);if(!a)return;if(t.readyState>=2&&a.onHeadersReceived)a.onHeadersReceived(),delete a.onHeadersReceived;if(t.readyState!==4)return;if(!this.#t.has(t))return;if(this.#t.delete(t),t.status===0&&this.isHttp){a.onError(t.status);return}let i=t.status||xb;if(!a.validateStatus(i)){a.onError(t.status);return}let s=xV(t.response);if(i===AF){let n=t.getResponseHeader("Content-Range");if(/bytes \d+-\d+\/\d+/.test(n))a.onDone(s);else de('Missing or invalid "Content-Range" header.'),a.onError(0)}else if(s)a.onDone(s);else a.onError(t.status)}_abortRequest(t){if(this.#t.has(t))this.#t.delete(t),t.abort()}getRangeReader(t,e){let a=super.getRangeReader(t,e);if(a)a.onClosed=()=>this._rangeReaders.delete(a);return a}}class AB extends v9{#t=p6.bind(this);_cachedChunks=[];_done=!1;_requests=[];_storedError=null;constructor(t){super(t);this._fullRequestXhr=t._request({onHeadersReceived:this.#e.bind(this),onDone:this.#a.bind(this),onError:this.#i.bind(this),onProgress:this.#s.bind(this)})}#e(){let t=this._stream,{disableRange:e,rangeChunkSize:a}=t._source,i=this._fullRequestXhr;t._responseOrigin=m6(i.responseURL);let s=i.getAllResponseHeaders(),n=new Headers(s?s.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map((o)=>{let[c,...u]=o.split(": ");return[c,u.join(": ")]}):[]),{contentLength:l,isRangeSupported:f}=oB({responseHeaders:n,isHttp:t.isHttp,rangeChunkSize:a,disableRange:e});if(this._contentLength=l,this._isRangeSupported=f,this._filename=hB(n),this._isRangeSupported)t._abortRequest(i);this._headersCapability.resolve()}#a(t){if(this._requests.length>0)this._requests.shift().resolve({value:t,done:!1});else this._cachedChunks.push(t);if(this._done=!0,this._cachedChunks.length===0)this.#t()}#i(t){this._storedError=g6(t,this._stream.url),this._headersCapability.reject(this._storedError);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}#s(t){this.onProgress?.({loaded:t.loaded,total:t.lengthComputable?t.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 t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t),this.#t(),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}}class vB extends S9{#t=p6.bind(this);onClosed=null;_done=!1;_queuedChunk=null;_requests=[];_storedError=null;constructor(t,e,a){super(t,e,a);this._requestXhr=t._request({begin:e,end:a,onHeadersReceived:this.#e.bind(this),onDone:this.#a.bind(this),onError:this.#i.bind(this),onProgress:null})}#e(){let t=m6(this._requestXhr?.responseURL);try{cB(t,this._stream._responseOrigin)}catch(e){this._storedError=e,this.#i(0)}}#a(t){if(this._requests.length>0)this._requests.shift().resolve({value:t,done:!1});else this._queuedChunk=t;this._done=!0,this.#t(),this.onClosed?.()}#i(t){this._storedError??=g6(t,this._stream.url);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){let e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this.#t(),this._stream._abortRequest(this._requestXhr),this.onClosed?.()}}function SB(t,e=null){let a=process.getBuiltinModule("fs"),{Readable:i}=process.getBuiltinModule("stream"),s=a.createReadStream(t,e);return i.toWeb(s)}class yB extends A9{constructor(t){super(t,kB,CB);let{url:e}=t;Ga(e.protocol==="file:","PDFNodeStream only supports file:// URLs.")}}class kB extends v9{_reader=null;constructor(t){super(t);let{disableRange:e,disableStream:a,rangeChunkSize:i,url:s}=t._source;this._isStreamingSupported=!a,process.getBuiltinModule("fs/promises").lstat(s).then((l)=>{let f=SB(s);this._reader=f.getReader();let{size:o}=l;if(this._contentLength=o,this._isRangeSupported=!e&&o>2*i,!this._isStreamingSupported&&this._isRangeSupported)this.cancel(new C1("Streaming is disabled."));this._headersCapability.resolve()}).catch((l)=>{if(l.code==="ENOENT")l=g6(0,s);this._headersCapability.reject(l)})}async read(){await this._headersCapability.promise;let{value:t,done:e}=await this._reader.read();if(e)return{value:t,done:e};return this._loaded+=t.byteLength,this._callOnProgress(),{value:b6(t),done:!1}}cancel(t){this._reader?.cancel(t)}}class CB extends S9{_readCapability=Promise.withResolvers();_reader=null;constructor(t,e,a){super(t,e,a);let{url:i}=t._source;try{let s=SB(i,{start:e,end:a-1});this._reader=s.getReader(),this._readCapability.resolve()}catch(s){this._readCapability.reject(s)}}async read(){await this._readCapability.promise;let{value:t,done:e}=await this._reader.read();if(e)return{value:t,done:e};return{value:b6(t),done:!1}}cancel(t){this._reader?.cancel(t)}}function UV(t){return r9(t)?gB:ln?yB:qB}class k1{static#t=null;static#e="";static get workerPort(){return this.#t}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw Error("Invalid `workerPort` type.");this.#t=t}static get workerSrc(){return this.#e}static set workerSrc(t){if(typeof t!=="string")throw Error("Invalid `workerSrc` type.");this.#e=t}}class _B{#t;#e;constructor({parsedData:t,rawData:e}){this.#t=t,this.#e=e}getRaw(){return this.#e}get(t){return this.#t.get(t)??null}[Symbol.iterator](){return this.#t.entries()}}var sr=Symbol("INTERNAL");class FB{#t=!1;#e=!1;#a=!1;#i=!0;constructor(t,{name:e,intent:a,usage:i,rbGroups:s}){this.#t=!!(t&sn.DISPLAY),this.#e=!!(t&sn.PRINT),this.name=e,this.intent=a,this.usage=i,this.rbGroups=s}get visible(){if(this.#a)return this.#i;if(!this.#i)return!1;let{print:t,view:e}=this.usage;if(this.#t)return e?.viewState!=="OFF";else if(this.#e)return t?.printState!=="OFF";return!0}_setVisible(t,e,a=!1){if(t!==sr)Qe("Internal method `_setVisible` called.");this.#a=a,this.#i=e}get serializable(){return{userSet:this.#a,visible:this.#i}}}class fp{#t=null;#e=new Map;#a=null;#i=null;#s;creator=null;name=null;constructor(t,e=sn.DISPLAY,a=null){if(this.#s=t,this.renderingIntent=e,t===null)return;this.name=t.name,this.creator=t.creator,this.#i=t.order;for(let i of t.groups)this.#e.set(i.id,new FB(e,i));if(a){if(a.size!==this.#e.size)Qe("Incorrect serialized groupState.");for(let[i,s]of a)this.#e.get(i)._setVisible(sr,s.visible,s.userSet)}else{if(t.baseState==="OFF")for(let i of this.#e.values())i._setVisible(sr,!1);for(let i of t.on)this.#e.get(i)._setVisible(sr,!0);for(let i of t.off)this.#e.get(i)._setVisible(sr,!1)}this.#a=this.getHash()}#l(t){let e=t.length;if(e<2)return!0;let a=t[0];for(let i=1;i<e;i++){let s=t[i],n;if(Array.isArray(s))n=this.#l(s);else if(this.#e.has(s))n=this.#e.get(s).visible;else return de(`Optional content group not found: ${s}`),!0;switch(a){case"And":if(!n)return!1;break;case"Or":if(n)return!0;break;case"Not":return!n;default:return!0}}return a==="And"}isVisible(t){if(this.#e.size===0)return!0;if(!t)return n6("Optional content group not defined."),!0;if(t.type==="OCG"){if(!this.#e.has(t.id))return de(`Optional content group not found: ${t.id}`),!0;return this.#e.get(t.id).visible}else if(t.type==="OCMD"){if(t.expression)return this.#l(t.expression);if(!t.policy||t.policy==="AnyOn"){for(let e of t.ids){if(!this.#e.has(e))return de(`Optional content group not found: ${e}`),!0;if(this.#e.get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(let e of t.ids){if(!this.#e.has(e))return de(`Optional content group not found: ${e}`),!0;if(!this.#e.get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(let e of t.ids){if(!this.#e.has(e))return de(`Optional content group not found: ${e}`),!0;if(!this.#e.get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(let e of t.ids){if(!this.#e.has(e))return de(`Optional content group not found: ${e}`),!0;if(this.#e.get(e).visible)return!1}return!0}return de(`Unknown optional content policy ${t.policy}.`),!0}return de(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,a=!0){let i=this.#e.get(t);if(!i){de(`Optional content group not found: ${t}`);return}if(a&&e&&i.rbGroups.length){for(let s of i.rbGroups)for(let n of s)if(n!==t)this.#e.get(n)?._setVisible(sr,!1,!0)}i._setVisible(sr,!!e,!0),this.#t=null}setOCGState({state:t,preserveRB:e}){let a;for(let i of t){switch(i){case"ON":case"OFF":case"Toggle":a=i;continue}let s=this.#e.get(i);if(!s)continue;switch(a){case"ON":this.setVisibility(i,!0,e);break;case"OFF":this.setVisibility(i,!1,e);break;case"Toggle":this.setVisibility(i,!s.visible,e);break}}this.#t=null}get hasInitialVisibility(){return this.#a===null||this.getHash()===this.#a}getOrder(){if(!this.#e.size)return null;if(this.#i)return this.#i.slice();return[...this.#e.keys()]}getGroup(t){return this.#e.get(t)||null}getHash(){if(this.#t!==null)return this.#t;let t=new Z3;for(let[e,a]of this.#e)t.update(`${e}:${a.visible}`);return this.#t=t.hexdigest()}[Symbol.iterator](){return this.#e.entries()}get serializable(){let t=new Map;for(let[e,a]of this.#e)t.set(e,a.serializable);return{data:this.#s,renderingIntent:this.renderingIntent,groupState:t}}static fromSerializable({data:t,renderingIntent:e,groupState:a}){return new fp(t,e,a)}}class BB{#t=null;#e=null;#a=0;#i=null;#s=null;get pagesNumber(){return this.#a}set pagesNumber(t){if(this.#a===t)return;this.#a=t,this.#t=null,this.#e=null}#l(){if(this.#t)return;let t=this.#a,e=this.#t=new Uint32Array(t);for(let a=0;a<t;a++)e[a]=a+1;this.#e=new Int32Array(e)}#n(){let t=new Map,e=this.#t;for(let a=0,i=this.#a;a<i;a++){let s=e[a],n=t.get(s);if(n)n.push(a+1);else t.set(s,[a+1])}return t}movePages(t,e,a){this.#l();let i=this.#t,s=this.#n(),n=e.length,l=new Uint32Array(n),f=0;for(let m=0;m<n;m++){let p=e[m]-1;if(l[m]=i[p],p<a)f++}let o=this.#a,c=o-n,u=_a(a-f,0,c);for(let m=0,p=0;m<o;m++)if(!t.has(m+1))i[p++]=i[m];if(i.copyWithin(u+n,u,c),i.set(l,u),this.#f(s),i.every((m,p)=>m===p+1))this.#t=null}deletePages(t){this.#l();let e=this.#t,a=this.#n();this.#s={pageNumberToId:e.slice(),pagesNumber:this.#a,prevPageNumbers:this.#e.slice()};let i=this.#a-t.length;this.#a=i;let s=this.#t=new Uint32Array(i);this.#e=new Int32Array(i);let n=0,l=0;for(let f of t){let o=f-1;if(o!==n)s.set(e.subarray(n,o),l),l+=o-n;n=o+1}if(n<e.length)s.set(e.subarray(n),l);this.#f(a,new Set(t))}cancelDelete(){if(this.#s)this.#t=this.#s.pageNumberToId,this.#a=this.#s.pagesNumber,this.#e=this.#s.prevPageNumbers,this.#s=null}cleanSavedData(){this.#s=null}copyPages(t){this.#l(),this.#i={pageNumbers:t,pageIds:t.map((e)=>this.#t[e-1])}}cancelCopy(){this.#i=null}pastePages(t){this.#l();let e=this.#t,a=this.#n(),{pageNumbers:i,pageIds:s}=this.#i,n=this.#a+i.length;this.#a=n;let l=this.#t=new Uint32Array(n);this.#e=new Int32Array(n),l.set(e.subarray(0,t),0),l.set(s,t),l.set(e.subarray(t),t+i.length),this.#f(a,null,t,i),this.#i=null}#f(t,e=null,a=-1,i=null){let s=this.#e,n=this.#t,l=a+(i?.length??0),f=new Map;for(let o=0,c=this.#a;o<c;o++){if(o>=a&&o<l){s[o]=-i[o-a];continue}let u=n[o],m=t.get(u),p=f.get(u)||0;if(e&&m)while(p<m.length&&e.has(m[p]))p++;s[o]=m?.[p],f.set(u,p+1)}}hasBeenAltered(){return this.#t!==null}getPageMappingForSaving(t=null){t??=this.#n();let e=0;for(let i of t.values())e=Math.max(e,i.length);let a=Array(e);for(let i=0;i<e;i++)a[i]={document:null,pageIndices:[],includePages:[]};for(let[i,s]of t)for(let n=0,l=s.length;n<l;n++)a[n].includePages.push([i-1,s[n]-1]);for(let{includePages:i,pageIndices:s}of a){i.sort((n,l)=>n[0]-l[0]);for(let n=0,l=i.length;n<l;n++)s.push(i[n][1]),i[n]=i[n][0]}return a}extractPages(t){t=Array.from(t).sort((a,i)=>a-i);let e=new Map;for(let a=0,i=t.length;a<i;a++){let s=this.getPageId(t[a]);e.getOrInsertComputed(s,w9).push(a+1)}return this.getPageMappingForSaving(e)}getPrevPageNumber(t){return this.#e?.[t-1]??0}getPageNumber(t){if(!this.#t)return t;let e=this.#t;for(let a=0,i=this.#a;a<i;a++)if(e[a]===t)return a+1;return 0}getPageId(t){return this.#t?.[t-1]??t}getMapping(){return this.#t?.subarray(0,this.pagesNumber)}}var kh=Symbol("INITIAL_DATA"),vF=()=>({...Promise.withResolvers(),data:kh});class rp{#t=new Map;get(t,e=null){if(e){let i=this.#t.getOrInsertComputed(t,vF);return i.promise.then(()=>e(i.data)),null}let a=this.#t.get(t);if(!a||a.data===kh)throw Error(`Requesting object that isn't resolved yet ${t}.`);return a.data}has(t){let e=this.#t.get(t);return!!e&&e.data!==kh}delete(t){let e=this.#t.get(t);if(!e||e.data===kh)return!1;return this.#t.delete(t),!0}resolve(t,e=null){let a=this.#t.getOrInsertComputed(t,vF);if(a.data!==kh)throw Error(`Object already resolved ${t}.`);a.data=e,a.resolve()}clear(){for(let{data:t}of this.#t.values())t?.bitmap?.close();this.#t.clear()}*[Symbol.iterator](){for(let[t,{data:e}]of this.#t)if(e!==kh)yield[t,e]}}var IV=1e5,SF=30;class nn{#t=Promise.withResolvers();#e=null;#a=!1;#i=!!globalThis.FontInspector?.enabled;#s=null;#l=null;#n=null;#f=0;#o=0;#r=null;#u=null;#c=0;#g=0;#p=Object.create(null);#b=[];#h=null;#m=[];#j=new WeakMap;#d=null;static#w=new Map;static#S=new Map;static#y=new WeakMap;static#q=null;static#k=new Set;constructor({textContentSource:t,images:e,container:a,viewport:i}){if(t instanceof ReadableStream)this.#h=t;else if(typeof t==="object")this.#h=new ReadableStream({start(o){o.enqueue(t),o.close()}});else throw Error('No "textContentSource" parameter specified.');this.#e=this.#u=a,this.#s=e,this.#g=i.scale*N0.pixelRatio,this.#c=i.rotation,this.#n={div:null,properties:null,ctx:null};let{pageWidth:s,pageHeight:n,pageX:l,pageY:f}=i.rawDims;this.#d=[1,0,0,-1,-l,f+n],this.#o=s,this.#f=n,nn.#D(),a.style.setProperty("--min-font-size",nn.#q),or(a,i),this.#t.promise.finally(()=>{nn.#k.delete(this),this.#n=null,this.#p=null}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:t,isFirefox:e}=ha.platform;return be(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){if(this.#s)this.#e.append(this.#s.render());let t=()=>{this.#r.read().then(({value:e,done:a})=>{if(a){this.#t.resolve();return}this.#l??=e.lang,Object.assign(this.#p,e.styles),this.#v(e.items),t()},this.#t.reject)};return this.#r=this.#h.getReader(),nn.#k.add(this),t(),this.#t.promise}update({viewport:t,onBefore:e=null}){let a=t.scale*N0.pixelRatio,i=t.rotation;if(i!==this.#c)e?.(),this.#c=i,or(this.#u,{rotation:i});if(a!==this.#g){e?.(),this.#g=a;let s={div:null,properties:null,ctx:nn.#O(this.#l)};for(let n of this.#m)s.properties=this.#j.get(n),s.div=n,this.#B(s)}}cancel(){let t=new C1("TextLayer task cancelled.");this.#r?.cancel(t).catch(()=>{}),this.#r=null,this.#t.reject(t)}get textDivs(){return this.#m}get textContentItemsStr(){return this.#b}#v(t){if(this.#a)return;this.#n.ctx??=nn.#O(this.#l);let e=this.#m,a=this.#b;for(let i of t){if(e.length>IV){de("Ignoring additional textDivs for performance reasons."),this.#a=!0;return}if(i.str===void 0){if(i.type==="beginMarkedContentProps"||i.type==="beginMarkedContent"){let s=this.#e;if(this.#e=document.createElement("span"),this.#e.classList.add("markedContent"),i.id)this.#e.setAttribute("id",`${i.id}`);if(i.tag==="Artifact")this.#e.ariaHidden=!0;s.append(this.#e)}else if(i.type==="endMarkedContent")this.#e=this.#e.parentNode;continue}a.push(i.str),this.#_(i)}}#_(t){let e=document.createElement("span"),a={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};this.#m.push(e);let i=Nt.transform(this.#d,t.transform),s=Math.atan2(i[1],i[0]),n=this.#p[t.fontName];if(n.vertical)s+=Math.PI/2;let l=this.#i&&n.fontSubstitution||n.fontFamily;l=nn.fontFamilyMap.get(l)||l;let f=Math.hypot(i[2],i[3]),o=f*nn.#T(l,n,this.#l),c,u;if(s===0)c=i[4],u=i[5]-o;else c=i[4]+o*Math.sin(s),u=i[5]-o*Math.cos(s);let m=e.style;if(m.left=`${(100*c/this.#o).toFixed(2)}%`,m.top=`${(100*u/this.#f).toFixed(2)}%`,m.setProperty("--font-height",`${f.toFixed(2)}px`),m.fontFamily=l,a.fontSize=f,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,this.#i)e.dataset.fontName=n.fontSubstitutionLoadedName||t.fontName;if(s!==0)a.angle=s*(180/Math.PI);let p=!1;if(t.str.length>1)p=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){let w=Math.abs(t.transform[0]),d=Math.abs(t.transform[3]);if(w!==d&&Math.max(w,d)/Math.min(w,d)>1.5)p=!0}if(p)a.canvasWidth=n.vertical?t.height:t.width;if(this.#j.set(e,a),this.#n.div=e,this.#n.properties=a,this.#B(this.#n),a.hasText)this.#e.append(e);if(a.hasEOL){let w=document.createElement("br");w.setAttribute("role","presentation"),this.#e.append(w)}}#B(t){let{div:e,properties:a,ctx:i}=t,{style:s}=e;if(a.canvasWidth!==0&&a.hasText){let{fontFamily:n}=s,{canvasWidth:l,fontSize:f}=a;nn.#F(i,f*this.#g,n);let{width:o}=i.measureText(e.textContent);if(o>0)s.setProperty("--scale-x",l*this.#g/o)}if(a.angle!==0)s.setProperty("--rotate",`${a.angle}deg`)}static cleanup(){if(this.#k.size>0)return;this.#w.clear();for(let{canvas:t}of this.#S.values())t.remove();this.#S.clear()}static#O(t=null){let e=this.#S.get(t||="");if(!e){let a=document.createElement("canvas");a.style.cssText="position:absolute;top:0;left:0;width:0;height:0;display:none;letter-spacing:normal;word-spacing:normal",a.lang=t,document.body.append(a),e=a.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#S.set(t,e),this.#y.set(e,{size:0,family:""})}return e}static#F(t,e,a){let i=this.#y.get(t);if(e===i.size&&a===i.family)return;t.font=`${e}px ${a}`,i.size=e,i.family=a}static#D(){if(this.#q!==null)return;let t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),this.#q=t.getBoundingClientRect().height,t.remove()}static#T(t,e,a){let i=this.#w.get(t);if(i)return i;let s=this.#O(a);s.canvas.width=s.canvas.height=SF,this.#F(s,SF,t);let n=s.measureText(""),l=n.fontBoundingBoxAscent,f=Math.abs(n.fontBoundingBoxDescent);s.canvas.width=s.canvas.height=0;let o=0.8;if(l)o=l/(l+f);else{if(ha.platform.isFirefox)de("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering.");if(e.ascent)o=e.ascent;else if(e.descent)o=1+e.descent}return this.#w.set(t,o),o}}var GV=100;function op(t={}){let e=new hp,{docId:a}=e,i=t.url?dV(t.url):null,s=t.data?qV(t.data):null,n=t.httpHeaders||null,l=t.withCredentials===!0,f=t.password??null,o=t.range instanceof cp?t.range:null,c=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:65536,u=t.worker instanceof Ji?t.worker:null,m=t.verbosity,p=typeof t.docBaseUrl==="string"&&!r6(t.docBaseUrl)?t.docBaseUrl:null,w=R3(t.cMapUrl),d=t.cMapPacked!==!1,v=R3(t.iccUrl),k=R3(t.standardFontDataUrl),y=R3(t.wasmUrl),B=t.stopAtErrors!==!0,H=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,M=typeof t.isOffscreenCanvasSupported==="boolean"?t.isOffscreenCanvasSupported:!ln,D=typeof t.isImageDecoderSupported==="boolean"?t.isImageDecoderSupported:!ln,T=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,z=typeof t.disableFontFace==="boolean"?t.disableFontFace:ln,E=t.fontExtraProperties===!0,V=t.enableXfa===!0,tt=t.ownerDocument||globalThis.document,at=t.disableRange===!0,Q=t.disableStream===!0,Z=t.disableAutoFetch===!0,J=t.pdfBug===!0,Y=t.CanvasFactory||(ln?eB:WF),W=t.FilterFactory||(ln?tB:PF),ft=t.BinaryDataFactory||(ln?aB:Jb),nt=t.enableHWA===!0,R=t.enableWebGPU===!0?CV():Promise.resolve(!1),ct=t.useWasm!==!1,pt=t.pagesMapper||new BB,G=typeof t.useSystemFonts==="boolean"?t.useSystemFonts:!ln&&!z,Ct=typeof t.useWorkerFetch==="boolean"?t.useWorkerFetch:!!(ft===Jb&&w&&d&&k&&y&&r9(w,document.baseURI)&&r9(k,document.baseURI)&&r9(y,document.baseURI)),Kt=null;nV(m);let le={canvasFactory:new Y({ownerDocument:tt,enableHWA:nt}),filterFactory:new W({docId:a,ownerDocument:tt}),binaryDataFactory:Ct?null:new ft({cMapUrl:w,standardFontDataUrl:k,wasmUrl:y})};if(!u)u=Ji.create({verbosity:m,port:k1.workerPort}),e._worker=u;let Ft={docId:a,apiVersion:"6.1.200",data:s,password:f,disableAutoFetch:Z,rangeChunkSize:c,docBaseUrl:p,enableXfa:V,evaluatorOptions:{maxImageSize:H,disableFontFace:z,ignoreErrors:B,isOffscreenCanvasSupported:M,isImageDecoderSupported:D,canvasMaxAreaInBytes:T,fontExtraProperties:E,useSystemFonts:G,useWasm:ct,useWorkerFetch:Ct,cMapUrl:w,cMapPacked:d,iccUrl:v,standardFontDataUrl:k,wasmUrl:y,hasGPU:!1}},Et={ownerDocument:tt,pdfBug:J,styleElement:Kt,enableHWA:nt,loadingParams:{disableAutoFetch:Z,enableXfa:V}};return Promise.all([u.promise,R]).then(function([,$t]){if(u.destroyed)throw Error("Worker was destroyed");Ft.evaluatorOptions.hasGPU=$t;let Dt=u.messageHandler.sendWithPromise("GetDocRequest",Ft,s?[s.buffer]:null),Mt;if(s);else if(o)Mt=new wB({pdfDataRangeTransport:o,disableRange:at,disableStream:Q});else if(i)Mt=new(UV(i))({url:i,httpHeaders:n,withCredentials:l,rangeChunkSize:c,disableRange:at,disableStream:Q});else throw Error("getDocument - expected either `data`, `range`, or `url` parameter.");return Dt.then((Xt)=>{if(u.destroyed)throw Error("Worker was destroyed");let Gt=new Ch(a,Xt,u.port),ae=new HB(Gt,e,Mt,Et,le,pt);if(e._transport=ae,e.destroyed)throw Error("Loading aborted");Gt.send("Ready",null)})}).catch(e._capability.reject).finally(e._setupCapability.resolve),e}class hp{static#t=0;_capability=Promise.withResolvers();_setupCapability=Promise.withResolvers();_transport=null;_worker=null;docId=`d${hp.#t++}`;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(t){if(this._worker?.port)delete this._worker._pendingDestroy;throw t}this._transport=null,this._worker?.destroy(),this._worker=null}async getData(){return this._transport.getData()}}class cp{#t=Promise.withResolvers();#e=null;constructor(t,e,a=!1,i=null){this.length=t,this.initialData=e,this.progressiveDone=a,this.contentDispositionFilename=i}onDataRange(t,e){this.#e({type:"range",begin:t,chunk:e})}onDataProgressiveRead(t){this.#t.promise.then(()=>{this.#e({type:"progressiveRead",chunk:t})})}onDataProgressiveDone(){this.#t.promise.then(()=>{this.#e({type:"progressiveDone"})})}transportReady(t){this.#e=t,this.#t.resolve()}requestDataRange(t,e){Qe("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class OB{constructor(t,e){this._pdfInfo=t,this._transport=e}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 be(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}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(t){return this._transport.getAttachmentContent(t)}getAnnotationsByType(t,e){return this._transport.getAnnotationsByType(t,e)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){let{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}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(t){return this._transport.extractPages(t)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}getRawData(t){return this._transport.getRawData(t)}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class up{#t=!1;#e=null;constructor(t,e,a,i,s=!1){this._pageIndex=t,this._pageInfo=e,this._transport=a,this._stats=s?new Xb:null,this._pdfBug=s,this.commonObjs=a.commonObjs,this.objs=new rp,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,this.#e=i,this.imageCoordinates=null}clone(t){let e=new up(t,this._pageInfo,this._transport,this.#e,this._pdfBug);return e.clonedFromIndex=this.clonedFromIndex??this._pageIndex,this._transport.updatePage(e),e}get pageNumber(){return this._pageIndex+1}set pageNumber(t){this._pageIndex=t-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:t,rotation:e=this.rotate,offsetX:a=0,offsetY:i=0,dontFlip:s=!1}={}){return new j9({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:a,offsetY:i,dontFlip:s})}getAnnotations({intent:t="display"}={}){let{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return be(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:t,canvas:e=t.canvas,viewport:a,intent:i="display",annotationMode:s=Dl.ENABLE,transform:n=null,background:l=null,optionalContentConfigPromise:f=null,annotationCanvasMap:o=null,pageColors:c=null,printAnnotationStorage:u=null,isEditing:m=!1,recordImages:p=!1,recordOperations:w=!1,operationsFilter:d=null}){this._stats?.time("Overall");let v=this._transport.getRenderingIntent(i,s,u,m),{renderingIntent:k,cacheKey:y}=v;this.#t=!1,f||=this._transport.getOptionalContentConfig(k);let B=this._intentStates.getOrInsertComputed(y,Gb);if(B.streamReaderCancelTimeout)clearTimeout(B.streamReaderCancelTimeout),B.streamReaderCancelTimeout=null;let H=!!(k&sn.PRINT);if(!B.displayReadyCapability)B.displayReadyCapability=Promise.withResolvers(),B.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(v);let M=!!(this._pdfBug&&globalThis.StepperManager?.enabled),D=!!e&&!this.recordedBBoxes&&(w||M),T=!!e&&!this.imageCoordinates&&p,z=(Q)=>{if(B.renderTasks.delete(tt),D){let Z=tt.gfx?.dependencyTracker.take();if(Z){if(tt.stepper?.setOperatorBBoxes(Z,tt.gfx.dependencyTracker.takeDebugMetadata()),w)this.recordedBBoxes=Z}}if(T&&!Q)this.imageCoordinates=tt.gfx?.imagesTracker.take();if(H)this.#t=!0;if(this.#a(),Q)tt.capability.reject(Q),this._abortOperatorList({intentState:B,reason:Q instanceof Error?Q:Error(Q)});else tt.capability.resolve();if(this._stats){if(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled)globalThis.Stats.add(this.pageNumber,this._stats)}},E=null,V=null;if(D||T)V=new UF(e,B.operatorList.length);if(D)E=new IF(V,M);let tt=new _h({callback:z,params:{canvas:e,canvasContext:t,dependencyTracker:E??V,imagesTracker:T?new $3(e):null,viewport:a,transform:n,background:l},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:o,operatorList:B.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!H,pdfBug:this._pdfBug,pageColors:c,enableHWA:this._transport.enableHWA,operationsFilter:d});(B.renderTasks||=new Set).add(tt);let at=tt.task;return Promise.all([B.displayReadyCapability.promise,f]).then(([Q,Z])=>{if(this.destroyed){z();return}if(this._stats?.time("Rendering"),!(Z.renderingIntent&k))throw Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");tt.initializeGraphics({transparency:Q,optionalContentConfig:Z}),tt.operatorListChanged()}).catch(z),at}getOperatorList({intent:t="display",annotationMode:e=Dl.ENABLE,printAnnotationStorage:a=null,isEditing:i=!1}={}){function s(){if(l.operatorList.lastChunk)l.opListReadCapability.resolve(l.operatorList),l.renderTasks.delete(f)}let n=this._transport.getRenderingIntent(t,e,a,i,!0),l=this._intentStates.getOrInsertComputed(n.cacheKey,Gb),f;if(!l.opListReadCapability)f=Object.create(null),f.operatorListChanged=s,l.opListReadCapability=Promise.withResolvers(),(l.renderTasks||=new Set).add(f),l.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(n);return l.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageId:this.#e.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:e===!0},{highWaterMark:100,size(i){return i.items.length}})}async getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then((i)=>u9.textContent(i));let e=this.streamTextContent(t),a={items:[],styles:Object.create(null),lang:null};for await(let i of e)a.lang??=i.lang,Object.assign(a.styles,i.styles),a.items.push(...i.items);return a}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let t=[];for(let e of this._intentStates.values()){if(this._abortOperatorList({intentState:e,reason:Error("Page was destroyed."),force:!0}),e.opListReadCapability)continue;for(let a of e.renderTasks)t.push(a.completed),a.cancel()}return this.objs.clear(),this.#t=!1,Promise.all(t)}cleanup(t=!1){this.#t=!0;let e=this.#a();if(t&&e)this._stats&&=new Xb;return e}#a(){if(!this.#t||this.destroyed)return!1;for(let{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#t=!1,!0}_startRenderPage(t,e){let a=this._intentStates.get(e);if(!a)return;this._stats?.timeEnd("Page Request"),a.displayReadyCapability?.resolve(t)}_renderPageChunk(t,e){for(let a=0,i=t.length;a<i;a++)e.operatorList.fnArray.push(t.fnArray[a]),e.operatorList.argsArray.push(t.argsArray[a]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(let a of e.renderTasks)a.operatorListChanged();if(t.lastChunk)this.#a()}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:a,modifiedIds:i}){let{map:s,transfer:n}=a,f=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageId:this.#e.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:s,modifiedIds:i},void 0,n).getReader(),o=this._intentStates.get(e);o.streamReader=f;let c=()=>{f.read().then(({value:u,done:m})=>{if(m){o.streamReader=null;return}if(this._transport.destroyed)return;this._renderPageChunk(u,o),c()},(u)=>{if(o.streamReader=null,this._transport.destroyed)return;if(o.operatorList){o.operatorList.lastChunk=!0;for(let m of o.renderTasks)m.operatorListChanged();this.#a()}if(o.displayReadyCapability)o.displayReadyCapability.reject(u);else if(o.opListReadCapability)o.opListReadCapability.reject(u);else throw u})};c()}_abortOperatorList({intentState:t,reason:e,force:a=!1}){if(!t.streamReader)return;if(t.streamReaderCancelTimeout)clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null;if(!a){if(t.renderTasks.size>0)return;if(e instanceof f6){let i=GV;if(e.extraDelay>0&&e.extraDelay<1000)i+=e.extraDelay;t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},i);return}}if(t.streamReader.cancel(new C1(e.message)).catch(()=>{}),t.streamReader=null,this._transport.destroyed)return;for(let[i,s]of this._intentStates)if(s===t){this._intentStates.delete(i);break}this.cleanup()}get stats(){return this._stats}}class Ji{#t=Promise.withResolvers();#e=null;#a=null;#i=null;static#s=0;static#l=!1;static#n=new WeakMap;static{if(ln)this.#l=!0,k1.workerSrc||="./pdf.worker.mjs";this._isSameOrigin=(t,e)=>{let a=URL.parse(t);if(!a?.origin||a.origin==="null")return!1;let i=new URL(e,a);return a.origin===i.origin},this._createCDNWrapper=(t)=>{let e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))}}constructor({name:t=null,port:e=null,verbosity:a=lV()}={}){if(this.name=t,this.destroyed=!1,this.verbosity=a,e){if(Ji.#n.has(e))throw Error("Cannot use more than one PDFWorker per port.");Ji.#n.set(e,this),this.#o(e)}else this.#r()}get promise(){return this.#t.promise}#f(){this.#t.resolve(),this.#e.send("configure",{verbosity:this.verbosity})}get port(){return this.#a}get messageHandler(){return this.#e}#o(t){this.#a=t,this.#e=new Ch("main","worker",t),this.#e.on("ready",()=>{}),this.#f()}#r(){if(Ji.#l||Ji.#c){this.#u();return}let{workerSrc:t}=Ji;try{if(!Ji._isSameOrigin(window.location,t))t=Ji._createCDNWrapper(new URL(t,window.location).href);let e=new Worker(t,{type:"module"}),a=new Ch("main","worker",e),i=()=>{if(s.abort(),a.destroy(),e.terminate(),this.destroyed)this.#t.reject(Error("Worker was destroyed"));else this.#u()},s=new AbortController;e.addEventListener("error",()=>{if(!this.#i)i()},{signal:s.signal}),a.on("test",(l)=>{if(s.abort(),this.destroyed||!l){i();return}this.#e=a,this.#a=e,this.#i=e,this.#f()}),a.on("ready",(l)=>{if(s.abort(),this.destroyed){i();return}try{n()}catch{this.#u()}});let n=()=>{let l=new Uint8Array;a.send("test",l,[l.buffer])};n();return}catch{n6("The worker has been disabled.")}this.#u()}#u(){if(!Ji.#l)de("Setting up fake worker."),Ji.#l=!0;Ji._setupFakeWorkerGlobal.then((t)=>{if(this.destroyed){this.#t.reject(Error("Worker was destroyed"));return}let e=new $F;this.#a=e;let a=`fake${Ji.#s++}`,i=new Ch(a+"_worker",a,e);t.setup(i,e),this.#e=new Ch(a,a+"_worker",e),this.#f()}).catch((t)=>{this.#t.reject(Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){this.destroyed=!0,this.#i?.terminate(),this.#i=null,Ji.#n.delete(this.#a),this.#a=null,this.#e?.destroy(),this.#e=null}static create(t){let e=this.#n.get(t?.port);if(e){if(e._pendingDestroy)throw Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new Ji(t)}static get workerSrc(){if(k1.workerSrc)return k1.workerSrc;throw Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#c(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return be(this,"_setupFakeWorkerGlobal",(async()=>{if(this.#c)return this.#c;return(await import(this.workerSrc)).WorkerMessageHandler})())}}class HB{downloadInfoCapability=Promise.withResolvers();#t=null;#e=new Map;#a=null;#i=new Map;#s=new Map;#l=new Map;#n=null;constructor(t,e,a,i,s,n){this.messageHandler=t,this.loadingTask=e,this.#a=a,this.commonObjs=new rp,this.fontLoader=new GF({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.enableHWA=i.enableHWA,this.loadingParams=i.loadingParams,this._params=i,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.binaryDataFactory=s.binaryDataFactory,this.pagesMapper=n,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler()}updatePage(t){let{_pageIndex:e}=t;this.#i.set(e,t),this.#s.set(e,Promise.resolve(t))}#f(t,e=null){return this.#e.getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,e))}#o({loaded:t,total:e}){this.loadingTask.onProgress?.({loaded:t,total:e,percent:e?_a(Math.round(t/e*100),0,100):NaN})}get annotationStorage(){return be(this,"annotationStorage",new h6)}getRenderingIntent(t,e=Dl.ENABLE,a=null,i=!1,s=!1){let n=sn.DISPLAY,l=m9;switch(t){case"any":n=sn.ANY;break;case"display":break;case"print":n=sn.PRINT;break;default:de(`getRenderingIntent - invalid intent: ${t}`)}let f=n&sn.PRINT&&a instanceof ip?a:this.annotationStorage;switch(e){case Dl.DISABLE:n+=sn.ANNOTATIONS_DISABLE;break;case Dl.ENABLE:break;case Dl.ENABLE_FORMS:n+=sn.ANNOTATIONS_FORMS;break;case Dl.ENABLE_STORAGE:n+=sn.ANNOTATIONS_STORAGE,l=f.serializable;break;default:de(`getRenderingIntent - invalid annotationMode: ${e}`)}if(i)n+=sn.IS_EDITING;if(s)n+=sn.OPLIST;let{ids:o,hash:c}=f.modifiedIds,u=[n,l.hash,c];return{renderingIntent:n,cacheKey:u.join("_"),annotationStorageSerializable:l,modifiedIds:o}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#n?.reject(Error("Worker was destroyed during onPassword callback"));let t=[];for(let a of this.#i.values())t.push(a._destroy());if(this.#i.clear(),this.#s.clear(),this.#l.clear(),Object.hasOwn(this,"annotationStorage"))this.annotationStorage.resetModified();let e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(),nn.cleanup(),this.#a?.cancelAllRequests(new C1("Worker was terminated.")),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(a,i)=>{Ga(this.#a,"GetReader - no `BasePDFStream` instance available."),this.#t=this.#a.getFullReader(),this.#t.onProgress=(s)=>this.#o(s),i.onPull=()=>{this.#t.read().then(function({value:s,done:n}){if(n){i.close();return}Ga(s instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(s),1,[s])}).catch((s)=>{i.error(s)})},i.onCancel=(s)=>{this.#t.cancel(s),i.ready.catch((n)=>{if(this.destroyed)return;throw n})}}),t.on("ReaderHeadersReady",async(a)=>{await this.#t.headersReady;let{isStreamingSupported:i,isRangeSupported:s,contentLength:n}=this.#t;if(i&&s)this.#t.onProgress=null;return{isStreamingSupported:i,isRangeSupported:s,contentLength:n}}),t.on("GetRangeReader",(a,i)=>{Ga(this.#a,"GetRangeReader - no `BasePDFStream` instance available.");let s=this.#a.getRangeReader(a.begin,a.end);if(!s){i.close();return}i.onPull=()=>{s.read().then(function({value:n,done:l}){if(l){i.close();return}Ga(n instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(n),1,[n])}).catch((n)=>{i.error(n)})},i.onCancel=(n)=>{s.cancel(n),i.ready.catch((l)=>{if(this.destroyed)return;throw l})}}),t.on("GetDoc",({pdfInfo:a})=>{this.pagesMapper.pagesNumber=a.numPages,this._numPages=a.numPages,this._htmlForXfa=a.htmlForXfa,delete a.htmlForXfa,e._capability.resolve(new OB(a,this))}),t.on("DocException",(a)=>{e._capability.reject(Es(a))}),t.on("PasswordRequest",(a)=>{this.#n=Promise.withResolvers();try{if(!e.onPassword)throw Es(a);let i=(s)=>{if(s instanceof Error)this.#n.reject(s);else this.#n.resolve({password:s})};e.onPassword(i,a.code)}catch(i){this.#n.reject(i)}return this.#n.promise}),t.on("DataLoaded",(a)=>{this.#o({loaded:a.length,total:a.length}),this.downloadInfoCapability.resolve(a)}),t.on("StartRenderPage",(a)=>{if(this.destroyed)return;this.#i.get(a.pageIndex)._startRenderPage(a.transparency,a.cacheKey)}),t.on("commonobj",([a,i,s])=>{if(this.destroyed)return null;if(this.commonObjs.has(a))return null;switch(i){case"Font":if("error"in s){let u=s.error;de(`Error during font loading: ${u}`),this.commonObjs.resolve(a,u);break}let n=new JF(s),l=this._params.pdfBug&&globalThis.FontInspector?.enabled?(u,m)=>globalThis.FontInspector.fontAdded(u,m):null,f=new XF(n,l,s.charProcOperatorList,s.extra);this.fontLoader.bind(f).catch(()=>t.sendWithPromise("FontFallback",{id:a})).finally(()=>{if(!f.fontExtraProperties)f.clearData();this.commonObjs.resolve(a,f)});break;case"CopyLocalImage":let{imageRef:o}=s;Ga(o,"The imageRef must be defined.");for(let u of this.#i.values())for(let[,m]of u.objs){if(m?.ref!==o)continue;if(!m.dataLen)return null;let p=structuredClone(m);return this.commonObjs.resolve(a,p),m.dataLen}break;case"FontPath":this.commonObjs.resolve(a,new ZF(s));break;case"Image":this.commonObjs.resolve(a,s);break;case"Pattern":let c=new QF(s);this.commonObjs.resolve(a,c.getIR());break;default:throw Error(`Got unknown common object type ${i}`)}return null}),t.on("obj",([a,i,s,n])=>{if(this.destroyed)return;let l=this.#i.get(i);if(l.objs.has(a))return;if(l._intentStates.size===0){n?.bitmap?.close();return}switch(s){case"Image":case"Pattern":l.objs.resolve(a,n);break;default:throw Error(`Got unknown object type ${s}`)}}),t.on("DocProgress",(a)=>{if(this.destroyed)return;this.#o(a)}),t.on("FetchBinaryData",async(a)=>{if(this.destroyed)throw Error("Worker was destroyed.");if(!this.binaryDataFactory)throw Error("`BinaryDataFactory` not initialized, see the `useWorkerFetch` parameter.");return this.binaryDataFactory.fetch(a)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){if(this.annotationStorage.size<=0)de("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this.#t?.filename??null},e).finally(()=>{this.annotationStorage.resetModified()})}extractPages(t){let e={pageInfos:t},a,i=globalThis.ImageBitmap;if(typeof i==="function"){let s=Array.isArray(t)?t:[t];for(let n of s)if(n?.image instanceof i)(a||=[]).push(n.image)}if(this.annotationStorage.size>0){let s=this.annotationStorage.serializable,{map:n}=s;if(s.transfer?.length)if(a)a.push(...s.transfer);else a=s.transfer;let l=this.pagesMapper.getMapping();if(l){let f=new Map;for(let[o,c]of n){if(c?.pageIndex!==void 0&&c.pageIndex>=0&&c.pageIndex<l.length){let u=l[c.pageIndex]-1;if(u!==c.pageIndex){f.set(o,{...c,pageIndex:u});continue}}f.set(o,c)}n=f}e.annotationStorage=n}return this.messageHandler.sendWithPromise("ExtractPages",e,a).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this.pagesMapper.pagesNumber)return Promise.reject(Error("Invalid page request."));let e=t-1,a=this.pagesMapper.getPageId(t)-1,i=this.#s.get(e);if(i)return i;let s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:a}).then((n)=>{if(this.destroyed)throw Error("Transport destroyed");if(n.refStr)this.#l.set(n.refStr,a);let l=new up(e,n,this,this.pagesMapper,this._params.pdfBug);return this.#i.set(e,l),l});return this.#s.set(e,s),s}async getPageIndex(t){if(!Yb(t))throw Error("Invalid pageIndex request.");let e=await this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}),a=this.pagesMapper.getPageNumber(e+1);if(a===0)throw Error("GetPageIndex: page has been removed.");return a-1}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:this.pagesMapper.getPageId(t+1)-1,intent:e})}getFieldObjects(){return this.#f("GetFieldObjects")}hasJSActions(){return this.#f("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){if(typeof t!=="string")return Promise.reject(Error("Invalid destination request."));return this.messageHandler.sendWithPromise("GetDestination",{id:t})}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(t){return this.messageHandler.sendWithPromise("GetAttachmentContent",t)}getAnnotationsByType(t,e){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:t,pageIndexesToSkip:e})}getDocJSActions(){return this.#f("GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:this.pagesMapper.getPageId(t+1)-1})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:this.pagesMapper.getPageId(t+1)-1})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return this.#f("GetOptionalContentConfig").then((e)=>new fp(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){return this.#e.getOrInsertComputed("GetMetadata",()=>this.messageHandler.sendWithPromise("GetMetadata",null).then((e)=>({info:e[0],metadata:e[1]?new _B(e[1]):null,contentDispositionFilename:this.#t?.filename??null,contentLength:this.#t?.contentLength??null,hasStructTree:e[2]})))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}getRawData(t){return this.messageHandler.sendWithPromise("GetRawData",t)}async startCleanup(t=!1){if(this.destroyed)return;await this.messageHandler.sendWithPromise("Cleanup",null);for(let e of this.#i.values())if(!e.cleanup())throw Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);if(this.commonObjs.clear(),!t)this.fontLoader.clear();this.#e.clear(),this.filterFactory.destroy(!0),nn.cleanup()}cachedPageNumber(t){if(!Yb(t))return null;let e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`,a=this.#l.get(e);if(a>=0){let i=this.pagesMapper.getPageNumber(a+1);if(i!==0)return i}return null}}class MB{_internalRenderTask=null;onContinue=null;onError=null;constructor(t){this._internalRenderTask=t}get promise(){return this._internalRenderTask.capability.promise}cancel(t=0){this._internalRenderTask.cancel(null,t)}get separateAnnots(){let{separateAnnots:t}=this._internalRenderTask.operatorList;if(!t)return!1;let{annotationCanvasMap:e}=this._internalRenderTask;return t.form||t.canvas&&e?.size>0}get imageCoordinates(){return this._internalRenderTask.imageCoordinates||null}}class _h{#t=null;static#e=new WeakSet;constructor({callback:t,params:e,objs:a,commonObjs:i,annotationCanvasMap:s,operatorList:n,pageIndex:l,canvasFactory:f,filterFactory:o,useRequestAnimationFrame:c=!1,pdfBug:u=!1,pageColors:m=null,enableHWA:p=!1,operationsFilter:w=null}){this.callback=t,this.params=e,this.objs=a,this.commonObjs=i,this.annotationCanvasMap=s,this.operatorListIdx=null,this.operatorList=n,this._pageIndex=l,this.canvasFactory=f,this.filterFactory=o,this._pdfBug=u,this.pageColors=m,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=c===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new MB(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=e.canvas,this._canvasContext=e.canvas?null:e.canvasContext,this._enableHWA=p,this._dependencyTracker=e.dependencyTracker,this._imagesTracker=e.imagesTracker,this._operationsFilter=w}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){if(this.cancelled)return;if(this._canvas){if(_h.#e.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.");_h.#e.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:a,transform:i,background:s,dependencyTracker:n,imagesTracker:l}=this.params,f=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new Fh(f,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors,n,l),this.gfx.beginDrawing({transform:i,viewport:a,transparency:t,background:s}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,e=0){if(this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#t)window.cancelAnimationFrame(this.#t),this.#t=null;_h.#e.delete(this._canvas),t||=new f6(`Rendering cancelled, page ${this._pageIndex+1}`,e),this.callback(t),this.task.onError?.(t)}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.#t=window.requestAnimationFrame(()=>{this.#t=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(),_h.#e.delete(this._canvas),this.callback()}}}var XV="6.1.200",KV="6353acefe";class Rn{#t=null;#e=null;#a;#i=null;#s=!1;#l=!1;#n=null;#f;#o=null;#r=null;static#u=null;static get _keyboardManager(){return be(this,"_keyboardManager",new fn([[["Escape"],Rn.prototype._hideDropdownFromKeyboard],[["Space"],Rn.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight"],Rn.prototype._moveToNext],[["ArrowUp","ArrowLeft"],Rn.prototype._moveToPrevious],[["Home"],Rn.prototype._moveToBeginning],[["End"],Rn.prototype._moveToEnd]]))}constructor({editor:t=null,uiManager:e=null}){if(t)this.#l=!1,this.#n=t;else this.#l=!0;this.#r=t?._uiManager||e,this.#f=this.#r._eventBus,this.#a=t?.color?.toUpperCase()||this.#r?.highlightColors.values().next().value||"#FFFF98",Rn.#u||=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 t=this.#t=document.createElement("button");if(t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",this.#n)t.ariaControls=`${this.#n.id}_colorpicker_dropdown`;let e=this.#r._signal;t.addEventListener("click",this.#b.bind(this),{signal:e}),t.addEventListener("keydown",this.#p.bind(this),{signal:e});let a=this.#e=document.createElement("span");return a.className="swatch",a.ariaHidden="true",a.style.backgroundColor=this.#a,t.append(a),t}renderMainDropdown(){let t=this.#i=this.#c();return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}#c(){let t=document.createElement("div"),e=this.#r._signal;if(t.addEventListener("contextmenu",Nn,{signal:e}),t.className="dropdown",t.role="listbox",t.ariaMultiSelectable="false",t.ariaOrientation="vertical",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),this.#n)t.id=`${this.#n.id}_colorpicker_dropdown`;for(let[a,i]of this.#r.highlightColors){let s=document.createElement("button");s.tabIndex="0",s.role="option",s.setAttribute("data-color",i),s.title=a,s.setAttribute("data-l10n-id",Rn.#u[a]);let n=document.createElement("span");s.append(n),n.className="swatch",n.style.backgroundColor=i,s.ariaSelected=i===this.#a,s.addEventListener("click",this.#g.bind(this,i),{signal:e}),t.append(s)}return t.addEventListener("keydown",this.#p.bind(this),{signal:e}),t}#g(t,e){e.stopPropagation(),this.#f.dispatch("switchannotationeditorparams",{source:this,type:Ce.HIGHLIGHT_COLOR,value:t}),this.updateColor(t)}_colorSelectFromKeyboard(t){if(t.target===this.#t){this.#b(t);return}let e=t.target.getAttribute("data-color");if(!e)return;this.#g(e,t)}_moveToNext(t){if(!this.#m){this.#b(t);return}if(t.target===this.#t){this.#i.firstElementChild?.focus();return}t.target.nextSibling?.focus()}_moveToPrevious(t){if(t.target===this.#i?.firstElementChild||t.target===this.#t){if(this.#m)this._hideDropdownFromKeyboard();return}if(!this.#m)this.#b(t);t.target.previousSibling?.focus()}_moveToBeginning(t){if(!this.#m){this.#b(t);return}this.#i.firstElementChild?.focus()}_moveToEnd(t){if(!this.#m){this.#b(t);return}this.#i.lastElementChild?.focus()}#p(t){Rn._keyboardManager.exec(this,t)}#b(t){if(this.#m){this.hideDropdown();return}if(this.#s=t.detail===0,!this.#o)this.#o=new AbortController,window.addEventListener("pointerdown",this.#h.bind(this),{signal:this.#r.combinedSignal(this.#o)});if(this.#t.ariaExpanded="true",this.#i){this.#i.classList.remove("hidden");return}let e=this.#i=this.#c();this.#t.append(e)}#h(t){if(this.#i?.contains(t.target))return;this.hideDropdown()}hideDropdown(){this.#i?.classList.add("hidden"),this.#t.ariaExpanded="false",this.#o?.abort(),this.#o=null}get#m(){return this.#i&&!this.#i.classList.contains("hidden")}_hideDropdownFromKeyboard(){if(this.#l)return;if(!this.#m){this.#n?.unselect();return}this.hideDropdown(),this.#t.focus({preventScroll:!0,focusVisible:this.#s})}updateColor(t){if(this.#e)this.#e.style.backgroundColor=t;if(!this.#i)return;let e=this.#r.highlightColors.values();for(let a of this.#i.children)a.ariaSelected=e.next().value===t.toUpperCase()}destroy(){this.#t?.remove(),this.#t=null,this.#e=null,this.#i?.remove(),this.#i=null}}class b9{#t=null;#e=!1;#a=null;#i=null;static#s=null;constructor(t){this.#a=t,this.#i=t._uiManager,b9.#s||=Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"})}renderButton(){if(this.#t)return this.#t;let{editorType:t,colorType:e,colorAndOpacityType:a,opacityType:i,color:s,opacity:n}=this.#a,l=this.#e=ha.isAlphaColorInputSupported&&i!==void 0,f=this.#t=document.createElement("input");if(f.type="color",l){f.setAttribute("alpha","");let o=Nt.hexNums[Math.round((n??1)*255)];f.value=(s||"#000000")+o}else f.value=s||"#000000";return f.className="basicColorPicker",f.tabIndex=0,f.setAttribute("data-l10n-id",b9.#s[t]),f.addEventListener("input",()=>{if(l){let o=d9(f.value);if(!o)return;let[c,u,m,p]=o,w=Nt.makeHexColor(c,u,m);if(a!==void 0)this.#i.updateParams(a,{color:w,opacity:p});else this.#i.updateParams(e,w),this.#i.updateParams(i,p)}else this.#i.updateParams(e,f.value)},{signal:this.#i._signal}),f}update(t){if(!this.#t)return;if(this.#e){let e=Nt.hexNums[Math.round(this.#a.opacity*255)];this.#t.value=t+e}else this.#t.value=t}updateOpacity(t){if(!this.#t||!this.#e)return;let e=Nt.hexNums[Math.round(t*255)];this.#t.value=this.#a.color+e}destroy(){this.#t?.remove(),this.#t=null}hideDropdown(){}}function yF(t){return Math.floor(_a(t,0,1)*255).toString(16).padStart(2,"0")}function n9(t){return _a(t,0,1)*255}class Zb{static CMYK_G([t,e,a,i]){return["G",1-Math.min(1,0.3*t+0.59*a+0.11*e+i)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return t=n9(t),[t,t,t]}static G_HTML([t]){let e=yF(t);return`#${e}${e}${e}`}static RGB_G([t,e,a]){return["G",0.3*t+0.59*e+0.11*a]}static RGB_rgb(t){return t.map(n9)}static RGB_HTML(t){return`#${t.map(yF).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,a,i]){return["RGB",1-Math.min(1,t+i),1-Math.min(1,a+i),1-Math.min(1,e+i)]}static CMYK_rgb([t,e,a,i]){return[n9(1-Math.min(1,t+i)),n9(1-Math.min(1,a+i)),n9(1-Math.min(1,e+i))]}static CMYK_HTML(t){let e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,a]){let i=1-t,s=1-e,n=1-a,l=Math.min(i,s,n);return["CMYK",i,s,n,l]}}class DB{create(t,e,a=!1){if(t<=0||e<=0)throw Error("Invalid SVG dimensions");let i=this._createSVG("svg:svg");if(i.setAttribute("version","1.1"),!a)i.setAttribute("width",`${t}px`),i.setAttribute("height",`${e}px`);return i.setAttribute("preserveAspectRatio","none"),i.setAttribute("viewBox",`0 0 ${t} ${e}`),i}createElement(t){if(typeof t!=="string")throw Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){Qe("Abstract method `_createSVG` called.")}}class p9 extends DB{_createSVG(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}}var LV=9,hr=new WeakSet,VV=new Date().getTimezoneOffset()*60*1000;class V3{static create(t){switch(t.data.annotationType){case Ja.LINK:return new w6(t);case Ja.TEXT:return new RB(t);case Ja.WIDGET:switch(t.data.fieldType){case"Tx":return new NB(t);case"Btn":if(t.data.radioButton)return new xB(t);else if(t.data.checkBox)return new EB(t);return new UB(t);case"Ch":return new IB(t);case"Sig":return new zB(t)}return new Rl(t);case Ja.POPUP:return new W3(t);case Ja.FREETEXT:return new mp(t);case Ja.LINE:return new XB(t);case Ja.SQUARE:return new KB(t);case Ja.CIRCLE:return new LB(t);case Ja.POLYLINE:return new gp(t);case Ja.CARET:return new YB(t);case Ja.INK:return new j6(t);case Ja.POLYGON:return new VB(t);case Ja.HIGHLIGHT:return new bp(t);case Ja.UNDERLINE:return new JB(t);case Ja.SQUIGGLY:return new QB(t);case Ja.STRIKEOUT:return new ZB(t);case Ja.STAMP:return new pp(t);case Ja.FILEATTACHMENT:return new $B(t);case Ja.RICHMEDIA:case Ja.SCREEN:return new wp(t);default:return new Ha(t)}}}class Ha{#t=null;#e=!1;#a=null;constructor(t,{isRenderable:e=!1,ignoreBorder:a=!1,createQuadrilaterals:i=!1}={}){if(this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableComment=t.enableComment,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,this.hasOwnCommentButton=!1,e)this.contentElement=this.container=this._createContainer(a);if(i)this._createQuadrilaterals()}static _hasPopupData({contentsObj:t,richText:e}){return!!(t?.str||e?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Ha._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){let{data:t}=this,e=this.annotationStorage?.getEditor(t.id);if(e)return e.getData();return t}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){let t=this.annotationStorage?.getEditor(this.data.id);if(t)return t.commentButtonPositionInPage;let{quadPoints:e,inkLists:a,rect:i}=this.data,s=-1/0,n=-1/0;if(e?.length>=8){for(let l=0;l<e.length;l+=8)if(e[l+1]>n)n=e[l+1],s=e[l+2];else if(e[l+1]===n)s=Math.max(s,e[l+2]);return[s,n]}if(a?.length>=1){for(let l of a)for(let f=0,o=l.length;f<o;f+=2)if(l[f+1]>n)n=l[f+1],s=l[f];else if(l[f+1]===n)s=Math.max(s,l[f]);if(s!==1/0)return[s,n]}if(i)return[i[2],i[3]];return null}_normalizePoint(t){let{page:{view:e},viewport:{rawDims:{pageWidth:a,pageHeight:i,pageX:s,pageY:n}}}=this.parent;return t[1]=e[3]-t[1]+e[1],t[0]=100*(t[0]-s)/a,t[1]=100*(t[1]-n)/i,t}get commentText(){let{data:t}=this;return this.annotationStorage.getRawValue(`pdfjs_internal_editor_${t.id}`)?.popup?.contents||t.contentsObj?.str||""}set commentText(t){let{data:e}=this,a={deleted:!t,contents:t||""};if(!this.annotationStorage.updateEditor(e.id,{popup:a}))this.annotationStorage.setValue(`pdfjs_internal_editor_${e.id}`,{id:e.id,annotationType:e.annotationType,page:this.parent.page,popup:a,popupRef:e.popupRef,modificationDate:new Date});if(!t)this.removePopup()}removePopup(){(this.#a?.popup||this.popup)?.remove(),this.#a=this.popup=null}updateEdited(t){if(!this.container)return;if(t.rect)this.#t||={rect:this.data.rect.slice(0)};let{rect:e,popup:a}=t;if(e)this.#i(e);let i=this.#a?.popup||this.popup;if(!i&&a?.text)this._createPopup(a),i=this.#a.popup;if(!i)return;if(i.updateEdited(t),a?.deleted)i.remove(),this.#a=null,this.popup=null}resetEdited(){if(!this.#t)return;this.#i(this.#t.rect),this.#a?.popup.resetEdited(),this.#t=null}#i(t){let{container:{style:e},data:{rect:a,rotation:i},parent:{viewport:{rawDims:{pageWidth:s,pageHeight:n,pageX:l,pageY:f}}}}=this;if(a?.splice(0,4,...t),e.left=`${100*(t[0]-l)/s}%`,e.top=`${100*(n-t[3]+f)/n}%`,i===0)e.width=`${100*(t[2]-t[0])/s}%`,e.height=`${100*(t[3]-t[1])/n}%`;else this.setRotation(i)}_createContainer(t){let{data:e,parent:{page:a,viewport:i}}=this,s=document.createElement("section");if(s.setAttribute("data-annotation-id",e.id),!(this instanceof Rl)&&!(this instanceof w6)&&!(this instanceof wp))s.tabIndex=0;let{style:n}=s;if(n.zIndex=this.parent.zIndex,this.parent.zIndex+=2,e.alternativeText)s.title=e.alternativeText;if(e.noRotate)s.classList.add("norotate");if(!e.rect||this instanceof W3){let{rotation:d}=e;if(!e.hasOwnCanvas&&d!==0)this.setRotation(d,s);return s}let{width:l,height:f}=this;if(!t&&e.borderStyle.width>0){n.borderWidth=`${e.borderStyle.width}px`;let d=e.borderStyle.horizontalCornerRadius,v=e.borderStyle.verticalCornerRadius;if(d>0||v>0){let y=`calc(${d}px * var(--total-scale-factor)) / calc(${v}px * var(--total-scale-factor))`;n.borderRadius=y}switch(e.borderStyle.style){case yh.SOLID:n.borderStyle="solid";break;case yh.DASHED:n.borderStyle="dashed";break;case yh.BEVELED:de("Unimplemented border style: beveled");break;case yh.INSET:de("Unimplemented border style: inset");break;case yh.UNDERLINE:n.borderBottomStyle="solid";break;default:break}let k=e.borderColor||null;if(k)this.#e=!0,n.borderColor=Nt.makeHexColor(...k);else n.borderWidth=0}let o=Nt.normalizeRect([e.rect[0],a.view[3]-e.rect[1]+a.view[1],e.rect[2],a.view[3]-e.rect[3]+a.view[1]]),{pageWidth:c,pageHeight:u,pageX:m,pageY:p}=i.rawDims;n.left=`${100*(o[0]-m)/c}%`,n.top=`${100*(o[1]-p)/u}%`;let{rotation:w}=e;if(e.hasOwnCanvas||w===0)n.width=`${100*l/c}%`,n.height=`${100*f/u}%`;else this.setRotation(w,s);return s}setRotation(t,e=this.container){if(!this.data.rect)return;let{pageWidth:a,pageHeight:i}=this.parent.viewport.rawDims,{width:s,height:n}=this;if(t%180!==0)[s,n]=[n,s];e.style.width=`${100*s/a}%`,e.style.height=`${100*n/i}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){let t=(e,a,i)=>{let s=i.detail[e],n=s[0],l=s.slice(1);i.target.style[a]=Zb[`${n}_HTML`](l),this.annotationStorage.setValue(this.data.id,{[a]:Zb[`${n}_rgb`](l)})};return be(this,"_commonActions",{display:(e)=>{let{display:a}=e.detail,i=a%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:a===1||a===2})},print:(e)=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:(e)=>{let{hidden:a}=e.detail;this.container.style.visibility=a?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:a,noView:a})},focus:(e)=>{setTimeout(()=>e.target.focus({preventScroll:!1}),0)},userName:(e)=>{e.target.title=e.detail.userName},readonly:(e)=>{e.target.disabled=e.detail.readonly},required:(e)=>{this._setRequired(e.target,e.detail.required)},bgColor:(e)=>{t("bgColor","backgroundColor",e)},fillColor:(e)=>{t("fillColor","backgroundColor",e)},fgColor:(e)=>{t("fgColor","color",e)},textColor:(e)=>{t("textColor","color",e)},borderColor:(e)=>{t("borderColor","borderColor",e)},strokeColor:(e)=>{t("strokeColor","borderColor",e)},rotation:(e)=>{let a=e.detail.rotation;this.setRotation(a),this.annotationStorage.setValue(this.data.id,{rotation:a})}})}_dispatchEventFromSandbox(t,e){let a=this._commonActions;for(let i of Object.keys(e.detail))(t[i]||a[i])?.(e)}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;let e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;let a=this._commonActions;for(let[i,s]of Object.entries(e)){let n=a[i];if(n){let l={detail:{[i]:s},target:t};n(l),delete e[i]}}}_createQuadrilaterals(){if(!this.container)return;let{quadPoints:t}=this.data;if(!t)return;let[e,a,i,s]=this.data.rect.map((d)=>Math.fround(d));if(t.length===8){let[d,v,k,y]=t.subarray(2,6);if(i===d&&s===v&&e===k&&a===y)return}let{style:n}=this.container,l;if(this.#e){let{borderColor:d,borderWidth:v}=n;n.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="${d}" stroke-width="${v}">`],this.container.classList.add("hasBorder")}let f=i-e,o=s-a,{svgFactory:c}=this,u=c.createElement("svg");u.classList.add("quadrilateralsContainer"),u.setAttribute("width",0),u.setAttribute("height",0),u.role="none";let m=c.createElement("defs");u.append(m);let p=c.createElement("clipPath"),w=`clippath_${this.data.id}`;p.setAttribute("id",w),p.setAttribute("clipPathUnits","objectBoundingBox"),m.append(p);for(let d=2,v=t.length;d<v;d+=8){let k=t[d],y=t[d+1],B=t[d+2],H=t[d+3],M=c.createElement("rect"),D=(B-e)/f,T=(s-y)/o,z=(k-B)/f,E=(y-H)/o;M.setAttribute("x",D),M.setAttribute("y",T),M.setAttribute("width",z),M.setAttribute("height",E),p.append(M),l?.push(`<rect vector-effect="non-scaling-stroke" x="${D}" y="${T}" width="${z}" height="${E}"/>`)}if(this.#e)l.push("</g></svg>')"),n.backgroundImage=l.join("");this.container.append(u),this.container.style.clipPath=`url(#${w})`}_createPopup(t=null){let{data:e}=this,a,i;if(t)a={str:t.text},i=t.date;else a=e.contentsObj,i=e.modificationDate;this.#a=new W3({data:{color:e.color,titleObj:e.titleObj,modificationDate:i,contentsObj:a,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]})}get hasPopupElement(){return!!(this.#a||this.popup||this.data.popupRef)}get extraPopupElement(){return this.#a}render(){Qe("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){let a=[];if(this._fieldObjects){let i=this._fieldObjects[t];if(i)for(let{page:s,id:n,exportValues:l}of i){if(s===-1)continue;if(n===e)continue;let f=typeof l==="string"?l:null,o=document.querySelector(`[data-element-id="${n}"]`);if(o&&!hr.has(o)){de(`_getElementsByName - element not allowed: ${n}`);continue}a.push({id:n,exportValue:f,domElement:o})}return a}for(let i of document.getElementsByName(t)){let{exportValue:s}=i,n=i.getAttribute("data-element-id");if(n===e)continue;if(!hr.has(i))continue;a.push({id:n,exportValue:s,domElement:i})}return a}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 t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(let e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e,mustEnterInEditMode:!0})})}updateOC(t){if(!this.data.oc||!t)return;if(t.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(t){let e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":Nt.makeHexColor(...e)}}class TB extends Ha{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});this.editor=t.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){let{editor:t}=this;if(!t.hasComment)return;this._createPopup(t.comment)}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(t){if(this.editor.comment=t,!t)this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.parent.removeAnnotation(this.data.id),this.container.remove(),this.container=null,this.removePopup()}}class w6 extends Ha{constructor(t,e=null){super(t,{isRenderable:!0,ignoreBorder:!!e?.ignoreBorder,createQuadrilaterals:!0});this.isTooltipOnly=t.data.isTooltipOnly}render(){let{data:t,linkService:e}=this,a=document.createElement("a");a.setAttribute("data-element-id",t.id);let i=!1;if(t.url)e.addLinkAttributes(a,t.url,t.newWindow),i=!0;else if(t.action)this._bindNamedAction(a,t.action,t.overlaidText),i=!0;else if(t.attachment)this.#e(a,t.attachmentId,t.attachment,t.overlaidText,t.attachmentDest),i=!0;else if(t.setOCGState)this.#a(a,t.setOCGState,t.overlaidText),i=!0;else if(t.dest)this._bindLink(a,t.dest,t.overlaidText),i=!0;else{if(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions)this._bindJSAction(a,t),i=!0;if(t.resetForm)this._bindResetFormAction(a,t.resetForm),i=!0;else if(this.isTooltipOnly&&!i)this._bindLink(a,""),i=!0}if(this.container.classList.add("linkAnnotation"),i)this.contentElement=a,this.container.append(a);return this.container}#t(){this.container.setAttribute("data-internal-link","")}_bindLink(t,e,a=""){if(t.href=this.linkService.getDestinationHash(e),t.onclick=()=>{if(e)this.linkService.goToDestination(e);return!1},e||e==="")this.#t();if(a)t.title=a}_bindNamedAction(t,e,a=""){if(t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>{return this.linkService.executeNamedAction(e),!1},a)t.title=a;this.#t()}#e(t,e,a,i="",s=null){if(t.href=this.linkService.getAnchorUrl(""),a.description)t.title=a.description;else if(i)t.title=i;let n=async()=>{let l=await this.linkService.getAttachmentContent(e);if(l)this.downloadManager?.openOrDownloadData(l,a.filename,s)};t.onclick=()=>{return n(),!1},this.#t()}#a(t,e,a=""){if(t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>{return this.linkService.executeSetOCGState(e),!1},a)t.title=a;this.#t()}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");let a=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let i of Object.keys(e.actions)){let s=a.get(i);if(!s)continue;t[s]=()=>{return this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:i}}),!1}}if(e.overlaidText)t.title=e.overlaidText;if(!t.onclick)t.onclick=()=>!1;this.#t()}_bindResetFormAction(t,e){let a=t.onclick;if(!a)t.href=this.linkService.getAnchorUrl("");if(this.#t(),!this._fieldObjects){if(de('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),!a)t.onclick=()=>!1;return}t.onclick=()=>{a?.();let{fields:i,refs:s,include:n}=e,l=[];if(i.length!==0||s.length!==0){let c=new Set(s);for(let u of i){let m=this._fieldObjects[u]||[];for(let{id:p}of m)c.add(p)}for(let u of Object.values(this._fieldObjects))for(let m of u)if(c.has(m.id)===n)l.push(m)}else for(let c of Object.values(this._fieldObjects))l.push(...c);let f=this.annotationStorage,o=[];for(let c of l){let{id:u}=c;switch(o.push(u),c.type){case"text":{let p=c.defaultValue||"";f.setValue(u,{value:p});break}case"checkbox":case"radiobutton":{let p=c.defaultValue===c.exportValues;f.setValue(u,{value:p});break}case"combobox":case"listbox":{let p=c.defaultValue||"";f.setValue(u,{value:p});break}default:continue}let m=document.querySelector(`[data-element-id="${u}"]`);if(!m)continue;else if(!hr.has(m)){de(`_bindResetFormAction - element not allowed: ${u}`);continue}m.dispatchEvent(new Event("resetform"))}if(this.enableScripting)this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:o,name:"ResetForm"}});return!1}}}class RB extends Ha{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");let t=document.createElement("img");if(t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this.container.append(t),this.container}}class Rl extends Ha{render(){return this.container}_getKeyModifier(t){return ha.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,a,i,s){if(a.includes("mouse"))t.addEventListener(a,(n)=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:s(n),shift:n.shiftKey,modifier:this._getKeyModifier(n)}})});else t.addEventListener(a,(n)=>{if(a==="blur"){if(!e.focused||!n.relatedTarget)return;e.focused=!1}else if(a==="focus"){if(e.focused)return;e.focused=!0}if(!s)return;this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:s(n)}})})}_setEventListeners(t,e,a,i){for(let[s,n]of a)if(n==="Action"||this.data.actions?.[n]){if(n==="Focus"||n==="Blur")e||={focused:!1};if(this._setEventListener(t,e,s,n,i),n==="Focus"&&!this.data.actions?.Blur)this._setEventListener(t,e,"blur","Blur",null);else if(n==="Blur"&&!this.data.actions?.Focus)this._setEventListener(t,e,"focus","Focus",null)}}_setTextStyle(t){let e=["left","center","right"],{fontColor:a}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||LV,s=t.style,n,l=2,f=(o)=>Math.round(10*o)/10;if(this.data.multiLine){let o=Math.abs(this.data.rect[3]-this.data.rect[1]-2),c=Math.round(o/(1.35*i))||1,u=o/c;n=Math.min(i,f(u/1.35))}else{let o=Math.abs(this.data.rect[3]-this.data.rect[1]-2);n=Math.min(i,f(o/1.35))}if(s.fontSize=`calc(${n}px * var(--total-scale-factor))`,s.color=Nt.makeHexColor(...a),this.data.textAlignment!==null&&!this.data.comb)s.textAlign=e[this.data.textAlignment]}_setRequired(t,e){if(e)t.setAttribute("required",!0);else t.removeAttribute("required");t.setAttribute("aria-required",e)}}class NB extends Rl{constructor(t){let e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,a,i){let s=this.annotationStorage;for(let n of this._getElementsByName(t.name,t.id)){if(n.domElement)n.domElement[e]=a;s.setValue(n.id,{[i]:a})}}render(){let t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let a=null;if(this.renderForms){let i=t.getValue(e,{value:this.data.fieldValue}),s=i.value||"",n=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;if(n&&s.length>n)s=s.slice(0,n);let l=i.formattedValue||this.data.textContent?.join(`
310
- `)||null;if(l&&this.data.comb)l=l.replaceAll(/\s+/g,"");let f={userValue:s,formattedValue:l,lastCommittedValue:null,commitKey:1,focused:!1};if(this.data.multiLine){if(a=document.createElement("textarea"),a.textContent=l??s,this.data.doNotScroll)a.style.overflowY="hidden"}else if(a=document.createElement("input"),a.type=this.data.password?"password":"text",a.setAttribute("value",l??s),this.data.doNotScroll)a.style.overflowX="hidden";if(this.data.hasOwnCanvas){if(this.container.classList.add("hasOwnCanvas"),t.has(e))this.container.classList.add("sandboxModified")}hr.add(a),this.contentElement=a,a.setAttribute("data-element-id",e),a.disabled=this.data.readOnly,a.name=this.data.fieldName,a.tabIndex=0;let{datetimeFormat:o,datetimeType:c,timeStep:u}=this.data,m=!!c&&this.enableScripting;if(o)a.title=o;if(this._setRequired(a,this.data.required),n)a.maxLength=n;a.addEventListener("input",(w)=>{t.setValue(e,{value:w.target.value}),this.setPropertyOnSiblings(a,"value",w.target.value,"value"),f.formattedValue=null}),a.addEventListener("resetform",(w)=>{let d=this.data.defaultFieldValue??"";a.value=f.userValue=d,f.formattedValue=null});let p=(w)=>{let{formattedValue:d}=f;if(d!==null&&d!==void 0)w.target.value=d;w.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){a.addEventListener("focus",(d)=>{if(f.focused)return;let{target:v}=d;if(m){if(v.type=c,u)v.step=u}if(f.userValue){let k=f.userValue;if(m)if(c==="time"){let y=new Date(k),B=[y.getHours(),y.getMinutes(),y.getSeconds()];v.value=B.map((H)=>H.toString().padStart(2,"0")).join(":")}else v.value=new Date(k-VV).toISOString().split(c==="date"?"T":".",1)[0];else v.value=k}if(f.lastCommittedValue=v.value,f.commitKey=1,!this.data.actions?.Focus)f.focused=!0}),a.addEventListener("updatefromsandbox",(d)=>{this.container.classList.add("sandboxModified");let v={value(k){if(f.userValue=k.detail.value??"",!m)t.setValue(e,{value:f.userValue.toString()});k.target.value=f.userValue},formattedValue(k){let{formattedValue:y}=k.detail;if(f.formattedValue=y,y!==null&&y!==void 0&&k.target!==document.activeElement)k.target.value=y;let B={formattedValue:y};if(m)B.value=y;t.setValue(e,B)},selRange(k){k.target.setSelectionRange(...k.detail.selRange)},charLimit:(k)=>{let{charLimit:y}=k.detail,{target:B}=k;if(y===0){B.removeAttribute("maxLength");return}B.setAttribute("maxLength",y);let H=f.userValue;if(!H||H.length<=y)return;H=H.slice(0,y),B.value=f.userValue=H,t.setValue(e,{value:H}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:H,willCommit:!0,commitKey:1,selStart:B.selectionStart,selEnd:B.selectionEnd}})}};this._dispatchEventFromSandbox(v,d)}),a.addEventListener("keydown",(d)=>{f.commitKey=1;let v=-1;if(d.key==="Escape")v=0;else if(d.key==="Enter"&&!this.data.multiLine)v=2;else if(d.key==="Tab")f.commitKey=3;if(v===-1)return;let{value:k}=d.target;if(f.lastCommittedValue===k)return;f.lastCommittedValue=k,f.userValue=k,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:k,willCommit:!0,commitKey:v,selStart:d.target.selectionStart,selEnd:d.target.selectionEnd}})});let w=p;if(p=null,a.addEventListener("blur",(d)=>{if(!f.focused||!d.relatedTarget)return;if(!this.data.actions?.Blur)f.focused=!1;let{target:v}=d,{value:k}=v;if(m){if(k&&c==="time"){let y=k.split(":").map((B)=>parseInt(B,10));k=new Date(2000,0,1,y[0],y[1],y[2]||0).valueOf(),v.step=""}else{if(!k.includes("T"))k=`${k}T00:00`;k=new Date(k).valueOf()}v.type="text"}if(f.userValue=k,f.lastCommittedValue!==k)this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:k,willCommit:!0,commitKey:f.commitKey,selStart:d.target.selectionStart,selEnd:d.target.selectionEnd}});w(d)}),this.data.actions?.Keystroke)a.addEventListener("beforeinput",(d)=>{f.lastCommittedValue=null;let{data:v,target:k}=d,{value:y,selectionStart:B,selectionEnd:H}=k,M=B,D=H;switch(d.inputType){case"deleteWordBackward":{let T=y.substring(0,B).match(/\w*\W*$/);if(T)M-=T[0].length;break}case"deleteWordForward":{let T=y.substring(B).match(/^\W*\w*/);if(T)D+=T[0].length;break}case"deleteContentBackward":if(B===H)M-=1;break;case"deleteContentForward":if(B===H)D+=1;break}d.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:y,change:v||"",willCommit:!1,selStart:M,selEnd:D}})});this._setEventListeners(a,f,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(d)=>d.target.value)}if(p)a.addEventListener("blur",p);if(this.data.comb){let d=(this.data.rect[2]-this.data.rect[0])/n;a.classList.add("comb"),a.style.setProperty("--comb-width",`calc(${d}px * var(--total-scale-factor))`);let v=this.data.textAlignment;if(v===1||v===2){let k=()=>{let y=n-a.value.length;a.style.setProperty("--comb-offset",`${v===1?y>>1:y}`)};k();for(let y of["input","blur","resetform","updatefromsandbox"])a.addEventListener(y,k)}}}else if(a=document.createElement("div"),a.textContent=this.data.fieldValue,a.style.verticalAlign="middle",a.style.display="table-cell",this.data.hasOwnCanvas)a.hidden=!0;return this._setTextStyle(a),this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class zB extends Rl{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class EB extends Rl{constructor(t){super(t,{isRenderable:t.renderForms})}render(){let t=this.annotationStorage,e=this.data,a=e.id,i=t.getValue(a,{value:e.exportValue===e.fieldValue}).value;if(typeof i==="string")i=i!=="Off",t.setValue(a,{value:i});this.container.classList.add("buttonWidgetAnnotation","checkBox");let s=document.createElement("input");if(hr.add(s),s.setAttribute("data-element-id",a),s.disabled=e.readOnly,this._setRequired(s,this.data.required),s.type="checkbox",s.name=e.fieldName,i)s.setAttribute("checked",!0);if(s.setAttribute("exportValue",e.exportValue),s.tabIndex=0,s.addEventListener("change",(n)=>{let{name:l,checked:f}=n.target;for(let o of this._getElementsByName(l,a)){let c=f&&o.exportValue===e.exportValue;if(o.domElement)o.domElement.checked=c;t.setValue(o.id,{value:c})}t.setValue(a,{value:f})}),s.addEventListener("resetform",(n)=>{let l=e.defaultFieldValue||"Off";n.target.checked=l===e.exportValue}),this.enableScripting&&this.hasJSActions)s.addEventListener("updatefromsandbox",(n)=>{let l={value(f){f.target.checked=f.detail.value!=="Off",t.setValue(a,{value:f.target.checked})}};this._dispatchEventFromSandbox(l,n)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(n)=>n.target.checked);return this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class xB extends Rl{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let t=this.annotationStorage,e=this.data,a=e.id,i=t.getValue(a,{value:e.buttonValue!==null&&e.fieldValue===e.buttonValue}).value;if(typeof i==="string")i=i!==e.buttonValue,t.setValue(a,{value:i});if(i)for(let n of this._getElementsByName(e.fieldName,a))t.setValue(n.id,{value:!1});let s=document.createElement("input");if(hr.add(s),s.setAttribute("data-element-id",a),s.disabled=e.readOnly,this._setRequired(s,this.data.required),s.type="radio",s.name=e.fieldName,i)s.setAttribute("checked",!0);if(s.tabIndex=0,s.addEventListener("change",(n)=>{let{name:l,checked:f}=n.target;for(let o of this._getElementsByName(l,a))t.setValue(o.id,{value:!1});t.setValue(a,{value:f})}),s.addEventListener("resetform",(n)=>{let l=e.defaultFieldValue;n.target.checked=l!==null&&l!==void 0&&l===e.buttonValue}),this.enableScripting&&this.hasJSActions){let n=e.buttonValue;s.addEventListener("updatefromsandbox",(l)=>{let f={value:(o)=>{let c=n===o.detail.value;for(let u of this._getElementsByName(o.target.name)){let m=c&&u.id===a;if(u.domElement)u.domElement.checked=m;t.setValue(u.id,{value:m})}}};this._dispatchEventFromSandbox(f,l)}),this._setEventListeners(s,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(s),this.container.append(s),this.container}}class UB extends w6{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){let t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");let e=t.lastChild;if(this.enableScripting&&this.hasJSActions&&e)this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",(a)=>{this._dispatchEventFromSandbox({},a)});return t}}class IB extends Rl{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");let t=this.annotationStorage,e=this.data.id,a=t.getValue(e,{value:this.data.fieldValue}),i=document.createElement("select");hr.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,this._setRequired(i,this.data.required),i.name=this.data.fieldName,i.tabIndex=0;let s=this.data.combo&&this.data.options.length>0;if(!this.data.combo){if(i.size=this.data.options.length,this.data.multiSelect)i.multiple=!0}i.addEventListener("resetform",(u)=>{let m=this.data.defaultFieldValue;for(let p of i.options)p.selected=p.value===m});let n=(u,m)=>{let p=m.replaceAll(" "," ");if(u.textContent=p,p!==m)u.setAttribute("display-value",m)};for(let u of this.data.options){let m=document.createElement("option");if(n(m,u.displayValue),m.value=u.exportValue,a.value.includes(u.exportValue))m.setAttribute("selected",!0),s=!1;i.append(m)}let l=null;if(s){let u=document.createElement("option");u.value=" ",u.setAttribute("hidden",!0),u.setAttribute("selected",!0),i.prepend(u),l=()=>{u.remove(),i.removeEventListener("input",l),l=null},i.addEventListener("input",l)}let f=(u)=>{let m=u?"value":"textContent",{options:p,multiple:w}=i;if(!w)return p.selectedIndex===-1?null:p[p.selectedIndex][m];return Array.prototype.filter.call(p,(d)=>d.selected).map((d)=>d[m])},o=f(!1),c=(u)=>{let m=u.target.options;return Array.prototype.map.call(m,(p)=>({displayValue:p.getAttribute("display-value")||p.textContent,exportValue:p.value}))};if(this.enableScripting&&this.hasJSActions)i.addEventListener("updatefromsandbox",(u)=>{let m={value(p){l?.();let w=p.detail.value,d=new Set(Array.isArray(w)?w:[w]);for(let v of i.options)v.selected=d.has(v.value);t.setValue(e,{value:f(!0)}),o=f(!1)},multipleSelection(p){i.multiple=!0},remove(p){let w=i.options,d=p.detail.remove;if(w[d].selected=!1,i.remove(d),w.length>0){if(Array.prototype.findIndex.call(w,(k)=>k.selected)===-1)w[0].selected=!0}t.setValue(e,{value:f(!0),items:c(p)}),o=f(!1)},clear(p){while(i.length!==0)i.remove(0);t.setValue(e,{value:null,items:[]}),o=f(!1)},insert(p){let{index:w,displayValue:d,exportValue:v}=p.detail.insert,k=i.children[w],y=document.createElement("option");if(n(y,d),y.value=v,k)k.before(y);else i.append(y);t.setValue(e,{value:f(!0),items:c(p)}),o=f(!1)},items(p){let{items:w}=p.detail;while(i.length!==0)i.remove(0);for(let d of w){let{displayValue:v,exportValue:k}=d,y=document.createElement("option");n(y,v),y.value=k,i.append(y)}if(i.options.length>0)i.options[0].selected=!0;t.setValue(e,{value:f(!0),items:c(p)}),o=f(!1)},indices(p){let w=new Set(p.detail.indices);for(let d of p.target.options)d.selected=w.has(d.index);t.setValue(e,{value:f(!0)}),o=f(!1)},editable(p){p.target.disabled=!p.detail.editable}};this._dispatchEventFromSandbox(m,u)}),i.addEventListener("input",(u)=>{let m=f(!0),p=f(!1);t.setValue(e,{value:m}),u.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:o,change:p,changeEx:m,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(i,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(u)=>u.target.value);else i.addEventListener("input",function(u){t.setValue(e,{value:f(!0)})});if(this.data.combo)this._setTextStyle(i);return this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class W3 extends Ha{constructor(t){let{data:e,elements:a,parent:i}=t,s=!!i._commentManager;super(t,{isRenderable:!s&&Ha._hasPopupData(e)});if(this.elements=a,s&&Ha._hasPopupData(e)){let n=this.popup=this.#t();for(let l of a)l.popup=n}else this.popup=null}#t(){return new GB({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:t}=this;t.classList.add("popupAnnotation"),t.role="comment";let e=this.popup=this.#t(),a=[];for(let i of this.elements)i.popup=e,i.container.ariaHasPopup="dialog",a.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",a.map((i)=>`pdfjs_internal_id_${i}`).join(",")),this.container}}class GB{#t=null;#e=this.#x.bind(this);#a=this.#N.bind(this);#i=this.#A.bind(this);#s=this.#C.bind(this);#l=null;#n=null;#f=null;#o=null;#r=null;#u=null;#c=null;#g=!1;#p=null;#b=null;#h=null;#m=null;#j=null;#d=null;#w=null;#S=null;#y=null;#q=null;#k=!1;#v=null;#_=null;constructor({container:t,color:e,elements:a,titleObj:i,modificationDate:s,contentsObj:n,richText:l,parent:f,rect:o,parentRect:c,open:u,commentManager:m=null}){if(this.#n=t,this.#y=i,this.#f=n,this.#S=l,this.#u=f,this.#l=e,this.#w=o,this.#c=c,this.#r=a,this.#t=m,this.#v=a[0],this.#o=Q3.toDateObject(s),this.trigger=a.flatMap((p)=>p.getElementsToTriggerPopup()),!m){if(this.#B(),this.#n.hidden=!0,u)this.#C()}}#B(){if(this.#b)return;this.#b=new AbortController;let{signal:t}=this.#b;for(let e of this.trigger)e.addEventListener("click",this.#s,{signal:t}),e.addEventListener("pointerenter",this.#i,{signal:t}),e.addEventListener("pointerleave",this.#a,{signal:t}),e.classList.add("popupTriggerArea");for(let e of this.#r)e.container?.addEventListener("keydown",this.#e,{signal:t})}#O(){let t=this.#r.find((e)=>e.hasCommentButton);if(!t)return;this.#j=t._normalizePoint(t.commentButtonPosition)}renderCommentButton(){if(this.#m){if(!this.#m.parentNode)this.#v.container.after(this.#m);return}if(!this.#j)this.#O();if(!this.#j)return;let{signal:t}=this.#b=new AbortController,e=this.#v.hasOwnCommentButton,a=()=>{this.#t.toggleCommentPopup(this,!0,void 0,!e)},i=()=>{this.#t.toggleCommentPopup(this,!1,!0,!e)},s=()=>{this.#t.toggleCommentPopup(this,!1,!1)};if(!e){let n=this.#m=document.createElement("button");n.className="annotationCommentButton";let l=this.#v.container;n.style.zIndex=parseInt(l.style.zIndex,10)+1,n.tabIndex=0,n.ariaHasPopup="dialog",n.ariaControls="commentPopup",n.setAttribute("data-l10n-id","pdfjs-show-comment-button"),this.#D(),this.#F(),n.addEventListener("keydown",this.#e,{signal:t}),n.addEventListener("click",a,{signal:t}),n.addEventListener("pointerenter",i,{signal:t}),n.addEventListener("pointerleave",s,{signal:t}),l.after(n)}else{this.#m=this.#v.container;for(let n of this.trigger)n.ariaHasPopup="dialog",n.ariaControls="commentPopup",n.addEventListener("keydown",this.#e,{signal:t}),n.addEventListener("click",a,{signal:t}),n.addEventListener("pointerenter",i,{signal:t}),n.addEventListener("pointerleave",s,{signal:t}),n.classList.add("popupTriggerArea")}}#F(){if(this.#v.extraPopupElement&&!this.#v.editor)return;if(!this.#m)this.renderCommentButton();let[t,e]=this.#j,{style:a}=this.#m;a.left=`calc(${t}%)`,a.top=`calc(${e}% - var(--comment-button-dim))`}#D(){if(this.#v.extraPopupElement)return;if(!this.#m)this.renderCommentButton();this.#m.style.backgroundColor=this.commentButtonColor||""}get commentButtonColor(){let{color:t,opacity:e}=this.#v.commentData;if(!t)return null;return this.#u._commentManager.makeCommentColor(t,e)}focusCommentButton(){setTimeout(()=>{this.#m?.focus()},0)}getData(){let{richText:t,color:e,opacity:a,creationDate:i,modificationDate:s}=this.#v.commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:a,creationDate:i,modificationDate:s}}get elementBeforePopup(){return this.#m}get comment(){return this.#_||=this.#v.commentText,this.#_}set comment(t){if(t===this.comment)return;this.#v.commentText=this.#_=t}focus(){this.#v.container?.focus()}get parentBoundingClientRect(){return this.#v.layer.getBoundingClientRect()}setCommentButtonStates({selected:t,hasPopup:e}){if(!this.#m)return;this.#m.classList.toggle("selected",t),this.#m.ariaExpanded=e}setSelectedCommentButton(t){this.#m.classList.toggle("selected",t)}get commentPopupPosition(){if(this.#d)return this.#d;let{x:t,y:e,height:a}=this.#m.getBoundingClientRect(),{x:i,y:s,width:n,height:l}=this.#v.layer.getBoundingClientRect();return[(t-i)/n,(e+a-s)/l]}set commentPopupPosition(t){this.#d=t}hasDefaultPopupPosition(){return this.#d===null}get commentButtonPosition(){return this.#j}get commentButtonWidth(){return this.#m.getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){let[e,a]=this.#d||this.commentButtonPosition.map((o)=>o/100),i=this.parentBoundingClientRect,{x:s,y:n,width:l,height:f}=i;this.#t.showDialog(null,this,s+e*l,n+a*f,{...t,parentDimensions:i})}render(){if(this.#p)return;let t=this.#p=document.createElement("div");if(t.className="popup",this.#l){let a=t.style.outlineColor=Nt.makeHexColor(...this.#l);t.style.backgroundColor=`color-mix(in srgb, ${a} 30%, white)`}let e=document.createElement("span");if(e.className="header",this.#y?.str){let a=document.createElement("span");a.className="title",e.append(a),{dir:a.dir,str:a.textContent}=this.#y}if(t.append(e),this.#o){let a=document.createElement("time");a.className="popupDate",a.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),a.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#o.valueOf()})),a.dateTime=this.#o.toISOString(),e.append(a)}MF({html:this.#T||this.#f.str,dir:this.#f?.dir,className:"popupContent"},t),this.#n.append(t)}get#T(){let t=this.#S,e=this.#f;if(t?.str&&(!e?.str||e.str===t.str))return this.#S.html||null;return null}get#M(){return this.#T?.attributes?.style?.fontSize||0}get#R(){return this.#T?.attributes?.style?.color||null}#z(t){let e=[],a={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},i={style:{color:this.#R,fontSize:this.#M?`calc(${this.#M}px * var(--total-scale-factor))`:""}};for(let s of t.split(`
311
- `))e.push({name:"span",value:s,attributes:i});return a}#x(t){if(t.altKey||t.shiftKey||t.ctrlKey||t.metaKey)return;if(t.key==="Enter"||t.key==="Escape"&&this.#g)this.#C()}updateEdited({rect:t,popup:e,deleted:a}){if(this.#t){if(a)this.remove(),this.#_=null;else if(e)if(e.deleted)this.remove();else this.#D(),this.#_=e.text;if(t)this.#j=null,this.#O(),this.#F();return}if(a||e?.deleted){this.remove();return}if(this.#B(),this.#q||={contentsObj:this.#f,richText:this.#S},t)this.#h=null;if(e&&e.text)this.#S=this.#z(e.text),this.#o=Q3.toDateObject(e.date),this.#f=null;this.#p?.remove(),this.#p=null}resetEdited(){if(!this.#q)return;({contentsObj:this.#f,richText:this.#S}=this.#q),this.#q=null,this.#p?.remove(),this.#p=null,this.#h=null}remove(){if(this.#b?.abort(),this.#b=null,this.#p?.remove(),this.#p=null,this.#k=!1,this.#g=!1,this.#m?.remove(),this.#m=null,this.trigger)for(let t of this.trigger)t.classList.remove("popupTriggerArea")}#L(){if(this.#h!==null)return;let{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:a,pageX:i,pageY:s}}}=this.#u,n=!!this.#c,l=n?this.#c:this.#w;for(let w of this.#r)if(!l||Nt.intersect(w.data.rect,l)!==null){l=w.data.rect,n=!0;break}let f=Nt.normalizeRect([l[0],t[3]-l[1]+t[1],l[2],t[3]-l[3]+t[1]]),o=5,c=n?l[2]-l[0]+o:0,u=f[0]+c,m=f[1];this.#h=[100*(u-i)/e,100*(m-s)/a];let{style:p}=this.#n;p.left=`${this.#h[0]}%`,p.top=`${this.#h[1]}%`}#C(){if(this.#t){this.#t.toggleCommentPopup(this,!1);return}if(this.#g=!this.#g,this.#g)this.#A(),this.#n.addEventListener("click",this.#s),this.#n.addEventListener("keydown",this.#e);else this.#N(),this.#n.removeEventListener("click",this.#s),this.#n.removeEventListener("keydown",this.#e)}#A(){if(!this.#p)this.render();if(!this.isVisible)this.#L(),this.#n.hidden=!1,this.#n.style.zIndex=parseInt(this.#n.style.zIndex,10)+1000;else if(this.#g)this.#n.classList.add("focused")}#N(){if(this.#n.classList.remove("focused"),this.#g||!this.isVisible)return;this.#n.hidden=!0,this.#n.style.zIndex=parseInt(this.#n.style.zIndex,10)-1000}forceHide(){if(this.#k=this.isVisible,!this.#k)return;this.#n.hidden=!0}maybeShow(){if(this.#t)return;if(this.#B(),!this.#k)return;if(!this.#p)this.#A();this.#k=!1,this.#n.hidden=!1}get isVisible(){if(this.#t)return!1;return this.#n.hidden===!1}}class mp extends Ha{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=je.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let t=this.contentElement=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(let e of this.textContent){let a=document.createElement("span");a.textContent=e,t.append(a)}this.container.append(t)}if(!this.data.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this._editOnDoubleClick(),this.container}}class XB extends Ha{#t=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");let{data:t,width:e,height:a}=this,i=this.svgFactory.create(e,a,!0),s=this.#t=this.svgFactory.createElement("svg:line");if(s.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),s.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),s.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),s.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),s.setAttribute("stroke-width",t.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),i.append(s),this.container.append(i),!t.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class KB extends Ha{#t=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");let{data:t,width:e,height:a}=this,i=this.svgFactory.create(e,a,!0),s=t.borderStyle.width,n=this.#t=this.svgFactory.createElement("svg:rect");if(n.setAttribute("x",s/2),n.setAttribute("y",s/2),n.setAttribute("width",e-s),n.setAttribute("height",a-s),n.setAttribute("stroke-width",s||1),n.setAttribute("stroke","transparent"),n.setAttribute("fill","transparent"),i.append(n),this.container.append(i),!t.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class LB extends Ha{#t=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");let{data:t,width:e,height:a}=this,i=this.svgFactory.create(e,a,!0),s=t.borderStyle.width,n=this.#t=this.svgFactory.createElement("svg:ellipse");if(n.setAttribute("cx",e/2),n.setAttribute("cy",a/2),n.setAttribute("rx",e/2-s/2),n.setAttribute("ry",a/2-s/2),n.setAttribute("stroke-width",s||1),n.setAttribute("stroke","transparent"),n.setAttribute("fill","transparent"),i.append(n),this.container.append(i),!t.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class gp extends Ha{#t=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);let{data:{rect:t,vertices:e,borderStyle:a,popupRef:i},width:s,height:n}=this;if(!e)return this.container;let l=this.svgFactory.create(s,n,!0),f=[];for(let c=0,u=e.length;c<u;c+=2){let m=e[c]-t[0],p=t[3]-e[c+1];f.push(`${m},${p}`)}f=f.join(" ");let o=this.#t=this.svgFactory.createElement(this.svgElementName);if(o.setAttribute("points",f),o.setAttribute("stroke-width",a.width||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),l.append(o),this.container.append(l),!i&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class VB extends gp{constructor(t){super(t);this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class YB extends Ha{constructor(t){super(t,{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 j6 extends Ha{#t=null;#e=[];constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?je.HIGHLIGHT:je.INK}#a(t,e){switch(t){case 90:return{transform:`rotate(90) translate(${-e[0]},${e[1]}) scale(1,-1)`,width:e[3]-e[1],height:e[2]-e[0]};case 180:return{transform:`rotate(180) translate(${-e[2]},${e[1]}) scale(1,-1)`,width:e[2]-e[0],height:e[3]-e[1]};case 270:return{transform:`rotate(270) translate(${-e[2]},${e[3]}) scale(1,-1)`,width:e[3]-e[1],height:e[2]-e[0]};default:return{transform:`translate(${-e[0]},${e[3]}) scale(1,-1)`,width:e[2]-e[0],height:e[3]-e[1]}}}render(){this.container.classList.add(this.containerClassName);let{data:{rect:t,rotation:e,inkLists:a,borderStyle:i,popupRef:s}}=this,{transform:n,width:l,height:f}=this.#a(e,t),o=this.svgFactory.create(l,f,!0),c=this.#t=this.svgFactory.createElement("svg:g");o.append(c),c.setAttribute("stroke-width",i.width||1),c.setAttribute("stroke-linecap","round"),c.setAttribute("stroke-linejoin","round"),c.setAttribute("stroke-miterlimit",10),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),c.setAttribute("transform",n);for(let u=0,m=a.length;u<m;u++){let p=this.svgFactory.createElement(this.svgElementName);this.#e.push(p),p.setAttribute("points",a[u].join(",")),c.append(p)}if(!s&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this.container.append(o),this._editOnDoubleClick(),this.container}updateEdited(t){super.updateEdited(t);let{thickness:e,points:a,rect:i}=t,s=this.#t;if(e>=0)s.setAttribute("stroke-width",e||1);if(a)for(let n=0,l=this.#e.length;n<l;n++)this.#e[n].setAttribute("points",a[n].join(","));if(i){let{transform:n,width:l,height:f}=this.#a(this.data.rotation,i);s.parentElement.setAttribute("viewBox",`0 0 ${l} ${f}`),s.setAttribute("transform",n)}}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class bp extends Ha{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0});this.annotationEditorType=je.HIGHLIGHT}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();if(this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),t){let a=document.createElement("mark");a.classList.add("overlaidText"),a.textContent=t,this.container.append(a)}return this.container}}class JB extends Ha{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();if(this.container.classList.add("underlineAnnotation"),t){let a=document.createElement("u");a.classList.add("overlaidText"),a.textContent=t,this.container.append(a)}return this.container}}class QB extends Ha{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();if(this.container.classList.add("squigglyAnnotation"),t){let a=document.createElement("u");a.classList.add("overlaidText"),a.textContent=t,this.container.append(a)}return this.container}}class ZB extends Ha{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();if(this.container.classList.add("strikeoutAnnotation"),t){let a=document.createElement("s");a.classList.add("overlaidText"),a.textContent=t,this.container.append(a)}return this.container}}class pp extends Ha{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});this.annotationEditorType=je.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 $B extends Ha{#t=null;constructor(t){super(t,{isRenderable:!0});let{fileId:e,file:a}=this.data;this.filename=a.filename,this.content=a.content,this.fileId=e,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,attachmentId:this.fileId,...a})}render(){this.container.classList.add("fileAttachmentAnnotation");let{container:t,data:e}=this,a;if(e.hasAppearance||e.fillAlpha===0)a=document.createElement("div");else if(a=document.createElement("img"),a.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(e.name)?"paperclip":"pushpin"}.svg`,e.fillAlpha&&e.fillAlpha<1)a.style=`filter: opacity(${Math.round(e.fillAlpha*100)}%);`;a.addEventListener("dblclick",this.#e.bind(this)),this.#t=a;let{isMac:i}=ha.platform;if(t.addEventListener("keydown",(s)=>{if(s.key==="Enter"&&(i?s.metaKey:s.ctrlKey))this.#e()}),!e.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();else a.classList.add("popupTriggerArea");return t.append(a),t}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}async#e(){let{fileId:t,filename:e,content:a}=this,i=await this.linkService.getAttachmentContent(t)||a;if(i)this.downloadManager?.openOrDownloadData(i,e)}}class wp extends Ha{#t=new AbortController;#e=null;#a=null;constructor(t){super(t,{isRenderable:!!t.data.richMedia})}render(){this.container.classList.add("mediaAnnotation");let{filename:t}=this.data.richMedia,e=document.createElement("button");return e.className="mediaPlayButton",e.type="button",e.title=e.ariaLabel=t,e.addEventListener("click",()=>this.#i(e),{signal:this.#t.signal}),this.container.append(e),this.container}async#i(t){let{fileId:e,filename:a,contentType:i}=this.data.richMedia;t.disabled=!0;let s;try{s=await this.linkService.getAttachmentContent(e)}catch{return}finally{t.disabled=!1}if(!s||!t.isConnected)return;let{signal:n}=this.#t,l=URL.createObjectURL(new Blob([s],{type:i}));this.#e=l;let f=i.startsWith("audio/"),o=document.createElement(f?"audio":"video");if(this.#a=o,o.className="mediaContent",this._setBackgroundColor(o),o.src=l,o.title=a,o.controls=!0,o.autoplay=!0,o.tabIndex=0,f){let c=!1,u=!1,m=()=>{o.controls=c||u};this.container.addEventListener("pointerenter",()=>{c=!0,m()},{signal:n}),this.container.addEventListener("pointerleave",()=>{c=!1,m()},{signal:n}),this.container.addEventListener("focusin",()=>{u=!0,m()},{signal:n}),this.container.addEventListener("focusout",()=>{u=!1,m()},{signal:n})}o.addEventListener("emptied",()=>this.#s(l),{once:!0,signal:n}),t.replaceWith(o),o.play().catch(()=>{})}#s(t=this.#e){if(t&&t===this.#e)URL.revokeObjectURL(t),this.#e=null}destroy(){if(this.#t.abort(),this.#a)this.#a.pause(),this.#a.removeAttribute("src"),this.#a.load(),this.#a=null;this.#s()}}class jp{#t=null;#e=null;#a=null;#i=new Map;#s=null;#l=null;#n=[];#f=!1;zIndex=0;constructor({div:t,accessibilityManager:e,annotationCanvasMap:a,annotationEditorUIManager:i,page:s,viewport:n,structTreeLayer:l,commentManager:f,linkService:o,annotationStorage:c}){this.div=t,this.#t=e,this.#e=a,this.#s=l||null,this.#l=o||null,this.#a=c||new h6,this.page=s,this.viewport=n,this._annotationEditorUIManager=i,this._commentManager=f||null}hasEditableAnnotations(){return this.#i.size>0}async render(t){let{annotations:e,optionalContentConfig:a}=t,i=this.div;or(i,this.viewport);let s=new Map,n=[],l={data:null,layer:i,linkService:this.#l,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new p9,annotationStorage:this.#a,enableComment:t.enableComment===!0,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(let f of e){if(f.noHTML)continue;let o=f.annotationType===Ja.POPUP;if(!o){if(f.rect[2]===f.rect[0]||f.rect[3]===f.rect[1])continue}else{let m=s.get(f.id);if(!m)continue;if(!this._commentManager){n.push(f);continue}l.elements=m}l.data=f;let c=V3.create(l);if(!c.isRenderable)continue;if(!o){if(this.#n.push(c),f.popupRef)s.getOrInsertComputed(f.popupRef,w9).push(c)}let u=c.render();if(f.hidden)u.style.visibility="hidden";if(c.updateOC(a),c._isEditable)this.#i.set(c.data.id,c),this._annotationEditorUIManager?.renderAnnotationElement(c)}await this.#o();for(let f of n){let o=l.elements=s.get(f.id);l.data=f;let c=V3.create(l);if(!c.isRenderable)continue;let u=c.render();if(c.contentElement.id=`pdfjs_internal_id_${f.id}`,f.hidden)u.style.visibility="hidden";o.at(-1).container.after(u)}this.#r()}async#o(){if(this.#n.length===0)return;this.div.replaceChildren();let t=[];if(!this.#f){this.#f=!0;for(let{contentElement:a,data:{id:i}}of this.#n){let s=a.id=`pdfjs_internal_id_${i}`;t.push(this.#s?.getAriaAttributes(s).then((n)=>{if(n)for(let[l,f]of n)a.setAttribute(l,f)}))}}this.#n.sort(({data:{rect:[a,i,s,n]}},{data:{rect:[l,f,o,c]}})=>{if(a===s&&i===n)return 1;if(l===o&&f===c)return-1;let u=n,m=i,p=(i+n)/2,w=c,d=f,v=(f+c)/2;if(p>=w&&v<=m)return-1;if(v>=u&&p<=d)return 1;let k=(a+s)/2,y=(l+o)/2;return k-y});let e=document.createDocumentFragment();for(let a of this.#n)if(e.append(a.container),this._commentManager)(a.extraPopupElement?.popup||a.popup)?.renderCommentButton();else if(a.extraPopupElement)e.append(a.extraPopupElement.render());if(this.div.append(e),await Promise.all(t),this.#t)for(let a of this.#n)this.#t.addPointerInTextLayer(a.contentElement,!1)}async addLinkAnnotations(t){let e={data:null,layer:this.div,linkService:this.#l,svgFactory:new p9,parent:this};for(let a of t){a.borderStyle||=jp._defaultBorderStyle,e.data=a;let i=V3.create(e);if(!i.isRenderable)continue;i.render(),i.contentElement.id=`pdfjs_internal_id_${a.id}`,this.#n.push(i)}await this.#o()}update({viewport:t,optionalContentConfig:e}){let a=this.div;this.viewport=t,or(a,{rotation:t.rotation});for(let i of this.#n)i.updateOC(e);this.#r(),a.hidden=!1}destroy(){for(let t of this.#n)t.destroy?.(),this.#t?.removePointerInTextLayer(t.contentElement);this.#n.length=0,this.#i.clear(),this.div.replaceChildren()}#r(){if(!this.#e)return;let t=this.div;for(let[e,a]of this.#e){let i=t.querySelector(`[data-annotation-id="${e}"]`);if(!i)continue;if(Array.isArray(a))for(let o of a)o.className="annotationContent",o.ariaHidden=!0;else a.className="annotationContent",a.ariaHidden=!0;let s=[];for(let o of i.children)if(o.nodeName==="CANVAS")s.push(o);for(let o of s)o.remove();let n=Array.isArray(a)?a[0]:a,{firstChild:l}=i;if(!l)i.append(n);else if(!l.classList.contains("annotationContent"))l.before(n);else l.after(n);if(Array.isArray(a)){let o=n;for(let c=1,u=a.length;c<u;c++)o.after(a[c]),o=a[c]}this.#e.delete(e);let f=this.#i.get(e);if(!f)continue;if(f._hasNoCanvas)this._annotationEditorUIManager?.setMissingCanvas(e,i.id,a),f._hasNoCanvas=!1;else f.canvas=a}}refreshCanvases(){this.#r()}getEditableAnnotations(){return this.#i.values()}getEditableAnnotation(t){return this.#i.get(t)}addFakeAnnotation(t){let{div:e}=this,{id:a,rotation:i}=t,s=new TB({data:{id:a,rect:t.getPDFRect(),rotation:i},editor:t,layer:e,parent:this,enableComment:!!this._commentManager,linkService:this.#l,annotationStorage:this.#a});return s.render(),s.contentElement.id=`pdfjs_internal_id_${a}`,s.createOrUpdatePopup(),this.#n.push(s),s}removeAnnotation(t){let e=this.#n.findIndex((i)=>i.data.id===t);if(e<0)return;let[a]=this.#n.splice(e,1);this.#t?.removePointerInTextLayer(a.contentElement)}updateFakeAnnotations(t){if(t.length===0)return;for(let e of t)e.updateFakeAnnotationElement(this);this.#o()}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}static get _defaultBorderStyle(){return be(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:yh.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}}var x3=/\r\n?|\n/g;class Ti extends se{#t="";#e=`${this.id}-editor`;#a=null;#i;_colorPicker=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){let t=Ti.prototype,e=(s)=>s.isEmpty(),a=Tl.TRANSLATE_SMALL,i=Tl.TRANSLATE_BIG;return be(this,"_keyboardManager",new fn([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter"],t.commitOrRemove],[["Escape"],t.commitOrRemove],[["ArrowLeft"],t._translateEmpty,{args:[-a,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:e}],[["ArrowRight"],t._translateEmpty,{args:[a,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ArrowUp"],t._translateEmpty,{args:[0,-a],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ArrowDown"],t._translateEmpty,{args:[0,a],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}]]))}static _type="freetext";static _editorType=je.FREETEXT;constructor(t){super({...t,name:"freeTextEditor"});if(this.color=t.color||Ti._defaultColor||se._defaultLineColor,this.#i=t.fontSize||Ti._defaultFontSize,!this.annotationElementId)this._uiManager.a11yAlert(se._l10nAlert.freetext);this.canAddComment=!1}static initialize(t,e){se.initialize(t,e);let a=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(a.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,e){switch(t){case Ce.FREETEXT_SIZE:Ti._defaultFontSize=e;break;case Ce.FREETEXT_COLOR:Ti._defaultColor=e;break}}updateParams(t,e){switch(t){case Ce.FREETEXT_SIZE:this.#s(e);break;case Ce.FREETEXT_COLOR:this.#l(e);break}}static get defaultPropertiesToUpdate(){return[[Ce.FREETEXT_SIZE,Ti._defaultFontSize],[Ce.FREETEXT_COLOR,Ti._defaultColor||se._defaultLineColor]]}get propertiesToUpdate(){return[[Ce.FREETEXT_SIZE,this.#i],[Ce.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||=new b9(this),[["colorPicker",this._colorPicker]]}get colorType(){return Ce.FREETEXT_COLOR}#s(t){let e=(i)=>{this.editorDiv.style.fontSize=`calc(${i}px * var(--total-scale-factor))`,this.translate(0,-(i-this.#i)*this.parentScale),this.#i=i,this.#f()},a=this.#i;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ce.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}onUpdatedColor(){this.editorDiv.style.color=this.color,this._colorPicker?.update(this.color),super.onUpdatedColor()}#l(t){let e=(i)=>{this.color=i,this.onUpdatedColor()},a=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ce.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){let t=this.parentScale;return[-Ti._internalPadding*t,-(Ti._internalPadding+this.#i)*t]}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.#a=new AbortController;let t=this._uiManager.combinedSignal(this.#a);return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t}),!0}disableEditMode(){if(!super.disableEditMode())return!1;return this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#e),this._isDraggable=!0,this.#a?.abort(),this.#a=null,this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0}focusin(t){if(!this._focusEventsAllowed)return;if(super.focusin(t),t.target!==this.editorDiv)this.editorDiv.focus()}onceAdded(t){if(this.width)return;if(this.enableEditMode(),t)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()}#n(){let t=[];this.editorDiv.normalize();let e=null;for(let a of this.editorDiv.childNodes){if(e?.nodeType===Node.TEXT_NODE&&a.nodeName==="BR")continue;t.push(Ti.#o(a)),e=a}return t.join(`
312
- `)}#f(){let[t,e]=this.parentDimensions,a;if(this.isAttachedToDOM)a=this.div.getBoundingClientRect();else{let{currentLayer:i,div:s}=this,n=s.style.display,l=s.classList.contains("hidden");s.classList.remove("hidden"),s.style.display="hidden",i.div.append(this.div),a=s.getBoundingClientRect(),s.remove(),s.style.display=n,s.classList.toggle("hidden",l)}if(this.rotation%180===this.parentRotation%180)this.width=a.width/t,this.height=a.height/e;else this.width=a.height/t,this.height=a.width/e;this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let t=this.#t,e=this.#t=this.#n().trimEnd();if(t===e)return;let a=(i)=>{if(this.#t=i,!i){this.remove();return}this.#r(),this._uiManager.rebuild(this),this.#f()};this.addCommands({cmd:()=>{a(e)},undo:()=>{a(t)},mustExec:!1}),this.#f()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(t){if(t.target===this.div&&t.key==="Enter")this.enterInEditMode(),t.preventDefault()}editorDivKeydown(t){Ti._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){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 t,e;if(this._isCopy||this.annotationElementId)t=this.x,e=this.y;super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#e),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:a}=this.editorDiv;if(a.fontSize=`calc(${this.#i}px * var(--total-scale-factor))`,a.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[i,s]=this.parentDimensions;if(this.annotationElementId){let{position:n}=this._initialData,[l,f]=this.getInitialTranslation();[l,f]=this.pageTranslationToScreen(l,f);let[o,c]=this.pageDimensions,[u,m]=this.pageTranslation,p,w;switch(this.rotation){case 0:p=t+(n[0]-u)/o,w=e+this.height-(n[1]-m)/c;break;case 90:p=t+(n[0]-u)/o,w=e-(n[1]-m)/c,[l,f]=[f,-l];break;case 180:p=t-this.width+(n[0]-u)/o,w=e-(n[1]-m)/c,[l,f]=[-l,-f];break;case 270:p=t+(n[0]-u-this.height*c)/o,w=e+(n[1]-m-this.width*o)/c,[l,f]=[-f,l];break}this.setAt(p*i,w*s,l,f)}else this._moveAfterPaste(t,e);this.#r(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#o(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(x3,"")}editorDivPaste(t){let e=t.clipboardData||window.clipboardData,{types:a}=e;if(a.length===1&&a[0]==="text/plain")return;t.preventDefault();let i=Ti.#c(e.getData("text")||"").replaceAll(x3,`
313
- `);if(!i)return;let s=window.getSelection();if(!s.rangeCount)return;this.editorDiv.normalize(),s.deleteFromDocument();let n=s.getRangeAt(0);if(!i.includes(`
314
- `)){n.insertNode(document.createTextNode(i)),this.editorDiv.normalize(),s.collapseToStart();return}let{startContainer:l,startOffset:f}=n,o=[],c=[];if(l.nodeType===Node.TEXT_NODE){let p=l.parentElement;if(c.push(l.nodeValue.slice(f).replaceAll(x3,"")),p!==this.editorDiv){let w=o;for(let d of this.editorDiv.childNodes){if(d===p){w=c;continue}w.push(Ti.#o(d))}}o.push(l.nodeValue.slice(0,f).replaceAll(x3,""))}else if(l===this.editorDiv){let p=o,w=0;for(let d of this.editorDiv.childNodes){if(w++===f)p=c;p.push(Ti.#o(d))}}this.#t=`${o.join(`
315
- `)}${i}${c.join(`
316
- `)}`,this.#r();let u=new Range,m=Math.sumPrecise(o.map((p)=>p.length));for(let{firstChild:p}of this.editorDiv.childNodes)if(p.nodeType===Node.TEXT_NODE){let w=p.nodeValue.length;if(m<=w){u.setStart(p,m),u.setEnd(p,m);break}m-=w}s.removeAllRanges(),s.addRange(u)}#r(){if(this.editorDiv.replaceChildren(),!this.#t)return;for(let t of this.#t.split(`
317
- `)){let e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}#u(){return this.#t.replaceAll(" "," ")}static#c(t){return t.replaceAll(" "," ")}get contentDiv(){return this.editorDiv}getPDFRect(){let t=Ti._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,e,a){let i=null;if(t instanceof mp){let{data:{defaultAppearanceData:{fontSize:n,fontColor:l},rect:f,rotation:o,id:c,popupRef:u,richText:m,contentsObj:p,creationDate:w,modificationDate:d},textContent:v,textPosition:k,parent:{page:{pageNumber:y}}}=t;if(!v?.length)return null;i=t={annotationType:je.FREETEXT,color:Array.from(l),fontSize:n,value:v.join(`
318
- `),position:k,pageIndex:y-1,rect:f.slice(0),rotation:o,annotationElementId:c,id:c,deleted:!1,popupRef:u,comment:p?.str||null,richText:m,creationDate:w,modificationDate:d}}let s=await super.deserialize(t,e,a);if(s.#i=t.fontSize,s.color=Nt.makeHexColor(...t.color),s.#t=Ti.#c(t.value),s._initialData=i,t.comment)s.setCommentData(t);return s}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let e=se._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),a=Object.assign(super.serialize(t),{color:e,fontSize:this.#i,value:this.#u()});if(this.addComment(a),t)return a.isCopy=!0,a;if(this.annotationElementId&&!this.#g(a))return null;return a.id=this.annotationElementId,a}#g(t){let{value:e,fontSize:a,color:i,pageIndex:s}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||t.value!==e||t.fontSize!==a||t.color.some((n,l)=>n!==i[l])||t.pageIndex!==s}renderAnnotationElement(t){let e=super.renderAnnotationElement(t);if(!e)return null;let{style:a}=e;a.fontSize=`calc(${this.#i}px * var(--total-scale-factor))`,a.color=this.color,e.replaceChildren();for(let i of this.#t.split(`
319
- `)){let s=document.createElement("div");s.append(i?document.createTextNode(i):document.createElement("br")),e.append(s)}return t.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:this.#t}}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}}class Jt{static PRECISION=0.0001;toSVGPath(){Qe("Abstract method `toSVGPath` must be implemented.")}get box(){Qe("Abstract getter `box` must be implemented.")}serialize(t,e){Qe("Abstract method `serialize` must be implemented.")}static _rescale(t,e,a,i,s,n){n||=new Float32Array(t.length);for(let l=0,f=t.length;l<f;l+=2)n[l]=e+t[l]*i,n[l+1]=a+t[l+1]*s;return n}static _rescaleAndSwap(t,e,a,i,s,n){n||=new Float32Array(t.length);for(let l=0,f=t.length;l<f;l+=2)n[l]=e+t[l+1]*i,n[l+1]=a+t[l]*s;return n}static _translate(t,e,a,i){i||=new Float32Array(t.length);for(let s=0,n=t.length;s<n;s+=2)i[s]=e+t[s],i[s+1]=a+t[s+1];return i}static svgRound(t){return Math.round(t*1e4)}static _normalizePoint(t,e,a,i,s){switch(s){case 90:return[1-e/a,t/i];case 180:return[1-t/a,1-e/i];case 270:return[e/a,1-t/i];default:return[t/a,e/i]}}static createBezierPoints(t,e,a,i,s,n){return[(t+5*a)/6,(e+5*i)/6,(5*a+s)/6,(5*i+n)/6,(a+s)/2,(i+n)/2]}}class fr{#t;#e=[];#a;#i;#s=[];#l=new Float32Array(18);#n;#f;#o;#r;#u;#c;#g=[];static#p=8;static#b=2;static#h=fr.#p+fr.#b;constructor({x:t,y:e},a,i,s,n,l=0){this.#t=a,this.#c=s*i,this.#i=n,this.#l.set([NaN,NaN,NaN,NaN,t,e],6),this.#a=l,this.#r=fr.#p*i,this.#o=fr.#h*i,this.#u=i,this.#g.push(t,e)}isEmpty(){return isNaN(this.#l[8])}#m(){let t=this.#l.subarray(4,6),e=this.#l.subarray(16,18),[a,i,s,n]=this.#t;return[(this.#n+(t[0]-e[0])/2-a)/s,(this.#f+(t[1]-e[1])/2-i)/n,(this.#n+(e[0]-t[0])/2-a)/s,(this.#f+(e[1]-t[1])/2-i)/n]}add({x:t,y:e}){this.#n=t,this.#f=e;let[a,i,s,n]=this.#t,[l,f,o,c]=this.#l.subarray(8,12),u=t-o,m=e-c,p=Math.hypot(u,m);if(p<this.#o)return!1;let w=p-this.#r,d=w/p,v=d*u,k=d*m,y=l,B=f;l=o,f=c,o+=v,c+=k,this.#g?.push(t,e);let H=-k/w,M=v/w,D=H*this.#c,T=M*this.#c;if(this.#l.set(this.#l.subarray(2,8),0),this.#l.set([o+D,c+T],4),this.#l.set(this.#l.subarray(14,18),12),this.#l.set([o-D,c-T],16),isNaN(this.#l[6])){if(this.#s.length===0)this.#l.set([l+D,f+T],2),this.#s.push(NaN,NaN,NaN,NaN,(l+D-a)/s,(f+T-i)/n),this.#l.set([l-D,f-T],14),this.#e.push(NaN,NaN,NaN,NaN,(l-D-a)/s,(f-T-i)/n);return this.#l.set([y,B,l,f,o,c],6),!this.isEmpty()}if(this.#l.set([y,B,l,f,o,c],6),Math.abs(Math.atan2(B-f,y-l)-Math.atan2(k,v))<Math.PI/2)return[l,f,o,c]=this.#l.subarray(2,6),this.#s.push(NaN,NaN,NaN,NaN,((l+o)/2-a)/s,((f+c)/2-i)/n),[l,f,y,B]=this.#l.subarray(14,18),this.#e.push(NaN,NaN,NaN,NaN,((y+l)/2-a)/s,((B+f)/2-i)/n),!0;return[y,B,l,f,o,c]=this.#l.subarray(0,6),this.#s.push(((y+5*l)/6-a)/s,((B+5*f)/6-i)/n,((5*l+o)/6-a)/s,((5*f+c)/6-i)/n,((l+o)/2-a)/s,((f+c)/2-i)/n),[o,c,l,f,y,B]=this.#l.subarray(12,18),this.#e.push(((y+5*l)/6-a)/s,((B+5*f)/6-i)/n,((5*l+o)/6-a)/s,((5*f+c)/6-i)/n,((l+o)/2-a)/s,((f+c)/2-i)/n),!0}toSVGPath(){if(this.isEmpty())return"";let t=this.#s,e=this.#e;if(isNaN(this.#l[6])&&!this.isEmpty())return this.#j();let a=[];a.push(`M${t[4]} ${t[5]}`);for(let i=6;i<t.length;i+=6)if(isNaN(t[i]))a.push(`L${t[i+4]} ${t[i+5]}`);else a.push(`C${t[i]} ${t[i+1]} ${t[i+2]} ${t[i+3]} ${t[i+4]} ${t[i+5]}`);this.#w(a);for(let i=e.length-6;i>=6;i-=6)if(isNaN(e[i]))a.push(`L${e[i+4]} ${e[i+5]}`);else a.push(`C${e[i]} ${e[i+1]} ${e[i+2]} ${e[i+3]} ${e[i+4]} ${e[i+5]}`);return this.#d(a),a.join(" ")}#j(){let[t,e,a,i]=this.#t,[s,n,l,f]=this.#m();return`M${(this.#l[2]-t)/a} ${(this.#l[3]-e)/i} L${(this.#l[4]-t)/a} ${(this.#l[5]-e)/i} L${s} ${n} L${l} ${f} L${(this.#l[16]-t)/a} ${(this.#l[17]-e)/i} L${(this.#l[14]-t)/a} ${(this.#l[15]-e)/i} Z`}#d(t){let e=this.#e;t.push(`L${e[4]} ${e[5]} Z`)}#w(t){let[e,a,i,s]=this.#t,n=this.#l.subarray(4,6),l=this.#l.subarray(16,18),[f,o,c,u]=this.#m();t.push(`L${(n[0]-e)/i} ${(n[1]-a)/s} L${f} ${o} L${c} ${u} L${(l[0]-e)/i} ${(l[1]-a)/s}`)}newFreeDrawOutline(t,e,a,i,s,n){return new dp(t,e,a,i,s,n)}getOutlines(){let t=this.#s,e=this.#e,a=this.#l,[i,s,n,l]=this.#t,f=new Float32Array((this.#g?.length??0)+2);for(let u=0,m=f.length-2;u<m;u+=2)f[u]=(this.#g[u]-i)/n,f[u+1]=(this.#g[u+1]-s)/l;if(f[f.length-2]=(this.#n-i)/n,f[f.length-1]=(this.#f-s)/l,isNaN(a[6])&&!this.isEmpty())return this.#S(f);let o=new Float32Array(this.#s.length+24+this.#e.length),c=t.length;for(let u=0;u<c;u+=2){if(isNaN(t[u])){o[u]=o[u+1]=NaN;continue}o[u]=t[u],o[u+1]=t[u+1]}c=this.#q(o,c);for(let u=e.length-6;u>=6;u-=6)for(let m=0;m<6;m+=2){if(isNaN(e[u+m])){o[c]=o[c+1]=NaN,c+=2;continue}o[c]=e[u+m],o[c+1]=e[u+m+1],c+=2}return this.#y(o,c),this.newFreeDrawOutline(o,f,this.#t,this.#u,this.#a,this.#i)}#S(t){let e=this.#l,[a,i,s,n]=this.#t,[l,f,o,c]=this.#m(),u=new Float32Array(36);return u.set([NaN,NaN,NaN,NaN,(e[2]-a)/s,(e[3]-i)/n,NaN,NaN,NaN,NaN,(e[4]-a)/s,(e[5]-i)/n,NaN,NaN,NaN,NaN,l,f,NaN,NaN,NaN,NaN,o,c,NaN,NaN,NaN,NaN,(e[16]-a)/s,(e[17]-i)/n,NaN,NaN,NaN,NaN,(e[14]-a)/s,(e[15]-i)/n],0),this.newFreeDrawOutline(u,t,this.#t,this.#u,this.#a,this.#i)}#y(t,e){let a=this.#e;return t.set([NaN,NaN,NaN,NaN,a[4],a[5]],e),e+=6}#q(t,e){let a=this.#l.subarray(4,6),i=this.#l.subarray(16,18),[s,n,l,f]=this.#t,[o,c,u,m]=this.#m();return t.set([NaN,NaN,NaN,NaN,(a[0]-s)/l,(a[1]-n)/f,NaN,NaN,NaN,NaN,o,c,NaN,NaN,NaN,NaN,u,m,NaN,NaN,NaN,NaN,(i[0]-s)/l,(i[1]-n)/f],e),e+=24}}class dp extends Jt{#t;#e=new Float32Array(4);#a;#i;#s;#l;#n;constructor(t,e,a,i,s,n){super();this.#n=t,this.#s=e,this.#t=a,this.#l=i,this.#a=s,this.#i=n,this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],this.#f(n);let[l,f,o,c]=this.#e;for(let u=0,m=t.length;u<m;u+=2)t[u]=(t[u]-l)/o,t[u+1]=(t[u+1]-f)/c;for(let u=0,m=e.length;u<m;u+=2)e[u]=(e[u]-l)/o,e[u+1]=(e[u+1]-f)/c}toSVGPath(){let t=[`M${this.#n[4]} ${this.#n[5]}`];for(let e=6,a=this.#n.length;e<a;e+=6){if(isNaN(this.#n[e])){t.push(`L${this.#n[e+4]} ${this.#n[e+5]}`);continue}t.push(`C${this.#n[e]} ${this.#n[e+1]} ${this.#n[e+2]} ${this.#n[e+3]} ${this.#n[e+4]} ${this.#n[e+5]}`)}return t.push("Z"),t.join(" ")}serialize([t,e,a,i],s){let n=a-t,l=i-e,f,o;switch(s){case 0:f=Jt._rescale(this.#n,t,i,n,-l),o=Jt._rescale(this.#s,t,i,n,-l);break;case 90:f=Jt._rescaleAndSwap(this.#n,t,e,n,l),o=Jt._rescaleAndSwap(this.#s,t,e,n,l);break;case 180:f=Jt._rescale(this.#n,a,e,-n,l),o=Jt._rescale(this.#s,a,e,-n,l);break;case 270:f=Jt._rescaleAndSwap(this.#n,a,i,-n,-l),o=Jt._rescaleAndSwap(this.#s,a,i,-n,-l);break}return{outline:Array.from(f),points:[Array.from(o)]}}#f(t){let e=this.#n,a=e[4],i=e[5],s=[a,i,a,i],n=a,l=i,f=a,o=i,c=t?Math.max:Math.min,u=new Float32Array(4);for(let p=6,w=e.length;p<w;p+=6){let d=e[p+4],v=e[p+5];if(isNaN(e[p])){if(Nt.pointBoundingBox(d,v,s),l>v)n=d,l=v;else if(l===v)n=c(n,d);if(o<v)f=d,o=v;else if(o===v)f=c(f,d)}else{if(u.set(y1,0),Nt.bezierBoundingBox(a,i,...e.slice(p,p+6),u),Nt.rectBoundingBox(...u,s),l>u[1])n=u[0],l=u[1];else if(l===u[1])n=c(n,u[0]);if(o<u[3])f=u[2],o=u[3];else if(o===u[3])f=c(f,u[2])}a=d,i=v}let m=this.#e;m[0]=s[0]-this.#a,m[1]=s[1]-this.#a,m[2]=s[2]-s[0]+2*this.#a,m[3]=s[3]-s[1]+2*this.#a,this.firstPoint=[n,l],this.lastPoint=[f,o]}get box(){return this.#e}newOutliner(t,e,a,i,s,n=0){return new fr(t,e,a,i,s,n)}getNewOutline(t,e){let[a,i,s,n]=this.#e,[l,f,o,c]=this.#t,u=s*o,m=n*c,p=a*o+l,w=i*c+f,d=this.newOutliner({x:this.#s[0]*u+p,y:this.#s[1]*m+w},this.#t,this.#l,t,this.#i,e??this.#a);for(let v=2;v<this.#s.length;v+=2)d.add({x:this.#s[v]*u+p,y:this.#s[v+1]*m+w});return d.getOutlines()}}class P3{#t;#e;#a;#i=[];#s=[];constructor(t,e=0,a=0,i=!0){let s=y1.slice(),n=4,l=0.0001;for(let{x:v,y:k,width:y,height:B}of t){let H=Math.floor((v-e)/0.0001)*0.0001,M=Math.ceil((v+y+e)/0.0001)*0.0001,D=Math.floor((k-e)/0.0001)*0.0001,T=Math.ceil((k+B+e)/0.0001)*0.0001,z=[H,D,T,!0],E=[M,D,T,!1];this.#i.push(z,E),Nt.rectBoundingBox(H,D,M,T,s)}let f=s[2]-s[0]+2*a,o=s[3]-s[1]+2*a,c=s[0]-a,u=s[1]-a,m=i?-1/0:1/0,p=1/0,w=this.#i.at(i?-1:-2),d=[w[0],w[2]];for(let v of this.#i){let[k,y,B,H]=v;if(!H&&i){if(y<p)p=y,m=k;else if(y===p)m=Math.max(m,k)}else if(H&&!i){if(y<p)p=y,m=k;else if(y===p)m=Math.min(m,k)}v[0]=(k-c)/f,v[1]=(y-u)/o,v[2]=(B-u)/o}this.#t=new Float32Array([c,u,f,o]),this.#e=[m,p],this.#a=d}getOutlines(){this.#i.sort((e,a)=>e[0]-a[0]||e[1]-a[1]||e[2]-a[2]);let t=[];for(let e of this.#i)if(e[3])t.push(...this.#r(e)),this.#f(e);else this.#o(e),t.push(...this.#r(e));return this.#l(t)}#l(t){let e=[],a=new Set;for(let n of t){let[l,f,o]=n;e.push([l,f,n],[l,o,n])}e.sort((n,l)=>n[1]-l[1]||n[0]-l[0]);for(let n=0,l=e.length;n<l;n+=2){let f=e[n][2],o=e[n+1][2];f.push(o),o.push(f),a.add(f),a.add(o)}let i=[],s;while(a.size>0){let n=a.values().next().value,[l,f,o,c,u]=n;a.delete(n);let m=l,p=f;s=[l,o],i.push(s);while(!0){let w;if(a.has(c))w=c;else if(a.has(u))w=u;else break;if(a.delete(w),[l,f,o,c,u]=w,m!==l)s.push(m,p,l,p===f?f:o),m=l;p=p===f?o:f}s.push(m,p)}return new WB(i,this.#t,this.#e,this.#a)}#n(t){let e=this.#s,a=0,i=e.length-1;while(a<=i){let s=a+i>>1,n=e[s][0];if(n===t)return s;if(n<t)a=s+1;else i=s-1}return i+1}#f([,t,e]){let a=this.#n(t);this.#s.splice(a,0,[t,e])}#o([,t,e]){let a=this.#n(t);for(let i=a;i<this.#s.length;i++){let[s,n]=this.#s[i];if(s!==t)break;if(s===t&&n===e){this.#s.splice(i,1);return}}for(let i=a-1;i>=0;i--){let[s,n]=this.#s[i];if(s!==t)break;if(s===t&&n===e){this.#s.splice(i,1);return}}}#r(t){let[e,a,i]=t,s=[[e,a,i]],n=this.#n(i);for(let l=0;l<n;l++){let[f,o]=this.#s[l];for(let c=0,u=s.length;c<u;c++){let[,m,p]=s[c];if(o<=m||p<=f)continue;if(m>=f){if(p>o)s[c][1]=o;else{if(u===1)return[];s.splice(c,1),c--,u--}continue}if(s[c][2]=f,p>o)s.push([e,o,p])}}return s}}class WB extends Jt{#t;#e;constructor(t,e,a,i){super();this.#e=t,this.#t=e,this.firstPoint=a,this.lastPoint=i}toSVGPath(){let t=[];for(let e of this.#e){let[a,i]=e;t.push(`M${a} ${i}`);for(let s=2;s<e.length;s+=2){let n=e[s],l=e[s+1];if(n===a)t.push(`V${l}`),i=l;else if(l===i)t.push(`H${n}`),a=n}t.push("Z")}return t.join(" ")}serialize([t,e,a,i],s){let n=[],l=a-t,f=i-e;for(let o of this.#e){let c=Array(o.length);for(let u=0;u<o.length;u+=2)c[u]=t+o[u]*l,c[u+1]=i-o[u+1]*f;n.push(c)}return n}get box(){return this.#t}}class t6 extends fr{newFreeDrawOutline(t,e,a,i,s,n){return new PB(t,e,a,i,s,n)}}class PB extends dp{newOutliner(t,e,a,i,s,n=0){return new t6(t,e,a,i,s,n)}}class ai extends se{#t=null;#e=0;#a;#i=null;#s=null;#l=null;#n=null;#f=0;#o=null;#r=null;#u=null;#c=!1;#g=null;#p=null;#b=null;#h="";#m;#j="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=je.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){let t=ai.prototype;return be(this,"_keyboardManager",new fn([[["ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown"],t._moveCaret,{args:[3]}]]))}constructor(t){super({...t,name:"highlightEditor"});if(this.color=t.color||ai._defaultColor,this.#m=t.thickness||ai._defaultThickness,this.opacity=t.opacity||ai._defaultOpacity,this.#a=t.boxes||null,this.#j=t.methodOfCreation||"",this.#h=t.text||"",this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",t.highlightId>-1)this.#c=!0,this.#w(t),this.#v();else if(this.#a)this.#t=t.anchorNode,this.#e=t.anchorOffset,this.#n=t.focusNode,this.#f=t.focusOffset,this.#d(),this.#v(),this.rotate(this.rotation);if(!this.annotationElementId)this._uiManager.a11yAlert(se._l10nAlert.highlight)}get telemetryInitialData(){return{action:"added",type:this.#c?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:this.#m,methodOfCreation:this.#j}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}#d(){let t=new P3(this.#a,0.001);this.#r=t.getOutlines(),[this.x,this.y,this.width,this.height]=this.#r.box;let e=new P3(this.#a,0.0025,0.001,this._uiManager.direction==="ltr");this.#l=e.getOutlines();let{firstPoint:a}=this.#r;this.#g=[(a[0]-this.x)/this.width,(a[1]-this.y)/this.height];let{lastPoint:i}=this.#l;this.#p=[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]}#w({highlightOutlines:t,highlightId:e,clipPathId:a}){this.#r=t;let i=1.5;if(this.#l=t.getNewOutline(this.#m/2+i,0.0025),e>=0)this.#u=e,this.#i=a,this.parent.drawLayer.finalizeDraw(e,{bbox:t.box,path:{d:t.toSVGPath()}}),this.#b=this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:this.#l.box,path:{d:this.#l.toSVGPath()}},!0);else if(this.parent){let u=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(this.#u,{bbox:ai.#_(this.#r.box,(u-this.rotation+360)%360),path:{d:t.toSVGPath()}}),this.parent.drawLayer.updateProperties(this.#b,{bbox:ai.#_(this.#l.box,u),path:{d:this.#l.toSVGPath()}})}let[s,n,l,f]=t.box;switch(this.rotation){case 0:this.x=s,this.y=n,this.width=l,this.height=f;break;case 90:{let[u,m]=this.parentDimensions;this.x=n,this.y=1-s,this.width=l*m/u,this.height=f*u/m;break}case 180:this.x=1-s,this.y=1-n,this.width=l,this.height=f;break;case 270:{let[u,m]=this.parentDimensions;this.x=1-n,this.y=s,this.width=l*m/u,this.height=f*u/m;break}}let{firstPoint:o}=t;this.#g=[(o[0]-s)/l,(o[1]-n)/f];let{lastPoint:c}=this.#l;this.#p=[(c[0]-s)/l,(c[1]-n)/f]}static initialize(t,e){se.initialize(t,e),ai._defaultColor||=e.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(t,e){switch(t){case Ce.HIGHLIGHT_COLOR:ai._defaultColor=e;break;case Ce.HIGHLIGHT_THICKNESS:ai._defaultThickness=e;break}}translateInPage(t,e){}get toolbarPosition(){return this.#p}get commentButtonPosition(){return this.#g}updateParams(t,e){switch(t){case Ce.HIGHLIGHT_COLOR:this.#S(e);break;case Ce.HIGHLIGHT_THICKNESS:this.#y(e);break}}static get defaultPropertiesToUpdate(){return[[Ce.HIGHLIGHT_COLOR,ai._defaultColor],[Ce.HIGHLIGHT_THICKNESS,ai._defaultThickness]]}get propertiesToUpdate(){return[[Ce.HIGHLIGHT_COLOR,this.color||ai._defaultColor],[Ce.HIGHLIGHT_THICKNESS,this.#m||ai._defaultThickness],[Ce.HIGHLIGHT_FREE,this.#c]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(this.#u,{root:{fill:this.color,"fill-opacity":this.opacity}}),this.#s?.updateColor(this.color),super.onUpdatedColor()}#S(t){let e=(s,n)=>{this.color=s,this.opacity=n,this.onUpdatedColor()},a=this.color,i=this.opacity;this.addCommands({cmd:e.bind(this,t,ai._defaultOpacity),undo:e.bind(this,a,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ce.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(t)},!0)}#y(t){let e=this.#m,a=(i)=>{this.#m=i,this.#q(i)};this.addCommands({cmd:a.bind(this,t),undo:a.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ce.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}get toolbarButtons(){if(this._uiManager.highlightColors)return[["colorPicker",this.#s=new Rn({editor:this})]];return super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#F())}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,this.#F())}onceAdded(t){if(!this.annotationElementId)this.parent.addUndoableEditor(this);if(t)this.div.focus()}remove(){this.#k(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){if(!this.parent)return;if(super.rebuild(),this.div===null)return;if(this.#v(),!this.isAttachedToDOM)this.parent.add(this)}setParent(t){let e=!1;if(this.parent&&!t)this.#k();else if(t)this.#v(t),e=!this.parent&&this.div?.classList.contains("selectedEditor");if(super.setParent(t),this.show(this._isVisible),e)this.select()}#q(t){if(!this.#c)return;this.#w({highlightOutlines:this.#r.getNewOutline(t/2)}),this.fixAndSetPosition(),this.setDims()}#k(){if(this.#u===null||!this.parent)return;this.parent.drawLayer.remove(this.#u),this.#u=null,this.parent.drawLayer.remove(this.#b),this.#b=null}#v(t=this.parent){if(this.#u!==null)return;if({id:this.#u,clipPathId:this.#i}=t.drawLayer.draw({bbox:this.#r.box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:this.#c},path:{d:this.#r.toSVGPath()}},!1,!0),this.#b=t.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:this.#c},bbox:this.#l.box,path:{d:this.#l.toSVGPath()}},this.#c),this.#o)this.#o.style.clipPath=this.#i}static#_([t,e,a,i],s){switch(s){case 90:return[1-e-i,t,i,a];case 180:return[1-t-a,1-e-i,a,i];case 270:return[e,1-t-a,i,a]}return[t,e,a,i]}rotate(t){let{drawLayer:e}=this.parent,a;if(this.#c)t=(t-this.rotation+360)%360,a=ai.#_(this.#r.box,t);else a=ai.#_([this.x,this.y,this.width,this.height],t);e.updateProperties(this.#u,{bbox:a,root:{"data-main-rotation":t}}),e.updateProperties(this.#b,{bbox:ai.#_(this.#l.box,t),root:{"data-main-rotation":t}})}render(){if(this.div)return this.div;let t=super.render();if(this.#h)t.setAttribute("aria-label",this.#h),t.setAttribute("role","mark");if(this.#c)t.classList.add("free");else this.div.addEventListener("keydown",this.#B.bind(this),{signal:this._uiManager._signal});let e=this.#o=document.createElement("div");return t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=this.#i,this.setDims(),RF(this,this.#o,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){if(!this.isSelected)this.parent?.drawLayer.updateProperties(this.#b,{rootClass:{hovered:!0}})}pointerleave(){if(!this.isSelected)this.parent?.drawLayer.updateProperties(this.#b,{rootClass:{hovered:!1}})}#B(t){ai._keyboardManager.exec(this,t)}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:this.#O(!0);break;case 1:case 3:this.#O(!1);break}}#O(t){if(!this.#t)return;let e=window.getSelection();if(t)e.setPosition(this.#t,this.#e);else e.setPosition(this.#n,this.#f)}select(){if(super.select(),!this.#b)return;this.parent?.drawLayer.updateProperties(this.#b,{rootClass:{hovered:!1,selected:!0}})}unselect(){if(super.unselect(),!this.#b)return;if(this.parent?.drawLayer.updateProperties(this.#b,{rootClass:{selected:!1}}),!this.#c)this.#O(!1)}get _mustFixPosition(){return!this.#c}show(t=this._isVisible){if(super.show(t),this.parent)this.parent.drawLayer.updateProperties(this.#u,{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties(this.#b,{rootClass:{hidden:!t}})}#F(){return this.#c?this.rotation:0}#D(){if(this.#c)return null;let[t,e]=this.pageDimensions,[a,i]=this.pageTranslation,s=this.#a,n=new Float32Array(s.length*8),l=0;for(let{x:f,y:o,width:c,height:u}of s){let m=f*t+a,p=(1-o)*e+i;n[l]=n[l+4]=m,n[l+1]=n[l+3]=p,n[l+2]=n[l+6]=m+c*t,n[l+5]=n[l+7]=p-u*e,l+=8}return n}#T(t){return this.#r.serialize(t,this.#F())}static startHighlighting(t,e,{target:a,x:i,y:s}){let{x:n,y:l,width:f,height:o}=a.getBoundingClientRect(),c=new AbortController,u=t.combinedSignal(c),m=(p)=>{c.abort(),this.#R(t,p)};window.addEventListener("blur",m,{signal:u}),window.addEventListener("pointerup",m,{signal:u}),window.addEventListener("pointerdown",Ia,{capture:!0,passive:!1,signal:u}),window.addEventListener("contextmenu",Nn,{signal:u}),a.addEventListener("pointermove",this.#M.bind(this,t),{signal:u}),this._freeHighlight=new t6({x:i,y:s},[n,l,f,o],t.scale,this._defaultThickness/2,e,0.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static#M(t,e){if(this._freeHighlight.add(e))t.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}static#R(t,e){if(!this._freeHighlight.isEmpty())t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"});else t.drawLayer.remove(this._freeHighlightId);this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static async deserialize(t,e,a){let i=null;if(t instanceof bp){let{data:{quadPoints:d,rect:v,rotation:k,id:y,color:B,opacity:H,popupRef:M,richText:D,contentsObj:T,creationDate:z,modificationDate:E},parent:{page:{pageNumber:V}}}=t;i=t={annotationType:je.HIGHLIGHT,color:Array.from(B),opacity:H,quadPoints:d,boxes:null,pageIndex:V-1,rect:v.slice(0),rotation:k,annotationElementId:y,id:y,deleted:!1,popupRef:M,richText:D,comment:T?.str||null,creationDate:z,modificationDate:E}}else if(t instanceof j6){let{data:{inkLists:d,rect:v,rotation:k,id:y,color:B,borderStyle:{rawWidth:H},popupRef:M,richText:D,contentsObj:T,creationDate:z,modificationDate:E},parent:{page:{pageNumber:V}}}=t;i=t={annotationType:je.HIGHLIGHT,color:Array.from(B),thickness:H,inkLists:d,boxes:null,pageIndex:V-1,rect:v.slice(0),rotation:k,annotationElementId:y,id:y,deleted:!1,popupRef:M,richText:D,comment:T?.str||null,creationDate:z,modificationDate:E}}let{color:s,quadPoints:n,inkLists:l,outlines:f,opacity:o}=t,c=await super.deserialize(t,e,a);if(c.color=Nt.makeHexColor(...s),c.opacity=o||1,l)c.#m=t.thickness;if(c._initialData=i,t.comment)c.setCommentData(t);let[u,m]=c.pageDimensions,[p,w]=c.pageTranslation;if(n){let d=c.#a=[];for(let v=0;v<n.length;v+=8)d.push({x:(n[v]-p)/u,y:1-(n[v+1]-w)/m,width:(n[v+2]-n[v])/u,height:(n[v+1]-n[v+5])/m});c.#d(),c.#v(),c.rotate(c.rotation)}else if(l||f){c.#c=!0;let d=(l||f.points)[0],v={x:d[0]-p,y:m-(d[1]-w)},k=new t6(v,[0,0,u,m],1,c.#m/2,!0,0.001);for(let H=0,M=d.length;H<M;H+=2)v.x=d[H]-p,v.y=m-(d[H+1]-w),k.add(v);let{id:y,clipPathId:B}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:c.color,"fill-opacity":c._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:k.toSVGPath()}},!0,!0);c.#w({highlightOutlines:k.getOutlines(),highlightId:y,clipPathId:B}),c.#v(),c.rotate(c.parentRotation)}return c}serialize(t=!1){if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();let e=se._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),a=super.serialize(t);if(Object.assign(a,{color:e,opacity:this.opacity,thickness:this.#m,quadPoints:this.#D(),outlines:this.#T(a.rect)}),this.addComment(a),this.annotationElementId&&!this.#z(a))return null;return a.id=this.annotationElementId,a}#z(t){let{color:e}=this._initialData;return this.hasEditedComment||t.color.some((a,i)=>a!==e[i])}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;return t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null}static canCreateNewEmptyEditor(){return!1}}class qp{#t=Object.create(null);updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(!t)return;for(let[e,a]of Object.entries(t))if(!e.startsWith("_"))this.updateProperty(e,a)}updateSVGProperty(t,e){this.#t[t]=e}toSVGProperties(){let t=this.#t;return this.#t=Object.create(null),{root:t}}reset(){this.#t=Object.create(null)}updateAll(t=this){this.updateProperties(t)}clone(){Qe("Not implemented")}}class $e extends se{#t=null;#e;_colorPicker=null;_drawId=null;static _currentDrawId=-1;static _currentParent=null;static#a=null;static#i=null;static#s=null;static _INNER_MARGIN=3;constructor(t){super(t);this.#e=t.mustBeCommitted||!1,this._addOutlines(t)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){this._colorPicker?.updateOpacity?.(this.opacity)}_addOutlines(t){if(t.drawOutlines)this.#l(t),this.#o()}#l({drawOutlines:t,drawId:e,drawingOptions:a}){if(this.#t=t,this._drawingOptions||=a,!this.annotationElementId)this._uiManager.a11yAlert(se._l10nAlert[this.editorType]);if(e>=0)this._drawId=e,this.parent.drawLayer.finalizeDraw(e,t.defaultProperties);else this._drawId=this.#n(t,this.parent);this.#c(t.box)}#n(t,e){let{id:a}=e.drawLayer.draw($e._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1);return a}static _mergeSVGProperties(t,e){let a=new Set(Object.keys(t));for(let[i,s]of Object.entries(e))if(a.has(i))Object.assign(t[i],s);else t[i]=s;return t}static getDefaultDrawingOptions(t){Qe("Not implemented")}static get typesMap(){Qe("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(t,e){let a=this.typesMap.get(t);if(a)this._defaultDrawingOptions.updateProperty(a,e);if(this._currentParent)$e.#a.updateProperty(a,e),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties())}updateParams(t,e){let a=this.constructor.typesMap.get(t);if(a)this._updateProperty(t,a,e)}static get defaultPropertiesToUpdate(){let t=[],e=this._defaultDrawingOptions;for(let[a,i]of this.typesMap)t.push([a,e[i]]);return t}get propertiesToUpdate(){let t=[],{_drawingOptions:e}=this;for(let[a,i]of this.constructor.typesMap)t.push([a,e[i]]);return t}_updateProperty(t,e,a){let i=this._drawingOptions,s=i[e],n=(l)=>{i.updateProperty(e,l);let f=this.#t.updateProperty(e,l);if(f)this.#c(f);if(this.parent?.drawLayer.updateProperties(this._drawId,i.toSVGProperties()),t===this.colorType)this.onUpdatedColor();else if(t===this.opacityType)this.onUpdatedOpacity()};this.addCommands({cmd:n.bind(this,a),undo:n.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(t,e){let a=this.constructor.typesMap.get(this.colorType),i=this.constructor.typesMap.get(this.opacityType),s=this._drawingOptions,n=s[a],l=s[i],f=(o,c)=>{s.updateProperty(a,o),s.updateProperty(i,c),this.#t.updateProperty(a,o),this.#t.updateProperty(i,c),this.parent?.drawLayer.updateProperties(this._drawId,s.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:f.bind(this,t,e),undo:f.bind(this,n,l),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ce.INK_COLOR_AND_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,$e._mergeSVGProperties(this.#t.getPathResizingSVGProperties(this.#u()),{bbox:this.#g()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,$e._mergeSVGProperties(this.#t.getPathResizedSVGProperties(this.#u()),{bbox:this.#g()}))}_onTranslating(t,e){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#g()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,$e._mergeSVGProperties(this.#t.getPathTranslatedSVGProperties(this.#u(),this.parentDimensions),{bbox:this.#g()}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),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(t){if(!this.annotationElementId)this.parent.addUndoableEditor(this);if(this._isDraggable=!0,this.#e){if(this.#e=!1,this.commit(),this.parent.setSelected(this),t&&this.isOnScreen)this.div.focus()}}remove(){this.#f(),super.remove()}rebuild(){if(!this.parent)return;if(super.rebuild(),this.div===null)return;if(this.#o(),this.#c(this.#t.box),!this.isAttachedToDOM)this.parent.add(this)}setParent(t){let e=!1;if(this.parent&&!t)this._uiManager.removeShouldRescale(this),this.#f();else if(t)this._uiManager.addShouldRescale(this),this.#o(t),e=!this.parent&&this.div?.classList.contains("selectedEditor");if(super.setParent(t),e)this.select()}#f(){if(this._drawId===null||!this.parent)return;this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset()}#o(t=this.parent){if(this._drawId!==null&&this.parent===t)return;if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,t.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=this.#n(this.#t,t)}#r([t,e,a,i]){let{parentDimensions:[s,n],rotation:l}=this;switch(l){case 90:return[e,1-t,a*(n/s),i*(s/n)];case 180:return[1-t,1-e,a,i];case 270:return[1-e,t,a*(n/s),i*(s/n)];default:return[t,e,a,i]}}#u(){let{x:t,y:e,width:a,height:i,parentDimensions:[s,n],rotation:l}=this;switch(l){case 90:return[1-e,t,a*(s/n),i*(n/s)];case 180:return[1-t,1-e,a,i];case 270:return[e,1-t,a*(s/n),i*(n/s)];default:return[t,e,a,i]}}#c(t){if([this.x,this.y,this.width,this.height]=this.#r(t),this.div)this.fixAndSetPosition(),this.setDims();this._onResized()}#g(){let{x:t,y:e,width:a,height:i,rotation:s,parentRotation:n,parentDimensions:[l,f]}=this;switch((s*4+n)/90){case 1:return[1-e-i,t,i,a];case 2:return[1-t-a,1-e-i,a,i];case 3:return[e,1-t-a,i,a];case 4:return[t,e-a*(l/f),i*(f/l),a*(l/f)];case 5:return[1-e,t,a*(l/f),i*(f/l)];case 6:return[1-t-i*(f/l),1-e,i*(f/l),a*(l/f)];case 7:return[e-a*(l/f),1-t-i*(f/l),a*(l/f),i*(f/l)];case 8:return[t-a,e-i,a,i];case 9:return[1-e,t-a,i,a];case 10:return[1-t,1-e,a,i];case 11:return[e-i,1-t,i,a];case 12:return[t-i*(f/l),e,i*(f/l),a*(l/f)];case 13:return[1-e-a*(l/f),t-i*(f/l),a*(l/f),i*(f/l)];case 14:return[1-t,1-e-a*(l/f),i*(f/l),a*(l/f)];case 15:return[e,1-t,a*(l/f),i*(f/l)];default:return[t,e,a,i]}}rotate(){if(!this.parent)return;this.parent.drawLayer.updateProperties(this._drawId,$e._mergeSVGProperties({bbox:this.#g()},this.#t.updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){if(!this.parent)return;this.#c(this.#t.updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let t,e;if(this._isCopy)t=this.x,e=this.y;let a=super.render();a.classList.add("draw");let i=document.createElement("div");if(a.append(i),i.setAttribute("aria-hidden","true"),i.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy)this._moveAfterPaste(t,e);return a}static createDrawerInstance(t,e,a,i,s){Qe("Not implemented")}static startDrawing(t,e,a,i){let{target:s,offsetX:n,offsetY:l,pointerId:f,pointerType:o}=i;if(We.isInitializedAndDifferentPointerType(o))return;let{viewport:{rotation:c}}=t,{width:u,height:m}=s.getBoundingClientRect(),p=$e.#i=new AbortController,w=t.combinedSignal(p);if(We.setPointer(o,f),window.addEventListener("pointerup",(d)=>{if(We.isSamePointerIdOrRemove(d.pointerId))this._endDraw(d)},{signal:w}),window.addEventListener("pointercancel",(d)=>{if(We.isSamePointerIdOrRemove(d.pointerId))this._currentParent.endDrawingSession()},{signal:w}),window.addEventListener("pointerdown",(d)=>{if(!We.isSamePointerType(d.pointerType))return;if(We.initializeAndAddPointerId(d.pointerId),$e.#a.isCancellable())if($e.#a.removeLastElement(),$e.#a.isEmpty())this._currentParent.endDrawingSession(!0);else this._endDraw(null)},{capture:!0,passive:!1,signal:w}),window.addEventListener("contextmenu",Nn,{signal:w}),s.addEventListener("pointermove",this._drawMove.bind(this),{signal:w}),s.addEventListener("touchmove",(d)=>{if(We.isSameTimeStamp(d.timeStamp))Ia(d)},{signal:w}),t.toggleDrawing(),e._editorUndoBar?.hide(),$e.#a){t.drawLayer.updateProperties(this._currentDrawId,$e.#a.startNew(n,l,u,m,c));return}e.updateUIForDefaultProperties(this),$e.#a=this.createDrawerInstance(n,l,u,m,c),$e.#s=this.getDefaultDrawingOptions(),this._currentParent=t,{id:this._currentDrawId}=t.drawLayer.draw(this._mergeSVGProperties($e.#s.toSVGProperties(),$e.#a.defaultSVGProperties),!0,!1)}static _drawMove(t){if(We.isSameTimeStamp(t.timeStamp),!$e.#a)return;let{offsetX:e,offsetY:a,pointerId:i}=t;if(!We.isSamePointerId(i))return;if(We.isUsingMultiplePointers()){this._endDraw(t);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,$e.#a.add(e,a)),We.setTimeStamp(t.timeStamp),Ia(t)}static _cleanup(t){if(t)this._currentDrawId=-1,this._currentParent=null,$e.#a=null,$e.#s=null,We.clearTimeStamp();if($e.#i)$e.#i.abort(),$e.#i=null,We.clearPointerIds()}static _endDraw(t){let e=this._currentParent;if(!e)return;if(e.toggleDrawing(!0),this._cleanup(!1),t?.target===e.div)e.drawLayer.updateProperties(this._currentDrawId,$e.#a.end(t.offsetX,t.offsetY));if(this.supportMultipleDrawings){let a=$e.#a,i=this._currentDrawId,s=a.getLastElement();e.addCommands({cmd:()=>{e.drawLayer.updateProperties(i,a.setLastElement(s))},undo:()=>{e.drawLayer.updateProperties(i,a.removeLastElement())},mustExec:!1,type:Ce.DRAW_STEP});return}this.endDrawing(!1)}static endDrawing(t){let e=this._currentParent;if(!e)return null;if(e.toggleDrawing(!0),e.cleanUndoStack(Ce.DRAW_STEP),!$e.#a.isEmpty()){let{pageDimensions:[a,i],scale:s}=e,n=e.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:$e.#a.getOutlines(a*s,i*s,s,this._INNER_MARGIN),drawingOptions:$e.#s,mustBeCommitted:!t});return this._cleanup(!0),n}return e.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,e,a,i,s,n){Qe("Not implemented")}static async deserialize(t,e,a){let{rawDims:{pageWidth:i,pageHeight:s,pageX:n,pageY:l}}=e.viewport,f=this.deserializeDraw(n,l,i,s,this._INNER_MARGIN,t),o=await super.deserialize(t,e,a);return o.createDrawingOptions(t),o.#l({drawOutlines:f}),o.#o(),o.onScaleChanging(),o.rotate(),o}serializeDraw(t){let[e,a]=this.pageTranslation,[i,s]=this.pageDimensions;return this.#t.serialize([e,a,i,s],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}}class tO{#t=new Float64Array(6);#e;#a;#i;#s;#l;#n="";#f=0;#o=new Bh;#r;#u;constructor(t,e,a,i,s,n){this.#r=a,this.#u=i,this.#i=s,this.#s=n,[t,e]=this.#c(t,e);let l=this.#e=[NaN,NaN,NaN,NaN,t,e];this.#l=[t,e],this.#a=[{line:l,points:this.#l}],this.#t.set(l,0)}updateProperty(t,e){if(t==="stroke-width")this.#s=e}#c(t,e){return Jt._normalizePoint(t,e,this.#r,this.#u,this.#i)}isEmpty(){return!this.#a?.length}isCancellable(){return this.#l.length<=10}add(t,e){[t,e]=this.#c(t,e);let[a,i,s,n]=this.#t.subarray(2,6),l=t-s,f=e-n;if(Math.hypot(this.#r*l,this.#u*f)<=2)return null;if(this.#l.push(t,e),isNaN(a))return this.#t.set([s,n,t,e],2),this.#e.push(NaN,NaN,NaN,NaN,t,e),{path:{d:this.toSVGPath()}};if(isNaN(this.#t[0]))this.#e.splice(6,6);return this.#t.set([a,i,s,n,t,e],0),this.#e.push(...Jt.createBezierPoints(a,i,s,n,t,e)),{path:{d:this.toSVGPath()}}}end(t,e){let a=this.add(t,e);if(a)return a;if(this.#l.length===2)return{path:{d:this.toSVGPath()}};return null}startNew(t,e,a,i,s){this.#r=a,this.#u=i,this.#i=s,[t,e]=this.#c(t,e);let n=this.#e=[NaN,NaN,NaN,NaN,t,e];this.#l=[t,e];let l=this.#a.at(-1);if(l)l.line=new Float32Array(l.line),l.points=new Float32Array(l.points);return this.#a.push({line:n,points:this.#l}),this.#t.set(n,0),this.#f=0,this.toSVGPath(),null}getLastElement(){return this.#a.at(-1)}setLastElement(t){if(!this.#a)return this.#o.setLastElement(t);return this.#a.push(t),this.#e=t.line,this.#l=t.points,this.#f=0,{path:{d:this.toSVGPath()}}}removeLastElement(){if(!this.#a)return this.#o.removeLastElement();this.#a.pop(),this.#n="";for(let t=0,e=this.#a.length;t<e;t++){let{line:a,points:i}=this.#a[t];this.#e=a,this.#l=i,this.#f=0,this.toSVGPath()}return{path:{d:this.#n}}}toSVGPath(){let t=Jt.svgRound(this.#e[4]),e=Jt.svgRound(this.#e[5]);if(this.#l.length===2)return this.#n=`${this.#n} M ${t} ${e} Z`,this.#n;if(this.#l.length<=6){let i=this.#n.lastIndexOf("M");this.#n=`${this.#n.slice(0,i)} M ${t} ${e}`,this.#f=6}if(this.#l.length===4){let i=Jt.svgRound(this.#e[10]),s=Jt.svgRound(this.#e[11]);return this.#n=`${this.#n} L ${i} ${s}`,this.#f=12,this.#n}let a=[];if(this.#f===0)a.push(`M ${t} ${e}`),this.#f=6;for(let i=this.#f,s=this.#e.length;i<s;i+=6){let[n,l,f,o,c,u]=this.#e.slice(i,i+6).map(Jt.svgRound);a.push(`C${n} ${l} ${f} ${o} ${c} ${u}`)}return this.#n+=a.join(" "),this.#f=this.#e.length,this.#n}getOutlines(t,e,a,i){let s=this.#a.at(-1);return s.line=new Float32Array(s.line),s.points=new Float32Array(s.points),this.#o.build(this.#a,t,e,a,this.#i,this.#s,i),this.#t=null,this.#e=null,this.#a=null,this.#n=null,this.#o}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}class Bh extends Jt{#t;#e=0;#a;#i;#s;#l;#n;#f;#o;build(t,e,a,i,s,n,l){this.#s=e,this.#l=a,this.#n=i,this.#f=s,this.#o=n,this.#a=l??0,this.#i=t,this.#c()}get thickness(){return this.#o}setLastElement(t){return this.#i.push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#i.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let t=[];for(let{line:e}of this.#i){if(t.push(`M${Jt.svgRound(e[4])} ${Jt.svgRound(e[5])}`),e.length===6){t.push("Z");continue}if(e.length===12&&isNaN(e[6])){t.push(`L${Jt.svgRound(e[10])} ${Jt.svgRound(e[11])}`);continue}for(let a=6,i=e.length;a<i;a+=6){let[s,n,l,f,o,c]=e.subarray(a,a+6).map(Jt.svgRound);t.push(`C${s} ${n} ${l} ${f} ${o} ${c}`)}}return t.join("")}serialize([t,e,a,i],s){let n=[],l=[],[f,o,c,u]=this.#u(),m,p,w,d,v,k,y,B,H;switch(this.#f){case 0:H=Jt._rescale,m=t,p=e+i,w=a,d=-i,v=t+f*a,k=e+(1-o-u)*i,y=t+(f+c)*a,B=e+(1-o)*i;break;case 90:H=Jt._rescaleAndSwap,m=t,p=e,w=a,d=i,v=t+o*a,k=e+f*i,y=t+(o+u)*a,B=e+(f+c)*i;break;case 180:H=Jt._rescale,m=t+a,p=e,w=-a,d=i,v=t+(1-f-c)*a,k=e+o*i,y=t+(1-f)*a,B=e+(o+u)*i;break;case 270:H=Jt._rescaleAndSwap,m=t+a,p=e+i,w=-a,d=-i,v=t+(1-o-u)*a,k=e+(1-f-c)*i,y=t+(1-o)*a,B=e+(1-f)*i;break}for(let{line:M,points:D}of this.#i)n.push(H(M,m,p,w,d,s?Array(M.length):null)),l.push(H(D,m,p,w,d,s?Array(D.length):null));return{lines:n,points:l,rect:[v,k,y,B]}}static deserialize(t,e,a,i,s,{paths:{lines:n,points:l},rotation:f,thickness:o}){let c=[],u,m,p,w,d;switch(f){case 0:d=Jt._rescale,u=-t/a,m=e/i+1,p=1/a,w=-1/i;break;case 90:d=Jt._rescaleAndSwap,u=-e/i,m=-t/a,p=1/i,w=1/a;break;case 180:d=Jt._rescale,u=t/a+1,m=-e/i,p=-1/a,w=1/i;break;case 270:d=Jt._rescaleAndSwap,u=e/i+1,m=t/a+1,p=-1/i,w=-1/a;break}if(!n){n=[];for(let k of l){let y=k.length;if(y===2){n.push(new Float32Array([NaN,NaN,NaN,NaN,k[0],k[1]]));continue}if(y===4){n.push(new Float32Array([NaN,NaN,NaN,NaN,k[0],k[1],NaN,NaN,NaN,NaN,k[2],k[3]]));continue}let B=new Float32Array(3*(y-2));n.push(B);let[H,M,D,T]=k.subarray(0,4);B.set([NaN,NaN,NaN,NaN,H,M],0);for(let z=4;z<y;z+=2){let E=k[z],V=k[z+1];B.set(Jt.createBezierPoints(H,M,D,T,E,V),(z-2)*3),[H,M,D,T]=[D,T,E,V]}}}for(let k=0,y=n.length;k<y;k++)c.push({line:d(n[k].map((B)=>B??NaN),u,m,p,w),points:d(l[k].map((B)=>B??NaN),u,m,p,w)});let v=new this.prototype.constructor;return v.build(c,a,i,1,f,o,s),v}#r(t=this.#o){let e=this.#a+t/2*this.#n;return this.#f%180===0?[e/this.#s,e/this.#l]:[e/this.#l,e/this.#s]}#u(){let[t,e,a,i]=this.#t,[s,n]=this.#r(0);return[t+s,e+n,a-2*s,i-2*n]}#c(){let t=this.#t=lr.slice();for(let{line:i}of this.#i){if(i.length<=12){for(let l=4,f=i.length;l<f;l+=6)Nt.pointBoundingBox(i[l],i[l+1],t);continue}let s=i[4],n=i[5];for(let l=6,f=i.length;l<f;l+=6){let[o,c,u,m,p,w]=i.subarray(l,l+6);Nt.bezierBoundingBox(s,n,o,c,u,m,p,w,t),s=p,n=w}}let[e,a]=this.#r();t[0]=_a(t[0]-e,0,1),t[1]=_a(t[1]-a,0,1),t[2]=_a(t[2]+e,0,1),t[3]=_a(t[3]+a,0,1),t[2]-=t[0],t[3]-=t[1]}get box(){return this.#t}updateProperty(t,e){if(t==="stroke-width")return this.#g(e);return null}#g(t){let[e,a]=this.#r();this.#o=t;let[i,s]=this.#r(),[n,l]=[i-e,s-a],f=this.#t;return f[0]-=n,f[1]-=l,f[2]+=2*n,f[3]+=2*l,f}updateParentDimensions([t,e],a){let[i,s]=this.#r();this.#s=t,this.#l=e,this.#n=a;let[n,l]=this.#r(),f=n-i,o=l-s,c=this.#t;return c[0]-=f,c[1]-=o,c[2]+=2*f,c[3]+=2*o,c}updateRotation(t){return this.#e=t,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#t.map(Jt.svgRound).join(" ")}get defaultProperties(){let[t,e]=this.#t;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Jt.svgRound(t)} ${Jt.svgRound(e)}`}}}get rotationTransform(){let[,,t,e]=this.#t,a=0,i=0,s=0,n=0,l=0,f=0;switch(this.#e){case 90:i=e/t,s=-t/e,l=t;break;case 180:a=-1,n=-1,l=t,f=e;break;case 270:i=-e/t,s=t/e,f=e;break;default:return""}return`matrix(${a} ${i} ${s} ${n} ${Jt.svgRound(l)} ${Jt.svgRound(f)})`}getPathResizingSVGProperties([t,e,a,i]){let[s,n]=this.#r(),[l,f,o,c]=this.#t;if(Math.abs(o-s)<=Jt.PRECISION||Math.abs(c-n)<=Jt.PRECISION){let d=t+a/2-(l+o/2),v=e+i/2-(f+c/2);return{path:{"transform-origin":`${Jt.svgRound(t)} ${Jt.svgRound(e)}`,transform:`${this.rotationTransform} translate(${d} ${v})`}}}let u=(a-2*s)/(o-2*s),m=(i-2*n)/(c-2*n),p=o/a,w=c/i;return{path:{"transform-origin":`${Jt.svgRound(l)} ${Jt.svgRound(f)}`,transform:`${this.rotationTransform} scale(${p} ${w}) translate(${Jt.svgRound(s)} ${Jt.svgRound(n)}) scale(${u} ${m}) translate(${Jt.svgRound(-s)} ${Jt.svgRound(-n)})`}}}getPathResizedSVGProperties([t,e,a,i]){let[s,n]=this.#r(),l=this.#t,[f,o,c,u]=l;if(l[0]=t,l[1]=e,l[2]=a,l[3]=i,Math.abs(c-s)<=Jt.PRECISION||Math.abs(u-n)<=Jt.PRECISION){let v=t+a/2-(f+c/2),k=e+i/2-(o+u/2);for(let{line:y,points:B}of this.#i)Jt._translate(y,v,k,y),Jt._translate(B,v,k,B);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Jt.svgRound(t)} ${Jt.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let m=(a-2*s)/(c-2*s),p=(i-2*n)/(u-2*n),w=-m*(f+s)+t+s,d=-p*(o+n)+e+n;if(m!==1||p!==1||w!==0||d!==0)for(let{line:v,points:k}of this.#i)Jt._rescale(v,w,d,m,p,v),Jt._rescale(k,w,d,m,p,k);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Jt.svgRound(t)} ${Jt.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([t,e],a){let[i,s]=a,n=this.#t,l=t-n[0],f=e-n[1];if(this.#s===i&&this.#l===s)for(let{line:o,points:c}of this.#i)Jt._translate(o,l,f,o),Jt._translate(c,l,f,c);else{let o=this.#s/i,c=this.#l/s;this.#s=i,this.#l=s;for(let{line:u,points:m}of this.#i)Jt._rescale(u,l,f,o,c,u),Jt._rescale(m,l,f,o,c,m);n[2]*=o,n[3]*=c}return n[0]=t,n[1]=e,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${Jt.svgRound(t)} ${Jt.svgRound(e)}`}}}get defaultSVGProperties(){let t=this.#t;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${Jt.svgRound(t[0])} ${Jt.svgRound(t[1])}`,transform:this.rotationTransform||null},bbox:t}}}class d6 extends qp{constructor(t){super();this._viewParameters=t,super.updateProperties({fill:"none",stroke:se._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(t,e){if(t==="stroke-width")e??=this["stroke-width"],e*=this._viewParameters.realScale;super.updateSVGProperty(t,e)}clone(){let t=new d6(this._viewParameters);return t.updateAll(this),t}}class Ap extends $e{static _type="ink";static _editorType=je.INK;static _defaultDrawingOptions=null;constructor(t){super({...t,name:"inkEditor"});this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(t,e){se.initialize(t,e),this._defaultDrawingOptions=new d6(e.viewParameters)}static getDefaultDrawingOptions(t){let e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!0}static get typesMap(){return be(this,"typesMap",new Map([[Ce.INK_THICKNESS,"stroke-width"],[Ce.INK_COLOR,"stroke"],[Ce.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(t,e,a,i,s){return new tO(t,e,a,i,s,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,e,a,i,s,n){return Bh.deserialize(t,e,a,i,s,n)}static async deserialize(t,e,a){let i=null;if(t instanceof j6){let{data:{inkLists:n,rect:l,rotation:f,id:o,color:c,opacity:u,borderStyle:{rawWidth:m},popupRef:p,richText:w,contentsObj:d,creationDate:v,modificationDate:k},parent:{page:{pageNumber:y}}}=t;i=t={annotationType:je.INK,color:Array.from(c),thickness:m,opacity:u,paths:{points:n},boxes:null,pageIndex:y-1,rect:l.slice(0),rotation:f,annotationElementId:o,id:o,deleted:!1,popupRef:p,richText:w,comment:d?.str||null,creationDate:v,modificationDate:k}}let s=await super.deserialize(t,e,a);if(s._initialData=i,t.comment)s.setCommentData(t);return s}get toolbarButtons(){return this._colorPicker||=new b9(this),[["colorPicker",this._colorPicker]]}get colorType(){return Ce.INK_COLOR}get colorAndOpacityType(){return Ce.INK_COLOR_AND_OPACITY}get opacityType(){return Ce.INK_OPACITY}updateParams(t,e){if(t===Ce.INK_COLOR_AND_OPACITY){this._updateColorAndOpacity(e.color,e.opacity);return}super.updateParams(t,e)}static updateDefaultParams(t,e){if(t===Ce.INK_COLOR_AND_OPACITY){super.updateDefaultParams(Ce.INK_COLOR,e.color),super.updateDefaultParams(Ce.INK_OPACITY,e.opacity);return}super.updateDefaultParams(t,e)}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();let{_drawId:t,_drawingOptions:e,parent:a}=this;e.updateSVGProperty("stroke-width"),a.drawLayer.updateProperties(t,e.toSVGProperties())}static onScaleChangingWhenDrawing(){let t=this._currentParent;if(!t)return;super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties())}createDrawingOptions({color:t,thickness:e,opacity:a}){this._drawingOptions=Ap.getDefaultDrawingOptions({stroke:Nt.makeHexColor(...t),"stroke-width":e,"stroke-opacity":a})}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:e,points:a}=this.serializeDraw(t),{_drawingOptions:{stroke:i,"stroke-opacity":s,"stroke-width":n}}=this,l=Object.assign(super.serialize(t),{color:se._colorManager.convert(i),opacity:s,thickness:n,paths:{lines:e,points:a}});if(this.addComment(l),t)return l.isCopy=!0,l;if(this.annotationElementId&&!this.#t(l))return null;return l.id=this.annotationElementId,l}#t(t){let{color:e,thickness:a,opacity:i,pageIndex:s}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||t.color.some((n,l)=>n!==e[l])||t.thickness!==a||t.opacity!==i||t.pageIndex!==s}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let{points:e,rect:a}=this.serializeDraw(!1);return t.updateEdited({rect:a,thickness:this._drawingOptions["stroke-width"],points:e,popup:this.comment}),null}}class e6 extends Bh{toSVGPath(){let t=super.toSVGPath();if(!t.endsWith("Z"))t+="Z";return t}}var U3=8,l9=3;class nr{static#t={maxDim:512,sigmaSFactor:0.02,sigmaR:25,kernelSize:16};static#e(t,e,a,i){if(a-=t,i-=e,a===0)return i>0?0:4;if(a===1)return i+6;return 2-i}static#a=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static#i(t,e,a,i,s,n,l){let f=this.#e(a,i,s,n);for(let o=0;o<8;o++){let c=(-o+f-l+16)%8,u=this.#a[2*c],m=this.#a[2*c+1];if(t[(a+u)*e+(i+m)]!==0)return c}return-1}static#s(t,e,a,i,s,n,l){let f=this.#e(a,i,s,n);for(let o=0;o<8;o++){let c=(o+f+l+16)%8,u=this.#a[2*c],m=this.#a[2*c+1];if(t[(a+u)*e+(i+m)]!==0)return c}return-1}static#l(t,e,a,i){let s=t.length,n=new Int32Array(s);for(let c=0;c<s;c++)n[c]=t[c]<=i?1:0;for(let c=1;c<a-1;c++)n[c*e]=n[c*e+e-1]=0;for(let c=0;c<e;c++)n[c]=n[e*a-1-c]=0;let l=1,f,o=[];for(let c=1;c<a-1;c++){f=1;for(let u=1;u<e-1;u++){let m=c*e+u,p=n[m];if(p===0)continue;let w=c,d=u;if(p===1&&n[m-1]===0)l+=1,d-=1;else if(p>=1&&n[m+1]===0){if(l+=1,d+=1,p>1)f=p}else{if(p!==1)f=Math.abs(p);continue}let v=[u,c],k=d===u+1,y={isHole:k,points:v,id:l,parent:0};o.push(y);let B;for(let tt of o)if(tt.id===f){B=tt;break}if(!B)y.parent=k?f:0;else if(B.isHole)y.parent=k?B.parent:f;else y.parent=k?f:B.parent;let H=this.#i(n,e,c,u,w,d,0);if(H===-1){if(n[m]=-l,n[m]!==1)f=Math.abs(n[m]);continue}let M=this.#a[2*H],D=this.#a[2*H+1],T=c+M,z=u+D;w=T,d=z;let E=c,V=u;while(!0){let tt=this.#s(n,e,E,V,w,d,1);M=this.#a[2*tt],D=this.#a[2*tt+1];let at=E+M,Q=V+D;v.push(Q,at);let Z=E*e+V;if(n[Z+1]===0)n[Z]=-l;else if(n[Z]===1)n[Z]=l;if(at===c&&Q===u&&E===T&&V===z){if(n[m]!==1)f=Math.abs(n[m]);break}else w=E,d=V,E=at,V=Q}}}return o}static#n(t,e,a,i){if(a-e<=4){for(let T=e;T<a-2;T+=2)i.push(t[T],t[T+1]);return}let s=t[e],n=t[e+1],l=t[a-4]-s,f=t[a-3]-n,o=Math.hypot(l,f),c=l/o,u=f/o,m=c*n-u*s,p=f/l,w=1/o,d=Math.atan(p),v=Math.cos(d),k=Math.sin(d),y=w*(Math.abs(v)+Math.abs(k)),B=w*(1-y+y**2),H=Math.max(Math.atan(Math.abs(k+v)*B),Math.atan(Math.abs(k-v)*B)),M=0,D=e;for(let T=e+2;T<a-2;T+=2){let z=Math.abs(m-c*t[T+1]+u*t[T]);if(z>M)D=T,M=z}if(M>(o*H)**2)this.#n(t,e,D+2,i),this.#n(t,D,a,i);else i.push(s,n)}static#f(t){let e=[],a=t.length;return this.#n(t,0,a,e),e.push(t[a-2],t[a-1]),e.length<=4?null:e}static#o(t,e,a,i,s,n){let l=new Float32Array(n**2),f=-2*i**2,o=n>>1;for(let d=0;d<n;d++){let v=(d-o)**2;for(let k=0;k<n;k++)l[d*n+k]=Math.exp((v+(k-o)**2)/f)}let c=new Float32Array(256),u=-2*s**2;for(let d=0;d<256;d++)c[d]=Math.exp(d**2/u);let m=t.length,p=new Uint8Array(m),w=new Uint32Array(256);for(let d=0;d<a;d++)for(let v=0;v<e;v++){let k=d*e+v,y=t[k],B=0,H=0;for(let D=0;D<n;D++){let T=d+D-o;if(T<0||T>=a)continue;for(let z=0;z<n;z++){let E=v+z-o;if(E<0||E>=e)continue;let V=t[T*e+E],tt=l[D*n+z]*c[Math.abs(V-y)];B+=V*tt,H+=tt}}let M=p[k]=Math.round(B/H);w[M]++}return[p,w]}static#r(t){let e=new Uint32Array(256);for(let a of t)e[a]++;return e}static#u(t){let e=t.length,a=new Uint8ClampedArray(e>>2),i=-1/0,s=1/0;for(let l=0,f=a.length;l<f;l++){let o=a[l]=t[l<<2];i=Math.max(i,o),s=Math.min(s,o)}let n=255/(i-s);for(let l=0,f=a.length;l<f;l++)a[l]=(a[l]-s)*n;return a}static#c(t){let e,a=-1/0,i=-1/0,s=t.findIndex((f)=>f!==0),n=s,l=s;for(e=s;e<256;e++){let f=t[e];if(f>a){if(e-n>i)i=e-n,l=e-1;a=f,n=e}}for(e=l-1;e>=0;e--)if(t[e]>t[e+1])break;return e}static#g(t){let e=t,{width:a,height:i}=t,{maxDim:s}=this.#t,n=a,l=i;if(a>s||i>s){let m=a,p=i,w=Math.log2(Math.max(a,i)/s),d=Math.floor(w);w=w===d?d-1:d;for(let k=0;k<w;k++){n=Math.ceil(m/2),l=Math.ceil(p/2);let y=new OffscreenCanvas(n,l);if(y.getContext("2d").drawImage(t,0,0,m,p,0,0,n,l),m=n,p=l,t!==e)t.close();t=y.transferToImageBitmap()}let v=Math.min(s/n,s/l);n=Math.round(n*v),l=Math.round(l*v)}let o=new OffscreenCanvas(n,l).getContext("2d",{willReadFrequently:!0});o.fillStyle="white",o.fillRect(0,0,n,l),o.filter="grayscale(1)",o.drawImage(t,0,0,t.width,t.height,0,0,n,l);let c=o.getImageData(0,0,n,l).data;return[this.#u(c),n,l]}static extractContoursFromText(t,{fontFamily:e,fontStyle:a,fontWeight:i},s,n,l,f){let o=new OffscreenCanvas(1,1),c=o.getContext("2d",{alpha:!1}),u=200,m=c.font=`${a} ${i} ${u}px ${e}`,{actualBoundingBoxLeft:p,actualBoundingBoxRight:w,actualBoundingBoxAscent:d,actualBoundingBoxDescent:v,fontBoundingBoxAscent:k,fontBoundingBoxDescent:y,width:B}=c.measureText(t),H=1.5,M=Math.ceil(Math.max(Math.abs(p)+Math.abs(w)||0,B)*H),D=Math.ceil(Math.max(Math.abs(d)+Math.abs(v)||u,Math.abs(k)+Math.abs(y)||u)*H);o=new OffscreenCanvas(M,D),c=o.getContext("2d",{alpha:!0,willReadFrequently:!0}),c.font=m,c.filter="grayscale(1)",c.fillStyle="white",c.fillRect(0,0,M,D),c.fillStyle="black",c.fillText(t,M*(H-1)/2,D*(3-H)/2);let T=this.#u(c.getImageData(0,0,M,D).data),z=this.#r(T),E=this.#c(z),V=this.#l(T,M,D,E);return this.processDrawnLines({lines:{curves:V,width:M,height:D},pageWidth:s,pageHeight:n,rotation:l,innerMargin:f,mustSmooth:!0,areContours:!0})}static process(t,e,a,i,s){let[n,l,f]=this.#g(t),[o,c]=this.#o(n,l,f,Math.hypot(l,f)*this.#t.sigmaSFactor,this.#t.sigmaR,this.#t.kernelSize),u=this.#c(c),m=this.#l(o,l,f,u);return this.processDrawnLines({lines:{curves:m,width:l,height:f},pageWidth:e,pageHeight:a,rotation:i,innerMargin:s,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:t,pageWidth:e,pageHeight:a,rotation:i,innerMargin:s,mustSmooth:n,areContours:l}){if(i%180!==0)[e,a]=[a,e];let{curves:f,width:o,height:c}=t,u=t.thickness??0,m=[],p=Math.min(e/o,a/c),w=p/e,d=p/a,v=[];for(let{points:y}of f){let B=n?this.#f(y):y;if(!B)continue;v.push(B);let H=B.length,M=new Float32Array(H),D=new Float32Array(3*(H===2?2:H-2));if(m.push({line:D,points:M}),H===2){M[0]=B[0]*w,M[1]=B[1]*d,D.set([NaN,NaN,NaN,NaN,M[0],M[1]],0);continue}let[T,z,E,V]=B;T*=w,z*=d,E*=w,V*=d,M.set([T,z,E,V],0),D.set([NaN,NaN,NaN,NaN,T,z],0);for(let tt=4;tt<H;tt+=2){let at=M[tt]=B[tt]*w,Q=M[tt+1]=B[tt+1]*d;D.set(Jt.createBezierPoints(T,z,E,V,at,Q),(tt-2)*3),[T,z,E,V]=[E,V,at,Q]}}if(m.length===0)return null;let k=l?new e6:new Bh;return k.build(m,e,a,1,i,l?0:u,s),{outline:k,newCurves:v,areContours:l,thickness:u,width:o,height:c}}static async compressSignature({outlines:t,areContours:e,thickness:a,width:i,height:s}){let n=1/0,l=-1/0,f=0;for(let y of t){f+=y.length;for(let B=2,H=y.length;B<H;B++){let M=y[B]-y[B-2];n=Math.min(n,M),l=Math.max(l,M)}}let o;if(n>=-128&&l<=127)o=Int8Array;else if(n>=-32768&&l<=32767)o=Int16Array;else o=Int32Array;let c=t.length,u=U3+l9*c,m=new Uint32Array(u),p=0;m[p++]=u*Uint32Array.BYTES_PER_ELEMENT+(f-2*c)*o.BYTES_PER_ELEMENT,m[p++]=0,m[p++]=i,m[p++]=s,m[p++]=e?0:1,m[p++]=Math.max(0,Math.floor(a??0)),m[p++]=c,m[p++]=o.BYTES_PER_ELEMENT;for(let y of t)m[p++]=y.length-2,m[p++]=y[0],m[p++]=y[1];let w=new CompressionStream("deflate-raw"),d=w.writable.getWriter();await d.ready,d.write(m);let v=o.prototype.constructor;for(let y of t){let B=new v(y.length-2);for(let H=2,M=y.length;H<M;H++)B[H-2]=y[H]-y[H-2];d.write(B)}return d.close(),(await new Response(w.readable).bytes()).toBase64()}static async decompressSignature(t){try{let e=Uint8Array.fromBase64(t),{readable:a,writable:i}=new DecompressionStream("deflate-raw"),s=i.getWriter();await s.ready,s.write(e).then(async()=>{await s.ready,await s.close()}).catch(()=>{});let n=null,l=0;for await(let B of a)n||=new Uint8Array(new Uint32Array(B.buffer,0,4)[0]),n.set(B,l),l+=B.length;let f=new Uint32Array(n.buffer,0,n.length>>2),o=f[1];if(o!==0)throw Error(`Invalid version: ${o}`);let c=f[2],u=f[3],m=f[4]===0,p=f[5],w=f[6],d=f[7],v=[],k=(U3+l9*w)*Uint32Array.BYTES_PER_ELEMENT,y;switch(d){case Int8Array.BYTES_PER_ELEMENT:y=new Int8Array(n.buffer,k);break;case Int16Array.BYTES_PER_ELEMENT:y=new Int16Array(n.buffer,k);break;case Int32Array.BYTES_PER_ELEMENT:y=new Int32Array(n.buffer,k);break}l=0;for(let B=0;B<w;B++){let H=f[l9*B+U3],M=new Float32Array(H+2);v.push(M);for(let D=0;D<l9-1;D++)M[D]=f[l9*B+U3+D+1];for(let D=0;D<H;D++)M[D+2]=M[D]+y[l++]}return{areContours:m,thickness:p,outlines:v,width:c,height:u}}catch(e){return de(`decompressSignature: ${e}`),null}}}class vp extends qp{constructor(){super();super.updateProperties({fill:se._defaultLineColor,"stroke-width":0})}clone(){let t=new vp;return t.updateAll(this),t}}class Sp extends d6{constructor(t){super(t);super.updateProperties({stroke:se._defaultLineColor,"stroke-width":1})}clone(){let t=new Sp(this._viewParameters);return t.updateAll(this),t}}class D0 extends $e{#t=!1;#e=null;#a=null;#i=null;static _type="signature";static _editorType=je.SIGNATURE;static _defaultDrawingOptions=null;constructor(t){super({...t,mustBeCommitted:!0,name:"signatureEditor"});this._willKeepAspectRatio=!0,this.#a=t.signatureData||null,this.#e=null,this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(t,e){se.initialize(t,e),this._defaultDrawingOptions=new vp,this._defaultDrawnSignatureOptions=new Sp(e.viewParameters)}static getDefaultDrawingOptions(t){let e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!1}static get typesMap(){return be(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!this.#e}}static computeTelemetryFinalData(t){let e=t.get("hasDescription");return{hasAltText:e.get(!0)??0,hasNoAltText:e.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){if(this._drawId===null)return;super.onScaleChanging()}render(){if(this.div)return this.div;let t,e,{_isCopy:a}=this;if(a)this._isCopy=!1,t=this.x,e=this.y;if(super.render(),this._drawId===null)if(this.#a){let{lines:i,mustSmooth:s,areContours:n,description:l,uuid:f,heightInPage:o}=this.#a,{rawDims:{pageWidth:c,pageHeight:u},rotation:m}=this.parent.viewport,p=nr.processDrawnLines({lines:i,pageWidth:c,pageHeight:u,rotation:m,innerMargin:D0._INNER_MARGIN,mustSmooth:s,areContours:n});this.addSignature(p,o,l,f)}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.#e||""}));if(a)this._isCopy=!0,this._moveAfterPaste(t,e);return this.div}setUuid(t){this.#i=t,this.addEditToolbar()}getUuid(){return this.#i}get description(){return this.#e}set description(t){if(this.#e=t,!this.div)return;this.div.setAttribute("data-l10n-args",JSON.stringify({description:t})),super.addEditToolbar().then((e)=>{e?.updateEditSignatureButton(t)})}getSignaturePreview(){let{newCurves:t,areContours:e,thickness:a,width:i,height:s}=this.#a,n=Math.max(i,s),l=nr.processDrawnLines({lines:{curves:t.map((f)=>({points:f})),thickness:a,width:i,height:s},pageWidth:n,pageHeight:n,rotation:0,innerMargin:0,mustSmooth:!1,areContours:e});return{areContours:e,outline:l.outline}}get toolbarButtons(){if(this._uiManager.signatureManager)return[["editSignature",this._uiManager.signatureManager]];return super.toolbarButtons}addSignature(t,e,a,i){let{x:s,y:n}=this,{outline:l}=this.#a=t;this.#t=l instanceof e6,this.description=a;let f;if(this.#t)f=D0.getDefaultDrawingOptions();else f=D0._defaultDrawnSignatureOptions.clone(),f.updateProperties({"stroke-width":l.thickness});this._addOutlines({drawOutlines:l,drawingOptions:f});let[,o]=this.pageDimensions,c=e/o;if(c=c>=1?0.5:c,this.width*=c/this.height,this.width>=1)c*=0.9/this.width,this.width=0.9;this.height=c,this.setDims(),this.x=s,this.y=n,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(i),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!i,hasDescription:!!a}}),this.div.hidden=!1}getFromImage(t){let{rawDims:{pageWidth:e,pageHeight:a},rotation:i}=this.parent.viewport;return nr.process(t,e,a,i,D0._INNER_MARGIN)}getFromText(t,e){let{rawDims:{pageWidth:a,pageHeight:i},rotation:s}=this.parent.viewport;return nr.extractContoursFromText(t,e,a,i,s,D0._INNER_MARGIN)}getDrawnSignature(t){let{rawDims:{pageWidth:e,pageHeight:a},rotation:i}=this.parent.viewport;return nr.processDrawnLines({lines:t,pageWidth:e,pageHeight:a,rotation:i,innerMargin:D0._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:e}){if(t)this._drawingOptions=D0.getDefaultDrawingOptions();else this._drawingOptions=D0._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":e})}serialize(t=!1){if(this.isEmpty())return null;let{lines:e,points:a}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":i}}=this,s=Object.assign(super.serialize(t),{isSignature:!0,areContours:this.#t,color:[0,0,0],thickness:this.#t?0:i});if(this.addComment(s),t)s.paths={lines:e,points:a},s.uuid=this.#i,s.isCopy=!0;else s.lines=e;if(this.#e)s.accessibilityData={type:"Figure",alt:this.#e};return s}static deserializeDraw(t,e,a,i,s,n){if(n.areContours)return e6.deserialize(t,e,a,i,s,n);return Bh.deserialize(t,e,a,i,s,n)}static async deserialize(t,e,a){let i=await super.deserialize(t,e,a);return i.#t=t.areContours,i.description=t.accessibilityData?.alt||"",i.#i=t.uuid,i}}class eO extends se{#t=null;#e=null;#a=null;#i=null;#s=null;#l="";#n=null;#f=!1;#o=null;#r=!1;#u=!1;static _type="stamp";static _editorType=je.STAMP;constructor(t){super({...t,name:"stampEditor"});this.#i=t.bitmapUrl,this.#s=t.bitmapFile,this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,e){se.initialize(t,e)}static isHandlingMimeForPasting(t){return Kb.includes(t)}static paste(t,e){e.pasteEditor({mode:je.STAMP},{bitmapFile:t.getAsFile()})}altTextFinish(){if(this._uiManager.useNewAltTextFlow)this.div.hidden=!1;super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(t){let e=t.get("hasAltText");return{hasAltText:e.get(!0)??0,hasNoAltText:e.get(!1)??0}}#c(t,e=!1){if(!t){this.remove();return}if(this.#t=t.bitmap,!e)this.#e=t.id,this.#r=t.isSvg;if(t.file)this.#l=t.file.name;this.#b()}#g(){if(this.#a=null,this._uiManager.enableWaiting(!1),!this.#n)return;if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#t){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#t){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(t=null,e=!0){if(this.hasAltTextData())return null;let{mlManager:a}=this._uiManager;if(!a)throw Error("No ML.");if(!await a.isEnabledFor("altText"))throw Error("ML isn't enabled for alt text.");let{data:i,width:s,height:n}=t||this.copyCanvas(null,null,!0).imageData,l=await a.guess({name:"altText",request:{data:i,width:s,height:n,channels:i.length/(s*n)}});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 f=l.output;if(await this.setGuessedAltText(f),e&&!this.hasAltTextData())this.altTextData={alt:f,decorative:!1};return f}#p(){if(this.#e){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#e).then((a)=>this.#c(a,!0)).finally(()=>this.#g());return}if(this.#i){let a=this.#i;this.#i=null,this._uiManager.enableWaiting(!0),this.#a=this._uiManager.imageManager.getFromUrl(a).then((i)=>this.#c(i)).finally(()=>this.#g());return}if(this.#s){let a=this.#s;this.#s=null,this._uiManager.enableWaiting(!0),this.#a=this._uiManager.imageManager.getFromFile(a).then((i)=>this.#c(i)).finally(()=>this.#g());return}let t=document.createElement("input");t.type="file",t.accept=Kb.join(",");let e=this._uiManager._signal;this.#a=new Promise((a)=>{t.addEventListener("change",async()=>{if(!t.files||t.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let i=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#c(i)}a()},{signal:e}),t.addEventListener("cancel",()=>{this.remove(),a()},{signal:e})}).finally(()=>this.#g()),t.click()}remove(){if(this.#e){if(this.#t=null,this._uiManager.imageManager.deleteId(this.#e),this.#n?.remove(),this.#n=null,this.#o)clearTimeout(this.#o),this.#o=null}super.remove()}rebuild(){if(!this.parent){if(this.#e)this.#p();return}if(super.rebuild(),this.div===null)return;if(this.#e&&this.#n===null)this.#p();if(!this.isAttachedToDOM)this.parent.add(this)}onceAdded(t){if(this._isDraggable=!0,t)this.div.focus()}isEmpty(){return!(this.#a||this.#t||this.#i||this.#s||this.#e||this.#f)}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let t,e;if(this._isCopy)t=this.x,e=this.y;if(super.render(),this.div.hidden=!0,this.createAltText(),!this.#f)if(this.#t)this.#b();else this.#p();if(this._isCopy)this._moveAfterPaste(t,e);return this._uiManager.addShouldRescale(this),this.div}setCanvas(t,e){let{id:a,bitmap:i}=this._uiManager.imageManager.getFromCanvas(t,e);if(e.remove(),a&&this._uiManager.imageManager.isValidId(a)){if(this.#e=a,i)this.#t=i;this.#f=!1,this.#b()}}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;if(this.#o!==null)clearTimeout(this.#o);let t=200;this.#o=setTimeout(()=>{this.#o=null,this.#m()},t)}#b(){let{div:t}=this,{width:e,height:a}=this.#t,[i,s]=this.pageDimensions,n=0.75;if(this.width)e=this.width*i,a=this.height*s;else if(e>0.75*i||a>0.75*s){let f=Math.min(0.75*i/e,0.75*s/a);e*=f,a*=f}this._uiManager.enableWaiting(!1);let l=this.#n=document.createElement("canvas");if(l.setAttribute("role","img"),this.addContainer(l),this.width=e/i,this.height=a/s,this.setDims(),this._initialOptions?.isCentered)this.center();else this.fixAndSetPosition();if(this._initialOptions=null,!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)t.hidden=!1;if(this.#m(),!this.#u)this.parent.addUndoableEditor(this),this.#u=!0;if(this._reportTelemetry({action:"inserted_image"}),this.#l)this.div.setAttribute("aria-description",this.#l);if(!this.annotationElementId)this._uiManager.a11yAlert(se._l10nAlert.stamp)}copyCanvas(t,e,a=!1){if(!t)t=224;let{width:i,height:s}=this.#t,n=new N0,l=this.#t,f=i,o=s,c=null;if(e){if(i>e||s>e){let D=Math.min(e/i,e/s);f=Math.floor(i*D),o=Math.floor(s*D)}c=document.createElement("canvas");let m=c.width=Math.ceil(f*n.sx),p=c.height=Math.ceil(o*n.sy);if(!this.#r)l=this.#h(m,p);let w=c.getContext("2d");w.filter=this._uiManager.hcmFilter;let d="white",v="#cfcfd8";if(this._uiManager.hcmFilter!=="none")v="black";else if(OF.isDarkMode)d="#8f8f9d",v="#42414d";let k=15,y=k*n.sx,B=k*n.sy,H=new OffscreenCanvas(y*2,B*2),M=H.getContext("2d");M.fillStyle=d,M.fillRect(0,0,y*2,B*2),M.fillStyle=v,M.fillRect(0,0,y,B),M.fillRect(y,B,y,B),w.fillStyle=w.createPattern(H,"repeat"),w.fillRect(0,0,m,p),w.drawImage(l,0,0,l.width,l.height,0,0,m,p)}let u=null;if(a){let m,p;if(n.symmetric&&l.width<t&&l.height<t)m=l.width,p=l.height;else if(l=this.#t,i>t||s>t){let v=Math.min(t/i,t/s);if(m=Math.floor(i*v),p=Math.floor(s*v),!this.#r)l=this.#h(m,p)}let d=new OffscreenCanvas(m,p).getContext("2d",{willReadFrequently:!0});d.drawImage(l,0,0,l.width,l.height,0,0,m,p),u={width:m,height:p,data:d.getImageData(0,0,m,p).data}}return{canvas:c,width:f,height:o,imageData:u}}#h(t,e){let{width:a,height:i}=this.#t,s=a,n=i,l=this.#t;while(s>2*t||n>2*e){let f=s,o=n;if(s>2*t)s=Math.ceil(s/2);if(n>2*e)n=Math.ceil(n/2);let c=new OffscreenCanvas(s,n);c.getContext("2d").drawImage(l,0,0,f,o,0,0,s,n),l=c.transferToImageBitmap()}return l}#m(){let[t,e]=this.parentDimensions,{width:a,height:i}=this,s=new N0,n=Math.ceil(a*t*s.sx),l=Math.ceil(i*e*s.sy),f=this.#n;if(!f||f.width===n&&f.height===l)return;f.width=n,f.height=l;let o=this.#r?this.#t:this.#h(n,l),c=f.getContext("2d");c.filter=this._uiManager.hcmFilter,c.drawImage(o,0,0,o.width,o.height,0,0,n,l)}#j(t){if(t){if(this.#r){let i=this._uiManager.imageManager.getSvgUrl(this.#e);if(i)return i}let e=document.createElement("canvas");return{width:e.width,height:e.height}=this.#t,e.getContext("2d").drawImage(this.#t,0,0),e.toDataURL()}if(this.#r){let[e,a]=this.pageDimensions,i=Math.round(this.width*e*rr.PDF_TO_CSS_UNITS),s=Math.round(this.height*a*rr.PDF_TO_CSS_UNITS),n=new OffscreenCanvas(i,s);return n.getContext("2d").drawImage(this.#t,0,0,this.#t.width,this.#t.height,0,0,i,s),n.transferToImageBitmap()}return structuredClone(this.#t)}static async deserialize(t,e,a){let i=null,s=!1;if(t instanceof pp){let{data:{rect:d,rotation:v,id:k,structParent:y,popupRef:B,richText:H,contentsObj:M,creationDate:D,modificationDate:T},container:z,parent:{page:{pageNumber:E}},canvas:V}=t,tt,at;if(V)delete t.canvas,{id:tt,bitmap:at}=a.imageManager.getFromCanvas(z.id,V),V.remove();else s=!0,t._hasNoCanvas=!0;let Q=(await e._structTree.getAriaAttributes(`pdfjs_internal_id_${k}`))?.get("aria-label")||"";i=t={annotationType:je.STAMP,bitmapId:tt,bitmap:at,pageIndex:E-1,rect:d.slice(0),rotation:v,annotationElementId:k,id:k,deleted:!1,accessibilityData:{decorative:!1,altText:Q},isSvg:!1,structParent:y,popupRef:B,richText:H,comment:M?.str||null,creationDate:D,modificationDate:T}}let n=await super.deserialize(t,e,a),{rect:l,bitmap:f,bitmapUrl:o,bitmapId:c,isSvg:u,accessibilityData:m}=t;if(s)a.addMissingCanvas(t.id,n),n.#f=!0;else if(c&&a.imageManager.isValidId(c)){if(n.#e=c,f)n.#t=f}else n.#i=o;n.#r=u;let[p,w]=n.pageDimensions;if(n.width=(l[2]-l[0])/p,n.height=(l[3]-l[1])/w,m)n.altTextData=m;if(n._initialData=i,t.comment)n.setCommentData(t);return n.#u=!!i,n}serialize(t=!1,e=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let a=Object.assign(super.serialize(t),{bitmapId:this.#e,isSvg:this.#r});if(this.addComment(a),t)return a.bitmapUrl=this.#j(!0),a.accessibilityData=this.serializeAltText(!0),a.isCopy=!0,a;let{decorative:i,altText:s}=this.serializeAltText(!1);if(!i&&s)a.accessibilityData={type:"Figure",alt:s};if(this.annotationElementId){let l=this.#d(a);if(l.isSame)return null;if(l.isSameAltText)delete a.accessibilityData;else a.accessibilityData.structParent=this._initialData.structParent??-1;return a.id=this.annotationElementId,delete a.bitmapId,a}if(e===null)return a;e.stamps||=new Map;let n=this.#r?(a.rect[2]-a.rect[0])*(a.rect[3]-a.rect[1]):null;if(!e.stamps.has(this.#e))e.stamps.set(this.#e,{area:n,serialized:a}),a.bitmap=this.#j(!1);else if(this.#r){let l=e.stamps.get(this.#e);if(n>l.area)l.area=n,l.serialized.bitmap.close(),l.serialized.bitmap=this.#j(!1)}return a}#d(t){let{pageIndex:e,accessibilityData:{altText:a}}=this._initialData,i=t.pageIndex===e,s=(t.accessibilityData?.alt||"")===a;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&i&&s,isSameAltText:s}}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;return t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null}}class S1{#t;#e=!1;#a=null;#i=null;#s=null;#l=new Map;#n=!1;#f=!1;#o=!1;#r=null;#u=null;#c=null;#g=null;#p=null;#b=-1;#h;static _initialized=!1;static#m=new Map([Ti,Ap,eO,ai,D0].map((t)=>[t._editorType,t]));constructor({uiManager:t,pageIndex:e,div:a,structTreeLayer:i,accessibilityManager:s,annotationLayer:n,drawLayer:l,textLayer:f,viewport:o,l10n:c}){let u=[...S1.#m.values()];if(!S1._initialized){S1._initialized=!0;for(let m of u)m.initialize(c,t)}t.registerEditorTypes(u),this.#h=t,this.pageIndex=e,this.div=a,this.#t=s,this.#a=n,this.viewport=o,this.#c=f,this.drawLayer=l,this._structTree=i,this.#h.addLayer(this)}get isEmpty(){return this.#l.size===0}get isInvisible(){return this.isEmpty&&this.#h.getMode()===je.NONE}updateToolbar(t){this.#h.updateToolbar(t)}updateMode(t=this.#h.getMode()){switch(this.#q(),t){case je.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case je.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case je.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:e}=this.div;if(e.toggle("nonEditing",!1),t===je.POPUP)e.toggle("commentEditing",!0);else{e.toggle("commentEditing",!1);for(let a of S1.#m.values())e.toggle(`${a._type}Editing`,t===a._editorType)}this.div.hidden=!1}hasTextLayer(t){return t===this.#c?.div}setEditingState(t){this.#h.setEditingState(t)}addCommands(t){this.#h.addCommands(t)}cleanUndoStack(t){this.#h.cleanUndoStack(t)}toggleDrawing(t=!1){this.div.classList.toggle("drawing",!t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){this.#a?.togglePointerEvents(t)}get#j(){return this.#l.size!==0?this.#l.values():this.#h.getEditors(this.pageIndex)}async enable(){this.#o=!0,this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),this.#p?.abort(),this.#p=null;let t=new Set;for(let a of this.#j)if(a.enableEditing(),a.show(!0),a.annotationElementId)this.#h.removeChangedExistingAnnotation(a),t.add(a.annotationElementId);let e=this.#a;if(e)for(let a of e.getEditableAnnotations()){if(a.hide(),this.#h.isDeletedAnnotationElement(a.data.id))continue;if(t.has(a.data.id))continue;let i=await this.deserialize(a);if(!i)continue;this.addOrRebuild(i),i.enableEditing()}this.#o=!1,this.#h._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(this.#f=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),this.#c&&!this.#p){this.#p=new AbortController;let i=this.#h.combinedSignal(this.#p);this.#c.div.addEventListener("pointerdown",(s)=>{let{clientX:l,clientY:f,timeStamp:o}=s,c=this.#b;if(o-c>500){this.#b=o;return}this.#b=-1;let{classList:u}=this.div;u.toggle("getElements",!0);let m=document.elementsFromPoint(l,f);if(u.toggle("getElements",!1),!this.div.contains(m[0]))return;let p,w=new RegExp("^pdfjs_internal_editor_[0-9]+$");for(let v of m)if(w.test(v.id)){p=v.id;break}if(!p)return;let d=this.#l.get(p);if(d?.annotationElementId===null)Ia(s),d.dblclick(s)},{signal:i,capture:!0})}let t=this.#a,e=[];if(t){let i=new Map,s=new Map;for(let n of this.#j){if(n.disableEditing(),!n.annotationElementId){e.push(n);continue}if(n.serialize()!==null){i.set(n.annotationElementId,n);continue}else s.set(n.annotationElementId,n);this.getEditableAnnotation(n.annotationElementId)?.show(),n.remove()}for(let n of t.getEditableAnnotations()){let{id:l}=n.data;if(this.#h.isDeletedAnnotationElement(l)){n.updateEdited({deleted:!0});continue}let f=s.get(l);if(f){f.resetAnnotationElement(n),f.show(!1),n.show();continue}if(f=i.get(l),f){if(this.#h.addChangedExistingAnnotation(f),f.renderAnnotationElement(n))f.show(!1)}n.show()}}if(this.#q(),this.isEmpty)this.div.hidden=!0;let{classList:a}=this.div;for(let i of S1.#m.values())a.remove(`${i._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(e),this.#f=!1}getEditableAnnotation(t){return this.#a?.getEditableAnnotation(t)||null}setActiveEditor(t){if(this.#h.getActive()===t)return;this.#h.setActiveEditor(t)}enableTextSelection(){if(this.div.tabIndex=-1,this.#c?.div&&!this.#g){this.#g=new AbortController;let t=this.#h.combinedSignal(this.#g);this.#c.div.addEventListener("pointerdown",this.#d.bind(this),{signal:t}),this.#c.div.classList.add("highlighting")}}disableTextSelection(){if(this.div.tabIndex=0,this.#c?.div&&this.#g)this.#g.abort(),this.#g=null,this.#c.div.classList.remove("highlighting")}#d(t){this.#h.unselectAll();let{target:e}=t;if(e===this.#c.div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent")||e.classList.contains("textLayerImages")||e.classList.contains("textLayerImagePlaceholder"))&&this.#c.div.contains(e)){let{isMac:a}=ha.platform;if(t.button!==0||t.ctrlKey&&a)return;this.#h.showAllEditors("highlight",!0,!0),this.#c.div.classList.add("free"),this.toggleDrawing(),ai.startHighlighting(this,this.#h.direction==="ltr",{target:this.#c.div,x:t.x,y:t.y}),this.#c.div.addEventListener("pointerup",()=>{this.#c.div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:this.#h._signal}),t.preventDefault()}}enableClick(){if(this.#i)return;this.#i=new AbortController;let t=this.#h.combinedSignal(this.#i);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});let e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:t}),this.div.addEventListener("pointercancel",e,{signal:t})}disableClick(){this.#i?.abort(),this.#i=null}attach(t){this.#l.set(t.id,t);let{annotationElementId:e}=t;if(e&&this.#h.isDeletedAnnotationElement(e))this.#h.removeDeletedAnnotationElement(t)}detach(t){if(this.#l.delete(t.id),this.#t?.removePointerInTextLayer(t.contentDiv),!this.#f&&t.annotationElementId)this.#h.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#h.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){if(t.parent===this)return;if(t.parent&&t.annotationElementId)this.#h.addDeletedAnnotationElement(t),se.deleteAnnotationElement(t),t.annotationElementId=null;if(this.attach(t),t.parent?.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM)t.div.remove(),this.div.append(t.div)}add(t){if(t.parent===this&&t.isAttachedToDOM)return;if(this.changeParent(t),this.#h.addEditor(t),this.attach(t),!t.isAttachedToDOM){let e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!this.#o),this.#h.addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;let{activeElement:e}=document;if(t.div.contains(e)&&!this.#s)t._focusEventsAllowed=!1,this.#s=setTimeout(()=>{if(this.#s=null,!t.div.contains(document.activeElement))t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this.#h._signal}),e.focus();else t._focusEventsAllowed=!0},0);t._structTreeParentId=this.#t?.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){if(t.needsToBeRebuilt())t.parent||=this,t.rebuild(),t.show();else this.add(t)}addUndoableEditor(t){let e=()=>t._uiManager.rebuild(t),a=()=>{t.remove()};this.addCommands({cmd:e,undo:a,mustExec:!1})}getEditorByUID(t){for(let e of this.#l.values())if(e.uid===t)return e;return null}get#w(){return S1.#m.get(this.#h.getMode())}combinedSignal(t){return this.#h.combinedSignal(t)}#S(t){let e=this.#w;return e?new e.prototype.constructor(t):null}canCreateNewEmptyEditor(){return this.#w?.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await this.#h.updateMode(t.mode);let{offsetX:a,offsetY:i}=this.#y(),s=this.#h.getId(),n=this.#S({parent:this,id:s,x:a,y:i,uiManager:this.#h,isCentered:!0,...e});if(n)this.add(n)}async deserialize(t){return await S1.#m.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#h)||null}createAndAddNewEditor(t,e,a={}){let i=this.#h.getId(),s=this.#S({parent:this,id:i,x:t.offsetX,y:t.offsetY,uiManager:this.#h,isCentered:e,...a});if(s)this.add(s);return s}get boundingClientRect(){return this.div.getBoundingClientRect()}#y(){let{x:t,y:e,width:a,height:i}=this.boundingClientRect,s=Math.max(0,t),n=Math.max(0,e),l=Math.min(window.innerWidth,t+a),f=Math.min(window.innerHeight,e+i),o=(s+l)/2-t,c=(n+f)/2-e,[u,m]=this.viewport.rotation%180===0?[o,c]:[c,o];return{offsetX:u,offsetY:m}}addNewEditor(t={}){this.createAndAddNewEditor(this.#y(),!0,t)}setSelected(t){this.#h.setSelected(t)}toggleSelected(t){this.#h.toggleSelected(t)}unselect(t){this.#h.unselect(t)}pointerup(t){let{isMac:e}=ha.platform;if(t.button!==0||t.ctrlKey&&e)return;if(t.target!==this.div)return;if(!this.#n)return;if(this.#n=!1,this.#w?.isDrawer&&this.#w.supportMultipleDrawings)return;if(!this.#e){this.#e=!0;return}let a=this.#h.getMode();if(a===je.STAMP||a===je.POPUP||a===je.SIGNATURE){this.#h.unselectAll();return}this.createAndAddNewEditor(t,!1)}pointerdown(t){if(this.#h.getMode()===je.HIGHLIGHT)this.enableTextSelection();if(this.#n){this.#n=!1;return}let{isMac:e}=ha.platform;if(t.button!==0||t.ctrlKey&&e)return;if(t.target!==this.div)return;if(this.#n=!0,this.#w?.isDrawer){this.startDrawingSession(t);return}let a=this.#h.getActive();this.#e=!a||a.isEmpty()}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),this.#r){this.#w.startDrawing(this,this.#h,!1,t);return}this.#h.setCurrentDrawingSession(this),this.#r=new AbortController;let e=this.#h.combinedSignal(this.#r);this.div.addEventListener("blur",({relatedTarget:a})=>{if(a&&!this.div.contains(a))this.#u=null,this.commitOrRemove()},{signal:e}),this.#w.startDrawing(this,this.#h,!1,t)}pause(t){if(t){let{activeElement:e}=document;if(this.div.contains(e))this.#u=e;return}if(this.#u)setTimeout(()=>{this.#u?.focus(),this.#u=null},0)}endDrawingSession(t=!1){if(!this.#r)return null;return this.#h.setCurrentDrawingSession(null),this.#r.abort(),this.#r=null,this.#u=null,this.#w.endDrawing(t)}findNewParent(t,e,a){let i=this.#h.findParent(e,a);if(i===null||i===this)return!1;return i.changeParent(t),!0}commitOrRemove(){if(this.#r)return this.endDrawingSession(),!0;return!1}onScaleChanging(){if(!this.#r)return;this.#w.onScaleChangingWhenDrawing(this)}destroy(){if(this.commitOrRemove(),this.#h.getActive()?.parent===this)this.#h.commitOrRemove(),this.#h.setActiveEditor(null);if(this.#s)clearTimeout(this.#s),this.#s=null;for(let t of this.#l.values())this.#t?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#l.clear(),this.#h.removeLayer(this)}#q(){for(let t of this.#l.values())if(t.isEmpty())t.remove()}async render({viewport:t}){this.viewport=t,or(this.div,t);for(let e of this.#h.getEditors(this.pageIndex))this.add(e),e.rebuild();await this.#h.findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:t}){this.#h.commitOrRemove(),this.#q();let e=this.viewport.rotation,a=t.rotation;if(this.viewport=t,or(this.div,{rotation:a}),e!==a)for(let i of this.#l.values())i.rotate(a)}get pageDimensions(){let{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return this.#h.viewParameters.realScale}}function YV(t,e){if(t===e)return 0;return t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function I3(t){if(!t)return null;if(t.nodeType===Node.ELEMENT_NODE)return t.closest(".textLayer");return t.parentElement?.closest(".textLayer")||null}function JV(t,e,a,i){if(t===a)return e<=i;let s=t.compareDocumentPosition(a);if(s&Node.DOCUMENT_POSITION_FOLLOWING)return!0;if(s&Node.DOCUMENT_POSITION_PRECEDING)return!1;return null}function kF(t,e,a){if(t.nodeType!==Node.ELEMENT_NODE||!t.classList.contains("textLayer")||e!==t.childNodes.length)return{container:t,offset:e};let i=t.lastChild;if(i?.nodeType===Node.ELEMENT_NODE&&i.classList.contains("endOfContent"))i=i.previousSibling;if(!i||!a.contains(i))return null;if(i.nodeType===Node.TEXT_NODE)return{container:i,offset:i.textContent.length};return{container:i,offset:i.childNodes.length}}class ge{#t=null;#e=new Map;#a=null;#i=null;#s=null;#l=null;#n=new Map;static#f=0;static#o=0;static#r=null;static#u=new Set;static#c=!1;static#g=new Set;static#p=new WeakMap;constructor({filterFactory:t=null,pageColors:e=null,pageIndex:a,textLayer:i=null}){if(this.pageIndex=a,this.#i=t,this.#s=e,i){let s=ge.#p.get(i);if(s?.selectionDiv)s.selectionDiv.remove(),ge.#u.delete(s.selectionDiv);if(ge.#p.set(i,{drawLayer:this}),ge.#g.add(i),this.#a=i,this.#l=new MutationObserver((n)=>{if(!this.#t||!this.#a?.isConnected||!ge.#h())return;for(let{addedNodes:l}of n)for(let f of l)if(f.nodeType===Node.ELEMENT_NODE&&f.classList.contains("endOfContent")){ge.#j();return}}),this.#l.observe(i,{childList:!0}),ge.#r===null){ge.#r=new AbortController;let{signal:n}=ge.#r;document.addEventListener("selectionchange",ge.#j.bind(ge),{signal:n}),document.addEventListener("pointerdown",()=>{ge.#c=!0},{signal:n}),document.addEventListener("pointerup",()=>{ge.#c=!1},{signal:n}),window.addEventListener("blur",()=>{ge.#c=!1},{signal:n})}}}setParent(t){if(!this.#t){if(this.#t=t,this.#a?.isConnected&&ge.#h())ge.#j();return}if(this.#t!==t){if(this.#e.size>0)for(let e of this.#e.values())e.remove(),t.append(e);this.#t=t}}static#b(t){let e=this.#p.get(t);if(!e?.selectionDiv)return;e.selectionDiv.remove(),this.#u.delete(e.selectionDiv),e.selectionDiv=null,e.path=null}static#h(){let t=document.getSelection();return!!t&&!t.isCollapsed}static#m(){return[...this.#g].filter((t)=>t.isConnected).sort(YV)}static#j(){let t=document.getSelection();if(!t||t.isCollapsed){for(let n of this.#u)n.remove();this.#u.clear();return}let e=new WeakMap,a=this.#m(),i=[];for(let n=0,l=t.rangeCount;n<l;n++){let f=t.getRangeAt(n);if(f.collapsed)continue;let{startContainer:o,startOffset:c,endContainer:u,endOffset:m}=f,p=I3(o),w=I3(u),d=p===null,v=w===null;if(this.#c&&d!==v)return;if(t.rangeCount===1){let{anchorNode:B,anchorOffset:H,focusNode:M,focusOffset:D}=t,T=I3(B),z=I3(M),E=JV(B,H,M,D);if(T&&z&&E!==null)if(E)o=B,c=H,p=T,u=M,m=D,w=z;else o=M,c=D,p=z,u=B,m=H,w=T}let k=a.filter((B)=>f.intersectsNode(B));if(k.length===0)continue;let y=!1;if(!p)p=k[0],o=p,c=0,y=!0;if(!w)w=k.at(-1),u=w,m=w.childNodes.length,y=!0;if(u.nodeType===Node.ELEMENT_NODE){if(u.classList.contains("endOfContent")){let B=u.previousSibling;if(!B)continue;u=B,m=B.nodeType===Node.TEXT_NODE?B.textContent.length:B.childNodes.length}else if(u.classList.contains("textLayer")&&u.childNodes.length===m){let B=kF(u,m,w);if(!B)continue;u=B.container,m=B.offset}}if(o.nodeType===Node.ELEMENT_NODE){let B=kF(o,c,p);if(!B)continue;o=B.container,c=B.offset}if(p===w&&!y&&k.includes(p)){i.push([f,p]);continue}for(let B of k){let H=B.firstChild;if(!H)continue;let M=document.createRange();if(B===p)M.setStart(o,c);else M.setStartBefore(H);if(B===w)M.setEnd(u,m);else{let D=B.lastChild;if(!D)continue;if(D.nodeType===Node.ELEMENT_NODE&&D.classList.contains("endOfContent")){let T=D.previousSibling;if(!T)continue;M.setEndAfter(T)}else M.setEndAfter(D)}if(!M.collapsed)i.push([M,B])}}let s=new Set(i.map((n)=>n[1]));for(let n of this.#g)if(!s.has(n))this.#b(n);for(let[n,l]of i){let f=ge.#p.get(l);if(!f)continue;let o=e.get(l);if(!o){let w=l.getBoundingClientRect();o=(d,v,k,y)=>({x:(d-w.x)/w.width,y:(v-w.y)/w.height,width:k/w.width,height:y/w.height}),e.set(l,o)}let c=[];for(let{x:w,y:d,width:v,height:k}of n.getClientRects()){if(v===0||k===0)continue;if({x:w,y:d,width:v,height:k}=o(w,d,v,k),v===1&&k===1)continue;c.push(`M${w} ${d} h${v} v${k} h-${v} Z`)}if(c.length===0)continue;let{drawLayer:u,selectionDiv:m,path:p}=f;if(!m){let w=`clip_selection_${ge.#o++}`;m=document.createElement("div"),m.className="selection",m.style.clipPath=`url(#${w})`;let d=u.#i?.createSelectionStyle(u.#s);if(d)for(let[y,B]of Object.entries(d))m.style.setProperty(y,B);let v=ge._svgFactory.create(1,1,!0);v.setAttribute("aria-hidden","true"),v.setAttribute("width","100%"),v.setAttribute("height","100%");let k=ge._svgFactory.createElement("clipPath");k.setAttribute("id",w),k.setAttribute("clipPathUnits","objectBoundingBox"),p=ge._svgFactory.createElement("path"),k.append(p),v.append(k),m.append(v),f.path=p,f.selectionDiv=m}if(!m.parentNode&&u.#t)u.#t.append(m),this.#u.add(m);p.setAttribute("d",c.join(" "))}}static get _svgFactory(){return be(this,"_svgFactory",new p9)}static#d(t,[e,a,i,s]){let{style:n}=t;n.top=`${100*a}%`,n.left=`${100*e}%`,n.width=`${100*i}%`,n.height=`${100*s}%`}#w(){let t=ge._svgFactory.create(1,1,!0);return this.#t.append(t),t.setAttribute("aria-hidden","true"),t}#S(t,e){let a=ge._svgFactory.createElement("clipPath");t.append(a);let i=`clip_${e}`;a.setAttribute("id",i),a.setAttribute("clipPathUnits","objectBoundingBox");let s=ge._svgFactory.createElement("use");return a.append(s),s.setAttribute("href",`#${e}`),s.classList.add("clip"),i}#y(t,e){for(let[a,i]of Object.entries(e))if(i===null)t.removeAttribute(a);else t.setAttribute(a,i)}draw(t,e=!1,a=!1){let i=ge.#f++,s=this.#w(),n=ge._svgFactory.createElement("defs");s.append(n);let l=ge._svgFactory.createElement("path");n.append(l);let f=`path_${i}`;if(l.setAttribute("id",f),l.setAttribute("vector-effect","non-scaling-stroke"),e)this.#n.set(i,l);let o=a?this.#S(n,f):null,c=ge._svgFactory.createElement("use");return s.append(c),c.setAttribute("href",`#${f}`),this.updateProperties(s,t),this.#e.set(i,s),{id:i,clipPathId:`url(#${o})`}}drawOutline(t,e){let a=ge.#f++,i=this.#w(),s=ge._svgFactory.createElement("defs");i.append(s);let n=ge._svgFactory.createElement("path");s.append(n);let l=`path_${a}`;n.setAttribute("id",l),n.setAttribute("vector-effect","non-scaling-stroke");let f;if(e){let u=ge._svgFactory.createElement("mask");s.append(u),f=`mask_${a}`,u.setAttribute("id",f),u.setAttribute("maskUnits","objectBoundingBox");let m=ge._svgFactory.createElement("rect");u.append(m),m.setAttribute("width","1"),m.setAttribute("height","1"),m.setAttribute("fill","white");let p=ge._svgFactory.createElement("use");u.append(p),p.setAttribute("href",`#${l}`),p.setAttribute("stroke","none"),p.setAttribute("fill","black"),p.setAttribute("fill-rule","nonzero"),p.classList.add("mask")}let o=ge._svgFactory.createElement("use");if(i.append(o),o.setAttribute("href",`#${l}`),f)o.setAttribute("mask",`url(#${f})`);let c=o.cloneNode();return i.append(c),o.classList.add("mainOutline"),c.classList.add("secondaryOutline"),this.updateProperties(i,t),this.#e.set(a,i),a}finalizeDraw(t,e){this.#n.delete(t),this.updateProperties(t,e)}updateProperties(t,e){if(!e)return;let{root:a,bbox:i,rootClass:s,path:n}=e,l=typeof t==="number"?this.#e.get(t):t;if(!l)return;if(a)this.#y(l,a);if(i)ge.#d(l,i);if(s){let{classList:f}=l;for(let[o,c]of Object.entries(s))f.toggle(o,c)}if(n){let o=l.firstElementChild.firstElementChild;this.#y(o,n)}}updateParent(t,e){if(e===this)return;let a=this.#e.get(t);if(!a)return;e.#t.append(a),this.#e.delete(t),e.#e.set(t,a)}remove(t){if(this.#n.delete(t),this.#t===null)return;this.#e.get(t).remove(),this.#e.delete(t)}destroy(){this.#t=null;for(let t of this.#e.values())t.remove();if(this.#e.clear(),this.#n.clear(),this.#l?.disconnect(),this.#l=null,this.#a){if(ge.#p.get(this.#a)?.drawLayer===this){if(ge.#b(this.#a),ge.#p.delete(this.#a),ge.#g.delete(this.#a),ge.#g.size===0)ge.#r?.abort(),ge.#r=null,ge.#c=!1}this.#a=null}}}function G3(t){return`${(t*100).toFixed(2)}%`}class a6{#t=[];#e=new Map;#a=null;#i=0;#s=0;#l=0;static#n=null;constructor(t,e,a,i){this.#i=t,this.#t=e,this.#s=a.rawDims.pageWidth,this.#l=a.rawDims.pageHeight,this.#a=i}render(){let t=document.createElement("div");t.className="textLayerImages";for(let e=0;e<this.#t.length;e+=6){let a=this.#f(this.#t.subarray(e,e+6));if(a)t.append(a)}return t.addEventListener("contextmenu",(e)=>{if(!(e.target instanceof HTMLCanvasElement))return;let a=e.target,i=this.#e.get(a);if(!i)return;let s=a6.#n?.deref();if(s===a)return;if(s)s.width=0,s.height=0;a6.#n=new WeakRef(a);let{inverseTransform:n,x1:l,y1:f,width:o,height:c}=i,u=this.#a(),m=Math.ceil(l*u.width),p=Math.ceil(f*u.height),w=Math.floor((l+o/this.#s)*u.width),d=Math.floor((f+c/this.#l)*u.height);a.width=w-m,a.height=d-p;let v=a.getContext("2d");v.setTransform(...n),v.translate(-m,-p),v.drawImage(u,0,0)}),t}#f([t,e,a,i,s,n]){let l=Math.hypot((s-t)*this.#s,(n-e)*this.#l),f=Math.hypot((a-t)*this.#s,(i-e)*this.#l);if(l<this.#i||f<this.#i)return null;let o=[(s-t)*this.#s/l,(n-e)*this.#l/l,(a-t)*this.#s/f,(i-e)*this.#l/f,0,0],c=Nt.inverseTransform(o),u=document.createElement("canvas");return u.className="textLayerImagePlaceholder",u.width=0,u.height=0,Object.assign(u.style,{opacity:0,position:"absolute",left:G3(t),top:G3(e),width:G3(l/this.#s),height:G3(f/this.#l),transformOrigin:"0% 0%",transform:`matrix(${o.join(",")})`}),this.#e.set(u,{inverseTransform:c,width:l,height:f,x1:t,y1:e}),u}}globalThis._pdfjsTestingUtils={HighlightOutliner:P3};globalThis.pdfjsLib={AbortException:C1,AnnotationEditorLayer:S1,AnnotationEditorParamsType:Ce,AnnotationEditorType:je,AnnotationEditorUIManager:Tl,AnnotationLayer:jp,AnnotationMode:Dl,AnnotationType:Ja,applyOpacity:bV,build:KV,ColorPicker:Rn,createValidAbsoluteUrl:CF,CSSConstants:HF,DOMSVGFactory:p9,DrawLayer:ge,FeatureTest:ha,fetchData:Pb,findContrastColor:pV,getDocument:op,getFilenameFromUrl:uV,getPdfFilenameFromUrl:mV,getRGB:q9,getRGBA:d9,getUuid:BF,GlobalWorkerOptions:k1,ImageKind:X3,InvalidPDFException:J3,isDataScheme:r6,isPdfFile:tp,isValidExplicitDest:vV,makeArr:w9,makeMap:$b,makeObj:Gb,MathClamp:_a,noContextMenu:Nn,normalizeUnicode:hV,OPS:T0,OutputScale:N0,PasswordException:Y3,PasswordResponses:sV,PDFDataRangeTransport:cp,PDFDateString:Q3,PDFWorker:Ji,PermissionFlag:iV,PixelsPerInch:rr,RenderingCancelledException:f6,renderRichText:MF,ResponseException:c9,setLayerDimensions:or,shadow:be,SignatureExtractor:nr,stopEvent:Ia,SupportedImageMimeTypes:Kb,TextLayer:nn,TextLayerImages:a6,TouchManager:o6,updateUrlHash:_F,Util:Nt,VerbosityLevel:i6,version:XV,XfaLayer:Wb};var Fa=Ie(Pa(),1);function sO({currentPage:t,totalPages:e,onPageChange:a,zoom:i,onZoomIn:s,onZoomOut:n,onFit:l,onDownload:f,canDownload:o}){return rt("div",{className:"relative px-4 py-3 bg-card border-t border-gray-200 dark:border-gray-700 z-10 flex items-center justify-between gap-2 transition-colors duration-200",children:[rt("div",{className:"flex items-center gap-1.5 bg-gray-200/50 dark:bg-white/10 rounded-md p-0.5",children:[x("button",{onClick:()=>a(Math.max(1,t-1)),disabled:t<=1,className:"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:It.previous_page(),children:x(aO,{size:16})}),x("span",{className:"px-2 text-xs font-mono font-medium text-gray-900 dark:text-gray-100 select-none",children:It.page_of_pages({current:t,total:e||1})}),x("button",{onClick:()=>a(Math.min(e,t+1)),disabled:t>=e,className:"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:It.next_page(),children:x(iO,{size:16})})]}),rt("div",{className:"flex items-center gap-2",children:[rt("div",{className:"flex items-center gap-1 bg-gray-200/50 dark:bg-white/10 rounded-md p-0.5",children:[x("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:It.zoom_out(),children:x(ul,{size:16})}),rt("span",{className:"w-12 text-center text-xs font-mono font-medium text-gray-900 dark:text-gray-100 select-none",children:[Math.round(i*100),"%"]}),x("button",{onClick:s,className:"p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors",title:It.zoom_in(),children:x(ch,{size:16})})]}),x("button",{onClick:l,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",children:It.fit()}),rt("button",{onClick:f,disabled:!o,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",title:It.download_original_file(),children:[x(Vn,{size:14}),It.download()]})]})]})}var Oh="./pdf.worker.min-szxdj13d.mjs";if(typeof window<"u"&&k1){let t=typeof Oh==="string"?Oh.startsWith("/")?Oh:"/"+Oh.replace(/^\.\//,""):Oh;k1.workerSrc=t}var $V=Fa.default.forwardRef(({file:t,annotations:e,shareId:a,children:i,onPlay:s,onPause:n,onTimeUpdate:l,startTime:f},o)=>{let{isDrawing:c,currentTool:u,currentColor:m,addAnnotation:p,annotations:w}=_s(),[d,v]=Fa.useState(null),[k,y]=Fa.useState(()=>f&&!isNaN(f)?Math.max(1,Math.round(f)):1),[B,H]=Fa.useState(1),[M,D]=Fa.useState(""),[T,z]=Fa.useState({width:800,height:1000}),[E,V]=Fa.useState(!0),[tt,at]=Fa.useState(null);Fa.useImperativeHandle(o,()=>({play:()=>{s?.()},pause:()=>{n?.()},seekTo:(Dt)=>{if(Dt&&!isNaN(Dt)){let Mt=Math.max(1,Math.min(B,Math.round(Dt)));y(Mt)}}}),[B,s,n]),Fa.useEffect(()=>{l?.(k)},[k,l]),Fa.useEffect(()=>{let Dt=(Mt)=>{let Xt=document.activeElement;if(Xt&&(Xt.tagName==="INPUT"||Xt.tagName==="TEXTAREA"||Xt instanceof HTMLElement&&Xt.isContentEditable))return;if(Mt.key==="ArrowRight"||Mt.key==="ArrowDown"||Mt.key==="PageDown")Mt.preventDefault(),y((Gt)=>{let ae=Math.min(B,Gt+1);if(ae!==Gt)s?.();return ae});else if(Mt.key==="ArrowLeft"||Mt.key==="ArrowUp"||Mt.key==="PageUp")Mt.preventDefault(),y((Gt)=>{let ae=Math.max(1,Gt-1);if(ae!==Gt)s?.();return ae});else if(Mt.key==="Home")Mt.preventDefault(),y(1),s?.();else if(Mt.key==="End")Mt.preventDefault(),y(B),s?.()};return window.addEventListener("keydown",Dt),()=>{window.removeEventListener("keydown",Dt)}},[B,s]);let[Q,Z]=Fa.useState({width:0,height:0}),[J,Y]=Fa.useState(1),[W,ft]=Fa.useState({x:0,y:0}),nt=Fa.useRef(null),qt=Fa.useCallback((Dt)=>{if(nt.current)nt.current.disconnect(),nt.current=null;if(Dt!==null){let Mt=new ResizeObserver((Xt)=>{let Gt=Xt[0];if(Gt)Z({width:Gt.contentRect.width,height:Gt.contentRect.height})});Mt.observe(Dt),nt.current=Mt}},[]),R=t.media?.pdfTranscode?.url||t.media?.original?.downloadUrl;Fa.useEffect(()=>{if(!R){at("No PDF URL available"),V(!1);return}let Dt=!0;V(!0),at(null);let Mt=op({url:R});return Mt.promise.then((Xt)=>{if(!Dt)return;v(Xt),H(Xt.numPages),y((Gt)=>f&&!isNaN(f)?Math.max(1,Math.min(Xt.numPages,Math.round(f))):Gt),V(!1)}).catch((Xt)=>{if(!Dt)return;console.error("Failed to load PDF:",Xt),at("Failed to load PDF document"),V(!1)}),()=>{Dt=!1,Mt.destroy().catch(()=>{})}},[R,f]),Fa.useEffect(()=>{if(!d)return;let Dt=!0,Mt=null;return d.getPage(k).then((Xt)=>{if(!Dt)return;let Gt=Xt.getViewport({scale:1}),ae=2,Xe=Xt.getViewport({scale:ae}),Re=document.createElement("canvas");Re.width=Xe.width,Re.height=Xe.height;let da=Re.getContext("2d");if(!da)return;if(Mt=Xt.render({canvasContext:da,viewport:Xe,canvas:Re}),!Dt){Mt.cancel();return}Mt.promise.then(()=>{if(!Dt)return;D(Re.toDataURL("image/png")),z({width:Gt.width,height:Gt.height})}).catch((Ve)=>{if(!Dt||Ve&&typeof Ve==="object"&&"name"in Ve&&Ve.name==="RenderingCancelledException")return;console.error("Failed to render page:",Ve)})}).catch((Xt)=>{if(!Dt)return;console.error("Failed to get page:",Xt)}),()=>{if(Dt=!1,Mt)Mt.cancel()}},[d,k]);let{width:ct,height:pt}=Q,G=T.width,Ct=T.height,Kt=1;if(ct>0&&pt>0&&G>0&&Ct>0)Kt=Math.min(ct/G,pt/Ct);Fa.useEffect(()=>{if(ct>0&&pt>0&&G>0&&Ct>0){Y(Kt);let Dt=(ct-G*Kt)/2,Mt=(pt-Ct*Kt)/2;ft({x:Dt,y:Mt})}},[t.id,k,ct,pt,Kt,G,Ct]);let le=(Dt)=>{let Mt=ct/2,Xt=pt/2,Gt=J*Dt;if(Gt<0.01||Gt>50)return;let ae=Mt-(Mt-W.x)*(Gt/J),Xe=Xt-(Xt-W.y)*(Gt/J);Y(Gt),ft({x:ae,y:Xe})},Ft=()=>{Y(Kt);let Dt=(ct-G*Kt)/2,Mt=(pt-Ct*Kt)/2;ft({x:Dt,y:Mt})},Et=async()=>{let Dt=t.media?.original?.key;if(!Dt||!t.id)return;try{let Mt=a?await Le.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:a,fileId:t.id},json:{key:Dt}}):await Le.api.files["download-url"].$post({json:{key:Dt,assetId:t.id}});if(!Mt.ok)return;let{url:Xt}=await Mt.json(),Gt=document.createElement("a");Gt.href=Xt,Gt.download=t.name||"document.pdf",document.body.appendChild(Gt),Gt.click(),document.body.removeChild(Gt)}catch{}},$t=[...e||[],...w];return rt("div",{className:"flex flex-col flex-1 h-full overflow-hidden bg-gray-100 dark:bg-gray-950 relative",children:[rt("div",{className:"flex-1 flex flex-col-reverse md:flex-row min-h-0 relative",children:[i,x("div",{ref:qt,className:"flex-1 relative overflow-hidden",children:E?x("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 z-20",children:x("div",{className:"w-8 h-8 border-4 border-white/30 border-t-white rounded-full animate-spin"})}):tt?x("div",{className:"absolute inset-0 flex items-center justify-center text-gray-500 text-sm",children:tt}):x(O0,{width:ct,height:pt,mediaDimensions:T,imageUrl:M,annotations:$t,scale:J,offset:W,onPan:ft,className:"absolute inset-0 z-0",isDrawing:c,currentTool:u,currentColor:m,onAddAnnotation:p})})]}),x(sO,{currentPage:k,totalPages:B,onPageChange:(Dt)=>{y(Dt),s?.()},zoom:J,onZoomIn:()=>le(1.2),onZoomOut:()=>le(0.8),onFit:Ft,onDownload:Et,canDownload:!!t.media?.original?.key})]})}),nO=$V;var lO={id:"pdf",name:"PDF",match:(t)=>t.proxyType==="pdf",viewer:nO,commentsConfig:{hasTimestamp:!0,hasAnnotations:!0,hasAiBots:!0,formatTimestamp:(t)=>`P${Math.round(t)}`}};var q6=Ie(Pa(),1);var WV=q6.default.forwardRef(({file:t,shareId:e,children:a},i)=>{return q6.useImperativeHandle(i,()=>({play:()=>{},pause:()=>{},seekTo:()=>{}})),rt("div",{className:"flex flex-col flex-1 h-full overflow-hidden bg-gray-100 dark:bg-gray-950 relative",children:[rt("div",{className:"flex-1 flex flex-col-reverse md:flex-row min-h-0 relative",children:[a,x("div",{className:"flex-1 flex items-center justify-center",children:x("p",{className:"text-muted-foreground",children:"Preview unavailable"})})]}),x("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:rt("button",{onClick:async()=>{let n=t.media?.original?.key;if(!n||!t.id)return;try{let l=e?await Le.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:e,fileId:t.id},json:{key:n}}):await Le.api.files["download-url"].$post({json:{key:n,assetId:t.id}});if(!l.ok)return;let{url:f}=await l.json(),o=document.createElement("a");o.href=f,o.download="",document.body.appendChild(o),o.click(),document.body.removeChild(o)}catch{}},disabled:!t.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:[x(Vn,{size:14}),"Download"]})})]})}),fO=WV;var yp={id:"default",name:"Default",match:()=>!0,viewer:fO,commentsConfig:{hasTimestamp:!1,hasAnnotations:!1,hasAiBots:!1}};var PV=[lO,Z_,eF];function rO(t){if(!t)return yp;return PV.find((a)=>a.match(t))||yp}function vot({teamId:t,projectId:e,file:a,onSaveField:i,members:s,onCommentSelect:n,hideAnnotationControl:l=!1,readOnly:f=!1,publicFields:o,isPublic:c=!1,shareId:u,currentTime:m,onTyping:p,selectedCommentId:w}){let{canEdit:d}=mO(e),{fields:v,setFields:k}=gO(),y=k5(),{ref:B,inView:H}=uO(),[M,D]=zn.useState(null),[T,z]=zn.useState(null),[E,V]=zn.useState(!1),[tt,at]=zn.useState(null),{data:Q}=po({queryKey:["fields",e],queryFn:async()=>{let Ft=await Le.api.projects[":projectId"].fields.$get({param:{projectId:e}});if(!Ft.ok)throw Error("Failed to fetch fields");return await Ft.json()},enabled:!!e&&!o}),{data:Z}=po({queryKey:["projects",e,"bots"],queryFn:async()=>{let Ft=await Le.api.projects[":projectId"].bots.$get({param:{projectId:e}});if(!Ft.ok)throw Error("Failed to fetch bots");return await Ft.json()},enabled:!!e&&!f}),J=rO(a),W=J?.commentsConfig?.hasAiBots?Z||[]:[];zn.useEffect(()=>{if(o)k(o,e);else if(Q)k(Q,e)},[Q,o,e,k]);let{data:ft,fetchNextPage:nt,hasNextPage:qt}=oO({queryKey:c?["shares",u,"files",a?.id,"comments"]:["files",a?.id,"comments"],queryFn:async({pageParam:Ft})=>{if(c){let Et=localStorage.getItem(`share_pwd_${u}`)||"",$t=await Le.api.shares[":shareId"].files[":fileId"].comments.$get({param:{shareId:u,fileId:a.id},query:{after:Ft}},{headers:{"x-share-password":Et}});if(!$t.ok)throw Error("Failed to fetch comments");return await $t.json()}else{let Et=await Le.api.files[":fileId"].comments.$get({param:{fileId:a.id},query:{after:Ft}});if(!Et.ok)throw Error("Failed to fetch comments");return await Et.json()}},enabled:!!a?.id&&(!c||!!u),initialPageParam:"",refetchInterval:2000,getNextPageParam:(Ft)=>Ft.pageInfo?.cursor||void 0}),{mutate:R}=Hf({mutationFn:async({text:Ft,attachmentIds:Et,annotations:$t,replyToId:Dt,guestUserId:Mt,second:Xt})=>{if(c){let Gt=localStorage.getItem(`share_pwd_${u}`)||"",ae=await Le.api.shares[":shareId"].files[":fileId"].comments.$post({param:{shareId:u,fileId:a.id},json:{message:Ft,attachmentIds:Et,replyToId:Dt??void 0,annotations:$t,second:Xt??void 0}},{headers:{"x-share-password":Gt,...Mt?{"x-guest-user-id":Mt}:{}}});if(!ae.ok)throw Error("Failed to create comment");return await ae.json()}else{let Gt=await Le.api.files[":fileId"].comments.$post({param:{fileId:a.id},json:{message:Ft,attachmentIds:Et,replyToId:Dt??void 0,annotations:$t,second:Xt??void 0}});if(!Gt.ok)throw Error("Failed to create comment");return await Gt.json()}},onSuccess:()=>{y.invalidateQueries({queryKey:c?["shares",u,"files",a?.id,"comments"]:["files",a?.id,"comments"]})}});zn.default.useEffect(()=>{if(H&&qt)nt()},[H,nt,qt]);let ct=zn.useMemo(()=>{return(a?.fieldValues||[]).reduce((Ft,Et)=>{return Ft[Et.fieldId]=Et,Ft},{})},[a?.fieldValues]),pt=zn.useMemo(()=>{return[...v].sort((Ft,Et)=>{let $t=Ft.config?.name?.toLowerCase()||"",Dt=Et.config?.name?.toLowerCase()||"";if($t<Dt)return-1;if($t>Dt)return 1;return 0})},[v]),G=ft?.pages.flatMap((Ft)=>Ft.data??[])??[],Ct=async(Ft,Et,$t,Dt,Mt)=>{if(!a?.id)return;if(c){console.log("[handleSendMessage] checking auth status");let Xt=await Le.api.me.$get(),{id:Gt}=await Xt.json();if(console.log("[handleSendMessage] loggedInUserId:",Gt),!Gt){let ae=localStorage.getItem("guest_user_id");if(console.log("[handleSendMessage] guestUserId from storage:",ae),!ae){console.log("[handleSendMessage] no guest ID, opening popup"),at({text:Ft,attachmentIds:Et,annotations:$t,replyToId:Dt,second:Mt}),V(!0);return}R({text:Ft,attachmentIds:Et,annotations:$t,replyToId:Dt,guestUserId:ae,second:Mt})}else R({text:Ft,attachmentIds:Et,annotations:$t,replyToId:Dt,second:Mt})}else R({text:Ft,attachmentIds:Et,annotations:$t,replyToId:Dt,second:Mt});D(null)},Kt=(Ft)=>{if(console.log("[handleGuestSuccess] guestUserId:",Ft),tt)R({...tt,guestUserId:Ft}),at(null),D(null)},le=(Ft)=>{let Et=s.find(($t)=>$t.id===Ft);if(Et)return Et;if(Z){let $t=Z.find((Dt)=>Dt.id===Ft);if($t)return{id:$t.id,name:$t.name,role:"bot"}}return{id:"unknown",name:"Unknown",role:"unknown"}};if(!a)return x("div",{className:"flex h-full items-center justify-center p-8 text-center bg-background",children:rt("div",{className:"space-y-2",children:[x("p",{className:"text-sm font-medium text-foreground",children:It.no_item_selected()}),x("p",{className:"text-xs text-muted-foreground",children:It.select_file_to_view_details()})]})});return rt("div",{className:"bg-background h-full flex flex-col overflow-hidden",children:[T&&T.proxyType==="image"&&rt("div",{className:"fixed inset-0 z-[100] bg-black/95 flex flex-col items-center justify-center p-4 animate-in fade-in duration-200",onClick:()=>z(null),children:[x("button",{className:"absolute top-4 right-4 text-white/70 hover:text-white bg-white/10 hover:bg-white/20 rounded-full p-2 transition-colors z-50",children:x(qo,{className:"w-8 h-8"})}),x("div",{className:"w-full h-full flex items-center justify-center p-2",children:x("img",{src:T.url,alt:"Enlarged view",className:"max-w-full max-h-[85vh] object-contain rounded shadow-2xl cursor-zoom-out",onClick:()=>z(null)})})]}),rt(hO,{defaultValue:"comments",className:"p-1 flex-1 flex flex-col px-2 min-h-0",children:[rt(cO,{className:"w-full shrink-0",children:[x(kp,{value:"comments",className:"flex-1",children:It.comments()}),x(kp,{value:"fields",className:"flex-1",children:It.fields()})]}),rt(Cp,{value:"comments",className:"flex-1 flex flex-col overflow-hidden min-h-0 mt-0",children:[x(_p,{className:"flex-1 min-h-0 [&>div>div]:block!",children:rt("div",{className:"space-y-4",children:[G.map((Ft)=>rt("div",{children:[x(f8,{teamId:t,message:Ft,getUser:le,onReply:D,onViewAttachment:z,hasReplies:!!Ft.replies?.length,formatTimestamp:J?.commentsConfig?.formatTimestamp,frameRate:J?.commentsConfig?.hasTimestamp?a?.media?.metadata?.frameRate||30:void 0,startTimecode:J?.commentsConfig?.hasTimestamp?a?.media?.metadata?.startTimecode:void 0,isSelected:w===Ft.id,onSelect:()=>{n?.(Ft)}}),Ft.replies?.map((Et,$t)=>x("div",{children:x(f8,{teamId:t,isReply:!0,message:Et,getUser:le,onReply:D,onViewAttachment:z,hasReplies:!1,isLastReply:$t===(Ft.replies?.length??0)-1,formatTimestamp:J?.commentsConfig?.formatTimestamp,frameRate:J?.commentsConfig?.hasTimestamp?a?.media?.metadata?.frameRate||30:void 0,startTimecode:J?.commentsConfig?.hasTimestamp?a?.media?.metadata?.startTimecode:void 0,isSelected:w===Et.id,onSelect:()=>{n?.(Et)}})},Et.id))]},Ft.id)),x("div",{ref:B})]})}),(!f||c)&&x("div",{className:"mt-4 shrink-0",children:x($d,{isOpen:E,onClose:()=>V(!1),onSuccess:Kt,children:x(o8,{projectId:e,onSendMessage:Ct,replyingTo:M,onCancelReply:()=>D(null),bots:W,hideAnnotationControl:l,disableMentions:c,currentTime:J?.commentsConfig?.hasTimestamp?m:void 0,formatTimestamp:J?.commentsConfig?.formatTimestamp,frameRate:J?.commentsConfig?.hasTimestamp?a?.media?.metadata?.frameRate||30:void 0,startTimecode:J?.commentsConfig?.hasTimestamp?a?.media?.metadata?.startTimecode:void 0,onTyping:p})})})]}),x(Cp,{value:"fields",className:"flex-1 flex flex-col overflow-hidden min-h-0 mt-4",children:x(_p,{className:"flex-1 px-4 min-h-0 [&>div>div]:block!",children:pt&&pt.length>0&&x("div",{className:"space-y-4 pb-4",children:pt.map((Ft)=>rt("div",{className:"space-y-1",children:[x("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:Ft.config?.name}),x("div",{className:"min-h-[28px]",children:x(bO,{config:Ft.config,value:ct[Ft.id]?.value,onSave:d?(Et)=>i(Ft.id,Et):void 0,readOnly:f||Ft.readOnly||!d})})]},Ft.id))})})})]})]})}
320
- export{go as n,Wk as o,tY as p,W_ as q,rO as r,vot as s};