@shumai-one/shumai 0.3.7 → 0.3.8

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 (151) hide show
  1. package/bin/{chunk-9nyhmtp9.js → chunk-0mmw31pj.js} +2 -2
  2. package/bin/{chunk-gjn3w26y.js → chunk-0pm8c9bq.js} +2 -2
  3. package/bin/{chunk-50keqtz9.js → chunk-0qpz48vc.js} +1 -1
  4. package/bin/{chunk-zjj9qj6y.js → chunk-0zbwpfsk.js} +2 -2
  5. package/bin/chunk-15jsnygy.js +5 -0
  6. package/bin/chunk-16s5kfy8.css +1 -0
  7. package/bin/{chunk-hqkmdp31.js → chunk-21rp4vzr.js} +2 -2
  8. package/bin/chunk-24ke0th1.css +1 -0
  9. package/bin/{chunk-260wywfb.js → chunk-28n8xqhm.js} +1 -1
  10. package/bin/{chunk-7hnw6y6d.js → chunk-2dxd0bar.js} +2 -2
  11. package/bin/{chunk-3dx0p1ge.js → chunk-2ejky9qv.js} +1 -1
  12. package/bin/{chunk-dej1gq35.js → chunk-2em77vjv.js} +1 -1
  13. package/bin/{chunk-zg60j9x2.js → chunk-2q26gz0p.js} +1 -1
  14. package/bin/{chunk-9s02m95j.js → chunk-2t0asg3w.js} +2 -2
  15. package/bin/{chunk-rfyaphas.js → chunk-2xaq1y16.js} +2 -2
  16. package/bin/{chunk-qmpph1gt.js → chunk-33r4w0yv.js} +2 -2
  17. package/bin/{chunk-1xzc6z02.js → chunk-3bm3be9d.js} +1 -1
  18. package/bin/{chunk-1sqz0va1.js → chunk-3mx22sn7.js} +2 -2
  19. package/bin/chunk-4cmw4qmt.js +1 -0
  20. package/bin/chunk-4d3wm83a.js +2 -0
  21. package/bin/{chunk-0jkqmbcx.js → chunk-4g4g02e0.js} +1 -1
  22. package/bin/{chunk-tpp9qf5m.js → chunk-5386brz2.js} +2 -2
  23. package/bin/{chunk-98j2z6he.js → chunk-5f9fk8x0.js} +3 -3
  24. package/bin/chunk-5fj5w0gg.js +2 -0
  25. package/bin/chunk-61bxmjd9.js +2 -0
  26. package/bin/{chunk-ptw49k86.js → chunk-6pcs8810.js} +1 -1
  27. package/bin/{chunk-x3ynjbt5.js → chunk-6pmsknnk.js} +2 -2
  28. package/bin/{chunk-9xhnmnnb.js → chunk-6vwqg1ra.js} +2 -2
  29. package/bin/{chunk-2mqqghrz.js → chunk-75segwsp.js} +2 -2
  30. package/bin/{chunk-ftc48rbb.js → chunk-7c85cyn0.js} +3 -3
  31. package/bin/chunk-7eyg2kgv.js +1 -0
  32. package/bin/chunk-7r22vcjy.js +2 -0
  33. package/bin/{chunk-0ycwr0kb.js → chunk-80g5kcm0.js} +1 -1
  34. package/bin/{chunk-5gtew41y.js → chunk-8bhsdk1v.js} +1 -1
  35. package/bin/{chunk-1khzycf9.js → chunk-8fsrs7mh.js} +1 -1
  36. package/bin/chunk-8jfm1j41.js +1 -0
  37. package/bin/chunk-8n6segk5.js +1 -0
  38. package/bin/chunk-99f9r6xm.js +2 -0
  39. package/bin/{chunk-2086rsb2.js → chunk-9acfydwy.js} +1 -1
  40. package/bin/{chunk-vxpnp4xg.js → chunk-9ntwrvhz.js} +2 -2
  41. package/bin/{chunk-s0hgykza.js → chunk-agdza65r.js} +2 -2
  42. package/bin/{chunk-6zs49mef.js → chunk-antsxrw9.js} +1 -1
  43. package/bin/chunk-bapy3qv8.js +1 -0
  44. package/bin/chunk-bc2bf144.js +2 -0
  45. package/bin/{chunk-v8w2nxew.js → chunk-bznz6h19.js} +1 -1
  46. package/bin/{chunk-qcqw7wnv.js → chunk-c24an5j3.js} +1 -1
  47. package/bin/chunk-cm74nd4n.js +1 -0
  48. package/bin/{chunk-87wqbn4g.js → chunk-cynjx7ha.js} +2 -2
  49. package/bin/chunk-cyq3m4qz.js +1 -0
  50. package/bin/chunk-ddff7vm3.js +2 -0
  51. package/bin/{chunk-br5xkaf7.js → chunk-djqs6m7w.js} +3 -3
  52. package/bin/{chunk-60hpa5kf.js → chunk-dn8k5ef5.js} +1 -1
  53. package/bin/chunk-dqdqs0d9.js +1 -0
  54. package/bin/chunk-drjaw6a5.js +14 -0
  55. package/bin/chunk-drvwchyn.js +2 -0
  56. package/bin/{chunk-esrtafz0.js → chunk-e4se9q6n.js} +1 -1
  57. package/bin/chunk-eb551xw7.js +1 -0
  58. package/bin/{chunk-nvjp2rnh.js → chunk-en96pr5c.js} +2 -2
  59. package/bin/{chunk-r5dv0rfv.js → chunk-ep138kb3.js} +2 -2
  60. package/bin/{chunk-jszpvg8e.js → chunk-eqf7k7ax.js} +2 -2
  61. package/bin/{chunk-f2j2cqd1.js → chunk-f3rqamey.js} +2 -2
  62. package/bin/{chunk-3kqdgddm.js → chunk-fvwz4mgw.js} +2 -2
  63. package/bin/chunk-g3p6h6sw.js +68 -0
  64. package/bin/{chunk-81tb4v5v.js → chunk-h9f55mjv.js} +2 -2
  65. package/bin/{chunk-n4gghgrj.js → chunk-jfjjh86p.js} +2 -2
  66. package/bin/{chunk-83k0wa5k.js → chunk-jg31cnqc.js} +2 -2
  67. package/bin/chunk-jk87gxbb.js +2 -0
  68. package/bin/{chunk-4bn9eb9h.js → chunk-jqzvazsf.js} +1 -1
  69. package/bin/chunk-jyk483r4.js +1 -0
  70. package/bin/{chunk-48nzw50r.js → chunk-k0ysbh3h.js} +1 -1
  71. package/bin/{chunk-fcs4v6jq.js → chunk-k5yxntns.js} +2 -2
  72. package/bin/chunk-khjybf4y.js +1 -0
  73. package/bin/{chunk-38g3s1f3.js → chunk-kmt9fj1z.js} +2 -2
  74. package/bin/{chunk-503qq6sa.js → chunk-m49ar48r.js} +2 -2
  75. package/bin/{chunk-a0k1b4sq.js → chunk-m7d52gfe.js} +1 -1
  76. package/bin/{chunk-x6532q76.js → chunk-mjxay7yv.js} +1 -1
  77. package/bin/{chunk-zqg4f56h.js → chunk-mp5etccz.js} +1 -1
  78. package/bin/{chunk-9gzy30zm.js → chunk-n8pas7tj.js} +2 -2
  79. package/bin/{chunk-b8v7jvkb.js → chunk-nc632fxz.js} +2 -2
  80. package/bin/{chunk-6fv38qdc.js → chunk-nffrjwb7.js} +2 -2
  81. package/bin/{chunk-7k3ccca6.js → chunk-p1rrkrn4.js} +1 -1
  82. package/bin/chunk-p6ep6grv.js +1 -0
  83. package/bin/{chunk-p4c4z0f2.js → chunk-ph43tgr6.js} +1 -1
  84. package/bin/{chunk-3xzgddev.js → chunk-pqtwzb3s.js} +1 -1
  85. package/bin/chunk-q0xv46wa.js +2 -0
  86. package/bin/{chunk-qh9rz2ee.js → chunk-qhxznkjk.js} +5 -5
  87. package/bin/chunk-qmja7bsr.js +2 -0
  88. package/bin/{chunk-v98e3gex.js → chunk-qyegjbzd.js} +1 -1
  89. package/bin/{chunk-gjdmnfms.js → chunk-r5rf62aa.js} +1 -1
  90. package/bin/{chunk-2xmsrq7f.js → chunk-rjkj0dr9.js} +2 -2
  91. package/bin/chunk-rjr8c8be.js +3 -0
  92. package/bin/{chunk-af6wbhkv.js → chunk-rq4h4p2g.js} +2 -2
  93. package/bin/{chunk-zwgf211t.js → chunk-scmhhrte.js} +2 -2
  94. package/bin/chunk-sjr6mvgm.js +78 -0
  95. package/bin/{chunk-t9t9evan.js → chunk-ssz62jfs.js} +2 -2
  96. package/bin/{chunk-g60v3jc1.js → chunk-ta02azkp.js} +1 -1
  97. package/bin/{chunk-tzt4c1dm.js → chunk-tfnh9sk9.js} +2 -2
  98. package/bin/{chunk-cqq8e3hc.js → chunk-thqahbva.js} +2 -2
  99. package/bin/chunk-tvzfm7g8.js +2 -0
  100. package/bin/{chunk-k48y9e5s.js → chunk-twm329fs.js} +1 -1
  101. package/bin/{chunk-0t8q76ac.js → chunk-ve826t5r.js} +1 -1
  102. package/bin/chunk-vpfj3q7r.js +1 -0
  103. package/bin/chunk-vqakgjsf.js +1 -0
  104. package/bin/chunk-wgjghs54.js +7 -0
  105. package/bin/chunk-wy1ytxw7.js +41 -0
  106. package/bin/{chunk-t3tp9trj.js → chunk-x788nk6z.js} +2 -2
  107. package/bin/{chunk-b3jh3hf1.js → chunk-x8ksced7.js} +2 -2
  108. package/bin/{chunk-qdycy714.js → chunk-xexxh1zq.js} +1 -1
  109. package/bin/{chunk-6v39c8eg.js → chunk-xktnqktj.js} +2 -2
  110. package/bin/{chunk-7872prvg.js → chunk-xpce3j7g.js} +1 -1
  111. package/bin/{chunk-karn564z.js → chunk-xyzsmjtk.js} +2 -2
  112. package/bin/chunk-y03s8bkz.js +1 -0
  113. package/bin/{chunk-kpn9d97x.js → chunk-y5g2ge6f.js} +1 -1
  114. package/bin/{chunk-qy93r7tm.js → chunk-ygcmv04c.js} +2 -2
  115. package/bin/{chunk-ytzk81tr.js → chunk-ykarhcph.js} +1 -1
  116. package/bin/{chunk-bancgvrc.js → chunk-yr8a8nzv.js} +2 -2
  117. package/bin/chunk-yxtb7xn8.js +2 -0
  118. package/bin/{chunk-n76r6s9k.js → chunk-zaft3sfe.js} +2 -2
  119. package/bin/shumai-app.html +1 -1
  120. package/bin/shumai-app.js +237 -215
  121. package/package.json +7 -7
  122. package/prisma/migrations/20260814090300_add_asset_agentmd/migration.sql +2 -0
  123. package/prisma/migrations/20260814125921_create_asset_agentmd_table/migration.sql +21 -0
  124. package/prisma/schema.prisma +12 -0
  125. package/bin/chunk-0xern7e4.js +0 -1
  126. package/bin/chunk-0yngn45x.js +0 -2
  127. package/bin/chunk-4egayx81.js +0 -2
  128. package/bin/chunk-4rbzswqs.js +0 -71
  129. package/bin/chunk-69tt1pvr.js +0 -2
  130. package/bin/chunk-815ezj20.js +0 -1
  131. package/bin/chunk-85eg9xqx.js +0 -1
  132. package/bin/chunk-86aagej8.js +0 -1
  133. package/bin/chunk-8y1v9dm9.js +0 -2
  134. package/bin/chunk-9gq9782d.js +0 -1
  135. package/bin/chunk-bv88se28.css +0 -1
  136. package/bin/chunk-dv1zpd2p.js +0 -15
  137. package/bin/chunk-eetrc0j1.js +0 -3
  138. package/bin/chunk-eztggp8r.js +0 -1
  139. package/bin/chunk-gf5ds9r9.js +0 -2
  140. package/bin/chunk-h9emz0zb.js +0 -2
  141. package/bin/chunk-h9k2atte.js +0 -1
  142. package/bin/chunk-kkq4wvnc.js +0 -1
  143. package/bin/chunk-ksx113sp.js +0 -1
  144. package/bin/chunk-m6a4rzdt.js +0 -62
  145. package/bin/chunk-mw8f8ngt.js +0 -7
  146. package/bin/chunk-rvspnthy.js +0 -1
  147. package/bin/chunk-sjjndwt4.js +0 -2
  148. package/bin/chunk-tvg9gvqs.js +0 -1
  149. package/bin/chunk-xp4dcyk3.js +0 -1
  150. package/bin/chunk-y8aehqr8.js +0 -2
  151. package/bin/chunk-yvxt48r4.js +0 -1
@@ -1,4 +1,4 @@
1
- import{s as Jp,t as Qp}from"./chunk-dv1zpd2p.js";import{C as _S,E as i7,Q as l7,R as FS,S as fv,T as Il,U as Am,V as qg,W as Wm,X as rv}from"./chunk-y8aehqr8.js";import{ca as Ju,da as Qu,ea as Zu}from"./chunk-83k0wa5k.js";import{fb as J8}from"./chunk-rfyaphas.js";import{kb as Ip,lb as Up,mb as Gp,nb as Xp,ob as Kp,pb as Lp,qb as Vp,rb as Yp}from"./chunk-karn564z.js";import{$f as xk,Vf as Vm,Wf as Ym,Xf as Hk,Zf as Vg,_f as Dk,bg as Rk,cg as Xk,dg as Yg,eg as Nk,fg as Ek,gg as AS,hg as yS,ig as V8,jg as Y8,qg as Yu}from"./chunk-qmpph1gt.js";import{Eg as _1}from"./chunk-69tt1pvr.js";import{Fg as SS,Gg as cs}from"./chunk-f2j2cqd1.js";import{Hg as Rp,Ig as Np,Jg as Ep,Kg as zp}from"./chunk-2xmsrq7f.js";import{Lg as M3}from"./chunk-af6wbhkv.js";import{hh as ar,jh as nr,kh as sr,lh as Ki,oh as Sm,ph as lv,th as s7,uh as CS}from"./chunk-n4gghgrj.js";import{Ah as oe,Ai as $m,Ak as vs,Bh as Lu,Cj as e7,Ck as Si,Dj as tv,Dk as Lc,Eh as Kc,Ej as vo,Ek as Vc,Fj as ko,Fk as Yc,Gh as tr,Gi as Wp,Hh as kS,Hj as t7,Ik as Ge,Ji as qo,Jj as av,Jk as T3,Ki as O1,Li as gS,Mi as pS,Nj as nv,Si as Pp,Sj as a7,Ui as oA,Wh as Zp,Xi as Ci,Xj as xp,Zj as n7,_i as Vu,bi as Ht,ck as sv,dk as iv,fk as B1,li as Dp,ni as f7,tj as Cm,wi as $p,xh as Pa,yh as F1,yi as O3,yj as _m,zh as I,zj as Ul}from"./chunk-m6a4rzdt.js";import{Nl as Rt,Ol as Dt,Pl as IR}from"./chunk-dej1gq35.js";var Li=Dt((Pz,o7)=>{var Qc;if(typeof window<"u")Qc=window;else if(typeof global<"u")Qc=global;else if(typeof self<"u")Qc=self;else Qc={};o7.exports=Qc});var H3=Dt((eI,h7)=>{var c7=Array.prototype.slice;h7.exports=y_;function y_(e,t){if(!("length"in e))e=[e];e=c7.call(e);while(e.length){var a=e.shift(),n=t(a);if(n)return n;if(a.childNodes&&a.childNodes.length)e=c7.call(a.childNodes).concat(e)}}});var m7=Dt((tI,u7)=>{u7.exports=T1;function T1(e,t){if(!(this instanceof T1))return new T1(e,t);this.data=e,this.nodeValue=e,this.length=e.length,this.ownerDocument=t||null}T1.prototype.nodeType=8;T1.prototype.nodeName="#comment";T1.prototype.toString=function(){return"[object Comment]"}});var p7=Dt((aI,g7)=>{g7.exports=Gl;function Gl(e,t){if(!(this instanceof Gl))return new Gl(e);this.data=e||"",this.length=this.data.length,this.ownerDocument=t||null}Gl.prototype.type="DOMTextNode";Gl.prototype.nodeType=3;Gl.prototype.nodeName="#text";Gl.prototype.toString=function(){return this.data};Gl.prototype.replaceData=function(t,a,n){var s=this.data,i=s.substring(0,t),l=s.substring(t+a,s.length);this.data=i+n+l,this.length=this.data.length}});var D3=Dt((nI,b7)=>{b7.exports=S_;function S_(e){var t=this,a=e.type;if(!e.target)e.target=t;if(!t.listeners)t.listeners={};var n=t.listeners[a];if(n)return n.forEach(function(s){if(e.currentTarget=t,typeof s==="function")s(e);else s.handleEvent(e)});if(t.parentNode)t.parentNode.dispatchEvent(e)}});var x3=Dt((sI,w7)=>{w7.exports=C_;function C_(e,t){var a=this;if(!a.listeners)a.listeners={};if(!a.listeners[e])a.listeners[e]=[];if(a.listeners[e].indexOf(t)===-1)a.listeners[e].push(t)}});var R3=Dt((iI,d7)=>{d7.exports=__;function __(e,t){var a=this;if(!a.listeners)return;if(!a.listeners[e])return;var n=a.listeners[e],s=n.indexOf(t);if(s!==-1)n.splice(s,1)}});var k7=Dt((lI,v7)=>{v7.exports=j7;var F_=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];function j7(e){switch(e.nodeType){case 3:return N3(e.data);case 8:return"<!--"+e.data+"-->";default:return O_(e)}}function O_(e){var t=[],a=e.tagName;if(e.namespaceURI==="http://www.w3.org/1999/xhtml")a=a.toLowerCase();if(t.push("<"+a+H_(e)+M_(e)),F_.indexOf(a)>-1)t.push(" />");else{if(t.push(">"),e.childNodes.length)t.push.apply(t,e.childNodes.map(j7));else if(e.textContent||e.innerText)t.push(N3(e.textContent||e.innerText));else if(e.innerHTML)t.push(e.innerHTML);t.push("</"+a+">")}return t.join("")}function B_(e,t){var a=typeof e[t];if(t==="style"&&Object.keys(e.style).length>0)return!0;return e.hasOwnProperty(t)&&(a==="string"||a==="boolean"||a==="number")&&t!=="nodeName"&&t!=="className"&&t!=="tagName"&&t!=="textContent"&&t!=="innerText"&&t!=="namespaceURI"&&t!=="innerHTML"}function T_(e){if(typeof e==="string")return e;var t="";return Object.keys(e).forEach(function(a){var n=e[a];a=a.replace(/[A-Z]/g,function(s){return"-"+s.toLowerCase()}),t+=a+":"+n+";"}),t}function M_(e){var t=e.dataset,a=[];for(var n in t)a.push({name:"data-"+n,value:t[n]});return a.length?q7(a):""}function q7(e){var t=[];return e.forEach(function(a){var{name:n,value:s}=a;if(n==="style")s=T_(s);t.push(n+'="'+D_(s)+'"')}),t.length?" "+t.join(" "):""}function H_(e){var t=[];for(var a in e)if(B_(e,a))t.push({name:a,value:e[a]});for(var n in e._attributes)for(var s in e._attributes[n]){var i=e._attributes[n][s],l=(i.prefix?i.prefix+":":"")+s;t.push({name:l,value:i.value})}if(e.className)t.push({name:"class",value:e.className});return t.length?q7(t):""}function N3(e){var t="";if(typeof e==="string")t=e;else if(e)t=e.toString();return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function D_(e){return N3(e).replace(/"/g,"&quot;")}});var z3=Dt((fI,y7)=>{var E3=H3(),x_=D3(),R_=x3(),N_=R3(),E_=k7(),A7="http://www.w3.org/1999/xhtml";y7.exports=wa;function wa(e,t,a){if(!(this instanceof wa))return new wa(e);var n=a===void 0?A7:a||null;if(this.tagName=n===A7?String(e).toUpperCase():e,this.nodeName=this.tagName,this.className="",this.dataset={},this.childNodes=[],this.parentNode=null,this.style={},this.ownerDocument=t||null,this.namespaceURI=n,this._attributes={},this.tagName==="INPUT")this.type="text"}wa.prototype.type="DOMElement";wa.prototype.nodeType=1;wa.prototype.appendChild=function(t){if(t.parentNode)t.parentNode.removeChild(t);return this.childNodes.push(t),t.parentNode=this,t};wa.prototype.replaceChild=function(t,a){if(t.parentNode)t.parentNode.removeChild(t);var n=this.childNodes.indexOf(a);return a.parentNode=null,this.childNodes[n]=t,t.parentNode=this,a};wa.prototype.removeChild=function(t){var a=this.childNodes.indexOf(t);return this.childNodes.splice(a,1),t.parentNode=null,t};wa.prototype.insertBefore=function(t,a){if(t.parentNode)t.parentNode.removeChild(t);var n=a===null||a===void 0?-1:this.childNodes.indexOf(a);if(n>-1)this.childNodes.splice(n,0,t);else this.childNodes.push(t);return t.parentNode=this,t};wa.prototype.setAttributeNS=function(t,a,n){var s=null,i=a,l=a.indexOf(":");if(l>-1)s=a.substr(0,l),i=a.substr(l+1);if(this.tagName==="INPUT"&&a==="type")this.type=n;else{var f=this._attributes[t]||(this._attributes[t]={});f[i]={value:n,prefix:s}}};wa.prototype.getAttributeNS=function(t,a){var n=this._attributes[t],s=n&&n[a]&&n[a].value;if(this.tagName==="INPUT"&&a==="type")return this.type;if(typeof s!=="string")return null;return s};wa.prototype.removeAttributeNS=function(t,a){if(!Object.prototype.hasOwnProperty.call(this._attributes,t))return;var n=this._attributes[t];if(n&&Object.prototype.hasOwnProperty.call(n,a))delete n[a]};wa.prototype.hasAttributeNS=function(t,a){var n=this._attributes[t];return!!n&&a in n};wa.prototype.setAttribute=function(t,a){return this.setAttributeNS(null,t,a)};wa.prototype.getAttribute=function(t){return this.getAttributeNS(null,t)};wa.prototype.removeAttribute=function(t){return this.removeAttributeNS(null,t)};wa.prototype.hasAttribute=function(t){return this.hasAttributeNS(null,t)};wa.prototype.removeEventListener=N_;wa.prototype.addEventListener=R_;wa.prototype.dispatchEvent=x_;wa.prototype.focus=function(){return};wa.prototype.toString=function(){return E_(this)};wa.prototype.getElementsByClassName=function(t){var a=t.split(" "),n=[];return E3(this,function(s){if(s.nodeType===1){var i=s.className||"",l=i.split(" ");if(a.every(function(f){return l.indexOf(f)!==-1}))n.push(s)}}),n};wa.prototype.getElementsByTagName=function(t){t=t.toLowerCase();var a=[];return E3(this.childNodes,function(n){if(n.nodeType===1&&(t==="*"||n.tagName.toLowerCase()===t))a.push(n)}),a};wa.prototype.contains=function(t){return E3(this,function(a){return t===a})||!1}});var C7=Dt((rI,S7)=>{var I3=z3();S7.exports=Vi;function Vi(e){if(!(this instanceof Vi))return new Vi;this.childNodes=[],this.parentNode=null,this.ownerDocument=e||null}Vi.prototype.type="DocumentFragment";Vi.prototype.nodeType=11;Vi.prototype.nodeName="#document-fragment";Vi.prototype.appendChild=I3.prototype.appendChild;Vi.prototype.replaceChild=I3.prototype.replaceChild;Vi.prototype.removeChild=I3.prototype.removeChild;Vi.prototype.toString=function(){return this.childNodes.map(function(t){return String(t)}).join("")}});var F7=Dt((oI,_7)=>{_7.exports=U3;function U3(e){}U3.prototype.initEvent=function(t,a,n){this.type=t,this.bubbles=a,this.cancelable=n};U3.prototype.preventDefault=function(){}});var B7=Dt((cI,O7)=>{var z_=H3(),I_=m7(),U_=p7(),Zc=z3(),G_=C7(),X_=F7(),K_=D3(),L_=x3(),V_=R3();O7.exports=$u;function $u(){if(!(this instanceof $u))return new $u;this.head=this.createElement("head"),this.body=this.createElement("body"),this.documentElement=this.createElement("html"),this.documentElement.appendChild(this.head),this.documentElement.appendChild(this.body),this.childNodes=[this.documentElement],this.nodeType=9}var Ns=$u.prototype;Ns.createTextNode=function(t){return new U_(t,this)};Ns.createElementNS=function(t,a){var n=t===null?null:String(t);return new Zc(a,this,n)};Ns.createElement=function(t){return new Zc(t,this)};Ns.createDocumentFragment=function(){return new G_(this)};Ns.createEvent=function(t){return new X_(t)};Ns.createComment=function(t){return new I_(t,this)};Ns.getElementById=function(t){t=String(t);var a=z_(this.childNodes,function(n){if(String(n.id)===t)return n});return a||null};Ns.getElementsByClassName=Zc.prototype.getElementsByClassName;Ns.getElementsByTagName=Zc.prototype.getElementsByTagName;Ns.contains=Zc.prototype.contains;Ns.removeEventListener=V_;Ns.addEventListener=L_;Ns.dispatchEvent=K_});var M7=Dt((hI,T7)=>{var Y_=B7();T7.exports=new Y_});var G3=Dt((uI,D7)=>{var H7=typeof global<"u"?global:typeof window<"u"?window:{},J_=M7(),$c;if(typeof document<"u")$c=document;else if($c=H7["__GLOBAL_DOCUMENT_CACHE@4"],!$c)$c=H7["__GLOBAL_DOCUMENT_CACHE@4"]=J_;D7.exports=$c});var x7=Dt((mI,z0)=>{function X3(){return z0.exports=X3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},z0.exports.__esModule=!0,z0.exports.default=z0.exports,X3.apply(null,arguments)}z0.exports=X3,z0.exports.__esModule=!0,z0.exports.default=z0.exports});var N7=Dt((gI,R7)=>{R7.exports=Z_;var Q_=Object.prototype.toString;function Z_(e){if(!e)return!1;var t=Q_.call(e);return t==="[object Function]"||typeof e==="function"&&t!=="[object RegExp]"||typeof window<"u"&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)}});var I7=Dt((pI,z7)=>{function $_(e,t){var a=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(a)return(a=a.call(e)).next.bind(a);if(Array.isArray(e)||(a=W_(e))||t&&e&&typeof e.length==="number"){if(a)e=a;var n=0;return function(){if(n>=e.length)return{done:!0};return{done:!1,value:e[n++]}}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
1
+ import{B as _S,D as i7,N as l7,O as FS,P as fv,Q as Il,R as Am,S as qg,T as Wm,U as rv}from"./chunk-61bxmjd9.js";import{W as Qp}from"./chunk-99f9r6xm.js";import{X as Ju,Y as Qu,Z as Zu}from"./chunk-jg31cnqc.js";import{na as Jp}from"./chunk-drjaw6a5.js";import{Aa as Vp,Ba as Yp,ua as Ip,va as Up,wa as Gp,xa as Xp,ya as Kp,za as Lp}from"./chunk-xyzsmjtk.js";import{Gf as Yu,jf as Vm,kf as Ym,lf as Hk,nf as Vg,of as Dk,pf as xk,rf as Rk,sf as Xk,tf as Yg,uf as Nk,vf as Ek,wf as AS,xf as yS,yf as V8,zf as Y8}from"./chunk-33r4w0yv.js";import{Hg as _1}from"./chunk-g3p6h6sw.js";import{Ig as J8}from"./chunk-2xaq1y16.js";import{Kg as SS,Lg as cs}from"./chunk-f3rqamey.js";import{Mg as Rp,Ng as Np,Og as Ep,Pg as zp}from"./chunk-rjkj0dr9.js";import{Qg as M3}from"./chunk-rq4h4p2g.js";import{mh as Lc,nh as Vc,oh as Yc}from"./chunk-5fj5w0gg.js";import{Bh as s7,Ch as CS,ph as ar,rh as nr,sh as sr,th as Ki,wh as Sm,xh as lv}from"./chunk-jfjjh86p.js";import{$i as Pp,$j as av,$k as Ge,Ak as B1,Ei as $p,Fh as Pa,Gh as F1,Gi as O3,Hh as I,Ih as oe,Ii as $m,Ij as Cm,Jh as Lu,Mh as Kc,Nj as _m,Oh as tr,Oj as Ul,Ph as kS,Pi as Wp,Rj as e7,Si as qo,Sj as tv,Ti as O1,Tj as vo,Ui as gS,Uj as ko,Vi as pS,Wk as vs,Yj as t7,Yk as Si,bj as oA,ci as Zp,dk as nv,ej as Ci,hj as Vu,hl as T3,ik as a7,ji as Ht,ok as xp,sk as n7,ti as Dp,vi as f7,xk as sv,yk as iv}from"./chunk-sjr6mvgm.js";import{em as Rt,fm as Dt,gm as IR}from"./chunk-2em77vjv.js";var Li=Dt((Pz,o7)=>{var Qc;if(typeof window<"u")Qc=window;else if(typeof global<"u")Qc=global;else if(typeof self<"u")Qc=self;else Qc={};o7.exports=Qc});var H3=Dt((eI,h7)=>{var c7=Array.prototype.slice;h7.exports=y_;function y_(e,t){if(!("length"in e))e=[e];e=c7.call(e);while(e.length){var a=e.shift(),n=t(a);if(n)return n;if(a.childNodes&&a.childNodes.length)e=c7.call(a.childNodes).concat(e)}}});var m7=Dt((tI,u7)=>{u7.exports=T1;function T1(e,t){if(!(this instanceof T1))return new T1(e,t);this.data=e,this.nodeValue=e,this.length=e.length,this.ownerDocument=t||null}T1.prototype.nodeType=8;T1.prototype.nodeName="#comment";T1.prototype.toString=function(){return"[object Comment]"}});var p7=Dt((aI,g7)=>{g7.exports=Gl;function Gl(e,t){if(!(this instanceof Gl))return new Gl(e);this.data=e||"",this.length=this.data.length,this.ownerDocument=t||null}Gl.prototype.type="DOMTextNode";Gl.prototype.nodeType=3;Gl.prototype.nodeName="#text";Gl.prototype.toString=function(){return this.data};Gl.prototype.replaceData=function(t,a,n){var s=this.data,i=s.substring(0,t),l=s.substring(t+a,s.length);this.data=i+n+l,this.length=this.data.length}});var D3=Dt((nI,b7)=>{b7.exports=S_;function S_(e){var t=this,a=e.type;if(!e.target)e.target=t;if(!t.listeners)t.listeners={};var n=t.listeners[a];if(n)return n.forEach(function(s){if(e.currentTarget=t,typeof s==="function")s(e);else s.handleEvent(e)});if(t.parentNode)t.parentNode.dispatchEvent(e)}});var x3=Dt((sI,w7)=>{w7.exports=C_;function C_(e,t){var a=this;if(!a.listeners)a.listeners={};if(!a.listeners[e])a.listeners[e]=[];if(a.listeners[e].indexOf(t)===-1)a.listeners[e].push(t)}});var R3=Dt((iI,d7)=>{d7.exports=__;function __(e,t){var a=this;if(!a.listeners)return;if(!a.listeners[e])return;var n=a.listeners[e],s=n.indexOf(t);if(s!==-1)n.splice(s,1)}});var k7=Dt((lI,v7)=>{v7.exports=j7;var F_=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];function j7(e){switch(e.nodeType){case 3:return N3(e.data);case 8:return"<!--"+e.data+"-->";default:return O_(e)}}function O_(e){var t=[],a=e.tagName;if(e.namespaceURI==="http://www.w3.org/1999/xhtml")a=a.toLowerCase();if(t.push("<"+a+H_(e)+M_(e)),F_.indexOf(a)>-1)t.push(" />");else{if(t.push(">"),e.childNodes.length)t.push.apply(t,e.childNodes.map(j7));else if(e.textContent||e.innerText)t.push(N3(e.textContent||e.innerText));else if(e.innerHTML)t.push(e.innerHTML);t.push("</"+a+">")}return t.join("")}function B_(e,t){var a=typeof e[t];if(t==="style"&&Object.keys(e.style).length>0)return!0;return e.hasOwnProperty(t)&&(a==="string"||a==="boolean"||a==="number")&&t!=="nodeName"&&t!=="className"&&t!=="tagName"&&t!=="textContent"&&t!=="innerText"&&t!=="namespaceURI"&&t!=="innerHTML"}function T_(e){if(typeof e==="string")return e;var t="";return Object.keys(e).forEach(function(a){var n=e[a];a=a.replace(/[A-Z]/g,function(s){return"-"+s.toLowerCase()}),t+=a+":"+n+";"}),t}function M_(e){var t=e.dataset,a=[];for(var n in t)a.push({name:"data-"+n,value:t[n]});return a.length?q7(a):""}function q7(e){var t=[];return e.forEach(function(a){var{name:n,value:s}=a;if(n==="style")s=T_(s);t.push(n+'="'+D_(s)+'"')}),t.length?" "+t.join(" "):""}function H_(e){var t=[];for(var a in e)if(B_(e,a))t.push({name:a,value:e[a]});for(var n in e._attributes)for(var s in e._attributes[n]){var i=e._attributes[n][s],l=(i.prefix?i.prefix+":":"")+s;t.push({name:l,value:i.value})}if(e.className)t.push({name:"class",value:e.className});return t.length?q7(t):""}function N3(e){var t="";if(typeof e==="string")t=e;else if(e)t=e.toString();return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function D_(e){return N3(e).replace(/"/g,"&quot;")}});var z3=Dt((fI,y7)=>{var E3=H3(),x_=D3(),R_=x3(),N_=R3(),E_=k7(),A7="http://www.w3.org/1999/xhtml";y7.exports=wa;function wa(e,t,a){if(!(this instanceof wa))return new wa(e);var n=a===void 0?A7:a||null;if(this.tagName=n===A7?String(e).toUpperCase():e,this.nodeName=this.tagName,this.className="",this.dataset={},this.childNodes=[],this.parentNode=null,this.style={},this.ownerDocument=t||null,this.namespaceURI=n,this._attributes={},this.tagName==="INPUT")this.type="text"}wa.prototype.type="DOMElement";wa.prototype.nodeType=1;wa.prototype.appendChild=function(t){if(t.parentNode)t.parentNode.removeChild(t);return this.childNodes.push(t),t.parentNode=this,t};wa.prototype.replaceChild=function(t,a){if(t.parentNode)t.parentNode.removeChild(t);var n=this.childNodes.indexOf(a);return a.parentNode=null,this.childNodes[n]=t,t.parentNode=this,a};wa.prototype.removeChild=function(t){var a=this.childNodes.indexOf(t);return this.childNodes.splice(a,1),t.parentNode=null,t};wa.prototype.insertBefore=function(t,a){if(t.parentNode)t.parentNode.removeChild(t);var n=a===null||a===void 0?-1:this.childNodes.indexOf(a);if(n>-1)this.childNodes.splice(n,0,t);else this.childNodes.push(t);return t.parentNode=this,t};wa.prototype.setAttributeNS=function(t,a,n){var s=null,i=a,l=a.indexOf(":");if(l>-1)s=a.substr(0,l),i=a.substr(l+1);if(this.tagName==="INPUT"&&a==="type")this.type=n;else{var f=this._attributes[t]||(this._attributes[t]={});f[i]={value:n,prefix:s}}};wa.prototype.getAttributeNS=function(t,a){var n=this._attributes[t],s=n&&n[a]&&n[a].value;if(this.tagName==="INPUT"&&a==="type")return this.type;if(typeof s!=="string")return null;return s};wa.prototype.removeAttributeNS=function(t,a){if(!Object.prototype.hasOwnProperty.call(this._attributes,t))return;var n=this._attributes[t];if(n&&Object.prototype.hasOwnProperty.call(n,a))delete n[a]};wa.prototype.hasAttributeNS=function(t,a){var n=this._attributes[t];return!!n&&a in n};wa.prototype.setAttribute=function(t,a){return this.setAttributeNS(null,t,a)};wa.prototype.getAttribute=function(t){return this.getAttributeNS(null,t)};wa.prototype.removeAttribute=function(t){return this.removeAttributeNS(null,t)};wa.prototype.hasAttribute=function(t){return this.hasAttributeNS(null,t)};wa.prototype.removeEventListener=N_;wa.prototype.addEventListener=R_;wa.prototype.dispatchEvent=x_;wa.prototype.focus=function(){return};wa.prototype.toString=function(){return E_(this)};wa.prototype.getElementsByClassName=function(t){var a=t.split(" "),n=[];return E3(this,function(s){if(s.nodeType===1){var i=s.className||"",l=i.split(" ");if(a.every(function(f){return l.indexOf(f)!==-1}))n.push(s)}}),n};wa.prototype.getElementsByTagName=function(t){t=t.toLowerCase();var a=[];return E3(this.childNodes,function(n){if(n.nodeType===1&&(t==="*"||n.tagName.toLowerCase()===t))a.push(n)}),a};wa.prototype.contains=function(t){return E3(this,function(a){return t===a})||!1}});var C7=Dt((rI,S7)=>{var I3=z3();S7.exports=Vi;function Vi(e){if(!(this instanceof Vi))return new Vi;this.childNodes=[],this.parentNode=null,this.ownerDocument=e||null}Vi.prototype.type="DocumentFragment";Vi.prototype.nodeType=11;Vi.prototype.nodeName="#document-fragment";Vi.prototype.appendChild=I3.prototype.appendChild;Vi.prototype.replaceChild=I3.prototype.replaceChild;Vi.prototype.removeChild=I3.prototype.removeChild;Vi.prototype.toString=function(){return this.childNodes.map(function(t){return String(t)}).join("")}});var F7=Dt((oI,_7)=>{_7.exports=U3;function U3(e){}U3.prototype.initEvent=function(t,a,n){this.type=t,this.bubbles=a,this.cancelable=n};U3.prototype.preventDefault=function(){}});var B7=Dt((cI,O7)=>{var z_=H3(),I_=m7(),U_=p7(),Zc=z3(),G_=C7(),X_=F7(),K_=D3(),L_=x3(),V_=R3();O7.exports=$u;function $u(){if(!(this instanceof $u))return new $u;this.head=this.createElement("head"),this.body=this.createElement("body"),this.documentElement=this.createElement("html"),this.documentElement.appendChild(this.head),this.documentElement.appendChild(this.body),this.childNodes=[this.documentElement],this.nodeType=9}var Ns=$u.prototype;Ns.createTextNode=function(t){return new U_(t,this)};Ns.createElementNS=function(t,a){var n=t===null?null:String(t);return new Zc(a,this,n)};Ns.createElement=function(t){return new Zc(t,this)};Ns.createDocumentFragment=function(){return new G_(this)};Ns.createEvent=function(t){return new X_(t)};Ns.createComment=function(t){return new I_(t,this)};Ns.getElementById=function(t){t=String(t);var a=z_(this.childNodes,function(n){if(String(n.id)===t)return n});return a||null};Ns.getElementsByClassName=Zc.prototype.getElementsByClassName;Ns.getElementsByTagName=Zc.prototype.getElementsByTagName;Ns.contains=Zc.prototype.contains;Ns.removeEventListener=V_;Ns.addEventListener=L_;Ns.dispatchEvent=K_});var M7=Dt((hI,T7)=>{var Y_=B7();T7.exports=new Y_});var G3=Dt((uI,D7)=>{var H7=typeof global<"u"?global:typeof window<"u"?window:{},J_=M7(),$c;if(typeof document<"u")$c=document;else if($c=H7["__GLOBAL_DOCUMENT_CACHE@4"],!$c)$c=H7["__GLOBAL_DOCUMENT_CACHE@4"]=J_;D7.exports=$c});var x7=Dt((mI,z0)=>{function X3(){return z0.exports=X3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},z0.exports.__esModule=!0,z0.exports.default=z0.exports,X3.apply(null,arguments)}z0.exports=X3,z0.exports.__esModule=!0,z0.exports.default=z0.exports});var N7=Dt((gI,R7)=>{R7.exports=Z_;var Q_=Object.prototype.toString;function Z_(e){if(!e)return!1;var t=Q_.call(e);return t==="[object Function]"||typeof e==="function"&&t!=="[object RegExp]"||typeof window<"u"&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)}});var I7=Dt((pI,z7)=>{function $_(e,t){var a=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(a)return(a=a.call(e)).next.bind(a);if(Array.isArray(e)||(a=W_(e))||t&&e&&typeof e.length==="number"){if(a)e=a;var n=0;return function(){if(n>=e.length)return{done:!0};return{done:!1,value:e[n++]}}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function W_(e,t){if(!e)return;if(typeof e==="string")return E7(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);if(a==="Object"&&e.constructor)a=e.constructor.name;if(a==="Map"||a==="Set")return Array.from(e);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return E7(e,t)}function E7(e,t){if(t==null||t>e.length)t=e.length;for(var a=0,n=Array(t);a<t;a++)n[a]=e[a];return n}var P_=function(){function e(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var t=e.prototype;return t.getIsEnabled=function(){return this.enabled_},t.enable=function(){this.enabled_=!0},t.disable=function(){this.enabled_=!1},t.reset=function(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1},t.addInterceptor=function(n,s){if(!this.typeToInterceptorsMap_.has(n))this.typeToInterceptorsMap_.set(n,new Set);var i=this.typeToInterceptorsMap_.get(n);if(i.has(s))return!1;return i.add(s),!0},t.removeInterceptor=function(n,s){var i=this.typeToInterceptorsMap_.get(n);if(i&&i.has(s))return i.delete(s),!0;return!1},t.clearInterceptorsByType=function(n){var s=this.typeToInterceptorsMap_.get(n);if(!s)return!1;return this.typeToInterceptorsMap_.delete(n),this.typeToInterceptorsMap_.set(n,new Set),!0},t.clear=function(){if(!this.typeToInterceptorsMap_.size)return!1;return this.typeToInterceptorsMap_=new Map,!0},t.getForType=function(n){return this.typeToInterceptorsMap_.get(n)||new Set},t.execute=function(n,s){var i=this.getForType(n);for(var l=$_(i),f;!(f=l()).done;){var c=f.value;try{s=c(s)}catch(h){}}return s},e}();z7.exports=P_});var G7=Dt((bI,U7)=>{var eF=function(){function e(){this.maxAttempts_=1,this.delayFactor_=0.1,this.fuzzFactor_=0.1,this.initialDelay_=1000,this.enabled_=!1}var t=e.prototype;return t.getIsEnabled=function(){return this.enabled_},t.enable=function(){this.enabled_=!0},t.disable=function(){this.enabled_=!1},t.reset=function(){this.maxAttempts_=1,this.delayFactor_=0.1,this.fuzzFactor_=0.1,this.initialDelay_=1000,this.enabled_=!1},t.getMaxAttempts=function(){return this.maxAttempts_},t.setMaxAttempts=function(n){this.maxAttempts_=n},t.getDelayFactor=function(){return this.delayFactor_},t.setDelayFactor=function(n){this.delayFactor_=n},t.getFuzzFactor=function(){return this.fuzzFactor_},t.setFuzzFactor=function(n){this.fuzzFactor_=n},t.getInitialDelay=function(){return this.initialDelay_},t.setInitialDelay=function(n){this.initialDelay_=n},t.createRetry=function(n){var s=n===void 0?{}:n,i=s.maxAttempts,l=s.delayFactor,f=s.fuzzFactor,c=s.initialDelay;return new tF({maxAttempts:i||this.maxAttempts_,delayFactor:l||this.delayFactor_,fuzzFactor:f||this.fuzzFactor_,initialDelay:c||this.initialDelay_})},e}(),tF=function(){function e(a){this.maxAttempts_=a.maxAttempts,this.delayFactor_=a.delayFactor,this.fuzzFactor_=a.fuzzFactor,this.currentDelay_=a.initialDelay,this.currentAttempt_=1}var t=e.prototype;return t.moveToNextAttempt=function(){this.currentAttempt_++;var n=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+n},t.shouldRetry=function(){return this.currentAttempt_<this.maxAttempts_},t.getCurrentDelay=function(){return this.currentDelay_},t.getCurrentMinPossibleDelay=function(){return(1-this.fuzzFactor_)*this.currentDelay_},t.getCurrentMaxPossibleDelay=function(){return(1+this.fuzzFactor_)*this.currentDelay_},t.getCurrentFuzzedDelay=function(){var n=this.getCurrentMinPossibleDelay(),s=this.getCurrentMaxPossibleDelay();return n+Math.random()*(s-n)},e}();U7.exports=eF});var K7=Dt((wI,X7)=>{var aF=Li(),nF=function(t,a){if(a===void 0)a=!1;return function(n,s,i){if(n){t(n);return}if(s.statusCode>=400&&s.statusCode<=599){var l=i;if(a)if(aF.TextDecoder){var f=sF(s.headers&&s.headers["content-type"]);try{l=new TextDecoder(f).decode(i)}catch(c){}}else l=String.fromCharCode.apply(null,new Uint8Array(i));t({cause:l});return}t(null,i)}};function sF(e){if(e===void 0)e="";return e.toLowerCase().split(";").reduce(function(t,a){var n=a.split("="),s=n[0],i=n[1];if(s.trim()==="charset")return i.trim();return t},"utf-8")}X7.exports=nF});var J7=Dt((dI,L3)=>{var L7=Li(),iF=x7(),lF=N7(),V7=I7(),fF=G7();Xa.httpHandler=K7();Xa.requestInterceptorsStorage=new V7;Xa.responseInterceptorsStorage=new V7;Xa.retryManager=new fF;var rF=function(t){var a={};if(!t)return a;return t.trim().split(`
3
3
  `).forEach(function(n){var s=n.indexOf(":"),i=n.slice(0,s).trim().toLowerCase(),l=n.slice(s+1).trim();if(typeof a[i]>"u")a[i]=l;else if(Array.isArray(a[i]))a[i].push(l);else a[i]=[a[i],l]}),a};L3.exports=Xa;L3.exports.default=Xa;Xa.XMLHttpRequest=L7.XMLHttpRequest||uF;Xa.XDomainRequest="withCredentials"in new Xa.XMLHttpRequest?Xa.XMLHttpRequest:L7.XDomainRequest;oF(["get","put","post","patch","head","delete"],function(e){Xa[e==="delete"?"del":e]=function(t,a,n){return a=Y7(t,a,n),a.method=e.toUpperCase(),K3(a)}});function oF(e,t){for(var a=0;a<e.length;a++)t(e[a])}function cF(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}function Y7(e,t,a){var n=e;if(lF(t)){if(a=t,typeof e==="string")n={uri:e}}else n=iF({},t,{uri:e});return n.callback=a,n}function Xa(e,t,a){return t=Y7(e,t,a),K3(t)}function K3(e){if(typeof e.callback>"u")throw Error("callback argument missing");if(e.requestType&&Xa.requestInterceptorsStorage.getIsEnabled()){var t={uri:e.uri||e.url,headers:e.headers||{},body:e.body,metadata:e.metadata||{},retry:e.retry,timeout:e.timeout},a=Xa.requestInterceptorsStorage.execute(e.requestType,t);e.uri=a.uri,e.headers=a.headers,e.body=a.body,e.metadata=a.metadata,e.retry=a.retry,e.timeout=a.timeout}var n=!1,s=function(M,x,R){if(!n)n=!0,e.callback(M,x,R)};function i(){if(h.readyState===4&&!Xa.responseInterceptorsStorage.getIsEnabled())setTimeout(c,0)}function l(){var H=void 0;if(h.response)H=h.response;else H=h.responseText||hF(h);if(S)try{H=JSON.parse(H)}catch(M){}return H}function f(H){if(clearTimeout(O),clearTimeout(e.retryTimeout),!(H instanceof Error))H=Error(""+(H||"Unknown XMLHttpRequest Error"));if(H.statusCode=0,!g&&Xa.retryManager.getIsEnabled()&&e.retry&&e.retry.shouldRetry()){e.retryTimeout=setTimeout(function(){e.retry.moveToNextAttempt(),e.xhr=h,K3(e)},e.retry.getCurrentFuzzedDelay());return}if(e.requestType&&Xa.responseInterceptorsStorage.getIsEnabled()){var M={headers:T.headers||{},body:T.body,responseUrl:h.responseURL,responseType:h.responseType},x=Xa.responseInterceptorsStorage.execute(e.requestType,M);T.body=x.body,T.headers=x.headers}return s(H,T)}function c(){if(g)return;var H;if(clearTimeout(O),clearTimeout(e.retryTimeout),e.useXDR&&h.status===void 0)H=200;else H=h.status===1223?204:h.status;var M=T,x=null;if(H!==0){if(M={body:l(),statusCode:H,method:d,headers:{},url:b,rawRequest:h},h.getAllResponseHeaders)M.headers=rF(h.getAllResponseHeaders())}else x=Error("Internal XMLHttpRequest Error");if(e.requestType&&Xa.responseInterceptorsStorage.getIsEnabled()){var R={headers:M.headers||{},body:M.body,responseUrl:h.responseURL,responseType:h.responseType},E=Xa.responseInterceptorsStorage.execute(e.requestType,R);M.body=E.body,M.headers=E.headers}return s(x,M,M.body)}var h=e.xhr||null;if(!h)if(e.cors||e.useXDR)h=new Xa.XDomainRequest;else h=new Xa.XMLHttpRequest;var u,g,b=h.url=e.uri||e.url,d=h.method=e.method||"GET",j=e.body||e.data,A=h.headers=e.headers||{},C=!!e.sync,S=!1,O,T={body:void 0,headers:{},statusCode:0,method:d,url:b,rawRequest:h};if("json"in e&&e.json!==!1){if(S=!0,A.accept||A.Accept||(A.Accept="application/json"),d!=="GET"&&d!=="HEAD")A["content-type"]||A["Content-Type"]||(A["Content-Type"]="application/json"),j=JSON.stringify(e.json===!0?j:e.json)}if(h.onreadystatechange=i,h.onload=c,h.onerror=f,h.onprogress=function(){},h.onabort=function(){g=!0,clearTimeout(e.retryTimeout)},h.ontimeout=f,h.open(d,b,!C,e.username,e.password),!C)h.withCredentials=!!e.withCredentials;if(!C&&e.timeout>0)O=setTimeout(function(){if(g)return;g=!0,h.abort("timeout");var H=Error("XMLHttpRequest timeout");H.code="ETIMEDOUT",f(H)},e.timeout);if(h.setRequestHeader){for(u in A)if(A.hasOwnProperty(u))h.setRequestHeader(u,A[u])}else if(e.headers&&!cF(e.headers))throw Error("Headers cannot be set on an XDomainRequest object");if("responseType"in e)h.responseType=e.responseType;if("beforeSend"in e&&typeof e.beforeSend==="function")e.beforeSend(h);return h.send(j||null),h}function hF(e){try{if(e.responseType==="document")return e.responseXML;var t=e.responseXML&&e.responseXML.documentElement.nodeName==="parsererror";if(e.responseType===""&&!t)return e.responseXML}catch(a){}return null}function uF(){}});var tb=Dt((jI,eb)=>{var Q7=G3(),Y3=Object.create||function(){function e(){}return function(t){if(arguments.length!==1)throw Error("Object.create shim only accepts one parameter.");return e.prototype=t,new e}}();function Es(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}Es.prototype=Y3(Error.prototype);Es.prototype.constructor=Es;Es.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function J3(e){function t(n,s,i,l){return(n|0)*3600+(s|0)*60+(i|0)+(l|0)/1000}var a=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);if(!a)return null;if(a[3])return t(a[1],a[2],a[3].replace(":",""),a[4]);else if(a[1]>59)return t(a[1],a[2],0,a[4]);else return t(0,a[1],a[2],a[4])}function Pc(){this.values=Y3(null)}Pc.prototype={set:function(e,t){if(!this.get(e)&&t!=="")this.values[e]=t},get:function(e,t,a){if(a)return this.has(e)?this.values[e]:t[a];return this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,a){for(var n=0;n<a.length;++n)if(t===a[n]){this.set(e,t);break}},integer:function(e,t){if(/^-?\d+$/.test(t))this.set(e,parseInt(t,10))},percent:function(e,t){var a;if(a=t.match(/^([\d]{1,3})(\.[\d]*)?%$/)){if(t=parseFloat(t),t>=0&&t<=100)return this.set(e,t),!0}return!1}};function Wc(e,t,a,n){var s=n?e.split(n):[e];for(var i in s){if(typeof s[i]!=="string")continue;var l=s[i].split(a);if(l.length!==2)continue;var f=l[0].trim(),c=l[1].trim();t(f,c)}}function mF(e,t,a){var n=e;function s(){var f=J3(e);if(f===null)throw new Es(Es.Errors.BadTimeStamp,"Malformed timestamp: "+n);return e=e.replace(/^[^\sa-zA-Z-]+/,""),f}function i(f,c){var h=new Pc;Wc(f,function(u,g){switch(u){case"region":for(var b=a.length-1;b>=0;b--)if(a[b].id===g){h.set(u,a[b].region);break}break;case"vertical":h.alt(u,g,["rl","lr"]);break;case"line":var d=g.split(","),j=d[0];if(h.integer(u,j),h.percent(u,j)&&h.set("snapToLines",!1),h.alt(u,j,["auto"]),d.length===2)h.alt("lineAlign",d[1],["start","center","end"]);break;case"position":if(d=g.split(","),h.percent(u,d[0]),d.length===2)h.alt("positionAlign",d[1],["start","center","end"]);break;case"size":h.percent(u,g);break;case"align":h.alt(u,g,["start","center","end","left","right"]);break}},/:/,/\s/),c.region=h.get("region",null),c.vertical=h.get("vertical","");try{c.line=h.get("line","auto")}catch(u){}c.lineAlign=h.get("lineAlign","start"),c.snapToLines=h.get("snapToLines",!0),c.size=h.get("size",100);try{c.align=h.get("align","center")}catch(u){c.align=h.get("align","middle")}try{c.position=h.get("position","auto")}catch(u){c.position=h.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},c.align)}c.positionAlign=h.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},c.align)}function l(){e=e.replace(/^\s+/,"")}if(l(),t.startTime=s(),l(),e.substr(0,3)!=="-->")throw new Es(Es.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+n);e=e.substr(3),l(),t.endTime=s(),l(),i(e,t)}var V3=Q7.createElement&&Q7.createElement("textarea"),gF={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},Z7={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)"},pF={v:"title",lang:"lang"},$7={rt:"ruby"};function P7(e,t){function a(){if(!t)return null;function j(C){return t=t.substr(C.length),C}var A=t.match(/^([^<]*)(<[^>]*>?)?/);return j(A[1]?A[1]:A[2])}function n(j){return V3.innerHTML=j,j=V3.textContent,V3.textContent="",j}function s(j,A){return!$7[A.localName]||$7[A.localName]===j.localName}function i(j,A){var C=gF[j];if(!C)return null;var S=e.document.createElement(C),O=pF[j];if(O&&A)S[O]=A.trim();return S}var l=e.document.createElement("div"),f=l,c,h=[];while((c=a())!==null){if(c[0]==="<"){if(c[1]==="/"){if(h.length&&h[h.length-1]===c.substr(2).replace(">",""))h.pop(),f=f.parentNode;continue}var u=J3(c.substr(1,c.length-2)),g;if(u){g=e.document.createProcessingInstruction("timestamp",u),f.appendChild(g);continue}var b=c.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!b)continue;if(g=i(b[1],b[3]),!g)continue;if(!s(f,g))continue;if(b[2]){var d=b[2].split(".");d.forEach(function(j){var A=/^bg_/.test(j),C=A?j.slice(3):j;if(Z7.hasOwnProperty(C)){var S=A?"background-color":"color",O=Z7[C];g.style[S]=O}}),g.className=d.join(" ")}h.push(b[1]),f.appendChild(g),f=g;continue}f.appendChild(e.document.createTextNode(n(c)))}return l}var W7=[[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 bF(e){for(var t=0;t<W7.length;t++){var a=W7[t];if(e>=a[0]&&e<=a[1])return!0}return!1}function wF(e){var t=[],a="",n;if(!e||!e.childNodes)return"ltr";function s(f,c){for(var h=c.childNodes.length-1;h>=0;h--)f.push(c.childNodes[h])}function i(f){if(!f||!f.length)return null;var c=f.pop(),h=c.textContent||c.innerText;if(h){var u=h.match(/^.*(\n|\r)/);if(u)return f.length=0,u[0];return h}if(c.tagName==="ruby")return i(f);if(c.childNodes)return s(f,c),i(f)}s(t,e);while(a=i(t))for(var l=0;l<a.length;l++)if(n=a.charCodeAt(l),bF(n))return"rtl";return"ltr"}function dF(e){if(typeof e.line==="number"&&(e.snapToLines||e.line>=0&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;var t=e.track,a=t.textTrackList,n=0;for(var s=0;s<a.length&&a[s]!==t;s++)if(a[s].mode==="showing")n++;return++n*-1}function Pu(){}Pu.prototype.applyStyles=function(e,t){t=t||this.div;for(var a in e)if(e.hasOwnProperty(a))t.style[a]=e[a]};Pu.prototype.formatStyle=function(e,t){return e===0?0:e+t};function Wu(e,t,a){Pu.call(this),this.cue=t,this.cueDiv=P7(e,t.text);var n={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:t.vertical===""?"horizontal-tb":t.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(n,this.cueDiv),this.div=e.document.createElement("div"),n={direction:wF(this.cueDiv),writingMode:t.vertical===""?"horizontal-tb":t.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:t.align==="middle"?"center":t.align,font:a.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(n),this.div.appendChild(this.cueDiv);var s=0;switch(t.positionAlign){case"start":case"line-left":s=t.position;break;case"center":s=t.position-t.size/2;break;case"end":case"line-right":s=t.position-t.size;break}if(t.vertical==="")this.applyStyles({left:this.formatStyle(s,"%"),width:this.formatStyle(t.size,"%")});else this.applyStyles({top:this.formatStyle(s,"%"),height:this.formatStyle(t.size,"%")});this.move=function(i){this.applyStyles({top:this.formatStyle(i.top,"px"),bottom:this.formatStyle(i.bottom,"px"),left:this.formatStyle(i.left,"px"),right:this.formatStyle(i.right,"px"),height:this.formatStyle(i.height,"px"),width:this.formatStyle(i.width,"px")})}}Wu.prototype=Y3(Pu.prototype);Wu.prototype.constructor=Wu;function Yn(e){var t,a,n,s;if(e.div){a=e.div.offsetHeight,n=e.div.offsetWidth,s=e.div.offsetTop;var i=(i=e.div.childNodes)&&(i=i[0])&&i.getClientRects&&i.getClientRects();e=e.div.getBoundingClientRect(),t=i?Math.max(i[0]&&i[0].height||0,e.height/i.length):0}this.left=e.left,this.right=e.right,this.top=e.top||s,this.height=e.height||a,this.bottom=e.bottom||s+(e.height||a),this.width=e.width||n,this.lineHeight=t!==void 0?t:e.lineHeight}Yn.prototype.move=function(e,t){switch(t=t!==void 0?t:this.lineHeight,e){case"+x":this.left+=t,this.right+=t;break;case"-x":this.left-=t,this.right-=t;break;case"+y":this.top+=t,this.bottom+=t;break;case"-y":this.top-=t,this.bottom-=t;break}};Yn.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top};Yn.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++)if(this.overlaps(e[t]))return!0;return!1};Yn.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right};Yn.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.left<e.left;case"-x":return this.right>e.right;case"+y":return this.top<e.top;case"-y":return this.bottom>e.bottom}};Yn.prototype.intersectPercentage=function(e){var t=Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left)),a=Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top)),n=t*a;return n/(this.height*this.width)};Yn.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}};Yn.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,a=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,n=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e;var s={left:e.left,right:e.right,top:e.top||n,height:e.height||t,bottom:e.bottom||n+(e.height||t),width:e.width||a};return s};function jF(e,t,a,n){function s(C,S){var O,T=new Yn(C),H=1;for(var M=0;M<S.length;M++){while(C.overlapsOppositeAxis(a,S[M])||C.within(a)&&C.overlapsAny(n))C.move(S[M]);if(C.within(a))return C;var x=C.intersectPercentage(a);if(H>x)O=new Yn(C),H=x;C=new Yn(T)}return O||T}var i=new Yn(t),l=t.cue,f=dF(l),c=[];if(l.snapToLines){var h;switch(l.vertical){case"":c=["+y","-y"],h="height";break;case"rl":c=["+x","-x"],h="width";break;case"lr":c=["-x","+x"],h="width";break}var u=i.lineHeight,g=u*Math.round(f),b=a[h]+u,d=c[0];if(Math.abs(g)>b)g=g<0?-1:1,g*=Math.ceil(b/u)*u;if(f<0)g+=l.vertical===""?a.height:a.width,c=c.reverse();i.move(d,g)}else{var j=i.lineHeight/a.height*100;switch(l.lineAlign){case"center":f-=j/2;break;case"end":f-=j;break}switch(l.vertical){case"":t.applyStyles({top:t.formatStyle(f,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(f,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(f,"%")});break}c=["+y","-x","+x","-y"],i=new Yn(t)}var A=s(i,c);t.move(A.toCSSCompatValues(a))}function M1(){}M1.StringDecoder=function(){return{decode:function(e){if(!e)return"";if(typeof e!=="string")throw Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}};M1.convertCueToDOMTree=function(e,t){if(!e||!t)return null;return P7(e,t)};var qF=0.05,vF="sans-serif",kF="1.5%";M1.processCues=function(e,t,a){if(!e||!t||!a)return null;while(a.firstChild)a.removeChild(a.firstChild);var n=e.document.createElement("div");n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin=kF,a.appendChild(n);function s(u){for(var g=0;g<u.length;g++)if(u[g].hasBeenReset||!u[g].displayState)return!0;return!1}if(!s(t)){for(var i=0;i<t.length;i++)n.appendChild(t[i].displayState);return}var l=[],f=Yn.getSimpleBoxPosition(n),c=Math.round(f.height*qF*100)/100,h={font:c+"px "+vF};(function(){var u,g;for(var b=0;b<t.length;b++)g=t[b],u=new Wu(e,g,h),n.appendChild(u.div),jF(e,u,f,l),g.displayState=u.div,l.push(Yn.getSimpleBoxPosition(u))})()};M1.Parser=function(e,t,a){if(!a)a=t,t={};if(!t)t={};this.window=e,this.vttjs=t,this.state="INITIAL",this.buffer="",this.decoder=a||new TextDecoder("utf8"),this.regionList=[]};M1.Parser.prototype={reportOrThrowError:function(e){if(e instanceof Es)this.onparsingerror&&this.onparsingerror(e);else throw e},parse:function(e){var t=this;if(e)t.buffer+=t.decoder.decode(e,{stream:!0});function a(){var u=t.buffer,g=0;while(g<u.length&&u[g]!=="\r"&&u[g]!==`
4
4
  `)++g;var b=u.substr(0,g);if(u[g]==="\r")++g;if(u[g]===`
@@ -304,4 +304,4 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
304
304
  `)){let t=document.createElement("div");t.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(t)}}#u(){return this.#e.replaceAll(" "," ")}static#h(e){return e.replaceAll(" "," ")}get contentDiv(){return this.editorDiv}getPDFRect(){let e=qn._internalPadding*this.parentScale;return this.getRect(e,e)}static async deserialize(e,t,a){let n=null;if(e instanceof D8){let{data:{defaultAppearanceData:{fontSize:i,fontColor:l},rect:f,rotation:c,id:h,popupRef:u,richText:g,contentsObj:b,creationDate:d,modificationDate:j},textContent:A,textPosition:C,parent:{page:{pageNumber:S}}}=e;if(!A?.length)return null;n=e={annotationType:ot.FREETEXT,color:Array.from(l),fontSize:i,value:A.join(`
305
305
  `),position:C,pageIndex:S-1,rect:f.slice(0),rotation:c,annotationElementId:h,id:h,deleted:!1,popupRef:u,comment:b?.str||null,richText:g,creationDate:d,modificationDate:j}}let s=await super.deserialize(e,t,a);if(s.#n=e.fontSize,s.color=Be.makeHexColor(...e.color),s.#e=qn.#h(e.value),s._initialData=n,e.comment)s.setCommentData(e);return s}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let t=Ke._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),a=Object.assign(super.serialize(e),{color:t,fontSize:this.#n,value:this.#u()});if(this.addComment(a),e)return a.isCopy=!0,a;if(this.annotationElementId&&!this.#g(a))return null;return a.id=this.annotationElementId,a}#g(e){let{value:t,fontSize:a,color:n,pageIndex:s}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==t||e.fontSize!==a||e.color.some((i,l)=>i!==n[l])||e.pageIndex!==s}renderAnnotationElement(e){let t=super.renderAnnotationElement(e);if(!t)return null;let{style:a}=t;a.fontSize=`calc(${this.#n}px * var(--total-scale-factor))`,a.color=this.color,t.replaceChildren();for(let n of this.#e.split(`
306
306
  `)){let s=document.createElement("div");s.append(n?document.createTextNode(n):document.createElement("br")),t.append(s)}return e.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:this.#e}}),t}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}}class Ee{static PRECISION=0.0001;toSVGPath(){zt("Abstract method `toSVGPath` must be implemented.")}get box(){zt("Abstract getter `box` must be implemented.")}serialize(e,t){zt("Abstract method `serialize` must be implemented.")}static _rescale(e,t,a,n,s,i){i||=new Float32Array(e.length);for(let l=0,f=e.length;l<f;l+=2)i[l]=t+e[l]*n,i[l+1]=a+e[l+1]*s;return i}static _rescaleAndSwap(e,t,a,n,s,i){i||=new Float32Array(e.length);for(let l=0,f=e.length;l<f;l+=2)i[l]=t+e[l+1]*n,i[l+1]=a+e[l]*s;return i}static _translate(e,t,a,n){n||=new Float32Array(e.length);for(let s=0,i=e.length;s<i;s+=2)n[s]=t+e[s],n[s+1]=a+e[s+1];return n}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,t,a,n,s){switch(s){case 90:return[1-t/a,e/n];case 180:return[1-e/a,1-t/n];case 270:return[t/a,1-e/n];default:return[e/a,t/n]}}static createBezierPoints(e,t,a,n,s,i){return[(e+5*a)/6,(t+5*n)/6,(5*a+s)/6,(5*n+i)/6,(a+s)/2,(n+i)/2]}}class Tr{#e;#t=[];#a;#n;#s=[];#l=new Float32Array(18);#i;#f;#o;#r;#u;#h;#g=[];static#b=8;static#p=2;static#c=Tr.#b+Tr.#p;constructor({x:e,y:t},a,n,s,i,l=0){this.#e=a,this.#h=s*n,this.#n=i,this.#l.set([NaN,NaN,NaN,NaN,e,t],6),this.#a=l,this.#r=Tr.#b*n,this.#o=Tr.#c*n,this.#u=n,this.#g.push(e,t)}isEmpty(){return isNaN(this.#l[8])}#m(){let e=this.#l.subarray(4,6),t=this.#l.subarray(16,18),[a,n,s,i]=this.#e;return[(this.#i+(e[0]-t[0])/2-a)/s,(this.#f+(e[1]-t[1])/2-n)/i,(this.#i+(t[0]-e[0])/2-a)/s,(this.#f+(t[1]-e[1])/2-n)/i]}add({x:e,y:t}){this.#i=e,this.#f=t;let[a,n,s,i]=this.#e,[l,f,c,h]=this.#l.subarray(8,12),u=e-c,g=t-h,b=Math.hypot(u,g);if(b<this.#o)return!1;let d=b-this.#r,j=d/b,A=j*u,C=j*g,S=l,O=f;l=c,f=h,c+=A,h+=C,this.#g?.push(e,t);let T=-C/d,H=A/d,M=T*this.#h,x=H*this.#h;if(this.#l.set(this.#l.subarray(2,8),0),this.#l.set([c+M,h+x],4),this.#l.set(this.#l.subarray(14,18),12),this.#l.set([c-M,h-x],16),isNaN(this.#l[6])){if(this.#s.length===0)this.#l.set([l+M,f+x],2),this.#s.push(NaN,NaN,NaN,NaN,(l+M-a)/s,(f+x-n)/i),this.#l.set([l-M,f-x],14),this.#t.push(NaN,NaN,NaN,NaN,(l-M-a)/s,(f-x-n)/i);return this.#l.set([S,O,l,f,c,h],6),!this.isEmpty()}if(this.#l.set([S,O,l,f,c,h],6),Math.abs(Math.atan2(O-f,S-l)-Math.atan2(C,A))<Math.PI/2)return[l,f,c,h]=this.#l.subarray(2,6),this.#s.push(NaN,NaN,NaN,NaN,((l+c)/2-a)/s,((f+h)/2-n)/i),[l,f,S,O]=this.#l.subarray(14,18),this.#t.push(NaN,NaN,NaN,NaN,((S+l)/2-a)/s,((O+f)/2-n)/i),!0;return[S,O,l,f,c,h]=this.#l.subarray(0,6),this.#s.push(((S+5*l)/6-a)/s,((O+5*f)/6-n)/i,((5*l+c)/6-a)/s,((5*f+h)/6-n)/i,((l+c)/2-a)/s,((f+h)/2-n)/i),[c,h,l,f,S,O]=this.#l.subarray(12,18),this.#t.push(((S+5*l)/6-a)/s,((O+5*f)/6-n)/i,((5*l+c)/6-a)/s,((5*f+h)/6-n)/i,((l+c)/2-a)/s,((f+h)/2-n)/i),!0}toSVGPath(){if(this.isEmpty())return"";let e=this.#s,t=this.#t;if(isNaN(this.#l[6])&&!this.isEmpty())return this.#d();let a=[];a.push(`M${e[4]} ${e[5]}`);for(let n=6;n<e.length;n+=6)if(isNaN(e[n]))a.push(`L${e[n+4]} ${e[n+5]}`);else a.push(`C${e[n]} ${e[n+1]} ${e[n+2]} ${e[n+3]} ${e[n+4]} ${e[n+5]}`);this.#w(a);for(let n=t.length-6;n>=6;n-=6)if(isNaN(t[n]))a.push(`L${t[n+4]} ${t[n+5]}`);else a.push(`C${t[n]} ${t[n+1]} ${t[n+2]} ${t[n+3]} ${t[n+4]} ${t[n+5]}`);return this.#j(a),a.join(" ")}#d(){let[e,t,a,n]=this.#e,[s,i,l,f]=this.#m();return`M${(this.#l[2]-e)/a} ${(this.#l[3]-t)/n} L${(this.#l[4]-e)/a} ${(this.#l[5]-t)/n} L${s} ${i} L${l} ${f} L${(this.#l[16]-e)/a} ${(this.#l[17]-t)/n} L${(this.#l[14]-e)/a} ${(this.#l[15]-t)/n} Z`}#j(e){let t=this.#t;e.push(`L${t[4]} ${t[5]} Z`)}#w(e){let[t,a,n,s]=this.#e,i=this.#l.subarray(4,6),l=this.#l.subarray(16,18),[f,c,h,u]=this.#m();e.push(`L${(i[0]-t)/n} ${(i[1]-a)/s} L${f} ${c} L${h} ${u} L${(l[0]-t)/n} ${(l[1]-a)/s}`)}newFreeDrawOutline(e,t,a,n,s,i){return new I8(e,t,a,n,s,i)}getOutlines(){let e=this.#s,t=this.#t,a=this.#l,[n,s,i,l]=this.#e,f=new Float32Array((this.#g?.length??0)+2);for(let u=0,g=f.length-2;u<g;u+=2)f[u]=(this.#g[u]-n)/i,f[u+1]=(this.#g[u+1]-s)/l;if(f[f.length-2]=(this.#i-n)/i,f[f.length-1]=(this.#f-s)/l,isNaN(a[6])&&!this.isEmpty())return this.#A(f);let c=new Float32Array(this.#s.length+24+this.#t.length),h=e.length;for(let u=0;u<h;u+=2){if(isNaN(e[u])){c[u]=c[u+1]=NaN;continue}c[u]=e[u],c[u+1]=e[u+1]}h=this.#q(c,h);for(let u=t.length-6;u>=6;u-=6)for(let g=0;g<6;g+=2){if(isNaN(t[u+g])){c[h]=c[h+1]=NaN,h+=2;continue}c[h]=t[u+g],c[h+1]=t[u+g+1],h+=2}return this.#y(c,h),this.newFreeDrawOutline(c,f,this.#e,this.#u,this.#a,this.#n)}#A(e){let t=this.#l,[a,n,s,i]=this.#e,[l,f,c,h]=this.#m(),u=new Float32Array(36);return u.set([NaN,NaN,NaN,NaN,(t[2]-a)/s,(t[3]-n)/i,NaN,NaN,NaN,NaN,(t[4]-a)/s,(t[5]-n)/i,NaN,NaN,NaN,NaN,l,f,NaN,NaN,NaN,NaN,c,h,NaN,NaN,NaN,NaN,(t[16]-a)/s,(t[17]-n)/i,NaN,NaN,NaN,NaN,(t[14]-a)/s,(t[15]-n)/i],0),this.newFreeDrawOutline(u,e,this.#e,this.#u,this.#a,this.#n)}#y(e,t){let a=this.#t;return e.set([NaN,NaN,NaN,NaN,a[4],a[5]],t),t+=6}#q(e,t){let a=this.#l.subarray(4,6),n=this.#l.subarray(16,18),[s,i,l,f]=this.#e,[c,h,u,g]=this.#m();return e.set([NaN,NaN,NaN,NaN,(a[0]-s)/l,(a[1]-i)/f,NaN,NaN,NaN,NaN,c,h,NaN,NaN,NaN,NaN,u,g,NaN,NaN,NaN,NaN,(n[0]-s)/l,(n[1]-i)/f],t),t+=24}}class I8 extends Ee{#e;#t=new Float32Array(4);#a;#n;#s;#l;#i;constructor(e,t,a,n,s,i){super();this.#i=e,this.#s=t,this.#e=a,this.#l=n,this.#a=s,this.#n=i,this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],this.#f(i);let[l,f,c,h]=this.#t;for(let u=0,g=e.length;u<g;u+=2)e[u]=(e[u]-l)/c,e[u+1]=(e[u+1]-f)/h;for(let u=0,g=t.length;u<g;u+=2)t[u]=(t[u]-l)/c,t[u+1]=(t[u+1]-f)/h}toSVGPath(){let e=[`M${this.#i[4]} ${this.#i[5]}`];for(let t=6,a=this.#i.length;t<a;t+=6){if(isNaN(this.#i[t])){e.push(`L${this.#i[t+4]} ${this.#i[t+5]}`);continue}e.push(`C${this.#i[t]} ${this.#i[t+1]} ${this.#i[t+2]} ${this.#i[t+3]} ${this.#i[t+4]} ${this.#i[t+5]}`)}return e.push("Z"),e.join(" ")}serialize([e,t,a,n],s){let i=a-e,l=n-t,f,c;switch(s){case 0:f=Ee._rescale(this.#i,e,n,i,-l),c=Ee._rescale(this.#s,e,n,i,-l);break;case 90:f=Ee._rescaleAndSwap(this.#i,e,t,i,l),c=Ee._rescaleAndSwap(this.#s,e,t,i,l);break;case 180:f=Ee._rescale(this.#i,a,t,-i,l),c=Ee._rescale(this.#s,a,t,-i,l);break;case 270:f=Ee._rescaleAndSwap(this.#i,a,n,-i,-l),c=Ee._rescaleAndSwap(this.#s,a,n,-i,-l);break}return{outline:Array.from(f),points:[Array.from(c)]}}#f(e){let t=this.#i,a=t[4],n=t[5],s=[a,n,a,n],i=a,l=n,f=a,c=n,h=e?Math.max:Math.min,u=new Float32Array(4);for(let b=6,d=t.length;b<d;b+=6){let j=t[b+4],A=t[b+5];if(isNaN(t[b])){if(Be.pointBoundingBox(j,A,s),l>A)i=j,l=A;else if(l===A)i=h(i,j);if(c<A)f=j,c=A;else if(c===A)f=h(f,j)}else{if(u.set(sl,0),Be.bezierBoundingBox(a,n,...t.slice(b,b+6),u),Be.rectBoundingBox(...u,s),l>u[1])i=u[0],l=u[1];else if(l===u[1])i=h(i,u[0]);if(c<u[3])f=u[2],c=u[3];else if(c===u[3])f=h(f,u[2])}a=j,n=A}let g=this.#t;g[0]=s[0]-this.#a,g[1]=s[1]-this.#a,g[2]=s[2]-s[0]+2*this.#a,g[3]=s[3]-s[1]+2*this.#a,this.firstPoint=[i,l],this.lastPoint=[f,c]}get box(){return this.#t}newOutliner(e,t,a,n,s,i=0){return new Tr(e,t,a,n,s,i)}getNewOutline(e,t){let[a,n,s,i]=this.#t,[l,f,c,h]=this.#e,u=s*c,g=i*h,b=a*c+l,d=n*h+f,j=this.newOutliner({x:this.#s[0]*u+b,y:this.#s[1]*g+d},this.#e,this.#l,e,this.#n,t??this.#a);for(let A=2;A<this.#s.length;A+=2)j.add({x:this.#s[A]*u+b,y:this.#s[A+1]*g+d});return j.getOutlines()}}class q5{#e;#t;#a;#n=[];#s=[];constructor(e,t=0,a=0,n=!0){let s=sl.slice(),i=4,l=0.0001;for(let{x:A,y:C,width:S,height:O}of e){let T=Math.floor((A-t)/0.0001)*0.0001,H=Math.ceil((A+S+t)/0.0001)*0.0001,M=Math.floor((C-t)/0.0001)*0.0001,x=Math.ceil((C+O+t)/0.0001)*0.0001,R=[T,M,x,!0],E=[H,M,x,!1];this.#n.push(R,E),Be.rectBoundingBox(T,M,H,x,s)}let f=s[2]-s[0]+2*a,c=s[3]-s[1]+2*a,h=s[0]-a,u=s[1]-a,g=n?-1/0:1/0,b=1/0,d=this.#n.at(n?-1:-2),j=[d[0],d[2]];for(let A of this.#n){let[C,S,O,T]=A;if(!T&&n){if(S<b)b=S,g=C;else if(S===b)g=Math.max(g,C)}else if(T&&!n){if(S<b)b=S,g=C;else if(S===b)g=Math.min(g,C)}A[0]=(C-h)/f,A[1]=(S-u)/c,A[2]=(O-u)/c}this.#e=new Float32Array([h,u,f,c]),this.#t=[g,b],this.#a=j}getOutlines(){this.#n.sort((t,a)=>t[0]-a[0]||t[1]-a[1]||t[2]-a[2]);let e=[];for(let t of this.#n)if(t[3])e.push(...this.#r(t)),this.#f(t);else this.#o(t),e.push(...this.#r(t));return this.#l(e)}#l(e){let t=[],a=new Set;for(let i of e){let[l,f,c]=i;t.push([l,f,i],[l,c,i])}t.sort((i,l)=>i[1]-l[1]||i[0]-l[0]);for(let i=0,l=t.length;i<l;i+=2){let f=t[i][2],c=t[i+1][2];f.push(c),c.push(f),a.add(f),a.add(c)}let n=[],s;while(a.size>0){let i=a.values().next().value,[l,f,c,h,u]=i;a.delete(i);let g=l,b=f;s=[l,c],n.push(s);while(!0){let d;if(a.has(h))d=h;else if(a.has(u))d=u;else break;if(a.delete(d),[l,f,c,h,u]=d,g!==l)s.push(g,b,l,b===f?f:c),g=l;b=b===f?c:f}s.push(g,b)}return new cS(n,this.#e,this.#t,this.#a)}#i(e){let t=this.#s,a=0,n=t.length-1;while(a<=n){let s=a+n>>1,i=t[s][0];if(i===e)return s;if(i<e)a=s+1;else n=s-1}return n+1}#f([,e,t]){let a=this.#i(e);this.#s.splice(a,0,[e,t])}#o([,e,t]){let a=this.#i(e);for(let n=a;n<this.#s.length;n++){let[s,i]=this.#s[n];if(s!==e)break;if(s===e&&i===t){this.#s.splice(n,1);return}}for(let n=a-1;n>=0;n--){let[s,i]=this.#s[n];if(s!==e)break;if(s===e&&i===t){this.#s.splice(n,1);return}}}#r(e){let[t,a,n]=e,s=[[t,a,n]],i=this.#i(n);for(let l=0;l<i;l++){let[f,c]=this.#s[l];for(let h=0,u=s.length;h<u;h++){let[,g,b]=s[h];if(c<=g||b<=f)continue;if(g>=f){if(b>c)s[h][1]=c;else{if(u===1)return[];s.splice(h,1),h--,u--}continue}if(s[h][2]=f,b>c)s.push([t,c,b])}}return s}}class cS extends Ee{#e;#t;constructor(e,t,a,n){super();this.#t=e,this.#e=t,this.firstPoint=a,this.lastPoint=n}toSVGPath(){let e=[];for(let t of this.#t){let[a,n]=t;e.push(`M${a} ${n}`);for(let s=2;s<t.length;s+=2){let i=t[s],l=t[s+1];if(i===a)e.push(`V${l}`),n=l;else if(l===n)e.push(`H${i}`),a=i}e.push("Z")}return e.join(" ")}serialize([e,t,a,n],s){let i=[],l=a-e,f=n-t;for(let c of this.#t){let h=Array(c.length);for(let u=0;u<c.length;u+=2)h[u]=e+c[u]*l,h[u+1]=n-c[u+1]*f;i.push(h)}return i}get box(){return this.#e}}class v5 extends Tr{newFreeDrawOutline(e,t,a,n,s,i){return new hS(e,t,a,n,s,i)}}class hS extends I8{newOutliner(e,t,a,n,s,i=0){return new v5(e,t,a,n,s,i)}}class La extends Ke{#e=null;#t=0;#a;#n=null;#s=null;#l=null;#i=null;#f=0;#o=null;#r=null;#u=null;#h=!1;#g=null;#b=null;#p=null;#c="";#m;#d="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=ot.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){let e=La.prototype;return lt(this,"_keyboardManager",new Ls([[["ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown"],e._moveCaret,{args:[3]}]]))}constructor(e){super({...e,name:"highlightEditor"});if(this.color=e.color||La._defaultColor,this.#m=e.thickness||La._defaultThickness,this.opacity=e.opacity||La._defaultOpacity,this.#a=e.boxes||null,this.#d=e.methodOfCreation||"",this.#c=e.text||"",this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",e.highlightId>-1)this.#h=!0,this.#w(e),this.#k();else if(this.#a)this.#e=e.anchorNode,this.#t=e.anchorOffset,this.#i=e.focusNode,this.#f=e.focusOffset,this.#j(),this.#k(),this.rotate(this.rotation);if(!this.annotationElementId)this._uiManager.a11yAlert(Ke._l10nAlert.highlight)}get telemetryInitialData(){return{action:"added",type:this.#h?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:this.#m,methodOfCreation:this.#d}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}#j(){let e=new q5(this.#a,0.001);this.#r=e.getOutlines(),[this.x,this.y,this.width,this.height]=this.#r.box;let t=new q5(this.#a,0.0025,0.001,this._uiManager.direction==="ltr");this.#l=t.getOutlines();let{firstPoint:a}=this.#r;this.#g=[(a[0]-this.x)/this.width,(a[1]-this.y)/this.height];let{lastPoint:n}=this.#l;this.#b=[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height]}#w({highlightOutlines:e,highlightId:t,clipPathId:a}){this.#r=e;let n=1.5;if(this.#l=e.getNewOutline(this.#m/2+n,0.0025),t>=0)this.#u=t,this.#n=a,this.parent.drawLayer.finalizeDraw(t,{bbox:e.box,path:{d:e.toSVGPath()}}),this.#p=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:La.#_(this.#r.box,(u-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(this.#p,{bbox:La.#_(this.#l.box,u),path:{d:this.#l.toSVGPath()}})}let[s,i,l,f]=e.box;switch(this.rotation){case 0:this.x=s,this.y=i,this.width=l,this.height=f;break;case 90:{let[u,g]=this.parentDimensions;this.x=i,this.y=1-s,this.width=l*g/u,this.height=f*u/g;break}case 180:this.x=1-s,this.y=1-i,this.width=l,this.height=f;break;case 270:{let[u,g]=this.parentDimensions;this.x=1-i,this.y=s,this.width=l*g/u,this.height=f*u/g;break}}let{firstPoint:c}=e;this.#g=[(c[0]-s)/l,(c[1]-i)/f];let{lastPoint:h}=this.#l;this.#b=[(h[0]-s)/l,(h[1]-i)/f]}static initialize(e,t){Ke.initialize(e,t),La._defaultColor||=t.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(e,t){switch(e){case pt.HIGHLIGHT_COLOR:La._defaultColor=t;break;case pt.HIGHLIGHT_THICKNESS:La._defaultThickness=t;break}}translateInPage(e,t){}get toolbarPosition(){return this.#b}get commentButtonPosition(){return this.#g}updateParams(e,t){switch(e){case pt.HIGHLIGHT_COLOR:this.#A(t);break;case pt.HIGHLIGHT_THICKNESS:this.#y(t);break}}static get defaultPropertiesToUpdate(){return[[pt.HIGHLIGHT_COLOR,La._defaultColor],[pt.HIGHLIGHT_THICKNESS,La._defaultThickness]]}get propertiesToUpdate(){return[[pt.HIGHLIGHT_COLOR,this.color||La._defaultColor],[pt.HIGHLIGHT_THICKNESS,this.#m||La._defaultThickness],[pt.HIGHLIGHT_FREE,this.#h]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(this.#u,{root:{fill:this.color,"fill-opacity":this.opacity}}),this.#s?.updateColor(this.color),super.onUpdatedColor()}#A(e){let t=(s,i)=>{this.color=s,this.opacity=i,this.onUpdatedColor()},a=this.color,n=this.opacity;this.addCommands({cmd:t.bind(this,e,La._defaultOpacity),undo:t.bind(this,a,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:pt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(e)},!0)}#y(e){let t=this.#m,a=(n)=>{this.#m=n,this.#q(n)};this.addCommands({cmd:a.bind(this,e),undo:a.bind(this,t),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:pt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)}get toolbarButtons(){if(this._uiManager.highlightColors)return[["colorPicker",this.#s=new bi({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(e,t){return super.getRect(e,t,this.#F())}onceAdded(e){if(!this.annotationElementId)this.parent.addUndoableEditor(this);if(e)this.div.focus()}remove(){this.#S(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){if(!this.parent)return;if(super.rebuild(),this.div===null)return;if(this.#k(),!this.isAttachedToDOM)this.parent.add(this)}setParent(e){let t=!1;if(this.parent&&!e)this.#S();else if(e)this.#k(e),t=!this.parent&&this.div?.classList.contains("selectedEditor");if(super.setParent(e),this.show(this._isVisible),t)this.select()}#q(e){if(!this.#h)return;this.#w({highlightOutlines:this.#r.getNewOutline(e/2)}),this.fixAndSetPosition(),this.setDims()}#S(){if(this.#u===null||!this.parent)return;this.parent.drawLayer.remove(this.#u),this.#u=null,this.parent.drawLayer.remove(this.#p),this.#p=null}#k(e=this.parent){if(this.#u!==null)return;if({id:this.#u,clipPathId:this.#n}=e.drawLayer.draw({bbox:this.#r.box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:this.#h},path:{d:this.#r.toSVGPath()}},!1,!0),this.#p=e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:this.#h},bbox:this.#l.box,path:{d:this.#l.toSVGPath()}},this.#h),this.#o)this.#o.style.clipPath=this.#n}static#_([e,t,a,n],s){switch(s){case 90:return[1-t-n,e,n,a];case 180:return[1-e-a,1-t-n,a,n];case 270:return[t,1-e-a,n,a]}return[e,t,a,n]}rotate(e){let{drawLayer:t}=this.parent,a;if(this.#h)e=(e-this.rotation+360)%360,a=La.#_(this.#r.box,e);else a=La.#_([this.x,this.y,this.width,this.height],e);t.updateProperties(this.#u,{bbox:a,root:{"data-main-rotation":e}}),t.updateProperties(this.#p,{bbox:La.#_(this.#l.box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;let e=super.render();if(this.#c)e.setAttribute("aria-label",this.#c),e.setAttribute("role","mark");if(this.#h)e.classList.add("free");else this.div.addEventListener("keydown",this.#O.bind(this),{signal:this._uiManager._signal});let t=this.#o=document.createElement("div");return e.append(t),t.setAttribute("aria-hidden","true"),t.className="internal",t.style.clipPath=this.#n,this.setDims(),YA(this,this.#o,["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){if(!this.isSelected)this.parent?.drawLayer.updateProperties(this.#p,{rootClass:{hovered:!0}})}pointerleave(){if(!this.isSelected)this.parent?.drawLayer.updateProperties(this.#p,{rootClass:{hovered:!1}})}#O(e){La._keyboardManager.exec(this,e)}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:this.#B(!0);break;case 1:case 3:this.#B(!1);break}}#B(e){if(!this.#e)return;let t=window.getSelection();if(e)t.setPosition(this.#e,this.#t);else t.setPosition(this.#i,this.#f)}select(){if(super.select(),!this.#p)return;this.parent?.drawLayer.updateProperties(this.#p,{rootClass:{hovered:!1,selected:!0}})}unselect(){if(super.unselect(),!this.#p)return;if(this.parent?.drawLayer.updateProperties(this.#p,{rootClass:{selected:!1}}),!this.#h)this.#B(!1)}get _mustFixPosition(){return!this.#h}show(e=this._isVisible){if(super.show(e),this.parent)this.parent.drawLayer.updateProperties(this.#u,{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(this.#p,{rootClass:{hidden:!e}})}#F(){return this.#h?this.rotation:0}#H(){if(this.#h)return null;let[e,t]=this.pageDimensions,[a,n]=this.pageTranslation,s=this.#a,i=new Float32Array(s.length*8),l=0;for(let{x:f,y:c,width:h,height:u}of s){let g=f*e+a,b=(1-c)*t+n;i[l]=i[l+4]=g,i[l+1]=i[l+3]=b,i[l+2]=i[l+6]=g+h*e,i[l+5]=i[l+7]=b-u*t,l+=8}return i}#D(e){return this.#r.serialize(e,this.#F())}static startHighlighting(e,t,{target:a,x:n,y:s}){let{x:i,y:l,width:f,height:c}=a.getBoundingClientRect(),h=new AbortController,u=e.combinedSignal(h),g=(b)=>{h.abort(),this.#x(e,b)};window.addEventListener("blur",g,{signal:u}),window.addEventListener("pointerup",g,{signal:u}),window.addEventListener("pointerdown",Ta,{capture:!0,passive:!1,signal:u}),window.addEventListener("contextmenu",wi,{signal:u}),a.addEventListener("pointermove",this.#M.bind(this,e),{signal:u}),this._freeHighlight=new v5({x:n,y:s},[i,l,f,c],e.scale,this._defaultThickness/2,t,0.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.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(e,t){if(this._freeHighlight.add(t))e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}static#x(e,t){if(!this._freeHighlight.isEmpty())e.createAndAddNewEditor(t,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"});else e.drawLayer.remove(this._freeHighlightId);this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static async deserialize(e,t,a){let n=null;if(e instanceof R8){let{data:{quadPoints:j,rect:A,rotation:C,id:S,color:O,opacity:T,popupRef:H,richText:M,contentsObj:x,creationDate:R,modificationDate:E},parent:{page:{pageNumber:K}}}=e;n=e={annotationType:ot.HIGHLIGHT,color:Array.from(O),opacity:T,quadPoints:j,boxes:null,pageIndex:K-1,rect:A.slice(0),rotation:C,annotationElementId:S,id:S,deleted:!1,popupRef:H,richText:M,comment:x?.str||null,creationDate:R,modificationDate:E}}else if(e instanceof z5){let{data:{inkLists:j,rect:A,rotation:C,id:S,color:O,borderStyle:{rawWidth:T},popupRef:H,richText:M,contentsObj:x,creationDate:R,modificationDate:E},parent:{page:{pageNumber:K}}}=e;n=e={annotationType:ot.HIGHLIGHT,color:Array.from(O),thickness:T,inkLists:j,boxes:null,pageIndex:K-1,rect:A.slice(0),rotation:C,annotationElementId:S,id:S,deleted:!1,popupRef:H,richText:M,comment:x?.str||null,creationDate:R,modificationDate:E}}let{color:s,quadPoints:i,inkLists:l,outlines:f,opacity:c}=e,h=await super.deserialize(e,t,a);if(h.color=Be.makeHexColor(...s),h.opacity=c||1,l)h.#m=e.thickness;if(h._initialData=n,e.comment)h.setCommentData(e);let[u,g]=h.pageDimensions,[b,d]=h.pageTranslation;if(i){let j=h.#a=[];for(let A=0;A<i.length;A+=8)j.push({x:(i[A]-b)/u,y:1-(i[A+1]-d)/g,width:(i[A+2]-i[A])/u,height:(i[A+1]-i[A+5])/g});h.#j(),h.#k(),h.rotate(h.rotation)}else if(l||f){h.#h=!0;let j=(l||f.points)[0],A={x:j[0]-b,y:g-(j[1]-d)},C=new v5(A,[0,0,u,g],1,h.#m/2,!0,0.001);for(let T=0,H=j.length;T<H;T+=2)A.x=j[T]-b,A.y=g-(j[T+1]-d),C.add(A);let{id:S,clipPathId:O}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:h.color,"fill-opacity":h._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:C.toSVGPath()}},!0,!0);h.#w({highlightOutlines:C.getOutlines(),highlightId:S,clipPathId:O}),h.#k(),h.rotate(h.parentRotation)}return h}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();let t=Ke._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),a=super.serialize(e);if(Object.assign(a,{color:t,opacity:this.opacity,thickness:this.#m,quadPoints:this.#H(),outlines:this.#D(a.rect)}),this.addComment(a),this.annotationElementId&&!this.#N(a))return null;return a.id=this.annotationElementId,a}#N(e){let{color:t}=this._initialData;return this.hasEditedComment||e.color.some((a,n)=>a!==t[n])}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;return e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null}static canCreateNewEmptyEditor(){return!1}}class U8{#e=Object.create(null);updateProperty(e,t){this[e]=t,this.updateSVGProperty(e,t)}updateProperties(e){if(!e)return;for(let[t,a]of Object.entries(e))if(!t.startsWith("_"))this.updateProperty(t,a)}updateSVGProperty(e,t){this.#e[e]=t}toSVGProperties(){let e=this.#e;return this.#e=Object.create(null),{root:e}}reset(){this.#e=Object.create(null)}updateAll(e=this){this.updateProperties(e)}clone(){zt("Not implemented")}}class Xt extends Ke{#e=null;#t;_colorPicker=null;_drawId=null;static _currentDrawId=-1;static _currentParent=null;static#a=null;static#n=null;static#s=null;static _INNER_MARGIN=3;constructor(e){super(e);this.#t=e.mustBeCommitted||!1,this._addOutlines(e)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){this._colorPicker?.updateOpacity?.(this.opacity)}_addOutlines(e){if(e.drawOutlines)this.#l(e),this.#o()}#l({drawOutlines:e,drawId:t,drawingOptions:a}){if(this.#e=e,this._drawingOptions||=a,!this.annotationElementId)this._uiManager.a11yAlert(Ke._l10nAlert[this.editorType]);if(t>=0)this._drawId=t,this.parent.drawLayer.finalizeDraw(t,e.defaultProperties);else this._drawId=this.#i(e,this.parent);this.#h(e.box)}#i(e,t){let{id:a}=t.drawLayer.draw(Xt._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return a}static _mergeSVGProperties(e,t){let a=new Set(Object.keys(e));for(let[n,s]of Object.entries(t))if(a.has(n))Object.assign(e[n],s);else e[n]=s;return e}static getDefaultDrawingOptions(e){zt("Not implemented")}static get typesMap(){zt("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(e,t){let a=this.typesMap.get(e);if(a)this._defaultDrawingOptions.updateProperty(a,t);if(this._currentParent)Xt.#a.updateProperty(a,t),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties())}updateParams(e,t){let a=this.constructor.typesMap.get(e);if(a)this._updateProperty(e,a,t)}static get defaultPropertiesToUpdate(){let e=[],t=this._defaultDrawingOptions;for(let[a,n]of this.typesMap)e.push([a,t[n]]);return e}get propertiesToUpdate(){let e=[],{_drawingOptions:t}=this;for(let[a,n]of this.constructor.typesMap)e.push([a,t[n]]);return e}_updateProperty(e,t,a){let n=this._drawingOptions,s=n[t],i=(l)=>{n.updateProperty(t,l);let f=this.#e.updateProperty(t,l);if(f)this.#h(f);if(this.parent?.drawLayer.updateProperties(this._drawId,n.toSVGProperties()),e===this.colorType)this.onUpdatedColor();else if(e===this.opacityType)this.onUpdatedOpacity()};this.addCommands({cmd:i.bind(this,a),undo:i.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(e,t){let a=this.constructor.typesMap.get(this.colorType),n=this.constructor.typesMap.get(this.opacityType),s=this._drawingOptions,i=s[a],l=s[n],f=(c,h)=>{s.updateProperty(a,c),s.updateProperty(n,h),this.#e.updateProperty(a,c),this.#e.updateProperty(n,h),this.parent?.drawLayer.updateProperties(this._drawId,s.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:f.bind(this,e,t),undo:f.bind(this,i,l),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:pt.INK_COLOR_AND_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,Xt._mergeSVGProperties(this.#e.getPathResizingSVGProperties(this.#u()),{bbox:this.#g()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,Xt._mergeSVGProperties(this.#e.getPathResizedSVGProperties(this.#u()),{bbox:this.#g()}))}_onTranslating(e,t){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#g()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,Xt._mergeSVGProperties(this.#e.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(e){if(!this.annotationElementId)this.parent.addUndoableEditor(this);if(this._isDraggable=!0,this.#t){if(this.#t=!1,this.commit(),this.parent.setSelected(this),e&&this.isOnScreen)this.div.focus()}}remove(){this.#f(),super.remove()}rebuild(){if(!this.parent)return;if(super.rebuild(),this.div===null)return;if(this.#o(),this.#h(this.#e.box),!this.isAttachedToDOM)this.parent.add(this)}setParent(e){let t=!1;if(this.parent&&!e)this._uiManager.removeShouldRescale(this),this.#f();else if(e)this._uiManager.addShouldRescale(this),this.#o(e),t=!this.parent&&this.div?.classList.contains("selectedEditor");if(super.setParent(e),t)this.select()}#f(){if(this._drawId===null||!this.parent)return;this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset()}#o(e=this.parent){if(this._drawId!==null&&this.parent===e)return;if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,e.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=this.#i(this.#e,e)}#r([e,t,a,n]){let{parentDimensions:[s,i],rotation:l}=this;switch(l){case 90:return[t,1-e,a*(i/s),n*(s/i)];case 180:return[1-e,1-t,a,n];case 270:return[1-t,e,a*(i/s),n*(s/i)];default:return[e,t,a,n]}}#u(){let{x:e,y:t,width:a,height:n,parentDimensions:[s,i],rotation:l}=this;switch(l){case 90:return[1-t,e,a*(s/i),n*(i/s)];case 180:return[1-e,1-t,a,n];case 270:return[t,1-e,a*(s/i),n*(i/s)];default:return[e,t,a,n]}}#h(e){if([this.x,this.y,this.width,this.height]=this.#r(e),this.div)this.fixAndSetPosition(),this.setDims();this._onResized()}#g(){let{x:e,y:t,width:a,height:n,rotation:s,parentRotation:i,parentDimensions:[l,f]}=this;switch((s*4+i)/90){case 1:return[1-t-n,e,n,a];case 2:return[1-e-a,1-t-n,a,n];case 3:return[t,1-e-a,n,a];case 4:return[e,t-a*(l/f),n*(f/l),a*(l/f)];case 5:return[1-t,e,a*(l/f),n*(f/l)];case 6:return[1-e-n*(f/l),1-t,n*(f/l),a*(l/f)];case 7:return[t-a*(l/f),1-e-n*(f/l),a*(l/f),n*(f/l)];case 8:return[e-a,t-n,a,n];case 9:return[1-t,e-a,n,a];case 10:return[1-e,1-t,a,n];case 11:return[t-n,1-e,n,a];case 12:return[e-n*(f/l),t,n*(f/l),a*(l/f)];case 13:return[1-t-a*(l/f),e-n*(f/l),a*(l/f),n*(f/l)];case 14:return[1-e,1-t-a*(l/f),n*(f/l),a*(l/f)];case 15:return[t,1-e,a*(l/f),n*(f/l)];default:return[e,t,a,n]}}rotate(){if(!this.parent)return;this.parent.drawLayer.updateProperties(this._drawId,Xt._mergeSVGProperties({bbox:this.#g()},this.#e.updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){if(!this.parent)return;this.#h(this.#e.updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,t;if(this._isCopy)e=this.x,t=this.y;let a=super.render();a.classList.add("draw");let n=document.createElement("div");if(a.append(n),n.setAttribute("aria-hidden","true"),n.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy)this._moveAfterPaste(e,t);return a}static createDrawerInstance(e,t,a,n,s){zt("Not implemented")}static startDrawing(e,t,a,n){let{target:s,offsetX:i,offsetY:l,pointerId:f,pointerType:c}=n;if(Kt.isInitializedAndDifferentPointerType(c))return;let{viewport:{rotation:h}}=e,{width:u,height:g}=s.getBoundingClientRect(),b=Xt.#n=new AbortController,d=e.combinedSignal(b);if(Kt.setPointer(c,f),window.addEventListener("pointerup",(j)=>{if(Kt.isSamePointerIdOrRemove(j.pointerId))this._endDraw(j)},{signal:d}),window.addEventListener("pointercancel",(j)=>{if(Kt.isSamePointerIdOrRemove(j.pointerId))this._currentParent.endDrawingSession()},{signal:d}),window.addEventListener("pointerdown",(j)=>{if(!Kt.isSamePointerType(j.pointerType))return;if(Kt.initializeAndAddPointerId(j.pointerId),Xt.#a.isCancellable())if(Xt.#a.removeLastElement(),Xt.#a.isEmpty())this._currentParent.endDrawingSession(!0);else this._endDraw(null)},{capture:!0,passive:!1,signal:d}),window.addEventListener("contextmenu",wi,{signal:d}),s.addEventListener("pointermove",this._drawMove.bind(this),{signal:d}),s.addEventListener("touchmove",(j)=>{if(Kt.isSameTimeStamp(j.timeStamp))Ta(j)},{signal:d}),e.toggleDrawing(),t._editorUndoBar?.hide(),Xt.#a){e.drawLayer.updateProperties(this._currentDrawId,Xt.#a.startNew(i,l,u,g,h));return}t.updateUIForDefaultProperties(this),Xt.#a=this.createDrawerInstance(i,l,u,g,h),Xt.#s=this.getDefaultDrawingOptions(),this._currentParent=e,{id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(Xt.#s.toSVGProperties(),Xt.#a.defaultSVGProperties),!0,!1)}static _drawMove(e){if(Kt.isSameTimeStamp(e.timeStamp),!Xt.#a)return;let{offsetX:t,offsetY:a,pointerId:n}=e;if(!Kt.isSamePointerId(n))return;if(Kt.isUsingMultiplePointers()){this._endDraw(e);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,Xt.#a.add(t,a)),Kt.setTimeStamp(e.timeStamp),Ta(e)}static _cleanup(e){if(e)this._currentDrawId=-1,this._currentParent=null,Xt.#a=null,Xt.#s=null,Kt.clearTimeStamp();if(Xt.#n)Xt.#n.abort(),Xt.#n=null,Kt.clearPointerIds()}static _endDraw(e){let t=this._currentParent;if(!t)return;if(t.toggleDrawing(!0),this._cleanup(!1),e?.target===t.div)t.drawLayer.updateProperties(this._currentDrawId,Xt.#a.end(e.offsetX,e.offsetY));if(this.supportMultipleDrawings){let a=Xt.#a,n=this._currentDrawId,s=a.getLastElement();t.addCommands({cmd:()=>{t.drawLayer.updateProperties(n,a.setLastElement(s))},undo:()=>{t.drawLayer.updateProperties(n,a.removeLastElement())},mustExec:!1,type:pt.DRAW_STEP});return}this.endDrawing(!1)}static endDrawing(e){let t=this._currentParent;if(!t)return null;if(t.toggleDrawing(!0),t.cleanUndoStack(pt.DRAW_STEP),!Xt.#a.isEmpty()){let{pageDimensions:[a,n],scale:s}=t,i=t.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:Xt.#a.getOutlines(a*s,n*s,s,this._INNER_MARGIN),drawingOptions:Xt.#s,mustBeCommitted:!e});return this._cleanup(!0),i}return t.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,t,a,n,s,i){zt("Not implemented")}static async deserialize(e,t,a){let{rawDims:{pageWidth:n,pageHeight:s,pageX:i,pageY:l}}=t.viewport,f=this.deserializeDraw(i,l,n,s,this._INNER_MARGIN,e),c=await super.deserialize(e,t,a);return c.createDrawingOptions(e),c.#l({drawOutlines:f}),c.#o(),c.onScaleChanging(),c.rotate(),c}serializeDraw(e){let[t,a]=this.pageTranslation,[n,s]=this.pageDimensions;return this.#e.serialize([t,a,n,s],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}}class uS{#e=new Float64Array(6);#t;#a;#n;#s;#l;#i="";#f=0;#o=new Uo;#r;#u;constructor(e,t,a,n,s,i){this.#r=a,this.#u=n,this.#n=s,this.#s=i,[e,t]=this.#h(e,t);let l=this.#t=[NaN,NaN,NaN,NaN,e,t];this.#l=[e,t],this.#a=[{line:l,points:this.#l}],this.#e.set(l,0)}updateProperty(e,t){if(e==="stroke-width")this.#s=t}#h(e,t){return Ee._normalizePoint(e,t,this.#r,this.#u,this.#n)}isEmpty(){return!this.#a?.length}isCancellable(){return this.#l.length<=10}add(e,t){[e,t]=this.#h(e,t);let[a,n,s,i]=this.#e.subarray(2,6),l=e-s,f=t-i;if(Math.hypot(this.#r*l,this.#u*f)<=2)return null;if(this.#l.push(e,t),isNaN(a))return this.#e.set([s,i,e,t],2),this.#t.push(NaN,NaN,NaN,NaN,e,t),{path:{d:this.toSVGPath()}};if(isNaN(this.#e[0]))this.#t.splice(6,6);return this.#e.set([a,n,s,i,e,t],0),this.#t.push(...Ee.createBezierPoints(a,n,s,i,e,t)),{path:{d:this.toSVGPath()}}}end(e,t){let a=this.add(e,t);if(a)return a;if(this.#l.length===2)return{path:{d:this.toSVGPath()}};return null}startNew(e,t,a,n,s){this.#r=a,this.#u=n,this.#n=s,[e,t]=this.#h(e,t);let i=this.#t=[NaN,NaN,NaN,NaN,e,t];this.#l=[e,t];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:i,points:this.#l}),this.#e.set(i,0),this.#f=0,this.toSVGPath(),null}getLastElement(){return this.#a.at(-1)}setLastElement(e){if(!this.#a)return this.#o.setLastElement(e);return this.#a.push(e),this.#t=e.line,this.#l=e.points,this.#f=0,{path:{d:this.toSVGPath()}}}removeLastElement(){if(!this.#a)return this.#o.removeLastElement();this.#a.pop(),this.#i="";for(let e=0,t=this.#a.length;e<t;e++){let{line:a,points:n}=this.#a[e];this.#t=a,this.#l=n,this.#f=0,this.toSVGPath()}return{path:{d:this.#i}}}toSVGPath(){let e=Ee.svgRound(this.#t[4]),t=Ee.svgRound(this.#t[5]);if(this.#l.length===2)return this.#i=`${this.#i} M ${e} ${t} Z`,this.#i;if(this.#l.length<=6){let n=this.#i.lastIndexOf("M");this.#i=`${this.#i.slice(0,n)} M ${e} ${t}`,this.#f=6}if(this.#l.length===4){let n=Ee.svgRound(this.#t[10]),s=Ee.svgRound(this.#t[11]);return this.#i=`${this.#i} L ${n} ${s}`,this.#f=12,this.#i}let a=[];if(this.#f===0)a.push(`M ${e} ${t}`),this.#f=6;for(let n=this.#f,s=this.#t.length;n<s;n+=6){let[i,l,f,c,h,u]=this.#t.slice(n,n+6).map(Ee.svgRound);a.push(`C${i} ${l} ${f} ${c} ${h} ${u}`)}return this.#i+=a.join(" "),this.#f=this.#t.length,this.#i}getOutlines(e,t,a,n){let s=this.#a.at(-1);return s.line=new Float32Array(s.line),s.points=new Float32Array(s.points),this.#o.build(this.#a,e,t,a,this.#n,this.#s,n),this.#e=null,this.#t=null,this.#a=null,this.#i=null,this.#o}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}class Uo extends Ee{#e;#t=0;#a;#n;#s;#l;#i;#f;#o;build(e,t,a,n,s,i,l){this.#s=t,this.#l=a,this.#i=n,this.#f=s,this.#o=i,this.#a=l??0,this.#n=e,this.#h()}get thickness(){return this.#o}setLastElement(e){return this.#n.push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#n.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let e=[];for(let{line:t}of this.#n){if(e.push(`M${Ee.svgRound(t[4])} ${Ee.svgRound(t[5])}`),t.length===6){e.push("Z");continue}if(t.length===12&&isNaN(t[6])){e.push(`L${Ee.svgRound(t[10])} ${Ee.svgRound(t[11])}`);continue}for(let a=6,n=t.length;a<n;a+=6){let[s,i,l,f,c,h]=t.subarray(a,a+6).map(Ee.svgRound);e.push(`C${s} ${i} ${l} ${f} ${c} ${h}`)}}return e.join("")}serialize([e,t,a,n],s){let i=[],l=[],[f,c,h,u]=this.#u(),g,b,d,j,A,C,S,O,T;switch(this.#f){case 0:T=Ee._rescale,g=e,b=t+n,d=a,j=-n,A=e+f*a,C=t+(1-c-u)*n,S=e+(f+h)*a,O=t+(1-c)*n;break;case 90:T=Ee._rescaleAndSwap,g=e,b=t,d=a,j=n,A=e+c*a,C=t+f*n,S=e+(c+u)*a,O=t+(f+h)*n;break;case 180:T=Ee._rescale,g=e+a,b=t,d=-a,j=n,A=e+(1-f-h)*a,C=t+c*n,S=e+(1-f)*a,O=t+(c+u)*n;break;case 270:T=Ee._rescaleAndSwap,g=e+a,b=t+n,d=-a,j=-n,A=e+(1-c-u)*a,C=t+(1-f-h)*n,S=e+(1-c)*a,O=t+(1-f)*n;break}for(let{line:H,points:M}of this.#n)i.push(T(H,g,b,d,j,s?Array(H.length):null)),l.push(T(M,g,b,d,j,s?Array(M.length):null));return{lines:i,points:l,rect:[A,C,S,O]}}static deserialize(e,t,a,n,s,{paths:{lines:i,points:l},rotation:f,thickness:c}){let h=[],u,g,b,d,j;switch(f){case 0:j=Ee._rescale,u=-e/a,g=t/n+1,b=1/a,d=-1/n;break;case 90:j=Ee._rescaleAndSwap,u=-t/n,g=-e/a,b=1/n,d=1/a;break;case 180:j=Ee._rescale,u=e/a+1,g=-t/n,b=-1/a,d=1/n;break;case 270:j=Ee._rescaleAndSwap,u=t/n+1,g=e/a+1,b=-1/n,d=-1/a;break}if(!i){i=[];for(let C of l){let S=C.length;if(S===2){i.push(new Float32Array([NaN,NaN,NaN,NaN,C[0],C[1]]));continue}if(S===4){i.push(new Float32Array([NaN,NaN,NaN,NaN,C[0],C[1],NaN,NaN,NaN,NaN,C[2],C[3]]));continue}let O=new Float32Array(3*(S-2));i.push(O);let[T,H,M,x]=C.subarray(0,4);O.set([NaN,NaN,NaN,NaN,T,H],0);for(let R=4;R<S;R+=2){let E=C[R],K=C[R+1];O.set(Ee.createBezierPoints(T,H,M,x,E,K),(R-2)*3),[T,H,M,x]=[M,x,E,K]}}}for(let C=0,S=i.length;C<S;C++)h.push({line:j(i[C].map((O)=>O??NaN),u,g,b,d),points:j(l[C].map((O)=>O??NaN),u,g,b,d)});let A=new this.prototype.constructor;return A.build(h,a,n,1,f,c,s),A}#r(e=this.#o){let t=this.#a+e/2*this.#i;return this.#f%180===0?[t/this.#s,t/this.#l]:[t/this.#l,t/this.#s]}#u(){let[e,t,a,n]=this.#e,[s,i]=this.#r(0);return[e+s,t+i,a-2*s,n-2*i]}#h(){let e=this.#e=Br.slice();for(let{line:n}of this.#n){if(n.length<=12){for(let l=4,f=n.length;l<f;l+=6)Be.pointBoundingBox(n[l],n[l+1],e);continue}let s=n[4],i=n[5];for(let l=6,f=n.length;l<f;l+=6){let[c,h,u,g,b,d]=n.subarray(l,l+6);Be.bezierBoundingBox(s,i,c,h,u,g,b,d,e),s=b,i=d}}let[t,a]=this.#r();e[0]=da(e[0]-t,0,1),e[1]=da(e[1]-a,0,1),e[2]=da(e[2]+t,0,1),e[3]=da(e[3]+a,0,1),e[2]-=e[0],e[3]-=e[1]}get box(){return this.#e}updateProperty(e,t){if(e==="stroke-width")return this.#g(t);return null}#g(e){let[t,a]=this.#r();this.#o=e;let[n,s]=this.#r(),[i,l]=[n-t,s-a],f=this.#e;return f[0]-=i,f[1]-=l,f[2]+=2*i,f[3]+=2*l,f}updateParentDimensions([e,t],a){let[n,s]=this.#r();this.#s=e,this.#l=t,this.#i=a;let[i,l]=this.#r(),f=i-n,c=l-s,h=this.#e;return h[0]-=f,h[1]-=c,h[2]+=2*f,h[3]+=2*c,h}updateRotation(e){return this.#t=e,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#e.map(Ee.svgRound).join(" ")}get defaultProperties(){let[e,t]=this.#e;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Ee.svgRound(e)} ${Ee.svgRound(t)}`}}}get rotationTransform(){let[,,e,t]=this.#e,a=0,n=0,s=0,i=0,l=0,f=0;switch(this.#t){case 90:n=t/e,s=-e/t,l=e;break;case 180:a=-1,i=-1,l=e,f=t;break;case 270:n=-t/e,s=e/t,f=t;break;default:return""}return`matrix(${a} ${n} ${s} ${i} ${Ee.svgRound(l)} ${Ee.svgRound(f)})`}getPathResizingSVGProperties([e,t,a,n]){let[s,i]=this.#r(),[l,f,c,h]=this.#e;if(Math.abs(c-s)<=Ee.PRECISION||Math.abs(h-i)<=Ee.PRECISION){let j=e+a/2-(l+c/2),A=t+n/2-(f+h/2);return{path:{"transform-origin":`${Ee.svgRound(e)} ${Ee.svgRound(t)}`,transform:`${this.rotationTransform} translate(${j} ${A})`}}}let u=(a-2*s)/(c-2*s),g=(n-2*i)/(h-2*i),b=c/a,d=h/n;return{path:{"transform-origin":`${Ee.svgRound(l)} ${Ee.svgRound(f)}`,transform:`${this.rotationTransform} scale(${b} ${d}) translate(${Ee.svgRound(s)} ${Ee.svgRound(i)}) scale(${u} ${g}) translate(${Ee.svgRound(-s)} ${Ee.svgRound(-i)})`}}}getPathResizedSVGProperties([e,t,a,n]){let[s,i]=this.#r(),l=this.#e,[f,c,h,u]=l;if(l[0]=e,l[1]=t,l[2]=a,l[3]=n,Math.abs(h-s)<=Ee.PRECISION||Math.abs(u-i)<=Ee.PRECISION){let A=e+a/2-(f+h/2),C=t+n/2-(c+u/2);for(let{line:S,points:O}of this.#n)Ee._translate(S,A,C,S),Ee._translate(O,A,C,O);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Ee.svgRound(e)} ${Ee.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let g=(a-2*s)/(h-2*s),b=(n-2*i)/(u-2*i),d=-g*(f+s)+e+s,j=-b*(c+i)+t+i;if(g!==1||b!==1||d!==0||j!==0)for(let{line:A,points:C}of this.#n)Ee._rescale(A,d,j,g,b,A),Ee._rescale(C,d,j,g,b,C);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Ee.svgRound(e)} ${Ee.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,t],a){let[n,s]=a,i=this.#e,l=e-i[0],f=t-i[1];if(this.#s===n&&this.#l===s)for(let{line:c,points:h}of this.#n)Ee._translate(c,l,f,c),Ee._translate(h,l,f,h);else{let c=this.#s/n,h=this.#l/s;this.#s=n,this.#l=s;for(let{line:u,points:g}of this.#n)Ee._rescale(u,l,f,c,h,u),Ee._rescale(g,l,f,c,h,g);i[2]*=c,i[3]*=h}return i[0]=e,i[1]=t,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${Ee.svgRound(e)} ${Ee.svgRound(t)}`}}}get defaultSVGProperties(){let e=this.#e;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${Ee.svgRound(e[0])} ${Ee.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}}class I5 extends U8{constructor(e){super();this._viewParameters=e,super.updateProperties({fill:"none",stroke:Ke._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,t){if(e==="stroke-width")t??=this["stroke-width"],t*=this._viewParameters.realScale;super.updateSVGProperty(e,t)}clone(){let e=new I5(this._viewParameters);return e.updateAll(this),e}}class G8 extends Xt{static _type="ink";static _editorType=ot.INK;static _defaultDrawingOptions=null;constructor(e){super({...e,name:"inkEditor"});this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(e,t){Ke.initialize(e,t),this._defaultDrawingOptions=new I5(t.viewParameters)}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!0}static get typesMap(){return lt(this,"typesMap",new Map([[pt.INK_THICKNESS,"stroke-width"],[pt.INK_COLOR,"stroke"],[pt.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(e,t,a,n,s){return new uS(e,t,a,n,s,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(e,t,a,n,s,i){return Uo.deserialize(e,t,a,n,s,i)}static async deserialize(e,t,a){let n=null;if(e instanceof z5){let{data:{inkLists:i,rect:l,rotation:f,id:c,color:h,opacity:u,borderStyle:{rawWidth:g},popupRef:b,richText:d,contentsObj:j,creationDate:A,modificationDate:C},parent:{page:{pageNumber:S}}}=e;n=e={annotationType:ot.INK,color:Array.from(h),thickness:g,opacity:u,paths:{points:i},boxes:null,pageIndex:S-1,rect:l.slice(0),rotation:f,annotationElementId:c,id:c,deleted:!1,popupRef:b,richText:d,comment:j?.str||null,creationDate:A,modificationDate:C}}let s=await super.deserialize(e,t,a);if(s._initialData=n,e.comment)s.setCommentData(e);return s}get toolbarButtons(){return this._colorPicker||=new m2(this),[["colorPicker",this._colorPicker]]}get colorType(){return pt.INK_COLOR}get colorAndOpacityType(){return pt.INK_COLOR_AND_OPACITY}get opacityType(){return pt.INK_OPACITY}updateParams(e,t){if(e===pt.INK_COLOR_AND_OPACITY){this._updateColorAndOpacity(t.color,t.opacity);return}super.updateParams(e,t)}static updateDefaultParams(e,t){if(e===pt.INK_COLOR_AND_OPACITY){super.updateDefaultParams(pt.INK_COLOR,t.color),super.updateDefaultParams(pt.INK_OPACITY,t.opacity);return}super.updateDefaultParams(e,t)}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();let{_drawId:e,_drawingOptions:t,parent:a}=this;t.updateSVGProperty("stroke-width"),a.drawLayer.updateProperties(e,t.toSVGProperties())}static onScaleChangingWhenDrawing(){let e=this._currentParent;if(!e)return;super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties())}createDrawingOptions({color:e,thickness:t,opacity:a}){this._drawingOptions=G8.getDefaultDrawingOptions({stroke:Be.makeHexColor(...e),"stroke-width":t,"stroke-opacity":a})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:t,points:a}=this.serializeDraw(e),{_drawingOptions:{stroke:n,"stroke-opacity":s,"stroke-width":i}}=this,l=Object.assign(super.serialize(e),{color:Ke._colorManager.convert(n),opacity:s,thickness:i,paths:{lines:t,points:a}});if(this.addComment(l),e)return l.isCopy=!0,l;if(this.annotationElementId&&!this.#e(l))return null;return l.id=this.annotationElementId,l}#e(e){let{color:t,thickness:a,opacity:n,pageIndex:s}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((i,l)=>i!==t[l])||e.thickness!==a||e.opacity!==n||e.pageIndex!==s}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let{points:t,rect:a}=this.serializeDraw(!1);return e.updateEdited({rect:a,thickness:this._drawingOptions["stroke-width"],points:t,popup:this.comment}),null}}class k5 extends Uo{toSVGPath(){let e=super.toSVGPath();if(!e.endsWith("Z"))e+="Z";return e}}var f5=8,s2=3;class Or{static#e={maxDim:512,sigmaSFactor:0.02,sigmaR:25,kernelSize:16};static#t(e,t,a,n){if(a-=e,n-=t,a===0)return n>0?0:4;if(a===1)return n+6;return 2-n}static#a=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static#n(e,t,a,n,s,i,l){let f=this.#t(a,n,s,i);for(let c=0;c<8;c++){let h=(-c+f-l+16)%8,u=this.#a[2*h],g=this.#a[2*h+1];if(e[(a+u)*t+(n+g)]!==0)return h}return-1}static#s(e,t,a,n,s,i,l){let f=this.#t(a,n,s,i);for(let c=0;c<8;c++){let h=(c+f+l+16)%8,u=this.#a[2*h],g=this.#a[2*h+1];if(e[(a+u)*t+(n+g)]!==0)return h}return-1}static#l(e,t,a,n){let s=e.length,i=new Int32Array(s);for(let h=0;h<s;h++)i[h]=e[h]<=n?1:0;for(let h=1;h<a-1;h++)i[h*t]=i[h*t+t-1]=0;for(let h=0;h<t;h++)i[h]=i[t*a-1-h]=0;let l=1,f,c=[];for(let h=1;h<a-1;h++){f=1;for(let u=1;u<t-1;u++){let g=h*t+u,b=i[g];if(b===0)continue;let d=h,j=u;if(b===1&&i[g-1]===0)l+=1,j-=1;else if(b>=1&&i[g+1]===0){if(l+=1,j+=1,b>1)f=b}else{if(b!==1)f=Math.abs(b);continue}let A=[u,h],C=j===u+1,S={isHole:C,points:A,id:l,parent:0};c.push(S);let O;for(let P of c)if(P.id===f){O=P;break}if(!O)S.parent=C?f:0;else if(O.isHole)S.parent=C?O.parent:f;else S.parent=C?f:O.parent;let T=this.#n(i,t,h,u,d,j,0);if(T===-1){if(i[g]=-l,i[g]!==1)f=Math.abs(i[g]);continue}let H=this.#a[2*T],M=this.#a[2*T+1],x=h+H,R=u+M;d=x,j=R;let E=h,K=u;while(!0){let P=this.#s(i,t,E,K,d,j,1);H=this.#a[2*P],M=this.#a[2*P+1];let $=E+H,te=K+M;A.push(te,$);let ae=E*t+K;if(i[ae+1]===0)i[ae]=-l;else if(i[ae]===1)i[ae]=l;if($===h&&te===u&&E===x&&K===R){if(i[g]!==1)f=Math.abs(i[g]);break}else d=E,j=K,E=$,K=te}}}return c}static#i(e,t,a,n){if(a-t<=4){for(let x=t;x<a-2;x+=2)n.push(e[x],e[x+1]);return}let s=e[t],i=e[t+1],l=e[a-4]-s,f=e[a-3]-i,c=Math.hypot(l,f),h=l/c,u=f/c,g=h*i-u*s,b=f/l,d=1/c,j=Math.atan(b),A=Math.cos(j),C=Math.sin(j),S=d*(Math.abs(A)+Math.abs(C)),O=d*(1-S+S**2),T=Math.max(Math.atan(Math.abs(C+A)*O),Math.atan(Math.abs(C-A)*O)),H=0,M=t;for(let x=t+2;x<a-2;x+=2){let R=Math.abs(g-h*e[x+1]+u*e[x]);if(R>H)M=x,H=R}if(H>(c*T)**2)this.#i(e,t,M+2,n),this.#i(e,M,a,n);else n.push(s,i)}static#f(e){let t=[],a=e.length;return this.#i(e,0,a,t),t.push(e[a-2],e[a-1]),t.length<=4?null:t}static#o(e,t,a,n,s,i){let l=new Float32Array(i**2),f=-2*n**2,c=i>>1;for(let j=0;j<i;j++){let A=(j-c)**2;for(let C=0;C<i;C++)l[j*i+C]=Math.exp((A+(C-c)**2)/f)}let h=new Float32Array(256),u=-2*s**2;for(let j=0;j<256;j++)h[j]=Math.exp(j**2/u);let g=e.length,b=new Uint8Array(g),d=new Uint32Array(256);for(let j=0;j<a;j++)for(let A=0;A<t;A++){let C=j*t+A,S=e[C],O=0,T=0;for(let M=0;M<i;M++){let x=j+M-c;if(x<0||x>=a)continue;for(let R=0;R<i;R++){let E=A+R-c;if(E<0||E>=t)continue;let K=e[x*t+E],P=l[M*i+R]*h[Math.abs(K-S)];O+=K*P,T+=P}}let H=b[C]=Math.round(O/T);d[H]++}return[b,d]}static#r(e){let t=new Uint32Array(256);for(let a of e)t[a]++;return t}static#u(e){let t=e.length,a=new Uint8ClampedArray(t>>2),n=-1/0,s=1/0;for(let l=0,f=a.length;l<f;l++){let c=a[l]=e[l<<2];n=Math.max(n,c),s=Math.min(s,c)}let i=255/(n-s);for(let l=0,f=a.length;l<f;l++)a[l]=(a[l]-s)*i;return a}static#h(e){let t,a=-1/0,n=-1/0,s=e.findIndex((f)=>f!==0),i=s,l=s;for(t=s;t<256;t++){let f=e[t];if(f>a){if(t-i>n)n=t-i,l=t-1;a=f,i=t}}for(t=l-1;t>=0;t--)if(e[t]>e[t+1])break;return t}static#g(e){let t=e,{width:a,height:n}=e,{maxDim:s}=this.#e,i=a,l=n;if(a>s||n>s){let g=a,b=n,d=Math.log2(Math.max(a,n)/s),j=Math.floor(d);d=d===j?j-1:j;for(let C=0;C<d;C++){i=Math.ceil(g/2),l=Math.ceil(b/2);let S=new OffscreenCanvas(i,l);if(S.getContext("2d").drawImage(e,0,0,g,b,0,0,i,l),g=i,b=l,e!==t)e.close();e=S.transferToImageBitmap()}let A=Math.min(s/i,s/l);i=Math.round(i*A),l=Math.round(l*A)}let c=new OffscreenCanvas(i,l).getContext("2d",{willReadFrequently:!0});c.fillStyle="white",c.fillRect(0,0,i,l),c.filter="grayscale(1)",c.drawImage(e,0,0,e.width,e.height,0,0,i,l);let h=c.getImageData(0,0,i,l).data;return[this.#u(h),i,l]}static extractContoursFromText(e,{fontFamily:t,fontStyle:a,fontWeight:n},s,i,l,f){let c=new OffscreenCanvas(1,1),h=c.getContext("2d",{alpha:!1}),u=200,g=h.font=`${a} ${n} ${u}px ${t}`,{actualBoundingBoxLeft:b,actualBoundingBoxRight:d,actualBoundingBoxAscent:j,actualBoundingBoxDescent:A,fontBoundingBoxAscent:C,fontBoundingBoxDescent:S,width:O}=h.measureText(e),T=1.5,H=Math.ceil(Math.max(Math.abs(b)+Math.abs(d)||0,O)*T),M=Math.ceil(Math.max(Math.abs(j)+Math.abs(A)||u,Math.abs(C)+Math.abs(S)||u)*T);c=new OffscreenCanvas(H,M),h=c.getContext("2d",{alpha:!0,willReadFrequently:!0}),h.font=g,h.filter="grayscale(1)",h.fillStyle="white",h.fillRect(0,0,H,M),h.fillStyle="black",h.fillText(e,H*(T-1)/2,M*(3-T)/2);let x=this.#u(h.getImageData(0,0,H,M).data),R=this.#r(x),E=this.#h(R),K=this.#l(x,H,M,E);return this.processDrawnLines({lines:{curves:K,width:H,height:M},pageWidth:s,pageHeight:i,rotation:l,innerMargin:f,mustSmooth:!0,areContours:!0})}static process(e,t,a,n,s){let[i,l,f]=this.#g(e),[c,h]=this.#o(i,l,f,Math.hypot(l,f)*this.#e.sigmaSFactor,this.#e.sigmaR,this.#e.kernelSize),u=this.#h(h),g=this.#l(c,l,f,u);return this.processDrawnLines({lines:{curves:g,width:l,height:f},pageWidth:t,pageHeight:a,rotation:n,innerMargin:s,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:t,pageHeight:a,rotation:n,innerMargin:s,mustSmooth:i,areContours:l}){if(n%180!==0)[t,a]=[a,t];let{curves:f,width:c,height:h}=e,u=e.thickness??0,g=[],b=Math.min(t/c,a/h),d=b/t,j=b/a,A=[];for(let{points:S}of f){let O=i?this.#f(S):S;if(!O)continue;A.push(O);let T=O.length,H=new Float32Array(T),M=new Float32Array(3*(T===2?2:T-2));if(g.push({line:M,points:H}),T===2){H[0]=O[0]*d,H[1]=O[1]*j,M.set([NaN,NaN,NaN,NaN,H[0],H[1]],0);continue}let[x,R,E,K]=O;x*=d,R*=j,E*=d,K*=j,H.set([x,R,E,K],0),M.set([NaN,NaN,NaN,NaN,x,R],0);for(let P=4;P<T;P+=2){let $=H[P]=O[P]*d,te=H[P+1]=O[P+1]*j;M.set(Ee.createBezierPoints(x,R,E,K,$,te),(P-2)*3),[x,R,E,K]=[E,K,$,te]}}if(g.length===0)return null;let C=l?new k5:new Uo;return C.build(g,t,a,1,n,l?0:u,s),{outline:C,newCurves:A,areContours:l,thickness:u,width:c,height:h}}static async compressSignature({outlines:e,areContours:t,thickness:a,width:n,height:s}){let i=1/0,l=-1/0,f=0;for(let S of e){f+=S.length;for(let O=2,T=S.length;O<T;O++){let H=S[O]-S[O-2];i=Math.min(i,H),l=Math.max(l,H)}}let c;if(i>=-128&&l<=127)c=Int8Array;else if(i>=-32768&&l<=32767)c=Int16Array;else c=Int32Array;let h=e.length,u=f5+s2*h,g=new Uint32Array(u),b=0;g[b++]=u*Uint32Array.BYTES_PER_ELEMENT+(f-2*h)*c.BYTES_PER_ELEMENT,g[b++]=0,g[b++]=n,g[b++]=s,g[b++]=t?0:1,g[b++]=Math.max(0,Math.floor(a??0)),g[b++]=h,g[b++]=c.BYTES_PER_ELEMENT;for(let S of e)g[b++]=S.length-2,g[b++]=S[0],g[b++]=S[1];let d=new CompressionStream("deflate-raw"),j=d.writable.getWriter();await j.ready,j.write(g);let A=c.prototype.constructor;for(let S of e){let O=new A(S.length-2);for(let T=2,H=S.length;T<H;T++)O[T-2]=S[T]-S[T-2];j.write(O)}return j.close(),(await new Response(d.readable).bytes()).toBase64()}static async decompressSignature(e){try{let t=Uint8Array.fromBase64(e),{readable:a,writable:n}=new DecompressionStream("deflate-raw"),s=n.getWriter();await s.ready,s.write(t).then(async()=>{await s.ready,await s.close()}).catch(()=>{});let i=null,l=0;for await(let O of a)i||=new Uint8Array(new Uint32Array(O.buffer,0,4)[0]),i.set(O,l),l+=O.length;let f=new Uint32Array(i.buffer,0,i.length>>2),c=f[1];if(c!==0)throw Error(`Invalid version: ${c}`);let h=f[2],u=f[3],g=f[4]===0,b=f[5],d=f[6],j=f[7],A=[],C=(f5+s2*d)*Uint32Array.BYTES_PER_ELEMENT,S;switch(j){case Int8Array.BYTES_PER_ELEMENT:S=new Int8Array(i.buffer,C);break;case Int16Array.BYTES_PER_ELEMENT:S=new Int16Array(i.buffer,C);break;case Int32Array.BYTES_PER_ELEMENT:S=new Int32Array(i.buffer,C);break}l=0;for(let O=0;O<d;O++){let T=f[s2*O+f5],H=new Float32Array(T+2);A.push(H);for(let M=0;M<s2-1;M++)H[M]=f[s2*O+f5+M+1];for(let M=0;M<T;M++)H[M+2]=H[M]+S[l++]}return{areContours:g,thickness:b,outlines:A,width:h,height:u}}catch(t){return ct(`decompressSignature: ${t}`),null}}}class X8 extends U8{constructor(){super();super.updateProperties({fill:Ke._defaultLineColor,"stroke-width":0})}clone(){let e=new X8;return e.updateAll(this),e}}class K8 extends I5{constructor(e){super(e);super.updateProperties({stroke:Ke._defaultLineColor,"stroke-width":1})}clone(){let e=new K8(this._viewParameters);return e.updateAll(this),e}}class g0 extends Xt{#e=!1;#t=null;#a=null;#n=null;static _type="signature";static _editorType=ot.SIGNATURE;static _defaultDrawingOptions=null;constructor(e){super({...e,mustBeCommitted:!0,name:"signatureEditor"});this._willKeepAspectRatio=!0,this.#a=e.signatureData||null,this.#t=null,this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(e,t){Ke.initialize(e,t),this._defaultDrawingOptions=new X8,this._defaultDrawnSignatureOptions=new K8(t.viewParameters)}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!1}static get typesMap(){return lt(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!this.#t}}static computeTelemetryFinalData(e){let t=e.get("hasDescription");return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){if(this._drawId===null)return;super.onScaleChanging()}render(){if(this.div)return this.div;let e,t,{_isCopy:a}=this;if(a)this._isCopy=!1,e=this.x,t=this.y;if(super.render(),this._drawId===null)if(this.#a){let{lines:n,mustSmooth:s,areContours:i,description:l,uuid:f,heightInPage:c}=this.#a,{rawDims:{pageWidth:h,pageHeight:u},rotation:g}=this.parent.viewport,b=Or.processDrawnLines({lines:n,pageWidth:h,pageHeight:u,rotation:g,innerMargin:g0._INNER_MARGIN,mustSmooth:s,areContours:i});this.addSignature(b,c,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.#t||""}));if(a)this._isCopy=!0,this._moveAfterPaste(e,t);return this.div}setUuid(e){this.#n=e,this.addEditToolbar()}getUuid(){return this.#n}get description(){return this.#t}set description(e){if(this.#t=e,!this.div)return;this.div.setAttribute("data-l10n-args",JSON.stringify({description:e})),super.addEditToolbar().then((t)=>{t?.updateEditSignatureButton(e)})}getSignaturePreview(){let{newCurves:e,areContours:t,thickness:a,width:n,height:s}=this.#a,i=Math.max(n,s),l=Or.processDrawnLines({lines:{curves:e.map((f)=>({points:f})),thickness:a,width:n,height:s},pageWidth:i,pageHeight:i,rotation:0,innerMargin:0,mustSmooth:!1,areContours:t});return{areContours:t,outline:l.outline}}get toolbarButtons(){if(this._uiManager.signatureManager)return[["editSignature",this._uiManager.signatureManager]];return super.toolbarButtons}addSignature(e,t,a,n){let{x:s,y:i}=this,{outline:l}=this.#a=e;this.#e=l instanceof k5,this.description=a;let f;if(this.#e)f=g0.getDefaultDrawingOptions();else f=g0._defaultDrawnSignatureOptions.clone(),f.updateProperties({"stroke-width":l.thickness});this._addOutlines({drawOutlines:l,drawingOptions:f});let[,c]=this.pageDimensions,h=t/c;if(h=h>=1?0.5:h,this.width*=h/this.height,this.width>=1)h*=0.9/this.width,this.width=0.9;this.height=h,this.setDims(),this.x=s,this.y=i,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(n),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!n,hasDescription:!!a}}),this.div.hidden=!1}getFromImage(e){let{rawDims:{pageWidth:t,pageHeight:a},rotation:n}=this.parent.viewport;return Or.process(e,t,a,n,g0._INNER_MARGIN)}getFromText(e,t){let{rawDims:{pageWidth:a,pageHeight:n},rotation:s}=this.parent.viewport;return Or.extractContoursFromText(e,t,a,n,s,g0._INNER_MARGIN)}getDrawnSignature(e){let{rawDims:{pageWidth:t,pageHeight:a},rotation:n}=this.parent.viewport;return Or.processDrawnLines({lines:e,pageWidth:t,pageHeight:a,rotation:n,innerMargin:g0._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:t}){if(e)this._drawingOptions=g0.getDefaultDrawingOptions();else this._drawingOptions=g0._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":t})}serialize(e=!1){if(this.isEmpty())return null;let{lines:t,points:a}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":n}}=this,s=Object.assign(super.serialize(e),{isSignature:!0,areContours:this.#e,color:[0,0,0],thickness:this.#e?0:n});if(this.addComment(s),e)s.paths={lines:t,points:a},s.uuid=this.#n,s.isCopy=!0;else s.lines=t;if(this.#t)s.accessibilityData={type:"Figure",alt:this.#t};return s}static deserializeDraw(e,t,a,n,s,i){if(i.areContours)return k5.deserialize(e,t,a,n,s,i);return Uo.deserialize(e,t,a,n,s,i)}static async deserialize(e,t,a){let n=await super.deserialize(e,t,a);return n.#e=e.areContours,n.description=e.accessibilityData?.alt||"",n.#n=e.uuid,n}}class mS extends Ke{#e=null;#t=null;#a=null;#n=null;#s=null;#l="";#i=null;#f=!1;#o=null;#r=!1;#u=!1;static _type="stamp";static _editorType=ot.STAMP;constructor(e){super({...e,name:"stampEditor"});this.#n=e.bitmapUrl,this.#s=e.bitmapFile,this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,t){Ke.initialize(e,t)}static isHandlingMimeForPasting(e){return h8.includes(e)}static paste(e,t){t.pasteEditor({mode:ot.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){if(this._uiManager.useNewAltTextFlow)this.div.hidden=!1;super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){let t=e.get("hasAltText");return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}#h(e,t=!1){if(!e){this.remove();return}if(this.#e=e.bitmap,!t)this.#t=e.id,this.#r=e.isSvg;if(e.file)this.#l=e.file.name;this.#p()}#g(){if(this.#a=null,this._uiManager.enableWaiting(!1),!this.#i)return;if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}async mlGuessAltText(e=null,t=!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:n,width:s,height:i}=e||this.copyCanvas(null,null,!0).imageData,l=await a.guess({name:"altText",request:{data:n,width:s,height:i,channels:n.length/(s*i)}});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),t&&!this.hasAltTextData())this.altTextData={alt:f,decorative:!1};return f}#b(){if(this.#t){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#t).then((a)=>this.#h(a,!0)).finally(()=>this.#g());return}if(this.#n){let a=this.#n;this.#n=null,this._uiManager.enableWaiting(!0),this.#a=this._uiManager.imageManager.getFromUrl(a).then((n)=>this.#h(n)).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((n)=>this.#h(n)).finally(()=>this.#g());return}let e=document.createElement("input");e.type="file",e.accept=h8.join(",");let t=this._uiManager._signal;this.#a=new Promise((a)=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let n=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#h(n)}a()},{signal:t}),e.addEventListener("cancel",()=>{this.remove(),a()},{signal:t})}).finally(()=>this.#g()),e.click()}remove(){if(this.#t){if(this.#e=null,this._uiManager.imageManager.deleteId(this.#t),this.#i?.remove(),this.#i=null,this.#o)clearTimeout(this.#o),this.#o=null}super.remove()}rebuild(){if(!this.parent){if(this.#t)this.#b();return}if(super.rebuild(),this.div===null)return;if(this.#t&&this.#i===null)this.#b();if(!this.isAttachedToDOM)this.parent.add(this)}onceAdded(e){if(this._isDraggable=!0,e)this.div.focus()}isEmpty(){return!(this.#a||this.#e||this.#n||this.#s||this.#t||this.#f)}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;if(this._isCopy)e=this.x,t=this.y;if(super.render(),this.div.hidden=!0,this.createAltText(),!this.#f)if(this.#e)this.#p();else this.#b();if(this._isCopy)this._moveAfterPaste(e,t);return this._uiManager.addShouldRescale(this),this.div}setCanvas(e,t){let{id:a,bitmap:n}=this._uiManager.imageManager.getFromCanvas(e,t);if(t.remove(),a&&this._uiManager.imageManager.isValidId(a)){if(this.#t=a,n)this.#e=n;this.#f=!1,this.#p()}}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;if(this.#o!==null)clearTimeout(this.#o);let e=200;this.#o=setTimeout(()=>{this.#o=null,this.#m()},e)}#p(){let{div:e}=this,{width:t,height:a}=this.#e,[n,s]=this.pageDimensions,i=0.75;if(this.width)t=this.width*n,a=this.height*s;else if(t>0.75*n||a>0.75*s){let f=Math.min(0.75*n/t,0.75*s/a);t*=f,a*=f}this._uiManager.enableWaiting(!1);let l=this.#i=document.createElement("canvas");if(l.setAttribute("role","img"),this.addContainer(l),this.width=t/n,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)e.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(Ke._l10nAlert.stamp)}copyCanvas(e,t,a=!1){if(!e)e=224;let{width:n,height:s}=this.#e,i=new w0,l=this.#e,f=n,c=s,h=null;if(t){if(n>t||s>t){let M=Math.min(t/n,t/s);f=Math.floor(n*M),c=Math.floor(s*M)}h=document.createElement("canvas");let g=h.width=Math.ceil(f*i.sx),b=h.height=Math.ceil(c*i.sy);if(!this.#r)l=this.#c(g,b);let d=h.getContext("2d");d.filter=this._uiManager.hcmFilter;let j="white",A="#cfcfd8";if(this._uiManager.hcmFilter!=="none")A="black";else if(GA.isDarkMode)j="#8f8f9d",A="#42414d";let C=15,S=C*i.sx,O=C*i.sy,T=new OffscreenCanvas(S*2,O*2),H=T.getContext("2d");H.fillStyle=j,H.fillRect(0,0,S*2,O*2),H.fillStyle=A,H.fillRect(0,0,S,O),H.fillRect(S,O,S,O),d.fillStyle=d.createPattern(T,"repeat"),d.fillRect(0,0,g,b),d.drawImage(l,0,0,l.width,l.height,0,0,g,b)}let u=null;if(a){let g,b;if(i.symmetric&&l.width<e&&l.height<e)g=l.width,b=l.height;else if(l=this.#e,n>e||s>e){let A=Math.min(e/n,e/s);if(g=Math.floor(n*A),b=Math.floor(s*A),!this.#r)l=this.#c(g,b)}let j=new OffscreenCanvas(g,b).getContext("2d",{willReadFrequently:!0});j.drawImage(l,0,0,l.width,l.height,0,0,g,b),u={width:g,height:b,data:j.getImageData(0,0,g,b).data}}return{canvas:h,width:f,height:c,imageData:u}}#c(e,t){let{width:a,height:n}=this.#e,s=a,i=n,l=this.#e;while(s>2*e||i>2*t){let f=s,c=i;if(s>2*e)s=Math.ceil(s/2);if(i>2*t)i=Math.ceil(i/2);let h=new OffscreenCanvas(s,i);h.getContext("2d").drawImage(l,0,0,f,c,0,0,s,i),l=h.transferToImageBitmap()}return l}#m(){let[e,t]=this.parentDimensions,{width:a,height:n}=this,s=new w0,i=Math.ceil(a*e*s.sx),l=Math.ceil(n*t*s.sy),f=this.#i;if(!f||f.width===i&&f.height===l)return;f.width=i,f.height=l;let c=this.#r?this.#e:this.#c(i,l),h=f.getContext("2d");h.filter=this._uiManager.hcmFilter,h.drawImage(c,0,0,c.width,c.height,0,0,i,l)}#d(e){if(e){if(this.#r){let n=this._uiManager.imageManager.getSvgUrl(this.#t);if(n)return n}let t=document.createElement("canvas");return{width:t.width,height:t.height}=this.#e,t.getContext("2d").drawImage(this.#e,0,0),t.toDataURL()}if(this.#r){let[t,a]=this.pageDimensions,n=Math.round(this.width*t*Mr.PDF_TO_CSS_UNITS),s=Math.round(this.height*a*Mr.PDF_TO_CSS_UNITS),i=new OffscreenCanvas(n,s);return i.getContext("2d").drawImage(this.#e,0,0,this.#e.width,this.#e.height,0,0,n,s),i.transferToImageBitmap()}return structuredClone(this.#e)}static async deserialize(e,t,a){let n=null,s=!1;if(e instanceof N8){let{data:{rect:j,rotation:A,id:C,structParent:S,popupRef:O,richText:T,contentsObj:H,creationDate:M,modificationDate:x},container:R,parent:{page:{pageNumber:E}},canvas:K}=e,P,$;if(K)delete e.canvas,{id:P,bitmap:$}=a.imageManager.getFromCanvas(R.id,K),K.remove();else s=!0,e._hasNoCanvas=!0;let te=(await t._structTree.getAriaAttributes(`pdfjs_internal_id_${C}`))?.get("aria-label")||"";n=e={annotationType:ot.STAMP,bitmapId:P,bitmap:$,pageIndex:E-1,rect:j.slice(0),rotation:A,annotationElementId:C,id:C,deleted:!1,accessibilityData:{decorative:!1,altText:te},isSvg:!1,structParent:S,popupRef:O,richText:T,comment:H?.str||null,creationDate:M,modificationDate:x}}let i=await super.deserialize(e,t,a),{rect:l,bitmap:f,bitmapUrl:c,bitmapId:h,isSvg:u,accessibilityData:g}=e;if(s)a.addMissingCanvas(e.id,i),i.#f=!0;else if(h&&a.imageManager.isValidId(h)){if(i.#t=h,f)i.#e=f}else i.#n=c;i.#r=u;let[b,d]=i.pageDimensions;if(i.width=(l[2]-l[0])/b,i.height=(l[3]-l[1])/d,g)i.altTextData=g;if(i._initialData=n,e.comment)i.setCommentData(e);return i.#u=!!n,i}serialize(e=!1,t=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let a=Object.assign(super.serialize(e),{bitmapId:this.#t,isSvg:this.#r});if(this.addComment(a),e)return a.bitmapUrl=this.#d(!0),a.accessibilityData=this.serializeAltText(!0),a.isCopy=!0,a;let{decorative:n,altText:s}=this.serializeAltText(!1);if(!n&&s)a.accessibilityData={type:"Figure",alt:s};if(this.annotationElementId){let l=this.#j(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(t===null)return a;t.stamps||=new Map;let i=this.#r?(a.rect[2]-a.rect[0])*(a.rect[3]-a.rect[1]):null;if(!t.stamps.has(this.#t))t.stamps.set(this.#t,{area:i,serialized:a}),a.bitmap=this.#d(!1);else if(this.#r){let l=t.stamps.get(this.#t);if(i>l.area)l.area=i,l.serialized.bitmap.close(),l.serialized.bitmap=this.#d(!1)}return a}#j(e){let{pageIndex:t,accessibilityData:{altText:a}}=this._initialData,n=e.pageIndex===t,s=(e.accessibilityData?.alt||"")===a;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&n&&s,isSameAltText:s}}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;return e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null}}class nl{#e;#t=!1;#a=null;#n=null;#s=null;#l=new Map;#i=!1;#f=!1;#o=!1;#r=null;#u=null;#h=null;#g=null;#b=null;#p=-1;#c;static _initialized=!1;static#m=new Map([qn,G8,mS,La,g0].map((e)=>[e._editorType,e]));constructor({uiManager:e,pageIndex:t,div:a,structTreeLayer:n,accessibilityManager:s,annotationLayer:i,drawLayer:l,textLayer:f,viewport:c,l10n:h}){let u=[...nl.#m.values()];if(!nl._initialized){nl._initialized=!0;for(let g of u)g.initialize(h,e)}e.registerEditorTypes(u),this.#c=e,this.pageIndex=t,this.div=a,this.#e=s,this.#a=i,this.viewport=c,this.#h=f,this.drawLayer=l,this._structTree=n,this.#c.addLayer(this)}get isEmpty(){return this.#l.size===0}get isInvisible(){return this.isEmpty&&this.#c.getMode()===ot.NONE}updateToolbar(e){this.#c.updateToolbar(e)}updateMode(e=this.#c.getMode()){switch(this.#q(),e){case ot.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case ot.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case ot.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:t}=this.div;if(t.toggle("nonEditing",!1),e===ot.POPUP)t.toggle("commentEditing",!0);else{t.toggle("commentEditing",!1);for(let a of nl.#m.values())t.toggle(`${a._type}Editing`,e===a._editorType)}this.div.hidden=!1}hasTextLayer(e){return e===this.#h?.div}setEditingState(e){this.#c.setEditingState(e)}addCommands(e){this.#c.addCommands(e)}cleanUndoStack(e){this.#c.cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){this.#a?.togglePointerEvents(e)}get#d(){return this.#l.size!==0?this.#l.values():this.#c.getEditors(this.pageIndex)}async enable(){this.#o=!0,this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),this.#b?.abort(),this.#b=null;let e=new Set;for(let a of this.#d)if(a.enableEditing(),a.show(!0),a.annotationElementId)this.#c.removeChangedExistingAnnotation(a),e.add(a.annotationElementId);let t=this.#a;if(t)for(let a of t.getEditableAnnotations()){if(a.hide(),this.#c.isDeletedAnnotationElement(a.data.id))continue;if(e.has(a.data.id))continue;let n=await this.deserialize(a);if(!n)continue;this.addOrRebuild(n),n.enableEditing()}this.#o=!1,this.#c._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.#h&&!this.#b){this.#b=new AbortController;let n=this.#c.combinedSignal(this.#b);this.#h.div.addEventListener("pointerdown",(s)=>{let{clientX:l,clientY:f,timeStamp:c}=s,h=this.#p;if(c-h>500){this.#p=c;return}this.#p=-1;let{classList:u}=this.div;u.toggle("getElements",!0);let g=document.elementsFromPoint(l,f);if(u.toggle("getElements",!1),!this.div.contains(g[0]))return;let b,d=new RegExp("^pdfjs_internal_editor_[0-9]+$");for(let A of g)if(d.test(A.id)){b=A.id;break}if(!b)return;let j=this.#l.get(b);if(j?.annotationElementId===null)Ta(s),j.dblclick(s)},{signal:n,capture:!0})}let e=this.#a,t=[];if(e){let n=new Map,s=new Map;for(let i of this.#d){if(i.disableEditing(),!i.annotationElementId){t.push(i);continue}if(i.serialize()!==null){n.set(i.annotationElementId,i);continue}else s.set(i.annotationElementId,i);this.getEditableAnnotation(i.annotationElementId)?.show(),i.remove()}for(let i of e.getEditableAnnotations()){let{id:l}=i.data;if(this.#c.isDeletedAnnotationElement(l)){i.updateEdited({deleted:!0});continue}let f=s.get(l);if(f){f.resetAnnotationElement(i),f.show(!1),i.show();continue}if(f=n.get(l),f){if(this.#c.addChangedExistingAnnotation(f),f.renderAnnotationElement(i))f.show(!1)}i.show()}}if(this.#q(),this.isEmpty)this.div.hidden=!0;let{classList:a}=this.div;for(let n of nl.#m.values())a.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),e?.updateFakeAnnotations(t),this.#f=!1}getEditableAnnotation(e){return this.#a?.getEditableAnnotation(e)||null}setActiveEditor(e){if(this.#c.getActive()===e)return;this.#c.setActiveEditor(e)}enableTextSelection(){if(this.div.tabIndex=-1,this.#h?.div&&!this.#g){this.#g=new AbortController;let e=this.#c.combinedSignal(this.#g);this.#h.div.addEventListener("pointerdown",this.#j.bind(this),{signal:e}),this.#h.div.classList.add("highlighting")}}disableTextSelection(){if(this.div.tabIndex=0,this.#h?.div&&this.#g)this.#g.abort(),this.#g=null,this.#h.div.classList.remove("highlighting")}#j(e){this.#c.unselectAll();let{target:t}=e;if(t===this.#h.div||(t.getAttribute("role")==="img"||t.classList.contains("endOfContent")||t.classList.contains("textLayerImages")||t.classList.contains("textLayerImagePlaceholder"))&&this.#h.div.contains(t)){let{isMac:a}=ta.platform;if(e.button!==0||e.ctrlKey&&a)return;this.#c.showAllEditors("highlight",!0,!0),this.#h.div.classList.add("free"),this.toggleDrawing(),La.startHighlighting(this,this.#c.direction==="ltr",{target:this.#h.div,x:e.x,y:e.y}),this.#h.div.addEventListener("pointerup",()=>{this.#h.div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:this.#c._signal}),e.preventDefault()}}enableClick(){if(this.#n)return;this.#n=new AbortController;let e=this.#c.combinedSignal(this.#n);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e});let t=this.pointerup.bind(this);this.div.addEventListener("pointerup",t,{signal:e}),this.div.addEventListener("pointercancel",t,{signal:e})}disableClick(){this.#n?.abort(),this.#n=null}attach(e){this.#l.set(e.id,e);let{annotationElementId:t}=e;if(t&&this.#c.isDeletedAnnotationElement(t))this.#c.removeDeletedAnnotationElement(e)}detach(e){if(this.#l.delete(e.id),this.#e?.removePointerInTextLayer(e.contentDiv),!this.#f&&e.annotationElementId)this.#c.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#c.removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){if(e.parent===this)return;if(e.parent&&e.annotationElementId)this.#c.addDeletedAnnotationElement(e),Ke.deleteAnnotationElement(e),e.annotationElementId=null;if(this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM)e.div.remove(),this.div.append(e.div)}add(e){if(e.parent===this&&e.isAttachedToDOM)return;if(this.changeParent(e),this.#c.addEditor(e),this.attach(e),!e.isAttachedToDOM){let t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!this.#o),this.#c.addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;let{activeElement:t}=document;if(e.div.contains(t)&&!this.#s)e._focusEventsAllowed=!1,this.#s=setTimeout(()=>{if(this.#s=null,!e.div.contains(document.activeElement))e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this.#c._signal}),t.focus();else e._focusEventsAllowed=!0},0);e._structTreeParentId=this.#e?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){if(e.needsToBeRebuilt())e.parent||=this,e.rebuild(),e.show();else this.add(e)}addUndoableEditor(e){let t=()=>e._uiManager.rebuild(e),a=()=>{e.remove()};this.addCommands({cmd:t,undo:a,mustExec:!1})}getEditorByUID(e){for(let t of this.#l.values())if(t.uid===e)return t;return null}get#w(){return nl.#m.get(this.#c.getMode())}combinedSignal(e){return this.#c.combinedSignal(e)}#A(e){let t=this.#w;return t?new t.prototype.constructor(e):null}canCreateNewEmptyEditor(){return this.#w?.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e),await this.#c.updateMode(e.mode);let{offsetX:a,offsetY:n}=this.#y(),s=this.#c.getId(),i=this.#A({parent:this,id:s,x:a,y:n,uiManager:this.#c,isCentered:!0,...t});if(i)this.add(i)}async deserialize(e){return await nl.#m.get(e.annotationType??e.annotationEditorType)?.deserialize(e,this,this.#c)||null}createAndAddNewEditor(e,t,a={}){let n=this.#c.getId(),s=this.#A({parent:this,id:n,x:e.offsetX,y:e.offsetY,uiManager:this.#c,isCentered:t,...a});if(s)this.add(s);return s}get boundingClientRect(){return this.div.getBoundingClientRect()}#y(){let{x:e,y:t,width:a,height:n}=this.boundingClientRect,s=Math.max(0,e),i=Math.max(0,t),l=Math.min(window.innerWidth,e+a),f=Math.min(window.innerHeight,t+n),c=(s+l)/2-e,h=(i+f)/2-t,[u,g]=this.viewport.rotation%180===0?[c,h]:[h,c];return{offsetX:u,offsetY:g}}addNewEditor(e={}){this.createAndAddNewEditor(this.#y(),!0,e)}setSelected(e){this.#c.setSelected(e)}toggleSelected(e){this.#c.toggleSelected(e)}unselect(e){this.#c.unselect(e)}pointerup(e){let{isMac:t}=ta.platform;if(e.button!==0||e.ctrlKey&&t)return;if(e.target!==this.div)return;if(!this.#i)return;if(this.#i=!1,this.#w?.isDrawer&&this.#w.supportMultipleDrawings)return;if(!this.#t){this.#t=!0;return}let a=this.#c.getMode();if(a===ot.STAMP||a===ot.POPUP||a===ot.SIGNATURE){this.#c.unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){if(this.#c.getMode()===ot.HIGHLIGHT)this.enableTextSelection();if(this.#i){this.#i=!1;return}let{isMac:t}=ta.platform;if(e.button!==0||e.ctrlKey&&t)return;if(e.target!==this.div)return;if(this.#i=!0,this.#w?.isDrawer){this.startDrawingSession(e);return}let a=this.#c.getActive();this.#t=!a||a.isEmpty()}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),this.#r){this.#w.startDrawing(this,this.#c,!1,e);return}this.#c.setCurrentDrawingSession(this),this.#r=new AbortController;let t=this.#c.combinedSignal(this.#r);this.div.addEventListener("blur",({relatedTarget:a})=>{if(a&&!this.div.contains(a))this.#u=null,this.commitOrRemove()},{signal:t}),this.#w.startDrawing(this,this.#c,!1,e)}pause(e){if(e){let{activeElement:t}=document;if(this.div.contains(t))this.#u=t;return}if(this.#u)setTimeout(()=>{this.#u?.focus(),this.#u=null},0)}endDrawingSession(e=!1){if(!this.#r)return null;return this.#c.setCurrentDrawingSession(null),this.#r.abort(),this.#r=null,this.#u=null,this.#w.endDrawing(e)}findNewParent(e,t,a){let n=this.#c.findParent(t,a);if(n===null||n===this)return!1;return n.changeParent(e),!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.#c.getActive()?.parent===this)this.#c.commitOrRemove(),this.#c.setActiveEditor(null);if(this.#s)clearTimeout(this.#s),this.#s=null;for(let e of this.#l.values())this.#e?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#l.clear(),this.#c.removeLayer(this)}#q(){for(let e of this.#l.values())if(e.isEmpty())e.remove()}async render({viewport:e}){this.viewport=e,Hr(this.div,e);for(let t of this.#c.getEditors(this.pageIndex))this.add(t),t.rebuild();await this.#c.findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:e}){this.#c.commitOrRemove(),this.#q();let t=this.viewport.rotation,a=e.rotation;if(this.viewport=e,Hr(this.div,{rotation:a}),t!==a)for(let n of this.#l.values())n.rotate(a)}get pageDimensions(){let{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return this.#c.viewParameters.realScale}}function WE(e,t){if(e===t)return 0;return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function r5(e){if(!e)return null;if(e.nodeType===Node.ELEMENT_NODE)return e.closest(".textLayer");return e.parentElement?.closest(".textLayer")||null}function PE(e,t,a,n){if(e===a)return t<=n;let s=e.compareDocumentPosition(a);if(s&Node.DOCUMENT_POSITION_FOLLOWING)return!0;if(s&Node.DOCUMENT_POSITION_PRECEDING)return!1;return null}function NA(e,t,a){if(e.nodeType!==Node.ELEMENT_NODE||!e.classList.contains("textLayer")||t!==e.childNodes.length)return{container:e,offset:t};let n=e.lastChild;if(n?.nodeType===Node.ELEMENT_NODE&&n.classList.contains("endOfContent"))n=n.previousSibling;if(!n||!a.contains(n))return null;if(n.nodeType===Node.TEXT_NODE)return{container:n,offset:n.textContent.length};return{container:n,offset:n.childNodes.length}}class it{#e=null;#t=new Map;#a=null;#n=null;#s=null;#l=null;#i=new Map;static#f=0;static#o=0;static#r=null;static#u=new Set;static#h=!1;static#g=new Set;static#b=new WeakMap;constructor({filterFactory:e=null,pageColors:t=null,pageIndex:a,textLayer:n=null}){if(this.pageIndex=a,this.#n=e,this.#s=t,n){let s=it.#b.get(n);if(s?.selectionDiv)s.selectionDiv.remove(),it.#u.delete(s.selectionDiv);if(it.#b.set(n,{drawLayer:this}),it.#g.add(n),this.#a=n,this.#l=new MutationObserver((i)=>{if(!this.#e||!this.#a?.isConnected||!it.#c())return;for(let{addedNodes:l}of i)for(let f of l)if(f.nodeType===Node.ELEMENT_NODE&&f.classList.contains("endOfContent")){it.#d();return}}),this.#l.observe(n,{childList:!0}),it.#r===null){it.#r=new AbortController;let{signal:i}=it.#r;document.addEventListener("selectionchange",it.#d.bind(it),{signal:i}),document.addEventListener("pointerdown",()=>{it.#h=!0},{signal:i}),document.addEventListener("pointerup",()=>{it.#h=!1},{signal:i}),window.addEventListener("blur",()=>{it.#h=!1},{signal:i})}}}setParent(e){if(!this.#e){if(this.#e=e,this.#a?.isConnected&&it.#c())it.#d();return}if(this.#e!==e){if(this.#t.size>0)for(let t of this.#t.values())t.remove(),e.append(t);this.#e=e}}static#p(e){let t=this.#b.get(e);if(!t?.selectionDiv)return;t.selectionDiv.remove(),this.#u.delete(t.selectionDiv),t.selectionDiv=null,t.path=null}static#c(){let e=document.getSelection();return!!e&&!e.isCollapsed}static#m(){return[...this.#g].filter((e)=>e.isConnected).sort(WE)}static#d(){let e=document.getSelection();if(!e||e.isCollapsed){for(let i of this.#u)i.remove();this.#u.clear();return}let t=new WeakMap,a=this.#m(),n=[];for(let i=0,l=e.rangeCount;i<l;i++){let f=e.getRangeAt(i);if(f.collapsed)continue;let{startContainer:c,startOffset:h,endContainer:u,endOffset:g}=f,b=r5(c),d=r5(u),j=b===null,A=d===null;if(this.#h&&j!==A)return;if(e.rangeCount===1){let{anchorNode:O,anchorOffset:T,focusNode:H,focusOffset:M}=e,x=r5(O),R=r5(H),E=PE(O,T,H,M);if(x&&R&&E!==null)if(E)c=O,h=T,b=x,u=H,g=M,d=R;else c=H,h=M,b=R,u=O,g=T,d=x}let C=a.filter((O)=>f.intersectsNode(O));if(C.length===0)continue;let S=!1;if(!b)b=C[0],c=b,h=0,S=!0;if(!d)d=C.at(-1),u=d,g=d.childNodes.length,S=!0;if(u.nodeType===Node.ELEMENT_NODE){if(u.classList.contains("endOfContent")){let O=u.previousSibling;if(!O)continue;u=O,g=O.nodeType===Node.TEXT_NODE?O.textContent.length:O.childNodes.length}else if(u.classList.contains("textLayer")&&u.childNodes.length===g){let O=NA(u,g,d);if(!O)continue;u=O.container,g=O.offset}}if(c.nodeType===Node.ELEMENT_NODE){let O=NA(c,h,b);if(!O)continue;c=O.container,h=O.offset}if(b===d&&!S&&C.includes(b)){n.push([f,b]);continue}for(let O of C){let T=O.firstChild;if(!T)continue;let H=document.createRange();if(O===b)H.setStart(c,h);else H.setStartBefore(T);if(O===d)H.setEnd(u,g);else{let M=O.lastChild;if(!M)continue;if(M.nodeType===Node.ELEMENT_NODE&&M.classList.contains("endOfContent")){let x=M.previousSibling;if(!x)continue;H.setEndAfter(x)}else H.setEndAfter(M)}if(!H.collapsed)n.push([H,O])}}let s=new Set(n.map((i)=>i[1]));for(let i of this.#g)if(!s.has(i))this.#p(i);for(let[i,l]of n){let f=it.#b.get(l);if(!f)continue;let c=t.get(l);if(!c){let d=l.getBoundingClientRect();c=(j,A,C,S)=>({x:(j-d.x)/d.width,y:(A-d.y)/d.height,width:C/d.width,height:S/d.height}),t.set(l,c)}let h=[];for(let{x:d,y:j,width:A,height:C}of i.getClientRects()){if(A===0||C===0)continue;if({x:d,y:j,width:A,height:C}=c(d,j,A,C),A===1&&C===1)continue;h.push(`M${d} ${j} h${A} v${C} h-${A} Z`)}if(h.length===0)continue;let{drawLayer:u,selectionDiv:g,path:b}=f;if(!g){let d=`clip_selection_${it.#o++}`;g=document.createElement("div"),g.className="selection",g.style.clipPath=`url(#${d})`;let j=u.#n?.createSelectionStyle(u.#s);if(j)for(let[S,O]of Object.entries(j))g.style.setProperty(S,O);let A=it._svgFactory.create(1,1,!0);A.setAttribute("aria-hidden","true"),A.setAttribute("width","100%"),A.setAttribute("height","100%");let C=it._svgFactory.createElement("clipPath");C.setAttribute("id",d),C.setAttribute("clipPathUnits","objectBoundingBox"),b=it._svgFactory.createElement("path"),C.append(b),A.append(C),g.append(A),f.path=b,f.selectionDiv=g}if(!g.parentNode&&u.#e)u.#e.append(g),this.#u.add(g);b.setAttribute("d",h.join(" "))}}static get _svgFactory(){return lt(this,"_svgFactory",new g2)}static#j(e,[t,a,n,s]){let{style:i}=e;i.top=`${100*a}%`,i.left=`${100*t}%`,i.width=`${100*n}%`,i.height=`${100*s}%`}#w(){let e=it._svgFactory.create(1,1,!0);return this.#e.append(e),e.setAttribute("aria-hidden","true"),e}#A(e,t){let a=it._svgFactory.createElement("clipPath");e.append(a);let n=`clip_${t}`;a.setAttribute("id",n),a.setAttribute("clipPathUnits","objectBoundingBox");let s=it._svgFactory.createElement("use");return a.append(s),s.setAttribute("href",`#${t}`),s.classList.add("clip"),n}#y(e,t){for(let[a,n]of Object.entries(t))if(n===null)e.removeAttribute(a);else e.setAttribute(a,n)}draw(e,t=!1,a=!1){let n=it.#f++,s=this.#w(),i=it._svgFactory.createElement("defs");s.append(i);let l=it._svgFactory.createElement("path");i.append(l);let f=`path_${n}`;if(l.setAttribute("id",f),l.setAttribute("vector-effect","non-scaling-stroke"),t)this.#i.set(n,l);let c=a?this.#A(i,f):null,h=it._svgFactory.createElement("use");return s.append(h),h.setAttribute("href",`#${f}`),this.updateProperties(s,e),this.#t.set(n,s),{id:n,clipPathId:`url(#${c})`}}drawOutline(e,t){let a=it.#f++,n=this.#w(),s=it._svgFactory.createElement("defs");n.append(s);let i=it._svgFactory.createElement("path");s.append(i);let l=`path_${a}`;i.setAttribute("id",l),i.setAttribute("vector-effect","non-scaling-stroke");let f;if(t){let u=it._svgFactory.createElement("mask");s.append(u),f=`mask_${a}`,u.setAttribute("id",f),u.setAttribute("maskUnits","objectBoundingBox");let g=it._svgFactory.createElement("rect");u.append(g),g.setAttribute("width","1"),g.setAttribute("height","1"),g.setAttribute("fill","white");let b=it._svgFactory.createElement("use");u.append(b),b.setAttribute("href",`#${l}`),b.setAttribute("stroke","none"),b.setAttribute("fill","black"),b.setAttribute("fill-rule","nonzero"),b.classList.add("mask")}let c=it._svgFactory.createElement("use");if(n.append(c),c.setAttribute("href",`#${l}`),f)c.setAttribute("mask",`url(#${f})`);let h=c.cloneNode();return n.append(h),c.classList.add("mainOutline"),h.classList.add("secondaryOutline"),this.updateProperties(n,e),this.#t.set(a,n),a}finalizeDraw(e,t){this.#i.delete(e),this.updateProperties(e,t)}updateProperties(e,t){if(!t)return;let{root:a,bbox:n,rootClass:s,path:i}=t,l=typeof e==="number"?this.#t.get(e):e;if(!l)return;if(a)this.#y(l,a);if(n)it.#j(l,n);if(s){let{classList:f}=l;for(let[c,h]of Object.entries(s))f.toggle(c,h)}if(i){let c=l.firstElementChild.firstElementChild;this.#y(c,i)}}updateParent(e,t){if(t===this)return;let a=this.#t.get(e);if(!a)return;t.#e.append(a),this.#t.delete(e),t.#t.set(e,a)}remove(e){if(this.#i.delete(e),this.#e===null)return;this.#t.get(e).remove(),this.#t.delete(e)}destroy(){this.#e=null;for(let e of this.#t.values())e.remove();if(this.#t.clear(),this.#i.clear(),this.#l?.disconnect(),this.#l=null,this.#a){if(it.#b.get(this.#a)?.drawLayer===this){if(it.#p(this.#a),it.#b.delete(this.#a),it.#g.delete(this.#a),it.#g.size===0)it.#r?.abort(),it.#r=null,it.#h=!1}this.#a=null}}}function o5(e){return`${(e*100).toFixed(2)}%`}class A5{#e=[];#t=new Map;#a=null;#n=0;#s=0;#l=0;static#i=null;constructor(e,t,a,n){this.#n=e,this.#e=t,this.#s=a.rawDims.pageWidth,this.#l=a.rawDims.pageHeight,this.#a=n}render(){let e=document.createElement("div");e.className="textLayerImages";for(let t=0;t<this.#e.length;t+=6){let a=this.#f(this.#e.subarray(t,t+6));if(a)e.append(a)}return e.addEventListener("contextmenu",(t)=>{if(!(t.target instanceof HTMLCanvasElement))return;let a=t.target,n=this.#t.get(a);if(!n)return;let s=A5.#i?.deref();if(s===a)return;if(s)s.width=0,s.height=0;A5.#i=new WeakRef(a);let{inverseTransform:i,x1:l,y1:f,width:c,height:h}=n,u=this.#a(),g=Math.ceil(l*u.width),b=Math.ceil(f*u.height),d=Math.floor((l+c/this.#s)*u.width),j=Math.floor((f+h/this.#l)*u.height);a.width=d-g,a.height=j-b;let A=a.getContext("2d");A.setTransform(...i),A.translate(-g,-b),A.drawImage(u,0,0)}),e}#f([e,t,a,n,s,i]){let l=Math.hypot((s-e)*this.#s,(i-t)*this.#l),f=Math.hypot((a-e)*this.#s,(n-t)*this.#l);if(l<this.#n||f<this.#n)return null;let c=[(s-e)*this.#s/l,(i-t)*this.#l/l,(a-e)*this.#s/f,(n-t)*this.#l/f,0,0],h=Be.inverseTransform(c),u=document.createElement("canvas");return u.className="textLayerImagePlaceholder",u.width=0,u.height=0,Object.assign(u.style,{opacity:0,position:"absolute",left:o5(e),top:o5(t),width:o5(l/this.#s),height:o5(f/this.#l),transformOrigin:"0% 0%",transform:`matrix(${c.join(",")})`}),this.#t.set(u,{inverseTransform:h,width:l,height:f,x1:e,y1:t}),u}}globalThis._pdfjsTestingUtils={HighlightOutliner:q5};globalThis.pdfjsLib={AbortException:ll,AnnotationEditorLayer:nl,AnnotationEditorParamsType:pt,AnnotationEditorType:ot,AnnotationEditorUIManager:hf,AnnotationLayer:z8,AnnotationMode:cf,AnnotationType:za,applyOpacity:qE,build:QE,ColorPicker:bi,createValidAbsoluteUrl:EA,CSSConstants:XA,DOMSVGFactory:g2,DrawLayer:it,FeatureTest:ta,fetchData:q8,findContrastColor:vE,getDocument:B8,getFilenameFromUrl:wE,getPdfFilenameFromUrl:dE,getRGB:d2,getRGBA:w2,getUuid:UA,GlobalWorkerOptions:il,ImageKind:c5,InvalidPDFException:p5,isDataScheme:O5,isPdfFile:v8,isValidExplicitDest:_E,makeArr:p2,makeMap:d8,makeObj:o8,MathClamp:da,noContextMenu:wi,normalizeUnicode:pE,OPS:p0,OutputScale:w0,PasswordException:g5,PasswordResponses:oE,PDFDataRangeTransport:M8,PDFDateString:b5,PDFWorker:Tn,PermissionFlag:rE,PixelsPerInch:Mr,RenderingCancelledException:F5,renderRichText:KA,ResponseException:o2,setLayerDimensions:Hr,shadow:lt,SignatureExtractor:Or,stopEvent:Ta,SupportedImageMimeTypes:h8,TextLayer:as,TextLayerImages:A5,TouchManager:B5,updateUrlHash:zA,Util:Be,VerbosityLevel:y5,version:JE,XfaLayer:j8};var Jt=Rt(Pa(),1);function bS({currentPage:e,totalPages:t,onPageChange:a,zoom:n,onZoomIn:s,onZoomOut:i,onFit:l,onDownload:f,canDownload:c,allowDownload:h=!0}){return oe("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:[oe("div",{className:"flex items-center gap-1.5 bg-gray-200/50 dark:bg-white/10 rounded-md p-0.5",children:[I("button",{onClick:()=>a(Math.max(1,e-1)),disabled:e<=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:Ge.previous_page(),children:I(gS,{size:16})}),I("span",{className:"px-2 text-xs font-mono font-medium text-gray-900 dark:text-gray-100 select-none",children:Ge.page_of_pages({current:e,total:t||1})}),I("button",{onClick:()=>a(Math.min(t,e+1)),disabled:e>=t,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:Ge.next_page(),children:I(pS,{size:16})})]}),oe("div",{className:"flex items-center gap-2",children:[oe("div",{className:"flex items-center gap-1 bg-gray-200/50 dark:bg-white/10 rounded-md p-0.5",children:[I("button",{onClick:i,className:"p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors",title:Ge.zoom_out(),children:I(Ul,{size:16})}),oe("span",{className:"w-12 text-center text-xs font-mono font-medium text-gray-900 dark:text-gray-100 select-none",children:[Math.round(n*100),"%"]}),I("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:Ge.zoom_in(),children:I(ko,{size:16})})]}),I("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:Ge.fit()}),h&&oe("button",{onClick:f,disabled:!c,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:Ge.download_original_file(),children:[I(Ci,{size:14}),Ge.download()]})]})]})}var Go="./pdf.worker.min-szxdj13d.mjs";var az=32000000,wS=16;if(typeof window<"u"&&il){let e=typeof Go==="string"?Go.startsWith("/")?Go:"/"+Go.replace(/^\.\//,""):Go;il.workerSrc=e}var nz=Jt.default.forwardRef(({file:e,annotations:t,shareId:a,children:n,onPlay:s,onPause:i,onTimeUpdate:l,startTime:f,allowDownload:c},h)=>{let{isDrawing:u,currentTool:g,currentColor:b,addAnnotation:d,annotations:j}=hs(),[A,C]=Jt.useState(null),[S,O]=Jt.useState(()=>f&&!isNaN(f)?Math.max(1,Math.round(f)):1),[T,H]=Jt.useState(1),[M,x]=Jt.useState(null),[R,E]=Jt.useState({width:800,height:1000}),[K,P]=Jt.useState(2),$=Jt.useRef(null),[te,ae]=Jt.useState(!0),[ee,L]=Jt.useState(null);Jt.useImperativeHandle(h,()=>({play:()=>{s?.()},pause:()=>{i?.()},seekTo:(xe)=>{if(xe&&!isNaN(xe)){let ze=Math.max(1,Math.min(T,Math.round(xe)));O(ze)}}}),[T,s,i]),Jt.useEffect(()=>{l?.(S)},[S,l]),Jt.useEffect(()=>{let xe=(ze)=>{let $e=document.activeElement;if($e&&($e.tagName==="INPUT"||$e.tagName==="TEXTAREA"||$e instanceof HTMLElement&&$e.isContentEditable))return;if(ze.key==="ArrowRight"||ze.key==="ArrowDown"||ze.key==="PageDown")ze.preventDefault(),O((nt)=>{let Tt=Math.min(T,nt+1);if(Tt!==nt)s?.();return Tt});else if(ze.key==="ArrowLeft"||ze.key==="ArrowUp"||ze.key==="PageUp")ze.preventDefault(),O((nt)=>{let Tt=Math.max(1,nt-1);if(Tt!==nt)s?.();return Tt});else if(ze.key==="Home")ze.preventDefault(),O(1),s?.();else if(ze.key==="End")ze.preventDefault(),O(T),s?.()};return window.addEventListener("keydown",xe),()=>{window.removeEventListener("keydown",xe)}},[T,s]);let[J,me]=Jt.useState({width:0,height:0}),[Q,be]=Jt.useState(1),[de,ce]=Jt.useState({x:0,y:0}),[ke,_e]=Jt.useState(!1),tt=Jt.useRef(null);Jt.useEffect(()=>{let xe=tt.current;if(!xe)return;let ze=new ResizeObserver(($e)=>{let nt=$e[0];if(nt)me({width:nt.contentRect.width,height:nt.contentRect.height})});return ze.observe(xe),()=>ze.disconnect()},[]);let jt=e.media?.pdfTranscode?.url;Jt.useEffect(()=>{if(!jt){L("No PDF URL available"),ae(!1);return}let xe=!0;ae(!0),L(null);let ze=B8({url:jt});return ze.promise.then(($e)=>{if(!xe)return;C($e),H($e.numPages),O((nt)=>f&&!isNaN(f)?Math.max(1,Math.min($e.numPages,Math.round(f))):nt),ae(!1)}).catch(($e)=>{if(!xe)return;console.error("Failed to load PDF:",$e),L("Failed to load PDF document"),ae(!1)}),()=>{xe=!1,ze.destroy().catch(()=>{})}},[jt,f]),Jt.useEffect(()=>{if(!A)return;let xe=!0,ze=null;return A.getPage(S).then(($e)=>{if(!xe)return;let nt=$e.getViewport({scale:1}),Tt=$e.getViewport({scale:K}),Ye=document.createElement("canvas");Ye.width=Tt.width,Ye.height=Tt.height;let aa=Ye.getContext("2d");if(!aa)return;if(ze=$e.render({canvasContext:aa,viewport:Tt,canvas:Ye}),!xe){ze.cancel();return}ze.promise.then(()=>{if(!xe)return;x(Ye),E({width:nt.width,height:nt.height})}).catch((dt)=>{if(!xe||dt&&typeof dt==="object"&&"name"in dt&&dt.name==="RenderingCancelledException")return;console.error("Failed to render page:",dt)})}).catch(($e)=>{if(!xe)return;console.error("Failed to get page:",$e)}),()=>{if(xe=!1,ze)ze.cancel()}},[A,S,K]),Jt.useEffect(()=>{let xe=window.setTimeout(()=>{let ze=typeof window<"u"?window.devicePixelRatio||1:1,$e=R.width*R.height,nt=$e>0?Math.sqrt(az/$e):wS,Tt=Math.min(Math.max(0.5,Q*ze),nt,wS);P(Tt)},150);return()=>window.clearTimeout(xe)},[Q,R]),Jt.useEffect(()=>{let xe=$.current;if(!A||!xe)return;let ze=!0,$e=null;return xe.innerHTML="",A.getPage(S).then((nt)=>{if(!ze)return;$e=new as({textContentSource:nt.streamTextContent(),container:xe,viewport:nt.getViewport({scale:1})}),$e.render().catch(()=>{})}).catch((nt)=>{if(!ze)return;console.error("Failed to build text layer:",nt)}),()=>{ze=!1,$e?.cancel()}},[A,S]),Jt.useEffect(()=>{let xe=$.current;if(!xe)return;xe.style.transform=`translate(${de.x}px, ${de.y}px) scale(${Q})`},[de,Q]);let{width:at,height:qe}=J,Ie=R.width,Ve=R.height,At=rf(at,qe,Ie,Ve);Jt.useEffect(()=>{if(at<=0||qe<=0||Ie<=0||Ve<=0)return;if(ke)return;be(At),ce(tl(at,qe,Ie,Ve,At))},[at,qe,At,Ie,Ve,ke]);let qt=(xe)=>{_e(!0);let ze=al(Q,de,xe,at/2,qe/2);be(ze.zoom),ce(ze.pan)},xt=()=>{_e(!1),be(At),ce(tl(at,qe,Ie,Ve,At))};Do({containerRef:tt,zoom:Q,pan:de,baseScale:At,onZoomChange:(xe)=>{_e(!0),be(xe.zoom),ce(xe.pan)},onPanChange:ce});let ha=async()=>{let xe=e.media?.original?.key;if(!xe||!e.id)return;try{let ze=a?await Ht.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:a,fileId:e.id},json:{key:xe}}):await Ht.api.files["download-url"].$post({json:{key:xe,assetId:e.id}});if(!ze.ok)return;let{url:$e}=await ze.json(),nt=document.createElement("a");nt.href=$e,nt.download=e.name||"document.pdf",document.body.appendChild(nt),nt.click(),document.body.removeChild(nt)}catch{}},ft=[...t||[],...j];return oe("div",{className:"flex flex-col flex-1 h-full overflow-hidden bg-gray-100 dark:bg-gray-950 relative",children:[oe("div",{className:"flex-1 flex flex-col-reverse md:flex-row min-h-0 relative",children:[n,oe("div",{ref:tt,className:"flex-1 relative overflow-hidden touch-none",children:[te?I("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 z-20",children:I("div",{className:"w-8 h-8 border-4 border-white/30 border-t-white rounded-full animate-spin"})}):ee?I("div",{className:"absolute inset-0 flex items-center justify-center text-gray-500 text-sm",children:ee}):I(h0,{width:at,height:qe,mediaDimensions:R,canvasElement:M,annotations:ft,scale:Q,offset:de,className:"absolute inset-0 z-0",isDrawing:u,currentTool:g,currentColor:b,onAddAnnotation:d}),I("div",{ref:$,className:"pdf-text-layer",onMouseDown:(xe)=>{if(xe.target instanceof HTMLElement&&xe.target.tagName!=="SPAN")window.getSelection()?.removeAllRanges()},style:{transform:`translate(${de.x}px, ${de.y}px) scale(${Q})`,transformOrigin:"0 0",pointerEvents:u?"none":"auto"}})]})]}),I(bS,{currentPage:S,totalPages:T,onPageChange:(xe)=>{O(xe),s?.()},zoom:Q,onZoomIn:()=>qt(1.2),onZoomOut:()=>qt(0.8),onFit:xt,onDownload:ha,canDownload:!!e.media?.original?.key,allowDownload:c})]})}),dS=nz;var jS={id:"pdf",name:"PDF",match:(e)=>e.proxyType==="pdf",viewer:dS,commentsConfig:{hasTimestamp:!0,hasAnnotations:!0,hasAiBots:!0,formatTimestamp:(e)=>`P${Math.round(e)}`}};var U5=Rt(Pa(),1);var sz=U5.default.forwardRef(({file:e,shareId:t,children:a,allowDownload:n=!0},s)=>{return U5.useImperativeHandle(s,()=>({play:()=>{},pause:()=>{},seekTo:()=>{}})),oe("div",{className:"flex flex-col flex-1 h-full overflow-hidden bg-gray-100 dark:bg-gray-950 relative",children:[oe("div",{className:"flex-1 flex flex-col-reverse md:flex-row min-h-0 relative",children:[a,I("div",{className:"flex-1 flex items-center justify-center",children:I("p",{className:"text-muted-foreground",children:"Preview unavailable"})})]}),I("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:n&&oe("button",{onClick:async()=>{let l=e.media?.original?.key;if(!l||!e.id)return;try{let f=t?await Ht.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:t,fileId:e.id},json:{key:l}}):await Ht.api.files["download-url"].$post({json:{key:l,assetId:e.id}});if(!f.ok)return;let{url:c}=await f.json(),h=document.createElement("a");h.href=c,h.download="",document.body.appendChild(h),h.click(),document.body.removeChild(h)}catch{}},disabled:!e.media?.original?.key,className:"flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded bg-gray-200/50 dark:bg-white/10 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors border border-transparent disabled:opacity-50 animate-in fade-in zoom-in-95 duration-200",title:"Download original file",children:[I(Ci,{size:14}),"Download"]})})]})}),qS=sz;var L8={id:"default",name:"Default",match:()=>!0,viewer:qS,commentsConfig:{hasTimestamp:!1,hasAnnotations:!1,hasAiBots:!1}};var iz=[jS,rA,mA];function vS(e){if(!e)return L8;return iz.find((a)=>a.match(e))||L8}function $Q({teamId:e,projectId:t,file:a,onSaveField:n,members:s,onCommentSelect:i,hideAnnotationControl:l=!1,readOnly:f=!1,publicFields:c,isPublic:h=!1,shareId:u,currentTime:g,onTyping:b,selectedCommentId:d}){let{canEdit:j}=CS(t),{fields:A,setFields:C}=_S(),S=Lu(),{ref:O,inView:T}=SS(),[H,M]=di.useState(null),[x,R]=di.useState(null),[E,K]=di.useState(!1),[P,$]=di.useState(null),{data:te}=Kc({queryKey:["fields",t],queryFn:async()=>{let qe=await Ht.api.projects[":projectId"].fields.$get({param:{projectId:t}});if(!qe.ok)throw Error("Failed to fetch fields");return await qe.json()},enabled:!!t&&!c}),{data:ae}=Kc({queryKey:["projects",t,"bots"],queryFn:async()=>{let qe=await Ht.api.projects[":projectId"].bots.$get({param:{projectId:t}});if(!qe.ok)throw Error("Failed to fetch bots");return await qe.json()},enabled:!!t&&!f}),ee=vS(a),J=ee?.commentsConfig?.hasAiBots?ae||[]:[];di.useEffect(()=>{if(c)C(c,t);else if(te)C(te,t)},[te,c,t,C]);let{data:me,fetchNextPage:Q,hasNextPage:be}=kS({queryKey:h?["shares",u,"files",a?.id,"comments"]:["files",a?.id,"comments"],queryFn:async({pageParam:qe})=>{if(h){let Ie=localStorage.getItem(`share_pwd_${u}`)||"",Ve=await Ht.api.shares[":shareId"].files[":fileId"].comments.$get({param:{shareId:u,fileId:a.id},query:{after:qe}},{headers:{"x-share-password":Ie}});if(!Ve.ok)throw Error("Failed to fetch comments");return await Ve.json()}else{let Ie=await Ht.api.files[":fileId"].comments.$get({param:{fileId:a.id},query:{after:qe}});if(!Ie.ok)throw Error("Failed to fetch comments");return await Ie.json()}},enabled:!!a?.id&&(!h||!!u),initialPageParam:"",refetchInterval:2000,getNextPageParam:(qe)=>qe.pageInfo?.cursor||void 0}),{mutate:de}=tr({mutationFn:async({text:qe,attachmentIds:Ie,annotations:Ve,replyToId:At,guestUserId:qt,second:xt})=>{if(h){let ha=localStorage.getItem(`share_pwd_${u}`)||"",ft=await Ht.api.shares[":shareId"].files[":fileId"].comments.$post({param:{shareId:u,fileId:a.id},json:{message:qe,attachmentIds:Ie,replyToId:At??void 0,annotations:Ve,second:xt??void 0}},{headers:{"x-share-password":ha,...qt?{"x-guest-user-id":qt}:{}}});if(!ft.ok)throw Error("Failed to create comment");return await ft.json()}else{let ha=await Ht.api.files[":fileId"].comments.$post({param:{fileId:a.id},json:{message:qe,attachmentIds:Ie,replyToId:At??void 0,annotations:Ve,second:xt??void 0}});if(!ha.ok)throw Error("Failed to create comment");return await ha.json()}},onSuccess:()=>{S.invalidateQueries({queryKey:h?["shares",u,"files",a?.id,"comments"]:["files",a?.id,"comments"]})}});di.default.useEffect(()=>{if(T&&be)Q()},[T,Q,be]);let ce=di.useMemo(()=>{return(a?.fieldValues||[]).reduce((qe,Ie)=>{return qe[Ie.fieldId]=Ie,qe},{})},[a?.fieldValues]),ke=di.useMemo(()=>{return[...A].sort((qe,Ie)=>{let Ve=qe.config?.name?.toLowerCase()||"",At=Ie.config?.name?.toLowerCase()||"";if(Ve<At)return-1;if(Ve>At)return 1;return 0})},[A]),_e=me?.pages.flatMap((qe)=>qe.data??[])??[],tt=async(qe,Ie,Ve,At,qt)=>{if(!a?.id)return;if(h){console.log("[handleSendMessage] checking auth status");let xt=await Ht.api.me.$get(),{id:ha}=await xt.json();if(console.log("[handleSendMessage] loggedInUserId:",ha),!ha){let ft=localStorage.getItem("guest_user_id");if(console.log("[handleSendMessage] guestUserId from storage:",ft),!ft){console.log("[handleSendMessage] no guest ID, opening popup"),$({text:qe,attachmentIds:Ie,annotations:Ve,replyToId:At,second:qt}),K(!0);return}de({text:qe,attachmentIds:Ie,annotations:Ve,replyToId:At,guestUserId:ft,second:qt})}else de({text:qe,attachmentIds:Ie,annotations:Ve,replyToId:At,second:qt})}else de({text:qe,attachmentIds:Ie,annotations:Ve,replyToId:At,second:qt});M(null)},jt=(qe)=>{if(console.log("[handleGuestSuccess] guestUserId:",qe),P)de({...P,guestUserId:qe}),$(null),M(null)},at=(qe)=>{let Ie=s.find((Ve)=>Ve.id===qe);if(Ie)return Ie;if(ae){let Ve=ae.find((At)=>At.id===qe);if(Ve)return{id:Ve.id,name:Ve.name,role:"bot"}}return{id:"unknown",name:"Unknown",role:"unknown"}};if(!a)return I("div",{className:"flex h-full items-center justify-center p-8 text-center bg-background",children:oe("div",{className:"space-y-2",children:[I("p",{className:"text-sm font-medium text-foreground",children:Ge.no_item_selected()}),I("p",{className:"text-xs text-muted-foreground",children:Ge.select_file_to_view_details()})]})});return oe("div",{className:"bg-background h-full flex flex-col overflow-hidden",children:[x&&x.proxyType==="image"&&oe("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:()=>R(null),children:[I("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:I(B1,{className:"w-8 h-8"})}),I("div",{className:"w-full h-full flex items-center justify-center p-2",children:I("img",{src:x.url,alt:"Enlarged view",className:"max-w-full max-h-[85vh] object-contain rounded shadow-2xl cursor-zoom-out",onClick:()=>R(null)})})]}),oe(AS,{defaultValue:"comments",className:"p-1 flex-1 flex flex-col px-2 min-h-0",children:[oe(yS,{className:"w-full shrink-0",children:[I(V8,{value:"comments",className:"flex-1",children:Ge.comments()}),I(V8,{value:"fields",className:"flex-1",children:Ge.fields()})]}),oe(Y8,{value:"comments",className:"flex-1 flex flex-col overflow-hidden min-h-0 mt-0",children:[I(J8,{className:"flex-1 min-h-0 [&>div>div]:block!",children:oe("div",{className:"space-y-4",children:[_e.map((qe)=>oe("div",{children:[I(F3,{teamId:e,message:qe,getUser:at,onReply:M,onViewAttachment:R,hasReplies:!!qe.replies?.length,formatTimestamp:ee?.commentsConfig?.formatTimestamp,frameRate:ee?.commentsConfig?.hasTimestamp?a?.media?.metadata?.frameRate||30:void 0,startTimecode:ee?.commentsConfig?.hasTimestamp?a?.media?.metadata?.startTimecode:void 0,isSelected:d===qe.id,onSelect:()=>{i?.(qe)}}),qe.replies?.map((Ie,Ve)=>I("div",{children:I(F3,{teamId:e,isReply:!0,message:Ie,getUser:at,onReply:M,onViewAttachment:R,hasReplies:!1,isLastReply:Ve===(qe.replies?.length??0)-1,formatTimestamp:ee?.commentsConfig?.formatTimestamp,frameRate:ee?.commentsConfig?.hasTimestamp?a?.media?.metadata?.frameRate||30:void 0,startTimecode:ee?.commentsConfig?.hasTimestamp?a?.media?.metadata?.startTimecode:void 0,isSelected:d===Ie.id,onSelect:()=>{i?.(Ie)}})},Ie.id))]},qe.id)),I("div",{ref:O})]})}),(!f||h)&&I("div",{className:"mt-4 shrink-0",children:I(r7,{isOpen:E,onClose:()=>K(!1),onSuccess:jt,children:I(B3,{projectId:t,onSendMessage:tt,replyingTo:H,onCancelReply:()=>M(null),bots:J,hideAnnotationControl:l,disableMentions:h,currentTime:ee?.commentsConfig?.hasTimestamp?g:void 0,formatTimestamp:ee?.commentsConfig?.formatTimestamp,frameRate:ee?.commentsConfig?.hasTimestamp?a?.media?.metadata?.frameRate||30:void 0,startTimecode:ee?.commentsConfig?.hasTimestamp?a?.media?.metadata?.startTimecode:void 0,onTyping:b})})})]}),I(Y8,{value:"fields",className:"flex-1 flex flex-col overflow-hidden min-h-0 mt-4",children:I(J8,{className:"flex-1 px-4 min-h-0 [&>div>div]:block!",children:ke&&ke.length>0&&I("div",{className:"space-y-4 pb-4",children:ke.map((qe)=>oe("div",{className:"space-y-1",children:[I("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:qe.config?.name}),I("div",{className:"min-h-[28px]",children:I(FS,{fieldId:qe.id,config:qe.config,value:ce[qe.id]?.value,onSave:j?(Ie)=>n(qe.id,Ie):void 0,readOnly:f||qe.readOnly||!j})})]},qe.id))})})})]})]})}
307
- export{ov as n,lz as o,cA as p,vS as q,$Q as r};
307
+ export{ov as p,lz as q,cA as r,vS as s,$Q as t};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{$d as u,Ce as _,Zd as JG,_d as r,de as H,je as W,ke as l,me as N,ne as k,qe as E,se as J,ue as I,xe as V,ze as X}from"./chunk-qy93r7tm.js";function q(G,Q){let Y={};if(!Object.keys(Q).length)return Y=G,Y;for(let[K,B]of Object.entries(G)){let O=Q[K];if(O===null)continue;Y[O??K]=B}return Y}function UG(G){let Q={};for(let[Y,K]of Object.entries(G))if(typeof K<"u")Q[Y]=K;return Q}class C extends Error{rawValue;rawMessage;static[Symbol.hasInstance](G){if(!(G instanceof Error))return!1;if(!("rawValue"in G))return!1;if(!("rawMessage"in G))return!1;if(!("pretty"in G))return!1;if(typeof G.pretty!=="function")return!1;return!0}constructor(G,Q,Y){super(`${G}: ${Q}`);this.name="SDKValidationError",this.cause=Q,this.rawValue=Y,this.rawMessage=G}pretty(){if(this.cause instanceof r)return`${this.rawMessage}
2
+ import{Ad as E,Cd as J,Ed as I,Hd as V,Jd as X,Md as _,hd as JG,id as r,jd as u,nd as H,td as W,ud as l,wd as N,xd as k}from"./chunk-ygcmv04c.js";function q(G,Q){let Y={};if(!Object.keys(Q).length)return Y=G,Y;for(let[K,B]of Object.entries(G)){let O=Q[K];if(O===null)continue;Y[O??K]=B}return Y}function UG(G){let Q={};for(let[Y,K]of Object.entries(G))if(typeof K<"u")Q[Y]=K;return Q}class C extends Error{rawValue;rawMessage;static[Symbol.hasInstance](G){if(!(G instanceof Error))return!1;if(!("rawValue"in G))return!1;if(!("rawMessage"in G))return!1;if(!("pretty"in G))return!1;if(typeof G.pretty!=="function")return!1;return!0}constructor(G,Q,Y){super(`${G}: ${Q}`);this.name="SDKValidationError",this.cause=Q,this.rawValue=Y,this.rawMessage=G}pretty(){if(this.cause instanceof r)return`${this.rawMessage}
3
3
  ${yG(this.cause)}`;else return this.toString()}}function yG(G){return u(G)}function t(G){return{ok:!0,value:G}}function s(G){return{ok:!1,error:G}}async function vG(G){let Q=await G;if(!Q.ok)throw Q.error;return Q.value}function i(G,Q,Y){try{return t(Q(G))}catch(K){return s(new C(Y,K,G))}}var o=J({prompt_tokens:W().default(0),completion_tokens:W().default(0),total_tokens:W().default(0),prompt_audio_seconds:_(W()).optional()}).catchall(N()).transform((G)=>{return q(G,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens",prompt_audio_seconds:"promptAudioSeconds"})}),hG=J({promptTokens:W().default(0),completionTokens:W().default(0),totalTokens:W().default(0),promptAudioSeconds:_(W()).optional()}).catchall(N()).transform((G)=>{return{...q(G,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens",promptAudioSeconds:"prompt_audio_seconds"})}});function j(G){return z++,G}var z=0,a=0;function P(){a++;let G=z;return{end:(Q)=>{let Y=z-G;if(z=G+(Q??Y),--a===0)z=0;return Y}}}function M(G){let Q=Object.values(G);return I([...Q.map((Y)=>X(Y)),H().transform((Y)=>j(Y))])}function lG(G){let Q=Object.values(G).filter((Y)=>typeof Y==="number");return I([...Q.map((Y)=>X(Y)),W().transform((Y)=>j(Y))])}function f(G){return H()}function cG(G){return W()}var e=Symbol("UNKNOWN");function n(G){return typeof G==="object"&&G!==null&&e in G}function GG(G,Q,Y={}){let{unknownValue:K="UNKNOWN",outputPropertyName:B}=Y;return k().transform((O)=>{let w=Object.defineProperties({raw:O,[B??G]:K,isUnknown:!0},{[e]:{value:!0,enumerable:!1,configurable:!1}});if(!(typeof O==="object"&&O!==null))return w;let F=O[G];if(typeof F!=="string")return w;if(!(F in Q))return w;let $=Q[F];if(!$)return w;let T=P(),y=$.safeParse(O);if(!y.success)return T.end(0),w;if(T.end(),B)y.data[B]=F;return y.data})}var HG=/^\d{4}-\d{2}-\d{2}$/;class v{serialized;static today(){return new v(new Date)}constructor(G){if(typeof G==="string"&&!HG.test(G))throw RangeError("RFCDate: date strings must be in the format YYYY-MM-DD: "+G);let Q=new Date(G);if(isNaN(+Q))throw RangeError("RFCDate: invalid date provided: "+G);if(this.serialized=Q.toISOString().slice(0,10),!HG.test(this.serialized))throw TypeError(`RFCDate: failed to build valid date with given value: ${G} serialized to ${this.serialized}`)}toJSON(){return this.toString()}toString(){return this.serialized}}function Z(G){return k().transform((Q,Y)=>{let K=[],B=G.map(()=>[]),O=P();for(let[D,F]of G.entries()){let $=P(),T=F.safeParse(Q),y=$.end(),xG=0;if(T.success){K.push({data:T.data,inexactCount:y,zeroDefaultCount:0,fieldCount:-1});continue}B[D].push(...T.error.issues)}if(K.length===0)return O.end(0),Y.addIssue({input:Q,code:"invalid_union",errors:B}),JG;let w=K[0];for(let D of K){if(K.length>1)D.fieldCount=PG(D.data);w=zG(D,w)}return O.end(w.inexactCount),w.data})}function zG(G,Q){let Y=G.inexactCount===0,K=Q.inexactCount===0;if(Y!==K)return Y?G:Q;let B=G.fieldCount-G.zeroDefaultCount,O=Q.fieldCount-Q.zeroDefaultCount;if(B!==O)return B>O?G:Q;return G.inexactCount<Q.inexactCount?G:Q}function PG(G){let Q=0,Y=[G],K=0;while(K<Y.length){let B=Y[K++];if(B===void 0||n(B))continue;let O=typeof B;if(B===null||O==="number"||O==="string"||O==="boolean"||O==="bigint"||B instanceof Date||B instanceof v){Q++;continue}if(Array.isArray(B)){Y.push(...B);continue}if(O==="object")Y.push(...Object.values(B))}return Q}var QG=J({type:X("input_audio"),input_audio:H()}).transform((G)=>{return q(G,{input_audio:"inputAudio"})}),XG=J({type:X("input_audio"),inputAudio:H()}).transform((G)=>{return q(G,{inputAudio:"input_audio"})});var YG=J({type:X("document_url").default("document_url"),document_url:H(),document_name:_(H()).optional()}).transform((G)=>{return q(G,{document_url:"documentUrl",document_name:"documentName"})}),_G=J({type:X("document_url").default("document_url"),documentUrl:H(),documentName:_(H()).optional()}).transform((G)=>{return q(G,{documentUrl:"document_url",documentName:"document_name"})});var ZG=J({type:X("file").default("file"),file_id:H()}).transform((G)=>{return q(G,{file_id:"fileId"})}),WG=J({type:X("file").default("file"),fileId:H()}).transform((G)=>{return q(G,{fileId:"file_id"})});var qG={Low:"low",Auto:"auto",High:"high"},BG=M(qG),KG=f(qG);var b=J({url:H(),detail:_(BG).optional()}),p=J({url:H(),detail:_(KG).optional()});var BH=Z([b,H()]),KH=Z([p,H()]);var OG=J({type:X("image_url").default("image_url"),image_url:Z([b,H()])}).transform((G)=>{return q(G,{image_url:"imageUrl"})}),AG=J({type:X("image_url").default("image_url"),imageUrl:Z([p,H()])}).transform((G)=>{return q(G,{imageUrl:"image_url"})});var wH=Z([W(),H()]),NH=Z([W(),H()]);var L=J({type:X("reference").default("reference"),reference_ids:E(Z([W(),H()]))}).transform((G)=>{return q(G,{reference_ids:"referenceIds"})}),R=J({type:X("reference").default("reference"),referenceIds:E(Z([W(),H()]))}).transform((G)=>{return q(G,{referenceIds:"reference_ids"})});var x=J({type:X("text").default("text"),text:H()}),U=J({type:X("text").default("text"),text:H()});var EG={WebSearch:"web_search",WebSearchPremium:"web_search_premium",CodeInterpreter:"code_interpreter",ImageGeneration:"image_generation",DocumentLibrary:"document_library"},h=M(EG),g=f(EG);var yH=Z([h,H()]),zH=Z([g,H()]);var d=J({type:X("tool_reference").default("tool_reference"),tool:Z([h,H()]),title:H(),url:_(H()).optional(),favicon:_(H()).optional(),description:_(H()).optional()}),m=J({type:X("tool_reference").default("tool_reference"),tool:Z([g,H()]),title:H(),url:_(H()).optional(),favicon:_(H()).optional(),description:_(H()).optional()});var UH=Z([d,x,L]),$H=Z([m,U,R]);var wG=J({type:X("thinking").default("thinking"),thinking:E(Z([d,x,L])),signature:_(H()).optional(),closed:l().optional()}),NG=J({type:X("thinking").default("thinking"),thinking:E(Z([m,U,R])),signature:_(H()).optional(),closed:l().optional()});var c=GG("type",{image_url:OG.and(J({type:X("image_url")})),document_url:YG.and(J({type:X("document_url")})),text:x.and(J({type:X("text")})),reference:L.and(J({type:X("reference")})),file:ZG.and(J({type:X("file")})),thinking:wG.and(J({type:X("thinking")})),input_audio:QG}),gH=I([AG.and(J({type:X("image_url")})),_G.and(J({type:X("document_url")})),U.and(J({type:X("text")})),R.and(J({type:X("reference")})),WG.and(J({type:X("file")})),NG.and(J({type:X("thinking")})),XG]);var lH=Z([V(H(),N()),H()]),cH=Z([V(H(),N()),H()]);var VG=J({name:H(),arguments:Z([V(H(),N()),H()])}),DG=J({name:H(),arguments:Z([V(H(),N()),H()])});var FG=J({id:H().default("null"),type:H().optional(),function:VG,index:W().default(0)}),tH=J({id:H().default("null"),type:H().optional(),function:DG,index:W().default(0)});var nH=Z([H(),E(c)]);var TG=J({role:_(H()).optional(),content:_(Z([H(),E(c)])).optional(),tool_calls:_(E(FG)).optional(),tool_call_id:_(H()).optional(),index:_(W()).optional(),metadata:_(V(H(),N())).optional()}).transform((G)=>{return q(G,{tool_calls:"toolCalls",tool_call_id:"toolCallId"})});var IG={Stop:"stop",Length:"length",Error:"error",ToolCalls:"tool_calls"},LG=M(IG),MG=J({index:W(),delta:TG,finish_reason:_(LG)}).transform((G)=>{return q(G,{finish_reason:"finishReason"})});var RG=J({id:H(),object:H().optional(),created:W().optional(),model:H(),usage:o.optional(),choices:E(MG)});function ZJ(G){return i(G,(Q)=>RG.parse(JSON.parse(Q)),"Failed to parse 'CompletionChunk' from JSON")}
4
- export{yG as sb,t as tb,s as ub,vG as vb,i as wb,q as xb,UG as yb,M as zb,lG as Ab,f as Bb,cG as Cb,GG as Db,Z as Eb,YG as Fb,_G as Gb,WG as Hb,OG as Ib,AG as Jb,x as Kb,U as Lb,h as Mb,g as Nb,d as Ob,m as Pb,wG as Qb,NG as Rb,c as Sb,gH as Tb,FG as Ub,tH as Vb,TG as Wb,o as Xb,hG as Yb,RG as Zb,ZJ as _b};
4
+ export{yG as Ca,t as Da,s as Ea,vG as Fa,i as Ga,q as Ha,UG as Ia,M as Ja,lG as Ka,f as La,cG as Ma,GG as Na,Z as Oa,YG as Pa,_G as Qa,WG as Ra,OG as Sa,AG as Ta,x as Ua,U as Va,h as Wa,g as Xa,d as Ya,m as Za,wG as _a,NG as $a,c as ab,gH as bb,FG as cb,tH as db,TG as eb,o as fb,hG as gb,RG as hb,ZJ as ib};
@@ -1,2 +1,2 @@
1
- import{Ik as T}from"./chunk-m6a4rzdt.js";var ZX=Math.pow(10,8)*24*60*60*1000,Z$=-ZX,F=604800000,s=86400000,z=60000,g=3600000;var p=Symbol.for("constructDateFrom");function x($,X){if(typeof $==="function")return $(X);if($&&typeof $==="object"&&p in $)return $[p](X);if($ instanceof Date)return new $.constructor(X);return new Date(X)}function M($,X){return x(X||$,$)}function i($,X,H){let A=M($,H?.in);if(isNaN(X))return x(H?.in||$,NaN);if(!X)return A;return A.setDate(A.getDate()+X),A}var IX={};function P(){return IX}function R($,X){let H=P(),A=X?.weekStartsOn??X?.locale?.options?.weekStartsOn??H.weekStartsOn??H.locale?.options?.weekStartsOn??0,B=M($,X?.in),K=B.getDay(),w=(K<A?7:0)+K-A;return B.setDate(B.getDate()-w),B.setHours(0,0,0,0),B}function E($,X){return R($,{...X,weekStartsOn:1})}function j($,X){let H=M($,X?.in),A=H.getFullYear(),B=x(H,0);B.setFullYear(A+1,0,4),B.setHours(0,0,0,0);let K=E(B),w=x(H,0);w.setFullYear(A,0,4),w.setHours(0,0,0,0);let Q=E(w);if(H.getTime()>=K.getTime())return A+1;else if(H.getTime()>=Q.getTime())return A;else return A-1}function m($){let X=M($),H=new Date(Date.UTC(X.getFullYear(),X.getMonth(),X.getDate(),X.getHours(),X.getMinutes(),X.getSeconds(),X.getMilliseconds()));return H.setUTCFullYear(X.getFullYear()),+$-+H}function Z($,...X){let H=x.bind(null,$||X.find((A)=>typeof A==="object"));return X.map(H)}function I($,X){let H=M($,X?.in);return H.setHours(0,0,0,0),H}function h($,X,H){let[A,B]=Z(H?.in,$,X),K=I(A),w=I(B),Q=+K-m(K),U=+w-m(w);return Math.round((Q-U)/s)}function r($,X){let H=j($,X),A=x(X?.in||$,0);return A.setFullYear(H,0,4),A.setHours(0,0,0,0),E(A)}function b($){return x($,Date.now())}function W($,X,H){let[A,B]=Z(H?.in,$,X);return+I(A)===+I(B)}function o($){return $ instanceof Date||typeof $==="object"&&Object.prototype.toString.call($)==="[object Date]"}function t($){return!(!o($)&&typeof $!=="number"||isNaN(+M($)))}function k($,X,H){let[A,B]=Z(H?.in,$,X),K=a(A,B),w=Math.abs(h(A,B));A.setDate(A.getDate()-K*w);let Q=Number(a(A,B)===-K),U=K*(w-Q);return U===0?0:U}function a($,X){let H=$.getFullYear()-X.getFullYear()||$.getMonth()-X.getMonth()||$.getDate()-X.getDate()||$.getHours()-X.getHours()||$.getMinutes()-X.getMinutes()||$.getSeconds()-X.getSeconds()||$.getMilliseconds()-X.getMilliseconds();if(H<0)return-1;if(H>0)return 1;return H}function e($,X){let H=M($,X?.in);return H.setFullYear(H.getFullYear(),0,1),H.setHours(0,0,0,0),H}var LX={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},XX=($,X,H)=>{let A,B=LX[$];if(typeof B==="string")A=B;else if(X===1)A=B.one;else A=B.other.replace("{{count}}",X.toString());if(H?.addSuffix)if(H.comparison&&H.comparison>0)return"in "+A;else return A+" ago";return A};function S($){return(X={})=>{let H=X.width?String(X.width):$.defaultWidth;return $.formats[H]||$.formats[$.defaultWidth]}}var _X={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},vX={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},YX={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},$X={date:S({formats:_X,defaultWidth:"full"}),time:S({formats:vX,defaultWidth:"full"}),dateTime:S({formats:YX,defaultWidth:"full"})};var FX={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},HX=($,X,H,A)=>FX[$];function L($){return(X,H)=>{let A=H?.context?String(H.context):"standalone",B;if(A==="formatting"&&$.formattingValues){let w=$.defaultFormattingWidth||$.defaultWidth,Q=H?.width?String(H.width):w;B=$.formattingValues[Q]||$.formattingValues[w]}else{let w=$.defaultWidth,Q=H?.width?String(H.width):$.defaultWidth;B=$.values[Q]||$.values[w]}let K=$.argumentCallback?$.argumentCallback(X):X;return B[K]}}var jX={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},hX={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},bX={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},WX={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},SX={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},DX={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},yX=($,X)=>{let H=Number($),A=H%100;if(A>20||A<10)switch(A%10){case 1:return H+"st";case 2:return H+"nd";case 3:return H+"rd"}return H+"th"},AX={ordinalNumber:yX,era:L({values:jX,defaultWidth:"wide"}),quarter:L({values:hX,defaultWidth:"wide",argumentCallback:($)=>$-1}),month:L({values:bX,defaultWidth:"wide"}),day:L({values:WX,defaultWidth:"wide"}),dayPeriod:L({values:SX,defaultWidth:"wide",formattingValues:DX,defaultFormattingWidth:"wide"})};function _($){return(X,H={})=>{let A=H.width,B=A&&$.matchPatterns[A]||$.matchPatterns[$.defaultMatchWidth],K=X.match(B);if(!K)return null;let w=K[0],Q=A&&$.parsePatterns[A]||$.parsePatterns[$.defaultParseWidth],U=Array.isArray(Q)?zX(Q,(N)=>N.test(w)):OX(Q,(N)=>N.test(w)),J;J=$.valueCallback?$.valueCallback(U):U,J=H.valueCallback?H.valueCallback(J):J;let q=X.slice(w.length);return{value:J,rest:q}}}function OX($,X){for(let H in $)if(Object.prototype.hasOwnProperty.call($,H)&&X($[H]))return H;return}function zX($,X){for(let H=0;H<$.length;H++)if(X($[H]))return H;return}function BX($){return(X,H={})=>{let A=X.match($.matchPattern);if(!A)return null;let B=A[0],K=X.match($.parsePattern);if(!K)return null;let w=$.valueCallback?$.valueCallback(K[0]):K[0];w=H.valueCallback?H.valueCallback(w):w;let Q=X.slice(B.length);return{value:w,rest:Q}}}var gX=/^(\d+)(th|st|nd|rd)?/i,pX=/\d+/i,mX={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},kX={any:[/^b/i,/^(a|c)/i]},uX={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},cX={any:[/1/i,/2/i,/3/i,/4/i]},fX={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},lX={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},dX={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},nX={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},sX={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},iX={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},KX={ordinalNumber:BX({matchPattern:gX,parsePattern:pX,valueCallback:($)=>parseInt($,10)}),era:_({matchPatterns:mX,defaultMatchWidth:"wide",parsePatterns:kX,defaultParseWidth:"any"}),quarter:_({matchPatterns:uX,defaultMatchWidth:"wide",parsePatterns:cX,defaultParseWidth:"any",valueCallback:($)=>$+1}),month:_({matchPatterns:fX,defaultMatchWidth:"wide",parsePatterns:lX,defaultParseWidth:"any"}),day:_({matchPatterns:dX,defaultMatchWidth:"wide",parsePatterns:nX,defaultParseWidth:"any"}),dayPeriod:_({matchPatterns:sX,defaultMatchWidth:"any",parsePatterns:iX,defaultParseWidth:"any"})};var u={code:"en-US",formatDistance:XX,formatLong:$X,formatRelative:HX,localize:AX,match:KX,options:{weekStartsOn:0,firstWeekContainsDate:1}};function wX($,X){let H=M($,X?.in);return h(H,e(H))+1}function GX($,X){let H=M($,X?.in),A=+E(H)-+r(H);return Math.round(A/F)+1}function D($,X){let H=M($,X?.in),A=H.getFullYear(),B=P(),K=X?.firstWeekContainsDate??X?.locale?.options?.firstWeekContainsDate??B.firstWeekContainsDate??B.locale?.options?.firstWeekContainsDate??1,w=x(X?.in||$,0);w.setFullYear(A+1,0,K),w.setHours(0,0,0,0);let Q=R(w,X),U=x(X?.in||$,0);U.setFullYear(A,0,K),U.setHours(0,0,0,0);let J=R(U,X);if(+H>=+Q)return A+1;else if(+H>=+J)return A;else return A-1}function QX($,X){let H=P(),A=X?.firstWeekContainsDate??X?.locale?.options?.firstWeekContainsDate??H.firstWeekContainsDate??H.locale?.options?.firstWeekContainsDate??1,B=D($,X),K=x(X?.in||$,0);return K.setFullYear(B,0,A),K.setHours(0,0,0,0),R(K,X)}function MX($,X){let H=M($,X?.in),A=+R(H,X)-+QX(H,X);return Math.round(A/F)+1}function G($,X){let H=$<0?"-":"",A=Math.abs($).toString().padStart(X,"0");return H+A}var C={y($,X){let H=$.getFullYear(),A=H>0?H:1-H;return G(X==="yy"?A%100:A,X.length)},M($,X){let H=$.getMonth();return X==="M"?String(H+1):G(H+1,2)},d($,X){return G($.getDate(),X.length)},a($,X){let H=$.getHours()/12>=1?"pm":"am";switch(X){case"a":case"aa":return H.toUpperCase();case"aaa":return H;case"aaaaa":return H[0];case"aaaa":default:return H==="am"?"a.m.":"p.m."}},h($,X){return G($.getHours()%12||12,X.length)},H($,X){return G($.getHours(),X.length)},m($,X){return G($.getMinutes(),X.length)},s($,X){return G($.getSeconds(),X.length)},S($,X){let H=X.length,A=$.getMilliseconds(),B=Math.trunc(A*Math.pow(10,H-3));return G(B,X.length)}};var v={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},c={G:function($,X,H){let A=$.getFullYear()>0?1:0;switch(X){case"G":case"GG":case"GGG":return H.era(A,{width:"abbreviated"});case"GGGGG":return H.era(A,{width:"narrow"});case"GGGG":default:return H.era(A,{width:"wide"})}},y:function($,X,H){if(X==="yo"){let A=$.getFullYear(),B=A>0?A:1-A;return H.ordinalNumber(B,{unit:"year"})}return C.y($,X)},Y:function($,X,H,A){let B=D($,A),K=B>0?B:1-B;if(X==="YY"){let w=K%100;return G(w,2)}if(X==="Yo")return H.ordinalNumber(K,{unit:"year"});return G(K,X.length)},R:function($,X){let H=j($);return G(H,X.length)},u:function($,X){let H=$.getFullYear();return G(H,X.length)},Q:function($,X,H){let A=Math.ceil(($.getMonth()+1)/3);switch(X){case"Q":return String(A);case"QQ":return G(A,2);case"Qo":return H.ordinalNumber(A,{unit:"quarter"});case"QQQ":return H.quarter(A,{width:"abbreviated",context:"formatting"});case"QQQQQ":return H.quarter(A,{width:"narrow",context:"formatting"});case"QQQQ":default:return H.quarter(A,{width:"wide",context:"formatting"})}},q:function($,X,H){let A=Math.ceil(($.getMonth()+1)/3);switch(X){case"q":return String(A);case"qq":return G(A,2);case"qo":return H.ordinalNumber(A,{unit:"quarter"});case"qqq":return H.quarter(A,{width:"abbreviated",context:"standalone"});case"qqqqq":return H.quarter(A,{width:"narrow",context:"standalone"});case"qqqq":default:return H.quarter(A,{width:"wide",context:"standalone"})}},M:function($,X,H){let A=$.getMonth();switch(X){case"M":case"MM":return C.M($,X);case"Mo":return H.ordinalNumber(A+1,{unit:"month"});case"MMM":return H.month(A,{width:"abbreviated",context:"formatting"});case"MMMMM":return H.month(A,{width:"narrow",context:"formatting"});case"MMMM":default:return H.month(A,{width:"wide",context:"formatting"})}},L:function($,X,H){let A=$.getMonth();switch(X){case"L":return String(A+1);case"LL":return G(A+1,2);case"Lo":return H.ordinalNumber(A+1,{unit:"month"});case"LLL":return H.month(A,{width:"abbreviated",context:"standalone"});case"LLLLL":return H.month(A,{width:"narrow",context:"standalone"});case"LLLL":default:return H.month(A,{width:"wide",context:"standalone"})}},w:function($,X,H,A){let B=MX($,A);if(X==="wo")return H.ordinalNumber(B,{unit:"week"});return G(B,X.length)},I:function($,X,H){let A=GX($);if(X==="Io")return H.ordinalNumber(A,{unit:"week"});return G(A,X.length)},d:function($,X,H){if(X==="do")return H.ordinalNumber($.getDate(),{unit:"date"});return C.d($,X)},D:function($,X,H){let A=wX($);if(X==="Do")return H.ordinalNumber(A,{unit:"dayOfYear"});return G(A,X.length)},E:function($,X,H){let A=$.getDay();switch(X){case"E":case"EE":case"EEE":return H.day(A,{width:"abbreviated",context:"formatting"});case"EEEEE":return H.day(A,{width:"narrow",context:"formatting"});case"EEEEEE":return H.day(A,{width:"short",context:"formatting"});case"EEEE":default:return H.day(A,{width:"wide",context:"formatting"})}},e:function($,X,H,A){let B=$.getDay(),K=(B-A.weekStartsOn+8)%7||7;switch(X){case"e":return String(K);case"ee":return G(K,2);case"eo":return H.ordinalNumber(K,{unit:"day"});case"eee":return H.day(B,{width:"abbreviated",context:"formatting"});case"eeeee":return H.day(B,{width:"narrow",context:"formatting"});case"eeeeee":return H.day(B,{width:"short",context:"formatting"});case"eeee":default:return H.day(B,{width:"wide",context:"formatting"})}},c:function($,X,H,A){let B=$.getDay(),K=(B-A.weekStartsOn+8)%7||7;switch(X){case"c":return String(K);case"cc":return G(K,X.length);case"co":return H.ordinalNumber(K,{unit:"day"});case"ccc":return H.day(B,{width:"abbreviated",context:"standalone"});case"ccccc":return H.day(B,{width:"narrow",context:"standalone"});case"cccccc":return H.day(B,{width:"short",context:"standalone"});case"cccc":default:return H.day(B,{width:"wide",context:"standalone"})}},i:function($,X,H){let A=$.getDay(),B=A===0?7:A;switch(X){case"i":return String(B);case"ii":return G(B,X.length);case"io":return H.ordinalNumber(B,{unit:"day"});case"iii":return H.day(A,{width:"abbreviated",context:"formatting"});case"iiiii":return H.day(A,{width:"narrow",context:"formatting"});case"iiiiii":return H.day(A,{width:"short",context:"formatting"});case"iiii":default:return H.day(A,{width:"wide",context:"formatting"})}},a:function($,X,H){let B=$.getHours()/12>=1?"pm":"am";switch(X){case"a":case"aa":return H.dayPeriod(B,{width:"abbreviated",context:"formatting"});case"aaa":return H.dayPeriod(B,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return H.dayPeriod(B,{width:"narrow",context:"formatting"});case"aaaa":default:return H.dayPeriod(B,{width:"wide",context:"formatting"})}},b:function($,X,H){let A=$.getHours(),B;if(A===12)B=v.noon;else if(A===0)B=v.midnight;else B=A/12>=1?"pm":"am";switch(X){case"b":case"bb":return H.dayPeriod(B,{width:"abbreviated",context:"formatting"});case"bbb":return H.dayPeriod(B,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return H.dayPeriod(B,{width:"narrow",context:"formatting"});case"bbbb":default:return H.dayPeriod(B,{width:"wide",context:"formatting"})}},B:function($,X,H){let A=$.getHours(),B;if(A>=17)B=v.evening;else if(A>=12)B=v.afternoon;else if(A>=4)B=v.morning;else B=v.night;switch(X){case"B":case"BB":case"BBB":return H.dayPeriod(B,{width:"abbreviated",context:"formatting"});case"BBBBB":return H.dayPeriod(B,{width:"narrow",context:"formatting"});case"BBBB":default:return H.dayPeriod(B,{width:"wide",context:"formatting"})}},h:function($,X,H){if(X==="ho"){let A=$.getHours()%12;if(A===0)A=12;return H.ordinalNumber(A,{unit:"hour"})}return C.h($,X)},H:function($,X,H){if(X==="Ho")return H.ordinalNumber($.getHours(),{unit:"hour"});return C.H($,X)},K:function($,X,H){let A=$.getHours()%12;if(X==="Ko")return H.ordinalNumber(A,{unit:"hour"});return G(A,X.length)},k:function($,X,H){let A=$.getHours();if(A===0)A=24;if(X==="ko")return H.ordinalNumber(A,{unit:"hour"});return G(A,X.length)},m:function($,X,H){if(X==="mo")return H.ordinalNumber($.getMinutes(),{unit:"minute"});return C.m($,X)},s:function($,X,H){if(X==="so")return H.ordinalNumber($.getSeconds(),{unit:"second"});return C.s($,X)},S:function($,X){return C.S($,X)},X:function($,X,H){let A=$.getTimezoneOffset();if(A===0)return"Z";switch(X){case"X":return JX(A);case"XXXX":case"XX":return V(A);case"XXXXX":case"XXX":default:return V(A,":")}},x:function($,X,H){let A=$.getTimezoneOffset();switch(X){case"x":return JX(A);case"xxxx":case"xx":return V(A);case"xxxxx":case"xxx":default:return V(A,":")}},O:function($,X,H){let A=$.getTimezoneOffset();switch(X){case"O":case"OO":case"OOO":return"GMT"+xX(A,":");case"OOOO":default:return"GMT"+V(A,":")}},z:function($,X,H){let A=$.getTimezoneOffset();switch(X){case"z":case"zz":case"zzz":return"GMT"+xX(A,":");case"zzzz":default:return"GMT"+V(A,":")}},t:function($,X,H){let A=Math.trunc(+$/1000);return G(A,X.length)},T:function($,X,H){return G(+$,X.length)}};function xX($,X=""){let H=$>0?"-":"+",A=Math.abs($),B=Math.trunc(A/60),K=A%60;if(K===0)return H+String(B);return H+String(B)+X+G(K,2)}function JX($,X){if($%60===0)return($>0?"-":"+")+G(Math.abs($)/60,2);return V($,X)}function V($,X=""){let H=$>0?"-":"+",A=Math.abs($),B=G(Math.trunc(A/60),2),K=G(A%60,2);return H+B+X+K}var UX=($,X)=>{switch($){case"P":return X.date({width:"short"});case"PP":return X.date({width:"medium"});case"PPP":return X.date({width:"long"});case"PPPP":default:return X.date({width:"full"})}},qX=($,X)=>{switch($){case"p":return X.time({width:"short"});case"pp":return X.time({width:"medium"});case"ppp":return X.time({width:"long"});case"pppp":default:return X.time({width:"full"})}},rX=($,X)=>{let H=$.match(/(P+)(p+)?/)||[],A=H[1],B=H[2];if(!B)return UX($,X);let K;switch(A){case"P":K=X.dateTime({width:"short"});break;case"PP":K=X.dateTime({width:"medium"});break;case"PPP":K=X.dateTime({width:"long"});break;case"PPPP":default:K=X.dateTime({width:"full"});break}return K.replace("{{date}}",UX(A,X)).replace("{{time}}",qX(B,X))},NX={p:qX,P:rX};var oX=/^D+$/,tX=/^Y+$/,aX=["D","DD","YY","YYYY"];function RX($){return oX.test($)}function CX($){return tX.test($)}function TX($,X,H){let A=eX($,X,H);if(console.warn(A),aX.includes($))throw RangeError(A)}function eX($,X,H){let A=$[0]==="Y"?"years":"days of the month";return`Use \`${$.toLowerCase()}\` instead of \`${$}\` (in \`${X}\`) for formatting ${A} to the input \`${H}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var X$=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,$$=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,H$=/^'([^]*?)'?$/,A$=/''/g,B$=/[a-zA-Z]/;function PX($,X,H){let A=P(),B=H?.locale??A.locale??u,K=H?.firstWeekContainsDate??H?.locale?.options?.firstWeekContainsDate??A.firstWeekContainsDate??A.locale?.options?.firstWeekContainsDate??1,w=H?.weekStartsOn??H?.locale?.options?.weekStartsOn??A.weekStartsOn??A.locale?.options?.weekStartsOn??0,Q=M($,H?.in);if(!t(Q))throw RangeError("Invalid time value");let U=X.match($$).map((q)=>{let N=q[0];if(N==="p"||N==="P"){let O=NX[N];return O(q,B.formatLong)}return q}).join("").match(X$).map((q)=>{if(q==="''")return{isToken:!1,value:"'"};let N=q[0];if(N==="'")return{isToken:!1,value:K$(q)};if(c[N])return{isToken:!0,value:q};if(N.match(B$))throw RangeError("Format string contains an unescaped latin alphabet character `"+N+"`");return{isToken:!1,value:q}});if(B.localize.preprocessor)U=B.localize.preprocessor(Q,U);let J={firstWeekContainsDate:K,weekStartsOn:w,locale:B};return U.map((q)=>{if(!q.isToken)return q.value;let N=q.value;if(!H?.useAdditionalWeekYearTokens&&CX(N)||!H?.useAdditionalDayOfYearTokens&&RX(N))TX(N,X,String($));let O=c[N[0]];return O(Q,N,B.localize,J)}).join("")}function K$($){let X=$.match(H$);if(!X)return $;return X[1].replace(A$,"'")}function f($,X){return W(x(X?.in||$,$),b(X?.in||$))}function EX($,X,H){return i($,-X,H)}function l($,X){return W(x(X?.in||$,$),EX(b(X?.in||$),1))}function n($,X){let H=()=>x(X?.in,NaN),A=X?.additionalDigits??2,B=M$($),K;if(B.date){let J=x$(B.date,A);K=J$(J.restDateString,J.year)}if(!K||isNaN(+K))return H();let w=+K,Q=0,U;if(B.time){if(Q=U$(B.time),isNaN(Q))return H()}if(B.timezone){if(U=q$(B.timezone),isNaN(U))return H()}else{let J=new Date(w+Q),q=M(0,X?.in);return q.setFullYear(J.getUTCFullYear(),J.getUTCMonth(),J.getUTCDate()),q.setHours(J.getUTCHours(),J.getUTCMinutes(),J.getUTCSeconds(),J.getUTCMilliseconds()),q}return M(w+Q+U,X?.in)}var y={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},w$=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,G$=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Q$=/^([+-])(\d{2})(?::?(\d{2}))?$/;function M$($){let X={},H=$.split(y.dateTimeDelimiter),A;if(H.length>2)return X;if(/:/.test(H[0]))A=H[0];else if(X.date=H[0],A=H[1],y.timeZoneDelimiter.test(X.date))X.date=$.split(y.timeZoneDelimiter)[0],A=$.substr(X.date.length,$.length);if(A){let B=y.timezone.exec(A);if(B)X.time=A.replace(B[1],""),X.timezone=B[1];else X.time=A}return X}function x$($,X){let H=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+X)+"})|(\\d{2}|[+-]\\d{"+(2+X)+"})$)"),A=$.match(H);if(!A)return{year:NaN,restDateString:""};let B=A[1]?parseInt(A[1]):null,K=A[2]?parseInt(A[2]):null;return{year:K===null?B:K*100,restDateString:$.slice((A[1]||A[2]).length)}}function J$($,X){if(X===null)return new Date(NaN);let H=$.match(w$);if(!H)return new Date(NaN);let A=!!H[4],B=Y(H[1]),K=Y(H[2])-1,w=Y(H[3]),Q=Y(H[4]),U=Y(H[5])-1;if(A){if(!P$(X,Q,U))return new Date(NaN);return N$(X,Q,U)}else{let J=new Date(0);if(!C$(X,K,w)||!T$(X,B))return new Date(NaN);return J.setUTCFullYear(X,K,Math.max(B,w)),J}}function Y($){return $?parseInt($):1}function U$($){let X=$.match(G$);if(!X)return NaN;let H=d(X[1]),A=d(X[2]),B=d(X[3]);if(!E$(H,A,B))return NaN;return H*g+A*z+B*1000}function d($){return $&&parseFloat($.replace(",","."))||0}function q$($){if($==="Z")return 0;let X=$.match(Q$);if(!X)return 0;let H=X[1]==="+"?-1:1,A=parseInt(X[2]),B=X[3]&&parseInt(X[3])||0;if(!V$(A,B))return NaN;return H*(A*g+B*z)}function N$($,X,H){let A=new Date(0);A.setUTCFullYear($,0,4);let B=A.getUTCDay()||7,K=(X-1)*7+H+1-B;return A.setUTCDate(A.getUTCDate()+K),A}var R$=[31,null,31,30,31,30,31,31,30,31,30,31];function VX($){return $%400===0||$%4===0&&$%100!==0}function C$($,X,H){return X>=0&&X<=11&&H>=1&&H<=(R$[X]||(VX($)?29:28))}function T$($,X){return X>=1&&X<=(VX($)?366:365)}function P$($,X,H){return X>=1&&X<=53&&H>=0&&H<=6}function E$($,X,H){if($===24)return X===0&&H===0;return H>=0&&H<60&&X>=0&&X<60&&$>=0&&$<25}function V$($,X){return X>=0&&X<=59}var lH=($)=>{let X=n($),H=new Date;if(isNaN(X.getTime()))return $;let A=PX(X,"HH:mm");if(f(X))return T.today_with_time({time:A});if(l(X))return T.yesterday_with_time({time:A});let B=k(H,X),K=B>=0?B:0;return K===1?T.n_days_ago_singular({count:K}):T.n_days_ago_plural({count:K})},dH=($)=>{let X=n($),H=new Date;if(isNaN(X.getTime()))return $;if(f(X))return T.today();if(l(X))return T.yesterday();let A=k(H,X),B=A>=0?A:0;return B===1?T.n_days_ago_singular({count:B}):T.n_days_ago_plural({count:B})};
2
- export{g as Mg,x as Ng,M as Og,i as Pg,P as Qg,R as Rg,E as Sg,Z as Tg,I as Ug,h as Vg,W as Wg,o as Xg,t as Yg,e as Zg,u as _g,GX as $g,MX as ah,PX as bh,f as ch,l as dh,n as eh,lH as fh,dH as gh};
1
+ import{$k as T}from"./chunk-sjr6mvgm.js";var ZX=Math.pow(10,8)*24*60*60*1000,Z$=-ZX,F=604800000,s=86400000,z=60000,g=3600000;var p=Symbol.for("constructDateFrom");function x($,X){if(typeof $==="function")return $(X);if($&&typeof $==="object"&&p in $)return $[p](X);if($ instanceof Date)return new $.constructor(X);return new Date(X)}function M($,X){return x(X||$,$)}function i($,X,H){let A=M($,H?.in);if(isNaN(X))return x(H?.in||$,NaN);if(!X)return A;return A.setDate(A.getDate()+X),A}var IX={};function P(){return IX}function R($,X){let H=P(),A=X?.weekStartsOn??X?.locale?.options?.weekStartsOn??H.weekStartsOn??H.locale?.options?.weekStartsOn??0,B=M($,X?.in),K=B.getDay(),w=(K<A?7:0)+K-A;return B.setDate(B.getDate()-w),B.setHours(0,0,0,0),B}function E($,X){return R($,{...X,weekStartsOn:1})}function j($,X){let H=M($,X?.in),A=H.getFullYear(),B=x(H,0);B.setFullYear(A+1,0,4),B.setHours(0,0,0,0);let K=E(B),w=x(H,0);w.setFullYear(A,0,4),w.setHours(0,0,0,0);let Q=E(w);if(H.getTime()>=K.getTime())return A+1;else if(H.getTime()>=Q.getTime())return A;else return A-1}function m($){let X=M($),H=new Date(Date.UTC(X.getFullYear(),X.getMonth(),X.getDate(),X.getHours(),X.getMinutes(),X.getSeconds(),X.getMilliseconds()));return H.setUTCFullYear(X.getFullYear()),+$-+H}function Z($,...X){let H=x.bind(null,$||X.find((A)=>typeof A==="object"));return X.map(H)}function I($,X){let H=M($,X?.in);return H.setHours(0,0,0,0),H}function h($,X,H){let[A,B]=Z(H?.in,$,X),K=I(A),w=I(B),Q=+K-m(K),U=+w-m(w);return Math.round((Q-U)/s)}function r($,X){let H=j($,X),A=x(X?.in||$,0);return A.setFullYear(H,0,4),A.setHours(0,0,0,0),E(A)}function b($){return x($,Date.now())}function W($,X,H){let[A,B]=Z(H?.in,$,X);return+I(A)===+I(B)}function o($){return $ instanceof Date||typeof $==="object"&&Object.prototype.toString.call($)==="[object Date]"}function t($){return!(!o($)&&typeof $!=="number"||isNaN(+M($)))}function k($,X,H){let[A,B]=Z(H?.in,$,X),K=a(A,B),w=Math.abs(h(A,B));A.setDate(A.getDate()-K*w);let Q=Number(a(A,B)===-K),U=K*(w-Q);return U===0?0:U}function a($,X){let H=$.getFullYear()-X.getFullYear()||$.getMonth()-X.getMonth()||$.getDate()-X.getDate()||$.getHours()-X.getHours()||$.getMinutes()-X.getMinutes()||$.getSeconds()-X.getSeconds()||$.getMilliseconds()-X.getMilliseconds();if(H<0)return-1;if(H>0)return 1;return H}function e($,X){let H=M($,X?.in);return H.setFullYear(H.getFullYear(),0,1),H.setHours(0,0,0,0),H}var LX={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},XX=($,X,H)=>{let A,B=LX[$];if(typeof B==="string")A=B;else if(X===1)A=B.one;else A=B.other.replace("{{count}}",X.toString());if(H?.addSuffix)if(H.comparison&&H.comparison>0)return"in "+A;else return A+" ago";return A};function S($){return(X={})=>{let H=X.width?String(X.width):$.defaultWidth;return $.formats[H]||$.formats[$.defaultWidth]}}var _X={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},vX={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},YX={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},$X={date:S({formats:_X,defaultWidth:"full"}),time:S({formats:vX,defaultWidth:"full"}),dateTime:S({formats:YX,defaultWidth:"full"})};var FX={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},HX=($,X,H,A)=>FX[$];function L($){return(X,H)=>{let A=H?.context?String(H.context):"standalone",B;if(A==="formatting"&&$.formattingValues){let w=$.defaultFormattingWidth||$.defaultWidth,Q=H?.width?String(H.width):w;B=$.formattingValues[Q]||$.formattingValues[w]}else{let w=$.defaultWidth,Q=H?.width?String(H.width):$.defaultWidth;B=$.values[Q]||$.values[w]}let K=$.argumentCallback?$.argumentCallback(X):X;return B[K]}}var jX={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},hX={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},bX={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},WX={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},SX={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},DX={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},yX=($,X)=>{let H=Number($),A=H%100;if(A>20||A<10)switch(A%10){case 1:return H+"st";case 2:return H+"nd";case 3:return H+"rd"}return H+"th"},AX={ordinalNumber:yX,era:L({values:jX,defaultWidth:"wide"}),quarter:L({values:hX,defaultWidth:"wide",argumentCallback:($)=>$-1}),month:L({values:bX,defaultWidth:"wide"}),day:L({values:WX,defaultWidth:"wide"}),dayPeriod:L({values:SX,defaultWidth:"wide",formattingValues:DX,defaultFormattingWidth:"wide"})};function _($){return(X,H={})=>{let A=H.width,B=A&&$.matchPatterns[A]||$.matchPatterns[$.defaultMatchWidth],K=X.match(B);if(!K)return null;let w=K[0],Q=A&&$.parsePatterns[A]||$.parsePatterns[$.defaultParseWidth],U=Array.isArray(Q)?zX(Q,(N)=>N.test(w)):OX(Q,(N)=>N.test(w)),J;J=$.valueCallback?$.valueCallback(U):U,J=H.valueCallback?H.valueCallback(J):J;let q=X.slice(w.length);return{value:J,rest:q}}}function OX($,X){for(let H in $)if(Object.prototype.hasOwnProperty.call($,H)&&X($[H]))return H;return}function zX($,X){for(let H=0;H<$.length;H++)if(X($[H]))return H;return}function BX($){return(X,H={})=>{let A=X.match($.matchPattern);if(!A)return null;let B=A[0],K=X.match($.parsePattern);if(!K)return null;let w=$.valueCallback?$.valueCallback(K[0]):K[0];w=H.valueCallback?H.valueCallback(w):w;let Q=X.slice(B.length);return{value:w,rest:Q}}}var gX=/^(\d+)(th|st|nd|rd)?/i,pX=/\d+/i,mX={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},kX={any:[/^b/i,/^(a|c)/i]},uX={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},cX={any:[/1/i,/2/i,/3/i,/4/i]},fX={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},lX={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},dX={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},nX={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},sX={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},iX={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},KX={ordinalNumber:BX({matchPattern:gX,parsePattern:pX,valueCallback:($)=>parseInt($,10)}),era:_({matchPatterns:mX,defaultMatchWidth:"wide",parsePatterns:kX,defaultParseWidth:"any"}),quarter:_({matchPatterns:uX,defaultMatchWidth:"wide",parsePatterns:cX,defaultParseWidth:"any",valueCallback:($)=>$+1}),month:_({matchPatterns:fX,defaultMatchWidth:"wide",parsePatterns:lX,defaultParseWidth:"any"}),day:_({matchPatterns:dX,defaultMatchWidth:"wide",parsePatterns:nX,defaultParseWidth:"any"}),dayPeriod:_({matchPatterns:sX,defaultMatchWidth:"any",parsePatterns:iX,defaultParseWidth:"any"})};var u={code:"en-US",formatDistance:XX,formatLong:$X,formatRelative:HX,localize:AX,match:KX,options:{weekStartsOn:0,firstWeekContainsDate:1}};function wX($,X){let H=M($,X?.in);return h(H,e(H))+1}function GX($,X){let H=M($,X?.in),A=+E(H)-+r(H);return Math.round(A/F)+1}function D($,X){let H=M($,X?.in),A=H.getFullYear(),B=P(),K=X?.firstWeekContainsDate??X?.locale?.options?.firstWeekContainsDate??B.firstWeekContainsDate??B.locale?.options?.firstWeekContainsDate??1,w=x(X?.in||$,0);w.setFullYear(A+1,0,K),w.setHours(0,0,0,0);let Q=R(w,X),U=x(X?.in||$,0);U.setFullYear(A,0,K),U.setHours(0,0,0,0);let J=R(U,X);if(+H>=+Q)return A+1;else if(+H>=+J)return A;else return A-1}function QX($,X){let H=P(),A=X?.firstWeekContainsDate??X?.locale?.options?.firstWeekContainsDate??H.firstWeekContainsDate??H.locale?.options?.firstWeekContainsDate??1,B=D($,X),K=x(X?.in||$,0);return K.setFullYear(B,0,A),K.setHours(0,0,0,0),R(K,X)}function MX($,X){let H=M($,X?.in),A=+R(H,X)-+QX(H,X);return Math.round(A/F)+1}function G($,X){let H=$<0?"-":"",A=Math.abs($).toString().padStart(X,"0");return H+A}var C={y($,X){let H=$.getFullYear(),A=H>0?H:1-H;return G(X==="yy"?A%100:A,X.length)},M($,X){let H=$.getMonth();return X==="M"?String(H+1):G(H+1,2)},d($,X){return G($.getDate(),X.length)},a($,X){let H=$.getHours()/12>=1?"pm":"am";switch(X){case"a":case"aa":return H.toUpperCase();case"aaa":return H;case"aaaaa":return H[0];case"aaaa":default:return H==="am"?"a.m.":"p.m."}},h($,X){return G($.getHours()%12||12,X.length)},H($,X){return G($.getHours(),X.length)},m($,X){return G($.getMinutes(),X.length)},s($,X){return G($.getSeconds(),X.length)},S($,X){let H=X.length,A=$.getMilliseconds(),B=Math.trunc(A*Math.pow(10,H-3));return G(B,X.length)}};var v={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},c={G:function($,X,H){let A=$.getFullYear()>0?1:0;switch(X){case"G":case"GG":case"GGG":return H.era(A,{width:"abbreviated"});case"GGGGG":return H.era(A,{width:"narrow"});case"GGGG":default:return H.era(A,{width:"wide"})}},y:function($,X,H){if(X==="yo"){let A=$.getFullYear(),B=A>0?A:1-A;return H.ordinalNumber(B,{unit:"year"})}return C.y($,X)},Y:function($,X,H,A){let B=D($,A),K=B>0?B:1-B;if(X==="YY"){let w=K%100;return G(w,2)}if(X==="Yo")return H.ordinalNumber(K,{unit:"year"});return G(K,X.length)},R:function($,X){let H=j($);return G(H,X.length)},u:function($,X){let H=$.getFullYear();return G(H,X.length)},Q:function($,X,H){let A=Math.ceil(($.getMonth()+1)/3);switch(X){case"Q":return String(A);case"QQ":return G(A,2);case"Qo":return H.ordinalNumber(A,{unit:"quarter"});case"QQQ":return H.quarter(A,{width:"abbreviated",context:"formatting"});case"QQQQQ":return H.quarter(A,{width:"narrow",context:"formatting"});case"QQQQ":default:return H.quarter(A,{width:"wide",context:"formatting"})}},q:function($,X,H){let A=Math.ceil(($.getMonth()+1)/3);switch(X){case"q":return String(A);case"qq":return G(A,2);case"qo":return H.ordinalNumber(A,{unit:"quarter"});case"qqq":return H.quarter(A,{width:"abbreviated",context:"standalone"});case"qqqqq":return H.quarter(A,{width:"narrow",context:"standalone"});case"qqqq":default:return H.quarter(A,{width:"wide",context:"standalone"})}},M:function($,X,H){let A=$.getMonth();switch(X){case"M":case"MM":return C.M($,X);case"Mo":return H.ordinalNumber(A+1,{unit:"month"});case"MMM":return H.month(A,{width:"abbreviated",context:"formatting"});case"MMMMM":return H.month(A,{width:"narrow",context:"formatting"});case"MMMM":default:return H.month(A,{width:"wide",context:"formatting"})}},L:function($,X,H){let A=$.getMonth();switch(X){case"L":return String(A+1);case"LL":return G(A+1,2);case"Lo":return H.ordinalNumber(A+1,{unit:"month"});case"LLL":return H.month(A,{width:"abbreviated",context:"standalone"});case"LLLLL":return H.month(A,{width:"narrow",context:"standalone"});case"LLLL":default:return H.month(A,{width:"wide",context:"standalone"})}},w:function($,X,H,A){let B=MX($,A);if(X==="wo")return H.ordinalNumber(B,{unit:"week"});return G(B,X.length)},I:function($,X,H){let A=GX($);if(X==="Io")return H.ordinalNumber(A,{unit:"week"});return G(A,X.length)},d:function($,X,H){if(X==="do")return H.ordinalNumber($.getDate(),{unit:"date"});return C.d($,X)},D:function($,X,H){let A=wX($);if(X==="Do")return H.ordinalNumber(A,{unit:"dayOfYear"});return G(A,X.length)},E:function($,X,H){let A=$.getDay();switch(X){case"E":case"EE":case"EEE":return H.day(A,{width:"abbreviated",context:"formatting"});case"EEEEE":return H.day(A,{width:"narrow",context:"formatting"});case"EEEEEE":return H.day(A,{width:"short",context:"formatting"});case"EEEE":default:return H.day(A,{width:"wide",context:"formatting"})}},e:function($,X,H,A){let B=$.getDay(),K=(B-A.weekStartsOn+8)%7||7;switch(X){case"e":return String(K);case"ee":return G(K,2);case"eo":return H.ordinalNumber(K,{unit:"day"});case"eee":return H.day(B,{width:"abbreviated",context:"formatting"});case"eeeee":return H.day(B,{width:"narrow",context:"formatting"});case"eeeeee":return H.day(B,{width:"short",context:"formatting"});case"eeee":default:return H.day(B,{width:"wide",context:"formatting"})}},c:function($,X,H,A){let B=$.getDay(),K=(B-A.weekStartsOn+8)%7||7;switch(X){case"c":return String(K);case"cc":return G(K,X.length);case"co":return H.ordinalNumber(K,{unit:"day"});case"ccc":return H.day(B,{width:"abbreviated",context:"standalone"});case"ccccc":return H.day(B,{width:"narrow",context:"standalone"});case"cccccc":return H.day(B,{width:"short",context:"standalone"});case"cccc":default:return H.day(B,{width:"wide",context:"standalone"})}},i:function($,X,H){let A=$.getDay(),B=A===0?7:A;switch(X){case"i":return String(B);case"ii":return G(B,X.length);case"io":return H.ordinalNumber(B,{unit:"day"});case"iii":return H.day(A,{width:"abbreviated",context:"formatting"});case"iiiii":return H.day(A,{width:"narrow",context:"formatting"});case"iiiiii":return H.day(A,{width:"short",context:"formatting"});case"iiii":default:return H.day(A,{width:"wide",context:"formatting"})}},a:function($,X,H){let B=$.getHours()/12>=1?"pm":"am";switch(X){case"a":case"aa":return H.dayPeriod(B,{width:"abbreviated",context:"formatting"});case"aaa":return H.dayPeriod(B,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return H.dayPeriod(B,{width:"narrow",context:"formatting"});case"aaaa":default:return H.dayPeriod(B,{width:"wide",context:"formatting"})}},b:function($,X,H){let A=$.getHours(),B;if(A===12)B=v.noon;else if(A===0)B=v.midnight;else B=A/12>=1?"pm":"am";switch(X){case"b":case"bb":return H.dayPeriod(B,{width:"abbreviated",context:"formatting"});case"bbb":return H.dayPeriod(B,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return H.dayPeriod(B,{width:"narrow",context:"formatting"});case"bbbb":default:return H.dayPeriod(B,{width:"wide",context:"formatting"})}},B:function($,X,H){let A=$.getHours(),B;if(A>=17)B=v.evening;else if(A>=12)B=v.afternoon;else if(A>=4)B=v.morning;else B=v.night;switch(X){case"B":case"BB":case"BBB":return H.dayPeriod(B,{width:"abbreviated",context:"formatting"});case"BBBBB":return H.dayPeriod(B,{width:"narrow",context:"formatting"});case"BBBB":default:return H.dayPeriod(B,{width:"wide",context:"formatting"})}},h:function($,X,H){if(X==="ho"){let A=$.getHours()%12;if(A===0)A=12;return H.ordinalNumber(A,{unit:"hour"})}return C.h($,X)},H:function($,X,H){if(X==="Ho")return H.ordinalNumber($.getHours(),{unit:"hour"});return C.H($,X)},K:function($,X,H){let A=$.getHours()%12;if(X==="Ko")return H.ordinalNumber(A,{unit:"hour"});return G(A,X.length)},k:function($,X,H){let A=$.getHours();if(A===0)A=24;if(X==="ko")return H.ordinalNumber(A,{unit:"hour"});return G(A,X.length)},m:function($,X,H){if(X==="mo")return H.ordinalNumber($.getMinutes(),{unit:"minute"});return C.m($,X)},s:function($,X,H){if(X==="so")return H.ordinalNumber($.getSeconds(),{unit:"second"});return C.s($,X)},S:function($,X){return C.S($,X)},X:function($,X,H){let A=$.getTimezoneOffset();if(A===0)return"Z";switch(X){case"X":return JX(A);case"XXXX":case"XX":return V(A);case"XXXXX":case"XXX":default:return V(A,":")}},x:function($,X,H){let A=$.getTimezoneOffset();switch(X){case"x":return JX(A);case"xxxx":case"xx":return V(A);case"xxxxx":case"xxx":default:return V(A,":")}},O:function($,X,H){let A=$.getTimezoneOffset();switch(X){case"O":case"OO":case"OOO":return"GMT"+xX(A,":");case"OOOO":default:return"GMT"+V(A,":")}},z:function($,X,H){let A=$.getTimezoneOffset();switch(X){case"z":case"zz":case"zzz":return"GMT"+xX(A,":");case"zzzz":default:return"GMT"+V(A,":")}},t:function($,X,H){let A=Math.trunc(+$/1000);return G(A,X.length)},T:function($,X,H){return G(+$,X.length)}};function xX($,X=""){let H=$>0?"-":"+",A=Math.abs($),B=Math.trunc(A/60),K=A%60;if(K===0)return H+String(B);return H+String(B)+X+G(K,2)}function JX($,X){if($%60===0)return($>0?"-":"+")+G(Math.abs($)/60,2);return V($,X)}function V($,X=""){let H=$>0?"-":"+",A=Math.abs($),B=G(Math.trunc(A/60),2),K=G(A%60,2);return H+B+X+K}var UX=($,X)=>{switch($){case"P":return X.date({width:"short"});case"PP":return X.date({width:"medium"});case"PPP":return X.date({width:"long"});case"PPPP":default:return X.date({width:"full"})}},qX=($,X)=>{switch($){case"p":return X.time({width:"short"});case"pp":return X.time({width:"medium"});case"ppp":return X.time({width:"long"});case"pppp":default:return X.time({width:"full"})}},rX=($,X)=>{let H=$.match(/(P+)(p+)?/)||[],A=H[1],B=H[2];if(!B)return UX($,X);let K;switch(A){case"P":K=X.dateTime({width:"short"});break;case"PP":K=X.dateTime({width:"medium"});break;case"PPP":K=X.dateTime({width:"long"});break;case"PPPP":default:K=X.dateTime({width:"full"});break}return K.replace("{{date}}",UX(A,X)).replace("{{time}}",qX(B,X))},NX={p:qX,P:rX};var oX=/^D+$/,tX=/^Y+$/,aX=["D","DD","YY","YYYY"];function RX($){return oX.test($)}function CX($){return tX.test($)}function TX($,X,H){let A=eX($,X,H);if(console.warn(A),aX.includes($))throw RangeError(A)}function eX($,X,H){let A=$[0]==="Y"?"years":"days of the month";return`Use \`${$.toLowerCase()}\` instead of \`${$}\` (in \`${X}\`) for formatting ${A} to the input \`${H}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var X$=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,$$=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,H$=/^'([^]*?)'?$/,A$=/''/g,B$=/[a-zA-Z]/;function PX($,X,H){let A=P(),B=H?.locale??A.locale??u,K=H?.firstWeekContainsDate??H?.locale?.options?.firstWeekContainsDate??A.firstWeekContainsDate??A.locale?.options?.firstWeekContainsDate??1,w=H?.weekStartsOn??H?.locale?.options?.weekStartsOn??A.weekStartsOn??A.locale?.options?.weekStartsOn??0,Q=M($,H?.in);if(!t(Q))throw RangeError("Invalid time value");let U=X.match($$).map((q)=>{let N=q[0];if(N==="p"||N==="P"){let O=NX[N];return O(q,B.formatLong)}return q}).join("").match(X$).map((q)=>{if(q==="''")return{isToken:!1,value:"'"};let N=q[0];if(N==="'")return{isToken:!1,value:K$(q)};if(c[N])return{isToken:!0,value:q};if(N.match(B$))throw RangeError("Format string contains an unescaped latin alphabet character `"+N+"`");return{isToken:!1,value:q}});if(B.localize.preprocessor)U=B.localize.preprocessor(Q,U);let J={firstWeekContainsDate:K,weekStartsOn:w,locale:B};return U.map((q)=>{if(!q.isToken)return q.value;let N=q.value;if(!H?.useAdditionalWeekYearTokens&&CX(N)||!H?.useAdditionalDayOfYearTokens&&RX(N))TX(N,X,String($));let O=c[N[0]];return O(Q,N,B.localize,J)}).join("")}function K$($){let X=$.match(H$);if(!X)return $;return X[1].replace(A$,"'")}function f($,X){return W(x(X?.in||$,$),b(X?.in||$))}function EX($,X,H){return i($,-X,H)}function l($,X){return W(x(X?.in||$,$),EX(b(X?.in||$),1))}function n($,X){let H=()=>x(X?.in,NaN),A=X?.additionalDigits??2,B=M$($),K;if(B.date){let J=x$(B.date,A);K=J$(J.restDateString,J.year)}if(!K||isNaN(+K))return H();let w=+K,Q=0,U;if(B.time){if(Q=U$(B.time),isNaN(Q))return H()}if(B.timezone){if(U=q$(B.timezone),isNaN(U))return H()}else{let J=new Date(w+Q),q=M(0,X?.in);return q.setFullYear(J.getUTCFullYear(),J.getUTCMonth(),J.getUTCDate()),q.setHours(J.getUTCHours(),J.getUTCMinutes(),J.getUTCSeconds(),J.getUTCMilliseconds()),q}return M(w+Q+U,X?.in)}var y={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},w$=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,G$=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Q$=/^([+-])(\d{2})(?::?(\d{2}))?$/;function M$($){let X={},H=$.split(y.dateTimeDelimiter),A;if(H.length>2)return X;if(/:/.test(H[0]))A=H[0];else if(X.date=H[0],A=H[1],y.timeZoneDelimiter.test(X.date))X.date=$.split(y.timeZoneDelimiter)[0],A=$.substr(X.date.length,$.length);if(A){let B=y.timezone.exec(A);if(B)X.time=A.replace(B[1],""),X.timezone=B[1];else X.time=A}return X}function x$($,X){let H=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+X)+"})|(\\d{2}|[+-]\\d{"+(2+X)+"})$)"),A=$.match(H);if(!A)return{year:NaN,restDateString:""};let B=A[1]?parseInt(A[1]):null,K=A[2]?parseInt(A[2]):null;return{year:K===null?B:K*100,restDateString:$.slice((A[1]||A[2]).length)}}function J$($,X){if(X===null)return new Date(NaN);let H=$.match(w$);if(!H)return new Date(NaN);let A=!!H[4],B=Y(H[1]),K=Y(H[2])-1,w=Y(H[3]),Q=Y(H[4]),U=Y(H[5])-1;if(A){if(!P$(X,Q,U))return new Date(NaN);return N$(X,Q,U)}else{let J=new Date(0);if(!C$(X,K,w)||!T$(X,B))return new Date(NaN);return J.setUTCFullYear(X,K,Math.max(B,w)),J}}function Y($){return $?parseInt($):1}function U$($){let X=$.match(G$);if(!X)return NaN;let H=d(X[1]),A=d(X[2]),B=d(X[3]);if(!E$(H,A,B))return NaN;return H*g+A*z+B*1000}function d($){return $&&parseFloat($.replace(",","."))||0}function q$($){if($==="Z")return 0;let X=$.match(Q$);if(!X)return 0;let H=X[1]==="+"?-1:1,A=parseInt(X[2]),B=X[3]&&parseInt(X[3])||0;if(!V$(A,B))return NaN;return H*(A*g+B*z)}function N$($,X,H){let A=new Date(0);A.setUTCFullYear($,0,4);let B=A.getUTCDay()||7,K=(X-1)*7+H+1-B;return A.setUTCDate(A.getUTCDate()+K),A}var R$=[31,null,31,30,31,30,31,31,30,31,30,31];function VX($){return $%400===0||$%4===0&&$%100!==0}function C$($,X,H){return X>=0&&X<=11&&H>=1&&H<=(R$[X]||(VX($)?29:28))}function T$($,X){return X>=1&&X<=(VX($)?366:365)}function P$($,X,H){return X>=1&&X<=53&&H>=0&&H<=6}function E$($,X,H){if($===24)return X===0&&H===0;return H>=0&&H<60&&X>=0&&X<60&&$>=0&&$<25}function V$($,X){return X>=0&&X<=59}var lH=($)=>{let X=n($),H=new Date;if(isNaN(X.getTime()))return $;let A=PX(X,"HH:mm");if(f(X))return T.today_with_time({time:A});if(l(X))return T.yesterday_with_time({time:A});let B=k(H,X),K=B>=0?B:0;return K===1?T.n_days_ago_singular({count:K}):T.n_days_ago_plural({count:K})},dH=($)=>{let X=n($),H=new Date;if(isNaN(X.getTime()))return $;if(f(X))return T.today();if(l(X))return T.yesterday();let A=k(H,X),B=A>=0?A:0;return B===1?T.n_days_ago_singular({count:B}):T.n_days_ago_plural({count:B})};
2
+ export{g as Rg,x as Sg,M as Tg,i as Ug,P as Vg,R as Wg,E as Xg,Z as Yg,I as Zg,h as _g,W as $g,o as ah,t as bh,e as ch,u as dh,GX as eh,MX as fh,PX as gh,f as hh,l as ih,n as jh,lH as kh,dH as lh};