@accounter/client
Version:
Accounter client application
158 lines • 1.55 MB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/html2canvas-pro.esm-cng67OYH.js","assets/dist-BmACi7k_.js","assets/index.es-CyUYsdZu.js","assets/dist-CQgUtVPI.js","assets/defineProperty-CHyAdSol.js","assets/typeof-B5XbjTb1.js"])))=>i.map(i=>d[i]);
import{a as e,n as t,r as n,s as r,t as i}from"./dist-BmACi7k_.js";import{i as a,o,t as s}from"./utils-BxkqV8PM.js";import{$o as c,A as l,Ai as u,Ba as d,Bn as f,Bo as p,Br as m,Ci as h,Cr as g,E as _,F as v,Gn as y,Go as b,Ho as x,Hr as S,It as C,Jn as w,Jo as T,Ka as E,Ko as D,L as O,M as k,Nt as A,P as j,Qa as M,Qo as N,Qr as P,Rn as F,S as I,Si as L,So as R,T as z,Tr as B,Uo as V,Ur as ee,V as te,Vo as H,Wo as ne,Wr as re,Xo as ie,Xr as U,Yo as ae,Yr as oe,Zo as W,Zr as se,_r as ce,ao as le,ar as ue,as as de,at as fe,b as pe,bi as me,ca as he,ci as ge,co as _e,cs as ve,di as ye,ds as be,es as xe,fa as Se,fr as Ce,fs as we,g as Te,ga as Ee,ho as De,hr as Oe,io as ke,ir as Ae,is as je,ji as Me,ki as Ne,kt as Pe,la as Fe,ls as Ie,mr as Le,no as Re,ns as ze,or as G,os as Be,pr as Ve,ps as He,qa as Ue,qo as We,qr as Ge,r as K,rs as Ke,s as qe,sr as Je,ss as Ye,t as Xe,ts as Ze,ua as Qe,ui as $e,us as et,va as tt,vi as nt,vo as rt,wn as it,wr as at,x as ot,xi as st,xn as ct,yi as lt,yt as ut,z as dt,zo as ft}from"./error-handling-BcsQohmh.js";import{n as pt,t as mt}from"./dist-CQgUtVPI.js";import{C as ht,a as gt,r as _t,s as vt,t as yt}from"./routes-DNs7M-mk.js";import{n as bt}from"./auth0-react.esm-C5ihvWnb.js";import{$ as xt,A as St,B as Ct,C as wt,D as Tt,E as Et,F as Dt,G as Ot,H as kt,I as At,J as jt,K as Mt,L as Nt,M as Pt,N as Ft,O as It,P as Lt,Q as Rt,R as zt,S as Bt,T as Vt,U as Ht,V as Ut,W as Wt,X as Gt,Z as Kt,a as qt,c as Jt,ct as Yt,d as Xt,dt as Zt,et as Qt,f as $t,ft as en,h as tn,ht as nn,i as rn,it as an,j as on,k as sn,l as cn,lt as ln,m as un,mt as dn,n as fn,nt as pn,o as mn,ot as hn,p as gn,pt as _n,q as vn,r as yn,s as bn,st as xn,t as Sn,tt as Cn,u as wn,ut as Tn,w as En,z as Dn}from"./select-B9uPAoLq.js";import{_ as On,a as kn,b as An,d as jn,f as Mn,g as Nn,h as Pn,i as Fn,l as In,m as Ln,n as Rn,o as zn,r as Bn,t as Vn,v as Hn,x as Un,y as Wn}from"./separator-Dgd_YdPn.js";import{c as Gn,i as Kn,n as qn,o as Jn,s as Yn,t as q}from"./button-BZ6z_NAl.js";import{$c as Xn,$l as Zn,$n as Qn,Al as $n,Bn as er,Dl as tr,En as nr,Fl as rr,Gc as ir,Gt as ar,Il as or,It as sr,Jc as cr,Jl as lr,Kc as ur,Kl as dr,Ll as fr,Ml as pr,Nl as mr,Ol as hr,Pt as gr,Qc as _r,Ql as vr,Rl as yr,Tl as br,Uc as xr,Vc as Sr,Vt as Cr,Wc as wr,Xc as Tr,Xl as Er,Yc as Dr,Yl as Or,Zc as kr,Zl as Ar,_l as jr,a as Mr,al as Nr,au as Pr,c as Fr,cl as Ir,cu as Lr,dl as Rr,du as zr,el as Br,eu as Vr,fu as Hr,h as Ur,hu as Wr,i as Gr,il as Kr,iu as qr,jl as J,kl as Y,ll as Jr,lu as Yr,m as Xr,ml as Zr,mn as Qr,mr as $r,mu as ei,n as ti,nl as ni,nu as ri,o as ii,ol as ai,ou as oi,pl as X,pr as si,pu as ci,qc as li,ql as ui,r as di,rn as fi,ru as pi,s as mi,sl as hi,su as gi,t as _i,tu as vi,u as yi,ul as bi,uu as xi}from"./table-QvPx-2PG.js";import{a as Si,n as Ci,o as wi,r as Ti,t as Ei}from"./card-BRoEyy6u.js";import{t as Di}from"./html2canvas-pro.esm-cng67OYH.js";import{t as Oi}from"./typeof-B5XbjTb1.js";var ki=nn(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Ai=nn(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),ji=nn(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Mi=nn(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),Ni=nn(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Pi=nn(`chevrons-left`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),Fi=nn(`chevrons-right`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]),Ii=nn(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Li=nn(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Ri=nn(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),zi=nn(`coins`,[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]),Bi=nn(`combine`,[[`path`,{d:`M14 3a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1`,key:`1l7d7l`}],[`path`,{d:`M19 3a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1`,key:`9955pe`}],[`path`,{d:`m7 15 3 3`,key:`4hkfgk`}],[`path`,{d:`m7 21 3-3H5a2 2 0 0 1-2-2v-2`,key:`1xljwe`}],[`rect`,{x:`14`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1cdgtw`}],[`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1`,key:`zi3rio`}]]),Vi=nn(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Hi=nn(`credit-card`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`,key:`ynyp8z`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`,key:`1b3vmo`}]]),Ui=nn(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Wi=nn(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Gi=nn(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ki=nn(`file-down`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}],[`path`,{d:`m9 15 3 3 3-3`,key:`1npd3o`}]]),qi=nn(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Ji=nn(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),Yi=nn(`gift`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8`,key:`1sqzm4`}],[`path`,{d:`M7.5 7a1 1 0 0 1 0-5A4.8 8 0 0 1 12 7a4.8 8 0 0 1 4.5-5 1 1 0 0 1 0 5`,key:`kc0143`}],[`rect`,{x:`3`,y:`7`,width:`18`,height:`4`,rx:`1`,key:`1hberx`}]]),Xi=nn(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Zi=nn(`hand-coins`,[[`path`,{d:`M11 15h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 17`,key:`geh8rc`}],[`path`,{d:`m7 21 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9`,key:`1fto5m`}],[`path`,{d:`m2 16 6 6`,key:`1pfhp9`}],[`circle`,{cx:`16`,cy:`9`,r:`2.9`,key:`1n0dlu`}],[`circle`,{cx:`6`,cy:`5`,r:`3`,key:`151irh`}]]),Qi=nn(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),$i=nn(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),ea=nn(`list-plus`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]),ta=nn(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),na=nn(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),ra=nn(`map-plus`,[[`path`,{d:`m11 19-1.106-.552a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0l4.212 2.106a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619V12`,key:`svfegj`}],[`path`,{d:`M15 5.764V12`,key:`1ocw4k`}],[`path`,{d:`M18 15v6`,key:`9wciyi`}],[`path`,{d:`M21 18h-6`,key:`139f0c`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]),ia=nn(`merge`,[[`path`,{d:`m8 6 4-4 4 4`,key:`ybng9g`}],[`path`,{d:`M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22`,key:`1hyw0i`}],[`path`,{d:`m20 22-5-5`,key:`1m27yz`}]]),aa=nn(`panel-top-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`m9 16 3-3 3 3`,key:`1idcnm`}]]),oa=nn(`panel-top-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`m15 14-3 3-3-3`,key:`g215vf`}]]),sa=nn(`phone`,[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),ca=nn(`piggy-bank`,[[`path`,{d:`M11 17h3v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3a3.16 3.16 0 0 0 2-2h1a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1h-1a5 5 0 0 0-2-4V3a4 4 0 0 0-3.2 1.6l-.3.4H11a6 6 0 0 0-6 6v1a5 5 0 0 0 2 4v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1z`,key:`1piglc`}],[`path`,{d:`M16 10h.01`,key:`1m94wz`}],[`path`,{d:`M2 8v1a2 2 0 0 0 2 2h1`,key:`1env43`}]]),la=nn(`plane`,[[`path`,{d:`M17.8 19.2 16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.1-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z`,key:`1v9wt8`}]]),ua=nn(`printer`,[[`path`,{d:`M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2`,key:`143wyd`}],[`path`,{d:`M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6`,key:`1itne7`}],[`rect`,{x:`6`,y:`14`,width:`12`,height:`8`,rx:`1`,key:`1ue0tg`}]]),da=nn(`receipt`,[[`path`,{d:`M12 17V7`,key:`pyj7ub`}],[`path`,{d:`M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8`,key:`1elt7d`}],[`path`,{d:`M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z`,key:`ycz6yz`}]]),fa=nn(`refresh-ccw-dot`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),pa=nn(`scale`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]),ma=nn(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),ha=nn(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ga=nn(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),_a=nn(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),va=nn(`square-x`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),ya=nn(`trash`,[[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),ba=nn(`trending-up-down`,[[`path`,{d:`M14.828 14.828 21 21`,key:`ar5fw7`}],[`path`,{d:`M21 16v5h-5`,key:`1ck2sf`}],[`path`,{d:`m21 3-9 9-4-4-6 6`,key:`1h02xo`}],[`path`,{d:`M21 8V3h-5`,key:`1qoq8a`}]]),xa=nn(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),Sa=nn(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Ca=nn(`wallet`,[[`path`,{d:`M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1`,key:`18etb6`}],[`path`,{d:`M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4`,key:`xoc0q4`}]]),wa=nn(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),Ta=nn(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),Ea=nn(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),Z=r(o(),1),Da=Z.useEffectEvent,Oa=Z.useInsertionEffect;function ka(e){if(typeof Da==`function`)return Da(e);let t=Z.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof Oa==`function`?Oa(()=>{t.current=e}):Cn(()=>{t.current=e}),Z.useMemo(()=>((...e)=>t.current?.(...e)),[])}var Q=a(),Aa=`Checkbox`,[ja,eee]=an(Aa),[Ma,Na]=ja(Aa);function Pa(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=Qt({prop:n,defaultProp:i??!1,onChange:c,caller:Aa}),[m,h]=Z.useState(null),[g,_]=Z.useState(null),v=Z.useRef(!1),y=!m||!!o||!!m.closest(`form`),b={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,required:l,defaultChecked:!Ua(i)&&i,isFormControl:y,bubbleInput:g,setBubbleInput:_};return(0,Q.jsx)(Ma,{scope:t,...b,children:Ha(d)?d(b):r})}var Fa=`CheckboxTrigger`,Ia=Z.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=Na(Fa,e),h=Yn(i,u),g=Z.useRef(c);return Z.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,Q.jsx)(hn.button,{type:`button`,role:`checkbox`,"aria-checked":Ua(c)?`mixed`:c,"aria-required":l,"data-state":Wa(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:pn(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:pn(n,e=>{d(e=>Ua(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});Ia.displayName=Fa;var La=Z.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,Q.jsx)(Pa,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ia,{...d,ref:t,__scopeCheckbox:n}),e&&(0,Q.jsx)(Va,{__scopeCheckbox:n})]})})});La.displayName=Aa;var Ra=`CheckboxIndicator`,za=Z.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=Na(Ra,n);return(0,Q.jsx)(xt,{present:r||Ua(a.checked)||a.checked===!0,children:(0,Q.jsx)(hn.span,{"data-state":Wa(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});za.displayName=Ra;var Ba=`CheckboxBubbleInput`,Va=Z.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=Na(Ba,e),m=Yn(n,p),h=zt(a),g=Nt(r);Z.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=Ua(a),n.call(e,!Ua(a)&&a),e.dispatchEvent(t)}},[f,h,a,i]);let _=Z.useRef(!Ua(a)&&a);return(0,Q.jsx)(hn.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});Va.displayName=Ba;function Ha(e){return typeof e==`function`}function Ua(e){return e===`indeterminate`}function Wa(e){return Ua(e)?`indeterminate`:e?`checked`:`unchecked`}var Ga=`Popover`,[Ka,tee]=an(Ga,[Et]),qa=Et(),[Ja,Ya]=Ka(Ga),Xa=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=qa(t),c=Z.useRef(null),[l,u]=Z.useState(!1),[d,f]=Qt({prop:r,defaultProp:i??!1,onChange:a,caller:Ga});return(0,Q.jsx)(Vt,{...s,children:(0,Q.jsx)(Ja,{scope:t,contentId:Rt(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:Z.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:Z.useCallback(()=>u(!0),[]),onCustomAnchorRemove:Z.useCallback(()=>u(!1),[]),modal:o,children:n})})};Xa.displayName=Ga;var Za=`PopoverAnchor`,Qa=Z.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Ya(Za,n),a=qa(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return Z.useEffect(()=>(o(),()=>s()),[o,s]),(0,Q.jsx)(Bt,{...a,...r,ref:t})});Qa.displayName=Za;var $a=`PopoverTrigger`,eo=Z.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Ya($a,n),a=qa(n),o=Yn(t,i.triggerRef),s=(0,Q.jsx)(hn.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":go(i.open),...r,ref:o,onClick:pn(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,Q.jsx)(Bt,{asChild:!0,...a,children:s})});eo.displayName=$a;var to=`PopoverPortal`,[no,ro]=Ka(to,{forceMount:void 0}),io=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Ya(to,t);return(0,Q.jsx)(no,{scope:t,forceMount:n,children:(0,Q.jsx)(xt,{present:n||a.open,children:(0,Q.jsx)(Mt,{asChild:!0,container:i,children:r})})})};io.displayName=to;var ao=`PopoverContent`,oo=Z.forwardRef((e,t)=>{let n=ro(ao,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Ya(ao,e.__scopePopover);return(0,Q.jsx)(xt,{present:r||a.open,children:a.modal?(0,Q.jsx)(co,{...i,ref:t}):(0,Q.jsx)(lo,{...i,ref:t})})});oo.displayName=ao;var so=Kn(`PopoverContent.RemoveScroll`),co=Z.forwardRef((e,t)=>{let n=Ya(ao,e.__scopePopover),r=Z.useRef(null),i=Yn(t,r),a=Z.useRef(!1);return Z.useEffect(()=>{let e=r.current;if(e)return Dn(e)},[]),(0,Q.jsx)(Ct,{as:so,allowPinchZoom:!0,children:(0,Q.jsx)(uo,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:pn(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:pn(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:pn(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),lo=Z.forwardRef((e,t)=>{let n=Ya(ao,e.__scopePopover),r=Z.useRef(!1),i=Z.useRef(!1);return(0,Q.jsx)(uo,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),uo=Z.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Ya(ao,n),p=qa(n);return Ot(),(0,Q.jsx)(vn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,Q.jsx)(jt,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,Q.jsx)(En,{"data-state":go(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),fo=`PopoverClose`,po=Z.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Ya(fo,n);return(0,Q.jsx)(hn.button,{type:`button`,...r,ref:t,onClick:pn(e.onClick,()=>i.onOpenChange(!1))})});po.displayName=fo;var mo=`PopoverArrow`,ho=Z.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=qa(n);return(0,Q.jsx)(wt,{...i,...r,ref:t})});ho.displayName=mo;function go(e){return e?`open`:`closed`}var _o=Xa,vo=eo,yo=io,bo=oo;function xo(e,t){return Z.useReducer((e,n)=>t[e][n]??e,e)}var So=`ScrollArea`,[Co,nee]=an(So),[wo,To]=Co(So),Eo=Z.forwardRef((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=Z.useState(null),[l,u]=Z.useState(null),[d,f]=Z.useState(null),[p,m]=Z.useState(null),[h,g]=Z.useState(null),[_,v]=Z.useState(0),[y,b]=Z.useState(0),[x,S]=Z.useState(!1),[C,w]=Z.useState(!1),T=Yn(t,c),E=Kt(i);return(0,Q.jsx)(wo,{scope:n,type:r,dir:E,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:x,onScrollbarXEnabledChange:S,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:C,onScrollbarYEnabledChange:w,onCornerWidthChange:v,onCornerHeightChange:b,children:(0,Q.jsx)(hn.div,{dir:E,...o,ref:T,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":y+`px`,...e.style}})})});Eo.displayName=So;var Do=`ScrollAreaViewport`,Oo=Z.forwardRef((e,t)=>{let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=To(Do,n),s=Yn(t,Z.useRef(null),o.onViewportChange);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ko,{nonce:i}),(0,Q.jsx)(hn.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,Q.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})});Oo.displayName=Do;var ko=Z.memo(({nonce:e})=>(0,Q.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:e}),(e,t)=>e.nonce===t.nonce),Ao=`ScrollAreaScrollbar`,jo=Z.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=To(Ao,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return Z.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,Q.jsx)(Mo,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,Q.jsx)(No,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,Q.jsx)(Po,{...r,ref:t,forceMount:n}):i.type===`always`?(0,Q.jsx)(Fo,{...r,ref:t,"data-state":`visible`}):null});jo.displayName=Ao;var Mo=Z.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=To(Ao,e.__scopeScrollArea),[a,o]=Z.useState(!1);return Z.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=()=>{window.clearTimeout(t),o(!0)},r=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,Q.jsx)(xt,{present:n||a,children:(0,Q.jsx)(Po,{"data-state":a?`visible`:`hidden`,...r,ref:t})})}),No=Z.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=To(Ao,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=ts(()=>c(`SCROLL_END`),100),[s,c]=xo(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return Z.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),Z.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,Q.jsx)(xt,{present:n||s!==`hidden`,children:(0,Q.jsx)(Fo,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:pn(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:pn(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})}),Po=Z.forwardRef((e,t)=>{let n=To(Ao,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=Z.useState(!1),s=e.orientation===`horizontal`,c=ts(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return ns(n.viewport,c),ns(n.content,c),(0,Q.jsx)(xt,{present:r||a,children:(0,Q.jsx)(Fo,{"data-state":a?`visible`:`hidden`,...i,ref:t})})}),Fo=Z.forwardRef((e,t)=>{let{orientation:n=`vertical`,...r}=e,i=To(Ao,e.__scopeScrollArea),a=Z.useRef(null),o=Z.useRef(0),[s,c]=Z.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=Jo(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function d(e,t){return Xo(e,o.current,s,t)}return n===`horizontal`?(0,Q.jsx)(Io,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=Zo(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,Q.jsx)(Lo,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=Zo(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null}),Io=Z.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=To(Ao,e.__scopeScrollArea),[o,s]=Z.useState(),c=Z.useRef(null),l=Yn(t,c,a.onScrollbarXChange);return Z.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,Q.jsx)(Bo,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":Yo(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),$o(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:qo(o.paddingLeft),paddingEnd:qo(o.paddingRight)}})}})}),Lo=Z.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=To(Ao,e.__scopeScrollArea),[o,s]=Z.useState(),c=Z.useRef(null),l=Yn(t,c,a.onScrollbarYChange);return Z.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,Q.jsx)(Bo,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":Yo(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),$o(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:qo(o.paddingTop),paddingEnd:qo(o.paddingBottom)}})}})}),[Ro,zo]=Co(Ao),Bo=Z.forwardRef((e,t)=>{let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:d,...f}=e,p=To(Ao,n),[m,h]=Z.useState(null),g=Yn(t,h),_=Z.useRef(null),v=Z.useRef(``),y=p.viewport,b=r.content-r.viewport,x=Gt(u),S=Gt(c),C=ts(d,10);function w(e){if(_.current){let t=e.clientX-_.current.left,n=e.clientY-_.current.top;l({x:t,y:n})}}return Z.useEffect(()=>{let e=e=>{let t=e.target;m?.contains(t)&&x(e,b)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[y,m,b,x]),Z.useEffect(S,[r,S]),ns(m,C),ns(p.content,C),(0,Q.jsx)(Ro,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:Gt(a),onThumbPointerUp:Gt(o),onThumbPositionChange:S,onThumbPointerDown:Gt(s),children:(0,Q.jsx)(hn.div,{...f,ref:g,style:{position:`absolute`,...f.style},onPointerDown:pn(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),_.current=m.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,p.viewport&&(p.viewport.style.scrollBehavior=`auto`),w(e))}),onPointerMove:pn(e.onPointerMove,w),onPointerUp:pn(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=``),_.current=null})})})}),Vo=`ScrollAreaThumb`,Ho=Z.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=zo(Vo,e.__scopeScrollArea);return(0,Q.jsx)(xt,{present:n||i.hasThumb,children:(0,Q.jsx)(Uo,{ref:t,...r})})}),Uo=Z.forwardRef((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,a=To(Vo,n),o=zo(Vo,n),{onThumbPositionChange:s}=o,c=Yn(t,o.onThumbChange),l=Z.useRef(void 0),u=ts(()=>{l.current&&=(l.current(),void 0)},100);return Z.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{if(u(),!l.current){let t=es(e,s);l.current=t,s()}};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,Q.jsx)(hn.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:pn(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:pn(e.onPointerUp,o.onThumbPointerUp)})});Ho.displayName=Vo;var Wo=`ScrollAreaCorner`,Go=Z.forwardRef((e,t)=>{let n=To(Wo,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,Q.jsx)(Ko,{...e,ref:t}):null});Go.displayName=Wo;var Ko=Z.forwardRef((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=To(Wo,n),[a,o]=Z.useState(0),[s,c]=Z.useState(0),l=!!(a&&s),{onCornerWidthChange:u,onCornerHeightChange:d}=i;return ns(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),ns(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),Z.useEffect(()=>()=>{u(0),d(0)},[u,d]),l?(0,Q.jsx)(hn.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null});function qo(e){return e?parseInt(e,10):0}function Jo(e,t){let n=e/t;return isNaN(n)?0:n}function Yo(e){let t=Jo(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function Xo(e,t,n,r=`ltr`){let i=Yo(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return Qo([c,l],d)(e)}function Zo(e,t,n=`ltr`){let r=Yo(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=tn(e,n===`ltr`?[0,o]:[o*-1,0]);return Qo([0,o],[0,s])(c)}function Qo(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function $o(e,t){return e>0&&e<t}var es=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function ts(e,t){let n=Gt(e),r=Z.useRef(0);return Z.useEffect(()=>()=>window.clearTimeout(r.current),[]),Z.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function ns(e,t){let n=Gt(t);Cn(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var rs=Eo,is=Oo,ree=Go,as=`Switch`,[os,iee]=an(as),[ss,cs]=os(as);function ls(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=Qt({prop:n,defaultProp:i??!1,onChange:c,caller:as}),[m,h]=Z.useState(null),[g,_]=Z.useState(null),v={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:Z.useRef(!1),required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,Q.jsx)(ss,{scope:t,...v,children:_s(d)?d(v):r})}var us=`SwitchTrigger`,ds=Z.forwardRef(({__scopeSwitch:e,onClick:t,...n},r)=>{let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=cs(us,e),h=Yn(r,u),g=Z.useRef(c);return Z.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,Q.jsx)(hn.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":vs(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:h,onClick:pn(t,e=>{d(e=>!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});ds.displayName=us;var fs=Z.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,Q.jsx)(ls,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ds,{...d,ref:t,__scopeSwitch:n}),e&&(0,Q.jsx)(gs,{__scopeSwitch:n})]})})});fs.displayName=as;var ps=`SwitchThumb`,ms=Z.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=cs(ps,n);return(0,Q.jsx)(hn.span,{"data-state":vs(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});ms.displayName=ps;var hs=`SwitchBubbleInput`,gs=Z.forwardRef(({__scopeSwitch:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=cs(hs,e),m=Yn(n,p),h=zt(a),g=Nt(r);Z.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});n.call(e,a),e.dispatchEvent(t)}},[f,h,a,i]);let _=Z.useRef(a);return(0,Q.jsx)(hn.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});gs.displayName=hs;function _s(e){return typeof e==`function`}function vs(e){return e?`checked`:`unchecked`}var ys=`Tabs`,[bs,aee]=an(ys,[Hn]),xs=Hn(),[Ss,Cs]=bs(ys),ws=Z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Kt(s),[d,f]=Qt({prop:r,onChange:i,defaultProp:a??``,caller:ys});return(0,Q.jsx)(Ss,{scope:n,baseId:Rt(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,Q.jsx)(hn.div,{dir:u,"data-orientation":o,...l,ref:t})})});ws.displayName=ys;var Ts=`TabsList`,Es=Z.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Cs(Ts,n),o=xs(n);return(0,Q.jsx)(On,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,Q.jsx)(hn.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Es.displayName=Ts;var Ds=`TabsTrigger`,Os=Z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Cs(Ds,n),s=xs(n),c=js(o.baseId,r),l=Ms(o.baseId,r),u=r===o.value;return(0,Q.jsx)(Nn,{asChild:!0,...s,focusable:!i,active:u,children:(0,Q.jsx)(hn.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:pn(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:pn(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:pn(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});Os.displayName=Ds;var ks=`TabsContent`,As=Z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Cs(ks,n),c=js(s.baseId,r),l=Ms(s.baseId,r),u=r===s.value,d=Z.useRef(u);return Z.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,Q.jsx)(xt,{present:i||u,children:({present:n})=>(0,Q.jsx)(hn.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});As.displayName=ks;function js(e,t){return`${e}-trigger-${t}`}function Ms(e,t){return`${e}-content-${t}`}var Ns=ws,Ps=Es,Fs=Os,Is=As;function Ls({className:e,...t}){return(0,Q.jsx)(`div`,{className:s(`animate-pulse rounded-md bg-gray-900/10 dark:bg-gray-50/10`,e),...t})}function Rs(e,t,n){let r=zr(e,n?.in);return isNaN(t)?Hr(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function zs(e,t,n){let r=zr(e,n?.in);if(isNaN(t))return Hr(n?.in||e,NaN);if(!t)return r;let i=r.getDate(),a=Hr(n?.in||e,r.getTime());return a.setMonth(r.getMonth()+t+1,0),i>=a.getDate()?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}function Bs(e,t,n){return Rs(e,t*7,n)}function Vs(e,t,n){return zs(e,t*12,n)}function Hs(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=Hr.bind(null,e));let t=zr(e,r);(!n||n<t||isNaN(+t))&&(n=t)}),Hr(r,n||NaN)}function Us(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=Hr.bind(null,e));let t=zr(e,r);(!n||n>t||isNaN(+t))&&(n=t)}),Hr(r,n||NaN)}function Ws(e,t,n){let[r,i]=oi(n?.in,e,t);return+Pr(r)==+Pr(i)}function Gs(e,t,n){let[r,i]=oi(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function Ks(e,t,n){let[r,i]=oi(n?.in,e,t),a=qs(r,i),o=Math.abs(qr(r,i));r.setDate(r.getDate()-a*o);let s=a*(o-Number(qs(r,i)===-a));return s===0?0:s}function qs(e,t){let n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function Js(e,t){let n=zr(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function Ys(e,t){let[n,r]=oi(e,t.start,t.end);return{start:n,end:r}}function Xs(e,t){let{start:n,end:r}=Ys(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setDate(1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(Hr(n,o)),o.setMonth(o.getMonth()+s);return i?c.reverse():c}function Zs(e,t){let n=zr(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Qs(e,t){let n=zr(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function $s(e,t){let{start:n,end:r}=Ys(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setMonth(0,1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(Hr(n,o)),o.setFullYear(o.getFullYear()+s);return i?c.reverse():c}function ec(e,t){let n=xi(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=zr(e,t?.in),a=i.getDay(),o=(a<r?-7:0)+6-(a-r);return i.setDate(i.getDate()+o),i.setHours(23,59,59,999),i}function tc(e,t){return ec(e,{...t,weekStartsOn:1})}function nc(e,t){let n=zr(e,t?.in),r=n.getFullYear(),i=n.getMonth(),a=Hr(n,0);return a.setFullYear(r,i+1,0),a.setHours(0,0,0,0),a.getDate()}function rc(){return Object.assign({},xi())}function ic(e,t){let n=zr(e,t?.in).getDay();return n===0?7:n}function ac(e,t){return zr(e,t?.in).getMonth()}function oc(e,t){return zr(e,t?.in).getFullYear()}function sc(e,t){return+zr(e)>+zr(t)}function cc(e,t){return+zr(e)<+zr(t)}function lc(e,t){let n=uc(t)?new t(0):Hr(t,0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}function uc(e){return typeof e==`function`&&e.prototype?.constructor===e}var dc=10,fc=class{subPriority=0;validate(e,t){return!0}},pc=class extends fc{constructor(e,t,n,r,i){super(),this.value=e,this.validateValue=t,this.setValue=n,this.priority=r,i&&(this.subPriority=i)}validate(e,t){return this.validateValue(e,this.value,t)}set(e,t,n){return this.setValue(e,t,this.value,n)}},mc=class extends fc{priority=dc;subPriority=-1;constructor(e,t){super(),this.context=e||(e=>Hr(t,e))}set(e,t){return t.timestampIsSet?e:Hr(e,lc(e,this.context))}},hc=class{run(e,t,n,r){let i=this.parse(e,t,n,r);return i?{setter:new pc(i.value,this.validate,this.set,this.priority,this.subPriority),rest:i.rest}:null}validate(e,t,n){return!0}},gc=class extends hc{priority=140;parse(e,t,n){switch(t){case`G`:case`GG`:case`GGG`:return n.era(e,{width:`abbreviated`})||n.era(e,{width:`narrow`});case`GGGGG`:return n.era(e,{width:`narrow`});default:return n.era(e,{width:`wide`})||n.era(e,{width:`abbreviated`})||n.era(e,{width:`narrow`})}}set(e,t,n){return t.era=n,e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=[`R`,`u`,`t`,`T`]},_c={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},vc={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function yc(e,t){return e&&{value:t(e.value),rest:e.rest}}function bc(e,t){let n=t.match(e);return n?{value:parseInt(n[0],10),rest:t.slice(n[0].length)}:null}function xc(e,t){let n=t.match(e);if(!n)return null;if(n[0]===`Z`)return{value:0,rest:t.slice(1)};let r=n[1]===`+`?1:-1,i=n[2]?parseInt(n[2],10):0,a=n[3]?parseInt(n[3],10):0,o=n[5]?parseInt(n[5],10):0;return{value:r*(i*ci+a*ei+o*Wr),rest:t.slice(n[0].length)}}function Sc(e){return bc(_c.anyDigitsSigned,e)}function Cc(e,t){switch(e){case 1:return bc(_c.singleDigit,t);case 2:return bc(_c.twoDigits,t);case 3:return bc(_c.threeDigits,t);case 4:return bc(_c.fourDigits,t);default:return bc(RegExp(`^\\d{1,`+e+`}`),t)}}function wc(e,t){switch(e){case 1:return bc(_c.singleDigitSigned,t);case 2:return bc(_c.twoDigitsSigned,t);case 3:return bc(_c.threeDigitsSigned,t);case 4:return bc(_c.fourDigitsSigned,t);default:return bc(RegExp(`^-?\\d{1,`+e+`}`),t)}}function Tc(e){switch(e){case`morning`:return 4;case`evening`:return 17;case`pm`:case`noon`:case`afternoon`:return 12;default:return 0}}function Ec(e,t){let n=t>0,r=n?t:1-t,i;if(r<=50)i=e||100;else{let t=r+50,n=Math.trunc(t/100)*100,a=e>=t%100;i=e+n-(a?100:0)}return n?i:1-i}function Dc(e){return e%400==0||e%4==0&&e%100!=0}var Oc=class extends hc{priority=130;incompatibleTokens=[`Y`,`R`,`u`,`w`,`I`,`i`,`e`,`c`,`t`,`T`];parse(e,t,n){let r=e=>({year:e,isTwoDigitYear:t===`yy`});switch(t){case`y`:return yc(Cc(4,e),r);case`yo`:return yc(n.ordinalNumber(e,{unit:`year`}),r);default:return yc(Cc(t.length,e),r)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n){let r=e.getFullYear();if(n.isTwoDigitYear){let t=Ec(n.year,r);return e.setFullYear(t,0,1),e.setHours(0,0,0,0),e}let i=!(`era`in t)||t.era===1?n.year:1-n.year;return e.setFullYear(i,0,1),e.setHours(0,0,0,0),e}},kc=class extends hc{priority=130;parse(e,t,n){let r=e=>({year:e,isTwoDigitYear:t===`YY`});switch(t){case`Y`:return yc(Cc(4,e),r);case`Yo`:return yc(n.ordinalNumber(e,{unit:`year`}),r);default:return yc(Cc(t.length,e),r)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n,r){let i=vr(e,r);if(n.isTwoDigitYear){let t=Ec(n.year,i);return e.setFullYear(t,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),Yr(e,r)}let a=!(`era`in t)||t.era===1?n.year:1-n.year;return e.setFullYear(a,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),Yr(e,r)}incompatibleTokens=[`y`,`R`,`u`,`Q`,`q`,`M`,`L`,`I`,`d`,`D`,`i`,`t`,`T`]},Ac=class extends hc{priority=130;parse(e,t){return wc(t===`R`?4:t.length,e)}set(e,t,n){let r=Hr(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Lr(r)}incompatibleTokens=[`G`,`y`,`Y`,`u`,`Q`,`q`,`M`,`L`,`w`,`d`,`D`,`e`,`c`,`t`,`T`]},jc=class extends hc{priority=130;parse(e,t){return wc(t===`u`?4:t.length,e)}set(e,t,n){return e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=[`G`,`y`,`Y`,`R`,`w`,`I`,`i`,`e`,`c`,`t`,`T`]},Mc=class extends hc{priority=120;parse(e,t,n){switch(t){case`Q`:case`QQ`:return Cc(t.length,e);case`Qo`:return n.ordinalNumber(e,{unit:`quarter`});case`QQQ`:return n.quarter(e,{width:`abbreviated`,context:`formatting`})||n.quarter(e,{width:`narrow`,context:`formatting`});case`QQQQQ`:return n.quarter(e,{width:`narrow`,context:`formatting`});default:return n.quarter(e,{width:`wide`,context:`formatting`})||n.quarter(e,{width:`abbreviated`,context:`formatting`})||n.quarter(e,{width:`narrow`,context:`formatting`})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth((n-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=[`Y`,`R`,`q`,`M`,`L`,`w`,`I`,`d`,`D`,`i`,`e`,`c`,`t`,`T`]},oee=class extends hc{priority=120;parse(e,t,n){switch(t){case`q`:case`qq`:return Cc(t.length,e);case`qo`:return n.ordinalNumber(e,{unit:`quarter`});case`qqq`:return n.quarter(e,{width:`abbreviated`,context:`standalone`})||n.quarter(e,{width:`narrow`,context:`standalone`});case`qqqqq`:return n.quarter(e,{width:`narrow`,context:`standalone`});default:return n.quarter(e,{width:`wide`,context:`standalone`})||n.quarter(e,{width:`abbreviated`,context:`standalone`})||n.quarter(e,{width:`narrow`,context:`standalone`})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth((n-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=[`Y`,`R`,`Q`,`M`,`L`,`w`,`I`,`d`,`D`,`i`,`e`,`c`,`t`,`T`]},see=class extends hc{incompatibleTokens=[`Y`,`R`,`q`,`Q`,`L`,`w`,`I`,`D`,`i`,`e`,`c`,`t`,`T`];priority=110;parse(e,t,n){let r=e=>e-1;switch(t){case`M`:return yc(bc(_c.month,e),r);case`MM`:return yc(Cc(2,e),r);case`Mo`:return yc(n.ordinalNumber(e,{unit:`month`}),r);case`MMM`:return n.month(e,{width:`abbreviated`,context:`formatting`})||n.month(e,{width:`narrow`,context:`formatting`});case`MMMMM`:return n.month(e,{width:`narrow`,context:`formatting`});default:return n.month(e,{width:`wide`,context:`formatting`})||n.month(e,{width:`abbreviated`,context:`formatting`})||n.month(e,{width:`narrow`,context:`formatting`})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}},cee=class extends hc{priority=110;parse(e,t,n){let r=e=>e-1;switch(t){case`L`:return yc(bc(_c.month,e),r);case`LL`:return yc(Cc(2,e),r);case`Lo`:return yc(n.ordinalNumber(e,{unit:`month`}),r);case`LLL`:return n.month(e,{width:`abbreviated`,context:`standalone`})||n.month(e,{width:`narrow`,context:`standalone`});case`LLLLL`:return n.month(e,{width:`narrow`,context:`standalone`});default:return n.month(e,{width:`wide`,context:`standalone`})||n.month(e,{width:`abbreviated`,context:`standalone`})||n.month(e,{width:`narrow`,context:`standalone`})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}incompatibleTokens=[`Y`,`R`,`q`,`Q`,`M`,`w`,`I`,`D`,`i`,`e`,`c`,`t`,`T`]};function lee(e,t,n){let r=zr(e,n?.in),i=Ar(r,n)-t;return r.setDate(r.getDate()-i*7),zr(r,n?.in)}var uee=class extends hc{priority=100;parse(e,t,n){switch(t){case`w`:return bc(_c.week,e);case`wo`:return n.ordinalNumber(e,{unit:`week`});default:return Cc(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n,r){return Yr(lee(e,n,r),r)}incompatibleTokens=[`y`,`R`,`u`,`q`,`Q`,`M`,`L`,`I`,`d`,`D`,`i`,`t`,`T`]};function dee(e,t,n){let r=zr(e,n?.in),i=Zn(r,n)-t;return r.setDate(r.getDate()-i*7),r}var fee=class extends hc{priority=100;parse(e,t,n){switch(t){case`I`:return bc(_c.week,e);case`Io`:return n.ordinalNumber(e,{unit:`week`});default:return Cc(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n){return Lr(dee(e,n))}incompatibleTokens=[`y`,`Y`,`u`,`q`,`Q`,`M`,`L`,`w`,`d`,`D`,`e`,`c`,`t`,`T`]},pee=[31,28,31,30,31,30,31,31,30,31,30,31],mee=[31,29,31,30,31,30,31,31,30,31,30,31],hee=class extends hc{priority=90;subPriority=1;parse(e,t,n){switch(t){case`d`:return bc(_c.date,e);case`do`:return n.ordinalNumber(e,{unit:`date`});default:return Cc(t.length,e)}}validate(e,t){let n=Dc(e.getFullYear()),r=e.getMonth();return n?t>=1&&t<=mee[r]:t>=1&&t<=pee[r]}set(e,t,n){return e.setDate(n),e.setHours(0,0,0,0),e}incompatibleTokens=[`Y`,`R`,`q`,`Q`,`w`,`I`,`D`,`i`,`e`,`c`,`t`,`T`]},gee=class extends hc{priority=90;subpriority=1;parse(e,t,n){switch(t){case`D`:case`DD`:return bc(_c.dayOfYear,e);case`Do`:return n.ordinalNumber(e,{unit:`date`});default:return Cc(t.length,e)}}validate(e,t){return Dc(e.getFullYear())?t>=1&&t<=366:t>=1&&t<=365}set(e,t,n){return e.setMonth(0,n),e.setHours(0,0,0,0),e}incompatibleTokens=[`Y`,`R`,`q`,`Q`,`M`,`L`,`w`,`I`,`d`,`E`,`i`,`e`,`c`,`t`,`T`]};function Nc(e,t,n){let r=xi(),i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=zr(e,n?.in),o=a.getDay(),s=(t%7+7)%7,c=7-i;return Rs(a,t<0||t>6?t-(o+c)%7:(s+c)%7-(o+c)%7,n)}var _ee=class extends hc{priority=90;parse(e,t,n){switch(t){case`E`:case`EE`:case`EEE`:return n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`});case`EEEEE`:return n.day(e,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`});default:return n.day(e,{width:`wide`,context:`formatting`})||n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,r){return e=Nc(e,n,r),e.setHours(0,0,0,0),e}incompatibleTokens=[`D`,`i`,`e`,`c`,`t`,`T`]},vee=class extends hc{priority=90;parse(e,t,n,r){let i=e=>{let t=Math.floor((e-1)/7)*7;return(e+r.weekStartsOn+6)%7+t};switch(t){case`e`:case`ee`:return yc(Cc(t.length,e),i);case`eo`:return yc(n.ordinalNumber(e,{unit:`day`}),i);case`eee`:return n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`});case`eeeee`:return n.day(e,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`});default:return n.day(e,{width:`wide`,context:`formatting`})||n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,r){return e=Nc(e,n,r),e.setHours(0,0,0,0),e}incompatibleTokens=[`y`,`R`,`u`,`q`,`Q`,`M`,`L`,`I`,`d`,`D`,`E`,`i`,`c`,`t`,`T`]},yee=class extends hc{priority=90;parse(e,t,n,r){let i=e=>{let t=Math.floor((e-1)/7)*7;return(e+r.weekStartsOn+6)%7+t};switch(t){case`c`:case`cc`:return yc(Cc(t.length,e),i);case`co`:return yc(n.ordinalNumber(e,{unit:`day`}),i);case`ccc`:return n.day(e,{width:`abbreviated`,context:`standalone`})||n.day(e,{width:`short`,context:`standalone`})||n.day(e,{width:`narrow`,context:`standalone`});case`ccccc`:return n.day(e,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(e,{width:`short`,context:`standalone`})||n.day(e,{width:`narrow`,context:`standalone`});default:return n.day(e,{width:`wide`,context:`standalone`})||n.day(e,{width:`abbreviated`,context:`standalone`})||n.day(e,{width:`short`,context:`standalone`})||n.day(e,{width:`narrow`,context:`standalone`})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,r){return e=Nc(e,n,r),e.setHours(0,0,0,0),e}incompatibleTokens=[`y`,`R`,`u`,`q`,`Q`,`M`,`L`,`I`,`d`,`D`,`E`,`i`,`e`,`t`,`T`]};function Pc(e,t,n){let r=zr(e,n?.in);return Rs(r,t-ic(r,n),n)}var Fc=class extends hc{priority=90;parse(e,t,n){let r=e=>e===0?7:e;switch(t){case`i`:case`ii`:return Cc(t.length,e);case`io`:return n.ordinalNumber(e,{unit:`day`});case`iii`:return yc(n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`}),r);case`iiiii`:return yc(n.day(e,{width:`narrow`,context:`formatting`}),r);case`iiiiii`:return yc(n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`}),r);default:return yc(n.day(e,{width:`wide`,context:`formatting`})||n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`}),r)}}validate(e,t){return t>=1&&t<=7}set(e,t,n){return e=Pc(e,n),e.setHours(0,0,0,0),e}incompatibleTokens=[`y`,`Y`,`u`,`q`,`Q`,`M`,`L`,`w`,`d`,`D`,`E`,`e`,`c`,`t`,`T`]},Ic=class extends hc{priority=80;parse(e,t,n){switch(t){case`a`:case`aa`:case`aaa`:return n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`});case`aaaaa`:return n.dayPeriod(e,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(e,{width:`wide`,context:`formatting`})||n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`})}}set(e,t,n){return e.setHours(Tc(n),0,0,0),e}incompatibleTokens=[`b`,`B`,`H`,`k`,`t`,`T`]},Lc=class extends hc{priority=80;parse(e,t,n){switch(t){case`b`:case`bb`:case`bbb`:return n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`});case`bbbbb`:return n.dayPeriod(e,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(e,{width:`wide`,context:`formatting`})||n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`})}}set(e,t,n){return e.setHours(Tc(n),0,0,0),e}incompatibleTokens=[`a`,`B`,`H`,`k`,`t`,`T`]},Rc=class extends hc{priority=80;parse(e,t,n){switch(t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`});case`BBBBB`:return n.dayPeriod(e,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(e,{width:`wide`,context:`formatting`})||n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`})}}set(e,t,n){return e.setHours(Tc(n),0,0,0),e}incompatibleTokens=[`a`,`b`,`t`,`T`]},zc=class extends hc{priority=70;parse(e,t,n){switch(t){case`h`:return bc(_c.hour12h,e);case`ho`:return n.ordinalNumber(e,{unit:`hour`});default:return Cc(t.length,e)}}validate(e,t){return t>=1&&t<=12}set(e,t,n){let r=e.getHours()>=12;return r&&n<12?e.setHours(n+12,0,0,0):!r&&n===12?e.setHours(0,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=[`H`,`K`,`k`,`t`,`T`]},Bc=class extends hc{priority=70;parse(e,t,n){switch(t){case`H`:return bc(_c.hour23h,e);case`Ho`:return n.ordinalNumber(e,{unit:`hour`});default:return Cc(t.length,e)}}validate(e,t){return t>=0&&t<=23}set(e,t,n){return e.setHours(n,0,0,0),e}incompatibleTokens=[`a`,`b`,`h`,`K`,`k`,`t`,`T`]},Vc=class extends hc{priority=70;parse(e,t,n){switch(t){case`K`:return bc(_c.hour11h,e);case`Ko`:return n.ordinalNumber(e,{unit:`hour`});default:return Cc(t.length,e)}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.getHours()>=12&&n<12?e.setHours(n+12,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=[`h`,`H`,`k`,`t`,`T`]},Hc=class extends hc{priority=70;parse(e,t,n){switch(t){case`k`:return bc(_c.hour24h,e);case`ko`:return n.ordinalNumber(e,{unit:`hour`});default:return Cc(t.length,e)}}validate(e,t){return t>=1&&t<=24}set(e,t,n){let r=n<=24?n%24:n;return e.setHours(r,0,0,0),e}incompatibleTokens=[`a`,`b`,`h`,`H`,`K`,`t`,`T`]},Uc=class extends hc{priority=60;parse(e,t,n){switch(t){case`m`:return bc(_c.minute,e);case`mo`:return n.ordinalNumber(e,{unit:`minute`});default:return Cc(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setMinutes(n,0,0),e}incompatibleTokens=[`t`,`T`]},Wc=class extends hc{priority=50;parse(e,t,n){switch(t){case`s`:return bc(_c.second,e);case`so`:return n.ordinalNumber(e,{unit:`second`});default:return Cc(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setSeconds(n,0),e}incompatibleTokens=[`t`,`T`]},Gc=class extends hc{priority=30;parse(e,t){return yc(Cc(t.length,e),e=>Math.trunc(e*10**(-t.length+3)))}set(e,t,n){return e.setMilliseconds(n),e}incompatibleTokens=[`t`,`T`]},Kc=class extends hc{priority=10;parse(e,t){switch(t){case`X`:return xc(vc.basicOptionalMinutes,e);case`XX`:return xc(vc.basic,e);case`XXXX`:return xc(vc.basicOptionalSeconds,e);case`XXXXX`:return xc(vc.extendedOptionalSeconds,e);default:return xc(vc.extended,e)}}set(e,t,n){return t.timestampIsSet?e:Hr(e,e.getTime()-gi(e)-n)}incompatibleTokens=[`t`,`T`,`x`]},qc=class extends hc{priority=10;parse(e,t){switch(t){case`x`:return xc(vc.basicOptionalMinutes,e);case`xx`:return xc(vc.basic,e);case`xxxx`:return xc(vc.basicOptionalSeconds,e);case`xxxxx`:return xc(vc.extendedOptionalSeconds,e);default:return xc(vc.extended,e)}}set(e,t,n){return t.timestampIsSet?e:Hr(e,e.getTime()-gi(e)-n)}incompatibleTokens=[`t`,`T`,`X`]},Jc=class extends hc{priority=40;parse(e){return Sc(e)}set(e,t,n){return[Hr(e,n*1e3),{timestampIsSet:!0}]}incompatibleTokens=`*`},Yc=class extends hc{priority=20;parse(e){return Sc(e)}set(e,t,n){return[Hr(e,n),{timestampIsSet:!0}]}incompatibleTokens=`*`},Xc={G:new gc,y:new Oc,Y:new kc,R:new Ac,u:new jc,Q:new Mc,q:new oee,M:new see,L:new cee,w:new uee,I:new fee,d:new hee,D:new gee,E:new _ee,e:new vee,c:new yee,i:new Fc,a:new Ic,b:new Lc,B:new Rc,h:new zc,H:new Bc,K:new Vc,k:new Hc,m:new Uc,s:new Wc,S:new Gc,X:new Kc,x:new qc,t:new Jc,T:new Yc},Zc=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Qc=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,$c=/^'([^]*?)'?$/,el=/''/g,tl=/\S/,nl=/[a-zA-Z]/;function rl(e,t,n,r){let i=()=>Hr(r?.in||n,NaN),a=rc(),o=r?.locale??a.locale??Vr,s=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,c=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0;if(!t)return e?i():zr(n,r?.in);let l={firstWeekContainsDate:s,weekStartsOn:c,locale:o},u=[new mc(r?.in,n)],d=t.match(Qc).map(e=>{let t=e[0];if(t in Er){let n=Er[t];return n(e,o.formatLong)}return e}).join(``).match(Zc),f=[];for(let n of d){!r?.useAdditionalWeekYearTokens&&lr(n)&&Or(n,t,e),!r?.useAdditionalDayOfYearTokens&&ui(n)&&Or(n,t,e);let a=n[0],s=Xc[a];if(s){let{incompatibleTokens:t}=s;if(Array.isArray(t)){let e=f.find(e=>t.includes(e.token)||e.token===a);if(e)throw RangeError(`The format string mustn't contain \`${e.fullToken}\` and \`${n}\` at the same time`)}else if(s.incompatibleTokens===`*`&&f.length>0)throw RangeError(`The format string mustn't contain \`${n}\` and any other token at the same time`);f.push({token:a,fullToken:n});let r=s.run(e,n,o.match,l);if(!r)return i();u.push(r.setter),e=r.rest}else{if(a.match(nl))throw RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");if(n===`''`?n=`'`:a===`'`&&(n=il(n)),e.indexOf(n)===0)e=e.slice(n.length);else return i()}}if(e.length>0&&tl.test(e))return i();let p=u.map(e=>e.priority).sort((e,t)=>t-e).filter((e,t,n)=>n.indexOf(e)===t).map(e=>u.filter(t=>t.priority===e).sort((e,t)=>t.subPriority-e.subPriority)).map(e=>e[0]),m=zr(n,r?.in);if(isNaN(+m))return i();let h={};for(let e of p){if(!e.validate(m,l))return i();let t=e.set(m,h,l);Array.isArray(t)?(m=t[0],Object.assign(h,t[1])):m=t}return m}function il(e){return e.match($c)[1].replace(el,`'`)}function al(e,t,n){let[r,i]=oi(n?.in,e,t);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}function ol(e,t,n){let[r,i]=oi(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function sl(e,t,n){let r=zr(e,n?.in),i=r.getFullYear(),a=r.getDate(),o=Hr(n?.in||e,0);o.setFullYear(i,t,15),o.setHours(0,0,0,0);let s=nc(o);return r.setMonth(t,Math.min(a,s)),r}function cl(e,t,n){let r=zr(e,n?.in);return r.setHours(t),r}function ll(e,t,n){let r=zr(e,n?.in);return isNaN(+r)?Hr(n?.in||e,NaN):(r.setFullYear(t),r)}function ul(e){var t=t=>e(t);return t.toPromise=()=>we(Ie(1)(T((e=>!e.stale&&!e.hasNext))(t))),t.then=(e,n)=>t.toPromise().then(e,n),t.subscribe=e=>Ye(e)(t),t}function dl(e,t,n){return{...t,kind:e,context:t.context?{...t.context,...n}:n||t.context}}var fl=()=>{},pl=({forward:e,dispatchDebug:t})=>t=>xe([Ze((e=>{var n=ne(e),r=We(e,n),i=b(e,n);return et(T((t=>t.kind===`teardown`&&t.key===e.key))(t))(D(e,r,i))}))(T((e=>e.kind!==`teardown`&&(e.kind!==`subscription`||!!e.context.fetchSubscriptions)))(t)),e(T((e=>e.kind===`teardown`||e.kind===`subscription`&&!e.context.fetchSubscriptions))(t))]),ml=e=>({client:t,forward:n,dispatchDebug:r})=>e.reduceRight(((e,n)=>n({client:t,forward(t){return Be(e(Be(t)))},dispatchDebug(e){}})),n),hl=({onOperation:e,onResult:t,onError:n})=>({forward:r})=>i=>Ze((e=>{n&&e.error&&n(e.error,e.operation);var r=t&&t(e)||e;return`then`in r?ae(r):ie(r)}))(r(Ze((t=>{if(t.kind===`teardown`)return ie(t);var n=e&&e(t)||t;return`then`in n?et(T((e=>e.kind===`teardown`&&e.key===t.key))(i))(ae(n)):ie(n)}))(i))),gl=({dispatchDebug:e})=>e=>T((e=>!1))(e),_l=function e(t){var n=0,r=new Map,i=new Map,a=new Set,o=[],s={url:t.url,fetchSubscriptions:t.fetchSubscriptions,fetchOptions:t.fetchOptions,fetch:t.fetch,preferGetMethod:t.preferGetMethod==null?`within-url-limit`:t.preferGetMethod,requestPolicy:t.requestPolicy||`cache-first`},l=N();function u(e){(e.kind===`mutation`||e.kind===`teardown`||!a.has(e.key))&&(e.kind===`teardown`?a.delete(e.key):e.kind!==`mutation`&&a.add(e.key),l.next(e))}var d=!1;function f(e){if(e&&u(e),!d){for(d=!0;d&&(e=o.shift());)u(e);d=!1}}var p=e=>{var t=et(T((t=>t.kind===`teardown`&&t.key===e.key))(l.source))(T((t=>t.operation.kind===e.kind&&t.operation.key===e.key&&(!t.operation.context._instance||t.operation.context._instance===e.context._instance)))(_));return t=e.kind===`query`?ve((t=>{var n=ie(t);return t.stale||t.hasNext?n:xe([n,c((()=>(t.stale=!0,t)))(Ie(1)(T((t=>t.key===e.key))(l.source)))])}))(t):be((e=>!!e.hasNext),!0)(t),t=e.kind===`mutation`?je((()=>{u(e)}))(t):ze((()=>{a.delete(e.key),r.delete(e.key),i.delete(e.key),d=!1;for(var t=o.length-1;t>=0;t--)o[t].key===e.key&&o.splice(t,1);u(dl(`teardown`,e,e.context))}))(Ke((t=>{if(t.stale)if(!t.hasNext)a.delete(e.key);else for(var n=0;n<o.length;n++){var i=o[n];if(i.key===t.operation.key){a.delete(i.key);break}}else t.hasNext||a.delete(e.key);r.set(e.key,t)}))(t)),Be(t)},m=this instanceof e?this:Object.create(e.prototype),h=Object.assign(m,{suspense:!!t.suspense,operations$:l.source,reexecuteOperation(e){if(e.kind===`teardown`)f(e);else if(e.kind===`mutation`)o.push(e),Promise.resolve().then(f);else if(i.has(e.key)){for(var t=!1,n=0;n<o.length;n++)o[n].key===e.key&&(o[n]=e,t=!0);t||a.has(e.key)&&e.context.requestPolicy!==`network-only`?(a.delete(e.key),Promise.resolve().then(f)):(o.push(e),Promise.resolve().then(f))}},createRequestOperation(e,t,r){return r||={},dl(e,t,{_instance:e===`mutation`?n=n+1|0:void 0,...s,...r,requestPolicy:r.requestPolicy||s.requestPolicy,suspense:r.suspense||!1!==r.suspense&&h.suspense})},executeRequestOperation(e){return e.kind===`mutation`?ul(p(e)):ul(W((()=>{var t=i.get(e.key);t||i.set(e.key,t=p(e)),t=je((()=>{f(e)}))(t);var n=r.get(e.key);return e.kind===`query`&&n&&(n.stale||n.hasNext)?ve(ie)(xe([t,T((t=>t===r.get(e.key)))(ie(n))])):t})))},executeQuery(e,t){var n=h.createRequestOperation(`query`,e,t);return h.executeRequestOperation(n)},executeSubscription(e,t){var n=h.createRequestOperation(`subscription`,e,t);return h.executeRequestOperation(n)},executeMutation(e,t){var n=h.createRequestOperation(`mutation`,e,t);return h.executeRequestOperation(n)},readQuery(e,t,n){var r=null;return Ye((e=>{r=e}))(h.query(e,t,n)).unsubscribe(),r},query:(e,t,n)=>h.executeQuery(x(e,t),n),subscription:(e,t,n)=>h.executeSubscription(x(e,t),n),mutation:(e,t,n)=>h.executeMutation(x(e,t),n)}),g=fl,_=Be(ml(t.exchanges)({client:h,dispatchDebug:g,forward:gl({dispatchDebug:g})})(l.source));return de(_),h},vl={CommonCharge:`Common`,BusinessTripCharge:`Business Trip`,DividendCharge:`Dividend`,ConversionCharge:`Conversion`,SalaryCharge:`Salary`,InternalTransferCharge:`Internal Transfer`,MonthlyVatCharge:`Monthly VAT`,BankDepositCharge:`Bank Deposit`,ForeignSecuritiesCharge:`Foreign Securities`,CreditcardBankCharge:`Credit Card Bank Charge`,FinancialCharge:`Financial Charge`},yl=e=>!e||!(e in vl)?`Unknown`:vl[e],bl={CommonCharge:(0,Q.jsx)(zi,{}),BusinessTripCharge:(0,Q.jsx)(la,{}),DividendCharge:(0,Q.jsx)(Yi,{}),ConversionCharge:(0,Q.jsx)(Xi,{}),SalaryCharge:(0,Q.jsx)(Ca,{}),InternalTransferCharge:(0,Q.jsx)(Ai,{}),MonthlyVatCharge:(0,Q.jsx)(da,{}),BankDepositCharge:(0,Q.jsx)(ca,{}),ForeignSecuritiesCharge:(0,Q.jsx)(ba,{}),CreditcardBankCharge:(0,Q.jsx)(Hi,{}),FinancialCharge:(0,Q.jsx)(pa,{})},xl=e=>!e||!(e in bl)?(0,Q.jsx)(zi,{}):bl[e];function Sl(e){switch(e){case`CommonCharge`:return`COMMON`;case`BusinessTripCharge`:return`BUSINESS_TRIP`;case`DividendCharge`:return`DIVIDEND`;case`ConversionCharge`:return`CONVERSION`;case`SalaryCharge`:return`PAYROLL`;case`InternalTransferCharge`:return`INTERNAL`;case`MonthlyVatCharge`:return`VAT`;case`BankDepositCharge`:return`BANK_DEPOSIT`;case`ForeignSecuritiesCharge`:return`FOREIGN_SECURITIES`;case`CreditcardBankCharge`:return`CREDITCARD_BANK`;case`FinancialCharge`:return`FINANCIAL`;default:throw Error(`Unsupported charge type: ${e}`)}}var Cl=e=>{navigator.clipboard.writeText(e).then(()=>{console.log(`clipboard successfully set`)},()=>{console.log(`clipboard failed`)})},wl=/^((?:1[6-9]|[2]\d)\d{2})(-)(?:((?:0[13578]|1[02])(-31))|(?:(?:0[1,3-9]|1[0-2])(-)(?:29|30)))$|^(?:(?:(?:1[6-9]|[2]\d)(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(-02-29)$|^(?:(?:1[6-9]|[2-9]\d)\d{2})(-)(?:(?:0[1-9])|(?:1[0-2]))(-)(?:0[1-9]|1\d|2[0-8])$/,Tl=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,El=`00000000-0000-0000-0000-000000000000`,Dl=[f.Ils,f.Eur,f.Usd,f.Gbp,f.Cad,f.Jpy,f.Aud,f.Sek];function Ol(e,t){if(!Dl.includes(e)){let n=new Intl.NumberFormat(`en-US`,{minimumFractionDigits:2,maximumFractionDigits:2,...t,style:`decimal`});return{format:t=>{let r=kl(e),i=n.format(Math.abs(t));return t<0?`-${r} ${i}`:`${r} ${i}`}}}return new Intl.NumberFormat(`en-US`,{style:`currency`,...t,currency:e})}function kl(e){let t=`₪`;switch(e){case`USD`:t=`$`;break;case`EUR`:t=`€`;break;case`GBP`:t=`£`;break;case`CAD`:t=`C$`;break;case`JPY`:t=`¥`;break;case`AUD`:t=`A$`;break;case`SEK`:t=`kr`;break;case`GRT`:t=`GRT`;break;case`USDC`:t=`USDC`;break;case`ETH`:t=`ETH`;break}return t}function Al(e,t,n=2){return`${kl(t)} ${Ll(e,n)}`}function jl(e){return e?.__typename===`Invoice`}function Ml(e){return e?.__typename===`Receipt`}function Nl(e){return e?.__typename===`InvoiceReceipt`}function Pl(e){return e?.__typename===`CreditInvoice`}function Fl(e){return e?.__typename===`Proforma`}function Il(e){switch(e){case G.Invoice:return`Tax Invoice`;case G.Proforma:return`Proforma Invoice`;case G.InvoiceReceipt:return`Invoice / Receipt`;case G.CreditInvoice:return`Credit Note`;case G.Receipt:return`Receipt`;case G.Other:return`Other Document`;case G.Unprocessed:return`Unprocessed Document`;default:throw Error(`Unsupported document type: ${e}`)}}var Ll=(e,t=2)=>new Intl.NumberFormat(`en-US`,{minimumFractionDigits:t,maximumFractionDigits:t}).format(e),Rl={C:`INPUT_SELF_INVOICE`,H:`INPUT_SINGLE_DOC_BY_LAW`,I:`SALE_PALESTINIAN_CUSTOMER`,K:`INPUT_PETTY_CASH`,L1:`SALE_UNIDENTIFIED_CUSTOMER`,L2:`SALE_UNIDENTIFIED_ZERO_OR_EXEMPT`,M:`SALE_SELF_INVOICE`,P:`INPUT_PALESTINIAN_SUPPLIER`,R:`INPUT_IMPORT`,S1:`SALE_REGULAR`,S2:`SALE_ZERO_OR_EXEMPT`,T:`INPUT_REGULAR`,Y:`SALE_EXPORT`};function zl(e){return e.sort((e,t)=>{let n=[...e.namePath??[],e.name],r=[...t.namePath??[],t.name];for(let e=0;e<Math.max(n.length,r.length);e++){if(n[e]&&r[e]&&n[e]!==r[e])return n[e].localeCompare(r[e]);if(n[e]&&!r[e])return 1;if(!n[e]&&r[e])return-1}return e.name.localeCompare(t.name)})}function Bl({className:e,children:t,...n}){return(0,Q.jsxs)(rs,{"data-slot":`scroll-area`,className:s(`relative`,e),...n,children:[(0,Q.jsx)(is,{"data-slot":`scroll-area-viewport`,className:`focus-visible:ring-gray-950/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1 dark:focus-visible:ring-gray-300/50`,children:t}),(0,Q.jsx)(Vl,{}),(0,Q.jsx)(ree,{})]})}function Vl({className:e,orientation:t=`vertical`,...n}){return(0,Q.jsx)(jo,{"data-slot":`scroll-area-scrollbar`,orientation:t,className:s(`flex touch-none p-px transition-colors select-none`,t===`vertical`&&`h-full w-2.5 border-l border-l-transparent`,t===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent`,e),...n,children:(0,Q.jsx)(Ho,{"data-slot":`scroll-area-thumb`,className:`bg-gray-200 relative flex-1 rounded-full dark:bg-gray-800`})})}var Hl=(e,t)=>dl(e.kind,e,{...e.context,authAttempt:t});function Ul(e){return({client:t,forward:n})=>{var r=new Set,i=N(),a=N(),o=new Map;function s(){u=void 0;var e=o;o=new Map,e.forEach(i.next)}function l(e){u=void 0;var t=o;o=new Map,t.forEach((t=>{a.next(V(t,e))}))}var u,d=null;return f=>{function p(){u=Promise.resolve().then((()=>e({mutate(e,n,a){var o=t.createRequestOperation(`mutation`,x(e,n),a);return we(Ie(1)(T((e=>e.operation.key===o.key&&o.context._instance===e.operation.context._instance))(je((()=>{var e=h(o);r.add(e.context._instance),i.next(e)}))(g))))},appendHeaders(e,t){var n=typeof e.context.fetchOptions==`function`?e.context.fetchOptions():e.context.fetchOptions||{};return dl(e.kind,e,{...e.context,fetchOptions:{...n,headers:{...n.headers,...t}}})}}))).then((e=>{e&&(d=e),s()})).catch((e=>{l(e)}))}p();function m(e){o.set(e.key,Hl(e,!0)),d&&!u&&(u=d.refreshAuth().then(s).catch(l))}function h(e){return d?d.addAuthToOperation(e):e}var g=n(T(Boolean)(c((e=>e.kind===`teardown`?(o.delete(e.key),e):e.context._instance&&r.has(e.context._instance)?e:e.context.authAttempt?h(e):u||!d?(u||p(),o.has(e.key)||o.set(e.key,Hl(e,!1)),null):function(e){return!e.context.authAttempt&&d&&d.willAuthError&&d.willAuthError(e)}(e)?(m(e),null):h(Hl(e,!1))))(xe([i.source,f]))));return xe([a.source,T((e=>!r.has(e.operation.context._instance)&&e.error&&function(e){return d&&d.didAuthError&&d.didAuthError(e.error,e.operation)}(e)&&!e.operation.context.authAttempt?(m(e.operation),!1):(r.has(e.operation.context._instance)&&r.delete(e.operation.context._instance),!0)))(g)])}}}var Wl=null,Gl=null;function Kl(e){Wl=e}function ql(){return Wl?(Gl||=Wl().finally(()=>{Gl=null}),Gl):Promise.resolve(`redirect`)}function Jl(e){if(e.error?.networkError){console.error(`Network Error:`,e.error.networkError),K.error(`Network Error`,{description:`Failed to connect to the server. Please check your connection.`,duration:5e3});return}if(e.error?.graphQLErrors?.length){let t=e.error.graphQLErrors[0],{message:n}=t;console.error(`GraphQL Error:`,t),K.error(`Operation Error`,{description:n||`An error occurred while processing your request.`,duration:5e3})}}var Yl=`urql:businessScope`,Xl=null,Zl=null,Ql=!1,$l=(()=>{try{return localStorage.getItem(Yl)}catch{return null}})(),eu=null;function tu(e){Xl=e,e||(Zl=null,Ql=!1)}function nu(){return $l?$l.split(`,`):[]}function ru(e){$l=e.length>0?e.join(`,`):null;try{$l?localStorage.setItem(Yl,$l):localStorage.removeItem(Yl)}catch{}uu(),eu?.(lu())}function iu(e){return typeof e==`string`?{status:`token`,token:e}:e?e.status===`token`?{status:`token`,token:e.token}:e.status===`unauthenticated`?{status:`unauthenticated`}:{status:`error`,error:e.error}:{status:`unauthenticated`}}async function au(e){if(!Xl)return{status:`unauthenticated`};try{return iu(await Xl(e))}catch(e){return{status:`error`,error:e}}}function ou(e){return e instanceof Error?e:Error(`Failed to refresh access token`)}function su(){if(!Ql){if(typeof window<`u`&&window.location){if(window.location.pathname===yt.LOGIN||window.location.pathname===yt.AUTH_CALLBACK)return;try{if(window.sessionStorage){let{pathname:e,search:t,hash:n}=window.location,r=`${e}${t}${n}`;window.sessionStorage.setItem(`auth:returnTo`,r)}}catch{}Ql=!0,window.location.href=`${yt.LOGIN}?reauth=1`;return}if(typeof globalThis<`u`&&`location`in globalThis&&globalThis.location){if(globalThis.location.pathname===yt.LOGIN||globalThis.location.pathname===yt.AUTH_CALLBACK)return;Ql=!0,globalThis.location.href=`${yt.LOGIN}?reauth=1`}}}var cu=null;function lu(){if(cu)return cu;let e;switch(`production`){case`production`:e=`https://accounter.onrender.com/graphql`;break;case`staging`:e=`https://accounter-staging.onrender.com/graphql`;break;default:e=`http://localhost:4000/graphql`;break}return cu=_l({url:e,exchanges:[hl({onResult(e){Jl(e)}}),Ul(async e=>{{let e=await au();Zl=e.status===`token`?`Bearer ${e.token}`:null}return{willAuthError(){return!1},addAuthToOperation(t){if(!Zl)return t;let n={Authorization:Zl};return $l&&(n[`x-business-scope`]=$l),e.appendHeaders(t,n)},didAuthError(e){return e.graphQLErrors?.some(e=>e.extensions?.code===`UNAUTHENTICATED`)??!1},async refreshAuth(){let e=await au({cacheMode:`off`});if(e.status===`error`)throw ou(e.error);if(e.status===`unauthenticated`){if(Zl=null,await ql()===`authenticated`){let e=await au({cacheMode:`off`});if(e.status===`token`){Ql=!1,Zl=`Bearer ${e.token}`;return}}su();return}Ql=!1,Zl=`Bearer ${e.token}`}}}),pl]}),cu}function uu(){cu=null,Zl=null,Ql=!1}function du({children:e}){let[t,n]=(0,Z.useState)(lu);return(0,Z.useEffect)(()=>(eu=n,()=>{eu===n&&(eu=null)}),[]),(0,Q.jsx)(ft,{value:t,children:e})}function fu(e,t){let n=e;for(;(n=n.parentElement)&&!n.matches(t););return n}function pu(e,t,n){for(let n=e-1;n>=0;--n)if(!t[n].disabled)return n;if(n){for(let e=t.length-1;e>-1;--e)if(!t[e].disabled)return e}return e}function mu(e,t,n){for(let n=e+1;n<t.length;n+=1)if(!t[n].disabled)return n;if(n){for(let e=0;e<t.length;e+=1)if(!t[e].disabled)return e}return e}function hu(e,t,n){return fu(e,n)===fu(t,n)}function gu({parentSelector:e,siblingSelector:t,onKeyDown:n,loop:r=!0,activateOnFocus:i=!1,dir:a=`rtl`,orientation:o}){return s=>{n?.(s);let c=Array.from(fu(s.currentTarget,e)?.querySelectorAll(t)||[]).filter(t=>hu(s.currentTarget,t,e)),l=c.findIndex(e=>s.currentTarget===e),u=mu(l,c,r),d=pu(l,c,r),f=a===`rtl`?d:u,p=a===`rtl`?u:d;switch(s.key){case`ArrowRight`:o===`horizontal`&&(s.stopPropagation(),s.preventDefault(),c[f].focus(),i&&c[f].click());break;case`ArrowLeft`:o===`horizontal`&&(s.stopPropagation(),s.preventDefault(),c[p].focus(),i&&c[p].click());break;case`ArrowUp`:o===`vertical`&&(s.stopPropagation(),s.preventDefault(),c[d].focus(),i&&c[d].click());break;case`ArrowDown`:o===`vertical`&&(s.stopPropagation(),s.preventDefault(),c[u].focus(),i&&c[u].click());break;case`Home`:s.stopPropagation(),s.preventDefault(),!c[0].disabled&&c[0].focus();break;case`End`:{s.stopPropagation(),s.preventDefault();let e=c.length-1;!c[e].disabled&&c[e].focus();break}}}}function _u(e,t,n){return n?Array.from(fu(n,t)?.querySelectorAll(e)||[]).findIndex(e=>e===n):null}function vu(e){let t=(0,Z.createContext)(null);return[({children:e,value:n})=>Z.createElement(t.Provider,{value:n},e),()=>{let n=(0,Z.useContext)(t);if(n===null)throw Error(e);return n}]}function yu(e){return Array.isArray(e)?e:[e]}var bu=()=>{};function xu(e,t={active:!0}){return typeof e!=`function`||!t.active?t.onKeyDown||bu:n=>{var r;n.key===`Escape`&&(e(n),(r=t.onTrigger)==null||r.call(t))}}function Su(e,t){return n=>{e?.(n),t?.(n)}}function Cu(){let[e,t]=(0,Z.useState)(-1);return[e,{setHovered:t,resetHovered:()=>t(-1)}]}function wu({data:e}){let t=[],n=[],r=e.reduce((e,t,r)=>(t.group?e[t.group]?e[t.group].push(r):e[t.group]=[r]:n.push(r),e),{});return Object.keys(r).forEach(n=>{t.push(...r[n].map(t=>e[t]))}),t.push(...n.map(t=>e[t])),t}function Tu(e){return Array.isArray(e)||e===null?!1:typeof e==`object`&&e.type!==Z.Fragment}var Eu={app:100,modal:200,popover:300,overlay:400,max:9999};function Du(e){return Eu[e]}function Ou(e){return`___ref-${e||``}`}var ku=Object.defineProperty,Au=Object.defineProperties,ju=Object.getOwnPropertyDescriptors,Mu=Object.getOwnPropertySymbols,Nu=Object.prototype.hasOwnProperty,Pu=Object.prototype.propertyIsEnumerable,Fu=(e,t,n)=>t in e?ku(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Iu=(e,t)=>{for(var n in t||={})Nu.call(t,n)&&Fu(e,n,t[n]);if(Mu)for(var n of Mu(t))Pu.call(t,n)&&Fu(e,n,t[n]);return e},Lu=(e,t)=>Au(e,ju(t)),Ru={in:{opacity:1,transform:`scale(1)`},out:{opacity:0,transform:`scale(.9) translateY(${J(10)})`},transitionProperty:`transform, opacity`},zu={fade:{in:{opacity:1},out:{opacity:0},transitionProperty:`opacity`},scale:{in:{opacity:1,transform:`scale(1)`},out:{opacity:0,transform:`scale(0)`},common:{transformOrigin:`top`},transitionProperty:`transform, opacity`},"scale-y":{in:{opacity:1,transform:`scaleY(1)`},out:{opacity:0,transform:`scaleY(0)`},common:{transformOrigin:`top`},transitionProperty:`transform, opacity`},"scale-x":{in:{opacity:1,transform:`scaleX(1)`},out:{opacity:0,transform:`scaleX(0)`},common:{transformOrigin:`left`},transitionProperty:`transform, opacity`},"skew-up":{in:{opacity:1,transform:`translateY(0) skew(0deg, 0deg)`},out:{opacity:0,transform:`translateY(-${J(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:`top`},transitionProperty:`transform, opacity`},"skew-down":{in:{opacity:1,transform:`translateY(0) skew(0deg, 0deg)`},out:{opacity:0,transform:`translateY(${J(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:`bottom`},transitionProperty:`transform, opacity`},"rotate-left":{in:{opacity:1,transform:`translateY(0) rotate(0deg)`},out:{opacity:0,transform:`translateY(${J(20)}) rotate(-5deg)`},common:{transformOrigin:`bottom`},transitionProperty:`transform, opacity`},"rotate-right":{in:{opacity:1,transform:`translateY(0) rotate(0deg)`},out:{opacity:0,transform:`translateY(${J(20)}) rotate(5deg)`},common:{transformOrigin:`top`},transitionProperty:`transform, opacity`},"slide-down":{in:{opacity:1,transform:`translateY(0)`},out:{opacity:0,transform:`translateY(-100%)`},common:{transformOrigin:`top`},transitionProperty:`transform, opacity`},"slide-up":{in:{opacity:1,transform:`translateY(0)`},out:{opacity:0,transform:`translateY(100%)`},common:{transformOrigin:`bottom`},transitionProperty:`transform, opacity`},"slide-left":{in:{opacity:1,transform:`translateX(0)`},out:{opacity:0,transform:`translateX(100%)`},common:{transformOrigin:`left`},transitionProperty:`transform, opacity`},"slide-right":{in:{opacity:1,transform:`translateX(0)`},out:{opacity:0,transform:`translateX(-100%)`},common:{transformOrigin:`right`},transitionProperty:`transform, opacity`},pop:Lu(Iu({},Ru),{common:{transformOrigin:`center center`}}),"pop-bottom-left":Lu(Iu({},Ru),{common:{transformOrigin:`bottom left`}}),"pop-bottom-right":Lu(Iu({},Ru),{common:{transformOrigin:`bottom right`}}),"pop-top-left":Lu(Iu({},Ru),{common:{transformOrigin:`top left`}}),"pop-top-right":Lu(Iu({},Ru),{common:{transformOrigin:`top right`}})},Bu=[`mousedown`,`touchstart`];function Vu(e,t,n){let r=(0,Z.useRef)();return(0,Z.useEffect)(()=>{let i=t=>{let{target:i}=t??{};if(Array.isArray(n)){let r=i?.hasAttribute(`data-ignore-outside-clicks`)||!document.body.contains(i)&&i.tagName!==`HTML`;n.every(e=>!!e&&!t.composedPath().includes(e))&&!r&&e()}else r.current&&!r.current.contains(i)&&e()};return(t||Bu).forEach(e=>document.addEventListener(e,i)),()=>{(t||Bu).forEach(e=>document.removeEventListener(e,i))}},[r,e,n]),r}function Hu(e,t){try{return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function Uu(e,t){return typeof t==`boolean`?t:typeof window<`u`&&`matchMedia`in window&&window.matchMedia(e).matches}function Wu(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){let[r,i]=(0,Z.useState)(n?t:Uu(e,t)),a=(0,Z.useRef)();return(0,Z.useEffect)(()=>{if(`matchMedia`in window)return a.current=window.matchMedia(e),i(a.current.matches),Hu(a.current,e=>i(e.matches))},[e]),r}function Gu(e,t,n){return Math.min(Math.max(e,t),n)}var Ku=typeof document<`u`?Z.useLayoutEffect:Z.useEffect;function qu({opened:e,shouldReturnFocus:t=!0}){let n=(0,Z.useRef)(),r=()=>{var e;n.current&&`focus`in n.current&&typeof n.current.focus==`function`&&((e=n.current)==null||e.focus({preventScroll:!0}))};return bi(()=>{let i=-1,a=e=>{e.key===`Tab`&&window.clearTimeout(i)};return document.addEventListener(`keydown`,a),e?n.current=document.activeElement:t&&(i=window.setTimeout(r,10)),()=>{window.clearTimeout(i),document.removeEventListener(`keydown`,a)}},[e,t]),r}var Ju=/input|select|textarea|button|object/,Yu=`a, input, select, textarea, button, object, [tabindex]`;function Xu(e){return e.style.display===`none`}function Zu(e){if(e.getAttribute(`aria-hidden`)||e.getAttribute(`hidden`)||e.getAttribute(`type`)===`hidden`)return!1;let t=e;for(;t&&!(t===document.body||t.nodeType===11);){if(Xu(t))return!1;t=t.parentNode}return!0}function Qu(e){let t=e.getAttribute(`tabindex`);return t===null&&(t=void 0),parseInt(t,10)}function $u(e){let t=e.nodeName.toLowerCase(),n=!Number.isNaN(Qu(e));return(Ju.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&Zu(e)}function ed(e){let t=Qu(e);return(Number.isNaN(t)||t>=0)&&$u(e)}function td(e){return Array.from(e.querySelectorAll(Yu)).filter(ed)}function nd(e,t){let n=td(e);if(!n.length){t.preventDefault();return}let r=n[t.shiftKey?0:n.length-1],i=e.getRootNode();if(!(r===i.activeElement||e===i.activeElement))return;t.preventDefault();let a=n[t.shiftKey?n.length-1:0];a&&a.focus()}function rd(){return`mantine-${Math.random().toString(36).slice(2,11)}`}function id(e,t=`body > :not(script)`){let n=rd(),r=Array.from(document.querySelectorAll(t)).map(t=>{if((t?.shadowRoot)?.contains(e)||t.contains(e))return;let r=t.getAttribute(`aria-hidden`),i=t.getAttribute(`data-hidden`),a=t.getAttribute(`data-focus-id`);return t.setAttribute(`data-focus-id`,n),r===null||r===`false`?t.setAttribute(`aria-hidden`,`true`):!i&&!a&&t.setAttribute(`data-hidden`,r),{node:t,ariaHidden:i||null}});return()=>{r.forEach(e=>{!e||n!==e.node.getAttribute(`data-focus-id`)||(e.ariaHidden===null?e.node.removeAttribute(`aria-hidden`):e.node.setAttribute(`aria-hidden`,e.ariaHidden),e.node.removeAttribute(`data-focus-id`),e.node.removeAttribute(`data-hidden`))})}}function ad(e=!0){let t=(0,Z.useRef)(),n=(0,Z.useRef)(null),r=e=>{let t=e.querySelector(`[data-autofocus]`);if(!t){let n=Array.from(e.querySelectorAll(Yu));t=n.find(ed)||n.find($u)||null,!t&&$u(e)&&(t=e)}t&&t.focus({preventScroll:!0})},i=(0,Z.useCallback)(i=>{if(e){if(i===null){n.current&&=(n.current(),null);return}n.current=id(i),t.current!==i&&(i?(setTimeout(()=>{i.getRootNode()&&r(i)}),t.current=i):t.current=null)}},[e]);return(0,Z.useEffect)(()=>{if(!e)return;t.current&&setTimeout(()=>r(t.current));let i=e=>{e.key===`Tab`&&t.current&&nd(t.current,e)};return document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`keydown`,i),n.current&&n.current()}},[e]),i}var od=Z.default.useId||(()=>void 0);function sd(){let e=od();return e?`mantine-${e.replace(/:/g,``)}`:``}function cd(e){let t=sd(),[n,r]=(0,Z.useState)(t);return Ku(()=>{r(rd())},[]),typeof e==`string`?e:typeof window>`u`?t:n}function ld(e,t,n){(0,Z.useEffect)(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function ud(e,t){typeof e==`function`?e(t):typeof e==`object`&&e&&`current`in e&&(e.current=t)}function dd(...e){return t=>{e.forEach(e=>ud(e,t))}}function fd(...e){return(0,Z.useCallback)(dd(...e),e)}function pd({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){let[i,a]=(0,Z.useState)(t===void 0?n:t);return e===void 0?[i,e=>{a(e),r?.(e)},!1]:[e,r,!0]}function md(e,t){return Wu(`(prefers-reduced-motion: reduce)`,e,t)}var hd=e=>e<.5?2*e*e:-1+(4-2*e)*e,gd=({axis:e,target:t,parent:n,alignment:r,offset:i,isList:a})=>{if(!t||!n&&typeof document>`u`)return 0;let o=!!n,s=(n||document.body).getBoundingClientRect(),c=t.getBoundingClientRect(),l=e=>c[e]-s[e];if(e===`y`){let e=l(`top`);if(e===0)return 0;if(r===`start`){let t=e-i;return t<=c.height*+!a||!a?t:0}let t=o?s.height:window.innerHeight;if(r===`end`){let n=e+i-t+c.height;return n>=-c.height*+!a||!a?n:0}return r===`center`?e-t/2+c.height/2:0}if(e===`x`){let e=l(`left`);if(e===0)return 0;if(r===`start`){let t=e-i;return t<=c.width||!a?t:0}let t=o?s.width:window.innerWidth;if(r===`end`){let n=e+i-t+c.width;return n>=-c.width||!a?n:0}return r===`center`?e-t/2+c.width/2:0}return 0},_d=({axis:e,parent:t})=>{if(!t&&typeof document>`u`)return 0;let n=e===`y`?`scrollTop`:`scrollLeft`;if(t)return t[n];let{body:r,documentElement:i}=document;return r[n]+i[n]},vd=({axis:e,parent:t,distance:n})=>{if(!t&&typeof document>`u`)return;let r=e===`y`?`scrollTop`:`scrollLeft`;if(t)t[r]=n;else{let{body:e,documentElement:t}=document;e[r]=n,t[r]=n}};function yd({duration:e=1250,axis:t=`y`,onScrollFinish:n,easing:r=hd,offset:i=0,cancelable:a=!0,isList:o=!1}={}){let s=(0,Z.useRef)(0),c=(0,Z.useRef)(0),l=(0,Z.useRef)(!1),u=(0,Z.useRef)(null),d=(0,Z.useRef)(null),f=md(),p=()=>{s.current&&cancelAnimationFrame(s.current)},m=(0,Z.useCallback)(({alignment:a=`start`}={})=>{l.current=!1,s.current&&p();let m=_d({parent:u.current,axis:t})??0,h=gd({parent:u.current,target:d.current,axis:t,alignment:a,offset:i,isList:o})-(u.current?0:m);function g(){c.current===0&&(c.current=performance.now());let i=performance.now()-c.current,a=f||e===0?1:i/e,o=m+h*r(a);vd({parent:u.current,axis:t,distance:o}),!l.current&&a<1?s.current=requestAnimationFrame(g):(typeof n==`function`&&n(),c.current=0,s.current=0,p())}g()},[t,e,r,o,i,n,f]),h=()=>{a&&(l.current=!0)};return ld(`wheel`,h,{passive:!0}),ld(`touchmove`,h,{passive:!0}),(0,Z.useEffect)(()=>p,[]),{scrollableRef:u,targetRef:d,scrollIntoView:m,cancel:p}}function bd(){if(typeof window>`u`)return`undetermined`;let{userAgent:e}=window.navigator;return/(Macintosh)|(MacIntel)|(MacPPC)|(Mac68K)/i.test(e)?`macos`:/(iPhone)|(iPad)|(iPod)/i.test(e)?`ios`:/(Win32)|(Win64)|(Windows)|(WinCE)/i.test(e)?`windows`:/Android/i.test(e)?`android`:/Linux/i.test(e)?`linux`:`undetermined`}function xd(e={getValueInEffect:!0}){let[t,n]=(0,Z.useState)(e.getValueInEffect?`undetermined`:bd());return Ku(()=>{e.getValueInEffect&&n(bd)},[]),t}function Sd(e=!1,t){let{onOpen:n,onClose:r}=t||{},[i,a]=(0,Z.useState)(e),o=(0,Z.useCallback)(()=>{a(e=>e||(n?.(),!0))},[n]),s=(0,Z.useCallback)(()=>{a(e=>e&&(r?.(),!1))},[r]);return[i,{open:o,close:s,toggle:(0,Z.useCallback)(()=>{i?s():o()},[s,o,i])}]}function Cd(e){return typeof e==`string`?e.charAt(0).toUpperCase()+e.slice(1):``}var wd=Object.defineProperty,Td=Object.defineProperties,Ed=Object.getOwnPropertyDescriptors,Dd=Object.getOwnPropertySymbols,Od=Object.prototype.hasOwnProperty,kd=Object.prototype.propertyIsEnumerable,Ad=(e,t,n)=>t in e?wd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jd=(e,t)=>{for(var n in t||={})Od.call(t,n)&&Ad(e,n,t[n]);if(Dd)for(var n of Dd(t))kd.call(t,n)&&Ad(e,n,t[n]);return e},Md=(e,t)=>Td(e,Ed(t)),Nd=Rr(e=>({root:Md(jd(jd({},e.fn.focusStyles()),e.fn.fontStyles()),{cursor:`pointer`,border:0,padding:0,appearance:`none`,fontSize:e.fontSizes.md,backgroundColor:`transparent`,textAlign:`left`,color:e.colorScheme===`dark`?e.colors.dark[0]:e.black,textDecoration:`none`,boxSizing:`border-box`})})),Pd=Object.defineProperty,Fd=Object.getOwnPropertySymbols,Id=Object.prototype.hasOwnProperty,Ld=Object.prototype.propertyIsEnumerable,Rd=(e,t,n)=>t in e?Pd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zd=(e,t)=>{for(var n in t||={})Id.call(t,n)&&Rd(e,n,t[n]);if(Fd)for(var n of Fd(t))Ld.call(t,n)&&Rd(e,n,t[n]);return e},Bd=(e,t)=>{var n={};for(var r in e)Id.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Fd)for(var r of Fd(e))t.indexOf(r)<0&&Ld.call(e,r)&&(n[r]=e[r]);return n},Vd=(0,Z.forwardRef)((e,t)=>{let n=X(`UnstyledButton`,{},e),{className:r,component:i=`button`,unstyled:a,variant:o}=n,s=Bd(n,[`className`,`component`,`unstyled`,`variant`]),{classes:c,cx:l}=Nd(null,{name:`UnstyledButton`,unstyled:a,variant:o});return Z.createElement(Ir,zd({component:i,ref:t,className:l(c.root,r),type:i===`button`?`button`:void 0},s))});Vd.displayName=`@mantine/core/UnstyledButton`;var Hd=mr(Vd),Ud=Object.defineProperty,Wd=Object.getOwnPropertySymbols,Gd=Object.prototype.hasOwnProperty,Kd=Object.prototype.propertyIsEnumerable,qd=(e,t,n)=>t in e?Ud(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jd=(e,t)=>{for(var n in t||={})Gd.call(t,n)&&qd(e,n,t[n]);if(Wd)for(var n of Wd(t))Kd.call(t,n)&&qd(e,n,t[n]);return e},Yd=(e,t)=>{var n={};for(var r in e)Gd.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Wd)for(var r of Wd(e))t.indexOf(r)<0&&Kd.call(e,r)&&(n[r]=e[r]);return n};function Xd(e){let t=e,{style:n}=t,r=Yd(t,[`style`]);return Z.createElement(`svg`,Jd({viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:Jd({width:J(16),height:J(16)},n)},r),Z.createElement(`path`,{d:`M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`}))}var Zd=Object.defineProperty,Qd=Object.defineProperties,$d=Object.getOwnPropertyDescriptors,ef=Object.getOwnPropertySymbols,tf=Object.prototype.hasOwnProperty,nf=Object.prototype.propertyIsEnumerable,rf=(e,t,n)=>t in e?Zd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,af=(e,t)=>{for(var n in t||={})tf.call(t,n)&&rf(e,n,t[n]);if(ef)for(var n of ef(t))nf.call(t,n)&&rf(e,n,t[n]);return e},of=(e,t)=>Qd(e,$d(t)),sf=[`subtle`,`filled`,`outline`,`light`,`default`,`transparent`,`gradient`],cf={xs:J(18),sm:J(22),md:J(28),lg:J(34),xl:J(44)};function lf({variant:e,theme:t,color:n,gradient:r}){let i=t.fn.variant({color:n,variant:e,gradient:r});return e===`gradient`?{border:0,backgroundImage:i.background,color:i.color,"&:hover":t.fn.hover({backgroundSize:`200%`})}:sf.includes(e)?af({border:`${J(1)} solid ${i.border}`,backgroundColor:i.background,color:i.color},t.fn.hover({backgroundColor:i.hover})):null}var uf=Rr((e,{radius:t,color:n,gradient:r},{variant:i,size:a})=>({root:of(af({position:`relative`,borderRadius:e.fn.radius(t),padding:0,lineHeight:1,display:`flex`,alignItems:`center`,justifyContent:`center`,height:Y({size:a,sizes:cf}),minHeight:Y({size:a,sizes:cf}),width:Y({size:a,sizes:cf}),minWidth:Y({size:a,sizes:cf})},lf({variant:i,theme:e,color:n,gradient:r})),{"&:active":e.activeStyles,"& [data-action-icon-loader]":{maxWidth:`70%`},"&:disabled, &[data-disabled]":{color:e.colors.gray[e.colorScheme===`dark`?6:4],cursor:`not-allowed`,backgroundColor:i===`transparent`?void 0:e.fn.themeColor(`gray`,e.colorScheme===`dark`?8:1),borderColor:i===`transparent`?void 0:e.fn.themeColor(`gray`,e.colorScheme===`dark`?8:1),backgroundImage:`none`,pointerEvents:`none`,"&:active":{transform:`none`}},"&[data-loading]":{pointerEvents:`none`,"&::before":of(af({content:`""`},e.fn.cover(J(-1))),{backgroundColor:e.colorScheme===`dark`?e.fn.rgba(e.colors.dark[7],.5):`rgba(255, 255, 255, .5)`,borderRadius:e.fn.radius(t),cursor:`not-allowed`})}})})),df=Object.defineProperty,ff=Object.getOwnPropertySymbols,pf=Object.prototype.hasOwnProperty,mf=Object.prototype.propertyIsEnumerable,hf=(e,t,n)=>t in e?df(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gf=(e,t)=>{for(var n in t||={})pf.call(t,n)&&hf(e,n,t[n]);if(ff)for(var n of ff(t))mf.call(t,n)&&hf(e,n,t[n]);return e},bee=(e,t)=>{var n={};for(var r in e)pf.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ff)for(var r of ff(e))t.indexOf(r)<0&&mf.call(e,r)&&(n[r]=e[r]);return n},xee={color:`gray`,size:`md`,variant:`subtle`},_f=(0,Z.forwardRef)((e,t)=>{let n=X(`ActionIcon`,xee,e),{className:r,color:i,children:a,radius:o,size:s,variant:c,gradient:l,disabled:u,loaderProps:d,loading:f,unstyled:p,__staticSelector:m}=n,h=bee(n,[`className`,`color`,`children`,`radius`,`size`,`variant`,`gradient`,`disabled`,`loaderProps`,`loading`,`unstyled`,`__staticSelector`]),{classes:g,cx:_,theme:v}=uf({radius:o,color:i,gradient:l},{name:[`ActionIcon`,m],unstyled:p,size:s,variant:c}),y=Z.createElement(hi,gf({color:v.fn.variant({color:i,variant:c}).color,size:`100%`,"data-action-icon-loader":!0},d));return Z.createElement(Hd,gf({className:_(g.root,r),ref:t,disabled:u,"data-disabled":u||void 0,"data-loading":f||void 0,unstyled:p},h),f?y:a)});_f.displayName=`@mantine/core/ActionIcon`;var See=mr(_f),vf=r(He()),Cee=Object.defineProperty,wee=Object.defineProperties,Tee=Object.getOwnPropertyDescriptors,yf=Object.getOwnPropertySymbols,bf=Object.prototype.hasOwnProperty,xf=Object.prototype.propertyIsEnumerable,Sf=(e,t,n)=>t in e?Cee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Eee=(e,t)=>{for(var n in t||={})bf.call(t,n)&&Sf(e,n,t[n]);if(yf)for(var n of yf(t))xf.call(t,n)&&Sf(e,n,t[n]);return e},Dee=(e,t)=>wee(e,Tee(t)),Oee=(e,t)=>{var n={};for(var r in e)bf.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&yf)for(var r of yf(e))t.indexOf(r)<0&&xf.call(e,r)&&(n[r]=e[r]);return n};function Cf(e){let t=X(`Portal`,{},e),{children:n,target:r,className:i,innerRef:a}=t,o=Oee(t,[`children`,`target`,`className`,`innerRef`]),s=Zr(),[c,l]=(0,Z.useState)(!1),u=(0,Z.useRef)();return Ku(()=>(l(!0),u.current=r?typeof r==`string`?document.querySelector(r):r:document.createElement(`div`),r||document.body.appendChild(u.current),()=>{!r&&document.body.removeChild(u.current)}),[r]),c?(0,vf.createPortal)(Z.createElement(`div`,Dee(Eee({className:i,dir:s.dir},o),{ref:a}),n),u.current):null}Cf.displayName=`@mantine/core/Portal`;var kee=Object.defineProperty,wf=Object.getOwnPropertySymbols,Tf=Object.prototype.hasOwnProperty,Ef=Object.prototype.propertyIsEnumerable,Df=(e,t,n)=>t in e?kee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Of=(e,t)=>{for(var n in t||={})Tf.call(t,n)&&Df(e,n,t[n]);if(wf)for(var n of wf(t))Ef.call(t,n)&&Df(e,n,t[n]);return e},kf=(e,t)=>{var n={};for(var r in e)Tf.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&wf)for(var r of wf(e))t.indexOf(r)<0&&Ef.call(e,r)&&(n[r]=e[r]);return n};function Af(e){var t=e,{withinPortal:n=!0,children:r}=t,i=kf(t,[`withinPortal`,`children`]);return n?Z.createElement(Cf,Of({},i),r):Z.createElement(Z.Fragment,null,r)}Af.displayName=`@mantine/core/OptionalPortal`;var jf=Object.defineProperty,Mf=Object.getOwnPropertySymbols,Nf=Object.prototype.hasOwnProperty,Pf=Object.prototype.propertyIsEnumerable,Ff=(e,t,n)=>t in e?jf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,If=(e,t)=>{for(var n in t||={})Nf.call(t,n)&&Ff(e,n,t[n]);if(Mf)for(var n of Mf(t))Pf.call(t,n)&&Ff(e,n,t[n]);return e},Lf=(e,t)=>{var n={};for(var r in e)Nf.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Mf)for(var r of Mf(e))t.indexOf(r)<0&&Pf.call(e,r)&&(n[r]=e[r]);return n};function Rf(e){let t=e,{width:n,height:r,style:i}=t,a=Lf(t,[`width`,`height`,`style`]);return Z.createElement(`svg`,If({viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:If({width:n,height:r},i)},a),Z.createElement(`path`,{d:`M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`}))}Rf.displayName=`@mantine/core/CloseIcon`;var zf=Object.defineProperty,Bf=Object.getOwnPropertySymbols,Vf=Object.prototype.hasOwnProperty,Hf=Object.prototype.propertyIsEnumerable,Uf=(e,t,n)=>t in e?zf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wf=(e,t)=>{for(var n in t||={})Vf.call(t,n)&&Uf(e,n,t[n]);if(Bf)for(var n of Bf(t))Hf.call(t,n)&&Uf(e,n,t[n]);return e},Gf=(e,t)=>{var n={};for(var r in e)Vf.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Bf)for(var r of Bf(e))t.indexOf(r)<0&&Hf.call(e,r)&&(n[r]=e[r]);return n},Kf={xs:J(12),sm:J(16),md:J(20),lg:J(28),xl:J(34)},qf={size:`sm`},Jf=(0,Z.forwardRef)((e,t)=>{let n=X(`CloseButton`,qf,e),{iconSize:r,size:i,children:a}=n,o=Gf(n,[`iconSize`,`size`,`children`]),s=J(r||Kf[i]);return Z.createElement(See,Wf({ref:t,__staticSelector:`CloseButton`,size:i},o),a||Z.createElement(Rf,{width:s,height:s}))});Jf.displayName=`@mantine/core/CloseButton`;var Yf=mr(Jf),Xf={xs:J(1),sm:J(2),md:J(3),lg:J(4),xl:J(5)};function Zf(e,t){let n=e.fn.variant({variant:`outline`,color:t}).border;return typeof t==`string`&&(t in e.colors||t.split(`.`)[0]in e.colors)?n:t===void 0?e.colorScheme===`dark`?e.colors.dark[4]:e.colors.gray[4]:t}var Qf=Rr((e,{color:t},{size:n,variant:r})=>({root:{},withLabel:{borderTop:`0 !important`},left:{"&::before":{display:`none`}},right:{"&::after":{display:`none`}},label:{display:`flex`,alignItems:`center`,"&::before":{content:`""`,flex:1,height:J(1),borderTop:`${Y({size:n,sizes:Xf})} ${r} ${Zf(e,t)}`,marginRight:e.spacing.xs},"&::after":{content:`""`,flex:1,borderTop:`${Y({size:n,sizes:Xf})} ${r} ${Zf(e,t)}`,marginLeft:e.spacing.xs}},labelDefaultStyles:{color:t===`dark`?e.colors.dark[1]:e.fn.themeColor(t,e.colorScheme===`dark`?5:e.fn.primaryShade(),!1)},horizontal:{border:0,borderTopWidth:J(Y({size:n,sizes:Xf})),borderTopColor:Zf(e,t),borderTopStyle:r,margin:0},vertical:{border:0,alignSelf:`stretch`,height:`auto`,borderLeftWidth:J(Y({size:n,sizes:Xf})),borderLeftColor:Zf(e,t),borderLeftStyle:r}})),$f=Object.defineProperty,ep=Object.defineProperties,tp=Object.getOwnPropertyDescriptors,np=Object.getOwnPropertySymbols,rp=Object.prototype.hasOwnProperty,ip=Object.prototype.propertyIsEnumerable,ap=(e,t,n)=>t in e?$f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,op=(e,t)=>{for(var n in t||={})rp.call(t,n)&&ap(e,n,t[n]);if(np)for(var n of np(t))ip.call(t,n)&&ap(e,n,t[n]);return e},sp=(e,t)=>ep(e,tp(t)),cp=(e,t)=>{var n={};for(var r in e)rp.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&np)for(var r of np(e))t.indexOf(r)<0&&ip.call(e,r)&&(n[r]=e[r]);return n},lp={orientation:`horizontal`,size:`xs`,labelPosition:`left`,variant:`solid`},up=(0,Z.forwardRef)((e,t)=>{let n=X(`Divider`,lp,e),{className:r,color:i,orientation:a,size:o,label:s,labelPosition:c,labelProps:l,variant:u,styles:d,classNames:f,unstyled:p}=n,m=cp(n,[`className`,`color`,`orientation`,`size`,`label`,`labelPosition`,`labelProps`,`variant`,`styles`,`classNames`,`unstyled`]),{classes:h,cx:g}=Qf({color:i},{classNames:f,styles:d,unstyled:p,name:`Divider`,variant:u,size:o}),_=a===`vertical`,v=a===`horizontal`,y=!!s&&v,b=!l?.color;return Z.createElement(Ir,op({ref:t,className:g(h.root,{[h.vertical]:_,[h.horizontal]:v,[h.withLabel]:y},r),role:`separator`},m),y&&Z.createElement(ai,sp(op({},l),{size:l?.size||`xs`,mt:J(2),className:g(h.label,h[c],{[h.labelDefaultStyles]:b})}),s))});up.displayName=`@mantine/core/Divider`;var dp=Object.defineProperty,fp=Object.defineProperties,pp=Object.getOwnPropertyDescriptors,mp=Object.getOwnPropertySymbols,hp=Object.prototype.hasOwnProperty,gp=Object.prototype.propertyIsEnumerable,_p=(e,t,n)=>t in e?dp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vp=(e,t)=>{for(var n in t||={})hp.call(t,n)&&_p(e,n,t[n]);if(mp)for(var n of mp(t))gp.call(t,n)&&_p(e,n,t[n]);return e},yp=(e,t)=>fp(e,pp(t)),bp=Rr((e,t,{size:n})=>({item:yp(vp({},e.fn.fontStyles()),{boxSizing:`border-box`,wordBreak:`break-all`,textAlign:`left`,width:`100%`,padding:`calc(${Y({size:n,sizes:e.spacing})} / 1.5) ${Y({size:n,sizes:e.spacing})}`,cursor:`pointer`,fontSize:Y({size:n,sizes:e.fontSizes}),color:e.colorScheme===`dark`?e.colors.dark[0]:e.black,borderRadius:e.fn.radius(),"&[data-hovered]":{backgroundColor:e.colorScheme===`dark`?e.colors.dark[4]:e.colors.gray[1]},"&[data-selected]":vp({backgroundColor:e.fn.variant({variant:`filled`}).background,color:e.fn.variant({variant:`filled`}).color},e.fn.hover({backgroundColor:e.fn.variant({variant:`filled`}).hover})),"&[data-disabled]":{cursor:`default`,color:e.colors.dark[2]}}),nothingFound:{boxSizing:`border-box`,color:e.colors.gray[6],paddingTop:`calc(${Y({size:n,sizes:e.spacing})} / 2)`,paddingBottom:`calc(${Y({size:n,sizes:e.spacing})} / 2)`,textAlign:`center`},separator:{boxSizing:`border-box`,textAlign:`left`,width:`100%`,padding:`calc(${Y({size:n,sizes:e.spacing})} / 1.5) ${Y({size:n,sizes:e.spacing})}`},separatorLabel:{color:e.colorScheme===`dark`?e.colors.dark[3]:e.colors.gray[5]}})),xp=Object.defineProperty,Sp=Object.getOwnPropertySymbols,Cp=Object.prototype.hasOwnProperty,wp=Object.prototype.propertyIsEnumerable,Tp=(e,t,n)=>t in e?xp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ep=(e,t)=>{for(var n in t||={})Cp.call(t,n)&&Tp(e,n,t[n]);if(Sp)for(var n of Sp(t))wp.call(t,n)&&Tp(e,n,t[n]);return e};function Dp({data:e,hovered:t,classNames:n,styles:r,isItemSelected:i,uuid:a,__staticSelector:o,onItemHover:s,onItemSelect:c,itemsRefs:l,itemComponent:u,size:d,nothingFound:f,creatable:p,createLabel:m,unstyled:h,variant:g}){let{classes:_}=bp(null,{classNames:n,styles:r,unstyled:h,name:o,variant:g,size:d}),v=[],y=[],b=null,x=(e,n)=>{let r=typeof i==`function`&&i(e.value);return Z.createElement(u,Ep({key:e.value,className:_.item,"data-disabled":e.disabled||void 0,"data-hovered":!e.disabled&&t===n||void 0,"data-selected":!e.disabled&&r||void 0,selected:r,onMouseEnter:()=>s(n),id:`${a}-${n}`,role:`option`,tabIndex:-1,"aria-selected":t===n,ref:t=>{l&&l.current&&(l.current[e.value]=t)},onMouseDown:e.disabled?null:t=>{t.preventDefault(),c(e)},disabled:e.disabled,variant:g},e))},S=null;if(e.forEach((e,t)=>{e.creatable?b=t:e.group?(S!==e.group&&(S=e.group,y.push(Z.createElement(`div`,{className:_.separator,key:`__mantine-divider-${t}`},Z.createElement(up,{classNames:{label:_.separatorLabel},label:e.group})))),y.push(x(e,t))):v.push(x(e,t))}),p){let n=e[b];v.push(Z.createElement(`div`,{key:rd(),className:_.item,"data-hovered":t===b||void 0,onMouseEnter:()=>s(b),onMouseDown:e=>{e.preventDefault(),c(n)},tabIndex:-1,ref:e=>{l&&l.current&&(l.current[n.value]=e)}},m))}return y.length>0&&v.length>0&&v.unshift(Z.createElement(`div`,{className:_.separator,key:`empty-group-separator`},Z.createElement(up,null))),y.length>0||v.length>0?Z.createElement(Z.Fragment,null,y,v):Z.createElement(ai,{size:d,unstyled:h,className:_.nothingFound},f)}Dp.displayName=`@mantine/core/SelectItems`;var Op=Object.defineProperty,kp=Object.getOwnPropertySymbols,Ap=Object.prototype.hasOwnProperty,jp=Object.prototype.propertyIsEnumerable,Mp=(e,t,n)=>t in e?Op(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Np=(e,t)=>{for(var n in t||={})Ap.call(t,n)&&Mp(e,n,t[n]);if(kp)for(var n of kp(t))jp.call(t,n)&&Mp(e,n,t[n]);return e},Pp=(e,t)=>{var n={};for(var r in e)Ap.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&kp)for(var r of kp(e))t.indexOf(r)<0&&jp.call(e,r)&&(n[r]=e[r]);return n},Fp=(0,Z.forwardRef)((e,t)=>{var n=e,{label:r,value:i}=n,a=Pp(n,[`label`,`value`]);return Z.createElement(`div`,Np({ref:t},a),r||i)});Fp.displayName=`@mantine/core/DefaultItem`;function Ip(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}function Lp(...e){return t=>e.forEach(e=>Ip(e,t))}function Rp(...e){return(0,Z.useCallback)(Lp(...e),e)}var zp=(0,Z.forwardRef)((e,t)=>{let{children:n,...r}=e,i=Z.Children.toArray(n),a=i.find(Hp);if(a){let e=a.props.children,n=i.map(t=>t===a?Z.Children.count(e)>1?Z.Children.only(null):(0,Z.isValidElement)(e)?e.props.children:null:t);return(0,Z.createElement)(Bp,br({},r,{ref:t}),(0,Z.isValidElement)(e)?(0,Z.cloneElement)(e,void 0,n):null)}return(0,Z.createElement)(Bp,br({},r,{ref:t}),n)});zp.displayName=`Slot`;var Bp=(0,Z.forwardRef)((e,t)=>{let{children:n,...r}=e;return(0,Z.isValidElement)(n)?(0,Z.cloneElement)(n,{...Up(r,n.props),ref:Lp(t,n.ref)}):Z.Children.count(n)>1?Z.Children.only(null):null});Bp.displayName=`SlotClone`;var Vp=({children:e})=>(0,Z.createElement)(Z.Fragment,null,e);function Hp(e){return(0,Z.isValidElement)(e)&&e.type===Vp}function Up(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{a(...e),i(...e)}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}var Wp=[`a`,`button`,`div`,`h2`,`h3`,`img`,`label`,`li`,`nav`,`ol`,`p`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=(0,Z.forwardRef)((e,n)=>{let{asChild:r,...i}=e,a=r?zp:t;return(0,Z.useEffect)(()=>{window[Symbol.for(`radix-ui`)]=!0},[]),(0,Z.createElement)(a,br({},i,{ref:n}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Gp=globalThis!=null&&globalThis.document?Z.useLayoutEffect:()=>{};function Kp(e,t){return(0,Z.useReducer)((e,n)=>t[e][n]??e,e)}var qp=e=>{let{present:t,children:n}=e,r=Jp(t),i=typeof n==`function`?n({present:r.isPresent}):Z.Children.only(n),a=Rp(r.ref,i.ref);return typeof n==`function`||r.isPresent?(0,Z.cloneElement)(i,{ref:a}):null};qp.displayName=`Presence`;function Jp(e){let[t,n]=(0,Z.useState)(),r=(0,Z.useRef)({}),i=(0,Z.useRef)(e),a=(0,Z.useRef)(`none`),[o,s]=Kp(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return(0,Z.useEffect)(()=>{let e=Yp(r.current);a.current=o===`mounted`?e:`none`},[o]),Gp(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Yp(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Gp(()=>{if(t){let e=e=>{let n=Yp(r.current).includes(e.animationName);e.target===t&&n&&(0,vf.flushSync)(()=>s(`ANIMATION_END`))},n=e=>{e.target===t&&(a.current=Yp(r.current))};return t.addEventListener(`animationstart`,n),t.addEventListener(`animationcancel`,e),t.addEventListener(`animationend`,e),()=>{t.removeEventListener(`animationstart`,n),t.removeEventListener(`animationcancel`,e),t.removeEventListener(`animationend`,e)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:(0,Z.useCallback)(e=>{e&&(r.current=getComputedStyle(e)),n(e)},[])}}function Yp(e){return e?.animationName||`none`}function Xp(e,t=[]){let n=[];function r(t,r){let i=(0,Z.createContext)(r),a=n.length;n=[...n,r];function o(t){let{scope:n,children:r,...o}=t,s=n?.[e][a]||i,c=(0,Z.useMemo)(()=>o,Object.values(o));return(0,Z.createElement)(s.Provider,{value:c},r)}function s(n,o){let s=(0,Z.useContext)(o?.[e][a]||i);if(s)return s;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return o.displayName=t+`Provider`,[o,s]}let i=()=>{let t=n.map(e=>(0,Z.createContext)(e));return function(n){let r=n?.[e]||t;return(0,Z.useMemo)(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Zp(i,...t)]}function Zp(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return(0,Z.useMemo)(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function Qp(e){let t=(0,Z.useRef)(e);return(0,Z.useEffect)(()=>{t.current=e}),(0,Z.useMemo)(()=>(...e)=>t.current?.call(t,...e),[])}var $p=(0,Z.createContext)(void 0);function em(e){let t=(0,Z.useContext)($p);return e||t||`ltr`}function tm(e,[t,n]){return Math.min(n,Math.max(t,e))}function nm(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function rm(e,t){return(0,Z.useReducer)((e,n)=>t[e][n]??e,e)}var im=`ScrollArea`,[am,Aee]=Xp(im),[om,sm]=am(im),cm=(0,Z.forwardRef)((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=(0,Z.useState)(null),[l,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(0),[y,b]=(0,Z.useState)(0),[x,S]=(0,Z.useState)(!1),[C,w]=(0,Z.useState)(!1),T=Rp(t,e=>c(e)),E=em(i);return(0,Z.createElement)(om,{scope:n,type:r,dir:E,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:x,onScrollbarXEnabledChange:S,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:C,onScrollbarYEnabledChange:w,onCornerWidthChange:v,onCornerHeightChange:b},(0,Z.createElement)(Wp.div,br({dir:E},o,{ref:T,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":y+`px`,...e.style}})))}),lm=`ScrollAreaViewport`,um=(0,Z.forwardRef)((e,t)=>{let{__scopeScrollArea:n,children:r,...i}=e,a=sm(lm,n),o=Rp(t,(0,Z.useRef)(null),a.onViewportChange);return(0,Z.createElement)(Z.Fragment,null,(0,Z.createElement)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`}}),(0,Z.createElement)(Wp.div,br({"data-radix-scroll-area-viewport":``},i,{ref:o,style:{overflowX:a.scrollbarXEnabled?`scroll`:`hidden`,overflowY:a.scrollbarYEnabled?`scroll`:`hidden`,...e.style}}),(0,Z.createElement)(`div`,{ref:a.onContentChange,style:{minWidth:`100%`,display:`table`}},r)))}),dm=`ScrollAreaScrollbar`,fm=(0,Z.forwardRef)((e,t)=>{let{forceMount:n,...r}=e,i=sm(dm,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return(0,Z.useEffect)(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,Z.createElement)(pm,br({},r,{ref:t,forceMount:n})):i.type===`scroll`?(0,Z.createElement)(mm,br({},r,{ref:t,forceMount:n})):i.type===`auto`?(0,Z.createElement)(hm,br({},r,{ref:t,forceMount:n})):i.type===`always`?(0,Z.createElement)(gm,br({},r,{ref:t})):null}),pm=(0,Z.forwardRef)((e,t)=>{let{forceMount:n,...r}=e,i=sm(dm,e.__scopeScrollArea),[a,o]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{let e=i.scrollArea,t=0;if(e){let n=()=>{window.clearTimeout(t),o(!0)},r=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,Z.createElement)(qp,{present:n||a},(0,Z.createElement)(hm,br({"data-state":a?`visible`:`hidden`},r,{ref:t})))}),mm=(0,Z.forwardRef)((e,t)=>{let{forceMount:n,...r}=e,i=sm(dm,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=Im(()=>c(`SCROLL_END`),100),[s,c]=rm(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return(0,Z.useEffect)(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),(0,Z.useEffect)(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,Z.createElement)(qp,{present:n||s!==`hidden`},(0,Z.createElement)(gm,br({"data-state":s===`hidden`?`hidden`:`visible`},r,{ref:t,onPointerEnter:nm(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:nm(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})))}),hm=(0,Z.forwardRef)((e,t)=>{let n=sm(dm,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=(0,Z.useState)(!1),s=e.orientation===`horizontal`,c=Im(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return Lm(n.viewport,c),Lm(n.content,c),(0,Z.createElement)(qp,{present:r||a},(0,Z.createElement)(gm,br({"data-state":a?`visible`:`hidden`},i,{ref:t})))}),gm=(0,Z.forwardRef)((e,t)=>{let{orientation:n=`vertical`,...r}=e,i=sm(dm,e.__scopeScrollArea),a=(0,Z.useRef)(null),o=(0,Z.useRef)(0),[s,c]=(0,Z.useState)({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=km(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function d(e,t){return jm(e,o.current,s,t)}return n===`horizontal`?(0,Z.createElement)(_m,br({},u,{ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=Mm(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}})):n===`vertical`?(0,Z.createElement)(vm,br({},u,{ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=Mm(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}})):null}),_m=(0,Z.forwardRef)((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=sm(dm,e.__scopeScrollArea),[o,s]=(0,Z.useState)(),c=(0,Z.useRef)(null),l=Rp(t,c,a.onScrollbarXChange);return(0,Z.useEffect)(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,Z.createElement)(xm,br({"data-orientation":`horizontal`},i,{ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":Am(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),Pm(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Om(o.paddingLeft),paddingEnd:Om(o.paddingRight)}})}}))}),vm=(0,Z.forwardRef)((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=sm(dm,e.__scopeScrollArea),[o,s]=(0,Z.useState)(),c=(0,Z.useRef)(null),l=Rp(t,c,a.onScrollbarYChange);return(0,Z.useEffect)(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,Z.createElement)(xm,br({"data-orientation":`vertical`},i,{ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":Am(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),Pm(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Om(o.paddingTop),paddingEnd:Om(o.paddingBottom)}})}}))}),[ym,bm]=am(dm),xm=(0,Z.forwardRef)((e,t)=>{let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:d,...f}=e,p=sm(dm,n),[m,h]=(0,Z.useState)(null),g=Rp(t,e=>h(e)),_=(0,Z.useRef)(null),v=(0,Z.useRef)(``),y=p.viewport,b=r.content-r.viewport,x=Qp(u),S=Qp(c),C=Im(d,10);function w(e){if(_.current){let t=e.clientX-_.current.left,n=e.clientY-_.current.top;l({x:t,y:n})}}return(0,Z.useEffect)(()=>{let e=e=>{let t=e.target;m?.contains(t)&&x(e,b)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[y,m,b,x]),(0,Z.useEffect)(S,[r,S]),Lm(m,C),Lm(p.content,C),(0,Z.createElement)(ym,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:Qp(a),onThumbPointerUp:Qp(o),onThumbPositionChange:S,onThumbPointerDown:Qp(s)},(0,Z.createElement)(Wp.div,br({},f,{ref:g,style:{position:`absolute`,...f.style},onPointerDown:nm(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),_.current=m.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,w(e))}),onPointerMove:nm(e.onPointerMove,w),onPointerUp:nm(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=v.current,_.current=null})})))}),Sm=`ScrollAreaThumb`,Cm=(0,Z.forwardRef)((e,t)=>{let{forceMount:n,...r}=e,i=bm(Sm,e.__scopeScrollArea);return(0,Z.createElement)(qp,{present:n||i.hasThumb},(0,Z.createElement)(wm,br({ref:t},r)))}),wm=(0,Z.forwardRef)((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,a=sm(Sm,n),o=bm(Sm,n),{onThumbPositionChange:s}=o,c=Rp(t,e=>o.onThumbChange(e)),l=(0,Z.useRef)(),u=Im(()=>{l.current&&=(l.current(),void 0)},100);return(0,Z.useEffect)(()=>{let e=a.viewport;if(e){let t=()=>{if(u(),!l.current){let t=Fm(e,s);l.current=t,s()}};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,Z.createElement)(Wp.div,br({"data-state":o.hasThumb?`visible`:`hidden`},i,{ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:nm(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:nm(e.onPointerUp,o.onThumbPointerUp)}))}),Tm=`ScrollAreaCorner`,Em=(0,Z.forwardRef)((e,t)=>{let n=sm(Tm,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,Z.createElement)(Dm,br({},e,{ref:t})):null}),Dm=(0,Z.forwardRef)((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=sm(Tm,n),[a,o]=(0,Z.useState)(0),[s,c]=(0,Z.useState)(0),l=!!(a&&s);return Lm(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),Lm(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),l?(0,Z.createElement)(Wp.div,br({},r,{ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}})):null});function Om(e){return e?parseInt(e,10):0}function km(e,t){let n=e/t;return isNaN(n)?0:n}function Am(e){let t=km(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function jm(e,t,n,r=`ltr`){let i=Am(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return Nm([c,l],d)(e)}function Mm(e,t,n=`ltr`){let r=Am(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=tm(e,n===`ltr`?[0,o]:[o*-1,0]);return Nm([0,o],[0,s])(c)}function Nm(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Pm(e,t){return e>0&&e<t}var Fm=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function Im(e,t){let n=Qp(e),r=(0,Z.useRef)(0);return(0,Z.useEffect)(()=>()=>window.clearTimeout(r.current),[]),(0,Z.useCallback)(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Lm(e,t){let n=Qp(t);Gp(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var Rm=cm,zm=um,Bm=fm,Vm=Cm,Hm=Em,Um=Rr((e,{scrollbarSize:t,offsetScrollbars:n,scrollbarHovered:r,hidden:i})=>({root:{overflow:`hidden`},viewport:{width:`100%`,height:`100%`,paddingRight:n?J(t):void 0,paddingBottom:n?J(t):void 0},scrollbar:{display:i?`none`:`flex`,userSelect:`none`,touchAction:`none`,boxSizing:`border-box`,padding:`calc(${J(t)} / 5)`,transition:`background-color 150ms ease, opacity 150ms ease`,"&:hover":{backgroundColor:e.colorScheme===`dark`?e.colors.dark[8]:e.colors.gray[0],[`& .${Ou(`thumb`)}`]:{backgroundColor:e.colorScheme===`dark`?e.fn.rgba(e.white,.5):e.fn.rgba(e.black,.5)}},'&[data-orientation="vertical"]':{width:J(t)},'&[data-orientation="horizontal"]':{flexDirection:`column`,height:J(t)},'&[data-state="hidden"]':{display:`none`,opacity:0}},thumb:{ref:Ou(`thumb`),flex:1,backgroundColor:e.colorScheme===`dark`?e.fn.rgba(e.white,.4):e.fn.rgba(e.black,.4),borderRadius:J(t),position:`relative`,transition:`background-color 150ms ease`,display:i?`none`:void 0,overflow:`hidden`,"&::before":{content:`""`,position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,width:`100%`,height:`100%`,minWidth:J(44),minHeight:J(44)}},corner:{backgroundColor:e.colorScheme===`dark`?e.colors.dark[6]:e.colors.gray[0],transition:`opacity 150ms ease`,opacity:+!!r,display:i?`none`:void 0}})),Wm=Object.defineProperty,Gm=Object.defineProperties,Km=Object.getOwnPropertyDescriptors,qm=Object.getOwnPropertySymbols,Jm=Object.prototype.hasOwnProperty,Ym=Object.prototype.propertyIsEnumerable,Xm=(e,t,n)=>t in e?Wm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zm=(e,t)=>{for(var n in t||={})Jm.call(t,n)&&Xm(e,n,t[n]);if(qm)for(var n of qm(t))Ym.call(t,n)&&Xm(e,n,t[n]);return e},Qm=(e,t)=>Gm(e,Km(t)),$m=(e,t)=>{var n={};for(var r in e)Jm.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&qm)for(var r of qm(e))t.indexOf(r)<0&&Ym.call(e,r)&&(n[r]=e[r]);return n},eh={scrollbarSize:12,scrollHideDelay:1e3,type:`hover`,offsetScrollbars:!1},th=(0,Z.forwardRef)((e,t)=>{let n=X(`ScrollArea`,eh,e),{children:r,className:i,classNames:a,styles:o,scrollbarSize:s,scrollHideDelay:c,type:l,dir:u,offsetScrollbars:d,viewportRef:f,onScrollPositionChange:p,unstyled:m,variant:h,viewportProps:g}=n,_=$m(n,[`children`,`className`,`classNames`,`styles`,`scrollbarSize`,`scrollHideDelay`,`type`,`dir`,`offsetScrollbars`,`viewportRef`,`onScrollPositionChange`,`unstyled`,`variant`,`viewportProps`]),[v,y]=(0,Z.useState)(!1),b=Zr(),{classes:x,cx:S}=Um({scrollbarSize:s,offsetScrollbars:d,scrollbarHovered:v,hidden:l===`never`},{name:`ScrollArea`,classNames:a,styles:o,unstyled:m,variant:h});return Z.createElement(Rm,{type:l===`never`?`always`:l,scrollHideDelay:c,dir:u||b.dir,ref:t,asChild:!0},Z.createElement(Ir,Zm({className:S(x.root,i)},_),Z.createElement(zm,Qm(Zm({},g),{className:x.viewport,ref:f,onScroll:typeof p==`function`?({currentTarget:e})=>p({x:e.scrollLeft,y:e.scrollTop}):void 0}),r),Z.createElement(Bm,{orientation:`horizontal`,className:x.scrollbar,forceMount:!0,onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1)},Z.createElement(Vm,{className:x.thumb})),Z.createElement(Bm,{orientation:`vertical`,className:x.scrollbar,forceMount:!0,onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1)},Z.createElement(Vm,{className:x.thumb})),Z.createElement(Hm,{className:x.corner})))}),nh=(0,Z.forwardRef)((e,t)=>{let n=X(`ScrollAreaAutosize`,eh,e),{children:r,classNames:i,styles:a,scrollbarSize:o,scrollHideDelay:s,type:c,dir:l,offsetScrollbars:u,viewportRef:d,onScrollPositionChange:f,unstyled:p,sx:m,variant:h,viewportProps:g}=n,_=$m(n,[`children`,`classNames`,`styles`,`scrollbarSize`,`scrollHideDelay`,`type`,`dir`,`offsetScrollbars`,`viewportRef`,`onScrollPositionChange`,`unstyled`,`sx`,`variant`,`viewportProps`]);return Z.createElement(Ir,Qm(Zm({},_),{ref:t,sx:[{display:`flex`},...yu(m)]}),Z.createElement(Ir,{sx:{display:`flex`,flexDirection:`column`,flex:1}},Z.createElement(th,{classNames:i,styles:a,scrollHideDelay:s,scrollbarSize:o,type:c,dir:l,offsetScrollbars:u,viewportRef:d,onScrollPositionChange:f,unstyled:p,variant:h,viewportProps:g},r)))});nh.displayName=`@mantine/core/ScrollAreaAutosize`,th.displayName=`@mantine/core/ScrollArea`,th.Autosize=nh;var rh=th,ih=Object.defineProperty,ah=Object.defineProperties,oh=Object.getOwnPropertyDescriptors,sh=Object.getOwnPropertySymbols,ch=Object.prototype.hasOwnProperty,lh=Object.prototype.propertyIsEnumerable,uh=(e,t,n)=>t in e?ih(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dh=(e,t)=>{for(var n in t||={})ch.call(t,n)&&uh(e,n,t[n]);if(sh)for(var n of sh(t))lh.call(t,n)&&uh(e,n,t[n]);return e},fh=(e,t)=>ah(e,oh(t)),ph=(e,t)=>{var n={};for(var r in e)ch.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&sh)for(var r of sh(e))t.indexOf(r)<0&&lh.call(e,r)&&(n[r]=e[r]);return n},mh=(0,Z.forwardRef)((e,t)=>{var n=e,{style:r}=n,i=ph(n,[`style`]);return Z.createElement(rh,fh(dh({},i),{style:dh({width:`100%`},r),viewportProps:{tabIndex:-1},viewportRef:t}),i.children)});mh.displayName=`@mantine/core/SelectScrollArea`;var hh=Rr(()=>({dropdown:{},itemsWrapper:{padding:J(4),display:`flex`,width:`100%`,boxSizing:`border-box`}})),gh=e=>{let{element:t,padding:n}=e;function r(e){return Object.prototype.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(e){return r(t)?t.current==null?{}:Tt({element:t.current,padding:n}).fn(e):t?Tt({element:t,padding:n}).fn(e):{}}}},_h=typeof document<`u`?Z.useLayoutEffect:Z.useEffect;function vh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!vh(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!vh(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function yh(e){let t=Z.useRef(e);return _h(()=>{t.current=e}),t}function bh(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,whileElementsMounted:a,open:o}=e,[s,c]=Z.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[l,u]=Z.useState(r);vh(l,r)||u(r);let d=Z.useRef(null),f=Z.useRef(null),p=Z.useRef(s),m=yh(a),h=yh(i),[g,_]=Z.useState(null),[v,y]=Z.useState(null),b=Z.useCallback(e=>{d.current!==e&&(d.current=e,_(e))},[]),x=Z.useCallback(e=>{f.current!==e&&(f.current=e,y(e))},[]),S=Z.useCallback(()=>{if(!d.current||!f.current)return;let e={placement:t,strategy:n,middleware:l};h.current&&(e.platform=h.current),sn(d.current,f.current,e).then(e=>{let t={...e,isPositioned:!0};C.current&&!vh(p.current,t)&&(p.current=t,vf.flushSync(()=>{c(t)}))})},[l,t,n,h]);_h(()=>{o===!1&&p.current.isPositioned&&(p.current.isPositioned=!1,c(e=>({...e,isPositioned:!1})))},[o]);let C=Z.useRef(!1);_h(()=>(C.current=!0,()=>{C.current=!1}),[]),_h(()=>{if(g&&v){if(m.current)return m.current(g,v,S);S()}},[g,v,S,m]);let w=Z.useMemo(()=>({reference:d,floating:f,setReference:b,setFloating:x}),[b,x]),T=Z.useMemo(()=>({reference:g,floating:v}),[g,v]);return Z.useMemo(()=>({...s,update:S,refs:w,elements:T,reference:b,floating:x}),[s,S,w,T,b,x])}var xh=typeof document<`u`?Z.useLayoutEffect:Z.useEffect,Sh=!1,Ch=0,wh=()=>`floating-ui-`+Ch++;function Th(){let[e,t]=Z.useState(()=>Sh?wh():void 0);return xh(()=>{e??t(wh())},[]),Z.useEffect(()=>{Sh||=!0},[]),e}var Eh=Z.useId||Th;function Dh(){let e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter(e=>e!==n))}}}var Oh=Z.createContext(null),kh=Z.createContext(null),Ah=()=>Z.useContext(Oh)?.id||null,jh=()=>Z.useContext(kh);function Mh(e){return e?.ownerDocument||document}function Nh(){let e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function Ph(){let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(e=>{let{brand:t,version:n}=e;return t+`/`+n}).join(` `):navigator.userAgent}function Fh(e){return Mh(e).defaultView||window}function Ih(e){return e?e instanceof Fh(e).Element:!1}function Lh(e){return e?e instanceof Fh(e).HTMLElement:!1}function Rh(e){return typeof ShadowRoot>`u`?!1:e instanceof Fh(e).ShadowRoot||e instanceof ShadowRoot}function zh(e){if(e.mozInputSource===0&&e.isTrusted)return!0;let t=/Android/i;return(t.test(Nh())||t.test(Ph()))&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Bh(e){return e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType!==`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0}function Vh(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function Hh(e){let t=(0,Z.useRef)(e);return xh(()=>{t.current=e}),t}var Uh=`data-floating-ui-safe-polygon`;function Wh(e,t,n){return n&&!Vh(n)?0:typeof e==`number`?e:e?.[t]}var Gh=function(e,t){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0}=t===void 0?{}:t,{open:c,onOpenChange:l,dataRef:u,events:d,elements:{domReference:f,floating:p},refs:m}=e,h=jh(),g=Ah(),_=Hh(i),v=Hh(r),y=Z.useRef(),b=Z.useRef(),x=Z.useRef(),S=Z.useRef(),C=Z.useRef(!0),w=Z.useRef(!1),T=Z.useRef(()=>{}),E=Z.useCallback(()=>{let e=u.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`},[u]);Z.useEffect(()=>{if(!n)return;function e(){clearTimeout(b.current),clearTimeout(S.current),C.current=!0}return d.on(`dismiss`,e),()=>{d.off(`dismiss`,e)}},[n,d]),Z.useEffect(()=>{if(!n||!_.current||!c)return;function e(){E()&&l(!1)}let t=Mh(p).documentElement;return t.addEventListener(`mouseleave`,e),()=>{t.removeEventListener(`mouseleave`,e)}},[p,c,l,n,_,u,E]);let D=Z.useCallback(function(e){e===void 0&&(e=!0);let t=Wh(v.current,`close`,y.current);t&&!x.current?(clearTimeout(b.current),b.current=setTimeout(()=>l(!1),t)):e&&(clearTimeout(b.current),l(!1))},[v,l]),O=Z.useCallback(()=>{T.current(),x.current=void 0},[]),k=Z.useCallback(()=>{if(w.current){let e=Mh(m.floating.current).body;e.style.pointerEvents=``,e.removeAttribute(Uh),w.current=!1}},[m]);return Z.useEffect(()=>{if(!n)return;function t(){return u.current.openEvent?[`click`,`mousedown`].includes(u.current.openEvent.type):!1}function r(e){if(clearTimeout(b.current),C.current=!1,a&&!Vh(y.current)||o>0&&Wh(v.current,`open`)===0)return;u.current.openEvent=e;let t=Wh(v.current,`open`,y.current);t?b.current=setTimeout(()=>{l(!0)},t):l(!0)}function i(n){if(t())return;T.current();let r=Mh(p);if(clearTimeout(S.current),_.current){c||clearTimeout(b.current),x.current=_.current({...e,tree:h,x:n.clientX,y:n.clientY,onClose(){k(),O(),D()}});let t=x.current;r.addEventListener(`mousemove`,t),T.current=()=>{r.removeEventListener(`mousemove`,t)};return}D()}function d(n){t()||_.current==null||_.current({...e,tree:h,x:n.clientX,y:n.clientY,onClose(){k(),O(),D()}})(n)}if(Ih(f)){let e=f;return c&&e.addEventListener(`mouseleave`,d),p?.addEventListener(`mouseleave`,d),s&&e.addEventListener(`mousemove`,r,{once:!0}),e.addEventListener(`mouseenter`,r),e.addEventListener(`mouseleave`,i),()=>{c&&e.removeEventListener(`mouseleave`,d),p?.removeEventListener(`mouseleave`,d),s&&e.removeEventListener(`mousemove`,r),e.removeEventListener(`mouseenter`,r),e.removeEventListener(`mouseleave`,i)}}},[f,p,n,e,a,o,s,D,O,k,l,c,h,v,_,u]),xh(()=>{var e;if(n&&c&&(e=_.current)!=null&&e.__options.blockPointerEvents&&E()){let e=Mh(p).body;if(e.setAttribute(Uh,``),e.style.pointerEvents=`none`,w.current=!0,Ih(f)&&p){var t;let e=f,n=h==null||(t=h.nodesRef.current.find(e=>e.id===g))==null?void 0:t.context?.elements.floating;return n&&(n.style.pointerEvents=``),e.style.pointerEvents=`auto`,p.style.pointerEvents=`auto`,()=>{e.style.pointerEvents=``,p.style.pointerEvents=``}}}},[n,c,g,p,f,h,_,u,E]),xh(()=>{c||(y.current=void 0,O(),k())},[c,O,k]),Z.useEffect(()=>()=>{O(),clearTimeout(b.current),clearTimeout(S.current),k()},[n,O,k]),Z.useMemo(()=>{if(!n)return{};function e(e){y.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){c||o===0||(clearTimeout(S.current),S.current=setTimeout(()=>{C.current||l(!0)},o))}},floating:{onMouseEnter(){clearTimeout(b.current)},onMouseLeave(){d.emit(`dismiss`,{type:`mouseLeave`,data:{returnFocus:!1}}),D(!1)}}}},[d,n,o,c,l,D])},Kh=Z.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{},isInstantPhase:!1}),qh=()=>Z.useContext(Kh),Jh=e=>{let{children:t,delay:n,timeoutMs:r=0}=e,[i,a]=Z.useReducer((e,t)=>({...e,...t}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),o=Z.useRef(null),s=Z.useCallback(e=>{a({currentId:e})},[]);return xh(()=>{i.currentId?o.current===null?o.current=i.currentId:a({isInstantPhase:!0}):(a({isInstantPhase:!1}),o.current=null)},[i.currentId]),Z.createElement(Kh.Provider,{value:Z.useMemo(()=>({...i,setState:a,setCurrentId:s}),[i,a,s])},t)},Yh=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:i}=t,{currentId:a,setCurrentId:o,initialDelay:s,setState:c,timeoutMs:l}=qh();Z.useEffect(()=>{a&&(c({delay:{open:1,close:Wh(s,`close`)}}),a!==i&&r(!1))},[i,r,c,a,s]),Z.useEffect(()=>{function e(){r(!1),c({delay:s,currentId:null})}if(!n&&a===i)if(l){let t=window.setTimeout(e,l);return()=>{clearTimeout(t)}}else e()},[n,c,a,i,r,s,l]),Z.useEffect(()=>{n&&o(i)},[n,o,i])};function Xh(e){let t=e.activeElement;for(;((n=t)==null?void 0:(r=n.shadowRoot)?.activeElement)!=null;){var n,r;t=t.shadowRoot.activeElement}return t}function Zh(e,t){if(!e||!t)return!1;let n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&Rh(n)){let n=t;do{if(n&&e===n)return!0;n=n.parentNode||n.host}while(n)}return!1}function Qh(e,t){let n=e.filter(e=>e.parentId===t&&e.context?.open)||[],r=n;for(;r.length;)r=e.filter(e=>r?.some(t=>e.parentId===t.id&&e.context?.open))||[],n=n.concat(r);return n}function $h(e){return`composedPath`in e?e.composedPath()[0]:e.target}var eg=Z.useInsertionEffect||(e=>e());function tg(e){let t=Z.useRef(()=>{});return eg(()=>{t.current=e}),Z.useCallback(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function ng(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}var rg={pointerdown:`onPointerDown`,mousedown:`onMouseDown`,click:`onClick`},ig={pointerdown:`onPointerDownCapture`,mousedown:`onMouseDownCapture`,click:`onClickCapture`},ag=function(e){return e===void 0&&(e=!0),{escapeKeyBubbles:typeof e==`boolean`?e:e.escapeKey??!0,outsidePressBubbles:typeof e==`boolean`?e:e.outsidePress??!0}},og=function(e,t){let{open:n,onOpenChange:r,events:i,nodeId:a,elements:{reference:o,domReference:s,floating:c},dataRef:l}=e,{enabled:u=!0,escapeKey:d=!0,outsidePress:f=!0,outsidePressEvent:p=`pointerdown`,referencePress:m=!1,referencePressEvent:h=`pointerdown`,ancestorScroll:g=!1,bubbles:_=!0}=t===void 0?{}:t,v=jh(),y=Ah()!=null,b=tg(typeof f==`function`?f:()=>!1),x=typeof f==`function`?b:f,S=Z.useRef(!1),{escapeKeyBubbles:C,outsidePressBubbles:w}=ag(_);return Z.useEffect(()=>{if(!n||!u)return;l.current.__escapeKeyBubbles=C,l.current.__outsidePressBubbles=w;function e(e){if(e.key===`Escape`){let e=v?Qh(v.nodesRef.current,a):[];if(e.length>0){let t=!0;if(e.forEach(e=>{var n;if((n=e.context)!=null&&n.open&&!e.context.dataRef.current.__escapeKeyBubbles){t=!1;return}}),!t)return}i.emit(`dismiss`,{type:`escapeKey`,data:{returnFocus:{preventScroll:!1}}}),r(!1)}}function t(e){let t=S.current;if(S.current=!1,t||typeof x==`function`&&!x(e))return;let n=$h(e);if(Lh(n)&&c){let t=c.ownerDocument.defaultView||window,r=n.scrollWidth>n.clientWidth,i=n.scrollHeight>n.clientHeight,a=i&&e.offsetX>n.clientWidth;if(i&&t.getComputedStyle(n).direction===`rtl`&&(a=e.offsetX<=n.offsetWidth-n.clientWidth),a||r&&e.offsetY>n.clientHeight)return}let o=v&&Qh(v.nodesRef.current,a).some(t=>ng(e,t.context?.elements.floating));if(ng(e,c)||ng(e,s)||o)return;let l=v?Qh(v.nodesRef.current,a):[];if(l.length>0){let e=!0;if(l.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__outsidePressBubbles){e=!1;return}}),!e)return}i.emit(`dismiss`,{type:`outsidePress`,data:{returnFocus:y?{preventScroll:!0}:zh(e)||Bh(e)}}),r(!1)}function f(){r(!1)}let m=Mh(c);d&&m.addEventListener(`keydown`,e),x&&m.addEventListener(p,t);let h=[];return g&&(Ih(s)&&(h=At(s)),Ih(c)&&(h=h.concat(At(c))),!Ih(o)&&o&&o.contextElement&&(h=h.concat(At(o.contextElement)))),h=h.filter(e=>e!==m.defaultView?.visualViewport),h.forEach(e=>{e.addEventListener(`scroll`,f,{passive:!0})}),()=>{d&&m.removeEventListener(`keydown`,e),x&&m.removeEventListener(p,t),h.forEach(e=>{e.removeEventListener(`scroll`,f)})}},[l,c,s,o,d,x,p,i,v,a,n,r,g,u,C,w,y]),Z.useEffect(()=>{S.current=!1},[x,p]),Z.useMemo(()=>u?{reference:{[rg[h]]:()=>{m&&(i.emit(`dismiss`,{type:`referencePress`,data:{returnFocus:!1}}),r(!1))}},floating:{[ig[p]]:()=>{S.current=!0}}}:{},[u,i,m,p,h,r])},sg=function(e,t){let{open:n,onOpenChange:r,dataRef:i,events:a,refs:o,elements:{floating:s,domReference:c}}=e,{enabled:l=!0,keyboardOnly:u=!0}=t===void 0?{}:t,d=Z.useRef(``),f=Z.useRef(!1),p=Z.useRef();return Z.useEffect(()=>{if(!l)return;let e=Mh(s).defaultView||window;function t(){!n&&Lh(c)&&c===Xh(Mh(c))&&(f.current=!0)}return e.addEventListener(`blur`,t),()=>{e.removeEventListener(`blur`,t)}},[s,c,n,l]),Z.useEffect(()=>{if(!l)return;function e(e){(e.type===`referencePress`||e.type===`escapeKey`)&&(f.current=!0)}return a.on(`dismiss`,e),()=>{a.off(`dismiss`,e)}},[a,l]),Z.useEffect(()=>()=>{clearTimeout(p.current)},[]),Z.useMemo(()=>l?{reference:{onPointerDown(e){let{pointerType:t}=e;d.current=t,f.current=!!(t&&u)},onMouseLeave(){f.current=!1},onFocus(e){f.current||e.type===`focus`&&i.current.openEvent?.type===`mousedown`&&i.current.openEvent&&ng(i.current.openEvent,c)||(i.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){f.current=!1;let t=e.relatedTarget,n=Ih(t)&&t.hasAttribute(`data-floating-ui-focus-guard`)&&t.getAttribute(`data-type`)===`outside`;p.current=setTimeout(()=>{Zh(o.floating.current,t)||Zh(c,t)||n||r(!1)})}}}:{},[l,u,c,o,i,r])},cg=function(e,t){let{open:n}=e,{enabled:r=!0,role:i=`dialog`}=t===void 0?{}:t,a=Eh(),o=Eh();return Z.useMemo(()=>{let e={id:a,role:i};return r?i===`tooltip`?{reference:{"aria-describedby":n?a:void 0},floating:e}:{reference:{"aria-expanded":n?`true`:`false`,"aria-haspopup":i===`alertdialog`?`dialog`:i,"aria-controls":n?a:void 0,...i===`listbox`&&{role:`combobox`},...i===`menu`&&{id:o}},floating:{...e,...i===`menu`&&{"aria-labelledby":o}}}:{}},[r,i,n,a,o])};function lg(e){e===void 0&&(e={});let{open:t=!1,onOpenChange:n,nodeId:r}=e,i=bh(e),a=jh(),o=Z.useRef(null),s=Z.useRef({}),c=Z.useState(()=>Dh())[0],[l,u]=Z.useState(null),d=Z.useCallback(e=>{let t=Ih(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;i.refs.setReference(t)},[i.refs]),f=Z.useCallback(e=>{(Ih(e)||e===null)&&(o.current=e,u(e)),(Ih(i.refs.reference.current)||i.refs.reference.current===null||e!==null&&!Ih(e))&&i.refs.setReference(e)},[i.refs]),p=Z.useMemo(()=>({...i.refs,setReference:f,setPositionReference:d,domReference:o}),[i.refs,f,d]),m=Z.useMemo(()=>({...i.elements,domReference:l}),[i.elements,l]),h=tg(n),g=Z.useMemo(()=>({...i,refs:p,elements:m,dataRef:s,nodeId:r,events:c,open:t,onOpenChange:h}),[i,r,c,t,h,p,m]);return xh(()=>{let e=a?.nodesRef.current.find(e=>e.id===r);e&&(e.context=g)}),Z.useMemo(()=>({...i,context:g,refs:p,reference:f,positionReference:d}),[i,p,g,f,d])}function ug(e,t,n){let r=new Map;return{...n===`floating`&&{tabIndex:-1},...e,...t.map(e=>e?e[n]:null).concat(e).reduce((e,t)=>(t&&Object.entries(t).forEach(t=>{let[n,i]=t;if(n.indexOf(`on`)===0){if(r.has(n)||r.set(n,[]),typeof i==`function`){var a;(a=r.get(n))==null||a.push(i),e[n]=function(){var e,t=[...arguments];(e=r.get(n))==null||e.forEach(e=>e(...t))}}}else e[n]=i}),e),{})}}var dg=function(e){e===void 0&&(e=[]);let t=e,n=Z.useCallback(t=>ug(t,e,`reference`),t),r=Z.useCallback(t=>ug(t,e,`floating`),t),i=Z.useCallback(t=>ug(t,e,`item`),e.map(e=>e?.item));return Z.useMemo(()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:i}),[n,r,i])};function fg({opened:e,floating:t,position:n,positionDependencies:r}){let[i,a]=(0,Z.useState)(0);(0,Z.useEffect)(()=>{if(t.refs.reference.current&&t.refs.floating.current)return It(t.refs.reference.current,t.refs.floating.current,t.update)},[t.refs.reference.current,t.refs.floating.current,e,i,n]),bi(()=>{t.update()},r),bi(()=>{a(e=>e+1)},[e])}function pg(e,t){let n=[Ft(e.offset)];return e.middlewares.shift&&n.push(Lt({limiter:Pt()})),e.middlewares.flip&&n.push(St()),e.middlewares.inline&&n.push(on()),n.push(gh({element:e.arrowRef,padding:e.arrowOffset})),(e.middlewares.size||e.width===`target`)&&n.push(Dt({apply({rects:n,availableWidth:r,availableHeight:i}){let a=t().refs.floating.current?.style??{};e.middlewares.size&&Object.assign(a,{maxWidth:`${r}px`,maxHeight:`${i}px`}),e.width===`target`&&Object.assign(a,{width:`${n.reference.width}px`})}})),n}function mg(e){let[t,n]=pd({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=()=>{var t;(t=e.onClose)==null||t.call(e),n(!1)},i=()=>{var r,i;t?((r=e.onClose)==null||r.call(e),n(!1)):((i=e.onOpen)==null||i.call(e),n(!0))},a=lg({placement:e.position,middleware:pg(e,()=>a)});return fg({opened:e.opened,position:e.position,positionDependencies:e.positionDependencies,floating:a}),bi(()=>{var t;(t=e.onPositionChange)==null||t.call(e,a.placement)},[a.placement]),bi(()=>{var t,n;e.opened?(n=e.onOpen)==null||n.call(e):(t=e.onClose)==null||t.call(e)},[e.opened]),{floating:a,controlled:typeof e.opened==`boolean`,opened:t,onClose:r,onToggle:i}}var hg={context:`Popover component was not found in the tree`,children:`Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`},[gg,_g]=vu(hg.context),vg=Object.defineProperty,yg=Object.defineProperties,bg=Object.getOwnPropertyDescriptors,xg=Object.getOwnPropertySymbols,Sg=Object.prototype.hasOwnProperty,Cg=Object.prototype.propertyIsEnumerable,wg=(e,t,n)=>t in e?vg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Tg=(e,t)=>{for(var n in t||={})Sg.call(t,n)&&wg(e,n,t[n]);if(xg)for(var n of xg(t))Cg.call(t,n)&&wg(e,n,t[n]);return e},Eg=(e,t)=>yg(e,bg(t)),Dg=(e,t)=>{var n={};for(var r in e)Sg.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&xg)for(var r of xg(e))t.indexOf(r)<0&&Cg.call(e,r)&&(n[r]=e[r]);return n},Og={refProp:`ref`,popupType:`dialog`,shouldOverrideDefaultTargetId:!0},kg=(0,Z.forwardRef)((e,t)=>{let n=X(`PopoverTarget`,Og,e),{children:r,refProp:i,popupType:a,shouldOverrideDefaultTargetId:o}=n,s=Dg(n,[`children`,`refProp`,`popupType`,`shouldOverrideDefaultTargetId`]);if(!Tu(r))throw Error(hg.children);let c=s,l=_g(),u=fd(l.reference,r.ref,t),d=l.withRoles?{"aria-haspopup":a,"aria-expanded":l.opened,"aria-controls":l.getDropdownId(),id:o?l.getTargetId():r.props.id}:{};return(0,Z.cloneElement)(r,Tg(Eg(Tg(Tg(Tg({},c),d),l.targetProps),{className:pr(l.targetProps.className,c.className,r.props.className),[i]:u}),l.controlled?null:{onClick:l.onToggle}))});kg.displayName=`@mantine/core/PopoverTarget`;var Ag=Rr((e,{radius:t,shadow:n})=>({dropdown:{position:`absolute`,backgroundColor:e.white,background:e.colorScheme===`dark`?e.colors.dark[6]:e.white,border:`${J(1)} solid ${e.colorScheme===`dark`?e.colors.dark[4]:e.colors.gray[2]}`,padding:`${e.spacing.sm} ${e.spacing.md}`,boxShadow:e.shadows[n]||n||`none`,borderRadius:e.fn.radius(t),"&:focus":{outline:0}},arrow:{backgroundColor:`inherit`,border:`${J(1)} solid ${e.colorScheme===`dark`?e.colors.dark[4]:e.colors.gray[2]}`,zIndex:1}})),jg=Object.defineProperty,Mg=Object.getOwnPropertySymbols,Ng=Object.prototype.hasOwnProperty,Pg=Object.prototype.propertyIsEnumerable,Fg=(e,t,n)=>t in e?jg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ig=(e,t)=>{for(var n in t||={})Ng.call(t,n)&&Fg(e,n,t[n]);if(Mg)for(var n of Mg(t))Pg.call(t,n)&&Fg(e,n,t[n]);return e},Lg={entering:`in`,entered:`in`,exiting:`out`,exited:`out`,"pre-exiting":`out`,"pre-entering":`out`};function Rg({transition:e,state:t,duration:n,timingFunction:r}){let i={transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e==`string`?e in zu?Ig(Ig(Ig({transitionProperty:zu[e].transitionProperty},i),zu[e].common),zu[e][Lg[t]]):null:Ig(Ig(Ig({transitionProperty:e.transitionProperty},i),e.common),e[Lg[t]])}function zg({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:i,onExit:a,onEntered:o,onExited:s}){let c=Zr(),l=md(),u=c.respectReducedMotion?l:!1,[d,f]=(0,Z.useState)(u?0:e),[p,m]=(0,Z.useState)(r?`entered`:`exited`),h=(0,Z.useRef)(-1),g=n=>{let r=n?i:a,c=n?o:s;m(n?`pre-entering`:`pre-exiting`),window.clearTimeout(h.current);let l=u?0:n?e:t;if(f(l),l===0)typeof r==`function`&&r(),typeof c==`function`&&c(),m(n?`entered`:`exited`);else{let e=window.setTimeout(()=>{typeof r==`function`&&r(),m(n?`entering`:`exiting`)},10);h.current=window.setTimeout(()=>{window.clearTimeout(e),typeof c==`function`&&c(),m(n?`entered`:`exited`)},l)}};return bi(()=>{g(r)},[r]),(0,Z.useEffect)(()=>()=>window.clearTimeout(h.current),[]),{transitionDuration:d,transitionStatus:p,transitionTimingFunction:n||c.transitionTimingFunction}}function Bg({keepMounted:e,transition:t,duration:n=250,exitDuration:r=n,mounted:i,children:a,timingFunction:o,onExit:s,onEntered:c,onEnter:l,onExited:u}){let{transitionDuration:d,transitionStatus:f,transitionTimingFunction:p}=zg({mounted:i,exitDuration:r,duration:n,timingFunction:o,onExit:s,onEntered:c,onEnter:l,onExited:u});return d===0?i?Z.createElement(Z.Fragment,null,a({})):e?a({display:`none`}):null:f===`exited`?e?a({display:`none`}):null:Z.createElement(Z.Fragment,null,a(Rg({transition:t,duration:d,state:f,timingFunction:p})))}Bg.displayName=`@mantine/core/Transition`;function Vg({children:e,active:t=!0,refProp:n=`ref`}){let r=fd(ad(t),e?.ref);return Tu(e)?(0,Z.cloneElement)(e,{[n]:r}):e}Vg.displayName=`@mantine/core/FocusTrap`;var Hg=Object.defineProperty,Ug=Object.defineProperties,Wg=Object.getOwnPropertyDescriptors,Gg=Object.getOwnPropertySymbols,Kg=Object.prototype.hasOwnProperty,qg=Object.prototype.propertyIsEnumerable,Jg=(e,t,n)=>t in e?Hg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yg=(e,t)=>{for(var n in t||={})Kg.call(t,n)&&Jg(e,n,t[n]);if(Gg)for(var n of Gg(t))qg.call(t,n)&&Jg(e,n,t[n]);return e},Xg=(e,t)=>Ug(e,Wg(t));function Zg(e,t,n,r){return e===`center`||r===`center`?{top:t}:e===`end`?{bottom:n}:e===`start`?{top:n}:{}}function Qg(e,t,n,r,i){return e===`center`||r===`center`?{left:t}:e===`end`?{[i===`ltr`?`right`:`left`]:n}:e===`start`?{[i===`ltr`?`left`:`right`]:n}:{}}var $g={bottom:`borderTopLeftRadius`,left:`borderTopRightRadius`,right:`borderBottomLeftRadius`,top:`borderBottomRightRadius`};function e_({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:i,arrowX:a,arrowY:o,dir:s}){let[c,l=`center`]=e.split(`-`),u={width:J(t),height:J(t),transform:`rotate(45deg)`,position:`absolute`,[$g[c]]:J(r)},d=J(-t/2);return c===`left`?Xg(Yg(Yg({},u),Zg(l,o,n,i)),{right:d,borderLeftColor:`transparent`,borderBottomColor:`transparent`}):c===`right`?Xg(Yg(Yg({},u),Zg(l,o,n,i)),{left:d,borderRightColor:`transparent`,borderTopColor:`transparent`}):c===`top`?Xg(Yg(Yg({},u),Qg(l,a,n,i,s)),{bottom:d,borderTopColor:`transparent`,borderLeftColor:`transparent`}):c===`bottom`?Xg(Yg(Yg({},u),Qg(l,a,n,i,s)),{top:d,borderBottomColor:`transparent`,borderRightColor:`transparent`}):{}}var t_=Object.defineProperty,n_=Object.defineProperties,r_=Object.getOwnPropertyDescriptors,i_=Object.getOwnPropertySymbols,a_=Object.prototype.hasOwnProperty,o_=Object.prototype.propertyIsEnumerable,s_=(e,t,n)=>t in e?t_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,c_=(e,t)=>{for(var n in t||={})a_.call(t,n)&&s_(e,n,t[n]);if(i_)for(var n of i_(t))o_.call(t,n)&&s_(e,n,t[n]);return e},l_=(e,t)=>n_(e,r_(t)),u_=(e,t)=>{var n={};for(var r in e)a_.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&i_)for(var r of i_(e))t.indexOf(r)<0&&o_.call(e,r)&&(n[r]=e[r]);return n},d_=(0,Z.forwardRef)((e,t)=>{var n=e,{position:r,arrowSize:i,arrowOffset:a,arrowRadius:o,arrowPosition:s,visible:c,arrowX:l,arrowY:u}=n,d=u_(n,[`position`,`arrowSize`,`arrowOffset`,`arrowRadius`,`arrowPosition`,`visible`,`arrowX`,`arrowY`]);let f=Zr();return c?Z.createElement(`div`,l_(c_({},d),{ref:t,style:e_({position:r,arrowSize:i,arrowOffset:a,arrowRadius:o,arrowPosition:s,dir:f.dir,arrowX:l,arrowY:u})})):null});d_.displayName=`@mantine/core/FloatingArrow`;var f_=Object.defineProperty,p_=Object.defineProperties,m_=Object.getOwnPropertyDescriptors,h_=Object.getOwnPropertySymbols,g_=Object.prototype.hasOwnProperty,__=Object.prototype.propertyIsEnumerable,v_=(e,t,n)=>t in e?f_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,y_=(e,t)=>{for(var n in t||={})g_.call(t,n)&&v_(e,n,t[n]);if(h_)for(var n of h_(t))__.call(t,n)&&v_(e,n,t[n]);return e},b_=(e,t)=>p_(e,m_(t)),x_=(e,t)=>{var n={};for(var r in e)g_.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&h_)for(var r of h_(e))t.indexOf(r)<0&&__.call(e,r)&&(n[r]=e[r]);return n},S_={};function C_(e){let t=X(`PopoverDropdown`,S_,e),{style:n,className:r,children:i,onKeyDownCapture:a}=t,o=x_(t,[`style`,`className`,`children`,`onKeyDownCapture`]),s=_g(),{classes:c,cx:l}=Ag({radius:s.radius,shadow:s.shadow},{name:s.__staticSelector,classNames:s.classNames,styles:s.styles,unstyled:s.unstyled,variant:s.variant}),u=qu({opened:s.opened,shouldReturnFocus:s.returnFocus}),d=s.withRoles?{"aria-labelledby":s.getTargetId(),id:s.getDropdownId(),role:`dialog`}:{};return s.disabled?null:Z.createElement(Af,b_(y_({},s.portalProps),{withinPortal:s.withinPortal}),Z.createElement(Bg,b_(y_({mounted:s.opened},s.transitionProps),{transition:s.transitionProps.transition||`fade`,duration:s.transitionProps.duration??150,keepMounted:s.keepMounted,exitDuration:typeof s.transitionProps.exitDuration==`number`?s.transitionProps.exitDuration:s.transitionProps.duration}),e=>Z.createElement(Vg,{active:s.trapFocus},Z.createElement(Ir,y_(b_(y_({},d),{tabIndex:-1,ref:s.floating,style:b_(y_(y_({},n),e),{zIndex:s.zIndex,top:s.y??0,left:s.x??0,width:s.width===`target`?void 0:J(s.width)}),className:l(c.dropdown,r),onKeyDownCapture:xu(s.onClose,{active:s.closeOnEscape,onTrigger:u,onKeyDown:a}),"data-position":s.placement}),o),i,Z.createElement(d_,{ref:s.arrowRef,arrowX:s.arrowX,arrowY:s.arrowY,visible:s.withArrow,position:s.placement,arrowSize:s.arrowSize,arrowRadius:s.arrowRadius,arrowOffset:s.arrowOffset,arrowPosition:s.arrowPosition,className:c.arrow})))))}C_.displayName=`@mantine/core/PopoverDropdown`;function w_(e,t){if(e===`rtl`&&(t.includes(`right`)||t.includes(`left`))){let[e,n]=t.split(`-`),r=e===`right`?`left`:`right`;return n===void 0?r:`${r}-${n}`}return t}var T_=Object.getOwnPropertySymbols,E_=Object.prototype.hasOwnProperty,D_=Object.prototype.propertyIsEnumerable,O_=(e,t)=>{var n={};for(var r in e)E_.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&T_)for(var r of T_(e))t.indexOf(r)<0&&D_.call(e,r)&&(n[r]=e[r]);return n},k_={position:`bottom`,offset:8,positionDependencies:[],transitionProps:{transition:`fade`,duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:`side`,closeOnClickOutside:!0,withinPortal:!1,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,clickOutsideEvents:[`mousedown`,`touchstart`],zIndex:Du(`popover`),__staticSelector:`Popover`,width:`max-content`};function A_(e){let t=(0,Z.useRef)(null),n=X(`Popover`,k_,e),{children:r,position:i,offset:a,onPositionChange:o,positionDependencies:s,opened:c,transitionProps:l,width:u,middlewares:d,withArrow:f,arrowSize:p,arrowOffset:m,arrowRadius:h,arrowPosition:g,unstyled:_,classNames:v,styles:y,closeOnClickOutside:b,withinPortal:x,portalProps:S,closeOnEscape:C,clickOutsideEvents:w,trapFocus:T,onClose:E,onOpen:D,onChange:O,zIndex:k,radius:A,shadow:j,id:M,defaultOpened:N,__staticSelector:P,withRoles:F,disabled:I,returnFocus:L,variant:R,keepMounted:z}=n,B=O_(n,`children.position.offset.onPositionChange.positionDependencies.opened.transitionProps.width.middlewares.withArrow.arrowSize.arrowOffset.arrowRadius.arrowPosition.unstyled.classNames.styles.closeOnClickOutside.withinPortal.portalProps.closeOnEscape.clickOutsideEvents.trapFocus.onClose.onOpen.onChange.zIndex.radius.shadow.id.defaultOpened.__staticSelector.withRoles.disabled.returnFocus.variant.keepMounted`.split(`.`)),[V,ee]=(0,Z.useState)(null),[te,H]=(0,Z.useState)(null),ne=cd(M),re=mg({middlewares:d,width:u,position:w_(Zr().dir,i),offset:typeof a==`number`?a+(f?p/2:0):a,arrowRef:t,arrowOffset:m,onPositionChange:o,positionDependencies:s,opened:c,defaultOpened:N,onChange:O,onOpen:D,onClose:E});Vu(()=>re.opened&&b&&re.onClose(),w,[V,te]);let ie=(0,Z.useCallback)(e=>{ee(e),re.floating.reference(e)},[re.floating.reference]),U=(0,Z.useCallback)(e=>{H(e),re.floating.floating(e)},[re.floating.floating]);return Z.createElement(gg,{value:{returnFocus:L,disabled:I,controlled:re.controlled,reference:ie,floating:U,x:re.floating.x,y:re.floating.y,arrowX:re.floating?.middlewareData?.arrow?.x,arrowY:re.floating?.middlewareData?.arrow?.y,opened:re.opened,arrowRef:t,transitionProps:l,width:u,withArrow:f,arrowSize:p,arrowOffset:m,arrowRadius:h,arrowPosition:g,placement:re.floating.placement,trapFocus:T,withinPortal:x,portalProps:S,zIndex:k,radius:A,shadow:j,closeOnEscape:C,onClose:re.onClose,onToggle:re.onToggle,getTargetId:()=>`${ne}-target`,getDropdownId:()=>`${ne}-dropdown`,withRoles:F,targetProps:B,__staticSelector:P,classNames:v,styles:y,unstyled:_,variant:R,keepMounted:z}},r)}A_.Target=kg,A_.Dropdown=C_,A_.displayName=`@mantine/core/Popover`;var j_=Object.defineProperty,M_=Object.getOwnPropertySymbols,N_=Object.prototype.hasOwnProperty,P_=Object.prototype.propertyIsEnumerable,F_=(e,t,n)=>t in e?j_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,I_=(e,t)=>{for(var n in t||={})N_.call(t,n)&&F_(e,n,t[n]);if(M_)for(var n of M_(t))P_.call(t,n)&&F_(e,n,t[n]);return e},L_=(e,t)=>{var n={};for(var r in e)N_.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&M_)for(var r of M_(e))t.indexOf(r)<0&&P_.call(e,r)&&(n[r]=e[r]);return n};function R_(e){var t=e,{children:n,component:r=`div`,maxHeight:i=220,direction:a=`column`,id:o,innerRef:s,__staticSelector:c,styles:l,classNames:u,unstyled:d}=t,f=L_(t,[`children`,`component`,`maxHeight`,`direction`,`id`,`innerRef`,`__staticSelector`,`styles`,`classNames`,`unstyled`]);let{classes:p}=hh(null,{name:c,styles:l,classNames:u,unstyled:d});return Z.createElement(A_.Dropdown,I_({p:0,onMouseDown:e=>e.preventDefault()},f),Z.createElement(`div`,{style:{maxHeight:J(i),display:`flex`}},Z.createElement(Ir,{component:r||`div`,id:`${o}-items`,"aria-labelledby":`${o}-label`,role:`listbox`,onMouseDown:e=>e.preventDefault(),style:{flex:1,overflowY:r===mh?void 0:`auto`},"data-combobox-popover":!0,tabIndex:-1,ref:s},Z.createElement(`div`,{className:p.itemsWrapper,style:{flexDirection:a}},n))))}function z_({opened:e,transitionProps:t={transition:`fade`,duration:0},shadow:n,withinPortal:r,portalProps:i,children:a,__staticSelector:o,onDirectionChange:s,switchDirectionOnFlip:c,zIndex:l,dropdownPosition:u,positionDependencies:d=[],classNames:f,styles:p,unstyled:m,readOnly:h,variant:g}){return Z.createElement(A_,{unstyled:m,classNames:f,styles:p,width:`target`,withRoles:!1,opened:e,middlewares:{flip:u===`flip`,shift:!1},position:u===`flip`?`bottom`:u,positionDependencies:d,zIndex:l,__staticSelector:o,withinPortal:r,portalProps:i,transitionProps:t,shadow:n,disabled:h,onPositionChange:e=>c&&s?.(e===`top`?`column-reverse`:`column`),variant:g},a)}z_.Target=A_.Target,z_.Dropdown=R_;var B_=Object.defineProperty,V_=Object.defineProperties,H_=Object.getOwnPropertyDescriptors,U_=Object.getOwnPropertySymbols,W_=Object.prototype.hasOwnProperty,G_=Object.prototype.propertyIsEnumerable,K_=(e,t,n)=>t in e?B_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,q_=(e,t)=>{for(var n in t||={})W_.call(t,n)&&K_(e,n,t[n]);if(U_)for(var n of U_(t))G_.call(t,n)&&K_(e,n,t[n]);return e},J_=(e,t)=>V_(e,H_(t)),Y_=(e,t)=>{var n={};for(var r in e)W_.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&U_)for(var r of U_(e))t.indexOf(r)<0&&G_.call(e,r)&&(n[r]=e[r]);return n};function X_(e,t,n){let r=X(e,t,n),{label:i,description:a,error:o,required:s,classNames:c,styles:l,className:u,unstyled:d,__staticSelector:f,sx:p,errorProps:m,labelProps:h,descriptionProps:g,wrapperProps:_,id:v,size:y,style:b,inputContainer:x,inputWrapperOrder:S,withAsterisk:C,variant:w}=r,T=Y_(r,[`label`,`description`,`error`,`required`,`classNames`,`styles`,`className`,`unstyled`,`__staticSelector`,`sx`,`errorProps`,`labelProps`,`descriptionProps`,`wrapperProps`,`id`,`size`,`style`,`inputContainer`,`inputWrapperOrder`,`withAsterisk`,`variant`]),E=cd(v),{systemStyles:D,rest:O}=Jr(T),k=q_({label:i,description:a,error:o,required:s,classNames:c,className:u,__staticSelector:f,sx:p,errorProps:m,labelProps:h,descriptionProps:g,unstyled:d,styles:l,id:E,size:y,style:b,inputContainer:x,inputWrapperOrder:S,withAsterisk:C,variant:w},_);return J_(q_({},O),{classNames:c,styles:l,unstyled:d,wrapperProps:q_(q_({},k),D),inputProps:{required:s,classNames:c,styles:l,unstyled:d,id:E,size:y,__staticSelector:f,error:o,variant:w}})}var Z_=Rr((e,t,{size:n})=>({label:{display:`inline-block`,fontSize:Y({size:n,sizes:e.fontSizes}),fontWeight:500,color:e.colorScheme===`dark`?e.colors.dark[0]:e.colors.gray[9],wordBreak:`break-word`,cursor:`default`,WebkitTapHighlightColor:`transparent`},required:{color:e.fn.variant({variant:`filled`,color:`red`}).background}})),Q_=Object.defineProperty,$_=Object.getOwnPropertySymbols,ev=Object.prototype.hasOwnProperty,tv=Object.prototype.propertyIsEnumerable,nv=(e,t,n)=>t in e?Q_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rv=(e,t)=>{for(var n in t||={})ev.call(t,n)&&nv(e,n,t[n]);if($_)for(var n of $_(t))tv.call(t,n)&&nv(e,n,t[n]);return e},iv=(e,t)=>{var n={};for(var r in e)ev.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&$_)for(var r of $_(e))t.indexOf(r)<0&&tv.call(e,r)&&(n[r]=e[r]);return n},av={labelElement:`label`,size:`sm`},ov=(0,Z.forwardRef)((e,t)=>{let n=X(`InputLabel`,av,e),{labelElement:r,children:i,required:a,size:o,classNames:s,styles:c,unstyled:l,className:u,htmlFor:d,__staticSelector:f,variant:p,onMouseDown:m}=n,h=iv(n,[`labelElement`,`children`,`required`,`size`,`classNames`,`styles`,`unstyled`,`className`,`htmlFor`,`__staticSelector`,`variant`,`onMouseDown`]),{classes:g,cx:_}=Z_(null,{name:[`InputWrapper`,f],classNames:s,styles:c,unstyled:l,variant:p,size:o});return Z.createElement(Ir,rv({component:r,ref:t,className:_(g.label,u),htmlFor:r===`label`?d:void 0,onMouseDown:e=>{m?.(e),!e.defaultPrevented&&e.detail>1&&e.preventDefault()}},h),i,a&&Z.createElement(`span`,{className:g.required,"aria-hidden":!0},` *`))});ov.displayName=`@mantine/core/InputLabel`;var sv=Rr((e,t,{size:n})=>({error:{wordBreak:`break-word`,color:e.fn.variant({variant:`filled`,color:`red`}).background,fontSize:`calc(${Y({size:n,sizes:e.fontSizes})} - ${J(2)})`,lineHeight:1.2,display:`block`}})),cv=Object.defineProperty,lv=Object.getOwnPropertySymbols,uv=Object.prototype.hasOwnProperty,dv=Object.prototype.propertyIsEnumerable,fv=(e,t,n)=>t in e?cv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pv=(e,t)=>{for(var n in t||={})uv.call(t,n)&&fv(e,n,t[n]);if(lv)for(var n of lv(t))dv.call(t,n)&&fv(e,n,t[n]);return e},mv=(e,t)=>{var n={};for(var r in e)uv.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&lv)for(var r of lv(e))t.indexOf(r)<0&&dv.call(e,r)&&(n[r]=e[r]);return n},hv={size:`sm`},gv=(0,Z.forwardRef)((e,t)=>{let n=X(`InputError`,hv,e),{children:r,className:i,classNames:a,styles:o,unstyled:s,size:c,__staticSelector:l,variant:u}=n,d=mv(n,[`children`,`className`,`classNames`,`styles`,`unstyled`,`size`,`__staticSelector`,`variant`]),{classes:f,cx:p}=sv(null,{name:[`InputWrapper`,l],classNames:a,styles:o,unstyled:s,variant:u,size:c});return Z.createElement(ai,pv({className:p(f.error,i),ref:t},d),r)});gv.displayName=`@mantine/core/InputError`;var _v=Rr((e,t,{size:n})=>({description:{wordBreak:`break-word`,color:e.colorScheme===`dark`?e.colors.dark[2]:e.colors.gray[6],fontSize:`calc(${Y({size:n,sizes:e.fontSizes})} - ${J(2)})`,lineHeight:1.2,display:`block`}})),vv=Object.defineProperty,yv=Object.getOwnPropertySymbols,bv=Object.prototype.hasOwnProperty,xv=Object.prototype.propertyIsEnumerable,Sv=(e,t,n)=>t in e?vv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cv=(e,t)=>{for(var n in t||={})bv.call(t,n)&&Sv(e,n,t[n]);if(yv)for(var n of yv(t))xv.call(t,n)&&Sv(e,n,t[n]);return e},wv=(e,t)=>{var n={};for(var r in e)bv.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&yv)for(var r of yv(e))t.indexOf(r)<0&&xv.call(e,r)&&(n[r]=e[r]);return n},Tv={size:`sm`},Ev=(0,Z.forwardRef)((e,t)=>{let n=X(`InputDescription`,Tv,e),{children:r,className:i,classNames:a,styles:o,unstyled:s,size:c,__staticSelector:l,variant:u}=n,d=wv(n,[`children`,`className`,`classNames`,`styles`,`unstyled`,`size`,`__staticSelector`,`variant`]),{classes:f,cx:p}=_v(null,{name:[`InputWrapper`,l],classNames:a,styles:o,unstyled:s,variant:u,size:c});return Z.createElement(ai,Cv({color:`dimmed`,className:p(f.description,i),ref:t,unstyled:s},d),r)});Ev.displayName=`@mantine/core/InputDescription`;var Dv=(0,Z.createContext)({offsetBottom:!1,offsetTop:!1,describedBy:void 0}),Ov=Dv.Provider,kv=()=>(0,Z.useContext)(Dv);function Av(e,{hasDescription:t,hasError:n}){let r=e.findIndex(e=>e===`input`),i=e[r-1],a=e[r+1];return{offsetBottom:t&&a===`description`||n&&a===`error`,offsetTop:t&&i===`description`||n&&i===`error`}}var jv=Object.defineProperty,Mv=Object.defineProperties,Nv=Object.getOwnPropertyDescriptors,Pv=Object.getOwnPropertySymbols,Fv=Object.prototype.hasOwnProperty,Iv=Object.prototype.propertyIsEnumerable,Lv=(e,t,n)=>t in e?jv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rv=(e,t)=>{for(var n in t||={})Fv.call(t,n)&&Lv(e,n,t[n]);if(Pv)for(var n of Pv(t))Iv.call(t,n)&&Lv(e,n,t[n]);return e},zv=(e,t)=>Mv(e,Nv(t)),Bv=Rr(e=>({root:zv(Rv({},e.fn.fontStyles()),{lineHeight:e.lineHeight})})),Vv=Object.defineProperty,Hv=Object.defineProperties,Uv=Object.getOwnPropertyDescriptors,Wv=Object.getOwnPropertySymbols,Gv=Object.prototype.hasOwnProperty,Kv=Object.prototype.propertyIsEnumerable,qv=(e,t,n)=>t in e?Vv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jv=(e,t)=>{for(var n in t||={})Gv.call(t,n)&&qv(e,n,t[n]);if(Wv)for(var n of Wv(t))Kv.call(t,n)&&qv(e,n,t[n]);return e},Yv=(e,t)=>Hv(e,Uv(t)),Xv=(e,t)=>{var n={};for(var r in e)Gv.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Wv)for(var r of Wv(e))t.indexOf(r)<0&&Kv.call(e,r)&&(n[r]=e[r]);return n},Zv={labelElement:`label`,size:`sm`,inputContainer:e=>e,inputWrapperOrder:[`label`,`description`,`input`,`error`]},Qv=(0,Z.forwardRef)((e,t)=>{let n=X(`InputWrapper`,Zv,e),{className:r,label:i,children:a,required:o,id:s,error:c,description:l,labelElement:u,labelProps:d,descriptionProps:f,errorProps:p,classNames:m,styles:h,size:g,inputContainer:_,__staticSelector:v,unstyled:y,inputWrapperOrder:b,withAsterisk:x,variant:S}=n,C=Xv(n,[`className`,`label`,`children`,`required`,`id`,`error`,`description`,`labelElement`,`labelProps`,`descriptionProps`,`errorProps`,`classNames`,`styles`,`size`,`inputContainer`,`__staticSelector`,`unstyled`,`inputWrapperOrder`,`withAsterisk`,`variant`]),{classes:w,cx:T}=Bv(null,{classNames:m,styles:h,name:[`InputWrapper`,v],unstyled:y,variant:S,size:g}),E={classNames:m,styles:h,unstyled:y,size:g,variant:S,__staticSelector:v},D=typeof x==`boolean`?x:o,O=s?`${s}-error`:p?.id,k=s?`${s}-description`:f?.id,A=`${c&&typeof c!=`boolean`?O:``} ${l?k:``}`,j=A.trim().length>0?A.trim():void 0,M=i&&Z.createElement(ov,Jv(Jv({key:`label`,labelElement:u,id:s?`${s}-label`:void 0,htmlFor:s,required:D},E),d),i),N=l&&Z.createElement(Ev,Yv(Jv(Jv({key:`description`},f),E),{size:f?.size||E.size,id:f?.id||k}),l),P=Z.createElement(Z.Fragment,{key:`input`},_(a)),F=typeof c!=`boolean`&&c&&Z.createElement(gv,Yv(Jv(Jv({},p),E),{size:p?.size||E.size,key:`error`,id:p?.id||O}),c),I=b.map(e=>{switch(e){case`label`:return M;case`input`:return P;case`description`:return N;case`error`:return F;default:return null}});return Z.createElement(Ov,{value:Jv({describedBy:j},Av(b,{hasDescription:!!N,hasError:!!F}))},Z.createElement(Ir,Jv({className:T(w.root,r),ref:t},C),I))});Qv.displayName=`@mantine/core/InputWrapper`;var $v=Object.defineProperty,ey=Object.getOwnPropertySymbols,ty=Object.prototype.hasOwnProperty,ny=Object.prototype.propertyIsEnumerable,ry=(e,t,n)=>t in e?$v(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,iy=(e,t)=>{for(var n in t||={})ty.call(t,n)&&ry(e,n,t[n]);if(ey)for(var n of ey(t))ny.call(t,n)&&ry(e,n,t[n]);return e},ay=(e,t)=>{var n={};for(var r in e)ty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ey)for(var r of ey(e))t.indexOf(r)<0&&ny.call(e,r)&&(n[r]=e[r]);return n},oy={},sy=(0,Z.forwardRef)((e,t)=>{let n=X(`InputPlaceholder`,oy,e),{sx:r}=n,i=ay(n,[`sx`]);return Z.createElement(Ir,iy({component:`span`,sx:[e=>e.fn.placeholderStyles(),...yu(r)],ref:t},i))});sy.displayName=`@mantine/core/InputPlaceholder`;var cy=Object.defineProperty,ly=Object.defineProperties,uy=Object.getOwnPropertyDescriptors,dy=Object.getOwnPropertySymbols,fy=Object.prototype.hasOwnProperty,py=Object.prototype.propertyIsEnumerable,my=(e,t,n)=>t in e?cy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hy=(e,t)=>{for(var n in t||={})fy.call(t,n)&&my(e,n,t[n]);if(dy)for(var n of dy(t))py.call(t,n)&&my(e,n,t[n]);return e},gy=(e,t)=>ly(e,uy(t)),_y={xs:J(30),sm:J(36),md:J(42),lg:J(50),xl:J(60)},vy=[`default`,`filled`,`unstyled`];function yy({theme:e,variant:t}){return vy.includes(t)?t==="default"?{border:`${J(1)} solid ${e.colorScheme===`dark`?e.colors.dark[4]:e.colors.gray[4]}`,backgroundColor:e.colorScheme===`dark`?e.colors.dark[6]:e.white,transition:`border-color 100ms ease`,"&:focus, &:focus-within":e.focusRingStyles.inputStyles(e)}:t===`filled`?{border:`${J(1)} solid transparent`,backgroundColor:e.colorScheme===`dark`?e.colors.dark[5]:e.colors.gray[1],"&:focus, &:focus-within":e.focusRingStyles.inputStyles(e)}:{borderWidth:0,color:e.colorScheme===`dark`?e.colors.dark[0]:e.black,backgroundColor:`transparent`,minHeight:J(28),outline:0,"&:focus, &:focus-within":{outline:`none`,borderColor:`transparent`},"&:disabled":{backgroundColor:`transparent`,"&:focus, &:focus-within":{outline:`none`,borderColor:`transparent`}}}:null}var by=Rr((e,{multiline:t,radius:n,invalid:r,rightSectionWidth:i,withRightSection:a,iconWidth:o,offsetBottom:s,offsetTop:c,pointer:l},{variant:u,size:d})=>{let f=e.fn.variant({variant:`filled`,color:`red`}).background,p=u==="default"||u===`filled`?{minHeight:Y({size:d,sizes:_y}),paddingLeft:`calc(${Y({size:d,sizes:_y})} / 3)`,paddingRight:a?i||Y({size:d,sizes:_y}):`calc(${Y({size:d,sizes:_y})} / 3)`,borderRadius:e.fn.radius(n)}:u===`unstyled`&&a?{paddingRight:i||Y({size:d,sizes:_y})}:null;return{wrapper:{position:`relative`,marginTop:c?`calc(${e.spacing.xs} / 2)`:void 0,marginBottom:s?`calc(${e.spacing.xs} / 2)`:void 0,"&:has(input:disabled)":{"& .mantine-Input-rightSection":{display:`none`}}},input:gy(hy(hy(gy(hy({},e.fn.fontStyles()),{height:t?u===`unstyled`?void 0:`auto`:Y({size:d,sizes:_y}),WebkitTapHighlightColor:`transparent`,lineHeight:t?e.lineHeight:`calc(${Y({size:d,sizes:_y})} - ${J(2)})`,appearance:`none`,resize:`none`,boxSizing:`border-box`,fontSize:Y({size:d,sizes:e.fontSizes}),width:`100%`,color:e.colorScheme===`dark`?e.colors.dark[0]:e.black,display:`block`,textAlign:`left`,cursor:l?`pointer`:void 0}),yy({theme:e,variant:u})),p),{"&:disabled, &[data-disabled]":{backgroundColor:e.colorScheme===`dark`?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,cursor:`not-allowed`,pointerEvents:`none`,"&::placeholder":{color:e.colors.dark[2]}},"&[data-invalid]":{color:f,borderColor:f,"&::placeholder":{opacity:1,color:f}},"&[data-with-icon]":{paddingLeft:typeof o==`number`?J(o):Y({size:d,sizes:_y})},"&::placeholder":gy(hy({},e.fn.placeholderStyles()),{opacity:1}),"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button, &::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration":{appearance:`none`},"&[type=number]":{MozAppearance:`textfield`}}),icon:{pointerEvents:`none`,position:`absolute`,zIndex:1,left:0,top:0,bottom:0,display:`flex`,alignItems:`center`,justifyContent:`center`,width:o?J(o):Y({size:d,sizes:_y}),color:r?e.colors.red[e.colorScheme===`dark`?6:7]:e.colorScheme===`dark`?e.colors.dark[2]:e.colors.gray[5]},rightSection:{position:`absolute`,top:0,bottom:0,right:0,display:`flex`,alignItems:`center`,justifyContent:`center`,width:i||Y({size:d,sizes:_y})}}}),xy=Object.defineProperty,Sy=Object.defineProperties,Cy=Object.getOwnPropertyDescriptors,wy=Object.getOwnPropertySymbols,Ty=Object.prototype.hasOwnProperty,Ey=Object.prototype.propertyIsEnumerable,Dy=(e,t,n)=>t in e?xy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oy=(e,t)=>{for(var n in t||={})Ty.call(t,n)&&Dy(e,n,t[n]);if(wy)for(var n of wy(t))Ey.call(t,n)&&Dy(e,n,t[n]);return e},ky=(e,t)=>Sy(e,Cy(t)),Ay=(e,t)=>{var n={};for(var r in e)Ty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&wy)for(var r of wy(e))t.indexOf(r)<0&&Ey.call(e,r)&&(n[r]=e[r]);return n},jy={size:`sm`,variant:`default`},My=(0,Z.forwardRef)((e,t)=>{let n=X(`Input`,jy,e),{className:r,error:i,required:a,disabled:o,variant:s,icon:c,style:l,rightSectionWidth:u,iconWidth:d,rightSection:f,rightSectionProps:p,radius:m,size:h,wrapperProps:g,classNames:_,styles:v,__staticSelector:y,multiline:b,sx:x,unstyled:S,pointer:C}=n,w=Ay(n,[`className`,`error`,`required`,`disabled`,`variant`,`icon`,`style`,`rightSectionWidth`,`iconWidth`,`rightSection`,`rightSectionProps`,`radius`,`size`,`wrapperProps`,`classNames`,`styles`,`__staticSelector`,`multiline`,`sx`,`unstyled`,`pointer`]),{offsetBottom:T,offsetTop:E,describedBy:D}=kv(),{classes:O,cx:k}=by({radius:m,multiline:b,invalid:!!i,rightSectionWidth:u?J(u):void 0,iconWidth:d,withRightSection:!!f,offsetBottom:T,offsetTop:E,pointer:C},{classNames:_,styles:v,name:[`Input`,y],unstyled:S,variant:s,size:h}),{systemStyles:A,rest:j}=Jr(w);return Z.createElement(Ir,Oy(Oy({className:k(O.wrapper,r),sx:x,style:l},A),g),c&&Z.createElement(`div`,{className:O.icon},c),Z.createElement(Ir,ky(Oy({component:`input`},j),{ref:t,required:a,"aria-invalid":!!i,"aria-describedby":D,disabled:o,"data-disabled":o||void 0,"data-with-icon":!!c||void 0,"data-invalid":!!i||void 0,className:O.input})),f&&Z.createElement(`div`,ky(Oy({},p),{className:O.rightSection}),f))});My.displayName=`@mantine/core/Input`,My.Wrapper=Qv,My.Label=ov,My.Description=Ev,My.Error=gv,My.Placeholder=sy;var Ny=mr(My),Py={xs:J(12),sm:J(18),md:J(24),lg:J(34),xl:J(42)},jee=Rr((e,{color:t,transitionDuration:n},{size:r})=>{let i=Y({size:r,sizes:Py}),a=t||(e.colorScheme===`dark`?e.white:e.black);return{root:{borderRadius:e.radius.sm,width:`calc(${i} + ${e.spacing.xs})`,height:`calc(${i} + ${e.spacing.xs})`,padding:`calc(${e.spacing.xs} / 2)`,cursor:`pointer`},burger:{position:`relative`,userSelect:`none`,boxSizing:`border-box`,"&, &::before, &::after":{display:`block`,width:i,height:`calc(${i} / 12)`,backgroundColor:a,outline:`${J(1)} solid transparent`,transitionProperty:`background-color, transform`,transitionDuration:`${n}ms`,"@media (prefers-reduced-motion)":{transitionDuration:e.respectReducedMotion?`0ms`:void 0}},"&::before, &::after":{position:`absolute`,content:`""`,left:0},"&::before":{top:`calc((${i} / 3) * -1)`},"&::after":{top:`calc(${i} / 3)`},"&[data-opened]":{backgroundColor:`transparent`,"&::before":{transform:`translateY(calc(${i} / 3)) rotate(45deg)`},"&::after":{transform:`translateY(calc(-${i} / 3)) rotate(-45deg)`}}}}}),Mee=Object.defineProperty,Fy=Object.getOwnPropertySymbols,Iy=Object.prototype.hasOwnProperty,Ly=Object.prototype.propertyIsEnumerable,Ry=(e,t,n)=>t in e?Mee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nee=(e,t)=>{for(var n in t||={})Iy.call(t,n)&&Ry(e,n,t[n]);if(Fy)for(var n of Fy(t))Ly.call(t,n)&&Ry(e,n,t[n]);return e},Pee=(e,t)=>{var n={};for(var r in e)Iy.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Fy)for(var r of Fy(e))t.indexOf(r)<0&&Ly.call(e,r)&&(n[r]=e[r]);return n},Fee={size:`md`,transitionDuration:300},zy=(0,Z.forwardRef)((e,t)=>{let n=X(`Burger`,Fee,e),{className:r,opened:i,color:a,size:o,classNames:s,styles:c,transitionDuration:l,variant:u}=n,d=Pee(n,[`className`,`opened`,`color`,`size`,`classNames`,`styles`,`transitionDuration`,`variant`]),{classes:f,cx:p}=jee({color:a,transitionDuration:l},{classNames:s,styles:c,name:`Burger`,variant:u,size:o});return Z.createElement(Hd,Nee({className:p(f.root,r),ref:t},d),Z.createElement(`div`,{"data-opened":i||void 0,className:f.burger}))});zy.displayName=`@mantine/core/Burger`;var Iee=Rr((e,{radius:t,shadow:n})=>({root:{outline:0,WebkitTapHighlightColor:`transparent`,display:`block`,textDecoration:`none`,color:e.colorScheme===`dark`?e.colors.dark[0]:e.black,backgroundColor:e.colorScheme===`dark`?e.colors.dark[7]:e.white,boxSizing:`border-box`,borderRadius:e.fn.radius(t),boxShadow:e.shadows[n]||n||`none`,"&[data-with-border]":{border:`${J(1)} solid ${e.colorScheme===`dark`?e.colors.dark[4]:e.colors.gray[3]}`}}})),Lee=Object.defineProperty,By=Object.getOwnPropertySymbols,Vy=Object.prototype.hasOwnProperty,Hy=Object.prototype.propertyIsEnumerable,Uy=(e,t,n)=>t in e?Lee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ree=(e,t)=>{for(var n in t||={})Vy.call(t,n)&&Uy(e,n,t[n]);if(By)for(var n of By(t))Hy.call(t,n)&&Uy(e,n,t[n]);return e},zee=(e,t)=>{var n={};for(var r in e)Vy.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&By)for(var r of By(e))t.indexOf(r)<0&&Hy.call(e,r)&&(n[r]=e[r]);return n},Bee={},Wy=(0,Z.forwardRef)((e,t)=>{let n=X(`Paper`,Bee,e),{className:r,children:i,radius:a,withBorder:o,shadow:s,unstyled:c,variant:l}=n,u=zee(n,[`className`,`children`,`radius`,`withBorder`,`shadow`,`unstyled`,`variant`]),{classes:d,cx:f}=Iee({radius:a,shadow:s},{name:`Paper`,unstyled:c,variant:l});return Z.createElement(Ir,Ree({className:f(d.root,r),"data-with-border":o||void 0,ref:t},u),i)});Wy.displayName=`@mantine/core/Paper`;var Gy=mr(Wy),Ky=(0,Z.createContext)(null),Vee=Ky.Provider,Hee=()=>(0,Z.useContext)(Ky),Uee=Object.defineProperty,qy=Object.getOwnPropertySymbols,Jy=Object.prototype.hasOwnProperty,Yy=Object.prototype.propertyIsEnumerable,Xy=(e,t,n)=>t in e?Uee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zy=(e,t)=>{for(var n in t||={})Jy.call(t,n)&&Xy(e,n,t[n]);if(qy)for(var n of qy(t))Yy.call(t,n)&&Xy(e,n,t[n]);return e},Wee=(e,t)=>{var n={};for(var r in e)Jy.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&qy)for(var r of qy(e))t.indexOf(r)<0&&Yy.call(e,r)&&(n[r]=e[r]);return n},Gee={size:`sm`},Qy=(0,Z.forwardRef)((e,t)=>{let n=X(`CheckboxGroup`,Gee,e),{children:r,value:i,defaultValue:a,onChange:o,size:s,wrapperProps:c}=n,l=Wee(n,[`children`,`value`,`defaultValue`,`onChange`,`size`,`wrapperProps`]),[u,d]=pd({value:i,defaultValue:a,finalValue:[],onChange:o});return Z.createElement(Vee,{value:{value:u,onChange:e=>{let t=e.currentTarget.value;d(u.includes(t)?u.filter(e=>e!==t):[...u,t])},size:s}},Z.createElement(Ny.Wrapper,Zy(Zy({labelElement:`div`,size:s,__staticSelector:`CheckboxGroup`,ref:t},c),l),r))});Qy.displayName=`@mantine/core/CheckboxGroup`;var Kee=Object.defineProperty,$y=Object.getOwnPropertySymbols,eb=Object.prototype.hasOwnProperty,tb=Object.prototype.propertyIsEnumerable,nb=(e,t,n)=>t in e?Kee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rb=(e,t)=>{for(var n in t||={})eb.call(t,n)&&nb(e,n,t[n]);if($y)for(var n of $y(t))tb.call(t,n)&&nb(e,n,t[n]);return e},ib=(e,t)=>{var n={};for(var r in e)eb.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&$y)for(var r of $y(e))t.indexOf(r)<0&&tb.call(e,r)&&(n[r]=e[r]);return n};function qee(e){let t=e,{width:n,height:r,style:i}=t,a=ib(t,[`width`,`height`,`style`]);return Z.createElement(`svg`,rb({viewBox:`0 0 10 7`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:rb({width:n,height:r},i)},a),Z.createElement(`path`,{d:`M4 4.586L1.707 2.293A1 1 0 1 0 .293 3.707l3 3a.997.997 0 0 0 1.414 0l5-5A1 1 0 1 0 8.293.293L4 4.586z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`}))}function Jee(e){var t=e,{indeterminate:n}=t,r=ib(t,[`indeterminate`]);return n?Z.createElement(`svg`,rb({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 32 6`},r),Z.createElement(`rect`,{width:`32`,height:`6`,fill:`currentColor`,rx:`3`})):Z.createElement(qee,rb({},r))}var Yee=Object.defineProperty,Xee=Object.defineProperties,Zee=Object.getOwnPropertyDescriptors,ab=Object.getOwnPropertySymbols,Qee=Object.prototype.hasOwnProperty,ob=Object.prototype.propertyIsEnumerable,sb=(e,t,n)=>t in e?Yee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cb=(e,t)=>{for(var n in t||={})Qee.call(t,n)&&sb(e,n,t[n]);if(ab)for(var n of ab(t))ob.call(t,n)&&sb(e,n,t[n]);return e},lb=(e,t)=>Xee(e,Zee(t)),ub={xs:J(16),sm:J(20),md:J(24),lg:J(30),xl:J(36)},db=Rr((e,{radius:t,color:n,transitionDuration:r,labelPosition:i,error:a,indeterminate:o},{size:s})=>{let c=Y({size:s,sizes:ub}),l=e.fn.variant({variant:`filled`,color:n});return{icon:lb(cb({},e.fn.cover()),{ref:Ou(`icon`),color:o?`inherit`:e.white,transform:o?`none`:`translateY(${J(5)}) scale(0.5)`,opacity:+!!o,transitionProperty:`opacity, transform`,transitionTimingFunction:`ease`,transitionDuration:`${r}ms`,pointerEvents:`none`,width:`60%`,position:`absolute`,zIndex:1,margin:`auto`,"@media (prefers-reduced-motion)":{transitionDuration:e.respectReducedMotion?`0ms`:void 0}}),inner:{position:`relative`,width:c,height:c,order:i===`left`?2:1},input:lb(cb({},e.fn.focusStyles()),{appearance:`none`,backgroundColor:e.colorScheme===`dark`?e.colors.dark[6]:e.white,border:`${J(1)} solid ${a?e.fn.variant({variant:`filled`,color:`red`}).background:e.colorScheme===`dark`?e.colors.dark[4]:e.colors.gray[4]}`,width:c,height:c,borderRadius:e.fn.radius(t),padding:0,display:`block`,margin:0,transition:`border-color ${r}ms ease, background-color ${r}ms ease`,cursor:e.cursorType,"&:checked":{backgroundColor:l.background,borderColor:l.background,[`& + .${Ou(`icon`)}`]:{opacity:1,color:e.white,transform:`translateY(0) scale(1)`}},"&:disabled":{backgroundColor:e.colorScheme===`dark`?e.colors.dark[4]:e.colors.gray[2],borderColor:e.colorScheme===`dark`?e.colors.dark[6]:e.colors.gray[3],cursor:`not-allowed`,pointerEvents:`none`,[`& + .${Ou(`icon`)}`]:{color:e.colorScheme===`dark`?e.colors.dark[6]:e.colors.gray[5]}}})}}),fb=Object.defineProperty,pb=Object.defineProperties,mb=Object.getOwnPropertyDescriptors,hb=Object.getOwnPropertySymbols,gb=Object.prototype.hasOwnProperty,_b=Object.prototype.propertyIsEnumerable,vb=(e,t,n)=>t in e?fb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yb=(e,t)=>{for(var n in t||={})gb.call(t,n)&&vb(e,n,t[n]);if(hb)for(var n of hb(t))_b.call(t,n)&&vb(e,n,t[n]);return e},bb=(e,t)=>pb(e,mb(t)),xb={xs:J(16),sm:J(20),md:J(24),lg:J(30),xl:J(36)},Sb=Rr((e,{labelPosition:t},{size:n})=>({root:{},body:{display:`flex`,"&:has(input:disabled) label":{color:e.colorScheme===`dark`?e.colors.dark[3]:e.colors.gray[5]}},labelWrapper:bb(yb({},e.fn.fontStyles()),{display:`inline-flex`,flexDirection:`column`,WebkitTapHighlightColor:`transparent`,fontSize:n in xb?Y({size:n,sizes:e.fontSizes}):void 0,lineHeight:n in xb?Y({size:n,sizes:xb}):void 0,color:e.colorScheme===`dark`?e.colors.dark[0]:e.black,cursor:e.cursorType,order:t===`left`?1:2}),description:{marginTop:`calc(${e.spacing.xs} / 2)`,[t===`left`?`paddingRight`:`paddingLeft`]:e.spacing.sm},error:{marginTop:`calc(${e.spacing.xs} / 2)`,[t===`left`?`paddingRight`:`paddingLeft`]:e.spacing.sm},label:{cursor:e.cursorType,[t===`left`?`paddingRight`:`paddingLeft`]:e.spacing.sm,"&:disabled, &[data-disabled]":{color:e.colorScheme===`dark`?e.colors.dark[3]:e.colors.gray[5]}}})),Cb=Object.defineProperty,wb=Object.getOwnPropertySymbols,Tb=Object.prototype.hasOwnProperty,Eb=Object.prototype.propertyIsEnumerable,Db=(e,t,n)=>t in e?Cb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ob=(e,t)=>{for(var n in t||={})Tb.call(t,n)&&Db(e,n,t[n]);if(wb)for(var n of wb(t))Eb.call(t,n)&&Db(e,n,t[n]);return e},kb=(e,t)=>{var n={};for(var r in e)Tb.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&wb)for(var r of wb(e))t.indexOf(r)<0&&Eb.call(e,r)&&(n[r]=e[r]);return n},Ab=(0,Z.forwardRef)((e,t)=>{var n=e,{__staticSelector:r,className:i,classNames:a,styles:o,unstyled:s,children:c,label:l,description:u,id:d,disabled:f,error:p,size:m,labelPosition:h,bodyElement:g=`div`,labelElement:_=`label`,variant:v}=n,y=kb(n,[`__staticSelector`,`className`,`classNames`,`styles`,`unstyled`,`children`,`label`,`description`,`id`,`disabled`,`error`,`size`,`labelPosition`,`bodyElement`,`labelElement`,`variant`]);let{classes:b,cx:x}=Sb({labelPosition:h},{name:r,styles:o,classNames:a,unstyled:s,variant:v,size:m});return Z.createElement(Ir,Ob({className:x(b.root,i),ref:t},y),Z.createElement(Ir,{component:g,htmlFor:g===`label`?d:void 0,className:x(b.body)},c,Z.createElement(`div`,{className:b.labelWrapper},l!=null&&Z.createElement(Ir,{component:_,htmlFor:_===`label`?d:void 0,className:b.label,"data-disabled":f||void 0},l),u&&Z.createElement(Ny.Description,{className:b.description},u),p&&p!==`boolean`&&Z.createElement(Ny.Error,{className:b.error},p))))});Ab.displayName=`@mantine/core/InlineInput`;var jb=Object.defineProperty,Mb=Object.getOwnPropertySymbols,Nb=Object.prototype.hasOwnProperty,Pb=Object.prototype.propertyIsEnumerable,Fb=(e,t,n)=>t in e?jb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ib=(e,t)=>{for(var n in t||={})Nb.call(t,n)&&Fb(e,n,t[n]);if(Mb)for(var n of Mb(t))Pb.call(t,n)&&Fb(e,n,t[n]);return e},Lb=(e,t)=>{var n={};for(var r in e)Nb.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Mb)for(var r of Mb(e))t.indexOf(r)<0&&Pb.call(e,r)&&(n[r]=e[r]);return n},Rb={size:`sm`,transitionDuration:100,icon:Jee,labelPosition:`right`},zb=(0,Z.forwardRef)((e,t)=>{let n=X(`Checkbox`,Rb,e),{className:r,style:i,sx:a,checked:o,disabled:s,color:c,label:l,indeterminate:u,id:d,size:f,radius:p,wrapperProps:m,children:h,classNames:g,styles:_,transitionDuration:v,icon:y,unstyled:b,labelPosition:x,description:S,error:C,variant:w}=n,T=Lb(n,[`className`,`style`,`sx`,`checked`,`disabled`,`color`,`label`,`indeterminate`,`id`,`size`,`radius`,`wrapperProps`,`children`,`classNames`,`styles`,`transitionDuration`,`icon`,`unstyled`,`labelPosition`,`description`,`error`,`variant`]),E=Hee(),D=cd(d),{systemStyles:O,rest:k}=Jr(T),{classes:A}=db({radius:p,color:c,transitionDuration:v,labelPosition:x,error:!!C,indeterminate:u},{name:`Checkbox`,classNames:g,styles:_,unstyled:b,variant:w,size:E?.size||f}),j=E?{checked:E.value.includes(k.value),onChange:E.onChange}:{};return Z.createElement(Ab,Ib(Ib({className:r,sx:a,style:i,id:D,size:E?.size||f,labelPosition:x,label:l,description:S,error:C,disabled:s,__staticSelector:`Checkbox`,classNames:g,styles:_,unstyled:b,"data-checked":j.checked||void 0,variant:w},O),m),Z.createElement(`div`,{className:A.inner},Z.createElement(`input`,Ib(Ib({id:D,ref:t,type:`checkbox`,className:A.input,checked:o,disabled:s},k),j)),Z.createElement(y,{indeterminate:u,className:A.icon})))});zb.displayName=`@mantine/core/Checkbox`,zb.Group=Qy;var[Bb,Vb]=vu(`Drawer component was not found in tree`),Hb={xs:J(320),sm:J(380),md:J(440),lg:J(620),xl:J(780)},Ub=Rr((e,{position:t},{size:n})=>({header:{zIndex:1e3},content:{flex:t===`right`||t===`left`?`0 0 ${Y({size:n,sizes:Hb})}`:`0 0 100%`,maxWidth:`100%`,maxHeight:`100%`,height:t===`right`||t===`left`?`100%`:Y({size:n,sizes:Hb}),borderRadius:0,overflowY:`auto`},inner:{display:`flex`,justifyContent:t===`right`?`flex-end`:`flex-start`,alignItems:t===`bottom`?`flex-end`:`flex-start`}})),[Wb,Gb]=vu(`ModalBase component was not found in tree`),Kb=Rr(()=>({close:{marginLeft:`auto`,marginRight:0}})),qb=Object.defineProperty,Jb=Object.getOwnPropertySymbols,Yb=Object.prototype.hasOwnProperty,Xb=Object.prototype.propertyIsEnumerable,Zb=(e,t,n)=>t in e?qb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qb=(e,t)=>{for(var n in t||={})Yb.call(t,n)&&Zb(e,n,t[n]);if(Jb)for(var n of Jb(t))Xb.call(t,n)&&Zb(e,n,t[n]);return e},$b=(e,t)=>{var n={};for(var r in e)Yb.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Jb)for(var r of Jb(e))t.indexOf(r)<0&&Xb.call(e,r)&&(n[r]=e[r]);return n},ex={size:`sm`},tx=(0,Z.forwardRef)((e,t)=>{let n=Gb(),r=X(`${n.__staticSelector}CloseButton`,ex,e),{className:i}=r,a=$b(r,[`className`]),{classes:o,cx:s}=Kb(null,n.stylesApi);return Z.createElement(Yf,Qb({className:s(o.close,i),ref:t,onClick:n.onClose},a))}),nx=Rr(()=>({overlay:{}})),rx=Object.defineProperty,ix=Object.defineProperties,ax=Object.getOwnPropertyDescriptors,ox=Object.getOwnPropertySymbols,sx=Object.prototype.hasOwnProperty,cx=Object.prototype.propertyIsEnumerable,lx=(e,t,n)=>t in e?rx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ux=(e,t)=>{for(var n in t||={})sx.call(t,n)&&lx(e,n,t[n]);if(ox)for(var n of ox(t))cx.call(t,n)&&lx(e,n,t[n]);return e},dx=(e,t)=>ix(e,ax(t)),fx=Rr((e,{color:t,opacity:n,blur:r,radius:i,gradient:a,fixed:o,zIndex:s})=>({root:dx(ux({},e.fn.cover(0)),{position:o?`fixed`:`absolute`,backgroundColor:a?void 0:e.fn.rgba(t,n),backgroundImage:a,backdropFilter:r?`blur(${J(r)})`:void 0,borderRadius:e.fn.radius(i),zIndex:s,"&[data-center]":{display:`flex`,alignItems:`center`,justifyContent:`center`}})})),px=Object.defineProperty,mx=Object.getOwnPropertySymbols,hx=Object.prototype.hasOwnProperty,gx=Object.prototype.propertyIsEnumerable,_x=(e,t,n)=>t in e?px(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vx=(e,t)=>{for(var n in t||={})hx.call(t,n)&&_x(e,n,t[n]);if(mx)for(var n of mx(t))gx.call(t,n)&&_x(e,n,t[n]);return e},yx=(e,t)=>{var n={};for(var r in e)hx.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&mx)for(var r of mx(e))t.indexOf(r)<0&&gx.call(e,r)&&(n[r]=e[r]);return n},bx={opacity:.6,color:`#000`,zIndex:Du(`modal`),radius:0},xx=(0,Z.forwardRef)((e,t)=>{let n=X(`Overlay`,bx,e),{variant:r,opacity:i,color:a,blur:o,gradient:s,zIndex:c,radius:l,children:u,className:d,classNames:f,styles:p,unstyled:m,center:h,fixed:g}=n,_=yx(n,[`variant`,`opacity`,`color`,`blur`,`gradient`,`zIndex`,`radius`,`children`,`className`,`classNames`,`styles`,`unstyled`,`center`,`fixed`]),{classes:v,cx:y}=fx({color:a,opacity:i,blur:o,radius:l,gradient:s,fixed:g,zIndex:c},{name:`Overlay`,classNames:f,styles:p,unstyled:m,variant:r});return Z.createElement(Ir,vx({ref:t,className:y(v.root,d),"data-center":h||void 0},_),u)});xx.displayName=`@mantine/core/Overlay`;var Sx=mr(xx),Cx=Object.defineProperty,wx=Object.defineProperties,Tx=Object.getOwnPropertyDescriptors,Ex=Object.getOwnPropertySymbols,Dx=Object.prototype.hasOwnProperty,Ox=Object.prototype.propertyIsEnumerable,kx=(e,t,n)=>t in e?Cx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ax=(e,t)=>{for(var n in t||={})Dx.call(t,n)&&kx(e,n,t[n]);if(Ex)for(var n of Ex(t))Ox.call(t,n)&&kx(e,n,t[n]);return e},jx=(e,t)=>wx(e,Tx(t)),Mx=(e,t)=>{var n={};for(var r in e)Dx.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ex)for(var r of Ex(e))t.indexOf(r)<0&&Ox.call(e,r)&&(n[r]=e[r]);return n},Nx={},Px=(0,Z.forwardRef)((e,t)=>{let n=Gb(),r=X(`${n.__staticSelector}Overlay`,Nx,e),{onClick:i,transitionProps:a,style:o,className:s}=r,c=Mx(r,[`onClick`,`transitionProps`,`style`,`className`]),{classes:l,cx:u}=nx(null,n.stylesApi),d=e=>{i?.(e),n.closeOnClickOutside&&n.onClose()};return Z.createElement(Bg,jx(Ax(Ax({mounted:n.opened},n.transitionProps),a),{transition:`fade`}),e=>Z.createElement(Sx,Ax({ref:t,onClick:d,fixed:!0,style:Ax(Ax({},o),e),className:u(l.overlay,s),zIndex:n.zIndex},c)))}),Fx=Rr((e,{zIndex:t})=>({inner:{position:`fixed`,width:`100%`,top:0,bottom:0,maxHeight:`100%`,zIndex:t,pointerEvents:`none`},content:{pointerEvents:`all`}})),Ix=Object.defineProperty,Lx=Object.getOwnPropertySymbols,Rx=Object.prototype.hasOwnProperty,zx=Object.prototype.propertyIsEnumerable,Bx=(e,t,n)=>t in e?Ix(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vx=(e,t)=>{for(var n in t||={})Rx.call(t,n)&&Bx(e,n,t[n]);if(Lx)for(var n of Lx(t))zx.call(t,n)&&Bx(e,n,t[n]);return e},Hx=(e,t)=>{var n={};for(var r in e)Rx.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Lx)for(var r of Lx(e))t.indexOf(r)<0&&zx.call(e,r)&&(n[r]=e[r]);return n},Ux={},Wx=(0,Z.forwardRef)((e,t)=>{let n=Gb(),r=X(`${n.__staticSelector}Content`,Ux,e),{className:i,transitionProps:a,style:o,onKeyDown:s}=r,c=Hx(r,[`className`,`transitionProps`,`style`,`onKeyDown`]),{classes:l,cx:u}=Fx({zIndex:n.zIndex},n.stylesApi),d=e=>{e.target?.getAttribute(`data-mantine-stop-propagation`)!==`true`&&e.key===`Escape`&&n.closeOnEscape&&n.onClose(),s?.(e)};return Z.createElement(Bg,Vx(Vx({mounted:n.opened,transition:`pop`},n.transitionProps),a),e=>Z.createElement(`div`,{className:u(l.inner)},Z.createElement(Vg,{active:n.opened&&n.trapFocus},Z.createElement(Gy,Vx({component:`section`,role:`dialog`,tabIndex:-1,"aria-modal":!0,"aria-describedby":n.bodyMounted?n.getBodyId():void 0,"aria-labelledby":n.titleMounted?n.getTitleId():void 0,onKeyDown:d,ref:t,className:u(l.content,i),style:Vx(Vx({},o),e),shadow:n.shadow},c),c.children))))}),Gx=Rr((e,{padding:t})=>{let n=Y({size:t,sizes:e.spacing});return{header:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:n,paddingRight:`calc(${n} - ${J(5)})`,position:`sticky`,top:0,backgroundColor:e.colorScheme===`dark`?e.colors.dark[7]:e.white,zIndex:1e3}}}),Kx=Object.defineProperty,qx=Object.getOwnPropertySymbols,Jx=Object.prototype.hasOwnProperty,Yx=Object.prototype.propertyIsEnumerable,Xx=(e,t,n)=>t in e?Kx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zx=(e,t)=>{for(var n in t||={})Jx.call(t,n)&&Xx(e,n,t[n]);if(qx)for(var n of qx(t))Yx.call(t,n)&&Xx(e,n,t[n]);return e},Qx=(e,t)=>{var n={};for(var r in e)Jx.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&qx)for(var r of qx(e))t.indexOf(r)<0&&Yx.call(e,r)&&(n[r]=e[r]);return n},$x={},eS=(0,Z.forwardRef)((e,t)=>{let n=Gb(),r=X(`${n.__staticSelector}Header`,$x,e),{className:i}=r,a=Qx(r,[`className`]),{classes:o,cx:s}=Gx({padding:n.padding},n.stylesApi);return Z.createElement(Ir,Zx({ref:t,className:s(o.header,i)},a))}),tS=Rr(e=>({title:{lineHeight:1,padding:0,margin:0,fontWeight:400,fontSize:e.fontSizes.md}})),nS=Object.defineProperty,rS=Object.getOwnPropertySymbols,iS=Object.prototype.hasOwnProperty,aS=Object.prototype.propertyIsEnumerable,oS=(e,t,n)=>t in e?nS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sS=(e,t)=>{for(var n in t||={})iS.call(t,n)&&oS(e,n,t[n]);if(rS)for(var n of rS(t))aS.call(t,n)&&oS(e,n,t[n]);return e},cS=(e,t)=>{var n={};for(var r in e)iS.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&rS)for(var r of rS(e))t.indexOf(r)<0&&aS.call(e,r)&&(n[r]=e[r]);return n},lS={},uS=(0,Z.forwardRef)((e,t)=>{let n=Gb(),r=X(`${n.__staticSelector}Title`,lS,e),{className:i}=r,a=cS(r,[`className`]),{classes:o,cx:s}=tS(null,n.stylesApi);return(0,Z.useEffect)(()=>(n.setTitleMounted(!0),()=>n.setTitleMounted(!1)),[]),Z.createElement(Ir,sS({component:`h2`,id:n.getTitleId(),className:s(o.title,i),ref:t},a))}),dS=Rr((e,{padding:t})=>({body:{padding:Y({size:t,sizes:e.spacing}),"&:not(:only-child)":{paddingTop:0}}})),fS=Object.defineProperty,pS=Object.getOwnPropertySymbols,mS=Object.prototype.hasOwnProperty,hS=Object.prototype.propertyIsEnumerable,gS=(e,t,n)=>t in e?fS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_S=(e,t)=>{for(var n in t||={})mS.call(t,n)&&gS(e,n,t[n]);if(pS)for(var n of pS(t))hS.call(t,n)&&gS(e,n,t[n]);return e},vS=(e,t)=>{var n={};for(var r in e)mS.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&pS)for(var r of pS(e))t.indexOf(r)<0&&hS.call(e,r)&&(n[r]=e[r]);return n},yS={},bS=(0,Z.forwardRef)((e,t)=>{let n=Gb(),r=X(`${n.__staticSelector}Body`,yS,e),{className:i}=r,a=vS(r,[`className`]),{classes:o,cx:s}=dS({padding:n.padding},n.stylesApi);return(0,Z.useEffect)(()=>(n.setBodyMounted(!0),()=>n.setBodyMounted(!1)),[]),Z.createElement(Ir,_S({id:n.getBodyId(),className:s(o.body,i),ref:t},a))});function xS({children:e}){return Z.createElement(Z.Fragment,null,e)}function SS({opened:e,transitionDuration:t}){let[n,r]=(0,Z.useState)(e),i=(0,Z.useRef)(),a=md()?0:t;return(0,Z.useEffect)(()=>(e?(r(!0),window.clearTimeout(i.current)):a===0?r(!1):i.current=window.setTimeout(()=>r(!1),a),()=>window.clearTimeout(i.current)),[e,a]),n}var CS=Rr(()=>({root:{}})),wS=Object.defineProperty,TS=Object.defineProperties,ES=Object.getOwnPropertyDescriptors,DS=Object.getOwnPropertySymbols,OS=Object.prototype.hasOwnProperty,kS=Object.prototype.propertyIsEnumerable,AS=(e,t,n)=>t in e?wS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jS=(e,t)=>{for(var n in t||={})OS.call(t,n)&&AS(e,n,t[n]);if(DS)for(var n of DS(t))kS.call(t,n)&&AS(e,n,t[n]);return e},MS=(e,t)=>TS(e,ES(t)),NS=(e,t)=>{var n={};for(var r in e)OS.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&DS)for(var r of DS(e))t.indexOf(r)<0&&kS.call(e,r)&&(n[r]=e[r]);return n},PS={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:Du(`modal`),padding:`md`,size:`md`,shadow:`xl`};function FS(e){let t=X(`ModalBase`,PS,e),{opened:n,onClose:r,children:i,closeOnClickOutside:a,__staticSelector:o,transitionProps:s,withinPortal:c,portalProps:l,keepMounted:u,target:d,zIndex:f,lockScroll:p,trapFocus:m,closeOnEscape:h,returnFocus:g,padding:_,shadow:v,id:y,size:b,variant:x,classNames:S,unstyled:C,styles:w,className:T}=t,E=NS(t,[`opened`,`onClose`,`children`,`closeOnClickOutside`,`__staticSelector`,`transitionProps`,`withinPortal`,`portalProps`,`keepMounted`,`target`,`zIndex`,`lockScroll`,`trapFocus`,`closeOnEscape`,`returnFocus`,`padding`,`shadow`,`id`,`size`,`variant`,`classNames`,`unstyled`,`styles`,`className`]),{classes:D,cx:O}=CS(null,{name:o,classNames:S,styles:w,unstyled:C,variant:x,size:b}),k=cd(y),[A,j]=(0,Z.useState)(!1),[M,N]=(0,Z.useState)(!1),P=typeof s?.duration==`number`?s?.duration:200,F=SS({opened:n,transitionDuration:P});return ld(`keydown`,e=>{!m&&e.key===`Escape`&&h&&r()}),qu({opened:n,shouldReturnFocus:m&&g}),Z.createElement(Af,MS(jS({},l),{withinPortal:c,target:d}),Z.createElement(Wb,{value:{__staticSelector:o,opened:n,onClose:r,closeOnClickOutside:a,transitionProps:MS(jS({},s),{duration:P,keepMounted:u}),zIndex:f,padding:_,id:k,getTitleId:()=>`${k}-title`,getBodyId:()=>`${k}-body`,titleMounted:A,bodyMounted:M,setTitleMounted:j,setBodyMounted:N,trapFocus:m,closeOnEscape:h,shadow:v,stylesApi:{name:o,size:b,variant:x,classNames:S,styles:w,unstyled:C}}},Z.createElement(Ct,{enabled:F&&p},Z.createElement(Ir,jS({className:O(D.root,T)},E),i))))}FS.CloseButton=tx,FS.Overlay=Px,FS.Content=Wx,FS.Header=eS,FS.Title=uS,FS.Body=bS,FS.NativeScrollArea=xS;var IS=Object.defineProperty,LS=Object.defineProperties,RS=Object.getOwnPropertyDescriptors,zS=Object.getOwnPropertySymbols,BS=Object.prototype.hasOwnProperty,VS=Object.prototype.propertyIsEnumerable,HS=(e,t,n)=>t in e?IS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,US=(e,t)=>{for(var n in t||={})BS.call(t,n)&&HS(e,n,t[n]);if(zS)for(var n of zS(t))VS.call(t,n)&&HS(e,n,t[n]);return e},WS=(e,t)=>LS(e,RS(t)),GS=(e,t)=>{var n={};for(var r in e)BS.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&zS)for(var r of zS(e))t.indexOf(r)<0&&VS.call(e,r)&&(n[r]=e[r]);return n},KS={top:`slide-down`,bottom:`slide-up`,left:`slide-right`,right:`slide-left`},qS={top:`slide-down`,bottom:`slide-up`,right:`slide-right`,left:`slide-left`},JS=WS(US({},PS),{position:`left`});function YS(e){let t=X(`DrawerRoot`,JS,e),{classNames:n,variant:r,size:i,scrollAreaComponent:a,position:o,transitionProps:s}=t,c=GS(t,[`classNames`,`variant`,`size`,`scrollAreaComponent`,`position`,`transitionProps`]),{classes:l,cx:u,theme:d}=Ub({position:o},{name:`Drawer`,variant:r,size:i}),f=(d.dir===`rtl`?qS:KS)[o];return Z.createElement(Bb,{value:{scrollAreaComponent:a}},Z.createElement(FS,US({__staticSelector:`Drawer`,size:i,variant:r,transitionProps:US({transition:f,duration:200},s),classNames:WS(US({},n),{content:u(l.content,n?.content),inner:u(l.inner,n?.inner)})},c)))}var XS=Object.defineProperty,ZS=Object.getOwnPropertySymbols,QS=Object.prototype.hasOwnProperty,$S=Object.prototype.propertyIsEnumerable,eC=(e,t,n)=>t in e?XS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tC=(e,t)=>{for(var n in t||={})QS.call(t,n)&&eC(e,n,t[n]);if(ZS)for(var n of ZS(t))$S.call(t,n)&&eC(e,n,t[n]);return e},nC=(e,t)=>{var n={};for(var r in e)QS.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ZS)for(var r of ZS(e))t.indexOf(r)<0&&$S.call(e,r)&&(n[r]=e[r]);return n},rC={shadow:`xl`},iC=(0,Z.forwardRef)((e,t)=>{let n=X(`ModalContent`,rC,e),{children:r,scrollAreaComponent:i}=n,a=nC(n,[`children`,`scrollAreaComponent`]),o=Vb(),s=i||o.scrollAreaComponent||FS.NativeScrollArea;return Z.createElement(FS.Content,tC({ref:t,radius:0},a),Z.createElement(s,{style:{height:`100vh`}},r))}),aC=Object.defineProperty,oC=Object.defineProperties,sC=Object.getOwnPropertyDescriptors,cC=Object.getOwnPropertySymbols,lC=Object.prototype.hasOwnProperty,uC=Object.prototype.propertyIsEnumerable,dC=(e,t,n)=>t in e?aC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fC=(e,t)=>{for(var n in t||={})lC.call(t,n)&&dC(e,n,t[n]);if(cC)for(var n of cC(t))uC.call(t,n)&&dC(e,n,t[n]);return e},pC=(e,t)=>oC(e,sC(t)),mC=(e,t)=>{var n={};for(var r in e)lC.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&cC)for(var r of cC(e))t.indexOf(r)<0&&uC.call(e,r)&&(n[r]=e[r]);return n},hC=pC(fC({},PS),{withOverlay:!0,withCloseButton:!0});function gC(e){let t=X(`Drawer`,hC,e),{title:n,withOverlay:r,overlayProps:i,withCloseButton:a,closeButtonProps:o,children:s}=t,c=mC(t,[`title`,`withOverlay`,`overlayProps`,`withCloseButton`,`closeButtonProps`,`children`]),l=!!n||a;return Z.createElement(YS,fC({},c),r&&Z.createElement(FS.Overlay,fC({},i)),Z.createElement(iC,null,l&&Z.createElement(FS.Header,null,n&&Z.createElement(FS.Title,null,n),a&&Z.createElement(FS.CloseButton,fC({},o))),Z.createElement(FS.Body,null,s)))}gC.Root=YS,gC.CloseButton=FS.CloseButton,gC.Overlay=FS.Overlay,gC.Content=iC,gC.Header=FS.Header,gC.Title=FS.Title,gC.Body=FS.Body,gC.NativeScrollArea=FS.NativeScrollArea;var _C=Object.defineProperty,vC=Object.getOwnPropertySymbols,yC=Object.prototype.hasOwnProperty,bC=Object.prototype.propertyIsEnumerable,xC=(e,t,n)=>t in e?_C(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,SC=(e,t)=>{for(var n in t||={})yC.call(t,n)&&xC(e,n,t[n]);if(vC)for(var n of vC(t))bC.call(t,n)&&xC(e,n,t[n]);return e},CC=(e,t)=>{var n={};for(var r in e)yC.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&vC)for(var r of vC(e))t.indexOf(r)<0&&bC.call(e,r)&&(n[r]=e[r]);return n},wC={multiple:!1},TC=(0,Z.forwardRef)((e,t)=>{let n=X(`FileButton`,wC,e),{onChange:r,children:i,multiple:a,accept:o,name:s,form:c,resetRef:l,disabled:u,capture:d,inputProps:f}=n,p=CC(n,[`onChange`,`children`,`multiple`,`accept`,`name`,`form`,`resetRef`,`disabled`,`capture`,`inputProps`]),m=(0,Z.useRef)();return ud(l,()=>{m.current.value=``}),Z.createElement(Z.Fragment,null,i(SC({onClick:()=>{!u&&m.current.click()}},p)),Z.createElement(`input`,SC({style:{display:`none`},type:`file`,accept:o,multiple:a,onChange:e=>{r(a?Array.from(e.currentTarget.files):e.currentTarget.files[0]||null)},ref:fd(t,m),name:s,form:c,capture:d},f)))});TC.displayName=`@mantine/core/FileButton`;var EC=Rr(()=>({placeholder:{},input:{cursor:`pointer`}})),DC=Object.defineProperty,OC=Object.defineProperties,kC=Object.getOwnPropertyDescriptors,AC=Object.getOwnPropertySymbols,jC=Object.prototype.hasOwnProperty,MC=Object.prototype.propertyIsEnumerable,NC=(e,t,n)=>t in e?DC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,PC=(e,t)=>{for(var n in t||={})jC.call(t,n)&&NC(e,n,t[n]);if(AC)for(var n of AC(t))MC.call(t,n)&&NC(e,n,t[n]);return e},FC=(e,t)=>OC(e,kC(t)),IC=(e,t)=>{var n={};for(var r in e)jC.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&AC)for(var r of AC(e))t.indexOf(r)<0&&MC.call(e,r)&&(n[r]=e[r]);return n},LC={size:`sm`,valueComponent:({value:e})=>Z.createElement(ai,{sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}},Array.isArray(e)?e.map(e=>e.name).join(`, `):e?.name)},RC=(0,Z.forwardRef)((e,t)=>{let n=X_(`FileInput`,LC,e),{inputProps:r,wrapperProps:i,placeholder:a,value:o,defaultValue:s,onChange:c,multiple:l,accept:u,name:d,form:f,classNames:p,styles:m,unstyled:h,valueComponent:g,rightSection:_,clearable:v,clearButtonProps:y,readOnly:b,capture:x,fileInputProps:S}=n,C=IC(n,[`inputProps`,`wrapperProps`,`placeholder`,`value`,`defaultValue`,`onChange`,`multiple`,`accept`,`name`,`form`,`classNames`,`styles`,`unstyled`,`valueComponent`,`rightSection`,`clearable`,`clearButtonProps`,`readOnly`,`capture`,`fileInputProps`]),w=(0,Z.useRef)(),{classes:T,cx:E}=EC(null,{name:`FileInput`,classNames:p,styles:m,unstyled:h}),[D,O]=pd({value:o,defaultValue:s,onChange:c,finalValue:l?[]:null}),k=Array.isArray(D)?D.length!==0:D!==null,A=_||(v&&k&&!b?Z.createElement(Yf,FC(PC({},y),{variant:`transparent`,onClick:()=>O(l?[]:null),size:r.size,unstyled:h})):null);return(0,Z.useEffect)(()=>{(Array.isArray(D)&&D.length===0||D===null)&&w.current()},[D]),Z.createElement(Ny.Wrapper,FC(PC({},i),{__staticSelector:`FileInput`}),Z.createElement(TC,{onChange:O,multiple:l,accept:u,name:d,form:f,resetRef:w,disabled:b,capture:x,inputProps:S},e=>Z.createElement(Ny,FC(PC(PC(PC({multiline:!0},e),r),C),{component:`button`,type:`button`,ref:t,__staticSelector:`FileInput`,rightSection:A,classNames:FC(PC({},p),{input:E(T.input,p?.input)})}),k?Z.createElement(g,{value:D}):Z.createElement(Ny.Placeholder,{className:T.placeholder},a))))});RC.displayName=`@mantine/core/FileInput`;var zC=RC,[BC,VC]=vu(`Grid component was not found in tree`),HC=Object.defineProperty,UC=Object.getOwnPropertySymbols,WC=Object.prototype.hasOwnProperty,GC=Object.prototype.propertyIsEnumerable,KC=(e,t,n)=>t in e?HC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qC=(e,t)=>{for(var n in t||={})WC.call(t,n)&&KC(e,n,t[n]);if(UC)for(var n of UC(t))GC.call(t,n)&&KC(e,n,t[n]);return e},JC=(e,t)=>e===`content`?`auto`:e===`auto`?`0rem`:e?`${100/(t/e)}%`:void 0,YC=(e,t,n)=>n||e===`auto`||e===`content`?`unset`:JC(e,t),XC=(e,t)=>{if(e)return e===`auto`||t?1:0},ZC=(e,t)=>e===0?0:e?`${100/(t/e)}%`:void 0,QC=(e,t)=>e===void 0?void 0:`calc(${Y({size:e,sizes:t.spacing})} / 2)`;function $C({sizes:e,offsets:t,orders:n,theme:r,columns:i,gutters:a,grow:o}){return tr.reduce((s,c)=>(s[`@media (min-width: ${$n(r.breakpoints[c])})`]={order:n[c],flexBasis:JC(e[c],i),padding:QC(a[c],r),flexShrink:0,width:e[c]===`content`?`auto`:void 0,maxWidth:YC(e[c],i,o),marginLeft:ZC(t[c],i),flexGrow:XC(e[c],o)},s),{})}var ew=Rr((e,{gutter:t,gutterXs:n,gutterSm:r,gutterMd:i,gutterLg:a,gutterXl:o,grow:s,offset:c,offsetXs:l,offsetSm:u,offsetMd:d,offsetLg:f,offsetXl:p,columns:m,span:h,xs:g,sm:_,md:v,lg:y,xl:b,order:x,orderXs:S,orderSm:C,orderMd:w,orderLg:T,orderXl:E})=>({col:qC({boxSizing:`border-box`,flexGrow:XC(h,s),order:x,padding:QC(t,e),marginLeft:ZC(c,m),flexBasis:JC(h,m),flexShrink:0,width:h===`content`?`auto`:void 0,maxWidth:YC(h,m,s)},$C({sizes:{xs:g,sm:_,md:v,lg:y,xl:b},offsets:{xs:l,sm:u,md:d,lg:f,xl:p},orders:{xs:S,sm:C,md:w,lg:T,xl:E},gutters:{xs:n,sm:r,md:i,lg:a,xl:o},theme:e,columns:m,grow:s}))})),tw=Object.defineProperty,nw=Object.getOwnPropertySymbols,rw=Object.prototype.hasOwnProperty,iw=Object.prototype.propertyIsEnumerable,aw=(e,t,n)=>t in e?tw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ow=(e,t)=>{for(var n in t||={})rw.call(t,n)&&aw(e,n,t[n]);if(nw)for(var n of nw(t))iw.call(t,n)&&aw(e,n,t[n]);return e},sw=(e,t)=>{var n={};for(var r in e)rw.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&nw)for(var r of nw(e))t.indexOf(r)<0&&iw.call(e,r)&&(n[r]=e[r]);return n},cw={};function lw(e){return e===`auto`||e===`content`||typeof e==`number`&&e>0&&e%1==0}var uw=(0,Z.forwardRef)((e,t)=>{let n=X(`GridCol`,cw,e),{children:r,span:i,offset:a,offsetXs:o,offsetSm:s,offsetMd:c,offsetLg:l,offsetXl:u,xs:d,sm:f,md:p,lg:m,xl:h,order:g,orderXs:_,orderSm:v,orderMd:y,orderLg:b,orderXl:x,className:S,unstyled:C,variant:w}=n,T=sw(n,[`children`,`span`,`offset`,`offsetXs`,`offsetSm`,`offsetMd`,`offsetLg`,`offsetXl`,`xs`,`sm`,`md`,`lg`,`xl`,`order`,`orderXs`,`orderSm`,`orderMd`,`orderLg`,`orderXl`,`className`,`unstyled`,`variant`]),E=VC(),D=i||E.columns,{classes:O,cx:k}=ew({gutter:E.gutter,gutterXs:E.gutterXs,gutterSm:E.gutterSm,gutterMd:E.gutterMd,gutterLg:E.gutterLg,gutterXl:E.gutterXl,offset:a,offsetXs:o,offsetSm:s,offsetMd:c,offsetLg:l,offsetXl:u,xs:d,sm:f,md:p,lg:m,xl:h,order:g,orderXs:_,orderSm:v,orderMd:y,orderLg:b,orderXl:x,grow:E.grow,columns:E.columns,span:D},{unstyled:C,name:`Grid`,variant:w});return!lw(D)||D>E.columns?null:Z.createElement(Ir,ow({className:k(O.col,S),ref:t},T),r)});uw.displayName=`@mantine/core/Col`;var dw=Object.defineProperty,fw=Object.getOwnPropertySymbols,pw=Object.prototype.hasOwnProperty,mw=Object.prototype.propertyIsEnumerable,hw=(e,t,n)=>t in e?dw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gw=(e,t)=>{for(var n in t||={})pw.call(t,n)&&hw(e,n,t[n]);if(fw)for(var n of fw(t))mw.call(t,n)&&hw(e,n,t[n]);return e};function _w(e,t){return tr.reduce((n,r)=>(e[r]!==void 0&&(n[`@media (min-width: ${t.breakpoints[r]})`]={margin:`calc(-${Y({size:e[r],sizes:t.spacing})} / 2)`}),n),{})}var vw=Rr((e,{justify:t,align:n,gutter:r,gutterXs:i,gutterSm:a,gutterMd:o,gutterLg:s,gutterXl:c})=>({root:gw({margin:`calc(-${Y({size:r,sizes:e.spacing})} / 2)`,display:`flex`,flexWrap:`wrap`,justifyContent:t,alignItems:n},_w({xs:i,sm:a,md:o,lg:s,xl:c},e))})),yw=Object.defineProperty,bw=Object.getOwnPropertySymbols,xw=Object.prototype.hasOwnProperty,Sw=Object.prototype.propertyIsEnumerable,Cw=(e,t,n)=>t in e?yw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ww=(e,t)=>{for(var n in t||={})xw.call(t,n)&&Cw(e,n,t[n]);if(bw)for(var n of bw(t))Sw.call(t,n)&&Cw(e,n,t[n]);return e},Tw=(e,t)=>{var n={};for(var r in e)xw.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&bw)for(var r of bw(e))t.indexOf(r)<0&&Sw.call(e,r)&&(n[r]=e[r]);return n},Ew={gutter:`md`,justify:`flex-start`,align:`stretch`,columns:12},Dw=(0,Z.forwardRef)((e,t)=>{let n=X(`Grid`,Ew,e),{gutter:r,gutterXs:i,gutterSm:a,gutterMd:o,gutterLg:s,gutterXl:c,children:l,grow:u,justify:d,align:f,columns:p,className:m,unstyled:h,variant:g}=n,_=Tw(n,[`gutter`,`gutterXs`,`gutterSm`,`gutterMd`,`gutterLg`,`gutterXl`,`children`,`grow`,`justify`,`align`,`columns`,`className`,`unstyled`,`variant`]),{classes:v,cx:y}=vw({gutter:r,justify:d,align:f,gutterXs:i,gutterSm:a,gutterMd:o,gutterLg:s,gutterXl:c},{unstyled:h,name:`Grid`,variant:g});return Z.createElement(BC,{value:{gutter:r,gutterXs:i,gutterSm:a,gutterMd:o,gutterLg:s,gutterXl:c,grow:u,columns:p}},Z.createElement(Ir,ww({className:y(v.root,m),ref:t},_),l))});Dw.Col=uw,Dw.displayName=`@mantine/core/Grid`;function Ow(e){return Z.Children.toArray(e).filter(Boolean)}var kw={left:`flex-start`,center:`center`,right:`flex-end`,apart:`space-between`},Aw=Rr((e,{spacing:t,position:n,noWrap:r,grow:i,align:a,count:o})=>({root:{boxSizing:`border-box`,display:`flex`,flexDirection:`row`,alignItems:a||`center`,flexWrap:r?`nowrap`:`wrap`,justifyContent:kw[n],gap:Y({size:t,sizes:e.spacing}),"& > *":{boxSizing:`border-box`,maxWidth:i?`calc(${100/o}% - (${J(Y({size:t,sizes:e.spacing}))} - ${Y({size:t,sizes:e.spacing})} / ${o}))`:void 0,flexGrow:+!!i}}})),jw=Object.defineProperty,Mw=Object.getOwnPropertySymbols,Nw=Object.prototype.hasOwnProperty,Pw=Object.prototype.propertyIsEnumerable,Fw=(e,t,n)=>t in e?jw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Iw=(e,t)=>{for(var n in t||={})Nw.call(t,n)&&Fw(e,n,t[n]);if(Mw)for(var n of Mw(t))Pw.call(t,n)&&Fw(e,n,t[n]);return e},Lw=(e,t)=>{var n={};for(var r in e)Nw.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Mw)for(var r of Mw(e))t.indexOf(r)<0&&Pw.call(e,r)&&(n[r]=e[r]);return n},Rw={position:`left`,spacing:`md`},zw=(0,Z.forwardRef)((e,t)=>{let n=X(`Group`,Rw,e),{className:r,position:i,align:a,children:o,noWrap:s,grow:c,spacing:l,unstyled:u,variant:d}=n,f=Lw(n,[`className`,`position`,`align`,`children`,`noWrap`,`grow`,`spacing`,`unstyled`,`variant`]),p=Ow(o),{classes:m,cx:h}=Aw({align:a,grow:c,noWrap:s,spacing:l,position:i,count:p.length},{unstyled:u,name:`Group`,variant:d});return Z.createElement(Ir,Iw({className:h(m.root,r),ref:t},f),p)});zw.displayName=`@mantine/core/Group`;function Bw({open:e,close:t,openDelay:n,closeDelay:r}){let i=(0,Z.useRef)(-1),a=(0,Z.useRef)(-1),o=()=>{window.clearTimeout(i.current),window.clearTimeout(a.current)};return(0,Z.useEffect)(()=>o,[]),{openDropdown:()=>{o(),n===0?e():i.current=window.setTimeout(e,n)},closeDropdown:()=>{o(),r===0?t():a.current=window.setTimeout(t,r)}}}var Vw=Object.defineProperty,Hw=Object.defineProperties,Uw=Object.getOwnPropertyDescriptors,Ww=Object.getOwnPropertySymbols,Gw=Object.prototype.hasOwnProperty,Kw=Object.prototype.propertyIsEnumerable,qw=(e,t,n)=>t in e?Vw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jw=(e,t)=>{for(var n in t||={})Gw.call(t,n)&&qw(e,n,t[n]);if(Ww)for(var n of Ww(t))Kw.call(t,n)&&qw(e,n,t[n]);return e},Yw=(e,t)=>Hw(e,Uw(t)),Xw=e=>jr({from:{boxShadow:`0 0 ${J(.5)} 0 ${e}`,opacity:.6},to:{boxShadow:`0 0 ${J(.5)} ${J(4.4)} ${e}`,opacity:0}});function Zw(e,t=0){let n={},[r,i]=e.split(`-`),a=``,o=``;return r===`top`&&(n.top=t,o=`-50%`),r===`middle`&&(n.top=`50%`,o=`-50%`),r===`bottom`&&(n.bottom=t,o=`50%`),i===`start`&&(n.left=t,a=`-50%`),i===`center`&&(n.left=`50%`,a=`-50%`),i===`end`&&(n.right=t,a=`50%`),n.transform=`translate(${a}, ${o})`,n}var Qw=Rr((e,{radius:t,color:n,position:r,offset:i,inline:a,withBorder:o,withLabel:s,zIndex:c},{size:l})=>{let{background:u}=e.fn.variant({variant:`filled`,primaryFallback:!1,color:n||e.primaryColor}),d=J(l);return{root:{position:`relative`,display:a?`inline-block`:`block`},indicator:Yw(Jw({},Zw(r,i)),{zIndex:c,position:`absolute`,[s?`minWidth`:`width`]:d,height:d,display:`flex`,justifyContent:`center`,alignItems:`center`,fontSize:e.fontSizes.xs,paddingLeft:s?`calc(${e.spacing.xs} / 2)`:0,paddingRight:s?`calc(${e.spacing.xs} / 2)`:0,borderRadius:e.fn.radius(t),backgroundColor:e.fn.variant({variant:`filled`,primaryFallback:!1,color:n||e.primaryColor}).background,border:o?`${J(2)} solid ${e.colorScheme===`dark`?e.colors.dark[7]:e.white}`:void 0,color:e.white,whiteSpace:`nowrap`}),processing:{animation:`${Xw(u)} 1000ms linear infinite`},common:Yw(Jw({},Zw(r,i)),{position:`absolute`,[s?`minWidth`:`width`]:d,height:d,borderRadius:e.fn.radius(t)})}}),$w=Object.defineProperty,eT=Object.getOwnPropertySymbols,tT=Object.prototype.hasOwnProperty,nT=Object.prototype.propertyIsEnumerable,rT=(e,t,n)=>t in e?$w(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,iT=(e,t)=>{for(var n in t||={})tT.call(t,n)&&rT(e,n,t[n]);if(eT)for(var n of eT(t))nT.call(t,n)&&rT(e,n,t[n]);return e},aT=(e,t)=>{var n={};for(var r in e)tT.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&eT)for(var r of eT(e))t.indexOf(r)<0&&nT.call(e,r)&&(n[r]=e[r]);return n},oT={position:`top-end`,offset:0,inline:!1,withBorder:!1,disabled:!1,processing:!1,size:10,radius:1e3,zIndex:Du(`app`)},sT=(0,Z.forwardRef)((e,t)=>{let n=X(`Indicator`,oT,e),{children:r,position:i,offset:a,size:o,radius:s,inline:c,withBorder:l,className:u,color:d,styles:f,label:p,classNames:m,disabled:h,zIndex:g,unstyled:_,processing:v,variant:y}=n,b=aT(n,[`children`,`position`,`offset`,`size`,`radius`,`inline`,`withBorder`,`className`,`color`,`styles`,`label`,`classNames`,`disabled`,`zIndex`,`unstyled`,`processing`,`variant`]),{classes:x,cx:S}=Qw({position:i,offset:a,radius:s,inline:c,color:d,withBorder:l,zIndex:g,withLabel:!!p},{name:`Indicator`,classNames:m,styles:f,unstyled:_,variant:y,size:o});return Z.createElement(Ir,iT({ref:t,className:S(x.root,u)},b),!h&&Z.createElement(Z.Fragment,null,Z.createElement(`div`,{className:S(x.indicator,x.common)},p),v&&Z.createElement(`div`,{className:S(x.processing,x.common)})),r)});sT.displayName=`@mantine/core/Indicator`;var[cT,lT]=vu(`List component was not found in tree`),uT=Rr((e,{spacing:t,center:n})=>({itemWrapper:{ref:Ou(`itemWrapper`),display:`inline-flex`,flexDirection:`column`,whiteSpace:`normal`},item:{whiteSpace:`nowrap`,lineHeight:n?1:e.lineHeight,"&:not(:first-of-type)":{marginTop:Y({size:t,sizes:e.spacing})},"&[data-with-icon]":{listStyle:`none`,[`& .${Ou(`itemWrapper`)}`]:{display:`inline-flex`,alignItems:n?`center`:`flex-start`,flexDirection:`row`}}},itemIcon:{display:`inline-block`,verticalAlign:`middle`,marginRight:e.spacing.sm}})),dT=Object.defineProperty,fT=Object.getOwnPropertySymbols,pT=Object.prototype.hasOwnProperty,mT=Object.prototype.propertyIsEnumerable,hT=(e,t,n)=>t in e?dT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gT=(e,t)=>{for(var n in t||={})pT.call(t,n)&&hT(e,n,t[n]);if(fT)for(var n of fT(t))mT.call(t,n)&&hT(e,n,t[n]);return e},_T=(e,t)=>{var n={};for(var r in e)pT.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&fT)for(var r of fT(e))t.indexOf(r)<0&&mT.call(e,r)&&(n[r]=e[r]);return n},vT={},yT=(0,Z.forwardRef)((e,t)=>{let n=X(`ListItem`,vT,e),{className:r,children:i,icon:a}=n,o=_T(n,[`className`,`children`,`icon`]),{icon:s,spacing:c,center:l,listStyleType:u,size:d,withPadding:f,classNames:p,styles:m,unstyled:h,variant:g}=lT(),_=a||s,{classes:v,cx:y}=uT({withPadding:f,listStyleType:u,center:l,spacing:c},{classNames:p,styles:m,unstyled:h,name:`List`,variant:g,size:d});return Z.createElement(Ir,gT({component:`li`,className:y(v.item,r),"data-with-icon":!!_||void 0,ref:t},o),Z.createElement(`div`,{className:v.itemWrapper},_&&Z.createElement(`span`,{className:v.itemIcon},_),Z.createElement(`span`,null,i)))});yT.displayName=`@mantine/core/ListItem`;var bT=Object.defineProperty,xT=Object.defineProperties,ST=Object.getOwnPropertyDescriptors,CT=Object.getOwnPropertySymbols,wT=Object.prototype.hasOwnProperty,TT=Object.prototype.propertyIsEnumerable,ET=(e,t,n)=>t in e?bT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,DT=(e,t)=>{for(var n in t||={})wT.call(t,n)&&ET(e,n,t[n]);if(CT)for(var n of CT(t))TT.call(t,n)&&ET(e,n,t[n]);return e},OT=(e,t)=>xT(e,ST(t)),kT=Rr((e,{withPadding:t,listStyleType:n},{size:r})=>({root:OT(DT({},e.fn.fontStyles()),{listStyleType:n,color:e.colorScheme===`dark`?e.colors.dark[0]:e.black,fontSize:Y({size:r,sizes:e.fontSizes}),lineHeight:e.lineHeight,margin:0,paddingLeft:t?e.spacing.xl:0,listStylePosition:`inside`})})),AT=Object.defineProperty,jT=Object.getOwnPropertySymbols,MT=Object.prototype.hasOwnProperty,NT=Object.prototype.propertyIsEnumerable,PT=(e,t,n)=>t in e?AT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,FT=(e,t)=>{for(var n in t||={})MT.call(t,n)&&PT(e,n,t[n]);if(jT)for(var n of jT(t))NT.call(t,n)&&PT(e,n,t[n]);return e},IT=(e,t)=>{var n={};for(var r in e)MT.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&jT)for(var r of jT(e))t.indexOf(r)<0&&NT.call(e,r)&&(n[r]=e[r]);return n},LT={type:`unordered`,size:`md`,spacing:0},RT=(0,Z.forwardRef)((e,t)=>{let n=X(`List`,LT,e),{children:r,type:i,size:a,listStyleType:o,withPadding:s,center:c,spacing:l,icon:u,className:d,styles:f,classNames:p,unstyled:m,variant:h}=n,g=IT(n,[`children`,`type`,`size`,`listStyleType`,`withPadding`,`center`,`spacing`,`icon`,`className`,`styles`,`classNames`,`unstyled`,`variant`]),{classes:_,cx:v}=kT({withPadding:s,listStyleType:o,center:c,spacing:l},{classNames:p,styles:f,name:`List`,unstyled:m,size:a,variant:h});return Z.createElement(cT,{value:{spacing:l,center:c,icon:u,listStyleType:o,size:a,withPadding:s,classNames:p,styles:f,unstyled:m,variant:h}},Z.createElement(Ir,FT({component:i===`unordered`?`ul`:`ol`,className:v(_.root,d),ref:t},g),r))});RT.Item=yT,RT.displayName=`@mantine/core/List`;var zT=Object.defineProperty,BT=Object.defineProperties,VT=Object.getOwnPropertyDescriptors,HT=Object.getOwnPropertySymbols,UT=Object.prototype.hasOwnProperty,WT=Object.prototype.propertyIsEnumerable,GT=(e,t,n)=>t in e?zT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,KT=(e,t)=>{for(var n in t||={})UT.call(t,n)&>(e,n,t[n]);if(HT)for(var n of HT(t))WT.call(t,n)&>(e,n,t[n]);return e},qT=(e,t)=>BT(e,VT(t)),JT=Rr(e=>({root:qT(KT({},e.fn.cover()),{display:`flex`,alignItems:`center`,justifyContent:`center`,overflow:`hidden`})})),YT=Object.defineProperty,XT=Object.defineProperties,ZT=Object.getOwnPropertyDescriptors,QT=Object.getOwnPropertySymbols,$T=Object.prototype.hasOwnProperty,eE=Object.prototype.propertyIsEnumerable,tE=(e,t,n)=>t in e?YT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,nE=(e,t)=>{for(var n in t||={})$T.call(t,n)&&tE(e,n,t[n]);if(QT)for(var n of QT(t))eE.call(t,n)&&tE(e,n,t[n]);return e},rE=(e,t)=>XT(e,ZT(t)),iE=(e,t)=>{var n={};for(var r in e)$T.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&QT)for(var r of QT(e))t.indexOf(r)<0&&eE.call(e,r)&&(n[r]=e[r]);return n},aE={overlayOpacity:.75,transitionDuration:0,radius:0,zIndex:Du(`overlay`)},oE=(0,Z.forwardRef)((e,t)=>{let n=X(`LoadingOverlay`,aE,e),{className:r,visible:i,loaderProps:a,overlayOpacity:o,overlayColor:s,transitionDuration:c,exitTransitionDuration:l,zIndex:u,style:d,loader:f,radius:p,overlayBlur:m,unstyled:h,variant:g,keepMounted:_}=n,v=iE(n,[`className`,`visible`,`loaderProps`,`overlayOpacity`,`overlayColor`,`transitionDuration`,`exitTransitionDuration`,`zIndex`,`style`,`loader`,`radius`,`overlayBlur`,`unstyled`,`variant`,`keepMounted`]),{classes:y,cx:b,theme:x}=JT(null,{name:`LoadingOverlay`,unstyled:h,variant:g}),S=`calc(${u} + 1)`;return Z.createElement(Bg,{keepMounted:_,duration:c,exitDuration:l,mounted:i,transition:`fade`},e=>Z.createElement(Ir,nE({className:b(y.root,r),style:rE(nE(nE({},e),d),{zIndex:u}),ref:t},v),f?Z.createElement(`div`,{style:{zIndex:S}},f):Z.createElement(hi,nE({style:{zIndex:S}},a)),Z.createElement(Sx,{opacity:o,zIndex:u,radius:p,blur:m,unstyled:h,color:s||(x.colorScheme===`dark`?x.colors.dark[5]:x.white)})))});oE.displayName=`@mantine/core/LoadingOverlay`;var sE={context:`Menu component was not found in the tree`,children:`Menu.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`},[cE,lE]=vu(sE.context),uE=Rr(e=>({divider:{marginTop:J(4),marginBottom:J(4),borderTop:`${J(1)} solid ${e.colorScheme===`dark`?e.colors.dark[4]:e.colors.gray[2]}`}})),dE=Object.defineProperty,fE=Object.getOwnPropertySymbols,pE=Object.prototype.hasOwnProperty,mE=Object.prototype.propertyIsEnumerable,hE=(e,t,n)=>t in e?dE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gE=(e,t)=>{for(var n in t||={})pE.call(t,n)&&hE(e,n,t[n]);if(fE)for(var n of fE(t))mE.call(t,n)&&hE(e,n,t[n]);return e},_E=(e,t)=>{var n={};for(var r in e)pE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&fE)for(var r of fE(e))t.indexOf(r)<0&&mE.call(e,r)&&(n[r]=e[r]);return n},vE={},yE=(0,Z.forwardRef)((e,t)=>{let n=X(`MenuDivider`,vE,e),{children:r,className:i}=n,a=_E(n,[`children`,`className`]),{classNames:o,styles:s,unstyled:c,variant:l}=lE(),{classes:u,cx:d}=uE(null,{name:`Menu`,classNames:o,styles:s,unstyled:c,variant:l});return Z.createElement(Ir,gE({className:d(u.divider,i),ref:t},a))});yE.displayName=`@mantine/core/MenuDivider`;var bE=Object.defineProperty,xE=Object.getOwnPropertySymbols,SE=Object.prototype.hasOwnProperty,CE=Object.prototype.propertyIsEnumerable,wE=(e,t,n)=>t in e?bE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,TE=(e,t)=>{for(var n in t||={})SE.call(t,n)&&wE(e,n,t[n]);if(xE)for(var n of xE(t))CE.call(t,n)&&wE(e,n,t[n]);return e},EE=(e,t)=>{var n={};for(var r in e)SE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&xE)for(var r of xE(e))t.indexOf(r)<0&&CE.call(e,r)&&(n[r]=e[r]);return n},DE={};function OE(e){let t=X(`MenuDropdown`,DE,e),{children:n,onMouseEnter:r,onMouseLeave:i}=t,a=EE(t,[`children`,`onMouseEnter`,`onMouseLeave`]),o=(0,Z.useRef)(),s=lE(),c=e=>{var t;(e.key===`ArrowUp`||e.key===`ArrowDown`)&&(e.preventDefault(),(t=o.current.querySelectorAll(`[data-menu-item]:not(:disabled)`)[0])==null||t.focus())},l=Su(r,()=>s.trigger===`hover`&&s.openDropdown()),u=Su(i,()=>s.trigger===`hover`&&s.closeDropdown());return Z.createElement(A_.Dropdown,TE({onMouseEnter:l,onMouseLeave:u,role:`menu`,"aria-orientation":`vertical`},a),Z.createElement(`div`,{tabIndex:-1,"data-menu-dropdown":!0,"data-autofocus":!0,onKeyDown:c,ref:o,style:{outline:0}},n))}OE.displayName=`@mantine/core/MenuDropdown`;var kE=Object.defineProperty,AE=Object.defineProperties,jE=Object.getOwnPropertyDescriptors,ME=Object.getOwnPropertySymbols,NE=Object.prototype.hasOwnProperty,PE=Object.prototype.propertyIsEnumerable,FE=(e,t,n)=>t in e?kE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,IE=(e,t)=>{for(var n in t||={})NE.call(t,n)&&FE(e,n,t[n]);if(ME)for(var n of ME(t))PE.call(t,n)&&FE(e,n,t[n]);return e},LE=(e,t)=>AE(e,jE(t)),RE=Rr((e,{color:t,radius:n})=>({item:LE(IE({},e.fn.fontStyles()),{WebkitTapHighlightColor:`transparent`,fontSize:e.fontSizes.sm,border:0,backgroundColor:`transparent`,outline:0,width:`100%`,textAlign:`left`,textDecoration:`none`,boxSizing:`border-box`,padding:`${e.spacing.xs} ${e.spacing.sm}`,cursor:`pointer`,borderRadius:e.fn.radius(n),color:t?e.fn.variant({variant:`filled`,primaryFallback:!1,color:t}).background:e.colorScheme===`dark`?e.colors.dark[0]:e.black,display:`flex`,alignItems:`center`,"&:disabled":{color:e.colorScheme===`dark`?e.colors.dark[3]:e.colors.gray[5],pointerEvents:`none`,userSelect:`none`},"&[data-hovered]":{backgroundColor:t?e.fn.variant({variant:`light`,color:t}).background:e.colorScheme===`dark`?e.fn.rgba(e.colors.dark[3],.35):e.colors.gray[1]}}),itemLabel:{flex:1},itemIcon:{display:`flex`,justifyContent:`center`,alignItems:`center`,marginRight:e.spacing.xs},itemRightSection:{}})),zE=Object.defineProperty,BE=Object.defineProperties,VE=Object.getOwnPropertyDescriptors,HE=Object.getOwnPropertySymbols,UE=Object.prototype.hasOwnProperty,WE=Object.prototype.propertyIsEnumerable,GE=(e,t,n)=>t in e?zE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,KE=(e,t)=>{for(var n in t||={})UE.call(t,n)&&GE(e,n,t[n]);if(HE)for(var n of HE(t))WE.call(t,n)&&GE(e,n,t[n]);return e},qE=(e,t)=>BE(e,VE(t)),JE=(e,t)=>{var n={};for(var r in e)UE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&HE)for(var r of HE(e))t.indexOf(r)<0&&WE.call(e,r)&&(n[r]=e[r]);return n},YE={},XE=(0,Z.forwardRef)((e,t)=>{let n=X(`MenuItem`,YE,e),{children:r,className:i,color:a,closeMenuOnClick:o,icon:s,rightSection:c}=n,l=JE(n,[`children`,`className`,`color`,`closeMenuOnClick`,`icon`,`rightSection`]),u=lE(),{classes:d,cx:f,theme:p}=RE({radius:u.radius,color:a},{name:`Menu`,classNames:u.classNames,styles:u.styles,unstyled:u.unstyled,variant:u.variant}),m=(0,Z.useRef)(),h=u.getItemIndex(m.current),g=l,_=Su(g.onMouseLeave,()=>u.setHovered(-1)),v=Su(g.onMouseEnter,()=>u.setHovered(u.getItemIndex(m.current))),y=Su(g.onClick,()=>{typeof o==`boolean`?o&&u.closeDropdownImmediately():u.closeOnItemClick&&u.closeDropdownImmediately()}),b=Su(g.onFocus,()=>u.setHovered(u.getItemIndex(m.current)));return Z.createElement(Ir,qE(KE({component:`button`,type:`button`},l),{tabIndex:-1,onFocus:b,className:f(d.item,i),ref:fd(m,t),role:`menuitem`,"data-menu-item":!0,"data-hovered":u.hovered===h||void 0,onMouseEnter:v,onMouseLeave:_,onClick:y,onKeyDown:gu({siblingSelector:`[data-menu-item]`,parentSelector:`[data-menu-dropdown]`,activateOnFocus:!1,loop:u.loop,dir:p.dir,orientation:`vertical`,onKeyDown:g.onKeydown})}),s&&Z.createElement(`div`,{className:d.itemIcon},s),r&&Z.createElement(`div`,{className:d.itemLabel},r),c&&Z.createElement(`div`,{className:d.itemRightSection},c))});XE.displayName=`@mantine/core/MenuItem`;var ZE=mr(XE),QE=Rr(e=>({label:{color:e.colorScheme===`dark`?e.colors.dark[2]:e.colors.gray[6],fontWeight:500,fontSize:e.fontSizes.xs,padding:`calc(${e.spacing.xs} / 2) ${e.spacing.sm}`,cursor:`default`}})),$E=Object.defineProperty,eD=Object.getOwnPropertySymbols,tD=Object.prototype.hasOwnProperty,nD=Object.prototype.propertyIsEnumerable,rD=(e,t,n)=>t in e?$E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,iD=(e,t)=>{for(var n in t||={})tD.call(t,n)&&rD(e,n,t[n]);if(eD)for(var n of eD(t))nD.call(t,n)&&rD(e,n,t[n]);return e},aD=(e,t)=>{var n={};for(var r in e)tD.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&eD)for(var r of eD(e))t.indexOf(r)<0&&nD.call(e,r)&&(n[r]=e[r]);return n},oD={},sD=(0,Z.forwardRef)((e,t)=>{let n=X(`MenuLabel`,oD,e),{children:r,className:i}=n,a=aD(n,[`children`,`className`]),{classNames:o,styles:s,unstyled:c,variant:l}=lE(),{classes:u,cx:d}=QE(null,{name:`Menu`,classNames:o,styles:s,unstyled:c,variant:l});return Z.createElement(ai,iD({className:d(u.label,i),ref:t},a),r)});sD.displayName=`@mantine/core/MenuLabel`;var cD=Object.defineProperty,lD=Object.getOwnPropertySymbols,uD=Object.prototype.hasOwnProperty,dD=Object.prototype.propertyIsEnumerable,fD=(e,t,n)=>t in e?cD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pD=(e,t)=>{for(var n in t||={})uD.call(t,n)&&fD(e,n,t[n]);if(lD)for(var n of lD(t))dD.call(t,n)&&fD(e,n,t[n]);return e},mD=(e,t)=>{var n={};for(var r in e)uD.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&lD)for(var r of lD(e))t.indexOf(r)<0&&dD.call(e,r)&&(n[r]=e[r]);return n},hD={refProp:`ref`},gD=(0,Z.forwardRef)((e,t)=>{let n=X(`MenuTarget`,hD,e),{children:r,refProp:i}=n,a=mD(n,[`children`,`refProp`]);if(!Tu(r))throw Error(sE.children);let o=lE(),s=Su(r.props.onClick,()=>o.trigger===`click`&&o.toggleDropdown()),c=Su(r.props.onMouseEnter,()=>o.trigger===`hover`&&o.openDropdown()),l=Su(r.props.onMouseLeave,()=>o.trigger===`hover`&&o.closeDropdown());return Z.createElement(A_.Target,pD({refProp:i,popupType:`menu`,ref:t},a),(0,Z.cloneElement)(r,{onClick:s,onMouseEnter:c,onMouseLeave:l,"data-expanded":o.opened?!0:void 0}))});gD.displayName=`@mantine/core/MenuTarget`;var _D=Rr({dropdown:{padding:J(4)}}),vD=Object.defineProperty,yD=Object.defineProperties,bD=Object.getOwnPropertyDescriptors,xD=Object.getOwnPropertySymbols,SD=Object.prototype.hasOwnProperty,CD=Object.prototype.propertyIsEnumerable,wD=(e,t,n)=>t in e?vD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,TD=(e,t)=>{for(var n in t||={})SD.call(t,n)&&wD(e,n,t[n]);if(xD)for(var n of xD(t))CD.call(t,n)&&wD(e,n,t[n]);return e},ED=(e,t)=>yD(e,bD(t)),DD=(e,t)=>{var n={};for(var r in e)SD.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&xD)for(var r of xD(e))t.indexOf(r)<0&&CD.call(e,r)&&(n[r]=e[r]);return n},OD={closeOnItemClick:!0,loop:!0,trigger:`click`,openDelay:0,closeDelay:100};function kD(e){let t=X(`Menu`,OD,e),{children:n,onOpen:r,onClose:i,opened:a,defaultOpened:o,onChange:s,closeOnItemClick:c,loop:l,closeOnEscape:u,trigger:d,openDelay:f,closeDelay:p,classNames:m,styles:h,unstyled:g,radius:_,variant:v}=t,y=DD(t,[`children`,`onOpen`,`onClose`,`opened`,`defaultOpened`,`onChange`,`closeOnItemClick`,`loop`,`closeOnEscape`,`trigger`,`openDelay`,`closeDelay`,`classNames`,`styles`,`unstyled`,`radius`,`variant`]),{classes:b,cx:x}=_D(),[S,{setHovered:C,resetHovered:w}]=Cu(),[T,E]=pd({value:a,defaultValue:o,finalValue:!1,onChange:s}),D=()=>{E(!1),T&&i?.()},O=()=>{E(!0),!T&&r?.()},k=()=>T?D():O(),{openDropdown:A,closeDropdown:j}=Bw({open:O,close:D,closeDelay:p,openDelay:f});return bi(()=>{w()},[T]),Z.createElement(cE,{value:{opened:T,toggleDropdown:k,getItemIndex:e=>_u(`[data-menu-item]`,`[data-menu-dropdown]`,e),hovered:S,setHovered:C,closeOnItemClick:c,closeDropdown:d===`click`?D:j,openDropdown:d===`click`?O:A,closeDropdownImmediately:D,loop:l,trigger:d,radius:_,classNames:m,styles:h,unstyled:g,variant:v}},Z.createElement(A_,ED(TD({},y),{radius:_,opened:T,onChange:k,defaultOpened:o,trapFocus:d===`click`&&T,closeOnEscape:u&&d===`click`,__staticSelector:`Menu`,classNames:ED(TD({},m),{dropdown:x(b.dropdown,m?.dropdown)}),styles:h,unstyled:g,variant:v}),n))}kD.displayName=`@mantine/core/Menu`,kD.Item=ZE,kD.Label=sD,kD.Dropdown=OE,kD.Target=gD,kD.Divider=yE;var[AD,jD]=vu(`Modal component was not found in tree`),MD={xs:J(320),sm:J(380),md:J(440),lg:J(620),xl:J(780)},ND=Rr((e,{yOffset:t,xOffset:n,centered:r,fullScreen:i},{size:a})=>({content:{flex:i?`0 0 100%`:`0 0 ${Y({size:a,sizes:MD})}`,maxWidth:`100%`,maxHeight:i?void 0:`calc(100dvh - (${J(t)} * 2))`,height:i?`100vh`:void 0,borderRadius:i?0:void 0,overflowY:`auto`},inner:{paddingTop:i?0:t,paddingBottom:i?0:t,paddingLeft:i?0:n,paddingRight:i?0:n,display:`flex`,justifyContent:`center`,alignItems:r?`center`:`flex-start`}})),PD=Object.defineProperty,FD=Object.defineProperties,ID=Object.getOwnPropertyDescriptors,LD=Object.getOwnPropertySymbols,RD=Object.prototype.hasOwnProperty,zD=Object.prototype.propertyIsEnumerable,BD=(e,t,n)=>t in e?PD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,VD=(e,t)=>{for(var n in t||={})RD.call(t,n)&&BD(e,n,t[n]);if(LD)for(var n of LD(t))zD.call(t,n)&&BD(e,n,t[n]);return e},HD=(e,t)=>FD(e,ID(t)),UD=(e,t)=>{var n={};for(var r in e)RD.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&LD)for(var r of LD(e))t.indexOf(r)<0&&zD.call(e,r)&&(n[r]=e[r]);return n},WD=HD(VD({},PS),{yOffset:`5dvh`,xOffset:`5vw`});function GD(e){let t=X(`ModalRoot`,WD,e),{classNames:n,variant:r,size:i,yOffset:a,xOffset:o,scrollAreaComponent:s,radius:c,centered:l,fullScreen:u}=t,d=UD(t,[`classNames`,`variant`,`size`,`yOffset`,`xOffset`,`scrollAreaComponent`,`radius`,`centered`,`fullScreen`]),{classes:f,cx:p}=ND({yOffset:a,xOffset:o,centered:l,fullScreen:u},{name:`Modal`,variant:r,size:i});return Z.createElement(AD,{value:{yOffset:a,scrollAreaComponent:s,radius:c}},Z.createElement(FS,VD({__staticSelector:`Modal`,size:i,variant:r,classNames:HD(VD({},n),{content:p(f.content,n?.content),inner:p(f.inner,n?.inner)})},d)))}var KD=Object.defineProperty,qD=Object.getOwnPropertySymbols,JD=Object.prototype.hasOwnProperty,YD=Object.prototype.propertyIsEnumerable,XD=(e,t,n)=>t in e?KD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ZD=(e,t)=>{for(var n in t||={})JD.call(t,n)&&XD(e,n,t[n]);if(qD)for(var n of qD(t))YD.call(t,n)&&XD(e,n,t[n]);return e},QD=(e,t)=>{var n={};for(var r in e)JD.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&qD)for(var r of qD(e))t.indexOf(r)<0&&YD.call(e,r)&&(n[r]=e[r]);return n},$D={shadow:`xl`},eO=(0,Z.forwardRef)((e,t)=>{let n=X(`ModalContent`,$D,e),{children:r,scrollAreaComponent:i}=n,a=QD(n,[`children`,`scrollAreaComponent`]),o=jD(),s=i||o.scrollAreaComponent||FS.NativeScrollArea;return Z.createElement(FS.Content,ZD({ref:t,radius:o.radius},a),Z.createElement(s,{style:{maxHeight:`calc(100dvh - (${J(o.yOffset)} * 2))`}},r))}),tO=Object.defineProperty,nO=Object.defineProperties,rO=Object.getOwnPropertyDescriptors,iO=Object.getOwnPropertySymbols,aO=Object.prototype.hasOwnProperty,oO=Object.prototype.propertyIsEnumerable,sO=(e,t,n)=>t in e?tO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cO=(e,t)=>{for(var n in t||={})aO.call(t,n)&&sO(e,n,t[n]);if(iO)for(var n of iO(t))oO.call(t,n)&&sO(e,n,t[n]);return e},lO=(e,t)=>nO(e,rO(t)),uO=(e,t)=>{var n={};for(var r in e)aO.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&iO)for(var r of iO(e))t.indexOf(r)<0&&oO.call(e,r)&&(n[r]=e[r]);return n},dO=lO(cO({},PS),{transitionProps:{duration:200,transition:`pop`},withOverlay:!0,withCloseButton:!0});function fO(e){let t=X(`Modal`,dO,e),{title:n,withOverlay:r,overlayProps:i,withCloseButton:a,closeButtonProps:o,children:s}=t,c=uO(t,[`title`,`withOverlay`,`overlayProps`,`withCloseButton`,`closeButtonProps`,`children`]),l=!!n||a;return Z.createElement(GD,cO({},c),r&&Z.createElement(FS.Overlay,cO({},i)),Z.createElement(eO,null,l&&Z.createElement(FS.Header,null,n&&Z.createElement(FS.Title,null,n),a&&Z.createElement(FS.CloseButton,cO({},o))),Z.createElement(FS.Body,null,s)))}fO.Root=GD,fO.CloseButton=FS.CloseButton,fO.Overlay=FS.Overlay,fO.Content=eO,fO.Header=FS.Header,fO.Title=FS.Title,fO.Body=FS.Body,fO.NativeScrollArea=FS.NativeScrollArea;var pO=Object.defineProperty,mO=Object.getOwnPropertySymbols,hO=Object.prototype.hasOwnProperty,gO=Object.prototype.propertyIsEnumerable,_O=(e,t,n)=>t in e?pO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vO=(e,t)=>{for(var n in t||={})hO.call(t,n)&&_O(e,n,t[n]);if(mO)for(var n of mO(t))gO.call(t,n)&&_O(e,n,t[n]);return e},yO=(e,t)=>{var n={};for(var r in e)hO.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&mO)for(var r of mO(e))t.indexOf(r)<0&&gO.call(e,r)&&(n[r]=e[r]);return n},bO={xs:J(14),sm:J(18),md:J(20),lg:J(24),xl:J(28)};function xO(e){var t=e,{size:n,error:r,style:i}=t,a=yO(t,[`size`,`error`,`style`]);let o=Zr(),s=Y({size:n,sizes:bO});return Z.createElement(`svg`,vO({viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:vO({color:r?o.colors.red[6]:o.colors.gray[6],width:s,height:s},i),"data-chevron":!0},a),Z.createElement(`path`,{d:`M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`}))}var SO=Object.defineProperty,CO=Object.defineProperties,wO=Object.getOwnPropertyDescriptors,TO=Object.getOwnPropertySymbols,EO=Object.prototype.hasOwnProperty,DO=Object.prototype.propertyIsEnumerable,OO=(e,t,n)=>t in e?SO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kO=(e,t)=>{for(var n in t||={})EO.call(t,n)&&OO(e,n,t[n]);if(TO)for(var n of TO(t))DO.call(t,n)&&OO(e,n,t[n]);return e},AO=(e,t)=>CO(e,wO(t));function jO({shouldClear:e,clearButtonProps:t,onClear:n,size:r,error:i}){return e?Z.createElement(Yf,AO(kO({},t),{variant:`transparent`,onClick:n,size:r,onMouseDown:e=>e.preventDefault()})):Z.createElement(xO,{error:i,size:r})}jO.displayName=`@mantine/core/SelectRightSection`;var MO=Object.defineProperty,NO=Object.defineProperties,PO=Object.getOwnPropertyDescriptors,FO=Object.getOwnPropertySymbols,IO=Object.prototype.hasOwnProperty,LO=Object.prototype.propertyIsEnumerable,RO=(e,t,n)=>t in e?MO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zO=(e,t)=>{for(var n in t||={})IO.call(t,n)&&RO(e,n,t[n]);if(FO)for(var n of FO(t))LO.call(t,n)&&RO(e,n,t[n]);return e},BO=(e,t)=>NO(e,PO(t)),VO=(e,t)=>{var n={};for(var r in e)IO.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&FO)for(var r of FO(e))t.indexOf(r)<0&&LO.call(e,r)&&(n[r]=e[r]);return n};function HO(e){var t=e,{styles:n,rightSection:r,rightSectionWidth:i,theme:a}=t,o=VO(t,[`styles`,`rightSection`,`rightSectionWidth`,`theme`]);if(r)return{rightSection:r,rightSectionWidth:i,styles:n};let s=typeof n==`function`?n(a):n;return{rightSection:!o.readOnly&&!(o.disabled&&o.shouldClear)&&Z.createElement(jO,zO({},o)),styles:BO(zO({},s),{rightSection:BO(zO({},s?.rightSection),{pointerEvents:o.shouldClear?void 0:`none`})})}}var UO=(e,t,n)=>Number.isInteger(e)&&e>=0&&t===0?`numeric`:!Number.isInteger(e)&&e>=0&&t!==0?`decimal`:Number.isInteger(e)&&e<0&&t===0||!Number.isInteger(e)&&e<0&&t!==0?n===`ios`?`text`:`decimal`:`numeric`;function WO({direction:e,size:t}){return Z.createElement(`svg`,{style:{width:J(t),height:J(t),transform:e===`up`?`rotate(180deg)`:void 0},viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},Z.createElement(`path`,{d:`M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`}))}var GO={xs:J(20),sm:J(24),md:J(30),lg:J(34),xl:J(36)},KO=Rr((e,{radius:t},{size:n})=>({rightSection:{display:`flex`,flexDirection:`column`,height:`calc(100% - ${J(2)})`,margin:J(1),overflow:`hidden`,borderTopRightRadius:e.fn.radius(t),borderBottomRightRadius:e.fn.radius(t)},control:{margin:0,position:`relative`,flex:`0 0 50%`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxSizing:`border-box`,width:Y({size:n,sizes:GO}),padding:0,WebkitTapHighlightColor:`transparent`,borderBottom:`${J(1)} solid ${e.colorScheme===`dark`?e.colors.dark[4]:e.colors.gray[4]}`,borderLeft:`${J(1)} solid ${e.colorScheme===`dark`?e.colors.dark[4]:e.colors.gray[4]}`,borderTop:0,borderRight:0,backgroundColor:`transparent`,marginRight:J(1),color:e.colorScheme===`dark`?e.colors.dark[0]:e.black,"&:not(:disabled):hover":{backgroundColor:e.colorScheme===`dark`?e.colors.dark[5]:e.colors.gray[0]},"&:disabled":{color:e.colorScheme===`dark`?e.colors.dark[3]:e.colors.gray[4]}},controlUp:{},controlDown:{borderBottom:0}})),qO=Object.defineProperty,JO=Object.defineProperties,YO=Object.getOwnPropertyDescriptors,XO=Object.getOwnPropertySymbols,ZO=Object.prototype.hasOwnProperty,QO=Object.prototype.propertyIsEnumerable,$O=(e,t,n)=>t in e?qO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ek=(e,t)=>{for(var n in t||={})ZO.call(t,n)&&$O(e,n,t[n]);if(XO)for(var n of XO(t))QO.call(t,n)&&$O(e,n,t[n]);return e},tk=(e,t)=>JO(e,YO(t)),nk=(e,t)=>{var n={};for(var r in e)ZO.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&XO)for(var r of XO(e))t.indexOf(r)<0&&QO.call(e,r)&&(n[r]=e[r]);return n},rk={type:`text`,size:`sm`,__staticSelector:`TextInput`},ik=(0,Z.forwardRef)((e,t)=>{let n=X_(`TextInput`,rk,e),{inputProps:r,wrapperProps:i}=n,a=nk(n,[`inputProps`,`wrapperProps`]);return Z.createElement(Ny.Wrapper,ek({},i),Z.createElement(Ny,tk(ek(ek({},r),a),{ref:t})))});ik.displayName=`@mantine/core/TextInput`;var ak=Object.defineProperty,ok=Object.defineProperties,sk=Object.getOwnPropertyDescriptors,ck=Object.getOwnPropertySymbols,lk=Object.prototype.hasOwnProperty,uk=Object.prototype.propertyIsEnumerable,dk=(e,t,n)=>t in e?ak(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fk=(e,t)=>{for(var n in t||={})lk.call(t,n)&&dk(e,n,t[n]);if(ck)for(var n of ck(t))uk.call(t,n)&&dk(e,n,t[n]);return e},pk=(e,t)=>ok(e,sk(t)),mk=(e,t)=>{var n={};for(var r in e)lk.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ck)for(var r of ck(e))t.indexOf(r)<0&&uk.call(e,r)&&(n[r]=e[r]);return n},hk=e=>e||``,gk=e=>{if(e===`-`)return e;let t=e;t[0]===`.`&&(t=`0${e}`);let n=parseFloat(t);return Number.isNaN(n)?``:e},_k={xs:J(10),sm:J(14),md:J(16),lg:J(18),xl:J(20)},vk={step:1,hideControls:!1,size:`sm`,precision:0,noClampOnBlur:!1,removeTrailingZeros:!1,decimalSeparator:`.`,formatter:hk,parser:gk,type:`text`},yk=(0,Z.forwardRef)((e,t)=>{let n=X(`NumberInput`,vk,e),{readOnly:r,disabled:i,value:a,onChange:o,decimalSeparator:s,thousandsSeparator:c,min:l,max:u,startValue:d,step:f,stepHoldInterval:p,stepHoldDelay:m,onFocus:h,onBlur:g,onKeyDown:_,onKeyUp:v,hideControls:y,radius:b,variant:x,precision:S,removeTrailingZeros:C,defaultValue:w,noClampOnBlur:T,handlersRef:E,classNames:D,styles:O,size:k,rightSection:A,rightSectionWidth:j,formatter:M,parser:N,inputMode:P,unstyled:F,type:I}=n,L=mk(n,`readOnly.disabled.value.onChange.decimalSeparator.thousandsSeparator.min.max.startValue.step.stepHoldInterval.stepHoldDelay.onFocus.onBlur.onKeyDown.onKeyUp.hideControls.radius.variant.precision.removeTrailingZeros.defaultValue.noClampOnBlur.handlersRef.classNames.styles.size.rightSection.rightSectionWidth.formatter.parser.inputMode.unstyled.type`.split(`.`)),{classes:R,cx:z}=KO({radius:b},{classNames:D,styles:O,unstyled:F,name:`NumberInput`,variant:x,size:k}),B=e=>{if(e===``)return``;let t=e.toFixed(S);return C&&S>0&&(t=t.replace(RegExp(`[0]{0,${S}}$`),``),t.endsWith(`.`)&&(t=t.slice(0,-1))),t},V=e=>{let t=e;return s&&(t=t.replace(`.`,s)),M(t)},ee=e=>{let t=e;return s&&(t=t.replaceAll(c,``).replace(s,`.`)),N(t)},te=e=>V(B(e)),[H,ne]=(0,Z.useState)(typeof a==`number`?a:typeof w==`number`?w:``),[re,ie]=(0,Z.useState)(()=>te(H)),U=(0,Z.useRef)(),[ae,oe]=(0,Z.useState)(!1),W=(e,t)=>{if(!ae||t){let t=te(e);t!==re&&ie(t)}e!==H&&ne(e)},se=typeof l==`number`?l:-1/0,ce=typeof u==`number`?u:1/0,le=(0,Z.useRef)();le.current=()=>{let e;e=H===``?d??l??0:parseFloat(B(Gu(H+f,se,ce))),W(e,!0),o?.(e)};let ue=(0,Z.useRef)();ue.current=()=>{let e;e=H===``?d??l??0:parseFloat(B(Gu(H-f,se,ce))),W(e,!0),o?.(e)},ud(E,{increment:le.current,decrement:ue.current}),(0,Z.useEffect)(()=>{ae||W(a===void 0?H:a,!0)},[a,ae]);let de=m!==void 0&&p!==void 0,fe=(0,Z.useRef)(null),pe=(0,Z.useRef)(0),me=()=>{fe.current&&window.clearTimeout(fe.current),fe.current=null,pe.current=0},he=e=>{e?le.current():ue.current(),pe.current+=1},ge=e=>{if(he(e),de){let t=typeof p==`number`?p:p(pe.current);fe.current=window.setTimeout(()=>ge(e),t)}},_e=(e,t)=>{e.preventDefault(),U.current.focus(),he(t),de&&(fe.current=window.setTimeout(()=>ge(t),m))};(0,Z.useEffect)(()=>(me(),me),[]);let ve=Z.createElement(`div`,{className:R.rightSection},Z.createElement(`button`,{type:`button`,tabIndex:-1,"aria-hidden":!0,disabled:H>=u,className:z(R.control,R.controlUp),onPointerDown:e=>{_e(e,!0)},onPointerUp:me,onPointerLeave:me},Z.createElement(WO,{size:Y({size:k,sizes:_k}),direction:`up`})),Z.createElement(`button`,{type:`button`,tabIndex:-1,"aria-hidden":!0,disabled:H<=l,className:z(R.control,R.controlDown),onPointerDown:e=>{_e(e,!1)},onPointerUp:me,onPointerLeave:me},Z.createElement(WO,{size:Y({size:k,sizes:_k}),direction:`down`}))),ye=e=>{let t=e;(t[0]===`${s}`||t[0]===`.`)&&(t=`0${t}`);let n=parseFloat(B(parseFloat(ee(t)))),r=T?n:Gu(n,se,ce),i=Number.isNaN(r)?``:r,a=H!==i;ie(e),W(i),a&&o?.(i)};return Z.createElement(ik,pk(fk({},L),{type:I,variant:x,value:re,disabled:i,readOnly:r,ref:fd(U,t),onChange:e=>{e.nativeEvent.isComposing||ye(e.target.value)},onFocus:e=>{oe(!0),h?.(e)},onBlur:e=>{oe(!1),g?.(e)},onKeyDown:e=>{if(typeof _==`function`&&_(e),e.repeat&&de&&(e.key===`ArrowUp`||e.key===`ArrowDown`)){e.preventDefault();return}r||(e.key===`ArrowUp`?_e(e,!0):e.key===`ArrowDown`&&_e(e,!1))},onKeyUp:e=>{typeof v==`function`&&v(e),(e.key===`ArrowUp`||e.key===`ArrowDown`)&&me()},rightSection:A||(i||r||y||x===`unstyled`?null:ve),rightSectionWidth:j??`calc(${Y({size:k,sizes:GO})} + ${J(1)})`,radius:b,max:u,min:l,step:f,size:k,styles:O,classNames:D,inputMode:P||UO(f,S,xd()),__staticSelector:`NumberInput`,unstyled:F}))});yk.displayName=`@mantine/core/NumberInput`;function bk({data:e,searchable:t,limit:n,searchValue:r,filter:i,value:a,filterDataOnExactSearchMatch:o}){if(!t)return e;let s=a==null?null:e.find(e=>e.value===a)||null;if(s&&!o&&s?.label===r){if(n){if(n>=e.length)return e;let t=e.indexOf(s),r=t+n,i=r-e.length;return i>0?e.slice(t-i):e.slice(t,r)}return e}let c=[];for(let t=0;t<e.length&&(i(r,e[t])&&c.push(e[t]),!(c.length>=n));t+=1);return c}var xk=Rr(()=>({input:{"&:not(:disabled)":{cursor:`pointer`,"&::selection":{backgroundColor:`transparent`}}}})),Sk=Object.defineProperty,Ck=Object.defineProperties,wk=Object.getOwnPropertyDescriptors,Tk=Object.getOwnPropertySymbols,Ek=Object.prototype.hasOwnProperty,Dk=Object.prototype.propertyIsEnumerable,Ok=(e,t,n)=>t in e?Sk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kk=(e,t)=>{for(var n in t||={})Ek.call(t,n)&&Ok(e,n,t[n]);if(Tk)for(var n of Tk(t))Dk.call(t,n)&&Ok(e,n,t[n]);return e},Ak=(e,t)=>Ck(e,wk(t)),jk=(e,t)=>{var n={};for(var r in e)Ek.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Tk)for(var r of Tk(e))t.indexOf(r)<0&&Dk.call(e,r)&&(n[r]=e[r]);return n};function Mk(e,t){return t.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function Nk(e,t){return!!e&&!t.some(t=>t.label.toLowerCase()===e.toLowerCase())}var Pk={required:!1,size:`sm`,shadow:`sm`,itemComponent:Fp,transitionProps:{transition:`fade`,duration:0},initiallyOpened:!1,filter:Mk,maxDropdownHeight:220,searchable:!1,clearable:!1,limit:1/0,disabled:!1,creatable:!1,shouldCreate:Nk,selectOnBlur:!1,switchDirectionOnFlip:!1,filterDataOnExactSearchMatch:!1,zIndex:Du(`popover`),positionDependencies:[],dropdownPosition:`flip`},Fk=(0,Z.forwardRef)((e,t)=>{let n=X_(`Select`,Pk,e),{inputProps:r,wrapperProps:i,shadow:a,data:o,value:s,defaultValue:c,onChange:l,itemComponent:u,onKeyDown:d,onBlur:f,onFocus:p,transitionProps:m,initiallyOpened:h,unstyled:g,classNames:_,styles:v,filter:y,maxDropdownHeight:b,searchable:x,clearable:S,nothingFound:C,limit:w,disabled:T,onSearchChange:E,searchValue:D,rightSection:O,rightSectionWidth:k,creatable:A,getCreateLabel:j,shouldCreate:M,selectOnBlur:N,onCreate:P,dropdownComponent:F,onDropdownClose:I,onDropdownOpen:L,withinPortal:R,portalProps:z,switchDirectionOnFlip:B,zIndex:V,name:ee,dropdownPosition:te,allowDeselect:H,placeholder:ne,filterDataOnExactSearchMatch:re,form:ie,positionDependencies:U,readOnly:ae,clearButtonProps:oe,hoverOnSearchChange:W}=n,se=jk(n,`inputProps.wrapperProps.shadow.data.value.defaultValue.onChange.itemComponent.onKeyDown.onBlur.onFocus.transitionProps.initiallyOpened.unstyled.classNames.styles.filter.maxDropdownHeight.searchable.clearable.nothingFound.limit.disabled.onSearchChange.searchValue.rightSection.rightSectionWidth.creatable.getCreateLabel.shouldCreate.selectOnBlur.onCreate.dropdownComponent.onDropdownClose.onDropdownOpen.withinPortal.portalProps.switchDirectionOnFlip.zIndex.name.dropdownPosition.allowDeselect.placeholder.filterDataOnExactSearchMatch.form.positionDependencies.readOnly.clearButtonProps.hoverOnSearchChange`.split(`.`)),{classes:ce,cx:le,theme:ue}=xk(),[de,fe]=(0,Z.useState)(h),[pe,me]=(0,Z.useState)(-1),he=(0,Z.useRef)(),ge=(0,Z.useRef)({}),[_e,ve]=(0,Z.useState)(`column`),ye=_e===`column`,{scrollIntoView:be,targetRef:xe,scrollableRef:Se}=yd({duration:0,offset:5,cancelable:!1,isList:!0}),Ce=H===void 0?S:H,we=e=>{if(de!==e){fe(e);let t=e?L:I;typeof t==`function`&&t()}},Te=A&&typeof j==`function`,Ee=null,De=wu({data:o.map(e=>typeof e==`string`?{label:e,value:e}:e)}),[Oe,ke,Ae]=pd({value:s,defaultValue:c,finalValue:null,onChange:l}),je=De.find(e=>e.value===Oe),[Me,Ne]=pd({value:D,defaultValue:je?.label||``,finalValue:void 0,onChange:E}),Pe=e=>{Ne(e),x&&typeof E==`function`&&E(e)},Fe=()=>{var e;ae||(ke(null),Ae||Pe(``),(e=he.current)==null||e.focus())};(0,Z.useEffect)(()=>{let e=De.find(e=>e.value===Oe);e?Pe(e.label):(!Te||!Oe)&&Pe(``)},[Oe]),(0,Z.useEffect)(()=>{je&&(!x||!de)&&Pe(je.label)},[je?.label]);let Ie=e=>{if(!ae)if(Ce&&je?.value===e.value)ke(null),we(!1);else{if(e.creatable&&typeof P==`function`){let t=P(e.value);t!=null&&ke(typeof t==`string`?t:t.value)}else ke(e.value);Ae||Pe(e.label),me(-1),we(!1),he.current.focus()}},Le=bk({data:De,searchable:x,limit:w,searchValue:Me,filter:y,filterDataOnExactSearchMatch:re,value:Oe});Te&&M(Me,Le)&&(Ee=j(Me),Le.push({label:Me,value:Me,creatable:!0}));let Re=(e,t,n)=>{let r=e;for(;n(r);)if(r=t(r),!Le[r].disabled)return r;return e};bi(()=>{me(W&&Me?0:-1)},[Me,W]);let ze=Oe?Le.findIndex(e=>e.value===Oe):0,G=!ae&&(Le.length>0?de:de&&!!C),Be=()=>{me(e=>{let t=Re(e,e=>e-1,e=>e>0);return xe.current=ge.current[Le[t]?.value],G&&be({alignment:ye?`start`:`end`}),t})},Ve=()=>{me(e=>{let t=Re(e,e=>e+1,e=>e<Le.length-1);return xe.current=ge.current[Le[t]?.value],G&&be({alignment:ye?`end`:`start`}),t})},He=()=>window.setTimeout(()=>{xe.current=ge.current[Le[ze]?.value],be({alignment:ye?`end`:`start`})},50);bi(()=>{G&&He()},[G]);let Ue=e=>{switch(typeof d==`function`&&d(e),e.key){case`ArrowUp`:e.preventDefault(),de?ye?Be():Ve():(me(ze),we(!0),He());break;case`ArrowDown`:e.preventDefault(),de?ye?Ve():Be():(me(ze),we(!0),He());break;case`Home`:if(!x){e.preventDefault(),de||we(!0);let t=Le.findIndex(e=>!e.disabled);me(t),G&&be({alignment:ye?`end`:`start`})}break;case`End`:if(!x){e.preventDefault(),de||we(!0);let t=Le.map(e=>!!e.disabled).lastIndexOf(!1);me(t),G&&be({alignment:ye?`end`:`start`})}break;case`Escape`:e.preventDefault(),we(!1),me(-1);break;case` `:x||(e.preventDefault(),Le[pe]&&de?Ie(Le[pe]):(we(!0),me(ze),He()));break;case`Enter`:x||e.preventDefault(),Le[pe]&&de&&(e.preventDefault(),Ie(Le[pe]))}},We=e=>{typeof f==`function`&&f(e);let t=De.find(e=>e.value===Oe);N&&Le[pe]&&de&&Ie(Le[pe]),Pe(t?.label||``),we(!1)},Ge=e=>{typeof p==`function`&&p(e),x&&we(!0)},K=e=>{ae||(Pe(e.currentTarget.value),S&&e.currentTarget.value===``&&ke(null),me(-1),we(!0))},Ke=()=>{ae||(we(!de),Oe&&!de&&me(ze))};return Z.createElement(Ny.Wrapper,Ak(kk({},i),{__staticSelector:`Select`}),Z.createElement(z_,{opened:G,transitionProps:m,shadow:a,withinPortal:R,portalProps:z,__staticSelector:`Select`,onDirectionChange:ve,switchDirectionOnFlip:B,zIndex:V,dropdownPosition:te,positionDependencies:[...U,Me],classNames:_,styles:v,unstyled:g,variant:r.variant},Z.createElement(z_.Target,null,Z.createElement(`div`,{role:`combobox`,"aria-haspopup":`listbox`,"aria-owns":G?`${r.id}-items`:null,"aria-controls":r.id,"aria-expanded":G,onMouseLeave:()=>me(-1),tabIndex:-1},Z.createElement(`input`,{type:`hidden`,name:ee,value:Oe||``,form:ie,disabled:T}),Z.createElement(Ny,kk(Ak(kk(kk({autoComplete:`off`,type:`search`},r),se),{ref:fd(t,he),onKeyDown:Ue,__staticSelector:`Select`,value:Me,placeholder:ne,onChange:K,"aria-autocomplete":`list`,"aria-controls":G?`${r.id}-items`:null,"aria-activedescendant":pe>=0?`${r.id}-${pe}`:null,onMouseDown:Ke,onBlur:We,onFocus:Ge,readOnly:!x||ae,disabled:T,"data-mantine-stop-propagation":G,name:null,classNames:Ak(kk({},_),{input:le({[ce.input]:!x},_?.input)})}),HO({theme:ue,rightSection:O,rightSectionWidth:k,styles:v,size:r.size,shouldClear:S&&!!je,onClear:Fe,error:i.error,clearButtonProps:oe,disabled:T,readOnly:ae}))))),Z.createElement(z_.Dropdown,{component:F||mh,maxHeight:b,direction:_e,id:r.id,innerRef:Se,__staticSelector:`Select`,classNames:_,styles:v},Z.createElement(Dp,{data:Le,hovered:pe,classNames:_,styles:v,isItemSelected:e=>e===Oe,uuid:r.id,__staticSelector:`Select`,onItemHover:me,onItemSelect:Ie,itemsRefs:ge,itemComponent:u,size:r.size,nothingFound:C,creatable:Te&&!!Ee,createLabel:Ee,"aria-label":i.label,unstyled:g,variant:r.variant}))))});Fk.displayName=`@mantine/core/Select`;function Ik(e,t){if(t.length===0)return t;let n=`maxWidth`in t[0]?`maxWidth`:`minWidth`,r=[...t].sort((t,r)=>hr(Y({size:r[n],sizes:e.breakpoints}))-hr(Y({size:t[n],sizes:e.breakpoints})));return n===`minWidth`?r.reverse():r}var Lk=Object.defineProperty,Rk=Object.getOwnPropertySymbols,zk=Object.prototype.hasOwnProperty,Bk=Object.prototype.propertyIsEnumerable,Vk=(e,t,n)=>t in e?Lk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hk=(e,t)=>{for(var n in t||={})zk.call(t,n)&&Vk(e,n,t[n]);if(Rk)for(var n of Rk(t))Bk.call(t,n)&&Vk(e,n,t[n]);return e},Uk=Rr((e,{spacing:t,breakpoints:n,cols:r,verticalSpacing:i})=>{let a=i!=null,o=Ik(e,n).reduce((n,r)=>{let o=`maxWidth`in r?`max-width`:`min-width`,s=hr(Y({size:o===`max-width`?r.maxWidth:r.minWidth,sizes:e.breakpoints,units:`em`}))-+(o===`max-width`);return n[`@media (${o}: ${$n(s)})`]={gridTemplateColumns:`repeat(${r.cols}, minmax(0, 1fr))`,gap:`${Y({size:r.verticalSpacing??(a?i:t),sizes:e.spacing})} ${Y({size:r.spacing??t,sizes:e.spacing})}`},n},{});return{root:Hk({boxSizing:`border-box`,display:`grid`,gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`,gap:`${Y({size:a?i:t,sizes:e.spacing})} ${Y({size:t,sizes:e.spacing})}`},o)}}),Wk=Object.defineProperty,Gk=Object.getOwnPropertySymbols,Kk=Object.prototype.hasOwnProperty,qk=Object.prototype.propertyIsEnumerable,Jk=(e,t,n)=>t in e?Wk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yk=(e,t)=>{for(var n in t||={})Kk.call(t,n)&&Jk(e,n,t[n]);if(Gk)for(var n of Gk(t))qk.call(t,n)&&Jk(e,n,t[n]);return e},Xk=(e,t)=>{var n={};for(var r in e)Kk.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Gk)for(var r of Gk(e))t.indexOf(r)<0&&qk.call(e,r)&&(n[r]=e[r]);return n},Zk={breakpoints:[],cols:1,spacing:`md`},Qk=(0,Z.forwardRef)((e,t)=>{let n=X(`SimpleGrid`,Zk,e),{className:r,breakpoints:i,cols:a,spacing:o,verticalSpacing:s,children:c,unstyled:l,variant:u}=n,d=Xk(n,[`className`,`breakpoints`,`cols`,`spacing`,`verticalSpacing`,`children`,`unstyled`,`variant`]),{classes:f,cx:p}=Uk({breakpoints:i,cols:a,spacing:o,verticalSpacing:s},{name:`SimpleGrid`,unstyled:l,variant:u});return Z.createElement(Ir,Yk({className:p(f.root,r),ref:t},d),c)});Qk.displayName=`@mantine/core/SimpleGrid`;var $k=Object.defineProperty,eA=Object.defineProperties,tA=Object.getOwnPropertyDescriptors,nA=Object.getOwnPropertySymbols,rA=Object.prototype.hasOwnProperty,iA=Object.prototype.propertyIsEnumerable,aA=(e,t,n)=>t in e?$k(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oA=(e,t)=>{for(var n in t||={})rA.call(t,n)&&aA(e,n,t[n]);if(nA)for(var n of nA(t))iA.call(t,n)&&aA(e,n,t[n]);return e},sA=(e,t)=>eA(e,tA(t)),cA=Rr((e,{captionSide:t,horizontalSpacing:n,verticalSpacing:r,fontSize:i,withBorder:a,withColumnBorders:o})=>{let s=`${J(1)} solid ${e.colorScheme===`dark`?e.colors.dark[4]:e.colors.gray[3]}`;return{root:sA(oA({},e.fn.fontStyles()),{width:`100%`,borderCollapse:`collapse`,captionSide:t,color:e.colorScheme===`dark`?e.colors.dark[0]:e.black,lineHeight:e.lineHeight,border:a?s:void 0,"& > caption":{marginTop:t===`top`?0:e.spacing.xs,marginBottom:t===`bottom`?0:e.spacing.xs,fontSize:e.fontSizes.sm,color:e.colorScheme===`dark`?e.colors.dark[2]:e.colors.gray[6]},"& > thead > tr > th, & > tfoot > tr > th, & > tbody > tr > th":{textAlign:`left`,fontWeight:`bold`,color:e.colorScheme===`dark`?e.colors.dark[0]:e.colors.gray[7],fontSize:Y({size:i,sizes:e.fontSizes}),padding:`${Y({size:r,sizes:e.spacing})} ${Y({size:n,sizes:e.spacing})}`},"& > thead > tr > th":{borderBottom:s},"& > tfoot > tr > th, & > tbody > tr > th":{borderTop:s},"& > tbody > tr > td":{padding:`${Y({size:r,sizes:e.spacing})} ${Y({size:n,sizes:e.spacing})}`,borderTop:s,fontSize:Y({size:i,sizes:e.fontSizes})},"& > tbody > tr:first-of-type > td, & > tbody > tr:first-of-type > th":{borderTop:`none`},"& > thead > tr > th, & > tbody > tr > td":{borderRight:o?s:`none`,"&:last-of-type":{borderRight:`none`,borderLeft:o?s:`none`}},"& > tbody > tr > th":{borderRight:o?s:`none`},"&[data-striped] > tbody > tr:nth-of-type(odd)":{backgroundColor:e.colorScheme===`dark`?e.colors.dark[6]:e.colors.gray[0]},"&[data-hover] > tbody > tr":e.fn.hover({backgroundColor:e.colorScheme===`dark`?e.colors.dark[5]:e.colors.gray[1]})})}}),lA=Object.defineProperty,uA=Object.defineProperties,dA=Object.getOwnPropertyDescriptors,fA=Object.getOwnPropertySymbols,pA=Object.prototype.hasOwnProperty,mA=Object.prototype.propertyIsEnumerable,hA=(e,t,n)=>t in e?lA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gA=(e,t)=>{for(var n in t||={})pA.call(t,n)&&hA(e,n,t[n]);if(fA)for(var n of fA(t))mA.call(t,n)&&hA(e,n,t[n]);return e},_A=(e,t)=>uA(e,dA(t)),vA=(e,t)=>{var n={};for(var r in e)pA.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&fA)for(var r of fA(e))t.indexOf(r)<0&&mA.call(e,r)&&(n[r]=e[r]);return n},yA={striped:!1,highlightOnHover:!1,captionSide:`top`,horizontalSpacing:`xs`,fontSize:`sm`,verticalSpacing:7,withBorder:!1,withColumnBorders:!1},bA=(0,Z.forwardRef)((e,t)=>{let n=X(`Table`,yA,e),{className:r,children:i,striped:a,highlightOnHover:o,captionSide:s,horizontalSpacing:c,verticalSpacing:l,fontSize:u,unstyled:d,withBorder:f,withColumnBorders:p,variant:m}=n,h=vA(n,[`className`,`children`,`striped`,`highlightOnHover`,`captionSide`,`horizontalSpacing`,`verticalSpacing`,`fontSize`,`unstyled`,`withBorder`,`withColumnBorders`,`variant`]),{classes:g,cx:_}=cA({captionSide:s,verticalSpacing:l,horizontalSpacing:c,fontSize:u,withBorder:f,withColumnBorders:p},{unstyled:d,name:`Table`,variant:m});return Z.createElement(Ir,_A(gA({},h),{component:`table`,ref:t,className:_(g.root,r),"data-striped":a||void 0,"data-hover":o||void 0}),i)});bA.displayName=`@mantine/core/Table`;var xA=(0,Z.createContext)(null);function SA(){return(0,Z.useContext)(xA)}function CA(e){let[t,n]=(0,Z.useState)(!1),r=e.moreInfo?e.moreInfo(e.item):null;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`tr`,{children:[e.columns.map((t,n)=>t.disabled?null:(0,Q.jsx)(`td`,{style:t.style,children:t.value(e.item,e.rowContext?e.rowContext(e.item):void 0)},String(n))),e.moreInfo&&(0,Q.jsx)(`td`,{children:r===null?(0,Q.jsx)(`p`,{children:`No Data Related`}):(0,Q.jsx)(q,{onClick:()=>n(!t),className:`ml-auto`,children:`More Info`})})]}),(e.isShowAll||t)&&r!==null&&(0,Q.jsx)(`tr`,{children:(0,Q.jsx)(`td`,{colSpan:12,children:(0,Q.jsx)(Gy,{style:{width:`100%`},withBorder:!0,shadow:`lg`,children:r})})})]})}function wA(e){let[t,n]=(0,Z.useState)(!1);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`flex flex-row justify-end w-full`,children:e.showButton===!0?(0,Q.jsx)(q,{type:`button`,onClick:()=>{n(e=>!e)},children:t?`Hide All`:`Show All`}):null}),(0,Q.jsxs)(bA,{striped:e.striped,highlightOnHover:e.highlightOnHover,children:[(0,Q.jsx)(`thead`,{style:e.stickyHeader?{position:`sticky`,top:0,zIndex:20}:{},children:(0,Q.jsxs)(`tr`,{className:`px-10 py-10 title-font tracking-wider font-medium text-gray-900 text-sm bg-gray-100 rounded-tl rounded-bl`,children:[e.columns.map((e,t)=>e.disabled?null:(0,Q.jsx)(`th`,{children:e.title},String(t))),e.moreInfo&&(0,Q.jsx)(`th`,{children:`More Info`})]})}),(0,Q.jsx)(`tbody`,{children:e.items.map((n,r)=>(0,Q.jsx)(CA,{columns:e.columns,item:n,moreInfo:e.moreInfo,isShowAll:t,rowContext:e.rowContext},r))})]})]})}function TA({data:e,onChange:t}){let n=Br(ut,e),[r,i]=(0,Z.useState)(n.accountantApproval);return(0,Z.useEffect)(()=>{r==null&&n.accountantApproval!=null&&i(n.accountantApproval)},[r,n.accountantApproval]),(0,Q.jsx)(W2,{value:r,businessTripId:n.id,onChange:t})}var EA=`creditShareholdersBusinessTripTravelAndSubsistence`,DA=()=>{let[{fetching:e},t]=p(F);return{fetching:e,creditShareholders:(0,Z.useCallback)(async e=>{let n=`Error crediting shareholders for trip ID ${e.businessTripId}`,r=`${EA}-${e.businessTripId}`;K.loading(`Crediting Shareholders`,{id:r});try{let i=Xe(await t(e),n,r);i&&K.success(`Shareholders Credited`,{id:r,description:`${i.creditShareholdersBusinessTripTravelAndSubsistence.length} Corresponding charges were successfully generated`})}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}};function OA({businessTripId:e}){let[t,n]=(0,Z.useState)(!1),{creditShareholders:r}=DA();return(0,Q.jsxs)(kD,{shadow:`md`,width:200,opened:t,children:[(0,Q.jsx)(kD.Target,{children:(0,Q.jsx)(zy,{opened:t,onClick:e=>{e.stopPropagation(),n(e=>!e)}})}),(0,Q.jsxs)(kD.Dropdown,{children:[(0,Q.jsx)(kD.Label,{children:`Summarize Trip`}),(0,Q.jsx)(t4,{onConfirm:()=>{r({businessTripId:e})},title:`Credit shareholders with travel and subsistence surplus?`,children:(0,Q.jsx)(kD.Item,{icon:(0,Q.jsx)(Zi,{size:14}),children:`Credit surplus T&S`})})]})]})}var kA=({data:e,onChange:t})=>{let n=Br(A,e),{name:r,dates:i,purpose:a,destination:o}=n;return(0,Q.jsxs)(Dw,{children:[(0,Q.jsxs)(Dw.Col,{span:12,className:`flex flex-row justify-between items-center`,children:[(0,Q.jsx)(ai,{fz:`xl`,children:r}),(0,Q.jsxs)(`div`,{className:`flex flex-row gap-2`,children:[(0,Q.jsx)(TA,{data:n,onChange:t}),(0,Q.jsx)(BA,{isLink:!0,content:`${window.location.origin}${yt.BUSINESS_TRIPS.DETAIL(n.id)}`}),(0,Q.jsx)(OA,{businessTripId:n.id})]})]}),(0,Q.jsxs)(Dw.Col,{xl:2,lg:3,md:6,children:[`From Date:`,(0,Q.jsx)(ai,{fz:`lg`,children:i?.start?dr(new Date(i.start),`dd/MM/yy`):`Missing`})]}),(0,Q.jsxs)(Dw.Col,{xl:2,lg:3,md:6,children:[`To Date:`,(0,Q.jsx)(ai,{fz:`lg`,children:i?.end?dr(new Date(i.end),`dd/MM/yy`):`Missing`})]}),(0,Q.jsxs)(Dw.Col,{xl:2,lg:3,md:6,children:[`Destination:`,(0,Q.jsx)(ai,{fz:`lg`,children:o?.name})]}),(0,Q.jsxs)(Dw.Col,{xl:4,lg:6,md:12,orderMd:6,children:[`Description:`,(0,Q.jsx)(ai,{fz:`lg`,children:a})]}),(0,Q.jsxs)(Dw.Col,{xl:2,lg:3,md:6,children:[`Total Days:`,(0,Q.jsx)(ai,{fz:`lg`,children:i?AA(i.start,i.end):`Missing`})]})]})};function AA(e,t){return Ks(cl(new Date(t),22),cl(new Date(e),6))+1}function jA(e){return e.split(`_`).map(MA).join(` `)}function MA(e){return e.slice(0,1).toUpperCase()+e.slice(1,e.length).toLowerCase()}var NA=({data:e})=>{let{summary:t}=Br(C,e);return t?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 mt-5`,children:[t.errors?.length&&(0,Q.jsxs)(Gy,{shadow:`xs`,p:`md`,children:[(0,Q.jsx)(ai,{c:`red`,children:`Errors:`}),(0,Q.jsx)(RT,{size:`sm`,withPadding:!0,children:t.errors.map((e,t)=>(0,Q.jsx)(RT.Item,{children:(0,Q.jsx)(ai,{c:`red`,children:e})},t))})]}),(0,Q.jsxs)(bA,{highlightOnHover:!0,withBorder:!0,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{children:`Expense Type`}),(0,Q.jsxs)(`th`,{children:[`Total `,kl(f.Usd)]}),(0,Q.jsxs)(`th`,{children:[`Total `,kl(f.Ils)]}),(0,Q.jsxs)(`th`,{children:[`Max Taxable `,kl(f.Usd)]}),(0,Q.jsxs)(`th`,{children:[`Taxable `,kl(f.Usd)]}),(0,Q.jsxs)(`th`,{children:[`Taxable `,kl(f.Ils)]}),(0,Q.jsx)(`th`,{children:`Excess Expenditure`})]})}),(0,Q.jsx)(`tbody`,{children:t.rows.map(e=>(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`td`,{children:jA(e.type)}),(0,Q.jsx)(`td`,{children:e.totalForeignCurrency?.formatted}),(0,Q.jsx)(`td`,{children:e.totalLocalCurrency?.formatted}),(0,Q.jsx)(`td`,{children:e.maxTaxableForeignCurrency?.formatted}),(0,Q.jsx)(`td`,{children:e.taxableForeignCurrency?.formatted}),(0,Q.jsx)(`td`,{children:e.taxableLocalCurrency?.formatted}),(0,Q.jsx)(`td`,{children:e.excessExpenditure?.formatted})]},e.type))})]}),(0,Q.jsxs)(Dw,{justify:`flex-end`,children:[(0,Q.jsxs)(Dw.Col,{lg:2,md:4,children:[`Excess Expenditure Tax:`,(0,Q.jsxs)(ai,{fz:`lg`,children:[t.excessTax??`0`,`%`]})]}),(0,Q.jsx)(Dw.Col,{lg:2,md:3,className:`flex flex-col justify-end`,children:(0,Q.jsx)(ai,{fz:`lg`,children:t.excessExpenditure?.formatted??`0.00`})})]})]}):(0,Q.jsx)(ai,{children:`Loading...`})},PA=({data:e})=>{let t=Br(Pe,e);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(kA,{data:t,onChange:()=>{}}),(0,Q.jsx)(NA,{data:t})]})};function FA(e){return(0,Q.jsx)(FK,{content:`To Charge`,children:(0,Q.jsx)(vt,{to:yt.CHARGES.DETAIL(e.chargeId),target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),className:`inline-block`,children:(0,Q.jsx)(q,{...e,className:s(`size-7.5`,e.className),variant:`ghost`,children:(0,Q.jsx)(Ui,{className:`size-5`})})})})}var IA=`closeDocument`,LA=()=>{let[{fetching:e},t]=p(it);return{fetching:e,closeDocument:(0,Z.useCallback)(async e=>{let n=`Error closing document ID [${e.documentId}]`,r=`${IA}-${e.documentId}`;K.loading(`Closing Document...`,{id:r});try{let i=Xe(await t(e),n,r,`closeDocument`);if(i)return K.success(`Success`,{id:r,description:`Document closed`}),i.closeDocument}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}return!1},[t])}};function RA({documentId:e,couldIssueCreditInvoice:t,...n}){let{closeDocument:r}=LA(),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(!1),c=(0,Z.useCallback)(()=>{r({documentId:e})},[r,e]);return t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(rr,{children:[(0,Q.jsx)(yr,{children:(0,Q.jsx)(q,{className:`size-7.5 text-red-600`,variant:`ghost`,...n,onClick:()=>a(!0),children:(0,Q.jsx)(Li,{className:`size-5`})})}),(0,Q.jsx)(or,{children:(0,Q.jsx)(`p`,{children:`Close Document`})})]}),(0,Q.jsx)(Jt,{open:i,onOpenChange:a,children:(0,Q.jsxs)(cn,{className:`sm:max-w-[425px]`,children:[(0,Q.jsx)($t,{children:(0,Q.jsx)(gn,{children:`Should Issue Credit Invoice?`})}),(0,Q.jsxs)(Xt,{children:[(0,Q.jsx)(q,{onClick:()=>{a(!1),c()},variant:`secondary`,children:`Just Close`}),(0,Q.jsx)(q,{onClick:()=>{a(!1),s(!0)},variant:`default`,children:`Issue Credit Invoice`})]})]})}),(0,Q.jsx)(N9,{documentId:e,documentType:G.CreditInvoice,open:o,setOpen:s})]}):(0,Q.jsx)(t4,{onConfirm:c,title:`Are you sure you want to close this document?`,children:(0,Q.jsx)(q,{className:`size-7.5 text-red-600`,variant:`ghost`,...n,children:(0,Q.jsxs)(rr,{children:[(0,Q.jsx)(yr,{children:(0,Q.jsx)(Li,{className:`size-5`})}),(0,Q.jsx)(or,{children:(0,Q.jsx)(`p`,{children:`Close Document`})})]})})})}function zA(e){return(0,Q.jsx)(q,{...e,variant:`ghost`,className:s(`size-7.5 text-green-500`,e.className),children:(0,Q.jsx)(dn,{className:`size-5`})})}var BA=({content:e,isLink:t})=>(0,Q.jsx)(q,{variant:`outline`,size:`icon`,className:`size-7.5`,onClick:()=>Cl(e),children:t?(0,Q.jsx)($i,{className:`size-5`}):(0,Q.jsx)(Vi,{className:`size-5`})}),VA=`deleteCharge`,HA=()=>{let[{fetching:e},t]=p(y);return{fetching:e,deleteCharge:(0,Z.useCallback)(async e=>{let n=`Error deleting charge ID [${e.chargeId}]`,r=`${VA}-${e.chargeId}`;K.loading(`Deleting charge`,{id:r});try{let i=Xe(await t(e),n,r);if(i){if(i.deleteCharge===!1)throw Error(`Unsuccessful deletion`);return K.success(`Success`,{id:r,description:`Charge was deleted`}),i.deleteCharge}}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}return!1},[t])}},UA=`deleteDocument`,WA=()=>{let[{fetching:e},t]=p(w);return{fetching:e,deleteDocument:(0,Z.useCallback)(async e=>{let n=`Error deleting document ID [${e.documentId}]`,r=`${UA}-${e.documentId}`;K.loading(`Deleting Document`,{id:r});try{let i=Xe(await t(e),n,r);if(i)return K.success(`Success`,{id:r,description:`Document was deleted`}),i.deleteDocument}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}return!1},[t])}};function GA({documentId:e}){let{deleteDocument:t}=WA();function n(){t({documentId:e})}return(0,Q.jsx)(t4,{onConfirm:n,title:`Are you sure you want to delete this document?`,children:(0,Q.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7.5 text-red-500`,children:(0,Q.jsx)(ya,{className:`size-5`})})})}function KA(e,t){let n=new Uint8Array([239,187,191]),r=new Blob([n,e],{type:`text/csv;charset=UTF-8`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${t}.csv`,document.body.appendChild(a),a.click(),document.body.removeChild(a)}var qA=({createFileVariables:e,buttonProps:t,buttonContent:n,label:r})=>{let i=(0,Z.useCallback)(()=>{e().then(({fileContent:e,fileName:t})=>{KA(e,t)})},[e]);return(0,Q.jsxs)(rr,{children:[(0,Q.jsx)(yr,{children:(0,Q.jsx)(q,{variant:`outline`,className:`p-2`,...t,onClick:i,children:n||(0,Q.jsx)(Ki,{size:20})})}),(0,Q.jsx)(or,{children:(0,Q.jsx)(`p`,{children:r||`Download CSV`})})]})};function JA(e){return(0,Q.jsx)(FK,{disabled:!e.tooltip,content:e.tooltip,children:(0,Q.jsx)(q,{className:`size-7.5`,variant:`ghost`,...e,children:(0,Q.jsx)(_a,{className:`size-5`})})})}function YA(e){return(0,Q.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7.5`,...e,children:(0,Q.jsx)(ln,{className:`size-5`})})}function XA(){let{logout:e}=bt();return async()=>{sessionStorage.clear(),await e({logoutParams:{returnTo:`${window.location.origin}${yt.LOGIN}`}})}}function ZA(){return(0,Q.jsx)(q,{variant:`ghost`,onClick:XA(),children:`Log out`})}var QA=Uint8Array,$A=Uint16Array,ej=Int32Array,tj=new QA([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),nj=new QA([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),rj=new QA([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ij=function(e,t){for(var n=new $A(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new ej(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},aj=ij(tj,2),oj=aj.b,sj=aj.r;oj[28]=258,sj[258]=28;var cj=ij(nj,0);cj.b;for(var lj=cj.r,uj=new $A(32768),dj=0;dj<32768;++dj){var fj=(dj&43690)>>1|(dj&21845)<<1;fj=(fj&52428)>>2|(fj&13107)<<2,fj=(fj&61680)>>4|(fj&3855)<<4,uj[dj]=((fj&65280)>>8|(fj&255)<<8)>>1}for(var pj=(function(e,t,n){for(var r=e.length,i=0,a=new $A(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new $A(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new $A(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[uj[d]>>c]=l}else for(s=new $A(r),i=0;i<r;++i)e[i]&&(s[i]=uj[o[e[i]-1]++]>>15-e[i]);return s}),mj=new QA(288),dj=0;dj<144;++dj)mj[dj]=8;for(var dj=144;dj<256;++dj)mj[dj]=9;for(var dj=256;dj<280;++dj)mj[dj]=7;for(var dj=280;dj<288;++dj)mj[dj]=8;for(var hj=new QA(32),dj=0;dj<32;++dj)hj[dj]=5;var gj=pj(mj,9,0),_j=pj(hj,5,0),vj=function(e){return(e+7)/8|0},yj=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new QA(e.subarray(t,n))},bj=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},xj=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},Sj=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return{t:kj,l:0};if(i==1){var o=new QA(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};for(var f=a[0].s,r=1;r<i;++r)a[r].s>f&&(f=a[r].s);var p=new $A(f+1),m=Cj(n[u-1],p,0);if(m>t){var r=0,h=0,g=m-t,_=1<<g;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<i;++r){var v=a[r].s;if(p[v]>t)h+=_-(1<<m-p[v]),p[v]=t;else break}for(h>>=g;h>0;){var y=a[r].s;p[y]<t?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}return{t:new QA(p),l:m}},Cj=function(e,t,n){return e.s==-1?Math.max(Cj(e.l,t,n+1),Cj(e.r,t,n+1)):t[e.s]=n},wj=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new $A(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return{c:n.subarray(0,r),n:t}},Tj=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Ej=function(e,t,n){var r=n.length,i=vj(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},Dj=function(e,t,n,r,i,a,o,s,c,l,u){bj(t,u++,n),++i[256];for(var d=Sj(i,15),f=d.t,p=d.l,m=Sj(a,15),h=m.t,g=m.l,_=wj(f),v=_.c,y=_.n,b=wj(h),x=b.c,S=b.n,C=new $A(19),w=0;w<v.length;++w)++C[v[w]&31];for(var w=0;w<x.length;++w)++C[x[w]&31];for(var T=Sj(C,7),E=T.t,D=T.l,O=19;O>4&&!E[rj[O-1]];--O);var k=l+5<<3,A=Tj(i,mj)+Tj(a,hj)+o,j=Tj(i,f)+Tj(a,h)+o+14+3*O+Tj(C,E)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&k<=A&&k<=j)return Ej(t,u,e.subarray(c,c+l));var M,N,P,F;if(bj(t,u,1+(j<A)),u+=2,j<A){M=pj(f,p,0),N=f,P=pj(h,g,0),F=h;var I=pj(E,D,0);bj(t,u,y-257),bj(t,u+5,S-1),bj(t,u+10,O-4),u+=14;for(var w=0;w<O;++w)bj(t,u+3*w,E[rj[w]]);u+=3*O;for(var L=[v,x],R=0;R<2;++R)for(var z=L[R],w=0;w<z.length;++w){var B=z[w]&31;bj(t,u,I[B]),u+=E[B],B>15&&(bj(t,u,z[w]>>5&127),u+=z[w]>>12)}}else M=gj,N=mj,P=_j,F=hj;for(var w=0;w<s;++w){var V=r[w];if(V>255){var B=V>>18&31;xj(t,u,M[B+257]),u+=N[B+257],B>7&&(bj(t,u,V>>23&31),u+=tj[B]);var ee=V&31;xj(t,u,P[ee]),u+=F[ee],ee>3&&(xj(t,u,V>>5&8191),u+=nj[ee])}else xj(t,u,M[V]),u+=N[V]}return xj(t,u,M[256]),u+N[256]},Oj=new ej([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),kj=new QA(0),Aj=function(e,t,n,r,i,a){var o=a.z||e.length,s=new QA(r+o+5*(1+Math.ceil(o/7e3))+i),c=s.subarray(r,s.length-i),l=a.l,u=(a.r||0)&7;if(t){u&&(c[0]=a.r>>3);for(var d=Oj[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=a.p||new $A(32768),g=a.h||new $A(m+1),_=Math.ceil(n/3),v=2*_,y=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<v)&m},b=new ej(25e3),x=new $A(288),S=new $A(32),C=0,w=0,T=a.i||0,E=0,D=a.w||0,O=0;T+2<o;++T){var k=y(T),A=T&32767,j=g[k];if(h[A]=j,g[k]=A,D<=T){var M=o-T;if((C>7e3||E>24576)&&(M>423||!l)){u=Dj(e,c,0,b,x,S,w,E,O,T-O,u),E=C=w=0,O=T;for(var N=0;N<286;++N)x[N]=0;for(var N=0;N<30;++N)S[N]=0}var P=2,F=0,I=p,L=A-j&32767;if(M>2&&k==y(T-L))for(var R=Math.min(f,M)-1,z=Math.min(32767,T),B=Math.min(258,M);L<=z&&--I&&A!=j;){if(e[T+P]==e[T+P-L]){for(var V=0;V<B&&e[T+V]==e[T+V-L];++V);if(V>P){if(P=V,F=L,V>R)break;for(var ee=Math.min(L,V-2),te=0,N=0;N<ee;++N){var H=T-L+N&32767,ne=H-h[H]&32767;ne>te&&(te=ne,j=H)}}}A=j,j=h[A],L+=A-j&32767}if(F){b[E++]=268435456|sj[P]<<18|lj[F];var re=sj[P]&31,ie=lj[F]&31;w+=tj[re]+nj[ie],++x[257+re],++S[ie],D=T+P,++C}else b[E++]=e[T],++x[e[T]]}}for(T=Math.max(T,D);T<o;++T)b[E++]=e[T],++x[e[T]];u=Dj(e,c,l,b,x,S,w,E,O,T-O,u),l||(a.r=u&7|c[u/8|0]<<3,u-=7,a.h=g,a.p=h,a.i=T,a.w=D)}else{for(var T=a.w||0;T<o+l;T+=65535){var U=T+65535;U>=o&&(c[u/8|0]=l,U=o),u=Ej(c,u+1,e.subarray(T,U))}a.i=o}return yj(s,0,r+vj(u)+i)},jj=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,a=n.length|0,o=0;o!=a;){for(var s=Math.min(o+2655,a);o<s;++o)i+=r+=n[o];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}e=r,t=i},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},Mj=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new QA(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return Aj(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},Nj=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},Pj=function(e,t){var n=t.level,r=n==0?0:n<6?1:n==9?3:2;if(e[0]=120,e[1]=r<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var i=jj();i.p(t.dictionary),Nj(e,2,i.d())}};function Fj(e,t){t||={};var n=jj();n.p(e);var r=Mj(e,t,t.dictionary?6:2,4);return Pj(r,t),Nj(r,r.length-4,n.d()),r}var Ij=typeof TextDecoder<`u`&&new TextDecoder;try{Ij.decode(kj,{stream:!0})}catch{}function Lj(e){if(Array.isArray(e))return e}function Rj(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function zj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Bj(e,t){if(e){if(typeof e==`string`)return zj(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zj(e,t):void 0}}function Vj(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hj(e,t){return Lj(e)||Rj(e,t)||Bj(e,t)||Vj()}function Uj(e,t=`utf8`){return new TextDecoder(t).decode(e)}var Wj=new TextEncoder;function Gj(e){return Wj.encode(e)}var Kj=1024*8,qj=(()=>{let e=new Uint8Array(4),t=new Uint32Array(e.buffer);return!((t[0]=1)&e[0])})(),Jj={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array},Yj=class e{buffer;byteLength;byteOffset;length;offset;lastWrittenByte;littleEndian;_data;_mark;_marks;constructor(t=Kj,n={}){let r=!1;typeof t==`number`?t=new ArrayBuffer(t):(r=!0,this.lastWrittenByte=t.byteLength);let i=n.offset?n.offset>>>0:0,a=t.byteLength-i,o=i;(ArrayBuffer.isView(t)||t instanceof e)&&(t.byteLength!==t.buffer.byteLength&&(o=t.byteOffset+i),t=t.buffer),r?this.lastWrittenByte=a:this.lastWrittenByte=0,this.buffer=t,this.length=a,this.byteLength=a,this.byteOffset=o,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,o,a),this._mark=0,this._marks=[]}available(e=1){return this.offset+e<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(e=1){return this.offset+=e,this}back(e=1){return this.offset-=e,this}seek(e){return this.offset=e,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){let e=this._marks.pop();if(e===void 0)throw Error(`Mark stack empty`);return this.seek(e),this}rewind(){return this.offset=0,this}ensureAvailable(e=1){if(!this.available(e)){let t=(this.offset+e)*2,n=new Uint8Array(t);n.set(new Uint8Array(this.buffer)),this.buffer=n.buffer,this.length=t,this.byteLength=t,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(e=1){return this.readArray(e,`uint8`)}readArray(e,t){let n=Jj[t].BYTES_PER_ELEMENT*e,r=this.byteOffset+this.offset,i=this.buffer.slice(r,r+n);if(this.littleEndian===qj&&t!==`uint8`&&t!==`int8`){let e=new Uint8Array(this.buffer.slice(r,r+n));e.reverse();let i=new Jj[t](e.buffer);return this.offset+=n,i.reverse(),i}let a=new Jj[t](i);return this.offset+=n,a}readInt16(){let e=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}readUint16(){let e=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,e}readInt32(){let e=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}readUint32(){let e=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat32(){let e=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat64(){let e=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}readBigInt64(){let e=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,e}readBigUint64(){let e=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,e}readChar(){return String.fromCharCode(this.readInt8())}readChars(e=1){let t=``;for(let n=0;n<e;n++)t+=this.readChar();return t}readUtf8(e=1){return Uj(this.readBytes(e))}decodeText(e=1,t=`utf8`){return Uj(this.readBytes(e),t)}writeBoolean(e){return this.writeUint8(e?255:0),this}writeInt8(e){return this.ensureAvailable(1),this._data.setInt8(this.offset++,e),this._updateLastWrittenByte(),this}writeUint8(e){return this.ensureAvailable(1),this._data.setUint8(this.offset++,e),this._updateLastWrittenByte(),this}writeByte(e){return this.writeUint8(e)}writeBytes(e){this.ensureAvailable(e.length);for(let t=0;t<e.length;t++)this._data.setUint8(this.offset++,e[t]);return this._updateLastWrittenByte(),this}writeInt16(e){return this.ensureAvailable(2),this._data.setInt16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(e){return this.ensureAvailable(2),this._data.setUint16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(e){return this.ensureAvailable(4),this._data.setInt32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(e){return this.ensureAvailable(4),this._data.setUint32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(e){return this.ensureAvailable(4),this._data.setFloat32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(e){return this.ensureAvailable(8),this._data.setFloat64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(e){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(e){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(e){return this.writeUint8(e.charCodeAt(0))}writeChars(e){for(let t=0;t<e.length;t++)this.writeUint8(e.charCodeAt(t));return this}writeUtf8(e){return this.writeBytes(Gj(e))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}getWrittenByteLength(){return this.lastWrittenByte-this.byteOffset}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}},Xj=4,Zj=0,Qj=1,$j=2;function eM(e){let t=e.length;for(;--t>=0;)e[t]=0}var tM=0,nM=1,rM=2,iM=29,aM=256,oM=286,sM=30,cM=19,lM=573,uM=15,dM=16,fM=7,pM=256,mM=16,hM=17,gM=18,_M=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),vM=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),yM=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),bM=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),xM=512,SM=Array(288*2);eM(SM);var CM=Array(sM*2);eM(CM);var wM=Array(xM);eM(wM);var TM=Array(256);eM(TM);var EM=Array(iM);eM(EM);var DM=Array(sM);eM(DM);function OM(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}var kM,AM,jM;function MM(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}var NM=e=>e<256?wM[e]:wM[256+(e>>>7)],PM=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},FM=(e,t,n)=>{e.bi_valid>dM-n?(e.bi_buf|=t<<e.bi_valid&65535,PM(e,e.bi_buf),e.bi_buf=t>>dM-e.bi_valid,e.bi_valid+=n-dM):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},IM=(e,t,n)=>{FM(e,n[t*2],n[t*2+1])},LM=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},RM=e=>{e.bi_valid===16?(PM(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},zM=(e,t)=>{let n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length,l,u,d,f,p,m,h=0;for(f=0;f<=uM;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<lM;l++)u=e.heap[l],f=n[n[u*2+1]*2+1]+1,f>c&&(f=c,h++),n[u*2+1]=f,!(u>r)&&(e.bl_count[f]++,p=0,u>=s&&(p=o[u-s]),m=n[u*2],e.opt_len+=m*(f+p),a&&(e.static_len+=m*(i[u*2+1]+p)));if(h!==0){do{for(f=c-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[c]--,h-=2}while(h>0);for(f=c;f!==0;f--)for(u=e.bl_count[f];u!==0;)d=e.heap[--l],!(d>r)&&(n[d*2+1]!==f&&(e.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),u--)}},BM=(e,t,n)=>{let r=Array(16),i=0,a,o;for(a=1;a<=uM;a++)i=i+n[a-1]<<1,r[a]=i;for(o=0;o<=t;o++){let t=e[o*2+1];t!==0&&(e[o*2]=LM(r[t]++,t))}},VM=()=>{let e,t,n,r,i,a=Array(16);for(n=0,r=0;r<iM-1;r++)for(EM[r]=n,e=0;e<1<<_M[r];e++)TM[n++]=r;for(TM[n-1]=r,i=0,r=0;r<16;r++)for(DM[r]=i,e=0;e<1<<vM[r];e++)wM[i++]=r;for(i>>=7;r<sM;r++)for(DM[r]=i<<7,e=0;e<1<<vM[r]-7;e++)wM[256+i++]=r;for(t=0;t<=uM;t++)a[t]=0;for(e=0;e<=143;)SM[e*2+1]=8,e++,a[8]++;for(;e<=255;)SM[e*2+1]=9,e++,a[9]++;for(;e<=279;)SM[e*2+1]=7,e++,a[7]++;for(;e<=287;)SM[e*2+1]=8,e++,a[8]++;for(BM(SM,287,a),e=0;e<sM;e++)CM[e*2+1]=5,CM[e*2]=LM(e,5);kM=new OM(SM,_M,257,oM,uM),AM=new OM(CM,vM,0,sM,uM),jM=new OM([],yM,0,cM,fM)},HM=e=>{let t;for(t=0;t<oM;t++)e.dyn_ltree[t*2]=0;for(t=0;t<sM;t++)e.dyn_dtree[t*2]=0;for(t=0;t<cM;t++)e.bl_tree[t*2]=0;e.dyn_ltree[pM*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},UM=e=>{e.bi_valid>8?PM(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},WM=(e,t,n,r)=>{let i=t*2,a=n*2;return e[i]<e[a]||e[i]===e[a]&&r[t]<=r[n]},GM=(e,t,n)=>{let r=e.heap[n],i=n<<1;for(;i<=e.heap_len&&(i<e.heap_len&&WM(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!WM(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r},KM=(e,t,n)=>{let r,i,a=0,o,s;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+a++]&255,r+=(e.pending_buf[e.sym_buf+a++]&255)<<8,i=e.pending_buf[e.sym_buf+a++],r===0?IM(e,i,t):(o=TM[i],IM(e,o+aM+1,t),s=_M[o],s!==0&&(i-=EM[o],FM(e,i,s)),r--,o=NM(r),IM(e,o,n),s=vM[o],s!==0&&(r-=DM[o],FM(e,r,s)));while(a<e.sym_next);IM(e,pM,t)},qM=(e,t)=>{let n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,a=t.stat_desc.elems,o,s,c=-1,l;for(e.heap_len=0,e.heap_max=lM,o=0;o<a;o++)n[o*2]===0?n[o*2+1]=0:(e.heap[++e.heap_len]=c=o,e.depth[o]=0);for(;e.heap_len<2;)l=e.heap[++e.heap_len]=c<2?++c:0,n[l*2]=1,e.depth[l]=0,e.opt_len--,i&&(e.static_len-=r[l*2+1]);for(t.max_code=c,o=e.heap_len>>1;o>=1;o--)GM(e,n,o);l=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],GM(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,n[l*2]=n[o*2]+n[s*2],e.depth[l]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,n[o*2+1]=n[s*2+1]=l,e.heap[1]=l++,GM(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],zM(e,t),BM(n,c,e.bl_count)},JM=(e,t,n)=>{let r,i=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)a=o,o=t[(r+1)*2+1],!(++s<c&&a===o)&&(s<l?e.bl_tree[a*2]+=s:a===0?s<=10?e.bl_tree[hM*2]++:e.bl_tree[gM*2]++:(a!==i&&e.bl_tree[a*2]++,e.bl_tree[mM*2]++),s=0,i=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4))},YM=(e,t,n)=>{let r,i=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),r=0;r<=n;r++)if(a=o,o=t[(r+1)*2+1],!(++s<c&&a===o)){if(s<l)do IM(e,a,e.bl_tree);while(--s!==0);else a===0?s<=10?(IM(e,hM,e.bl_tree),FM(e,s-3,3)):(IM(e,gM,e.bl_tree),FM(e,s-11,7)):(a!==i&&(IM(e,a,e.bl_tree),s--),IM(e,mM,e.bl_tree),FM(e,s-3,2));s=0,i=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4)}},XM=e=>{let t;for(JM(e,e.dyn_ltree,e.l_desc.max_code),JM(e,e.dyn_dtree,e.d_desc.max_code),qM(e,e.bl_desc),t=cM-1;t>=3&&e.bl_tree[bM[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},ZM=(e,t,n,r)=>{let i;for(FM(e,t-257,5),FM(e,n-1,5),FM(e,r-4,4),i=0;i<r;i++)FM(e,e.bl_tree[bM[i]*2+1],3);YM(e,e.dyn_ltree,t-1),YM(e,e.dyn_dtree,n-1)},QM=e=>{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return Zj;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return Qj;for(n=32;n<aM;n++)if(e.dyn_ltree[n*2]!==0)return Qj;return Zj},$M=!1,eN=e=>{$M||=(VM(),!0),e.l_desc=new MM(e.dyn_ltree,kM),e.d_desc=new MM(e.dyn_dtree,AM),e.bl_desc=new MM(e.bl_tree,jM),e.bi_buf=0,e.bi_valid=0,HM(e)},tN=(e,t,n,r)=>{FM(e,(tM<<1)+ +!!r,3),UM(e),PM(e,n),PM(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},nN={_tr_init:eN,_tr_stored_block:tN,_tr_flush_block:(e,t,n,r)=>{let i,a,o=0;e.level>0?(e.strm.data_type===$j&&(e.strm.data_type=QM(e)),qM(e,e.l_desc),qM(e,e.d_desc),o=XM(e),i=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=i&&(i=a)):i=a=n+5,n+4<=i&&t!==-1?tN(e,t,n,r):e.strategy===Xj||a===i?(FM(e,(nM<<1)+ +!!r,3),KM(e,SM,CM)):(FM(e,(rM<<1)+ +!!r,3),ZM(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),KM(e,e.dyn_ltree,e.dyn_dtree)),HM(e),r&&UM(e)},_tr_tally:(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(TM[n]+aM+1)*2]++,e.dyn_dtree[NM(t)*2]++),e.sym_next===e.sym_end),_tr_align:e=>{FM(e,nM<<1,3),IM(e,pM,SM),RM(e)}},rN=(e,t,n,r)=>{let i=e&65535|0,a=e>>>16&65535|0,o=0;for(;n!==0;){o=n>2e3?2e3:n,n-=o;do i=i+t[r++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0},iN=new Uint32Array((()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t})()),aN=(e,t,n,r)=>{let i=iN,a=r+n;e^=-1;for(let n=r;n<a;n++)e=e>>>8^i[(e^t[n])&255];return e^-1},oN={2:`need dictionary`,1:`stream end`,0:``,"-1":`file error`,"-2":`stream error`,"-3":`data error`,"-4":`insufficient memory`,"-5":`buffer error`,"-6":`incompatible version`},sN={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:cN,_tr_stored_block:lN,_tr_flush_block:uN,_tr_tally:dN,_tr_align:fN}=nN,{Z_NO_FLUSH:pN,Z_PARTIAL_FLUSH:mN,Z_FULL_FLUSH:hN,Z_FINISH:gN,Z_BLOCK:_N,Z_OK:vN,Z_STREAM_END:yN,Z_STREAM_ERROR:bN,Z_DATA_ERROR:xN,Z_BUF_ERROR:SN,Z_DEFAULT_COMPRESSION:CN,Z_FILTERED:wN,Z_HUFFMAN_ONLY:TN,Z_RLE:EN,Z_FIXED:DN,Z_DEFAULT_STRATEGY:ON,Z_UNKNOWN:kN,Z_DEFLATED:AN}=sN,jN=9,MN=15,NN=8,PN=573,FN=3,IN=258,LN=262,RN=32,zN=42,BN=57,VN=69,HN=73,UN=91,WN=103,GN=113,KN=666,qN=1,JN=2,YN=3,XN=4,ZN=3,QN=(e,t)=>(e.msg=oN[t],t),$N=e=>e*2-(e>4?9:0),eP=e=>{let t=e.length;for(;--t>=0;)e[t]=0},tP=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)},nP=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask,rP=(e,t)=>{let n;if(e.legacy_hash)n=e.ins_h=nP(e,e.ins_h,e.window[t+FN-1]);else{let r=e.window,i=r[t]|r[t+1]<<8|r[t+2]<<16|r[t+3]<<24;n=e.ins_h=Math.imul(i,66521)+66521>>>16&e.hash_mask}let r=e.prev[t&e.w_mask]=e.head[n];return e.head[n]=t,r},iP=e=>{let t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},aP=(e,t)=>{uN(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,iP(e.strm)},oP=(e,t)=>{e.pending_buf[e.pending++]=t},sP=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},cP=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=rN(e.adler,t,i,n):e.state.wrap===2&&(e.adler=aN(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},lP=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,a,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-LN?e.strstart-(e.w_size-LN):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+IN,p=l[r+o-1],m=l[r+o];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(i=t,l[i+o]!==m||l[i+o-1]!==p||l[i]!==l[r]||l[++i]!==l[r+1])continue;r+=2,i++;do;while(l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&r<f);if(a=IN-(f-r),r=f-IN,a>o){if(e.match_start=t,o=a,a>=s)break;p=l[r+o-1],m=l[r+o]}}while((t=d[t&u])>c&&--n!==0);return o<=e.lookahead?o:e.lookahead},uP=e=>{let t=e.w_size,n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-LN)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),tP(e),r+=t),e.strm.avail_in===0)break;if(n=cP(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,!e.legacy_hash){if(e.lookahead+e.insert>FN)for(i=e.strstart-e.insert;e.insert&&(rP(e,i),i++,e.insert--,!(e.lookahead+e.insert<=FN)););}else if(e.lookahead+e.insert>=FN)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=nP(e,e.ins_h,e.window[i+1]);e.insert&&(rP(e,i),i++,e.insert--,!(e.lookahead+e.insert<FN)););}while(e.lookahead<LN&&e.strm.avail_in!==0)},dP=(e,t)=>{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,a,o=0,s=e.strm.avail_in;do{if(r=65535,a=e.bi_valid+42>>3,e.strm.avail_out<a||(a=e.strm.avail_out-a,i=e.strstart-e.block_start,r>i+e.strm.avail_in&&(r=i+e.strm.avail_in),r>a&&(r=a),r<n&&(r===0&&t!==gN||t===pN||r!==i+e.strm.avail_in)))break;o=+(t===gN&&r===i+e.strm.avail_in),lN(e,0,0,o),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,iP(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(cP(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(o===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),o?XN:t!==pN&&t!==gN&&e.strm.avail_in===0&&e.strstart===e.block_start?JN:(a=e.window_size-e.strstart,e.strm.avail_in>a&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(cP(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water<e.strstart&&(e.high_water=e.strstart),a=e.bi_valid+42>>3,a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a,n=a>e.w_size?e.w_size:a,i=e.strstart-e.block_start,(i>=n||(i||t===gN)&&t!==pN&&e.strm.avail_in===0&&i<=a)&&(r=i>a?a:i,o=+(t===gN&&e.strm.avail_in===0&&r===i),lN(e,e.block_start,r,o),e.block_start+=r,iP(e.strm)),o?YN:qN)},fP=(e,t)=>{let n,r;for(;;){if(e.lookahead<LN){if(uP(e),e.lookahead<LN&&t===pN)return qN;if(e.lookahead===0)break}if(n=0,e.lookahead>=FN&&(n=rP(e,e.strstart)),n!==0&&e.strstart-n<=e.w_size-LN&&(e.match_length=lP(e,n)),e.match_length>=FN)if(r=dN(e,e.strstart-e.match_start,e.match_length-FN),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=FN){e.match_length--;do e.strstart++,n=rP(e,e.strstart);while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.legacy_hash&&(e.ins_h=e.window[e.strstart],e.ins_h=nP(e,e.ins_h,e.window[e.strstart+1]));else r=dN(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(aP(e,!1),e.strm.avail_out===0))return qN}return e.insert=e.strstart<FN-1?e.strstart:FN-1,t===gN?(aP(e,!0),e.strm.avail_out===0?YN:XN):e.sym_next&&(aP(e,!1),e.strm.avail_out===0)?qN:JN},pP=(e,t)=>{let n,r,i;for(;;){if(e.lookahead<LN){if(uP(e),e.lookahead<LN&&t===pN)return qN;if(e.lookahead===0)break}if(n=0,e.lookahead>=FN&&(n=rP(e,e.strstart)),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=FN-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-LN&&(e.match_length=lP(e,n),e.match_length<=5&&(e.strategy===wN||e.match_length===FN&&e.strstart-e.match_start>4096)&&(e.match_length=FN-1)),e.prev_length>=FN&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-FN,r=dN(e,e.strstart-1-e.prev_match,e.prev_length-FN),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(n=rP(e,e.strstart));while(--e.prev_length!==0);if(e.match_available=0,e.match_length=FN-1,e.strstart++,r&&(aP(e,!1),e.strm.avail_out===0))return qN}else if(e.match_available){if(r=dN(e,0,e.window[e.strstart-1]),r&&aP(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return qN}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&=(r=dN(e,0,e.window[e.strstart-1]),0),e.insert=e.strstart<FN-1?e.strstart:FN-1,t===gN?(aP(e,!0),e.strm.avail_out===0?YN:XN):e.sym_next&&(aP(e,!1),e.strm.avail_out===0)?qN:JN},mP=(e,t)=>{let n,r,i,a,o=e.window;for(;;){if(e.lookahead<=IN){if(uP(e),e.lookahead<=IN&&t===pN)return qN;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=FN&&e.strstart>0&&(i=e.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){a=e.strstart+IN;do;while(r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&i<a);e.match_length=IN-(a-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=FN?(n=dN(e,1,e.match_length-FN),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=dN(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(aP(e,!1),e.strm.avail_out===0))return qN}return e.insert=0,t===gN?(aP(e,!0),e.strm.avail_out===0?YN:XN):e.sym_next&&(aP(e,!1),e.strm.avail_out===0)?qN:JN},hP=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(uP(e),e.lookahead===0)){if(t===pN)return qN;break}if(e.match_length=0,n=dN(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(aP(e,!1),e.strm.avail_out===0))return qN}return e.insert=0,t===gN?(aP(e,!0),e.strm.avail_out===0?YN:XN):e.sym_next&&(aP(e,!1),e.strm.avail_out===0)?qN:JN};function gP(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}var _P=[new gP(0,0,0,0,dP),new gP(4,4,8,4,fP),new gP(4,5,16,8,fP),new gP(4,6,32,32,fP),new gP(4,4,16,16,pP),new gP(8,16,32,32,pP),new gP(8,16,128,128,pP),new gP(8,32,128,256,pP),new gP(32,128,258,1024,pP),new gP(32,258,258,4096,pP)],vP=e=>{e.window_size=2*e.w_size,eP(e.head),e.max_lazy_match=_P[e.level].max_lazy,e.good_match=_P[e.level].good_length,e.nice_match=_P[e.level].nice_length,e.max_chain_length=_P[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=FN-1,e.match_available=0,e.ins_h=0};function yP(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=AN,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.legacy_hash=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(PN*2),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),eP(this.dyn_ltree),eP(this.dyn_dtree),eP(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),eP(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),eP(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var bP=e=>{if(!e)return 1;let t=e.state;return+(!t||t.strm!==e||t.status!==zN&&t.status!==BN&&t.status!==VN&&t.status!==HN&&t.status!==UN&&t.status!==WN&&t.status!==GN&&t.status!==KN)},xP=e=>{if(bP(e))return QN(e,bN);e.total_in=e.total_out=0,e.data_type=kN;let t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?BN:t.wrap?zN:GN,e.adler=t.wrap===2?0:1,t.last_flush=-2,cN(t),vN},SP=e=>{let t=xP(e);return t===vN&&vP(e.state),t},$ee=(e,t)=>bP(e)||e.state.wrap!==2?bN:(e.state.gzhead=t,vN),CP=(e,t,n,r,i,a,o)=>{if(!e)return bN;let s=1;if(t===CN&&(t=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),i<1||i>jN||n!==AN||r<8||r>15||t<0||t>9||a<0||a>DN||r===8&&s!==1)return QN(e,bN);r===8&&(r=9);let c=new yP;return e.state=c,c.strm=e,c.status=zN,c.wrap=s,c.gzhead=null,c.w_bits=r,c.w_size=1<<c.w_bits,c.w_mask=c.w_size-1,c.legacy_hash=+!!o,c.hash_bits=i+7,!c.legacy_hash&&c.hash_bits<15&&(c.hash_bits=15),c.hash_size=1<<c.hash_bits,c.hash_mask=c.hash_size-1,c.hash_shift=~~((c.hash_bits+FN-1)/FN),c.window=new Uint8Array(c.w_size*2),c.head=new Uint16Array(c.hash_size),c.prev=new Uint16Array(c.w_size),c.lit_bufsize=1<<i+6,c.pending_buf_size=c.lit_bufsize*4,c.pending_buf=new Uint8Array(c.pending_buf_size),c.sym_buf=c.lit_bufsize,c.sym_end=(c.lit_bufsize-1)*3,c.level=t,c.strategy=a,c.method=n,SP(e)},wP={deflateInit:(e,t)=>CP(e,t,AN,MN,NN,ON),deflateInit2:CP,deflateReset:SP,deflateResetKeep:xP,deflateSetHeader:$ee,deflate:(e,t)=>{if(bP(e)||t>_N||t<0)return e?QN(e,bN):bN;let n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===KN&&t!==gN)return QN(e,e.avail_out===0?SN:bN);let r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(iP(e),e.avail_out===0)return n.last_flush=-1,vN}else if(e.avail_in===0&&$N(t)<=$N(r)&&t!==gN)return QN(e,SN);if(n.status===KN&&e.avail_in!==0)return QN(e,SN);if(n.status===zN&&n.wrap===0&&(n.status=GN),n.status===zN){let t=AN+(n.w_bits-8<<4)<<8,r=-1;if(r=n.strategy>=TN||n.level<2?0:n.level<6?1:n.level===6?2:3,t|=r<<6,n.strstart!==0&&(t|=RN),t+=31-t%31,sP(n,t),n.strstart!==0&&(sP(n,e.adler>>>16),sP(n,e.adler&65535)),e.adler=1,n.status=GN,iP(e),n.pending!==0)return n.last_flush=-1,vN}if(n.status===BN){if(e.adler=0,oP(n,31),oP(n,139),oP(n,8),n.gzhead)oP(n,+!!n.gzhead.text+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),oP(n,n.gzhead.time&255),oP(n,n.gzhead.time>>8&255),oP(n,n.gzhead.time>>16&255),oP(n,n.gzhead.time>>24&255),oP(n,n.level===9?2:n.strategy>=TN||n.level<2?4:0),oP(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(oP(n,n.gzhead.extra.length&255),oP(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=aN(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=VN;else if(oP(n,0),oP(n,0),oP(n,0),oP(n,0),oP(n,0),oP(n,n.level===9?2:n.strategy>=TN||n.level<2?4:0),oP(n,ZN),n.status=GN,iP(e),n.pending!==0)return n.last_flush=-1,vN}if(n.status===VN){if(n.gzhead.extra){let t=n.pending,r=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+r>n.pending_buf_size;){let i=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=aN(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=i,iP(e),n.pending!==0)return n.last_flush=-1,vN;t=0,r-=i}let i=new Uint8Array(n.gzhead.extra);n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending+=r,n.gzhead.hcrc&&n.pending>t&&(e.adler=aN(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=HN}if(n.status===HN){if(n.gzhead.name){let t=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(e.adler=aN(e.adler,n.pending_buf,n.pending-t,t)),iP(e),n.pending!==0)return n.last_flush=-1,vN;t=0}r=n.gzindex<n.gzhead.name.length?n.gzhead.name.charCodeAt(n.gzindex++)&255:0,oP(n,r)}while(r!==0);n.gzhead.hcrc&&n.pending>t&&(e.adler=aN(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=UN}if(n.status===UN){if(n.gzhead.comment){let t=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(e.adler=aN(e.adler,n.pending_buf,n.pending-t,t)),iP(e),n.pending!==0)return n.last_flush=-1,vN;t=0}r=n.gzindex<n.gzhead.comment.length?n.gzhead.comment.charCodeAt(n.gzindex++)&255:0,oP(n,r)}while(r!==0);n.gzhead.hcrc&&n.pending>t&&(e.adler=aN(e.adler,n.pending_buf,n.pending-t,t))}n.status=WN}if(n.status===WN){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(iP(e),n.pending!==0))return n.last_flush=-1,vN;oP(n,e.adler&255),oP(n,e.adler>>8&255),e.adler=0}if(n.status=GN,iP(e),n.pending!==0)return n.last_flush=-1,vN}if(e.avail_in!==0||n.lookahead!==0||t!==pN&&n.status!==KN){let r=n.level===0?dP(n,t):n.strategy===TN?hP(n,t):n.strategy===EN?mP(n,t):_P[n.level].func(n,t);if((r===YN||r===XN)&&(n.status=KN),r===qN||r===YN)return e.avail_out===0&&(n.last_flush=-1),vN;if(r===JN&&(t===mN?fN(n):t!==_N&&(lN(n,0,0,!1),t===hN&&(eP(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),iP(e),e.avail_out===0))return n.last_flush=-1,vN}return t===gN?n.wrap<=0?yN:(n.wrap===2?(oP(n,e.adler&255),oP(n,e.adler>>8&255),oP(n,e.adler>>16&255),oP(n,e.adler>>24&255),oP(n,e.total_in&255),oP(n,e.total_in>>8&255),oP(n,e.total_in>>16&255),oP(n,e.total_in>>24&255)):(sP(n,e.adler>>>16),sP(n,e.adler&65535)),iP(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending===0?yN:vN):vN},deflateEnd:e=>{if(bP(e))return bN;let t=e.state.status;return e.state=null,t===GN?QN(e,xN):vN},deflateSetDictionary:(e,t)=>{let n=t.length;if(bP(e))return bN;let r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==zN||r.lookahead)return bN;if(i===1&&(e.adler=rN(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(eP(r.head),r.strstart=0,r.block_start=0,r.insert=0);let e=new Uint8Array(r.w_size);e.set(t.subarray(n-r.w_size,n),0),t=e,n=r.w_size}let a=e.avail_in,o=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,uP(r);r.lookahead>=FN;){let e=r.strstart,t=r.lookahead-(FN-1);do rP(r,e),e++;while(--t);r.strstart=e,r.lookahead=FN-1,uP(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=FN-1,r.match_available=0,e.next_in=o,e.input=s,e.avail_in=a,r.wrap=i,vN},deflateInfo:`pako deflate (from Nodeca project)`},ete=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),TP={assign:function(e){let t=Array.prototype.slice.call(arguments,1);for(;t.length;){let n=t.shift();if(n){if(typeof n!=`object`)throw TypeError(n+`must be non-object`);for(let t in n)ete(n,t)&&(e[t]=n[t])}}return e},flattenChunks:e=>{let t=0;for(let n=0,r=e.length;n<r;n++)t+=e[n].length;let n=new Uint8Array(t);for(let t=0,r=0,i=e.length;t<i;t++){let i=e[t];n.set(i,r),r+=i.length}return n}},EP=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{EP=!1}var DP=new Uint8Array(256);for(let e=0;e<256;e++)DP[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;DP[254]=DP[255]=1;var tte=e=>{if(typeof TextEncoder==`function`&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,a,o=e.length,s=0;for(i=0;i<o;i++)n=e.charCodeAt(i),(n&64512)==55296&&i+1<o&&(r=e.charCodeAt(i+1),(r&64512)==56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(s),a=0,i=0;a<s;i++)n=e.charCodeAt(i),(n&64512)==55296&&i+1<o&&(r=e.charCodeAt(i+1),(r&64512)==56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?t[a++]=n:n<2048?(t[a++]=192|n>>>6,t[a++]=128|n&63):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|n&63):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|n&63);return t},nte=(e,t)=>{if(t<65534&&e.subarray&&EP)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n=``;for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n},OP={string2buf:tte,buf2string:(e,t)=>{let n=t||e.length;if(typeof TextDecoder==`function`&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i,a=Array(n*2);for(i=0,r=0;r<n;){let t=e[r++];if(t<128){a[i++]=t;continue}let o=DP[t];if(o>4){a[i++]=65533,r+=o-1;continue}for(t&=o===2?31:o===3?15:7;o>1&&r<n;)t=t<<6|e[r++]&63,o--;if(o>1){a[i++]=65533;continue}t<65536?a[i++]=t:(t-=65536,a[i++]=55296|t>>10&1023,a[i++]=56320|t&1023)}return nte(a,i)},utf8border:(e,t)=>{t||=e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)==128;)n--;return n<0||n===0?t:n+DP[e[n]]>t?n:t}};function rte(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=``,this.state=null,this.data_type=2,this.adler=0}var kP=rte,AP=Object.prototype.toString,{Z_NO_FLUSH:ite,Z_SYNC_FLUSH:ate,Z_FULL_FLUSH:ote,Z_FINISH:ste,Z_OK:jP,Z_STREAM_END:cte,Z_DEFAULT_COMPRESSION:lte,Z_DEFAULT_STRATEGY:ute,Z_DEFLATED:dte}=sN,fte={level:lte,method:dte,chunkSize:16384,windowBits:15,memLevel:8,strategy:ute,legacyHash:!0};function MP(e){this.options=TP.assign({},fte,e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new kP,this.strm.avail_out=0;let n=wP.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy,t.legacyHash);if(n!==jP)throw Error(oN[n]);if(t.header&&wP.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e=typeof t.dictionary==`string`?OP.string2buf(t.dictionary):AP.call(t.dictionary)===`[object ArrayBuffer]`?new Uint8Array(t.dictionary):t.dictionary,n=wP.deflateSetDictionary(this.strm,e),n!==jP)throw Error(oN[n]);this._dict_set=!0}}MP.prototype.push=function(e,t){let n=this.strm,r=this.options.chunkSize,i,a;if(this.ended)return!1;for(a=t===~~t?t:t===!0?ste:ite,typeof e==`string`?n.input=OP.string2buf(e):AP.call(e)===`[object ArrayBuffer]`?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(a===ate||a===ote)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=wP.deflate(n,a),i===cte)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=wP.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===jP;if(n.avail_out===0){this.onData(n.output);continue}if(a>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0},MP.prototype.onData=function(e){this.chunks.push(e)},MP.prototype.onEnd=function(e){e===jP&&(this.result=TP.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function NP(e,t){let n=new MP(t);if(n.push(e,!0),n.err)throw n.msg||oN[n.err];return n.result}function pte(e,t){return t||={},t.raw=!0,NP(e,t)}function mte(e,t){return t||={},t.gzip=!0,NP(e,t)}var hte={Deflate:MP,deflate:NP,deflateRaw:pte,gzip:mte,constants:sN},PP=16209,gte=16191,_te=function(e,t){let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E=e.state;n=e.next_in,w=e.input,r=n+(e.avail_in-5),i=e.next_out,T=e.output,a=i-(t-e.avail_out),o=i+(e.avail_out-257),s=E.dmax,c=E.wsize,l=E.whave,u=E.wnext,d=E.window,f=E.hold,p=E.bits,m=E.lencode,h=E.distcode,g=(1<<E.lenbits)-1,_=(1<<E.distbits)-1;top:do{p<15&&(f+=w[n++]<<p,p+=8,f+=w[n++]<<p,p+=8),v=m[f&g];dolen:for(;;){if(y=v>>>24,f>>>=y,p-=y,y=v>>>16&255,y===0)T[i++]=v&65535;else if(y&16){b=v&65535,y&=15,y&&(p<y&&(f+=w[n++]<<p,p+=8),b+=f&(1<<y)-1,f>>>=y,p-=y),p<15&&(f+=w[n++]<<p,p+=8,f+=w[n++]<<p,p+=8),v=h[f&_];dodist:for(;;){if(y=v>>>24,f>>>=y,p-=y,y=v>>>16&255,y&16){if(x=v&65535,y&=15,p<y&&(f+=w[n++]<<p,p+=8,p<y&&(f+=w[n++]<<p,p+=8)),x+=f&(1<<y)-1,x>s){e.msg=`invalid distance too far back`,E.mode=PP;break top}if(f>>>=y,p-=y,y=i-a,x>y){if(y=x-y,y>l&&E.sane){e.msg=`invalid distance too far back`,E.mode=PP;break top}if(S=0,C=d,u===0){if(S+=c-y,y<b){b-=y;do T[i++]=d[S++];while(--y);S=i-x,C=T}}else if(u<y){if(S+=c+u-y,y-=u,y<b){b-=y;do T[i++]=d[S++];while(--y);if(S=0,u<b){y=u,b-=y;do T[i++]=d[S++];while(--y);S=i-x,C=T}}}else if(S+=u-y,y<b){b-=y;do T[i++]=d[S++];while(--y);S=i-x,C=T}for(;b>2;)T[i++]=C[S++],T[i++]=C[S++],T[i++]=C[S++],b-=3;b&&(T[i++]=C[S++],b>1&&(T[i++]=C[S++]))}else{S=i-x;do T[i++]=T[S++],T[i++]=T[S++],T[i++]=T[S++],b-=3;while(b>2);b&&(T[i++]=T[S++],b>1&&(T[i++]=T[S++]))}}else if(y&64){e.msg=`invalid distance code`,E.mode=PP;break top}else{v=h[(v&65535)+(f&(1<<y)-1)];continue dodist}break}}else if(!(y&64)){v=m[(v&65535)+(f&(1<<y)-1)];continue dolen}else if(y&32){E.mode=gte;break top}else{e.msg=`invalid literal/length code`,E.mode=PP;break top}break}}while(n<r&&i<o);b=p>>3,n-=b,p-=b<<3,f&=(1<<p)-1,e.next_in=n,e.next_out=i,e.avail_in=n<r?5+(r-n):5-(n-r),e.avail_out=i<o?257+(o-i):257-(i-o),E.hold=f,E.bits=p},FP=15,IP=852,LP=592,RP=0,zP=1,BP=2,vte=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),yte=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,199,75]),bte=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),xte=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),VP=(e,t,n,r,i,a,o,s)=>{let c=s.bits,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y,b,x,S,C,w=null,T,E=new Uint16Array(16),D=new Uint16Array(16),O=null,k,A,j;for(l=0;l<=FP;l++)E[l]=0;for(u=0;u<r;u++)E[t[n+u]]++;for(p=c,f=FP;f>=1&&E[f]===0;f--);if(p>f&&(p=f),f===0)return i[a++]=20971520,i[a++]=20971520,s.bits=1,0;for(d=1;d<f&&E[d]===0;d++);for(p<d&&(p=d),g=1,l=1;l<=FP;l++)if(g<<=1,g-=E[l],g<0)return-1;if(g>0&&(e===RP||f!==1))return-1;for(D[1]=0,l=1;l<FP;l++)D[l+1]=D[l]+E[l];for(u=0;u<r;u++)t[n+u]!==0&&(o[D[t[n+u]]++]=u);if(e===RP?(w=O=o,T=20):e===zP?(w=vte,O=yte,T=257):(w=bte,O=xte,T=0),v=0,u=0,l=d,C=a,m=p,h=0,x=-1,_=1<<p,S=_-1,e===zP&&_>IP||e===BP&&_>LP)return 1;for(;;){k=l-h,o[u]+1<T?(A=0,j=o[u]):o[u]>=T?(A=O[o[u]-T],j=w[o[u]-T]):(A=96,j=0),y=1<<l-h,b=1<<m,d=b;do b-=y,i[C+(v>>h)+b]=k<<24|A<<16|j|0;while(b!==0);for(y=1<<l-1;v&y;)y>>=1;if(y===0?v=0:(v&=y-1,v+=y),u++,--E[l]===0){if(l===f)break;l=t[n+o[u]]}if(l>p&&(v&S)!==x){for(h===0&&(h=p),C+=d,m=l-h,g=1<<m;m+h<f&&(g-=E[m+h],!(g<=0));)m++,g<<=1;if(_+=1<<m,e===zP&&_>IP||e===BP&&_>LP)return 1;x=v&S,i[x]=p<<24|m<<16|C-a|0}}return v!==0&&(i[C+v]=l-h<<24|4194304),s.bits=p,0},Ste=0,HP=1,UP=2,{Z_FINISH:WP,Z_BLOCK:Cte,Z_TREES:GP,Z_OK:KP,Z_STREAM_END:wte,Z_NEED_DICT:Tte,Z_STREAM_ERROR:qP,Z_DATA_ERROR:JP,Z_MEM_ERROR:YP,Z_BUF_ERROR:Ete,Z_DEFLATED:XP}=sN,ZP=16180,QP=16181,$P=16182,eF=16183,tF=16184,nF=16185,rF=16186,iF=16187,aF=16188,oF=16189,sF=16190,cF=16191,lF=16192,uF=16193,dF=16194,fF=16195,pF=16196,mF=16197,hF=16198,gF=16199,_F=16200,vF=16201,yF=16202,bF=16203,xF=16204,SF=16205,CF=16206,wF=16207,TF=16208,EF=16209,DF=16210,OF=16211,kF=852,AF=592,jF=15,MF=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function NF(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var PF=e=>{if(!e)return 1;let t=e.state;return+(!t||t.strm!==e||t.mode<ZP||t.mode>OF)},FF=e=>{if(PF(e))return qP;let t=e.state;return e.total_in=e.total_out=t.total=0,e.msg=``,t.wrap&&(e.adler=t.wrap&1),t.mode=ZP,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(kF),t.distcode=t.distdyn=new Int32Array(AF),t.sane=1,t.back=-1,KP},IF=e=>{if(PF(e))return qP;let t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,FF(e)},LF=(e,t)=>{let n;if(PF(e))return qP;let r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?qP:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,IF(e))},RF=(e,t)=>{if(!e)return qP;let n=new NF;e.state=n,n.strm=e,n.window=null,n.mode=ZP;let r=LF(e,t);return r!==KP&&(e.state=null),r},zF=e=>RF(e,jF),BF=!0,VF,HF,UF=e=>{if(BF){VF=new Int32Array(512),HF=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(VP(HP,e.lens,0,288,VF,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;VP(UP,e.lens,0,32,HF,0,e.work,{bits:5}),BF=!1}e.lencode=VF,e.lenbits=9,e.distcode=HF,e.distbits=5},WF=(e,t,n,r)=>{let i,a=e.state;return a.window===null&&(a.window=new Uint8Array(1<<a.wbits)),a.wsize===0&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0),r>=a.wsize?(a.window.set(t.subarray(n-a.wsize,n),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>r&&(i=r),a.window.set(t.subarray(n-r,n-r+i),a.wnext),r-=i,r?(a.window.set(t.subarray(n-r,n),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0},GF={inflateReset:IF,inflateReset2:LF,inflateResetKeep:FF,inflateInit:zF,inflateInit2:RF,inflate:(e,t)=>{let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g=0,_,v,y,b,x,S,C,w,T=new Uint8Array(4),E,D,O=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(PF(e)||!e.output||!e.input&&e.avail_in!==0)return qP;n=e.state,n.mode===cF&&(n.mode=lF),o=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,l=n.hold,u=n.bits,d=s,f=c,w=KP;inf_leave:for(;;)switch(n.mode){case ZP:if(n.wrap===0){n.mode=lF;break}for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.wrap&2&&l===35615){n.wbits===0&&(n.wbits=15),n.check=0,T[0]=l&255,T[1]=l>>>8&255,n.check=aN(n.check,T,2,0),l=0,u=0,n.mode=QP;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg=`incorrect header check`,n.mode=EF;break}if((l&15)!==XP){e.msg=`unknown compression method`,n.mode=EF;break}if(l>>>=4,u-=4,C=(l&15)+8,n.wbits===0&&(n.wbits=C),C>15||C>n.wbits){e.msg=`invalid window size`,n.mode=EF;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=l&512?oF:cF,l=0,u=0;break;case QP:for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.flags=l,(n.flags&255)!==XP){e.msg=`unknown compression method`,n.mode=EF;break}if(n.flags&57344){e.msg=`unknown header flags set`,n.mode=EF;break}n.head&&(n.head.text=l>>8&1),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=aN(n.check,T,2,0)),l=0,u=0,n.mode=$P;case $P:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.head&&(n.head.time=l),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,T[2]=l>>>16&255,T[3]=l>>>24&255,n.check=aN(n.check,T,4,0)),l=0,u=0,n.mode=eF;case eF:for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.head&&(n.head.xflags=l&255,n.head.os=l>>8),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=aN(n.check,T,2,0)),l=0,u=0,n.mode=tF;case tF:if(n.flags&1024){for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.length=l,n.head&&(n.head.extra_len=l),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=aN(n.check,T,2,0)),l=0,u=0}else n.head&&(n.head.extra=null);n.mode=nF;case nF:if(n.flags&1024&&(p=n.length,p>s&&(p=s),p&&(n.head&&(C=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(a,a+p),C)),n.flags&512&&n.wrap&4&&(n.check=aN(n.check,r,p,a)),s-=p,a+=p,n.length-=p),n.length))break inf_leave;n.length=0,n.mode=rF;case rF:if(n.flags&2048){if(s===0)break inf_leave;p=0;do C=r[a+p++],n.head&&C&&n.length<65536&&(n.head.name+=String.fromCharCode(C));while(C&&p<s);if(n.flags&512&&n.wrap&4&&(n.check=aN(n.check,r,p,a)),s-=p,a+=p,C)break inf_leave}else n.head&&(n.head.name=null);n.length=0,n.mode=iF;case iF:if(n.flags&4096){if(s===0)break inf_leave;p=0;do C=r[a+p++],n.head&&C&&n.length<65536&&(n.head.comment+=String.fromCharCode(C));while(C&&p<s);if(n.flags&512&&n.wrap&4&&(n.check=aN(n.check,r,p,a)),s-=p,a+=p,C)break inf_leave}else n.head&&(n.head.comment=null);n.mode=aF;case aF:if(n.flags&512){for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.wrap&4&&l!==(n.check&65535)){e.msg=`header crc mismatch`,n.mode=EF;break}l=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=cF;break;case oF:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}e.adler=n.check=MF(l),l=0,u=0,n.mode=sF;case sF:if(n.havedict===0)return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,Tte;e.adler=n.check=1,n.mode=cF;case cF:if(t===Cte||t===GP)break inf_leave;case lF:if(n.last){l>>>=u&7,u-=u&7,n.mode=CF;break}for(;u<3;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}switch(n.last=l&1,l>>>=1,--u,l&3){case 0:n.mode=uF;break;case 1:if(UF(n),n.mode=gF,t===GP){l>>>=2,u-=2;break inf_leave}break;case 2:n.mode=pF;break;case 3:e.msg=`invalid block type`,n.mode=EF}l>>>=2,u-=2;break;case uF:for(l>>>=u&7,u-=u&7;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if((l&65535)!=(l>>>16^65535)){e.msg=`invalid stored block lengths`,n.mode=EF;break}if(n.length=l&65535,l=0,u=0,n.mode=dF,t===GP)break inf_leave;case dF:n.mode=fF;case fF:if(p=n.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break inf_leave;i.set(r.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,n.length-=p;break}n.mode=cF;break;case pF:for(;u<14;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.nlen=(l&31)+257,l>>>=5,u-=5,n.ndist=(l&31)+1,l>>>=5,u-=5,n.ncode=(l&15)+4,l>>>=4,u-=4,n.nlen>286||n.ndist>30){e.msg=`too many length or distance symbols`,n.mode=EF;break}n.have=0,n.mode=mF;case mF:for(;n.have<n.ncode;){for(;u<3;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.lens[O[n.have++]]=l&7,l>>>=3,u-=3}for(;n.have<19;)n.lens[O[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,E={bits:n.lenbits},w=VP(Ste,n.lens,0,19,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid code lengths set`,n.mode=EF;break}n.have=0,n.mode=hF;case hF:for(;n.have<n.nlen+n.ndist;){for(;g=n.lencode[l&(1<<n.lenbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(y<16)l>>>=_,u-=_,n.lens[n.have++]=y;else{if(y===16){for(D=_+2;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(l>>>=_,u-=_,n.have===0){e.msg=`invalid bit length repeat`,n.mode=EF;break}C=n.lens[n.have-1],p=3+(l&3),l>>>=2,u-=2}else if(y===17){for(D=_+3;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=_,u-=_,C=0,p=3+(l&7),l>>>=3,u-=3}else{for(D=_+7;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=_,u-=_,C=0,p=11+(l&127),l>>>=7,u-=7}if(n.have+p>n.nlen+n.ndist){e.msg=`invalid bit length repeat`,n.mode=EF;break}for(;p--;)n.lens[n.have++]=C}}if(n.mode===EF)break;if(n.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,n.mode=EF;break}if(n.lenbits=9,E={bits:n.lenbits},w=VP(HP,n.lens,0,n.nlen,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid literal/lengths set`,n.mode=EF;break}if(n.distbits=6,n.distcode=n.distdyn,E={bits:n.distbits},w=VP(UP,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,E),n.distbits=E.bits,w){e.msg=`invalid distances set`,n.mode=EF;break}if(n.mode=gF,t===GP)break inf_leave;case gF:n.mode=_F;case _F:if(s>=6&&c>=258){e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,_te(e,f),o=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,l=n.hold,u=n.bits,n.mode===cF&&(n.back=-1);break}for(n.back=0;g=n.lencode[l&(1<<n.lenbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(v&&!(v&240)){for(b=_,x=v,S=y;g=n.lencode[S+((l&(1<<b+x)-1)>>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,n.length=y,v===0){n.mode=SF;break}if(v&32){n.back=-1,n.mode=cF;break}if(v&64){e.msg=`invalid literal/length code`,n.mode=EF;break}n.extra=v&15,n.mode=vF;case vF:if(n.extra){for(D=n.extra;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.length+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=yF;case yF:for(;g=n.distcode[l&(1<<n.distbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(!(v&240)){for(b=_,x=v,S=y;g=n.distcode[S+((l&(1<<b+x)-1)>>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,v&64){e.msg=`invalid distance code`,n.mode=EF;break}n.offset=y,n.extra=v&15,n.mode=bF;case bF:if(n.extra){for(D=n.extra;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.offset+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg=`invalid distance too far back`,n.mode=EF;break}n.mode=xF;case xF:if(c===0)break inf_leave;if(p=f-c,n.offset>p){if(p=n.offset-p,p>n.whave&&n.sane){e.msg=`invalid distance too far back`,n.mode=EF;break}p>n.wnext?(p-=n.wnext,m=n.wsize-p):m=n.wnext-p,p>n.length&&(p=n.length),h=n.window}else h=i,m=o-n.offset,p=n.length;p>c&&(p=c),c-=p,n.length-=p;do i[o++]=h[m++];while(--p);n.length===0&&(n.mode=_F);break;case SF:if(c===0)break inf_leave;i[o++]=n.length,c--,n.mode=_F;break;case CF:if(n.wrap){for(;u<32;){if(s===0)break inf_leave;s--,l|=r[a++]<<u,u+=8}if(f-=c,e.total_out+=f,n.total+=f,n.wrap&4&&f&&(e.adler=n.check=n.flags?aN(n.check,i,f,o-f):rN(n.check,i,f,o-f)),f=c,n.wrap&4&&(n.flags?l:MF(l))!==n.check){e.msg=`incorrect data check`,n.mode=EF;break}l=0,u=0}n.mode=wF;case wF:if(n.wrap&&n.flags){for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.wrap&4&&l!==(n.total&4294967295)){e.msg=`incorrect length check`,n.mode=EF;break}l=0,u=0}n.mode=TF;case TF:w=wte;break inf_leave;case EF:w=JP;break inf_leave;case DF:return YP;case OF:default:return qP}return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,(n.wsize||f!==e.avail_out&&n.mode<EF&&(n.mode<CF||t!==WP))&&WF(e,e.output,e.next_out,f-e.avail_out),d-=e.avail_in,f-=e.avail_out,e.total_in+=d,e.total_out+=f,n.total+=f,n.wrap&4&&f&&(e.adler=n.check=n.flags?aN(n.check,i,f,e.next_out-f):rN(n.check,i,f,e.next_out-f)),e.data_type=n.bits+(n.last?64:0)+(n.mode===cF?128:0)+(n.mode===gF||n.mode===dF?256:0),(d===0&&f===0||t===WP)&&w===KP&&(w=Ete),w},inflateEnd:e=>{if(PF(e))return qP;let t=e.state;return t.window&&=null,e.state=null,KP},inflateGetHeader:(e,t)=>{if(PF(e))return qP;let n=e.state;return n.wrap&2?(n.head=t,t.done=!1,KP):qP},inflateSetDictionary:(e,t)=>{let n=t.length,r,i,a;return PF(e)||(r=e.state,r.wrap!==0&&r.mode!==sF)?qP:r.mode===sF&&(i=1,i=rN(i,t,n,0),i!==r.check)?JP:(a=WF(e,t,n,n),a?(r.mode=DF,YP):(r.havedict=1,KP))},inflateInfo:`pako inflate (from Nodeca project)`};function KF(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name=``,this.comment=``,this.hcrc=0,this.done=!1}var qF=KF,JF=Object.prototype.toString,{Z_NO_FLUSH:YF,Z_FINISH:XF,Z_OK:ZF,Z_STREAM_END:QF,Z_NEED_DICT:$F,Z_STREAM_ERROR:eI,Z_DATA_ERROR:tI,Z_MEM_ERROR:nI,Z_BUF_ERROR:rI}=sN,iI={chunkSize:1024*64,windowBits:15,to:``};function aI(e){this.options=TP.assign({},iI,e||{});let t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new kP,this.strm.avail_out=0;let n=GF.inflateInit2(this.strm,t.windowBits);if(n!==ZF||(this.header=new qF,GF.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary==`string`?t.dictionary=OP.string2buf(t.dictionary):JF.call(t.dictionary)===`[object ArrayBuffer]`&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=GF.inflateSetDictionary(this.strm,t.dictionary),n!==ZF))))throw Error(oN[n])}aI.prototype.push=function(e,t){let n=this.strm,r=this.options.chunkSize,i=this.options.dictionary,a,o,s;if(this.ended)return!1;for(o=t===~~t?t:t===!0?XF:YF,JF.call(e)===`[object ArrayBuffer]`?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),a=GF.inflate(n,o),a===$F&&i&&(a=GF.inflateSetDictionary(n,i),a===ZF?a=GF.inflate(n,o):a===tI&&(a=$F));n.avail_in>0&&a===QF&&n.state.wrap&2&&n.state.flags!==0&&n.input[n.next_in]!==0;)GF.inflateReset(n),a=GF.inflate(n,o);switch(a){case eI:case tI:case $F:case nI:return this.onEnd(a),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||a===QF||o>0))if(this.options.to===`string`){let e=OP.utf8border(n.output,n.next_out),t=n.next_out-e,i=OP.buf2string(n.output,e);n.next_out=t,n.avail_out=r-t,t&&n.output.set(n.output.subarray(e,e+t),0),this.onData(i)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out)),n.avail_out=0,n.next_out=0;if(!((a===ZF||a===rI)&&s===0)){if(a===QF)return a=GF.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(n.avail_in===0){if(o===XF)return a=GF.inflateEnd(this.strm),this.onEnd(a===ZF?rI:a),this.ended=!0,!1;break}}}return!0},aI.prototype.onData=function(e){this.chunks.push(e)},aI.prototype.onEnd=function(e){e===ZF&&(this.options.to===`string`?this.result=this.chunks.join(``):this.result=TP.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function oI(e,t){let n=new aI(t);if(n.push(e,!0),n.err)throw n.msg||oN[n.err];return n.result}function sI(e,t){return t||={},t.raw=!0,oI(e,t)}var cI={Inflate:aI,inflate:oI,inflateRaw:sI,ungzip:oI,constants:sN},{Deflate:Dte,deflate:Ote,deflateRaw:kte,gzip:Ate}=hte,{Inflate:lI,inflate:uI,inflateRaw:jte,ungzip:Mte}=cI,dI=lI,fI=uI,pI=[];for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t&1?t=3988292384^t>>>1:t>>>=1;pI[e]=t}var mI=4294967295;function hI(e,t,n){let r=e;for(let e=0;e<n;e++)r=pI[(r^t[e])&255]^r>>>8;return r}function gI(e,t){return(hI(mI,e,t)^mI)>>>0}function _I(e,t,n){let r=e.readUint32(),i=gI(new Uint8Array(e.buffer,e.byteOffset+e.offset-t-4,t),t);if(i!==r)throw Error(`CRC mismatch for chunk ${n}. Expected ${r}, found ${i}`)}function vI(e,t,n){for(let r=0;r<n;r++)t[r]=e[r]}function yI(e,t,n,r){let i=0;for(;i<r;i++)t[i]=e[i];for(;i<n;i++)t[i]=e[i]+t[i-r]&255}function bI(e,t,n,r){let i=0;if(n.length===0)for(;i<r;i++)t[i]=e[i];else for(;i<r;i++)t[i]=e[i]+n[i]&255}function xI(e,t,n,r,i){let a=0;if(n.length===0){for(;a<i;a++)t[a]=e[a];for(;a<r;a++)t[a]=e[a]+(t[a-i]>>1)&255}else{for(;a<i;a++)t[a]=e[a]+(n[a]>>1)&255;for(;a<r;a++)t[a]=e[a]+(t[a-i]+n[a]>>1)&255}}function SI(e,t,n,r,i){let a=0;if(n.length===0){for(;a<i;a++)t[a]=e[a];for(;a<r;a++)t[a]=e[a]+t[a-i]&255}else{for(;a<i;a++)t[a]=e[a]+n[a]&255;for(;a<r;a++)t[a]=e[a]+CI(t[a-i],n[a],n[a-i])&255}}function CI(e,t,n){let r=e+t-n,i=Math.abs(r-e),a=Math.abs(r-t),o=Math.abs(r-n);return i<=a&&i<=o?e:a<=o?t:n}function wI(e,t,n,r,i,a){switch(e){case 0:vI(t,n,i);break;case 1:yI(t,n,i,a);break;case 2:bI(t,n,r,i);break;case 3:xI(t,n,r,i,a);break;case 4:SI(t,n,r,i,a);break;default:throw Error(`Unsupported filter: ${e}`)}}var TI=new Uint16Array([255]),EI=new Uint8Array(TI.buffer)[0]===255;function DI(e){let{data:t,width:n,height:r,channels:i,depth:a}=e,o=[{x:0,y:0,xStep:8,yStep:8},{x:4,y:0,xStep:8,yStep:8},{x:0,y:4,xStep:4,yStep:8},{x:2,y:0,xStep:4,yStep:4},{x:0,y:2,xStep:2,yStep:4},{x:1,y:0,xStep:2,yStep:2},{x:0,y:1,xStep:1,yStep:2}],s=Math.ceil(a/8)*i,c=new Uint8Array(r*n*s),l=0;for(let e=0;e<7;e++){let i=o[e],a=Math.ceil((n-i.x)/i.xStep),u=Math.ceil((r-i.y)/i.yStep);if(a<=0||u<=0)continue;let d=a*s,f=new Uint8Array(d);for(let e=0;e<u;e++){let o=t[l++],u=t.subarray(l,l+d);l+=d;let p=new Uint8Array(d);wI(o,u,p,f,d,s),f.set(p);for(let t=0;t<a;t++){let a=i.x+t*i.xStep,o=i.y+e*i.yStep;if(!(a>=n||o>=r))for(let e=0;e<s;e++)c[(o*n+a)*s+e]=p[t*s+e]}}}if(a===16){let e=new Uint16Array(c.buffer);if(EI)for(let t=0;t<e.length;t++)e[t]=OI(e[t]);return e}else return c}function OI(e){return(e&255)<<8|e>>8&255}var kI=new Uint16Array([255]),AI=new Uint8Array(kI.buffer)[0]===255,jI=new Uint8Array;function MI(e){let{data:t,width:n,height:r,channels:i,depth:a}=e,o=Math.ceil(a/8)*i,s=Math.ceil(a/8*i*n),c=new Uint8Array(r*s),l=jI,u=0,d,f;for(let e=0;e<r;e++){switch(d=t.subarray(u+1,u+1+s),f=c.subarray(e*s,(e+1)*s),t[u]){case 0:vI(d,f,s);break;case 1:yI(d,f,s,o);break;case 2:bI(d,f,l,s);break;case 3:xI(d,f,l,s,o);break;case 4:SI(d,f,l,s,o);break;default:throw Error(`Unsupported filter: ${t[u]}`)}l=f,u+=s+1}if(a===16){let e=new Uint16Array(c.buffer);if(AI)for(let t=0;t<e.length;t++)e[t]=NI(e[t]);return e}else return c}function NI(e){return(e&255)<<8|e>>8&255}var PI=Uint8Array.of(137,80,78,71,13,10,26,10);function FI(e){if(!II(e.readBytes(PI.length)))throw Error(`wrong PNG signature`)}function II(e){if(e.length<PI.length)return!1;for(let t=0;t<PI.length;t++)if(e[t]!==PI[t])return!1;return!0}var LI=`tEXt`,RI=0,zI=new TextDecoder(`latin1`);function BI(e){if(HI(e),e.length===0||e.length>79)throw Error(`keyword length must be between 1 and 79`)}var VI=/^[\u0000-\u00FF]*$/;function HI(e){if(!VI.test(e))throw Error(`invalid latin1 text`)}function UI(e,t,n){let r=WI(t);e[r]=GI(t,n-r.length-1)}function WI(e){for(e.mark();e.readByte()!==RI;);let t=e.offset;e.reset();let n=zI.decode(e.readBytes(t-e.offset-1));return e.skip(1),BI(n),n}function GI(e,t){return zI.decode(e.readBytes(t))}var KI={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},qI={UNKNOWN:-1,DEFLATE:0},JI={UNKNOWN:-1,ADAPTIVE:0},YI={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},XI={NONE:0,BACKGROUND:1,PREVIOUS:2},ZI={SOURCE:0,OVER:1},QI=class extends Yj{_checkCrc;_inflator;_png;_apng;_end;_hasPalette;_palette;_hasTransparency;_transparency;_compressionMethod;_filterMethod;_interlaceMethod;_colorType;_isAnimated;_numberOfFrames;_numberOfPlays;_frames;_writingDataChunks;constructor(e,t={}){super(e);let{checkCrc:n=!1}=t;this._checkCrc=n,this._inflator=new dI,this._png={width:-1,height:-1,channels:-1,data:new Uint8Array,depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array,this._compressionMethod=qI.UNKNOWN,this._filterMethod=JI.UNKNOWN,this._interlaceMethod=YI.UNKNOWN,this._colorType=KI.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(FI(this);!this._end;){let e=this.readUint32(),t=this.readChars(4);this.decodeChunk(e,t)}return this.decodeImage(),this._png}decodeApng(){for(FI(this);!this._end;){let e=this.readUint32(),t=this.readChars(4);this.decodeApngChunk(e,t)}return this.decodeApngImage(),this._apng}decodeChunk(e,t){let n=this.offset;switch(t){case`IHDR`:this.decodeIHDR();break;case`PLTE`:this.decodePLTE(e);break;case`IDAT`:this.decodeIDAT(e);break;case`IEND`:this._end=!0;break;case`tRNS`:this.decodetRNS(e);break;case`iCCP`:this.decodeiCCP(e);break;case LI:UI(this._png.text,this,e);break;case`pHYs`:this.decodepHYs();break;default:this.skip(e);break}if(this.offset-n!==e)throw Error(`Length mismatch while decoding chunk ${t}`);this._checkCrc?_I(this,e+4,t):this.skip(4)}decodeApngChunk(e,t){let n=this.offset;switch(t!==`fdAT`&&t!==`IDAT`&&this._writingDataChunks&&this.pushDataToFrame(),t){case`acTL`:this.decodeACTL();break;case`fcTL`:this.decodeFCTL();break;case`fdAT`:this.decodeFDAT(e);break;default:this.decodeChunk(e,t),this.offset=n+e;break}if(this.offset-n!==e)throw Error(`Length mismatch while decoding chunk ${t}`);this._checkCrc?_I(this,e+4,t):this.skip(4)}decodeIHDR(){let e=this._png;e.width=this.readUint32(),e.height=this.readUint32(),e.depth=$I(this.readUint8());let t=this.readUint8();this._colorType=t;let n;switch(t){case KI.GREYSCALE:n=1;break;case KI.TRUECOLOUR:n=3;break;case KI.INDEXED_COLOUR:n=1;break;case KI.GREYSCALE_ALPHA:n=2;break;case KI.TRUECOLOUR_ALPHA:n=4;break;case KI.UNKNOWN:default:throw Error(`Unknown color type: ${t}`)}if(this._png.channels=n,this._compressionMethod=this.readUint8(),this._compressionMethod!==qI.DEFLATE)throw Error(`Unsupported compression method: ${this._compressionMethod}`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){let e={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array};this._frames.push(e)}decodePLTE(e){if(e%3!=0)throw RangeError(`PLTE field length must be a multiple of 3. Got ${e}`);let t=e/3;this._hasPalette=!0;let n=[];this._palette=n;for(let e=0;e<t;e++)n.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(e){this._writingDataChunks=!0;let t=e,n=this.offset+this.byteOffset;if(this._inflator.push(new Uint8Array(this.buffer,n,t)),this._inflator.err)throw Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(e)}decodeFDAT(e){this._writingDataChunks=!0;let t=e,n=this.offset+this.byteOffset;if(n+=4,t-=4,this._inflator.push(new Uint8Array(this.buffer,n,t)),this._inflator.err)throw Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(e)}decodetRNS(e){switch(this._colorType){case KI.GREYSCALE:case KI.TRUECOLOUR:if(e%2!=0)throw RangeError(`tRNS chunk length must be a multiple of 2. Got ${e}`);if(e/2>this._png.width*this._png.height)throw Error(`tRNS chunk contains more alpha values than there are pixels (${e/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(e/2);for(let t=0;t<e/2;t++)this._transparency[t]=this.readUint16();break;case KI.INDEXED_COLOUR:{if(e>this._palette.length)throw Error(`tRNS chunk contains more alpha values than there are palette colors (${e} vs ${this._palette.length})`);let t=0;for(;t<e;t++){let e=this.readByte();this._palette[t].push(e)}for(;t<this._palette.length;t++)this._palette[t].push(255);break}case KI.UNKNOWN:case KI.GREYSCALE_ALPHA:case KI.TRUECOLOUR_ALPHA:default:throw Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(e){let t=WI(this),n=this.readUint8();if(n!==qI.DEFLATE)throw Error(`Unsupported iCCP compression method: ${n}`);let r=this.readBytes(e-t.length-2);this._png.iccEmbeddedProfile={name:t,profile:fI(r)}}decodepHYs(){let e=this.readUint32(),t=this.readUint32(),n=this.readByte();this._png.resolution={x:e,y:t,unit:n}}decodeApngImage(){this._apng.width=this._png.width,this._apng.height=this._png.height,this._apng.channels=this._png.channels,this._apng.depth=this._png.depth,this._apng.numberOfFrames=this._numberOfFrames,this._apng.numberOfPlays=this._numberOfPlays,this._apng.text=this._png.text,this._apng.resolution=this._png.resolution;for(let e=0;e<this._numberOfFrames;e++){let t={sequenceNumber:this._frames[e].sequenceNumber,delayNumber:this._frames[e].delayNumber,delayDenominator:this._frames[e].delayDenominator,data:this._apng.depth===8?new Uint8Array(this._apng.width*this._apng.height*this._apng.channels):new Uint16Array(this._apng.width*this._apng.height*this._apng.channels)},n=this._frames.at(e);if(n){if(n.data=MI({data:n.data,width:n.width,height:n.height,channels:this._apng.channels,depth:this._apng.depth}),this._hasPalette&&(this._apng.palette=this._palette),this._hasTransparency&&(this._apng.transparency=this._transparency),e===0||n.xOffset===0&&n.yOffset===0&&n.width===this._png.width&&n.height===this._png.height)t.data=n.data;else{let r=this._apng.frames.at(e-1);this.disposeFrame(n,r,t),this.addFrameDataToCanvas(t,n)}this._apng.frames.push(t)}}return this._apng}disposeFrame(e,t,n){switch(e.disposeOp){case XI.NONE:break;case XI.BACKGROUND:for(let t=0;t<this._png.height;t++)for(let r=0;r<this._png.width;r++){let i=(t*e.width+r)*this._png.channels;for(let e=0;e<this._png.channels;e++)n.data[i+e]=0}break;case XI.PREVIOUS:n.data.set(t.data);break;default:throw Error(`Unknown disposeOp`)}}addFrameDataToCanvas(e,t){let n=1<<this._png.depth,r=(e,n)=>({index:((e+t.yOffset)*this._png.width+t.xOffset+n)*this._png.channels,frameIndex:(e*t.width+n)*this._png.channels});switch(t.blendOp){case ZI.SOURCE:for(let n=0;n<t.height;n++)for(let i=0;i<t.width;i++){let{index:a,frameIndex:o}=r(n,i);for(let n=0;n<this._png.channels;n++)e.data[a+n]=t.data[o+n]}break;case ZI.OVER:for(let i=0;i<t.height;i++)for(let a=0;a<t.width;a++){let{index:o,frameIndex:s}=r(i,a);for(let r=0;r<this._png.channels;r++){let i=t.data[s+this._png.channels-1]/n,a=r%(this._png.channels-1)==0?1:t.data[s+r],c=Math.floor(i*a+(1-i)*e.data[o+r]);e.data[o+r]+=c}}break;default:throw Error(`Unknown blendOp`)}}decodeImage(){if(this._inflator.err)throw Error(`Error while decompressing the data: ${this._inflator.err}`);let e=this._isAnimated?(this._frames?.at(0)).data:this._inflator.result;if(this._filterMethod!==JI.ADAPTIVE)throw Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===YI.NO_INTERLACE)this._png.data=MI({data:e,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===YI.ADAM7)this._png.data=DI({data:e,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else throw Error(`Interlace method ${this._interlaceMethod} not supported`);this._hasPalette&&(this._png.palette=this._palette),this._hasTransparency&&(this._png.transparency=this._transparency)}pushDataToFrame(){let e=this._inflator.result,t=this._frames.at(-1);t?t.data=e:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:XI.NONE,blendOp:ZI.SOURCE,data:e}),this._inflator=new dI,this._writingDataChunks=!1}};function $I(e){if(e!==1&&e!==2&&e!==4&&e!==8&&e!==16)throw Error(`invalid bit depth: ${e}`);return e}var eL;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.METRE=1]=`METRE`})(eL||={});function tL(e,t){return new QI(e,t).decode()}pt();var nL=function(){return typeof window<`u`?window:mt===void 0?typeof self<`u`?self:this:mt}();function rL(){nL.console&&typeof nL.console.log==`function`&&nL.console.log.apply(nL.console,arguments)}var iL={log:rL,warn:function(e){nL.console&&(typeof nL.console.warn==`function`?nL.console.warn.apply(nL.console,arguments):rL.call(null,arguments))},error:function(e){nL.console&&(typeof nL.console.error==`function`?nL.console.error.apply(nL.console,arguments):rL(e))}};function aL(e,t,n){var r=new XMLHttpRequest;r.open(`GET`,e),r.responseType=`blob`,r.onload=function(){cL(r.response,t,n)},r.onerror=function(){iL.error(`could not download file`)},r.send()}function oL(e){var t=new XMLHttpRequest;t.open(`HEAD`,e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function sL(e){try{e.dispatchEvent(new MouseEvent(`click`))}catch{var t=document.createEvent(`MouseEvents`);t.initMouseEvent(`click`,!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var cL=nL.saveAs||((typeof window>`u`?`undefined`:Oi(window))!==`object`||window!==nL?function(){}:typeof HTMLAnchorElement<`u`&&`download`in HTMLAnchorElement.prototype?function(e,t,n){var r=nL.URL||nL.webkitURL,i=document.createElement(`a`);t=t||e.name||`download`,i.download=t,i.rel=`noopener`,typeof e==`string`?(i.href=e,i.origin===location.origin?sL(i):oL(i.href)?aL(e,t,n):sL(i,i.target=`_blank`)):(i.href=r.createObjectURL(e),setTimeout(function(){r.revokeObjectURL(i.href)},4e4),setTimeout(function(){sL(i)},0))}:`msSaveOrOpenBlob`in navigator?function(e,t,n){if(t=t||e.name||`download`,typeof e==`string`)if(oL(e))aL(e,t,n);else{var r=document.createElement(`a`);r.href=e,r.target=`_blank`,setTimeout(function(){sL(r)})}else navigator.msSaveOrOpenBlob(function(e,t){return t===void 0?t={autoBom:!1}:Oi(t)!==`object`&&(iL.warn(`Deprecated: Expected third argument to be a object`),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([``,e],{type:e.type}):e}(e,n),t)}:function(e,t,n,r){if((r||=open(``,`_blank`))&&(r.document.title=r.document.body.innerText=`downloading...`),typeof e==`string`)return aL(e,t,n);var i=e.type===`application/octet-stream`,a=/constructor/i.test(nL.HTMLElement)||nL.safari,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||i&&a)&&(typeof FileReader>`u`?`undefined`:Oi(FileReader))===`object`){var s=new FileReader;s.onloadend=function(){var e=s.result;e=o?e:e.replace(/^data:[^;]*;/,`data:attachment/file;`),r?r.location.href=e:location=e,r=null},s.readAsDataURL(e)}else{var c=nL.URL||nL.webkitURL,l=c.createObjectURL(e);r?r.location=l:location.href=l,r=null,setTimeout(function(){c.revokeObjectURL(l)},4e4)}});function lL(e){var t;e||=``,this.ok=!1,e.charAt(0)==`#`&&(e=e.substr(1,6)),e={aliceblue:`f0f8ff`,antiquewhite:`faebd7`,aqua:`00ffff`,aquamarine:`7fffd4`,azure:`f0ffff`,beige:`f5f5dc`,bisque:`ffe4c4`,black:`000000`,blanchedalmond:`ffebcd`,blue:`0000ff`,blueviolet:`8a2be2`,brown:`a52a2a`,burlywood:`deb887`,cadetblue:`5f9ea0`,chartreuse:`7fff00`,chocolate:`d2691e`,coral:`ff7f50`,cornflowerblue:`6495ed`,cornsilk:`fff8dc`,crimson:`dc143c`,cyan:`00ffff`,darkblue:`00008b`,darkcyan:`008b8b`,darkgoldenrod:`b8860b`,darkgray:`a9a9a9`,darkgreen:`006400`,darkkhaki:`bdb76b`,darkmagenta:`8b008b`,darkolivegreen:`556b2f`,darkorange:`ff8c00`,darkorchid:`9932cc`,darkred:`8b0000`,darksalmon:`e9967a`,darkseagreen:`8fbc8f`,darkslateblue:`483d8b`,darkslategray:`2f4f4f`,darkturquoise:`00ced1`,darkviolet:`9400d3`,deeppink:`ff1493`,deepskyblue:`00bfff`,dimgray:`696969`,dodgerblue:`1e90ff`,feldspar:`d19275`,firebrick:`b22222`,floralwhite:`fffaf0`,forestgreen:`228b22`,fuchsia:`ff00ff`,gainsboro:`dcdcdc`,ghostwhite:`f8f8ff`,gold:`ffd700`,goldenrod:`daa520`,gray:`808080`,green:`008000`,greenyellow:`adff2f`,honeydew:`f0fff0`,hotpink:`ff69b4`,indianred:`cd5c5c`,indigo:`4b0082`,ivory:`fffff0`,khaki:`f0e68c`,lavender:`e6e6fa`,lavenderblush:`fff0f5`,lawngreen:`7cfc00`,lemonchiffon:`fffacd`,lightblue:`add8e6`,lightcoral:`f08080`,lightcyan:`e0ffff`,lightgoldenrodyellow:`fafad2`,lightgrey:`d3d3d3`,lightgreen:`90ee90`,lightpink:`ffb6c1`,lightsalmon:`ffa07a`,lightseagreen:`20b2aa`,lightskyblue:`87cefa`,lightslateblue:`8470ff`,lightslategray:`778899`,lightsteelblue:`b0c4de`,lightyellow:`ffffe0`,lime:`00ff00`,limegreen:`32cd32`,linen:`faf0e6`,magenta:`ff00ff`,maroon:`800000`,mediumaquamarine:`66cdaa`,mediumblue:`0000cd`,mediumorchid:`ba55d3`,mediumpurple:`9370d8`,mediumseagreen:`3cb371`,mediumslateblue:`7b68ee`,mediumspringgreen:`00fa9a`,mediumturquoise:`48d1cc`,mediumvioletred:`c71585`,midnightblue:`191970`,mintcream:`f5fffa`,mistyrose:`ffe4e1`,moccasin:`ffe4b5`,navajowhite:`ffdead`,navy:`000080`,oldlace:`fdf5e6`,olive:`808000`,olivedrab:`6b8e23`,orange:`ffa500`,orangered:`ff4500`,orchid:`da70d6`,palegoldenrod:`eee8aa`,palegreen:`98fb98`,paleturquoise:`afeeee`,palevioletred:`d87093`,papayawhip:`ffefd5`,peachpuff:`ffdab9`,peru:`cd853f`,pink:`ffc0cb`,plum:`dda0dd`,powderblue:`b0e0e6`,purple:`800080`,red:`ff0000`,rosybrown:`bc8f8f`,royalblue:`4169e1`,saddlebrown:`8b4513`,salmon:`fa8072`,sandybrown:`f4a460`,seagreen:`2e8b57`,seashell:`fff5ee`,sienna:`a0522d`,silver:`c0c0c0`,skyblue:`87ceeb`,slateblue:`6a5acd`,slategray:`708090`,snow:`fffafa`,springgreen:`00ff7f`,steelblue:`4682b4`,tan:`d2b48c`,teal:`008080`,thistle:`d8bfd8`,tomato:`ff6347`,turquoise:`40e0d0`,violet:`ee82ee`,violetred:`d02090`,wheat:`f5deb3`,white:`ffffff`,whitesmoke:`f5f5f5`,yellow:`ffff00`,yellowgreen:`9acd32`}[e=(e=e.replace(/ /g,``)).toLowerCase()]||e;for(var n=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:[`rgb(123, 234, 45)`,`rgb(255,234,245)`],process:function(e){return[parseInt(e[1]),parseInt(e[2]),parseInt(e[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:[`#00ff00`,`336699`],process:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:[`#fb0`,`f0f`],process:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}}],r=0;r<n.length;r++){var i=n[r].re,a=n[r].process,o=i.exec(e);o&&(t=a(o),this.r=t[0],this.g=t[1],this.b=t[2],this.ok=!0)}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return`rgb(`+this.r+`, `+this.g+`, `+this.b+`)`},this.toHex=function(){var e=this.r.toString(16),t=this.g.toString(16),n=this.b.toString(16);return e.length==1&&(e=`0`+e),t.length==1&&(t=`0`+t),n.length==1&&(n=`0`+n),`#`+e+t+n}}var uL=nL.atob.bind(nL),dL=nL.btoa.bind(nL);function fL(e,t){var n=e[0],r=e[1],i=e[2],a=e[3];n=mL(n,r,i,a,t[0],7,-680876936),a=mL(a,n,r,i,t[1],12,-389564586),i=mL(i,a,n,r,t[2],17,606105819),r=mL(r,i,a,n,t[3],22,-1044525330),n=mL(n,r,i,a,t[4],7,-176418897),a=mL(a,n,r,i,t[5],12,1200080426),i=mL(i,a,n,r,t[6],17,-1473231341),r=mL(r,i,a,n,t[7],22,-45705983),n=mL(n,r,i,a,t[8],7,1770035416),a=mL(a,n,r,i,t[9],12,-1958414417),i=mL(i,a,n,r,t[10],17,-42063),r=mL(r,i,a,n,t[11],22,-1990404162),n=mL(n,r,i,a,t[12],7,1804603682),a=mL(a,n,r,i,t[13],12,-40341101),i=mL(i,a,n,r,t[14],17,-1502002290),n=hL(n,r=mL(r,i,a,n,t[15],22,1236535329),i,a,t[1],5,-165796510),a=hL(a,n,r,i,t[6],9,-1069501632),i=hL(i,a,n,r,t[11],14,643717713),r=hL(r,i,a,n,t[0],20,-373897302),n=hL(n,r,i,a,t[5],5,-701558691),a=hL(a,n,r,i,t[10],9,38016083),i=hL(i,a,n,r,t[15],14,-660478335),r=hL(r,i,a,n,t[4],20,-405537848),n=hL(n,r,i,a,t[9],5,568446438),a=hL(a,n,r,i,t[14],9,-1019803690),i=hL(i,a,n,r,t[3],14,-187363961),r=hL(r,i,a,n,t[8],20,1163531501),n=hL(n,r,i,a,t[13],5,-1444681467),a=hL(a,n,r,i,t[2],9,-51403784),i=hL(i,a,n,r,t[7],14,1735328473),n=gL(n,r=hL(r,i,a,n,t[12],20,-1926607734),i,a,t[5],4,-378558),a=gL(a,n,r,i,t[8],11,-2022574463),i=gL(i,a,n,r,t[11],16,1839030562),r=gL(r,i,a,n,t[14],23,-35309556),n=gL(n,r,i,a,t[1],4,-1530992060),a=gL(a,n,r,i,t[4],11,1272893353),i=gL(i,a,n,r,t[7],16,-155497632),r=gL(r,i,a,n,t[10],23,-1094730640),n=gL(n,r,i,a,t[13],4,681279174),a=gL(a,n,r,i,t[0],11,-358537222),i=gL(i,a,n,r,t[3],16,-722521979),r=gL(r,i,a,n,t[6],23,76029189),n=gL(n,r,i,a,t[9],4,-640364487),a=gL(a,n,r,i,t[12],11,-421815835),i=gL(i,a,n,r,t[15],16,530742520),n=_L(n,r=gL(r,i,a,n,t[2],23,-995338651),i,a,t[0],6,-198630844),a=_L(a,n,r,i,t[7],10,1126891415),i=_L(i,a,n,r,t[14],15,-1416354905),r=_L(r,i,a,n,t[5],21,-57434055),n=_L(n,r,i,a,t[12],6,1700485571),a=_L(a,n,r,i,t[3],10,-1894986606),i=_L(i,a,n,r,t[10],15,-1051523),r=_L(r,i,a,n,t[1],21,-2054922799),n=_L(n,r,i,a,t[8],6,1873313359),a=_L(a,n,r,i,t[15],10,-30611744),i=_L(i,a,n,r,t[6],15,-1560198380),r=_L(r,i,a,n,t[13],21,1309151649),n=_L(n,r,i,a,t[4],6,-145523070),a=_L(a,n,r,i,t[11],10,-1120210379),i=_L(i,a,n,r,t[2],15,718787259),r=_L(r,i,a,n,t[9],21,-343485551),e[0]=TL(n,e[0]),e[1]=TL(r,e[1]),e[2]=TL(i,e[2]),e[3]=TL(a,e[3])}function pL(e,t,n,r,i,a){return t=TL(TL(t,e),TL(r,a)),TL(t<<i|t>>>32-i,n)}function mL(e,t,n,r,i,a,o){return pL(t&n|~t&r,e,t,i,a,o)}function hL(e,t,n,r,i,a,o){return pL(t&r|n&~r,e,t,i,a,o)}function gL(e,t,n,r,i,a,o){return pL(t^n^r,e,t,i,a,o)}function _L(e,t,n,r,i,a,o){return pL(n^(t|~r),e,t,i,a,o)}function vL(e){var t,n=e.length,r=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=e.length;t+=64)fL(r,yL(e.substring(t-64,t)));e=e.substring(t-64);var i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<e.length;t++)i[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(fL(r,i),t=0;t<16;t++)i[t]=0;return i[14]=8*n,fL(r,i),r}function yL(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}var bL=`0123456789abcdef`.split(``);function xL(e){for(var t=``,n=0;n<4;n++)t+=bL[e>>8*n+4&15]+bL[e>>8*n&15];return t}function SL(e){return String.fromCharCode(255&e,(65280&e)>>8,(16711680&e)>>16,(4278190080&e)>>24)}function CL(e){return vL(e).map(SL).join(``)}var wL=function(e){for(var t=0;t<e.length;t++)e[t]=xL(e[t]);return e.join(``)}(vL(`hello`))!=`5d41402abc4b2a76b9719d911017c592`;function TL(e,t){if(wL){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}return e+t&4294967295}function EL(e,t){var n,r,i,a;if(e!==n){for(var o=(i=e,a=1+(256/e.length|0),Array(a+1).join(i)),s=[],c=0;c<256;c++)s[c]=c;var l=0;for(c=0;c<256;c++){var u=s[c];l=(l+u+o.charCodeAt(c))%256,s[c]=s[l],s[l]=u}n=e,r=s}else s=r;var d=t.length,f=0,p=0,m=``;for(c=0;c<d;c++)p=(p+(u=s[f=(f+1)%256]))%256,s[f]=s[p],s[p]=u,o=s[(s[f]+s[p])%256],m+=String.fromCharCode(t.charCodeAt(c)^o);return m}var DL={print:4,modify:8,copy:16,"annot-forms":32};function OL(e,t,n,r){this.v=1,this.r=2;var i=192;e.forEach(function(e){if(DL.perm!==void 0)throw Error(`Invalid permission: `+e);i+=DL[e]}),this.padding=`(¿N^NuAd\0NVÿú\b..\0¶Ðh>/\f©þdSiz`;var a=(t+this.padding).substr(0,32),o=(n+this.padding).substr(0,32);this.O=this.processOwnerPassword(a,o),this.P=-(1+(255^i)),this.encryptionKey=CL(a+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(r)).substr(0,5),this.U=EL(this.encryptionKey,this.padding)}function kL(e){if(/[^\u0000-\u00ff]/.test(e))throw Error(`Invalid PDF Name Object: `+e+`, Only accept ASCII characters.`);for(var t=``,n=e.length,r=0;r<n;r++){var i=e.charCodeAt(r);t+=i<33||i===35||i===37||i===40||i===41||i===47||i===60||i===62||i===91||i===93||i===123||i===125||i>126?`#`+(`0`+i.toString(16)).slice(-2):e[r]}return t}function AL(e){if(Oi(e)!==`object`)throw Error(`Invalid Context passed to initialize PubSub (jsPDF-module)`);var t={};this.subscribe=function(e,n,r){if(r||=!1,typeof e!=`string`||typeof n!=`function`||typeof r!=`boolean`)throw Error(`Invalid arguments passed to PubSub.subscribe (jsPDF-module)`);t.hasOwnProperty(e)||(t[e]={});var i=Math.random().toString(35);return t[e][i]=[n,!!r],i},this.unsubscribe=function(e){for(var n in t)if(t[n][e])return delete t[n][e],Object.keys(t[n]).length===0&&delete t[n],!0;return!1},this.publish=function(n){if(t.hasOwnProperty(n)){var r=Array.prototype.slice.call(arguments,1),i=[];for(var a in t[n]){var o=t[n][a];try{o[0].apply(e,r)}catch(e){nL.console&&iL.error(`jsPDF PubSub Error`,e.message,e)}o[1]&&i.push(a)}i.length&&i.forEach(this.unsubscribe)}},this.getTopics=function(){return t}}function jL(e){if(!(this instanceof jL))return new jL(e);var t=`opacity,stroke-opacity`.split(`,`);for(var n in e)e.hasOwnProperty(n)&&t.indexOf(n)>=0&&(this[n]=e[n]);this.id=``,this.objectNumber=-1}function ML(e,t){this.gState=e,this.matrix=t,this.id=``,this.objectNumber=-1}function NL(e,t,n,r,i){if(!(this instanceof NL))return new NL(e,t,n,r,i);this.type=e===`axial`?2:3,this.coords=t,this.colors=n,ML.call(this,r,i)}function PL(e,t,n,r,i){if(!(this instanceof PL))return new PL(e,t,n,r,i);this.boundingBox=e,this.xStep=t,this.yStep=n,this.stream=``,this.cloneIndex=0,ML.call(this,r,i)}function FL(e){var t,n=typeof arguments[0]==`string`?arguments[0]:`p`,r=arguments[1],i=arguments[2],a=arguments[3],o=[],s=1,c=16,l=`S`,u=null;Oi(e||={})===`object`&&(n=e.orientation,r=e.unit||r,i=e.format||i,a=e.compress||e.compressPdf||a,(u=e.encryption||null)!==null&&(u.userPassword=u.userPassword||``,u.ownerPassword=u.ownerPassword||``,u.userPermissions=u.userPermissions||[]),s=typeof e.userUnit==`number`?Math.abs(e.userUnit):1,e.precision!==void 0&&(t=e.precision),e.floatPrecision!==void 0&&(c=e.floatPrecision),l=e.defaultPathOperation||`S`),o=e.filters||(!0===a?[`FlateEncode`]:o),r||=`mm`,n=(``+(n||`P`)).toLowerCase();var d=e.putOnlyUsedFonts||!1,f={},p={internal:{},__private__:{}};p.__private__.PubSub=AL;var m=`1.3`,h=p.__private__.getPdfVersion=function(){return m};p.__private__.setPdfVersion=function(e){m=e};var g={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};p.__private__.getPageFormats=function(){return g};var _=p.__private__.getPageFormat=function(e){return g[e]};i||=`a4`;var v=`compat`,y=`advanced`,b=v;function x(){this.saveGraphicsState(),W(new G(xe,0,0,-xe,0,Sn()*xe).toString()+` cm`),this.setFontSize(this.getFontSize()/xe),l=`n`,b=y}function S(){this.restoreGraphicsState(),l=`S`,b=v}var C=p.__private__.combineFontStyleAndFontWeight=function(e,t){if(e==`bold`&&t==`normal`||e==`bold`&&t==400||e==`normal`&&t==`italic`||e==`bold`&&t==`italic`)throw Error(`Invalid Combination of fontweight and fontstyle`);return t&&(e=t==400||t===`normal`?e===`italic`?`italic`:`normal`:t!=700&&t!==`bold`||e!==`normal`?(t==700?`bold`:t)+``+e:`bold`),e};p.advancedAPI=function(e){var t=b===v;return t&&x.call(this),typeof e!=`function`||(e(this),t&&S.call(this)),this},p.compatAPI=function(e){var t=b===y;return t&&S.call(this),typeof e!=`function`||(e(this),t&&x.call(this)),this},p.isAdvancedAPI=function(){return b===y};var w,T=function(e){if(b!==y)throw Error(e+` is only available in 'advanced' API mode. You need to call advancedAPI() first.`)},E=p.roundToPrecision=p.__private__.roundToPrecision=function(e,n){var r=t||n;if(isNaN(e)||isNaN(r))throw Error(`Invalid argument passed to jsPDF.roundToPrecision`);return e.toFixed(r).replace(/0+$/,``)};w=p.hpf=p.__private__.hpf=typeof c==`number`?function(e){if(isNaN(e))throw Error(`Invalid argument passed to jsPDF.hpf`);return E(e,c)}:c===`smart`?function(e){if(isNaN(e))throw Error(`Invalid argument passed to jsPDF.hpf`);return E(e,e>-1&&e<1?16:5)}:function(e){if(isNaN(e))throw Error(`Invalid argument passed to jsPDF.hpf`);return E(e,16)};var D=p.f2=p.__private__.f2=function(e){if(isNaN(e))throw Error(`Invalid argument passed to jsPDF.f2`);return E(e,2)},O=p.__private__.f3=function(e){if(isNaN(e))throw Error(`Invalid argument passed to jsPDF.f3`);return E(e,3)},k=p.scale=p.__private__.scale=function(e){if(isNaN(e))throw Error(`Invalid argument passed to jsPDF.scale`);return b===v?e*xe:b===y?e:void 0},A=function(e){return k(function(e){return b===v?Sn()-e:b===y?e:void 0}(e))};p.__private__.setPrecision=p.setPrecision=function(e){typeof parseInt(e,10)==`number`&&(t=parseInt(e,10))};var j,M=`00000000000000000000000000000000`,N=p.__private__.getFileId=function(){return M},P=p.__private__.setFileId=function(e){return M=e!==void 0&&/^[a-fA-F0-9]{32}$/.test(e)?e.toUpperCase():M.split(``).map(function(){return`ABCDEF0123456789`.charAt(Math.floor(16*Math.random()))}).join(``),u!==null&&(Dt=new OL(u.userPermissions,u.userPassword,u.ownerPassword,M)),M};p.setFileId=function(e){return P(e),this},p.getFileId=function(){return N()};var F=p.__private__.convertDateToPDFDate=function(e){var t=e.getTimezoneOffset(),n=t<0?`+`:`-`,r=Math.floor(Math.abs(t/60)),i=Math.abs(t%60),a=[n,B(r),`'`,B(i),`'`].join(``);return[`D:`,e.getFullYear(),B(e.getMonth()+1),B(e.getDate()),B(e.getHours()),B(e.getMinutes()),B(e.getSeconds()),a].join(``)},I=p.__private__.convertPDFDateToDate=function(e){var t=parseInt(e.substr(2,4),10),n=parseInt(e.substr(6,2),10)-1,r=parseInt(e.substr(8,2),10),i=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),o=parseInt(e.substr(14,2),10);return new Date(t,n,r,i,a,o,0)},L=p.__private__.setCreationDate=function(e){var t;if(e===void 0&&(e=new Date),e instanceof Date)t=F(e);else{if(!/^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|-0[0-9]|-1[0-1])'(0[0-9]|[1-5][0-9])'?$/.test(e))throw Error(`Invalid argument passed to jsPDF.setCreationDate`);t=e}return j=t},R=p.__private__.getCreationDate=function(e){var t=j;return e===`jsDate`&&(t=I(j)),t};p.setCreationDate=function(e){return L(e),this},p.getCreationDate=function(e){return R(e)};var z,B=p.__private__.padd2=function(e){return(`0`+parseInt(e)).slice(-2)},V=p.__private__.padd2Hex=function(e){return(`00`+(e=e.toString())).substr(e.length)},ee=0,te=[],H=[],ne=0,re=[],ie=[],U=!1,ae=H;p.__private__.setCustomOutputDestination=function(e){U=!0,ae=e};var oe=function(e){U||(ae=e)};p.__private__.resetCustomOutputDestination=function(){U=!1,ae=H};var W=p.__private__.out=function(e){return e=e.toString(),ne+=e.length+1,ae.push(e),ae},se=p.__private__.write=function(e){return W(arguments.length===1?e.toString():Array.prototype.join.call(arguments,` `))},ce=p.__private__.getArrayBuffer=function(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n);t--;)r[t]=e.charCodeAt(t);return n},le=[[`Helvetica`,`helvetica`,`normal`,`WinAnsiEncoding`],[`Helvetica-Bold`,`helvetica`,`bold`,`WinAnsiEncoding`],[`Helvetica-Oblique`,`helvetica`,`italic`,`WinAnsiEncoding`],[`Helvetica-BoldOblique`,`helvetica`,`bolditalic`,`WinAnsiEncoding`],[`Courier`,`courier`,`normal`,`WinAnsiEncoding`],[`Courier-Bold`,`courier`,`bold`,`WinAnsiEncoding`],[`Courier-Oblique`,`courier`,`italic`,`WinAnsiEncoding`],[`Courier-BoldOblique`,`courier`,`bolditalic`,`WinAnsiEncoding`],[`Times-Roman`,`times`,`normal`,`WinAnsiEncoding`],[`Times-Bold`,`times`,`bold`,`WinAnsiEncoding`],[`Times-Italic`,`times`,`italic`,`WinAnsiEncoding`],[`Times-BoldItalic`,`times`,`bolditalic`,`WinAnsiEncoding`],[`ZapfDingbats`,`zapfdingbats`,`normal`,null],[`Symbol`,`symbol`,`normal`,null]];p.__private__.getStandardFonts=function(){return le};var ue=e.fontSize||16;p.__private__.setFontSize=p.setFontSize=function(e){return ue=b===y?e/xe:e,this};var de,fe=p.__private__.getFontSize=p.getFontSize=function(){return b===v?ue:ue*xe},pe=e.R2L||!1;p.__private__.setR2L=p.setR2L=function(e){return pe=e,this},p.__private__.getR2L=p.getR2L=function(){return pe};var me,he=p.__private__.setZoomMode=function(e){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(e))de=e;else if(isNaN(e)){if([void 0,null,`fullwidth`,`fullheight`,`fullpage`,`original`].indexOf(e)===-1)throw Error(`zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "`+e+`" is not recognized.`);de=e}else de=parseInt(e,10)};p.__private__.getZoomMode=function(){return de};var ge,_e=p.__private__.setPageMode=function(e){if([void 0,null,`UseNone`,`UseOutlines`,`UseThumbs`,`FullScreen`].indexOf(e)==-1)throw Error(`Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "`+e+`" is not recognized.`);me=e};p.__private__.getPageMode=function(){return me};var ve=p.__private__.setLayoutMode=function(e){if([void 0,null,`continuous`,`single`,`twoleft`,`tworight`,`two`].indexOf(e)==-1)throw Error(`Layout mode must be one of continuous, single, twoleft, tworight. "`+e+`" is not recognized.`);ge=e};p.__private__.getLayoutMode=function(){return ge},p.__private__.setDisplayMode=p.setDisplayMode=function(e,t,n){return he(e),ve(t),_e(n),this};var ye={title:``,subject:``,author:``,keywords:``,creator:``};p.__private__.getDocumentProperty=function(e){if(Object.keys(ye).indexOf(e)===-1)throw Error(`Invalid argument passed to jsPDF.getDocumentProperty`);return ye[e]},p.__private__.getDocumentProperties=function(){return ye},p.__private__.setDocumentProperties=p.setProperties=p.setDocumentProperties=function(e){for(var t in ye)ye.hasOwnProperty(t)&&e[t]&&(ye[t]=e[t]);return this},p.__private__.setDocumentProperty=function(e,t){if(Object.keys(ye).indexOf(e)===-1)throw Error(`Invalid arguments passed to jsPDF.setDocumentProperty`);return ye[e]=t};var be,xe,Se,Ce,we,Te={},Ee={},De=[],Oe={},ke={},Ae={},je={},Me=null,Ne=0,Pe=[],Fe=new AL(p),Ie=e.hotfixes||[],Le={},Re={},ze=[],G=function e(t,n,r,i,a,o){if(!(this instanceof e))return new e(t,n,r,i,a,o);isNaN(t)&&(t=1),isNaN(n)&&(n=0),isNaN(r)&&(r=0),isNaN(i)&&(i=1),isNaN(a)&&(a=0),isNaN(o)&&(o=0),this._matrix=[t,n,r,i,a,o]};Object.defineProperty(G.prototype,"sx",{get:function(){return this._matrix[0]},set:function(e){this._matrix[0]=e}}),Object.defineProperty(G.prototype,"shy",{get:function(){return this._matrix[1]},set:function(e){this._matrix[1]=e}}),Object.defineProperty(G.prototype,"shx",{get:function(){return this._matrix[2]},set:function(e){this._matrix[2]=e}}),Object.defineProperty(G.prototype,"sy",{get:function(){return this._matrix[3]},set:function(e){this._matrix[3]=e}}),Object.defineProperty(G.prototype,"tx",{get:function(){return this._matrix[4]},set:function(e){this._matrix[4]=e}}),Object.defineProperty(G.prototype,"ty",{get:function(){return this._matrix[5]},set:function(e){this._matrix[5]=e}}),Object.defineProperty(G.prototype,"a",{get:function(){return this._matrix[0]},set:function(e){this._matrix[0]=e}}),Object.defineProperty(G.prototype,"b",{get:function(){return this._matrix[1]},set:function(e){this._matrix[1]=e}}),Object.defineProperty(G.prototype,"c",{get:function(){return this._matrix[2]},set:function(e){this._matrix[2]=e}}),Object.defineProperty(G.prototype,"d",{get:function(){return this._matrix[3]},set:function(e){this._matrix[3]=e}}),Object.defineProperty(G.prototype,"e",{get:function(){return this._matrix[4]},set:function(e){this._matrix[4]=e}}),Object.defineProperty(G.prototype,"f",{get:function(){return this._matrix[5]},set:function(e){this._matrix[5]=e}}),Object.defineProperty(G.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(G.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(G.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(G.prototype,"isIdentity",{get:function(){return this.sx===1&&this.shy===0&&this.shx===0&&this.sy===1&&this.tx===0&&this.ty===0}}),G.prototype.join=function(e){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(w).join(e)},G.prototype.multiply=function(e){return new G(e.sx*this.sx+e.shy*this.shx,e.sx*this.shy+e.shy*this.sy,e.shx*this.sx+e.sy*this.shx,e.shx*this.shy+e.sy*this.sy,e.tx*this.sx+e.ty*this.shx+this.tx,e.tx*this.shy+e.ty*this.sy+this.ty)},G.prototype.decompose=function(){var e=this.sx,t=this.shy,n=this.shx,r=this.sy,i=this.tx,a=this.ty,o=Math.sqrt(e*e+t*t),s=(e/=o)*n+(t/=o)*r;n-=e*s,r-=t*s;var c=Math.sqrt(n*n+r*r);return s/=c,e*(r/=c)<t*(n/=c)&&(e=-e,t=-t,s=-s,o=-o),{scale:new G(o,0,0,c,0,0),translate:new G(1,0,0,1,i,a),rotate:new G(e,t,-t,e,0,0),skew:new G(1,0,s,1,0,0)}},G.prototype.toString=function(e){return this.join(` `)},G.prototype.inversed=function(){var e=this.sx,t=this.shy,n=this.shx,r=this.sy,i=this.tx,a=this.ty,o=1/(e*r-t*n),s=r*o,c=-t*o,l=-n*o,u=e*o;return new G(s,c,l,u,-s*i-l*a,-c*i-u*a)},G.prototype.applyToPoint=function(e){return new dn(e.x*this.sx+e.y*this.shx+this.tx,e.x*this.shy+e.y*this.sy+this.ty)},G.prototype.applyToRectangle=function(e){var t=this.applyToPoint(e),n=this.applyToPoint(new dn(e.x+e.w,e.y+e.h));return new fn(t.x,t.y,n.x-t.x,n.y-t.y)},G.prototype.clone=function(){var e=this.sx,t=this.shy,n=this.shx,r=this.sy,i=this.tx,a=this.ty;return new G(e,t,n,r,i,a)},p.Matrix=G;var Be=p.matrixMult=function(e,t){return t.multiply(e)},Ve=new G(1,0,0,1,0,0);p.unitMatrix=p.identityMatrix=Ve;var He=function(e,t){if(!ke[e]){var n=(t instanceof NL?`Sh`:`P`)+(Object.keys(Oe).length+1).toString(10);t.id=n,ke[e]=n,Oe[n]=t,Fe.publish(`addPattern`,t)}};p.ShadingPattern=NL,p.TilingPattern=PL,p.addShadingPattern=function(e,t){return T(`addShadingPattern()`),He(e,t),this},p.beginTilingPattern=function(e){T(`beginTilingPattern()`),mn(e.boundingBox[0],e.boundingBox[1],e.boundingBox[2]-e.boundingBox[0],e.boundingBox[3]-e.boundingBox[1],e.matrix)},p.endTilingPattern=function(e,t){T(`endTilingPattern()`),t.stream=ie[z].join(`
`),He(e,t),Fe.publish(`endTilingPattern`,t),ze.pop().restore()};var Ue,We=p.__private__.newObject=function(){var e=Ge();return K(e,!0),e},Ge=p.__private__.newObjectDeferred=function(){return ee++,te[ee]=function(){return ne},ee},K=function(e,t){return t=typeof t==`boolean`&&t,te[e]=ne,t&&W(e+` 0 obj`),e},Ke=p.__private__.newAdditionalObject=function(){var e={objId:Ge(),content:``};return re.push(e),e},qe=Ge(),Je=Ge(),Ye=p.__private__.decodeColorString=function(e){var t=e.split(` `);if(t.length!==2||t[1]!==`g`&&t[1]!==`G`)t.length!==5||t[4]!==`k`&&t[4]!==`K`||(t=[(1-t[0])*(1-t[3]),(1-t[1])*(1-t[3]),(1-t[2])*(1-t[3]),`r`]);else{var n=parseFloat(t[0]);t=[n,n,n,`r`]}for(var r=`#`,i=0;i<3;i++)r+=(`0`+Math.floor(255*parseFloat(t[i])).toString(16)).slice(-2);return r},Xe=p.__private__.encodeColorString=function(e){var t;typeof e==`string`&&(e={ch1:e});var n=e.ch1,r=e.ch2,i=e.ch3,a=e.ch4,o=e.pdfColorType===`draw`?[`G`,`RG`,`K`]:[`g`,`rg`,`k`];if(typeof n==`string`&&n.charAt(0)!==`#`){var s=new lL(n);if(s.ok)n=s.toHex();else if(!/^\d*\.?\d*$/.test(n))throw Error(`Invalid color "`+n+`" passed to jsPDF.encodeColorString.`)}if(typeof n==`string`&&/^#[0-9A-Fa-f]{3}$/.test(n)&&(n=`#`+n[1]+n[1]+n[2]+n[2]+n[3]+n[3]),typeof n==`string`&&/^#[0-9A-Fa-f]{6}$/.test(n)){var c=parseInt(n.substr(1),16);n=c>>16&255,r=c>>8&255,i=255&c}if(r===void 0||a===void 0&&n===r&&r===i)t=typeof n==`string`?n+` `+o[0]:e.precision===2?D(n/255)+` `+o[0]:O(n/255)+` `+o[0];else if(a===void 0||Oi(a)===`object`){if(a&&!isNaN(a.a)&&a.a===0)return[`1.`,`1.`,`1.`,o[1]].join(` `);t=typeof n==`string`?[n,r,i,o[1]].join(` `):e.precision===2?[D(n/255),D(r/255),D(i/255),o[1]].join(` `):[O(n/255),O(r/255),O(i/255),o[1]].join(` `)}else t=typeof n==`string`?[n,r,i,a,o[2]].join(` `):e.precision===2?[D(n),D(r),D(i),D(a),o[2]].join(` `):[O(n),O(r),O(i),O(a),o[2]].join(` `);return t},Ze=p.__private__.getFilters=function(){return o},Qe=p.__private__.putStream=function(e){var t=(e||={}).data||``,n=e.filters||Ze(),r=e.alreadyAppliedFilters||[],i=e.addLength1||!1,a=t.length,o=e.objectId,s=function(e){return e};if(u!==null&&o===void 0)throw Error(`ObjectId must be passed to putStream for file encryption`);u!==null&&(s=Dt.encryptor(o,0));var c={};!0===n&&(n=[`FlateEncode`]);var l=e.additionalKeyValues||[],d=(c=FL.API.processDataByFilters===void 0?{data:t,reverseChain:[]}:FL.API.processDataByFilters(t,n)).reverseChain+(Array.isArray(r)?r.join(` `):r.toString());if(c.data.length!==0&&(l.push({key:`Length`,value:c.data.length}),!0===i&&l.push({key:`Length1`,value:a})),d.length!=0)if(d.split(`/`).length-1==1)l.push({key:`Filter`,value:d});else{l.push({key:`Filter`,value:`[`+d+`]`});for(var f=0;f<l.length;f+=1)if(l[f].key===`DecodeParms`){for(var p=[],m=0;m<c.reverseChain.split(`/`).length-1;m+=1)p.push(`null`);p.push(l[f].value),l[f].value=`[`+p.join(` `)+`]`}}W(`<<`);for(var h=0;h<l.length;h++)W(`/`+l[h].key+` `+l[h].value);W(`>>`),c.data.length!==0&&(W(`stream`),W(s(c.data)),W(`endstream`))},$e=p.__private__.putPage=function(e){var t=e.number,n=e.data,r=e.objId,i=e.contentsObjId;K(r,!0),W(`<</Type /Page`),W(`/Parent `+e.rootDictionaryObjId+` 0 R`),W(`/Resources `+e.resourceDictionaryObjId+` 0 R`),W(`/MediaBox [`+parseFloat(w(e.mediaBox.bottomLeftX))+` `+parseFloat(w(e.mediaBox.bottomLeftY))+` `+w(e.mediaBox.topRightX)+` `+w(e.mediaBox.topRightY)+`]`),e.cropBox!==null&&W(`/CropBox [`+w(e.cropBox.bottomLeftX)+` `+w(e.cropBox.bottomLeftY)+` `+w(e.cropBox.topRightX)+` `+w(e.cropBox.topRightY)+`]`),e.bleedBox!==null&&W(`/BleedBox [`+w(e.bleedBox.bottomLeftX)+` `+w(e.bleedBox.bottomLeftY)+` `+w(e.bleedBox.topRightX)+` `+w(e.bleedBox.topRightY)+`]`),e.trimBox!==null&&W(`/TrimBox [`+w(e.trimBox.bottomLeftX)+` `+w(e.trimBox.bottomLeftY)+` `+w(e.trimBox.topRightX)+` `+w(e.trimBox.topRightY)+`]`),e.artBox!==null&&W(`/ArtBox [`+w(e.artBox.bottomLeftX)+` `+w(e.artBox.bottomLeftY)+` `+w(e.artBox.topRightX)+` `+w(e.artBox.topRightY)+`]`),typeof e.userUnit==`number`&&e.userUnit!==1&&W(`/UserUnit `+e.userUnit),Fe.publish(`putPage`,{objId:r,pageContext:Pe[t],pageNumber:t,page:n}),W(`/Contents `+i+` 0 R`),W(`>>`),W(`endobj`);var a=n.join(`
`);return b===y&&(a+=`
Q`),K(i,!0),Qe({data:a,filters:Ze(),objectId:i}),W(`endobj`),r},et=p.__private__.putPages=function(){var e,t,n=[];for(e=1;e<=Ne;e++)Pe[e].objId=Ge(),Pe[e].contentsObjId=Ge();for(e=1;e<=Ne;e++)n.push($e({number:e,data:ie[e],objId:Pe[e].objId,contentsObjId:Pe[e].contentsObjId,mediaBox:Pe[e].mediaBox,cropBox:Pe[e].cropBox,bleedBox:Pe[e].bleedBox,trimBox:Pe[e].trimBox,artBox:Pe[e].artBox,userUnit:Pe[e].userUnit,rootDictionaryObjId:qe,resourceDictionaryObjId:Je}));K(qe,!0),W(`<</Type /Pages`);var r=`/Kids [`;for(t=0;t<Ne;t++)r+=n[t]+` 0 R `;W(r+`]`),W(`/Count `+Ne),W(`>>`),W(`endobj`),Fe.publish(`postPutPages`)},tt=function(e){Fe.publish(`putFont`,{font:e,out:W,newObject:We,putStream:Qe}),!0!==e.isAlreadyPutted&&(e.objectNumber=We(),W(`<<`),W(`/Type /Font`),W(`/BaseFont /`+kL(e.postScriptName)),W(`/Subtype /Type1`),typeof e.encoding==`string`&&W(`/Encoding /`+e.encoding),W(`/FirstChar 32`),W(`/LastChar 255`),W(`>>`),W(`endobj`))},nt=function(e){e.objectNumber=We();var t=[];t.push({key:`Type`,value:`/XObject`}),t.push({key:`Subtype`,value:`/Form`}),t.push({key:`BBox`,value:`[`+[w(e.x),w(e.y),w(e.x+e.width),w(e.y+e.height)].join(` `)+`]`}),t.push({key:`Matrix`,value:`[`+e.matrix.toString()+`]`}),Qe({data:e.pages[1].join(`
`),additionalKeyValues:t,objectId:e.objectNumber}),W(`endobj`)},rt=function(e,t){t||=21;var n=We(),r=function(e,t){var n,r=[],i=1/(t-1);for(n=0;n<1;n+=i)r.push(n);if(r.push(1),e[0].offset!=0){var a={offset:0,color:e[0].color};e.unshift(a)}if(e[e.length-1].offset!=1){var o={offset:1,color:e[e.length-1].color};e.push(o)}for(var s=``,c=0,l=0;l<r.length;l++){for(n=r[l];n>e[c+1].offset;)c++;var u=e[c].offset,d=(n-u)/(e[c+1].offset-u),f=e[c].color,p=e[c+1].color;s+=V(Math.round((1-d)*f[0]+d*p[0]).toString(16))+V(Math.round((1-d)*f[1]+d*p[1]).toString(16))+V(Math.round((1-d)*f[2]+d*p[2]).toString(16))}return s.trim()}(e.colors,t),i=[];i.push({key:`FunctionType`,value:`0`}),i.push({key:`Domain`,value:`[0.0 1.0]`}),i.push({key:`Size`,value:`[`+t+`]`}),i.push({key:`BitsPerSample`,value:`8`}),i.push({key:`Range`,value:`[0.0 1.0 0.0 1.0 0.0 1.0]`}),i.push({key:`Decode`,value:`[0.0 1.0 0.0 1.0 0.0 1.0]`}),Qe({data:r,additionalKeyValues:i,alreadyAppliedFilters:[`/ASCIIHexDecode`],objectId:n}),W(`endobj`),e.objectNumber=We(),W(`<< /ShadingType `+e.type),W(`/ColorSpace /DeviceRGB`);var a=`/Coords [`+w(parseFloat(e.coords[0]))+` `+w(parseFloat(e.coords[1]))+` `;e.type===2?a+=w(parseFloat(e.coords[2]))+` `+w(parseFloat(e.coords[3])):a+=w(parseFloat(e.coords[2]))+` `+w(parseFloat(e.coords[3]))+` `+w(parseFloat(e.coords[4]))+` `+w(parseFloat(e.coords[5])),W(a+=`]`),e.matrix&&W(`/Matrix [`+e.matrix.toString()+`]`),W(`/Function `+n+` 0 R`),W(`/Extend [true true]`),W(`>>`),W(`endobj`)},it=function(e,t){var n=Ge(),r=We();t.push({resourcesOid:n,objectOid:r}),e.objectNumber=r;var i=[];i.push({key:`Type`,value:`/Pattern`}),i.push({key:`PatternType`,value:`1`}),i.push({key:`PaintType`,value:`1`}),i.push({key:`TilingType`,value:`1`}),i.push({key:`BBox`,value:`[`+e.boundingBox.map(w).join(` `)+`]`}),i.push({key:`XStep`,value:w(e.xStep)}),i.push({key:`YStep`,value:w(e.yStep)}),i.push({key:`Resources`,value:n+` 0 R`}),e.matrix&&i.push({key:`Matrix`,value:`[`+e.matrix.toString()+`]`}),Qe({data:e.stream,additionalKeyValues:i,objectId:e.objectNumber}),W(`endobj`)},at=function(e){for(var t in e.objectNumber=We(),W(`<<`),e)switch(t){case`opacity`:W(`/ca `+D(e[t]));break;case`stroke-opacity`:W(`/CA `+D(e[t]))}W(`>>`),W(`endobj`)},ot=function(e){K(e.resourcesOid,!0),W(`<<`),W(`/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]`),function(){for(var e in W(`/Font <<`),Te)Te.hasOwnProperty(e)&&(!1===d||!0===d&&f.hasOwnProperty(e))&&W(`/`+e+` `+Te[e].objectNumber+` 0 R`);W(`>>`)}(),function(){if(Object.keys(Oe).length>0){for(var e in W(`/Shading <<`),Oe)Oe.hasOwnProperty(e)&&Oe[e]instanceof NL&&Oe[e].objectNumber>=0&&W(`/`+e+` `+Oe[e].objectNumber+` 0 R`);Fe.publish(`putShadingPatternDict`),W(`>>`)}}(),function(e){if(Object.keys(Oe).length>0){for(var t in W(`/Pattern <<`),Oe)Oe.hasOwnProperty(t)&&Oe[t]instanceof p.TilingPattern&&Oe[t].objectNumber>=0&&Oe[t].objectNumber<e&&W(`/`+t+` `+Oe[t].objectNumber+` 0 R`);Fe.publish(`putTilingPatternDict`),W(`>>`)}}(e.objectOid),function(){if(Object.keys(Ae).length>0){for(var e in W(`/ExtGState <<`),Ae)Ae.hasOwnProperty(e)&&Ae[e].objectNumber>=0&&W(`/`+e+` `+Ae[e].objectNumber+` 0 R`);Fe.publish(`putGStateDict`),W(`>>`)}}(),function(){for(var e in W(`/XObject <<`),Le)Le.hasOwnProperty(e)&&Le[e].objectNumber>=0&&W(`/`+e+` `+Le[e].objectNumber+` 0 R`);Fe.publish(`putXobjectDict`),W(`>>`)}(),W(`>>`),W(`endobj`)},st=function(e){Ee[e.fontName]=Ee[e.fontName]||{},Ee[e.fontName][e.fontStyle]=e.id},ct=function(e,t,n,r,i){var a={id:`F`+(Object.keys(Te).length+1).toString(10),postScriptName:e,fontName:t,fontStyle:n,encoding:r,isStandardFont:i||!1,metadata:{}};return Fe.publish(`addFont`,{font:a,instance:this}),Te[a.id]=a,st(a),a.id},lt=p.__private__.pdfEscape=p.pdfEscape=function(e,t){return function(e,t){var n,r,i,a,o,s,c,l,u;if(i=(t||={}).sourceEncoding||`Unicode`,o=t.outputEncoding,(t.autoencode||o)&&Te[be].metadata&&Te[be].metadata[i]&&Te[be].metadata[i].encoding&&(a=Te[be].metadata[i].encoding,!o&&Te[be].encoding&&(o=Te[be].encoding),!o&&a.codePages&&(o=a.codePages[0]),typeof o==`string`&&(o=a[o]),o)){for(c=!1,s=[],n=0,r=e.length;n<r;n++)(l=o[e.charCodeAt(n)])?s.push(String.fromCharCode(l)):s.push(e[n]),s[n].charCodeAt(0)>>8&&(c=!0);e=s.join(``)}for(n=e.length;c===void 0&&n!==0;)e.charCodeAt(n-1)>>8&&(c=!0),n--;if(!c)return e;for(s=t.noBOM?[]:[254,255],n=0,r=e.length;n<r;n++){if((u=(l=e.charCodeAt(n))>>8)>>8)throw Error(`Character at position `+n+` of string '`+e+`' exceeds 16bits. Cannot be encoded into UCS-2 BE`);s.push(u),s.push(l-(u<<8))}return String.fromCharCode.apply(void 0,s)}(e,t).replace(/\\/g,`\\\\`).replace(/\(/g,`\\(`).replace(/\)/g,`\\)`)},ut=p.__private__.beginPage=function(e){ie[++Ne]=[],Pe[Ne]={objId:0,contentsObjId:0,userUnit:Number(s),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(e[0]),topRightY:Number(e[1])}},pt(Ne),oe(ie[z])},dt=function(e,t){var r,a,o;switch(n=t||n,typeof e==`string`&&(r=_(e.toLowerCase()),Array.isArray(r)&&(a=r[0],o=r[1])),Array.isArray(e)&&(a=e[0]*xe,o=e[1]*xe),isNaN(a)&&(a=i[0],o=i[1]),(a>14400||o>14400)&&(iL.warn(`A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400`),a=Math.min(14400,a),o=Math.min(14400,o)),i=[a,o],n.substr(0,1)){case`l`:o>a&&(i=[o,a]);break;case`p`:a>o&&(i=[o,a])}ut(i),qt(Gt),W(tn),cn!==0&&W(cn+` J`),ln!==0&&W(ln+` j`),Fe.publish(`addPage`,{pageNumber:Ne})},ft=function(e){e>0&&e<=Ne&&(ie.splice(e,1),Pe.splice(e,1),Ne--,z>Ne&&(z=Ne),this.setPage(z))},pt=function(e){e>0&&e<=Ne&&(z=e)},mt=p.__private__.getNumberOfPages=p.getNumberOfPages=function(){return ie.length-1},ht=function(e,t,n){var r,i=void 0;return n||={},e=e===void 0?Te[be].fontName:e,t=t===void 0?Te[be].fontStyle:t,r=e.toLowerCase(),Ee[r]!==void 0&&Ee[r][t]!==void 0?i=Ee[r][t]:Ee[e]!==void 0&&Ee[e][t]!==void 0?i=Ee[e][t]:!1===n.disableWarning&&iL.warn(`Unable to look up font label for font '`+e+`', '`+t+`'. Refer to getFontList() for available fonts.`),i||n.noFallback||((i=Ee.times[t])??(i=Ee.times.normal)),i},gt=p.__private__.putInfo=function(){var e=We(),t=function(e){return e};for(var n in u!==null&&(t=Dt.encryptor(e,0)),W(`<<`),W(`/Producer (`+lt(t(`jsPDF `+FL.version))+`)`),ye)ye.hasOwnProperty(n)&&ye[n]&&W(`/`+n.substr(0,1).toUpperCase()+n.substr(1)+` (`+lt(t(ye[n]))+`)`);W(`/CreationDate (`+lt(t(j))+`)`),W(`>>`),W(`endobj`)},_t=p.__private__.putCatalog=function(e){var t=(e||={}).rootDictionaryObjId||qe;switch(We(),W(`<<`),W(`/Type /Catalog`),W(`/Pages `+t+` 0 R`),de||=`fullwidth`,de){case`fullwidth`:W(`/OpenAction [3 0 R /FitH null]`);break;case`fullheight`:W(`/OpenAction [3 0 R /FitV null]`);break;case`fullpage`:W(`/OpenAction [3 0 R /Fit]`);break;case`original`:W(`/OpenAction [3 0 R /XYZ null null 1]`);break;default:var n=``+de;n.substr(n.length-1)===`%`&&(de=parseInt(de)/100),typeof de==`number`&&W(`/OpenAction [3 0 R /XYZ null null `+D(de)+`]`)}switch(ge||=`continuous`,ge){case`continuous`:W(`/PageLayout /OneColumn`);break;case`single`:W(`/PageLayout /SinglePage`);break;case`two`:case`twoleft`:W(`/PageLayout /TwoColumnLeft`);break;case`tworight`:W(`/PageLayout /TwoColumnRight`)}me&&W(`/PageMode /`+me),Fe.publish(`putCatalog`),W(`>>`),W(`endobj`)},vt=p.__private__.putTrailer=function(){W(`trailer`),W(`<<`),W(`/Size `+(ee+1)),W(`/Root `+ee+` 0 R`),W(`/Info `+(ee-1)+` 0 R`),u!==null&&W(`/Encrypt `+Dt.oid+` 0 R`),W(`/ID [ <`+M+`> <`+M+`> ]`),W(`>>`)},yt=p.__private__.putHeader=function(){W(`%PDF-`+m),W(`%ºß¬à`)},bt=p.__private__.putXRef=function(){var e=`0000000000`;W(`xref`),W(`0 `+(ee+1)),W(`0000000000 65535 f `);for(var t=1;t<=ee;t++)typeof te[t]==`function`?W((e+te[t]()).slice(-10)+` 00000 n `):te[t]===void 0?W(`0000000000 00000 n `):W((e+te[t]).slice(-10)+` 00000 n `)},xt=p.__private__.buildDocument=function(){var e;ee=0,ne=0,H=[],te=[],re=[],qe=Ge(),Je=Ge(),oe(H),Fe.publish(`buildDocument`),yt(),et(),function(){Fe.publish(`putAdditionalObjects`);for(var e=0;e<re.length;e++){var t=re[e];K(t.objId,!0),W(t.content),W(`endobj`)}Fe.publish(`postPutAdditionalObjects`)}(),e=[],function(){for(var e in Te)Te.hasOwnProperty(e)&&(!1===d||!0===d&&f.hasOwnProperty(e))&&tt(Te[e])}(),function(){for(var e in Ae)Ae.hasOwnProperty(e)&&at(Ae[e])}(),function(){for(var e in Le)Le.hasOwnProperty(e)&&nt(Le[e])}(),function(e){for(var t in Oe)Oe.hasOwnProperty(t)&&(Oe[t]instanceof NL?rt(Oe[t]):Oe[t]instanceof PL&&it(Oe[t],e))}(e),Fe.publish(`putResources`),e.forEach(ot),ot({resourcesOid:Je,objectOid:2**53-1}),Fe.publish(`postPutResources`),u!==null&&(Dt.oid=We(),W(`<<`),W(`/Filter /Standard`),W(`/V `+Dt.v),W(`/R `+Dt.r),W(`/U <`+Dt.toHexString(Dt.U)+`>`),W(`/O <`+Dt.toHexString(Dt.O)+`>`),W(`/P `+Dt.P),W(`>>`),W(`endobj`)),gt(),_t();var t=ne;return bt(),vt(),W(`startxref`),W(``+t),W(`%%EOF`),oe(ie[z]),H.join(`
`)},St=p.__private__.getBlob=function(e){return new Blob([ce(e)],{type:`application/pdf`})},Ct=function(e){for(;e.firstChild;)e.removeChild(e.firstChild)},wt=function(e){var t,n=e.document,r=n.documentElement,i=n.head,a=n.body;return i||(i=n.createElement(`head`),r.appendChild(i)),a||(a=n.createElement(`body`),r.appendChild(a)),Ct(i),Ct(a),(t=n.createElement(`style`)).appendChild(n.createTextNode(`html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;}`)),i.appendChild(t),{document:n,body:a}},Tt=p.output=p.__private__.output=(Ue=function(e,t){switch(typeof(t||={})==`string`?t={filename:t}:t.filename=t.filename||`generated.pdf`,e){case void 0:return xt();case`save`:p.save(t.filename);break;case`arraybuffer`:return ce(xt());case`blob`:return St(xt());case`bloburi`:case`bloburl`:if(nL.URL!==void 0&&typeof nL.URL.createObjectURL==`function`)return nL.URL&&nL.URL.createObjectURL(St(xt()))||void 0;iL.warn(`bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.`);break;case`datauristring`:case`dataurlstring`:var n=``,r=xt();try{n=dL(r)}catch{n=dL(unescape(encodeURIComponent(r)))}return`data:application/pdf;filename=`+encodeURIComponent(t.filename)+`;base64,`+n;case`pdfobjectnewwindow`:if(Object.prototype.toString.call(nL)===`[object Window]`){var i=`https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.1.1/pdfobject.min.js`,a=!t.pdfObjectUrl;a||(i=t.pdfObjectUrl);var o=nL.open();if(o!==null){var s=wt(o),c=s.document.createElement(`script`),l=this;c.src=i,a&&(c.integrity=`sha512-4ze/a9/4jqu+tX9dfOqJYSvyYd5M6qum/3HpCLr+/Jqf0whc37VUbkpNGHR7/8pSnCFw47T1fmIpwBV7UySh3g==`,c.crossOrigin=`anonymous`),c.onload=function(){o.PDFObject.embed(l.output(`dataurlstring`),t)},s.body.appendChild(c)}return o}throw Error(`The option pdfobjectnewwindow just works in a browser-environment.`);case`pdfjsnewwindow`:if(Object.prototype.toString.call(nL)===`[object Window]`){var u=t.pdfJsUrl||`examples/PDF.js/web/viewer.html`,d=nL.open();if(d!==null){var f=wt(d),m=f.document.createElement(`iframe`),h=u.indexOf(`?`)===-1?`?`:`&`;l=this,m.id=`pdfViewer`,m.width=`500px`,m.height=`400px`,m.src=u+h+`file=&downloadName=`+encodeURIComponent(t.filename),m.onload=function(){d.document.title=t.filename,m.contentWindow.PDFViewerApplication.open(l.output(`bloburl`))},f.body.appendChild(m)}return d}throw Error(`The option pdfjsnewwindow just works in a browser-environment.`);case`dataurlnewwindow`:if(Object.prototype.toString.call(nL)!==`[object Window]`)throw Error(`The option dataurlnewwindow just works in a browser-environment.`);var g=nL.open();if(g!==null){var _=wt(g),v=_.document.createElement(`iframe`);v.src=this.output(`datauristring`,t),_.body.appendChild(v),g.document.title=t.filename}if(g||typeof safari>`u`)return g;break;case`datauri`:case`dataurl`:return nL.document.location.href=this.output(`datauristring`,t);default:return null}},Ue.foo=function(){try{return Ue.apply(this,arguments)}catch(n){var e=n.stack||``;~e.indexOf(` at `)&&(e=e.split(` at `)[1]);var t=`Error in function `+e.split(`
`)[0].split(`<`)[0]+`: `+n.message;if(!nL.console)throw Error(t);nL.console.error(t,n),nL.alert&&alert(t)}},Ue.foo.bar=Ue,Ue.foo),Et=function(e){return!0===Array.isArray(Ie)&&Ie.indexOf(e)>-1};switch(r){case`pt`:xe=1;break;case`mm`:xe=72/25.4;break;case`cm`:xe=72/2.54;break;case`in`:xe=72;break;case`px`:xe=Et(`px_scaling`)==1?.75:96/72;break;case`pc`:case`em`:xe=12;break;case`ex`:xe=6;break;default:if(typeof r!=`number`)throw Error(`Invalid unit: `+r);xe=r}var Dt=null;L(),P();var Ot=p.__private__.getPageInfo=p.getPageInfo=function(e){if(isNaN(e)||e%1!=0)throw Error(`Invalid argument passed to jsPDF.getPageInfo`);return{objId:Pe[e].objId,pageNumber:e,pageContext:Pe[e]}},kt=p.__private__.getPageInfoByObjId=function(e){if(isNaN(e)||e%1!=0)throw Error(`Invalid argument passed to jsPDF.getPageInfoByObjId`);for(var t in Pe)if(Pe[t].objId===e)break;return Ot(t)},At=p.__private__.getCurrentPageInfo=p.getCurrentPageInfo=function(){return{objId:Pe[z].objId,pageNumber:z,pageContext:Pe[z]}};p.addPage=function(){return dt.apply(this,arguments),this},p.setPage=function(){return pt.apply(this,arguments),oe.call(this,ie[z]),this},p.insertPage=function(e){return this.addPage(),this.movePage(z,e),this},p.movePage=function(e,t){var n,r;if(e>t){n=ie[e],r=Pe[e];for(var i=e;i>t;i--)ie[i]=ie[i-1],Pe[i]=Pe[i-1];ie[t]=n,Pe[t]=r,this.setPage(t)}else if(e<t){n=ie[e],r=Pe[e];for(var a=e;a<t;a++)ie[a]=ie[a+1],Pe[a]=Pe[a+1];ie[t]=n,Pe[t]=r,this.setPage(t)}return this},p.deletePage=function(){return ft.apply(this,arguments),this},p.__private__.text=p.text=function(e,t,n,r,i){var a,o,s,c,l,u,d,p,m,h=(r||={}).scope||this;if(typeof e==`number`&&typeof t==`number`&&(typeof n==`string`||Array.isArray(n))){var g=n;n=t,t=e,e=g}if(arguments[3]instanceof G==0?(s=arguments[4],c=arguments[5],Oi(d=arguments[3])===`object`&&d!==null||(typeof s==`string`&&(c=s,s=null),typeof d==`string`&&(c=d,d=null),typeof d==`number`&&(s=d,d=null),r={flags:d,angle:s,align:c})):(T(`The transform parameter of text() with a Matrix value`),m=i),isNaN(t)||isNaN(n)||e==null)throw Error(`Invalid arguments passed to jsPDF.text`);if(e.length===0)return h;var _,v=``,x=typeof r.lineHeightFactor==`number`?r.lineHeightFactor:Wt,S=h.internal.scaleFactor;function C(e){return e=e.split(` `).join(Array(r.TabLen||9).join(` `)),lt(e,d)}function E(e){for(var t,n=e.concat(),r=[],i=n.length;i--;)typeof(t=n.shift())==`string`?r.push(t):Array.isArray(e)&&(t.length===1||t[1]===void 0&&t[2]===void 0)?r.push(t[0]):r.push([t[0],t[1],t[2]]);return r}function D(e,t){var n;if(typeof e==`string`)n=t(e)[0];else if(Array.isArray(e)){for(var r,i,a=e.concat(),o=[],s=a.length;s--;)typeof(r=a.shift())==`string`?o.push(t(r)[0]):Array.isArray(r)&&typeof r[0]==`string`&&(i=t(r[0],r[1],r[2]),o.push([i[0],i[1],i[2]]));n=o}return n}var O=!1,A=!0;if(typeof e==`string`)O=!0;else if(Array.isArray(e)){var j=e.concat();o=[];for(var M,N=j.length;N--;)(typeof(M=j.shift())!=`string`||Array.isArray(M)&&typeof M[0]!=`string`)&&(A=!1);O=A}if(!1===O)throw Error(`Type of text must be string or Array. "`+e+`" is not recognized.`);typeof e==`string`&&(e=e.match(/[\r?\n]/)?e.split(/\r\n|\r|\n/g):[e]);var P=ue/h.internal.scaleFactor,F=P*(x-1);switch(r.baseline){case`bottom`:n-=F;break;case`top`:n+=P-F;break;case`hanging`:n+=P-2*F;break;case`middle`:n+=P/2-F}if((u=r.maxWidth||0)>0&&(typeof e==`string`?e=h.splitTextToSize(e,u):Object.prototype.toString.call(e)===`[object Array]`&&(e=e.reduce(function(e,t){return e.concat(h.splitTextToSize(t,u))},[]))),a={text:e,x:t,y:n,options:r,mutex:{pdfEscape:lt,activeFontKey:be,fonts:Te,activeFontSize:ue}},Fe.publish(`preProcessText`,a),e=a.text,s=(r=a.options).angle,m instanceof G==0&&s&&typeof s==`number`){s*=Math.PI/180,r.rotationDirection===0&&(s=-s),b===y&&(s=-s);var I=Math.cos(s),L=Math.sin(s);m=new G(I,L,-L,I,0,0)}else s&&s instanceof G&&(m=s);b!==y||m||(m=Ve),(l=r.charSpace||on)!==void 0&&(v+=w(k(l))+` Tc
`,this.setCharSpace(this.getCharSpace()||0)),(p=r.horizontalScale)!==void 0&&(v+=w(100*p)+` Tz
`),r.lang;var R=-1,z=r.renderingMode===void 0?r.stroke:r.renderingMode,B=h.internal.getCurrentPageInfo().pageContext;switch(z){case 0:case!1:case`fill`:R=0;break;case 1:case!0:case`stroke`:R=1;break;case 2:case`fillThenStroke`:R=2;break;case 3:case`invisible`:R=3;break;case 4:case`fillAndAddForClipping`:R=4;break;case 5:case`strokeAndAddPathForClipping`:R=5;break;case 6:case`fillThenStrokeAndAddToPathForClipping`:R=6;break;case 7:case`addToPathForClipping`:R=7}var V=B.usedRenderingMode===void 0?-1:B.usedRenderingMode;R===-1?V!==-1&&(v+=`0 Tr
`):v+=R+` Tr
`,R!==-1&&(B.usedRenderingMode=R),c=r.align||`left`;var ee,te=ue*x,H=h.internal.pageSize.getWidth(),ne=Te[be];l=r.charSpace||on,u=r.maxWidth||0,d=Object.assign({autoencode:!0,noBOM:!0},r.flags);var re=[],ie=function(e){return h.getStringUnitWidth(e,{font:ne,charSpace:l,fontSize:ue,doKerning:!1})*ue/S};if(Object.prototype.toString.call(e)===`[object Array]`){var U;o=E(e),c!==`left`&&(ee=o.map(ie));var ae,oe=0;if(c===`right`){t-=ee[0],e=[],N=o.length;for(var se=0;se<N;se++)se===0?(ae=Zt(t),U=Qt(n)):(ae=k(oe-ee[se]),U=-te),e.push([o[se],ae,U]),oe=ee[se]}else if(c===`center`){t-=ee[0]/2,e=[],N=o.length;for(var ce=0;ce<N;ce++)ce===0?(ae=Zt(t),U=Qt(n)):(ae=k((oe-ee[ce])/2),U=-te),e.push([o[ce],ae,U]),oe=ee[ce]}else if(c===`left`){e=[],N=o.length;for(var le=0;le<N;le++)e.push(o[le])}else if(c===`justify`&&ne.encoding===`Identity-H`){e=[],N=o.length,u=u===0?H:u;for(var de=0,fe=0;fe<N;fe++)if(U=fe===0?Qt(n):-te,ae=fe===0?Zt(t):de,fe<N-1){var me=k((u-ee[fe])/(o[fe].split(` `).length-1)),he=o[fe].split(` `);e.push([he[0]+` `,ae,U]),de=0;for(var ge=1;ge<he.length;ge++){var _e=(ie(he[ge-1]+` `+he[ge])-ie(he[ge]))*S+me;ge==he.length-1?e.push([he[ge],_e,0]):e.push([he[ge]+` `,_e,0]),de-=_e}}else e.push([o[fe],ae,U]);e.push([``,de,0])}else{if(c!==`justify`)throw Error(`Unrecognized alignment option, use "left", "center", "right" or "justify".`);for(e=[],N=o.length,u=u===0?H:u,fe=0;fe<N;fe++){U=fe===0?Qt(n):-te,ae=fe===0?Zt(t):0;var ve=o[fe].split(` `).length-1,ye=ve>0?(u-ee[fe])/ve:0;fe<N-1?re.push(w(k(ye))):re.push(0),e.push([o[fe],ae,U])}}}!0===(typeof r.R2L==`boolean`?r.R2L:pe)&&(e=D(e,function(e,t,n){return[e.split(``).reverse().join(``),t,n]})),a={text:e,x:t,y:n,options:r,mutex:{pdfEscape:lt,activeFontKey:be,fonts:Te,activeFontSize:ue}},Fe.publish(`postProcessText`,a),e=a.text,_=a.mutex.isHex||!1;var xe=Te[be].encoding;xe!==`WinAnsiEncoding`&&xe!==`StandardEncoding`||(e=D(e,function(e,t,n){return[C(e),t,n]})),o=E(e),e=[];for(var Se,Ce,we,Ee=+!!Array.isArray(o[0]),De=``,Oe=function(e,t,n){var i=``;return n instanceof G?(n=typeof r.angle==`number`?Be(n,new G(1,0,0,1,e,t)):Be(new G(1,0,0,1,e,t),n),b===y&&(n=Be(new G(1,0,0,-1,0,0),n)),i=n.join(` `)+` Tm
`):i=w(e)+` `+w(t)+` Td
`,i},ke=0;ke<o.length;ke++){switch(De=``,Ee){case 1:we=(_?`<`:`(`)+o[ke][0]+(_?`>`:`)`),Se=parseFloat(o[ke][1]),Ce=parseFloat(o[ke][2]);break;case 0:we=(_?`<`:`(`)+o[ke]+(_?`>`:`)`),Se=Zt(t),Ce=Qt(n)}re!==void 0&&re[ke]!==void 0&&(De=re[ke]+` Tw
`),ke===0?e.push(De+Oe(Se,Ce,m)+we):Ee===0?e.push(De+we):Ee===1&&e.push(De+Oe(Se,Ce,m)+we)}e=Ee===0?e.join(` Tj
T* `):e.join(` Tj
`),e+=` Tj
`;var Ae=`BT
/`;return Ae+=be+` `+ue+` Tf
`,Ae+=w(ue*x)+` TL
`,Ae+=rn+`
`,Ae+=v,Ae+=e,W(Ae+=`ET`),f[be]=!0,h};var jt=p.__private__.clip=p.clip=function(e){return W(e===`evenodd`?`W*`:`W`),this};p.clipEvenOdd=function(){return jt(`evenodd`)},p.__private__.discardPath=p.discardPath=function(){return W(`n`),this};var Mt=p.__private__.isValidStyle=function(e){var t=!1;return[void 0,null,`S`,`D`,`F`,`DF`,`FD`,`f`,`f*`,`B`,`B*`,`n`].indexOf(e)!==-1&&(t=!0),t};p.__private__.setDefaultPathOperation=p.setDefaultPathOperation=function(e){return Mt(e)&&(l=e),this};var Nt=p.__private__.getStyle=p.getStyle=function(e){var t=l;switch(e){case`D`:case`S`:t=`S`;break;case`F`:t=`f`;break;case`FD`:case`DF`:t=`B`;break;case`f`:case`f*`:case`B`:case`B*`:t=e}return t},Pt=p.close=function(){return W(`h`),this};p.stroke=function(){return W(`S`),this},p.fill=function(e){return Ft(`f`,e),this},p.fillEvenOdd=function(e){return Ft(`f*`,e),this},p.fillStroke=function(e){return Ft(`B`,e),this},p.fillStrokeEvenOdd=function(e){return Ft(`B*`,e),this};var Ft=function(e,t){Oi(t)===`object`?Rt(t,e):W(e)},It=function(e){e===null||b===y&&e===void 0||(e=Nt(e),W(e))};function Lt(e,t,n,r,i){var a=new PL(t||this.boundingBox,n||this.xStep,r||this.yStep,this.gState,i||this.matrix);return a.stream=this.stream,He(e+`$$`+this.cloneIndex+++`$$`,a),a}var Rt=function(e,t){var n=ke[e.key],r=Oe[n];if(r instanceof NL)W(`q`),W(zt(t)),r.gState&&p.setGState(r.gState),W(e.matrix.toString()+` cm`),W(`/`+n+` sh`),W(`Q`);else if(r instanceof PL){var i=new G(1,0,0,-1,0,Sn());e.matrix&&(i=i.multiply(e.matrix||Ve),n=Lt.call(r,e.key,e.boundingBox,e.xStep,e.yStep,i).id),W(`q`),W(`/Pattern cs`),W(`/`+n+` scn`),r.gState&&p.setGState(r.gState),W(t),W(`Q`)}},zt=function(e){switch(e){case`f`:case`F`:case`n`:return`W n`;case`f*`:return`W* n`;case`B`:case`S`:return`W S`;case`B*`:return`W* S`}},Bt=p.moveTo=function(e,t){return W(w(k(e))+` `+w(A(t))+` m`),this},Vt=p.lineTo=function(e,t){return W(w(k(e))+` `+w(A(t))+` l`),this},Ht=p.curveTo=function(e,t,n,r,i,a){return W([w(k(e)),w(A(t)),w(k(n)),w(A(r)),w(k(i)),w(A(a)),`c`].join(` `)),this};p.__private__.line=p.line=function(e,t,n,r,i){if(isNaN(e)||isNaN(t)||isNaN(n)||isNaN(r)||!Mt(i))throw Error(`Invalid arguments passed to jsPDF.line`);return b===v?this.lines([[n-e,r-t]],e,t,[1,1],i||`S`):this.lines([[n-e,r-t]],e,t,[1,1]).stroke()},p.__private__.lines=p.lines=function(e,t,n,r,i,a){var o,s,c,l,u,d,f,p,m,h,g,_;if(typeof e==`number`&&(_=n,n=t,t=e,e=_),r||=[1,1],a||=!1,isNaN(t)||isNaN(n)||!Array.isArray(e)||!Array.isArray(r)||!Mt(i)||typeof a!=`boolean`)throw Error(`Invalid arguments passed to jsPDF.lines`);for(Bt(t,n),o=r[0],s=r[1],l=e.length,h=t,g=n,c=0;c<l;c++)(u=e[c]).length===2?(h=u[0]*o+h,g=u[1]*s+g,Vt(h,g)):(d=u[0]*o+h,f=u[1]*s+g,p=u[2]*o+h,m=u[3]*s+g,h=u[4]*o+h,g=u[5]*s+g,Ht(d,f,p,m,h,g));return a&&Pt(),It(i),this},p.path=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n.c;switch(n.op){case`m`:Bt(r[0],r[1]);break;case`l`:Vt(r[0],r[1]);break;case`c`:Ht.apply(this,r);break;case`h`:Pt()}}return this},p.__private__.rect=p.rect=function(e,t,n,r,i){if(isNaN(e)||isNaN(t)||isNaN(n)||isNaN(r)||!Mt(i))throw Error(`Invalid arguments passed to jsPDF.rect`);return b===v&&(r=-r),W([w(k(e)),w(A(t)),w(k(n)),w(k(r)),`re`].join(` `)),It(i),this},p.__private__.triangle=p.triangle=function(e,t,n,r,i,a,o){if(isNaN(e)||isNaN(t)||isNaN(n)||isNaN(r)||isNaN(i)||isNaN(a)||!Mt(o))throw Error(`Invalid arguments passed to jsPDF.triangle`);return this.lines([[n-e,r-t],[i-n,a-r],[e-i,t-a]],e,t,[1,1],o,!0),this},p.__private__.roundedRect=p.roundedRect=function(e,t,n,r,i,a,o){if(isNaN(e)||isNaN(t)||isNaN(n)||isNaN(r)||isNaN(i)||isNaN(a)||!Mt(o))throw Error(`Invalid arguments passed to jsPDF.roundedRect`);var s=4/3*(Math.SQRT2-1);return i=Math.min(i,.5*n),a=Math.min(a,.5*r),this.lines([[n-2*i,0],[i*s,0,i,a-a*s,i,a],[0,r-2*a],[0,a*s,-i*s,a,-i,a],[2*i-n,0],[-i*s,0,-i,-a*s,-i,-a],[0,2*a-r],[0,-a*s,i*s,-a,i,-a]],e+i,t,[1,1],o,!0),this},p.__private__.ellipse=p.ellipse=function(e,t,n,r,i){if(isNaN(e)||isNaN(t)||isNaN(n)||isNaN(r)||!Mt(i))throw Error(`Invalid arguments passed to jsPDF.ellipse`);var a=4/3*(Math.SQRT2-1)*n,o=4/3*(Math.SQRT2-1)*r;return Bt(e+n,t),Ht(e+n,t-o,e+a,t-r,e,t-r),Ht(e-a,t-r,e-n,t-o,e-n,t),Ht(e-n,t+o,e-a,t+r,e,t+r),Ht(e+a,t+r,e+n,t+o,e+n,t),It(i),this},p.__private__.circle=p.circle=function(e,t,n,r){if(isNaN(e)||isNaN(t)||isNaN(n)||!Mt(r))throw Error(`Invalid arguments passed to jsPDF.circle`);return this.ellipse(e,t,n,n,r)},p.setFont=function(e,t,n){return n&&(t=C(t,n)),be=ht(e,t,{disableWarning:!1}),this};var Ut=p.__private__.getFont=p.getFont=function(){return Te[ht.apply(p,arguments)]};p.__private__.getFontList=p.getFontList=function(){var e,t,n={};for(e in Ee)if(Ee.hasOwnProperty(e))for(t in n[e]=[],Ee[e])Ee[e].hasOwnProperty(t)&&n[e].push(t);return n},p.addFont=function(e,t,n,r,i){var a=[`StandardEncoding`,`MacRomanEncoding`,`Identity-H`,`WinAnsiEncoding`];return arguments[3]&&a.indexOf(arguments[3])!==-1?i=arguments[3]:arguments[3]&&a.indexOf(arguments[3])==-1&&(n=C(n,r)),ct.call(this,e,t,n,i||=`Identity-H`)};var Wt,Gt=e.lineWidth||.200025,Kt=p.__private__.getLineWidth=p.getLineWidth=function(){return Gt},qt=p.__private__.setLineWidth=p.setLineWidth=function(e){return Gt=e,W(w(k(e))+` w`),this};p.__private__.setLineDash=FL.API.setLineDash=FL.API.setLineDashPattern=function(e,t){if(e||=[],t||=0,isNaN(t)||!Array.isArray(e))throw Error(`Invalid arguments passed to jsPDF.setLineDash`);return e=e.map(function(e){return w(k(e))}).join(` `),t=w(k(t)),W(`[`+e+`] `+t+` d`),this};var Jt=p.__private__.getLineHeight=p.getLineHeight=function(){return ue*Wt};p.__private__.getLineHeight=p.getLineHeight=function(){return ue*Wt};var Yt=p.__private__.setLineHeightFactor=p.setLineHeightFactor=function(e){return typeof(e||=1.15)==`number`&&(Wt=e),this},Xt=p.__private__.getLineHeightFactor=p.getLineHeightFactor=function(){return Wt};Yt(e.lineHeight);var Zt=p.__private__.getHorizontalCoordinate=function(e){return k(e)},Qt=p.__private__.getVerticalCoordinate=function(e){return b===y?e:Pe[z].mediaBox.topRightY-Pe[z].mediaBox.bottomLeftY-k(e)},$t=p.__private__.getHorizontalCoordinateString=p.getHorizontalCoordinateString=function(e){return w(Zt(e))},en=p.__private__.getVerticalCoordinateString=p.getVerticalCoordinateString=function(e){return w(Qt(e))},tn=e.strokeColor||`0 G`;p.__private__.getStrokeColor=p.getDrawColor=function(){return Ye(tn)},p.__private__.setStrokeColor=p.setDrawColor=function(e,t,n,r){return tn=Xe({ch1:e,ch2:t,ch3:n,ch4:r,pdfColorType:`draw`,precision:2}),W(tn),this};var nn=e.fillColor||`0 g`;p.__private__.getFillColor=p.getFillColor=function(){return Ye(nn)},p.__private__.setFillColor=p.setFillColor=function(e,t,n,r){return nn=Xe({ch1:e,ch2:t,ch3:n,ch4:r,pdfColorType:`fill`,precision:2}),W(nn),this};var rn=e.textColor||`0 g`,an=p.__private__.getTextColor=p.getTextColor=function(){return Ye(rn)};p.__private__.setTextColor=p.setTextColor=function(e,t,n,r){return rn=Xe({ch1:e,ch2:t,ch3:n,ch4:r,pdfColorType:`text`,precision:3}),this};var on=e.charSpace,sn=p.__private__.getCharSpace=p.getCharSpace=function(){return parseFloat(on||0)};p.__private__.setCharSpace=p.setCharSpace=function(e){if(isNaN(e))throw Error(`Invalid argument passed to jsPDF.setCharSpace`);return on=e,this};var cn=0;p.CapJoinStyles={0:0,butt:0,but:0,miter:0,1:1,round:1,rounded:1,circle:1,2:2,projecting:2,project:2,square:2,bevel:2},p.__private__.setLineCap=p.setLineCap=function(e){var t=p.CapJoinStyles[e];if(t===void 0)throw Error(`Line cap style of '`+e+`' is not recognized. See or extend .CapJoinStyles property for valid styles`);return cn=t,W(t+` J`),this};var ln=0;p.__private__.setLineJoin=p.setLineJoin=function(e){var t=p.CapJoinStyles[e];if(t===void 0)throw Error(`Line join style of '`+e+`' is not recognized. See or extend .CapJoinStyles property for valid styles`);return ln=t,W(t+` j`),this},p.__private__.setLineMiterLimit=p.__private__.setMiterLimit=p.setLineMiterLimit=p.setMiterLimit=function(e){if(e||=0,isNaN(e))throw Error(`Invalid argument passed to jsPDF.setLineMiterLimit`);return W(w(k(e))+` M`),this},p.GState=jL,p.setGState=function(e){(e=typeof e==`string`?Ae[je[e]]:un(null,e)).equals(Me)||(W(`/`+e.id+` gs`),Me=e)};var un=function(e,t){if(!e||!je[e]){var n=!1;for(var r in Ae)if(Ae.hasOwnProperty(r)&&Ae[r].equals(t)){n=!0;break}if(n)t=Ae[r];else{var i=`GS`+(Object.keys(Ae).length+1).toString(10);Ae[i]=t,t.id=i}return e&&(je[e]=t.id),Fe.publish(`addGState`,t),t}};p.addGState=function(e,t){return un(e,t),this},p.saveGraphicsState=function(){return W(`q`),De.push({key:be,size:ue,color:rn}),this},p.restoreGraphicsState=function(){W(`Q`);var e=De.pop();return be=e.key,ue=e.size,rn=e.color,Me=null,this},p.setCurrentTransformationMatrix=function(e){return W(e.toString()+` cm`),this},p.comment=function(e){return W(`#`+e),this};var dn=function(e,t){var n=e||0;Object.defineProperty(this,"x",{enumerable:!0,get:function(){return n},set:function(e){isNaN(e)||(n=parseFloat(e))}});var r=t||0;Object.defineProperty(this,"y",{enumerable:!0,get:function(){return r},set:function(e){isNaN(e)||(r=parseFloat(e))}});var i=`pt`;return Object.defineProperty(this,"type",{enumerable:!0,get:function(){return i},set:function(e){i=e.toString()}}),this},fn=function(e,t,n,r){dn.call(this,e,t),this.type=`rect`;var i=n||0;Object.defineProperty(this,"w",{enumerable:!0,get:function(){return i},set:function(e){isNaN(e)||(i=parseFloat(e))}});var a=r||0;return Object.defineProperty(this,"h",{enumerable:!0,get:function(){return a},set:function(e){isNaN(e)||(a=parseFloat(e))}}),this},pn=function(){this.page=Ne,this.currentPage=z,this.pages=ie.slice(0),this.pagesContext=Pe.slice(0),this.x=Se,this.y=Ce,this.matrix=we,this.width=gn(z),this.height=vn(z),this.outputDestination=ae,this.id=``,this.objectNumber=-1};pn.prototype.restore=function(){Ne=this.page,z=this.currentPage,Pe=this.pagesContext,ie=this.pages,Se=this.x,Ce=this.y,we=this.matrix,_n(z,this.width),yn(z,this.height),ae=this.outputDestination};var mn=function(e,t,n,r,i){ze.push(new pn),Ne=z=0,ie=[],Se=e,Ce=t,we=i,ut([n,r])};for(var hn in p.beginFormObject=function(e,t,n,r,i){return mn(e,t,n,r,i),this},p.endFormObject=function(e){return function(e){if(Re[e])ze.pop().restore();else{var t=new pn,n=`Xo`+(Object.keys(Le).length+1).toString(10);t.id=n,Re[e]=n,Le[n]=t,Fe.publish(`addFormObject`,t),ze.pop().restore()}}(e),this},p.doFormObject=function(e,t){var n=Le[Re[e]];return W(`q`),W(t.toString()+` cm`),W(`/`+n.id+` Do`),W(`Q`),this},p.getFormObject=function(e){var t=Le[Re[e]];return{x:t.x,y:t.y,width:t.width,height:t.height,matrix:t.matrix}},p.save=function(e,t){return e||=`generated.pdf`,(t||={}).returnPromise=t.returnPromise||!1,!1===t.returnPromise?(cL(St(xt()),e),typeof cL.unload==`function`&&nL.setTimeout&&setTimeout(cL.unload,911),this):new Promise(function(t,n){try{var r=cL(St(xt()),e);typeof cL.unload==`function`&&nL.setTimeout&&setTimeout(cL.unload,911),t(r)}catch(e){n(e.message)}})},FL.API)FL.API.hasOwnProperty(hn)&&(hn===`events`&&FL.API.events.length?function(e,t){var n,r,i;for(i=t.length-1;i!==-1;i--)n=t[i][0],r=t[i][1],e.subscribe.apply(e,[n].concat(typeof r==`function`?[r]:r))}(Fe,FL.API.events):p[hn]=FL.API[hn]);function gn(e){return Pe[e].mediaBox.topRightX-Pe[e].mediaBox.bottomLeftX}function _n(e,t){Pe[e].mediaBox.topRightX=t+Pe[e].mediaBox.bottomLeftX}function vn(e){return Pe[e].mediaBox.topRightY-Pe[e].mediaBox.bottomLeftY}function yn(e,t){Pe[e].mediaBox.topRightY=t+Pe[e].mediaBox.bottomLeftY}var bn=p.getPageWidth=function(e){return gn(e||=z)/xe},xn=p.setPageWidth=function(e,t){_n(e,t*xe)},Sn=p.getPageHeight=function(e){return vn(e||=z)/xe},Cn=p.setPageHeight=function(e,t){yn(e,t*xe)};return p.internal={pdfEscape:lt,getStyle:Nt,getFont:Ut,getFontSize:fe,getCharSpace:sn,getTextColor:an,getLineHeight:Jt,getLineHeightFactor:Xt,getLineWidth:Kt,write:se,getHorizontalCoordinate:Zt,getVerticalCoordinate:Qt,getCoordinateString:$t,getVerticalCoordinateString:en,collections:{},newObject:We,newAdditionalObject:Ke,newObjectDeferred:Ge,newObjectDeferredBegin:K,getFilters:Ze,putStream:Qe,events:Fe,scaleFactor:xe,pageSize:{getWidth:function(){return bn(z)},setWidth:function(e){xn(z,e)},getHeight:function(){return Sn(z)},setHeight:function(e){Cn(z,e)}},encryptionOptions:u,encryption:Dt,getEncryptor:function(e){return u===null?function(e){return e}:Dt.encryptor(e,0)},output:Tt,getNumberOfPages:mt,get pages(){return ie},out:W,f2:D,f3:O,getPageInfo:Ot,getPageInfoByObjId:kt,getCurrentPageInfo:At,getPDFVersion:h,Point:dn,Rectangle:fn,Matrix:G,hasHotfix:Et},Object.defineProperty(p.internal.pageSize,"width",{get:function(){return bn(z)},set:function(e){xn(z,e)},enumerable:!0,configurable:!0}),Object.defineProperty(p.internal.pageSize,"height",{get:function(){return Sn(z)},set:function(e){Cn(z,e)},enumerable:!0,configurable:!0}),function(e){for(var t=0,n=le.length;t<n;t++){var r=ct.call(this,e[t][0],e[t][1],e[t][2],le[t][3],!0);!1===d&&(f[r]=!0);var i=e[t][0].split(`-`);st({id:r,fontName:i[0],fontStyle:i[1]||``})}Fe.publish(`addFonts`,{fonts:Te,dictionary:Ee})}.call(p,le),be=`F1`,dt(i,n),Fe.publish(`initialized`),p}OL.prototype.lsbFirstWord=function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)},OL.prototype.toHexString=function(e){return e.split(``).map(function(e){return(`0`+(255&e.charCodeAt(0)).toString(16)).slice(-2)}).join(``)},OL.prototype.hexToBytes=function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(String.fromCharCode(parseInt(e.substr(n,2),16)));return t.join(``)},OL.prototype.processOwnerPassword=function(e,t){return EL(CL(t).substr(0,5),e)},OL.prototype.encryptor=function(e,t){var n=CL(this.encryptionKey+String.fromCharCode(255&e,e>>8&255,e>>16&255,255&t,t>>8&255)).substr(0,10);return function(e){return EL(n,e)}},jL.prototype.equals=function(e){var t,n=`id,objectNumber,equals`;if(!e||Oi(e)!==Oi(this))return!1;var r=0;for(t in this)if(!(n.indexOf(t)>=0)){if(this.hasOwnProperty(t)&&!e.hasOwnProperty(t)||this[t]!==e[t])return!1;r++}for(t in e)e.hasOwnProperty(t)&&n.indexOf(t)<0&&r--;return r===0},FL.API={events:[]},FL.version=`4.2.1`;var IL=FL.API,LL=1,RL=function(e){return e.replace(/\\/g,`\\\\`).replace(/\(/g,`\\(`).replace(/\)/g,`\\)`)},zL=function(e){return e.replace(/\\\\/g,`\\`).replace(/\\\(/g,`(`).replace(/\\\)/g,`)`)},BL=function(e){return e.toString().replace(/#/g,`#23`).replace(/[\s\n\r()<>[\]{}\/%]/g,function(e){var t=e.charCodeAt(0).toString(16).toUpperCase();return`#`+(t.length===1?`0`+t:t)})},VL=function(e){return e.toFixed(2)},HL=function(e){return e.toFixed(5)};IL.__acroform__={};var UL=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e},WL=function(e){return e*LL},GL=function(e){var t=new cR,n=SR.internal.getHeight(e)||0,r=SR.internal.getWidth(e)||0;return t.BBox=[0,0,Number(VL(r)),Number(VL(n))],t},KL=IL.__acroform__.setBit=function(e,t){if(e||=0,t||=0,isNaN(e)||isNaN(t))throw Error(`Invalid arguments passed to jsPDF.API.__acroform__.setBit`);return e|1<<t},qL=IL.__acroform__.clearBit=function(e,t){if(e||=0,t||=0,isNaN(e)||isNaN(t))throw Error(`Invalid arguments passed to jsPDF.API.__acroform__.clearBit`);return e&~(1<<t)},JL=IL.__acroform__.getBit=function(e,t){if(isNaN(e)||isNaN(t))throw Error(`Invalid arguments passed to jsPDF.API.__acroform__.getBit`);return e&1<<t?1:0},YL=IL.__acroform__.getBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw Error(`Invalid arguments passed to jsPDF.API.__acroform__.getBitForPdf`);return JL(e,t-1)},XL=IL.__acroform__.setBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw Error(`Invalid arguments passed to jsPDF.API.__acroform__.setBitForPdf`);return KL(e,t-1)},ZL=IL.__acroform__.clearBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw Error(`Invalid arguments passed to jsPDF.API.__acroform__.clearBitForPdf`);return qL(e,t-1)},QL=IL.__acroform__.calculateCoordinates=function(e,t){var n=t.internal.getHorizontalCoordinate,r=t.internal.getVerticalCoordinate,i=e[0],a=e[1],o=e[2],s=e[3],c={};return c.lowerLeft_X=n(i)||0,c.lowerLeft_Y=r(a+s)||0,c.upperRight_X=n(i+o)||0,c.upperRight_Y=r(a)||0,[Number(VL(c.lowerLeft_X)),Number(VL(c.lowerLeft_Y)),Number(VL(c.upperRight_X)),Number(VL(c.upperRight_Y))]},$L=function(e){if(e.appearanceStreamContent)return e.appearanceStreamContent;if(e.V||e.DV){var t=[],n=eR(e,e._V||e.DV),r=e.scope.internal.getFont(e.fontName,e.fontStyle).id;t.push(`/Tx BMC`),t.push(`q`),t.push(`BT`),t.push(e.scope.__private__.encodeColorString(e.color)),t.push(`/`+r+` `+VL(n.fontSize)+` Tf`),t.push(`1 0 0 1 0 0 Tm`),t.push(n.text),t.push(`ET`),t.push(`Q`),t.push(`EMC`);var i=GL(e);return i.scope=e.scope,i.stream=t.join(`
`),i}},eR=function(e,t){var n=e.fontSize===0?e.maxFontSize:e.fontSize,r={text:``,fontSize:``},i=(t=(t=t.substr(0,1)==`(`?t.substr(1):t).substr(t.length-1)==`)`?t.substr(0,t.length-1):t).split(` `);i=e.multiline?i.map(function(e){return e.split(`
`)}):i.map(function(e){return[e]});var a=n,o=SR.internal.getHeight(e)||0;o=o<0?-o:o;var s=SR.internal.getWidth(e)||0;s=s<0?-s:s;var c=function(t,n,r){return t+1<i.length&&tR(n+` `+i[t+1][0],e,r).width<=s-4};a++;t:for(;a>0;){t=``,a--;var l,u,d=tR(`3`,e,a).height,f=e.multiline?o-a:(o-d)/2,p=f+=2,m=0,h=0,g=0;if(a<=0){t=`(...) Tj
`,t+=`% Width of Text: `+tR(t,e,a=12).width+`, FieldWidth:`+s+`
`;break}for(var _=``,v=0,y=0;y<i.length;y++)if(i.hasOwnProperty(y)){var b=!1;if(i[y].length!==1&&g!==i[y].length-1){if((d+2)*(v+2)+2>o)continue t;_+=i[y][g],b=!0,h=y,y--}else{_=(_+=i[y][g]+` `).substr(_.length-1)==` `?_.substr(0,_.length-1):_;var x=parseInt(y),S=c(x,_,a),C=y>=i.length-1;if(S&&!C){_+=` `,g=0;continue}if(S||C){if(C)h=x;else if(e.multiline&&(d+2)*(v+2)+2>o)continue t}else{if(!e.multiline||(d+2)*(v+2)+2>o)continue t;h=x}}for(var w=``,T=m;T<=h;T++){var E=i[T];if(e.multiline){if(T===h){w+=E[g]+` `,g=(g+1)%E.length;continue}if(T===m){w+=E[E.length-1]+` `;continue}}w+=E[0]+` `}switch(w=w.substr(w.length-1)==` `?w.substr(0,w.length-1):w,u=tR(w,e,a).width,e.textAlign){case`right`:l=s-u-2;break;case`center`:l=(s-u)/2;break;default:l=2}t+=VL(l)+` `+VL(p)+` Td
`,t+=`(`+RL(w)+`) Tj
`,t+=-VL(l)+` 0 Td
`,p=-(a+2),u=0,m=b?h:h+1,v++,_=``}break}return r.text=t,r.fontSize=a,r},tR=function(e,t,n){var r=t.scope.internal.getFont(t.fontName,t.fontStyle),i=t.scope.getStringUnitWidth(e,{font:r,fontSize:parseFloat(n),charSpace:0})*parseFloat(n);return{height:t.scope.getStringUnitWidth(`3`,{font:r,fontSize:parseFloat(n),charSpace:0})*parseFloat(n)*1.5,width:i}},nR={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null,isInitialized:!1},rR=function(e,t){var n={type:`reference`,object:e};t.internal.getPageInfo(e.page).pageContext.annotations.find(function(e){return e.type===n.type&&e.object===n.object})===void 0&&t.internal.getPageInfo(e.page).pageContext.annotations.push(n)},iR=function(e,t){if(t.scope=e,e.internal!==void 0&&(e.internal.acroformPlugin===void 0||!1===e.internal.acroformPlugin.isInitialized)){if(uR.FieldNum=0,e.internal.acroformPlugin=JSON.parse(JSON.stringify(nR)),e.internal.acroformPlugin.acroFormDictionaryRoot)throw Error(`Exception while creating AcroformDictionary`);LL=e.internal.scaleFactor,e.internal.acroformPlugin.acroFormDictionaryRoot=new lR,e.internal.acroformPlugin.acroFormDictionaryRoot.scope=e,e.internal.acroformPlugin.acroFormDictionaryRoot._eventID=e.internal.events.subscribe(`postPutResources`,function(){(function(e){e.internal.events.unsubscribe(e.internal.acroformPlugin.acroFormDictionaryRoot._eventID),delete e.internal.acroformPlugin.acroFormDictionaryRoot._eventID,e.internal.acroformPlugin.printedOut=!0})(e)}),e.internal.events.subscribe(`buildDocument`,function(){(function(e){e.internal.acroformPlugin.acroFormDictionaryRoot.objId=void 0;var t=e.internal.acroformPlugin.acroFormDictionaryRoot.Fields;for(var n in t)if(t.hasOwnProperty(n)){var r=t[n];r.objId=void 0,r.hasAnnotation&&rR(r,e)}})(e)}),e.internal.events.subscribe(`putCatalog`,function(){(function(e){if(e.internal.acroformPlugin.acroFormDictionaryRoot===void 0)throw Error(`putCatalogCallback: Root missing.`);e.internal.write(`/AcroForm `+e.internal.acroformPlugin.acroFormDictionaryRoot.objId+` 0 R`)})(e)}),e.internal.events.subscribe(`postPutPages`,function(t){(function(e,t){var n=!e;for(var r in e||(t.internal.newObjectDeferredBegin(t.internal.acroformPlugin.acroFormDictionaryRoot.objId,!0),t.internal.acroformPlugin.acroFormDictionaryRoot.putStream()),e||=t.internal.acroformPlugin.acroFormDictionaryRoot.Kids)if(e.hasOwnProperty(r)){var i=e[r],a=[],o=i.Rect;if(i.Rect&&=QL(i.Rect,t),t.internal.newObjectDeferredBegin(i.objId,!0),i.DA=SR.createDefaultAppearanceStream(i),Oi(i)===`object`&&typeof i.getKeyValueListForStream==`function`&&(a=i.getKeyValueListForStream()),i.Rect=o,i.hasAppearanceStream&&!i.appearanceStreamContent){var s=$L(i);a.push({key:`AP`,value:`<</N `+s+`>>`}),t.internal.acroformPlugin.xForms.push(s)}if(i.appearanceStreamContent){var c=``;for(var l in i.appearanceStreamContent)if(i.appearanceStreamContent.hasOwnProperty(l)){var u=i.appearanceStreamContent[l];if(c+=`/`+l+` `,c+=`<<`,Object.keys(u).length>=1||Array.isArray(u)){for(var r in u)if(u.hasOwnProperty(r)){var d=u[r];typeof d==`function`&&(d=d.call(t,i)),c+=`/`+r+` `+d+` `,t.internal.acroformPlugin.xForms.indexOf(d)>=0||t.internal.acroformPlugin.xForms.push(d)}}else typeof(d=u)==`function`&&(d=d.call(t,i)),c+=`/`+r+` `+d,t.internal.acroformPlugin.xForms.indexOf(d)>=0||t.internal.acroformPlugin.xForms.push(d);c+=`>>`}a.push({key:`AP`,value:`<<
`+c+`>>`})}t.internal.putStream({additionalKeyValues:a,objectId:i.objId}),t.internal.out(`endobj`)}n&&function(e,t){for(var n in e)if(e.hasOwnProperty(n)){var r=n,i=e[n];t.internal.newObjectDeferredBegin(i.objId,!0),Oi(i)===`object`&&typeof i.putStream==`function`&&i.putStream(),delete e[r]}}(t.internal.acroformPlugin.xForms,t)})(t,e)}),e.internal.acroformPlugin.isInitialized=!0}},aR=IL.__acroform__.arrayToPdfArray=function(e,t,n){var r=function(e){return e};if(Array.isArray(e)){for(var i=`[`,a=0;a<e.length;a++)switch(a!==0&&(i+=` `),Oi(e[a])){case`boolean`:case`number`:case`object`:i+=e[a].toString();break;case`string`:e[a].substr(0,1)===`/`?i+=`/`+BL(e[a].substr(1)):(t!==void 0&&n&&(r=n.internal.getEncryptor(t)),i+=`(`+RL(r(e[a].toString()))+`)`)}return i+`]`}throw Error(`Invalid argument passed to jsPDF.__acroform__.arrayToPdfArray`)},oR=function(e,t,n){var r=function(e){return e};return t!==void 0&&n&&(r=n.internal.getEncryptor(t)),(e||=``).toString(),`(`+RL(r(e))+`)`},sR=function(){this._objId=void 0,this._scope=void 0,Object.defineProperty(this,"objId",{get:function(){if(this._objId===void 0){if(this.scope===void 0)return;this._objId=this.scope.internal.newObjectDeferred()}return this._objId},set:function(e){this._objId=e}}),Object.defineProperty(this,"scope",{value:this._scope,writable:!0})};sR.prototype.toString=function(){return this.objId+` 0 R`},sR.prototype.putStream=function(){var e=this.getKeyValueListForStream();this.scope.internal.putStream({data:this.stream,additionalKeyValues:e,objectId:this.objId}),this.scope.internal.out(`endobj`)},sR.prototype.getKeyValueListForStream=function(){var e=[],t=Object.getOwnPropertyNames(this).filter(function(e){return e!=`content`&&e!=`appearanceStreamContent`&&e!=`scope`&&e!=`objId`&&e.substring(0,1)!=`_`});for(var n in t)if(!1===Object.getOwnPropertyDescriptor(this,t[n]).configurable){var r=t[n],i=this[r];i&&(Array.isArray(i)?e.push({key:r,value:aR(i,this.objId,this.scope)}):i instanceof sR?(i.scope=this.scope,e.push({key:r,value:i.objId+` 0 R`})):typeof i!=`function`&&e.push({key:r,value:i}))}return e};var cR=function(){sR.call(this),Object.defineProperty(this,"Type",{value:`/XObject`,configurable:!1,writable:!0}),Object.defineProperty(this,"Subtype",{value:`/Form`,configurable:!1,writable:!0}),Object.defineProperty(this,"FormType",{value:1,configurable:!1,writable:!0});var e,t=[];Object.defineProperty(this,"BBox",{configurable:!1,get:function(){return t},set:function(e){t=e}}),Object.defineProperty(this,"Resources",{value:`2 0 R`,configurable:!1,writable:!0}),Object.defineProperty(this,"stream",{enumerable:!1,configurable:!0,set:function(t){e=t.trim()},get:function(){return e||null}})};UL(cR,sR);var lR=function(){sR.call(this);var e,t=[];Object.defineProperty(this,"Kids",{enumerable:!1,configurable:!0,get:function(){return t.length>0?t:void 0}}),Object.defineProperty(this,"Fields",{enumerable:!1,configurable:!1,get:function(){return t}}),Object.defineProperty(this,"DA",{enumerable:!1,configurable:!1,get:function(){if(e){var t=function(e){return e};return this.scope&&(t=this.scope.internal.getEncryptor(this.objId)),`(`+RL(t(e))+`)`}},set:function(t){e=t}})};UL(lR,sR);var uR=function e(){sR.call(this);var t=4;Object.defineProperty(this,"F",{enumerable:!1,configurable:!1,get:function(){return t},set:function(e){if(isNaN(e))throw Error(`Invalid value "`+e+`" for attribute F supplied.`);t=e}}),Object.defineProperty(this,"showWhenPrinted",{enumerable:!0,configurable:!0,get:function(){return!!YL(t,3)},set:function(e){!!e==1?this.F=XL(t,3):this.F=ZL(t,3)}});var n=0;Object.defineProperty(this,"Ff",{enumerable:!1,configurable:!1,get:function(){return n},set:function(e){if(isNaN(e))throw Error(`Invalid value "`+e+`" for attribute Ff supplied.`);n=e}});var r=[];Object.defineProperty(this,"Rect",{enumerable:!1,configurable:!1,get:function(){if(r.length!==0)return r},set:function(e){r=e===void 0?[]:e}}),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[0])?0:r[0]},set:function(e){r[0]=e}}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[1])?0:r[1]},set:function(e){r[1]=e}}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[2])?0:r[2]},set:function(e){r[2]=e}}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[3])?0:r[3]},set:function(e){r[3]=e}});var i=``;Object.defineProperty(this,"FT",{enumerable:!0,configurable:!1,get:function(){return i},set:function(e){switch(e){case`/Btn`:case`/Tx`:case`/Ch`:case`/Sig`:i=e;break;default:throw Error(`Invalid value "`+e+`" for attribute FT supplied.`)}}});var a=null;Object.defineProperty(this,"T",{enumerable:!0,configurable:!1,get:function(){if(!a||a.length<1){if(this instanceof vR)return;a=`FieldObject`+e.FieldNum++}var t=function(e){return e};return this.scope&&(t=this.scope.internal.getEncryptor(this.objId)),`(`+RL(t(a))+`)`},set:function(e){a=e.toString()}}),Object.defineProperty(this,"fieldName",{configurable:!0,enumerable:!0,get:function(){return a},set:function(e){a=e}});var o=`helvetica`;Object.defineProperty(this,"fontName",{enumerable:!0,configurable:!0,get:function(){return o},set:function(e){o=e}});var s=`normal`;Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,get:function(){return s},set:function(e){s=e}});var c=0;Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,get:function(){return c},set:function(e){c=e}});var l=void 0;Object.defineProperty(this,"maxFontSize",{enumerable:!0,configurable:!0,get:function(){return l===void 0?50/LL:l},set:function(e){l=e}});var u=`black`;Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,get:function(){return u},set:function(e){u=e}});var d=`/F1 0 Tf 0 g`;Object.defineProperty(this,"DA",{enumerable:!0,configurable:!1,get:function(){if(!(!d||this instanceof vR||this instanceof bR))return oR(d,this.objId,this.scope)},set:function(e){e=e.toString(),d=e}});var f=null;Object.defineProperty(this,"DV",{enumerable:!1,configurable:!1,get:function(){if(f)return this instanceof hR==0?oR(f,this.objId,this.scope):f},set:function(e){e=e.toString(),f=this instanceof hR==0?e.substr(0,1)===`(`?zL(e.substr(1,e.length-2)):zL(e):e}}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,get:function(){return this instanceof hR==1?zL(f.substr(1,f.length-1)):f},set:function(e){e=e.toString(),f=this instanceof hR==1?`/`+BL(e):e}});var p=null;Object.defineProperty(this,"_V",{enumerable:!1,configurable:!1,get:function(){if(p)return p},set:function(e){this.V=e}}),Object.defineProperty(this,"V",{enumerable:!1,configurable:!1,get:function(){if(p)return this instanceof hR==0?oR(p,this.objId,this.scope):p},set:function(e){e=e.toString(),p=this instanceof hR==0?e.substr(0,1)===`(`?zL(e.substr(1,e.length-2)):zL(e):e}}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,get:function(){return this instanceof hR==1?zL(p.substr(1,p.length-1)):p},set:function(e){e=e.toString(),p=this instanceof hR==1?`/`+BL(e):e}}),Object.defineProperty(this,"hasAnnotation",{enumerable:!0,configurable:!0,get:function(){return this.Rect}}),Object.defineProperty(this,"Type",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?`/Annot`:null}}),Object.defineProperty(this,"Subtype",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?`/Widget`:null}});var m,h=!1;Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return h},set:function(e){e=!!e,h=e}}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,get:function(){if(m)return m},set:function(e){m=e}}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,get:function(){return!!YL(this.Ff,1)},set:function(e){!!e==1?this.Ff=XL(this.Ff,1):this.Ff=ZL(this.Ff,1)}}),Object.defineProperty(this,"required",{enumerable:!0,configurable:!0,get:function(){return!!YL(this.Ff,2)},set:function(e){!!e==1?this.Ff=XL(this.Ff,2):this.Ff=ZL(this.Ff,2)}}),Object.defineProperty(this,"noExport",{enumerable:!0,configurable:!0,get:function(){return!!YL(this.Ff,3)},set:function(e){!!e==1?this.Ff=XL(this.Ff,3):this.Ff=ZL(this.Ff,3)}});var g=null;Object.defineProperty(this,"Q",{enumerable:!0,configurable:!1,get:function(){if(g!==null)return g},set:function(e){if([0,1,2].indexOf(e)===-1)throw Error(`Invalid value "`+e+`" for attribute Q supplied.`);g=e}}),Object.defineProperty(this,"textAlign",{get:function(){var e;switch(g){case 0:default:e=`left`;break;case 1:e=`center`;break;case 2:e=`right`}return e},configurable:!0,enumerable:!0,set:function(e){switch(e){case`right`:case 2:g=2;break;case`center`:case 1:g=1;break;default:g=0}}})};UL(uR,sR);var dR=function(){uR.call(this),this.FT=`/Ch`,this.V=`()`,this.fontName=`zapfdingbats`;var e=0;Object.defineProperty(this,"TI",{enumerable:!0,configurable:!1,get:function(){return e},set:function(t){e=t}}),Object.defineProperty(this,"topIndex",{enumerable:!0,configurable:!0,get:function(){return e},set:function(t){e=t}});var t=[];Object.defineProperty(this,"Opt",{enumerable:!0,configurable:!1,get:function(){return aR(t,this.objId,this.scope)},set:function(e){var n,r=[];typeof(n=e)==`string`&&(r=function(e,t,n){n||=1;for(var r,i=[];r=t.exec(e);)i.push(r[n]);return i}(n,/\((.*?)\)/g)),t=r}}),this.getOptions=function(){return t},this.setOptions=function(e){t=e,this.sort&&t.sort()},this.addOption=function(e){e=(e||=``).toString(),t.push(e),this.sort&&t.sort()},this.removeOption=function(e,n){for(n||=!1,e=(e||=``).toString();t.indexOf(e)!==-1&&(t.splice(t.indexOf(e),1),!1!==n););},Object.defineProperty(this,"combo",{enumerable:!0,configurable:!0,get:function(){return!!YL(this.Ff,18)},set:function(e){!!e==1?this.Ff=XL(this.Ff,18):this.Ff=ZL(this.Ff,18)}}),Object.defineProperty(this,"edit",{enumerable:!0,configurable:!0,get:function(){return!!YL(this.Ff,19)},set:function(e){!0===this.combo&&(!!e==1?this.Ff=XL(this.Ff,19):this.Ff=ZL(this.Ff,19))}}),Object.defineProperty(this,"sort",{enumerable:!0,configurable:!0,get:function(){return!!YL(this.Ff,20)},set:function(e){!!e==1?(this.Ff=XL(this.Ff,20),t.sort()):this.Ff=ZL(this.Ff,20)}}),Object.defineProperty(this,"multiSelect",{enumerable:!0,configurable:!0,get:function(){return!!YL(this.Ff,22)},set:function(e){!!e==1?this.Ff=XL(this.Ff,22):this.Ff=ZL(this.Ff,22)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!YL(this.Ff,23)},set:function(e){!!e==1?this.Ff=XL(this.Ff,23):this.Ff=ZL(this.Ff,23)}}),Object.defineProperty(this,"commitOnSelChange",{enumerable:!0,configurable:!0,get:function(){return!!YL(this.Ff,27)},set:function(e){!!e==1?this.Ff=XL(this.Ff,27):this.Ff=ZL(this.Ff,27)}}),this.hasAppearanceStream=!1};UL(dR,uR);var fR=function(){dR.call(this),this.fontName=`helvetica`,this.combo=!1};UL(fR,dR);var pR=function(){fR.call(this),this.combo=!0};UL(pR,fR);var mR=function(){pR.call(this),this.edit=!0};UL(mR,pR);var hR=function(){uR.call(this),this.FT=`/Btn`,Object.defineProperty(this,"noToggleToOff",{enumerable:!0,configurable:!0,get:function(){return!!YL(this.Ff,15)},set:function(e){!!e==1?this.Ff=XL(this.Ff,15):this.Ff=ZL(this.Ff,15)}}),Object.defineProperty(this,"radio",{enumerable:!0,configurable:!0,get:function(){return!!YL(this.Ff,16)},set:function(e){!!e==1?this.Ff=XL(this.Ff,16):this.Ff=ZL(this.Ff,16)}}),Object.defineProperty(this,"pushButton",{enumerable:!0,configurable:!0,get:function(){return!!YL(this.Ff,17)},set:function(e){!!e==1?this.Ff=XL(this.Ff,17):this.Ff=ZL(this.Ff,17)}}),Object.defineProperty(this,"radioIsUnison",{enumerable:!0,configurable:!0,get:function(){return!!YL(this.Ff,26)},set:function(e){!!e==1?this.Ff=XL(this.Ff,26):this.Ff=ZL(this.Ff,26)}});var e,t={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var e=function(e){return e};if(this.scope&&(e=this.scope.internal.getEncryptor(this.objId)),Object.keys(t).length!==0){var n,r=[];for(n in r.push(`<<`),t)r.push(`/`+n+` (`+RL(e(t[n]))+`)`);return r.push(`>>`),r.join(`
`)}},set:function(e){Oi(e)===`object`&&(t=e)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return t.CA||``},set:function(e){typeof e==`string`&&(t.CA=e)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return e},set:function(t){var n=t==null?``:t.toString();n.substr(0,1)===`/`&&(n=n.substr(1)),e=`/`+BL(n)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return e.substr(1,e.length-1)},set:function(t){e=`/`+BL(t)}})};UL(hR,uR);var gR=function(){hR.call(this),this.pushButton=!0};UL(gR,hR);var _R=function(){hR.call(this),this.radio=!0,this.pushButton=!1;var e=[];Object.defineProperty(this,"Kids",{enumerable:!0,configurable:!1,get:function(){return e},set:function(t){e=t===void 0?[]:t}})};UL(_R,hR);var vR=function(){var e,t;uR.call(this),Object.defineProperty(this,"Parent",{enumerable:!1,configurable:!1,get:function(){return e},set:function(t){e=t}}),Object.defineProperty(this,"optionName",{enumerable:!1,configurable:!0,get:function(){return t},set:function(e){t=e}});var n,r={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var e=function(e){return e};this.scope&&(e=this.scope.internal.getEncryptor(this.objId));var t,n=[];for(t in n.push(`<<`),r)n.push(`/`+t+` (`+RL(e(r[t]))+`)`);return n.push(`>>`),n.join(`
`)},set:function(e){Oi(e)===`object`&&(r=e)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return r.CA||``},set:function(e){typeof e==`string`&&(r.CA=e)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return n},set:function(e){var t=e==null?``:e.toString();t.substr(0,1)===`/`&&(t=t.substr(1)),n=`/`+BL(t)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return n.substr(1,n.length-1)},set:function(e){var t=e==null?``:e.toString();t.substr(0,1)===`/`&&(t=t.substr(1)),n=`/`+BL(t)}}),this.caption=`l`,this.appearanceState=`Off`,this._AppearanceType=SR.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(this.optionName)};UL(vR,uR),_R.prototype.setAppearance=function(e){if(!(`createAppearanceStream`in e)||!(`getCA`in e))throw Error(`Couldn't assign Appearance to RadioButton. Appearance was Invalid!`);for(var t in this.Kids)if(this.Kids.hasOwnProperty(t)){var n=this.Kids[t];n.appearanceStreamContent=e.createAppearanceStream(n.optionName),n.caption=e.getCA()}},_R.prototype.createOption=function(e){var t=new vR;return t.Parent=this,t.optionName=e,this.Kids.push(t),CR.call(this.scope,t),t};var yR=function(){hR.call(this),this.fontName=`zapfdingbats`,this.caption=`3`,this.appearanceState=`On`,this.value=`On`,this.textAlign=`center`,this.appearanceStreamContent=SR.CheckBox.createAppearanceStream()};UL(yR,hR);var bR=function(){uR.call(this),this.FT=`/Tx`,Object.defineProperty(this,"multiline",{enumerable:!0,configurable:!0,get:function(){return!!YL(this.Ff,13)},set:function(e){!!e==1?this.Ff=XL(this.Ff,13):this.Ff=ZL(this.Ff,13)}}),Object.defineProperty(this,"fileSelect",{enumerable:!0,configurable:!0,get:function(){return!!YL(this.Ff,21)},set:function(e){!!e==1?this.Ff=XL(this.Ff,21):this.Ff=ZL(this.Ff,21)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!YL(this.Ff,23)},set:function(e){!!e==1?this.Ff=XL(this.Ff,23):this.Ff=ZL(this.Ff,23)}}),Object.defineProperty(this,"doNotScroll",{enumerable:!0,configurable:!0,get:function(){return!!YL(this.Ff,24)},set:function(e){!!e==1?this.Ff=XL(this.Ff,24):this.Ff=ZL(this.Ff,24)}}),Object.defineProperty(this,"comb",{enumerable:!0,configurable:!0,get:function(){return!!YL(this.Ff,25)},set:function(e){!!e==1?this.Ff=XL(this.Ff,25):this.Ff=ZL(this.Ff,25)}}),Object.defineProperty(this,"richText",{enumerable:!0,configurable:!0,get:function(){return!!YL(this.Ff,26)},set:function(e){!!e==1?this.Ff=XL(this.Ff,26):this.Ff=ZL(this.Ff,26)}});var e=null;Object.defineProperty(this,"MaxLen",{enumerable:!0,configurable:!1,get:function(){return e},set:function(t){e=t}}),Object.defineProperty(this,"maxLength",{enumerable:!0,configurable:!0,get:function(){return e},set:function(t){Number.isInteger(t)&&(e=t)}}),Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return this.V||this.DV}})};UL(bR,uR);var xR=function(){bR.call(this),Object.defineProperty(this,"password",{enumerable:!0,configurable:!0,get:function(){return!!YL(this.Ff,14)},set:function(e){!!e==1?this.Ff=XL(this.Ff,14):this.Ff=ZL(this.Ff,14)}}),this.password=!0};UL(xR,bR);var SR={CheckBox:{createAppearanceStream:function(){return{N:{On:SR.CheckBox.YesNormal},D:{On:SR.CheckBox.YesPushDown,Off:SR.CheckBox.OffPushDown}}},YesPushDown:function(e){var t=GL(e);t.scope=e.scope;var n=[],r=e.scope.internal.getFont(e.fontName,e.fontStyle).id,i=e.scope.__private__.encodeColorString(e.color),a=eR(e,e.caption);return n.push(`0.749023 g`),n.push(`0 0 `+VL(SR.internal.getWidth(e))+` `+VL(SR.internal.getHeight(e))+` re`),n.push(`f`),n.push(`BMC`),n.push(`q`),n.push(`0 0 1 rg`),n.push(`/`+r+` `+VL(a.fontSize)+` Tf `+i),n.push(`BT`),n.push(a.text),n.push(`ET`),n.push(`Q`),n.push(`EMC`),t.stream=n.join(`
`),t},YesNormal:function(e){var t=GL(e);t.scope=e.scope;var n=e.scope.internal.getFont(e.fontName,e.fontStyle).id,r=e.scope.__private__.encodeColorString(e.color),i=[],a=SR.internal.getHeight(e),o=SR.internal.getWidth(e),s=eR(e,e.caption);return i.push(`1 g`),i.push(`0 0 `+VL(o)+` `+VL(a)+` re`),i.push(`f`),i.push(`q`),i.push(`0 0 1 rg`),i.push(`0 0 `+VL(o-1)+` `+VL(a-1)+` re`),i.push(`W`),i.push(`n`),i.push(`0 g`),i.push(`BT`),i.push(`/`+n+` `+VL(s.fontSize)+` Tf `+r),i.push(s.text),i.push(`ET`),i.push(`Q`),t.stream=i.join(`
`),t},OffPushDown:function(e){var t=GL(e);t.scope=e.scope;var n=[];return n.push(`0.749023 g`),n.push(`0 0 `+VL(SR.internal.getWidth(e))+` `+VL(SR.internal.getHeight(e))+` re`),n.push(`f`),t.stream=n.join(`
`),t}},RadioButton:{Circle:{createAppearanceStream:function(e){var t={D:{Off:SR.RadioButton.Circle.OffPushDown},N:{}};return t.N[e]=SR.RadioButton.Circle.YesNormal,t.D[e]=SR.RadioButton.Circle.YesPushDown,t},getCA:function(){return`l`},YesNormal:function(e){var t=GL(e);t.scope=e.scope;var n=[],r=SR.internal.getWidth(e)<=SR.internal.getHeight(e)?SR.internal.getWidth(e)/4:SR.internal.getHeight(e)/4;r=Number((.9*r).toFixed(5));var i=SR.internal.Bezier_C,a=Number((r*i).toFixed(5));return n.push(`q`),n.push(`1 0 0 1 `+HL(SR.internal.getWidth(e)/2)+` `+HL(SR.internal.getHeight(e)/2)+` cm`),n.push(r+` 0 m`),n.push(r+` `+a+` `+a+` `+r+` 0 `+r+` c`),n.push(`-`+a+` `+r+` -`+r+` `+a+` -`+r+` 0 c`),n.push(`-`+r+` -`+a+` -`+a+` -`+r+` 0 -`+r+` c`),n.push(a+` -`+r+` `+r+` -`+a+` `+r+` 0 c`),n.push(`f`),n.push(`Q`),t.stream=n.join(`
`),t},YesPushDown:function(e){var t=GL(e);t.scope=e.scope;var n=[],r=SR.internal.getWidth(e)<=SR.internal.getHeight(e)?SR.internal.getWidth(e)/4:SR.internal.getHeight(e)/4;r=Number((.9*r).toFixed(5));var i=Number((2*r).toFixed(5)),a=Number((i*SR.internal.Bezier_C).toFixed(5)),o=Number((r*SR.internal.Bezier_C).toFixed(5));return n.push(`0.749023 g`),n.push(`q`),n.push(`1 0 0 1 `+HL(SR.internal.getWidth(e)/2)+` `+HL(SR.internal.getHeight(e)/2)+` cm`),n.push(i+` 0 m`),n.push(i+` `+a+` `+a+` `+i+` 0 `+i+` c`),n.push(`-`+a+` `+i+` -`+i+` `+a+` -`+i+` 0 c`),n.push(`-`+i+` -`+a+` -`+a+` -`+i+` 0 -`+i+` c`),n.push(a+` -`+i+` `+i+` -`+a+` `+i+` 0 c`),n.push(`f`),n.push(`Q`),n.push(`0 g`),n.push(`q`),n.push(`1 0 0 1 `+HL(SR.internal.getWidth(e)/2)+` `+HL(SR.internal.getHeight(e)/2)+` cm`),n.push(r+` 0 m`),n.push(r+` `+o+` `+o+` `+r+` 0 `+r+` c`),n.push(`-`+o+` `+r+` -`+r+` `+o+` -`+r+` 0 c`),n.push(`-`+r+` -`+o+` -`+o+` -`+r+` 0 -`+r+` c`),n.push(o+` -`+r+` `+r+` -`+o+` `+r+` 0 c`),n.push(`f`),n.push(`Q`),t.stream=n.join(`
`),t},OffPushDown:function(e){var t=GL(e);t.scope=e.scope;var n=[],r=SR.internal.getWidth(e)<=SR.internal.getHeight(e)?SR.internal.getWidth(e)/4:SR.internal.getHeight(e)/4;r=Number((.9*r).toFixed(5));var i=Number((2*r).toFixed(5)),a=Number((i*SR.internal.Bezier_C).toFixed(5));return n.push(`0.749023 g`),n.push(`q`),n.push(`1 0 0 1 `+HL(SR.internal.getWidth(e)/2)+` `+HL(SR.internal.getHeight(e)/2)+` cm`),n.push(i+` 0 m`),n.push(i+` `+a+` `+a+` `+i+` 0 `+i+` c`),n.push(`-`+a+` `+i+` -`+i+` `+a+` -`+i+` 0 c`),n.push(`-`+i+` -`+a+` -`+a+` -`+i+` 0 -`+i+` c`),n.push(a+` -`+i+` `+i+` -`+a+` `+i+` 0 c`),n.push(`f`),n.push(`Q`),t.stream=n.join(`
`),t}},Cross:{createAppearanceStream:function(e){var t={D:{Off:SR.RadioButton.Cross.OffPushDown},N:{}};return t.N[e]=SR.RadioButton.Cross.YesNormal,t.D[e]=SR.RadioButton.Cross.YesPushDown,t},getCA:function(){return`8`},YesNormal:function(e){var t=GL(e);t.scope=e.scope;var n=[],r=SR.internal.calculateCross(e);return n.push(`q`),n.push(`1 1 `+VL(SR.internal.getWidth(e)-2)+` `+VL(SR.internal.getHeight(e)-2)+` re`),n.push(`W`),n.push(`n`),n.push(VL(r.x1.x)+` `+VL(r.x1.y)+` m`),n.push(VL(r.x2.x)+` `+VL(r.x2.y)+` l`),n.push(VL(r.x4.x)+` `+VL(r.x4.y)+` m`),n.push(VL(r.x3.x)+` `+VL(r.x3.y)+` l`),n.push(`s`),n.push(`Q`),t.stream=n.join(`
`),t},YesPushDown:function(e){var t=GL(e);t.scope=e.scope;var n=SR.internal.calculateCross(e),r=[];return r.push(`0.749023 g`),r.push(`0 0 `+VL(SR.internal.getWidth(e))+` `+VL(SR.internal.getHeight(e))+` re`),r.push(`f`),r.push(`q`),r.push(`1 1 `+VL(SR.internal.getWidth(e)-2)+` `+VL(SR.internal.getHeight(e)-2)+` re`),r.push(`W`),r.push(`n`),r.push(VL(n.x1.x)+` `+VL(n.x1.y)+` m`),r.push(VL(n.x2.x)+` `+VL(n.x2.y)+` l`),r.push(VL(n.x4.x)+` `+VL(n.x4.y)+` m`),r.push(VL(n.x3.x)+` `+VL(n.x3.y)+` l`),r.push(`s`),r.push(`Q`),t.stream=r.join(`
`),t},OffPushDown:function(e){var t=GL(e);t.scope=e.scope;var n=[];return n.push(`0.749023 g`),n.push(`0 0 `+VL(SR.internal.getWidth(e))+` `+VL(SR.internal.getHeight(e))+` re`),n.push(`f`),t.stream=n.join(`
`),t}}},createDefaultAppearanceStream:function(e){var t=e.scope.internal.getFont(e.fontName,e.fontStyle).id,n=e.scope.__private__.encodeColorString(e.color);return`/`+t+` `+e.fontSize+` Tf `+n}};SR.internal={Bezier_C:.551915024494,calculateCross:function(e){var t=SR.internal.getWidth(e),n=SR.internal.getHeight(e),r=Math.min(t,n);return{x1:{x:(t-r)/2,y:(n-r)/2+r},x2:{x:(t-r)/2+r,y:(n-r)/2},x3:{x:(t-r)/2,y:(n-r)/2},x4:{x:(t-r)/2+r,y:(n-r)/2+r}}}},SR.internal.getWidth=function(e){var t=0;return Oi(e)===`object`&&(t=WL(e.Rect[2])),t},SR.internal.getHeight=function(e){var t=0;return Oi(e)===`object`&&(t=WL(e.Rect[3])),t};var CR=IL.addField=function(e){if(iR(this,e),!(e instanceof uR))throw Error(`Invalid argument passed to jsPDF.addField.`);var t;return(t=e).scope.internal.acroformPlugin.printedOut&&(t.scope.internal.acroformPlugin.printedOut=!1,t.scope.internal.acroformPlugin.acroFormDictionaryRoot=null),t.scope.internal.acroformPlugin.acroFormDictionaryRoot.Fields.push(t),e.page=e.scope.internal.getCurrentPageInfo().pageNumber,this};IL.AcroFormChoiceField=dR,IL.AcroFormListBox=fR,IL.AcroFormComboBox=pR,IL.AcroFormEditBox=mR,IL.AcroFormButton=hR,IL.AcroFormPushButton=gR,IL.AcroFormRadioButton=_R,IL.AcroFormCheckBox=yR,IL.AcroFormTextField=bR,IL.AcroFormPasswordField=xR,IL.AcroFormAppearance=SR,IL.AcroForm={ChoiceField:dR,ListBox:fR,ComboBox:pR,EditBox:mR,Button:hR,PushButton:gR,RadioButton:_R,CheckBox:yR,TextField:bR,PasswordField:xR,Appearance:SR},FL.AcroForm={ChoiceField:dR,ListBox:fR,ComboBox:pR,EditBox:mR,Button:hR,PushButton:gR,RadioButton:_R,CheckBox:yR,TextField:bR,PasswordField:xR,Appearance:SR},FL.AcroForm;function wR(e){return e.reduce(function(e,t,n){return e[t]=n,e},{})}(function(e){e.__addimage__={};var t=`UNKNOWN`,n={PNG:[[137,80,78,71]],TIFF:[[77,77,0,42],[73,73,42,0]],JPEG:[[255,216,255,224,void 0,void 0,74,70,73,70,0],[255,216,255,225,void 0,void 0,69,120,105,102,0,0],[255,216,255,219],[255,216,255,238]],JPEG2000:[[0,0,0,12,106,80,32,32]],GIF87a:[[71,73,70,56,55,97]],GIF89a:[[71,73,70,56,57,97]],WEBP:[[82,73,70,70,void 0,void 0,void 0,void 0,87,69,66,80]],BMP:[[66,77],[66,65],[67,73],[67,80],[73,67],[80,84]]},r=e.__addimage__.getImageFileTypeByImageData=function(e,r){var i,a,o,s,c,l=t;if((r||=t)===`RGBA`||e.data!==void 0&&e.data instanceof Uint8ClampedArray&&`height`in e&&`width`in e)return`RGBA`;if(x(e))for(c in n)for(o=n[c],i=0;i<o.length;i+=1){for(s=!0,a=0;a<o[i].length;a+=1)if(o[i][a]!==void 0&&o[i][a]!==e[a]){s=!1;break}if(!0===s){l=c;break}}else for(c in n)for(o=n[c],i=0;i<o.length;i+=1){for(s=!0,a=0;a<o[i].length;a+=1)if(o[i][a]!==void 0&&o[i][a]!==e.charCodeAt(a)){s=!1;break}if(!0===s){l=c;break}}return l===t&&r!==t&&(l=r),l},i=function e(t){for(var n=this.internal.write,r=this.internal.putStream,i=(0,this.internal.getFilters)();i.indexOf(`FlateEncode`)!==-1;)i.splice(i.indexOf(`FlateEncode`),1);t.objectId=this.internal.newObject();var a=[];if(a.push({key:`Type`,value:`/XObject`}),a.push({key:`Subtype`,value:`/Image`}),a.push({key:`Width`,value:t.width}),a.push({key:`Height`,value:t.height}),t.colorSpace===g.INDEXED?a.push({key:`ColorSpace`,value:`[/Indexed /DeviceRGB `+(t.palette.length/3-1)+` `+(`sMask`in t&&t.sMask!==void 0?t.objectId+2:t.objectId+1)+` 0 R]`}):(a.push({key:`ColorSpace`,value:`/`+t.colorSpace}),t.colorSpace===g.DEVICE_CMYK&&a.push({key:`Decode`,value:`[1 0 1 0 1 0 1 0]`})),a.push({key:`BitsPerComponent`,value:t.bitsPerComponent}),`decodeParameters`in t&&t.decodeParameters!==void 0&&a.push({key:`DecodeParms`,value:`<<`+t.decodeParameters+`>>`}),`transparency`in t&&Array.isArray(t.transparency)&&t.transparency.length>0){for(var o=``,s=0,c=t.transparency.length;s<c;s++)o+=t.transparency[s]+` `+t.transparency[s]+` `;a.push({key:`Mask`,value:`[`+o+`]`})}t.sMask!==void 0&&a.push({key:`SMask`,value:t.objectId+1+` 0 R`});var l=t.filter===void 0?void 0:[`/`+t.filter];if(r({data:t.data,additionalKeyValues:a,alreadyAppliedFilters:l,objectId:t.objectId}),n(`endobj`),`sMask`in t&&t.sMask!==void 0){var u=t.sMaskBitsPerComponent??t.bitsPerComponent,d={width:t.width,height:t.height,colorSpace:`DeviceGray`,bitsPerComponent:u,data:t.sMask};`filter`in t&&(d.decodeParameters=`/Predictor ${t.predictor} /Colors 1 /BitsPerComponent ${u} /Columns ${t.width}`,d.filter=t.filter),e.call(this,d)}if(t.colorSpace===g.INDEXED){var f=this.internal.newObject();r({data:C(new Uint8Array(t.palette)),objectId:f}),n(`endobj`)}},a=function(){var e=this.internal.collections.addImage_images;for(var t in e)i.call(this,e[t])},o=function(){var e,t=this.internal.collections.addImage_images,n=this.internal.write;for(var r in t)n(`/I`+(e=t[r]).index,e.objectId,`0`,`R`)},s=function(){this.internal.collections.addImage_images||(this.internal.collections.addImage_images={},this.internal.events.subscribe(`putResources`,a),this.internal.events.subscribe(`putXobjectDict`,o))},c=function(){var e=this.internal.collections.addImage_images;return s.call(this),e},l=function(){return Object.keys(this.internal.collections.addImage_images).length},u=function(t){return typeof e[`process`+t.toUpperCase()]==`function`},d=function(e){return Oi(e)===`object`&&e.nodeType===1},f=function(t,n){if(t.nodeName===`IMG`&&t.hasAttribute(`src`)){var r=``+t.getAttribute(`src`);if(r.indexOf(`data:image/`)===0)return uL(unescape(r).split(`base64,`).pop());var i=e.loadFile(r,!0);if(i!==void 0)return i}if(t.nodeName===`CANVAS`){if(t.width===0||t.height===0)throw Error(`Given canvas must have data. Canvas width: `+t.width+`, height: `+t.height);var a;switch(n){case`PNG`:a=`image/png`;break;case`WEBP`:a=`image/webp`;break;default:a=`image/jpeg`}return uL(t.toDataURL(a,1).split(`base64,`).pop())}},p=function(e){var t=this.internal.collections.addImage_images;if(t){for(var n in t)if(e===t[n].alias)return t[n]}},m=function(e,t,n){return e||t||(e=-96,t=-96),e<0&&(e=-1*n.width*72/e/this.internal.scaleFactor),t<0&&(t=-1*n.height*72/t/this.internal.scaleFactor),e===0&&(e=t*n.width/n.height),t===0&&(t=e*n.height/n.width),[e,t]},h=function(e,t,n,r,i,a){var o=m.call(this,n,r,i),s=this.internal.getCoordinateString,l=this.internal.getVerticalCoordinateString,u=c.call(this);if(n=o[0],r=o[1],u[i.index]=i,a){a*=Math.PI/180;var d=Math.cos(a),f=Math.sin(a),p=function(e){return e.toFixed(4)},h=[p(d),p(f),p(-1*f),p(d),0,0,`cm`]}this.internal.write(`q`),a?(this.internal.write([1,`0`,`0`,1,s(e),l(t+r),`cm`].join(` `)),this.internal.write(h.join(` `)),this.internal.write([s(n),`0`,`0`,s(r),`0`,`0`,`cm`].join(` `))):this.internal.write([s(n),`0`,`0`,s(r),s(e),l(t+r),`cm`].join(` `)),this.isAdvancedAPI()&&this.internal.write([1,0,0,-1,0,0,`cm`].join(` `)),this.internal.write(`/I`+i.index+` Do`),this.internal.write(`Q`)},g=e.color_spaces={DEVICE_RGB:`DeviceRGB`,DEVICE_GRAY:`DeviceGray`,DEVICE_CMYK:`DeviceCMYK`,CAL_GREY:`CalGray`,CAL_RGB:`CalRGB`,LAB:`Lab`,ICC_BASED:`ICCBased`,INDEXED:`Indexed`,PATTERN:`Pattern`,SEPARATION:`Separation`,DEVICE_N:`DeviceN`};e.decode={DCT_DECODE:`DCTDecode`,FLATE_DECODE:`FlateDecode`,LZW_DECODE:`LZWDecode`,JPX_DECODE:`JPXDecode`,JBIG2_DECODE:`JBIG2Decode`,ASCII85_DECODE:`ASCII85Decode`,ASCII_HEX_DECODE:`ASCIIHexDecode`,RUN_LENGTH_DECODE:`RunLengthDecode`,CCITT_FAX_DECODE:`CCITTFaxDecode`};var _=e.image_compression={NONE:`NONE`,FAST:`FAST`,MEDIUM:`MEDIUM`,SLOW:`SLOW`},v=e.__addimage__.sHashCode=function(e){var t,n,r=0;if(typeof e==`string`)for(n=e.length,t=0;t<n;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;else if(x(e))for(n=e.byteLength/2,t=0;t<n;t++)r=(r<<5)-r+e[t],r|=0;return r},y=e.__addimage__.validateStringAsBase64=function(e){(e||=``).toString().trim();var t=!0;return e.length===0&&(t=!1),e.length%4!=0&&(t=!1),!1===/^[A-Za-z0-9+/]+$/.test(e.substr(0,e.length-2))&&(t=!1),!1===/^[A-Za-z0-9/][A-Za-z0-9+/]|[A-Za-z0-9+/]=|==$/.test(e.substr(-2))&&(t=!1),t},b=e.__addimage__.extractImageFromDataUrl=function(e){if(e==null||!(e=e.trim()).startsWith(`data:`))return null;var t=e.indexOf(`,`);return t<0?null:e.substring(0,t).trim().endsWith(`base64`)?e.substring(t+1):null};e.__addimage__.isArrayBuffer=function(e){return e instanceof ArrayBuffer};var x=e.__addimage__.isArrayBufferView=function(e){return e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array},S=e.__addimage__.binaryStringToUint8Array=function(e){for(var t=e.length,n=new Uint8Array(t),r=0;r<t;r++)n[r]=e.charCodeAt(r);return n},C=e.__addimage__.arrayBufferToBinaryString=function(e){for(var t=``,n=x(e)?e:new Uint8Array(e),r=0;r<n.length;r+=8192)t+=String.fromCharCode.apply(null,n.subarray(r,r+8192));return t};e.addImage=function(){var e,n,r,i,a,o,c,l,u;if(typeof arguments[1]==`number`?(n=t,r=arguments[1],i=arguments[2],a=arguments[3],o=arguments[4],c=arguments[5],l=arguments[6],u=arguments[7]):(n=arguments[1],r=arguments[2],i=arguments[3],a=arguments[4],o=arguments[5],c=arguments[6],l=arguments[7],u=arguments[8]),Oi(e=arguments[0])===`object`&&!d(e)&&`imageData`in e){var f=e;e=f.imageData,n=f.format||n||t,r=f.x||r||0,i=f.y||i||0,a=f.w||f.width||a,o=f.h||f.height||o,c=f.alias||c,l=f.compression||l,u=f.rotation||f.angle||u}var p=this.internal.getFilters();if(l===void 0&&p.indexOf(`FlateEncode`)!==-1&&(l=`SLOW`),isNaN(r)||isNaN(i))throw Error(`Invalid coordinates passed to jsPDF.addImage`);s.call(this);var m=w.call(this,e,n,c,l);return h.call(this,r,i,a,o,m,u),this};var w=function(n,i,a,o){var s,c,m;if(typeof n==`string`&&r(n)===t){n=unescape(n);var h=T(n,!1);(h!==``||(h=e.loadFile(n,!0))!==void 0)&&(n=h)}if(d(n)&&(n=f(n,i)),i=r(n,i),!u(i))throw Error(`addImage does not support files of type '`+i+`', please ensure that a plugin for '`+i+`' support is added.`);if(((m=a)==null||m.length===0)&&(a=function(e){return typeof e==`string`||x(e)?v(e):x(e.data)?v(e.data):null}(n)),(s=p.call(this,a))||(n instanceof Uint8Array||i===`RGBA`||(c=n,n=S(n)),s=this[`process`+i.toUpperCase()](n,l.call(this),a,function(t){return t&&typeof t==`string`&&(t=t.toUpperCase()),t in e.image_compression?t:_.NONE}(o),c)),!s)throw Error(`An unknown error occurred whilst processing the image.`);return s},T=e.__addimage__.convertBase64ToBinaryString=function(e,t){t=typeof t!=`boolean`||t;var n,r=``;if(typeof e==`string`){n=b(e)??e;try{r=uL(n)}catch(e){if(t)throw y(n)?Error(`atob-Error in jsPDF.convertBase64ToBinaryString `+e.message):Error(`Supplied Data is not a valid base64-String jsPDF.convertBase64ToBinaryString `)}}return r};e.getImageProperties=function(n){var i,a,o=``;if(d(n)&&(n=f(n)),typeof n==`string`&&r(n)===t&&((o=T(n,!1))===``&&(o=e.loadFile(n)||``),n=o),a=r(n),!u(a))throw Error(`addImage does not support files of type '`+a+`', please ensure that a plugin for '`+a+`' support is added.`);if(n instanceof Uint8Array||(n=S(n)),!(i=this[`process`+a.toUpperCase()](n)))throw Error(`An unknown error occurred whilst processing the image`);return i.fileType=a,i}})(FL.API),function(e){var t=function(e){if(e!==void 0&&e!=``)return!0};FL.API.events.push([`addPage`,function(e){this.internal.getPageInfo(e.pageNumber).pageContext.annotations=[]}]),e.events.push([`putPage`,function(e){for(var n,r,i,a=this.internal.getCoordinateString,o=this.internal.getVerticalCoordinateString,s=this.internal.getPageInfoByObjId(e.objId),c=e.pageContext.annotations,l=!1,u=0;u<c.length&&!l;u++)switch((n=c[u]).type){case`link`:(t(n.options.url)||t(n.options.pageNumber))&&(l=!0);break;case`reference`:case`text`:case`freetext`:l=!0}if(l!=0){this.internal.write(`/Annots [`);for(var d=0;d<c.length;d++){n=c[d];var f=this.internal.pdfEscape,p=this.internal.getEncryptor(e.objId);switch(n.type){case`reference`:this.internal.write(` `+n.object.objId+` 0 R `);break;case`text`:var m=this.internal.newAdditionalObject(),h=this.internal.newAdditionalObject(),g=this.internal.getEncryptor(m.objId),_=n.title||`Note`;i=`<</Type /Annot /Subtype /Text `+(r=`/Rect [`+a(n.bounds.x)+` `+o(n.bounds.y+n.bounds.h)+` `+a(n.bounds.x+n.bounds.w)+` `+o(n.bounds.y)+`] `)+`/Contents (`+f(g(n.contents))+`)`,i+=` /Popup `+h.objId+` 0 R`,i+=` /P `+s.objId+` 0 R`,i+=` /T (`+f(g(_))+`) >>`,m.content=i;var v=m.objId+` 0 R`;i=`<</Type /Annot /Subtype /Popup `+(r=`/Rect [`+a(n.bounds.x+30)+` `+o(n.bounds.y+n.bounds.h)+` `+a(n.bounds.x+n.bounds.w+30)+` `+o(n.bounds.y)+`] `)+` /Parent `+v,n.open&&(i+=` /Open true`),i+=` >>`,h.content=i,this.internal.write(m.objId,`0 R`,h.objId,`0 R`);break;case`freetext`:r=`/Rect [`+a(n.bounds.x)+` `+o(n.bounds.y)+` `+a(n.bounds.x+n.bounds.w)+` `+o(n.bounds.y+n.bounds.h)+`] `;var y=`font: Helvetica,sans-serif 12.0pt; text-align:left; color:#`+(n.color||`#000000`);i=`<</Type /Annot /Subtype /FreeText `+r+`/Contents (`+f(p(n.contents))+`)`,i+=` /DS(`+f(p(y))+`)`,i+=` /Border [0 0 0]`,i+=` >>`,this.internal.write(i);break;case`link`:if(n.options.name){var b=this.annotations._nameMap[n.options.name];n.options.pageNumber=b.page,n.options.top=b.y}else n.options.top||(n.options.top=0);if(r=`/Rect [`+n.finalBounds.x+` `+n.finalBounds.y+` `+n.finalBounds.w+` `+n.finalBounds.h+`] `,i=``,n.options.url)i=`<</Type /Annot /Subtype /Link `+r+`/Border [0 0 0] /A <</S /URI /URI (`+f(p(n.options.url))+`) >>`;else if(n.options.pageNumber)switch(i=`<</Type /Annot /Subtype /Link `+r+`/Border [0 0 0] /Dest [`+this.internal.getPageInfo(n.options.pageNumber).objId+` 0 R`,n.options.magFactor=n.options.magFactor||`XYZ`,n.options.magFactor){case`Fit`:i+=` /Fit]`;break;case`FitH`:i+=` /FitH `+n.options.top+`]`;break;case`FitV`:n.options.left=n.options.left||0,i+=` /FitV `+n.options.left+`]`;break;default:var x=o(n.options.top);n.options.left=n.options.left||0,n.options.zoom===void 0&&(n.options.zoom=0),i+=` /XYZ `+n.options.left+` `+x+` `+n.options.zoom+`]`}i!=``&&(i+=` >>`,this.internal.write(i))}}this.internal.write(`]`)}}]),e.createAnnotation=function(e){var t=this.internal.getCurrentPageInfo();switch(e.type){case`link`:this.link(e.bounds.x,e.bounds.y,e.bounds.w,e.bounds.h,e);break;case`text`:case`freetext`:t.pageContext.annotations.push(e)}},e.link=function(e,t,n,r,i){var a=this.internal.getCurrentPageInfo(),o=this.internal.getCoordinateString,s=this.internal.getVerticalCoordinateString;a.pageContext.annotations.push({finalBounds:{x:o(e),y:s(t),w:o(e+n),h:s(t+r)},options:i,type:`link`})},e.textWithLink=function(e,t,n,r){var i,a,o=this.getTextWidth(e),s=this.internal.getLineHeight()/this.internal.scaleFactor;if(r.maxWidth!==void 0){a=r.maxWidth;var c=this.splitTextToSize(e,a).length;i=Math.ceil(s*c)}else a=o,i=s;return this.text(e,t,n,r),n+=.2*s,r.align===`center`&&(t-=o/2),r.align===`right`&&(t-=o),this.link(t,n-s,a,i,r),o},e.getTextWidth=function(e){var t=this.internal.getFontSize();return this.getStringUnitWidth(e)*t/this.internal.scaleFactor}}(FL.API),function(e){var t={1569:[65152],1570:[65153,65154],1571:[65155,65156],1572:[65157,65158],1573:[65159,65160],1574:[65161,65162,65163,65164],1575:[65165,65166],1576:[65167,65168,65169,65170],1577:[65171,65172],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194],1584:[65195,65196],1585:[65197,65198],1586:[65199,65200],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1649:[64336,64337],1655:[64477],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393],1676:[64388,64389],1677:[64386,64387],1678:[64390,64391],1681:[64396,64397],1688:[64394,64395],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421],1729:[64422,64423,64424,64425],1733:[64480,64481],1734:[64473,64474],1735:[64471,64472],1736:[64475,64476],1737:[64482,64483],1739:[64478,64479],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431],1747:[64432,64433]},n={65247:{65154:65269,65156:65271,65160:65273,65166:65275},65248:{65154:65270,65156:65272,65160:65274,65166:65276},65165:{65247:{65248:{65258:65010}}},1617:{1612:64606,1613:64607,1614:64608,1615:64609,1616:64610}},r={1612:64606,1613:64607,1614:64608,1615:64609,1616:64610},i=[1570,1571,1573,1575];e.__arabicParser__={};var a=e.__arabicParser__.isInArabicSubstitutionA=function(e){return t[e.charCodeAt(0)]!==void 0},o=e.__arabicParser__.isArabicLetter=function(e){return typeof e==`string`&&/^[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]+$/.test(e)},s=e.__arabicParser__.isArabicEndLetter=function(e){return o(e)&&a(e)&&t[e.charCodeAt(0)].length<=2},c=e.__arabicParser__.isArabicAlfLetter=function(e){return o(e)&&i.indexOf(e.charCodeAt(0))>=0};e.__arabicParser__.arabicLetterHasIsolatedForm=function(e){return o(e)&&a(e)&&t[e.charCodeAt(0)].length>=1};var l=e.__arabicParser__.arabicLetterHasFinalForm=function(e){return o(e)&&a(e)&&t[e.charCodeAt(0)].length>=2};e.__arabicParser__.arabicLetterHasInitialForm=function(e){return o(e)&&a(e)&&t[e.charCodeAt(0)].length>=3};var u=e.__arabicParser__.arabicLetterHasMedialForm=function(e){return o(e)&&a(e)&&t[e.charCodeAt(0)].length==4},d=e.__arabicParser__.resolveLigatures=function(e){var t=0,r=n,i=``,a=0;for(t=0;t<e.length;t+=1)r[e.charCodeAt(t)]===void 0?(r=n,i+=e.charAt(t-a),t-=a,a=0):(a++,typeof(r=r[e.charCodeAt(t)])==`number`&&(i+=String.fromCharCode(r),r=n,a=0),t===e.length-1&&(r=n,i+=e.charAt(t-(a-1)),t-=a-1,a=0));return i};e.__arabicParser__.isArabicDiacritic=function(e){return e!==void 0&&r[e.charCodeAt(0)]!==void 0};var f=e.__arabicParser__.getCorrectForm=function(e,t,n){return o(e)?!1===a(e)?-1:!l(e)||!o(t)&&!o(n)||!o(n)&&s(t)||s(e)&&!o(t)||s(e)&&c(t)||s(e)&&s(t)?0:u(e)&&o(t)&&!s(t)&&o(n)&&l(n)?3:s(e)||!o(n)?1:2:-1},p=function(e){var n=0,r=0,i=0,a=``,s=``,c=``,l=(e||=``).split(`\\s+`),u=[];for(n=0;n<l.length;n+=1){for(u.push(``),r=0;r<l[n].length;r+=1)a=l[n][r],s=l[n][r-1],c=l[n][r+1],o(a)?(i=f(a,s,c),u[n]+=i===-1?a:String.fromCharCode(t[a.charCodeAt(0)][i])):u[n]+=a;u[n]=d(u[n])}return u.join(` `)},m=e.__arabicParser__.processArabic=e.processArabic=function(){var e,t=typeof arguments[0]==`string`?arguments[0]:arguments[0].text,n=[];if(Array.isArray(t)){var r=0;for(n=[],r=0;r<t.length;r+=1)Array.isArray(t[r])?n.push([p(t[r][0]),t[r][1],t[r][2]]):n.push([p(t[r])]);e=n}else e=p(t);return typeof arguments[0]==`string`?e:(arguments[0].text=e,arguments[0])};e.events.push([`preProcessText`,m])}(FL.API),FL.API.autoPrint=function(e){var t;return(e||={}).variant=e.variant||`non-conform`,e.variant===`javascript`?this.addJS(`print({});`):(this.internal.events.subscribe(`postPutResources`,function(){t=this.internal.newObject(),this.internal.out(`<<`),this.internal.out(`/S /Named`),this.internal.out(`/Type /Action`),this.internal.out(`/N /Print`),this.internal.out(`>>`),this.internal.out(`endobj`)}),this.internal.events.subscribe(`putCatalog`,function(){this.internal.out(`/OpenAction `+t+` 0 R`)})),this},function(e){var t=function(){var e=void 0;Object.defineProperty(this,"pdf",{get:function(){return e},set:function(t){e=t}});var t=150;Object.defineProperty(this,"width",{get:function(){return t},set:function(e){t=isNaN(e)||!1===Number.isInteger(e)||e<0?150:e,this.getContext(`2d`).pageWrapXEnabled&&(this.getContext(`2d`).pageWrapX=t+1)}});var n=300;Object.defineProperty(this,"height",{get:function(){return n},set:function(e){n=isNaN(e)||!1===Number.isInteger(e)||e<0?300:e,this.getContext(`2d`).pageWrapYEnabled&&(this.getContext(`2d`).pageWrapY=n+1)}});var r=[];Object.defineProperty(this,"childNodes",{get:function(){return r},set:function(e){r=e}});var i={};Object.defineProperty(this,"style",{get:function(){return i},set:function(e){i=e}}),Object.defineProperty(this,"parentNode",{})};t.prototype.getContext=function(e,t){var n;if((e||=`2d`)!==`2d`)return null;for(n in t)this.pdf.context2d.hasOwnProperty(n)&&(this.pdf.context2d[n]=t[n]);return this.pdf.context2d._canvas=this,this.pdf.context2d},t.prototype.toDataURL=function(){throw Error(`toDataURL is not implemented.`)},e.events.push([`initialized`,function(){this.canvas=new t,this.canvas.pdf=this}])}(FL.API),function(e){var t={left:0,top:0,bottom:0,right:0},n=!1,r=function(){this.internal.__cell__===void 0&&(this.internal.__cell__={},this.internal.__cell__.padding=3,this.internal.__cell__.headerFunction=void 0,this.internal.__cell__.margins=Object.assign({},t),this.internal.__cell__.margins.width=this.getPageWidth(),i.call(this))},i=function(){this.internal.__cell__.lastCell=new a,this.internal.__cell__.pages=1},a=function(){var e=arguments[0];Object.defineProperty(this,"x",{enumerable:!0,get:function(){return e},set:function(t){e=t}});var t=arguments[1];Object.defineProperty(this,"y",{enumerable:!0,get:function(){return t},set:function(e){t=e}});var n=arguments[2];Object.defineProperty(this,"width",{enumerable:!0,get:function(){return n},set:function(e){n=e}});var r=arguments[3];Object.defineProperty(this,"height",{enumerable:!0,get:function(){return r},set:function(e){r=e}});var i=arguments[4];Object.defineProperty(this,"text",{enumerable:!0,get:function(){return i},set:function(e){i=e}});var a=arguments[5];Object.defineProperty(this,"lineNumber",{enumerable:!0,get:function(){return a},set:function(e){a=e}});var o=arguments[6];return Object.defineProperty(this,"align",{enumerable:!0,get:function(){return o},set:function(e){o=e}}),this};a.prototype.clone=function(){return new a(this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align)},a.prototype.toArray=function(){return[this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align]},e.setHeaderFunction=function(e){return r.call(this),this.internal.__cell__.headerFunction=typeof e==`function`?e:void 0,this},e.getTextDimensions=function(e,t){r.call(this);var n=(t||={}).fontSize||this.getFontSize(),i=t.font||this.getFont(),a=t.scaleFactor||this.internal.scaleFactor,o=0,s=0,c=0,l=this;if(!Array.isArray(e)&&typeof e!=`string`){if(typeof e!=`number`)throw Error(`getTextDimensions expects text-parameter to be of type String or type Number or an Array of Strings.`);e=String(e)}var u=t.maxWidth;u>0?typeof e==`string`?e=this.splitTextToSize(e,u):Object.prototype.toString.call(e)===`[object Array]`&&(e=e.reduce(function(e,t){return e.concat(l.splitTextToSize(t,u))},[])):e=Array.isArray(e)?e:[e];for(var d=0;d<e.length;d++)o<(c=this.getStringUnitWidth(e[d],{font:i})*n)&&(o=c);return o!==0&&(s=e.length),{w:o/=a,h:Math.max((s*n*this.getLineHeightFactor()-n*(this.getLineHeightFactor()-1))/a,0)}},e.cellAddPage=function(){r.call(this),this.addPage();var e=this.internal.__cell__.margins||t;return this.internal.__cell__.lastCell=new a(e.left,e.top,void 0,void 0),this.internal.__cell__.pages+=1,this};var o=e.cell=function(){var e=arguments[0]instanceof a?arguments[0]:new a(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6]);r.call(this);var i=this.internal.__cell__.lastCell,o=this.internal.__cell__.padding,s=this.internal.__cell__.margins||t,c=this.internal.__cell__.tableHeaderRow,l=this.internal.__cell__.printHeaders;return i.lineNumber!==void 0&&(i.lineNumber===e.lineNumber?(e.x=(i.x||0)+(i.width||0),e.y=i.y||0):i.y+i.height+e.height+s.bottom>this.getPageHeight()?(this.cellAddPage(),e.y=s.top,l&&c&&(this.printHeaderRow(e.lineNumber,!0),e.y+=c[0].height)):e.y=i.y+i.height||e.y),e.text[0]!==void 0&&(this.rect(e.x,e.y,e.width,e.height,!0===n?`FD`:void 0),e.align===`right`?this.text(e.text,e.x+e.width-o,e.y+o,{align:`right`,baseline:`top`}):e.align===`center`?this.text(e.text,e.x+e.width/2,e.y+o,{align:`center`,baseline:`top`,maxWidth:e.width-o-o}):this.text(e.text,e.x+o,e.y+o,{align:`left`,baseline:`top`,maxWidth:e.width-o-o})),this.internal.__cell__.lastCell=e,this};e.table=function(e,n,c,l,u){if(r.call(this),!c)throw Error(`No data for PDF table.`);var d,f,p,m,h=[],g=[],_=[],v={},y={},b=[],x=[],S=(u||={}).autoSize||!1,C=!1!==u.printHeaders,w=u.css&&u.css[`font-size`]!==void 0?16*u.css[`font-size`]:u.fontSize||12,T=u.margins||Object.assign({width:this.getPageWidth()},t),E=typeof u.padding==`number`?u.padding:3,D=u.headerBackgroundColor||`#c8c8c8`,O=u.headerTextColor||`#000`;if(i.call(this),this.internal.__cell__.printHeaders=C,this.internal.__cell__.margins=T,this.internal.__cell__.table_font_size=w,this.internal.__cell__.padding=E,this.internal.__cell__.headerBackgroundColor=D,this.internal.__cell__.headerTextColor=O,this.setFontSize(w),l==null)g=h=Object.keys(c[0]),_=h.map(function(){return`left`});else if(Array.isArray(l)&&Oi(l[0])===`object`)for(h=l.map(function(e){return e.name}),g=l.map(function(e){return e.prompt||e.name||``}),_=l.map(function(e){return e.align||`left`}),d=0;d<l.length;d+=1)y[l[d].name]=.7499990551181103*l[d].width;else Array.isArray(l)&&typeof l[0]==`string`&&(g=h=l,_=h.map(function(){return`left`}));if(S||Array.isArray(l)&&typeof l[0]==`string`)for(d=0;d<h.length;d+=1){for(v[m=h[d]]=c.map(function(e){return e[m]}),this.setFont(void 0,`bold`),b.push(this.getTextDimensions(g[d],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w),f=v[m],this.setFont(void 0,`normal`),p=0;p<f.length;p+=1)b.push(this.getTextDimensions(f[p],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w);y[m]=Math.max.apply(null,b)+E+E,b=[]}if(C){var k={};for(d=0;d<h.length;d+=1)k[h[d]]={},k[h[d]].text=g[d],k[h[d]].align=_[d];var A=s.call(this,k,y);x=h.map(function(t){return new a(e,n,y[t],A,k[t].text,void 0,k[t].align)}),this.setTableHeaderRow(x),this.printHeaderRow(1,!1)}var j=l.reduce(function(e,t){return e[t.name]=t.align,e},{});for(d=0;d<c.length;d+=1){`rowStart`in u&&u.rowStart instanceof Function&&u.rowStart({row:d,data:c[d]},this);var M=s.call(this,c[d],y);for(p=0;p<h.length;p+=1){var N=c[d][h[p]];`cellStart`in u&&u.cellStart instanceof Function&&u.cellStart({row:d,col:p,data:N},this),o.call(this,new a(e,n,y[h[p]],M,N,d+2,j[h[p]]))}}return this.internal.__cell__.table_x=e,this.internal.__cell__.table_y=n,this};var s=function(e,t){var n=this.internal.__cell__.padding,r=this.internal.__cell__.table_font_size,i=this.internal.scaleFactor;return Object.keys(e).map(function(r){var i=e[r];return this.splitTextToSize(i.hasOwnProperty(`text`)?i.text:i,t[r]-n-n)},this).map(function(e){return this.getLineHeightFactor()*e.length*r/i+n+n},this).reduce(function(e,t){return Math.max(e,t)},0)};e.setTableHeaderRow=function(e){r.call(this),this.internal.__cell__.tableHeaderRow=e},e.printHeaderRow=function(e,t){if(r.call(this),!this.internal.__cell__.tableHeaderRow)throw Error(`Property tableHeaderRow does not exist.`);var i;if(n=!0,typeof this.internal.__cell__.headerFunction==`function`){var s=this.internal.__cell__.headerFunction(this,this.internal.__cell__.pages);this.internal.__cell__.lastCell=new a(s[0],s[1],s[2],s[3],void 0,-1)}this.setFont(void 0,`bold`);for(var c=[],l=0;l<this.internal.__cell__.tableHeaderRow.length;l+=1){i=this.internal.__cell__.tableHeaderRow[l].clone(),t&&(i.y=this.internal.__cell__.margins.top||0,c.push(i)),i.lineNumber=e;var u=this.getTextColor();this.setTextColor(this.internal.__cell__.headerTextColor),this.setFillColor(this.internal.__cell__.headerBackgroundColor),o.call(this,i),this.setTextColor(u)}c.length>0&&this.setTableHeaderRow(c),this.setFont(void 0,`normal`),n=!1}}(FL.API);var TR={italic:[`italic`,`oblique`,`normal`],oblique:[`oblique`,`italic`,`normal`],normal:[`normal`,`oblique`,`italic`]},ER=[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`],DR=wR(ER),OR=[100,200,300,400,500,600,700,800,900],kR=wR(OR);function AR(e){var t=e.family.replace(/"|'/g,``).toLowerCase(),n=function(e){return TR[e||=`normal`]?e:`normal`}(e.style),r=function(e){return e?typeof e==`number`?e>=100&&e<=900&&e%100==0?e:400:/^\d00$/.test(e)?parseInt(e):e===`bold`?700:400:400}(e.weight),i=function(e){return typeof DR[e||=`normal`]==`number`?e:`normal`}(e.stretch);return{family:t,style:n,weight:r,stretch:i,src:e.src||[],ref:e.ref||{name:t,style:[i,n,r].join(` `)}}}function jR(e,t,n,r){var i;for(i=n;i>=0&&i<t.length;i+=r)if(e[t[i]])return e[t[i]];for(i=n;i>=0&&i<t.length;i-=r)if(e[t[i]])return e[t[i]]}var MR={"sans-serif":`helvetica`,fixed:`courier`,monospace:`courier`,terminal:`courier`,cursive:`times`,fantasy:`times`,serif:`times`},NR={caption:`times`,icon:`times`,menu:`times`,"message-box":`times`,"small-caption":`times`,"status-bar":`times`};function PR(e){return[e.stretch,e.style,e.weight,e.family].join(` `)}function FR(e){return e.trimLeft()}function IR(e,t){for(var n=0;n<e.length;){if(e.charAt(n)===t)return[e.substring(0,n),e.substring(n+1)];n+=1}return null}function LR(e){var t=e.match(/^(-[a-z_]|[a-z_])[a-z0-9_-]*/i);return t===null?null:[t[0],e.substring(t[0].length)]}var RR,zR,BR,VR,HR,UR=[`times`];function WR(e,t,n,r,i){var a=4,o=qR;switch(i){case FL.API.image_compression.FAST:a=1,o=KR;break;case FL.API.image_compression.MEDIUM:a=6,o=JR;break;case FL.API.image_compression.SLOW:a=9,o=YR}e=function(e,t,n,r){for(var i,a=e.length/t,o=new Uint8Array(e.length+a),s=[GR,KR,qR,JR,YR],c=0;c<a;c+=1){var l=c*t,u=e.subarray(l,l+t);if(r)o.set(r(u,n,i),l+c);else{for(var d=s.length,f=[],p=0;p<d;p+=1)f[p]=s[p](u,n,i);var m=ZR(f.concat());o.set(f[m],l+c)}i=u}return o}(e,t,Math.ceil(n*r/8),o);var s=Fj(e,{level:a});return FL.API.__addimage__.arrayBufferToBinaryString(s)}function GR(e){var t=Array.apply([],e);return t.unshift(0),t}function KR(e,t){var n=e.length,r=[];r[0]=1;for(var i=0;i<n;i+=1){var a=e[i-t]||0;r[i+1]=e[i]-a+256&255}return r}function qR(e,t,n){var r=e.length,i=[];i[0]=2;for(var a=0;a<r;a+=1){var o=n&&n[a]||0;i[a+1]=e[a]-o+256&255}return i}function JR(e,t,n){var r=e.length,i=[];i[0]=3;for(var a=0;a<r;a+=1){var o=e[a-t]||0,s=n&&n[a]||0;i[a+1]=e[a]+256-(o+s>>>1)&255}return i}function YR(e,t,n){var r=e.length,i=[];i[0]=4;for(var a=0;a<r;a+=1){var o=XR(e[a-t]||0,n&&n[a]||0,n&&n[a-t]||0);i[a+1]=e[a]-o+256&255}return i}function XR(e,t,n){if(e===t&&t===n)return e;var r=Math.abs(t-n),i=Math.abs(e-n),a=Math.abs(e+t-n-n);return r<=i&&r<=a?e:i<=a?t:n}function ZR(e){var t=e.map(function(e){return e.reduce(function(e,t){return e+Math.abs(t)},0)});return t.indexOf(Math.min.apply(null,t))}function QR(e,t,n){var r=t*n,i=Math.floor(r/8),a=16-(r-8*i+n),o=(1<<n)-1;return ez(e,i)>>a&o}function $R(e,t,n,r){var i=n*r,a=Math.floor(i/8),o=16-(i-8*a+r),s=(1<<r)-1,c=(t&s)<<o;(function(e,t,n){if(t+1<e.byteLength)e.setUint16(t,n,!1);else{var r=n>>8&255;e.setUint8(t,r)}})(e,a,ez(e,a)&~(s<<o)&65535|c)}function ez(e,t){return t+1<e.byteLength?e.getUint16(t,!1):e.getUint8(t)<<8}function tz(e){var t=0;if(e[t++]!==71||e[t++]!==73||e[t++]!==70||e[t++]!==56||(e[t++]+1&253)!=56||e[t++]!==97)throw Error(`Invalid GIF 87a/89a header.`);var n=e[t++]|e[t++]<<8,r=e[t++]|e[t++]<<8,i=e[t++],a=i>>7,o=1<<1+(7&i);e[t++],e[t++];var s=null,c=null;a&&(s=t,c=o,t+=3*o);var l=!0,u=[],d=0,f=null,p=0,m=null;for(this.width=n,this.height=r;l&&t<e.length;)switch(e[t++]){case 33:switch(e[t++]){case 255:if(e[t]!==11||e[t+1]==78&&e[t+2]==69&&e[t+3]==84&&e[t+4]==83&&e[t+5]==67&&e[t+6]==65&&e[t+7]==80&&e[t+8]==69&&e[t+9]==50&&e[t+10]==46&&e[t+11]==48&&e[t+12]==3&&e[t+13]==1&&e[t+16]==0)t+=14,m=e[t++]|e[t++]<<8,t++;else for(t+=12;;){if(!((D=e[t++])>=0))throw Error(`Invalid block size`);if(D===0)break;t+=D}break;case 249:if(e[t++]!==4||e[t+4]!==0)throw Error(`Invalid graphics extension block.`);var h=e[t++];d=e[t++]|e[t++]<<8,f=e[t++],1&h||(f=null),p=h>>2&7,t++;break;case 254:for(;;){if(!((D=e[t++])>=0))throw Error(`Invalid block size`);if(D===0)break;t+=D}break;default:throw Error(`Unknown graphic control label: 0x`+e[t-1].toString(16))}break;case 44:var g=e[t++]|e[t++]<<8,_=e[t++]|e[t++]<<8,v=e[t++]|e[t++]<<8,y=e[t++]|e[t++]<<8,b=e[t++],x=b>>6&1,S=1<<1+(7&b),C=s,w=c,T=!1;b>>7&&(T=!0,C=t,w=S,t+=3*S);var E=t;for(t++;;){var D;if(!((D=e[t++])>=0))throw Error(`Invalid block size`);if(D===0)break;t+=D}u.push({x:g,y:_,width:v,height:y,has_local_palette:T,palette_offset:C,palette_size:w,data_offset:E,data_length:t-E,transparent_index:f,interlaced:!!x,delay:d,disposal:p});break;case 59:l=!1;break;default:throw Error(`Unknown gif block: 0x`+e[t-1].toString(16))}this.numFrames=function(){return u.length},this.loopCount=function(){return m},this.frameInfo=function(e){if(e<0||e>=u.length)throw Error(`Frame index out of range.`);return u[e]},this.decodeAndBlitFrameBGRA=function(t,r){var i=this.frameInfo(t),a=i.width*i.height;if(a>536870912)throw Error(`Image dimensions exceed 512MB, which is too large.`);var o=new Uint8Array(a);nz(e,i.data_offset,o,a);var s=i.palette_offset,c=i.transparent_index;c===null&&(c=256);var l=i.width,u=n-l,d=l,f=4*(i.y*n+i.x),p=4*((i.y+i.height)*n+i.x),m=f,h=4*u;!0===i.interlaced&&(h+=4*n*7);for(var g=8,_=0,v=o.length;_<v;++_){var y=o[_];if(d===0&&(d=l,(m+=h)>=p&&(h=4*u+4*n*(g-1),m=f+(l+u)*(g<<1),g>>=1)),y===c)m+=4;else{var b=e[s+3*y],x=e[s+3*y+1],S=e[s+3*y+2];r[m++]=S,r[m++]=x,r[m++]=b,r[m++]=255}--d}},this.decodeAndBlitFrameRGBA=function(t,r){var i=this.frameInfo(t),a=i.width*i.height;if(a>536870912)throw Error(`Image dimensions exceed 512MB, which is too large.`);var o=new Uint8Array(a);nz(e,i.data_offset,o,a);var s=i.palette_offset,c=i.transparent_index;c===null&&(c=256);var l=i.width,u=n-l,d=l,f=4*(i.y*n+i.x),p=4*((i.y+i.height)*n+i.x),m=f,h=4*u;!0===i.interlaced&&(h+=4*n*7);for(var g=8,_=0,v=o.length;_<v;++_){var y=o[_];if(d===0&&(d=l,(m+=h)>=p&&(h=4*u+4*n*(g-1),m=f+(l+u)*(g<<1),g>>=1)),y===c)m+=4;else{var b=e[s+3*y],x=e[s+3*y+1],S=e[s+3*y+2];r[m++]=b,r[m++]=x,r[m++]=S,r[m++]=255}--d}}}function nz(e,t,n,r){for(var i=e[t++],a=1<<i,o=a+1,s=o+1,c=i+1,l=(1<<c)-1,u=0,d=0,f=0,p=e[t++],m=new Int32Array(4096),h=null;;){for(;u<16&&p!==0;)d|=e[t++]<<u,u+=8,p===1?p=e[t++]:--p;if(u<c)break;var g=d&l;if(d>>=c,u-=c,g!==a){if(g===o)break;for(var _=g<s?g:h,v=0,y=_;y>a;)y=m[y]>>8,++v;var b=y;if(f+v+(_===g?0:1)>r)return void iL.log(`Warning, gif stream longer than expected.`);n[f++]=b;var x=f+=v;for(_!==g&&(n[f++]=b),y=_;v--;)y=m[y],n[--x]=255&y,y>>=8;h!==null&&s<4096&&(m[s++]=h<<8|b,s>=l+1&&c<12&&(++c,l=l<<1|1)),h=g}else s=o+1,l=(1<<(c=i+1))-1,h=null}return f!==r&&iL.log(`Warning, gif stream shorter than expected.`),n}function rz(e){var t,n,r,i,a,o=Math.floor,s=Array(64),c=Array(64),l=Array(64),u=Array(64),d=Array(65535),f=Array(65535),p=Array(64),m=Array(64),h=[],g=0,_=7,v=Array(64),y=Array(64),b=Array(64),x=Array(256),S=Array(2048),C=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],w=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],T=[0,1,2,3,4,5,6,7,8,9,10,11],E=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],D=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],O=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],k=[0,1,2,3,4,5,6,7,8,9,10,11],A=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],j=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function M(e,t){for(var n=0,r=0,i=[],a=1;a<=16;a++){for(var o=1;o<=e[a];o++)i[t[r]]=[],i[t[r]][0]=n,i[t[r]][1]=a,r++,n++;n*=2}return i}function N(e){for(var t=e[0],n=e[1]-1;n>=0;)t&1<<n&&(g|=1<<_),n--,--_<0&&(g==255?(P(255),P(0)):P(g),_=7,g=0)}function P(e){h.push(e)}function F(e){P(e>>8&255),P(255&e)}function I(e,t,n,r,i){for(var a,o=i[0],s=i[240],c=function(e,t){var n,r,i,a,o,s,c,l,u,d,f=0;for(u=0;u<8;++u){n=e[f],r=e[f+1],i=e[f+2],a=e[f+3],o=e[f+4],s=e[f+5],c=e[f+6];var m=n+(l=e[f+7]),h=n-l,g=r+c,_=r-c,v=i+s,y=i-s,b=a+o,x=a-o,S=m+b,C=m-b,w=g+v,T=g-v;e[f]=S+w,e[f+4]=S-w;var E=.707106781*(T+C);e[f+2]=C+E,e[f+6]=C-E;var D=.382683433*((S=x+y)-(T=_+h)),O=.5411961*S+D,k=1.306562965*T+D,A=.707106781*(w=y+_),j=h+A,M=h-A;e[f+5]=M+O,e[f+3]=M-O,e[f+1]=j+k,e[f+7]=j-k,f+=8}for(f=0,u=0;u<8;++u){n=e[f],r=e[f+8],i=e[f+16],a=e[f+24],o=e[f+32],s=e[f+40],c=e[f+48];var N=n+(l=e[f+56]),P=n-l,F=r+c,I=r-c,L=i+s,R=i-s,z=a+o,B=a-o,V=N+z,ee=N-z,te=F+L,H=F-L;e[f]=V+te,e[f+32]=V-te;var ne=.707106781*(H+ee);e[f+16]=ee+ne,e[f+48]=ee-ne;var re=.382683433*((V=B+R)-(H=I+P)),ie=.5411961*V+re,U=1.306562965*H+re,ae=.707106781*(te=R+I),oe=P+ae,W=P-ae;e[f+40]=W+ie,e[f+24]=W-ie,e[f+8]=oe+U,e[f+56]=oe-U,f++}for(u=0;u<64;++u)d=e[u]*t[u],p[u]=d>0?d+.5|0:d-.5|0;return p}(e,t),l=0;l<64;++l)m[C[l]]=c[l];var u=m[0]-n;n=m[0],u==0?N(r[0]):(N(r[f[a=32767+u]]),N(d[a]));for(var h=63;h>0&&m[h]==0;)h--;if(h==0)return N(o),n;for(var g,_=1;_<=h;){for(var v=_;m[_]==0&&_<=h;)++_;var y=_-v;if(y>=16){g=y>>4;for(var b=1;b<=g;++b)N(s);y&=15}a=32767+m[_],N(i[(y<<4)+f[a]]),N(d[a]),_++}return h!=63&&N(o),n}function L(e){e=Math.min(Math.max(e,1),100),a!=e&&(function(e){for(var t=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=o((t[n]*e+50)/100);r=Math.min(Math.max(r,1),255),s[C[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],a=0;a<64;a++){var d=o((i[a]*e+50)/100);d=Math.min(Math.max(d,1),255),c[C[a]]=d}for(var f=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],p=0,m=0;m<8;m++)for(var h=0;h<8;h++)l[p]=1/(s[C[p]]*f[m]*f[h]*8),u[p]=1/(c[C[p]]*f[m]*f[h]*8),p++}(Math.floor(e<50?5e3/e:200-2*e)),a=e)}this.encode=function(e,a){a&&L(a),h=[],g=0,_=7,F(65496),F(65504),F(16),P(74),P(70),P(73),P(70),P(0),P(1),P(1),P(0),F(1),F(1),P(0),P(0),function(){F(65499),F(132),P(0);for(var e=0;e<64;e++)P(s[e]);P(1);for(var t=0;t<64;t++)P(c[t])}(),function(e,t){F(65472),F(17),P(8),F(t),F(e),P(3),P(1),P(17),P(0),P(2),P(17),P(1),P(3),P(17),P(1)}(e.width,e.height),function(){F(65476),F(418),P(0);for(var e=0;e<16;e++)P(w[e+1]);for(var t=0;t<=11;t++)P(T[t]);P(16);for(var n=0;n<16;n++)P(E[n+1]);for(var r=0;r<=161;r++)P(D[r]);P(1);for(var i=0;i<16;i++)P(O[i+1]);for(var a=0;a<=11;a++)P(k[a]);P(17);for(var o=0;o<16;o++)P(A[o+1]);for(var s=0;s<=161;s++)P(j[s])}(),F(65498),F(12),P(3),P(1),P(0),P(2),P(17),P(3),P(17),P(0),P(63),P(0);var o=0,d=0,f=0;g=0,_=7,this.encode.displayName=`_encode_`;for(var p,m,x,C,M,R,z,B,V,ee=e.data,te=e.width,H=e.height,ne=4*te,re=0;re<H;){for(p=0;p<ne;){for(M=ne*re+p,z=-1,B=0,V=0;V<64;V++)R=M+(B=V>>3)*ne+(z=4*(7&V)),re+B>=H&&(R-=ne*(re+1+B-H)),p+z>=ne&&(R-=p+z-ne+4),m=ee[R++],x=ee[R++],C=ee[R++],v[V]=(S[m]+S[x+256|0]+S[C+512|0]>>16)-128,y[V]=(S[m+768|0]+S[x+1024|0]+S[C+1280|0]>>16)-128,b[V]=(S[m+1280|0]+S[x+1536|0]+S[C+1792|0]>>16)-128;o=I(v,l,o,t,r),d=I(y,u,d,n,i),f=I(b,u,f,n,i),p+=32}re+=8}if(_>=0){var ie=[];ie[1]=_+1,ie[0]=(1<<_+1)-1,N(ie)}return F(65497),new Uint8Array(h)},e||=50,function(){for(var e=String.fromCharCode,t=0;t<256;t++)x[t]=e(t)}(),t=M(w,T),n=M(O,k),r=M(E,D),i=M(A,j),function(){for(var e=1,t=2,n=1;n<=15;n++){for(var r=e;r<t;r++)f[32767+r]=n,d[32767+r]=[],d[32767+r][1]=n,d[32767+r][0]=r;for(var i=-(t-1);i<=-e;i++)f[32767+i]=n,d[32767+i]=[],d[32767+i][1]=n,d[32767+i][0]=t-1+i;e<<=1,t<<=1}}(),function(){for(var e=0;e<256;e++)S[e]=19595*e,S[e+256|0]=38470*e,S[e+512|0]=7471*e+32768,S[e+768|0]=-11059*e,S[e+1024|0]=-21709*e,S[e+1280|0]=32768*e+8421375,S[e+1536|0]=-27439*e,S[e+1792|0]=-5329*e}(),L(e)}function iz(e,t){if(this.pos=0,this.buffer=e,this.datav=new DataView(e.buffer),this.is_with_alpha=!!t,this.bottom_up=!0,this.flag=String.fromCharCode(this.buffer[0])+String.fromCharCode(this.buffer[1]),this.pos+=2,[`BM`,`BA`,`CI`,`CP`,`IC`,`PT`].indexOf(this.flag)===-1)throw Error(`Invalid BMP File`);this.parseHeader(),this.parseBGR()}function az(e){function t(e){if(!e)throw Error(`assert :P`)}function n(e,t,n){for(var r=0;4>r;r++)if(e[t+r]!=n.charCodeAt(r))return!0;return!1}function r(e,t,n,r,i){for(var a=0;a<i;a++)e[t+a]=n[r+a]}function i(e,t,n,r){for(var i=0;i<r;i++)e[t+i]=n}function a(e){return new Int32Array(e)}function o(e,t){for(var n=[],r=0;r<e;r++)n.push(new t);return n}function s(e,t){var n=[];return function e(n,r,i){for(var a=i[r],o=0;o<a&&(n.push(i.length>r+1?[]:new t),!(i.length<r+1));o++)e(n[o],r+1,i)}(n,0,e),n}var c=function(){var e=this;function c(e,t){for(var n=1<<t-1>>>0;e&n;)n>>>=1;return n?(e&n-1)+n:e}function l(e,n,r,i,a){t(!(i%r));do e[n+(i-=r)]=a;while(0<i)}function u(e,n,r,i,o){if(t(2328>=o),512>=o)var s=a(512);else if((s=a(o))==null)return 0;return function(e,n,r,i,o,s){var u,f,p=n,m=1<<r,h=a(16),g=a(16);for(t(o!=0),t(i!=null),t(e!=null),t(0<r),f=0;f<o;++f){if(15<i[f])return 0;++h[i[f]]}if(h[0]==o)return 0;for(g[1]=0,u=1;15>u;++u){if(h[u]>1<<u)return 0;g[u+1]=g[u]+h[u]}for(f=0;f<o;++f)u=i[f],0<i[f]&&(s[g[u]++]=f);if(g[15]==1)return(i=new d).g=0,i.value=s[0],l(e,p,1,m,i),m;var _,v=-1,y=m-1,b=0,x=1,S=1,C=1<<r;for(f=0,u=1,o=2;u<=r;++u,o<<=1){if(x+=S<<=1,0>(S-=h[u]))return 0;for(;0<h[u];--h[u])(i=new d).g=u,i.value=s[f++],l(e,p+b,o,C,i),b=c(b,u)}for(u=r+1,o=2;15>=u;++u,o<<=1){if(x+=S<<=1,0>(S-=h[u]))return 0;for(;0<h[u];--h[u]){if(i=new d,(b&y)!=v){for(p+=C,_=1<<(v=u)-r;15>v&&!(0>=(_-=h[v]));)++v,_<<=1;m+=C=1<<(_=v-r),e[n+(v=b&y)].g=_+r,e[n+v].value=p-n-v}i.g=u-r,i.value=s[f++],l(e,p+(b>>r),o,C,i),b=c(b,u)}}return x==2*g[15]-1?m:0}(e,n,r,i,o,s)}function d(){this.value=this.g=0}function f(){this.value=this.g=0}function p(){this.G=o(5,d),this.H=a(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=o(Gn,f)}function m(e,n,r,i){t(e!=null),t(n!=null),t(2147483648>i),e.Ca=254,e.I=0,e.b=-8,e.Ka=0,e.oa=n,e.pa=r,e.Jd=n,e.Yc=r+i,e.Zc=4<=i?r+i-4+1:r,E(e)}function h(e,t){for(var n=0;0<t--;)n|=O(e,128)<<t;return n}function g(e,t){var n=h(e,t);return D(e)?-n:n}function _(e,n,r,i){var a,o=0;for(t(e!=null),t(n!=null),t(4294967288>i),e.Sb=i,e.Ra=0,e.u=0,e.h=0,4<i&&(i=4),a=0;a<i;++a)o+=n[r+a]<<8*a;e.Ra=o,e.bb=i,e.oa=n,e.pa=r}function v(e){for(;8<=e.u&&e.bb<e.Sb;)e.Ra>>>=8,e.Ra+=e.oa[e.pa+e.bb]<<Jn-8>>>0,++e.bb,e.u-=8;C(e)&&(e.h=1,e.u=0)}function y(e,n){if(t(0<=n),!e.h&&n<=qn){var r=S(e)&Kn[n];return e.u+=n,v(e),r}return e.h=1,e.u=0}function b(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function x(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function S(e){return e.Ra>>>(e.u&Jn-1)>>>0}function C(e){return t(e.bb<=e.Sb),e.h||e.bb==e.Sb&&e.u>Jn}function w(e,t){e.u=t,e.h=C(e)}function T(e){e.u>=Yn&&(t(e.u>=Yn),v(e))}function E(e){t(e!=null&&e.oa!=null),e.pa<e.Zc?(e.I=(e.oa[e.pa++]|e.I<<8)>>>0,e.b+=8):(t(e!=null&&e.oa!=null),e.pa<e.Yc?(e.b+=8,e.I=e.oa[e.pa++]|e.I<<8):e.Ka?e.b=0:(e.I<<=8,e.b+=8,e.Ka=1))}function D(e){return h(e,1)}function O(e,t){var n=e.Ca;0>e.b&&E(e);var r=e.b,i=n*t>>>8,a=(e.I>>>r>i)+0;for(a?(n-=i,e.I-=i+1<<r>>>0):n=i+1,r=n,i=0;256<=r;)i+=8,r>>=8;return r=7^i+q[r],e.b-=r,e.Ca=(n<<r)-1,a}function k(e,t,n){e[t+0]=n>>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n}function A(e,t){return e[t+0]|e[t+1]<<8}function j(e,t){return A(e,t)|e[t+2]<<16}function M(e,t){return A(e,t)|A(e,t+2)<<16}function N(e,n){var r=1<<n;return t(e!=null),t(0<n),e.X=a(r),e.X==null?0:(e.Mb=32-n,e.Xa=n,1)}function P(e,n){t(e!=null),t(n!=null),t(e.Xa==n.Xa),r(n.X,0,e.X,0,1<<n.Xa)}function F(){this.X=[],this.Xa=this.Mb=0}function I(e,n,r,i){t(r!=null),t(i!=null);var a=r[0],o=i[0];return a==0&&(a=(e*o+n/2)/n),o==0&&(o=(n*a+e/2)/e),0>=a||0>=o?0:(r[0]=a,i[0]=o,1)}function L(e,t){return e+(1<<t)-1>>>t}function R(e,t){return((4278255360&e)+(4278255360&t)>>>0&4278255360)+((16711935&e)+(16711935&t)>>>0&16711935)>>>0}function z(t,n){e[n]=function(n,r,i,a,o,s,c){var l;for(l=0;l<o;++l){var u=e[t](s[c+l-1],i,a+l);s[c+l]=R(n[r+l],u)}}}function B(){this.ud=this.hd=this.jd=0}function V(e,t){return((4278124286&(e^t))>>>1)+(e&t)>>>0}function ee(e){return 0<=e&&256>e?e:0>e?0:255<e?255:void 0}function te(e,t){return ee(e+(e-t+.5>>1))}function H(e,t,n){return Math.abs(t-n)-Math.abs(e-n)}function ne(e,t,n,r,i,a,o){for(r=a[o-1],n=0;n<i;++n)a[o+n]=r=R(e[t+n],r)}function re(e,t,n,r,i){var a;for(a=0;a<n;++a){var o=e[t+a],s=o>>8&255,c=16711935&(c=(c=16711935&o)+((s<<16)+s));r[i+a]=(4278255360&o)+c>>>0}}function ie(e,t){t.jd=255&e,t.hd=e>>8&255,t.ud=e>>16&255}function U(e,t,n,r,i,a){var o;for(o=0;o<r;++o){var s=t[n+o],c=s>>>8,l=s,u=255&(u=(u=s>>>16)+((e.jd<<24>>24)*(c<<24>>24)>>>5));l=255&(l=(l+=(e.hd<<24>>24)*(c<<24>>24)>>>5)+((e.ud<<24>>24)*(u<<24>>24)>>>5)),i[a+o]=(4278255360&s)+(u<<16)+l}}function ae(t,n,r,i,a){e[n]=function(e,t,n,r,o,s,c,l,u){for(r=c;r<l;++r)for(c=0;c<u;++c)o[s++]=a(n[i(e[t++])])},e[t]=function(t,n,o,s,c,l,u){var d=8>>t.b,f=t.Ea,p=t.K[0],m=t.w;if(8>d)for(t=(1<<t.b)-1,m=(1<<d)-1;n<o;++n){var h,g=0;for(h=0;h<f;++h)h&t||(g=i(s[c++])),l[u++]=a(p[g&m]),g>>=d}else e[`VP8LMapColor`+r](s,c,p,m,l,u,n,o,f)}}function oe(e,t,n,r,i){for(n=t+n;t<n;){var a=e[t++];r[i++]=a>>16&255,r[i++]=a>>8&255,r[i++]=255&a}}function W(e,t,n,r,i){for(n=t+n;t<n;){var a=e[t++];r[i++]=a>>16&255,r[i++]=a>>8&255,r[i++]=255&a,r[i++]=a>>24&255}}function se(e,t,n,r,i){for(n=t+n;t<n;){var a=(o=e[t++])>>16&240|o>>12&15,o=240&o|o>>28&15;r[i++]=a,r[i++]=o}}function ce(e,t,n,r,i){for(n=t+n;t<n;){var a=(o=e[t++])>>16&248|o>>13&7,o=o>>5&224|o>>3&31;r[i++]=a,r[i++]=o}}function le(e,t,n,r,i){for(n=t+n;t<n;){var a=e[t++];r[i++]=255&a,r[i++]=a>>8&255,r[i++]=a>>16&255}}function ue(e,t,n,i,a,o){if(o==0)for(n=t+n;t<n;)k(i,((o=e[t++])[0]>>24|o[1]>>8&65280|o[2]<<8&16711680|o[3]<<24)>>>0),a+=32;else r(i,a,e,t,n)}function de(t,n){e[n][0]=e[t+`0`],e[n][1]=e[t+`1`],e[n][2]=e[t+`2`],e[n][3]=e[t+`3`],e[n][4]=e[t+`4`],e[n][5]=e[t+`5`],e[n][6]=e[t+`6`],e[n][7]=e[t+`7`],e[n][8]=e[t+`8`],e[n][9]=e[t+`9`],e[n][10]=e[t+`10`],e[n][11]=e[t+`11`],e[n][12]=e[t+`12`],e[n][13]=e[t+`13`],e[n][14]=e[t+`0`],e[n][15]=e[t+`0`]}function fe(e){return e==J||e==Y||e==Jr||e==Yr}function pe(){this.eb=[],this.size=this.A=this.fb=0}function me(){this.y=[],this.f=[],this.ea=[],this.F=[],this.Tc=this.Ed=this.Cd=this.Fd=this.lb=this.Db=this.Ab=this.fa=this.J=this.W=this.N=this.O=0}function he(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new pe,this.f.kb=new me,this.sd=null}function ge(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function _e(){this.Id=this.fd=this.Md=this.hb=this.ib=this.da=this.bd=this.cd=this.j=this.v=this.Da=this.Sd=this.ob=0}function ve(e){return alert(`todo:WebPSamplerProcessPlane`),e.T}function ye(e,t){var n=e.T,i=t.ba.f.RGBA,a=i.eb,o=i.fb+e.ka*i.A,s=yi[t.ba.S],c=e.y,l=e.O,u=e.f,d=e.N,f=e.ea,p=e.W,m=t.cc,h=t.dc,g=t.Mc,_=t.Nc,v=e.ka,y=e.ka+e.T,b=e.U,x=b+1>>1;for(v==0?s(c,l,null,null,u,d,f,p,u,d,f,p,a,o,null,null,b):(s(t.ec,t.fc,c,l,m,h,g,_,u,d,f,p,a,o-i.A,a,o,b),++n);v+2<y;v+=2)m=u,h=d,g=f,_=p,d+=e.Rc,p+=e.Rc,o+=2*i.A,s(c,(l+=2*e.fa)-e.fa,c,l,m,h,g,_,u,d,f,p,a,o-i.A,a,o,b);return l+=e.fa,e.j+y<e.o?(r(t.ec,t.fc,c,l,b),r(t.cc,t.dc,u,d,x),r(t.Mc,t.Nc,f,p,x),n--):1&y||s(c,l,null,null,u,d,f,p,u,d,f,p,a,o+i.A,null,null,b),n}function be(e,n,r){var i=e.F,a=[e.J];if(i!=null){var o=e.U,s=n.ba.S,c=s==Gr||s==Jr;n=n.ba.f.RGBA;var l=[0],u=e.ka;l[0]=e.T,e.Kb&&(u==0?--l[0]:(--u,a[0]-=e.width),e.j+e.ka+e.T==e.o&&(l[0]=e.o-e.j-u));var d=n.eb;u=n.fb+u*n.A,e=Ar(i,a[0],e.width,o,l,d,u+(c?0:3),n.A),t(r==l),e&&fe(s)&&Or(d,u,c,o,l,n.A)}return 0}function xe(e){var t=e.ma,n=t.ba.S,r=11>n,i=n==Hr||n==Wr||n==Gr||n==Kr||n==12||fe(n);if(t.memory=null,t.Ib=null,t.Jb=null,t.Nd=null,!Hn(t.Oa,e,i?11:12))return 0;if(i&&fe(n)&&Tn(),e.da)alert(`todo:use_scaling`);else{if(r){if(t.Ib=ve,e.Kb){if(n=e.U+1>>1,t.memory=a(e.U+2*n),t.memory==null)return 0;t.ec=t.memory,t.fc=0,t.cc=t.ec,t.dc=t.fc+e.U,t.Mc=t.cc,t.Nc=t.dc+n,t.Ib=ye,Tn()}}else alert(`todo:EmitYUV`);i&&(t.Jb=be,r&&Cn())}if(r&&!Ni){for(e=0;256>e;++e)Pi[e]=89858*(e-128)+Oi>>Di,Li[e]=-22014*(e-128)+Oi,Ii[e]=-45773*(e-128),Fi[e]=113618*(e-128)+Oi>>Di;for(e=ki;e<Ai;++e)t=76283*(e-16)+Oi>>Di,Ri[e-ki]=Qe(t,255),zi[e-ki]=Qe(t+8>>4,15);Ni=1}return 1}function Se(e){var n=e.ma,r=e.U,i=e.T;return t(!(1&e.ka)),0>=r||0>=i?0:(r=n.Ib(e,n),n.Jb!=null&&n.Jb(e,n,r),n.Dc+=r,1)}function Ce(e){e.ma.memory=null}function we(e,t,n,r){return y(e,8)==47?(t[0]=y(e,14)+1,n[0]=y(e,14)+1,r[0]=y(e,1),y(e,3)==0?!e.h:0):0}function Te(e,t){if(4>e)return e+1;var n=e-2>>1;return(2+(1&e)<<n)+y(t,n)+1}function Ee(e,t){return 120<t?t-120:1<=(n=((n=ti[t-1])>>4)*e+(8-(15&n)))?n:1;var n}function De(e,t,n){var r=S(n),i=e[t+=255&r].g-8;return 0<i&&(w(n,n.u+8),r=S(n),t+=e[t].value,t+=r&(1<<i)-1),w(n,n.u+e[t].g),e[t].value}function Oe(e,n,r){return r.g+=e.g,r.value+=e.value<<n>>>0,t(8>=r.g),e.g}function ke(e,n,r){var i=e.xc;return t((n=i==0?0:e.vc[e.md*(r>>i)+(n>>i)])<e.Wb),e.Ya[n]}function Ae(e,n,i,a){var o=e.ab,s=e.c*n,c=e.C;n=c+n;var l=i,u=a;for(a=e.Ta,i=e.Ua;0<o--;){var d=e.gc[o],f=c,p=n,m=l,h=u,g=(u=a,l=i,d.Ea);switch(t(f<p),t(p<=d.nc),d.hc){case 2:Qn(m,h,(p-f)*g,u,l);break;case 0:var _=f,v=p,y=u,b=l,x=(E=d).Ea;_==0&&(Xn(m,h,null,null,1,y,b),ne(m,h+1,0,0,x-1,y,b+1),h+=x,b+=x,++_);for(var S=1<<E.b,C=S-1,w=L(x,E.b),T=E.K,E=E.w+(_>>E.b)*w;_<v;){var D=T,O=E,k=1;for(Zn(m,h,y,b-x,1,y,b);k<x;){var A=(k&~C)+S;A>x&&(A=x),(0,rr[D[O++]>>8&15])(m,h+ +k,y,b+k-x,A-k,y,b+k),k=A}h+=x,b+=x,++_&C||(E+=w)}p!=d.nc&&r(u,l-g,u,l+(p-f-1)*g,g);break;case 1:for(g=m,v=h,x=(m=d.Ea)-(b=m&~(y=(h=1<<d.b)-1)),_=L(m,d.b),S=d.K,d=d.w+(f>>d.b)*_;f<p;){for(C=S,w=d,T=new B,E=v+b,D=v+m;v<E;)ie(C[w++],T),ir(T,g,v,h,u,l),v+=h,l+=h;v<D&&(ie(C[w++],T),ir(T,g,v,x,u,l),v+=x,l+=x),++f&y||(d+=_)}break;case 3:if(m==u&&h==l&&0<d.b){for(v=u,m=g=l+(p-f)*g-(b=(p-f)*L(d.Ea,d.b)),h=u,y=l,_=[],b=(x=b)-1;0<=b;--b)_[b]=h[y+b];for(b=x-1;0<=b;--b)v[m+b]=_[b];$n(d,f,p,u,g,u,l)}else $n(d,f,p,m,h,u,l)}l=a,u=i}u!=i&&r(a,i,l,u,s)}function je(e,n){var r=e.V,i=e.Ba+e.c*e.C,a=n-e.C;if(t(n<=e.l.o),t(16>=a),0<a){var o=e.l,s=e.Ta,c=e.Ua,l=o.width;if(Ae(e,a,r,i),a=c=[c],t((r=e.C)<(i=n)),t(o.v<o.va),i>o.o&&(i=o.o),r<o.j){var u=o.j-r;r=o.j,a[0]+=u*l}if(r>=i?r=0:(a[0]+=4*o.v,o.ka=r-o.j,o.U=o.va-o.v,o.T=i-r,r=1),r){if(c=c[0],11>(r=e.ca).S){var d=r.f.RGBA,f=(i=r.S,a=o.U,o=o.T,u=d.eb,d.A),p=o;for(d=d.fb+e.Ma*d.A;0<p--;){var m=s,h=c,g=a,_=u,v=d;switch(i){case Vr:ar(m,h,g,_,v);break;case Hr:or(m,h,g,_,v);break;case J:or(m,h,g,_,v),Or(_,v,0,g,1,0);break;case Ur:lr(m,h,g,_,v);break;case Wr:ue(m,h,g,_,v,1);break;case Y:ue(m,h,g,_,v,1),Or(_,v,0,g,1,0);break;case Gr:ue(m,h,g,_,v,0);break;case Jr:ue(m,h,g,_,v,0),Or(_,v,1,g,1,0);break;case Kr:sr(m,h,g,_,v);break;case Yr:sr(m,h,g,_,v),kr(_,v,g,1,0);break;case qr:cr(m,h,g,_,v);break;default:t(0)}c+=l,d+=f}e.Ma+=o}else alert(`todo:EmitRescaledRowsYUVA`);t(e.Ma<=r.height)}}e.C=n,t(e.C<=e.i)}function Me(e){var t;if(0<e.ua)return 0;for(t=0;t<e.Wb;++t){var n=e.Ya[t].G,r=e.Ya[t].H;if(0<n[1][r[1]+0].g||0<n[2][r[2]+0].g||0<n[3][r[3]+0].g)return 0}return 1}function Ne(e,n,r,i,a,o){if(e.Z!=0){var s=e.qd,c=e.rd;for(t(vi[e.Z]!=null);n<r;++n)vi[e.Z](s,c,i,a,i,a,o),s=i,c=a,a+=o;e.qd=s,e.rd=c}}function Pe(e,n){var r=e.l.ma,i=r.Z==0||r.Z==1?e.l.j:e.C;if(i=e.C<i?i:e.C,t(n<=e.l.o),n>i){var a=e.l.width,o=r.ca,s=r.tb+a*i,c=e.V,l=e.Ba+e.c*i,u=e.gc;t(e.ab==1),t(u[0].hc==3),tr(u[0],i,n,c,l,o,s),Ne(r,i,n,o,s,a)}e.C=e.Ma=n}function Fe(e,n,r,i,a,o,s){var c=e.$/i,l=e.$%i,u=e.m,d=e.s,f=r+e.$,p=f;a=r+i*a;var m=r+i*o,h=280+d.ua,g=e.Pb?c:16777216,_=0<d.ua?d.Wa:null,v=d.wc,y=f<m?ke(d,l,c):null;t(e.C<o),t(m<=a);var b=!1;t:for(;;){for(;b||f<m;){var x=0;if(c>=g){var E=f-r;t((g=e).Pb),g.wd=g.m,g.xd=E,0<g.s.ua&&P(g.s.Wa,g.s.vb),g=c+ri}if(l&v||(y=ke(d,l,c)),t(y!=null),y.Qb&&(n[f]=y.qb,b=!0),!b)if(T(u),y.jc){x=u,E=n;var D=f,O=y.pd[S(x)&Gn-1];t(y.jc),256>O.g?(w(x,x.u+O.g),E[D]=O.value,x=0):(w(x,x.u+O.g-256),t(256<=O.value),x=O.value),x==0&&(b=!0)}else x=De(y.G[0],y.H[0],u);if(u.h)break;if(b||256>x){if(!b)if(y.nd)n[f]=(y.qb|x<<8)>>>0;else{if(T(u),b=De(y.G[1],y.H[1],u),T(u),E=De(y.G[2],y.H[2],u),D=De(y.G[3],y.H[3],u),u.h)break;n[f]=(D<<24|b<<16|x<<8|E)>>>0}if(b=!1,++f,++l>=i&&(l=0,++c,s!=null&&c<=o&&!(c%16)&&s(e,c),_!=null))for(;p<f;)x=n[p++],_.X[(506832829*x&4294967295)>>>_.Mb]=x}else if(280>x){if(x=Te(x-256,u),E=De(y.G[4],y.H[4],u),T(u),E=Ee(i,E=Te(E,u)),u.h)break;if(f-r<E||a-f<x)break t;for(D=0;D<x;++D)n[f+D]=n[f+D-E];for(f+=x,l+=x;l>=i;)l-=i,++c,s!=null&&c<=o&&!(c%16)&&s(e,c);if(t(f<=a),l&v&&(y=ke(d,l,c)),_!=null)for(;p<f;)x=n[p++],_.X[(506832829*x&4294967295)>>>_.Mb]=x}else{if(!(x<h))break t;for(b=x-280,t(_!=null);p<f;)x=n[p++],_.X[(506832829*x&4294967295)>>>_.Mb]=x;x=f,t(!(b>>>(E=_).Xa)),n[x]=E.X[b],b=!0}b||t(u.h==C(u))}if(e.Pb&&u.h&&f<a)t(e.m.h),e.a=5,e.m=e.wd,e.$=e.xd,0<e.s.ua&&P(e.s.vb,e.s.Wa);else{if(u.h)break t;s?.(e,c>o?o:c),e.a=0,e.$=f-r}return 1}return e.a=3,0}function Ie(e){t(e!=null),e.vc=null,e.yc=null,e.Ya=null;var n=e.Wa;n!=null&&(n.X=null),e.vb=null,t(e!=null)}function Le(){var t=new pn;return t==null?null:(t.a=0,t.xb=_i,de(`Predictor`,`VP8LPredictors`),de(`Predictor`,`VP8LPredictors_C`),de(`PredictorAdd`,`VP8LPredictorsAdd`),de(`PredictorAdd`,`VP8LPredictorsAdd_C`),Qn=re,ir=U,ar=oe,or=W,sr=se,cr=ce,lr=le,e.VP8LMapColor32b=er,e.VP8LMapColor8b=nr,t)}function Re(e,n,r,s,c){var l=1,f=[e],m=[n],h=s.m,g=s.s,_=null,v=0;t:for(;;){if(r)for(;l&&y(h,1);){var b=f,x=m,C=s,E=1,D=C.m,O=C.gc[C.ab],k=y(D,2);if(C.Oc&1<<k)l=0;else{switch(C.Oc|=1<<k,O.hc=k,O.Ea=b[0],O.nc=x[0],O.K=[null],++C.ab,t(4>=C.ab),k){case 0:case 1:O.b=y(D,3)+2,E=Re(L(O.Ea,O.b),L(O.nc,O.b),0,C,O.K),O.K=O.K[0];break;case 3:var A,j=y(D,8)+1,M=16<j?0:4<j?1:2<j?2:3;if(b[0]=L(O.Ea,M),O.b=M,A=E=Re(j,1,0,C,O.K)){var P,F=j,I=O,z=1<<(8>>I.b),B=a(z);if(B==null)A=0;else{var V=I.K[0],ee=I.w;for(B[0]=I.K[0][0],P=1;P<1*F;++P)B[P]=R(V[ee+P],B[P-1]);for(;P<4*z;++P)B[P]=0;I.K[0]=null,I.K[0]=B,A=1}}E=A;break;case 2:break;default:t(0)}l=E}}if(f=f[0],m=m[0],l&&y(h,1)&&!(l=1<=(v=y(h,4))&&11>=v)){s.a=3;break t}var te;if(te=l)e:{var H,ne,re,ie=s,U=f,ae=m,oe=v,W=r,se=ie.m,ce=ie.s,le=[null],ue=1,de=0,fe=ni[oe];r:for(;;){if(W&&y(se,1)){var pe=y(se,3)+2,me=L(U,pe),he=L(ae,pe),ge=me*he;if(!Re(me,he,0,ie,le))break r;for(le=le[0],ce.xc=pe,H=0;H<ge;++H){var _e=le[H]>>8&65535;le[H]=_e,_e>=ue&&(ue=_e+1)}}if(se.h)break r;for(ne=0;5>ne;++ne){var ve=Qr[ne];!ne&&0<oe&&(ve+=1<<oe),de<ve&&(de=ve)}var ye=o(ue*fe,d),be=ue,xe=o(be,p);if(xe==null)var Se=null;else t(65536>=be),Se=xe;var Ce=a(de);if(Se==null||Ce==null||ye==null){ie.a=1;break r}var we=ye;for(H=re=0;H<ue;++H){var Te=Se[H],Ee=Te.G,De=Te.H,ke=0,Ae=1,je=0;for(ne=0;5>ne;++ne){ve=Qr[ne],Ee[ne]=we,De[ne]=re,!ne&&0<oe&&(ve+=1<<oe);n:{var Me,Ne=ve,Pe=ie,Le=Ce,ze=we,G=re,Be=0,Ve=Pe.m,He=y(Ve,1);if(i(Le,0,0,Ne),He){var Ue=y(Ve,1)+1,We=y(Ve,y(Ve,1)==0?1:8);Le[We]=1,Ue==2&&(Le[We=y(Ve,8)]=1);var Ge=1}else{var K=a(19),Ke=y(Ve,4)+4;if(19<Ke){Pe.a=3;var qe=0;break n}for(Me=0;Me<Ke;++Me)K[ei[Me]]=y(Ve,3);var Je=void 0,Ye=void 0,Xe=Pe,Ze=K,Qe=Ne,$e=Le,et=0,tt=Xe.m,nt=8,rt=o(128,d);i:for(;u(rt,0,7,Ze,19);){if(y(tt,1)){if((Je=2+y(tt,2+2*y(tt,3)))>Qe)break i}else Je=Qe;for(Ye=0;Ye<Qe&&Je--;){T(tt);var it=rt[0+(127&S(tt))];w(tt,tt.u+it.g);var at=it.value;if(16>at)$e[Ye++]=at,at!=0&&(nt=at);else{var ot=at==16,st=at-16,ct=Zr[st],lt=y(tt,Xr[st])+ct;if(Ye+lt>Qe)break i;for(var ut=ot?nt:0;0<lt--;)$e[Ye++]=ut}}et=1;break i}et||(Xe.a=3),Ge=et}(Ge&&=!Ve.h)&&(Be=u(ze,G,8,Le,Ne)),Ge&&Be!=0?qe=Be:(Pe.a=3,qe=0)}if(qe==0)break r;if(Ae&&$r[ne]==1&&(Ae=we[re].g==0),ke+=we[re].g,re+=qe,3>=ne){var dt,ft=Ce[0];for(dt=1;dt<ve;++dt)Ce[dt]>ft&&(ft=Ce[dt]);je+=ft}}if(Te.nd=Ae,Te.Qb=0,Ae&&(Te.qb=(Ee[3][De[3]+0].value<<24|Ee[1][De[1]+0].value<<16|Ee[2][De[2]+0].value)>>>0,ke==0&&256>Ee[0][De[0]+0].value&&(Te.Qb=1,Te.qb+=Ee[0][De[0]+0].value<<8)),Te.jc=!Te.Qb&&6>je,Te.jc){var pt,mt=Te;for(pt=0;pt<Gn;++pt){var ht=pt,gt=mt.pd[ht],_t=mt.G[0][mt.H[0]+ht];256<=_t.value?(gt.g=_t.g+256,gt.value=_t.value):(gt.g=0,gt.value=0,ht>>=Oe(_t,8,gt),ht>>=Oe(mt.G[1][mt.H[1]+ht],16,gt),ht>>=Oe(mt.G[2][mt.H[2]+ht],0,gt),Oe(mt.G[3][mt.H[3]+ht],24,gt))}}}ce.vc=le,ce.Wb=ue,ce.Ya=Se,ce.yc=ye,te=1;break e}te=0}if(!(l=te)){s.a=3;break t}if(0<v){if(g.ua=1<<v,!N(g.Wa,v)){s.a=1,l=0;break t}}else g.ua=0;var vt=s,yt=f,bt=m,xt=vt.s,St=xt.xc;if(vt.c=yt,vt.i=bt,xt.md=L(yt,St),xt.wc=St==0?-1:(1<<St)-1,r){s.xb=gi;break t}if((_=a(f*m))==null){s.a=1,l=0;break t}l=(l=Fe(s,_,0,f,m,m,null))&&!h.h;break t}return l?(c==null?(t(_==null),t(r)):c[0]=_,s.$=0,r||Ie(g)):Ie(g),l}function ze(e,n){var r=e.c*e.i,i=r+n+16*n;return t(e.c<=n),e.V=a(i),e.V==null?(e.Ta=null,e.Ua=0,e.a=1,0):(e.Ta=e.V,e.Ua=e.Ba+r+n,1)}function G(e,n){var r=e.C,i=n-r,a=e.V,o=e.Ba+e.c*r;for(t(n<=e.l.o);0<i;){var s=16<i?16:i,c=e.l.ma,l=e.l.width,u=l*s,d=c.ca,f=c.tb+l*r,p=e.Ta,m=e.Ua;Ae(e,s,a,o),jr(p,m,d,f,u),Ne(c,r,r+s,d,f,l),i-=s,a+=s*e.c,r+=s}t(r==n),e.C=e.Ma=n}function Be(){this.ub=this.yd=this.td=this.Rb=0}function Ve(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function He(){this.Fb=this.Bb=this.Cb=0,this.Zb=a(4),this.Lb=a(4)}function Ue(){this.Yb=function(){var e=[];return function e(t,n,r){for(var i=r[n],a=0;a<i&&(t.push(r.length>n+1?[]:0),!(r.length<n+1));a++)e(t[a],n+1,r)}(e,0,[3,11]),e}()}function We(){this.jb=a(3),this.Wc=s([4,8],Ue),this.Xc=s([4,17],Ue)}function Ge(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new a(4),this.od=new a(4)}function K(){this.ld=this.La=this.dd=this.tc=0}function Ke(){this.Na=this.la=0}function qe(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function Je(){this.ad=a(384),this.Za=0,this.Ob=a(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function Ye(){this.uc=this.M=this.Nb=0,this.wa=Array(new K),this.Y=0,this.ya=Array(new Je),this.aa=0,this.l=new $e}function Xe(){this.y=a(16),this.f=a(8),this.ea=a(8)}function Ze(){this.cb=this.a=0,this.sc=``,this.m=new b,this.Od=new Be,this.Kc=new Ve,this.ed=new Ge,this.Qa=new He,this.Ic=this.$c=this.Aa=0,this.D=new Ye,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=o(8,b),this.ia=0,this.pb=o(4,qe),this.Pa=new We,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new Xe),this.Hd=0,this.rb=Array(new Ke),this.sb=0,this.wa=Array(new K),this.Y=0,this.oc=[],this.pc=0,this.sa=[],this.ta=0,this.qa=[],this.ra=0,this.Ha=[],this.B=this.R=this.Ia=0,this.Ec=[],this.M=this.ja=this.Vb=this.Fc=0,this.ya=Array(new Je),this.L=this.aa=0,this.gd=s([4,2],K),this.ga=null,this.Fa=[],this.Cc=this.qc=this.P=0,this.Gb=[],this.Uc=0,this.mb=[],this.nb=0,this.rc=[],this.Ga=this.Vc=0}function Qe(e,t){return 0>e?0:e>t?t:e}function $e(){this.T=this.U=this.ka=this.height=this.width=0,this.y=[],this.f=[],this.ea=[],this.Rc=this.fa=this.W=this.N=this.O=0,this.ma=`void`,this.put=`VP8IoPutHook`,this.ac=`VP8IoSetupHook`,this.bc=`VP8IoTeardownHook`,this.ha=this.Kb=0,this.data=[],this.hb=this.ib=this.da=this.o=this.j=this.va=this.v=this.Da=this.ob=this.w=0,this.F=[],this.J=0}function et(){var e=new Ze;return e!=null&&(e.a=0,e.sc=`OK`,e.cb=0,e.Xb=0,oi||=it),e}function tt(e,t,n){return e.a==0&&(e.a=t,e.sc=n,e.cb=0),0}function nt(e,t,n){return 3<=n&&e[t+0]==157&&e[t+1]==1&&e[t+2]==42}function rt(e,n){if(e==null)return 0;if(e.a=0,e.sc=`OK`,n==null)return tt(e,2,`null VP8Io passed to VP8GetHeaders()`);var r=n.data,a=n.w,o=n.ha;if(4>o)return tt(e,7,`Truncated header.`);var s=r[a+0]|r[a+1]<<8|r[a+2]<<16,c=e.Od;if(c.Rb=!(1&s),c.td=s>>1&7,c.yd=s>>4&1,c.ub=s>>5,3<c.td)return tt(e,3,`Incorrect keyframe parameters.`);if(!c.yd)return tt(e,4,`Frame not displayable.`);a+=3,o-=3;var l=e.Kc;if(c.Rb){if(7>o)return tt(e,7,`cannot parse picture header`);if(!nt(r,a,o))return tt(e,3,`Bad code word`);l.c=16383&(r[a+4]<<8|r[a+3]),l.Td=r[a+4]>>6,l.i=16383&(r[a+6]<<8|r[a+5]),l.Ud=r[a+6]>>6,a+=7,o-=7,e.za=l.c+15>>4,e.Ub=l.i+15>>4,n.width=l.c,n.height=l.i,n.Da=0,n.j=0,n.v=0,n.va=n.width,n.o=n.height,n.da=0,n.ib=n.width,n.hb=n.height,n.U=n.width,n.T=n.height,i((s=e.Pa).jb,0,255,s.jb.length),t((s=e.Qa)!=null),s.Cb=0,s.Bb=0,s.Fb=1,i(s.Zb,0,0,s.Zb.length),i(s.Lb,0,0,s.Lb)}if(c.ub>o)return tt(e,7,`bad partition length`);m(s=e.m,r,a,c.ub),a+=c.ub,o-=c.ub,c.Rb&&(l.Ld=D(s),l.Kd=D(s)),l=e.Qa;var u,d=e.Pa;if(t(s!=null),t(l!=null),l.Cb=D(s),l.Cb){if(l.Bb=D(s),D(s)){for(l.Fb=D(s),u=0;4>u;++u)l.Zb[u]=D(s)?g(s,7):0;for(u=0;4>u;++u)l.Lb[u]=D(s)?g(s,6):0}if(l.Bb)for(u=0;3>u;++u)d.jb[u]=D(s)?h(s,8):255}else l.Bb=0;if(s.Ka)return tt(e,3,`cannot parse segment header`);if((l=e.ed).zd=D(s),l.Tb=h(s,6),l.wb=h(s,3),l.Pc=D(s),l.Pc&&D(s)){for(d=0;4>d;++d)D(s)&&(l.vd[d]=g(s,6));for(d=0;4>d;++d)D(s)&&(l.od[d]=g(s,6))}if(e.L=l.Tb==0?0:l.zd?1:2,s.Ka)return tt(e,3,`cannot parse filter header`);var f=o;if(o=u=a,a=u+f,l=f,e.Xb=(1<<h(e.m,2))-1,f<3*(d=e.Xb))r=7;else{for(u+=3*d,l-=3*d,f=0;f<d;++f){var p=r[o+0]|r[o+1]<<8|r[o+2]<<16;p>l&&(p=l),m(e.Jc[+f],r,u,p),u+=p,l-=p,o+=3}m(e.Jc[+d],r,u,l),r=u<a?0:5}if(r!=0)return tt(e,r,`cannot parse partitions`);for(r=h(u=e.m,7),o=D(u)?g(u,4):0,a=D(u)?g(u,4):0,l=D(u)?g(u,4):0,d=D(u)?g(u,4):0,u=D(u)?g(u,4):0,f=e.Qa,p=0;4>p;++p){if(f.Cb){var _=f.Zb[p];f.Fb||(_+=r)}else{if(0<p){e.pb[p]=e.pb[0];continue}_=r}var v=e.pb[p];v.Sc[0]=ii[Qe(_+o,127)],v.Sc[1]=ai[Qe(_+0,127)],v.Eb[0]=2*ii[Qe(_+a,127)],v.Eb[1]=101581*ai[Qe(_+l,127)]>>16,8>v.Eb[1]&&(v.Eb[1]=8),v.Qc[0]=ii[Qe(_+d,117)],v.Qc[1]=ai[Qe(_+u,127)],v.lc=_+u}if(!c.Rb)return tt(e,4,`Not a key frame.`);for(D(s),c=e.Pa,r=0;4>r;++r){for(o=0;8>o;++o)for(a=0;3>a;++a)for(l=0;11>l;++l)d=O(s,di[r][o][a][l])?h(s,8):li[r][o][a][l],c.Wc[r][o].Yb[a][l]=d;for(o=0;17>o;++o)c.Xc[r][o]=c.Wc[r][fi[o]]}return e.kc=D(s),e.kc&&(e.Bd=h(s,8)),e.cb=1}function it(e,t,n,r,i,a,o){var s=t[i].Yb[n];for(n=0;16>i;++i){if(!O(e,s[n+0]))return i;for(;!O(e,s[n+1]);)if(s=t[++i].Yb[0],n=0,i==16)return 16;var c=t[i+1].Yb;if(O(e,s[n+2])){var l=e,u=0;if(O(l,(f=s)[(d=n)+3]))if(O(l,f[d+6])){for(s=0,d=2*(u=O(l,f[d+8]))+(f=O(l,f[d+9+u])),u=0,f=X[d];f[s];++s)u+=u+O(l,f[s]);u+=3+(8<<d)}else O(l,f[d+7])?(u=7+2*O(l,165),u+=O(l,145)):u=5+O(l,159);else u=O(l,f[d+4])?3+O(l,f[d+5]):2;s=c[2]}else u=1,s=c[1];c=o+si[i],0>(l=e).b&&E(l);var d,f=l.b,p=(d=l.Ca>>1)-(l.I>>f)>>31;--l.b,l.Ca+=p,l.Ca|=1,l.I-=(d+1&p)<<f,a[c]=((u^p)-p)*r[(0<i)+0]}return 16}function at(e){var t=e.rb[e.sb-1];t.la=0,t.Na=0,i(e.zc,0,0,e.zc.length),e.ja=0}function ot(e,t,n,r,i){i=e[t+n+32*r]+(i>>3),e[t+n+32*r]=-256&i?0>i?0:255:i}function st(e,t,n,r,i,a){ot(e,t,0,n,r+i),ot(e,t,1,n,r+a),ot(e,t,2,n,r-a),ot(e,t,3,n,r-i)}function ct(e){return(20091*e>>16)+e}function lt(e,t,n,r){var i,o=0,s=a(16);for(i=0;4>i;++i){var c=e[t+0]+e[t+8],l=e[t+0]-e[t+8],u=(35468*e[t+4]>>16)-ct(e[t+12]),d=ct(e[t+4])+(35468*e[t+12]>>16);s[o+0]=c+d,s[o+1]=l+u,s[o+2]=l-u,s[o+3]=c-d,o+=4,t++}for(i=o=0;4>i;++i)c=(e=s[o+0]+4)+s[o+8],l=e-s[o+8],u=(35468*s[o+4]>>16)-ct(s[o+12]),ot(n,r,0,0,c+(d=ct(s[o+4])+(35468*s[o+12]>>16))),ot(n,r,1,0,l+u),ot(n,r,2,0,l-u),ot(n,r,3,0,c-d),o++,r+=32}function ut(e,t,n,r){var i=e[t+0]+4,a=35468*e[t+4]>>16,o=ct(e[t+4]),s=35468*e[t+1]>>16;st(n,r,0,i+o,e=ct(e[t+1]),s),st(n,r,1,i+a,e,s),st(n,r,2,i-a,e,s),st(n,r,3,i-o,e,s)}function dt(e,t,n,r,i){lt(e,t,n,r),i&<(e,t+16,n,r+4)}function ft(e,t,n,r){dr(e,t+0,n,r,1),dr(e,t+32,n,r+128,1)}function pt(e,t,n,r){var i;for(e=e[t+0]+4,i=0;4>i;++i)for(t=0;4>t;++t)ot(n,r,t,i,e)}function mt(e,t,n,r){e[t+0]&&mr(e,t+0,n,r),e[t+16]&&mr(e,t+16,n,r+4),e[t+32]&&mr(e,t+32,n,r+128),e[t+48]&&mr(e,t+48,n,r+128+4)}function ht(e,t,n,r){var i,o=a(16);for(i=0;4>i;++i){var s=e[t+0+i]+e[t+12+i],c=e[t+4+i]+e[t+8+i],l=e[t+4+i]-e[t+8+i],u=e[t+0+i]-e[t+12+i];o[0+i]=s+c,o[8+i]=s-c,o[4+i]=u+l,o[12+i]=u-l}for(i=0;4>i;++i)s=(e=o[0+4*i]+3)+o[3+4*i],c=o[1+4*i]+o[2+4*i],l=o[1+4*i]-o[2+4*i],u=e-o[3+4*i],n[r+0]=s+c>>3,n[r+16]=u+l>>3,n[r+32]=s-c>>3,n[r+48]=u-l>>3,r+=64}function gt(e,t,n){var r,i=t-32,a=zr,o=255-e[i-1];for(r=0;r<n;++r){var s,c=a,l=o+e[t-1];for(s=0;s<n;++s)e[t+s]=c[l+e[i+s]];t+=32}}function _t(e,t){gt(e,t,4)}function vt(e,t){gt(e,t,8)}function yt(e,t){gt(e,t,16)}function bt(e,t){var n;for(n=0;16>n;++n)r(e,t+32*n,e,t-32,16)}function xt(e,t){var n;for(n=16;0<n;--n)i(e,t,e[t-1],16),t+=32}function St(e,t,n){var r;for(r=0;16>r;++r)i(t,n+32*r,e,16)}function Ct(e,t){var n,r=16;for(n=0;16>n;++n)r+=e[t-1+32*n]+e[t+n-32];St(r>>5,e,t)}function wt(e,t){var n,r=8;for(n=0;16>n;++n)r+=e[t-1+32*n];St(r>>4,e,t)}function Tt(e,t){var n,r=8;for(n=0;16>n;++n)r+=e[t+n-32];St(r>>4,e,t)}function Et(e,t){St(128,e,t)}function Dt(e,t,n){return e+2*t+n+2>>2}function Ot(e,t){var n,i=t-32;for(i=new Uint8Array([Dt(e[i-1],e[i+0],e[i+1]),Dt(e[i+0],e[i+1],e[i+2]),Dt(e[i+1],e[i+2],e[i+3]),Dt(e[i+2],e[i+3],e[i+4])]),n=0;4>n;++n)r(e,t+32*n,i,0,i.length)}function kt(e,t){var n=e[t-1],r=e[t-1+32],i=e[t-1+64],a=e[t-1+96];k(e,t+0,16843009*Dt(e[t-1-32],n,r)),k(e,t+32,16843009*Dt(n,r,i)),k(e,t+64,16843009*Dt(r,i,a)),k(e,t+96,16843009*Dt(i,a,a))}function At(e,t){var n,r=4;for(n=0;4>n;++n)r+=e[t+n-32]+e[t-1+32*n];for(r>>=3,n=0;4>n;++n)i(e,t+32*n,r,4)}function jt(e,t){var n=e[t-1+0],r=e[t-1+32],i=e[t-1+64],a=e[t-1-32],o=e[t+0-32],s=e[t+1-32],c=e[t+2-32],l=e[t+3-32];e[t+0+96]=Dt(r,i,e[t-1+96]),e[t+1+96]=e[t+0+64]=Dt(n,r,i),e[t+2+96]=e[t+1+64]=e[t+0+32]=Dt(a,n,r),e[t+3+96]=e[t+2+64]=e[t+1+32]=e[t+0+0]=Dt(o,a,n),e[t+3+64]=e[t+2+32]=e[t+1+0]=Dt(s,o,a),e[t+3+32]=e[t+2+0]=Dt(c,s,o),e[t+3+0]=Dt(l,c,s)}function Mt(e,t){var n=e[t+1-32],r=e[t+2-32],i=e[t+3-32],a=e[t+4-32],o=e[t+5-32],s=e[t+6-32],c=e[t+7-32];e[t+0+0]=Dt(e[t+0-32],n,r),e[t+1+0]=e[t+0+32]=Dt(n,r,i),e[t+2+0]=e[t+1+32]=e[t+0+64]=Dt(r,i,a),e[t+3+0]=e[t+2+32]=e[t+1+64]=e[t+0+96]=Dt(i,a,o),e[t+3+32]=e[t+2+64]=e[t+1+96]=Dt(a,o,s),e[t+3+64]=e[t+2+96]=Dt(o,s,c),e[t+3+96]=Dt(s,c,c)}function Nt(e,t){var n=e[t-1+0],r=e[t-1+32],i=e[t-1+64],a=e[t-1-32],o=e[t+0-32],s=e[t+1-32],c=e[t+2-32],l=e[t+3-32];e[t+0+0]=e[t+1+64]=a+o+1>>1,e[t+1+0]=e[t+2+64]=o+s+1>>1,e[t+2+0]=e[t+3+64]=s+c+1>>1,e[t+3+0]=c+l+1>>1,e[t+0+96]=Dt(i,r,n),e[t+0+64]=Dt(r,n,a),e[t+0+32]=e[t+1+96]=Dt(n,a,o),e[t+1+32]=e[t+2+96]=Dt(a,o,s),e[t+2+32]=e[t+3+96]=Dt(o,s,c),e[t+3+32]=Dt(s,c,l)}function Pt(e,t){var n=e[t+0-32],r=e[t+1-32],i=e[t+2-32],a=e[t+3-32],o=e[t+4-32],s=e[t+5-32],c=e[t+6-32],l=e[t+7-32];e[t+0+0]=n+r+1>>1,e[t+1+0]=e[t+0+64]=r+i+1>>1,e[t+2+0]=e[t+1+64]=i+a+1>>1,e[t+3+0]=e[t+2+64]=a+o+1>>1,e[t+0+32]=Dt(n,r,i),e[t+1+32]=e[t+0+96]=Dt(r,i,a),e[t+2+32]=e[t+1+96]=Dt(i,a,o),e[t+3+32]=e[t+2+96]=Dt(a,o,s),e[t+3+64]=Dt(o,s,c),e[t+3+96]=Dt(s,c,l)}function Ft(e,t){var n=e[t-1+0],r=e[t-1+32],i=e[t-1+64],a=e[t-1+96];e[t+0+0]=n+r+1>>1,e[t+2+0]=e[t+0+32]=r+i+1>>1,e[t+2+32]=e[t+0+64]=i+a+1>>1,e[t+1+0]=Dt(n,r,i),e[t+3+0]=e[t+1+32]=Dt(r,i,a),e[t+3+32]=e[t+1+64]=Dt(i,a,a),e[t+3+64]=e[t+2+64]=e[t+0+96]=e[t+1+96]=e[t+2+96]=e[t+3+96]=a}function It(e,t){var n=e[t-1+0],r=e[t-1+32],i=e[t-1+64],a=e[t-1+96],o=e[t-1-32],s=e[t+0-32],c=e[t+1-32],l=e[t+2-32];e[t+0+0]=e[t+2+32]=n+o+1>>1,e[t+0+32]=e[t+2+64]=r+n+1>>1,e[t+0+64]=e[t+2+96]=i+r+1>>1,e[t+0+96]=a+i+1>>1,e[t+3+0]=Dt(s,c,l),e[t+2+0]=Dt(o,s,c),e[t+1+0]=e[t+3+32]=Dt(n,o,s),e[t+1+32]=e[t+3+64]=Dt(r,n,o),e[t+1+64]=e[t+3+96]=Dt(i,r,n),e[t+1+96]=Dt(a,i,r)}function Lt(e,t){var n;for(n=0;8>n;++n)r(e,t+32*n,e,t-32,8)}function Rt(e,t){var n;for(n=0;8>n;++n)i(e,t,e[t-1],8),t+=32}function zt(e,t,n){var r;for(r=0;8>r;++r)i(t,n+32*r,e,8)}function Bt(e,t){var n,r=8;for(n=0;8>n;++n)r+=e[t+n-32]+e[t-1+32*n];zt(r>>4,e,t)}function Vt(e,t){var n,r=4;for(n=0;8>n;++n)r+=e[t+n-32];zt(r>>3,e,t)}function Ht(e,t){var n,r=4;for(n=0;8>n;++n)r+=e[t-1+32*n];zt(r>>3,e,t)}function Ut(e,t){zt(128,e,t)}function Wt(e,t,n){var r=e[t-n],i=e[t+0],a=3*(i-r)+Lr[1020+e[t-2*n]-e[t+n]],o=Rr[112+(a+4>>3)];e[t-n]=zr[255+r+Rr[112+(a+3>>3)]],e[t+0]=zr[255+i-o]}function Gt(e,t,n,r){var i=e[t+0],a=e[t+n];return Br[255+e[t-2*n]-e[t-n]]>r||Br[255+a-i]>r}function Kt(e,t,n,r){return 4*Br[255+e[t-n]-e[t+0]]+Br[255+e[t-2*n]-e[t+n]]<=r}function qt(e,t,n,r,i){var a=e[t-3*n],o=e[t-2*n],s=e[t-n],c=e[t+0],l=e[t+n],u=e[t+2*n],d=e[t+3*n];return 4*Br[255+s-c]+Br[255+o-l]>r?0:Br[255+e[t-4*n]-a]<=i&&Br[255+a-o]<=i&&Br[255+o-s]<=i&&Br[255+d-u]<=i&&Br[255+u-l]<=i&&Br[255+l-c]<=i}function Jt(e,t,n,r){var i=2*r+1;for(r=0;16>r;++r)Kt(e,t+r,n,i)&&Wt(e,t+r,n)}function Yt(e,t,n,r){var i=2*r+1;for(r=0;16>r;++r)Kt(e,t+r*n,1,i)&&Wt(e,t+r*n,1)}function Xt(e,t,n,r){var i;for(i=3;0<i;--i)Jt(e,t+=4*n,n,r)}function Zt(e,t,n,r){var i;for(i=3;0<i;--i)Yt(e,t+=4,n,r)}function Qt(e,t,n,r,i,a,o,s){for(a=2*a+1;0<i--;){if(qt(e,t,n,a,o))if(Gt(e,t,n,s))Wt(e,t,n);else{var c=e,l=t,u=n,d=c[l-2*u],f=c[l-u],p=c[l+0],m=c[l+u],h=c[l+2*u],g=27*(v=Lr[1020+3*(p-f)+Lr[1020+d-m]])+63>>7,_=18*v+63>>7,v=9*v+63>>7;c[l-3*u]=zr[255+c[l-3*u]+v],c[l-2*u]=zr[255+d+_],c[l-u]=zr[255+f+g],c[l+0]=zr[255+p-g],c[l+u]=zr[255+m-_],c[l+2*u]=zr[255+h-v]}t+=r}}function $t(e,t,n,r,i,a,o,s){for(a=2*a+1;0<i--;){if(qt(e,t,n,a,o))if(Gt(e,t,n,s))Wt(e,t,n);else{var c=e,l=t,u=n,d=c[l-u],f=c[l+0],p=c[l+u],m=Rr[112+(4+(h=3*(f-d))>>3)],h=Rr[112+(h+3>>3)],g=m+1>>1;c[l-2*u]=zr[255+c[l-2*u]+g],c[l-u]=zr[255+d+h],c[l+0]=zr[255+f-m],c[l+u]=zr[255+p-g]}t+=r}}function en(e,t,n,r,i,a){Qt(e,t,n,1,16,r,i,a)}function tn(e,t,n,r,i,a){Qt(e,t,1,n,16,r,i,a)}function nn(e,t,n,r,i,a){var o;for(o=3;0<o;--o)$t(e,t+=4*n,n,1,16,r,i,a)}function rn(e,t,n,r,i,a){var o;for(o=3;0<o;--o)$t(e,t+=4,1,n,16,r,i,a)}function an(e,t,n,r,i,a,o,s){Qt(e,t,i,1,8,a,o,s),Qt(n,r,i,1,8,a,o,s)}function on(e,t,n,r,i,a,o,s){Qt(e,t,1,i,8,a,o,s),Qt(n,r,1,i,8,a,o,s)}function sn(e,t,n,r,i,a,o,s){$t(e,t+4*i,i,1,8,a,o,s),$t(n,r+4*i,i,1,8,a,o,s)}function cn(e,t,n,r,i,a,o,s){$t(e,t+4,1,i,8,a,o,s),$t(n,r+4,1,i,8,a,o,s)}function ln(){this.ba=new he,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new _e,this.memory=0,this.Ib=`OutputFunc`,this.Jb=`OutputAlphaFunc`,this.Nd=`OutputRowFunc`}function un(){this.data=[],this.offset=this.kd=this.ha=this.w=0,this.na=[],this.xa=this.gb=this.Ja=this.Sa=this.P=0}function dn(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function fn(){this.ua=0,this.Wa=new F,this.vb=new F,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new p,this.yc=new d}function pn(){this.xb=this.a=0,this.l=new $e,this.ca=new he,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new x,this.Pb=0,this.wd=new x,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new fn,this.ab=0,this.gc=o(4,dn),this.Oc=0}function mn(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new $e,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function hn(e,t,n,r,i,a,o){for(e=e==null?0:e[t+0],t=0;t<o;++t)i[a+t]=e+n[r+t]&255,e=i[a+t]}function gn(e,t,n,r,i,a,o){var s;if(e==null)hn(null,null,n,r,i,a,o);else for(s=0;s<o;++s)i[a+s]=e[t+s]+n[r+s]&255}function _n(e,t,n,r,i,a,o){if(e==null)hn(null,null,n,r,i,a,o);else{var s,c=e[t+0],l=c,u=c;for(s=0;s<o;++s)l=u+(c=e[t+s])-l,u=n[r+s]+(-256&l?0>l?0:255:l)&255,l=c,i[a+s]=u}}function vn(e,n,i,o){var s=n.width,c=n.o;if(t(e!=null&&n!=null),0>i||0>=o||i+o>c)return null;if(!e.Cc){if(e.ga==null){var l;if(e.ga=new mn,(l=e.ga==null)||(l=n.width*n.o,t(e.Gb.length==0),e.Gb=a(l),e.Uc=0,e.Gb==null?l=0:(e.mb=e.Gb,e.nb=e.Uc,e.rc=null,l=1),l=!l),!l){l=e.ga;var u=e.Fa,d=e.P,f=e.qc,p=e.mb,m=e.nb,h=d+1,g=f-1,v=l.l;if(t(u!=null&&p!=null&&n!=null),vi[0]=null,vi[1]=hn,vi[2]=gn,vi[3]=_n,l.ca=p,l.tb=m,l.c=n.width,l.i=n.height,t(0<l.c&&0<l.i),1>=f)n=0;else if(l.$a=3&u[d+0],l.Z=u[d+0]>>2&3,l.Lc=u[d+0]>>4&3,d=u[d+0]>>6&3,0>l.$a||1<l.$a||4<=l.Z||1<l.Lc||d)n=0;else if(v.put=Se,v.ac=xe,v.bc=Ce,v.ma=l,v.width=n.width,v.height=n.height,v.Da=n.Da,v.v=n.v,v.va=n.va,v.j=n.j,v.o=n.o,l.$a)t:{t(l.$a==1),n=Le();e:for(;;){if(n==null){n=0;break t}if(t(l!=null),l.mc=n,n.c=l.c,n.i=l.i,n.l=l.l,n.l.ma=l,n.l.width=l.c,n.l.height=l.i,n.a=0,_(n.m,u,h,g),!Re(l.c,l.i,1,n,null)||(n.ab==1&&n.gc[0].hc==3&&Me(n.s)?(l.ic=1,u=n.c*n.i,n.Ta=null,n.Ua=0,n.V=a(u),n.Ba=0,n.V==null?(n.a=1,n=0):n=1):(l.ic=0,n=ze(n,l.c)),!n))break e;n=1;break t}l.mc=null,n=0}else n=g>=l.c*l.i;l=!n}if(l)return null;e.ga.Lc==1?o=c-i:e.Ga=0}t(e.ga!=null),t(i+o<=c);t:{if(n=(u=e.ga).c,c=u.l.o,u.$a==0){if(h=e.rc,g=e.Vc,v=e.Fa,d=e.P+1+i*n,f=e.mb,p=e.nb+i*n,t(d<=e.P+e.qc),u.Z!=0)for(t(vi[u.Z]!=null),l=0;l<o;++l)vi[u.Z](h,g,v,d,f,p,n),h=f,g=p,p+=n,d+=n;else for(l=0;l<o;++l)r(f,p,v,d,n),h=f,g=p,p+=n,d+=n;e.rc=h,e.Vc=g}else{if(t(u.mc!=null),n=i+o,t((l=u.mc)!=null),t(n<=l.i),l.C>=n)n=1;else if(u.ic||Cn(),u.ic){u=l.V,h=l.Ba,g=l.c;var y=l.i,b=(v=1,d=l.$/g,f=l.$%g,p=l.m,m=l.s,l.$),x=g*y,S=g*n,w=m.wc,E=b<S?ke(m,f,d):null;t(b<=x),t(n<=y),t(Me(m));e:for(;;){for(;!p.h&&b<S;){if(f&w||(E=ke(m,f,d)),t(E!=null),T(p),256>(y=De(E.G[0],E.H[0],p)))u[h+b]=y,++b,++f>=g&&(f=0,++d<=n&&!(d%16)&&Pe(l,d));else{if(!(280>y)){v=0;break e}y=Te(y-256,p);var D,O=De(E.G[4],E.H[4],p);if(T(p),!(b>=(O=Ee(g,O=Te(O,p)))&&x-b>=y)){v=0;break e}for(D=0;D<y;++D)u[h+b+D]=u[h+b+D-O];for(b+=y,f+=y;f>=g;)f-=g,++d<=n&&!(d%16)&&Pe(l,d);b<S&&f&w&&(E=ke(m,f,d))}t(p.h==C(p))}Pe(l,d>n?n:d);break e}!v||p.h&&b<x?(v=0,l.a=p.h?5:3):l.$=b,n=v}else n=Fe(l,l.V,l.Ba,l.c,l.i,n,G);if(!n){o=0;break t}}i+o>=c&&(e.Cc=1),o=1}if(!o)return null;if(e.Cc&&((o=e.ga)!=null&&(o.mc=null),e.ga=null,0<e.Ga))return alert(`todo:WebPDequantizeLevels`),null}return e.nb+i*s}function yn(e,t,n,r,i,a){for(;0<i--;){var o,s=e,c=t+ +!!n,l=e,u=t+(n?0:3);for(o=0;o<r;++o){var d=l[u+4*o];d!=255&&(d*=32897,s[c+4*o+0]=s[c+4*o+0]*d>>23,s[c+4*o+1]=s[c+4*o+1]*d>>23,s[c+4*o+2]=s[c+4*o+2]*d>>23)}t+=a}}function bn(e,t,n,r,i){for(;0<r--;){var a;for(a=0;a<n;++a){var o=e[t+2*a+0],s=15&(l=e[t+2*a+1]),c=4369*s,l=(240&l|l>>4)*c>>16;e[t+2*a+0]=(240&o|o>>4)*c>>16&240|(15&o|o<<4)*c>>16>>4&15,e[t+2*a+1]=240&l|s}t+=i}}function xn(e,t,n,r,i,a,o,s){var c,l,u=255;for(l=0;l<i;++l){for(c=0;c<r;++c){var d=e[t+c];a[o+4*c]=d,u&=d}t+=n,o+=s}return u!=255}function Sn(e,t,n,r,i){var a;for(a=0;a<i;++a)n[r+a]=e[t+a]>>8}function Cn(){Or=yn,kr=bn,Ar=xn,jr=Sn}function wn(n,r,i){e[n]=function(e,n,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y){var b,x=y-1>>1,S=s[c+0]|l[u+0]<<16,C=d[f+0]|p[m+0]<<16;t(e!=null);var w=3*S+C+131074>>2;for(r(e[n+0],255&w,w>>16,h,g),a!=null&&(w=3*C+S+131074>>2,r(a[o+0],255&w,w>>16,_,v)),b=1;b<=x;++b){var T=s[c+b]|l[u+b]<<16,E=d[f+b]|p[m+b]<<16,D=S+T+C+E+524296,O=D+2*(T+C)>>3;w=O+S>>1,S=(D=D+2*(S+E)>>3)+T>>1,r(e[n+2*b-1],255&w,w>>16,h,g+(2*b-1)*i),r(e[n+2*b-0],255&S,S>>16,h,g+(2*b-0)*i),a!=null&&(w=D+C>>1,S=O+E>>1,r(a[o+2*b-1],255&w,w>>16,_,v+(2*b-1)*i),r(a[o+2*b+0],255&S,S>>16,_,v+(2*b+0)*i)),S=T,C=E}1&y||(w=3*S+C+131074>>2,r(e[n+y-1],255&w,w>>16,h,g+(y-1)*i),a!=null&&(w=3*C+S+131074>>2,r(a[o+y-1],255&w,w>>16,_,v+(y-1)*i)))}}function Tn(){yi[Vr]=bi,yi[Hr]=Si,yi[Ur]=xi,yi[Wr]=Ci,yi[Gr]=wi,yi[Kr]=Ti,yi[qr]=Ei,yi[J]=Si,yi[Y]=Ci,yi[Jr]=wi,yi[Yr]=Ti}function En(e){return e&~Mi?0>e?0:255:e>>ji}function Dn(e,t){return En((19077*e>>8)+(26149*t>>8)-14234)}function On(e,t,n){return En((19077*e>>8)-(6419*t>>8)-(13320*n>>8)+8708)}function kn(e,t){return En((19077*e>>8)+(33050*t>>8)-17685)}function An(e,t,n,r,i){r[i+0]=Dn(e,n),r[i+1]=On(e,t,n),r[i+2]=kn(e,t)}function jn(e,t,n,r,i){r[i+0]=kn(e,t),r[i+1]=On(e,t,n),r[i+2]=Dn(e,n)}function Mn(e,t,n,r,i){var a=On(e,t,n);t=a<<3&224|kn(e,t)>>3,r[i+0]=248&Dn(e,n)|a>>5,r[i+1]=t}function Nn(e,t,n,r,i){var a=240&kn(e,t)|15;r[i+0]=240&Dn(e,n)|On(e,t,n)>>4,r[i+1]=a}function Pn(e,t,n,r,i){r[i+0]=255,An(e,t,n,r,i+1)}function Fn(e,t,n,r,i){jn(e,t,n,r,i),r[i+3]=255}function In(e,t,n,r,i){An(e,t,n,r,i),r[i+3]=255}function Ln(t,n,r){e[t]=function(e,t,i,a,o,s,c,l,u){for(var d=l+(-2&u)*r;l!=d;)n(e[t+0],i[a+0],o[s+0],c,l),n(e[t+1],i[a+0],o[s+0],c,l+r),t+=2,++a,++s,l+=2*r;1&u&&n(e[t+0],i[a+0],o[s+0],c,l)}}function Rn(e,t,n){return n==0?e==0?t==0?6:5:t==0?4:0:n}function zn(e,t,n,r,i){switch(e>>>30){case 3:dr(t,n,r,i,0);break;case 2:fr(t,n,r,i);break;case 1:mr(t,n,r,i)}}function Bn(e,t){var n,a,o=t.M,s=t.Nb,c=e.oc,l=e.pc+40,u=e.oc,d=e.pc+584,f=e.oc,p=e.pc+600;for(n=0;16>n;++n)c[l+32*n-1]=129;for(n=0;8>n;++n)u[d+32*n-1]=129,f[p+32*n-1]=129;for(0<o?c[l-1-32]=u[d-1-32]=f[p-1-32]=129:(i(c,l-32-1,127,21),i(u,d-32-1,127,9),i(f,p-32-1,127,9)),a=0;a<e.za;++a){var m=t.ya[t.aa+a];if(0<a){for(n=-1;16>n;++n)r(c,l+32*n-4,c,l+32*n+12,4);for(n=-1;8>n;++n)r(u,d+32*n-4,u,d+32*n+4,4),r(f,p+32*n-4,f,p+32*n+4,4)}var h=e.Gd,g=e.Hd+a,_=m.ad,v=m.Hc;if(0<o&&(r(c,l-32,h[g].y,0,16),r(u,d-32,h[g].f,0,8),r(f,p-32,h[g].ea,0,8)),m.Za){var y=c,b=l-32+16;for(0<o&&(a>=e.za-1?i(y,b,h[g].y[15],4):r(y,b,h[g+1].y,0,4)),n=0;4>n;n++)y[b+128+n]=y[b+256+n]=y[b+384+n]=y[b+0+n];for(n=0;16>n;++n,v<<=2)y=c,b=l+Bi[n],mi[m.Ob[n]](y,b),zn(v,_,16*n,y,b)}else if(y=Rn(a,o,m.Ob[0]),pi[y](c,l),v!=0)for(n=0;16>n;++n,v<<=2)zn(v,_,16*n,c,l+Bi[n]);for(n=m.Gc,y=Rn(a,o,m.Dd),hi[y](u,d),hi[y](f,p),v=_,y=u,b=d,255&(m=0|n)&&(170&m?pr(v,256,y,b):hr(v,256,y,b)),m=f,v=p,255&(n>>=8)&&(170&n?pr(_,320,m,v):hr(_,320,m,v)),o<e.Ub-1&&(r(h[g].y,0,c,l+480,16),r(h[g].f,0,u,d+224,8),r(h[g].ea,0,f,p+224,8)),n=8*s*e.B,h=e.sa,g=e.ta+16*a+16*s*e.R,_=e.qa,m=e.ra+8*a+n,v=e.Ha,y=e.Ia+8*a+n,n=0;16>n;++n)r(h,g+n*e.R,c,l+32*n,16);for(n=0;8>n;++n)r(_,m+n*e.B,u,d+32*n,8),r(v,y+n*e.B,f,p+32*n,8)}}function Vn(e,r,i,a,o,s,c,l,u){var d=[0],f=[0],p=0,m=u==null?0:u.kd,h=u??new un;if(e==null||12>i)return 7;h.data=e,h.w=r,h.ha=i,r=[r],i=[i],h.gb=[h.gb];t:{var g=r,v=i,y=h.gb;if(t(e!=null),t(v!=null),t(y!=null),y[0]=0,12<=v[0]&&!n(e,g[0],`RIFF`)){if(n(e,g[0]+8,`WEBP`)){y=3;break t}var b=M(e,g[0]+4);if(12>b||4294967286<b){y=3;break t}if(m&&b>v[0]-8){y=7;break t}y[0]=b,g[0]+=12,v[0]-=12}y=0}if(y!=0)return y;for(b=0<h.gb[0],i=i[0];;){t:{var S=e;v=r,y=i;var C=d,w=f,T=g=[0];if((O=p=[p])[0]=0,8>y[0])y=7;else{if(!n(S,v[0],`VP8X`)){if(M(S,v[0]+4)!=10){y=3;break t}if(18>y[0]){y=7;break t}var E=M(S,v[0]+8),D=1+j(S,v[0]+12);if(2147483648<=D*(S=1+j(S,v[0]+15))){y=3;break t}T!=null&&(T[0]=E),C!=null&&(C[0]=D),w!=null&&(w[0]=S),v[0]+=18,y[0]-=18,O[0]=1}y=0}}if(p=p[0],g=g[0],y!=0)return y;if(v=!!(2&g),!b&&p)return 3;if(s!=null&&(s[0]=!!(16&g)),c!=null&&(c[0]=v),l!=null&&(l[0]=0),c=d[0],g=f[0],p&&v&&u==null){y=0;break}if(4>i){y=7;break}if(b&&p||!b&&!p&&!n(e,r[0],`ALPH`)){i=[i],h.na=[h.na],h.P=[h.P],h.Sa=[h.Sa];t:{E=e,y=r,b=i;var O=h.gb;C=h.na,w=h.P,T=h.Sa,D=22,t(E!=null),t(b!=null),S=y[0];var k=b[0];for(t(C!=null),t(T!=null),C[0]=null,w[0]=null,T[0]=0;;){if(y[0]=S,b[0]=k,8>k){y=7;break t}var A=M(E,S+4);if(4294967286<A){y=3;break t}var N=8+A+1&-2;if(D+=N,0<O&&D>O){y=3;break t}if(!n(E,S,`VP8 `)||!n(E,S,`VP8L`)){y=0;break t}if(k[0]<N){y=7;break t}n(E,S,`ALPH`)||(C[0]=E,w[0]=S+8,T[0]=A),S+=N,k-=N}}if(i=i[0],h.na=h.na[0],h.P=h.P[0],h.Sa=h.Sa[0],y!=0)break}i=[i],h.Ja=[h.Ja],h.xa=[h.xa];t:if(O=e,y=r,b=i,C=h.gb[0],w=h.Ja,T=h.xa,E=y[0],S=!n(O,E,`VP8 `),D=!n(O,E,`VP8L`),t(O!=null),t(b!=null),t(w!=null),t(T!=null),8>b[0])y=7;else{if(S||D){if(O=M(O,E+4),12<=C&&O>C-12){y=3;break t}if(m&&O>b[0]-8){y=7;break t}w[0]=O,y[0]+=8,b[0]-=8,T[0]=D}else T[0]=5<=b[0]&&O[E+0]==47&&!(O[E+4]>>5),w[0]=b[0];y=0}if(i=i[0],h.Ja=h.Ja[0],h.xa=h.xa[0],r=r[0],y!=0)break;if(4294967286<h.Ja)return 3;if(l==null||v||(l[0]=h.xa?2:1),c=[c],g=[g],h.xa){if(5>i){y=7;break}l=c,m=g,v=s,e==null||5>i?e=0:5<=i&&e[r+0]==47&&!(e[r+4]>>5)?(b=[0],O=[0],C=[0],_(w=new x,e,r,i),we(w,b,O,C)?(l!=null&&(l[0]=b[0]),m!=null&&(m[0]=O[0]),v!=null&&(v[0]=C[0]),e=1):e=0):e=0}else{if(10>i){y=7;break}l=g,e==null||10>i||!nt(e,r+3,i-3)?e=0:(m=e[r+0]|e[r+1]<<8|e[r+2]<<16,v=16383&(e[r+7]<<8|e[r+6]),e=16383&(e[r+9]<<8|e[r+8]),1&m||3<(m>>1&7)||!(m>>4&1)||m>>5>=h.Ja||!v||!e?e=0:(c&&(c[0]=v),l&&(l[0]=e),e=1))}if(!e||(c=c[0],g=g[0],p&&(d[0]!=c||f[0]!=g)))return 3;u!=null&&(u[0]=h,u.offset=r-u.w,t(4294967286>r-u.w),t(u.offset==u.ha-i));break}return y==0||y==7&&p&&u==null?(s!=null&&(s[0]|=h.na!=null&&0<h.na.length),a!=null&&(a[0]=c),o!=null&&(o[0]=g),0):y}function Hn(e,t,n){var r=t.width,i=t.height,a=0,o=0,s=r,c=i;if(t.Da=e!=null&&0<e.Da,t.Da&&(s=e.cd,c=e.bd,a=e.v,o=e.j,11>n||(a&=-2,o&=-2),0>a||0>o||0>=s||0>=c||a+s>r||o+c>i))return 0;if(t.v=a,t.j=o,t.va=a+s,t.o=o+c,t.U=s,t.T=c,t.da=e!=null&&0<e.da,t.da){if(!I(s,c,n=[e.ib],a=[e.hb]))return 0;t.ib=n[0],t.hb=a[0]}return t.ob=e!=null&&e.ob,t.Kb=e==null||!e.Sd,t.da&&(t.ob=t.ib<3*r/4&&t.hb<3*i/4,t.Kb=0),1}function Un(e){if(e==null)return 2;if(11>e.S){var t=e.f.RGBA;t.fb+=(e.height-1)*t.A,t.A=-t.A}else t=e.f.kb,e=e.height,t.O+=(e-1)*t.fa,t.fa=-t.fa,t.N+=(e-1>>1)*t.Ab,t.Ab=-t.Ab,t.W+=(e-1>>1)*t.Db,t.Db=-t.Db,t.F!=null&&(t.J+=(e-1)*t.lb,t.lb=-t.lb);return 0}function Wn(e,t,n,r){if(r==null||0>=e||0>=t)return 2;if(n!=null){if(n.Da){var i=n.cd,o=n.bd,s=-2&n.v,c=-2&n.j;if(0>s||0>c||0>=i||0>=o||s+i>e||c+o>t)return 2;e=i,t=o}if(n.da){if(!I(e,t,i=[n.ib],o=[n.hb]))return 2;e=i[0],t=o[0]}}r.width=e,r.height=t;t:{var l=r.width,u=r.height;if(e=r.S,0>=l||0>=u||!(e>=Vr&&13>e))e=2;else{if(0>=r.Rd&&r.sd==null){s=o=i=t=0;var d=(c=l*Wi[e])*u;if(11>e||(o=(u+1)/2*(t=(l+1)/2),e==12&&(s=(i=l)*u)),(u=a(d+2*o+s))==null){e=1;break t}r.sd=u,11>e?((l=r.f.RGBA).eb=u,l.fb=0,l.A=c,l.size=d):((l=r.f.kb).y=u,l.O=0,l.fa=c,l.Fd=d,l.f=u,l.N=0+d,l.Ab=t,l.Cd=o,l.ea=u,l.W=0+d+o,l.Db=t,l.Ed=o,e==12&&(l.F=u,l.J=0+d+2*o),l.Tc=s,l.lb=i)}if(t=1,i=r.S,o=r.width,s=r.height,i>=Vr&&13>i)if(11>i)e=r.f.RGBA,t&=(c=Math.abs(e.A))*(s-1)+o<=e.size,t&=c>=o*Wi[i],t&=e.eb!=null;else{e=r.f.kb,c=(o+1)/2,d=(s+1)/2,l=Math.abs(e.fa),u=Math.abs(e.Ab);var f=Math.abs(e.Db),p=Math.abs(e.lb),m=p*(s-1)+o;t&=l*(s-1)+o<=e.Fd,t&=u*(d-1)+c<=e.Cd,t=(t&=f*(d-1)+c<=e.Ed)&l>=o&u>=c&f>=c,t&=e.y!=null,t&=e.f!=null,t&=e.ea!=null,i==12&&(t&=p>=o,t&=m<=e.Tc,t&=e.F!=null)}else t=0;e=t?0:2}}return e!=0||n!=null&&n.fd&&(e=Un(r)),e}var Gn=64,Kn=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215],qn=24,Jn=32,Yn=8,q=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7];z(`Predictor0`,`PredictorAdd0`),e.Predictor0=function(){return 4278190080},e.Predictor1=function(e){return e},e.Predictor2=function(e,t,n){return t[n+0]},e.Predictor3=function(e,t,n){return t[n+1]},e.Predictor4=function(e,t,n){return t[n-1]},e.Predictor5=function(e,t,n){return V(V(e,t[n+1]),t[n+0])},e.Predictor6=function(e,t,n){return V(e,t[n-1])},e.Predictor7=function(e,t,n){return V(e,t[n+0])},e.Predictor8=function(e,t,n){return V(t[n-1],t[n+0])},e.Predictor9=function(e,t,n){return V(t[n+0],t[n+1])},e.Predictor10=function(e,t,n){return V(V(e,t[n-1]),V(t[n+0],t[n+1]))},e.Predictor11=function(e,t,n){var r=t[n+0];return 0>=H(r>>24&255,e>>24&255,(t=t[n-1])>>24&255)+H(r>>16&255,e>>16&255,t>>16&255)+H(r>>8&255,e>>8&255,t>>8&255)+H(255&r,255&e,255&t)?r:e},e.Predictor12=function(e,t,n){var r=t[n+0];return(ee((e>>24&255)+(r>>24&255)-((t=t[n-1])>>24&255))<<24|ee((e>>16&255)+(r>>16&255)-(t>>16&255))<<16|ee((e>>8&255)+(r>>8&255)-(t>>8&255))<<8|ee((255&e)+(255&r)-(255&t)))>>>0},e.Predictor13=function(e,t,n){var r=t[n-1];return(te((e=V(e,t[n+0]))>>24&255,r>>24&255)<<24|te(e>>16&255,r>>16&255)<<16|te(e>>8&255,r>>8&255)<<8|te(255&e,255&r))>>>0};var Xn=e.PredictorAdd0;e.PredictorAdd1=ne,z(`Predictor2`,`PredictorAdd2`),z(`Predictor3`,`PredictorAdd3`),z(`Predictor4`,`PredictorAdd4`),z(`Predictor5`,`PredictorAdd5`),z(`Predictor6`,`PredictorAdd6`),z(`Predictor7`,`PredictorAdd7`),z(`Predictor8`,`PredictorAdd8`),z(`Predictor9`,`PredictorAdd9`),z(`Predictor10`,`PredictorAdd10`),z(`Predictor11`,`PredictorAdd11`),z(`Predictor12`,`PredictorAdd12`),z(`Predictor13`,`PredictorAdd13`);var Zn=e.PredictorAdd2;ae(`ColorIndexInverseTransform`,`MapARGB`,`32b`,function(e){return e>>8&255},function(e){return e}),ae(`VP8LColorIndexInverseTransformAlpha`,`MapAlpha`,`8b`,function(e){return e},function(e){return e>>8&255});var Qn,$n=e.ColorIndexInverseTransform,er=e.MapARGB,tr=e.VP8LColorIndexInverseTransformAlpha,nr=e.MapAlpha,rr=e.VP8LPredictorsAdd=[];rr.length=16,(e.VP8LPredictors=[]).length=16,(e.VP8LPredictorsAdd_C=[]).length=16,(e.VP8LPredictors_C=[]).length=16;var ir,ar,or,sr,cr,lr,ur,dr,fr,pr,mr,hr,gr,_r,vr,yr,br,xr,Sr,Cr,wr,Tr,Er,Dr,Or,kr,Ar,jr,Mr=a(511),Nr=a(2041),Pr=a(225),Fr=a(767),Ir=0,Lr=Nr,Rr=Pr,zr=Fr,Br=Mr,Vr=0,Hr=1,Ur=2,Wr=3,Gr=4,Kr=5,qr=6,J=7,Y=8,Jr=9,Yr=10,Xr=[2,3,7],Zr=[3,3,11],Qr=[280,256,256,256,40],$r=[0,1,1,1,0],ei=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],ti=[24,7,23,25,40,6,39,41,22,26,38,42,56,5,55,57,21,27,54,58,37,43,72,4,71,73,20,28,53,59,70,74,36,44,88,69,75,52,60,3,87,89,19,29,86,90,35,45,68,76,85,91,51,61,104,2,103,105,18,30,102,106,34,46,84,92,67,77,101,107,50,62,120,1,119,121,83,93,17,31,100,108,66,78,118,122,33,47,117,123,49,63,99,109,82,94,0,116,124,65,79,16,32,98,110,48,115,125,81,95,64,114,126,97,111,80,113,127,96,112],ni=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],ri=8,ii=[4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157],ai=[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284],oi=null,X=[[173,148,140,0],[176,155,140,135,0],[180,157,141,134,130,0],[254,254,243,230,196,177,153,140,133,130,129,0]],si=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],ci=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],li=[[[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]],[[253,136,254,255,228,219,128,128,128,128,128],[189,129,242,255,227,213,255,219,128,128,128],[106,126,227,252,214,209,255,255,128,128,128]],[[1,98,248,255,236,226,255,255,128,128,128],[181,133,238,254,221,234,255,154,128,128,128],[78,134,202,247,198,180,255,219,128,128,128]],[[1,185,249,255,243,255,128,128,128,128,128],[184,150,247,255,236,224,128,128,128,128,128],[77,110,216,255,236,230,128,128,128,128,128]],[[1,101,251,255,241,255,128,128,128,128,128],[170,139,241,252,236,209,255,255,128,128,128],[37,116,196,243,228,255,255,255,128,128,128]],[[1,204,254,255,245,255,128,128,128,128,128],[207,160,250,255,238,128,128,128,128,128,128],[102,103,231,255,211,171,128,128,128,128,128]],[[1,152,252,255,240,255,128,128,128,128,128],[177,135,243,255,234,225,128,128,128,128,128],[80,129,211,255,194,224,128,128,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[246,1,255,128,128,128,128,128,128,128,128],[255,128,128,128,128,128,128,128,128,128,128]]],[[[198,35,237,223,193,187,162,160,145,155,62],[131,45,198,221,172,176,220,157,252,221,1],[68,47,146,208,149,167,221,162,255,223,128]],[[1,149,241,255,221,224,255,255,128,128,128],[184,141,234,253,222,220,255,199,128,128,128],[81,99,181,242,176,190,249,202,255,255,128]],[[1,129,232,253,214,197,242,196,255,255,128],[99,121,210,250,201,198,255,202,128,128,128],[23,91,163,242,170,187,247,210,255,255,128]],[[1,200,246,255,234,255,128,128,128,128,128],[109,178,241,255,231,245,255,255,128,128,128],[44,130,201,253,205,192,255,255,128,128,128]],[[1,132,239,251,219,209,255,165,128,128,128],[94,136,225,251,218,190,255,255,128,128,128],[22,100,174,245,186,161,255,199,128,128,128]],[[1,182,249,255,232,235,128,128,128,128,128],[124,143,241,255,227,234,128,128,128,128,128],[35,77,181,251,193,211,255,205,128,128,128]],[[1,157,247,255,236,231,255,255,128,128,128],[121,141,235,255,225,227,255,255,128,128,128],[45,99,188,251,195,217,255,224,128,128,128]],[[1,1,251,255,213,255,128,128,128,128,128],[203,1,248,255,255,128,128,128,128,128,128],[137,1,177,255,224,255,128,128,128,128,128]]],[[[253,9,248,251,207,208,255,192,128,128,128],[175,13,224,243,193,185,249,198,255,255,128],[73,17,171,221,161,179,236,167,255,234,128]],[[1,95,247,253,212,183,255,255,128,128,128],[239,90,244,250,211,209,255,255,128,128,128],[155,77,195,248,188,195,255,255,128,128,128]],[[1,24,239,251,218,219,255,205,128,128,128],[201,51,219,255,196,186,128,128,128,128,128],[69,46,190,239,201,218,255,228,128,128,128]],[[1,191,251,255,255,128,128,128,128,128,128],[223,165,249,255,213,255,128,128,128,128,128],[141,124,248,255,255,128,128,128,128,128,128]],[[1,16,248,255,255,128,128,128,128,128,128],[190,36,230,255,236,255,128,128,128,128,128],[149,1,255,128,128,128,128,128,128,128,128]],[[1,226,255,128,128,128,128,128,128,128,128],[247,192,255,128,128,128,128,128,128,128,128],[240,128,255,128,128,128,128,128,128,128,128]],[[1,134,252,255,255,128,128,128,128,128,128],[213,62,250,255,255,128,128,128,128,128,128],[55,93,255,128,128,128,128,128,128,128,128]],[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]]],[[[202,24,213,235,186,191,220,160,240,175,255],[126,38,182,232,169,184,228,174,255,187,128],[61,46,138,219,151,178,240,170,255,216,128]],[[1,112,230,250,199,191,247,159,255,255,128],[166,109,228,252,211,215,255,174,128,128,128],[39,77,162,232,172,180,245,178,255,255,128]],[[1,52,220,246,198,199,249,220,255,255,128],[124,74,191,243,183,193,250,221,255,255,128],[24,71,130,219,154,170,243,182,255,255,128]],[[1,182,225,249,219,240,255,224,128,128,128],[149,150,226,252,216,205,255,171,128,128,128],[28,108,170,242,183,194,254,223,255,255,128]],[[1,81,230,252,204,203,255,192,128,128,128],[123,102,209,247,188,196,255,233,128,128,128],[20,95,153,243,164,173,255,203,128,128,128]],[[1,222,248,255,216,213,128,128,128,128,128],[168,175,246,252,235,205,255,255,128,128,128],[47,116,215,255,211,212,255,255,128,128,128]],[[1,121,236,253,212,214,255,255,128,128,128],[141,84,213,252,201,202,255,219,128,128,128],[42,80,160,240,162,185,255,205,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[244,1,255,128,128,128,128,128,128,128,128],[238,1,255,128,128,128,128,128,128,128,128]]]],ui=[[[231,120,48,89,115,113,120,152,112],[152,179,64,126,170,118,46,70,95],[175,69,143,80,85,82,72,155,103],[56,58,10,171,218,189,17,13,152],[114,26,17,163,44,195,21,10,173],[121,24,80,195,26,62,44,64,85],[144,71,10,38,171,213,144,34,26],[170,46,55,19,136,160,33,206,71],[63,20,8,114,114,208,12,9,226],[81,40,11,96,182,84,29,16,36]],[[134,183,89,137,98,101,106,165,148],[72,187,100,130,157,111,32,75,80],[66,102,167,99,74,62,40,234,128],[41,53,9,178,241,141,26,8,107],[74,43,26,146,73,166,49,23,157],[65,38,105,160,51,52,31,115,128],[104,79,12,27,217,255,87,17,7],[87,68,71,44,114,51,15,186,23],[47,41,14,110,182,183,21,17,194],[66,45,25,102,197,189,23,18,22]],[[88,88,147,150,42,46,45,196,205],[43,97,183,117,85,38,35,179,61],[39,53,200,87,26,21,43,232,171],[56,34,51,104,114,102,29,93,77],[39,28,85,171,58,165,90,98,64],[34,22,116,206,23,34,43,166,73],[107,54,32,26,51,1,81,43,31],[68,25,106,22,64,171,36,225,114],[34,19,21,102,132,188,16,76,124],[62,18,78,95,85,57,50,48,51]],[[193,101,35,159,215,111,89,46,111],[60,148,31,172,219,228,21,18,111],[112,113,77,85,179,255,38,120,114],[40,42,1,196,245,209,10,25,109],[88,43,29,140,166,213,37,43,154],[61,63,30,155,67,45,68,1,209],[100,80,8,43,154,1,51,26,71],[142,78,78,16,255,128,34,197,171],[41,40,5,102,211,183,4,1,221],[51,50,17,168,209,192,23,25,82]],[[138,31,36,171,27,166,38,44,229],[67,87,58,169,82,115,26,59,179],[63,59,90,180,59,166,93,73,154],[40,40,21,116,143,209,34,39,175],[47,15,16,183,34,223,49,45,183],[46,17,33,183,6,98,15,32,183],[57,46,22,24,128,1,54,17,37],[65,32,73,115,28,128,23,128,205],[40,3,9,115,51,192,18,6,223],[87,37,9,115,59,77,64,21,47]],[[104,55,44,218,9,54,53,130,226],[64,90,70,205,40,41,23,26,57],[54,57,112,184,5,41,38,166,213],[30,34,26,133,152,116,10,32,134],[39,19,53,221,26,114,32,73,255],[31,9,65,234,2,15,1,118,73],[75,32,12,51,192,255,160,43,51],[88,31,35,67,102,85,55,186,85],[56,21,23,111,59,205,45,37,192],[55,38,70,124,73,102,1,34,98]],[[125,98,42,88,104,85,117,175,82],[95,84,53,89,128,100,113,101,45],[75,79,123,47,51,128,81,171,1],[57,17,5,71,102,57,53,41,49],[38,33,13,121,57,73,26,1,85],[41,10,67,138,77,110,90,47,114],[115,21,2,10,102,255,166,23,6],[101,29,16,10,85,128,101,196,26],[57,18,10,102,102,213,34,20,43],[117,20,15,36,163,128,68,1,26]],[[102,61,71,37,34,53,31,243,192],[69,60,71,38,73,119,28,222,37],[68,45,128,34,1,47,11,245,171],[62,17,19,70,146,85,55,62,70],[37,43,37,154,100,163,85,160,1],[63,9,92,136,28,64,32,201,85],[75,15,9,9,64,255,184,119,16],[86,6,28,5,64,255,25,248,1],[56,8,17,132,137,255,55,116,128],[58,15,20,82,135,57,26,121,40]],[[164,50,31,137,154,133,25,35,218],[51,103,44,131,131,123,31,6,158],[86,40,64,135,148,224,45,183,128],[22,26,17,131,240,154,14,1,209],[45,16,21,91,64,222,7,1,197],[56,21,39,155,60,138,23,102,213],[83,12,13,54,192,255,68,47,28],[85,26,85,85,128,128,32,146,171],[18,11,7,63,144,171,4,4,246],[35,27,10,146,174,171,12,26,128]],[[190,80,35,99,180,80,126,54,45],[85,126,47,87,176,51,41,20,32],[101,75,128,139,118,146,116,128,85],[56,41,15,176,236,85,37,9,62],[71,30,17,119,118,255,17,18,138],[101,38,60,138,55,70,43,26,142],[146,36,19,30,171,255,97,27,20],[138,45,61,62,219,1,81,188,64],[32,41,20,117,151,142,20,21,163],[112,19,12,61,195,128,48,4,24]]],di=[[[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[176,246,255,255,255,255,255,255,255,255,255],[223,241,252,255,255,255,255,255,255,255,255],[249,253,253,255,255,255,255,255,255,255,255]],[[255,244,252,255,255,255,255,255,255,255,255],[234,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255]],[[255,246,254,255,255,255,255,255,255,255,255],[239,253,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[251,255,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[251,254,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,254,253,255,254,255,255,255,255,255,255],[250,255,254,255,254,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[217,255,255,255,255,255,255,255,255,255,255],[225,252,241,253,255,255,254,255,255,255,255],[234,250,241,250,253,255,253,254,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[223,254,254,255,255,255,255,255,255,255,255],[238,253,254,254,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[249,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,255,255,255,255,255,255,255,255,255],[247,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[252,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[186,251,250,255,255,255,255,255,255,255,255],[234,251,244,254,255,255,255,255,255,255,255],[251,251,243,253,254,255,254,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[236,253,254,255,255,255,255,255,255,255,255],[251,253,253,254,254,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[254,254,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[254,254,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[248,255,255,255,255,255,255,255,255,255,255],[250,254,252,254,255,255,255,255,255,255,255],[248,254,249,253,255,255,255,255,255,255,255]],[[255,253,253,255,255,255,255,255,255,255,255],[246,253,253,255,255,255,255,255,255,255,255],[252,254,251,254,254,255,255,255,255,255,255]],[[255,254,252,255,255,255,255,255,255,255,255],[248,254,253,255,255,255,255,255,255,255,255],[253,255,254,254,255,255,255,255,255,255,255]],[[255,251,254,255,255,255,255,255,255,255,255],[245,251,254,255,255,255,255,255,255,255,255],[253,253,254,255,255,255,255,255,255,255,255]],[[255,251,253,255,255,255,255,255,255,255,255],[252,253,254,255,255,255,255,255,255,255,255],[255,254,255,255,255,255,255,255,255,255,255]],[[255,252,255,255,255,255,255,255,255,255,255],[249,255,254,255,255,255,255,255,255,255,255],[255,255,254,255,255,255,255,255,255,255,255]],[[255,255,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]]],fi=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],pi=[],mi=[],hi=[],gi=1,_i=2,vi=[],yi=[];wn(`UpsampleRgbLinePair`,An,3),wn(`UpsampleBgrLinePair`,jn,3),wn(`UpsampleRgbaLinePair`,In,4),wn(`UpsampleBgraLinePair`,Fn,4),wn(`UpsampleArgbLinePair`,Pn,4),wn(`UpsampleRgba4444LinePair`,Nn,2),wn(`UpsampleRgb565LinePair`,Mn,2);var bi=e.UpsampleRgbLinePair,xi=e.UpsampleBgrLinePair,Si=e.UpsampleRgbaLinePair,Ci=e.UpsampleBgraLinePair,wi=e.UpsampleArgbLinePair,Ti=e.UpsampleRgba4444LinePair,Ei=e.UpsampleRgb565LinePair,Di=16,Oi=1<<Di-1,ki=-227,Ai=482,ji=6,Mi=(256<<ji)-1,Ni=0,Pi=a(256),Fi=a(256),Ii=a(256),Li=a(256),Ri=a(Ai-ki),zi=a(Ai-ki);Ln(`YuvToRgbRow`,An,3),Ln(`YuvToBgrRow`,jn,3),Ln(`YuvToRgbaRow`,In,4),Ln(`YuvToBgraRow`,Fn,4),Ln(`YuvToArgbRow`,Pn,4),Ln(`YuvToRgba4444Row`,Nn,2),Ln(`YuvToRgb565Row`,Mn,2);var Bi=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],Vi=[0,2,8],Hi=[8,7,6,4,4,2,2,2,1,1,1,1],Ui=1;this.WebPDecodeRGBA=function(e,n,s,c,l){var u=Hr,d=new ln,f=new he;d.ba=f,f.S=u,f.width=[f.width],f.height=[f.height];var p=f.width,m=f.height,h=new ge;if(h==null||e==null)var g=2;else t(h!=null),g=Vn(e,n,s,h.width,h.height,h.Pd,h.Qd,h.format,null);if(g==0?(p!=null&&(p[0]=h.width[0]),m!=null&&(m[0]=h.height[0]),p=1):p=0,p){f.width=f.width[0],f.height=f.height[0],c!=null&&(c[0]=f.width),l!=null&&(l[0]=f.height);t:{if(c=new $e,(l=new un).data=e,l.w=n,l.ha=s,l.kd=1,n=[0],t(l!=null),((e=Vn(l.data,l.w,l.ha,null,null,null,n,null,l))==0||e==7)&&n[0]&&(e=4),(n=e)==0){if(t(d!=null),c.data=l.data,c.w=l.w+l.offset,c.ha=l.ha-l.offset,c.put=Se,c.ac=xe,c.bc=Ce,c.ma=d,l.xa){if((e=Le())==null){d=1;break t}if(function(e,n){var r=[0],i=[0],a=[0];e:for(;;){if(e==null)return 0;if(n==null)return e.a=2,0;if(e.l=n,e.a=0,_(e.m,n.data,n.w,n.ha),!we(e.m,r,i,a)){e.a=3;break e}if(e.xb=_i,n.width=r[0],n.height=i[0],!Re(r[0],i[0],1,e,null))break e;return 1}return t(e.a!=0),0}(e,c)){if(c=(n=Wn(c.width,c.height,d.Oa,d.ba))==0){e:{c=e;r:for(;;){if(c==null){c=0;break e}if(t(c.s.yc!=null),t(c.s.Ya!=null),t(0<c.s.Wb),t((s=c.l)!=null),t((l=s.ma)!=null),c.xb!=0){if(c.ca=l.ba,c.tb=l.tb,t(c.ca!=null),!Hn(l.Oa,s,Wr)){c.a=2;break r}if(!ze(c,s.width)||s.da)break r;if((s.da||fe(c.ca.S))&&Cn(),11>c.ca.S||(alert(`todo:WebPInitConvertARGBToYUV`),c.ca.f.kb.F!=null&&Cn()),c.Pb&&0<c.s.ua&&c.s.vb.X==null&&!N(c.s.vb,c.s.Wa.Xa)){c.a=1;break r}c.xb=0}if(!Fe(c,c.V,c.Ba,c.c,c.i,s.o,je))break r;l.Dc=c.Ma,c=1;break e}t(c.a!=0),c=0}c=!c}c&&(n=e.a)}else n=e.a}else{if((e=new et)==null){d=1;break t}if(e.Fa=l.na,e.P=l.P,e.qc=l.Sa,rt(e,c)){if((n=Wn(c.width,c.height,d.Oa,d.ba))==0){if(e.Aa=0,s=d.Oa,t((l=e)!=null),s!=null){if(0<(p=0>(p=s.Md)?0:100<p?255:255*p/100)){for(m=h=0;4>m;++m)12>(g=l.pb[m]).lc&&(g.ia=p*Hi[0>g.lc?0:g.lc]>>3),h|=g.ia;h&&(alert(`todo:VP8InitRandom`),l.ia=1)}l.Ga=s.Id,100<l.Ga?l.Ga=100:0>l.Ga&&(l.Ga=0)}(function(e,n){if(e==null)return 0;if(n==null)return tt(e,2,`NULL VP8Io parameter in VP8Decode().`);if(!e.cb&&!rt(e,n))return 0;if(t(e.cb),n.ac==null||n.ac(n)){n.ob&&(e.L=0);var s=Vi[e.L];if(e.L==2?(e.yb=0,e.zb=0):(e.yb=n.v-s>>4,e.zb=n.j-s>>4,0>e.yb&&(e.yb=0),0>e.zb&&(e.zb=0)),e.Va=n.o+15+s>>4,e.Hb=n.va+15+s>>4,e.Hb>e.za&&(e.Hb=e.za),e.Va>e.Ub&&(e.Va=e.Ub),0<e.L){var c=e.ed;for(s=0;4>s;++s){var l;if(e.Qa.Cb){var u=e.Qa.Lb[s];e.Qa.Fb||(u+=c.Tb)}else u=c.Tb;for(l=0;1>=l;++l){var d=e.gd[s][l],f=u;if(c.Pc&&(f+=c.vd[0],l&&(f+=c.od[0])),0<(f=0>f?0:63<f?63:f)){var p=f;0<c.wb&&(p=4<c.wb?p>>2:p>>1)>9-c.wb&&(p=9-c.wb),1>p&&(p=1),d.dd=p,d.tc=2*f+p,d.ld=40<=f?2:+(15<=f)}else d.tc=0;d.La=l}}}s=0}else tt(e,6,`Frame setup failed`),s=e.a;if(s=s==0){if(s){e.$c=0,0<e.Aa||(e.Ic=Ui);e:{s=e.Ic,c=4*(p=e.za);var m=32*p,h=p+1,g=0<e.L?p*(0<e.Aa?2:1):0,_=(e.Aa==2?2:1)*p;if((d=c+832+(l=3*(16*s+Vi[e.L])/2*m)+(u=e.Fa!=null&&0<e.Fa.length?e.Kc.c*e.Kc.i:0))!=d)s=0;else{if(d>e.Vb){if(e.Vb=0,e.Ec=a(d),e.Fc=0,e.Ec==null){s=tt(e,1,`no memory during frame initialization.`);break e}e.Vb=d}d=e.Ec,f=e.Fc,e.Ac=d,e.Bc=f,f+=c,e.Gd=o(m,Xe),e.Hd=0,e.rb=o(h+1,Ke),e.sb=1,e.wa=g?o(g,K):null,e.Y=0,e.D.Nb=0,e.D.wa=e.wa,e.D.Y=e.Y,0<e.Aa&&(e.D.Y+=p),t(!0),e.oc=d,e.pc=f,f+=832,e.ya=o(_,Je),e.aa=0,e.D.ya=e.ya,e.D.aa=e.aa,e.Aa==2&&(e.D.aa+=p),e.R=16*p,e.B=8*p,p=(m=Vi[e.L])*e.R,m=m/2*e.B,e.sa=d,e.ta=f+p,e.qa=e.sa,e.ra=e.ta+16*s*e.R+m,e.Ha=e.qa,e.Ia=e.ra+8*s*e.B+m,e.$c=0,f+=l,e.mb=u?d:null,e.nb=u?f:null,t(f+u<=e.Fc+e.Vb),at(e),i(e.Ac,e.Bc,0,c),s=1}}if(s){if(n.ka=0,n.y=e.sa,n.O=e.ta,n.f=e.qa,n.N=e.ra,n.ea=e.Ha,n.Vd=e.Ia,n.fa=e.R,n.Rc=e.B,n.F=null,n.J=0,!Ir){for(s=-255;255>=s;++s)Mr[255+s]=0>s?-s:s;for(s=-1020;1020>=s;++s)Nr[1020+s]=-128>s?-128:127<s?127:s;for(s=-112;112>=s;++s)Pr[112+s]=-16>s?-16:15<s?15:s;for(s=-255;510>=s;++s)Fr[255+s]=0>s?0:255<s?255:s;Ir=1}ur=ht,dr=dt,pr=ft,mr=pt,hr=mt,fr=ut,gr=en,_r=tn,vr=an,yr=on,br=nn,xr=rn,Sr=sn,Cr=cn,wr=Jt,Tr=Yt,Er=Xt,Dr=Zt,mi[0]=At,mi[1]=_t,mi[2]=Ot,mi[3]=kt,mi[4]=jt,mi[5]=Nt,mi[6]=Mt,mi[7]=Pt,mi[8]=It,mi[9]=Ft,pi[0]=Ct,pi[1]=yt,pi[2]=bt,pi[3]=xt,pi[4]=wt,pi[5]=Tt,pi[6]=Et,hi[0]=Bt,hi[1]=vt,hi[2]=Lt,hi[3]=Rt,hi[4]=Ht,hi[5]=Vt,hi[6]=Ut,s=1}else s=0}s&&=function(e,n){for(e.M=0;e.M<e.Va;++e.M){var o,s=e.Jc[e.M&e.Xb],c=e.m,l=e;for(o=0;o<l.za;++o){var u=c,d=l,f=d.Ac,p=d.Bc+4*o,m=d.zc,h=d.ya[d.aa+o];if(d.Qa.Bb?h.$b=O(u,d.Pa.jb[0])?2+O(u,d.Pa.jb[2]):O(u,d.Pa.jb[1]):h.$b=0,d.kc&&(h.Ad=O(u,d.Bd)),h.Za=!O(u,145)+0,h.Za){var g=h.Ob,_=0;for(d=0;4>d;++d){var v,y=m[0+d];for(v=0;4>v;++v){y=ui[f[p+v]][y];for(var b=ci[O(u,y[0])];0<b;)b=ci[2*b+O(u,y[b])];y=-b,f[p+v]=y}r(g,_,f,p,4),_+=4,m[0+d]=y}}else y=O(u,156)?O(u,128)?1:3:O(u,163)?2:0,h.Ob[0]=y,i(f,p,y,4),i(m,0,y,4);h.Dd=O(u,142)?O(u,114)?O(u,183)?1:3:2:0}if(l.m.Ka)return tt(e,7,`Premature end-of-partition0 encountered.`);for(;e.ja<e.za;++e.ja){if(l=s,u=(c=e).rb[c.sb-1],f=c.rb[c.sb+c.ja],o=c.ya[c.aa+c.ja],p=c.kc?o.Ad:0)u.la=f.la=0,o.Za||(u.Na=f.Na=0),o.Hc=0,o.Gc=0,o.ia=0;else{var x,S;if(u=f,f=l,p=c.Pa.Xc,m=c.ya[c.aa+c.ja],h=c.pb[m.$b],d=m.ad,g=0,_=c.rb[c.sb-1],y=v=0,i(d,g,0,384),m.Za)var C=0,w=p[3];else{b=a(16);var T=u.Na+_.Na;if(T=oi(f,p[1],T,h.Eb,0,b,0),u.Na=_.Na=(0<T)+0,1<T)ur(b,0,d,g);else{var E=b[0]+3>>3;for(b=0;256>b;b+=16)d[g+b]=E}C=1,w=p[0]}var D=15&u.la,k=15&_.la;for(b=0;4>b;++b){var A=1&k;for(E=S=0;4>E;++E)D=D>>1|(A=(T=oi(f,w,T=A+(1&D),h.Sc,C,d,g))>C)<<7,S=S<<2|(3<T?3:1<T?2:d[g+0]!=0),g+=16;D>>=4,k=k>>1|A<<7,v=(v<<8|S)>>>0}for(w=D,C=k>>4,x=0;4>x;x+=2){for(S=0,D=u.la>>4+x,k=_.la>>4+x,b=0;2>b;++b){for(A=1&k,E=0;2>E;++E)T=A+(1&D),D=D>>1|(A=0<(T=oi(f,p[2],T,h.Qc,0,d,g)))<<3,S=S<<2|(3<T?3:1<T?2:d[g+0]!=0),g+=16;D>>=2,k=k>>1|A<<5}y|=S<<4*x,w|=D<<4<<x,C|=(240&k)<<x}u.la=w,_.la=C,m.Hc=v,m.Gc=y,m.ia=43690&y?0:h.ia,p=!(v|y)}if(0<c.L&&(c.wa[c.Y+c.ja]=c.gd[o.$b][o.Za],c.wa[c.Y+c.ja].La|=!p),l.Ka)return tt(e,7,`Premature end-of-file encountered.`)}if(at(e),c=n,l=1,o=(s=e).D,u=0<s.L&&s.M>=s.zb&&s.M<=s.Va,s.Aa==0)e:{if(o.M=s.M,o.uc=u,Bn(s,o),l=1,o=(S=s.D).Nb,u=(y=Vi[s.L])*s.R,f=y/2*s.B,b=16*o*s.R,E=8*o*s.B,p=s.sa,m=s.ta-u+b,h=s.qa,d=s.ra-f+E,g=s.Ha,_=s.Ia-f+E,k=(D=S.M)==0,v=D>=s.Va-1,s.Aa==2&&Bn(s,S),S.uc)for(A=(T=s).D.M,t(T.D.uc),S=T.yb;S<T.Hb;++S){C=S,w=A;var j=(M=(V=T).D).Nb;x=V.R;var M=M.wa[M.Y+C],N=V.sa,P=V.ta+16*j*x+16*C,F=M.dd,I=M.tc;if(I!=0)if(t(3<=I),V.L==1)0<C&&Tr(N,P,x,I+4),M.La&&Dr(N,P,x,I),0<w&&wr(N,P,x,I+4),M.La&&Er(N,P,x,I);else{var L=V.B,R=V.qa,z=V.ra+8*j*L+8*C,B=V.Ha,V=V.Ia+8*j*L+8*C;j=M.ld,0<C&&(_r(N,P,x,I+4,F,j),yr(R,z,B,V,L,I+4,F,j)),M.La&&(xr(N,P,x,I,F,j),Cr(R,z,B,V,L,I,F,j)),0<w&&(gr(N,P,x,I+4,F,j),vr(R,z,B,V,L,I+4,F,j)),M.La&&(br(N,P,x,I,F,j),Sr(R,z,B,V,L,I,F,j))}}if(s.ia&&alert(`todo:DitherRow`),c.put!=null){if(S=16*D,D=16*(D+1),k?(c.y=s.sa,c.O=s.ta+b,c.f=s.qa,c.N=s.ra+E,c.ea=s.Ha,c.W=s.Ia+E):(S-=y,c.y=p,c.O=m,c.f=h,c.N=d,c.ea=g,c.W=_),v||(D-=y),D>c.o&&(D=c.o),c.F=null,c.J=null,s.Fa!=null&&0<s.Fa.length&&S<D&&(c.J=vn(s,c,S,D-S),c.F=s.mb,c.F==null&&c.F.length==0)){l=tt(s,3,`Could not decode alpha data.`);break e}S<c.j&&(y=c.j-S,S=c.j,t(!(1&y)),c.O+=s.R*y,c.N+=s.B*(y>>1),c.W+=s.B*(y>>1),c.F!=null&&(c.J+=c.width*y)),S<D&&(c.O+=c.v,c.N+=c.v>>1,c.W+=c.v>>1,c.F!=null&&(c.J+=c.v),c.ka=S-c.j,c.U=c.va-c.v,c.T=D-S,l=c.put(c))}o+1!=s.Ic||v||(r(s.sa,s.ta-u,p,m+16*s.R,u),r(s.qa,s.ra-f,h,d+8*s.B,f),r(s.Ha,s.Ia-f,g,_+8*s.B,f))}if(!l)return tt(e,6,`Output aborted.`)}return 1}(e,n),n.bc!=null&&n.bc(n),s&=1}return s?(e.cb=0,s):0})(e,c)||(n=e.a)}}else n=e.a}n==0&&d.Oa!=null&&d.Oa.fd&&(n=Un(d.ba))}d=n}u=d==0?11>u?f.f.RGBA.eb:f.f.kb.y:null}else u=null;return u};var Wi=[3,4,3,4,4,2,2,4,4,4,2,1,1]};function l(e,t){for(var n=``,r=0;r<4;r++)n+=String.fromCharCode(e[t++]);return n}function u(e,t){return e[t+0]|e[t+1]<<8}function d(e,t){return(e[t+0]|e[t+1]<<8|e[t+2]<<16)>>>0}function f(e,t){return(e[t+0]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}new c;var p=[0],m=[0],h=[],g=new c,_=e,v=function(e,t){var n={},r=0,i=!1,a=0,o=0;if(n.frames=[],!function(e,t){for(var n=0;n<4;n++)if(e[t+n]!=`RIFF`.charCodeAt(n))return!0;return!1}(e,t)){for(f(e,t+=4),t+=8;t<e.length;){var s=l(e,t),c=f(e,t+=4);t+=4;var p=c+(1&c);switch(s){case`VP8 `:case`VP8L`:n.frames[r]===void 0&&(n.frames[r]={}),(g=n.frames[r]).src_off=i?o:t-8,g.src_size=a+c+8,r++,i&&(i=!1,a=0,o=0);break;case`VP8X`:(g=n.header={}).feature_flags=e[t];var m=t+4;g.canvas_width=1+d(e,m),m+=3,g.canvas_height=1+d(e,m),m+=3;break;case`ALPH`:i=!0,a=p+8,o=t-8;break;case`ANIM`:(g=n.header).bgcolor=f(e,t),m=t+4,g.loop_count=u(e,m),m+=2;break;case`ANMF`:var h,g;(g=n.frames[r]={}).offset_x=2*d(e,t),t+=3,g.offset_y=2*d(e,t),t+=3,g.width=1+d(e,t),t+=3,g.height=1+d(e,t),t+=3,g.duration=d(e,t),t+=3,h=e[t++],g.dispose=1&h,g.blend=h>>1&1}s!=`ANMF`&&(t+=p)}return n}}(_,0);v.response=_,v.rgbaoutput=!0,v.dataurl=!1;var y=v.header?v.header:null,b=v.frames?v.frames:null;if(y){y.loop_counter=y.loop_count,p=[y.canvas_height],m=[y.canvas_width];for(var x=0;x<b.length&&b[x].blend!=0;x++);}var S=b[0],C=g.WebPDecodeRGBA(_,S.src_off,S.src_size,m,p);S.rgba=C,S.imgwidth=m[0],S.imgheight=p[0];for(var w=0;w<m[0]*p[0]*4;w++)h[w]=C[w];return this.width=m,this.height=p,this.data=h,this}function oz(){var e,t=this.internal.__metadata__.metadata,n=unescape(encodeURIComponent(t));e=this.internal.__metadata__.rawXml?n:`<x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:jspdf="`+this.internal.__metadata__.namespaceUri+`"><jspdf:metadata>`+n.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)+`</jspdf:metadata></rdf:Description></rdf:RDF></x:xmpmeta>`,this.internal.__metadata__.metadataObjectNumber=this.internal.newObject(),this.internal.write(`<< /Type /Metadata /Subtype /XML /Length `+e.length+` >>`),this.internal.write(`stream`),this.internal.write(e),this.internal.write(`endstream`),this.internal.write(`endobj`)}function sz(){this.internal.__metadata__.metadataObjectNumber&&this.internal.write(`/Metadata `+this.internal.__metadata__.metadataObjectNumber+` 0 R`)}(function(e){var t,n,r,i,a,o,s,c,l,u=function(e){return e||={},this.isStrokeTransparent=e.isStrokeTransparent||!1,this.strokeOpacity=e.strokeOpacity||1,this.strokeStyle=e.strokeStyle||`#000000`,this.fillStyle=e.fillStyle||`#000000`,this.isFillTransparent=e.isFillTransparent||!1,this.fillOpacity=e.fillOpacity||1,this.font=e.font||`10px sans-serif`,this.textBaseline=e.textBaseline||`alphabetic`,this.textAlign=e.textAlign||`left`,this.lineWidth=e.lineWidth||1,this.lineJoin=e.lineJoin||`miter`,this.lineCap=e.lineCap||`butt`,this.path=e.path||[],this.transform=e.transform===void 0?new c:e.transform.clone(),this.globalCompositeOperation=e.globalCompositeOperation||`normal`,this.globalAlpha=e.globalAlpha||1,this.clip_path=e.clip_path||[],this.currentPoint=e.currentPoint||new o,this.miterLimit=e.miterLimit||10,this.lastPoint=e.lastPoint||new o,this.lineDashOffset=e.lineDashOffset||0,this.lineDash=e.lineDash||[],this.margin=e.margin||[0,0,0,0],this.prevPageLastElemOffset=e.prevPageLastElemOffset||0,this.ignoreClearRect=typeof e.ignoreClearRect!=`boolean`||e.ignoreClearRect,this};e.events.push([`initialized`,function(){this.context2d=new d(this),t=this.internal.f2,n=this.internal.getCoordinateString,r=this.internal.getVerticalCoordinateString,i=this.internal.getHorizontalCoordinate,a=this.internal.getVerticalCoordinate,o=this.internal.Point,s=this.internal.Rectangle,c=this.internal.Matrix,l=new u}]);var d=function(e){Object.defineProperty(this,"canvas",{get:function(){return{parentNode:!1,style:!1}}});var t=e;Object.defineProperty(this,"pdf",{get:function(){return t}});var n=!1;Object.defineProperty(this,"pageWrapXEnabled",{get:function(){return n},set:function(e){n=!!e}});var r=!1;Object.defineProperty(this,"pageWrapYEnabled",{get:function(){return r},set:function(e){r=!!e}});var i=0;Object.defineProperty(this,"posX",{get:function(){return i},set:function(e){isNaN(e)||(i=e)}});var a=0;Object.defineProperty(this,"posY",{get:function(){return a},set:function(e){isNaN(e)||(a=e)}}),Object.defineProperty(this,"margin",{get:function(){return l.margin},set:function(e){var t;typeof e==`number`?t=[e,e,e,e]:((t=[,,,,])[0]=e[0],t[1]=e.length>=2?e[1]:t[0],t[2]=e.length>=3?e[2]:t[0],t[3]=e.length>=4?e[3]:t[1]),l.margin=t}});var o=!1;Object.defineProperty(this,"autoPaging",{get:function(){return o},set:function(e){o=e}});var s=0;Object.defineProperty(this,"lastBreak",{get:function(){return s},set:function(e){s=e}});var c=[];Object.defineProperty(this,"pageBreaks",{get:function(){return c},set:function(e){c=e}}),Object.defineProperty(this,"ctx",{get:function(){return l},set:function(e){e instanceof u&&(l=e)}}),Object.defineProperty(this,"path",{get:function(){return l.path},set:function(e){l.path=e}});var d=[];Object.defineProperty(this,"ctxStack",{get:function(){return d},set:function(e){d=e}}),Object.defineProperty(this,"fillStyle",{get:function(){return this.ctx.fillStyle},set:function(e){var t=f(e);this.ctx.fillStyle=t.style,this.ctx.isFillTransparent=t.a===0,this.ctx.fillOpacity=t.a,this.pdf.setFillColor(t.r,t.g,t.b,{a:t.a}),this.pdf.setTextColor(t.r,t.g,t.b,{a:t.a})}}),Object.defineProperty(this,"strokeStyle",{get:function(){return this.ctx.strokeStyle},set:function(e){var t=f(e);this.ctx.strokeStyle=t.style,this.ctx.isStrokeTransparent=t.a===0,this.ctx.strokeOpacity=t.a,t.a===0?this.pdf.setDrawColor(255,255,255):(t.a,this.pdf.setDrawColor(t.r,t.g,t.b))}}),Object.defineProperty(this,"lineCap",{get:function(){return this.ctx.lineCap},set:function(e){[`butt`,`round`,`square`].indexOf(e)!==-1&&(this.ctx.lineCap=e,this.pdf.setLineCap(e))}}),Object.defineProperty(this,"lineWidth",{get:function(){return this.ctx.lineWidth},set:function(e){isNaN(e)||(this.ctx.lineWidth=e,this.pdf.setLineWidth(e))}}),Object.defineProperty(this,"lineJoin",{get:function(){return this.ctx.lineJoin},set:function(e){[`bevel`,`round`,`miter`].indexOf(e)!==-1&&(this.ctx.lineJoin=e,this.pdf.setLineJoin(e))}}),Object.defineProperty(this,"miterLimit",{get:function(){return this.ctx.miterLimit},set:function(e){isNaN(e)||(this.ctx.miterLimit=e,this.pdf.setMiterLimit(e))}}),Object.defineProperty(this,"textBaseline",{get:function(){return this.ctx.textBaseline},set:function(e){this.ctx.textBaseline=e}}),Object.defineProperty(this,"textAlign",{get:function(){return this.ctx.textAlign},set:function(e){[`right`,`end`,`center`,`left`,`start`].indexOf(e)!==-1&&(this.ctx.textAlign=e)}});var p=null,m=null,h=null;Object.defineProperty(this,"fontFaces",{get:function(){return h},set:function(e){p=null,m=null,h=e}}),Object.defineProperty(this,"font",{get:function(){return this.ctx.font},set:function(e){var t;if(this.ctx.font=e,(t=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-_,\"\'\sa-z0-9]+?)\s*$/i.exec(e))!==null){var n=t[1];t[2];var r=t[3],i=t[4];t[5];var a=t[6],o=/^([.\d]+)((?:%|in|[cem]m|ex|p[ctx]))$/i.exec(i)[2];i=Math.floor(o===`px`?parseFloat(i)*this.pdf.internal.scaleFactor:o===`em`?parseFloat(i)*this.pdf.getFontSize():parseFloat(i)*this.pdf.internal.scaleFactor),this.pdf.setFontSize(i);var s=function(e){var t,n,r=[],i=e.trim();if(i===``)return UR;if(i in NR)return[NR[i]];for(;i!==``;){switch(n=null,t=(i=FR(i)).charAt(0)){case`"`:case`'`:n=IR(i.substring(1),t);break;default:n=LR(i)}if(n===null||(r.push(n[0]),(i=FR(n[1]))!==``&&i.charAt(0)!==`,`))return UR;i=i.replace(/^,/,``)}return r}(a);if(this.fontFaces){var c=function(e,t,n){for(var r=(n||={}).defaultFontFamily||`times`,i=Object.assign({},MR,n.genericFontFamilies||{}),a=null,o=null,s=0;s<t.length;++s)if(i[(a=AR(t[s])).family]&&(a.family=i[a.family]),e.hasOwnProperty(a.family)){o=e[a.family];break}if(!(o||=e[r]))throw Error(`Could not find a font-family for the rule '`+PR(a)+`' and default family '`+r+`'.`);if(o=function(e,t){if(t[e])return t[e];var n=DR[e],r=jR(t,ER,n,n<=DR.normal?-1:1);if(!r)throw Error(`Could not find a matching font-stretch value for `+e);return r}(a.stretch,o),o=function(e,t){if(t[e])return t[e];for(var n=TR[e],r=0;r<n.length;++r)if(t[n[r]])return t[n[r]];throw Error(`Could not find a matching font-style for `+e)}(a.style,o),!(o=function(e,t){if(t[e])return t[e];if(e===400&&t[500])return t[500];if(e===500&&t[400])return t[400];var n=kR[e],r=jR(t,OR,n,e<400?-1:1);if(!r)throw Error(`Could not find a matching font-weight for value `+e);return r}(a.weight,o)))throw Error(`Failed to resolve a font for the rule '`+PR(a)+`'.`);return o}(function(e,t){var n=e.getFontList(),r=JSON.stringify(n);return(p===null||m!==r)&&(p=function(e){for(var t={},n=0;n<e.length;++n){var r=AR(e[n]),i=r.family,a=r.stretch,o=r.style,s=r.weight;t[i]=t[i]||{},t[i][a]=t[i][a]||{},t[i][a][o]=t[i][a][o]||{},t[i][a][o][s]=r}return t}(function(e){var t=[];return Object.keys(e).forEach(function(n){e[n].forEach(function(e){var r=null;switch(e){case`bold`:r={family:n,weight:`bold`};break;case`italic`:r={family:n,style:`italic`};break;case`bolditalic`:r={family:n,weight:`bold`,style:`italic`};break;case``:case`normal`:r={family:n}}r!==null&&(r.ref={name:n,style:e},t.push(r))})}),t}(n).concat(t)),m=r),p}(this.pdf,this.fontFaces),s.map(function(e){return{family:e,stretch:`normal`,weight:r,style:n}}));this.pdf.setFont(c.ref.name,c.ref.style)}else{var l=``;(r===`bold`||parseInt(r,10)>=700||n===`bold`)&&(l=`bold`),n===`italic`&&(l+=`italic`),l.length===0&&(l=`normal`);for(var u=``,d={arial:`Helvetica`,Arial:`Helvetica`,verdana:`Helvetica`,Verdana:`Helvetica`,helvetica:`Helvetica`,Helvetica:`Helvetica`,"sans-serif":`Helvetica`,fixed:`Courier`,monospace:`Courier`,terminal:`Courier`,cursive:`Times`,fantasy:`Times`,serif:`Times`},f=0;f<s.length;f++){if(this.pdf.internal.getFont(s[f],l,{noFallback:!0,disableWarning:!0})!==void 0){u=s[f];break}if(l===`bolditalic`&&this.pdf.internal.getFont(s[f],`bold`,{noFallback:!0,disableWarning:!0})!==void 0)u=s[f],l=`bold`;else if(this.pdf.internal.getFont(s[f],`normal`,{noFallback:!0,disableWarning:!0})!==void 0){u=s[f],l=`normal`;break}}if(u===``){for(var h=0;h<s.length;h++)if(d[s[h]]){u=d[s[h]];break}}u=u===``?`Times`:u,this.pdf.setFont(u,l)}}}}),Object.defineProperty(this,"globalCompositeOperation",{get:function(){return this.ctx.globalCompositeOperation},set:function(e){this.ctx.globalCompositeOperation=e}}),Object.defineProperty(this,"globalAlpha",{get:function(){return this.ctx.globalAlpha},set:function(e){this.ctx.globalAlpha=e}}),Object.defineProperty(this,"lineDashOffset",{get:function(){return this.ctx.lineDashOffset},set:function(e){this.ctx.lineDashOffset=e,L.call(this)}}),Object.defineProperty(this,"lineDash",{get:function(){return this.ctx.lineDash},set:function(e){this.ctx.lineDash=e,L.call(this)}}),Object.defineProperty(this,"ignoreClearRect",{get:function(){return this.ctx.ignoreClearRect},set:function(e){this.ctx.ignoreClearRect=!!e}})};d.prototype.setLineDash=function(e){this.lineDash=e},d.prototype.getLineDash=function(){return this.lineDash.length%2?this.lineDash.concat(this.lineDash):this.lineDash.slice()},d.prototype.fill=function(){b.call(this,`fill`,!1)},d.prototype.stroke=function(){b.call(this,`stroke`,!1)},d.prototype.beginPath=function(){this.path=[{type:`begin`}]},d.prototype.moveTo=function(e,t){if(isNaN(e)||isNaN(t))throw iL.error(`jsPDF.context2d.moveTo: Invalid arguments`,arguments),Error(`Invalid arguments passed to jsPDF.context2d.moveTo`);var n=this.ctx.transform.applyToPoint(new o(e,t));this.path.push({type:`mt`,x:n.x,y:n.y}),this.ctx.lastPoint=new o(e,t)},d.prototype.closePath=function(){var e=new o(0,0),t=0;for(t=this.path.length-1;t!==-1;t--)if(this.path[t].type===`begin`&&Oi(this.path[t+1])===`object`&&typeof this.path[t+1].x==`number`){e=new o(this.path[t+1].x,this.path[t+1].y);break}this.path.push({type:`close`}),this.ctx.lastPoint=new o(e.x,e.y)},d.prototype.lineTo=function(e,t){if(isNaN(e)||isNaN(t))throw iL.error(`jsPDF.context2d.lineTo: Invalid arguments`,arguments),Error(`Invalid arguments passed to jsPDF.context2d.lineTo`);var n=this.ctx.transform.applyToPoint(new o(e,t));this.path.push({type:`lt`,x:n.x,y:n.y}),this.ctx.lastPoint=new o(n.x,n.y)},d.prototype.clip=function(){this.ctx.clip_path=JSON.parse(JSON.stringify(this.path)),b.call(this,null,!0)},d.prototype.quadraticCurveTo=function(e,t,n,r){if(isNaN(n)||isNaN(r)||isNaN(e)||isNaN(t))throw iL.error(`jsPDF.context2d.quadraticCurveTo: Invalid arguments`,arguments),Error(`Invalid arguments passed to jsPDF.context2d.quadraticCurveTo`);var i=this.ctx.transform.applyToPoint(new o(n,r)),a=this.ctx.transform.applyToPoint(new o(e,t));this.path.push({type:`qct`,x1:a.x,y1:a.y,x:i.x,y:i.y}),this.ctx.lastPoint=new o(i.x,i.y)},d.prototype.bezierCurveTo=function(e,t,n,r,i,a){if(isNaN(i)||isNaN(a)||isNaN(e)||isNaN(t)||isNaN(n)||isNaN(r))throw iL.error(`jsPDF.context2d.bezierCurveTo: Invalid arguments`,arguments),Error(`Invalid arguments passed to jsPDF.context2d.bezierCurveTo`);var s=this.ctx.transform.applyToPoint(new o(i,a)),c=this.ctx.transform.applyToPoint(new o(e,t)),l=this.ctx.transform.applyToPoint(new o(n,r));this.path.push({type:`bct`,x1:c.x,y1:c.y,x2:l.x,y2:l.y,x:s.x,y:s.y}),this.ctx.lastPoint=new o(s.x,s.y)},d.prototype.arc=function(e,t,n,r,i,a){if(isNaN(e)||isNaN(t)||isNaN(n)||isNaN(r)||isNaN(i))throw iL.error(`jsPDF.context2d.arc: Invalid arguments`,arguments),Error(`Invalid arguments passed to jsPDF.context2d.arc`);if(a=!!a,!this.ctx.transform.isIdentity){var s=this.ctx.transform.applyToPoint(new o(e,t));e=s.x,t=s.y;var c=this.ctx.transform.applyToPoint(new o(0,n)),l=this.ctx.transform.applyToPoint(new o(0,0));n=Math.sqrt((c.x-l.x)**2+(c.y-l.y)**2)}Math.abs(i-r)>=2*Math.PI&&(r=0,i=2*Math.PI),this.path.push({type:`arc`,x:e,y:t,radius:n,startAngle:r,endAngle:i,counterclockwise:a})},d.prototype.arcTo=function(e,t,n,r,i){throw Error(`arcTo not implemented.`)},d.prototype.rect=function(e,t,n,r){if(isNaN(e)||isNaN(t)||isNaN(n)||isNaN(r))throw iL.error(`jsPDF.context2d.rect: Invalid arguments`,arguments),Error(`Invalid arguments passed to jsPDF.context2d.rect`);this.moveTo(e,t),this.lineTo(e+n,t),this.lineTo(e+n,t+r),this.lineTo(e,t+r),this.lineTo(e,t),this.lineTo(e+n,t),this.lineTo(e,t)},d.prototype.fillRect=function(e,t,n,r){if(isNaN(e)||isNaN(t)||isNaN(n)||isNaN(r))throw iL.error(`jsPDF.context2d.fillRect: Invalid arguments`,arguments),Error(`Invalid arguments passed to jsPDF.context2d.fillRect`);if(!p.call(this)){var i={};this.lineCap!==`butt`&&(i.lineCap=this.lineCap,this.lineCap=`butt`),this.lineJoin!==`miter`&&(i.lineJoin=this.lineJoin,this.lineJoin=`miter`),this.beginPath(),this.rect(e,t,n,r),this.fill(),i.hasOwnProperty(`lineCap`)&&(this.lineCap=i.lineCap),i.hasOwnProperty(`lineJoin`)&&(this.lineJoin=i.lineJoin)}},d.prototype.strokeRect=function(e,t,n,r){if(isNaN(e)||isNaN(t)||isNaN(n)||isNaN(r))throw iL.error(`jsPDF.context2d.strokeRect: Invalid arguments`,arguments),Error(`Invalid arguments passed to jsPDF.context2d.strokeRect`);m.call(this)||(this.beginPath(),this.rect(e,t,n,r),this.stroke())},d.prototype.clearRect=function(e,t,n,r){if(isNaN(e)||isNaN(t)||isNaN(n)||isNaN(r))throw iL.error(`jsPDF.context2d.clearRect: Invalid arguments`,arguments),Error(`Invalid arguments passed to jsPDF.context2d.clearRect`);this.ignoreClearRect||(this.fillStyle=`#ffffff`,this.fillRect(e,t,n,r))},d.prototype.save=function(e){e=typeof e!=`boolean`||e;for(var t=this.pdf.internal.getCurrentPageInfo().pageNumber,n=0;n<this.pdf.internal.getNumberOfPages();n++)this.pdf.setPage(n+1),this.pdf.internal.out(`q`);if(this.pdf.setPage(t),e){this.ctx.fontSize=this.pdf.internal.getFontSize();var r=new u(this.ctx);this.ctxStack.push(this.ctx),this.ctx=r}},d.prototype.restore=function(e){e=typeof e!=`boolean`||e;for(var t=this.pdf.internal.getCurrentPageInfo().pageNumber,n=0;n<this.pdf.internal.getNumberOfPages();n++)this.pdf.setPage(n+1),this.pdf.internal.out(`Q`);this.pdf.setPage(t),e&&this.ctxStack.length!==0&&(this.ctx=this.ctxStack.pop(),this.fillStyle=this.ctx.fillStyle,this.strokeStyle=this.ctx.strokeStyle,this.font=this.ctx.font,this.lineCap=this.ctx.lineCap,this.lineWidth=this.ctx.lineWidth,this.lineJoin=this.ctx.lineJoin,this.lineDash=this.ctx.lineDash,this.lineDashOffset=this.ctx.lineDashOffset)},d.prototype.toDataURL=function(){throw Error(`toDataUrl not implemented.`)};var f=function(e){var t,n,r,i;if(!0===e.isCanvasGradient&&(e=e.getColor()),!e)return{r:0,g:0,b:0,a:0,style:e};if(/transparent|rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*0+\s*\)/.test(e))t=0,n=0,r=0,i=0;else{var a=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(e);if(a!==null)t=parseInt(a[1]),n=parseInt(a[2]),r=parseInt(a[3]),i=1;else if((a=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)/.exec(e))!==null)t=parseInt(a[1]),n=parseInt(a[2]),r=parseInt(a[3]),i=parseFloat(a[4]);else{if(i=1,typeof e==`string`&&e.charAt(0)!==`#`){var o=new lL(e);e=o.ok?o.toHex():`#000000`}e.length===4?(t=e.substring(1,2),t+=t,n=e.substring(2,3),n+=n,r=e.substring(3,4),r+=r):(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7)),t=parseInt(t,16),n=parseInt(n,16),r=parseInt(r,16)}}return{r:t,g:n,b:r,a:i,style:e}},p=function(){return this.ctx.isFillTransparent||this.globalAlpha==0},m=function(){return!!(this.ctx.isStrokeTransparent||this.globalAlpha==0)};d.prototype.fillText=function(e,t,n,r){if(isNaN(t)||isNaN(n)||typeof e!=`string`)throw iL.error(`jsPDF.context2d.fillText: Invalid arguments`,arguments),Error(`Invalid arguments passed to jsPDF.context2d.fillText`);if(r=isNaN(r)?void 0:r,!p.call(this)){var i=P(this.ctx.transform.rotation),a=this.ctx.transform.scaleX;O.call(this,{text:e,x:t,y:n,scale:a,angle:i,align:this.textAlign,maxWidth:r})}},d.prototype.strokeText=function(e,t,n,r){if(isNaN(t)||isNaN(n)||typeof e!=`string`)throw iL.error(`jsPDF.context2d.strokeText: Invalid arguments`,arguments),Error(`Invalid arguments passed to jsPDF.context2d.strokeText`);if(!m.call(this)){r=isNaN(r)?void 0:r;var i=P(this.ctx.transform.rotation),a=this.ctx.transform.scaleX;O.call(this,{text:e,x:t,y:n,scale:a,renderingMode:`stroke`,angle:i,align:this.textAlign,maxWidth:r})}},d.prototype.measureText=function(e){if(typeof e!=`string`)throw iL.error(`jsPDF.context2d.measureText: Invalid arguments`,arguments),Error(`Invalid arguments passed to jsPDF.context2d.measureText`);var t=this.pdf,n=this.pdf.internal.scaleFactor,r=t.internal.getFontSize(),i=t.getStringUnitWidth(e)*r/t.internal.scaleFactor;return new function(e){var t=(e||={}).width||0;return Object.defineProperty(this,"width",{get:function(){return t}}),this}({width:i*=Math.round(96*n/72*1e4)/1e4})},d.prototype.scale=function(e,t){if(isNaN(e)||isNaN(t))throw iL.error(`jsPDF.context2d.scale: Invalid arguments`,arguments),Error(`Invalid arguments passed to jsPDF.context2d.scale`);var n=new c(e,0,0,t,0,0);this.ctx.transform=this.ctx.transform.multiply(n)},d.prototype.rotate=function(e){if(isNaN(e))throw iL.error(`jsPDF.context2d.rotate: Invalid arguments`,arguments),Error(`Invalid arguments passed to jsPDF.context2d.rotate`);var t=new c(Math.cos(e),Math.sin(e),-Math.sin(e),Math.cos(e),0,0);this.ctx.transform=this.ctx.transform.multiply(t)},d.prototype.translate=function(e,t){if(isNaN(e)||isNaN(t))throw iL.error(`jsPDF.context2d.translate: Invalid arguments`,arguments),Error(`Invalid arguments passed to jsPDF.context2d.translate`);var n=new c(1,0,0,1,e,t);this.ctx.transform=this.ctx.transform.multiply(n)},d.prototype.transform=function(e,t,n,r,i,a){if(isNaN(e)||isNaN(t)||isNaN(n)||isNaN(r)||isNaN(i)||isNaN(a))throw iL.error(`jsPDF.context2d.transform: Invalid arguments`,arguments),Error(`Invalid arguments passed to jsPDF.context2d.transform`);var o=new c(e,t,n,r,i,a);this.ctx.transform=this.ctx.transform.multiply(o)},d.prototype.setTransform=function(e,t,n,r,i,a){e=isNaN(e)?1:e,t=isNaN(t)?0:t,n=isNaN(n)?0:n,r=isNaN(r)?1:r,i=isNaN(i)?0:i,a=isNaN(a)?0:a,this.ctx.transform=new c(e,t,n,r,i,a)};var h=function(){return this.margin[0]>0||this.margin[1]>0||this.margin[2]>0||this.margin[3]>0};d.prototype.drawImage=function(e,t,n,r,i,a,o,l,u){var d=this.pdf.getImageProperties(e),f=1,p=1,m=1,_=1;r!==void 0&&l!==void 0&&(m=l/r,_=u/i,f=d.width/r*l/r,p=d.height/i*u/i),a===void 0&&(a=t,o=n,t=0,n=0),r!==void 0&&l===void 0&&(l=r,u=i),r===void 0&&l===void 0&&(l=d.width,u=d.height);var b=this.ctx.transform.decompose(),S=P(b.rotate.shx),C=new c,w=(C=(C=(C=C.multiply(b.translate)).multiply(b.skew)).multiply(b.scale)).applyToRectangle(new s(a-t*m,o-n*_,r*f,i*p));if(this.autoPaging){for(var T,E=g.call(this,w),D=[],O=0;O<E.length;O+=1)D.indexOf(E[O])===-1&&D.push(E[O]);y(D);for(var k=D[0],A=D[D.length-1],j=k;j<A+1;j++){this.pdf.setPage(j);var M=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],N=j===1?this.posY+this.margin[0]:this.margin[0],F=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],I=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],L=j===1?0:F+(j-2)*I;if(this.ctx.clip_path.length!==0){var R=this.path;T=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=v(T,this.posX+this.margin[3],-L+N+this.ctx.prevPageLastElemOffset),x.call(this,`fill`,!0),this.path=R}var z=JSON.parse(JSON.stringify(w));z=v([z],this.posX+this.margin[3],-L+N+this.ctx.prevPageLastElemOffset)[0];var B=(j>k||j<A)&&h.call(this);B&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],M,I,null).clip().discardPath()),this.pdf.addImage(e,`JPEG`,z.x,z.y,z.w,z.h,null,null,S),B&&this.pdf.restoreGraphicsState()}}else this.pdf.addImage(e,`JPEG`,w.x,w.y,w.w,w.h,null,null,S)};var g=function(e,t,n){var r=[];t||=this.pdf.internal.pageSize.width,n||=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2];var i=this.posY+this.ctx.prevPageLastElemOffset;switch(e.type){default:case`mt`:case`lt`:r.push(Math.floor((e.y+i)/n)+1);break;case`arc`:r.push(Math.floor((e.y+i-e.radius)/n)+1),r.push(Math.floor((e.y+i+e.radius)/n)+1);break;case`qct`:var a=F(this.ctx.lastPoint.x,this.ctx.lastPoint.y,e.x1,e.y1,e.x,e.y);r.push(Math.floor((a.y+i)/n)+1),r.push(Math.floor((a.y+a.h+i)/n)+1);break;case`bct`:var o=I(this.ctx.lastPoint.x,this.ctx.lastPoint.y,e.x1,e.y1,e.x2,e.y2,e.x,e.y);r.push(Math.floor((o.y+i)/n)+1),r.push(Math.floor((o.y+o.h+i)/n)+1);break;case`rect`:r.push(Math.floor((e.y+i)/n)+1),r.push(Math.floor((e.y+e.h+i)/n)+1)}for(var s=0;s<r.length;s+=1)for(;this.pdf.internal.getNumberOfPages()<r[s];)_.call(this);return r},_=function(){var e=this.fillStyle,t=this.strokeStyle,n=this.font,r=this.lineCap,i=this.lineWidth,a=this.lineJoin;this.pdf.addPage(),this.fillStyle=e,this.strokeStyle=t,this.font=n,this.lineCap=r,this.lineWidth=i,this.lineJoin=a},v=function(e,t,n){for(var r=0;r<e.length;r++)switch(e[r].type){case`bct`:e[r].x2+=t,e[r].y2+=n;case`qct`:e[r].x1+=t,e[r].y1+=n;default:e[r].x+=t,e[r].y+=n}return e},y=function(e){return e.sort(function(e,t){return e-t})},b=function(e,t){var n=this.fillStyle,r=this.strokeStyle,i=this.lineCap,a=this.lineWidth,o=Math.abs(a*this.ctx.transform.scaleX),s=this.lineJoin;if(this.autoPaging){for(var c,l,u=JSON.parse(JSON.stringify(this.path)),d=JSON.parse(JSON.stringify(this.path)),f=[],p=0;p<d.length;p++)if(d[p].x!==void 0)for(var m=g.call(this,d[p]),b=0;b<m.length;b+=1)f.indexOf(m[b])===-1&&f.push(m[b]);for(var S=0;S<f.length;S++)for(;this.pdf.internal.getNumberOfPages()<f[S];)_.call(this);y(f);for(var C=f[0],w=f[f.length-1],T=C;T<w+1;T++){this.pdf.setPage(T),this.fillStyle=n,this.strokeStyle=r,this.lineCap=i,this.lineWidth=o,this.lineJoin=s;var E=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],D=T===1?this.posY+this.margin[0]:this.margin[0],O=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],k=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],A=T===1?0:O+(T-2)*k;if(this.ctx.clip_path.length!==0){var j=this.path;c=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=v(c,this.posX+this.margin[3],-A+D+this.ctx.prevPageLastElemOffset),x.call(this,e,!0),this.path=j}if(l=JSON.parse(JSON.stringify(u)),this.path=v(l,this.posX+this.margin[3],-A+D+this.ctx.prevPageLastElemOffset),!1===t||T===0){var M=(T>C||T<w)&&h.call(this);M&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],E,k,null).clip().discardPath()),x.call(this,e,t),M&&this.pdf.restoreGraphicsState()}this.lineWidth=a}this.path=u}else this.lineWidth=o,x.call(this,e,t),this.lineWidth=a},x=function(e,t){if((e!==`stroke`||t||!m.call(this))&&(e===`stroke`||t||!p.call(this))){for(var n,r,i=[],a=this.path,o=0;o<a.length;o++){var s=a[o];switch(s.type){case`begin`:i.push({begin:!0});break;case`close`:i.push({close:!0});break;case`mt`:i.push({start:s,deltas:[],abs:[]});break;case`lt`:var c=i.length;if(a[o-1]&&!isNaN(a[o-1].x)&&(n=[s.x-a[o-1].x,s.y-a[o-1].y],c>0)){for(;c>=0;c--)if(!0!==i[c-1].close&&!0!==i[c-1].begin){i[c-1].deltas.push(n),i[c-1].abs.push(s);break}}break;case`bct`:n=[s.x1-a[o-1].x,s.y1-a[o-1].y,s.x2-a[o-1].x,s.y2-a[o-1].y,s.x-a[o-1].x,s.y-a[o-1].y],i[i.length-1].deltas.push(n);break;case`qct`:var l=a[o-1].x+2/3*(s.x1-a[o-1].x),u=a[o-1].y+2/3*(s.y1-a[o-1].y),d=s.x+2/3*(s.x1-s.x),f=s.y+2/3*(s.y1-s.y),h=s.x,g=s.y;n=[l-a[o-1].x,u-a[o-1].y,d-a[o-1].x,f-a[o-1].y,h-a[o-1].x,g-a[o-1].y],i[i.length-1].deltas.push(n);break;case`arc`:i.push({deltas:[],abs:[],arc:!0}),Array.isArray(i[i.length-1].abs)&&i[i.length-1].abs.push(s)}}r=t?null:e===`stroke`?`stroke`:`fill`;for(var _=!1,v=0;v<i.length;v++)if(i[v].arc)for(var y=i[v].abs,b=0;b<y.length;b++){var x=y[b];x.type===`arc`?w.call(this,x.x,x.y,x.radius,x.startAngle,x.endAngle,x.counterclockwise,void 0,t,!_):k.call(this,x.x,x.y),_=!0}else if(!0===i[v].close)this.pdf.internal.out(`h`),_=!1;else if(!0!==i[v].begin){var S=i[v].start.x,C=i[v].start.y;A.call(this,i[v].deltas,S,C),_=!0}r&&T.call(this,r),t&&E.call(this)}},S=function(e){var t=this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor,n=t*(this.pdf.internal.getLineHeightFactor()-1);switch(this.ctx.textBaseline){case`bottom`:return e-n;case`top`:return e+t-n;case`hanging`:return e+t-2*n;case`middle`:return e+t/2-n;default:return e}},C=function(e){return e+this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor*(this.pdf.internal.getLineHeightFactor()-1)};d.prototype.createLinearGradient=function(){var e=function(){};return e.colorStops=[],e.addColorStop=function(e,t){this.colorStops.push([e,t])},e.getColor=function(){return this.colorStops.length===0?`#000000`:this.colorStops[0][1]},e.isCanvasGradient=!0,e},d.prototype.createPattern=function(){return this.createLinearGradient()},d.prototype.createRadialGradient=function(){return this.createLinearGradient()};var w=function(e,t,n,r,i,a,o,s,c){for(var l=M.call(this,n,r,i,a),u=0;u<l.length;u++){var d=l[u];u===0&&(c?D.call(this,d.x1+e,d.y1+t):k.call(this,d.x1+e,d.y1+t)),j.call(this,e,t,d.x2,d.y2,d.x3,d.y3,d.x4,d.y4)}s?E.call(this):T.call(this,o)},T=function(e){switch(e){case`stroke`:this.pdf.internal.out(`S`);break;case`fill`:this.pdf.internal.out(`f`)}},E=function(){this.pdf.clip(),this.pdf.discardPath()},D=function(e,t){this.pdf.internal.out(n(e)+` `+r(t)+` m`)},O=function(e){var t;switch(e.align){case`right`:case`end`:t=`right`;break;case`center`:t=`center`;break;default:t=`left`}var n,r,i,a=this.pdf.getTextDimensions(e.text),l=S.call(this,e.y),u=C.call(this,l)-a.h,d=this.ctx.transform.applyToPoint(new o(e.x,l));if(this.autoPaging){var f=this.ctx.transform.decompose(),p=new c;p=(p=(p=p.multiply(f.translate)).multiply(f.skew)).multiply(f.scale);for(var m=this.ctx.transform.applyToRectangle(new s(e.x,l,a.w,a.h)),_=p.applyToRectangle(new s(e.x,u,a.w,a.h)),b=g.call(this,_),w=[],T=0;T<b.length;T+=1)w.indexOf(b[T])===-1&&w.push(b[T]);y(w);for(var E=w[0],D=w[w.length-1],O=E;O<D+1;O++){this.pdf.setPage(O);var k=O===1?this.posY+this.margin[0]:this.margin[0],A=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],j=this.pdf.internal.pageSize.height-this.margin[2],M=j-this.margin[0],N=this.pdf.internal.pageSize.width-this.margin[1],P=N-this.margin[3],F=O===1?0:A+(O-2)*M;if(this.ctx.clip_path.length!==0){var I=this.path;n=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=v(n,this.posX+this.margin[3],-1*F+k),x.call(this,`fill`,!0),this.path=I}var L=v([JSON.parse(JSON.stringify(_))],this.posX+this.margin[3],-F+k+this.ctx.prevPageLastElemOffset)[0];e.scale>=.01&&(r=this.pdf.internal.getFontSize(),this.pdf.setFontSize(r*e.scale),i=this.lineWidth,this.lineWidth=i*e.scale);var R=this.autoPaging!==`text`;if(R||L.y+L.h<=j){if(R||L.y>=k&&L.x<=N){var z=R?e.text:this.pdf.splitTextToSize(e.text,e.maxWidth||N-L.x)[0],B=v([JSON.parse(JSON.stringify(m))],this.posX+this.margin[3],-F+k+this.ctx.prevPageLastElemOffset)[0],V=R&&(O>E||O<D)&&h.call(this);V&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],P,M,null).clip().discardPath()),this.pdf.text(z,B.x,B.y,{angle:e.angle,align:t,renderingMode:e.renderingMode}),V&&this.pdf.restoreGraphicsState()}}else L.y<j&&(this.ctx.prevPageLastElemOffset+=j-L.y);e.scale>=.01&&(this.pdf.setFontSize(r),this.lineWidth=i)}}else e.scale>=.01&&(r=this.pdf.internal.getFontSize(),this.pdf.setFontSize(r*e.scale),i=this.lineWidth,this.lineWidth=i*e.scale),this.pdf.text(e.text,d.x+this.posX,d.y+this.posY,{angle:e.angle,align:t,renderingMode:e.renderingMode,maxWidth:e.maxWidth}),e.scale>=.01&&(this.pdf.setFontSize(r),this.lineWidth=i)},k=function(e,t,i,a){i||=0,a||=0,this.pdf.internal.out(n(e+i)+` `+r(t+a)+` l`)},A=function(e,t,n){return this.pdf.lines(e,t,n,null,null)},j=function(e,n,r,o,s,c,l,u){this.pdf.internal.out([t(i(r+e)),t(a(o+n)),t(i(s+e)),t(a(c+n)),t(i(l+e)),t(a(u+n)),`c`].join(` `))},M=function(e,t,n,r){for(var i=2*Math.PI,a=Math.PI/2;t>n;)t-=i;var o=Math.abs(n-t);o<i&&r&&(o=i-o);for(var s=[],c=r?-1:1,l=t;o>1e-5;){var u=l+c*Math.min(o,a);s.push(N.call(this,e,l,u)),o-=Math.abs(u-l),l=u}return s},N=function(e,t,n){var r=(n-t)/2,i=e*Math.cos(r),a=e*Math.sin(r),o=i,s=-a,c=o*o+s*s,l=c+o*i+s*a,u=4/3*(Math.sqrt(2*c*l)-l)/(o*a-s*i),d=o-u*s,f=s+u*o,p=d,m=-f,h=r+t,g=Math.cos(h),_=Math.sin(h);return{x1:e*Math.cos(t),y1:e*Math.sin(t),x2:d*g-f*_,y2:d*_+f*g,x3:p*g-m*_,y3:p*_+m*g,x4:e*Math.cos(n),y4:e*Math.sin(n)}},P=function(e){return 180*e/Math.PI},F=function(e,t,n,r,i,a){var o=e+.5*(n-e),c=t+.5*(r-t),l=i+.5*(n-i),u=a+.5*(r-a),d=Math.min(e,i,o,l),f=Math.max(e,i,o,l),p=Math.min(t,a,c,u),m=Math.max(t,a,c,u);return new s(d,p,f-d,m-p)},I=function(e,t,n,r,i,a,o,c){var l,u,d,f,p,m,h,g,_,v,y,b,x,S,C=n-e,w=r-t,T=i-n,E=a-r,D=o-i,O=c-a;for(u=0;u<41;u++)_=(h=(d=e+(l=u/40)*C)+l*((p=n+l*T)-d))+l*(p+l*(i+l*D-p)-h),v=(g=(f=t+l*w)+l*((m=r+l*E)-f))+l*(m+l*(a+l*O-m)-g),u==0?(y=_,b=v,x=_,S=v):(y=Math.min(y,_),b=Math.min(b,v),x=Math.max(x,_),S=Math.max(S,v));return new s(Math.round(y),Math.round(b),Math.round(x-y),Math.round(S-b))},L=function(){if(this.prevLineDash||this.ctx.lineDash.length||this.ctx.lineDashOffset){var e,t,n=(e=this.ctx.lineDash,t=this.ctx.lineDashOffset,JSON.stringify({lineDash:e,lineDashOffset:t}));this.prevLineDash!==n&&(this.pdf.setLineDash(this.ctx.lineDash,this.ctx.lineDashOffset),this.prevLineDash=n)}}})(FL.API),function(e){var t=function(e){var t,n,r,i,a,o,s,c,l,u;for(/[^\x00-\xFF]/.test(e),n=[],r=0,i=(e+=t=`\0\0\0\0`.slice(e.length%4||4)).length;i>r;r+=4)(a=(e.charCodeAt(r)<<24)+(e.charCodeAt(r+1)<<16)+(e.charCodeAt(r+2)<<8)+e.charCodeAt(r+3))===0?n.push(122):(o=(a=((a=((a=((a=(a-(u=a%85))/85)-(l=a%85))/85)-(c=a%85))/85)-(s=a%85))/85)%85,n.push(o+33,s+33,c+33,l+33,u+33));return function(e,t){for(var n=t;n>0;n--)e.pop()}(n,t.length),String.fromCharCode.apply(String,n)+`~>`},n=function(e){var t,n,r,i,a,o=String,s=`length`,c=255,l=`charCodeAt`,u=`slice`,d=`replace`;for(e[u](-2),e=e[u](0,-2)[d](/\s/g,``)[d](`z`,`!!!!!`),r=[],i=0,a=(e+=t=`uuuuu`[u](e[s]%5||5))[s];a>i;i+=5)n=52200625*(e[l](i)-33)+614125*(e[l](i+1)-33)+7225*(e[l](i+2)-33)+85*(e[l](i+3)-33)+(e[l](i+4)-33),r.push(c&n>>24,c&n>>16,c&n>>8,c&n);return function(e,t){for(var n=t;n>0;n--)e.pop()}(r,t[s]),o.fromCharCode.apply(o,r)},r=function(e){return e.split(``).map(function(e){return(`0`+e.charCodeAt().toString(16)).slice(-2)}).join(``)+`>`},i=function(e){var t=new RegExp(/^([0-9A-Fa-f]{2})+$/);if((e=e.replace(/\s/g,``)).indexOf(`>`)!==-1&&(e=e.substr(0,e.indexOf(`>`))),e.length%2&&(e+=`0`),!1===t.test(e))return``;for(var n=``,r=0;r<e.length;r+=2)n+=String.fromCharCode(`0x`+(e[r]+e[r+1]));return n},a=function(e){for(var t=new Uint8Array(e.length),n=e.length;n--;)t[n]=e.charCodeAt(n);return(t=Fj(t)).reduce(function(e,t){return e+String.fromCharCode(t)},``)};e.processDataByFilters=function(e,o){var s=0,c=e||``,l=[];for(typeof(o||=[])==`string`&&(o=[o]),s=0;s<o.length;s+=1)switch(o[s]){case`ASCII85Decode`:case`/ASCII85Decode`:c=n(c),l.push(`/ASCII85Encode`);break;case`ASCII85Encode`:case`/ASCII85Encode`:c=t(c),l.push(`/ASCII85Decode`);break;case`ASCIIHexDecode`:case`/ASCIIHexDecode`:c=i(c),l.push(`/ASCIIHexEncode`);break;case`ASCIIHexEncode`:case`/ASCIIHexEncode`:c=r(c),l.push(`/ASCIIHexDecode`);break;case`FlateEncode`:case`/FlateEncode`:c=a(c),l.push(`/FlateDecode`);break;default:throw Error(`The filter: "`+o[s]+`" is not implemented`)}return{data:c,reverseChain:l.reverse().join(` `)}}}(FL.API),function(e){e.loadFile=function(e,t,n){return function(e,t,n){t=!1!==t,n=typeof n==`function`?n:function(){};var r=void 0;try{r=function(e,t,n){var r=new XMLHttpRequest,i=0,a=function(e){var t=e.length,n=[],r=String.fromCharCode;for(i=0;i<t;i+=1)n.push(r(255&e.charCodeAt(i)));return n.join(``)};if(r.open(`GET`,e,!t),r.overrideMimeType(`text/plain; charset=x-user-defined`),!1===t&&(r.onload=function(){r.status===200?n(a(this.responseText)):n(void 0)}),r.send(null),t&&r.status===200)return a(r.responseText)}(e,t,n)}catch{}return r}(e,t,n)},e.allowFsRead=void 0,e.loadImageFile=e.loadFile}(FL.API),function(e){function t(){return(nL.html2canvas?Promise.resolve(nL.html2canvas):ht(()=>import(`./html2canvas-pro.esm-cng67OYH.js`).then(e=>e.n),__vite__mapDeps([0,1]))).catch(function(e){return Promise.reject(Error(`Could not load html2canvas: `+e))}).then(function(e){return e.default?e.default:e})}function n(){return(nL.DOMPurify?Promise.resolve(nL.DOMPurify):ht(()=>import(`./purify.es-ZPrpXrUc.js`),[])).catch(function(e){return Promise.reject(Error(`Could not load dompurify: `+e))}).then(function(e){return e.default?e.default:e})}var r=function(e){var t=Oi(e);return t===`undefined`?`undefined`:t===`string`||e instanceof String?`string`:t===`number`||e instanceof Number?`number`:t===`function`||e instanceof Function?`function`:e&&e.constructor===Array?`array`:e&&e.nodeType===1?`element`:t===`object`?`object`:`unknown`},i=function(e,t){var n=document.createElement(e);for(var r in t.className&&(n.className=t.className),t.innerHTML&&t.dompurify&&(n.innerHTML=t.dompurify.sanitize(t.innerHTML)),t.style)n.style[r]=t.style[r];return n},a=function e(t,n){for(var r=t.nodeType===3?document.createTextNode(t.nodeValue):t.cloneNode(!1),i=t.firstChild;i;i=i.nextSibling)!0!==n&&i.nodeType===1&&i.nodeName===`SCRIPT`||r.appendChild(e(i,n));return t.nodeType===1&&(t.nodeName===`CANVAS`?(r.width=t.width,r.height=t.height,r.getContext(`2d`).drawImage(t,0,0)):t.nodeName!==`TEXTAREA`&&t.nodeName!==`SELECT`||(r.value=t.value),r.addEventListener(`load`,function(){r.scrollTop=t.scrollTop,r.scrollLeft=t.scrollLeft},!0)),r},o=function e(t){var n=Object.assign(e.convert(Promise.resolve()),JSON.parse(JSON.stringify(e.template))),r=e.convert(Promise.resolve(),n);return(r=r.setProgress(1,e,1,[e])).set(t)};(o.prototype=Object.create(Promise.prototype)).constructor=o,o.convert=function(e,t){return e.__proto__=t||o.prototype,e},o.template={prop:{src:null,container:null,overlay:null,canvas:null,img:null,pdf:null,pageSize:null,callback:function(){}},progress:{val:0,state:null,n:0,stack:[]},opt:{filename:`file.pdf`,margin:[0,0,0,0],enableLinks:!0,x:0,y:0,html2canvas:{},jsPDF:{},backgroundColor:`transparent`}},o.prototype.from=function(e,t){return this.then(function(){switch(t||=function(e){switch(r(e)){case`string`:return`string`;case`element`:return e.nodeName.toLowerCase()===`canvas`?`canvas`:`element`;default:return`unknown`}}(e),t){case`string`:return this.then(n).then(function(t){return this.set({src:i(`div`,{innerHTML:e,dompurify:t})})});case`element`:return this.set({src:e});case`canvas`:return this.set({canvas:e});case`img`:return this.set({img:e});default:return this.error(`Unknown source type.`)}})},o.prototype.to=function(e){switch(e){case`container`:return this.toContainer();case`canvas`:return this.toCanvas();case`img`:return this.toImg();case`pdf`:return this.toPdf();default:return this.error(`Invalid target.`)}},o.prototype.toContainer=function(){return this.thenList([function(){return this.prop.src||this.error(`Cannot duplicate - no source HTML.`)},function(){return this.prop.pageSize||this.setPageSize()}]).then(function(){var e={position:`relative`,display:`inline-block`,width:(typeof this.opt.width!=`number`||isNaN(this.opt.width)||typeof this.opt.windowWidth!=`number`||isNaN(this.opt.windowWidth)?Math.max(this.prop.src.clientWidth,this.prop.src.scrollWidth,this.prop.src.offsetWidth):this.opt.windowWidth)+`px`,left:0,right:0,top:0,margin:`auto`,backgroundColor:this.opt.backgroundColor},t=a(this.prop.src,this.opt.html2canvas.javascriptEnabled);t.tagName===`BODY`&&(e.height=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)+`px`),this.prop.overlay=i(`div`,{className:`html2pdf__overlay`,style:{position:`fixed`,overflow:`hidden`,zIndex:1e3,left:`-100000px`,right:0,bottom:0,top:0}}),this.prop.container=i(`div`,{className:`html2pdf__container`,style:e}),this.prop.container.appendChild(t),this.prop.container.firstChild.appendChild(i(`div`,{style:{clear:`both`,border:`0 none transparent`,margin:0,padding:0,height:0}})),this.prop.container.style.float=`none`,this.prop.overlay.appendChild(this.prop.container),document.body.appendChild(this.prop.overlay),this.prop.container.firstChild.style.position=`relative`,this.prop.container.height=Math.max(this.prop.container.firstChild.clientHeight,this.prop.container.firstChild.scrollHeight,this.prop.container.firstChild.offsetHeight)+`px`})},o.prototype.toCanvas=function(){return this.thenList([function(){return document.body.contains(this.prop.container)||this.toContainer()}]).then(t).then(function(e){var t=Object.assign({},this.opt.html2canvas);return delete t.onrendered,e(this.prop.container,t)}).then(function(e){(this.opt.html2canvas.onrendered||function(){})(e),this.prop.canvas=e,document.body.removeChild(this.prop.overlay)})},o.prototype.toContext2d=function(){return this.thenList([function(){return document.body.contains(this.prop.container)||this.toContainer()}]).then(t).then(function(e){var t=this.opt.jsPDF,n=this.opt.fontFaces,r=typeof this.opt.width!=`number`||isNaN(this.opt.width)||typeof this.opt.windowWidth!=`number`||isNaN(this.opt.windowWidth)?1:this.opt.width/this.opt.windowWidth,i=Object.assign({async:!0,allowTaint:!0,scale:r,scrollX:this.opt.scrollX||0,scrollY:this.opt.scrollY||0,backgroundColor:`#ffffff`,imageTimeout:15e3,logging:!0,proxy:null,removeContainer:!0,foreignObjectRendering:!1,useCORS:!1},this.opt.html2canvas);if(delete i.onrendered,t.context2d.autoPaging=this.opt.autoPaging===void 0||this.opt.autoPaging,t.context2d.posX=this.opt.x,t.context2d.posY=this.opt.y,t.context2d.margin=this.opt.margin,t.context2d.fontFaces=n,n)for(var a=0;a<n.length;++a){var o=n[a],s=o.src.find(function(e){return e.format===`truetype`});s&&t.addFont(s.url,o.ref.name,o.ref.style)}return i.windowHeight=i.windowHeight||0,i.windowHeight=i.windowHeight==0?Math.max(this.prop.container.clientHeight,this.prop.container.scrollHeight,this.prop.container.offsetHeight):i.windowHeight,t.context2d.save(!0),e(this.prop.container,i)}).then(function(e){this.opt.jsPDF.context2d.restore(!0),(this.opt.html2canvas.onrendered||function(){})(e),this.prop.canvas=e,document.body.removeChild(this.prop.overlay)})},o.prototype.toImg=function(){return this.thenList([function(){return this.prop.canvas||this.toCanvas()}]).then(function(){var e=this.prop.canvas.toDataURL(`image/`+this.opt.image.type,this.opt.image.quality);this.prop.img=document.createElement(`img`),this.prop.img.src=e})},o.prototype.toPdf=function(){return this.thenList([function(){return this.toContext2d()}]).then(function(){this.prop.pdf=this.prop.pdf||this.opt.jsPDF})},o.prototype.output=function(e,t,n){return(n||=`pdf`).toLowerCase()===`img`||n.toLowerCase()===`image`?this.outputImg(e,t):this.outputPdf(e,t)},o.prototype.outputPdf=function(e,t){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){return this.prop.pdf.output(e,t)})},o.prototype.outputImg=function(e){return this.thenList([function(){return this.prop.img||this.toImg()}]).then(function(){switch(e){case void 0:case`img`:return this.prop.img;case`datauristring`:case`dataurlstring`:return this.prop.img.src;case`datauri`:case`dataurl`:return document.location.href=this.prop.img.src;default:throw`Image output type "`+e+`" is not supported.`}})},o.prototype.save=function(e){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).set(e?{filename:e}:null).then(function(){this.prop.pdf.save(this.opt.filename)})},o.prototype.doCallback=function(){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){this.prop.callback(this.prop.pdf)})},o.prototype.set=function(e){if(r(e)!==`object`)return this;var t=Object.keys(e||{}).map(function(t){if(t in o.template.prop)return function(){this.prop[t]=e[t]};switch(t){case`margin`:return this.setMargin.bind(this,e.margin);case`jsPDF`:return function(){return this.opt.jsPDF=e.jsPDF,this.setPageSize()};case`pageSize`:return this.setPageSize.bind(this,e.pageSize);default:return function(){this.opt[t]=e[t]}}},this);return this.then(function(){return this.thenList(t)})},o.prototype.get=function(e,t){return this.then(function(){var n=e in o.template.prop?this.prop[e]:this.opt[e];return t?t(n):n})},o.prototype.setMargin=function(e){return this.then(function(){switch(r(e)){case`number`:e=[e,e,e,e];case`array`:if(e.length===2&&(e=[e[0],e[1],e[0],e[1]]),e.length===4)break;default:return this.error(`Invalid margin array.`)}this.opt.margin=e}).then(this.setPageSize)},o.prototype.setPageSize=function(e){function t(e,t){return Math.floor(e*t/72*96)}return this.then(function(){(e||=FL.getPageSize(this.opt.jsPDF)).hasOwnProperty(`inner`)||(e.inner={width:e.width-this.opt.margin[1]-this.opt.margin[3],height:e.height-this.opt.margin[0]-this.opt.margin[2]},e.inner.px={width:t(e.inner.width,e.k),height:t(e.inner.height,e.k)},e.inner.ratio=e.inner.height/e.inner.width),this.prop.pageSize=e})},o.prototype.setProgress=function(e,t,n,r){return e!=null&&(this.progress.val=e),t!=null&&(this.progress.state=t),n!=null&&(this.progress.n=n),r!=null&&(this.progress.stack=r),this.progress.ratio=this.progress.val/this.progress.state,this},o.prototype.updateProgress=function(e,t,n,r){return this.setProgress(e?this.progress.val+e:null,t||null,n?this.progress.n+n:null,r?this.progress.stack.concat(r):null)},o.prototype.then=function(e,t){var n=this;return this.thenCore(e,t,function(e,t){return n.updateProgress(null,null,1,[e]),Promise.prototype.then.call(this,function(t){return n.updateProgress(null,e),t}).then(e,t).then(function(e){return n.updateProgress(1),e})})},o.prototype.thenCore=function(e,t,n){n||=Promise.prototype.then;var r=this;e&&=e.bind(r),t&&=t.bind(r);var i=Promise.toString().indexOf(`[native code]`)!==-1&&Promise.name===`Promise`?r:o.convert(Object.assign({},r),Promise.prototype),a=n.call(i,e,t);return o.convert(a,r.__proto__)},o.prototype.thenExternal=function(e,t){return Promise.prototype.then.call(this,e,t)},o.prototype.thenList=function(e){var t=this;return e.forEach(function(e){t=t.thenCore(e)}),t},o.prototype.catch=function(e){e&&=e.bind(this);var t=Promise.prototype.catch.call(this,e);return o.convert(t,this)},o.prototype.catchExternal=function(e){return Promise.prototype.catch.call(this,e)},o.prototype.error=function(e){return this.then(function(){throw Error(e)})},o.prototype.using=o.prototype.set,o.prototype.saveAs=o.prototype.save,o.prototype.export=o.prototype.output,o.prototype.run=o.prototype.then,FL.getPageSize=function(e,t,n){if(Oi(e)===`object`){var r=e;e=r.orientation,t=r.unit||t,n=r.format||n}t||=`mm`,n||=`a4`,e=(``+(e||`P`)).toLowerCase();var i,a=(``+n).toLowerCase(),o={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};switch(t){case`pt`:i=1;break;case`mm`:i=72/25.4;break;case`cm`:i=72/2.54;break;case`in`:i=72;break;case`px`:i=.75;break;case`pc`:case`em`:i=12;break;case`ex`:i=6;break;default:throw`Invalid unit: `+t}var s,c=0,l=0;if(o.hasOwnProperty(a))c=o[a][1]/i,l=o[a][0]/i;else try{c=n[1],l=n[0]}catch{throw Error(`Invalid format: `+n)}if(e===`p`||e===`portrait`)e=`p`,l>c&&(s=l,l=c,c=s);else{if(e!==`l`&&e!==`landscape`)throw`Invalid orientation: `+e;e=`l`,c>l&&(s=l,l=c,c=s)}return{width:l,height:c,unit:t,k:i,orientation:e}},e.html=function(e,t){(t||={}).callback=t.callback||function(){},t.html2canvas=t.html2canvas||{},t.html2canvas.canvas=t.html2canvas.canvas||this.canvas,t.jsPDF=t.jsPDF||this,t.fontFaces=t.fontFaces?t.fontFaces.map(AR):null;var n=new o(t);return t.worker?n:n.from(e).doCallback()}}(FL.API),FL.API.addJS=function(e){var t,n,r=function(e){for(var t=``,n=0;n<e.length;n++){var r=e[n];if(r===`(`||r===`)`){for(var i=0,a=n-1;a>=0&&e[a]===`\\`;a--)i++;t+=i%2==0?`\\`+r:r}else t+=r}return t}(e);return this.internal.events.subscribe(`postPutResources`,function(){t=this.internal.newObject(),this.internal.out(`<<`),this.internal.out(`/Names [(EmbeddedJS) `+(t+1)+` 0 R]`),this.internal.out(`>>`),this.internal.out(`endobj`),n=this.internal.newObject(),this.internal.out(`<<`),this.internal.out(`/S /JavaScript`),this.internal.out(`/JS (`+r+`)`),this.internal.out(`>>`),this.internal.out(`endobj`)}),this.internal.events.subscribe(`putCatalog`,function(){t!==void 0&&n!==void 0&&this.internal.out(`/Names <</JavaScript `+t+` 0 R>>`)}),this},function(e){var t;e.events.push([`postPutResources`,function(){var e=this,n=/^(\d+) 0 obj$/;if(this.outline.root.children.length>0)for(var r=e.outline.render().split(/\r\n/),i=0;i<r.length;i++){var a=r[i],o=n.exec(a);if(o!=null){var s=o[1];e.internal.newObjectDeferredBegin(s,!1)}e.internal.write(a)}if(this.outline.createNamedDestinations){var c=this.internal.pages.length,l=[];for(i=0;i<c;i++){var u=e.internal.newObject();l.push(u);var d=e.internal.getPageInfo(i+1);e.internal.write(`<< /D[`+d.objId+` 0 R /XYZ null null null]>> endobj`)}var f=e.internal.newObject();for(e.internal.write(`<< /Names [ `),i=0;i<l.length;i++)e.internal.write(`(page_`+(i+1)+`)`+l[i]+` 0 R`);e.internal.write(` ] >>`,`endobj`),t=e.internal.newObject(),e.internal.write(`<< /Dests `+f+` 0 R`),e.internal.write(`>>`,`endobj`)}}]),e.events.push([`putCatalog`,function(){var e=this;e.outline.root.children.length>0&&(e.internal.write(`/Outlines`,this.outline.makeRef(this.outline.root)),this.outline.createNamedDestinations&&e.internal.write(`/Names `+t+` 0 R`))}]),e.events.push([`initialized`,function(){var e=this;e.outline={createNamedDestinations:!1,root:{children:[]}},e.outline.add=function(e,t,n){var r={title:t,options:n,children:[]};return e??=this.root,e.children.push(r),r},e.outline.render=function(){return this.ctx={},this.ctx.val=``,this.ctx.pdf=e,this.genIds_r(this.root),this.renderRoot(this.root),this.renderItems(this.root),this.ctx.val},e.outline.genIds_r=function(t){t.id=e.internal.newObjectDeferred();for(var n=0;n<t.children.length;n++)this.genIds_r(t.children[n])},e.outline.renderRoot=function(e){this.objStart(e),this.line(`/Type /Outlines`),e.children.length>0&&(this.line(`/First `+this.makeRef(e.children[0])),this.line(`/Last `+this.makeRef(e.children[e.children.length-1]))),this.line(`/Count `+this.count_r({count:0},e)),this.objEnd()},e.outline.renderItems=function(t){for(var n=this.ctx.pdf.internal.getVerticalCoordinateString,r=0;r<t.children.length;r++){var i=t.children[r];this.objStart(i),this.line(`/Title `+this.makeString(i.title)),this.line(`/Parent `+this.makeRef(t)),r>0&&this.line(`/Prev `+this.makeRef(t.children[r-1])),r<t.children.length-1&&this.line(`/Next `+this.makeRef(t.children[r+1])),i.children.length>0&&(this.line(`/First `+this.makeRef(i.children[0])),this.line(`/Last `+this.makeRef(i.children[i.children.length-1])));var a=this.count=this.count_r({count:0},i);if(a>0&&this.line(`/Count `+a),i.options&&i.options.pageNumber){var o=e.internal.getPageInfo(i.options.pageNumber);this.line(`/Dest [`+o.objId+` 0 R /XYZ 0 `+n(0)+` 0]`)}this.objEnd()}for(var s=0;s<t.children.length;s++)this.renderItems(t.children[s])},e.outline.line=function(e){this.ctx.val+=e+`\r
`},e.outline.makeRef=function(e){return e.id+` 0 R`},e.outline.makeString=function(t){return`(`+e.internal.pdfEscape(t)+`)`},e.outline.objStart=function(e){this.ctx.val+=`\r
`+e.id+` 0 obj\r
<<\r
`},e.outline.objEnd=function(){this.ctx.val+=`>> \r
endobj\r
`},e.outline.count_r=function(e,t){for(var n=0;n<t.children.length;n++)e.count++,this.count_r(e,t.children[n]);return e.count}}])}(FL.API),function(e){var t=[192,193,194,195,196,197,198,199];e.processJPEG=function(e,n,r,i,a,o){var s,c=this.decode.DCT_DECODE,l=null;if(typeof e==`string`||this.__addimage__.isArrayBuffer(e)||this.__addimage__.isArrayBufferView(e)){switch(e=a||e,e=this.__addimage__.isArrayBuffer(e)?new Uint8Array(e):e,s=function(e){for(var n,r=256*e.charCodeAt(4)+e.charCodeAt(5),i=e.length,a={width:0,height:0,numcomponents:1},o=4;o<i;o+=2){if(o+=r,t.indexOf(e.charCodeAt(o+1))!==-1){n=256*e.charCodeAt(o+5)+e.charCodeAt(o+6),a={width:256*e.charCodeAt(o+7)+e.charCodeAt(o+8),height:n,numcomponents:e.charCodeAt(o+9)};break}r=256*e.charCodeAt(o+2)+e.charCodeAt(o+3)}return a}(e=this.__addimage__.isArrayBufferView(e)?this.__addimage__.arrayBufferToBinaryString(e):e),s.numcomponents){case 1:o=this.color_spaces.DEVICE_GRAY;break;case 4:o=this.color_spaces.DEVICE_CMYK;break;case 3:o=this.color_spaces.DEVICE_RGB}l={data:e,width:s.width,height:s.height,colorSpace:o,bitsPerComponent:8,filter:c,index:n,alias:r}}return l}}(FL.API),FL.API.processPNG=function(e,t,n,r){if(this.__addimage__.isArrayBuffer(e)&&(e=new Uint8Array(e)),this.__addimage__.isArrayBufferView(e)){var i,a=tL(e,{checkCrc:!0}),o=a.width,s=a.height,c=a.channels,l=a.palette,u=a.depth;i=l&&c===1?function(e){for(var t=e.width,n=e.height,r=e.data,i=e.palette,a=e.depth,o=!1,s=[],c=[],l=void 0,u=!1,d=0,f=0;f<i.length;f++){var p=Hj(i[f],4),m=p[0],h=p[1],g=p[2],_=p[3];s.push(m,h,g),_!=null&&(_===0?(d++,c.length<1&&c.push(f)):_<255&&(u=!0))}if(u||d>1){o=!0,c=void 0;var v=t*n;l=new Uint8Array(v);for(var y=new DataView(r.buffer),b=0;b<v;b++){var x=Hj(i[QR(y,b,a)],4)[3];l[b]=x}}else d===0&&(c=void 0);return{colorSpace:`Indexed`,colorsPerPixel:1,sMaskBitsPerComponent:o?8:void 0,colorBytes:r,alphaBytes:l,needSMask:o,palette:s,mask:c}}(a):c===2||c===4?function(e){for(var t=e.data,n=e.width,r=e.height,i=e.channels,a=e.depth,o=i===2?`DeviceGray`:`DeviceRGB`,s=i-1,c=n*r,l=s,u=c*l,d=1*c,f=Math.ceil(u*a/8),p=Math.ceil(d*a/8),m=new Uint8Array(f),h=new Uint8Array(p),g=new DataView(t.buffer),_=new DataView(m.buffer),v=new DataView(h.buffer),y=!1,b=0;b<c;b++){for(var x=b*i,S=0;S<l;S++)$R(_,QR(g,x+S,a),b*l+S,a);var C=QR(g,x+l,a);C<(1<<a)-1&&(y=!0),$R(v,C,1*b,a)}return{colorSpace:o,colorsPerPixel:s,sMaskBitsPerComponent:y?a:void 0,colorBytes:m,alphaBytes:h,needSMask:y}}(a):function(e){var t=e.data,n=e.channels===1?`DeviceGray`:`DeviceRGB`;return{colorSpace:n,colorsPerPixel:n===`DeviceGray`?1:3,colorBytes:t instanceof Uint16Array?function(e){for(var t=e.length,n=new Uint8Array(2*t),r=new DataView(n.buffer,n.byteOffset,n.byteLength),i=0;i<t;i++)r.setUint16(2*i,e[i],!1);return n}(t):t,needSMask:!1}}(a);var d,f,p,m=i,h=m.colorSpace,g=m.colorsPerPixel,_=m.sMaskBitsPerComponent,v=m.colorBytes,y=m.alphaBytes,b=m.needSMask,x=m.palette,S=m.mask,C=null;return r!==FL.API.image_compression.NONE&&typeof Fj==`function`?(C=function(e){var t;switch(e){case FL.API.image_compression.FAST:t=11;break;case FL.API.image_compression.MEDIUM:t=13;break;case FL.API.image_compression.SLOW:t=14;break;default:t=12}return t}(r),d=this.decode.FLATE_DECODE,f=`/Predictor ${C} /Colors ${g} /BitsPerComponent ${u} /Columns ${o}`,e=WR(v,Math.ceil(o*g*u/8),g,u,r),b&&(p=WR(y,Math.ceil(o*_/8),1,_,r))):(d=void 0,f=void 0,e=v,b&&(p=y)),(this.__addimage__.isArrayBuffer(e)||this.__addimage__.isArrayBufferView(e))&&(e=this.__addimage__.arrayBufferToBinaryString(e)),(p&&this.__addimage__.isArrayBuffer(p)||this.__addimage__.isArrayBufferView(p))&&(p=this.__addimage__.arrayBufferToBinaryString(p)),{alias:n,data:e,index:t,filter:d,decodeParameters:f,transparency:S,palette:x,sMask:p,predictor:C,width:o,height:s,bitsPerComponent:u,sMaskBitsPerComponent:_,colorSpace:h}}},function(e){e.processGIF89A=function(t,n,r,i){var a=new tz(t),o=a.width,s=a.height,c=[];a.decodeAndBlitFrameRGBA(0,c);var l={data:c,width:o,height:s},u=new rz(100).encode(l,100);return e.processJPEG.call(this,u,n,r,i)},e.processGIF87A=e.processGIF89A}(FL.API),iz.prototype.parseHeader=function(){if(this.fileSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.reserved=this.datav.getUint32(this.pos,!0),this.pos+=4,this.offset=this.datav.getUint32(this.pos,!0),this.pos+=4,this.headerSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.width=this.datav.getUint32(this.pos,!0),this.pos+=4,this.height=this.datav.getInt32(this.pos,!0),this.pos+=4,this.planes=this.datav.getUint16(this.pos,!0),this.pos+=2,this.bitPP=this.datav.getUint16(this.pos,!0),this.pos+=2,this.compress=this.datav.getUint32(this.pos,!0),this.pos+=4,this.rawSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.hr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.vr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.colors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.importantColors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.bitPP===16&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var e=this.colors===0?1<<this.bitPP:this.colors;this.palette=Array(e);for(var t=0;t<e;t++){var n=this.datav.getUint8(this.pos++,!0),r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0);this.palette[t]={red:i,green:r,blue:n,quad:a}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},iz.prototype.parseBGR=function(){this.pos=this.offset;var e=`bit`+this.bitPP,t=this.width*this.height*4;if(t>536870912)throw Error(`Image dimensions exceed 512MB, which is too large.`);this.data=new Uint8Array(t);try{this[e]()}catch(e){iL.log(`bit decode error:`+e)}},iz.prototype.bit1=function(){var e,t=Math.ceil(this.width/8),n=t%4;for(e=this.height-1;e>=0;e--){for(var r=this.bottom_up?e:this.height-1-e,i=0;i<t;i++)for(var a=this.datav.getUint8(this.pos++,!0),o=r*this.width*4+8*i*4,s=0;s<8&&8*i+s<this.width;s++){var c=this.palette[a>>7-s&1];this.data[o+4*s]=c.blue,this.data[o+4*s+1]=c.green,this.data[o+4*s+2]=c.red,this.data[o+4*s+3]=255}n!==0&&(this.pos+=4-n)}},iz.prototype.bit4=function(){for(var e=Math.ceil(this.width/2),t=e%4,n=this.height-1;n>=0;n--){for(var r=this.bottom_up?n:this.height-1-n,i=0;i<e;i++){var a=this.datav.getUint8(this.pos++,!0),o=r*this.width*4+2*i*4,s=a>>4,c=15&a,l=this.palette[s];if(this.data[o]=l.blue,this.data[o+1]=l.green,this.data[o+2]=l.red,this.data[o+3]=255,2*i+1>=this.width)break;l=this.palette[c],this.data[o+4]=l.blue,this.data[o+4+1]=l.green,this.data[o+4+2]=l.red,this.data[o+4+3]=255}t!==0&&(this.pos+=4-t)}},iz.prototype.bit8=function(){for(var e=this.width%4,t=this.height-1;t>=0;t--){for(var n=this.bottom_up?t:this.height-1-t,r=0;r<this.width;r++){var i=this.datav.getUint8(this.pos++,!0),a=n*this.width*4+4*r;if(i<this.palette.length){var o=this.palette[i];this.data[a]=o.red,this.data[a+1]=o.green,this.data[a+2]=o.blue,this.data[a+3]=255}else this.data[a]=255,this.data[a+1]=255,this.data[a+2]=255,this.data[a+3]=255}e!==0&&(this.pos+=4-e)}},iz.prototype.bit15=function(){for(var e=this.width%3,t=31,n=this.height-1;n>=0;n--){for(var r=this.bottom_up?n:this.height-1-n,i=0;i<this.width;i++){var a=this.datav.getUint16(this.pos,!0);this.pos+=2;var o=(a&t)/t*255|0,s=(a>>5&t)/t*255|0,c=(a>>10&t)/t*255|0,l=a>>15?255:0,u=r*this.width*4+4*i;this.data[u]=c,this.data[u+1]=s,this.data[u+2]=o,this.data[u+3]=l}this.pos+=e}},iz.prototype.bit16=function(){for(var e=this.width%3,t=31,n=63,r=this.height-1;r>=0;r--){for(var i=this.bottom_up?r:this.height-1-r,a=0;a<this.width;a++){var o=this.datav.getUint16(this.pos,!0);this.pos+=2;var s=(o&t)/t*255|0,c=(o>>5&n)/n*255|0,l=(o>>11)/t*255|0,u=i*this.width*4+4*a;this.data[u]=l,this.data[u+1]=c,this.data[u+2]=s,this.data[u+3]=255}this.pos+=e}},iz.prototype.bit24=function(){for(var e=this.height-1;e>=0;e--){for(var t=this.bottom_up?e:this.height-1-e,n=0;n<this.width;n++){var r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),o=t*this.width*4+4*n;this.data[o]=a,this.data[o+1]=i,this.data[o+2]=r,this.data[o+3]=255}this.pos+=this.width%4}},iz.prototype.bit32=function(){for(var e=this.height-1;e>=0;e--)for(var t=this.bottom_up?e:this.height-1-e,n=0;n<this.width;n++){var r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),o=this.datav.getUint8(this.pos++,!0),s=t*this.width*4+4*n;this.data[s]=a,this.data[s+1]=i,this.data[s+2]=r,this.data[s+3]=o}},iz.prototype.getData=function(){return this.data},function(e){e.processBMP=function(t,n,r,i){var a=new iz(t,!1),o=a.width,s=a.height,c={data:a.getData(),width:o,height:s},l=new rz(100).encode(c,100);return e.processJPEG.call(this,l,n,r,i)}}(FL.API),az.prototype.getData=function(){return this.data},function(e){e.processWEBP=function(t,n,r,i){var a=new az(t),o=a.width,s=a.height,c={data:a.getData(),width:o,height:s},l=new rz(100).encode(c,100);return e.processJPEG.call(this,l,n,r,i)}}(FL.API),FL.API.processRGBA=function(e,t,n){for(var r=e.data,i=r.length,a=new Uint8Array(i/4*3),o=new Uint8Array(i/4),s=0,c=0,l=0;l<i;l+=4){var u=r[l],d=r[l+1],f=r[l+2],p=r[l+3];a[s++]=u,a[s++]=d,a[s++]=f,o[c++]=p}var m=this.__addimage__.arrayBufferToBinaryString(a);return{alpha:this.__addimage__.arrayBufferToBinaryString(o),data:m,index:t,alias:n,colorSpace:`DeviceRGB`,bitsPerComponent:8,width:e.width,height:e.height}},FL.API.setLanguage=function(e){return this.internal.languageSettings===void 0&&(this.internal.languageSettings={},this.internal.languageSettings.isSubscribed=!1),{af:`Afrikaans`,sq:`Albanian`,ar:`Arabic (Standard)`,"ar-DZ":`Arabic (Algeria)`,"ar-BH":`Arabic (Bahrain)`,"ar-EG":`Arabic (Egypt)`,"ar-IQ":`Arabic (Iraq)`,"ar-JO":`Arabic (Jordan)`,"ar-KW":`Arabic (Kuwait)`,"ar-LB":`Arabic (Lebanon)`,"ar-LY":`Arabic (Libya)`,"ar-MA":`Arabic (Morocco)`,"ar-OM":`Arabic (Oman)`,"ar-QA":`Arabic (Qatar)`,"ar-SA":`Arabic (Saudi Arabia)`,"ar-SY":`Arabic (Syria)`,"ar-TN":`Arabic (Tunisia)`,"ar-AE":`Arabic (U.A.E.)`,"ar-YE":`Arabic (Yemen)`,an:`Aragonese`,hy:`Armenian`,as:`Assamese`,ast:`Asturian`,az:`Azerbaijani`,eu:`Basque`,be:`Belarusian`,bn:`Bengali`,bs:`Bosnian`,br:`Breton`,bg:`Bulgarian`,my:`Burmese`,ca:`Catalan`,ch:`Chamorro`,ce:`Chechen`,zh:`Chinese`,"zh-HK":`Chinese (Hong Kong)`,"zh-CN":`Chinese (PRC)`,"zh-SG":`Chinese (Singapore)`,"zh-TW":`Chinese (Taiwan)`,cv:`Chuvash`,co:`Corsican`,cr:`Cree`,hr:`Croatian`,cs:`Czech`,da:`Danish`,nl:`Dutch (Standard)`,"nl-BE":`Dutch (Belgian)`,en:`English`,"en-AU":`English (Australia)`,"en-BZ":`English (Belize)`,"en-CA":`English (Canada)`,"en-IE":`English (Ireland)`,"en-JM":`English (Jamaica)`,"en-NZ":`English (New Zealand)`,"en-PH":`English (Philippines)`,"en-ZA":`English (South Africa)`,"en-TT":`English (Trinidad & Tobago)`,"en-GB":`English (United Kingdom)`,"en-US":`English (United States)`,"en-ZW":`English (Zimbabwe)`,eo:`Esperanto`,et:`Estonian`,fo:`Faeroese`,fj:`Fijian`,fi:`Finnish`,fr:`French (Standard)`,"fr-BE":`French (Belgium)`,"fr-CA":`French (Canada)`,"fr-FR":`French (France)`,"fr-LU":`French (Luxembourg)`,"fr-MC":`French (Monaco)`,"fr-CH":`French (Switzerland)`,fy:`Frisian`,fur:`Friulian`,gd:`Gaelic (Scots)`,"gd-IE":`Gaelic (Irish)`,gl:`Galacian`,ka:`Georgian`,de:`German (Standard)`,"de-AT":`German (Austria)`,"de-DE":`German (Germany)`,"de-LI":`German (Liechtenstein)`,"de-LU":`German (Luxembourg)`,"de-CH":`German (Switzerland)`,el:`Greek`,gu:`Gujurati`,ht:`Haitian`,he:`Hebrew`,hi:`Hindi`,hu:`Hungarian`,is:`Icelandic`,id:`Indonesian`,iu:`Inuktitut`,ga:`Irish`,it:`Italian (Standard)`,"it-CH":`Italian (Switzerland)`,ja:`Japanese`,kn:`Kannada`,ks:`Kashmiri`,kk:`Kazakh`,km:`Khmer`,ky:`Kirghiz`,tlh:`Klingon`,ko:`Korean`,"ko-KP":`Korean (North Korea)`,"ko-KR":`Korean (South Korea)`,la:`Latin`,lv:`Latvian`,lt:`Lithuanian`,lb:`Luxembourgish`,mk:`North Macedonia`,ms:`Malay`,ml:`Malayalam`,mt:`Maltese`,mi:`Maori`,mr:`Marathi`,mo:`Moldavian`,nv:`Navajo`,ng:`Ndonga`,ne:`Nepali`,no:`Norwegian`,nb:`Norwegian (Bokmal)`,nn:`Norwegian (Nynorsk)`,oc:`Occitan`,or:`Oriya`,om:`Oromo`,fa:`Persian`,"fa-IR":`Persian/Iran`,pl:`Polish`,pt:`Portuguese`,"pt-BR":`Portuguese (Brazil)`,pa:`Punjabi`,"pa-IN":`Punjabi (India)`,"pa-PK":`Punjabi (Pakistan)`,qu:`Quechua`,rm:`Rhaeto-Romanic`,ro:`Romanian`,"ro-MO":`Romanian (Moldavia)`,ru:`Russian`,"ru-MO":`Russian (Moldavia)`,sz:`Sami (Lappish)`,sg:`Sango`,sa:`Sanskrit`,sc:`Sardinian`,sd:`Sindhi`,si:`Singhalese`,sr:`Serbian`,sk:`Slovak`,sl:`Slovenian`,so:`Somani`,sb:`Sorbian`,es:`Spanish`,"es-AR":`Spanish (Argentina)`,"es-BO":`Spanish (Bolivia)`,"es-CL":`Spanish (Chile)`,"es-CO":`Spanish (Colombia)`,"es-CR":`Spanish (Costa Rica)`,"es-DO":`Spanish (Dominican Republic)`,"es-EC":`Spanish (Ecuador)`,"es-SV":`Spanish (El Salvador)`,"es-GT":`Spanish (Guatemala)`,"es-HN":`Spanish (Honduras)`,"es-MX":`Spanish (Mexico)`,"es-NI":`Spanish (Nicaragua)`,"es-PA":`Spanish (Panama)`,"es-PY":`Spanish (Paraguay)`,"es-PE":`Spanish (Peru)`,"es-PR":`Spanish (Puerto Rico)`,"es-ES":`Spanish (Spain)`,"es-UY":`Spanish (Uruguay)`,"es-VE":`Spanish (Venezuela)`,sx:`Sutu`,sw:`Swahili`,sv:`Swedish`,"sv-FI":`Swedish (Finland)`,"sv-SV":`Swedish (Sweden)`,ta:`Tamil`,tt:`Tatar`,te:`Teluga`,th:`Thai`,tig:`Tigre`,ts:`Tsonga`,tn:`Tswana`,tr:`Turkish`,tk:`Turkmen`,uk:`Ukrainian`,hsb:`Upper Sorbian`,ur:`Urdu`,ve:`Venda`,vi:`Vietnamese`,vo:`Volapuk`,wa:`Walloon`,cy:`Welsh`,xh:`Xhosa`,ji:`Yiddish`,zu:`Zulu`}[e]!==void 0&&(this.internal.languageSettings.languageCode=e,!1===this.internal.languageSettings.isSubscribed&&(this.internal.events.subscribe(`putCatalog`,function(){this.internal.write(`/Lang (`+this.internal.languageSettings.languageCode+`)`)}),this.internal.languageSettings.isSubscribed=!0)),this},RR=FL.API,zR=RR.getCharWidthsArray=function(e,t){var n,r,i=(t||={}).font||this.internal.getFont(),a=t.fontSize||this.internal.getFontSize(),o=t.charSpace||this.internal.getCharSpace(),s=t.widths?t.widths:i.metadata.Unicode.widths,c=s.fof?s.fof:1,l=t.kerning?t.kerning:i.metadata.Unicode.kerning,u=l.fof?l.fof:1,d=!1!==t.doKerning,f=0,p=e.length,m=0,h=s[0]||c,g=[];for(n=0;n<p;n++)r=e.charCodeAt(n),typeof i.metadata.widthOfString==`function`?g.push((i.metadata.widthOfGlyph(i.metadata.characterToGlyph(r))+1e3/a*o||0)/1e3):(f=d&&Oi(l[r])===`object`&&!isNaN(parseInt(l[r][m],10))?l[r][m]/u:0,g.push((s[r]||h)/c+f)),m=r;return g},BR=RR.getStringUnitWidth=function(e,t){var n=(t||={}).fontSize||this.internal.getFontSize(),r=t.font||this.internal.getFont(),i=t.charSpace||this.internal.getCharSpace();return RR.processArabic&&(e=RR.processArabic(e)),typeof r.metadata.widthOfString==`function`?r.metadata.widthOfString(e,n,i)/n:zR.apply(this,arguments).reduce(function(e,t){return e+t},0)},VR=function(e,t,n,r){for(var i=[],a=0,o=e.length,s=0;a!==o&&s+t[a]<n;)s+=t[a],a++;i.push(e.slice(0,a));var c=a;for(s=0;a!==o;)s+t[a]>r&&(i.push(e.slice(c,a)),s=0,c=a),s+=t[a],a++;return c!==a&&i.push(e.slice(c,a)),i},HR=function(e,t,n){n||={};var r,i,a,o,s,c,l,u=[],d=[u],f=n.textIndent||0,p=0,m=0,h=e.split(` `),g=zR.apply(this,[` `,n])[0];if(c=n.lineIndent===-1?h[0].length+2:n.lineIndent||0){var _=Array(c).join(` `),v=[];h.map(function(e){(e=e.split(/\s*\n/)).length>1?v=v.concat(e.map(function(e,t){return(t&&e.length?`
`:``)+e})):v.push(e[0])}),h=v,c=BR.apply(this,[_,n])}for(a=0,o=h.length;a<o;a++){var y=0;if(r=h[a],c&&r[0]==`
`&&(r=r.substr(1),y=1),f+p+(m=(i=zR.apply(this,[r,n])).reduce(function(e,t){return e+t},0))>t||y){if(m>t){for(s=VR.apply(this,[r,i,t-(f+p),t]),u.push(s.shift()),u=[s.pop()];s.length;)d.push([s.shift()]);m=i.slice(r.length-(u[0]?u[0].length:0)).reduce(function(e,t){return e+t},0)}else u=[r];d.push(u),f=m+c,p=g}else u.push(r),f+=p+m,p=g}return l=c?function(e,t){return(t?_:``)+e.join(` `)}:function(e){return e.join(` `)},d.map(l)},RR.splitTextToSize=function(e,t,n){var r,i=(n||={}).fontSize||this.internal.getFontSize(),a=function(e){if(e.widths&&e.kerning)return{widths:e.widths,kerning:e.kerning};var t=this.internal.getFont(e.fontName,e.fontStyle),n=`Unicode`;return t.metadata[n]?{widths:t.metadata[n].widths||{0:1},kerning:t.metadata[n].kerning||{}}:{font:t.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}.call(this,n);r=Array.isArray(e)?e:String(e).split(/\r?\n/);var o=1*this.internal.scaleFactor*t/i;a.textIndent=n.textIndent?1*n.textIndent*this.internal.scaleFactor/i:0,a.lineIndent=n.lineIndent;var s,c,l=[];for(s=0,c=r.length;s<c;s++)l=l.concat(HR.apply(this,[r[s],o,a]));return l},function(e){e.__fontmetrics__=e.__fontmetrics__||{};for(var t=`0123456789abcdef`,n=`klmnopqrstuvwxyz`,r={},i={},a=0;a<16;a++)r[n[a]]=t[a],i[t[a]]=n[a];var o=function(e){return`0x`+parseInt(e,10).toString(16)},s=e.__fontmetrics__.compress=function(e){var t,n,r,a,c=[`{`];for(var l in e){if(t=e[l],isNaN(parseInt(l,10))?n=`'`+l+`'`:(l=parseInt(l,10),n=(n=o(l).slice(2)).slice(0,-1)+i[n.slice(-1)]),typeof t==`number`)t<0?(r=o(t).slice(3),a=`-`):(r=o(t).slice(2),a=``),r=a+r.slice(0,-1)+i[r.slice(-1)];else{if(Oi(t)!==`object`)throw Error(`Don't know what to do with value type `+Oi(t)+`.`);r=s(t)}c.push(n+r)}return c.push(`}`),c.join(``)},c=e.__fontmetrics__.uncompress=function(e){if(typeof e!=`string`)throw Error(`Invalid argument passed to uncompress.`);for(var t,n,i,a,o={},s=1,c=o,l=[],u=``,d=``,f=e.length-1,p=1;p<f;p+=1)(a=e[p])==`'`?t?(i=t.join(``),t=void 0):t=[]:t?t.push(a):a==`{`?(l.push([c,i]),c={},i=void 0):a==`}`?((n=l.pop())[0][n[1]]=c,i=void 0,c=n[0]):a==`-`?s=-1:i===void 0?r.hasOwnProperty(a)?(u+=r[a],i=parseInt(u,16)*s,s=1,u=``):u+=a:r.hasOwnProperty(a)?(d+=r[a],c[i]=parseInt(d,16)*s,s=1,i=void 0,d=``):d+=a;return o},l={codePages:[`WinAnsiEncoding`],WinAnsiEncoding:c(`{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}`)},u={Unicode:{Courier:l,"Courier-Bold":l,"Courier-BoldOblique":l,"Courier-Oblique":l,Helvetica:l,"Helvetica-Bold":l,"Helvetica-BoldOblique":l,"Helvetica-Oblique":l,"Times-Roman":l,"Times-Bold":l,"Times-BoldItalic":l,"Times-Italic":l}},d={Unicode:{"Courier-Oblique":c(`{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}`),"Times-BoldItalic":c(`{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}`),"Helvetica-Bold":c(`{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}`),Courier:c(`{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}`),"Courier-BoldOblique":c(`{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}`),"Times-Bold":c(`{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}`),Symbol:c(`{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}`),Helvetica:c(`{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}`),"Helvetica-BoldOblique":c(`{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}`),ZapfDingbats:c(`{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}`),"Courier-Bold":c(`{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}`),"Times-Italic":c(`{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}`),"Times-Roman":c(`{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}`),"Helvetica-Oblique":c(`{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}`)}};e.events.push([`addFont`,function(e){var t=e.font,n=d.Unicode[t.postScriptName];n&&(t.metadata.Unicode={},t.metadata.Unicode.widths=n.widths,t.metadata.Unicode.kerning=n.kerning);var r=u.Unicode[t.postScriptName];r&&(t.metadata.Unicode.encoding=r,t.encoding=r.codePages[0])}])}(FL.API),function(e){var t=function(e){for(var t=e.length,n=new Uint8Array(t),r=0;r<t;r++)n[r]=e.charCodeAt(r);return n};e.API.events.push([`addFont`,function(n){var r=void 0,i=n.font,a=n.instance;if(!i.isStandardFont){if(a===void 0)throw Error(`Font does not exist in vFS, import fonts or remove declaration doc.addFont('`+i.postScriptName+`').`);if(typeof(r=!1===a.existsFileInVFS(i.postScriptName)?a.loadFile(i.postScriptName):a.getFileFromVFS(i.postScriptName))!=`string`)throw Error(`Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('`+i.postScriptName+`').`);(function(n,r){r=/^\x00\x01\x00\x00/.test(r)?t(r):t(uL(r)),n.metadata=e.API.TTFFont.open(r),n.metadata.Unicode=n.metadata.Unicode||{encoding:{},kerning:{},widths:[]},n.metadata.glyIdsUsed=[0]})(i,r)}}])}(FL),FL.API.addSvgAsImage=function(e,t,n,r,i,a,o,s){if(isNaN(t)||isNaN(n))throw iL.error(`jsPDF.addSvgAsImage: Invalid coordinates`,arguments),Error(`Invalid coordinates passed to jsPDF.addSvgAsImage`);if(isNaN(r)||isNaN(i))throw iL.error(`jsPDF.addSvgAsImage: Invalid measurements`,arguments),Error(`Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage`);var c=document.createElement(`canvas`);c.width=r,c.height=i;var l=c.getContext(`2d`);l.fillStyle=`#fff`,l.fillRect(0,0,c.width,c.height);var u={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},d=this;return(nL.canvg?Promise.resolve(nL.canvg):ht(()=>import(`./index.es-CyUYsdZu.js`),__vite__mapDeps([2,1,3,4,5]))).catch(function(e){return Promise.reject(Error(`Could not load canvg: `+e))}).then(function(e){return e.default?e.default:e}).then(function(t){return t.fromString(l,e,u)},function(){return Promise.reject(Error(`Could not load canvg.`))}).then(function(e){return e.render(u)}).then(function(){d.addImage(c.toDataURL(`image/jpeg`,1),t,n,r,i,o,s)})},FL.API.putTotalPages=function(e){var t,n=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(t=new RegExp(e,`g`),n=this.internal.getNumberOfPages()):(t=new RegExp(this.pdfEscape16(e,this.internal.getFont()),`g`),n=this.pdfEscape16(this.internal.getNumberOfPages()+``,this.internal.getFont()));for(var r=1;r<=this.internal.getNumberOfPages();r++)for(var i=0;i<this.internal.pages[r].length;i++)this.internal.pages[r][i]=this.internal.pages[r][i].replace(t,n);return this},FL.API.viewerPreferences=function(e,t){var n;e||={},t||=!1;var r,i,a,o={HideToolbar:{defaultValue:!1,value:!1,type:`boolean`,explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:`boolean`,explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:`boolean`,explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:`boolean`,explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:`boolean`,explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:`boolean`,explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:`UseNone`,value:`UseNone`,type:`name`,explicitSet:!1,valueSet:[`UseNone`,`UseOutlines`,`UseThumbs`,`UseOC`],pdfVersion:1.3},Direction:{defaultValue:`L2R`,value:`L2R`,type:`name`,explicitSet:!1,valueSet:[`L2R`,`R2L`],pdfVersion:1.3},ViewArea:{defaultValue:`CropBox`,value:`CropBox`,type:`name`,explicitSet:!1,valueSet:[`MediaBox`,`CropBox`,`TrimBox`,`BleedBox`,`ArtBox`],pdfVersion:1.4},ViewClip:{defaultValue:`CropBox`,value:`CropBox`,type:`name`,explicitSet:!1,valueSet:[`MediaBox`,`CropBox`,`TrimBox`,`BleedBox`,`ArtBox`],pdfVersion:1.4},PrintArea:{defaultValue:`CropBox`,value:`CropBox`,type:`name`,explicitSet:!1,valueSet:[`MediaBox`,`CropBox`,`TrimBox`,`BleedBox`,`ArtBox`],pdfVersion:1.4},PrintClip:{defaultValue:`CropBox`,value:`CropBox`,type:`name`,explicitSet:!1,valueSet:[`MediaBox`,`CropBox`,`TrimBox`,`BleedBox`,`ArtBox`],pdfVersion:1.4},PrintScaling:{defaultValue:`AppDefault`,value:`AppDefault`,type:`name`,explicitSet:!1,valueSet:[`AppDefault`,`None`],pdfVersion:1.6},Duplex:{defaultValue:``,value:`none`,type:`name`,explicitSet:!1,valueSet:[`Simplex`,`DuplexFlipShortEdge`,`DuplexFlipLongEdge`,`none`],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:`boolean`,explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:``,value:``,type:`array`,explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:`integer`,explicitSet:!1,valueSet:null,pdfVersion:1.7}},s=Object.keys(o),c=[],l=0,u=0,d=0;function f(e,t){var n,r=!1;for(n=0;n<e.length;n+=1)e[n]===t&&(r=!0);return r}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(o)),this.internal.viewerpreferences.isSubscribed=!1),n=this.internal.viewerpreferences.configuration,e===`reset`||!0===t){var p=s.length;for(d=0;d<p;d+=1)n[s[d]].value=n[s[d]].defaultValue,n[s[d]].explicitSet=!1}if(Oi(e)===`object`){for(i in e)if(a=e[i],f(s,i)&&a!==void 0){if(n[i].type===`boolean`&&typeof a==`boolean`)n[i].value=a;else if(n[i].type===`name`&&f(n[i].valueSet,a))n[i].value=a;else if(n[i].type===`integer`&&Number.isInteger(a))n[i].value=a;else if(n[i].type===`array`){for(l=0;l<a.length;l+=1)if(r=!0,a[l].length===1&&typeof a[l][0]==`number`)c.push(String(a[l]-1));else if(a[l].length>1){for(u=0;u<a[l].length;u+=1)typeof a[l][u]!=`number`&&(r=!1);!0===r&&c.push([a[l][0]-1,a[l][1]-1].join(` `))}n[i].value=`[`+c.join(` `)+`]`}else n[i].value=n[i].defaultValue;n[i].explicitSet=!0}}return!1===this.internal.viewerpreferences.isSubscribed&&(this.internal.events.subscribe(`putCatalog`,function(){var e,t=[];for(e in n)!0===n[e].explicitSet&&(n[e].type===`name`?t.push(`/`+e+` /`+n[e].value):t.push(`/`+e+` `+n[e].value));t.length!==0&&this.internal.write(`/ViewerPreferences
<<
`+t.join(`
`)+`
>>`)}),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=n,this},FL.API.addMetadata=function(e,t){return this.internal.__metadata__===void 0&&(this.internal.__metadata__={metadata:e,namespaceUri:t??`http://jspdf.default.namespaceuri/`,rawXml:typeof t==`boolean`&&t},this.internal.events.subscribe(`putCatalog`,sz),this.internal.events.subscribe(`postPutResources`,oz)),this},function(e){var t=e.API,n=t.pdfEscape16=function(e,t){for(var n,r=t.metadata.Unicode.widths,i=[``,`0`,`00`,`000`,`0000`],a=[``],o=0,s=e.length;o<s;++o){if(n=t.metadata.characterToGlyph(e.charCodeAt(o)),t.metadata.glyIdsUsed.push(n),t.metadata.toUnicode[n]=e.charCodeAt(o),r.indexOf(n)==-1&&(r.push(n),r.push([parseInt(t.metadata.widthOfGlyph(n),10)])),n==`0`)return a.join(``);n=n.toString(16),a.push(i[4-n.length],n)}return a.join(``)},r=function(e){var t,n,r,i,a,o,s;for(a=`/CIDInit /ProcSet findresource begin
12 dict begin
begincmap
/CIDSystemInfo <<
/Registry (Adobe)
/Ordering (UCS)
/Supplement 0
>> def
/CMapName /Adobe-Identity-UCS def
/CMapType 2 def
1 begincodespacerange
<0000><ffff>
endcodespacerange`,r=[],o=0,s=(n=Object.keys(e).sort(function(e,t){return e-t})).length;o<s;o++)t=n[o],r.length>=100&&(a+=`
`+r.length+` beginbfchar
`+r.join(`
`)+`
endbfchar`,r=[]),e[t]!==void 0&&e[t]!==null&&typeof e[t].toString==`function`&&(i=(`0000`+e[t].toString(16)).slice(-4),t=(`0000`+(+t).toString(16)).slice(-4),r.push(`<`+t+`><`+i+`>`));return r.length&&(a+=`
`+r.length+` beginbfchar
`+r.join(`
`)+`
endbfchar
`),a+`endcmap
CMapName currentdict /CMap defineresource pop
end
end`};t.events.push([`putFont`,function(t){(function(t){var n=t.font,i=t.out,a=t.newObject,o=t.putStream;if(n.metadata instanceof e.API.TTFFont&&n.encoding===`Identity-H`){for(var s=n.metadata.Unicode.widths,c=n.metadata.subset.encode(n.metadata.glyIdsUsed,1),l=``,u=0;u<c.length;u++)l+=String.fromCharCode(c[u]);var d=a();o({data:l,addLength1:!0,objectId:d}),i(`endobj`);var f=a();o({data:r(n.metadata.toUnicode),addLength1:!0,objectId:f}),i(`endobj`);var p=a();i(`<<`),i(`/Type /FontDescriptor`),i(`/FontName /`+kL(n.fontName)),i(`/FontFile2 `+d+` 0 R`),i(`/FontBBox `+e.API.PDFObject.convert(n.metadata.bbox)),i(`/Flags `+n.metadata.flags),i(`/StemV `+n.metadata.stemV),i(`/ItalicAngle `+n.metadata.italicAngle),i(`/Ascent `+n.metadata.ascender),i(`/Descent `+n.metadata.decender),i(`/CapHeight `+n.metadata.capHeight),i(`>>`),i(`endobj`);var m=a();i(`<<`),i(`/Type /Font`),i(`/BaseFont /`+kL(n.fontName)),i(`/FontDescriptor `+p+` 0 R`),i(`/W `+e.API.PDFObject.convert(s)),i(`/CIDToGIDMap /Identity`),i(`/DW 1000`),i(`/Subtype /CIDFontType2`),i(`/CIDSystemInfo`),i(`<<`),i(`/Supplement 0`),i(`/Registry (Adobe)`),i(`/Ordering (`+n.encoding+`)`),i(`>>`),i(`>>`),i(`endobj`),n.objectNumber=a(),i(`<<`),i(`/Type /Font`),i(`/Subtype /Type0`),i(`/ToUnicode `+f+` 0 R`),i(`/BaseFont /`+kL(n.fontName)),i(`/Encoding /`+n.encoding),i(`/DescendantFonts [`+m+` 0 R]`),i(`>>`),i(`endobj`),n.isAlreadyPutted=!0}})(t)}]),t.events.push([`putFont`,function(t){(function(t){var n=t.font,i=t.out,a=t.newObject,o=t.putStream;if(n.metadata instanceof e.API.TTFFont&&n.encoding===`WinAnsiEncoding`){for(var s=n.metadata.rawData,c=``,l=0;l<s.length;l++)c+=String.fromCharCode(s[l]);var u=a();o({data:c,addLength1:!0,objectId:u}),i(`endobj`);var d=a();o({data:r(n.metadata.toUnicode),addLength1:!0,objectId:d}),i(`endobj`);var f=a();i(`<<`),i(`/Descent `+n.metadata.decender),i(`/CapHeight `+n.metadata.capHeight),i(`/StemV `+n.metadata.stemV),i(`/Type /FontDescriptor`),i(`/FontFile2 `+u+` 0 R`),i(`/Flags 96`),i(`/FontBBox `+e.API.PDFObject.convert(n.metadata.bbox)),i(`/FontName /`+kL(n.fontName)),i(`/ItalicAngle `+n.metadata.italicAngle),i(`/Ascent `+n.metadata.ascender),i(`>>`),i(`endobj`),n.objectNumber=a();for(var p=0;p<n.metadata.hmtx.widths.length;p++)n.metadata.hmtx.widths[p]=parseInt(n.metadata.hmtx.widths[p]*(1e3/n.metadata.head.unitsPerEm));i(`<</Subtype/TrueType/Type/Font/ToUnicode `+d+` 0 R/BaseFont/`+kL(n.fontName)+`/FontDescriptor `+f+` 0 R/Encoding/`+n.encoding+` /FirstChar 29 /LastChar 255 /Widths `+e.API.PDFObject.convert(n.metadata.hmtx.widths)+`>>`),i(`endobj`),n.isAlreadyPutted=!0}})(t)}]);var i=function(e){var t,r=e.text||``,i=e.x,a=e.y,o=e.options||{},s=e.mutex||{},c=s.pdfEscape,l=s.activeFontKey,u=s.fonts,d=l,f=``,p=0,m=``,h=u[d].encoding;if(u[d].encoding!==`Identity-H`)return{text:r,x:i,y:a,options:o,mutex:s};for(m=r,d=l,Array.isArray(r)&&(m=r[0]),p=0;p<m.length;p+=1)u[d].metadata.hasOwnProperty(`cmap`)&&(t=u[d].metadata.cmap.unicode.codeMap[m[p].charCodeAt(0)]),t||m[p].charCodeAt(0)<256&&u[d].metadata.hasOwnProperty(`Unicode`)?f+=m[p]:f+=``;var g=``;return parseInt(d.slice(1))<14||h===`WinAnsiEncoding`?g=c(f,d).split(``).map(function(e){return e.charCodeAt(0).toString(16)}).join(``):h===`Identity-H`&&(g=n(f,u[d])),s.isHex=!0,{text:g,x:i,y:a,options:o,mutex:s}};t.events.push([`postProcessText`,function(e){var t=e.text||``,n=[],r={text:t,x:e.x,y:e.y,options:e.options,mutex:e.mutex};if(Array.isArray(t)){var a=0;for(a=0;a<t.length;a+=1)Array.isArray(t[a])&&t[a].length===3?n.push([i(Object.assign({},r,{text:t[a][0]})).text,t[a][1],t[a][2]]):n.push(i(Object.assign({},r,{text:t[a]})).text);e.text=n}else e.text=i(Object.assign({},r,{text:t})).text}])}(FL),function(e){var t=function(){return this.internal.vFS===void 0&&(this.internal.vFS={}),!0};e.existsFileInVFS=function(e){return t.call(this),this.internal.vFS[e]!==void 0},e.addFileToVFS=function(e,n){return t.call(this),this.internal.vFS[e]=n,this},e.getFileFromVFS=function(e){return t.call(this),this.internal.vFS[e]===void 0?null:this.internal.vFS[e]}}(FL.API),function(e){e.__bidiEngine__=e.prototype.__bidiEngine__=function(e){var n,r,i,a,o,s,c,l=t,u=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],d=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],f={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},p={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},m=`(.).(.<.>.<.[.].[.{.}.{.«.».«.‹.›.‹.⁅.⁆.⁅.⁽.⁾.⁽.₍.₎.₍.≤.≥.≤.〈.〉.〈.﹙.﹚.﹙.﹛.﹜.﹛.﹝.﹞.﹝.﹤.﹥.﹤`.split(`.`),h=new RegExp(/^([1-4|9]|1[0-9]|2[0-9]|3[0168]|4[04589]|5[012]|7[78]|159|16[0-9]|17[0-2]|21[569]|22[03489]|250)$/),g=!1,_=0;this.__bidiEngine__={};var v=function(e){var t=e.charCodeAt(),n=t>>8,r=p[n];return r===void 0?n===252||n===253?`AL`:h.test(n)?`L`:n===8?`R`:`N`:l[256*r+(255&t)]},y=function(e){for(var t,n=0;n<e.length;n++){if((t=v(e.charAt(n)))===`L`)return!1;if(t===`R`)return!0}return!1},b=function(e,t,o,s){var c,l,u,d,f=t[s];switch(f){case`L`:case`R`:case`LRE`:case`RLE`:case`LRO`:case`RLO`:case`PDF`:g=!1;break;case`N`:case`AN`:break;case`EN`:g&&(f=`AN`);break;case`AL`:g=!0,f=`R`;break;case`WS`:case`BN`:f=`N`;break;case`CS`:s<1||s+1>=t.length||(c=o[s-1])!==`EN`&&c!==`AN`||(l=t[s+1])!==`EN`&&l!==`AN`?f=`N`:g&&(l=`AN`),f=l===c?l:`N`;break;case`ES`:f=(c=s>0?o[s-1]:`B`)===`EN`&&s+1<t.length&&t[s+1]===`EN`?`EN`:`N`;break;case`ET`:if(s>0&&o[s-1]===`EN`){f=`EN`;break}if(g){f=`N`;break}for(u=s+1,d=t.length;u<d&&t[u]===`ET`;)u++;f=u<d&&t[u]===`EN`?`EN`:`N`;break;case`NSM`:if(i&&!a){for(d=t.length,u=s+1;u<d&&t[u]===`NSM`;)u++;if(u<d){var p=e[s],m=p>=1425&&p<=2303||p===64286;if(c=t[u],m&&(c===`R`||c===`AL`)){f=`R`;break}}}f=s<1||(c=t[s-1])===`B`?`N`:o[s-1];break;case`B`:g=!1,n=!0,f=_;break;case`S`:r=!0,f=`N`}return f},x=function(e,t,n){var r=e.split(``);return n&&S(r,n,{hiLevel:_}),r.reverse(),t&&t.reverse(),r.join(``)},S=function(e,t,i){var a,o,s,c,l,p=-1,m=e.length,h=0,y=[],x=_?d:u,S=[];for(g=!1,n=!1,r=!1,o=0;o<m;o++)S[o]=v(e[o]);for(s=0;s<m;s++){if(l=h,y[s]=b(e,S,y,s),a=240&(h=x[l][f[y[s]]]),h&=15,t[s]=c=x[h][5],a>0)if(a===16){for(o=p;o<s;o++)t[o]=1;p=-1}else p=-1;if(x[h][6])p===-1&&(p=s);else if(p>-1){for(o=p;o<s;o++)t[o]=c;p=-1}S[s]===`B`&&(t[s]=0),i.hiLevel|=c}r&&function(e,t,n){for(var r=0;r<n;r++)if(e[r]===`S`){t[r]=_;for(var i=r-1;i>=0&&e[i]===`WS`;i--)t[i]=_}}(S,t,m)},C=function(e,t,r,i,a){if(!(a.hiLevel<e)){if(e===1&&_===1&&!n)return t.reverse(),void(r&&r.reverse());for(var o,s,c,l,u=t.length,d=0;d<u;){if(i[d]>=e){for(c=d+1;c<u&&i[c]>=e;)c++;for(l=d,s=c-1;l<s;l++,s--)o=t[l],t[l]=t[s],t[s]=o,r&&(o=r[l],r[l]=r[s],r[s]=o);d=c}d++}}},w=function(e,t,n){var r=e.split(``),i={hiLevel:_};return n||=[],S(r,n,i),function(e,t,n){if(n.hiLevel!==0&&c)for(var r,i=0;i<e.length;i++)t[i]===1&&(r=m.indexOf(e[i]))>=0&&(e[i]=m[r+1])}(r,n,i),C(2,r,t,n,i),C(1,r,t,n,i),r.join(``)};return this.__bidiEngine__.doBidiReorder=function(e,t,n){if(function(e,t){if(t)for(var n=0;n<e.length;n++)t[n]=n;a===void 0&&(a=y(e)),s===void 0&&(s=y(e))}(e,t),i||!o||s)if(i&&o&&a^s)_=+!!a,e=x(e,t,n);else if(!i&&o&&s)_=+!!a,e=w(e,t,n),e=x(e,t);else if(!i||a||o||s){if(i&&!o&&a^s)e=x(e,t),a?(_=0,e=w(e,t,n)):(_=1,e=w(e,t,n),e=x(e,t));else if(i&&a&&!o&&s)_=1,e=w(e,t,n),e=x(e,t);else if(!i&&!o&&a^s){var r=c;a?(_=1,e=w(e,t,n),_=0,c=!1,e=w(e,t,n),c=r):(_=0,e=w(e,t,n),e=x(e,t),_=1,c=!1,e=w(e,t,n),c=r,e=x(e,t))}}else _=0,e=w(e,t,n);else _=+!!a,e=w(e,t,n);return e},this.__bidiEngine__.setOptions=function(e){e&&(i=e.isInputVisual,o=e.isOutputVisual,a=e.isInputRtl,s=e.isOutputRtl,c=e.isSymmetricSwapping)},this.__bidiEngine__.setOptions(e),this.__bidiEngine__};var t=`BN.BN.BN.BN.BN.BN.BN.BN.BN.S.B.S.WS.B.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.B.B.B.S.WS.N.N.ET.ET.ET.N.N.N.N.N.ES.CS.ES.CS.CS.EN.EN.EN.EN.EN.EN.EN.EN.EN.EN.CS.N.N.N.N.N.N.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.N.N.N.N.N.N.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.N.N.N.N.BN.BN.BN.BN.BN.BN.B.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.CS.N.ET.ET.ET.ET.N.N.N.N.L.N.N.BN.N.N.ET.ET.EN.EN.N.L.N.N.N.EN.L.N.N.N.N.N.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.N.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.N.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.N.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.N.N.L.L.L.L.L.L.L.N.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.N.L.N.N.N.N.N.ET.N.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.R.NSM.R.NSM.NSM.R.NSM.NSM.R.NSM.N.N.N.N.N.N.N.N.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.N.N.N.N.N.R.R.R.R.R.N.N.N.N.N.N.N.N.N.N.N.AN.AN.AN.AN.AN.AN.N.N.AL.ET.ET.AL.CS.AL.N.N.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.AL.AL.N.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.AN.AN.AN.AN.AN.AN.AN.AN.AN.AN.ET.AN.AN.AL.AL.AL.NSM.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.NSM.NSM.NSM.NSM.NSM.NSM.NSM.AN.N.NSM.NSM.NSM.NSM.NSM.NSM.AL.AL.NSM.NSM.N.NSM.NSM.NSM.NSM.AL.AL.EN.EN.EN.EN.EN.EN.EN.EN.EN.EN.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.N.AL.AL.NSM.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.N.N.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.AL.N.N.N.N.N.N.N.N.N.N.N.N.N.N.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.R.R.N.N.N.N.R.N.N.N.N.N.WS.WS.WS.WS.WS.WS.WS.WS.WS.WS.WS.BN.BN.BN.L.R.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.WS.B.LRE.RLE.PDF.LRO.RLO.CS.ET.ET.ET.ET.ET.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.CS.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.WS.BN.BN.BN.BN.BN.N.LRI.RLI.FSI.PDI.BN.BN.BN.BN.BN.BN.EN.L.N.N.EN.EN.EN.EN.EN.EN.ES.ES.N.N.N.L.EN.EN.EN.EN.EN.EN.EN.EN.EN.EN.ES.ES.N.N.N.N.L.L.L.L.L.L.L.L.L.L.L.L.L.N.N.N.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.ET.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.L.L.L.L.L.L.L.N.N.N.N.N.N.N.N.N.N.N.N.L.L.L.L.L.N.N.N.N.N.R.NSM.R.R.R.R.R.R.R.R.R.R.ES.R.R.R.R.R.R.R.R.R.R.R.R.R.N.R.R.R.R.R.N.R.N.R.R.N.R.R.N.R.R.R.R.R.R.R.R.R.R.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.NSM.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.CS.N.CS.N.N.CS.N.N.N.N.N.N.N.N.N.ET.N.N.ES.ES.N.N.N.N.N.ET.ET.N.N.N.N.N.AL.AL.AL.AL.AL.N.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.AL.N.N.BN.N.N.N.ET.ET.ET.N.N.N.N.N.ES.CS.ES.CS.CS.EN.EN.EN.EN.EN.EN.EN.EN.EN.EN.CS.N.N.N.N.N.N.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.N.N.N.N.N.N.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.N.N.N.N.N.N.N.N.N.N.N.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.N.N.N.L.L.L.L.L.L.N.N.L.L.L.L.L.L.N.N.L.L.L.L.L.L.N.N.L.L.L.N.N.N.ET.ET.N.N.N.ET.ET.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N`.split(`.`),n=new e.__bidiEngine__({isInputVisual:!0});e.API.events.push([`postProcessText`,function(e){var t=e.text;e.x,e.y;var r=e.options||{};e.mutex,r.lang;var i=[];if(r.isInputVisual=typeof r.isInputVisual!=`boolean`||r.isInputVisual,n.setOptions(r),Object.prototype.toString.call(t)===`[object Array]`){var a=0;for(i=[],a=0;a<t.length;a+=1)Object.prototype.toString.call(t[a])===`[object Array]`?i.push([n.doBidiReorder(t[a][0]),t[a][1],t[a][2]]):i.push([n.doBidiReorder(t[a])]);e.text=i}else e.text=n.doBidiReorder(t);n.setOptions({isInputVisual:!0})}])}(FL),FL.API.TTFFont=function(){function e(e){var t;if(this.rawData=e,t=this.contents=new lz(e),this.contents.pos=4,t.readString(4)===`ttcf`)throw Error(`TTCF not supported.`);t.pos=0,this.parse(),this.subset=new Oz(this),this.registerTTF()}return e.open=function(t){return new e(t)},e.prototype.parse=function(){return this.directory=new uz(this.contents),this.head=new pz(this),this.name=new bz(this),this.cmap=new hz(this),this.toUnicode={},this.hhea=new gz(this),this.maxp=new xz(this),this.hmtx=new Sz(this),this.post=new vz(this),this.os2=new _z(this),this.loca=new Dz(this),this.glyf=new wz(this),this.ascender=this.os2.exists&&this.os2.ascender||this.hhea.ascender,this.decender=this.os2.exists&&this.os2.decender||this.hhea.decender,this.lineGap=this.os2.exists&&this.os2.lineGap||this.hhea.lineGap,this.bbox=[this.head.xMin,this.head.yMin,this.head.xMax,this.head.yMax]},e.prototype.registerTTF=function(){var e,t,n,r,i;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=function(){var t,n,r,i;for(i=[],t=0,n=(r=this.bbox).length;t<n;t++)e=r[t],i.push(Math.round(e*this.scaleFactor));return i}.call(this),this.stemV=0,this.post.exists?(n=255&(r=this.post.italic_angle),32768&(t=r>>16)&&(t=-(1+(65535^t))),this.italicAngle=+(t+`.`+n)):this.italicAngle=0,this.ascender=Math.round(this.ascender*this.scaleFactor),this.decender=Math.round(this.decender*this.scaleFactor),this.lineGap=Math.round(this.lineGap*this.scaleFactor),this.capHeight=this.os2.exists&&this.os2.capHeight||this.ascender,this.xHeight=this.os2.exists&&this.os2.xHeight||0,this.familyClass=(this.os2.exists&&this.os2.familyClass||0)>>8,this.isSerif=(i=this.familyClass)===1||i===2||i===3||i===4||i===5||i===7,this.isScript=this.familyClass===10,this.flags=0,this.post.isFixedPitch&&(this.flags|=1),this.isSerif&&(this.flags|=2),this.isScript&&(this.flags|=8),this.italicAngle!==0&&(this.flags|=64),this.flags|=32,!this.cmap.unicode)throw Error(`No unicode cmap for font`)},e.prototype.characterToGlyph=function(e){return this.cmap.unicode?.codeMap[e]||0},e.prototype.widthOfGlyph=function(e){var t;return t=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(e).advance*t},e.prototype.widthOfString=function(e,t,n){var r,i,a,o;for(a=0,i=0,o=(e=``+e).length;0<=o?i<o:i>o;i=0<=o?++i:--i)r=e.charCodeAt(i),a+=this.widthOfGlyph(this.characterToGlyph(r))+1e3/t*n||0;return t/1e3*a},e.prototype.lineHeight=function(e,t){var n;return t??=!1,n=t?this.lineGap:0,(this.ascender+n-this.decender)/1e3*e},e}();var cz,lz=function(){function e(e){this.data=e??[],this.pos=0,this.length=this.data.length}return e.prototype.readByte=function(){return this.data[this.pos++]},e.prototype.writeByte=function(e){return this.data[this.pos++]=e},e.prototype.readUInt32=function(){return 16777216*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},e.prototype.writeUInt32=function(e){return this.writeByte(e>>>24&255),this.writeByte(e>>16&255),this.writeByte(e>>8&255),this.writeByte(255&e)},e.prototype.readInt32=function(){var e;return(e=this.readUInt32())>=2147483648?e-4294967296:e},e.prototype.writeInt32=function(e){return e<0&&(e+=4294967296),this.writeUInt32(e)},e.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},e.prototype.writeUInt16=function(e){return this.writeByte(e>>8&255),this.writeByte(255&e)},e.prototype.readInt16=function(){var e;return(e=this.readUInt16())>=32768?e-65536:e},e.prototype.writeInt16=function(e){return e<0&&(e+=65536),this.writeUInt16(e)},e.prototype.readString=function(e){var t,n;for(n=[],t=0;0<=e?t<e:t>e;t=0<=e?++t:--t)n[t]=String.fromCharCode(this.readByte());return n.join(``)},e.prototype.writeString=function(e){var t,n,r;for(r=[],t=0,n=e.length;0<=n?t<n:t>n;t=0<=n?++t:--t)r.push(this.writeByte(e.charCodeAt(t)));return r},e.prototype.readShort=function(){return this.readInt16()},e.prototype.writeShort=function(e){return this.writeInt16(e)},e.prototype.readLongLong=function(){var e,t,n,r,i,a,o,s;return e=this.readByte(),t=this.readByte(),n=this.readByte(),r=this.readByte(),i=this.readByte(),a=this.readByte(),o=this.readByte(),s=this.readByte(),128&e?-1*(72057594037927940*(255^e)+281474976710656*(255^t)+1099511627776*(255^n)+4294967296*(255^r)+16777216*(255^i)+65536*(255^a)+256*(255^o)+(255^s)+1):72057594037927940*e+281474976710656*t+1099511627776*n+4294967296*r+16777216*i+65536*a+256*o+s},e.prototype.writeLongLong=function(e){var t,n;return t=Math.floor(e/4294967296),n=4294967295&e,this.writeByte(t>>24&255),this.writeByte(t>>16&255),this.writeByte(t>>8&255),this.writeByte(255&t),this.writeByte(n>>24&255),this.writeByte(n>>16&255),this.writeByte(n>>8&255),this.writeByte(255&n)},e.prototype.readInt=function(){return this.readInt32()},e.prototype.writeInt=function(e){return this.writeInt32(e)},e.prototype.read=function(e){var t,n;for(t=[],n=0;0<=e?n<e:n>e;n=0<=e?++n:--n)t.push(this.readByte());return t},e.prototype.write=function(e){var t,n,r,i;for(i=[],n=0,r=e.length;n<r;n++)t=e[n],i.push(this.writeByte(t));return i},e}(),uz=function(){var e;function t(e){var t,n,r;for(this.scalarType=e.readInt(),this.tableCount=e.readShort(),this.searchRange=e.readShort(),this.entrySelector=e.readShort(),this.rangeShift=e.readShort(),this.tables={},n=0,r=this.tableCount;0<=r?n<r:n>r;n=0<=r?++n:--n)t={tag:e.readString(4),checksum:e.readInt(),offset:e.readInt(),length:e.readInt()},this.tables[t.tag]=t}return t.prototype.encode=function(t){var n,r,i,a,o,s,c,l,u,d,f,p,m;for(m in f=Object.keys(t).length,s=Math.log(2),u=16*Math.floor(Math.log(f)/s),a=Math.floor(u/s),l=16*f-u,(r=new lz).writeInt(this.scalarType),r.writeShort(f),r.writeShort(u),r.writeShort(a),r.writeShort(l),i=16*f,c=r.pos+i,o=null,p=[],t)for(d=t[m],r.writeString(m),r.writeInt(e(d)),r.writeInt(c),r.writeInt(d.length),p=p.concat(d),m===`head`&&(o=c),c+=d.length;c%4;)p.push(0),c++;return r.write(p),n=2981146554-e(r.data),r.pos=o+8,r.writeUInt32(n),r.data},e=function(e){var t,n,r,i;for(e=Cz.call(e);e.length%4;)e.push(0);for(r=new lz(e),n=0,t=0,i=e.length;t<i;t=t+=4)n+=r.readUInt32();return 4294967295&n},t}(),dz={}.hasOwnProperty,fz=function(e,t){for(var n in t)dz.call(t,n)&&(e[n]=t[n]);function r(){this.constructor=e}return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};cz=function(){function e(e){var t;this.file=e,t=this.file.directory.tables[this.tag],this.exists=!!t,t&&(this.offset=t.offset,this.length=t.length,this.parse(this.file.contents))}return e.prototype.parse=function(){},e.prototype.encode=function(){},e.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},e}();var pz=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return fz(e,cz),e.prototype.tag=`head`,e.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.revision=e.readInt(),this.checkSumAdjustment=e.readInt(),this.magicNumber=e.readInt(),this.flags=e.readShort(),this.unitsPerEm=e.readShort(),this.created=e.readLongLong(),this.modified=e.readLongLong(),this.xMin=e.readShort(),this.yMin=e.readShort(),this.xMax=e.readShort(),this.yMax=e.readShort(),this.macStyle=e.readShort(),this.lowestRecPPEM=e.readShort(),this.fontDirectionHint=e.readShort(),this.indexToLocFormat=e.readShort(),this.glyphDataFormat=e.readShort()},e.prototype.encode=function(e){var t;return(t=new lz).writeInt(this.version),t.writeInt(this.revision),t.writeInt(this.checkSumAdjustment),t.writeInt(this.magicNumber),t.writeShort(this.flags),t.writeShort(this.unitsPerEm),t.writeLongLong(this.created),t.writeLongLong(this.modified),t.writeShort(this.xMin),t.writeShort(this.yMin),t.writeShort(this.xMax),t.writeShort(this.yMax),t.writeShort(this.macStyle),t.writeShort(this.lowestRecPPEM),t.writeShort(this.fontDirectionHint),t.writeShort(e),t.writeShort(this.glyphDataFormat),t.data},e}(),mz=function(){function e(e,t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v;switch(this.platformID=e.readUInt16(),this.encodingID=e.readShort(),this.offset=t+e.readInt(),u=e.pos,e.pos=this.offset,this.format=e.readUInt16(),this.length=e.readUInt16(),this.language=e.readUInt16(),this.isUnicode=this.platformID===3&&this.encodingID===1&&this.format===4||this.platformID===0&&this.format===4,this.codeMap={},this.format){case 0:for(s=0;s<256;++s)this.codeMap[s]=e.readByte();break;case 4:for(f=e.readUInt16(),d=f/2,e.pos+=6,i=function(){var t,n;for(n=[],s=t=0;0<=d?t<d:t>d;s=0<=d?++t:--t)n.push(e.readUInt16());return n}(),e.pos+=2,m=function(){var t,n;for(n=[],s=t=0;0<=d?t<d:t>d;s=0<=d?++t:--t)n.push(e.readUInt16());return n}(),c=function(){var t,n;for(n=[],s=t=0;0<=d?t<d:t>d;s=0<=d?++t:--t)n.push(e.readUInt16());return n}(),l=function(){var t,n;for(n=[],s=t=0;0<=d?t<d:t>d;s=0<=d?++t:--t)n.push(e.readUInt16());return n}(),r=(this.length-e.pos+this.offset)/2,o=function(){var t,n;for(n=[],s=t=0;0<=r?t<r:t>r;s=0<=r?++t:--t)n.push(e.readUInt16());return n}(),s=g=0,v=i.length;g<v;s=++g)for(h=i[s],n=_=p=m[s];p<=h?_<=h:_>=h;n=p<=h?++_:--_)l[s]===0?a=n+c[s]:(a=o[l[s]/2+(n-p)-(d-s)]||0)!==0&&(a+=c[s]),this.codeMap[n]=65535&a}e.pos=u}return e.encode=function(e,t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,N,P,F,I,L,R,z,B,V,ee,te,H,ne,re,ie;switch(k=new lz,a=Object.keys(e).sort(function(e,t){return e-t}),t){case`macroman`:for(m=0,h=function(){var e=[];for(p=0;p<256;++p)e.push(0);return e}(),_={0:0},i={},A=0,P=a.length;A<P;A++)_[H=e[r=a[A]]]??(_[H]=++m),i[r]={old:e[r],new:_[e[r]]},h[r]=_[e[r]];return k.writeUInt16(1),k.writeUInt16(0),k.writeUInt32(12),k.writeUInt16(0),k.writeUInt16(262),k.writeUInt16(0),k.write(h),{charMap:i,subtable:k.data,maxGlyphID:m+1};case`unicode`:for(D=[],u=[],v=0,_={},n={},g=c=null,j=0,F=a.length;j<F;j++)_[b=e[r=a[j]]]??(_[b]=++v),n[r]={old:b,new:_[b]},o=_[b]-r,g!=null&&o===c||(g&&u.push(g),D.push(r),c=o),g=r;for(g&&u.push(g),u.push(65535),D.push(65535),T=2*(w=D.length),C=2*(Math.log(w)/Math.LN2)**2,d=Math.log(C/2)/Math.LN2,S=2*w-C,s=[],x=[],f=[],p=M=0,I=D.length;M<I;p=++M){if(E=D[p],l=u[p],E===65535){s.push(0),x.push(0);break}if(E-(O=n[E].new)>=32768)for(s.push(0),x.push(2*(f.length+w-p)),r=N=E;E<=l?N<=l:N>=l;r=E<=l?++N:--N)f.push(n[r].new);else s.push(O-E),x.push(0)}for(k.writeUInt16(3),k.writeUInt16(1),k.writeUInt32(12),k.writeUInt16(4),k.writeUInt16(16+8*w+2*f.length),k.writeUInt16(0),k.writeUInt16(T),k.writeUInt16(C),k.writeUInt16(d),k.writeUInt16(S),ee=0,L=u.length;ee<L;ee++)r=u[ee],k.writeUInt16(r);for(k.writeUInt16(0),te=0,R=D.length;te<R;te++)r=D[te],k.writeUInt16(r);for(ne=0,z=s.length;ne<z;ne++)o=s[ne],k.writeUInt16(o);for(re=0,B=x.length;re<B;re++)y=x[re],k.writeUInt16(y);for(ie=0,V=f.length;ie<V;ie++)m=f[ie],k.writeUInt16(m);return{charMap:n,subtable:k.data,maxGlyphID:v+1}}},e}(),hz=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return fz(e,cz),e.prototype.tag=`cmap`,e.prototype.parse=function(e){var t,n,r;for(e.pos=this.offset,this.version=e.readUInt16(),r=e.readUInt16(),this.tables=[],this.unicode=null,n=0;0<=r?n<r:n>r;n=0<=r?++n:--n)t=new mz(e,this.offset),this.tables.push(t),t.isUnicode&&this.unicode==null&&(this.unicode=t);return!0},e.encode=function(e,t){var n,r;return t??=`macroman`,n=mz.encode(e,t),(r=new lz).writeUInt16(0),r.writeUInt16(1),n.table=r.data.concat(n.subtable),n},e}(),gz=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return fz(e,cz),e.prototype.tag=`hhea`,e.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.ascender=e.readShort(),this.decender=e.readShort(),this.lineGap=e.readShort(),this.advanceWidthMax=e.readShort(),this.minLeftSideBearing=e.readShort(),this.minRightSideBearing=e.readShort(),this.xMaxExtent=e.readShort(),this.caretSlopeRise=e.readShort(),this.caretSlopeRun=e.readShort(),this.caretOffset=e.readShort(),e.pos+=8,this.metricDataFormat=e.readShort(),this.numberOfMetrics=e.readUInt16()},e}(),_z=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return fz(e,cz),e.prototype.tag=`OS/2`,e.prototype.parse=function(e){if(e.pos=this.offset,this.version=e.readUInt16(),this.averageCharWidth=e.readShort(),this.weightClass=e.readUInt16(),this.widthClass=e.readUInt16(),this.type=e.readShort(),this.ySubscriptXSize=e.readShort(),this.ySubscriptYSize=e.readShort(),this.ySubscriptXOffset=e.readShort(),this.ySubscriptYOffset=e.readShort(),this.ySuperscriptXSize=e.readShort(),this.ySuperscriptYSize=e.readShort(),this.ySuperscriptXOffset=e.readShort(),this.ySuperscriptYOffset=e.readShort(),this.yStrikeoutSize=e.readShort(),this.yStrikeoutPosition=e.readShort(),this.familyClass=e.readShort(),this.panose=function(){var t,n;for(n=[],t=0;t<10;++t)n.push(e.readByte());return n}(),this.charRange=function(){var t,n;for(n=[],t=0;t<4;++t)n.push(e.readInt());return n}(),this.vendorID=e.readString(4),this.selection=e.readShort(),this.firstCharIndex=e.readShort(),this.lastCharIndex=e.readShort(),this.version>0&&(this.ascent=e.readShort(),this.descent=e.readShort(),this.lineGap=e.readShort(),this.winAscent=e.readShort(),this.winDescent=e.readShort(),this.codePageRange=function(){var t,n;for(n=[],t=0;t<2;t=++t)n.push(e.readInt());return n}(),this.version>1))return this.xHeight=e.readShort(),this.capHeight=e.readShort(),this.defaultChar=e.readShort(),this.breakChar=e.readShort(),this.maxContext=e.readShort()},e}(),vz=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return fz(e,cz),e.prototype.tag=`post`,e.prototype.parse=function(e){var t,n,r;switch(e.pos=this.offset,this.format=e.readInt(),this.italicAngle=e.readInt(),this.underlinePosition=e.readShort(),this.underlineThickness=e.readShort(),this.isFixedPitch=e.readInt(),this.minMemType42=e.readInt(),this.maxMemType42=e.readInt(),this.minMemType1=e.readInt(),this.maxMemType1=e.readInt(),this.format){case 65536:case 196608:break;case 131072:var i;for(n=e.readUInt16(),this.glyphNameIndex=[],i=0;0<=n?i<n:i>n;i=0<=n?++i:--i)this.glyphNameIndex.push(e.readUInt16());for(this.names=[],r=[];e.pos<this.offset+this.length;)t=e.readByte(),r.push(this.names.push(e.readString(t)));return r;case 151552:return n=e.readUInt16(),this.offsets=e.read(n);case 262144:return this.map=function(){var t,n,r;for(r=[],i=t=0,n=this.file.maxp.numGlyphs;0<=n?t<n:t>n;i=0<=n?++t:--t)r.push(e.readUInt32());return r}.call(this)}},e}(),yz=function(e,t){this.raw=e,this.length=e.length,this.platformID=t.platformID,this.encodingID=t.encodingID,this.languageID=t.languageID},bz=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return fz(e,cz),e.prototype.tag=`name`,e.prototype.parse=function(e){var t,n,r,i,a,o,s,c,l,u,d;for(e.pos=this.offset,e.readShort(),t=e.readShort(),o=e.readShort(),n=[],i=0;0<=t?i<t:i>t;i=0<=t?++i:--i)n.push({platformID:e.readShort(),encodingID:e.readShort(),languageID:e.readShort(),nameID:e.readShort(),length:e.readShort(),offset:this.offset+o+e.readShort()});for(s={},i=l=0,u=n.length;l<u;i=++l)r=n[i],e.pos=r.offset,c=e.readString(r.length),a=new yz(c,r),s[d=r.nameID]??(s[d]=[]),s[r.nameID].push(a);this.strings=s,this.copyright=s[0],this.fontFamily=s[1],this.fontSubfamily=s[2],this.uniqueSubfamily=s[3],this.fontName=s[4],this.version=s[5];try{this.postscriptName=s[6][0].raw.replace(/[\x00-\x19\x80-\xff]/g,``)}catch{this.postscriptName=s[4][0].raw.replace(/[\x00-\x19\x80-\xff]/g,``)}return this.trademark=s[7],this.manufacturer=s[8],this.designer=s[9],this.description=s[10],this.vendorUrl=s[11],this.designerUrl=s[12],this.license=s[13],this.licenseUrl=s[14],this.preferredFamily=s[15],this.preferredSubfamily=s[17],this.compatibleFull=s[18],this.sampleText=s[19]},e}(),xz=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return fz(e,cz),e.prototype.tag=`maxp`,e.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.numGlyphs=e.readUInt16(),this.maxPoints=e.readUInt16(),this.maxContours=e.readUInt16(),this.maxCompositePoints=e.readUInt16(),this.maxComponentContours=e.readUInt16(),this.maxZones=e.readUInt16(),this.maxTwilightPoints=e.readUInt16(),this.maxStorage=e.readUInt16(),this.maxFunctionDefs=e.readUInt16(),this.maxInstructionDefs=e.readUInt16(),this.maxStackElements=e.readUInt16(),this.maxSizeOfInstructions=e.readUInt16(),this.maxComponentElements=e.readUInt16(),this.maxComponentDepth=e.readUInt16()},e}(),Sz=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return fz(e,cz),e.prototype.tag=`hmtx`,e.prototype.parse=function(e){var t,n,r,i,a,o,s;for(e.pos=this.offset,this.metrics=[],t=0,o=this.file.hhea.numberOfMetrics;0<=o?t<o:t>o;t=0<=o?++t:--t)this.metrics.push({advance:e.readUInt16(),lsb:e.readInt16()});for(r=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=function(){var n,i;for(i=[],t=n=0;0<=r?n<r:n>r;t=0<=r?++n:--n)i.push(e.readInt16());return i}(),this.widths=function(){var e,t,n,r;for(r=[],e=0,t=(n=this.metrics).length;e<t;e++)i=n[e],r.push(i.advance);return r}.call(this),n=this.widths[this.widths.length-1],s=[],t=a=0;0<=r?a<r:a>r;t=0<=r?++a:--a)s.push(this.widths.push(n));return s},e.prototype.forGlyph=function(e){return e in this.metrics?this.metrics[e]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[e-this.metrics.length]}},e}(),Cz=[].slice,wz=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return fz(e,cz),e.prototype.tag=`glyf`,e.prototype.parse=function(){return this.cache={}},e.prototype.glyphFor=function(e){var t,n,r,i,a,o,s,c,l,u;return e in this.cache?this.cache[e]:(i=this.file.loca,t=this.file.contents,n=i.indexOf(e),(r=i.lengthOf(e))===0?this.cache[e]=null:(t.pos=this.offset+n,a=(o=new lz(t.read(r))).readShort(),c=o.readShort(),u=o.readShort(),s=o.readShort(),l=o.readShort(),this.cache[e]=a===-1?new Ez(o,c,u,s,l):new Tz(o,a,c,u,s,l),this.cache[e]))},e.prototype.encode=function(e,t,n){var r,i,a,o,s;for(a=[],i=[],o=0,s=t.length;o<s;o++)r=e[t[o]],i.push(a.length),r&&(a=a.concat(r.encode(n)));return i.push(a.length),{table:a,offsets:i}},e}(),Tz=function(){function e(e,t,n,r,i,a){this.raw=e,this.numberOfContours=t,this.xMin=n,this.yMin=r,this.xMax=i,this.yMax=a,this.compound=!1}return e.prototype.encode=function(){return this.raw.data},e}(),Ez=function(){function e(e,t,n,r,i){var a,o;for(this.raw=e,this.xMin=t,this.yMin=n,this.xMax=r,this.yMax=i,this.compound=!0,this.glyphIDs=[],this.glyphOffsets=[],a=this.raw;o=a.readShort(),this.glyphOffsets.push(a.pos),this.glyphIDs.push(a.readUInt16()),32&o;)a.pos+=1&o?4:2,128&o?a.pos+=8:64&o?a.pos+=4:8&o&&(a.pos+=2)}return e.prototype.encode=function(){var e,t,n;for(t=new lz(Cz.call(this.raw.data)),e=0,n=this.glyphIDs.length;e<n;++e)t.pos=this.glyphOffsets[e];return t.data},e}(),Dz=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return fz(e,cz),e.prototype.tag=`loca`,e.prototype.parse=function(e){var t,n;return e.pos=this.offset,t=this.file.head.indexToLocFormat,this.offsets=t===0?function(){var t,r;for(r=[],n=0,t=this.length;n<t;n+=2)r.push(2*e.readUInt16());return r}.call(this):function(){var t,r;for(r=[],n=0,t=this.length;n<t;n+=4)r.push(e.readUInt32());return r}.call(this)},e.prototype.indexOf=function(e){return this.offsets[e]},e.prototype.lengthOf=function(e){return this.offsets[e+1]-this.offsets[e]},e.prototype.encode=function(e,t){for(var n=new Uint32Array(this.offsets.length),r=0,i=0,a=0;a<n.length;++a)if(n[a]=r,i<t.length&&t[i]==a){++i,n[a]=r;var o=this.offsets[a],s=this.offsets[a+1]-o;s>0&&(r+=s)}for(var c=Array(4*n.length),l=0;l<n.length;++l)c[4*l+3]=255&n[l],c[4*l+2]=(65280&n[l])>>8,c[4*l+1]=(16711680&n[l])>>16,c[4*l]=(4278190080&n[l])>>24;return c},e}(),Oz=function(){function e(e){this.font=e,this.subset={},this.unicodes={},this.next=33}return e.prototype.generateCmap=function(){var e,t,n,r,i;for(t in r=this.font.cmap.tables[0].codeMap,e={},i=this.subset)n=i[t],e[t]=r[n];return e},e.prototype.glyphsFor=function(e){var t,n,r,i,a,o,s;for(r={},a=0,o=e.length;a<o;a++)r[i=e[a]]=this.font.glyf.glyphFor(i);for(i in t=[],r)(n=r[i])!=null&&n.compound&&t.push.apply(t,n.glyphIDs);if(t.length>0)for(i in s=this.glyphsFor(t))n=s[i],r[i]=n;return r},e.prototype.encode=function(e,t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g;for(r in n=hz.encode(this.generateCmap(),`unicode`),a=this.glyphsFor(e),f={0:0},g=n.charMap)f[(s=g[r]).old]=s.new;for(p in d=n.maxGlyphID,a)p in f||(f[p]=d++);return l=function(e){var t,n;for(t in n={},e)n[e[t]]=t;return n}(f),u=Object.keys(l).sort(function(e,t){return e-t}),m=function(){var e,t,n;for(n=[],e=0,t=u.length;e<t;e++)o=u[e],n.push(l[o]);return n}(),i=this.font.glyf.encode(a,m,f),c=this.font.loca.encode(i.offsets,m),h={cmap:this.font.cmap.raw(),glyf:i.table,loca:c,hmtx:this.font.hmtx.raw(),hhea:this.font.hhea.raw(),maxp:this.font.maxp.raw(),post:this.font.post.raw(),name:this.font.name.raw(),head:this.font.head.encode(t)},this.font.os2.exists&&(h[`OS/2`]=this.font.os2.raw()),this.font.directory.encode(h)},e}();FL.API.PDFObject=function(){var e;function t(){}return e=function(e,t){return(Array(t+1).join(`0`)+e).slice(-t)},t.convert=function(n){var r,i,a,o;if(Array.isArray(n))return`[`+function(){var e,i,a;for(a=[],e=0,i=n.length;e<i;e++)r=n[e],a.push(t.convert(r));return a}().join(` `)+`]`;if(typeof n==`string`)return`/`+n;if(n?.isString)return`(`+n+`)`;if(n instanceof Date)return`(D:`+e(n.getUTCFullYear(),4)+e(n.getUTCMonth(),2)+e(n.getUTCDate(),2)+e(n.getUTCHours(),2)+e(n.getUTCMinutes(),2)+e(n.getUTCSeconds(),2)+`Z)`;if({}.toString.call(n)===`[object Object]`){for(i in a=[`<<`],n)o=n[i],a.push(`/`+i+` `+t.convert(o));return a.push(`>>`),a.join(`
`)}return``+n},t}();var kz=3.77952755906,Az={method:`save`,resolution:3,page:{margin:0,format:`A4`,orientation:`portrait`},canvas:{mimeType:`image/jpeg`,qualityRatio:1,useCORS:!0,logging:!1},overrides:{}},jz=class{pdf;canvas;options;constructor(e,t){this.canvas=e,this.options=t,this.pdf=new FL({format:this.options.page.format,orientation:this.options.page.orientation,...this.options.overrides?.pdf,unit:`mm`})}getMarginTopMM(){let e=typeof this.options.page.margin==`object`?this.options.page.margin.top:this.options.page.margin;return Number(e)}getMarginLeftMM(){let e=typeof this.options.page.margin==`object`?this.options.page.margin.left:this.options.page.margin;return Number(e)}getMarginRightMM(){let e=typeof this.options.page.margin==`object`?this.options.page.margin.right:this.options.page.margin;return Number(e)}getMarginBottomMM(){let e=typeof this.options.page.margin==`object`?this.options.page.margin.bottom:this.options.page.margin;return Number(e)}getMarginTop(){return this.getMarginTopMM()*kz}getMarginBottom(){return this.getMarginBottomMM()*kz}getMarginLeft(){return this.getMarginLeftMM()*kz}getMarginRight(){return this.getMarginRightMM()*kz}getScale(){return this.options.resolution}getPageHeight(){return this.getPageHeightMM()*kz}getPageHeightMM(){return this.pdf.internal.pageSize.height}getPageWidthMM(){return this.pdf.internal.pageSize.width}getPageWidth(){return this.getPageWidthMM()*kz}getOriginalCanvasWidth(){return this.canvas.width/this.getScale()}getOriginalCanvasHeight(){return this.canvas.height/this.getScale()}getCanvasPageAvailableHeight(){return this.getPageAvailableHeight()*this.getScale()*this.getHorizontalFitFactor()}getPageAvailableWidth(){return this.getPageWidth()-(this.getMarginLeft()+this.getMarginRight())}getPageAvailableHeight(){return this.getPageHeight()-(this.getMarginTop()+this.getMarginBottom())}getPageAvailableWidthMM(){return this.getPageAvailableWidth()/kz}getPageAvailableHeightMM(){return this.getPageAvailableHeight()/kz}getNumberPages(){return Math.ceil(this.canvas.height/this.getCanvasPageAvailableHeight())}getHorizontalFitFactor(){return this.getPageAvailableWidth()<this.getOriginalCanvasWidth()?this.getOriginalCanvasWidth()/this.getPageAvailableWidth():1}getCanvasOffsetY(e){return this.getCanvasPageAvailableHeight()*(e-1)}getCanvasHeightLeft(e){return this.canvas.height-this.getCanvasOffsetY(e)}getCanvasPageHeight(e){if(this.canvas.height<this.getCanvasPageAvailableHeight())return this.canvas.height;let t=this.getCanvasHeightLeft(e);return t<this.getCanvasPageAvailableHeight()?t:this.getCanvasPageAvailableHeight()}getCanvasPageWidth(){return this.canvas.width}createCanvasPage(e){let t=this.getCanvasPageWidth(),n=this.getCanvasPageHeight(e),r=document.createElement(`canvas`);return r.setAttribute(`width`,String(t)),r.setAttribute(`height`,String(n)),r.getContext(`2d`).drawImage(this.canvas,0,this.getCanvasOffsetY(e),this.canvas.width,n,0,0,this.canvas.width,n),r}convert(){let e=1,t=this.getNumberPages();for(;e<=t;){e>1&&this.pdf.addPage(this.options.page.format,this.options.page.orientation);let t=this.createCanvasPage(e),n=t.toDataURL(this.options.canvas.mimeType,this.options.canvas.qualityRatio);this.pdf.setPage(e),this.pdf.addImage({imageData:n,width:t.width/(this.getScale()*kz*this.getHorizontalFitFactor()),height:t.height/(this.getScale()*kz*this.getHorizontalFitFactor()),x:this.getMarginLeftMM(),y:this.getMarginTopMM()}),e+=1}return this.pdf}},Mz=e=>e?{...Az,...e,canvas:{...Az.canvas,...e.canvas},page:{...Az.page,...e.page}}:Az,Nz=e=>typeof e==`function`?e():e?.current,Pz=async(e,t)=>{let n=Mz(t),r=Nz(e);if(!r){console.error(`Unable to get the target element.`);return}let i=new jz(await Di(r,{useCORS:n.canvas.useCORS,logging:n.canvas.logging,scale:n.resolution,...n.overrides?.canvas}),n).convert();switch(n.method){case`build`:return i;case`open`:return window.open(i.output(`bloburl`),`_blank`),i;default:{let e=n.filename??`${new Date().getTime()}.pdf`;return await i.save(e,{returnPromise:!0}),i}}},Fz={method:`open`,overrides:{pdf:{compress:!0}}},Iz=()=>document.getElementById(`main-page`),Lz=({filename:e})=>{let[t,n]=(0,Z.useState)(!1);return(0,Q.jsx)(q,{variant:`outline`,size:`icon`,className:`size-7.5`,onClick:async()=>{n(!0),await Pz(Iz,{...Fz,filename:e}),n(!1)},disabled:t,children:t?(0,Q.jsx)(Tn,{className:`h-10 w-10 animate-spin mr-2 self-center`}):(0,Q.jsx)(ua,{className:`size-5`})})},Rz=`regenerateLedgerRecords`,zz=()=>{let[{fetching:e},t]=p(Me);return{fetching:e,regenerateLedgerRecords:(0,Z.useCallback)(async e=>{let n=`Error regenerating ledger`,r=`${Rz}-${e.chargeId}`;K.loading(`Regenerating Ledger`,{id:r});try{let i=Xe(await t(e),n,r,`regenerateLedgerRecords`);if(i)return K.success(`Success`,{id:r,description:`Ledger records were regenerated`}),i.regenerateLedgerRecords}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}};function Bz({chargeId:e,onChange:t,...n}){let{regenerateLedgerRecords:r}=zz();function i(){r({chargeId:e}).then(t)}return(0,Q.jsx)(FK,{content:`Regenerate Ledger`,children:(0,Q.jsx)(t4,{onConfirm:i,title:`Are you sure you want to regenerate ledger records?`,children:(0,Q.jsx)(q,{variant:`outline`,size:`icon`,...n,className:s(`size-7.5`,n.className),children:(0,Q.jsx)(fa,{className:`size-5`})})})})}function Vz(e){let{toggleExpansion:t,isExpanded:n,onClickAction:r}=e;return(0,Q.jsx)(FK,{content:`Expand info`,children:(0,Q.jsx)(q,{variant:n?`default`:`outline`,onClick:e=>{e.stopPropagation(),t(e=>(r&&r(e),!e))},className:`size-7.5`,children:n?(0,Q.jsx)(aa,{className:`size-5`}):(0,Q.jsx)(oa,{className:`size-5`})})})}function Hz(e){let{mergeSelected:t,toggleMergeSelected:n}=e,[r,i]=(0,Z.useState)(t?`default`:`ghost`);return(0,Z.useEffect)(()=>{i(t?`default`:`ghost`)},[t]),(0,Q.jsx)(FK,{content:`Select for merge`,children:(0,Q.jsx)(q,{onClick:e=>{e.stopPropagation(),n()},variant:r,className:s(`size-7.5`,t?`bg-blue-500 hover:bg-blue-500/90`:``),children:(0,Q.jsx)(Bi,{className:`size-5`})})})}var Uz=`updateDocument`,Wz=()=>{let[{fetching:e},t]=p(M);return{fetching:e,updateDocument:(0,Z.useCallback)(async e=>{let n=`Error updating document ID [${e.documentId}]`,r=`${Uz}-${e.documentId}`;K.loading(`Updating document`,{id:r});try{let i=Xe(await t(e),n,r,`updateDocument`);if(i)return K.success(`Success`,{id:r,description:`Document updated`}),i.updateDocument}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}};function Gz({documentId:e}){let{updateDocument:t}=Wz();function n(){t({documentId:e,fields:{chargeId:El}})}return(0,Q.jsx)(t4,{onConfirm:n,title:`Are you sure you want to unlink this document from the charge?`,children:(0,Q.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7.5`,children:(0,Q.jsx)(xa,{className:`size-5`})})})}var Kz=`updateTransaction`,qz=()=>{let[{fetching:e},t]=p(_e);return{fetching:e,updateTransaction:(0,Z.useCallback)(async e=>{let n=`Error updating transaction ID [${e.transactionId}]`,r=`${Kz}-${e.transactionId}`;K.loading(`Updating Transaction`,{id:r});try{let i=Xe(await t(e),n,r,`updateTransaction`);if(i)return K.success(`Success`,{id:r,description:`Transaction updated`}),i.updateTransaction}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}};function Jz({transactionId:e}){let{updateTransaction:t}=qz();function n(){t({transactionId:e,fields:{chargeId:El}})}return(0,Q.jsx)(t4,{onConfirm:n,title:`Are you sure you want to unlink this transaction from the charge?`,children:(0,Q.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7.5`,children:(0,Q.jsx)(xa,{className:`size-5`})})})}function Yz({column:e,title:t,className:n}){return e.getCanSort()?(0,Q.jsx)(`div`,{className:s(`flex items-center gap-2`,n),children:(0,Q.jsxs)(In,{children:[(0,Q.jsx)(Pn,{asChild:!0,children:(0,Q.jsxs)(q,{variant:`ghost`,size:`sm`,className:`data-[state=open]:bg-accent -ml-3 h-8`,children:[(0,Q.jsx)(`span`,{children:t}),e.getIsSorted()===`desc`?(0,Q.jsx)(ki,{}):e.getIsSorted()===`asc`?(0,Q.jsx)(ji,{}):(0,Q.jsx)(Ii,{})]})}),(0,Q.jsxs)(jn,{align:`start`,children:[(0,Q.jsxs)(Mn,{onClick:()=>e.toggleSorting(!1),children:[(0,Q.jsx)(ji,{}),`Asc`]}),(0,Q.jsxs)(Mn,{onClick:()=>e.toggleSorting(!0),children:[(0,Q.jsx)(ki,{}),`Desc`]}),(0,Q.jsx)(Ln,{}),(0,Q.jsxs)(Mn,{onClick:()=>e.toggleVisibility(!1),children:[(0,Q.jsx)(Wi,{}),`Hide`]})]})]})}):(0,Q.jsx)(`div`,{className:s(n),children:t})}function Xz({table:e}){return(0,Q.jsxs)(`div`,{className:`flex items-center space-x-6 lg:space-x-8`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:`Rows per page`}),(0,Q.jsxs)(Sn,{value:String(e.getState().pagination.pageSize),onValueChange:t=>{e.setPageSize(Number(t))},children:[(0,Q.jsx)(rn,{className:`h-8 w-[70px]`,children:(0,Q.jsx)(qt,{placeholder:e.getState().pagination.pageSize})}),(0,Q.jsx)(fn,{side:`top`,children:[10,20,30,40,50,100].map(e=>(0,Q.jsx)(yn,{value:String(e),children:e},e))})]})]}),(0,Q.jsxs)(`div`,{className:`flex w-[100px] items-center justify-center text-sm font-medium`,children:[`Page `,e.getState().pagination.pageIndex+1,` of `,e.getPageCount()]}),(0,Q.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,Q.jsxs)(q,{variant:`outline`,className:`hidden h-8 w-8 p-0 lg:flex`,onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),children:[(0,Q.jsx)(`span`,{className:`sr-only`,children:`Go to first page`}),(0,Q.jsx)(Pi,{})]}),(0,Q.jsxs)(q,{variant:`outline`,className:`h-8 w-8 p-0`,onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:[(0,Q.jsx)(`span`,{className:`sr-only`,children:`Go to previous page`}),(0,Q.jsx)(Ni,{})]}),(0,Q.jsxs)(q,{variant:`outline`,className:`h-8 w-8 p-0`,onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:[(0,Q.jsx)(`span`,{className:`sr-only`,children:`Go to next page`}),(0,Q.jsx)(en,{})]}),(0,Q.jsxs)(q,{variant:`outline`,className:`hidden h-8 w-8 p-0 lg:flex`,onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),children:[(0,Q.jsx)(`span`,{className:`sr-only`,children:`Go to last page`}),(0,Q.jsx)(Fi,{})]})]})]})}var Zz=()=>{let[{data:e,fetching:t,error:n},r]=H({query:O});n&&(console.error(`Error fetching tags: ${n}`),K.error(`Error`,{description:`Unable to fetch tags`}));let i=(0,Z.useMemo)(()=>zl(e?.allTags??[]),[e]);return{fetching:t,refresh:()=>r(),tags:i,selectableTags:(0,Z.useMemo)(()=>i.map(e=>({value:e.id,label:e.name,description:e.namePath?e.namePath.join(` > `):void 0})),[i])}},Qz=()=>{let[{data:e,fetching:t,error:n},r]=H({query:dt});n&&(console.error(`Error fetching tax categories: ${n}`),K.error(`Error`,{description:`Unable to fetch tax categories`}));let i=(0,Z.useMemo)(()=>e?.taxCategories?.sort((e,t)=>e.name>t.name?1:-1)??[],[e]);return{fetching:t,refresh:()=>r(),taxCategories:i,selectableTaxCategories:(0,Z.useMemo)(()=>i.map(e=>({value:e.id,label:e.name})),[i])}},$z=`updateCharge`,eB=()=>{let[{fetching:e},t]=p(Ue);return{fetching:e,updateCharge:(0,Z.useCallback)(async e=>{let n=`Error updating charge ID [${e.chargeId}]`,r=`${$z}-${e.chargeId}`;K.loading(`Updating charge`,{id:r});try{let i=Xe(await t(e),n,r,`updateCharge`);if(i)return K.success(`Success`,{id:r,description:`Charge updated`}),i.updateCharge.charge}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}};function tB({className:e,...t}){return(0,Q.jsx)(fs,{"data-slot":`switch`,className:s(`peer data-[state=checked]:bg-gray-900 data-[state=unchecked]:bg-gray-200 focus-visible:border-gray-950 focus-visible:ring-gray-950/50 dark:data-[state=unchecked]:bg-gray-200/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-gray-200 border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 dark:data-[state=checked]:bg-gray-50 dark:data-[state=unchecked]:bg-gray-800 dark:focus-visible:border-gray-300 dark:focus-visible:ring-gray-300/50 dark:dark:data-[state=unchecked]:bg-gray-800/80 dark:border-gray-800`,e),...t,children:(0,Q.jsx)(ms,{"data-slot":`switch-thumb`,className:s(`bg-white dark:data-[state=unchecked]:bg-gray-950 dark:data-[state=checked]:bg-gray-50 pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:bg-gray-950 dark:dark:data-[state=unchecked]:bg-gray-50 dark:dark:data-[state=checked]:bg-gray-900`)})})}var nB=Object.entries(vl).map(([e,t])=>({value:Sl(e),label:t})),rB=({charge:e,close:t,onChange:n})=>{let{updateCharge:r,fetching:i}=eB(),[a,o]=(0,Z.useState)([]),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(void 0),d=(0,Z.useMemo)(()=>({tags:e.tags?.map(e=>({id:e.id})),counterpartyId:e.counterparty?.id,businessTripID:`businessTrip`in e?e.businessTrip?.id:void 0,defaultTaxCategoryID:e.taxCategory?.id,isDecreasedVAT:e.decreasedVAT,isInvoicePaymentDifferentCurrency:e.isInvoicePaymentDifferentCurrency,optionalDocuments:e.optionalDocuments,optionalVAT:e.optionalVAT,ownerId:e.owner?.id,type:Sl(e.__typename),userDescription:e.userDescription,yearsOfRelevance:e.yearsOfRelevance?.map(e=>({year:e.year,amount:e.amount})).sort((e,t)=>e.year>t.year?1:-1)}),[e]),f=Xn({defaultValues:d}),{control:p,handleSubmit:m,formState:{dirtyFields:h}}=f,g=async i=>{let a=gt(i,h);if(a&&Object.keys(a).length>0)if(await r({chargeId:e.id,fields:{...a,yearsOfRelevance:i.yearsOfRelevance?Object.values(i.yearsOfRelevance):void 0}}),a.tags?.length||a.userDescription){let t={};if(a.tags){let n=e?.missingInfoSuggestions?.tags??[],r=new Set(n.map(e=>e.id)),i=new Set(a.tags.map(e=>e.id));(r.size!==i.size||[...r].some(e=>!i.has(e)))&&(t.tagIds=a.tags.map(e=>({id:e.id})))}u(t),c(!0)}else t(),n?.()},{selectableTaxCategories:_,fetching:v}=Qz(),{selectableTags:y,fetching:b}=Zz(),[{data:x,fetching:S,error:C},w]=H({query:ot}),T=(0,Z.useCallback)(()=>{w()},[w]);return(0,Z.useEffect)(()=>{C&&K.error(`Error`,{description:`An error occurred while fetching business trips.`})},[C]),(0,Z.useEffect)(()=>{x?.allBusinessTrips.length&&o([...x.allBusinessTrips.map(e=>({value:e.id,label:e.name})).sort((e,t)=>e.label>t.label?1:-1),{value:El,label:`None`}])},[x,o]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(wr,{...f,children:(0,Q.jsxs)(`form`,{onSubmit:m(g),children:[(0,Q.jsx)(`div`,{className:`flex-row px-10 h-max justify-start block`,children:(0,Q.jsxs)($9,{cols:3,children:[(0,Q.jsx)(li,{name:`userDescription`,control:p,defaultValue:d.userDescription,rules:{required:`Required`,minLength:{value:2,message:`Must be at least 2 characters`}},render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Description`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...e,value:e.value??void 0})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`defaultTaxCategoryID`,control:p,defaultValue:d.defaultTaxCategoryID,render:({field:e,fieldState:t})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Tax Category Override`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(Fk,{...e,data:_,value:e.value,disabled:v,placeholder:`Scroll to see all options`,maxDropdownHeight:160,searchable:!0,error:!!t.error})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`businessTripID`,control:p,defaultValue:d.businessTripID,render:({field:e,fieldState:t})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Business Trip`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(Fk,{...e,data:a,value:e.value,disabled:S,placeholder:`Scroll to see all options`,maxDropdownHeight:160,searchable:!0,error:!!t.error,rightSection:(0,Q.jsx)(M4,{onDone:T})})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`tags`,control:p,defaultValue:d.tags,render:({field:e,fieldState:t})=>{let n=e.value?.map(e=>e.id)??[];return(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Tags`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(U0,{asChild:!0,options:Object.values(y),onValueChange:t=>e.onChange(t.map(e=>({id:e}))),defaultValue:n,value:n,placeholder:`Select Tags`,variant:`default`,disabled:b,className:t.error?`border-red-500`:void 0})}),(0,Q.jsx)(Tr,{})]})}}),(0,Q.jsx)(li,{name:`type`,control:p,defaultValue:d.type,render:({field:e,fieldState:t})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Charge Type`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(Fk,{...e,data:nB,value:e.value,placeholder:`Scroll to see all options`,maxDropdownHeight:160,searchable:!0,error:!!t.error})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`isInvoicePaymentDifferentCurrency`,control:p,defaultValue:d.isInvoicePaymentDifferentCurrency,render:({field:e})=>(0,Q.jsxs)(cr,{className:`flex flex-row h-fit items-center justify-between rounded-lg border p-3 shadow-sm`,children:[(0,Q.jsx)(`div`,{className:`space-y-0.5`,children:(0,Q.jsx)(Dr,{children:`Is Invoice-Payment currency difference`})}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(tB,{checked:e.value===!0,onCheckedChange:e.onChange})})]})}),(0,Q.jsx)(li,{name:`isDecreasedVAT`,control:p,defaultValue:d.isDecreasedVAT,render:({field:e})=>(0,Q.jsxs)(cr,{className:`flex flex-row h-fit items-center justify-between rounded-lg border p-3 shadow-sm`,children:[(0,Q.jsx)(`div`,{className:`space-y-0.5`,children:(0,Q.jsx)(Dr,{children:`Is Decreased VAT`})}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(tB,{checked:e.value===!0,onCheckedChange:e.onChange})})]})}),(0,Q.jsx)(li,{name:`optionalVAT`,control:p,defaultValue:d.optionalVAT??!1,render:({field:e})=>(0,Q.jsxs)(cr,{className:`flex flex-row h-fit items-center justify-between rounded-lg border p-3 shadow-sm`,children:[(0,Q.jsx)(`div`,{className:`space-y-0.5`,children:(0,Q.jsx)(Dr,{children:`Optional VAT`})}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(tB,{checked:e.value===!0,onCheckedChange:e.onChange})})]})}),(0,Q.jsx)(li,{name:`optionalDocuments`,control:p,defaultValue:d.optionalDocuments??!1,render:({field:e})=>(0,Q.jsxs)(cr,{className:`flex flex-row h-fit items-center justify-between rounded-lg border p-3 shadow-sm`,children:[(0,Q.jsx)(`div`,{className:`space-y-0.5`,children:(0,Q.jsx)(Dr,{children:`Optional Documents`})}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(tB,{checked:e.value===!0,onCheckedChange:e.onChange})})]})}),(0,Q.jsx)(LK,{formManager:f,chargeSpreadPath:`yearsOfRelevance`})]})}),(0,Q.jsxs)(`div`,{className:`mt-10 mb-5 flex justify-center gap-5`,children:[(0,Q.jsx)(`button`,{type:`submit`,onClick:()=>m(g),className:`mt-8 text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg`,disabled:i||Object.keys(h).length===0,children:`Accept`}),(0,Q.jsx)(`button`,{type:`button`,className:`mt-8 text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg`,onClick:t,children:`Cancel`})]})]})}),(0,Q.jsx)(B9,{chargeId:e.id,tagIds:l?.tagIds,description:l?.description,open:s,onOpenChange:c,onClose:()=>{t(),n?.()},showChargesWithExistingSuggestions:!0})]})},iB=Object.defineProperty,aB=Object.defineProperties,oB=Object.getOwnPropertyDescriptors,sB=Object.getOwnPropertySymbols,cB=Object.prototype.hasOwnProperty,lB=Object.prototype.propertyIsEnumerable,uB=(e,t,n)=>t in e?iB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dB=(e,t)=>{for(var n in t||={})cB.call(t,n)&&uB(e,n,t[n]);if(sB)for(var n of sB(t))lB.call(t,n)&&uB(e,n,t[n]);return e},fB=(e,t)=>aB(e,oB(t)),pB=(e,t)=>{var n={};for(var r in e)cB.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&sB)for(var r of sB(e))t.indexOf(r)<0&&lB.call(e,r)&&(n[r]=e[r]);return n};function mB(e){var t=e,{direction:n,style:r}=t,i=pB(t,[`direction`,`style`]);let a=Zr();return Z.createElement(Xd,fB(dB({},i),{style:fB(dB({},r),{transform:n===`next`&&a.dir===`ltr`||n===`previous`&&a.dir===`rtl`?`rotate(270deg)`:`rotate(90deg)`})}))}mB.displayName=`@mantine/dates/Chevron`;var hB=Object.defineProperty,gB=Object.defineProperties,_B=Object.getOwnPropertyDescriptors,vB=Object.getOwnPropertySymbols,yB=Object.prototype.hasOwnProperty,bB=Object.prototype.propertyIsEnumerable,xB=(e,t,n)=>t in e?hB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,SB=(e,t)=>{for(var n in t||={})yB.call(t,n)&&xB(e,n,t[n]);if(vB)for(var n of vB(t))bB.call(t,n)&&xB(e,n,t[n]);return e},CB=(e,t)=>gB(e,_B(t)),wB={xs:J(30),sm:J(36),md:J(42),lg:J(48),xl:J(54)},TB=Rr((e,{radius:t,isStatic:n},{size:r})=>{let i=e.fn.variant({variant:`filled`}),a=e.fn.variant({variant:`light`});return{day:CB(SB({width:Y({size:r,sizes:wB}),height:Y({size:r,sizes:wB}),fontSize:Y({size:r,sizes:e.fontSizes}),display:`inline-flex`,justifyContent:`center`,alignItems:`center`,userSelect:n?void 0:`none`,cursor:n?`default`:`pointer`,borderRadius:e.fn.radius(t)},n?null:e.fn.hover({backgroundColor:e.colorScheme===`dark`?e.colors.dark[5]:e.colors.gray[0]})),{"&:active":n?void 0:e.activeStyles,"&[data-disabled]":CB(SB({color:e.colorScheme===`dark`?e.colors.dark[3]:e.colors.gray[4],cursor:`not-allowed`},e.fn.hover({backgroundColor:`transparent`})),{"&:active":{transform:`none`}}),"&[data-weekend]":{color:e.colors.red[e.fn.primaryShade()]},"&[data-outside]":{color:e.colorScheme===`dark`?e.colors.dark[3]:e.colors.gray[4]},"&[data-in-range]":SB({backgroundColor:a.background,borderRadius:0},n?null:e.fn.hover({backgroundColor:a.hover})),"&[data-first-in-range]":{borderTopLeftRadius:e.radius.sm,borderBottomLeftRadius:e.radius.sm},"&[data-last-in-range]":{borderTopRightRadius:e.radius.sm,borderBottomRightRadius:e.radius.sm},"&[data-selected]":SB({color:i.color,backgroundColor:i.background},n?null:e.fn.hover({backgroundColor:i.hover})),"&[data-hidden]":{display:`none`}})}}),EB=Object.defineProperty,DB=Object.defineProperties,OB=Object.getOwnPropertyDescriptors,kB=Object.getOwnPropertySymbols,AB=Object.prototype.hasOwnProperty,jB=Object.prototype.propertyIsEnumerable,MB=(e,t,n)=>t in e?EB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,NB=(e,t)=>{for(var n in t||={})AB.call(t,n)&&MB(e,n,t[n]);if(kB)for(var n of kB(t))jB.call(t,n)&&MB(e,n,t[n]);return e},PB=(e,t)=>DB(e,OB(t)),FB=Rr((e,t,{size:n})=>{let r=Y({size:n,sizes:wB});return{calendarHeaderControlIcon:{},calendarHeader:{display:`flex`,maxWidth:`calc(${r} * 7 + ${J(7)})`},calendarHeaderControl:PB(NB({width:r,height:r,borderRadius:e.fn.radius(),display:`flex`,justifyContent:`center`,alignItems:`center`,userSelect:`none`},e.fn.hover({backgroundColor:e.colorScheme===`dark`?e.colors.dark[5]:e.colors.gray[0]})),{"&:active":e.activeStyles,"&[data-disabled]":PB(NB({opacity:.2,cursor:`not-allowed`},e.fn.hover({backgroundColor:`transparent`})),{"&:active":{transform:`none`}})}),calendarHeaderLevel:PB(NB({height:r,borderRadius:e.fn.radius(),display:`flex`,justifyContent:`center`,alignItems:`center`,userSelect:`none`,flex:1,fontSize:Y({size:n,sizes:e.fontSizes}),fontWeight:500,textTransform:`capitalize`},e.fn.hover({backgroundColor:e.colorScheme===`dark`?e.colors.dark[5]:e.colors.gray[0]})),{"&:active":e.activeStyles,"&[data-static]":PB(NB({cursor:`default`,userSelect:`unset`},e.fn.hover({backgroundColor:`transparent`})),{"&:active":{transform:`none`}})})}}),IB=Object.defineProperty,LB=Object.getOwnPropertySymbols,RB=Object.prototype.hasOwnProperty,zB=Object.prototype.propertyIsEnumerable,BB=(e,t,n)=>t in e?IB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,VB=(e,t)=>{for(var n in t||={})RB.call(t,n)&&BB(e,n,t[n]);if(LB)for(var n of LB(t))zB.call(t,n)&&BB(e,n,t[n]);return e},HB=(e,t)=>{var n={};for(var r in e)RB.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&LB)for(var r of LB(e))t.indexOf(r)<0&&zB.call(e,r)&&(n[r]=e[r]);return n},UB={nextDisabled:!1,previousDisabled:!1,hasNextLevel:!0,withNext:!0,withPrevious:!0,size:`sm`},WB=(0,Z.forwardRef)((e,t)=>{let n=X(`CalendarHeader`,UB,e),{className:r,nextIcon:i,previousIcon:a,nextLabel:o,previousLabel:s,onNext:c,onPrevious:l,onLevelClick:u,label:d,classNames:f,styles:p,unstyled:m,nextDisabled:h,previousDisabled:g,hasNextLevel:_,levelControlAriaLabel:v,withNext:y,withPrevious:b,__staticSelector:x,__preventFocus:S,__stopPropagation:C,size:w,variant:T}=n,E=HB(n,[`className`,`nextIcon`,`previousIcon`,`nextLabel`,`previousLabel`,`onNext`,`onPrevious`,`onLevelClick`,`label`,`classNames`,`styles`,`unstyled`,`nextDisabled`,`previousDisabled`,`hasNextLevel`,`levelControlAriaLabel`,`withNext`,`withPrevious`,`__staticSelector`,`__preventFocus`,`__stopPropagation`,`size`,`variant`]),{classes:D,cx:O}=FB(null,{name:[`CalendarHeader`,x],classNames:f,styles:p,unstyled:m,size:w,variant:T}),k=S?e=>e.preventDefault():void 0;return Z.createElement(Ir,VB({className:O(D.calendarHeader,r),ref:t},E),b&&Z.createElement(Hd,{className:D.calendarHeaderControl,"data-previous":!0,"aria-label":s,onClick:l,unstyled:m,onMouseDown:k,disabled:g,"data-disabled":g||void 0,tabIndex:S?-1:0,"data-mantine-stop-propagation":C||void 0},a||Z.createElement(mB,{className:D.calendarHeaderControlIcon,direction:`previous`,"data-previous":!0})),Z.createElement(Hd,{component:_?`button`:`div`,className:D.calendarHeaderLevel,onClick:_?u:void 0,unstyled:m,onMouseDown:_?k:void 0,disabled:!_,"data-static":!_||void 0,"aria-label":v,tabIndex:S||!_?-1:0,"data-mantine-stop-propagation":C||void 0},d),y&&Z.createElement(Hd,{className:D.calendarHeaderControl,"data-next":!0,"aria-label":o,onClick:c,unstyled:m,onMouseDown:k,disabled:h,"data-disabled":h||void 0,tabIndex:S?-1:0,"data-mantine-stop-propagation":C||void 0},i||Z.createElement(mB,{className:D.calendarHeaderControlIcon,direction:`next`,"data-next":!0})))});WB.displayName=`@mantine/dates/CalendarHeader`;var GB=r(n(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||=(e(t,E,w),!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))}))());function KB(e,t){return e?e===`month`?0:e===`year`?1:2:t}function qB(e){return e===0?`month`:e===1?`year`:`decade`}function JB(e,t,n){return qB(Gu(KB(e,0),KB(t,0),KB(n,2)))}var YB=Rr(()=>({calendar:{}})),XB=Rr((e,t,{size:n})=>({monthLevelGroup:{display:`flex`,"& [data-month-level]:not(:last-of-type)":{marginRight:Y({size:n,sizes:e.spacing})}}})),ZB=Rr(e=>({monthLevel:{},calendarHeader:{marginBottom:e.spacing.xs}})),QB=(0,Z.createContext)({locale:`en`,firstDayOfWeek:1,weekendDays:[0,6],labelSeparator:`–`}),$B=Object.defineProperty,eV=Object.defineProperties,tV=Object.getOwnPropertyDescriptors,nV=Object.getOwnPropertySymbols,rV=Object.prototype.hasOwnProperty,iV=Object.prototype.propertyIsEnumerable,aV=(e,t,n)=>t in e?$B(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oV=(e,t)=>{for(var n in t||={})rV.call(t,n)&&aV(e,n,t[n]);if(nV)for(var n of nV(t))iV.call(t,n)&&aV(e,n,t[n]);return e},sV=(e,t)=>eV(e,tV(t));function cV(){let e=(0,Z.useContext)(QB),t=(0,Z.useCallback)(t=>t||e.locale,[e.locale]),n=(0,Z.useCallback)(t=>typeof t==`number`?t:e.firstDayOfWeek,[e.firstDayOfWeek]),r=(0,Z.useCallback)(t=>Array.isArray(t)?t:e.weekendDays,[e.weekendDays]),i=(0,Z.useCallback)(t=>typeof t==`string`?t:e.labelSeparator,[e.labelSeparator]);return sV(oV({},e),{getLocale:t,getFirstDayOfWeek:n,getWeekendDays:r,getLabelSeparator:i})}function lV(e,t=1){let n=new Date(e);for(;n.getDay()!==t;)n.setDate(n.getDate()-1);return n}function uV(e,t=1){let n=new Date(e),r=t===0?6:t-1;for(;n.getDay()!==r;)n.setDate(n.getDate()+1);return n}function dV(e,t=1){let n=e.getMonth(),r=new Date(e.getFullYear(),n,1),i=uV(new Date(e.getFullYear(),e.getMonth()+1,0),t),a=lV(r,t),o=[];for(;a<=i;){let e=[];for(let t=0;t<7;t+=1)e.push(new Date(a)),a.setDate(a.getDate()+1);o.push(e)}return o}function fV(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()}function pV(e,t){return t instanceof Date?(0,GB.default)(e).isBefore((0,GB.default)(t).add(1,`day`),`day`):!0}function mV(e,t){return t instanceof Date?(0,GB.default)(e).isAfter((0,GB.default)(t).subtract(1,`day`),`day`):!0}var hV=Object.defineProperty,gV=Object.defineProperties,_V=Object.getOwnPropertyDescriptors,vV=Object.getOwnPropertySymbols,yV=Object.prototype.hasOwnProperty,bV=Object.prototype.propertyIsEnumerable,xV=(e,t,n)=>t in e?hV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,SV=(e,t)=>{for(var n in t||={})yV.call(t,n)&&xV(e,n,t[n]);if(vV)for(var n of vV(t))bV.call(t,n)&&xV(e,n,t[n]);return e},CV=(e,t)=>gV(e,_V(t)),wV=Rr(e=>({monthThead:{},monthRow:{},monthTbody:{},monthCell:{padding:0,"&[data-with-spacing]":{padding:J(.5)}},month:CV(SV({},e.fn.fontStyles()),{borderCollapse:`collapse`,tableLayout:`fixed`,"& *":{boxSizing:`border-box`}})}));function TV(e,t,n,r,i,a,o){let s=e.flat().filter(e=>pV(e,n)&&mV(e,t)&&!i?.(e)&&!r?.(e)?.disabled&&(!a||fV(e,o)));return s.find(e=>r?.(e)?.selected)||s.find(e=>(0,GB.default)().isSame(e,`date`))||s[0]}var EV=Object.defineProperty,DV=Object.getOwnPropertySymbols,OV=Object.prototype.hasOwnProperty,kV=Object.prototype.propertyIsEnumerable,AV=(e,t,n)=>t in e?EV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jV=(e,t)=>{for(var n in t||={})OV.call(t,n)&&AV(e,n,t[n]);if(DV)for(var n of DV(t))kV.call(t,n)&&AV(e,n,t[n]);return e},MV=(e,t)=>{var n={};for(var r in e)OV.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&DV)for(var r of DV(e))t.indexOf(r)<0&&kV.call(e,r)&&(n[r]=e[r]);return n},NV={tabIndex:0,size:`sm`},PV=(0,Z.forwardRef)((e,t)=>{let n=X(`Day`,NV,e),{className:r,date:i,radius:a,disabled:o,styles:s,classNames:c,unstyled:l,__staticSelector:u,weekend:d,outside:f,selected:p,renderDay:m,inRange:h,firstInRange:g,lastInRange:_,hidden:v,static:y,variant:b,size:x}=n,S=MV(n,[`className`,`date`,`radius`,`disabled`,`styles`,`classNames`,`unstyled`,`__staticSelector`,`weekend`,`outside`,`selected`,`renderDay`,`inRange`,`firstInRange`,`lastInRange`,`hidden`,`static`,`variant`,`size`]),{classes:C,cx:w}=TB({radius:a,isStatic:y},{name:[`Day`,u],classNames:c,styles:s,unstyled:l,variant:b,size:x});return Z.createElement(Hd,jV({component:y?`div`:`button`,ref:t,className:w(C.day,r),disabled:o,"data-today":(0,GB.default)(i).isSame(new Date,`day`)||void 0,"data-hidden":v||void 0,"data-disabled":o||void 0,"data-weekend":!o&&!f&&d||void 0,"data-outside":!o&&f||void 0,"data-selected":!o&&p||void 0,"data-in-range":h&&!o||void 0,"data-first-in-range":g&&!o||void 0,"data-last-in-range":_&&!o||void 0,unstyled:l},S),m?.(i)||i.getDate())});PV.displayName=`@mantine/dates/Day`;function FV({locale:e,format:t=`dd`,firstDayOfWeek:n=1}){let r=(0,GB.default)().day(n),i=[];for(let n=0;n<7;n+=1)typeof t==`string`?i.push((0,GB.default)(r).add(n,`days`).locale(e).format(t)):i.push(t((0,GB.default)(r).add(n,`days`).toDate()));return i}var IV=Rr((e,t,{size:n})=>({weekdaysRow:{},weekday:{color:e.colorScheme===`dark`?e.colors.dark[1]:e.colors.gray[5],fontWeight:400,fontSize:Y({size:n,sizes:e.fontSizes}),textTransform:`capitalize`,paddingBottom:`calc(${Y({size:n,sizes:e.spacing})} / 2)`}})),LV=Object.defineProperty,RV=Object.getOwnPropertySymbols,zV=Object.prototype.hasOwnProperty,BV=Object.prototype.propertyIsEnumerable,VV=(e,t,n)=>t in e?LV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,HV=(e,t)=>{for(var n in t||={})zV.call(t,n)&&VV(e,n,t[n]);if(RV)for(var n of RV(t))BV.call(t,n)&&VV(e,n,t[n]);return e},UV=(e,t)=>{var n={};for(var r in e)zV.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&RV)for(var r of RV(e))t.indexOf(r)<0&&BV.call(e,r)&&(n[r]=e[r]);return n},WV={weekdayFormat:`dd`,cellComponent:`th`,size:`sm`},GV=(0,Z.forwardRef)((e,t)=>{let n=X(`WeekdaysRow`,WV,e),{className:r,locale:i,firstDayOfWeek:a,weekdayFormat:o,cellComponent:s,__staticSelector:c,classNames:l,styles:u,unstyled:d,variant:f,size:p}=n,m=UV(n,[`className`,`locale`,`firstDayOfWeek`,`weekdayFormat`,`cellComponent`,`__staticSelector`,`classNames`,`styles`,`unstyled`,`variant`,`size`]),h=cV(),{classes:g,cx:_}=IV(null,{name:[`WeekdaysRow`,c],classNames:l,styles:u,unstyled:d,variant:f,size:p}),v=FV({locale:h.getLocale(i),format:o,firstDayOfWeek:h.getFirstDayOfWeek(a)}).map((e,t)=>Z.createElement(s,{key:t,className:g.weekday},e));return Z.createElement(Ir,HV({component:`tr`,ref:t,className:_(g.weekdaysRow,r)},m),v)});GV.displayName=`@mantine/dates/WeekdaysRow`;var KV=Object.defineProperty,qV=Object.defineProperties,JV=Object.getOwnPropertyDescriptors,YV=Object.getOwnPropertySymbols,XV=Object.prototype.hasOwnProperty,ZV=Object.prototype.propertyIsEnumerable,QV=(e,t,n)=>t in e?KV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$V=(e,t)=>{for(var n in t||={})XV.call(t,n)&&QV(e,n,t[n]);if(YV)for(var n of YV(t))ZV.call(t,n)&&QV(e,n,t[n]);return e},eH=(e,t)=>qV(e,JV(t)),tH=(e,t)=>{var n={};for(var r in e)XV.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&YV)for(var r of YV(e))t.indexOf(r)<0&&ZV.call(e,r)&&(n[r]=e[r]);return n},nH={size:`sm`,withCellSpacing:!0},rH=(0,Z.forwardRef)((e,t)=>{let n=X(`Month`,nH,e),{className:r,classNames:i,styles:a,unstyled:o,__staticSelector:s,locale:c,firstDayOfWeek:l,weekdayFormat:u,month:d,weekendDays:f,getDayProps:p,excludeDate:m,minDate:h,maxDate:g,renderDay:_,hideOutsideDates:v,hideWeekdays:y,getDayAriaLabel:b,static:x,__getDayRef:S,__onDayKeyDown:C,__onDayClick:w,__onDayMouseEnter:T,__preventFocus:E,__stopPropagation:D,withCellSpacing:O,size:k,variant:A}=n,j=tH(n,`className.classNames.styles.unstyled.__staticSelector.locale.firstDayOfWeek.weekdayFormat.month.weekendDays.getDayProps.excludeDate.minDate.maxDate.renderDay.hideOutsideDates.hideWeekdays.getDayAriaLabel.static.__getDayRef.__onDayKeyDown.__onDayClick.__onDayMouseEnter.__preventFocus.__stopPropagation.withCellSpacing.size.variant`.split(`.`)),M=cV(),{classes:N,cx:P}=wV(null,{name:[`Month`,s],classNames:i,styles:a,unstyled:o,variant:A,size:k}),F={__staticSelector:s||`Month`,classNames:i,styles:a,unstyled:o,variant:A,size:k},I=dV(d,M.getFirstDayOfWeek(l)),L=TV(I,h,g,p,m,v,d),R=I.map((e,t)=>{let n=e.map((e,n)=>{let r=!fV(e,d),i=b?.(e)||(0,GB.default)(e).locale(c||M.locale).format(`D MMMM YYYY`),a=p?.(e),o=(0,GB.default)(e).isSame(L,`date`);return Z.createElement(`td`,{key:e.toString(),className:N.monthCell,"data-with-spacing":O||void 0},Z.createElement(PV,eH($V(eH($V({},F),{"data-mantine-stop-propagation":D||void 0,renderDay:_,date:e,weekend:M.getWeekendDays(f).includes(e.getDay()),outside:r,hidden:v?r:!1,"aria-label":i,static:x,disabled:m?.(e)||!pV(e,g)||!mV(e,h),ref:e=>S?.(t,n,e)}),a),{onKeyDown:r=>{var i;(i=a?.onKeyDown)==null||i.call(a,r),C?.(r,{rowIndex:t,cellIndex:n,date:e})},onMouseEnter:t=>{var n;(n=a?.onMouseEnter)==null||n.call(a,t),T?.(t,e)},onClick:t=>{var n;(n=a?.onClick)==null||n.call(a,t),w?.(t,e)},onMouseDown:e=>{var t;(t=a?.onMouseDown)==null||t.call(a,e),E&&e.preventDefault()},tabIndex:E||!o?-1:0})))});return Z.createElement(`tr`,{key:t,className:N.monthRow},n)});return Z.createElement(Ir,$V({component:`table`,className:P(N.month,r),ref:t},j),!y&&Z.createElement(`thead`,{className:N.monthThead},Z.createElement(GV,eH($V({},F),{locale:c,firstDayOfWeek:l,weekdayFormat:u}))),Z.createElement(`tbody`,{className:N.monthTbody},R))});rH.displayName=`@mantine/dates/Month`;var iH=Object.defineProperty,aH=Object.getOwnPropertySymbols,oH=Object.prototype.hasOwnProperty,sH=Object.prototype.propertyIsEnumerable,cH=(e,t,n)=>t in e?iH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lH=(e,t)=>{for(var n in t||={})oH.call(t,n)&&cH(e,n,t[n]);if(aH)for(var n of aH(t))sH.call(t,n)&&cH(e,n,t[n]);return e},uH=(e,t)=>{var n={};for(var r in e)oH.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&aH)for(var r of aH(e))t.indexOf(r)<0&&sH.call(e,r)&&(n[r]=e[r]);return n},dH={monthLabelFormat:`MMMM YYYY`},fH=(0,Z.forwardRef)((e,t)=>{let n=X(`MonthLevel`,dH,e),{month:r,locale:i,firstDayOfWeek:a,weekdayFormat:o,weekendDays:s,getDayProps:c,excludeDate:l,minDate:u,maxDate:d,renderDay:f,hideOutsideDates:p,hideWeekdays:m,getDayAriaLabel:h,__getDayRef:g,__onDayKeyDown:_,__onDayClick:v,__onDayMouseEnter:y,withCellSpacing:b,__preventFocus:x,__stopPropagation:S,nextIcon:C,previousIcon:w,nextLabel:T,previousLabel:E,onNext:D,onPrevious:O,onLevelClick:k,nextDisabled:A,previousDisabled:j,hasNextLevel:M,levelControlAriaLabel:N,withNext:P,withPrevious:F,className:I,monthLabelFormat:L,classNames:R,styles:z,unstyled:B,__staticSelector:V,size:ee,variant:te,static:H}=n,ne=uH(n,`month.locale.firstDayOfWeek.weekdayFormat.weekendDays.getDayProps.excludeDate.minDate.maxDate.renderDay.hideOutsideDates.hideWeekdays.getDayAriaLabel.__getDayRef.__onDayKeyDown.__onDayClick.__onDayMouseEnter.withCellSpacing.__preventFocus.__stopPropagation.nextIcon.previousIcon.nextLabel.previousLabel.onNext.onPrevious.onLevelClick.nextDisabled.previousDisabled.hasNextLevel.levelControlAriaLabel.withNext.withPrevious.className.monthLabelFormat.classNames.styles.unstyled.__staticSelector.size.variant.static`.split(`.`)),{classes:re,cx:ie}=ZB(null,{name:[`MonthLevel`,V],classNames:R,styles:z,unstyled:B,variant:te,size:ee}),U=cV(),ae={__staticSelector:V||`MonthLevel`,classNames:R,styles:z,unstyled:B,variant:te,size:ee},oe=typeof A==`boolean`?A:d?!(0,GB.default)(r).endOf(`month`).isBefore(d):!1,W=typeof j==`boolean`?j:u?!(0,GB.default)(r).startOf(`month`).isAfter(u):!1;return Z.createElement(Ir,lH({className:ie(re.monthLevel,I),"data-month-level":!0,ref:t},ne),Z.createElement(WB,lH({label:typeof L==`function`?L(r):(0,GB.default)(r).locale(i||U.locale).format(L),className:re.calendarHeader,__preventFocus:x,__stopPropagation:S,nextIcon:C,previousIcon:w,nextLabel:T,previousLabel:E,onNext:D,onPrevious:O,onLevelClick:k,nextDisabled:oe,previousDisabled:W,hasNextLevel:M,levelControlAriaLabel:N,withNext:P,withPrevious:F},ae)),Z.createElement(rH,lH({month:r,locale:i,firstDayOfWeek:a,weekdayFormat:o,weekendDays:s,getDayProps:c,excludeDate:l,minDate:u,maxDate:d,renderDay:f,hideOutsideDates:p,hideWeekdays:m,getDayAriaLabel:h,__getDayRef:g,__onDayKeyDown:_,__onDayClick:v,__onDayMouseEnter:y,__preventFocus:x,__stopPropagation:S,static:H,withCellSpacing:b},ae)))});fH.displayName=`@mantine/dates/MonthLevel`;function pH({direction:e,levelIndex:t,rowIndex:n,cellIndex:r,size:i}){switch(e){case`up`:return t===0&&n===0?null:n===0?{levelIndex:t-1,rowIndex:r<=i[t-1][i[t-1].length-1]-1?i[t-1].length-1:i[t-1].length-2,cellIndex:r}:{levelIndex:t,rowIndex:n-1,cellIndex:r};case`down`:return n===i[t].length-1||n===i[t].length-2&&r>=i[t][i[t].length-1]?{levelIndex:t+1,rowIndex:0,cellIndex:r}:{levelIndex:t,rowIndex:n+1,cellIndex:r};case`left`:return t===0&&n===0&&r===0?null:n===0&&r===0?{levelIndex:t-1,rowIndex:i[t-1].length-1,cellIndex:i[t-1][i[t-1].length-1]-1}:r===0?{levelIndex:t,rowIndex:n-1,cellIndex:i[t][n-1]-1}:{levelIndex:t,rowIndex:n,cellIndex:r-1};case`right`:return n===i[t].length-1&&r===i[t][n]-1?{levelIndex:t+1,rowIndex:0,cellIndex:0}:r===i[t][n]-1?{levelIndex:t,rowIndex:n+1,cellIndex:0}:{levelIndex:t,rowIndex:n,cellIndex:r+1};default:return{levelIndex:t,rowIndex:n,cellIndex:r}}}function mH({controlsRef:e,direction:t,levelIndex:n,rowIndex:r,cellIndex:i,size:a}){let o=pH({direction:t,size:a,rowIndex:r,cellIndex:i,levelIndex:n});if(!o)return;let s=e.current[o.levelIndex]?.[o.rowIndex]?.[o.cellIndex];s&&(s.disabled||s.getAttribute(`data-hidden`)||s.getAttribute(`data-outside`)?mH({controlsRef:e,direction:t,levelIndex:o.levelIndex,cellIndex:o.cellIndex,rowIndex:o.rowIndex,size:a}):s.focus())}function hH(e){switch(e){case`ArrowDown`:return`down`;case`ArrowUp`:return`up`;case`ArrowRight`:return`right`;case`ArrowLeft`:return`left`;default:return null}}function gH(e){return e.current.map(e=>e.map(e=>e.length))}function _H({controlsRef:e,levelIndex:t,rowIndex:n,cellIndex:r,event:i}){let a=hH(i.key);a&&(i.preventDefault(),mH({controlsRef:e,direction:a,levelIndex:t,rowIndex:n,cellIndex:r,size:gH(e)}))}var vH=Object.defineProperty,yH=Object.getOwnPropertySymbols,bH=Object.prototype.hasOwnProperty,xH=Object.prototype.propertyIsEnumerable,SH=(e,t,n)=>t in e?vH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,CH=(e,t)=>{for(var n in t||={})bH.call(t,n)&&SH(e,n,t[n]);if(yH)for(var n of yH(t))xH.call(t,n)&&SH(e,n,t[n]);return e},wH=(e,t)=>{var n={};for(var r in e)bH.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&yH)for(var r of yH(e))t.indexOf(r)<0&&xH.call(e,r)&&(n[r]=e[r]);return n},TH={numberOfColumns:1},EH=(0,Z.forwardRef)((e,t)=>{let n=X(`MonthLevelGroup`,TH,e),{month:r,locale:i,firstDayOfWeek:a,weekdayFormat:o,weekendDays:s,getDayProps:c,excludeDate:l,minDate:u,maxDate:d,renderDay:f,hideOutsideDates:p,hideWeekdays:m,getDayAriaLabel:h,__onDayClick:g,__onDayMouseEnter:_,withCellSpacing:v,__preventFocus:y,nextIcon:b,previousIcon:x,nextLabel:S,previousLabel:C,onNext:w,onPrevious:T,onLevelClick:E,nextDisabled:D,previousDisabled:O,hasNextLevel:k,className:A,classNames:j,styles:M,unstyled:N,numberOfColumns:P,levelControlAriaLabel:F,monthLabelFormat:I,__staticSelector:L,__stopPropagation:R,size:z,variant:B,static:V}=n,ee=wH(n,`month.locale.firstDayOfWeek.weekdayFormat.weekendDays.getDayProps.excludeDate.minDate.maxDate.renderDay.hideOutsideDates.hideWeekdays.getDayAriaLabel.__onDayClick.__onDayMouseEnter.withCellSpacing.__preventFocus.nextIcon.previousIcon.nextLabel.previousLabel.onNext.onPrevious.onLevelClick.nextDisabled.previousDisabled.hasNextLevel.className.classNames.styles.unstyled.numberOfColumns.levelControlAriaLabel.monthLabelFormat.__staticSelector.__stopPropagation.size.variant.static`.split(`.`)),{classes:te,cx:H}=XB(null,{name:[`MonthLevelGroup`,L],classNames:j,styles:M,unstyled:N,variant:B,size:z}),ne=(0,Z.useRef)([]),re=Array(P).fill(0).map((e,t)=>{let n=(0,GB.default)(r).add(t,`months`).toDate();return Z.createElement(fH,{key:t,month:n,withNext:t===P-1,withPrevious:t===0,monthLabelFormat:I,__stopPropagation:R,__onDayClick:g,__onDayMouseEnter:_,__onDayKeyDown:(e,n)=>_H({levelIndex:t,rowIndex:n.rowIndex,cellIndex:n.cellIndex,event:e,controlsRef:ne}),__getDayRef:(e,n,r)=>{Array.isArray(ne.current[t])||(ne.current[t]=[]),Array.isArray(ne.current[t][e])||(ne.current[t][e]=[]),ne.current[t][e][n]=r},levelControlAriaLabel:typeof F==`function`?F(n):F,locale:i,firstDayOfWeek:a,weekdayFormat:o,weekendDays:s,getDayProps:c,excludeDate:l,minDate:u,maxDate:d,renderDay:f,hideOutsideDates:p,hideWeekdays:m,getDayAriaLabel:h,__preventFocus:y,nextIcon:b,previousIcon:x,nextLabel:S,previousLabel:C,onNext:w,onPrevious:T,onLevelClick:E,nextDisabled:D,previousDisabled:O,hasNextLevel:k,classNames:j,styles:M,unstyled:N,__staticSelector:L||`MonthLevelGroup`,size:z,variant:B,static:V,withCellSpacing:v})});return Z.createElement(Ir,CH({className:H(te.monthLevelGroup,A),ref:t},ee),re)});EH.displayName=`@mantine/dates/MonthLevelGroup`;var DH=Rr((e,t,{size:n})=>({yearLevelGroup:{display:`flex`,"& [data-year-level]:not(:last-of-type)":{marginRight:Y({size:n,sizes:e.spacing})}}})),OH=Rr(e=>({yearLevel:{},calendarHeader:{marginBottom:e.spacing.xs}}));function kH(e){let t=(0,GB.default)(e).startOf(`year`).toDate(),n=[[],[],[],[]],r=0;for(let e=0;e<4;e+=1)for(let i=0;i<3;i+=1)n[e].push((0,GB.default)(t).add(r,`months`).toDate()),r+=1;return n}function AH(e,t,n){return!t&&!n?!1:!!(t&&(0,GB.default)(e).isBefore(t,`month`)||n&&(0,GB.default)(e).isAfter(n,`month`))}var jH=Rr(()=>({monthsList:{borderCollapse:`collapse`,borderWidth:0,cursor:`pointer`},monthsListCell:{padding:0,"&[data-with-spacing]":{padding:J(.5)}},monthsListRow:{}}));function MH(e,t,n,r){let i=e.flat().filter(e=>!AH(e,t,n)&&!r?.(e)?.disabled);return i.find(e=>r?.(e)?.selected)||i.find(e=>(0,GB.default)().isSame(e,`month`))||i[0]}var NH=Object.defineProperty,PH=Object.defineProperties,FH=Object.getOwnPropertyDescriptors,IH=Object.getOwnPropertySymbols,LH=Object.prototype.hasOwnProperty,RH=Object.prototype.propertyIsEnumerable,zH=(e,t,n)=>t in e?NH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,BH=(e,t)=>{for(var n in t||={})LH.call(t,n)&&zH(e,n,t[n]);if(IH)for(var n of IH(t))RH.call(t,n)&&zH(e,n,t[n]);return e},VH=(e,t)=>PH(e,FH(t)),HH=Rr((e,t,{size:n})=>{let r=e.fn.variant({variant:`filled`}),i=e.fn.variant({variant:`light`});return{pickerControl:VH(BH({fontSize:Y({size:n,sizes:e.fontSizes}),height:Y({size:n,sizes:wB}),width:`calc((${Y({size:n,sizes:wB})} * 7) / 3 + ${J(1.5)})`,display:`flex`,justifyContent:`center`,alignItems:`center`,userSelect:`none`,borderRadius:e.fn.radius()},e.fn.hover({backgroundColor:e.colorScheme===`dark`?e.colors.dark[5]:e.colors.gray[0]})),{"&:active":e.activeStyles,"&[data-in-range]":BH({backgroundColor:i.background,borderRadius:0},e.fn.hover({backgroundColor:i.hover})),"&[data-first-in-range]":{borderRadius:0,borderTopLeftRadius:e.radius.sm,borderBottomLeftRadius:e.radius.sm},"&[data-last-in-range]":{borderRadius:0,borderTopRightRadius:e.radius.sm,borderBottomRightRadius:e.radius.sm},"&[data-last-in-range][data-first-in-range]":{borderRadius:e.radius.sm},"&[data-selected]":BH({color:r.color,backgroundColor:r.background},e.fn.hover({backgroundColor:r.hover})),"&[data-disabled]":VH(BH({color:e.colorScheme===`dark`?e.colors.dark[3]:e.colors.gray[4],cursor:`not-allowed`},e.fn.hover({backgroundColor:`transparent`})),{"&:active":{transform:`none`}})})}}),UH=Object.defineProperty,WH=Object.getOwnPropertySymbols,GH=Object.prototype.hasOwnProperty,KH=Object.prototype.propertyIsEnumerable,qH=(e,t,n)=>t in e?UH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,JH=(e,t)=>{for(var n in t||={})GH.call(t,n)&&qH(e,n,t[n]);if(WH)for(var n of WH(t))KH.call(t,n)&&qH(e,n,t[n]);return e},YH=(e,t)=>{var n={};for(var r in e)GH.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&WH)for(var r of WH(e))t.indexOf(r)<0&&KH.call(e,r)&&(n[r]=e[r]);return n},XH={size:`sm`},ZH=(0,Z.forwardRef)((e,t)=>{let n=X(`PickerControl`,XH,e),{className:r,children:i,disabled:a,selected:o,classNames:s,styles:c,unstyled:l,firstInRange:u,lastInRange:d,inRange:f,__staticSelector:p,size:m,variant:h}=n,g=YH(n,[`className`,`children`,`disabled`,`selected`,`classNames`,`styles`,`unstyled`,`firstInRange`,`lastInRange`,`inRange`,`__staticSelector`,`size`,`variant`]),{classes:_,cx:v}=HH(null,{name:[`PickerControl`,p],classNames:s,styles:c,unstyled:l,variant:h,size:m});return Z.createElement(Hd,JH({className:v(_.pickerControl,r),ref:t,unstyled:l,"data-picker-control":!0,"data-selected":o&&!a||void 0,"data-disabled":a||void 0,"data-in-range":f&&!a&&!o||void 0,"data-first-in-range":u&&!a||void 0,"data-last-in-range":d&&!a||void 0,disabled:a},g),i)});ZH.displayName=`@mantine/dates/PickerControl`;var QH=Object.defineProperty,$H=Object.defineProperties,eU=Object.getOwnPropertyDescriptors,tU=Object.getOwnPropertySymbols,nU=Object.prototype.hasOwnProperty,rU=Object.prototype.propertyIsEnumerable,iU=(e,t,n)=>t in e?QH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,aU=(e,t)=>{for(var n in t||={})nU.call(t,n)&&iU(e,n,t[n]);if(tU)for(var n of tU(t))rU.call(t,n)&&iU(e,n,t[n]);return e},oU=(e,t)=>$H(e,eU(t)),sU=(e,t)=>{var n={};for(var r in e)nU.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&tU)for(var r of tU(e))t.indexOf(r)<0&&rU.call(e,r)&&(n[r]=e[r]);return n},cU={monthsListFormat:`MMM`,size:`sm`,withCellSpacing:!0},lU=(0,Z.forwardRef)((e,t)=>{let n=X(`MonthsList`,cU,e),{year:r,className:i,monthsListFormat:a,locale:o,minDate:s,maxDate:c,getMonthControlProps:l,classNames:u,styles:d,unstyled:f,__staticSelector:p,__getControlRef:m,__onControlKeyDown:h,__onControlClick:g,__onControlMouseEnter:_,__preventFocus:v,size:y,variant:b,__stopPropagation:x,withCellSpacing:S}=n,C=sU(n,[`year`,`className`,`monthsListFormat`,`locale`,`minDate`,`maxDate`,`getMonthControlProps`,`classNames`,`styles`,`unstyled`,`__staticSelector`,`__getControlRef`,`__onControlKeyDown`,`__onControlClick`,`__onControlMouseEnter`,`__preventFocus`,`size`,`variant`,`__stopPropagation`,`withCellSpacing`]),{classes:w,cx:T}=jH(null,{name:[`MonthsList`,p],classNames:u,styles:d,unstyled:f,variant:b,size:y}),E=cV(),D=kH(r),O=MH(D,s,c,l),k=D.map((e,t)=>{let n=e.map((e,n)=>{let r=l?.(e),i=(0,GB.default)(e).isSame(O,`month`);return Z.createElement(`td`,{key:n,className:w.monthsListCell,"data-with-spacing":S||void 0},Z.createElement(ZH,oU(aU({variant:b,size:y,classNames:u,styles:d,unstyled:f,__staticSelector:p||`MonthsList`,"data-mantine-stop-propagation":x||void 0,disabled:AH(e,s,c),ref:e=>m?.(t,n,e)},r),{onKeyDown:i=>{var a;(a=r?.onKeyDown)==null||a.call(r,i),h?.(i,{rowIndex:t,cellIndex:n,date:e})},onClick:t=>{var n;(n=r?.onClick)==null||n.call(r,t),g?.(t,e)},onMouseEnter:t=>{var n;(n=r?.onMouseEnter)==null||n.call(r,t),_?.(t,e)},onMouseDown:e=>{var t;(t=r?.onMouseDown)==null||t.call(r,e),v&&e.preventDefault()},tabIndex:v||!i?-1:0}),(0,GB.default)(e).locale(E.getLocale(o)).format(a)))});return Z.createElement(`tr`,{key:t,className:w.monthsListRow},n)});return Z.createElement(Ir,aU({component:`table`,ref:t,className:T(w.monthsList,i)},C),Z.createElement(`tbody`,null,k))});lU.displayName=`@mantine/dates/MonthsList`;var uU=Object.defineProperty,dU=Object.getOwnPropertySymbols,fU=Object.prototype.hasOwnProperty,pU=Object.prototype.propertyIsEnumerable,mU=(e,t,n)=>t in e?uU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hU=(e,t)=>{for(var n in t||={})fU.call(t,n)&&mU(e,n,t[n]);if(dU)for(var n of dU(t))pU.call(t,n)&&mU(e,n,t[n]);return e},gU=(e,t)=>{var n={};for(var r in e)fU.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&dU)for(var r of dU(e))t.indexOf(r)<0&&pU.call(e,r)&&(n[r]=e[r]);return n},_U={yearLabelFormat:`YYYY`,size:`sm`},vU=(0,Z.forwardRef)((e,t)=>{let n=X(`YearLevel`,_U,e),{year:r,locale:i,minDate:a,maxDate:o,monthsListFormat:s,getMonthControlProps:c,__getControlRef:l,__onControlKeyDown:u,__onControlClick:d,__onControlMouseEnter:f,withCellSpacing:p,__preventFocus:m,nextIcon:h,previousIcon:g,nextLabel:_,previousLabel:v,onNext:y,onPrevious:b,onLevelClick:x,nextDisabled:S,previousDisabled:C,hasNextLevel:w,levelControlAriaLabel:T,withNext:E,withPrevious:D,className:O,yearLabelFormat:k,classNames:A,styles:j,unstyled:M,__staticSelector:N,__stopPropagation:P,size:F,variant:I}=n,L=gU(n,`year.locale.minDate.maxDate.monthsListFormat.getMonthControlProps.__getControlRef.__onControlKeyDown.__onControlClick.__onControlMouseEnter.withCellSpacing.__preventFocus.nextIcon.previousIcon.nextLabel.previousLabel.onNext.onPrevious.onLevelClick.nextDisabled.previousDisabled.hasNextLevel.levelControlAriaLabel.withNext.withPrevious.className.yearLabelFormat.classNames.styles.unstyled.__staticSelector.__stopPropagation.size.variant`.split(`.`)),{classes:R,cx:z}=OH(null,{name:[`YearLevel`,N],classNames:A,styles:j,unstyled:M,size:F,variant:I}),B=cV(),V={__staticSelector:N||`YearLevel`,classNames:A,styles:j,unstyled:M,size:F,variant:I},ee=typeof S==`boolean`?S:o?!(0,GB.default)(r).endOf(`year`).isBefore(o):!1,te=typeof C==`boolean`?C:a?!(0,GB.default)(r).startOf(`year`).isAfter(a):!1;return Z.createElement(Ir,hU({className:z(R.yearLevel,O),"data-year-level":!0,ref:t},L),Z.createElement(WB,hU({label:typeof k==`function`?k(r):(0,GB.default)(r).locale(i||B.locale).format(k),className:R.calendarHeader,__preventFocus:m,__stopPropagation:P,nextIcon:h,previousIcon:g,nextLabel:_,previousLabel:v,onNext:y,onPrevious:b,onLevelClick:x,nextDisabled:ee,previousDisabled:te,hasNextLevel:w,levelControlAriaLabel:T,withNext:E,withPrevious:D},V)),Z.createElement(lU,hU({year:r,locale:i,minDate:a,maxDate:o,monthsListFormat:s,getMonthControlProps:c,__getControlRef:l,__onControlKeyDown:u,__onControlClick:d,__onControlMouseEnter:f,__preventFocus:m,__stopPropagation:P,withCellSpacing:p},V)))});vU.displayName=`@mantine/dates/YearLevel`;var yU=Object.defineProperty,bU=Object.getOwnPropertySymbols,xU=Object.prototype.hasOwnProperty,SU=Object.prototype.propertyIsEnumerable,CU=(e,t,n)=>t in e?yU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wU=(e,t)=>{for(var n in t||={})xU.call(t,n)&&CU(e,n,t[n]);if(bU)for(var n of bU(t))SU.call(t,n)&&CU(e,n,t[n]);return e},TU=(e,t)=>{var n={};for(var r in e)xU.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&bU)for(var r of bU(e))t.indexOf(r)<0&&SU.call(e,r)&&(n[r]=e[r]);return n},EU={numberOfColumns:1,size:`sm`},DU=(0,Z.forwardRef)((e,t)=>{let n=X(`YearLevelGroup`,EU,e),{year:r,locale:i,minDate:a,maxDate:o,monthsListFormat:s,getMonthControlProps:c,__onControlClick:l,__onControlMouseEnter:u,withCellSpacing:d,__preventFocus:f,nextIcon:p,previousIcon:m,nextLabel:h,previousLabel:g,onNext:_,onPrevious:v,onLevelClick:y,nextDisabled:b,previousDisabled:x,hasNextLevel:S,className:C,classNames:w,styles:T,unstyled:E,__staticSelector:D,__stopPropagation:O,numberOfColumns:k,levelControlAriaLabel:A,yearLabelFormat:j,variant:M,size:N}=n,P=TU(n,`year.locale.minDate.maxDate.monthsListFormat.getMonthControlProps.__onControlClick.__onControlMouseEnter.withCellSpacing.__preventFocus.nextIcon.previousIcon.nextLabel.previousLabel.onNext.onPrevious.onLevelClick.nextDisabled.previousDisabled.hasNextLevel.className.classNames.styles.unstyled.__staticSelector.__stopPropagation.numberOfColumns.levelControlAriaLabel.yearLabelFormat.variant.size`.split(`.`)),{classes:F,cx:I}=DH(null,{name:[`YearLevelGroup`,D],styles:T,classNames:w,unstyled:E,variant:M,size:N}),L=(0,Z.useRef)([]),R=Array(k).fill(0).map((e,t)=>{let n=(0,GB.default)(r).add(t,`years`).toDate();return Z.createElement(vU,{key:t,variant:M,size:N,monthsListFormat:s,year:n,withNext:t===k-1,withPrevious:t===0,yearLabelFormat:j,__stopPropagation:O,__onControlClick:l,__onControlMouseEnter:u,__onControlKeyDown:(e,n)=>_H({levelIndex:t,rowIndex:n.rowIndex,cellIndex:n.cellIndex,event:e,controlsRef:L}),__getControlRef:(e,n,r)=>{Array.isArray(L.current[t])||(L.current[t]=[]),Array.isArray(L.current[t][e])||(L.current[t][e]=[]),L.current[t][e][n]=r},levelControlAriaLabel:typeof A==`function`?A(n):A,locale:i,minDate:a,maxDate:o,__preventFocus:f,nextIcon:p,previousIcon:m,nextLabel:h,previousLabel:g,onNext:_,onPrevious:v,onLevelClick:y,nextDisabled:b,previousDisabled:x,hasNextLevel:S,getMonthControlProps:c,classNames:w,styles:T,unstyled:E,__staticSelector:D||`YearLevelGroup`,withCellSpacing:d})});return Z.createElement(Ir,wU({className:I(F.yearLevelGroup,C),ref:t},P),R)});DU.displayName=`@mantine/dates/YearLevelGroup`;var OU=Rr(e=>({decadeLevelGroup:{display:`flex`,gap:e.spacing.md}}));function kU(e){let t=e.getFullYear(),n=t-t%10,r=0,i=[[],[],[],[]];for(let e=0;e<4;e+=1){let t=e===3?1:3;for(let a=0;a<t;a+=1)i[e].push(new Date(n+r,0)),r+=1}return i}function AU(e){let t=kU(e);return[t[0][0],t[3][0]]}var jU=Rr(e=>({decadeLevel:{},calendarHeader:{marginBottom:e.spacing.xs}}));function MU(e,t,n){return!t&&!n?!1:!!(t&&(0,GB.default)(e).isBefore(t,`year`)||n&&(0,GB.default)(e).isAfter(n,`year`))}var NU=Rr(()=>({yearsList:{borderCollapse:`collapse`,borderWidth:0},yearsListCell:{padding:0,"&[data-with-spacing]":{padding:J(.5)}},yearsListRow:{}}));function PU(e,t,n,r){let i=e.flat().filter(e=>!MU(e,t,n)&&!r?.(e)?.disabled);return i.find(e=>r?.(e)?.selected)||i.find(e=>(0,GB.default)().isSame(e,`year`))||i[0]}var FU=Object.defineProperty,IU=Object.defineProperties,LU=Object.getOwnPropertyDescriptors,RU=Object.getOwnPropertySymbols,zU=Object.prototype.hasOwnProperty,BU=Object.prototype.propertyIsEnumerable,VU=(e,t,n)=>t in e?FU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,HU=(e,t)=>{for(var n in t||={})zU.call(t,n)&&VU(e,n,t[n]);if(RU)for(var n of RU(t))BU.call(t,n)&&VU(e,n,t[n]);return e},UU=(e,t)=>IU(e,LU(t)),WU=(e,t)=>{var n={};for(var r in e)zU.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&RU)for(var r of RU(e))t.indexOf(r)<0&&BU.call(e,r)&&(n[r]=e[r]);return n},GU={yearsListFormat:`YYYY`,size:`sm`,withCellSpacing:!0},KU=(0,Z.forwardRef)((e,t)=>{let n=X(`YearsList`,GU,e),{decade:r,className:i,yearsListFormat:a,locale:o,minDate:s,maxDate:c,getYearControlProps:l,classNames:u,styles:d,unstyled:f,__staticSelector:p,__getControlRef:m,__onControlKeyDown:h,__onControlClick:g,__onControlMouseEnter:_,__preventFocus:v,__stopPropagation:y,size:b,variant:x,withCellSpacing:S}=n,C=WU(n,[`decade`,`className`,`yearsListFormat`,`locale`,`minDate`,`maxDate`,`getYearControlProps`,`classNames`,`styles`,`unstyled`,`__staticSelector`,`__getControlRef`,`__onControlKeyDown`,`__onControlClick`,`__onControlMouseEnter`,`__preventFocus`,`__stopPropagation`,`size`,`variant`,`withCellSpacing`]),{classes:w,cx:T}=NU(null,{name:[`YearsList`,p],classNames:u,styles:d,unstyled:f,variant:x,size:b}),E=cV(),D=kU(r),O=PU(D,s,c,l),k=D.map((e,t)=>{let n=e.map((e,n)=>{let r=l?.(e),i=(0,GB.default)(e).isSame(O,`year`);return Z.createElement(`td`,{key:n,className:w.yearsListCell,"data-with-spacing":S||void 0},Z.createElement(ZH,UU(HU({size:b,variant:x,classNames:u,styles:d,unstyled:f,__staticSelector:p||`YearsList`,"data-mantine-stop-propagation":y||void 0,disabled:MU(e,s,c),ref:e=>m?.(t,n,e)},r),{onKeyDown:i=>{var a;(a=r?.onKeyDown)==null||a.call(r,i),h?.(i,{rowIndex:t,cellIndex:n,date:e})},onClick:t=>{var n;(n=r?.onClick)==null||n.call(r,t),g?.(t,e)},onMouseEnter:t=>{var n;(n=r?.onMouseEnter)==null||n.call(r,t),_?.(t,e)},onMouseDown:e=>{var t;(t=r?.onMouseDown)==null||t.call(r,e),v&&e.preventDefault()},tabIndex:v||!i?-1:0}),(0,GB.default)(e).locale(E.getLocale(o)).format(a)))});return Z.createElement(`tr`,{key:t,className:w.yearsListRow},n)});return Z.createElement(Ir,HU({component:`table`,ref:t,className:T(w.yearsList,i)},C),Z.createElement(`tbody`,null,k))});KU.displayName=`@mantine/dates/YearsList`;var qU=Object.defineProperty,JU=Object.getOwnPropertySymbols,YU=Object.prototype.hasOwnProperty,XU=Object.prototype.propertyIsEnumerable,ZU=(e,t,n)=>t in e?qU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,QU=(e,t)=>{for(var n in t||={})YU.call(t,n)&&ZU(e,n,t[n]);if(JU)for(var n of JU(t))XU.call(t,n)&&ZU(e,n,t[n]);return e},$U=(e,t)=>{var n={};for(var r in e)YU.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&JU)for(var r of JU(e))t.indexOf(r)<0&&XU.call(e,r)&&(n[r]=e[r]);return n},eW={decadeLabelFormat:`YYYY`},tW=(0,Z.forwardRef)((e,t)=>{let n=X(`DecadeLevel`,eW,e),{decade:r,locale:i,minDate:a,maxDate:o,yearsListFormat:s,getYearControlProps:c,__getControlRef:l,__onControlKeyDown:u,__onControlClick:d,__onControlMouseEnter:f,withCellSpacing:p,__preventFocus:m,nextIcon:h,previousIcon:g,nextLabel:_,previousLabel:v,onNext:y,onPrevious:b,nextDisabled:x,previousDisabled:S,levelControlAriaLabel:C,withNext:w,withPrevious:T,className:E,decadeLabelFormat:D,classNames:O,styles:k,unstyled:A,__staticSelector:j,__stopPropagation:M,variant:N,size:P}=n,F=$U(n,`decade.locale.minDate.maxDate.yearsListFormat.getYearControlProps.__getControlRef.__onControlKeyDown.__onControlClick.__onControlMouseEnter.withCellSpacing.__preventFocus.nextIcon.previousIcon.nextLabel.previousLabel.onNext.onPrevious.nextDisabled.previousDisabled.levelControlAriaLabel.withNext.withPrevious.className.decadeLabelFormat.classNames.styles.unstyled.__staticSelector.__stopPropagation.variant.size`.split(`.`)),{classes:I,cx:L}=jU(null,{name:[`DecadeLevel`,j],classNames:O,styles:k,unstyled:A,variant:N,size:P}),R=cV(),[z,B]=AU(r),V={__staticSelector:j||`DecadeLevel`,classNames:O,styles:k,unstyled:A,variant:N,size:P},ee=typeof x==`boolean`?x:o?!(0,GB.default)(B).endOf(`year`).isBefore(o):!1,te=typeof S==`boolean`?S:a?!(0,GB.default)(z).startOf(`year`).isAfter(a):!1,H=(e,t)=>(0,GB.default)(e).locale(i||R.locale).format(t);return Z.createElement(Ir,QU({className:L(I.decadeLevel,E),"data-decade-level":!0,ref:t},F),Z.createElement(WB,QU({label:typeof D==`function`?D(z,B):`${H(z,D)} \u2013 ${H(B,D)}`,className:I.calendarHeader,__preventFocus:m,__stopPropagation:M,nextIcon:h,previousIcon:g,nextLabel:_,previousLabel:v,onNext:y,onPrevious:b,nextDisabled:ee,previousDisabled:te,hasNextLevel:!1,levelControlAriaLabel:C,withNext:w,withPrevious:T},V)),Z.createElement(KU,QU({decade:r,locale:i,minDate:a,maxDate:o,yearsListFormat:s,getYearControlProps:c,__getControlRef:l,__onControlKeyDown:u,__onControlClick:d,__onControlMouseEnter:f,__preventFocus:m,__stopPropagation:M,withCellSpacing:p},V)))});tW.displayName=`@mantine/dates/DecadeLevel`;var nW=Object.defineProperty,rW=Object.getOwnPropertySymbols,iW=Object.prototype.hasOwnProperty,aW=Object.prototype.propertyIsEnumerable,oW=(e,t,n)=>t in e?nW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sW=(e,t)=>{for(var n in t||={})iW.call(t,n)&&oW(e,n,t[n]);if(rW)for(var n of rW(t))aW.call(t,n)&&oW(e,n,t[n]);return e},cW=(e,t)=>{var n={};for(var r in e)iW.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&rW)for(var r of rW(e))t.indexOf(r)<0&&aW.call(e,r)&&(n[r]=e[r]);return n},lW={numberOfColumns:1},uW=(0,Z.forwardRef)((e,t)=>{let n=X(`DecadeLevelGroup`,lW,e),{decade:r,locale:i,minDate:a,maxDate:o,yearsListFormat:s,getYearControlProps:c,__onControlClick:l,__onControlMouseEnter:u,withCellSpacing:d,__preventFocus:f,nextIcon:p,previousIcon:m,nextLabel:h,previousLabel:g,onNext:_,onPrevious:v,nextDisabled:y,previousDisabled:b,className:x,classNames:S,styles:C,unstyled:w,__staticSelector:T,__stopPropagation:E,numberOfColumns:D,levelControlAriaLabel:O,decadeLabelFormat:k,variant:A,size:j}=n,M=cW(n,`decade.locale.minDate.maxDate.yearsListFormat.getYearControlProps.__onControlClick.__onControlMouseEnter.withCellSpacing.__preventFocus.nextIcon.previousIcon.nextLabel.previousLabel.onNext.onPrevious.nextDisabled.previousDisabled.className.classNames.styles.unstyled.__staticSelector.__stopPropagation.numberOfColumns.levelControlAriaLabel.decadeLabelFormat.variant.size`.split(`.`)),{classes:N,cx:P}=OU(null,{name:[`DecadeLevelGroup`,T],styles:C,classNames:S,unstyled:w,variant:A,size:j}),F=(0,Z.useRef)([]),I=Array(D).fill(0).map((e,t)=>{let n=(0,GB.default)(r).add(t*10,`years`).toDate();return Z.createElement(tW,{key:t,variant:A,size:j,yearsListFormat:s,decade:n,withNext:t===D-1,withPrevious:t===0,decadeLabelFormat:k,__onControlClick:l,__onControlMouseEnter:u,__onControlKeyDown:(e,n)=>_H({levelIndex:t,rowIndex:n.rowIndex,cellIndex:n.cellIndex,event:e,controlsRef:F}),__getControlRef:(e,n,r)=>{Array.isArray(F.current[t])||(F.current[t]=[]),Array.isArray(F.current[t][e])||(F.current[t][e]=[]),F.current[t][e][n]=r},levelControlAriaLabel:typeof O==`function`?O(n):O,locale:i,minDate:a,maxDate:o,__preventFocus:f,__stopPropagation:E,nextIcon:p,previousIcon:m,nextLabel:h,previousLabel:g,onNext:_,onPrevious:v,nextDisabled:y,previousDisabled:b,getYearControlProps:c,__staticSelector:T||`DecadeLevelGroup`,classNames:S,styles:C,unstyled:w,withCellSpacing:d})});return Z.createElement(Ir,sW({className:P(N.decadeLevelGroup,x),ref:t},M),I)});uW.displayName=`@mantine/dates/DecadeLevelGroup`;var dW=Object.defineProperty,fW=Object.getOwnPropertySymbols,pW=Object.prototype.hasOwnProperty,mW=Object.prototype.propertyIsEnumerable,hW=(e,t,n)=>t in e?dW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gW=(e,t)=>{for(var n in t||={})pW.call(t,n)&&hW(e,n,t[n]);if(fW)for(var n of fW(t))mW.call(t,n)&&hW(e,n,t[n]);return e},_W=(e,t)=>{var n={};for(var r in e)pW.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&fW)for(var r of fW(e))t.indexOf(r)<0&&mW.call(e,r)&&(n[r]=e[r]);return n},vW={maxLevel:`decade`,minLevel:`month`,__updateDateOnYearSelect:!0,__updateDateOnMonthSelect:!0},yW=(0,Z.forwardRef)((e,t)=>{let n=X(`Calendar`,vW,e),{maxLevel:r,minLevel:i,defaultLevel:a,level:o,onLevelChange:s,date:c,defaultDate:l,onDateChange:u,numberOfColumns:d,columnsToScroll:f,ariaLabels:p,onYearSelect:m,onMonthSelect:h,onYearMouseEnter:g,onMonthMouseEnter:_,__updateDateOnYearSelect:v,__updateDateOnMonthSelect:y,firstDayOfWeek:b,weekdayFormat:x,weekendDays:S,getDayProps:C,excludeDate:w,renderDay:T,hideOutsideDates:E,hideWeekdays:D,getDayAriaLabel:O,monthLabelFormat:k,nextIcon:A,previousIcon:j,__onDayClick:M,__onDayMouseEnter:N,withCellSpacing:P,monthsListFormat:F,getMonthControlProps:I,yearLabelFormat:L,yearsListFormat:R,getYearControlProps:z,decadeLabelFormat:B,minDate:V,maxDate:ee,locale:te,className:H,classNames:ne,styles:re,__staticSelector:ie,unstyled:U,variant:ae,size:oe,__preventFocus:W,__stopPropagation:se,onNextDecade:ce,onPreviousDecade:le,onNextYear:ue,onPreviousYear:de,onNextMonth:fe,onPreviousMonth:pe,static:me}=n,he=_W(n,`maxLevel.minLevel.defaultLevel.level.onLevelChange.date.defaultDate.onDateChange.numberOfColumns.columnsToScroll.ariaLabels.onYearSelect.onMonthSelect.onYearMouseEnter.onMonthMouseEnter.__updateDateOnYearSelect.__updateDateOnMonthSelect.firstDayOfWeek.weekdayFormat.weekendDays.getDayProps.excludeDate.renderDay.hideOutsideDates.hideWeekdays.getDayAriaLabel.monthLabelFormat.nextIcon.previousIcon.__onDayClick.__onDayMouseEnter.withCellSpacing.monthsListFormat.getMonthControlProps.yearLabelFormat.yearsListFormat.getYearControlProps.decadeLabelFormat.minDate.maxDate.locale.className.classNames.styles.__staticSelector.unstyled.variant.size.__preventFocus.__stopPropagation.onNextDecade.onPreviousDecade.onNextYear.onPreviousYear.onNextMonth.onPreviousMonth.static`.split(`.`)),{classes:ge,cx:_e}=YB(null,{name:[`Calendar`,ie],classNames:ne,styles:re,unstyled:U,variant:ae,size:oe}),[ve,ye]=pd({value:o?JB(o,i,r):void 0,defaultValue:a?JB(a,i,r):void 0,finalValue:JB(void 0,i,r),onChange:s}),[be,xe]=pd({value:c,defaultValue:l,finalValue:null,onChange:u}),Se={__staticSelector:ie||`Calendar`,styles:re,classNames:ne,unstyled:U,variant:ae,size:oe},Ce=f||d||1,we=be||new Date;return Z.createElement(Ir,gW({className:_e(ge.calendar,H),ref:t},he),ve===`month`&&Z.createElement(EH,gW({month:we,minDate:V,maxDate:ee,firstDayOfWeek:b,weekdayFormat:x,weekendDays:S,getDayProps:C,excludeDate:w,renderDay:T,hideOutsideDates:E,hideWeekdays:D,getDayAriaLabel:O,onNext:()=>{let e=(0,GB.default)(we).add(Ce,`month`).toDate();fe?.(e),xe(e)},onPrevious:()=>{let e=(0,GB.default)(we).subtract(Ce,`month`).toDate();pe?.(e),xe(e)},hasNextLevel:r!==`month`,onLevelClick:()=>ye(`year`),numberOfColumns:d,locale:te,levelControlAriaLabel:p?.monthLevelControl,nextLabel:p?.nextMonth,nextIcon:A,previousLabel:p?.previousMonth,previousIcon:j,monthLabelFormat:k,__onDayClick:M,__onDayMouseEnter:N,__preventFocus:W,__stopPropagation:se,static:me,withCellSpacing:P},Se)),ve===`year`&&Z.createElement(DU,gW({year:we,numberOfColumns:d,minDate:V,maxDate:ee,monthsListFormat:F,getMonthControlProps:I,locale:te,onNext:()=>{let e=(0,GB.default)(we).add(Ce,`year`).toDate();ue?.(e),xe(e)},onPrevious:()=>{let e=(0,GB.default)(we).subtract(Ce,`year`).toDate();de?.(e),xe(e)},hasNextLevel:r!==`month`&&r!==`year`,onLevelClick:()=>ye(`decade`),levelControlAriaLabel:p?.yearLevelControl,nextLabel:p?.nextYear,nextIcon:A,previousLabel:p?.previousYear,previousIcon:j,yearLabelFormat:L,__onControlMouseEnter:_,__onControlClick:(e,t)=>{y&&xe(t),ye(JB(`month`,i,r)),h?.(t)},__preventFocus:W,__stopPropagation:se,withCellSpacing:P},Se)),ve===`decade`&&Z.createElement(uW,gW({decade:we,minDate:V,maxDate:ee,yearsListFormat:R,getYearControlProps:z,locale:te,onNext:()=>{let e=(0,GB.default)(we).add(10*Ce,`year`).toDate();ce?.(e),xe(e)},onPrevious:()=>{let e=(0,GB.default)(we).subtract(10*Ce,`year`).toDate();le?.(e),xe(e)},numberOfColumns:d,nextLabel:p?.nextDecade,nextIcon:A,previousLabel:p?.previousDecade,previousIcon:j,decadeLabelFormat:B,__onControlMouseEnter:g,__onControlClick:(e,t)=>{v&&xe(t),ye(JB(`year`,i,r)),m?.(t)},__preventFocus:W,__stopPropagation:se,withCellSpacing:P},Se)))});yW.displayName=`@mantine/dates/Calendar`;var bW=Object.getOwnPropertySymbols,xW=Object.prototype.hasOwnProperty,SW=Object.prototype.propertyIsEnumerable,CW=(e,t)=>{var n={};for(var r in e)xW.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&bW)for(var r of bW(e))t.indexOf(r)<0&&SW.call(e,r)&&(n[r]=e[r]);return n};function wW(e){let t=e,{maxLevel:n,minLevel:r,defaultLevel:i,level:a,onLevelChange:o,nextIcon:s,previousIcon:c,date:l,defaultDate:u,onDateChange:d,numberOfColumns:f,columnsToScroll:p,ariaLabels:m,onYearSelect:h,onMonthSelect:g,onYearMouseEnter:_,onMonthMouseEnter:v,onNextMonth:y,onPreviousMonth:b,onNextYear:x,onPreviousYear:S,onNextDecade:C,onPreviousDecade:w,withCellSpacing:T,__updateDateOnYearSelect:E,__updateDateOnMonthSelect:D,firstDayOfWeek:O,weekdayFormat:k,weekendDays:A,getDayProps:j,excludeDate:M,renderDay:N,hideOutsideDates:P,hideWeekdays:F,getDayAriaLabel:I,monthLabelFormat:L,monthsListFormat:R,getMonthControlProps:z,yearLabelFormat:B,yearsListFormat:V,getYearControlProps:ee,decadeLabelFormat:te,allowSingleDateInRange:H,allowDeselect:ne,minDate:re,maxDate:ie,locale:U}=t,ae=CW(t,`maxLevel.minLevel.defaultLevel.level.onLevelChange.nextIcon.previousIcon.date.defaultDate.onDateChange.numberOfColumns.columnsToScroll.ariaLabels.onYearSelect.onMonthSelect.onYearMouseEnter.onMonthMouseEnter.onNextMonth.onPreviousMonth.onNextYear.onPreviousYear.onNextDecade.onPreviousDecade.withCellSpacing.__updateDateOnYearSelect.__updateDateOnMonthSelect.firstDayOfWeek.weekdayFormat.weekendDays.getDayProps.excludeDate.renderDay.hideOutsideDates.hideWeekdays.getDayAriaLabel.monthLabelFormat.monthsListFormat.getMonthControlProps.yearLabelFormat.yearsListFormat.getYearControlProps.decadeLabelFormat.allowSingleDateInRange.allowDeselect.minDate.maxDate.locale`.split(`.`));return{calendarProps:{maxLevel:n,minLevel:r,defaultLevel:i,level:a,onLevelChange:o,nextIcon:s,previousIcon:c,date:l,defaultDate:u,onDateChange:d,numberOfColumns:f,columnsToScroll:p,ariaLabels:m,onYearSelect:h,onMonthSelect:g,onYearMouseEnter:_,onMonthMouseEnter:v,onNextMonth:y,onPreviousMonth:b,onNextYear:x,onPreviousYear:S,onNextDecade:C,onPreviousDecade:w,withCellSpacing:T,__updateDateOnYearSelect:E,__updateDateOnMonthSelect:D,firstDayOfWeek:O,weekdayFormat:k,weekendDays:A,getDayProps:j,excludeDate:M,renderDay:N,hideOutsideDates:P,hideWeekdays:F,getDayAriaLabel:I,monthLabelFormat:L,monthsListFormat:R,getMonthControlProps:z,yearLabelFormat:B,yearsListFormat:V,getYearControlProps:ee,decadeLabelFormat:te,allowSingleDateInRange:H,allowDeselect:ne,minDate:re,maxDate:ie,locale:U},others:ae}}function TW(e,t){if(t===`range`&&Array.isArray(e)){let[t,n]=e;return t?n?`${t.toISOString()} \u2013 ${n.toISOString()}`:`${t.toISOString()} \u2013`:``}return t===`multiple`&&Array.isArray(e)?e.map(e=>e.toISOString()).join(`, `):!Array.isArray(e)&&e?e.toISOString():``}function EW({value:e,type:t,name:n,form:r}){return Z.createElement(`input`,{type:`hidden`,value:TW(e,t),name:n,form:r})}EW.displayName=`@mantine/dates/HiddenDatesInput`;var DW=e=>e===`range`?[null,null]:e===`multiple`?[]:null;function OW({type:e,value:t,defaultValue:n,onChange:r}){let i=(0,Z.useRef)(e),[a,o]=pd({value:t,defaultValue:n,onChange:r,finalValue:DW(e)}),s=a;return i.current!==e&&(i.current=e,t===void 0&&(s=n===void 0?DW(e):n,o(s))),[s,o]}function kW(e,t){let n=[...t].sort((e,t)=>e.getTime()-t.getTime());return(0,GB.default)(n[0]).startOf(`day`).subtract(1,`ms`).isBefore(e)&&(0,GB.default)(n[1]).endOf(`day`).add(1,`ms`).isAfter(e)}function AW({type:e,level:t,value:n,defaultValue:r,onChange:i,allowSingleDateInRange:a,allowDeselect:o,onMouseLeave:s}){let[c,l]=OW({type:e,value:n,defaultValue:r,onChange:i}),[u,d]=(0,Z.useState)(e===`range`&&c[0]&&!c[1]?c[0]:null),[f,p]=(0,Z.useState)(null),m=n=>{if(e===`range`){if(u instanceof Date&&!c[1]){if((0,GB.default)(n).isSame(u,t)&&!a){d(null),p(null),l([null,null]);return}let e=[n,u];e.sort((e,t)=>e.getTime()-t.getTime()),l(e),p(null),d(null);return}if(c[0]&&!c[1]&&(0,GB.default)(n).isSame(c[0],t)&&!a){d(null),p(null),l([null,null]);return}l([n,null]),p(null),d(n);return}if(e===`multiple`){c.some(e=>(0,GB.default)(e).isSame(n,t))?l(c.filter(e=>!(0,GB.default)(e).isSame(n,t))):l([...c,n]);return}c&&o&&(0,GB.default)(n).isSame(c,t)?l(null):l(n)},h=e=>u instanceof Date&&f instanceof Date?kW(e,[f,u]):c[0]instanceof Date&&c[1]instanceof Date&&kW(e,c),g=e===`range`?e=>{s?.(e),p(null)}:s,_=e=>c[0]instanceof Date&&(0,GB.default)(e).isSame(c[0],t)?!(f&&(0,GB.default)(f).isBefore(c[0])):!1,v=e=>c[1]instanceof Date?(0,GB.default)(e).isSame(c[1],t):!(c[0]instanceof Date)||!f?!1:(0,GB.default)(f).isBefore(c[0])&&(0,GB.default)(e).isSame(c[0],t);return{onDateChange:m,onRootMouseLeave:g,onHoveredDateChange:e===`range`&&u?p:()=>{},getControlProps:n=>{if(e===`range`)return{selected:c.some(e=>e&&(0,GB.default)(e).isSame(n,t)),inRange:h(n),firstInRange:_(n),lastInRange:v(n),"data-autofocus":!!c[0]&&(0,GB.default)(c[0]).isSame(n,t)||void 0};if(e===`multiple`)return{selected:c.some(e=>e&&(0,GB.default)(e).isSame(n,t)),"data-autofocus":!!c[0]&&(0,GB.default)(c[0]).isSame(n,t)||void 0};let r=(0,GB.default)(c).isSame(n,t);return{selected:r,"data-autofocus":r||void 0}},_value:c,setValue:l}}function jW({type:e,date:t,locale:n,format:r,labelSeparator:i}){let a=e=>(0,GB.default)(e).locale(n).format(r);return e==="default"?t===null?``:a(t):e===`multiple`?t.map(a).join(`, `):e===`range`?t[0]&&t[1]?`${a(t[0])} ${i} ${a(t[1])}`:t[0]?`${a(t[0])} ${i} `:``:``}function MW({type:e,value:t,defaultValue:n,onChange:r,locale:i,format:a,closeOnChange:o,sortDates:s,labelSeparator:c}){let l=cV(),[u,d]=Sd(!1),[f,p]=OW({type:e,value:t,defaultValue:n,onChange:r}),m=jW({type:e,date:f,locale:l.getLocale(i),format:a,labelSeparator:l.getLabelSeparator(c)}),h=t=>{o&&(e==="default"&&d.close(),e===`range`&&t[0]&&t[1]&&d.close()),p(s&&e===`multiple`?[...t].sort((e,t)=>e.getTime()-t.getTime()):t)};return{_value:f,setValue:h,onClear:()=>h(e===`range`?[null,null]:e===`multiple`?[]:null),shouldClear:e===`range`?!!f[0]:e===`multiple`?f.length>0:f!==null,formattedValue:m,dropdownOpened:u,dropdownHandlers:d}}function NW({minDate:e,maxDate:t}){let n=new Date;return!e&&!t?n:(0,GB.default)(n).isBefore(e)?e:(0,GB.default)(n).isAfter(t)?t:n}var PW=Rr(()=>({placeholder:{},input:{cursor:`pointer`,lineHeight:`unset`,"&[data-read-only]":{cursor:`default`}}})),FW=Object.defineProperty,IW=Object.defineProperties,LW=Object.getOwnPropertyDescriptors,RW=Object.getOwnPropertySymbols,zW=Object.prototype.hasOwnProperty,BW=Object.prototype.propertyIsEnumerable,VW=(e,t,n)=>t in e?FW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,HW=(e,t)=>{for(var n in t||={})zW.call(t,n)&&VW(e,n,t[n]);if(RW)for(var n of RW(t))BW.call(t,n)&&VW(e,n,t[n]);return e},UW=(e,t)=>IW(e,LW(t)),WW=(e,t)=>{var n={};for(var r in e)zW.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&RW)for(var r of RW(e))t.indexOf(r)<0&&BW.call(e,r)&&(n[r]=e[r]);return n},GW={},KW=(0,Z.forwardRef)((e,t)=>{let n=X_(`PickerInputBase`,GW,e),{inputProps:r,wrapperProps:i,placeholder:a,classNames:o,styles:s,unstyled:c,popoverProps:l,modalProps:u,dropdownType:d,children:f,formattedValue:p,dropdownHandlers:m,dropdownOpened:h,onClick:g,clearable:_,onClear:v,clearButtonProps:y,rightSection:b,shouldClear:x,readOnly:S,disabled:C,value:w,name:T,form:E,type:D}=n,O=WW(n,[`inputProps`,`wrapperProps`,`placeholder`,`classNames`,`styles`,`unstyled`,`popoverProps`,`modalProps`,`dropdownType`,`children`,`formattedValue`,`dropdownHandlers`,`dropdownOpened`,`onClick`,`clearable`,`onClear`,`clearButtonProps`,`rightSection`,`shouldClear`,`readOnly`,`disabled`,`value`,`name`,`form`,`type`]),{classes:k,cx:A}=PW(null,{name:r.__staticSelector,classNames:o,styles:s,unstyled:c,variant:r.variant,size:r.size}),j=b||(_&&x&&!S&&!C?Z.createElement(Yf,HW({variant:`transparent`,onClick:v,unstyled:c,size:r.size},y)):null),M=()=>{D===`range`&&w[0]&&!w[1]&&v(),m.close()},N=i.label;return Z.createElement(Z.Fragment,null,d===`modal`&&!S&&Z.createElement(fO,HW({opened:h,onClose:M,withCloseButton:!1,size:`auto`,"data-dates-modal":!0,unstyled:c},u),f),Z.createElement(Ny.Wrapper,HW({},i),Z.createElement(A_,HW({position:`bottom-start`,opened:h,onClose:M,disabled:d===`modal`||S,trapFocus:!0,returnFocus:!0,unstyled:c},l),Z.createElement(A_.Target,{shouldOverrideDefaultTargetId:!N},Z.createElement(Ny,HW(UW(HW({"aria-label":p,"data-dates-input":!0,"data-read-only":S||void 0,disabled:C,component:`button`,type:`button`,multiline:!0,onClick:e=>{g?.(e),m.toggle()},rightSection:j},r),{ref:t,classNames:UW(HW({},o),{input:A(k.input,o?.input)})}),O),p||Z.createElement(Ny.Placeholder,{className:k.placeholder,sx:{color:r.error?`inherit`:void 0}},a))),Z.createElement(A_.Dropdown,{"data-dates-dropdown":!0},f))),Z.createElement(EW,{value:w,name:T,form:E,type:D}))});KW.displayName=`@mantine/dates/PickerInputBase`;var qW=Object.defineProperty,JW=Object.getOwnPropertySymbols,YW=Object.prototype.hasOwnProperty,XW=Object.prototype.propertyIsEnumerable,ZW=(e,t,n)=>t in e?qW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,QW=(e,t)=>{for(var n in t||={})YW.call(t,n)&&ZW(e,n,t[n]);if(JW)for(var n of JW(t))XW.call(t,n)&&ZW(e,n,t[n]);return e},$W=(e,t)=>{var n={};for(var r in e)YW.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&JW)for(var r of JW(e))t.indexOf(r)<0&&XW.call(e,r)&&(n[r]=e[r]);return n},eG={type:`default`},tG=(0,Z.forwardRef)((e,t)=>{let n=X(`MonthPicker`,eG,e),{type:r,defaultValue:i,value:a,onChange:o,__staticSelector:s,getMonthControlProps:c,allowSingleDateInRange:l,allowDeselect:u,onMouseLeave:d,onMonthSelect:f}=n,p=$W(n,[`type`,`defaultValue`,`value`,`onChange`,`__staticSelector`,`getMonthControlProps`,`allowSingleDateInRange`,`allowDeselect`,`onMouseLeave`,`onMonthSelect`]),{onDateChange:m,onRootMouseLeave:h,onHoveredDateChange:g,getControlProps:_}=AW({type:r,level:`month`,allowDeselect:u,allowSingleDateInRange:l,value:a,defaultValue:i,onChange:o,onMouseLeave:d});return Z.createElement(yW,QW({ref:t,minLevel:`year`,__updateDateOnMonthSelect:!1,__staticSelector:s||`MonthPicker`,onMouseLeave:h,onMonthMouseEnter:(e,t)=>g(t),onMonthSelect:e=>{m(e),f?.(e)},getMonthControlProps:e=>QW(QW({},_(e)),c?.(e))},p))});tG.displayName=`@mantine/dates/MonthPicker`;var nG=Object.defineProperty,rG=Object.defineProperties,iG=Object.getOwnPropertyDescriptors,aG=Object.getOwnPropertySymbols,oG=Object.prototype.hasOwnProperty,sG=Object.prototype.propertyIsEnumerable,cG=(e,t,n)=>t in e?nG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lG=(e,t)=>{for(var n in t||={})oG.call(t,n)&&cG(e,n,t[n]);if(aG)for(var n of aG(t))sG.call(t,n)&&cG(e,n,t[n]);return e},uG=(e,t)=>rG(e,iG(t)),dG=(e,t)=>{var n={};for(var r in e)oG.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&aG)for(var r of aG(e))t.indexOf(r)<0&&sG.call(e,r)&&(n[r]=e[r]);return n},fG={type:`default`,valueFormat:`MMMM YYYY`,closeOnChange:!0,sortDates:!0,dropdownType:`popover`},pG=(0,Z.forwardRef)((e,t)=>{let n=X(`MonthPickerInput`,fG,e),{type:r,value:i,defaultValue:a,onChange:o,valueFormat:s,labelSeparator:c,locale:l,classNames:u,styles:d,unstyled:f,closeOnChange:p,variant:m,size:h,dropdownType:g,sortDates:_,minDate:v,maxDate:y}=n,{calendarProps:b,others:x}=wW(dG(n,[`type`,`value`,`defaultValue`,`onChange`,`valueFormat`,`labelSeparator`,`locale`,`classNames`,`styles`,`unstyled`,`closeOnChange`,`variant`,`size`,`dropdownType`,`sortDates`,`minDate`,`maxDate`])),{_value:S,setValue:C,formattedValue:w,dropdownHandlers:T,dropdownOpened:E,onClear:D,shouldClear:O}=MW({type:r,value:i,defaultValue:a,onChange:o,locale:l,format:s,labelSeparator:c,closeOnChange:p,sortDates:_});return Z.createElement(KW,lG({formattedValue:w,dropdownOpened:E,dropdownHandlers:T,classNames:u,styles:d,unstyled:f,__staticSelector:`MonthPickerInput`,ref:t,onClear:D,shouldClear:O,value:S,type:r,variant:m,size:h,dropdownType:g},x),Z.createElement(tG,uG(lG({},b),{type:r,value:S,defaultDate:Array.isArray(S)?S[0]||NW({maxDate:y,minDate:v}):S||NW({maxDate:y,minDate:v}),onChange:C,locale:l,classNames:u,styles:d,unstyled:f,__staticSelector:`MonthPickerInput`,__stopPropagation:g===`popover`,variant:m,size:h,minDate:v,maxDate:y})))});pG.displayName=`@mantine/dates/MonthPickerInput`;var mG=Object.defineProperty,hG=Object.getOwnPropertySymbols,gG=Object.prototype.hasOwnProperty,_G=Object.prototype.propertyIsEnumerable,vG=(e,t,n)=>t in e?mG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yG=(e,t)=>{for(var n in t||={})gG.call(t,n)&&vG(e,n,t[n]);if(hG)for(var n of hG(t))_G.call(t,n)&&vG(e,n,t[n]);return e},bG=(e,t)=>{var n={};for(var r in e)gG.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&hG)for(var r of hG(e))t.indexOf(r)<0&&_G.call(e,r)&&(n[r]=e[r]);return n},xG={type:`default`},SG=(0,Z.forwardRef)((e,t)=>{let n=X(`YearPicker`,xG,e),{type:r,defaultValue:i,value:a,onChange:o,__staticSelector:s,getYearControlProps:c,allowSingleDateInRange:l,allowDeselect:u,onMouseLeave:d,onYearSelect:f}=n,p=bG(n,[`type`,`defaultValue`,`value`,`onChange`,`__staticSelector`,`getYearControlProps`,`allowSingleDateInRange`,`allowDeselect`,`onMouseLeave`,`onYearSelect`]),{onDateChange:m,onRootMouseLeave:h,onHoveredDateChange:g,getControlProps:_}=AW({type:r,level:`year`,allowDeselect:u,allowSingleDateInRange:l,value:a,defaultValue:i,onChange:o,onMouseLeave:d});return Z.createElement(yW,yG({ref:t,minLevel:`decade`,__updateDateOnYearSelect:!1,__staticSelector:s||`YearPicker`,onMouseLeave:h,onYearMouseEnter:(e,t)=>g(t),onYearSelect:e=>{m(e),f?.(e)},getYearControlProps:e=>yG(yG({},_(e)),c?.(e))},p))});SG.displayName=`@mantine/dates/YearPicker`;var CG=Object.defineProperty,wG=Object.defineProperties,TG=Object.getOwnPropertyDescriptors,EG=Object.getOwnPropertySymbols,DG=Object.prototype.hasOwnProperty,OG=Object.prototype.propertyIsEnumerable,kG=(e,t,n)=>t in e?CG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,AG=(e,t)=>{for(var n in t||={})DG.call(t,n)&&kG(e,n,t[n]);if(EG)for(var n of EG(t))OG.call(t,n)&&kG(e,n,t[n]);return e},jG=(e,t)=>wG(e,TG(t)),MG=(e,t)=>{var n={};for(var r in e)DG.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&EG)for(var r of EG(e))t.indexOf(r)<0&&OG.call(e,r)&&(n[r]=e[r]);return n},NG={type:`default`,valueFormat:`YYYY`,closeOnChange:!0,sortDates:!0,dropdownType:`popover`},PG=(0,Z.forwardRef)((e,t)=>{let n=X(`YearPickerInput`,NG,e),{type:r,value:i,defaultValue:a,onChange:o,valueFormat:s,labelSeparator:c,locale:l,classNames:u,styles:d,unstyled:f,closeOnChange:p,size:m,variant:h,dropdownType:g,sortDates:_,minDate:v,maxDate:y}=n,{calendarProps:b,others:x}=wW(MG(n,[`type`,`value`,`defaultValue`,`onChange`,`valueFormat`,`labelSeparator`,`locale`,`classNames`,`styles`,`unstyled`,`closeOnChange`,`size`,`variant`,`dropdownType`,`sortDates`,`minDate`,`maxDate`])),{_value:S,setValue:C,formattedValue:w,dropdownHandlers:T,dropdownOpened:E,onClear:D,shouldClear:O}=MW({type:r,value:i,defaultValue:a,onChange:o,locale:l,format:s,labelSeparator:c,closeOnChange:p,sortDates:_});return Z.createElement(KW,AG({formattedValue:w,dropdownOpened:E,dropdownHandlers:T,classNames:u,styles:d,unstyled:f,__staticSelector:`YearPickerInput`,ref:t,onClear:D,shouldClear:O,value:S,type:r,size:m,variant:h,dropdownType:g},x),Z.createElement(SG,jG(AG({},b),{size:m,variant:h,type:r,value:S,defaultDate:Array.isArray(S)?S[0]||NW({maxDate:y,minDate:v}):S||NW({maxDate:y,minDate:v}),onChange:C,locale:l,classNames:u,styles:d,unstyled:f,__staticSelector:`YearPickerInput`,__stopPropagation:g===`popover`,minDate:v,maxDate:y})))});PG.displayName=`@mantine/dates/YearPickerInput`;var FG=()=>{let[{data:e,fetching:t,error:n},r]=H({query:k});n&&(console.error(`Error fetching financial entities: ${n}`),K.error(`Error`,{description:`Unable to fetch financial entities`}));let i=(0,Z.useMemo)(()=>e?.allFinancialEntities?.nodes.sort((e,t)=>e.name>t.name?1:-1)??[],[e]);return{fetching:t,refresh:()=>r(),financialEntities:i,selectableFinancialEntities:(0,Z.useMemo)(()=>i.map(e=>({value:e.id,label:e.name})),[i])}},IG=({formManager:e,document:t,defaultCurrency:n})=>{let{control:r,watch:i,trigger:a}=e,[o,s]=(0,Z.useState)(!1),{selectableFinancialEntities:c,fetching:l}=FG(),u=jl(t)||Ml(t)||Nl(t)||Fl(t)||Pl(t)?t:void 0,d=i(`documentType`);return(0,Z.useEffect)(()=>{s(!!d&&(d===G.Invoice||d===G.Receipt||d===G.InvoiceReceipt||d===G.Proforma||d===G.CreditInvoice))},[d]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(li,{name:`documentType`,control:r,rules:{required:`Required`},defaultValue:t?.documentType??G.Unprocessed,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Type`}),(0,Q.jsxs)(Sn,{onValueChange:e.onChange,value:e.value??void 0,children:[(0,Q.jsx)(ir,{children:(0,Q.jsx)(rn,{className:`w-full truncate`,children:(0,Q.jsx)(qt,{placeholder:`Select type`})})}),(0,Q.jsx)(fn,{onClick:e=>e.stopPropagation(),children:Object.entries(G).map(([e,t])=>(0,Q.jsx)(yn,{value:t,children:e},t))})]}),(0,Q.jsx)(Tr,{})]})}),o&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(li,{name:`date`,control:r,defaultValue:u?.date,rules:{pattern:{value:wl,message:`Date must be in format yyyy-mm-dd`}},render:({field:e,fieldState:t})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Date`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)($Q,{value:e.value??void 0,onChange:t=>{t!==e.value&&e.onChange(t)},"aria-invalid":!!t.error})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`serialNumber`,control:r,defaultValue:u?.serialNumber,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Serial Number`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...e,value:!e||e.value===`Missing`?``:e.value})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`allocationNumber`,control:r,defaultValue:u?.allocationNumber,rules:{pattern:{value:/^\d{9}$/,message:`Allocation number must be 9 characters long`}},render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Allocation Number`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...e,value:e.value??void 0})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`debtorId`,control:r,defaultValue:u?.debtor?.id,render:({field:e})=>(0,Q.jsxs)(cr,{className:`flex flex-col`,children:[(0,Q.jsx)(Dr,{children:`Debtor`}),(0,Q.jsx)(hX,{...e,data:c,value:e.value??void 0,disabled:l,placeholder:`Scroll to see all options`,formPart:!0}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`creditorId`,control:r,defaultValue:u?.creditor?.id,render:({field:e})=>(0,Q.jsxs)(cr,{className:`flex flex-col`,children:[(0,Q.jsx)(Dr,{children:`Creditor`}),(0,Q.jsx)(hX,{...e,data:c,value:e.value??void 0,disabled:l,placeholder:`Scroll to see all options`,formPart:!0}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(kr,{name:`vat.raw`,control:r,defaultValue:u?.vat?.raw,render:({field:e,fieldState:t})=>(0,Q.jsx)(kr,{name:`vat.currency`,control:r,defaultValue:u?.amount?.currency??n??f.Ils,render:({field:n,fieldState:r})=>(0,Q.jsx)(bX,{...e,error:t.error?.message||r.error?.message,label:`VAT`,currencyCodeProps:{...n,label:`Currency`,disabled:!0}})})}),(0,Q.jsx)(kr,{name:`amount.raw`,control:r,defaultValue:u?.amount?.raw,render:({field:e,fieldState:t})=>(0,Q.jsx)(kr,{name:`amount.currency`,control:r,defaultValue:u?.amount?.currency??n??f.Ils,render:({field:n,fieldState:r})=>(0,Q.jsx)(bX,{...e,error:t.error?.message||r.error?.message,label:`Amount`,currencyCodeProps:{...n,label:`Currency`}})})}),(0,Q.jsx)(kr,{name:`vatReportDateOverride`,control:r,defaultValue:u?.vatReportDateOverride,rules:{pattern:{value:wl,message:`Date must be in format yyyy-mm-dd`}},render:({field:e,fieldState:t})=>(0,Q.jsx)(pG,{...e,label:`VAT report date`,value:e.value?new Date(e.value):void 0,onChange:t=>{a(`vatReportDateOverride`),e.onChange(t?`${dr(t,`yyyy-MM`)}-15`:void 0)},error:t.error?.message,popoverProps:{withinPortal:!0}})}),(0,Q.jsx)(kr,{name:`noVatAmount`,control:r,defaultValue:u?.noVatAmount??void 0,render:({field:e,fieldState:t})=>(0,Q.jsx)(kr,{name:`amount.currency`,control:r,defaultValue:u?.amount?.currency??n??f.Ils,render:({field:n})=>(0,Q.jsx)(bX,{...e,value:e.value??void 0,error:t.error?.message,label:`no VAT amount`,currencyCodeProps:{...n,label:`Currency`,disabled:!0}})})})]}),(0,Q.jsx)(li,{name:`image`,control:r,defaultValue:t?.image,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Image URL`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...e,value:e.value?.toString()})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`file`,control:r,defaultValue:t?.file,render:({field:e})=>(0,Q.jsx)(`div`,{className:`flex flex-row`,children:(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`File URL`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{className:`grow`,...e,value:e.value?.toString()})}),(0,Q.jsx)(Tr,{})]})})}),(0,Q.jsx)(li,{name:`description`,control:r,defaultValue:t?.description,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Description`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...e,value:e.value??``})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`remarks`,control:r,defaultValue:t?.remarks,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Remarks`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...e,value:e.value??``})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`exchangeRateOverride`,control:r,defaultValue:u?.exchangeRateOverride,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsxs)(Dr,{children:[`Exchange Rate Override`,(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`(${u?.amount?.currency??n??f.Ils} => ${f.Ils})`})]}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(N2,{onValueChange:t=>e.onChange(Number(t)),value:e.value??void 0,hideControls:!0,decimalScale:5,thousandSeparator:`,`})}),(0,Q.jsx)(Tr,{})]})})]})},LG=({documentId:e,onDone:t,onChange:n})=>{let[{data:r,fetching:i}]=H({query:Ve,variables:{documentId:e}}),a=r?.documentById,o=Xn({defaultValues:{...a}}),{handleSubmit:s,formState:{dirtyFields:c},setValue:l,watch:u}=o,[d,f]=(0,Z.useState)(!1),{updateDocument:p,fetching:m}=Wz(),h=r=>{if(!a)return;let i=gt(r,c);t?.(),i&&Object.keys(i).length>0&&p({documentId:e,fields:i}).then(n)},g=u(`amount.currency`);return(0,Z.useEffect)(()=>{l(`vat.currency`,g)},[l,g]),(0,Q.jsxs)(`div`,{className:`flex flex-row`,children:[i&&(0,Q.jsx)(hi,{className:`flex self-center my-5`,color:`dark`,size:`xl`,variant:`dots`}),!i&&a&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`px-5 w-4/5 h-max justify-items-center`,children:(0,Q.jsx)(wr,{...o,children:(0,Q.jsxs)(`form`,{onSubmit:s(h),children:[(0,Q.jsxs)($9,{cols:4,children:[(0,Q.jsx)(IG,{document:a,formManager:o}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{htmlFor:`file`,children:`File`}),(0,Q.jsx)(vt,{to:a?.file?.toString()||``,target:`_blank`,rel:`noreferrer`,className:`flex flex-col items-center justify-center mt-5`,children:(0,Q.jsx)(q,{variant:`outline`,className:`w-full mb-2`,children:`Open File`})})]})]}),(0,Q.jsx)(`div`,{className:`flex justify-center mt-5`,children:(0,Q.jsx)(q,{type:`submit`,variant:`default`,disabled:m||Object.keys(c).length===0,children:`Save`})})]})})}),(0,Q.jsx)(`div`,{className:` w-1/5 h-max flex flex-col `,children:(0,Q.jsx)(`div`,{className:`flex justify-center`,children:(0,Q.jsx)(Nr,{onClick:()=>f(!!a.image),src:a?.image?.toString(),className:` cursor-pointer bg-gray-300 p-5 mr-5 max-h-fit max-w-fit`})})}),a.image&&(0,Q.jsx)(gC,{classNames:{content:`overflow-y-auto drop-shadow-lg`},withCloseButton:!0,withOverlay:!1,position:`right`,opened:d,onClose:()=>f(!1),size:`30%`,children:(0,Q.jsx)(`div`,{className:`m-2`,children:(0,Q.jsx)(IK,{src:a.image.toString(),zoomLevel:3,magnifierHeight:300,magnifierWidth:300})})})]})]})},RG=`updateMiscExpense`,zG=()=>{let[{fetching:e},t]=p(Re);return{fetching:e,updateMiscExpense:(0,Z.useCallback)(async e=>{let n=`Error updating misc expense ID [${e.id}]`,r=`${RG}-${e.id}`;K.loading(`Update Misc Expense`,{id:r});try{let i=Xe(await t(e),n,r,`updateMiscExpense`);if(i)return K.success(`Success`,{id:r,description:`Misc expense was updated`}),i.updateMiscExpense}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}},BG=({onDone:e,data:t})=>{let[n,r]=(0,Z.useState)(!1),i=Br(Le,t),a=Xn({defaultValues:{amount:i.amount.raw,currency:i.amount.currency,description:i.description,valueDate:new Date(i.valueDate),invoiceDate:i.invoiceDate,creditorId:i.creditor.id,debtorId:i.debtor.id}}),{handleSubmit:o,formState:{dirtyFields:s}}=a,{updateMiscExpense:c,fetching:l}=zG(),u=(0,Z.useCallback)(async t=>{r(!0),await c({id:i.id,fields:t}),e(),r(!1)},[c,e,i.id]),d=e=>{e&&Object.keys(e).length>0&&u({...e})};return n?(0,Q.jsx)(hi,{className:`flex self-center my-5`,color:`dark`,size:`xl`,variant:`dots`}):(0,Q.jsx)(wr,{...a,children:(0,Q.jsx)(`form`,{onSubmit:o(d),noValidate:!0,children:(0,Q.jsxs)(`div`,{className:`px-5 flex flex-col gap-5`,children:[(0,Q.jsx)(TK,{formManager:a,isInsert:!1}),(0,Q.jsx)(`div`,{className:`flex justify-right gap-5 mt-5`,children:(0,Q.jsx)(`button`,{type:`submit`,className:`text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg`,disabled:l||Object.keys(s).length===0,children:`Accept`})})]})})})},VG=({transactionID:e,onDone:t,onChange:n})=>{let[{data:r,fetching:i}]=H({query:ce,variables:{transactionIDs:[e]}}),a=r?.transactionsByIDs?.[0],o=Xn({defaultValues:a??{}});(0,Z.useEffect)(()=>{a&&o.reset(a)},[a,o]);let{control:s,handleSubmit:c,formState:{dirtyFields:l}}=o,{updateTransaction:u,fetching:d}=qz(),f=e=>{if(!a)return;let r=gt(e,l);t?.(),r&&Object.keys(r).length>0&&u({transactionId:a.id,fields:r}).then(n)},{selectableFinancialEntities:p,fetching:m}=FG();return(0,Q.jsxs)(Q.Fragment,{children:[i&&(0,Q.jsx)(hi,{className:`flex self-center my-5`,color:`dark`,size:`xl`,variant:`dots`}),!i&&a&&(0,Q.jsx)(wr,{...o,children:(0,Q.jsxs)(`form`,{onSubmit:c(f),children:[(0,Q.jsx)(`div`,{className:`flex-row px-10 h-max justify-start block`,children:(0,Q.jsxs)($9,{cols:3,children:[(0,Q.jsx)(li,{name:`counterpartyId`,control:s,defaultValue:a.counterparty?.id,rules:{minLength:{value:2,message:`Minimum 2 characters`}},render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Counterparty`}),(0,Q.jsxs)(Sn,{onValueChange:e.onChange,value:e.value??void 0,disabled:m,children:[(0,Q.jsx)(ir,{children:(0,Q.jsx)(rn,{className:`w-full truncate`,children:(0,Q.jsx)(qt,{placeholder:`Scroll to see all options`})})}),(0,Q.jsx)(fn,{onClick:e=>e.stopPropagation(),children:p.map(({value:e,label:t})=>(0,Q.jsx)(yn,{value:e,children:t},e))})]}),(0,Q.jsx)(Tr,{})]})}),a?.account.type===B.CreditCard?(0,Q.jsx)(li,{name:`effectiveDate`,control:s,rules:{pattern:{value:wl,message:`Date must be in format yyyy-mm-dd`}},render:({field:e,fieldState:t})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{htmlFor:`transaction-effective-date`,children:`Effective Date`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)($Q,{id:`transaction-effective-date`,onChange:t=>{t!==e.value&&e.onChange(t)},value:e.value??void 0,"aria-invalid":!!t.error})}),(0,Q.jsx)(Tr,{})]})}):(0,Q.jsx)(Q.Fragment,{}),(0,Q.jsx)(li,{name:`isFee`,control:s,defaultValue:a.isFee,render:({field:e})=>(0,Q.jsxs)(cr,{className:`flex flex-row items-center justify-between rounded-lg border p-3 shadow-sm`,children:[(0,Q.jsx)(`div`,{className:`space-y-0.5`,children:(0,Q.jsx)(Dr,{children:`Fee Transaction`})}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(tB,{checked:e.value===!0,onCheckedChange:e.onChange})})]})})]})}),(0,Q.jsxs)(`div`,{className:`mt-10 mb-5 flex justify-center gap-5`,children:[(0,Q.jsx)(`button`,{type:`submit`,onClick:()=>c(f),className:`mt-8 text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg`,disabled:d||Object.keys(l).length===0,children:`Accept`}),(0,Q.jsx)(`button`,{type:`button`,className:`mt-8 text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg`,onClick:t,children:`Cancel`})]})]})})]})},HG=`insertBusinessTrip`,UG=()=>{let[{fetching:e},t]=p(S);return{fetching:e,insertBusinessTrip:(0,Z.useCallback)(async e=>{let n=`Error inserting business trip`,r=HG;K.loading(`Creating trip`,{id:r});try{let i=Xe(await t(e),n,r);if(i)return K.success(`Success`,{id:r,description:`Business trip created`}),i.insertBusinessTrip}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}},WG=()=>{let[{data:e,fetching:t,error:n},r]=H({query:_});return n&&(console.error(`Error fetching countries: ${n}`),K.error(`Error`,{description:`Unable to fetch countries`})),{fetching:t,refresh:()=>r(),countries:e?.allCountries??[]}},GG=({control:e})=>{let{countries:t,fetching:n}=WG();return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(li,{name:`name`,control:e,rules:{required:`Required`},render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Name`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...e,required:!0})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`fromDate`,control:e,rules:{pattern:{value:wl,message:`Date must be in format yyyy-mm-dd`}},render:({field:e,fieldState:t})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{htmlFor:`business-trip-from-date`,children:`Start Date`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)($Q,{id:`business-trip-from-date`,onChange:t=>{t!==e.value&&e.onChange(t)},value:e.value??void 0,"aria-invalid":!!t.error})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`toDate`,control:e,rules:{pattern:{value:wl,message:`Date must be in format yyyy-mm-dd`}},render:({field:e,fieldState:t})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{htmlFor:`business-trip-to-date`,children:`End Date`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)($Q,{id:`business-trip-to-date`,onChange:t=>{t!==e.value&&e.onChange(t)},value:e.value??void 0,"aria-invalid":!!t.error})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`destinationCode`,control:e,render:({field:e,fieldState:r})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Destination`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(Fk,{...e,data:t.map(e=>({value:e.code,label:e.name})),value:e.value??void 0,disabled:n,maxDropdownHeight:160,searchable:!0,error:r.error?.message})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{control:e,name:`tripPurpose`,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Trip Purpose`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...e,value:e.value??void 0})}),(0,Q.jsx)(Tr,{})]})})]})},KG=({onDone:e})=>{let[t,n]=(0,Z.useState)(!1),r=Xn(),{control:i,handleSubmit:a,formState:{dirtyFields:o}}=r,{insertBusinessTrip:s,fetching:c}=UG(),l=(0,Z.useCallback)(async t=>{n(!0),await s({fields:t}),e(),n(!1)},[s,e]),u=e=>{if(e.fromDate?.trim()===``&&(e.fromDate=void 0),e.toDate?.trim()===``&&(e.fromDate=void 0),e&&Object.keys(e).length>0){if(!e.name){K.error(`Error`,{description:`Business name is required`});return}l(e)}};return t?(0,Q.jsx)(hi,{className:`flex self-center my-5`,color:`dark`,size:`xl`,variant:`dots`}):(0,Q.jsx)(wr,{...r,children:(0,Q.jsx)(`form`,{children:(0,Q.jsxs)(`div`,{className:`px-5 flex flex-col gap-5`,children:[(0,Q.jsx)(GG,{control:i}),(0,Q.jsx)(`div`,{className:`flex justify-right gap-5 mt-5`,children:(0,Q.jsx)(`button`,{type:`button`,className:`text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg`,disabled:c||Object.keys(o).length===0,onClick:a(u),children:`Accept`})})]})})})},qG=`insertDocument`,JG=()=>{let[{fetching:e},t]=p(re);return{fetching:e,insertDocument:(0,Z.useCallback)(async e=>{let n=`Error inserting document to charge ID [${e.record.chargeId}]`,r=qG;K.loading(`Adding document`,{id:r});try{let i=Xe(await t(e),n,r,`insertDocument`);if(i)return K.success(`Success`,{id:r,description:`Document added`}),i.insertDocument}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}},YG=({chargeId:e,onChange:t,closeModal:n})=>{let r=Xn(),{handleSubmit:i,formState:{dirtyFields:a},setValue:o,watch:s}=r,{insertDocument:c,fetching:l}=JG(),u=r=>{if(r&&Object.keys(r).length>0){if(r.vat){if(!r.amount?.currency){K.error(`Error`,{description:`Couldn't figure out the currency of the document`});return}r.vat.currency=r.amount.currency}r.documentType??=G.Unprocessed,c({record:{...r,chargeId:e}}).then(()=>t?.()),n?.()}},d=s(`amount.currency`);return(0,Z.useEffect)(()=>{o(`vat.currency`,d)},[o,d]),(0,Q.jsx)(`div`,{className:`px-5 w-max h-max justify-items-center`,children:(0,Q.jsx)(wr,{...r,children:(0,Q.jsxs)(`form`,{onSubmit:i(u),children:[(0,Q.jsx)($9,{cols:5,children:(0,Q.jsx)(IG,{formManager:r,defaultCurrency:f.Ils})}),(0,Q.jsxs)(`div`,{className:`flex justify-center gap-5 mt-5`,children:[(0,Q.jsx)(`button`,{type:`submit`,className:` text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg`,disabled:l||Object.keys(a).length===0,children:`Accept`}),(0,Q.jsx)(`button`,{type:`button`,className:` text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg`,onClick:n,children:`Cancel`})]})]})})})},XG=`insertMiscExpense`,ZG=()=>{let[{fetching:e},t]=p(Ge);return{fetching:e,insertMiscExpense:(0,Z.useCallback)(async e=>{let n=`Error creating misc expense`,r=`${XG}-${e.chargeId}`;K.loading(`Creating misc expense`,{id:r});try{let i=Xe(await t(e),n,r);if(i)return K.success(`Success`,{id:r,description:`Misc expense was created`}),i.insertMiscExpense}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}},QG=({onDone:e,defaultValues:t={},chargeId:n})=>{let{insertMiscExpense:r,fetching:i}=ZG(),a=(0,Z.useCallback)(async t=>{await r({chargeId:n,fields:t}),e()},[r,n,e]);return(0,Q.jsx)($G,{defaultValues:t,onInsertDone:a,fetching:i})},$G=({onInsertDone:e,defaultValues:t,fetching:n})=>{let r=t=>{t&&Object.keys(t).length>0&&e(t)},i=Xn({defaultValues:{...t}}),{handleSubmit:a,formState:{dirtyFields:o}}=i;return(0,Q.jsx)(wr,{...i,children:(0,Q.jsx)(`form`,{onSubmit:a(r),noValidate:!0,children:(0,Q.jsxs)(`div`,{className:`px-5 flex flex-col gap-5 relative`,children:[n&&(0,Q.jsx)(`div`,{className:`absolute bg-white/60 z-10 h-full w-full flex items-center justify-center`,children:(0,Q.jsx)(`div`,{className:`flex items-center`,children:(0,Q.jsx)(`span`,{className:`text-3xl mr-4`,children:(0,Q.jsx)(Tn,{className:`h-10 w-10 animate-spin mr-2 self-center`})})})}),(0,Q.jsx)(TK,{formManager:i,isInsert:!0}),(0,Q.jsx)(`div`,{className:`flex justify-right gap-5 mt-5`,children:(0,Q.jsx)(`button`,{type:`submit`,className:`text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg`,disabled:n||Object.keys(o).length===0,children:`Accept`})})]})})})},eK=()=>{let[{data:e,fetching:t,error:n},r]=H({query:z});n&&(console.error(`Error fetching clients: ${n}`),K.error(`Error`,{description:`Unable to fetch clients`}));let i=(0,Z.useMemo)(()=>e?.allClients?.slice().sort((e,t)=>e.originalBusiness.name>t.originalBusiness.name?1:-1)??[],[e]);return{fetching:t,refresh:()=>r(),clients:i,selectableClients:(0,Z.useMemo)(()=>i.map(e=>({value:e.originalBusiness.id,label:e.originalBusiness.name})),[i])}},tK=function(e){return e.Afghanistan=`AFG`,e.Albania=`ALB`,e.Algeria=`DZA`,e[`American Samoa`]=`ASM`,e.Andorra=`AND`,e.Angola=`AGO`,e.Anguilla=`AIA`,e.Antarctica=`ATA`,e[`Antigua and Barbuda`]=`ATG`,e.Argentina=`ARG`,e.Armenia=`ARM`,e.Aruba=`ABW`,e.Australia=`AUS`,e.Austria=`AUT`,e.Azerbaijan=`AZE`,e[`Bahamas (the)`]=`BHS`,e.Bahrain=`BHR`,e.Bangladesh=`BGD`,e.Barbados=`BRB`,e.Belarus=`BLR`,e.Belgium=`BEL`,e.Belize=`BLZ`,e.Benin=`BEN`,e.Bermuda=`BMU`,e.Bhutan=`BTN`,e[`Bolivia (Plurinational State of)`]=`BOL`,e[`Bonaire, Sint Eustatius and Saba`]=`BES`,e[`Bosnia and Herzegovina`]=`BIH`,e.Botswana=`BWA`,e[`Bouvet Island`]=`BVT`,e.Brazil=`BRA`,e[`British Indian Ocean Territory (the)`]=`IOT`,e[`Brunei Darussalam`]=`BRN`,e.Bulgaria=`BGR`,e[`Burkina Faso`]=`BFA`,e.Burundi=`BDI`,e[`Cabo Verde`]=`CPV`,e.Cambodia=`KHM`,e.Cameroon=`CMR`,e.Canada=`CAN`,e[`Cayman Islands (the)`]=`CYM`,e[`Central African Republic (the)`]=`CAF`,e.Chad=`TCD`,e.Chile=`CHL`,e.China=`CHN`,e[`Christmas Island`]=`CXR`,e[`Cocos (Keeling) Islands (the)`]=`CCK`,e.Colombia=`COL`,e[`Comoros (the)`]=`COM`,e[`Congo (the Democratic Republic of the)`]=`COD`,e[`Congo (the)`]=`COG`,e[`Cook Islands (the)`]=`COK`,e[`Costa Rica`]=`CRI`,e.Croatia=`HRV`,e.Cuba=`CUB`,e.Curaçao=`CUW`,e.Cyprus=`CYP`,e.Czechia=`CZE`,e[`Côte d'Ivoire`]=`CIV`,e.Denmark=`DNK`,e.Djibouti=`DJI`,e.Dominica=`DMA`,e[`Dominican Republic (the)`]=`DOM`,e.Ecuador=`ECU`,e.Egypt=`EGY`,e[`El Salvador`]=`SLV`,e[`Equatorial Guinea`]=`GNQ`,e.Eritrea=`ERI`,e.Estonia=`EST`,e.Eswatini=`SWZ`,e.Ethiopia=`ETH`,e[`Falkland Islands (the) [Malvinas]`]=`FLK`,e[`Faroe Islands (the)`]=`FRO`,e.Fiji=`FJI`,e.Finland=`FIN`,e.France=`FRA`,e[`French Guiana`]=`GUF`,e[`French Polynesia`]=`PYF`,e[`French Southern Territories (the)`]=`ATF`,e.Gabon=`GAB`,e[`Gambia (the)`]=`GMB`,e.Georgia=`GEO`,e.Germany=`DEU`,e.Ghana=`GHA`,e.Gibraltar=`GIB`,e.Greece=`GRC`,e.Greenland=`GRL`,e.Grenada=`GRD`,e.Guadeloupe=`GLP`,e.Guam=`GUM`,e.Guatemala=`GTM`,e.Guernsey=`GGY`,e.Guinea=`GIN`,e[`Guinea-Bissau`]=`GNB`,e.Guyana=`GUY`,e.Haiti=`HTI`,e[`Heard Island and McDonald Islands`]=`HMD`,e[`Holy See (the)`]=`VAT`,e.Honduras=`HND`,e[`Hong Kong`]=`HKG`,e.Hungary=`HUN`,e.Iceland=`ISL`,e.India=`IND`,e.Indonesia=`IDN`,e[`Iran (Islamic Republic of)`]=`IRN`,e.Iraq=`IRQ`,e.Ireland=`IRL`,e[`Isle of Man`]=`IMN`,e.Israel=`ISR`,e.Italy=`ITA`,e.Jamaica=`JAM`,e.Japan=`JPN`,e.Jersey=`JEY`,e.Jordan=`JOR`,e.Kazakhstan=`KAZ`,e.Kenya=`KEN`,e.Kiribati=`KIR`,e[`Korea (the Democratic People's Republic of)`]=`PRK`,e[`Korea (the Republic of)`]=`KOR`,e.Kuwait=`KWT`,e.Kyrgyzstan=`KGZ`,e[`Lao People's Democratic Republic (the)`]=`LAO`,e.Latvia=`LVA`,e.Lebanon=`LBN`,e.Lesotho=`LSO`,e.Liberia=`LBR`,e.Libya=`LBY`,e.Liechtenstein=`LIE`,e.Lithuania=`LTU`,e.Luxembourg=`LUX`,e.Macao=`MAC`,e.Madagascar=`MDG`,e.Malawi=`MWI`,e.Malaysia=`MYS`,e.Maldives=`MDV`,e.Mali=`MLI`,e.Malta=`MLT`,e[`Marshall Islands (the)`]=`MHL`,e.Martinique=`MTQ`,e.Mauritania=`MRT`,e.Mauritius=`MUS`,e.Mayotte=`MYT`,e.Mexico=`MEX`,e[`Micronesia (Federated States of)`]=`FSM`,e[`Moldova (the Republic of)`]=`MDA`,e.Monaco=`MCO`,e.Mongolia=`MNG`,e.Montenegro=`MNE`,e.Montserrat=`MSR`,e.Morocco=`MAR`,e.Mozambique=`MOZ`,e.Myanmar=`MMR`,e.Namibia=`NAM`,e.Nauru=`NRU`,e.Nepal=`NPL`,e[`Netherlands (the)`]=`NLD`,e[`New Caledonia`]=`NCL`,e[`New Zealand`]=`NZL`,e.Nicaragua=`NIC`,e[`Niger (the)`]=`NER`,e.Nigeria=`NGA`,e.Niue=`NIU`,e[`Norfolk Island`]=`NFK`,e[`Northern Mariana Islands (the)`]=`MNP`,e.Norway=`NOR`,e.Oman=`OMN`,e.Pakistan=`PAK`,e.Palau=`PLW`,e[`Palestine, State of`]=`PSE`,e.Panama=`PAN`,e[`Papua New Guinea`]=`PNG`,e.Paraguay=`PRY`,e.Peru=`PER`,e[`Philippines (the)`]=`PHL`,e.Pitcairn=`PCN`,e.Poland=`POL`,e.Portugal=`PRT`,e[`Puerto Rico`]=`PRI`,e.Qatar=`QAT`,e[`Republic of North Macedonia`]=`MKD`,e.Romania=`ROU`,e[`Russian Federation (the)`]=`RUS`,e.Rwanda=`RWA`,e.Réunion=`REU`,e[`Saint Barthélemy`]=`BLM`,e[`Saint Helena, Ascension and Tristan da Cunha`]=`SHN`,e[`Saint Kitts and Nevis`]=`KNA`,e[`Saint Lucia`]=`LCA`,e[`Saint Martin (French part)`]=`MAF`,e[`Saint Pierre and Miquelon`]=`SPM`,e[`Saint Vincent and the Grenadines`]=`VCT`,e.Samoa=`WSM`,e[`San Marino`]=`SMR`,e[`Sao Tome and Principe`]=`STP`,e[`Saudi Arabia`]=`SAU`,e.Senegal=`SEN`,e.Serbia=`SRB`,e.Seychelles=`SYC`,e[`Sierra Leone`]=`SLE`,e.Singapore=`SGP`,e[`Sint Maarten (Dutch part)`]=`SXM`,e.Slovakia=`SVK`,e.Slovenia=`SVN`,e[`Solomon Islands`]=`SLB`,e.Somalia=`SOM`,e[`South Africa`]=`ZAF`,e[`South Georgia and the South Sandwich Islands`]=`SGS`,e[`South Sudan`]=`SSD`,e.Spain=`ESP`,e[`Sri Lanka`]=`LKA`,e[`Sudan (the)`]=`SDN`,e.Suriname=`SUR`,e[`Svalbard and Jan Mayen`]=`SJM`,e.Sweden=`SWE`,e.Switzerland=`CHE`,e[`Syrian Arab Republic`]=`SYR`,e[`Taiwan (Province of China)`]=`TWN`,e.Tajikistan=`TJK`,e[`Tanzania, United Republic of`]=`TZA`,e.Thailand=`THA`,e[`Timor-Leste`]=`TLS`,e.Togo=`TGO`,e.Tokelau=`TKL`,e.Tonga=`TON`,e[`Trinidad and Tobago`]=`TTO`,e.Tunisia=`TUN`,e.Turkey=`TUR`,e.Turkmenistan=`TKM`,e[`Turks and Caicos Islands (the)`]=`TCA`,e.Tuvalu=`TUV`,e.Uganda=`UGA`,e.Ukraine=`UKR`,e[`United Arab Emirates (the)`]=`ARE`,e[`United Kingdom of Great Britain and Northern Ireland (the)`]=`GBR`,e[`United States Minor Outlying Islands (the)`]=`UMI`,e[`United States of America (the)`]=`USA`,e.Uruguay=`URY`,e.Uzbekistan=`UZB`,e.Vanuatu=`VUT`,e[`Venezuela (Bolivarian Republic of)`]=`VEN`,e[`Viet Nam`]=`VNM`,e[`Virgin Islands (British)`]=`VGB`,e[`Virgin Islands (U.S.)`]=`VIR`,e[`Wallis and Futuna`]=`WLF`,e[`Western Sahara`]=`ESH`,e.Yemen=`YEM`,e.Zambia=`ZMB`,e.Zimbabwe=`ZWE`,e[`Åland Islands`]=`ALA`,e}({}),nK=Object.fromEntries(Object.entries(tK).map(([e,t])=>[t,e]));function rK(e){return e?nK[e.toUpperCase()]??e:null}var iK=()=>[{value:Ae.English,label:`English`},{value:Ae.Hebrew,label:`Hebrew`}],aK=()=>[{value:f.Ils,label:`Israeli Shekel (ILS)`},{value:f.Usd,label:`US Dollar (USD)`},{value:f.Eur,label:`Euro (EUR)`},{value:f.Gbp,label:`British Pound (GBP)`},{value:f.Jpy,label:`Japanese Yen (JPY)`},{value:f.Aud,label:`Australian Dollar (AUD)`},{value:f.Cad,label:`Canadian Dollar (CAD)`},{value:f.Sek,label:`Swedish Krona (SEK)`}],oK=()=>[{value:Je.Default,label:`Default (Based on business type)`},{value:Je.Exempt,label:`Exempt (VAT free)`},{value:Je.Mixed,label:`Mixed (Contains exempt and due VAT income rows)`}],sK=()=>[G.CreditInvoice,G.Invoice,G.InvoiceReceipt,G.Receipt,G.Proforma].map(e=>({value:e,label:Il(e)})),cK=()=>Object.entries(tK).map(([e,t])=>({value:t,label:e})),lK=()=>[{value:L.TaxDeduction,label:`Tax deduction (ניכוי במקור)`},{value:L.Cash,label:`Cash (מזומן)`},{value:L.Cheque,label:`Cheque (צ׳ק)`},{value:L.CreditCard,label:`Credit card (כרטיס אשראי)`},{value:L.WireTransfer,label:`Wire-transfer (העברה בנקאית)`},{value:L.Paypal,label:`PayPal (פייפאל)`},{value:L.OtherDeduction,label:`Other deduction (ניכוי אחר)`},{value:L.PaymentApp,label:`Payment app (אפליקציית תשלום)`},{value:L.Other,label:`Other (אחר)`}],uK=()=>[{value:ue.Unknown,label:`Unknown (לא ידוע)`},{value:ue.Isracard,label:`Isracard (ישראכרט)`},{value:ue.Visa,label:`Visa (ויזה)`},{value:ue.Mastercard,label:`Mastercard (מאסטרקארד)`},{value:ue.AmericanExpress,label:`American Express (אמריקן אקספרס)`},{value:ue.Diners,label:`Diners (דיינרס)`}],dK=cK();function fK({client:e,onChange:t,fetching:n}){let r=(n,r)=>{t({...e,[n]:r})},i=e=>{let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);r(`emails`,t)};return(0,Q.jsxs)(Ei,{children:[(0,Q.jsx)(Si,{children:(0,Q.jsxs)(wi,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Sa,{className:`w-5 h-5`}),`Client Information`]})}),(0,Q.jsx)(Ci,{className:`space-y-4`,children:n?(0,Q.jsx)(`div`,{children:`Loading...`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{htmlFor:`clientName`,children:`Client Name`}),(0,Q.jsx)(bn,{id:`clientName`,value:e.name||``,onChange:e=>r(`name`,e.target.value),placeholder:`Enter client name`})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{htmlFor:`taxId`,children:`Tax ID`}),(0,Q.jsx)(bn,{id:`taxId`,value:e.taxId||``,onChange:e=>r(`taxId`,e.target.value),placeholder:`Tax identification number`})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{htmlFor:`emails`,children:`Email Addresses`}),(0,Q.jsx)(bn,{id:`emails`,value:e.emails?.join(`, `)||``,onChange:e=>i(e.target.value),placeholder:`email1@example.com, email2@example.com`})]}),(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-4`,children:(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{htmlFor:`phone`,children:`Phone`}),(0,Q.jsx)(bn,{id:`phone`,value:e.phone||``,onChange:e=>r(`phone`,e.target.value),placeholder:`Phone number`})]})}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{htmlFor:`address`,children:`Address`}),(0,Q.jsx)(bn,{id:`address`,value:e.address||``,onChange:e=>r(`address`,e.target.value),placeholder:`Street address`})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-3 gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{htmlFor:`city`,children:`City`}),(0,Q.jsx)(bn,{id:`city`,value:e.city||``,onChange:e=>r(`city`,e.target.value),placeholder:`City`})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{htmlFor:`country`,children:`Country`}),(0,Q.jsx)(hX,{onChange:e=>r(`country`,e),data:dK,value:e.country,placeholder:`Select country`,triggerProps:{className:`w-full flex justify-between`}})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{htmlFor:`zipCode`,children:`Zip Code`}),(0,Q.jsx)(bn,{id:`zipCode`,value:e.zipCode||``,onChange:e=>r(`zipCode`,e.target.value),placeholder:`Zip Code`})]})]})]})})]})}var pK=oK(),mK=aK();function hK({income:e,currency:t,onChange:n}){let r=()=>{let r={description:``,price:0,quantity:1,currency:t,vatType:Je.Exempt};n([...e,r])},i=(t,r,i)=>{let a=[...e];a[t]={...a[t],[r]:i},n(a)},a=t=>{n(e.filter((e,n)=>n!==t))},o=e=>{let t=e.price*e.quantity;return t+t*((e.vatRate||0)/100)};return(0,Q.jsxs)(Ei,{children:[(0,Q.jsx)(Si,{children:(0,Q.jsxs)(wi,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(da,{className:`w-5 h-5`}),`Income Items`]})}),(0,Q.jsxs)(Ci,{className:`space-y-4`,children:[e.map((e,n)=>(0,Q.jsxs)(`div`,{className:`border rounded-lg p-4 space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,Q.jsxs)(`h4`,{className:`font-medium`,children:[`Item `,n+1]}),(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>a(n),className:`text-red-600 hover:text-red-700`,children:(0,Q.jsx)(Wn,{className:`w-4 h-4`})})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`Description`}),(0,Q.jsx)(zn,{value:e.description,onChange:e=>i(n,`description`,e.target.value),placeholder:`Item description`,className:`min-h-[60px]`})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-3 gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`Price`}),(0,Q.jsx)(bn,{type:`number`,step:`0.01`,value:e.price,onChange:e=>i(n,`price`,Number.parseFloat(e.target.value)||0),placeholder:`0.00`})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`Currency`}),(0,Q.jsxs)(Sn,{value:e.currency,onValueChange:e=>i(n,`currency`,e),children:[(0,Q.jsx)(rn,{children:(0,Q.jsx)(qt,{})}),(0,Q.jsx)(fn,{children:mK.map(e=>(0,Q.jsx)(yn,{value:e.value,children:e.label},e.value))})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`Quantity`}),(0,Q.jsx)(bn,{type:`number`,step:`1`,value:e.quantity,onChange:e=>i(n,`quantity`,Number.parseInt(e.target.value)||1),placeholder:`1`})]})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`VAT Type`}),(0,Q.jsxs)(Sn,{value:e.vatType,onValueChange:e=>i(n,`vatType`,e),children:[(0,Q.jsx)(rn,{children:(0,Q.jsx)(qt,{})}),(0,Q.jsx)(fn,{children:pK.map(e=>(0,Q.jsx)(yn,{value:e.value,children:e.label},e.value))})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`VAT Rate (%)`}),(0,Q.jsx)(bn,{type:`number`,step:`0.01`,value:e.vatRate||0,onChange:e=>i(n,`vatRate`,Number.parseFloat(e.target.value)||0),placeholder:`0.00`})]})]}),(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-4`,children:(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`Total`}),(0,Q.jsxs)(`div`,{className:`px-3 py-2 bg-gray-50 rounded-md text-sm font-medium`,children:[o(e).toFixed(2),` `,t]})]})})]},n)),(0,Q.jsxs)(q,{onClick:r,variant:`outline`,className:`w-full bg-transparent`,children:[(0,Q.jsx)(ln,{className:`w-4 h-4 mr-2`}),`Add Income Item`]}),e.length>0&&(0,Q.jsx)(`div`,{className:`border-t pt-4`,children:(0,Q.jsxs)(`div`,{className:`flex justify-between items-center font-medium`,children:[(0,Q.jsx)(`span`,{children:`Total Amount:`}),(0,Q.jsxs)(`span`,{children:[e.reduce((e,t)=>e+o(t),0).toFixed(2),` `,t]})]})})]})]})}var gK=aK(),_K=lK(),vK=uK();function yK({payments:e,currency:t,onChange:n}){let r=()=>{let r={currency:t,price:0,type:L.Cash,date:new Date().toISOString().split(`T`)[0]};n([...e,r])},i=(0,Z.useCallback)((t,r,i)=>{let a=[...e];a[t]={...a[t],[r]:i},n(a)},[e,n]),a=t=>{n(e.filter((e,n)=>n!==t))},o=e=>_K.find(t=>t.value===e)?.label||e,s=e=>e===L.WireTransfer||e===L.Cheque,c=e=>e===L.Cheque,l=e=>e===L.CreditCard,u=e=>e===L.Paypal,d=(0,Z.useCallback)((e,t)=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`Account ID`}),(0,Q.jsx)(bn,{value:e.accountId||``,onChange:e=>i(t,`accountId`,e.target.value),placeholder:`PayPal account ID`})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`Transaction ID`}),(0,Q.jsx)(bn,{value:e.transactionId||``,onChange:e=>i(t,`transactionId`,e.target.value),placeholder:`Transaction ID`})]})]}),[i]);return(0,Q.jsxs)(Ei,{children:[(0,Q.jsx)(Si,{children:(0,Q.jsxs)(wi,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Hi,{className:`w-5 h-5`}),`Payments`]})}),(0,Q.jsxs)(Ci,{className:`space-y-4`,children:[e.map((e,t)=>(0,Q.jsxs)(`div`,{className:`border rounded-lg p-4 space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,Q.jsxs)(`h4`,{className:`font-medium`,children:[`Payment `,t+1,` - `,o(e.type)]}),(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>a(t),className:`text-red-600 hover:text-red-700`,children:(0,Q.jsx)(Wn,{className:`w-4 h-4`})})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-3 gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`Payment Type`}),(0,Q.jsxs)(Sn,{value:e.type,onValueChange:e=>i(t,`type`,e),children:[(0,Q.jsx)(rn,{children:(0,Q.jsx)(qt,{})}),(0,Q.jsx)(fn,{children:_K.map(e=>(0,Q.jsx)(yn,{value:e.value,children:e.label},e.value))})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`Amount`}),(0,Q.jsx)(bn,{type:`number`,step:`0.01`,value:e.price,onChange:e=>i(t,`price`,Number.parseFloat(e.target.value)||0),placeholder:`0.00`})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`Currency`}),(0,Q.jsxs)(Sn,{value:e.currency,onValueChange:e=>i(t,`currency`,e),children:[(0,Q.jsx)(rn,{children:(0,Q.jsx)(qt,{})}),(0,Q.jsx)(fn,{children:gK.map(e=>(0,Q.jsx)(yn,{value:e.value,children:e.label},e.value))})]})]})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`Date`}),(0,Q.jsx)(bn,{type:`date`,value:e.date||``,onChange:e=>i(t,`date`,e.target.value)})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`Currency Rate (relative to ILS)`}),(0,Q.jsx)(bn,{type:`number`,step:`0.0001`,value:e.currencyRate||``,onChange:e=>i(t,`currencyRate`,Number.parseFloat(e.target.value)||void 0),placeholder:`1.0000`})]})]}),s(e.type)&&(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(`h5`,{className:`font-medium text-sm text-gray-700`,children:`Bank Details`}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-3 gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`Bank Name`}),(0,Q.jsx)(bn,{value:e.bankName||``,onChange:e=>i(t,`bankName`,e.target.value),placeholder:`Bank name`})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`Bank Branch`}),(0,Q.jsx)(bn,{value:e.bankBranch||``,onChange:e=>i(t,`bankBranch`,e.target.value),placeholder:`Branch number`})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`Bank Account`}),(0,Q.jsx)(bn,{value:e.bankAccount||``,onChange:e=>i(t,`bankAccount`,e.target.value),placeholder:`Account number`})]})]})]}),c(e.type)&&(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-4`,children:(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`Cheque Number`}),(0,Q.jsx)(bn,{value:e.chequeNum||``,onChange:e=>i(t,`chequeNum`,e.target.value),placeholder:`Cheque number`})]})})}),l(e.type)&&(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(`h5`,{className:`font-medium text-sm text-gray-700`,children:`Credit Card Details`}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-3 gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`Card Type`}),(0,Q.jsxs)(Sn,{value:e.cardType||``,onValueChange:e=>i(t,`cardType`,e||void 0),children:[(0,Q.jsx)(rn,{children:(0,Q.jsx)(qt,{placeholder:`Select card type`})}),(0,Q.jsx)(fn,{children:vK.map(e=>(0,Q.jsx)(yn,{value:e.value,children:e.label},e.value))})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`Last 4 Digits`}),(0,Q.jsx)(bn,{value:e.cardNum||``,onChange:e=>i(t,`cardNum`,e.target.value),placeholder:`1234`,maxLength:4})]})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`Number of Payments (1-36)`}),(0,Q.jsx)(bn,{type:`number`,min:`1`,max:`36`,value:e.numPayments||``,onChange:e=>i(t,`numPayments`,Number.parseInt(e.target.value)||void 0),placeholder:`1`})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{children:`First Payment Amount`}),(0,Q.jsx)(bn,{type:`number`,step:`0.01`,value:e.firstPayment||``,onChange:e=>i(t,`firstPayment`,Number.parseFloat(e.target.value)||void 0),placeholder:`0.00`})]})]})]}),u(e.type)&&(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(`h5`,{className:`font-medium text-sm text-gray-700`,children:`PayPal Details`}),(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-4`,children:d(e,t)})]})]},t)),(0,Q.jsxs)(q,{onClick:r,variant:`outline`,className:`w-full bg-transparent`,children:[(0,Q.jsx)(ln,{className:`w-4 h-4 mr-2`}),`Add Payment`]}),e.length>0&&(0,Q.jsx)(`div`,{className:`border-t pt-4`,children:(0,Q.jsxs)(`div`,{className:`flex justify-between items-center font-medium`,children:[(0,Q.jsx)(`span`,{children:`Total Payments:`}),(0,Q.jsxs)(`span`,{children:[e.reduce((e,t)=>e+t.price,0).toFixed(2),` `,t]})]})})]})]})}var bK=aK(),xK=sK(),SK=iK(),CK=oK();function wK({formData:e,updateFormData:t}){let[n,r]=(0,Z.useState)(e.client?.id||void 0),{selectableClients:i}=eK(),[a,o]=(0,Z.useState)(e.client??null),[{data:s,fetching:c},l]=H({pause:!0,query:ct,variables:{businessId:n??``}});(0,Z.useEffect)(()=>{e.client?.id&&r(e.client.id)},[e.client?.id]),(0,Z.useEffect)(()=>{n&&l()},[n,l]);let u=(0,Z.useCallback)(e=>{o(e),t(`client`,e)},[t]);(0,Z.useEffect)(()=>{if(s?.client?.integrations.greenInvoiceInfo){let e=j9(Br(se,s.client));u(e)}},[s?.client,u,n]);let d=e=>{if(r(e),e===`new`)t(`client`,{id:`temp-${crypto.randomUUID()}`,name:``});else if(e){let n=i.find(t=>t.value===e);n&&t(`client`,{id:n.value,name:n.label})}},f=e.type===G.Proforma||e.type===G.Invoice,p=f||e.type===G.InvoiceReceipt||e.type===G.CreditInvoice,m=e.type===G.Receipt||e.type===G.InvoiceReceipt;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Ei,{children:[(0,Q.jsx)(Si,{children:(0,Q.jsxs)(wi,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(ha,{className:`w-5 h-5`}),`Document Settings`]})}),(0,Q.jsxs)(Ci,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{htmlFor:`documentType`,children:`Document Type`}),(0,Q.jsxs)(Sn,{value:e.type,onValueChange:e=>t(`type`,e),children:[(0,Q.jsx)(rn,{children:(0,Q.jsx)(qt,{})}),(0,Q.jsx)(fn,{children:xK.map(e=>(0,Q.jsx)(yn,{value:e.value,children:e.label},e.value))})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{htmlFor:`language`,children:`Language`}),(0,Q.jsxs)(Sn,{value:e.language,onValueChange:e=>t(`language`,e),children:[(0,Q.jsx)(rn,{children:(0,Q.jsx)(qt,{})}),(0,Q.jsx)(fn,{children:SK.map(e=>(0,Q.jsx)(yn,{value:e.value,children:e.label},e.value))})]})]})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{htmlFor:`currency`,children:`Currency`}),(0,Q.jsxs)(Sn,{value:e.currency,onValueChange:e=>t(`currency`,e),children:[(0,Q.jsx)(rn,{children:(0,Q.jsx)(qt,{})}),(0,Q.jsx)(fn,{children:bK.map(e=>(0,Q.jsx)(yn,{value:e.value,children:e.label},e.value))})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{htmlFor:`vatType`,children:`VAT Type`}),(0,Q.jsxs)(Sn,{value:e.vatType,onValueChange:e=>t(`vatType`,e),children:[(0,Q.jsx)(rn,{children:(0,Q.jsx)(qt,{})}),(0,Q.jsx)(fn,{children:CK.map(e=>(0,Q.jsx)(yn,{value:e.value,children:e.label},e.value))})]})]})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{htmlFor:`clientSelect`,children:`Select Client`}),(0,Q.jsxs)(Sn,{value:n,onValueChange:d,children:[(0,Q.jsx)(rn,{children:(0,Q.jsx)(qt,{placeholder:`Choose existing client or create new`})}),(0,Q.jsx)(fn,{children:i.map(e=>(0,Q.jsx)(yn,{value:e.value,children:e.label},e.value))})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{htmlFor:`date`,children:`Document Date`}),(0,Q.jsx)(bn,{id:`date`,type:`date`,value:e.date||``,onChange:e=>t(`date`,e.target.value)})]})]}),f&&(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{htmlFor:`maxPayments`,children:`Max Payments`}),(0,Q.jsx)(bn,{id:`maxPayments`,type:`number`,min:`1`,max:`36`,value:e.maxPayments||``,onChange:e=>t(`maxPayments`,Number.parseInt(e.target.value)||void 0),placeholder:`1`})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{htmlFor:`dueDate`,children:`Due Date`}),(0,Q.jsx)(bn,{id:`dueDate`,type:`date`,value:e.dueDate||``,onChange:e=>t(`dueDate`,e.target.value)})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{htmlFor:`description`,children:`Description`}),(0,Q.jsx)(zn,{id:`description`,value:e.description||``,onChange:e=>t(`description`,e.target.value),placeholder:`Main description`,className:`min-h-[60px]`})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{htmlFor:`remarks`,children:`Remarks`}),(0,Q.jsx)(zn,{id:`remarks`,value:e.remarks||``,onChange:e=>t(`remarks`,e.target.value),placeholder:`Additional remarks`,className:`min-h-[60px]`})]})]})]}),a&&(0,Q.jsx)(fK,{client:a,fetching:c,onChange:e=>u(e)}),p&&(0,Q.jsx)(hK,{income:e.income||[],currency:e.currency,onChange:e=>t(`income`,e)}),m&&(0,Q.jsx)(yK,{payments:e.payment||[],currency:e.currency,onChange:e=>t(`payment`,e)})]})}var TK=({formManager:e,isInsert:t})=>{let{control:n,setValue:r}=e,{selectableFinancialEntities:i,fetching:a}=FG();return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(li,{name:`creditorId`,control:n,rules:{required:t?`Required`:void 0},render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Creditor`}),(0,Q.jsx)(hX,{...e,data:i,value:e.value??void 0,disabled:a,placeholder:`Select creditor`,formPart:!0}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`debtorId`,control:n,rules:{required:t?`Required`:void 0},render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Debtor`}),(0,Q.jsx)(hX,{...e,data:i,value:e.value??void 0,disabled:a,placeholder:`Select debtor`,formPart:!0}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(kr,{name:`amount`,control:n,rules:{required:t?`Required`:void 0},render:({field:e,fieldState:r})=>(0,Q.jsx)(kr,{name:`currency`,control:n,rules:{required:t?`Required`:void 0},render:({field:n,fieldState:i})=>(0,Q.jsx)(bX,{...e,required:t,value:e.value??void 0,error:r.error?.message||i.error?.message,label:`Amount`,currencyCodeProps:{...n,required:t,label:`Currency`}})})}),(0,Q.jsx)(li,{name:`invoiceDate`,control:n,rules:{...t?{required:`Required`}:{},pattern:{value:wl,message:`Date must be in format yyyy-mm-dd`}},render:({field:e,fieldState:n})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{htmlFor:`misc-expense-invoice-date`,children:`Invoice Date`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)($Q,{id:`misc-expense-invoice-date`,required:t,onChange:t=>{t!==e.value&&e.onChange(t)},value:e.value??void 0,"aria-invalid":!!n.error})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`valueDate`,control:n,rules:{...t?{required:`Required`}:{},validate:e=>!e||!Number.isNaN(e.getTime())||`Invalid date and time format`},render:({field:e,fieldState:n})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{htmlFor:`misc-expense-value-date`,children:`Value Date`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(r$,{id:`misc-expense-value-date`,value:e.value??null,onChange:t=>{r(`valueDate`,t),e.onChange(t)},required:t,"aria-invalid":!!n.error})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`description`,control:n,rules:{required:t?`Required`:void 0},render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Description`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...e,required:t,value:e.value??void 0})}),(0,Q.jsx)(Tr,{})]})})]})},EK=()=>{let[{data:e,fetching:t,error:n},r]=H({query:I});n&&(console.error(`Error fetching businesses: ${n}`),K.error(`Error`,{description:`Unable to fetch businesses`}));let i=(0,Z.useMemo)(()=>e?.allBusinesses?.nodes.sort((e,t)=>e.name>t.name?1:-1)??[],[e]);return{fetching:t,refresh:()=>r(),businesses:i,selectableBusinesses:(0,Z.useMemo)(()=>i.map(e=>({value:e.id,label:e.name})),[i])}},DK=({isNewInsert:e=!0,defaultValues:t,month:n,onDone:r,isModifying:i})=>{let{selectableBusinesses:a,fetching:o}=EK(),[{data:s,fetching:c,error:u}]=H({query:j}),{userContext:d}=(0,Z.useContext)(ni),[{data:f,fetching:p,error:m}]=H({query:te}),[{data:h,fetching:g,error:_}]=H({query:l,variables:{employerId:d?.context.adminBusinessId??``}}),[v,y]=(0,Z.useState)([]),[b,x]=(0,Z.useState)([]),[S,C]=(0,Z.useState)([]),w=t?.month??n,T=Xn({defaultValues:{...t,month:w}}),{control:E,handleSubmit:D,formState:{dirtyFields:O},setValue:k}=T;(0,Z.useEffect)(()=>{u&&K.error(`Error`,{description:`Oh no!, we have an error fetching pension funds! 🤥`})},[u]),(0,Z.useEffect)(()=>{m&&K.error(`Error`,{description:`Oh no!, we have an error fetching training funds! 🤥`})},[m]),(0,Z.useEffect)(()=>{_&&K.error(`Error`,{description:`Oh no!, we have an error employees! 🤥`})},[_]),(0,Z.useEffect)(()=>{s?.allPensionFunds?.length&&y(s.allPensionFunds.map(e=>({value:e.id,label:e.name})).sort((e,t)=>e.label>t.label?1:-1))},[s,x]),(0,Z.useEffect)(()=>{f?.allTrainingFunds?.length&&x(f.allTrainingFunds.map(e=>({value:e.id,label:e.name})).sort((e,t)=>e.label>t.label?1:-1))},[f,x]),(0,Z.useEffect)(()=>{h?.employeesByEmployerId.length&&C(h.employeesByEmployerId.filter(e=>!e.name.toLocaleLowerCase().includes(`batched`)).map(e=>({value:e.id,label:e.name})).sort((e,t)=>e.label>t.label?1:-1))},[h,x]),(0,Z.useEffect)(()=>{!t?.employer&&d?.context.adminBusinessId&&k(`employer`,d.context.adminBusinessId,{shouldDirty:!0,shouldTouch:!0})},[k,t?.employer,d?.context.adminBusinessId]);let A=n=>{let i=gt(n,O);if(!(e&&(!i?.directPaymentAmount||!i?.employeeId||!i?.employer||!i?.month)))if(i&&Object.keys(i).length>0){if(!e){if(!t)return;i.employeeId??=t.employeeId,i.month??=t.month}r(i)}else r()};function M(e){k(`month`,dr(e,`yyyy-MM-dd`),{shouldDirty:!0,shouldTouch:!0})}return(0,Q.jsx)(wr,{...T,children:(0,Q.jsxs)(`form`,{onSubmit:D(A),children:[(0,Q.jsx)(`div`,{className:`flex-row px-10 h-max justify-start block`,children:(0,Q.jsxs)($9,{cols:4,children:[(0,Q.jsxs)(`div`,{className:`flex-column h-max justify-start block`,children:[(0,Q.jsx)(pG,{defaultDate:w?new Date(w):void 0,defaultValue:w?new Date(w):void 0,onChange:M,popoverProps:{withinPortal:!0}}),(0,Q.jsx)(kr,{name:`employer`,control:E,defaultValue:t?.employer,rules:{required:`Required`},render:({field:e,fieldState:t})=>(0,Q.jsx)(Fk,{...e,data:a,value:e.value,disabled:o,label:`Employer`,placeholder:`Scroll to see all options`,maxDropdownHeight:160,searchable:!0,error:t.error?.message})}),(0,Q.jsx)(li,{name:`chargeId`,control:E,defaultValue:t?.chargeId,rules:{pattern:{value:Tl,message:`Invalid UUID`}},render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Charge ID`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...e,value:e.value??void 0})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(kr,{name:`employeeId`,control:E,defaultValue:t?.employeeId,rules:{required:`Required`},render:({field:e,fieldState:t})=>(0,Q.jsx)(Fk,{...e,data:S,value:e.value,disabled:g,label:`Employee`,placeholder:`Scroll to see all options`,maxDropdownHeight:160,searchable:!0,error:t.error?.message})})]}),(0,Q.jsxs)(`div`,{className:`flex-row px-10 h-max justify-start block`,children:[(0,Q.jsx)(kr,{name:`baseSalary`,control:E,defaultValue:t?.baseSalary,render:({field:e,fieldState:t})=>(0,Q.jsx)(bX,{...e,value:e.value??void 0,error:t.error?.message,label:`Base Salary`,removeTrailingZeros:!0,currencyCodeProps:{value:`ILS`,label:`Currency`,disabled:!0}})}),(0,Q.jsx)(kr,{name:`globalAdditionalHours`,control:E,defaultValue:t?.globalAdditionalHours,render:({field:e,fieldState:t})=>(0,Q.jsx)(bX,{...e,value:e.value??void 0,error:t.error?.message,label:`Global Additional Hours`,removeTrailingZeros:!0,currencyCodeProps:{value:`ILS`,label:`Currency`,disabled:!0}})}),(0,Q.jsx)(kr,{name:`bonus`,control:E,defaultValue:t?.bonus,render:({field:e,fieldState:t})=>(0,Q.jsx)(bX,{...e,value:e.value??void 0,error:t.error?.message,label:`Bonus`,removeTrailingZeros:!0,currencyCodeProps:{value:`ILS`,label:`Currency`,disabled:!0}})}),(0,Q.jsx)(kr,{name:`gift`,control:E,defaultValue:t?.gift,render:({field:e,fieldState:t})=>(0,Q.jsx)(bX,{...e,value:e.value??void 0,error:t.error?.message,label:`Gift`,removeTrailingZeros:!0,currencyCodeProps:{value:`ILS`,label:`Currency`,disabled:!0}})}),(0,Q.jsx)(kr,{name:`travelAndSubsistence`,control:E,defaultValue:t?.travelAndSubsistence,render:({field:e,fieldState:t})=>(0,Q.jsx)(bX,{...e,value:e.value??void 0,error:t.error?.message,label:`Travel and Subsistence`,removeTrailingZeros:!0,currencyCodeProps:{value:`ILS`,label:`Currency`,disabled:!0}})}),(0,Q.jsx)(kr,{name:`recovery`,control:E,defaultValue:t?.recovery,render:({field:e,fieldState:t})=>(0,Q.jsx)(bX,{...e,value:e.value??void 0,error:t.error?.message,label:`Recovery`,removeTrailingZeros:!0,currencyCodeProps:{value:`ILS`,label:`Currency`}})}),(0,Q.jsx)(kr,{name:`vacationTakeout`,control:E,defaultValue:t?.vacationTakeout,render:({field:e,fieldState:t})=>(0,Q.jsx)(bX,{...e,value:e.value??void 0,error:t.error?.message,label:`Vacation Takeout`,removeTrailingZeros:!0,currencyCodeProps:{value:`ILS`,label:`Currency`,disabled:!0}})}),(0,Q.jsx)(kr,{name:`directPaymentAmount`,control:E,defaultValue:t?.directPaymentAmount,rules:{required:`Required`},render:({field:e,fieldState:t})=>(0,Q.jsx)(bX,{...e,value:e.value??void 0,error:t.error?.message,label:`Direct Payment`,removeTrailingZeros:!0,currencyCodeProps:{value:`ILS`,label:`Currency`,disabled:!0}})})]}),(0,Q.jsxs)(`div`,{className:`flex-row px-10 h-max justify-start block`,children:[(0,Q.jsx)(kr,{name:`pensionFundId`,control:E,defaultValue:t?.pensionFundId,render:({field:e,fieldState:t})=>(0,Q.jsx)(Fk,{...e,data:v,value:e.value,disabled:c,label:`Pension Fund`,placeholder:`Scroll to see all options`,maxDropdownHeight:160,searchable:!0,error:t.error?.message})}),(0,Q.jsx)(kr,{name:`pensionEmployeeAmount`,control:E,defaultValue:t?.pensionEmployeeAmount,render:({field:e,fieldState:t})=>(0,Q.jsx)(bX,{...e,value:e.value??void 0,error:t.error?.message,label:`Pension Employee Amount`,removeTrailingZeros:!0,currencyCodeProps:{value:`ILS`,label:`Currency`,disabled:!0}})}),(0,Q.jsx)(kr,{name:`pensionEmployeePercentage`,control:E,defaultValue:t?.pensionEmployeePercentage,render:({field:{value:e,...t},fieldState:n})=>(0,Q.jsx)(yk,{...t,hideControls:!0,precision:2,removeTrailingZeros:!0,rightSection:`%`,value:e??void 0,error:n.error?.message,label:`Pension Employee Percentage`})}),(0,Q.jsx)(kr,{name:`pensionEmployerAmount`,control:E,defaultValue:t?.pensionEmployerAmount,render:({field:e,fieldState:t})=>(0,Q.jsx)(bX,{...e,value:e.value??void 0,error:t.error?.message,label:`Pension Employer Amount`,removeTrailingZeros:!0,currencyCodeProps:{value:`ILS`,label:`Currency`,disabled:!0}})}),(0,Q.jsx)(kr,{name:`pensionEmployerPercentage`,control:E,defaultValue:t?.pensionEmployerPercentage,render:({field:{value:e,...t},fieldState:n})=>(0,Q.jsx)(yk,{...t,hideControls:!0,precision:2,removeTrailingZeros:!0,rightSection:`%`,value:e??void 0,error:n.error?.message,label:`Pension Employer Percentage`})})]}),(0,Q.jsxs)(`div`,{className:`flex-row px-10 h-max justify-start block`,children:[(0,Q.jsx)(kr,{name:`compensationsEmployerAmount`,control:E,defaultValue:t?.compensationsEmployerAmount,render:({field:e,fieldState:t})=>(0,Q.jsx)(bX,{...e,value:e.value??void 0,error:t.error?.message,label:`Compensations Amount`,removeTrailingZeros:!0,currencyCodeProps:{value:`ILS`,label:`Currency`,disabled:!0}})}),(0,Q.jsx)(kr,{name:`compensationsEmployerPercentage`,control:E,defaultValue:t?.compensationsEmployerPercentage,render:({field:{value:e,...t},fieldState:n})=>(0,Q.jsx)(yk,{...t,hideControls:!0,precision:2,removeTrailingZeros:!0,rightSection:`%`,value:e??void 0,error:n.error?.message,label:`Compensations Percentage`})})]}),(0,Q.jsxs)(`div`,{className:`flex-row px-10 h-max justify-start block`,children:[(0,Q.jsx)(kr,{name:`trainingFundId`,control:E,defaultValue:t?.trainingFundId,render:({field:e,fieldState:t})=>(0,Q.jsx)(Fk,{...e,data:b,value:e.value,disabled:p,label:`Training Fund`,placeholder:`Scroll to see all options`,maxDropdownHeight:160,searchable:!0,error:t.error?.message})}),(0,Q.jsx)(kr,{name:`trainingFundEmployeeAmount`,control:E,defaultValue:t?.trainingFundEmployeeAmount,render:({field:e,fieldState:t})=>(0,Q.jsx)(bX,{...e,value:e.value??void 0,error:t.error?.message,label:`Training Employee Amount`,removeTrailingZeros:!0,currencyCodeProps:{value:`ILS`,label:`Currency`,disabled:!0}})}),(0,Q.jsx)(kr,{name:`trainingFundEmployeePercentage`,control:E,defaultValue:t?.trainingFundEmployeePercentage,render:({field:{value:e,...t},fieldState:n})=>(0,Q.jsx)(yk,{...t,hideControls:!0,precision:2,removeTrailingZeros:!0,rightSection:`%`,value:e??void 0,error:n.error?.message,label:`Training Employee Percentage`})}),(0,Q.jsx)(kr,{name:`trainingFundEmployerAmount`,control:E,defaultValue:t?.trainingFundEmployerAmount,render:({field:e,fieldState:t})=>(0,Q.jsx)(bX,{...e,value:e.value??void 0,error:t.error?.message,label:`Training Employer Amount`,removeTrailingZeros:!0,currencyCodeProps:{value:`ILS`,label:`Currency`,disabled:!0}})}),(0,Q.jsx)(kr,{name:`trainingFundEmployerPercentage`,control:E,defaultValue:t?.trainingFundEmployerPercentage,render:({field:{value:e,...t},fieldState:n})=>(0,Q.jsx)(yk,{...t,hideControls:!0,precision:2,removeTrailingZeros:!0,rightSection:`%`,value:e??void 0,error:n.error?.message,label:`Training Employer Percentage`})})]}),(0,Q.jsxs)(`div`,{className:`flex-row px-10 h-max justify-start block`,children:[(0,Q.jsx)(kr,{name:`socialSecurityAmountEmployee`,control:E,defaultValue:t?.socialSecurityAmountEmployee,render:({field:e,fieldState:t})=>(0,Q.jsx)(bX,{...e,value:e.value??void 0,error:t.error?.message,label:`Social Security - Employee`,removeTrailingZeros:!0,currencyCodeProps:{value:`ILS`,label:`Currency`,disabled:!0}})}),(0,Q.jsx)(kr,{name:`socialSecurityAmountEmployer`,control:E,defaultValue:t?.socialSecurityAmountEmployer,render:({field:e,fieldState:t})=>(0,Q.jsx)(bX,{...e,value:e.value??void 0,error:t.error?.message,label:`Social Security - Employer`,removeTrailingZeros:!0,currencyCodeProps:{value:`ILS`,label:`Currency`,disabled:!0}})}),(0,Q.jsx)(kr,{name:`healthPaymentAmount`,control:E,defaultValue:t?.healthPaymentAmount,render:({field:e,fieldState:t})=>(0,Q.jsx)(bX,{...e,value:e.value??void 0,error:t.error?.message,label:`Health Insurance`,removeTrailingZeros:!0,currencyCodeProps:{value:`ILS`,label:`Currency`,disabled:!0}})})]}),(0,Q.jsxs)(`div`,{className:`flex-row px-10 h-max justify-start block`,children:[(0,Q.jsx)(kr,{name:`taxAmount`,control:E,defaultValue:t?.taxAmount,render:({field:e,fieldState:t})=>(0,Q.jsx)(bX,{...e,value:e.value??void 0,error:t.error?.message,label:`Income Tax`,removeTrailingZeros:!0,currencyCodeProps:{value:`ILS`,label:`Currency`,disabled:!0}})}),(0,Q.jsx)(kr,{name:`zkufot`,control:E,defaultValue:t?.zkufot,render:({field:e,fieldState:t})=>(0,Q.jsx)(bX,{...e,value:e.value??void 0,error:t.error?.message,precision:0,label:`Notional Expense`,removeTrailingZeros:!0,currencyCodeProps:{value:`ILS`,label:`Currency`,disabled:!0}})})]}),(0,Q.jsxs)(`div`,{className:`flex-row px-10 h-max justify-start block`,children:[(0,Q.jsx)(kr,{name:`workDays`,control:E,defaultValue:t?.workDays,render:({field:{value:e,...t},fieldState:n})=>(0,Q.jsx)(yk,{...t,hideControls:!0,precision:2,removeTrailingZeros:!0,value:e??void 0,error:n.error?.message,label:`Work Days`})}),(0,Q.jsx)(kr,{name:`addedVacationDays`,control:E,defaultValue:t?.addedVacationDays,render:({field:{value:e,...t},fieldState:n})=>(0,Q.jsx)(yk,{...t,hideControls:!0,precision:2,removeTrailingZeros:!0,value:e??void 0,error:n.error?.message,label:`Added Vacation Days`})}),(0,Q.jsx)(kr,{name:`vacationDaysBalance`,control:E,defaultValue:t?.vacationDaysBalance,render:({field:{value:e,...t},fieldState:n})=>(0,Q.jsx)(yk,{...t,hideControls:!0,precision:2,removeTrailingZeros:!0,value:e??void 0,error:n.error?.message,label:`Vacation Days Balance`})}),(0,Q.jsx)(kr,{name:`sicknessDaysBalance`,control:E,defaultValue:t?.sicknessDaysBalance,render:({field:{value:e,...t},fieldState:n})=>(0,Q.jsx)(yk,{...t,hideControls:!0,precision:2,removeTrailingZeros:!0,value:e??void 0,error:n.error?.message,label:`Sickness Days Balance`})})]})]})}),(0,Q.jsxs)(`div`,{className:`mt-10 mb-5 flex justify-center gap-5`,children:[(0,Q.jsx)(`button`,{type:`submit`,onClick:()=>D(A),className:`mt-8 text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg`,disabled:i||Object.keys(O).length===0,children:`Accept`}),(0,Q.jsx)(`button`,{type:`button`,className:`mt-8 text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg`,onClick:()=>r(),children:`Cancel`})]})]})})};function OK({isInsert:e,formManager:t}){let{control:n}=t;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(li,{name:`key`,control:n,disabled:!e,rules:{required:`Required`,validate:{positive:e=>Number(e)>0||`Key must be a positive number`,integer:e=>Number.isInteger(Number(e))||`Key must be an integer`}},render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Key`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(N2,{...e,value:e.value??void 0,hideControls:!0,decimalScale:0,thousandSeparator:``,required:!0})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`name`,control:n,rules:{required:`Required`,minLength:{value:2,message:`Must be at least 2 characters`}},render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Name`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...e,value:e.value??void 0,required:!0})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`defaultIrsCode`,control:n,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Default IRS Code`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(N2,{...e,value:e.value??void 0,hideControls:!0,decimalScale:0})}),(0,Q.jsx)(Tr,{})]})})]})}var kK=({data:e})=>(0,Q.jsx)(`div`,{className:`flex flex-col gap-4 mt-5`,children:e.map(e=>Br(st,e)).filter(({charge:e})=>e).map(e=>(0,Q.jsx)(vt,{to:yt.CHARGES.DETAIL(e.charge.id),target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),className:`inline-flex items-center font-semibold`,children:`${e.charge.counterparty?.name??`Unknown`} - ${e.charge.userDescription}`},e.id))}),AK=`uploadMultipleDocuments`,jK=()=>{let[{fetching:e},t]=p(rt);return{uploading:e,uploadMultipleDocuments:(0,Z.useCallback)(async e=>{let n=`Error uploading documents`,r=`${AK}-${e.chargeId}`;K.loading(`Uploading Documents`,{id:r});try{let i=Xe(await t(e),n,r,`batchUploadDocuments`);if(i){let e=!1,t=i.batchUploadDocuments.filter(t=>`message`in t?(console.error(`Error uploading document: ${t.message}`),e=!0,!1):`document`in t).map(({document:e})=>e);return K.success(`Upload Successful`,{id:r,description:t.length>0?kK({data:t}):`No successful document uploads`,duration:t.length>0?1/0:5e3,closeButton:!0}),e&&K.error(`Some files failed to upload`,{duration:1e5,closeButton:!0}),t}}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}},MK=`insertSalaryRecordsFromFile`,NK=()=>{let[{fetching:e},t]=p(R);return{fetching:e,uploadPayrollFile:(0,Z.useCallback)(async e=>{let n=`Error uploading payroll file to charge ID [${e.chargeId}]`,r=`${MK}-${e.chargeId}`;K.loading(`Uploading payroll file`,{id:r});try{let i=Xe(await t(e),n,r,`insertSalaryRecordsFromFile`);if(i)return K.success(`Success`,{id:r,description:`Payroll file added`}),i.insertSalaryRecordsFromFile}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}return!1},[t])}},PK=({chargeId:e,onDone:t})=>{let{fetching:n,uploadPayrollFile:r}=NK(),[i,a]=(0,Z.useState)(null),o=(0,Z.useCallback)(async()=>{i&&r({file:i,chargeId:e}).then(t)},[r,t,i,e]);return(0,Q.jsxs)(`div`,{className:`px-5 w-max h-max justify-items-center`,children:[(0,Q.jsx)(zC,{icon:n&&(0,Q.jsx)(hi,{}),value:i,onChange:a,clearable:!0,label:`File Upload`}),(0,Q.jsx)(`div`,{className:`flex justify-center gap-5 mt-5`,children:(0,Q.jsx)(`button`,{type:`submit`,className:` text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg`,disabled:n||!i,onClick:o,children:`Accept`})})]})};function FK({children:e,content:t,disabled:n,asChild:r=!1,...i}){return n?e:(0,Q.jsx)(fr,{children:(0,Q.jsxs)(rr,{children:[(0,Q.jsx)(yr,{asChild:r,children:e}),(0,Q.jsx)(or,{...i,children:t})]})})}function IK({src:e,width:t,height:n,magnifierHeight:r=100,magnifierWidth:i=100,zoomLevel:a=1.5}){let[o,s]=(0,Z.useState)({x:0,y:0}),[c,l]=(0,Z.useState)({height:0,width:0}),[u,d]=(0,Z.useState)(a),[f,p]=(0,Z.useState)({width:i,height:r}),[m,h]=(0,Z.useState)(!1);return(0,Q.jsxs)(`div`,{style:{position:`relative`,height:n,width:t},children:[(0,Q.jsx)(`img`,{src:e,style:{height:n,width:t},onMouseEnter:e=>{let{width:t,height:n}=e.currentTarget.getBoundingClientRect();l({width:t,height:n}),h(!0)},onMouseMove:e=>{let{top:t,left:n}=e.currentTarget.getBoundingClientRect(),r=e.pageX-n-window.pageXOffset,i=e.pageY-t-window.pageYOffset;s({x:r,y:i})},onMouseLeave:()=>{h(!1)},alt:`img`}),(0,Q.jsx)(`div`,{style:{display:m?``:`none`,position:`absolute`,pointerEvents:`none`,height:`${f.height}px`,width:`${f.width}px`,top:`${o.y-f.height/2}px`,left:`${o.x-f.width/2}px`,opacity:`1`,border:`1px solid lightgray`,backgroundColor:`white`,backgroundImage:`url('${e}')`,backgroundRepeat:`no-repeat`,backgroundSize:`${c.width*u}px ${c.height*u}px`,backgroundPositionX:`${-o.x*u+f.width/2}px`,backgroundPositionY:`${-o.y*u+f.height/2}px`}}),(0,Q.jsxs)(`div`,{className:`absolute top-10 right-10 flex flex-row gap-1`,children:[(0,Q.jsx)(FK,{content:`Increase zoom`,asChild:!0,children:(0,Q.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7.5`,onClick:e=>{e.stopPropagation(),d(e=>e*1.2)},children:(0,Q.jsx)(Ta,{className:`size-5`})})}),(0,Q.jsx)(FK,{content:`Decrease zoom`,asChild:!0,children:(0,Q.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7.5`,onClick:e=>{e.stopPropagation(),d(e=>e/1.2)},children:(0,Q.jsx)(Ea,{className:`size-5`})})}),(0,Q.jsx)(FK,{content:`Expand zoom area`,asChild:!0,children:(0,Q.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7.5`,onClick:e=>{e.stopPropagation(),p(e=>({width:e.width*1.2,height:e.height*1.2}))},children:(0,Q.jsx)(Ta,{className:`size-5`})})}),(0,Q.jsx)(FK,{content:`Reduce zoom area`,asChild:!0,children:(0,Q.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7.5`,onClick:e=>{e.stopPropagation(),p(e=>({width:e.width/1.2,height:e.height/1.2}))},children:(0,Q.jsx)(Ea,{className:`size-5`})})})]})]})}function LK({formManager:e,chargeSpreadPath:t}){let{control:n,watch:r,trigger:i}=e,{fields:a,append:o,remove:s}=_r({control:n,name:t}),c=r(t),l=a.map((e,t)=>({...e,...c[t]}));return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`span`,{className:`mantine-InputWrapper-label mantine-Select-label`,children:`Charge Spread`}),(0,Q.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden`,children:[l?.map((e,r)=>(0,Q.jsxs)(`div`,{className:`flex items-end gap-2 text-gray-600 mb-2`,children:[(0,Q.jsx)(`div`,{className:`w-full mt-1 relative rounded-md shadow-xs`,children:(0,Q.jsx)(kr,{name:`${t}.${r}.year`,control:n,rules:{required:`Required`,validate:e=>c.map(e=>e.year).filter(t=>t===e).length>1?`Years must be unique`:!0},render:({field:{value:e,...n},fieldState:r})=>(0,Q.jsx)(PG,{...n,label:`Year of relevance`,value:e?new Date(e):null,error:r.error?.message,popoverProps:{withinPortal:!0,zIndex:1002},required:!0,onChange:e=>{i(t),n.onChange(e?dr(e,`yyyy-MM-dd`):void 0)}})})}),(0,Q.jsx)(`div`,{className:`w-full mt-1 relative rounded-md shadow-xs`,children:(0,Q.jsx)(kr,{control:n,name:`${t}.${r}.amount`,render:({field:e,fieldState:t})=>(0,Q.jsx)(yk,{className:`w-full`,...e,min:0,label:`Amount`,value:e.value??void 0,hideControls:!0,precision:2,error:t.error?.message,onChange:t=>e.onChange(t&&typeof t==`number`?t:void 0)})})}),(0,Q.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7.5 mb-2`,onClick:()=>{s(r),i(t)},children:(0,Q.jsx)(Wn,{className:`size-5`})})]},e.id)),(0,Q.jsx)(q,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7.5`,onClick:()=>{o({year:`${new Date().getFullYear()}-01-01`}),i(t)},children:(0,Q.jsx)(ea,{className:`size-5`})})]})]})}function RK(e){let[t,n]=Z.useState(!1);return Z.useEffect(()=>{function t(e){n(e.matches)}let r=matchMedia(e);return r.addEventListener(`change`,t),n(r.matches),()=>r.removeEventListener(`change`,t)},[e]),t}var zK=1,BK=.9,VK=.8,HK=.17,UK=.1,WK=.999,GK=.9999,KK=.99,qK=/[\\\/_+.#"@\[\(\{&]/,JK=/[\\\/_+.#"@\[\(\{&]/g,YK=/[\s-]/,XK=/[\s-]/g;function ZK(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?zK:KK;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=ZK(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=zK:qK.test(e.charAt(l-1))?(d*=VK,p=e.slice(i,l-1).match(JK),p&&i>0&&(d*=WK**+p.length)):YK.test(e.charAt(l-1))?(d*=BK,m=e.slice(i,l-1).match(XK),m&&i>0&&(d*=WK**+m.length)):(d*=HK,i>0&&(d*=WK**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=GK)),(d<UK&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=ZK(e,t,n,r,l+1,a+2,o),f*UK>d&&(d=f*UK)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function QK(e){return e.toLowerCase().replace(XK,` `)}function $K(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,ZK(e,t,QK(e),QK(t),0,0,{})}typeof window<`u`&&window.document&&window.document.createElement;function eq(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function tq(e,t=[]){let n=[];function r(t,r){let i=Z.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=Z.useMemo(()=>o,Object.values(o));return(0,Q.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=Z.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>Z.createContext(e));return function(n){let r=n?.[e]||t;return Z.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,nq(i,...t)]}function nq(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return Z.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var rq=`DismissableLayer`,iq=`dismissableLayer.update`,aq=`dismissableLayer.pointerDownOutside`,oq=`dismissableLayer.focusOutside`,sq,cq=Z.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),lq=Z.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=Z.useContext(cq),[d,f]=Z.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=Z.useState({}),h=Yn(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(_),y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=Z.useRef(!1),C=pq(e=>{let t=e.target;if(!(t instanceof Node))return;let n=[...u.branches].some(e=>e.contains(t));!x||n||(a?.(e),s?.(e),e.defaultPrevented||c?.())},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces}),w=mq(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=ka(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return Z.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T]),Z.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(sq=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),hq(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=sq))}},[d,p,n,u]),Z.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),hq())},[d,u]),Z.useEffect(()=>{let e=()=>m({});return document.addEventListener(iq,e),()=>document.removeEventListener(iq,e)},[]),(0,Q.jsx)(hn.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:eq(e.onFocusCapture,w.onFocusCapture),onBlurCapture:eq(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:eq(e.onPointerDownCapture,C.onPointerDownCapture)})});lq.displayName=rq;var uq=`DismissableLayerBranch`,dq=Z.forwardRef((e,t)=>{let n=Z.useContext(cq),r=Z.useRef(null),i=Yn(t,r);return Z.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,Q.jsx)(hn.div,{...e,ref:i})});dq.displayName=uq;function fq(){let e=Z.useContext(cq),[t,n]=Z.useState(null);return Z.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function pq(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a}=t,o=Gt(e),s=Z.useRef(!1),c=Z.useRef(!1),l=Z.useRef(new Map),u=Z.useRef(()=>{});return Z.useEffect(()=>{function e(){c.current=!1,i.current=!1,l.current.clear()}function t(){return Array.from(l.current.values()).some(Boolean)}function d(e){if(!c.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||l.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{c.current&&u.current()},0)}function f(e){c.current&&l.current.set(e.type,!1)}let p=a=>{if(a.target&&!s.current){let s=function(){n.removeEventListener(`click`,u.current);let r=t();e(),r||gq(aq,o,d,{discrete:!0})},d={originalEvent:a};c.current=!0,i.current=r&&a.button===0,l.current.clear(),!r||a.button!==0?s():(n.removeEventListener(`click`,u.current),u.current=s,n.addEventListener(`click`,u.current,{once:!0}))}else n.removeEventListener(`click`,u.current),e();s.current=!1},m=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of m)n.addEventListener(e,d,!0),n.addEventListener(e,f);let h=window.setTimeout(()=>{n.addEventListener(`pointerdown`,p)},0);return()=>{window.clearTimeout(h),n.removeEventListener(`pointerdown`,p),n.removeEventListener(`click`,u.current);for(let e of m)n.removeEventListener(e,d,!0),n.removeEventListener(e,f)}},[n,o,r,i,a]),{onPointerDownCapture:()=>s.current=!0}}function mq(e,t=globalThis?.document){let n=Gt(e),r=Z.useRef(!1);return Z.useEffect(()=>{let e=e=>{e.target&&!r.current&&gq(oq,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function hq(){let e=new CustomEvent(iq);document.dispatchEvent(e)}function gq(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?xn(i,a):i.dispatchEvent(a)}var _q=`focusScope.autoFocusOnMount`,vq=`focusScope.autoFocusOnUnmount`,yq={bubbles:!1,cancelable:!0},bq=`FocusScope`,xq=Z.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=Z.useState(null),l=Gt(i),u=Gt(a),d=Z.useRef(null),f=Yn(t,c),p=Z.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Z.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Oq(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Oq(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Oq(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),Z.useEffect(()=>{if(s){kq.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(_q,yq);s.addEventListener(_q,l),s.dispatchEvent(t),t.defaultPrevented||(Sq(Mq(wq(s)),{select:!0}),document.activeElement===e&&Oq(s))}return()=>{s.removeEventListener(_q,l),setTimeout(()=>{let t=new CustomEvent(vq,yq);s.addEventListener(vq,u),s.dispatchEvent(t),t.defaultPrevented||Oq(e??document.body,{select:!0}),s.removeEventListener(vq,u),kq.remove(p)},0)}}},[s,l,u,p]);let m=Z.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Cq(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Oq(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Oq(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,Q.jsx)(hn.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});xq.displayName=bq;function Sq(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Oq(r,{select:t}),document.activeElement!==n)return}function Cq(e){let t=wq(e);return[Tq(t,e),Tq(t.reverse(),e)]}function wq(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Tq(e,t){for(let n of e)if(!Eq(n,{upTo:t}))return n}function Eq(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Dq(e){return e instanceof HTMLInputElement&&`select`in e}function Oq(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Dq(e)&&t&&e.select()}}var kq=Aq();function Aq(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=jq(e,t),e.unshift(t)},remove(t){e=jq(e,t),e[0]?.resume()}}}function jq(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Mq(e){return e.filter(e=>e.tagName!==`A`)}function Nq(e,t){return Z.useReducer((e,n)=>t[e][n]??e,e)}var Pq=e=>{let{present:t,children:n}=e,r=Fq(t),i=typeof n==`function`?n({present:r.isPresent}):Z.Children.only(n),a=Lq(r.ref,zq(i));return typeof n==`function`||r.isPresent?Z.cloneElement(i,{ref:a}):null};Pq.displayName=`Presence`;function Fq(e){let[t,n]=Z.useState(),r=Z.useRef(null),i=Z.useRef(e),a=Z.useRef(`none`),[o,s]=Nq(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return Z.useEffect(()=>{let e=Rq(r.current);a.current=o===`mounted`?e:`none`},[o]),Cn(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Rq(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Cn(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Rq(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Rq(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:Z.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Iq(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Lq(...e){let t=Z.useRef(e);return t.current=e,Z.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Iq(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():Iq(n[e],null)}}},[])}function Rq(e){return e?.animationName||`none`}function zq(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Bq=`Dialog`,[Vq,Nte]=tq(Bq),[Hq,Uq]=Vq(Bq),Wq=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=Z.useRef(null),c=Z.useRef(null),[l,u]=Qt({prop:r,defaultProp:i??!1,onChange:a,caller:Bq});return(0,Q.jsx)(Hq,{scope:t,triggerRef:s,contentRef:c,contentId:Rt(),titleId:Rt(),descriptionId:Rt(),open:l,onOpenChange:u,onOpenToggle:Z.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};Wq.displayName=Bq;var Gq=`DialogTrigger`,Kq=Z.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Uq(Gq,n),a=Yn(t,i.triggerRef);return(0,Q.jsx)(hn.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":fJ(i.open),...r,ref:a,onClick:eq(e.onClick,i.onOpenToggle)})});Kq.displayName=Gq;var qq=`DialogPortal`,[Jq,Yq]=Vq(qq,{forceMount:void 0}),Xq=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Uq(qq,t);return(0,Q.jsx)(Jq,{scope:t,forceMount:n,children:Z.Children.map(r,e=>(0,Q.jsx)(Pq,{present:n||a.open,children:(0,Q.jsx)(Mt,{asChild:!0,container:i,children:e})}))})};Xq.displayName=qq;var Zq=`DialogOverlay`,Qq=Z.forwardRef((e,t)=>{let n=Yq(Zq,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Uq(Zq,e.__scopeDialog);return a.modal?(0,Q.jsx)(Pq,{present:r||a.open,children:(0,Q.jsx)(eJ,{...i,ref:t})}):null});Qq.displayName=Zq;var $q=Kn(`DialogOverlay.RemoveScroll`),eJ=Z.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Uq(Zq,n),a=Yn(t,fq());return(0,Q.jsx)(Ct,{as:$q,allowPinchZoom:!0,shards:[i.contentRef],children:(0,Q.jsx)(hn.div,{"data-state":fJ(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})}),tJ=`DialogContent`,nJ=Z.forwardRef((e,t)=>{let n=Yq(tJ,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Uq(tJ,e.__scopeDialog);return(0,Q.jsx)(Pq,{present:r||a.open,children:a.modal?(0,Q.jsx)(rJ,{...i,ref:t}):(0,Q.jsx)(iJ,{...i,ref:t})})});nJ.displayName=tJ;var rJ=Z.forwardRef((e,t)=>{let n=Uq(tJ,e.__scopeDialog),r=Z.useRef(null),i=Yn(t,n.contentRef,r);return Z.useEffect(()=>{let e=r.current;if(e)return Dn(e)},[]),(0,Q.jsx)(aJ,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:eq(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:eq(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:eq(e.onFocusOutside,e=>e.preventDefault())})}),iJ=Z.forwardRef((e,t)=>{let n=Uq(tJ,e.__scopeDialog),r=Z.useRef(!1),i=Z.useRef(!1);return(0,Q.jsx)(aJ,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),aJ=Z.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Uq(tJ,n);return Ot(),(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsx)(xq,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,Q.jsx)(lq,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":fJ(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),oJ=`DialogTitle`,sJ=Z.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Uq(oJ,n);return(0,Q.jsx)(hn.h2,{id:i.titleId,...r,ref:t})});sJ.displayName=oJ;var cJ=`DialogDescription`,lJ=Z.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Uq(cJ,n);return(0,Q.jsx)(hn.p,{id:i.descriptionId,...r,ref:t})});lJ.displayName=cJ;var uJ=`DialogClose`,dJ=Z.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Uq(uJ,n);return(0,Q.jsx)(hn.button,{type:`button`,...r,ref:t,onClick:eq(e.onClick,()=>i.onOpenChange(!1))})});dJ.displayName=uJ;function fJ(e){return e?`open`:`closed`}var pJ=`[cmdk-group=""]`,mJ=`[cmdk-group-items=""]`,hJ=`[cmdk-group-heading=""]`,gJ=`[cmdk-item=""]`,_J=`${gJ}:not([aria-disabled="true"])`,vJ=`cmdk-item-select`,yJ=`data-value`,bJ=(e,t,n)=>$K(e,t,n),xJ=Z.createContext(void 0),SJ=()=>Z.useContext(xJ),CJ=Z.createContext(void 0),wJ=()=>Z.useContext(CJ),TJ=Z.createContext(void 0),EJ=Z.forwardRef((e,t)=>{let n=BJ(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=BJ(()=>new Set),i=BJ(()=>new Map),a=BJ(()=>new Map),o=BJ(()=>new Set),s=RJ(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=Rt(),y=Rt(),b=Rt(),x=Z.useRef(null),S=UJ();zJ(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),zJ(()=>{S(6,k)},[]);let C=Z.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=Z.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??bJ;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(mJ);t?t.appendChild(e.parentElement===t?e:e.closest(`${mJ} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${mJ} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${pJ}[${yJ}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(yJ);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(pJ)?.querySelector(hJ))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${gJ}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(_J)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(yJ))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(yJ))}function P(e){let t=A()?.closest(pJ),n;for(;t&&!n;)t=e>0?IJ(t,pJ):LJ(t,pJ),n=t?.querySelector(_J);n?C.setState(`value`,n.getAttribute(yJ)):N(e)}let F=()=>M(j().length-1),I=e=>{e.preventDefault(),e.metaKey?F():e.altKey?P(1):N(1)},L=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return Z.createElement(hn.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&I(e);break;case`ArrowDown`:I(e);break;case`p`:case`k`:g&&e.ctrlKey&&L(e);break;case`ArrowUp`:L(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),F();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(vJ);t.dispatchEvent(e)}}}}},Z.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:KJ},c),GJ(e,e=>Z.createElement(CJ.Provider,{value:C},Z.createElement(xJ.Provider,{value:w},e))))}),DJ=Z.forwardRef((e,t)=>{let n=Rt(),r=Z.useRef(null),i=Z.useContext(TJ),a=SJ(),o=RJ(e),s=o.current?.forceMount??i?.forceMount;zJ(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=HJ(n,r,[e.value,e.children,r],e.keywords),l=wJ(),u=VJ(e=>e.value&&e.value===c.current),d=VJ(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);Z.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(vJ,f),()=>t.removeEventListener(vJ,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return Z.createElement(hn.div,{ref:Jn(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),OJ=Z.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Rt(),s=Z.useRef(null),c=Z.useRef(null),l=Rt(),u=SJ(),d=VJ(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));zJ(()=>u.group(o),[]),HJ(o,s,[e.value,e.heading,c]);let f=Z.useMemo(()=>({id:o,forceMount:i}),[i]);return Z.createElement(hn.div,{ref:Jn(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&Z.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),GJ(e,e=>Z.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},Z.createElement(TJ.Provider,{value:f},e))))}),kJ=Z.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=Z.useRef(null),a=VJ(e=>!e.search);return!n&&!a?null:Z.createElement(hn.div,{ref:Jn(i,t),...r,"cmdk-separator":``,role:`separator`})}),AJ=Z.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=wJ(),o=VJ(e=>e.search),s=VJ(e=>e.selectedItemId),c=SJ();return Z.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),Z.createElement(hn.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),jJ=Z.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=Z.useRef(null),o=Z.useRef(null),s=VJ(e=>e.selectedItemId),c=SJ();return Z.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),Z.createElement(hn.div,{ref:Jn(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},GJ(e,e=>Z.createElement(`div`,{ref:Jn(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),MJ=Z.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return Z.createElement(Wq,{open:n,onOpenChange:r},Z.createElement(Xq,{container:o},Z.createElement(Qq,{"cmdk-overlay":``,className:i}),Z.createElement(nJ,{"aria-label":e.label,"cmdk-dialog":``,className:a},Z.createElement(EJ,{ref:t,...s}))))}),NJ=Z.forwardRef((e,t)=>VJ(e=>e.filtered.count===0)?Z.createElement(hn.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),PJ=Z.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return Z.createElement(hn.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},GJ(e,e=>Z.createElement(`div`,{"aria-hidden":!0},e)))}),FJ=Object.assign(EJ,{List:jJ,Item:DJ,Input:AJ,Group:OJ,Separator:kJ,Dialog:MJ,Empty:NJ,Loading:PJ});function IJ(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function LJ(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function RJ(e){let t=Z.useRef(e);return zJ(()=>{t.current=e}),t}var zJ=typeof window>`u`?Z.useEffect:Z.useLayoutEffect;function BJ(e){let t=Z.useRef();return t.current===void 0&&(t.current=e()),t}function VJ(e){let t=wJ(),n=()=>e(t.snapshot());return Z.useSyncExternalStore(t.subscribe,n,n)}function HJ(e,t,n,r=[]){let i=Z.useRef(),a=SJ();return zJ(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(yJ,s),i.current=s}),i}var UJ=()=>{let[e,t]=Z.useState(),n=BJ(()=>new Map);return zJ(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function WJ(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function GJ({asChild:e,children:t},n){return e&&Z.isValidElement(t)?Z.cloneElement(WJ(t),{ref:t.ref},n(t.props.children)):n(t)}var KJ={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function qJ({className:e,...t}){return(0,Q.jsx)(FJ,{"data-slot":`command`,className:s(`bg-white text-gray-950 flex h-full w-full flex-col overflow-hidden rounded-md dark:bg-gray-950 dark:text-gray-50`,e),...t})}function JJ({className:e,...t}){return(0,Q.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,Q.jsx)(An,{className:`size-4 shrink-0 opacity-50`}),(0,Q.jsx)(FJ.Input,{"data-slot":`command-input`,className:s(`placeholder:text-gray-500 flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50 dark:placeholder:text-gray-400`,e),...t})]})}function YJ({className:e,...t}){return(0,Q.jsx)(FJ.List,{"data-slot":`command-list`,className:s(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...t})}function XJ({...e}){return(0,Q.jsx)(FJ.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function ZJ({className:e,...t}){return(0,Q.jsx)(FJ.Group,{"data-slot":`command-group`,className:s(`text-gray-950 [&_[cmdk-group-heading]]:text-gray-500 overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium dark:text-gray-50 dark:[&_[cmdk-group-heading]]:text-gray-400`,e),...t})}function QJ({className:e,...t}){return(0,Q.jsx)(FJ.Separator,{"data-slot":`command-separator`,className:s(`bg-gray-200 -mx-1 h-px dark:bg-gray-800`,e),...t})}function $J({className:e,...t}){return(0,Q.jsx)(FJ.Item,{"data-slot":`command-item`,className:s(`data-[selected=true]:bg-gray-100 data-[selected=true]:text-gray-900 [&_svg:not([class*='text-'])]:text-gray-500 relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 dark:data-[selected=true]:bg-gray-800 dark:data-[selected=true]:text-gray-50 dark:[&_svg:not([class*='text-'])]:text-gray-400`,e),...t})}function eY(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var tY=Z.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:`bottom`,shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),nY=()=>{let e=Z.useContext(tY);if(!e)throw Error(`useDrawerContext must be used within a Drawer.Root`);return e};eY(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
[data-state=closed]
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function rY(){let e=navigator.userAgent;return typeof window<`u`&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function iY(){return lY(/^Mac/)}function aY(){return lY(/^iPhone/)}function oY(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function sY(){return lY(/^iPad/)||iY()&&navigator.maxTouchPoints>1}function cY(){return aY()||sY()}function lY(e){return typeof window<`u`&&window.navigator!=null?e.test(window.navigator.platform):void 0}var uY=24,dY=typeof window<`u`?Z.useLayoutEffect:Z.useEffect;function fY(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}var pY=typeof document<`u`&&window.visualViewport;function mY(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function hY(e){for(mY(e)&&(e=e.parentElement);e&&!mY(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}var gY=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]),_Y=0,vY;function yY(e={}){let{isDisabled:t}=e;dY(()=>{if(!t)return _Y++,_Y===1&&cY()&&(vY=bY()),()=>{_Y--,_Y===0&&vY?.()}},[t])}function bY(){let e,t=0,n=n=>{e=hY(n.target),!(e===document.documentElement&&e===document.body)&&(t=n.changedTouches[0].pageY)},r=n=>{if(!e||e===document.documentElement||e===document.body){n.preventDefault();return}let r=n.changedTouches[0].pageY,i=e.scrollTop,a=e.scrollHeight-e.clientHeight;a!==0&&((i<=0&&r>t||i>=a&&r<t)&&n.preventDefault(),t=r)},i=e=>{let t=e.target;wY(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform=`translateY(-2000px)`,t.focus(),requestAnimationFrame(()=>{t.style.transform=``}))},a=e=>{let t=e.target;wY(t)&&(t.style.transform=`translateY(-2000px)`,requestAnimationFrame(()=>{t.style.transform=``,pY&&(pY.height<window.innerHeight?requestAnimationFrame(()=>{CY(t)}):pY.addEventListener(`resize`,()=>CY(t),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},s=window.pageXOffset,c=window.pageYOffset,l=fY(xY(document.documentElement,`paddingRight`,`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let u=fY(SY(document,`touchstart`,n,{passive:!1,capture:!0}),SY(document,`touchmove`,r,{passive:!1,capture:!0}),SY(document,`touchend`,i,{passive:!1,capture:!0}),SY(document,`focus`,a,!0),SY(window,`scroll`,o));return()=>{l(),u(),window.scrollTo(s,c)}}function xY(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function SY(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function CY(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=hY(e);if(t!==document.documentElement&&t!==document.body&&t!==e){let n=t.getBoundingClientRect().top,r=e.getBoundingClientRect().top;e.getBoundingClientRect().bottom>t.getBoundingClientRect().bottom+uY&&(t.scrollTop+=r-n)}e=t.parentElement}}function wY(e){return e instanceof HTMLInputElement&&!gY.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function TY(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}function EY(...e){return t=>e.forEach(e=>TY(e,t))}function DY(...e){return Z.useCallback(EY(...e),e)}var OY=new WeakMap;function kY(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([t,n])=>{if(t.startsWith(`--`)){e.style.setProperty(t,n);return}r[t]=e.style[t],e.style[t]=n}),!n&&OY.set(e,r)}function AY(e,t){if(!e||!(e instanceof HTMLElement))return;let n=OY.get(e);n&&(e.style[t]=n[t])}var jY=e=>{switch(e){case`top`:case`bottom`:return!0;case`left`:case`right`:return!1;default:return e}};function MY(e,t){if(!e)return null;let n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform,i=r.match(/^matrix3d\((.+)\)$/);return i?parseFloat(i[1].split(`, `)[jY(t)?13:12]):(i=r.match(/^matrix\((.+)\)$/),i?parseFloat(i[1].split(`, `)[jY(t)?5:4]):null)}function NY(e){return 8*(Math.log(e+1)-2)}function PY(e,t){if(!e)return()=>{};let n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}var FY={DURATION:.5,EASE:[.32,.72,0,1]},IY=.4,LY=.25,RY=100,zY=8,BY=16,VY=26,HY=`vaul-dragging`;function UY(e){let t=Z.useRef(e);return Z.useEffect(()=>{t.current=e}),Z.useMemo(()=>(...e)=>t.current==null?void 0:t.current.call(t,...e),[])}function WY({defaultProp:e,onChange:t}){let n=Z.useState(e),[r]=n,i=Z.useRef(r),a=UY(t);return Z.useEffect(()=>{i.current!==r&&(a(r),i.current=r)},[r,i,a]),n}function GY({prop:e,defaultProp:t,onChange:n=()=>{}}){let[r,i]=WY({defaultProp:t,onChange:n}),a=e!==void 0,o=a?e:r,s=UY(n);return[o,Z.useCallback(t=>{if(a){let n=typeof t==`function`?t(e):t;n!==e&&s(n)}else i(t)},[a,e,i,s])]}function KY({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:i,fadeFromIndex:a,onSnapPointChange:o,direction:s=`bottom`,container:c,snapToSequentialPoint:l}){let[u,d]=GY({prop:e,defaultProp:n?.[0],onChange:t}),[f,p]=Z.useState(typeof window<`u`?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);Z.useEffect(()=>{function e(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let m=Z.useMemo(()=>u===n?.[n.length-1]||null,[n,u]),h=Z.useMemo(()=>n?.findIndex(e=>e===u)??null,[n,u]),g=n&&n.length>0&&(a||a===0)&&!Number.isNaN(a)&&n[a]===u||!n,_=Z.useMemo(()=>{let e=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<`u`?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};return n?.map(t=>{let n=typeof t==`string`,r=0;if(n&&(r=parseInt(t,10)),jY(s)){let i=n?r:f?t*e.height:0;return f?s===`bottom`?e.height-i:-e.height+i:i}let i=n?r:f?t*e.width:0;return f?s===`right`?e.width-i:-e.width+i:i})??[]},[n,f,c]),v=Z.useMemo(()=>h===null?null:_?.[h],[_,h]),y=Z.useCallback(e=>{let t=_?.findIndex(t=>t===e)??null;o(t),kY(r.current,{transition:`transform ${FY.DURATION}s cubic-bezier(${FY.EASE.join(`,`)})`,transform:jY(s)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),_&&t!==_.length-1&&a!==void 0&&t!==a&&t<a?kY(i.current,{transition:`opacity ${FY.DURATION}s cubic-bezier(${FY.EASE.join(`,`)})`,opacity:`0`}):kY(i.current,{transition:`opacity ${FY.DURATION}s cubic-bezier(${FY.EASE.join(`,`)})`,opacity:`1`}),d(n?.[Math.max(t,0)])},[r.current,n,_,a,i,d]);Z.useEffect(()=>{if(u||e){let t=n?.findIndex(t=>t===e||t===u)??-1;_&&t!==-1&&typeof _[t]==`number`&&y(_[t])}},[u,e,n,_,y]);function b({draggedDistance:e,closeDrawer:t,velocity:r,dismissible:o}){if(a===void 0)return;let c=s===`bottom`||s===`right`?(v??0)-e:(v??0)+e,u=h===a-1,d=h===0,f=e>0;if(u&&kY(i.current,{transition:`opacity ${FY.DURATION}s cubic-bezier(${FY.EASE.join(`,`)})`}),!l&&r>2&&!f){o?t():y(_[0]);return}if(!l&&r>2&&f&&_&&n){y(_[n.length-1]);return}let p=_?.reduce((e,t)=>typeof e!=`number`||typeof t!=`number`?e:Math.abs(t-c)<Math.abs(e-c)?t:e),g=jY(s)?window.innerHeight:window.innerWidth;if(r>IY&&Math.abs(e)<g*.4){let e=f?1:-1;if(e>0&&m&&n){y(_[n.length-1]);return}if(d&&e<0&&o&&t(),h===null)return;y(_[h+e]);return}y(p)}function x({draggedDistance:e}){if(v===null)return;let t=s===`bottom`||s===`right`?v-e:v+e;(s===`bottom`||s===`right`)&&t<_[_.length-1]||(s===`top`||s===`left`)&&t>_[_.length-1]||kY(r.current,{transform:jY(s)?`translate3d(0, ${t}px, 0)`:`translate3d(${t}px, 0, 0)`})}function S(e,t){if(!n||typeof h!=`number`||!_||a===void 0)return null;let r=h===a-1;if(h>=a&&t)return 0;if(r&&!t)return 1;if(!g&&!r)return null;let i=r?h+1:h-1,o=r?_[i]-_[i-1]:_[i+1]-_[i],s=e/Math.abs(o);return r?1-s:s}return{isLastSnapPoint:m,activeSnapPoint:u,shouldFade:g,getPercentageDragged:S,setActiveSnapPoint:d,activeSnapPointIndex:h,onRelease:b,onDrag:x,snapPointsOffset:_}}function qY(){let{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:i}=nY(),a=Z.useRef(null),o=(0,Z.useMemo)(()=>document.body.style.backgroundColor,[]);function s(){return(window.innerWidth-VY)/window.innerWidth}Z.useEffect(()=>{if(t&&n){a.current&&clearTimeout(a.current);let t=document.querySelector(`[data-vaul-drawer-wrapper]`)||document.querySelector(`[vaul-drawer-wrapper]`);if(!t)return;r&&!i&&PY(document.body,{background:`black`}),PY(t,{transformOrigin:jY(e)?`top`:`left`,transitionProperty:`transform, border-radius`,transitionDuration:`${FY.DURATION}s`,transitionTimingFunction:`cubic-bezier(${FY.EASE.join(`,`)})`});let n=PY(t,{borderRadius:`${zY}px`,overflow:`hidden`,...jY(e)?{transform:`scale(${s()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${s()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{n(),a.current=window.setTimeout(()=>{o?document.body.style.background=o:document.body.style.removeProperty(`background`)},FY.DURATION*1e3)}}},[t,n,o])}var JY=null;function YY({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:i,noBodyStyles:a}){let[o,s]=Z.useState(()=>typeof window<`u`?window.location.href:``),c=Z.useRef(0),l=Z.useCallback(()=>{if(oY()&&JY===null&&e&&!a){JY={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:`unset`};let{scrollX:e,innerHeight:t}=window;document.body.style.setProperty(`position`,`fixed`,`important`),Object.assign(document.body.style,{top:`${-c.current}px`,left:`${-e}px`,right:`0px`,height:`auto`}),window.setTimeout(()=>window.requestAnimationFrame(()=>{let e=t-window.innerHeight;e&&c.current>=t&&(document.body.style.top=`${-(c.current+e)}px`)}),300)}},[e]),u=Z.useCallback(()=>{if(oY()&&JY!==null&&!a){let e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,JY),window.requestAnimationFrame(()=>{if(i&&o!==window.location.href){s(window.location.href);return}window.scrollTo(t,e)}),JY=null}},[o]);return Z.useEffect(()=>{function e(){c.current=window.scrollY}return e(),window.addEventListener(`scroll`,e),()=>{window.removeEventListener(`scroll`,e)}},[]),Z.useEffect(()=>{if(t)return()=>{typeof document>`u`||document.querySelector(`[data-vaul-drawer]`)||u()}},[t,u]),Z.useEffect(()=>{n||!r||(e?(!window.matchMedia(`(display-mode: standalone)`).matches&&l(),t||window.setTimeout(()=>{u()},500)):u())},[e,r,o,t,n,l,u]),{restorePositionSetting:u}}function XY({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:i,snapPoints:a,shouldScaleBackground:o=!1,setBackgroundColorOnScale:s=!0,closeThreshold:c=LY,scrollLockTimeout:l=RY,dismissible:u=!0,handleOnly:d=!1,fadeFromIndex:f=a&&a.length-1,activeSnapPoint:p,setActiveSnapPoint:m,fixed:h,modal:g=!0,onClose:_,nested:v,noBodyStyles:y=!1,direction:b=`bottom`,defaultOpen:x=!1,disablePreventScroll:S=!0,snapToSequentialPoint:C=!1,preventScrollRestoration:w=!1,repositionInputs:T=!0,onAnimationEnd:E,container:D,autoFocus:O=!1}){let[k=!1,A]=GY({defaultProp:x,prop:e,onChange:e=>{t?.(e),!e&&!v&&he(),setTimeout(()=>{E?.(e)},FY.DURATION*1e3),e&&!g&&typeof window<`u`&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents=`auto`}),e||(document.body.style.pointerEvents=`auto`)}}),[j,M]=Z.useState(!1),[N,P]=Z.useState(!1),[F,I]=Z.useState(!1),L=Z.useRef(null),R=Z.useRef(null),z=Z.useRef(null),B=Z.useRef(null),V=Z.useRef(null),ee=Z.useRef(!1),te=Z.useRef(null),H=Z.useRef(0),ne=Z.useRef(!1),re=Z.useRef(!x),ie=Z.useRef(0),U=Z.useRef(null),ae=Z.useRef(U.current?.getBoundingClientRect().height||0),oe=Z.useRef(U.current?.getBoundingClientRect().width||0),W=Z.useRef(0),{activeSnapPoint:se,activeSnapPointIndex:ce,setActiveSnapPoint:le,onRelease:ue,snapPointsOffset:de,onDrag:fe,shouldFade:pe,getPercentageDragged:me}=KY({snapPoints:a,activeSnapPointProp:p,setActiveSnapPointProp:m,drawerRef:U,fadeFromIndex:f,overlayRef:L,onSnapPointChange:Z.useCallback(e=>{a&&e===de.length-1&&(R.current=new Date)},[]),direction:b,container:D,snapToSequentialPoint:C});yY({isDisabled:!k||N||!g||F||!j||!T||!S});let{restorePositionSetting:he}=YY({isOpen:k,modal:g,nested:v??!1,hasBeenOpened:j,preventScrollRestoration:w,noBodyStyles:y});function ge(){return(window.innerWidth-VY)/window.innerWidth}function _e(e){!u&&!a||U.current&&!U.current.contains(e.target)||(ae.current=U.current?.getBoundingClientRect().height||0,oe.current=U.current?.getBoundingClientRect().width||0,P(!0),z.current=new Date,cY()&&window.addEventListener(`touchend`,()=>ee.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),H.current=jY(b)?e.pageY:e.pageX)}function ve(e,t){let n=e,r=window.getSelection()?.toString(),i=U.current?MY(U.current,b):null,a=new Date;if(n.tagName===`SELECT`||n.hasAttribute(`data-vaul-no-drag`)||n.closest(`[data-vaul-no-drag]`))return!1;if(b===`right`||b===`left`)return!0;if(R.current&&a.getTime()-R.current.getTime()<500)return!1;if(i!==null&&(b===`bottom`?i>0:i<0))return!0;if(r&&r.length>0)return!1;if(V.current&&a.getTime()-V.current.getTime()<l&&i===0||t)return V.current=a,!1;for(;n;){if(n.scrollHeight>n.clientHeight){if(n.scrollTop!==0)return V.current=new Date,!1;if(n.getAttribute(`role`)===`dialog`)return!0}n=n.parentNode}return!0}function ye(e){if(U.current&&N){let t=b===`bottom`||b===`right`?1:-1,n=(H.current-(jY(b)?e.pageY:e.pageX))*t,i=n>0,s=a&&!u&&!i;if(s&&ce===0)return;let c=Math.abs(n),l=document.querySelector(`[data-vaul-drawer-wrapper]`),d=c/(b===`bottom`||b===`top`?ae.current:oe.current),p=me(c,i);if(p!==null&&(d=p),s&&d>=1||!ee.current&&!ve(e.target,i))return;if(U.current.classList.add(HY),ee.current=!0,kY(U.current,{transition:`none`}),kY(L.current,{transition:`none`}),a&&fe({draggedDistance:n}),i&&!a){let e=NY(n),r=Math.min(e*-1,0)*t;kY(U.current,{transform:jY(b)?`translate3d(0, ${r}px, 0)`:`translate3d(${r}px, 0, 0)`});return}let m=1-d;if((pe||f&&ce===f-1)&&(r?.(e,d),kY(L.current,{opacity:`${m}`,transition:`none`},!0)),l&&L.current&&o){let e=Math.min(ge()+d*(1-ge()),1),t=8-d*8,n=Math.max(0,14-d*14);kY(l,{borderRadius:`${t}px`,transform:jY(b)?`scale(${e}) translate3d(0, ${n}px, 0)`:`scale(${e}) translate3d(${n}px, 0, 0)`,transition:`none`},!0)}if(!a){let e=c*t;kY(U.current,{transform:jY(b)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})}}}Z.useEffect(()=>{window.requestAnimationFrame(()=>{re.current=!0})},[]),Z.useEffect(()=>{var e;function t(){if(!U.current||!T)return;let e=document.activeElement;if(wY(e)||ne.current){let e=window.visualViewport?.height||0,t=window.innerHeight,n=t-e,r=U.current.getBoundingClientRect().height||0,i=r>t*.8;W.current||=r;let o=U.current.getBoundingClientRect().top;if(Math.abs(ie.current-n)>60&&(ne.current=!ne.current),a&&a.length>0&&de&&ce){let e=de[ce]||0;n+=e}if(ie.current=n,r>e||ne.current){let t=U.current.getBoundingClientRect().height,r=t;t>e&&(r=e-(i?o:VY)),h?U.current.style.height=`${t-Math.max(n,0)}px`:U.current.style.height=`${Math.max(r,e-o)}px`}else rY()||(U.current.style.height=`${W.current}px`);a&&a.length>0&&!ne.current?U.current.style.bottom=`0px`:U.current.style.bottom=`${Math.max(n,0)}px`}}return(e=window.visualViewport)==null||e.addEventListener(`resize`,t),()=>window.visualViewport?.removeEventListener(`resize`,t)},[ce,a,de]);function be(e){Se(),_?.(),e||A(!1),setTimeout(()=>{a&&le(a[0])},FY.DURATION*1e3)}function xe(){if(!U.current)return;let e=document.querySelector(`[data-vaul-drawer-wrapper]`),t=MY(U.current,b);kY(U.current,{transform:`translate3d(0, 0, 0)`,transition:`transform ${FY.DURATION}s cubic-bezier(${FY.EASE.join(`,`)})`}),kY(L.current,{transition:`opacity ${FY.DURATION}s cubic-bezier(${FY.EASE.join(`,`)})`,opacity:`1`}),o&&t&&t>0&&k&&kY(e,{borderRadius:`${zY}px`,overflow:`hidden`,...jY(b)?{transform:`scale(${ge()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:`top`}:{transform:`scale(${ge()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:`left`},transitionProperty:`transform, border-radius`,transitionDuration:`${FY.DURATION}s`,transitionTimingFunction:`cubic-bezier(${FY.EASE.join(`,`)})`},!0)}function Se(){!N||!U.current||(U.current.classList.remove(HY),ee.current=!1,P(!1),B.current=new Date)}function Ce(e){if(!N||!U.current)return;U.current.classList.remove(HY),ee.current=!1,P(!1),B.current=new Date;let t=MY(U.current,b);if(!e||!ve(e.target,!1)||!t||Number.isNaN(t)||z.current===null)return;let n=B.current.getTime()-z.current.getTime(),r=H.current-(jY(b)?e.pageY:e.pageX),o=Math.abs(r)/n;if(o>.05&&(I(!0),setTimeout(()=>{I(!1)},200)),a){ue({draggedDistance:r*(b===`bottom`||b===`right`?1:-1),closeDrawer:be,velocity:o,dismissible:u}),i?.(e,!0);return}if(b===`bottom`||b===`right`?r>0:r<0){xe(),i?.(e,!0);return}if(o>IY){be(),i?.(e,!1);return}let s=Math.min(U.current.getBoundingClientRect().height??0,window.innerHeight),l=Math.min(U.current.getBoundingClientRect().width??0,window.innerWidth);if(Math.abs(t)>=(b===`left`||b===`right`?l:s)*c){be(),i?.(e,!1);return}i?.(e,!0),xe()}Z.useEffect(()=>(k&&(kY(document.documentElement,{scrollBehavior:`auto`}),R.current=new Date),()=>{AY(document.documentElement,`scrollBehavior`)}),[k]);function we(e){let t=e?(window.innerWidth-BY)/window.innerWidth:1,n=e?-16:0;te.current&&window.clearTimeout(te.current),kY(U.current,{transition:`transform ${FY.DURATION}s cubic-bezier(${FY.EASE.join(`,`)})`,transform:jY(b)?`scale(${t}) translate3d(0, ${n}px, 0)`:`scale(${t}) translate3d(${n}px, 0, 0)`}),!e&&U.current&&(te.current=setTimeout(()=>{let e=MY(U.current,b);kY(U.current,{transition:`none`,transform:jY(b)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))}function Te(e,t){if(t<0)return;let n=(window.innerWidth-BY)/window.innerWidth,r=n+t*(1-n),i=-16+t*BY;kY(U.current,{transform:jY(b)?`scale(${r}) translate3d(0, ${i}px, 0)`:`scale(${r}) translate3d(${i}px, 0, 0)`,transition:`none`})}function Ee(e,t){let n=jY(b)?window.innerHeight:window.innerWidth,r=t?(n-BY)/n:1,i=t?-16:0;t&&kY(U.current,{transition:`transform ${FY.DURATION}s cubic-bezier(${FY.EASE.join(`,`)})`,transform:jY(b)?`scale(${r}) translate3d(0, ${i}px, 0)`:`scale(${r}) translate3d(${i}px, 0, 0)`})}return Z.useEffect(()=>{g||window.requestAnimationFrame(()=>{document.body.style.pointerEvents=`auto`})},[g]),Z.createElement(Wq,{defaultOpen:x,onOpenChange:e=>{!u&&!e||(e?M(!0):be(!0),A(e))},open:k},Z.createElement(tY.Provider,{value:{activeSnapPoint:se,snapPoints:a,setActiveSnapPoint:le,drawerRef:U,overlayRef:L,onOpenChange:t,onPress:_e,onRelease:Ce,onDrag:ye,dismissible:u,shouldAnimate:re,handleOnly:d,isOpen:k,isDragging:N,shouldFade:pe,closeDrawer:be,onNestedDrag:Te,onNestedOpenChange:we,onNestedRelease:Ee,keyboardIsOpen:ne,modal:g,snapPointsOffset:de,activeSnapPointIndex:ce,direction:b,shouldScaleBackground:o,setBackgroundColorOnScale:s,noBodyStyles:y,container:D,autoFocus:O}},n))}var ZY=Z.forwardRef(function({...e},t){let{overlayRef:n,snapPoints:r,onRelease:i,shouldFade:a,isOpen:o,modal:s,shouldAnimate:c}=nY(),l=DY(t,n),u=r&&r.length>0;if(!s)return null;let d=Z.useCallback(e=>i(e),[i]);return Z.createElement(Qq,{onMouseUp:d,ref:l,"data-vaul-overlay":``,"data-vaul-snap-points":o&&u?`true`:`false`,"data-vaul-snap-points-overlay":o&&a?`true`:`false`,"data-vaul-animate":c?.current?`true`:`false`,...e})});ZY.displayName=`Drawer.Overlay`;var QY=Z.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},i){let{drawerRef:a,onPress:o,onRelease:s,onDrag:c,keyboardIsOpen:l,snapPointsOffset:u,activeSnapPointIndex:d,modal:f,isOpen:p,direction:m,snapPoints:h,container:g,handleOnly:_,shouldAnimate:v,autoFocus:y}=nY(),[b,x]=Z.useState(!1),S=DY(i,a),C=Z.useRef(null),w=Z.useRef(null),T=Z.useRef(!1),E=h&&h.length>0;qY();let D=(e,t,n=0)=>{if(T.current)return!0;let r=Math.abs(e.y),i=Math.abs(e.x),a=i>r,o=[`bottom`,`right`].includes(t)?1:-1;if(t===`left`||t===`right`){if(!(e.x*o<0)&&i>=0&&i<=n)return a}else if(!(e.y*o<0)&&r>=0&&r<=n)return!a;return T.current=!0,!0};Z.useEffect(()=>{E&&window.requestAnimationFrame(()=>{x(!0)})},[]);function O(e){C.current=null,T.current=!1,s(e)}return Z.createElement(nJ,{"data-vaul-drawer-direction":m,"data-vaul-drawer":``,"data-vaul-delayed-snap-points":b?`true`:`false`,"data-vaul-snap-points":p&&E?`true`:`false`,"data-vaul-custom-container":g?`true`:`false`,"data-vaul-animate":v?.current?`true`:`false`,...r,ref:S,style:u&&u.length>0?{"--snap-point-height":`${u[d??0]}px`,...t}:t,onPointerDown:e=>{_||(r.onPointerDown==null||r.onPointerDown.call(r,e),C.current={x:e.pageX,y:e.pageY},o(e))},onOpenAutoFocus:e=>{n?.(e),y||e.preventDefault()},onPointerDownOutside:t=>{if(e?.(t),!f||t.defaultPrevented){t.preventDefault();return}l.current&&=!1},onFocusOutside:e=>{if(!f){e.preventDefault();return}},onPointerMove:e=>{if(w.current=e,_||(r.onPointerMove==null||r.onPointerMove.call(r,e),!C.current))return;let t=e.pageY-C.current.y,n=e.pageX-C.current.x,i=e.pointerType===`touch`?10:2;D({x:n,y:t},m,i)?c(e):(Math.abs(n)>i||Math.abs(t)>i)&&(C.current=null)},onPointerUp:e=>{r.onPointerUp==null||r.onPointerUp.call(r,e),C.current=null,T.current=!1,s(e)},onPointerOut:e=>{r.onPointerOut==null||r.onPointerOut.call(r,e),O(w.current)},onContextMenu:e=>{r.onContextMenu==null||r.onContextMenu.call(r,e),w.current&&O(w.current)}})});QY.displayName=`Drawer.Content`;var $Y=250,eX=120,tX=Z.forwardRef(function({preventCycle:e=!1,children:t,...n},r){let{closeDrawer:i,isDragging:a,snapPoints:o,activeSnapPoint:s,setActiveSnapPoint:c,dismissible:l,handleOnly:u,isOpen:d,onPress:f,onDrag:p}=nY(),m=Z.useRef(null),h=Z.useRef(!1);function g(){if(h.current){y();return}window.setTimeout(()=>{_()},eX)}function _(){if(a||e||h.current){y();return}if(y(),!o||o.length===0){l||i();return}if(s===o[o.length-1]&&l){i();return}let t=o.findIndex(e=>e===s);if(t===-1)return;let n=o[t+1];c(n)}function v(){m.current=window.setTimeout(()=>{h.current=!0},$Y)}function y(){m.current&&window.clearTimeout(m.current),h.current=!1}return Z.createElement(`div`,{onClick:g,onPointerCancel:y,onPointerDown:e=>{u&&f(e),v()},onPointerMove:e=>{u&&p(e)},ref:r,"data-vaul-drawer-visible":d?`true`:`false`,"data-vaul-handle":``,"aria-hidden":`true`,...n},Z.createElement(`span`,{"data-vaul-handle-hitarea":``,"aria-hidden":`true`},t))});tX.displayName=`Drawer.Handle`;function nX({onDrag:e,onOpenChange:t,open:n,...r}){let{onNestedDrag:i,onNestedOpenChange:a,onNestedRelease:o}=nY();if(!i)throw Error(`Drawer.NestedRoot must be placed in another drawer`);return Z.createElement(XY,{nested:!0,open:n,onClose:()=>{a(!1)},onDrag:(t,n)=>{i(t,n),e?.(t,n)},onOpenChange:e=>{e&&a(e),t?.(e)},onRelease:o,...r})}function rX(e){let t=nY(),{container:n=t.container,...r}=e;return Z.createElement(Xq,{container:n,...r})}var iX={Root:XY,NestedRoot:nX,Content:QY,Overlay:ZY,Trigger:Kq,Portal:rX,Handle:tX,Close:dJ,Title:sJ,Description:lJ};function aX({...e}){return(0,Q.jsx)(iX.Root,{"data-slot":`drawer`,...e})}function oX({...e}){return(0,Q.jsx)(iX.Trigger,{"data-slot":`drawer-trigger`,...e})}function sX({...e}){return(0,Q.jsx)(iX.Portal,{"data-slot":`drawer-portal`,...e})}function cX({className:e,...t}){return(0,Q.jsx)(iX.Overlay,{"data-slot":`drawer-overlay`,className:s(`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-1001 bg-black/50`,e),...t})}function lX({className:e,children:t,withOverlay:n=!0,...r}){return(0,Q.jsxs)(sX,{"data-slot":`drawer-portal`,children:[n&&(0,Q.jsx)(cX,{}),(0,Q.jsx)(iX.Content,{"data-slot":`drawer-content`,className:s(`group/drawer-content bg-white fixed z-1001 flex h-auto flex-col dark:bg-gray-950`,`data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b`,`data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t`,`data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm`,`data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm`,e),onClick:e=>e.stopPropagation(),...r,children:t})]})}function uX({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`drawer-header`,className:s(`flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left`,e),...t})}function dX({className:e,...t}){return(0,Q.jsx)(iX.Title,{"data-slot":`drawer-title`,className:s(`text-gray-950 font-semibold dark:text-gray-50`,e),...t})}function fX({...e}){return(0,Q.jsx)(_o,{"data-slot":`popover`,...e})}function pX({...e}){return(0,Q.jsx)(vo,{"data-slot":`popover-trigger`,...e})}function mX({className:e,align:t=`center`,sideOffset:n=4,container:r,...i}){return(0,Q.jsx)(yo,{container:r,children:(0,Q.jsx)(bo,{"data-slot":`popover-content`,align:t,sideOffset:n,className:s(`bg-white text-gray-950 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-1001 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border border-gray-200 p-4 shadow-md outline-hidden dark:bg-gray-950 dark:text-gray-50 dark:border-gray-800`,e),...i})})}function hX({data:e,placeholder:t,triggerProps:n,disabled:r,onChange:i,value:a,formPart:o,error:s}){let[c,l]=Z.useState(!1),u=SA(),d=RK(`(min-width: 768px)`),f=(0,Z.useMemo)(()=>a&&e.find(e=>e.value===a)||null,[a,e]);return d?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 w-full`,children:[(0,Q.jsxs)(fX,{modal:!0,open:c,onOpenChange:l,children:[(0,Q.jsx)(pX,{asChild:!0,className:`w-full min-w-40`,children:(0,Q.jsx)(gX,{placeholder:t,selectedOption:f,disabled:r,formPart:o,...n})}),(0,Q.jsx)(mX,{className:`w-full p-0`,align:`start`,container:u,children:(0,Q.jsx)(_X,{setOpen:l,onChange:i,data:e,placeholder:t,value:a})})]}),s&&(0,Q.jsx)(`p`,{className:`text-xs text-red-500`,children:s})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 w-full`,children:[(0,Q.jsxs)(aX,{open:c,onOpenChange:l,children:[(0,Q.jsx)(oX,{asChild:!0,children:(0,Q.jsx)(gX,{placeholder:t,selectedOption:f,disabled:r,formPart:o,...n})}),(0,Q.jsx)(lX,{children:(0,Q.jsx)(`div`,{className:`mt-4 border-t`,children:(0,Q.jsx)(_X,{setOpen:l,onChange:i,data:e,placeholder:t,value:a})})})]}),s&&(0,Q.jsx)(`p`,{className:`text-xs text-red-500`,children:s})]})}function gX({formPart:e,placeholder:t,selectedOption:n,...r}){return e?(0,Q.jsx)(ir,{children:(0,Q.jsxs)(q,{variant:`outline`,className:`w-full justify-start`,...r,children:[n?n.label:t,(0,Q.jsx)(_n,{strokeWidth:2,className:`shrink-0 text-gray-500/80 dark:text-gray-400/80 size-4`,"aria-hidden":`true`})]})}):(0,Q.jsxs)(q,{variant:`outline`,className:`w-[150px] justify-start`,...r,children:[n?n.label:t,(0,Q.jsx)(_n,{strokeWidth:2,className:`shrink-0 text-gray-500/80 dark:text-gray-400/80 size-4`,"aria-hidden":`true`})]})}function _X({setOpen:e,onChange:t,placeholder:n,data:r,value:i}){return(0,Q.jsxs)(qJ,{children:[(0,Q.jsx)(JJ,{placeholder:n??`Filter options...`}),(0,Q.jsxs)(YJ,{children:[(0,Q.jsx)(XJ,{children:`No results found.`}),(0,Q.jsx)(ZJ,{children:r.map(n=>(0,Q.jsxs)($J,{keywords:[n.label,n.description??``],value:n.value,onSelect:n=>{t?.(r.find(e=>e.value.toLowerCase()===n.toLowerCase())?.value??null),e(!1)},children:[(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Q.jsx)(`span`,{children:n.label}),n.description&&(0,Q.jsx)(`span`,{className:`text-xs opacity-65`,children:n.description})]}),(0,Q.jsx)(dn,{className:s(`ml-auto`,n.value===i?`opacity-100`:`opacity-0`)})]},n.value))})]})]})}var vX=Object.values(f);(0,Z.forwardRef)(function({label:e,value:t,onChange:n,disabled:r,name:i,form:a}){return(0,Q.jsxs)(`div`,{className:`bottom-0 mt-6`,children:[e&&(0,Q.jsx)(mn,{className:`sr-only`,children:e}),(0,Q.jsxs)(Sn,{value:t,onValueChange:n,disabled:r,name:i,form:a,children:[(0,Q.jsx)(rn,{children:(0,Q.jsx)(qt,{placeholder:`Currency`})}),(0,Q.jsx)(fn,{children:vX.map(e=>(0,Q.jsx)(yn,{value:e,children:e},e))})]})]})});function yX({value:e,onChange:t,onBlur:n,label:r,disabled:i,form:a}){let[o,c]=(0,Z.useState)(!1);return(0,Q.jsxs)(`div`,{className:`w-1/2 min-w-[75px] mt-6`,children:[r&&(0,Q.jsx)(mn,{className:`sr-only`,children:r}),(0,Q.jsxs)(fX,{modal:!0,open:o,onOpenChange:c,children:[(0,Q.jsx)(pX,{asChild:!0,children:(0,Q.jsxs)(q,{type:`button`,variant:`outline`,className:`w-full justify-between font-normal`,disabled:i,onBlur:n,onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(`span`,{children:e??`Currency`}),(0,Q.jsx)(_n,{strokeWidth:2,className:`shrink-0 text-gray-500/80 dark:text-gray-400/80 size-4`,"aria-hidden":`true`})]})}),(0,Q.jsx)(mX,{className:`w-40 p-0`,align:`start`,children:(0,Q.jsxs)(qJ,{children:[(0,Q.jsx)(JJ,{placeholder:`Search currency...`,form:a}),(0,Q.jsxs)(YJ,{children:[(0,Q.jsx)(XJ,{children:`No currency found.`}),(0,Q.jsx)(ZJ,{children:vX.map(n=>(0,Q.jsxs)($J,{value:n,onSelect:()=>{t?.(n),c(!1)},children:[n,(0,Q.jsx)(dn,{className:s(`ml-auto`,e===n?`opacity-100`:`opacity-0`)})]},n))})]})]})})]})]})}var bX=(0,Z.forwardRef)(function({currencyCodeProps:{error:e,...t},error:n,...r}){let{precision:i}=r,a=Math.abs(typeof r.value==`number`?r.value:0);if(a&&!i){if(a>.1)i=2;else for(let e=1;e<6;e++)if(a>10**-e){i=e+1;break}}return(0,Q.jsxs)(`div`,{className:`w-full flex flex-row min-w-[150px]`,children:[(0,Q.jsx)(yk,{className:`w-full min-w-[75px]`,...r,hideControls:!0,precision:i??2,error:n||e}),(0,Q.jsx)(yX,{...t})]})});function xX(e,t,n=`long`){return new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(` `)}var SX={},CX={};function wX(e,t){try{let n=(SX[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in CX?CX[n]:EX(n,n.split(`:`))}catch{if(e in CX)return CX[e];let t=e?.match(TX);return t?EX(e,t.slice(1)):NaN}}var TX=/([+-]\d\d):?(\d\d)?/;function EX(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return CX[e]=n*60+r>0?n*60+r+i:n*60-r-i}var DX=class e extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]==`string`&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(wX(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]==`number`&&(e.length===1||e.length===2&&typeof e[1]!=`number`)?this.setTime(e[0]):typeof e[0]==`string`?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),jX(this,e)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){let e=-wX(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),kX(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},OX=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!OX.test(e))return;let t=e.replace(OX,`$1UTC`);DX.prototype[t]&&(e.startsWith(`get`)?DX.prototype[e]=function(){return this.internal[t]()}:(DX.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),AX(this),+this},DX.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),kX(this),+this}))});function kX(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-wX(e.timeZone,e)*60))}function AX(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),jX(e)}function jX(e,t){let n=Array.isArray(t)?MX(t):+e.internal,r=wX(e.timeZone,e),i=r>0?Math.floor(r):Math.ceil(r),a=new Date(+e);a.setUTCHours(a.getUTCHours()-1);let o=-new Date(+e).getTimezoneOffset(),s=-new Date(+a).getTimezoneOffset(),c=o-s,l=o;if(c&&o!==i&&Date.prototype.getHours.apply(e)!==(Array.isArray(t)?t[3]||0:e.internal.getUTCHours())){let t=new Date(+e),n=o-i;n&&t.setUTCMinutes(t.getUTCMinutes()+n);let r=wX(e.timeZone,t);(r>0?Math.floor(r):Math.ceil(r))===i&&(l=s)}let u=l-i;u&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+u);let d=new Date(+e);d.setUTCSeconds(0);let f=o>0?d.getSeconds():(d.getSeconds()-60)%60,p=Math.round(-(wX(e.timeZone,e)*60))%60;(p||f)&&Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+p+f);let m=wX(e.timeZone,e),h=m>0?Math.floor(m):Math.ceil(m),g=-new Date(+e).getTimezoneOffset()-h,_=h!==i,v=g-u,y=h-i,b=n-h*60*1e3,x=y>0&&NX(e)-n===y*60*1e3&&NX(e,b)!==n;if(_&&v&&!x){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+v);let t=wX(e.timeZone,e),n=h-(t>0?Math.floor(t):Math.ceil(t));n&&v<0&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n)}kX(e);let S=(t?n:n+p*1e3)-+e.internal;S&&Math.abs(S)<1800*1e3&&(Date.prototype.setTime.call(e,+e+S),kX(e))}function MX(e){return Date.UTC(e[0],e.length>1?e[1]:0,e.length>2?e[2]:1,...e.slice(3))}function NX(e,t){let n=new Date(t??+e);return n.setUTCSeconds(n.getUTCSeconds()-Math.round(-wX(e.timeZone,n)*60)),+n}var PX=class e extends DX{static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}toISOString(){let[e,t,n]=this.tzComponents(),r=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){let[e,t,n,r]=this.internal.toUTCString().split(` `);return`${e?.slice(0,-1)} ${n} ${t} ${r}`}toTimeString(){let e=this.internal.toUTCString().split(` `)[4],[t,n,r]=this.tzComponents();return`${e} GMT${t}${n}${r} (${xX(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){let e=this.getTimezoneOffset();return[e>0?`-`:`+`,String(Math.floor(Math.abs(e)/60)).padStart(2,`0`),String(Math.abs(e)%60).padStart(2,`0`)]}withTimeZone(t){return new e(+this,t)}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},FX=5,IX=4;function LX(e,t){let n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,i=t.addDays(e,-r+1),a=t.addDays(i,FX*7-1);return t.getMonth(e)===t.getMonth(a)?FX:IX}function RX(e,t){let n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function zX(e,t){let n=RX(e,t),r=LX(e,t);return t.addDays(n,r*7-1)}var BX={...Vr,labels:{labelDayButton:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>dr(e,t,{locale:Vr,...n});let a=i(e,`PPPP`);return t.today&&(a=`Today, ${a}`),t.selected&&(a=`${a}, selected`),a},labelMonthDropdown:`Choose the Month`,labelNext:`Go to the Next Month`,labelPrevious:`Go to the Previous Month`,labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:`Choose the Year`,labelGrid:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>dr(e,n,{locale:Vr,...t}),r(e,`LLLL yyyy`)},labelGridcell:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>dr(e,t,{locale:Vr,...n});let a=i(e,`PPPP`);return t?.today&&(a=`Today, ${a}`),a},labelNav:`Navigation bar`,labelWeekNumberHeader:`Week Number`,labelWeekday:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>dr(e,n,{locale:Vr,...t}),r(e,`cccc`)}}},VX=class e{constructor(e,t){this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?PX.tz(this.options.timeZone):new(this.options.Date??Date),this.newDate=(e,t,n)=>this.overrides?.newDate?this.overrides.newDate(e,t,n):this.options.timeZone?new PX(e,t,n,this.options.timeZone):new Date(e,t,n),this.addDays=(e,t)=>this.overrides?.addDays?this.overrides.addDays(e,t):Rs(e,t),this.addMonths=(e,t)=>this.overrides?.addMonths?this.overrides.addMonths(e,t):zs(e,t),this.addWeeks=(e,t)=>this.overrides?.addWeeks?this.overrides.addWeeks(e,t):Bs(e,t),this.addYears=(e,t)=>this.overrides?.addYears?this.overrides.addYears(e,t):Vs(e,t),this.differenceInCalendarDays=(e,t)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(e,t):qr(e,t),this.differenceInCalendarMonths=(e,t)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(e,t):Gs(e,t),this.eachMonthOfInterval=e=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(e):Xs(e),this.eachYearOfInterval=e=>{let t=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(e):$s(e),n=new Set(t.map(e=>this.getYear(e)));if(n.size===t.length)return t;let r=[];return n.forEach(e=>{r.push(new Date(e,0,1))}),r},this.endOfBroadcastWeek=e=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(e):zX(e,this),this.endOfISOWeek=e=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(e):tc(e),this.endOfMonth=e=>this.overrides?.endOfMonth?this.overrides.endOfMonth(e):Js(e),this.endOfWeek=(e,t)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(e,t):ec(e,this.options),this.endOfYear=e=>this.overrides?.endOfYear?this.overrides.endOfYear(e):Qs(e),this.format=(e,t,n)=>{let r=this.overrides?.format?this.overrides.format(e,t,this.options):dr(e,t,this.options);return this.options.numerals&&this.options.numerals!==`latn`?this.replaceDigits(r):r},this.getISOWeek=e=>this.overrides?.getISOWeek?this.overrides.getISOWeek(e):Zn(e),this.getMonth=(e,t)=>this.overrides?.getMonth?this.overrides.getMonth(e,this.options):ac(e,this.options),this.getYear=(e,t)=>this.overrides?.getYear?this.overrides.getYear(e,this.options):oc(e,this.options),this.getWeek=(e,t)=>this.overrides?.getWeek?this.overrides.getWeek(e,this.options):Ar(e,this.options),this.isAfter=(e,t)=>this.overrides?.isAfter?this.overrides.isAfter(e,t):sc(e,t),this.isBefore=(e,t)=>this.overrides?.isBefore?this.overrides.isBefore(e,t):cc(e,t),this.isDate=e=>this.overrides?.isDate?this.overrides.isDate(e):pi(e),this.isSameDay=(e,t)=>this.overrides?.isSameDay?this.overrides.isSameDay(e,t):Ws(e,t),this.isSameMonth=(e,t)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(e,t):al(e,t),this.isSameYear=(e,t)=>this.overrides?.isSameYear?this.overrides.isSameYear(e,t):ol(e,t),this.max=e=>this.overrides?.max?this.overrides.max(e):Hs(e),this.min=e=>this.overrides?.min?this.overrides.min(e):Us(e),this.setMonth=(e,t)=>this.overrides?.setMonth?this.overrides.setMonth(e,t):sl(e,t),this.setYear=(e,t)=>this.overrides?.setYear?this.overrides.setYear(e,t):ll(e,t),this.startOfBroadcastWeek=(e,t)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(e,this):RX(e,this),this.startOfDay=e=>this.overrides?.startOfDay?this.overrides.startOfDay(e):Pr(e),this.startOfISOWeek=e=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(e):Lr(e),this.startOfMonth=e=>this.overrides?.startOfMonth?this.overrides.startOfMonth(e):Zs(e),this.startOfWeek=(e,t)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(e,this.options):Yr(e,this.options),this.startOfYear=e=>this.overrides?.startOfYear?this.overrides.startOfYear(e):vi(e),this.options={locale:BX,...e},this.overrides=t}getDigitMap(){let{numerals:e=`latn`}=this.options,t=new Intl.NumberFormat(`en-US`,{numberingSystem:e}),n={};for(let e=0;e<10;e++)n[e.toString()]=t.format(e);return n}replaceDigits(e){let t=this.getDigitMap();return e.replace(/\d/g,e=>t[e]||e)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){let t=this.options.locale?.code;return t&&e.yearFirstLocales.has(t)?`year-first`:`month-first`}formatMonthYear(t){let{locale:n,timeZone:r,numerals:i}=this.options,a=n?.code;if(a&&e.yearFirstLocales.has(a))try{return new Intl.DateTimeFormat(a,{month:`long`,year:`numeric`,timeZone:r,numberingSystem:i}).format(t)}catch{}let o=this.getMonthYearOrder()===`year-first`?`y LLLL`:`LLLL y`;return this.format(t,o)}};VX.yearFirstLocales=new Set([`eu`,`hu`,`ja`,`ja-Hira`,`ja-JP`,`ko`,`ko-KR`,`lt`,`lt-LT`,`lv`,`lv-LV`,`mn`,`mn-MN`,`zh`,`zh-CN`,`zh-HK`,`zh-TW`]);var HX=new VX,UX=class{constructor(e,t,n=HX){this.date=e,this.displayMonth=t,this.outside=!!(t&&!n.isSameMonth(e,t)),this.dateLib=n,this.isoDate=n.format(e,`yyyy-MM-dd`),this.displayMonthId=n.format(t,`yyyy-MM`),this.dateMonthId=n.format(e,`yyyy-MM`)}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}},WX=class{constructor(e,t){this.date=e,this.weeks=t}},GX=class{constructor(e,t){this.days=t,this.weekNumber=e}};function KX(e){return Z.createElement(`span`,{...e})}function qX(e){let{size:t=24,orientation:n=`left`,className:r,style:i}=e;return Z.createElement(`svg`,{className:r,style:i,width:t,height:t,viewBox:`0 0 24 24`},n===`up`&&Z.createElement(`polygon`,{points:`6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28`}),n===`down`&&Z.createElement(`polygon`,{points:`6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72`}),n===`left`&&Z.createElement(`polygon`,{points:`16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20`}),n===`right`&&Z.createElement(`polygon`,{points:`8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20`}))}function JX(e){let{day:t,modifiers:n,...r}=e;return Z.createElement(`td`,{...r})}function YX(e){let{day:t,modifiers:n,...r}=e,i=Z.useRef(null);return Z.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),Z.createElement(`button`,{ref:i,...r})}var XX;(function(e){e.Root=`root`,e.Chevron=`chevron`,e.Day=`day`,e.DayButton=`day_button`,e.CaptionLabel=`caption_label`,e.Dropdowns=`dropdowns`,e.Dropdown=`dropdown`,e.DropdownRoot=`dropdown_root`,e.Footer=`footer`,e.MonthGrid=`month_grid`,e.MonthCaption=`month_caption`,e.MonthsDropdown=`months_dropdown`,e.Month=`month`,e.Months=`months`,e.Nav=`nav`,e.NextMonthButton=`button_next`,e.PreviousMonthButton=`button_previous`,e.Week=`week`,e.Weeks=`weeks`,e.Weekday=`weekday`,e.Weekdays=`weekdays`,e.WeekNumber=`week_number`,e.WeekNumberHeader=`week_number_header`,e.YearsDropdown=`years_dropdown`})(XX||={});var ZX;(function(e){e.disabled=`disabled`,e.hidden=`hidden`,e.outside=`outside`,e.focused=`focused`,e.today=`today`})(ZX||={});var QX;(function(e){e.range_end=`range_end`,e.range_middle=`range_middle`,e.range_start=`range_start`,e.selected=`selected`})(QX||={});var $X;(function(e){e.weeks_before_enter=`weeks_before_enter`,e.weeks_before_exit=`weeks_before_exit`,e.weeks_after_enter=`weeks_after_enter`,e.weeks_after_exit=`weeks_after_exit`,e.caption_after_enter=`caption_after_enter`,e.caption_after_exit=`caption_after_exit`,e.caption_before_enter=`caption_before_enter`,e.caption_before_exit=`caption_before_exit`})($X||={});var eZ=(0,Z.createContext)(void 0);function tZ(){let e=(0,Z.useContext)(eZ);if(e===void 0)throw Error(`useDayPicker() must be used within a custom component.`);return e}function nZ(e){let{options:t,className:n,...r}=e,{classNames:i,components:a,styles:o}=tZ(),s=[i[XX.Dropdown],n].join(` `),c=t?.find(({value:e})=>e===r.value);return Z.createElement(`span`,{"data-disabled":r.disabled,className:i[XX.DropdownRoot],style:o?.[XX.DropdownRoot]},Z.createElement(a.Select,{className:s,...r},t?.map(({value:e,label:t,disabled:n})=>Z.createElement(a.Option,{key:e,value:e,disabled:n},t))),Z.createElement(`span`,{className:i[XX.CaptionLabel],style:o?.[XX.CaptionLabel],"aria-hidden":!0},c?.label,Z.createElement(a.Chevron,{orientation:`down`,size:18,className:i[XX.Chevron],style:o?.[XX.Chevron]})))}function rZ(e){return Z.createElement(`div`,{...e})}function iZ(e){return Z.createElement(`div`,{...e})}function aZ(e){let{calendarMonth:t,displayIndex:n,...r}=e;return Z.createElement(`div`,{...r},e.children)}function oZ(e){let{calendarMonth:t,displayIndex:n,...r}=e;return Z.createElement(`div`,{...r})}function sZ(e){return Z.createElement(`table`,{...e})}function cZ(e){return Z.createElement(`div`,{...e})}function lZ(e){let{components:t}=tZ();return Z.createElement(t.Dropdown,{...e})}function uZ(e){let{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:i,...a}=e,{components:o,classNames:s,styles:c,labels:{labelPrevious:l,labelNext:u}}=tZ(),d=(0,Z.useCallback)(e=>{i&&n?.(e)},[i,n]),f=(0,Z.useCallback)(e=>{r&&t?.(e)},[r,t]);return Z.createElement(`nav`,{...a},Z.createElement(o.PreviousMonthButton,{type:`button`,className:s[XX.PreviousMonthButton],style:c?.[XX.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":!r||void 0,"aria-label":l(r),onClick:f},Z.createElement(o.Chevron,{disabled:!r||void 0,className:s[XX.Chevron],style:c?.[XX.Chevron],orientation:`left`})),Z.createElement(o.NextMonthButton,{type:`button`,className:s[XX.NextMonthButton],style:c?.[XX.NextMonthButton],tabIndex:i?void 0:-1,"aria-disabled":!i||void 0,"aria-label":u(i),onClick:d},Z.createElement(o.Chevron,{disabled:!i||void 0,orientation:`right`,className:s[XX.Chevron],style:c?.[XX.Chevron]})))}function dZ(e){return Z.createElement(`button`,{...e})}function fZ(e){return Z.createElement(`option`,{...e})}function pZ(e){return Z.createElement(`button`,{...e})}function mZ(e){let{rootRef:t,...n}=e;return Z.createElement(`div`,{...n,ref:t})}function hZ(e){return Z.createElement(`select`,{...e})}function gZ(e){let{week:t,...n}=e;return Z.createElement(`tr`,{...n})}function _Z(e){return Z.createElement(`th`,{...e})}function vZ(e){return Z.createElement(`thead`,{"aria-hidden":!0},Z.createElement(`tr`,{...e}))}function yZ(e){let{week:t,...n}=e;return Z.createElement(`th`,{...n})}function bZ(e){return Z.createElement(`th`,{...e})}function xZ(e){return Z.createElement(`tbody`,{...e})}function SZ(e){let{components:t}=tZ();return Z.createElement(t.Dropdown,{...e})}var CZ=e({CaptionLabel:()=>KX,Chevron:()=>qX,Day:()=>JX,DayButton:()=>YX,Dropdown:()=>nZ,DropdownNav:()=>rZ,Footer:()=>iZ,Month:()=>aZ,MonthCaption:()=>oZ,MonthGrid:()=>sZ,Months:()=>cZ,MonthsDropdown:()=>lZ,Nav:()=>uZ,NextMonthButton:()=>dZ,Option:()=>fZ,PreviousMonthButton:()=>pZ,Root:()=>mZ,Select:()=>hZ,Week:()=>gZ,WeekNumber:()=>yZ,WeekNumberHeader:()=>bZ,Weekday:()=>_Z,Weekdays:()=>vZ,Weeks:()=>xZ,YearsDropdown:()=>SZ});function wZ(e,t,n=!1,r=HX){let{from:i,to:a}=e,{differenceInCalendarDays:o,isSameDay:s}=r;return i&&a?(o(a,i)<0&&([i,a]=[a,i]),o(t,i)>=+!!n&&o(a,t)>=+!!n):!n&&a?s(a,t):!n&&i?s(i,t):!1}function TZ(e){return!!(e&&typeof e==`object`&&`before`in e&&`after`in e)}function EZ(e){return!!(e&&typeof e==`object`&&`from`in e)}function DZ(e){return!!(e&&typeof e==`object`&&`after`in e)}function OZ(e){return!!(e&&typeof e==`object`&&`before`in e)}function kZ(e){return!!(e&&typeof e==`object`&&`dayOfWeek`in e)}function AZ(e,t){return Array.isArray(e)&&e.every(t.isDate)}function jZ(e,t,n=HX){let r=Array.isArray(t)?t:[t],{isSameDay:i,differenceInCalendarDays:a,isAfter:o}=n;return r.some(t=>{if(typeof t==`boolean`)return t;if(n.isDate(t))return i(e,t);if(AZ(t,n))return t.some(t=>i(e,t));if(EZ(t))return wZ(t,e,!1,n);if(kZ(t))return Array.isArray(t.dayOfWeek)?t.dayOfWeek.includes(e.getDay()):t.dayOfWeek===e.getDay();if(TZ(t)){let n=a(t.before,e),r=a(t.after,e),i=n>0,s=r<0;return o(t.before,t.after)?s&&i:i||s}return DZ(t)?a(e,t.after)>0:OZ(t)?a(t.before,e)>0:typeof t==`function`&&t(e)})}function MZ(e,t,n,r,i){let{disabled:a,hidden:o,modifiers:s,showOutsideDays:c,broadcastCalendar:l,today:u=i.today()}=t,{isSameDay:d,isSameMonth:f,startOfMonth:p,isBefore:m,endOfMonth:h,isAfter:g}=i,_=n&&p(n),v=r&&h(r),y={[ZX.focused]:[],[ZX.outside]:[],[ZX.disabled]:[],[ZX.hidden]:[],[ZX.today]:[]},b={};for(let t of e){let{date:e,displayMonth:n}=t,r=!!(n&&!f(e,n)),p=!!(_&&m(e,_)),h=!!(v&&g(e,v)),x=!!(a&&jZ(e,a,i)),S=!!(o&&jZ(e,o,i))||p||h||!l&&!c&&r||l&&c===!1&&r,C=d(e,u);r&&y.outside.push(t),x&&y.disabled.push(t),S&&y.hidden.push(t),C&&y.today.push(t),s&&Object.keys(s).forEach(n=>{let r=s?.[n];r&&jZ(e,r,i)&&(b[n]?b[n].push(t):b[n]=[t])})}return e=>{let t={[ZX.focused]:!1,[ZX.disabled]:!1,[ZX.hidden]:!1,[ZX.outside]:!1,[ZX.today]:!1},n={};for(let n in y)t[n]=y[n].some(t=>t===e);for(let t in b)n[t]=b[t].some(t=>t===e);return{...t,...n}}}function NZ(e,t,n={}){return Object.entries(e).filter(([,e])=>e===!0).reduce((e,[r])=>(n[r]?e.push(n[r]):t[ZX[r]]?e.push(t[ZX[r]]):t[QX[r]]&&e.push(t[QX[r]]),e),[t[XX.Day]])}function PZ(e){return{...CZ,...e}}function FZ(e){let t={"data-mode":e.mode??void 0,"data-required":`required`in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([e,n])=>{e.startsWith(`data-`)&&(t[e]=n)}),t}function IZ(){let e={};for(let t in XX)e[XX[t]]=`rdp-${XX[t]}`;for(let t in ZX)e[ZX[t]]=`rdp-${ZX[t]}`;for(let t in QX)e[QX[t]]=`rdp-${QX[t]}`;for(let t in $X)e[$X[t]]=`rdp-${$X[t]}`;return e}function LZ(e,t,n){return(n??new VX(t)).formatMonthYear(e)}function RZ(e,t,n){return(n??new VX(t)).format(e,`d`)}function zZ(e,t=HX){return t.format(e,`LLLL`)}function BZ(e,t,n){return(n??new VX(t)).format(e,`cccccc`)}function VZ(e,t=HX){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function HZ(){return``}function UZ(e,t=HX){return t.format(e,`yyyy`)}var WZ=e({formatCaption:()=>LZ,formatDay:()=>RZ,formatMonthDropdown:()=>zZ,formatWeekNumber:()=>VZ,formatWeekNumberHeader:()=>HZ,formatWeekdayName:()=>BZ,formatYearDropdown:()=>UZ});function GZ(e){return{...WZ,...e}}function KZ(e,t,n,r){let i=(r??new VX(n)).format(e,`PPPP`);return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i}function qZ(e,t,n){return(n??new VX(t)).formatMonthYear(e)}function JZ(e,t,n,r){let i=(r??new VX(n)).format(e,`PPPP`);return t?.today&&(i=`Today, ${i}`),i}function YZ(e){return`Choose the Month`}function XZ(){return``}var ZZ=`Go to the Next Month`;function QZ(e,t){return ZZ}function $Z(e){return`Go to the Previous Month`}function eQ(e,t,n){return(n??new VX(t)).format(e,`cccc`)}function tQ(e,t){return`Week ${e}`}function nQ(e){return`Week Number`}function rQ(e){return`Choose the Year`}var iQ=e({labelDayButton:()=>KZ,labelGrid:()=>qZ,labelGridcell:()=>JZ,labelMonthDropdown:()=>YZ,labelNav:()=>XZ,labelNext:()=>QZ,labelPrevious:()=>$Z,labelWeekNumber:()=>tQ,labelWeekNumberHeader:()=>nQ,labelWeekday:()=>eQ,labelYearDropdown:()=>rQ}),aQ=(e,t,n)=>t||(n?typeof n==`function`?n:(...e)=>n:e);function oQ(e,t){let n=t.locale?.labels??{};return{...iQ,...e??{},labelDayButton:aQ(KZ,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:aQ(YZ,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:aQ(QZ,e?.labelNext,n.labelNext),labelPrevious:aQ($Z,e?.labelPrevious,n.labelPrevious),labelWeekNumber:aQ(tQ,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:aQ(rQ,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:aQ(qZ,e?.labelGrid,n.labelGrid),labelGridcell:aQ(JZ,e?.labelGridcell,n.labelGridcell),labelNav:aQ(XZ,e?.labelNav,n.labelNav),labelWeekNumberHeader:aQ(nQ,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:aQ(eQ,e?.labelWeekday,n.labelWeekday)}}function sQ(e,t,n,r,i){let{startOfMonth:a,startOfYear:o,endOfYear:s,eachMonthOfInterval:c,getMonth:l}=i;return c({start:o(e),end:s(e)}).map(e=>{let o=r.formatMonthDropdown(e,i);return{value:l(e),label:o,disabled:t&&e<a(t)||n&&e>a(n)||!1}})}function cQ(e,t={},n={}){let r={...t?.[XX.Day]};return Object.entries(e).filter(([,e])=>e===!0).forEach(([e])=>{r={...r,...n?.[e]}}),r}function lQ(e,t,n,r){let i=r??e.today(),a=n?e.startOfBroadcastWeek(i,e):t?e.startOfISOWeek(i):e.startOfWeek(i),o=[];for(let t=0;t<7;t++){let n=e.addDays(a,t);o.push(n)}return o}function uQ(e,t,n,r,i=!1){if(!e||!t)return;let{startOfYear:a,endOfYear:o,eachYearOfInterval:s,getYear:c}=r,l=s({start:a(e),end:o(t)});return i&&l.reverse(),l.map(e=>{let t=n.formatYearDropdown(e,r);return{value:c(e),label:t,disabled:!1}})}function dQ(e,t={}){let{weekStartsOn:n,locale:r}=t,i=n??r?.options?.weekStartsOn??0,a=t=>{let n=typeof t==`number`||typeof t==`string`?new Date(t):t;return new PX(n.getFullYear(),n.getMonth(),n.getDate(),12,0,0,e)},o=e=>{let t=a(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)};return{today:()=>a(PX.tz(e)),newDate:(t,n,r)=>new PX(t,n,r,12,0,0,e),startOfDay:e=>a(e),startOfWeek:(e,t)=>{let n=a(e),r=t?.weekStartsOn??i,o=(n.getDay()-r+7)%7;return n.setDate(n.getDate()-o),n},startOfISOWeek:e=>{let t=a(e),n=(t.getDay()-1+7)%7;return t.setDate(t.getDate()-n),t},startOfMonth:e=>{let t=a(e);return t.setDate(1),t},startOfYear:e=>{let t=a(e);return t.setMonth(0,1),t},endOfWeek:(e,t)=>{let n=a(e),r=(((t?.weekStartsOn??i)+6)%7-n.getDay()+7)%7;return n.setDate(n.getDate()+r),n},endOfISOWeek:e=>{let t=a(e),n=(7-t.getDay())%7;return t.setDate(t.getDate()+n),t},endOfMonth:e=>{let t=a(e);return t.setMonth(t.getMonth()+1,0),t},endOfYear:e=>{let t=a(e);return t.setMonth(11,31),t},eachMonthOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new PX(n.getFullYear(),n.getMonth(),1,12,0,0,e),s=r.getFullYear()*12+r.getMonth();for(;o.getFullYear()*12+o.getMonth()<=s;)i.push(new PX(o,e)),o.setMonth(o.getMonth()+1,1);return i},addDays:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t),n},addWeeks:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t*7),n},addMonths:(e,t)=>{let n=a(e);return n.setMonth(n.getMonth()+t),n},addYears:(e,t)=>{let n=a(e);return n.setFullYear(n.getFullYear()+t),n},eachYearOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new PX(n.getFullYear(),0,1,12,0,0,e);for(;o.getFullYear()<=r.getFullYear();)i.push(new PX(o,e)),o.setFullYear(o.getFullYear()+1,0,1);return i},getWeek:(e,t)=>Ar(o(e),{weekStartsOn:t?.weekStartsOn??i,firstWeekContainsDate:t?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1}),getISOWeek:e=>Zn(o(e)),differenceInCalendarDays:(e,t)=>qr(o(e),o(t)),differenceInCalendarMonths:(e,t)=>Gs(o(e),o(t))}}var fQ=e=>e instanceof HTMLElement?e:null,pQ=e=>[...e.querySelectorAll(`[data-animated-month]`)??[]],mQ=e=>fQ(e.querySelector(`[data-animated-month]`)),hQ=e=>fQ(e.querySelector(`[data-animated-caption]`)),gQ=e=>fQ(e.querySelector(`[data-animated-weeks]`)),Pte=e=>fQ(e.querySelector(`[data-animated-nav]`)),_Q=e=>fQ(e.querySelector(`[data-animated-weekdays]`));function vQ(e,t,{classNames:n,months:r,focused:i,dateLib:a}){let o=(0,Z.useRef)(null),s=(0,Z.useRef)(r),c=(0,Z.useRef)(!1);(0,Z.useLayoutEffect)(()=>{let l=s.current;if(s.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||l.length===0||r.length!==l.length)return;let u=a.isSameMonth(r[0].date,l[0].date),d=a.isAfter(r[0].date,l[0].date),f=d?n[$X.caption_after_enter]:n[$X.caption_before_enter],p=d?n[$X.weeks_after_enter]:n[$X.weeks_before_enter],m=o.current,h=e.current.cloneNode(!0);if(h instanceof HTMLElement?(pQ(h).forEach(e=>{if(!(e instanceof HTMLElement))return;let t=mQ(e);t&&e.contains(t)&&e.removeChild(t);let n=hQ(e);n&&n.classList.remove(f);let r=gQ(e);r&&r.classList.remove(p)}),o.current=h):o.current=null,c.current||u||i)return;let g=m instanceof HTMLElement?pQ(m):[],_=pQ(e.current);if(_?.every(e=>e instanceof HTMLElement)&&g?.every(e=>e instanceof HTMLElement)){c.current=!0;let t=[];e.current.style.isolation=`isolate`;let r=Pte(e.current);r&&(r.style.zIndex=`1`),_.forEach((i,a)=>{let o=g[a];if(!o)return;i.style.position=`relative`,i.style.overflow=`hidden`;let s=hQ(i);s&&s.classList.add(f);let l=gQ(i);l&&l.classList.add(p);let u=()=>{c.current=!1,e.current&&(e.current.style.isolation=``),r&&(r.style.zIndex=``),s&&s.classList.remove(f),l&&l.classList.remove(p),i.style.position=``,i.style.overflow=``,i.contains(o)&&i.removeChild(o)};t.push(u),o.style.pointerEvents=`none`,o.style.position=`absolute`,o.style.overflow=`hidden`,o.setAttribute(`aria-hidden`,`true`);let m=_Q(o);m&&(m.style.opacity=`0`);let h=hQ(o);h&&(h.classList.add(d?n[$X.caption_before_exit]:n[$X.caption_after_exit]),h.addEventListener(`animationend`,u));let _=gQ(o);_&&_.classList.add(d?n[$X.weeks_before_exit]:n[$X.weeks_after_exit]),i.insertBefore(o,i.firstChild)})}})}function yQ(e,t,n,r){let i=e[0],a=e[e.length-1],{ISOWeek:o,fixedWeeks:s,broadcastCalendar:c}=n??{},{addDays:l,differenceInCalendarDays:u,differenceInCalendarMonths:d,endOfBroadcastWeek:f,endOfISOWeek:p,endOfMonth:m,endOfWeek:h,isAfter:g,startOfBroadcastWeek:_,startOfISOWeek:v,startOfWeek:y}=r,b=c?_(i,r):o?v(i):y(i),x=c?f(a):o?p(m(a)):h(m(a)),S=t&&(c?f(t):o?p(t):h(t)),C=u(S&&g(x,S)?S:x,b),w=d(a,i)+1,T=[];for(let e=0;e<=C;e++){let t=l(b,e);T.push(t)}let E=(c?35:42)*w;if(s&&T.length<E){let e=E-T.length;for(let t=0;t<e;t++){let e=l(T[T.length-1],1);T.push(e)}}return T}function bQ(e){let t=[];return e.reduce((e,n)=>{let r=n.weeks.reduce((e,t)=>e.concat(t.days.slice()),t.slice());return e.concat(r.slice())},t.slice())}function xQ(e,t,n,r){let{numberOfMonths:i=1}=n,a=[];for(let n=0;n<i;n++){let i=r.addMonths(e,n);if(t&&i>t)break;a.push(i)}return a}function SQ(e,t,n,r){let{month:i,defaultMonth:a,today:o=r.today(),numberOfMonths:s=1}=e,c=i||a||o,{differenceInCalendarMonths:l,addMonths:u,startOfMonth:d}=r;return n&&l(n,c)<s-1&&(c=u(n,-1*(s-1))),t&&l(c,t)<0&&(c=t),d(c)}function CQ(e,t,n,r){let{addDays:i,endOfBroadcastWeek:a,endOfISOWeek:o,endOfMonth:s,endOfWeek:c,getISOWeek:l,getWeek:u,startOfBroadcastWeek:d,startOfISOWeek:f,startOfWeek:p}=r,m=e.reduce((e,m)=>{let h=n.broadcastCalendar?d(m,r):n.ISOWeek?f(m):p(m),g=n.broadcastCalendar?a(m):n.ISOWeek?o(s(m)):c(s(m)),_=t.filter(e=>e>=h&&e<=g),v=n.broadcastCalendar?35:42;if(n.fixedWeeks&&_.length<v){let e=t.filter(e=>{let t=v-_.length;return e>g&&e<=i(g,t)});_.push(...e)}let y=new WX(m,_.reduce((e,t)=>{let i=n.ISOWeek?l(t):u(t),a=e.find(e=>e.weekNumber===i),o=new UX(t,m,r);return a?a.days.push(o):e.push(new GX(i,[o])),e},[]));return e.push(y),e},[]);return n.reverseMonths?m.reverse():m}function wQ(e,t){let{startMonth:n,endMonth:r}=e,{startOfYear:i,startOfDay:a,startOfMonth:o,endOfMonth:s,addYears:c,endOfYear:l,today:u}=t,d=e.captionLayout===`dropdown`||e.captionLayout===`dropdown-years`;return n?n=o(n):!n&&d&&(n=i(c(e.today??u(),-100))),r?r=s(r):!r&&d&&(r=l(e.today??u())),[n&&a(n),r&&a(r)]}function TQ(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a=1}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a:1,u=o(e);if(!t||!(c(t,e)<a))return s(u,l)}function EQ(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a??1:1,u=o(e);if(!t||!(c(u,t)<=0))return s(u,-l)}function DQ(e){return e.reduce((e,t)=>e.concat(t.weeks.slice()),[].slice())}function OQ(e,t){let[n,r]=(0,Z.useState)(e);return[t===void 0?n:t,r]}function kQ(e,t){let[n,r]=wQ(e,t),{startOfMonth:i,endOfMonth:a}=t,o=SQ(e,n,r,t),[s,c]=OQ(o,e.month?o:void 0);(0,Z.useEffect)(()=>{let i=SQ(e,n,r,t);c(i)},[e.timeZone]);let{months:l,weeks:u,days:d,previousMonth:f,nextMonth:p}=(0,Z.useMemo)(()=>{let i=xQ(s,r,{numberOfMonths:e.numberOfMonths},t),o=CQ(i,yQ(i,e.endMonth?a(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t);return{months:o,weeks:DQ(o),days:bQ(o),previousMonth:EQ(s,n,e,t),nextMonth:TQ(s,r,e,t)}},[t,s.getTime(),r?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:m,onMonthChange:h}=e,g=e=>u.some(t=>t.days.some(t=>t.isEqualTo(e))),_=e=>{if(m)return;let t=i(e);n&&t<i(n)&&(t=i(n)),r&&t>i(r)&&(t=i(r)),c(t),h?.(t)};return{months:l,weeks:u,days:d,navStart:n,navEnd:r,previousMonth:f,nextMonth:p,goToMonth:_,goToDay:e=>{g(e)||_(e.date)}}}var AQ;(function(e){e[e.Today=0]=`Today`,e[e.Selected=1]=`Selected`,e[e.LastFocused=2]=`LastFocused`,e[e.FocusedModifier=3]=`FocusedModifier`})(AQ||={});function jQ(e){return!e[ZX.disabled]&&!e[ZX.hidden]&&!e[ZX.outside]}function MQ(e,t,n,r){let i,a=-1;for(let o of e){let e=t(o);jQ(e)&&(e[ZX.focused]&&a<AQ.FocusedModifier?(i=o,a=AQ.FocusedModifier):r?.isEqualTo(o)&&a<AQ.LastFocused?(i=o,a=AQ.LastFocused):n(o.date)&&a<AQ.Selected?(i=o,a=AQ.Selected):e[ZX.today]&&a<AQ.Today&&(i=o,a=AQ.Today))}return i||=e.find(e=>jQ(t(e))),i}function NQ(e,t,n,r,i,a,o){let{ISOWeek:s,broadcastCalendar:c}=a,{addDays:l,addMonths:u,addWeeks:d,addYears:f,endOfBroadcastWeek:p,endOfISOWeek:m,endOfWeek:h,max:g,min:_,startOfBroadcastWeek:v,startOfISOWeek:y,startOfWeek:b}=o,x={day:l,week:d,month:u,year:f,startOfWeek:e=>c?v(e,o):s?y(e):b(e),endOfWeek:e=>c?p(e):s?m(e):h(e)}[e](n,t===`after`?1:-1);return t===`before`&&r?x=g([r,x]):t===`after`&&i&&(x=_([i,x])),x}function PQ(e,t,n,r,i,a,o,s=0){if(s>365)return;let c=NQ(e,t,n.date,r,i,a,o),l=!!(a.disabled&&jZ(c,a.disabled,o)),u=!!(a.hidden&&jZ(c,a.hidden,o)),d=new UX(c,c,o);return!l&&!u?d:PQ(e,t,d,r,i,a,o,s+1)}function FQ(e,t,n,r,i){let{autoFocus:a}=e,[o,s]=(0,Z.useState)(),c=MQ(t.days,n,r||(()=>!1),o),[l,u]=(0,Z.useState)(a?c:void 0);return{isFocusTarget:e=>!!c?.isEqualTo(e),setFocused:u,focused:l,blur:()=>{s(l),u(void 0)},moveFocus:(n,r)=>{if(!l)return;let a=PQ(n,r,l,t.navStart,t.navEnd,e,i);a&&(e.disableNavigation&&!t.days.some(e=>e.isEqualTo(a))||(t.goToDay(a),u(a)))}}}function IQ(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=OQ(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t,l=e=>s?.some(t=>c(t,e))??!1,{min:u,max:d}=e;return{selected:s,select:(e,t,n)=>{let a=[...s??[]];if(l(e)){if(s?.length===u||r&&s?.length===1)return;a=s?.filter(t=>!c(t,e))}else a=s?.length===d?[e]:[...a,e];return i||o(a),i?.(a,e,t,n),a},isSelected:l}}function LQ(e,t,n=0,r=0,i=!1,a=HX){let{from:o,to:s}=t||{},{isSameDay:c,isAfter:l,isBefore:u}=a,d;if(!o&&!s)d={from:e,to:n>0?void 0:e};else if(o&&!s)d=c(o,e)?n===0?{from:o,to:e}:i?{from:o,to:void 0}:void 0:u(e,o)?{from:e,to:o}:{from:o,to:e};else if(o&&s)if(c(o,e)&&c(s,e))d=i?{from:o,to:s}:void 0;else if(c(o,e))d={from:o,to:n>0?void 0:e};else if(c(s,e))d={from:e,to:n>0?void 0:e};else if(u(e,o))d={from:e,to:s};else if(l(e,o))d={from:o,to:e};else if(l(e,s))d={from:o,to:e};else throw Error(`Invalid range`);if(d?.from&&d?.to){let t=a.differenceInCalendarDays(d.to,d.from);(r>0&&t>r||n>1&&t<n)&&(d={from:e,to:void 0})}return d}function RQ(e,t,n=HX){let r=Array.isArray(t)?t:[t],i=e.from,a=n.differenceInCalendarDays(e.to,e.from),o=Math.min(a,6);for(let e=0;e<=o;e++){if(r.includes(i.getDay()))return!0;i=n.addDays(i,1)}return!1}function zQ(e,t,n=HX){return wZ(e,t.from,!1,n)||wZ(e,t.to,!1,n)||wZ(t,e.from,!1,n)||wZ(t,e.to,!1,n)}function BQ(e,t,n=HX){let r=Array.isArray(t)?t:[t];if(r.filter(e=>typeof e!=`function`).some(t=>typeof t==`boolean`?t:n.isDate(t)?wZ(e,t,!1,n):AZ(t,n)?t.some(t=>wZ(e,t,!1,n)):EZ(t)?t.from&&t.to?zQ(e,{from:t.from,to:t.to},n):!1:kZ(t)?RQ(e,t.dayOfWeek,n):TZ(t)?n.isAfter(t.before,t.after)?zQ(e,{from:n.addDays(t.after,1),to:n.addDays(t.before,-1)},n):jZ(e.from,t,n)||jZ(e.to,t,n):DZ(t)||OZ(t)?jZ(e.from,t,n)||jZ(e.to,t,n):!1))return!0;let i=r.filter(e=>typeof e==`function`);if(i.length){let t=e.from,r=n.differenceInCalendarDays(e.to,e.from);for(let e=0;e<=r;e++){if(i.some(e=>e(t)))return!0;t=n.addDays(t,1)}}return!1}function VQ(e,t){let{disabled:n,excludeDisabled:r,resetOnSelect:i,selected:a,required:o,onSelect:s}=e,[c,l]=OQ(a,s?a:void 0),u=s?a:c;return{selected:u,select:(a,c,d)=>{let{min:f,max:p}=e,m;if(a){let e=u?.from,n=u?.to,r=!!e&&!!n,s=!!e&&!!n&&t.isSameDay(e,n)&&t.isSameDay(a,e);m=i&&(r||!u?.from)?!o&&s?void 0:{from:a,to:void 0}:LQ(a,u,f,p,o,t)}return r&&n&&m?.from&&m.to&&BQ({from:m.from,to:m.to},n,t)&&(m.from=a,m.to=void 0),s||l(m),s?.(m,a,c,d),m},isSelected:e=>u&&wZ(u,e,!1,t)}}function HQ(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=OQ(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t;return{selected:s,select:(e,t,n)=>{let a=e;return!r&&s&&s&&c(e,s)&&(a=void 0),i||o(a),i?.(a,e,t,n),a},isSelected:e=>s?c(s,e):!1}}function UQ(e,t){let n=HQ(e,t),r=IQ(e,t),i=VQ(e,t);switch(e.mode){case`single`:return n;case`multiple`:return r;case`range`:return i;default:return}}function WQ(e,t){return e instanceof PX&&e.timeZone===t?e:new PX(e,t)}function GQ(e,t,n){if(!n)return WQ(e,t);let r=WQ(e,t),i=new PX(r.getFullYear(),r.getMonth(),r.getDate(),12,0,0,t);return new Date(i.getTime())}function KQ(e,t,n){return typeof e==`boolean`||typeof e==`function`?e:e instanceof Date?GQ(e,t,n):Array.isArray(e)?e.map(e=>e instanceof Date?GQ(e,t,n):e):EZ(e)?{...e,from:e.from?WQ(e.from,t):e.from,to:e.to?WQ(e.to,t):e.to}:TZ(e)?{before:GQ(e.before,t,n),after:GQ(e.after,t,n)}:DZ(e)?{after:GQ(e.after,t,n)}:OZ(e)?{before:GQ(e.before,t,n)}:e}function qQ(e,t,n){return e&&(Array.isArray(e)?e.map(e=>KQ(e,t,n)):KQ(e,t,n))}function JQ(e){let t=e,n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&=WQ(t.today,n),t.month&&=WQ(t.month,n),t.defaultMonth&&=WQ(t.defaultMonth,n),t.startMonth&&=WQ(t.startMonth,n),t.endMonth&&=WQ(t.endMonth,n),t.mode===`single`&&t.selected?t.selected=WQ(t.selected,n):t.mode===`multiple`&&t.selected?t.selected=t.selected?.map(e=>WQ(e,n)):t.mode===`range`&&t.selected&&(t.selected={from:t.selected.from?WQ(t.selected.from,n):t.selected.from,to:t.selected.to?WQ(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=qQ(t.disabled,n)),t.hidden!==void 0&&(t.hidden=qQ(t.hidden,n)),t.modifiers)){let e={};Object.keys(t.modifiers).forEach(r=>{e[r]=qQ(t.modifiers?.[r],n)}),t.modifiers=e}let{components:r,formatters:i,labels:a,dateLib:o,locale:s,classNames:c}=(0,Z.useMemo)(()=>{let e={...BX,...t.locale},n=t.broadcastCalendar?1:t.weekStartsOn,r=t.noonSafe&&t.timeZone?dQ(t.timeZone,{weekStartsOn:n,locale:e}):void 0,i=t.dateLib&&r?{...r,...t.dateLib}:t.dateLib??r,a=new VX({locale:e,weekStartsOn:n,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},i);return{dateLib:a,components:PZ(t.components),formatters:GZ(t.formatters),labels:oQ(t.labels,a.options),locale:e,classNames:{...IZ(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:o.today()});let{captionLayout:l,mode:u,navLayout:d,numberOfMonths:f=1,onDayBlur:p,onDayClick:m,onDayFocus:h,onDayKeyDown:g,onDayMouseEnter:_,onDayMouseLeave:v,onNextClick:y,onPrevClick:b,showWeekNumber:x,styles:S}=t,{formatCaption:C,formatDay:w,formatMonthDropdown:T,formatWeekNumber:E,formatWeekNumberHeader:D,formatWeekdayName:O,formatYearDropdown:k}=i,A=kQ(t,o),{days:j,months:M,navStart:N,navEnd:P,previousMonth:F,nextMonth:I,goToMonth:L}=A,R=MZ(j,t,N,P,o),{isSelected:z,select:B,selected:V}=UQ(t,o)??{},{blur:ee,focused:te,isFocusTarget:H,moveFocus:ne,setFocused:re}=FQ(t,A,R,z??(()=>!1),o),{labelDayButton:ie,labelGridcell:U,labelGrid:ae,labelMonthDropdown:oe,labelNav:W,labelPrevious:se,labelNext:ce,labelWeekday:le,labelWeekNumber:ue,labelWeekNumberHeader:de,labelYearDropdown:fe}=a,pe=(0,Z.useMemo)(()=>lQ(o,t.ISOWeek,t.broadcastCalendar,t.today),[o,t.ISOWeek,t.broadcastCalendar,t.today]),me=u!==void 0||m!==void 0,he=(0,Z.useCallback)(()=>{F&&(L(F),b?.(F))},[F,L,b]),ge=(0,Z.useCallback)(()=>{I&&(L(I),y?.(I))},[L,I,y]),_e=(0,Z.useCallback)((e,t)=>n=>{n.preventDefault(),n.stopPropagation(),re(e),!t.disabled&&(B?.(e.date,t,n),m?.(e.date,t,n))},[B,m,re]),ve=(0,Z.useCallback)((e,t)=>n=>{re(e),h?.(e.date,t,n)},[h,re]),ye=(0,Z.useCallback)((e,t)=>n=>{ee(),p?.(e.date,t,n)},[ee,p]),be=(0,Z.useCallback)((e,n)=>r=>{let i={ArrowLeft:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`after`:`before`],ArrowRight:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`before`:`after`],ArrowDown:[r.shiftKey?`year`:`week`,`after`],ArrowUp:[r.shiftKey?`year`:`week`,`before`],PageUp:[r.shiftKey?`year`:`month`,`before`],PageDown:[r.shiftKey?`year`:`month`,`after`],Home:[`startOfWeek`,`before`],End:[`endOfWeek`,`after`]};if(i[r.key]){r.preventDefault(),r.stopPropagation();let[e,t]=i[r.key];ne(e,t)}g?.(e.date,n,r)},[ne,g,t.dir]),xe=(0,Z.useCallback)((e,t)=>n=>{_?.(e.date,t,n)},[_]),Se=(0,Z.useCallback)((e,t)=>n=>{v?.(e.date,t,n)},[v]),Ce=(0,Z.useCallback)((e,t)=>n=>{let r=Number(n.target.value),i=o.setMonth(o.startOfMonth(e),r);L(o.addMonths(i,-t))},[o,L]),we=(0,Z.useCallback)((e,t)=>n=>{let r=Number(n.target.value),i=o.setYear(o.startOfMonth(e),r);L(o.addMonths(i,-t))},[o,L]),{className:Te,style:Ee}=(0,Z.useMemo)(()=>({className:[c[XX.Root],t.className].filter(Boolean).join(` `),style:{...S?.[XX.Root],...t.style}}),[c,t.className,t.style,S]),De=FZ(t),Oe=e=>{let t=S?.[XX.Dropdown],n=S?.[e];if(!(!t&&!n))return{...t,...n}},ke=(0,Z.useRef)(null);vQ(ke,!!t.animate,{classNames:c,months:M,focused:te,dateLib:o});let Ae={dayPickerProps:t,selected:V,select:B,isSelected:z,months:M,nextMonth:I,previousMonth:F,goToMonth:L,getModifiers:R,components:r,classNames:c,styles:S,labels:a,formatters:i};return Z.createElement(eZ.Provider,{value:Ae},Z.createElement(r.Root,{rootRef:t.animate?ke:void 0,className:Te,style:Ee,dir:t.dir,id:t.id,lang:t.lang??s.code,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t[`aria-label`],"aria-labelledby":t[`aria-labelledby`],...De},Z.createElement(r.Months,{className:c[XX.Months],style:S?.[XX.Months]},!t.hideNavigation&&!d&&Z.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[XX.Nav],style:S?.[XX.Nav],"aria-label":W(),onPreviousClick:he,onNextClick:ge,previousMonth:F,nextMonth:I}),M.map((e,n)=>{let a=t.reverseMonths?M.length-1-n:n;return Z.createElement(r.Month,{"data-animated-month":t.animate?`true`:void 0,className:c[XX.Month],style:S?.[XX.Month],key:n,displayIndex:n,calendarMonth:e},d===`around`&&!t.hideNavigation&&n===0&&Z.createElement(r.PreviousMonthButton,{type:`button`,className:c[XX.PreviousMonthButton],style:S?.[XX.PreviousMonthButton],tabIndex:F?void 0:-1,"aria-disabled":!F||void 0,"aria-label":se(F),onClick:he,"data-animated-button":t.animate?`true`:void 0},Z.createElement(r.Chevron,{disabled:!F||void 0,className:c[XX.Chevron],style:S?.[XX.Chevron],orientation:t.dir===`rtl`?`right`:`left`})),Z.createElement(r.MonthCaption,{"data-animated-caption":t.animate?`true`:void 0,className:c[XX.MonthCaption],style:S?.[XX.MonthCaption],calendarMonth:e,displayIndex:n},l?.startsWith(`dropdown`)?Z.createElement(r.DropdownNav,{className:c[XX.Dropdowns],style:S?.[XX.Dropdowns]},(()=>{let n=l===`dropdown`||l===`dropdown-months`?Z.createElement(r.MonthsDropdown,{key:`month`,className:c[XX.MonthsDropdown],"aria-label":oe(),disabled:!!t.disableNavigation,onChange:Ce(e.date,a),options:sQ(e.date,N,P,i,o),style:Oe(XX.MonthsDropdown),value:o.getMonth(e.date)}):Z.createElement(`span`,{key:`month`},T(e.date,o)),s=l===`dropdown`||l===`dropdown-years`?Z.createElement(r.YearsDropdown,{key:`year`,className:c[XX.YearsDropdown],"aria-label":fe(o.options),disabled:!!t.disableNavigation,onChange:we(e.date,a),options:uQ(N,P,i,o,!!t.reverseYears),style:Oe(XX.YearsDropdown),value:o.getYear(e.date)}):Z.createElement(`span`,{key:`year`},k(e.date,o));return o.getMonthYearOrder()===`year-first`?[s,n]:[n,s]})(),Z.createElement(`span`,{role:`status`,"aria-live":`polite`,style:{border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`,wordWrap:`normal`}},C(e.date,o.options,o))):Z.createElement(r.CaptionLabel,{className:c[XX.CaptionLabel],style:S?.[XX.CaptionLabel],role:`status`,"aria-live":`polite`},C(e.date,o.options,o))),d===`around`&&!t.hideNavigation&&n===f-1&&Z.createElement(r.NextMonthButton,{type:`button`,className:c[XX.NextMonthButton],style:S?.[XX.NextMonthButton],tabIndex:I?void 0:-1,"aria-disabled":!I||void 0,"aria-label":ce(I),onClick:ge,"data-animated-button":t.animate?`true`:void 0},Z.createElement(r.Chevron,{disabled:!I||void 0,className:c[XX.Chevron],style:S?.[XX.Chevron],orientation:t.dir===`rtl`?`left`:`right`})),n===f-1&&d===`after`&&!t.hideNavigation&&Z.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[XX.Nav],style:S?.[XX.Nav],"aria-label":W(),onPreviousClick:he,onNextClick:ge,previousMonth:F,nextMonth:I}),Z.createElement(r.MonthGrid,{role:`grid`,"aria-multiselectable":u===`multiple`||u===`range`,"aria-label":ae(e.date,o.options,o)||void 0,className:c[XX.MonthGrid],style:S?.[XX.MonthGrid]},!t.hideWeekdays&&Z.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?`true`:void 0,className:c[XX.Weekdays],style:S?.[XX.Weekdays]},x&&Z.createElement(r.WeekNumberHeader,{"aria-label":de(o.options),className:c[XX.WeekNumberHeader],style:S?.[XX.WeekNumberHeader],scope:`col`},D()),pe.map(e=>Z.createElement(r.Weekday,{"aria-label":le(e,o.options,o),className:c[XX.Weekday],key:String(e),style:S?.[XX.Weekday],scope:`col`},O(e,o.options,o)))),Z.createElement(r.Weeks,{"data-animated-weeks":t.animate?`true`:void 0,className:c[XX.Weeks],style:S?.[XX.Weeks]},e.weeks.map(e=>Z.createElement(r.Week,{className:c[XX.Week],key:e.weekNumber,style:S?.[XX.Week],week:e},x&&Z.createElement(r.WeekNumber,{week:e,style:S?.[XX.WeekNumber],"aria-label":ue(e.weekNumber,{locale:s}),className:c[XX.WeekNumber],scope:`row`,role:`rowheader`},E(e.weekNumber,o)),e.days.map(e=>{let{date:n}=e,i=R(e);if(i[ZX.focused]=!i.hidden&&!!te?.isEqualTo(e),i[QX.selected]=z?.(n)||i.selected,EZ(V)){let{from:e,to:t}=V;i[QX.range_start]=!!(e&&t&&o.isSameDay(n,e)),i[QX.range_end]=!!(e&&t&&o.isSameDay(n,t)),i[QX.range_middle]=wZ(V,n,!0,o)}let a=cQ(i,S,t.modifiersStyles),s=NZ(i,c,t.modifiersClassNames),l=!me&&!i.hidden?U(n,i,o.options,o):void 0;return Z.createElement(r.Day,{key:`${e.isoDate}_${e.displayMonthId}`,day:e,modifiers:i,className:s.join(` `),style:a,role:`gridcell`,"aria-selected":i.selected||void 0,"aria-label":l,"data-day":e.isoDate,"data-month":e.outside?e.dateMonthId:void 0,"data-selected":i.selected||void 0,"data-disabled":i.disabled||void 0,"data-hidden":i.hidden||void 0,"data-outside":e.outside||void 0,"data-focused":i.focused||void 0,"data-today":i.today||void 0},!i.hidden&&me?Z.createElement(r.DayButton,{className:c[XX.DayButton],style:S?.[XX.DayButton],type:`button`,day:e,modifiers:i,disabled:!i.focused&&i.disabled||void 0,"aria-disabled":i.focused&&i.disabled||void 0,tabIndex:H(e)?0:-1,"aria-label":ie(n,i,o.options,o),onClick:_e(e,i),onBlur:ye(e,i),onFocus:ve(e,i),onKeyDown:be(e,i),onMouseEnter:xe(e,i),onMouseLeave:Se(e,i)},w(n,o.options,o)):!i.hidden&&w(e.date,o.options,o))}))))))})),t.footer&&Z.createElement(r.Footer,{className:c[XX.Footer],style:S?.[XX.Footer],role:`status`,"aria-live":`polite`},t.footer)))}function YQ({className:e,classNames:t,showOutsideDays:n=!0,captionLayout:r=`label`,buttonVariant:i=`ghost`,formatters:a,components:o,...c}){let l=IZ();return(0,Q.jsx)(JQ,{showOutsideDays:n,className:s(`bg-white group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent dark:bg-gray-950`,String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:r,formatters:{formatMonthDropdown:e=>e.toLocaleString(`default`,{month:`short`}),...a},classNames:{root:s(`w-fit`,l.root),months:s(`flex gap-4 flex-col md:flex-row relative`,l.months),month:s(`flex flex-col w-full gap-4`,l.month),nav:s(`flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between`,l.nav),button_previous:s(qn({variant:i}),`size-(--cell-size) aria-disabled:opacity-50 p-0 select-none`,l.button_previous),button_next:s(qn({variant:i}),`size-(--cell-size) aria-disabled:opacity-50 p-0 select-none`,l.button_next),month_caption:s(`flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)`,l.month_caption),dropdowns:s(`w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5`,l.dropdowns),dropdown_root:s(`relative has-focus:border-gray-950 border border-gray-200 shadow-xs has-focus:ring-gray-950/50 has-focus:ring-[3px] rounded-md dark:has-focus:border-gray-300 dark:border-gray-800 dark:has-focus:ring-gray-300/50`,l.dropdown_root),dropdown:s(`absolute bg-white inset-0 opacity-0 dark:bg-gray-950`,l.dropdown),caption_label:s(`select-none font-medium`,r===`label`?`text-sm`:`rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-gray-500 [&>svg]:size-3.5 dark:[&>svg]:text-gray-400`,l.caption_label),month_grid:`w-full border-collapse`,weekdays:s(`flex`,l.weekdays),weekday:s(`text-gray-500 rounded-md flex-1 font-normal text-[0.8rem] select-none dark:text-gray-400`,l.weekday),week:s(`flex w-full mt-2`,l.week),week_number_header:s(`select-none w-(--cell-size)`,l.week_number_header),week_number:s(`text-[0.8rem] select-none text-gray-500 dark:text-gray-400`,l.week_number),day:s(`relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none`,l.day),range_start:s(`rounded-l-md bg-gray-100 dark:bg-gray-800`,l.range_start),range_middle:s(`rounded-none`,l.range_middle),range_end:s(`rounded-r-md bg-gray-100 dark:bg-gray-800`,l.range_end),today:s(`bg-gray-100 text-gray-900 rounded-md data-[selected=true]:rounded-none dark:bg-gray-800 dark:text-gray-50`,l.today),outside:s(`text-gray-500 aria-selected:text-gray-500 dark:text-gray-400 dark:aria-selected:text-gray-400`,l.outside),disabled:s(`text-gray-500 opacity-50 dark:text-gray-400`,l.disabled),hidden:s(`invisible`,l.hidden),...t},components:{Root:({className:e,rootRef:t,...n})=>(0,Q.jsx)(`div`,{"data-slot":`calendar`,ref:t,className:s(e),...n}),Chevron:({className:e,orientation:t,...n})=>t===`left`?(0,Q.jsx)(Ni,{className:s(`size-4`,e),...n}):t===`right`?(0,Q.jsx)(en,{className:s(`size-4`,e),...n}):(0,Q.jsx)(_n,{className:s(`size-4`,e),...n}),DayButton:XQ,WeekNumber:({week:e,...t})=>(0,Q.jsx)(`td`,{...t,children:(0,Q.jsx)(`div`,{className:`flex size-(--cell-size) items-center justify-center text-center`,children:e.weekNumber})}),...o},...c})}function XQ({className:e,day:t,modifiers:n,...r}){let i=IZ(),a=Z.useRef(null);return Z.useEffect(()=>{n.focused&&a.current?.focus()},[n.focused]),(0,Q.jsx)(q,{ref:a,variant:`ghost`,size:`icon`,"data-day":t.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:s(`data-[selected-single=true]:bg-gray-900 data-[selected-single=true]:text-gray-50 data-[range-middle=true]:bg-gray-100 data-[range-middle=true]:text-gray-900 data-[range-start=true]:bg-gray-900 data-[range-start=true]:text-gray-50 data-[range-end=true]:bg-gray-900 data-[range-end=true]:text-gray-50 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-gray-900 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70 dark:data-[selected-single=true]:bg-gray-50 dark:data-[selected-single=true]:text-gray-900 dark:data-[range-middle=true]:bg-gray-800 dark:data-[range-middle=true]:text-gray-50 dark:data-[range-start=true]:bg-gray-50 dark:data-[range-start=true]:text-gray-900 dark:data-[range-end=true]:bg-gray-50 dark:data-[range-end=true]:text-gray-900 dark:dark:hover:text-gray-50`,i.day,e),...r})}function ZQ(e){if(wl.test(e))return e}function QQ(e){let[t,n,r]=e.split(`-`).map(Number);return new Date(t,n-1,r)}function $Q({value:e,onChange:t,disabled:n,id:r,...i}){let a=Z.useId(),o=r??a,[s,c]=Z.useState(!1),[l,u]=Z.useState(e),[d,f]=Z.useState(l?QQ(l):void 0),[p,m]=Z.useState(l??``),h=p.trim()!==``&&!ZQ(p),g=`${o}-date-format-error`,_=[typeof i[`aria-describedby`]==`string`?i[`aria-describedby`]:void 0,h?g:void 0].filter(Boolean).join(` `);return(0,Z.useEffect)(()=>{u(t=>(e??null)===(t??null)?t:(f(e?QQ(e):void 0),m(e??``),e))},[e]),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsxs)(Rn,{children:[(0,Q.jsx)(kn,{...i,disabled:n,id:o,value:p,placeholder:`Select date`,"aria-invalid":h,"aria-describedby":_||void 0,onChange:e=>{let n=e.target.value;if(m(n),n.trim()===``){u(void 0),t?.(null);return}let r=ZQ(n);r&&(u(r),f(r?QQ(r):void 0),t?.(r))},onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),c(!0))}}),(0,Q.jsx)(Bn,{align:`inline-end`,children:(0,Q.jsxs)(fX,{open:s,onOpenChange:c,children:[(0,Q.jsx)(pX,{asChild:!0,children:(0,Q.jsxs)(Fn,{variant:`ghost`,size:`icon-xs`,"aria-label":`Select date`,children:[(0,Q.jsx)(Mi,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Select date`})]})}),(0,Q.jsx)(mX,{className:`w-auto overflow-hidden p-0`,align:`end`,alignOffset:-8,sideOffset:10,children:(0,Q.jsx)(YQ,{mode:`single`,selected:l?QQ(l):void 0,month:d,onMonthChange:f,onSelect:e=>{let n=e?dr(e,`yyyy-MM-dd`):void 0;m(n??``),u(n),t?.(n??null),c(!1)}})})]})})]}),h?(0,Q.jsx)(`p`,{id:g,className:`text-destructive text-xs`,children:`Date must use YYYY-MM-DD format.`}):null]})}var e$=`yyyy-MM-dd HH:mm:ss`,t$=/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/;function n$(e){if(!t$.test(e))return;let t=rl(e,e$,new Date);return ri(t)?t:void 0}function r$({value:e,onChange:t,disabled:n,id:r,...i}){let a=Z.useId(),o=r??a,[s,c]=Z.useState(!1),[l,u]=Z.useState(e??void 0),[d,f]=Z.useState(e?dr(e,e$):``),p=d.trim()!==``&&!n$(d),m=`${o}-datetime-format-error`;return(0,Z.useEffect)(()=>{f(e?dr(e,e$):``),e&&u(e)},[e]),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsxs)(Rn,{children:[(0,Q.jsx)(kn,{...i,disabled:n,id:o,value:d,placeholder:`YYYY-MM-DD HH:mm:ss`,"aria-invalid":p||void 0,"aria-describedby":p?m:void 0,onChange:e=>{let n=e.target.value;if(f(n),n.trim()===``){t?.(null);return}let r=n$(n);r&&(u(r),t?.(r))},onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),c(!0))}}),(0,Q.jsx)(Bn,{align:`inline-end`,children:(0,Q.jsxs)(fX,{open:s,onOpenChange:c,children:[(0,Q.jsx)(pX,{asChild:!0,children:(0,Q.jsxs)(Fn,{variant:`ghost`,size:`icon-xs`,"aria-label":`Select date and time`,children:[(0,Q.jsx)(Mi,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Select date and time`})]})}),(0,Q.jsxs)(mX,{className:`w-auto overflow-hidden p-0`,align:`end`,alignOffset:-8,sideOffset:10,children:[(0,Q.jsx)(YQ,{mode:`single`,selected:e??void 0,month:l,onMonthChange:u,onSelect:n=>{if(!n){t?.(null),c(!1);return}let r=e??Pr(new Date),i=new Date(n.getFullYear(),n.getMonth(),n.getDate(),r.getHours(),r.getMinutes(),r.getSeconds());f(dr(i,e$)),u(i),t?.(i),c(!1)}}),(0,Q.jsxs)(`div`,{className:`flex gap-2 border-t p-2`,children:[(0,Q.jsx)(i$,{label:`Hours`,value:e?e.getHours():0,max:23,onChange:n=>{let r=e??Pr(new Date),i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),n,r.getMinutes(),r.getSeconds());f(dr(i,e$)),t?.(i)}}),(0,Q.jsx)(i$,{label:`Minutes`,value:e?e.getMinutes():0,max:59,onChange:n=>{let r=e??Pr(new Date),i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),n,r.getSeconds());f(dr(i,e$)),t?.(i)}}),(0,Q.jsx)(i$,{label:`Seconds`,value:e?e.getSeconds():0,max:59,onChange:n=>{let r=e??Pr(new Date),i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),n);f(dr(i,e$)),t?.(i)}})]})]})]})})]}),p?(0,Q.jsx)(`p`,{id:m,className:`text-destructive text-xs`,children:`Date must use YYYY-MM-DD HH:mm:ss format.`}):null]})}function i$({label:e,value:t,max:n,onChange:r}){return(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e}),(0,Q.jsx)(`input`,{type:`number`,min:0,max:n,value:t,onChange:e=>{let t=parseInt(e.target.value,10);!Number.isNaN(t)&&t>=0&&t<=n&&r(t)},className:`w-12 rounded border px-1 py-0.5 text-center text-sm`})]})}var a$=n(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),o$=n(((e,t)=>{var n=a$();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),s$=n(((e,t)=>{t.exports=o$()()})),c$=new Map([[`aac`,`audio/aac`],[`abw`,`application/x-abiword`],[`arc`,`application/x-freearc`],[`avif`,`image/avif`],[`avi`,`video/x-msvideo`],[`azw`,`application/vnd.amazon.ebook`],[`bin`,`application/octet-stream`],[`bmp`,`image/bmp`],[`bz`,`application/x-bzip`],[`bz2`,`application/x-bzip2`],[`cda`,`application/x-cdf`],[`csh`,`application/x-csh`],[`css`,`text/css`],[`csv`,`text/csv`],[`doc`,`application/msword`],[`docx`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`],[`eot`,`application/vnd.ms-fontobject`],[`epub`,`application/epub+zip`],[`gz`,`application/gzip`],[`gif`,`image/gif`],[`heic`,`image/heic`],[`heif`,`image/heif`],[`htm`,`text/html`],[`html`,`text/html`],[`ico`,`image/vnd.microsoft.icon`],[`ics`,`text/calendar`],[`jar`,`application/java-archive`],[`jpeg`,`image/jpeg`],[`jpg`,`image/jpeg`],[`js`,`text/javascript`],[`json`,`application/json`],[`jsonld`,`application/ld+json`],[`mid`,`audio/midi`],[`midi`,`audio/midi`],[`mjs`,`text/javascript`],[`mp3`,`audio/mpeg`],[`mp4`,`video/mp4`],[`mpeg`,`video/mpeg`],[`mpkg`,`application/vnd.apple.installer+xml`],[`odp`,`application/vnd.oasis.opendocument.presentation`],[`ods`,`application/vnd.oasis.opendocument.spreadsheet`],[`odt`,`application/vnd.oasis.opendocument.text`],[`oga`,`audio/ogg`],[`ogv`,`video/ogg`],[`ogx`,`application/ogg`],[`opus`,`audio/opus`],[`otf`,`font/otf`],[`png`,`image/png`],[`pdf`,`application/pdf`],[`php`,`application/x-httpd-php`],[`ppt`,`application/vnd.ms-powerpoint`],[`pptx`,`application/vnd.openxmlformats-officedocument.presentationml.presentation`],[`rar`,`application/vnd.rar`],[`rtf`,`application/rtf`],[`sh`,`application/x-sh`],[`svg`,`image/svg+xml`],[`swf`,`application/x-shockwave-flash`],[`tar`,`application/x-tar`],[`tif`,`image/tiff`],[`tiff`,`image/tiff`],[`ts`,`video/mp2t`],[`ttf`,`font/ttf`],[`txt`,`text/plain`],[`vsd`,`application/vnd.visio`],[`wav`,`audio/wav`],[`weba`,`audio/webm`],[`webm`,`video/webm`],[`webp`,`image/webp`],[`woff`,`font/woff`],[`woff2`,`font/woff2`],[`xhtml`,`application/xhtml+xml`],[`xls`,`application/vnd.ms-excel`],[`xlsx`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`],[`xml`,`application/xml`],[`xul`,`application/vnd.mozilla.xul+xml`],[`zip`,`application/zip`],[`7z`,`application/x-7z-compressed`],[`mkv`,`video/x-matroska`],[`mov`,`video/quicktime`],[`msg`,`application/vnd.ms-outlook`]]);function l$(e,t){var n=u$(e);if(typeof n.path!=`string`){var r=e.webkitRelativePath;Object.defineProperty(n,"path",{value:typeof t==`string`?t:typeof r==`string`&&r.length>0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function u$(e){var t=e.name;if(t&&t.lastIndexOf(`.`)!==-1&&!e.type){var n=t.split(`.`).pop().toLowerCase(),r=c$.get(n);r&&Object.defineProperty(e,"type",{value:r,writable:!1,configurable:!1,enumerable:!0})}return e}var d$=[`.DS_Store`,`Thumbs.db`];function f$(e){return Ut(this,void 0,void 0,function(){return kt(this,function(t){return h$(e)&&p$(e.dataTransfer)?[2,v$(e.dataTransfer,e.type)]:m$(e)?[2,g$(e)]:Array.isArray(e)&&e.every(function(e){return`getFile`in e&&typeof e.getFile==`function`})?[2,_$(e)]:[2,[]]})})}function p$(e){return h$(e)}function m$(e){return h$(e)&&h$(e.target)}function h$(e){return typeof e==`object`&&!!e}function g$(e){return b$(e.target.files).map(function(e){return l$(e)})}function _$(e){return Ut(this,void 0,void 0,function(){var t;return kt(this,function(n){switch(n.label){case 0:return[4,Promise.all(e.map(function(e){return e.getFile()}))];case 1:return t=n.sent(),[2,t.map(function(e){return l$(e)})]}})})}function v$(e,t){return Ut(this,void 0,void 0,function(){var n,r;return kt(this,function(i){switch(i.label){case 0:return e.items?(n=b$(e.items).filter(function(e){return e.kind===`file`}),t===`drop`?[4,Promise.all(n.map(x$))]:[2,n]):[3,2];case 1:return r=i.sent(),[2,y$(S$(r))];case 2:return[2,y$(b$(e.files).map(function(e){return l$(e)}))]}})})}function y$(e){return e.filter(function(e){return d$.indexOf(e.name)===-1})}function b$(e){if(e===null)return[];for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r)}return t}function x$(e){if(typeof e.webkitGetAsEntry!=`function`)return C$(e);var t=e.webkitGetAsEntry();return t&&t.isDirectory?T$(t):C$(e)}function S$(e){return e.reduce(function(e,t){return Wt(Wt([],Ht(e),!1),Ht(Array.isArray(t)?S$(t):[t]),!1)},[])}function C$(e){var t=e.getAsFile();if(!t)return Promise.reject(`${e} is not a File`);var n=l$(t);return Promise.resolve(n)}function w$(e){return Ut(this,void 0,void 0,function(){return kt(this,function(t){return[2,e.isDirectory?T$(e):E$(e)]})})}function T$(e){var t=e.createReader();return new Promise(function(e,n){var r=[];function i(){var a=this;t.readEntries(function(t){return Ut(a,void 0,void 0,function(){var a,o,s;return kt(this,function(c){switch(c.label){case 0:if(t.length)return[3,5];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,Promise.all(r)];case 2:return a=c.sent(),e(a),[3,4];case 3:return o=c.sent(),n(o),[3,4];case 4:return[3,6];case 5:s=Promise.all(t.map(w$)),r.push(s),i(),c.label=6;case 6:return[2]}})})},function(e){n(e)})}i()})}function E$(e){return Ut(this,void 0,void 0,function(){return kt(this,function(t){return[2,new Promise(function(t,n){e.file(function(n){t(l$(n,e.fullPath))},function(e){n(e)})})]})})}var D$=r(n((e=>{e.__esModule=!0,e.default=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(`,`);if(n.length===0)return!0;var r=e.name||``,i=(e.type||``).toLowerCase(),a=i.replace(/\/.*$/,``);return n.some(function(e){var t=e.trim().toLowerCase();return t.charAt(0)===`.`?r.toLowerCase().endsWith(t):t.endsWith(`/*`)?a===t.replace(/\/.*$/,``):i===t})}return!0}}))());function O$(e){return j$(e)||A$(e)||L$(e)||k$()}function k$(){throw TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function A$(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function j$(e){if(Array.isArray(e))return R$(e)}function M$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function N$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?M$(Object(n),!0).forEach(function(t){P$(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M$(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function P$(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F$(e,t){return B$(e)||z$(e,t)||L$(e,t)||I$()}function I$(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function L$(e,t){if(e){if(typeof e==`string`)return R$(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return R$(e,t)}}function R$(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function z$(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function B$(e){if(Array.isArray(e))return e}var V$=`file-invalid-type`,H$=`file-too-large`,U$=`file-too-small`,W$=`too-many-files`,G$=function(e){return e=Array.isArray(e)&&e.length===1?e[0]:e,{code:V$,message:`File type must be ${Array.isArray(e)?`one of ${e.join(`, `)}`:e}`}},K$=function(e){return{code:H$,message:`File is larger than ${e} ${e===1?`byte`:`bytes`}`}},q$=function(e){return{code:U$,message:`File is smaller than ${e} ${e===1?`byte`:`bytes`}`}},J$={code:W$,message:`Too many files`};function Y$(e,t){var n=e.type===`application/x-moz-file`||(0,D$.default)(e,t);return[n,n?null:G$(t)]}function X$(e,t,n){if(Z$(e.size)){if(Z$(t)&&Z$(n)){if(e.size>n)return[!1,K$(n)];if(e.size<t)return[!1,q$(t)]}else if(Z$(t)&&e.size<t)return[!1,q$(t)];else if(Z$(n)&&e.size>n)return[!1,K$(n)]}return[!0,null]}function Z$(e){return e!=null}function Q$(e){var t=e.files,n=e.accept,r=e.minSize,i=e.maxSize,a=e.multiple,o=e.maxFiles,s=e.validator;return!a&&t.length>1||a&&o>=1&&t.length>o?!1:t.every(function(e){var t=F$(Y$(e,n),1)[0],a=F$(X$(e,r,i),1)[0],o=s?s(e):null;return t&&a&&!o})}function $$(e){return typeof e.isPropagationStopped==`function`?e.isPropagationStopped():e.cancelBubble!==void 0&&e.cancelBubble}function e1(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(e){return e===`Files`||e===`application/x-moz-file`}):!!e.target&&!!e.target.files}function t1(e){e.preventDefault()}function n1(e){return e.indexOf(`MSIE`)!==-1||e.indexOf(`Trident/`)!==-1}function r1(e){return e.indexOf(`Edge/`)!==-1}function i1(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return n1(e)||r1(e)}function a1(){var e=[...arguments];return function(t){var n=[...arguments].slice(1);return e.some(function(e){return!$$(t)&&e&&e.apply(void 0,[t].concat(n)),$$(t)})}}function o1(){return`showOpenFilePicker`in window}function s1(e){return Z$(e)?[{description:`Files`,accept:Object.entries(e).filter(function(e){var t=F$(e,2),n=t[0],r=t[1],i=!0;return d1(n)||(console.warn(`Skipped "${n}" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.`),i=!1),(!Array.isArray(r)||!r.every(f1))&&(console.warn(`Skipped "${n}" because an invalid file extension was provided.`),i=!1),i}).reduce(function(e,t){var n=F$(t,2),r=n[0],i=n[1];return N$(N$({},e),{},P$({},r,i))},{})}]:e}function c1(e){if(Z$(e))return Object.entries(e).reduce(function(e,t){var n=F$(t,2),r=n[0],i=n[1];return[].concat(O$(e),[r],O$(i))},[]).filter(function(e){return d1(e)||f1(e)}).join(`,`)}function l1(e){return e instanceof DOMException&&(e.name===`AbortError`||e.code===e.ABORT_ERR)}function u1(e){return e instanceof DOMException&&(e.name===`SecurityError`||e.code===e.SECURITY_ERR)}function d1(e){return e===`audio/*`||e===`video/*`||e===`image/*`||e===`text/*`||/\w+\/[-+.\w]+/g.test(e)}function f1(e){return/^.*\.[\w]+$/.test(e)}var p1=r(s$()),m1=[`children`],h1=[`open`],g1=[`refKey`,`role`,`onKeyDown`,`onFocus`,`onBlur`,`onClick`,`onDragEnter`,`onDragOver`,`onDragLeave`,`onDrop`],_1=[`refKey`,`onChange`,`onClick`];function v1(e){return x1(e)||b1(e)||w1(e)||y1()}function y1(){throw TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b1(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function x1(e){if(Array.isArray(e))return T1(e)}function S1(e,t){return D1(e)||E1(e,t)||w1(e,t)||C1()}function C1(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w1(e,t){if(e){if(typeof e==`string`)return T1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return T1(e,t)}}function T1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function E1(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function D1(e){if(Array.isArray(e))return e}function O1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function k1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?O1(Object(n),!0).forEach(function(t){A1(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O1(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function A1(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j1(e,t){if(e==null)return{};var n=M1(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function M1(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var N1=(0,Z.forwardRef)(function(e,t){var n=e.children,r=I1(j1(e,m1)),i=r.open,a=j1(r,h1);return(0,Z.useImperativeHandle)(t,function(){return{open:i}},[i]),Z.createElement(Z.Fragment,null,n(k1(k1({},a),{},{open:i})))});N1.displayName=`Dropzone`;var P1={disabled:!1,getFilesFromEvent:f$,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0,autoFocus:!1};N1.defaultProps=P1,N1.propTypes={children:p1.default.func,accept:p1.default.objectOf(p1.default.arrayOf(p1.default.string)),multiple:p1.default.bool,preventDropOnDocument:p1.default.bool,noClick:p1.default.bool,noKeyboard:p1.default.bool,noDrag:p1.default.bool,noDragEventsBubbling:p1.default.bool,minSize:p1.default.number,maxSize:p1.default.number,maxFiles:p1.default.number,disabled:p1.default.bool,getFilesFromEvent:p1.default.func,onFileDialogCancel:p1.default.func,onFileDialogOpen:p1.default.func,useFsAccessApi:p1.default.bool,autoFocus:p1.default.bool,onDragEnter:p1.default.func,onDragLeave:p1.default.func,onDragOver:p1.default.func,onDrop:p1.default.func,onDropAccepted:p1.default.func,onDropRejected:p1.default.func,onError:p1.default.func,validator:p1.default.func};var F1={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function I1(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=k1(k1({},P1),e),n=t.accept,r=t.disabled,i=t.getFilesFromEvent,a=t.maxSize,o=t.minSize,s=t.multiple,c=t.maxFiles,l=t.onDragEnter,u=t.onDragLeave,d=t.onDragOver,f=t.onDrop,p=t.onDropAccepted,m=t.onDropRejected,h=t.onFileDialogCancel,g=t.onFileDialogOpen,_=t.useFsAccessApi,v=t.autoFocus,y=t.preventDropOnDocument,b=t.noClick,x=t.noKeyboard,S=t.noDrag,C=t.noDragEventsBubbling,w=t.onError,T=t.validator,E=(0,Z.useMemo)(function(){return c1(n)},[n]),D=(0,Z.useMemo)(function(){return s1(n)},[n]),O=(0,Z.useMemo)(function(){return typeof g==`function`?g:R1},[g]),k=(0,Z.useMemo)(function(){return typeof h==`function`?h:R1},[h]),A=(0,Z.useRef)(null),j=(0,Z.useRef)(null),M=S1((0,Z.useReducer)(L1,F1),2),N=M[0],P=M[1],F=N.isFocused,I=N.isFileDialogActive,L=(0,Z.useRef)(typeof window<`u`&&window.isSecureContext&&_&&o1()),R=function(){!L.current&&I&&setTimeout(function(){j.current&&(j.current.files.length||(P({type:`closeDialog`}),k()))},300)};(0,Z.useEffect)(function(){return window.addEventListener(`focus`,R,!1),function(){window.removeEventListener(`focus`,R,!1)}},[j,I,k,L]);var z=(0,Z.useRef)([]),B=function(e){A.current&&A.current.contains(e.target)||(e.preventDefault(),z.current=[])};(0,Z.useEffect)(function(){return y&&(document.addEventListener(`dragover`,t1,!1),document.addEventListener(`drop`,B,!1)),function(){y&&(document.removeEventListener(`dragover`,t1),document.removeEventListener(`drop`,B))}},[A,y]),(0,Z.useEffect)(function(){return!r&&v&&A.current&&A.current.focus(),function(){}},[A,v,r]);var V=(0,Z.useCallback)(function(e){w?w(e):console.error(e)},[w]),ee=(0,Z.useCallback)(function(e){e.preventDefault(),e.persist(),ue(e),z.current=[].concat(v1(z.current),[e.target]),e1(e)&&Promise.resolve(i(e)).then(function(t){if(!($$(e)&&!C)){var n=t.length,r=n>0&&Q$({files:t,accept:E,minSize:o,maxSize:a,multiple:s,maxFiles:c,validator:T});P({isDragAccept:r,isDragReject:n>0&&!r,isDragActive:!0,type:`setDraggedFiles`}),l&&l(e)}}).catch(function(e){return V(e)})},[i,l,V,C,E,o,a,s,c,T]),te=(0,Z.useCallback)(function(e){e.preventDefault(),e.persist(),ue(e);var t=e1(e);if(t&&e.dataTransfer)try{e.dataTransfer.dropEffect=`copy`}catch{}return t&&d&&d(e),!1},[d,C]),H=(0,Z.useCallback)(function(e){e.preventDefault(),e.persist(),ue(e);var t=z.current.filter(function(e){return A.current&&A.current.contains(e)}),n=t.indexOf(e.target);n!==-1&&t.splice(n,1),z.current=t,!(t.length>0)&&(P({type:`setDraggedFiles`,isDragActive:!1,isDragAccept:!1,isDragReject:!1}),e1(e)&&u&&u(e))},[A,u,C]),ne=(0,Z.useCallback)(function(e,t){var n=[],r=[];e.forEach(function(e){var t=S1(Y$(e,E),2),i=t[0],s=t[1],c=S1(X$(e,o,a),2),l=c[0],u=c[1],d=T?T(e):null;if(i&&l&&!d)n.push(e);else{var f=[s,u];d&&(f=f.concat(d)),r.push({file:e,errors:f.filter(function(e){return e})})}}),(!s&&n.length>1||s&&c>=1&&n.length>c)&&(n.forEach(function(e){r.push({file:e,errors:[J$]})}),n.splice(0)),P({acceptedFiles:n,fileRejections:r,type:`setFiles`}),f&&f(n,r,t),r.length>0&&m&&m(r,t),n.length>0&&p&&p(n,t)},[P,s,E,o,a,c,f,p,m,T]),re=(0,Z.useCallback)(function(e){e.preventDefault(),e.persist(),ue(e),z.current=[],e1(e)&&Promise.resolve(i(e)).then(function(t){$$(e)&&!C||ne(t,e)}).catch(function(e){return V(e)}),P({type:`reset`})},[i,ne,V,C]),ie=(0,Z.useCallback)(function(){if(L.current){P({type:`openDialog`}),O();var e={multiple:s,types:D};window.showOpenFilePicker(e).then(function(e){return i(e)}).then(function(e){ne(e,null),P({type:`closeDialog`})}).catch(function(e){l1(e)?(k(e),P({type:`closeDialog`})):u1(e)?(L.current=!1,j.current?(j.current.value=null,j.current.click()):V(Error(`Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided.`))):V(e)});return}j.current&&(P({type:`openDialog`}),O(),j.current.value=null,j.current.click())},[P,O,k,_,ne,V,D,s]),U=(0,Z.useCallback)(function(e){!A.current||!A.current.isEqualNode(e.target)||(e.key===` `||e.key===`Enter`||e.keyCode===32||e.keyCode===13)&&(e.preventDefault(),ie())},[A,ie]),ae=(0,Z.useCallback)(function(){P({type:`focus`})},[]),oe=(0,Z.useCallback)(function(){P({type:`blur`})},[]),W=(0,Z.useCallback)(function(){b||(i1()?setTimeout(ie,0):ie())},[b,ie]),se=function(e){return r?null:e},ce=function(e){return x?null:se(e)},le=function(e){return S?null:se(e)},ue=function(e){C&&e.stopPropagation()},de=(0,Z.useMemo)(function(){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.refKey,n=t===void 0?`ref`:t,i=e.role,a=e.onKeyDown,o=e.onFocus,s=e.onBlur,c=e.onClick,l=e.onDragEnter,u=e.onDragOver,d=e.onDragLeave,f=e.onDrop,p=j1(e,g1);return k1(k1(A1({onKeyDown:ce(a1(a,U)),onFocus:ce(a1(o,ae)),onBlur:ce(a1(s,oe)),onClick:se(a1(c,W)),onDragEnter:le(a1(l,ee)),onDragOver:le(a1(u,te)),onDragLeave:le(a1(d,H)),onDrop:le(a1(f,re)),role:typeof i==`string`&&i!==``?i:`presentation`},n,A),!r&&!x?{tabIndex:0}:{}),p)}},[A,U,ae,oe,W,ee,te,H,re,x,S,r]),fe=(0,Z.useCallback)(function(e){e.stopPropagation()},[]),pe=(0,Z.useMemo)(function(){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.refKey,n=t===void 0?`ref`:t,r=e.onChange,i=e.onClick,a=j1(e,_1);return k1(k1({},A1({accept:E,multiple:s,type:`file`,style:{display:`none`},onChange:se(a1(r,re)),onClick:se(a1(i,fe)),tabIndex:-1},n,j)),a)}},[j,n,s,re,r]);return k1(k1({},N),{},{isFocused:F&&!r,getRootProps:de,getInputProps:pe,rootRef:A,inputRef:j,open:se(ie)})}function L1(e,t){switch(t.type){case`focus`:return k1(k1({},e),{},{isFocused:!0});case`blur`:return k1(k1({},e),{},{isFocused:!1});case`openDialog`:return k1(k1({},F1),{},{isFileDialogActive:!0});case`closeDialog`:return k1(k1({},e),{},{isFileDialogActive:!1});case`setDraggedFiles`:return k1(k1({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case`setFiles`:return k1(k1({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case`reset`:return k1({},F1);default:return e}}function R1(){}var[z1,B1]=vu(`Dropzone component was not found in tree`),V1=Object.getOwnPropertySymbols,H1=Object.prototype.hasOwnProperty,U1=Object.prototype.propertyIsEnumerable,W1=(e,t)=>{var n={};for(var r in e)H1.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&V1)for(var r of V1(e))t.indexOf(r)<0&&U1.call(e,r)&&(n[r]=e[r]);return n};function G1(e){let t=t=>{let n=X(`Dropzone${Cd(e)}`,{},t),{children:r}=n,i=W1(n,[`children`]),a=B1(),o=Tu(r)?r:Z.createElement(`span`,null,r);return a[e]?(0,Z.cloneElement)(o,i):null};return t.displayName=`@mantine/dropzone/${Cd(e)}`,t}var K1=G1(`accept`),q1=G1(`reject`),J1=G1(`idle`),Y1=Object.defineProperty,X1=Object.defineProperties,Z1=Object.getOwnPropertyDescriptors,Q1=Object.getOwnPropertySymbols,$1=Object.prototype.hasOwnProperty,e0=Object.prototype.propertyIsEnumerable,t0=(e,t,n)=>t in e?Y1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,n0=(e,t)=>{for(var n in t||={})$1.call(t,n)&&t0(e,n,t[n]);if(Q1)for(var n of Q1(t))e0.call(t,n)&&t0(e,n,t[n]);return e},r0=(e,t)=>X1(e,Z1(t)),i0=Rr((e,{padding:t,radius:n})=>{let r=e.fn.variant({color:`red`,variant:`light`}),i=e.fn.variant({color:e.primaryColor,variant:`light`});return{root:r0(n0(n0({},e.fn.fontStyles()),e.fn.focusStyles()),{boxSizing:`border-box`,backgroundColor:e.colorScheme===`dark`?e.colors.dark[6]:e.white,border:`${J(2)} dashed ${e.colorScheme===`dark`?e.colors.dark[4]:e.colors.gray[4]}`,padding:Y({size:t,sizes:e.spacing}),borderRadius:e.fn.radius(n),cursor:`pointer`,userSelect:`none`,transition:`background-color 150ms ease`,position:`relative`,"&:hover":{backgroundColor:e.colorScheme===`dark`?e.colors.dark[5]:e.colors.gray[0]},"&[data-loading]":{cursor:`default`,"&:hover":{backgroundColor:e.colorScheme===`dark`?e.colors.dark[6]:e.white}},"&[data-accept]":{backgroundColor:e.colorScheme===`dark`?i.background:e.colors[e.primaryColor][0],borderColor:e.colorScheme===`dark`?i.border:e.colors[e.primaryColor][4],"&:hover":{backgroundColor:e.colorScheme===`dark`?i.background:e.colors[e.primaryColor][0]}},"&[data-reject]":{backgroundColor:e.colorScheme===`dark`?r.background:e.colors.red[0],borderColor:e.colorScheme===`dark`?r.border:e.colors.red[4],"&:hover":{backgroundColor:e.colorScheme===`dark`?r.background:e.colors.red[0]}}}),inner:{pointerEvents:`none`,userSelect:`none`}}}),a0=Object.defineProperty,o0=Object.defineProperties,s0=Object.getOwnPropertyDescriptors,c0=Object.getOwnPropertySymbols,l0=Object.prototype.hasOwnProperty,u0=Object.prototype.propertyIsEnumerable,d0=(e,t,n)=>t in e?a0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,f0=(e,t)=>{for(var n in t||={})l0.call(t,n)&&d0(e,n,t[n]);if(c0)for(var n of c0(t))u0.call(t,n)&&d0(e,n,t[n]);return e},p0=(e,t)=>o0(e,s0(t)),m0=(e,t)=>{var n={};for(var r in e)l0.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&c0)for(var r of c0(e))t.indexOf(r)<0&&u0.call(e,r)&&(n[r]=e[r]);return n},h0={padding:`md`,loading:!1,multiple:!0,maxSize:1/0,autoFocus:!1,activateOnClick:!0,activateOnDrag:!0,dragEventsBubbling:!0,activateOnKeyboard:!0,useFsAccessApi:!0};function g0(e){let t=X(`Dropzone`,h0,e),{className:n,padding:r,radius:i,disabled:a,classNames:o,styles:s,loading:c,multiple:l,maxSize:u,accept:d,children:f,onDropAny:p,onDrop:m,onReject:h,openRef:g,name:_,unstyled:v,maxFiles:y,autoFocus:b,activateOnClick:x,activateOnDrag:S,dragEventsBubbling:C,activateOnKeyboard:w,onDragEnter:T,onDragLeave:E,onDragOver:D,onFileDialogCancel:O,onFileDialogOpen:k,preventDropOnDocument:A,useFsAccessApi:j,getFilesFromEvent:M,validator:N,variant:P}=t,F=m0(t,`className.padding.radius.disabled.classNames.styles.loading.multiple.maxSize.accept.children.onDropAny.onDrop.onReject.openRef.name.unstyled.maxFiles.autoFocus.activateOnClick.activateOnDrag.dragEventsBubbling.activateOnKeyboard.onDragEnter.onDragLeave.onDragOver.onFileDialogCancel.onFileDialogOpen.preventDropOnDocument.useFsAccessApi.getFilesFromEvent.validator.variant`.split(`.`)),{classes:I,cx:L}=i0({radius:i,padding:r},{name:`Dropzone`,classNames:o,styles:s,unstyled:v,variant:P}),{getRootProps:R,getInputProps:z,isDragAccept:B,isDragReject:V,open:ee}=I1(f0({onDrop:p,onDropAccepted:m,onDropRejected:h,disabled:a||c,accept:Array.isArray(d)?d.reduce((e,t)=>p0(f0({},e),{[t]:[]}),{}):d,multiple:l,maxSize:u,maxFiles:y,autoFocus:b,noClick:!x,noDrag:!S,noDragEventsBubbling:!C,noKeyboard:!w,onDragEnter:T,onDragLeave:E,onDragOver:D,onFileDialogCancel:O,onFileDialogOpen:k,preventDropOnDocument:A,useFsAccessApi:j,validator:N},M?{getFilesFromEvent:M}:null));ud(g,ee);let te=!B&&!V;return Z.createElement(z1,{value:{accept:B,reject:V,idle:te}},Z.createElement(Ir,p0(f0(f0({},F),R()),{"data-accept":B||void 0,"data-reject":V||void 0,"data-idle":te||void 0,"data-loading":c||void 0,className:L(I.root,n)}),Z.createElement(oE,{visible:c,radius:i,unstyled:v}),Z.createElement(`input`,p0(f0({},z()),{name:_})),Z.createElement(`div`,{className:I.inner},f)))}g0.displayName=`@mantine/dropzone/Dropzone`,g0.Accept=K1,g0.Reject=q1,g0.Idle=J1;var _0=g0,v0=Object.defineProperty,y0=Object.defineProperties,b0=Object.getOwnPropertyDescriptors,x0=Object.getOwnPropertySymbols,S0=Object.prototype.hasOwnProperty,C0=Object.prototype.propertyIsEnumerable,w0=(e,t,n)=>t in e?v0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,T0=(e,t)=>{for(var n in t||={})S0.call(t,n)&&w0(e,n,t[n]);if(x0)for(var n of x0(t))C0.call(t,n)&&w0(e,n,t[n]);return e},E0=(e,t)=>y0(e,b0(t)),D0=Rr(e=>({wrapper:E0(T0({},e.fn.cover(0)),{position:`fixed`,backgroundColor:e.colorScheme===`dark`?e.colors.dark[7]:e.white,display:`flex`,padding:e.spacing.xs,transition:`opacity 100ms ease`}),dropzone:{flex:1}})),O0=Object.defineProperty,k0=Object.defineProperties,A0=Object.getOwnPropertyDescriptors,j0=Object.getOwnPropertySymbols,M0=Object.prototype.hasOwnProperty,N0=Object.prototype.propertyIsEnumerable,P0=(e,t,n)=>t in e?O0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,F0=(e,t)=>{for(var n in t||={})M0.call(t,n)&&P0(e,n,t[n]);if(j0)for(var n of j0(t))N0.call(t,n)&&P0(e,n,t[n]);return e},I0=(e,t)=>k0(e,A0(t)),L0=(e,t)=>{var n={};for(var r in e)M0.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&j0)for(var r of j0(e))t.indexOf(r)<0&&N0.call(e,r)&&(n[r]=e[r]);return n},R0={padding:`md`,loading:!1,multiple:!0,maxSize:1/0,autoFocus:!1,activateOnClick:!0,activateOnDrag:!0,dragEventsBubbling:!0,activateOnKeyboard:!0,active:!0,zIndex:Du(`max`),withinPortal:!0};function z0(e){let t=X(`DropzoneFullScreen`,R0,e),{classNames:n,styles:r,sx:i,className:a,style:o,unstyled:s,active:c,onDrop:l,onReject:u,zIndex:d,withinPortal:f,portalProps:p}=t,m=L0(t,[`classNames`,`styles`,`sx`,`className`,`style`,`unstyled`,`active`,`onDrop`,`onReject`,`zIndex`,`withinPortal`,`portalProps`]),[h,g]=Z.useState(0),[_,{open:v,close:y}]=Sd(!1),{classes:b,cx:x}=D0(null,{name:`DropzoneFullScreen`,classNames:n,styles:r,unstyled:s}),S=e=>{e.dataTransfer.types.includes(`Files`)&&(g(e=>e+1),v())},C=()=>{g(e=>e-1)};return(0,Z.useEffect)(()=>{h===0&&y()},[h]),(0,Z.useEffect)(()=>{if(c)return document.addEventListener(`dragenter`,S,!1),document.addEventListener(`dragleave`,C,!1),()=>{document.removeEventListener(`dragenter`,S,!1),document.removeEventListener(`dragleave`,C,!1)}},[c]),Z.createElement(Af,I0(F0({},p),{withinPortal:f}),Z.createElement(Ir,{className:x(b.wrapper,a),sx:i,style:I0(F0({},o),{opacity:+!!_,pointerEvents:_?`all`:`none`,zIndex:d})},Z.createElement(g0,I0(F0({},m),{classNames:n,styles:r,unstyled:s,className:b.dropzone,onDrop:e=>{l?.(e),y()},onReject:e=>{u?.(e),y()}}))))}z0.displayName=`@mantine/dropzone/DropzoneFullScreen`,_0.FullScreen=z0;var B0=_0,V0=({children:e,chargeId:t})=>{let{uploading:n,uploadMultipleDocuments:r}=jK();function i(e){K.error(`Error`,{description:e,duration:5e3})}return(0,Q.jsx)(B0,{onDrop:e=>r({documents:e,chargeId:t,isSensitive:!1}),onReject:e=>i(`Rejected Files:\n${e.map(e=>`"${e.file.name}": ${e.errors}`).join(`
`)}`),activateOnClick:!1,activateOnKeyboard:!1,radius:0,padding:0,maxFiles:1/0,loading:n,sx:()=>({border:0,cursor:`default`,width:`100%`,height:`100%`,zIndex:1}),children:e})};(0,Z.forwardRef)(function({type:e=`text`,label:t,error:n,onChange:r,showControls:i=!1,rightPadding:a=`pr-2`,precision:o,children:s,isDirty:c,className:l,...u}){function d(e){let t=Number(e.target.value);if(Number.isNaN(t))r(null);else{if(o){let e=10**o;t=Math.round((t+2**-52)*e)/e}r(t)}}return(0,Q.jsxs)(`div`,{className:l,children:[t&&(0,Q.jsx)(`label`,{htmlFor:u.name,className:`text-sm font-medium text-gray-700`,children:t}),(0,Q.jsxs)(`div`,{children:[!i&&e===`number`&&(0,Q.jsx)(`style`,{children:`/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
/* Firefox */
input[type=number] {
-moz-appearance: textfield;
}
`}),(0,Q.jsx)(`input`,{type:e,...u,onChange:e===`number`?d:r,className:`w-full bg-gray-100 rounded border border-${n?`red`:c?`green`:`gray`}-300 focus:ring-2 focus:ring-indigo-200 focus:bg-transparent focus:border-indigo-500 text-base outline-hidden text-gray-700 py-1 px-3 leading-8 transition-colors duration-200 ease-in-out ${a} sm:text-sm rounded-md`}),s]}),n&&(0,Q.jsx)(`p`,{className:`text-red-500 text-xs italic`,children:n})]})});var H0=Gn(`m-1 transition ease-in-out delay-150 hover:-translate-y-1 hover:scale-110 duration-300`,{variants:{variant:{default:`border-gray-950/10 text-gray-950 bg-white hover:bg-white/80`,secondary:`border-gray-950/10 bg-gray-100 text-gray-900 hover:bg-gray-100/80`,destructive:`border-transparent bg-red-600 text-destructive-foreground hover:bg-red-600/80`,inverted:`inverted`}},defaultVariants:{variant:`default`}}),U0=Z.forwardRef(({options:e,onValueChange:t,variant:n,defaultValue:r=[],placeholder:i=`Select options`,animation:a=0,maxCount:o=3,modalPopover:c=!1,asChild:l=!1,className:u,removeButton:d,...f},p)=>{let[m,h]=Z.useState(r),[g,_]=Z.useState(!1),[v,y]=Z.useState(!1),[b,x]=Z.useState(r),S=Z.useMemo(()=>{let t=new Set(b);return[...e.filter(e=>t.has(e.value)),...e.filter(e=>!t.has(e.value))]},[e,b]),C=e=>{if(e.key===`Enter`)_(!0);else if(e.key===`Backspace`&&!e.currentTarget.value){let e=[...m];e.pop(),h(e),t(e)}},w=e=>{let n=m.includes(e)?m.filter(t=>t!==e):[...m,e];h(n),t(n)},T=()=>{h([]),t([])},E=()=>{_(e=>!e)},D=()=>{let e=m.slice(0,o);h(e),t(e)},O=()=>{if(m.length===e.length)T();else{let n=e.map(e=>e.value);h(n),t(n)}};return(0,Q.jsxs)(fX,{open:g,onOpenChange:e=>{e&&x(m),_(e)},modal:c,children:[(0,Q.jsx)(pX,{asChild:l,children:(0,Q.jsx)(q,{ref:p,...f,onClick:E,className:s(`flex w-full p-1 rounded-md border min-h-10 h-auto items-center justify-between bg-inherit hover:bg-inherit [&_svg]:pointer-events-auto`,u),children:m.length>0?(0,Q.jsxs)(`div`,{className:`flex justify-between items-center w-full`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center`,children:[m.slice(0,o).map(t=>{let r=e.find(e=>e.value===t),i=r?.icon;return(0,Q.jsxs)(xr,{className:s(v?`animate-bounce`:``,H0({variant:n})),style:{animationDuration:`${a}s`},children:[i&&(0,Q.jsx)(i,{className:`h-4 w-4 mr-2`}),r?.label,d&&(0,Q.jsx)(q,{className:`h-4 w-4 p-0`,variant:`link`,onClick:e=>{e.stopPropagation(),w(t)},children:(0,Q.jsx)(Li,{className:`h-4 w-4 cursor-pointer`})})]},t)}),m.length>o&&(0,Q.jsxs)(xr,{className:s(`bg-transparent text-gray-950 border-gray-950/1 hover:bg-transparent p-0 gap-0`,v?`animate-bounce`:``,H0({variant:n})),style:{animationDuration:`${a}s`},children:[(0,Q.jsxs)(rr,{children:[(0,Q.jsx)(yr,{asChild:!0,children:(0,Q.jsx)(`span`,{role:`button`,tabIndex:0,className:`pl-2 pr-1 py-0.5 cursor-help outline-none focus-visible:underline`,children:`+ ${m.length-o} more`})}),(0,Q.jsx)(or,{className:`flex flex-col gap-0.5`,children:m.slice(o).map(t=>(0,Q.jsx)(`span`,{children:e.find(e=>e.value===t)?.label??t},t))})]}),d&&(0,Q.jsx)(q,{className:`h-4 w-4 p-0 mr-1`,variant:`link`,onClick:e=>{e.stopPropagation(),D()},children:(0,Q.jsx)(Li,{className:`h-4 w-4 cursor-pointer`})})]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(Yt,{className:`h-4 mx-2 cursor-pointer text-gray-500`,onClick:e=>{e.stopPropagation(),T()}}),(0,Q.jsx)(Vn,{orientation:`vertical`,className:`flex min-h-6 h-full`}),(0,Q.jsx)(_n,{className:`h-4 mx-2 cursor-pointer text-gray-500`})]})]}):(0,Q.jsxs)(`div`,{className:`flex items-center justify-between w-full mx-auto`,children:[(0,Q.jsx)(`span`,{className:`text-sm text-gray-500 mx-3`,children:i}),(0,Q.jsx)(_n,{className:`h-4 cursor-pointer text-gray-500 mx-2`})]})})}),(0,Q.jsx)(mX,{className:`w-auto p-0`,align:`start`,onEscapeKeyDown:()=>_(!1),children:(0,Q.jsxs)(qJ,{children:[(0,Q.jsx)(JJ,{placeholder:`Search...`,onKeyDown:C}),(0,Q.jsxs)(YJ,{children:[(0,Q.jsx)(XJ,{children:`No results found.`}),(0,Q.jsxs)(ZJ,{children:[(0,Q.jsxs)($J,{onSelect:O,className:`cursor-pointer`,children:[(0,Q.jsx)(`div`,{className:s(`mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-gray-900`,m.length===e.length?`bg-gray-900 text-gray-50`:`opacity-50 [&_svg]:invisible`),children:(0,Q.jsx)(dn,{className:`h-4 w-4`})}),(0,Q.jsx)(`span`,{children:`(Select All)`})]},`all`),S.map(e=>(0,Q.jsxs)($J,{onSelect:()=>w(e.value),className:`cursor-pointer`,children:[(0,Q.jsx)(`div`,{className:s(`mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-gray-900`,m.includes(e.value)?`bg-gray-900 text-gray-50`:`opacity-50 [&_svg]:invisible`),children:(0,Q.jsx)(dn,{className:`h-4 w-4`})}),e.icon&&(0,Q.jsx)(e.icon,{className:`mr-2 h-4 w-4 text-gray-500`}),(0,Q.jsx)(`span`,{children:e.label}),e.description&&(0,Q.jsx)(`span`,{className:`text-xs opacity-65`,children:e.description})]},e.value))]}),(0,Q.jsx)(QJ,{}),(0,Q.jsx)(ZJ,{children:(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[m.length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($J,{onSelect:T,className:`flex-1 justify-center cursor-pointer`,children:`Clear`}),(0,Q.jsx)(Vn,{orientation:`vertical`,className:`flex min-h-6 h-full`})]}),(0,Q.jsx)($J,{onSelect:()=>_(!1),className:`flex-1 justify-center cursor-pointer max-w-full`,children:`Close`})]})})]})]})}),a>0&&m.length>0&&(0,Q.jsx)(wa,{className:s(`cursor-pointer my-2 text-gray-950 bg-white w-5 h-5`,v?``:`text-gray-500`),onClick:()=>y(!v)})]})});U0.displayName=`MultiSelect`;function W0(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}var G0;(function(e){e.event=`event`,e.props=`prop`})(G0||={});function K0(){}function q0(e){var t,n=void 0;return function(){for(var r=[],i=arguments.length;i--;)r[i]=arguments[i];return t&&r.length===t.length&&r.every(function(e,n){return e===t[n]})?n:(t=r,n=e.apply(void 0,r),n)}}function J0(e){return!!(e||``).match(/\d/)}function Y0(e){return e==null}function X0(e){return typeof e==`number`&&isNaN(e)}function Z0(e){return Y0(e)||X0(e)||typeof e==`number`&&!isFinite(e)}function Q0(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,`\\$&`)}function $0(e){switch(e){case`lakh`:return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case`wan`:return/(\d)(?=(\d{4})+(?!\d))/g;default:return/(\d)(?=(\d{3})+(?!\d))/g}}function e2(e,t,n){var r=$0(n),i=e.search(/[1-9]/);return i=i===-1?e.length:i,e.substring(0,i)+e.substring(i,e.length).replace(r,`$1`+t)}function t2(e){var t=(0,Z.useRef)(e);return t.current=e,(0,Z.useRef)(function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return t.current.apply(t,e)}).current}function n2(e,t){t===void 0&&(t=!0);var n=e[0]===`-`,r=n&&t;e=e.replace(`-`,``);var i=e.split(`.`);return{beforeDecimal:i[0],afterDecimal:i[1]||``,hasNegation:n,addNegation:r}}function r2(e){if(!e)return e;var t=e[0]===`-`;t&&(e=e.substring(1,e.length));var n=e.split(`.`),r=n[0].replace(/^0+/,``)||`0`,i=n[1]||``;return(t?`-`:``)+r+(i?`.`+i:``)}function i2(e,t,n){for(var r=``,i=n?`0`:``,a=0;a<=t-1;a++)r+=e[a]||i;return r}function a2(e,t){return Array(t+1).join(e)}function o2(e){var t=e+``,n=t[0]===`-`?`-`:``;n&&(t=t.substring(1));var r=t.split(/[eE]/g),i=r[0],a=r[1];if(a=Number(a),!a)return n+i;i=i.replace(`.`,``);var o=1+a,s=i.length;return o<0?i=`0.`+a2(`0`,Math.abs(o))+i:o>=s?i+=a2(`0`,o-s):i=(i.substring(0,o)||`0`)+`.`+i.substring(o),n+i}function s2(e,t,n){if([``,`-`].indexOf(e)!==-1)return e;var r=(e.indexOf(`.`)!==-1||n)&&t,i=n2(e),a=i.beforeDecimal,o=i.afterDecimal,s=i.hasNegation,c=parseFloat(`0.`+(o||`0`)),l=(o.length<=t?`0.`+o:c.toFixed(t)).split(`.`),u=a;a&&Number(l[0])&&(u=a.split(``).reverse().reduce(function(e,t,n){return e.length>n?(Number(e[0])+Number(t)).toString()+e.substring(1,e.length):t+e},l[0]));var d=i2(l[1]||``,t,n),f=s?`-`:``,p=r?`.`:``;return``+f+u+p+d}function c2(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var n=e.createTextRange();return n.move(`character`,t),n.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var l2=q0(function(e,t){for(var n=0,r=0,i=e.length,a=t.length;e[n]===t[n]&&n<i;)n++;for(;e[i-1-r]===t[a-1-r]&&a-r>n&&i-r>n;)r++;return{from:{start:n,end:i-r},to:{start:n,end:a-r}}}),u2=function(e,t){var n=Math.min(e.selectionStart,t);return{from:{start:n,end:e.selectionEnd},to:{start:n,end:t}}};function d2(e,t,n){return Math.min(Math.max(e,t),n)}function f2(e){return Math.max(e.selectionStart,e.selectionEnd)}function p2(){return typeof navigator<`u`&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function m2(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:``}}function h2(e){var t=e.currentValue,n=e.formattedValue,r=e.currentValueIndex,i=e.formattedValueIndex;return t[r]===n[i]}function g2(e,t,n,r,i,a,o){o===void 0&&(o=h2);var s=i.findIndex(function(e){return e}),c=e.slice(0,s);!t&&!n.startsWith(c)&&(t=c,n=c+n,r+=c.length);for(var l=n.length,u=e.length,d={},f=Array(l),p=0;p<l;p++){f[p]=-1;for(var m=0,h=u;m<h;m++)if(o({currentValue:n,lastValue:t,formattedValue:e,currentValueIndex:p,formattedValueIndex:m})&&d[m]!==!0){f[p]=m,d[m]=!0;break}}for(var g=r;g<l&&(f[g]===-1||!a(n[g]));)g++;var _=g===l||f[g]===-1?u:f[g];for(g=r-1;g>0&&f[g]===-1;)g--;var v=g===-1||f[g]===-1?0:f[g]+1;return v>_?_:r-v<_-r?v:_}function _2(e,t,n,r){var i=e.length;if(t=d2(t,0,i),r===`left`){for(;t>=0&&!n[t];)t--;t===-1&&(t=n.indexOf(!0))}else{for(;t<=i&&!n[t];)t++;t>i&&(t=n.lastIndexOf(!0))}return t===-1&&(t=i),t}function v2(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),n=0,r=t.length;n<r;n++)t[n]=!!(J0(e[n])||J0(e[n-1]));return t}function y2(e,t,n,r,i,a){a===void 0&&(a=K0);var o=t2(function(e,t){var n,a;return Z0(e)?(a=``,n=``):typeof e==`number`||t?(a=typeof e==`number`?o2(e):e,n=r(a)):(a=i(e,void 0),n=r(a)),{formattedValue:n,numAsString:a}}),s=(0,Z.useState)(function(){return o(Y0(e)?t:e,n)}),c=s[0],l=s[1],u=t2(function(e,t){e.formattedValue!==c.formattedValue&&l({formattedValue:e.formattedValue,numAsString:e.value}),a(e,t)}),d=e,f=n;Y0(e)&&(d=c.numAsString,f=!0);var p=o(d,f);return(0,Z.useMemo)(function(){l(p)},[p.formattedValue]),(0,Z.useEffect)(function(){if(!Y0(t)&&Y0(e)&&c.formattedValue!==``){var n=parseFloat(c.numAsString);u({formattedValue:c.formattedValue,value:c.numAsString,floatValue:isNaN(n)?void 0:n},{event:void 0,source:G0.props})}},[]),[c,u]}function b2(e){return e.replace(/[^0-9]/g,``)}function x2(e){return e}function S2(e){var t=e.type;t===void 0&&(t=`text`);var n=e.displayType;n===void 0&&(n=`input`);var r=e.customInput,i=e.renderText,a=e.getInputRef,o=e.format;o===void 0&&(o=x2);var s=e.removeFormatting;s===void 0&&(s=b2);var c=e.defaultValue,l=e.valueIsNumericString,u=e.onValueChange,d=e.isAllowed,f=e.onChange;f===void 0&&(f=K0);var p=e.onKeyDown;p===void 0&&(p=K0);var m=e.onMouseUp;m===void 0&&(m=K0);var h=e.onFocus;h===void 0&&(h=K0);var g=e.onBlur;g===void 0&&(g=K0);var _=e.value,v=e.getCaretBoundary;v===void 0&&(v=v2);var y=e.isValidInputCharacter;y===void 0&&(y=J0);var b=e.isCharacterSame,x=W0(e,[`type`,`displayType`,`customInput`,`renderText`,`getInputRef`,`format`,`removeFormatting`,`defaultValue`,`valueIsNumericString`,`onValueChange`,`isAllowed`,`onChange`,`onKeyDown`,`onMouseUp`,`onFocus`,`onBlur`,`value`,`getCaretBoundary`,`isValidInputCharacter`,`isCharacterSame`]),S=y2(_,c,!!l,o,s,u),C=S[0],w=C.formattedValue,T=C.numAsString,E=S[1],D=(0,Z.useRef)(),O=(0,Z.useRef)({formattedValue:w,numAsString:T}),k=function(e,t){O.current={formattedValue:e.formattedValue,numAsString:e.value},E(e,t)},A=(0,Z.useState)(!1),j=A[0],M=A[1],N=(0,Z.useRef)(null),P=(0,Z.useRef)({setCaretTimeout:null,focusTimeout:null});(0,Z.useEffect)(function(){return M(!0),function(){clearTimeout(P.current.setCaretTimeout),clearTimeout(P.current.focusTimeout)}},[]);var F=o,I=function(e,t){var n=parseFloat(t);return{formattedValue:e,value:t,floatValue:isNaN(n)?void 0:n}},L=function(e,t,n){e.selectionStart===0&&e.selectionEnd===e.value.length||(c2(e,t),P.current.setCaretTimeout=setTimeout(function(){e.value===n&&e.selectionStart!==t&&c2(e,t)},0))},R=function(e,t,n){return _2(e,t,v(e),n)},z=function(e,t,n){var r=v(t),i=g2(t,w,e,n,r,y,b);return i=_2(t,i,r),i},B=function(e){var t=e.formattedValue;t===void 0&&(t=``);var n=e.input,r=e.source,i=e.event,a=e.numAsString,o;if(n){var s=e.inputValue||n.value,c=f2(n);n.value=t,o=z(s,t,c),o!==void 0&&L(n,o,t)}t!==w&&k(I(t,a),{event:i,source:r})};(0,Z.useEffect)(function(){var e=O.current,t=e.formattedValue,n=e.numAsString;(w!==t||T!==n)&&k(I(w,T),{event:void 0,source:G0.props})},[w,T]);var V=N.current?f2(N.current):void 0;(typeof window<`u`?Z.useLayoutEffect:Z.useEffect)(function(){var e=N.current;if(w!==O.current.formattedValue&&e){var t=z(O.current.formattedValue,w,V);e.value=w,L(e,t,w)}},[w]);var ee=function(e,t,n){var r=t.target,i=D.current?u2(D.current,r.selectionEnd):l2(w,e),a=Object.assign(Object.assign({},i),{lastValue:w}),o=s(e,a),c=F(o);if(o=s(c,void 0),d&&!d(I(c,o))){var l=t.target,u=z(e,w,f2(l));return l.value=w,L(l,u,w),!1}return B({formattedValue:c,numAsString:o,inputValue:e,event:t,source:n,input:t.target}),!0},te=function(e,t){t===void 0&&(t=0),D.current={selectionStart:e.selectionStart,selectionEnd:e.selectionEnd+t}},H=function(e){var t=e.target.value;ee(t,e,G0.event)&&f(e),D.current=void 0},ne=function(e){var t=e.target,n=e.key,r=t.selectionStart,i=t.selectionEnd,a=t.value;a===void 0&&(a=``);var o;n===`ArrowLeft`||n===`Backspace`?o=Math.max(r-1,0):n===`ArrowRight`?o=Math.min(r+1,a.length):n===`Delete`&&(o=r);var s=0;n===`Delete`&&r===i&&(s=1);var c=n===`ArrowLeft`||n===`ArrowRight`;if(o===void 0||r!==i&&!c){p(e),te(t,s);return}var l=o;c?(l=R(a,o,n===`ArrowLeft`?`left`:`right`),l!==o&&e.preventDefault()):n===`Delete`&&!y(a[o])?l=R(a,o,`right`):n===`Backspace`&&!y(a[o])&&(l=R(a,o,`left`)),l!==o&&L(t,l,a),p(e),te(t,s)},re=function(e){var t=e.target,n=function(){var e=t.selectionStart,n=t.selectionEnd,r=t.value;if(r===void 0&&(r=``),e===n){var i=R(r,e);i!==e&&L(t,i,r)}};n(),requestAnimationFrame(function(){n()}),m(e),te(t)},ie=function(e){e.persist&&e.persist();var t=e.target,n=e.currentTarget;N.current=t,P.current.focusTimeout=setTimeout(function(){var r=t.selectionStart,i=t.selectionEnd,a=t.value;a===void 0&&(a=``);var o=R(a,r);o!==r&&!(r===0&&i===a.length)&&L(t,o,a),h(Object.assign(Object.assign({},e),{currentTarget:n}))},0)},U=function(e){N.current=null,clearTimeout(P.current.focusTimeout),clearTimeout(P.current.setCaretTimeout),g(e)},ae=j&&p2()?`numeric`:void 0,oe=Object.assign({inputMode:ae},x,{type:t,value:w,onChange:H,onKeyDown:ne,onMouseUp:re,onFocus:ie,onBlur:U});if(n===`text`)return i?Z.createElement(Z.Fragment,null,i(w,x)||null):Z.createElement(`span`,Object.assign({},x,{ref:a}),w);if(r){var W=r;return Z.createElement(W,Object.assign({},oe,{ref:a}))}return Z.createElement(`input`,Object.assign({},oe,{ref:a}))}function C2(e,t){var n=t.decimalScale,r=t.fixedDecimalScale,i=t.prefix;i===void 0&&(i=``);var a=t.suffix;a===void 0&&(a=``);var o=t.allowNegative,s=t.thousandsGroupStyle;if(s===void 0&&(s=`thousand`),e===``||e===`-`)return e;var c=w2(t),l=c.thousandSeparator,u=c.decimalSeparator,d=n!==0&&e.indexOf(`.`)!==-1||n&&r,f=n2(e,o),p=f.beforeDecimal,m=f.afterDecimal,h=f.addNegation;return n!==void 0&&(m=i2(m,n,!!r)),l&&(p=e2(p,l,s)),i&&(p=i+p),a&&(m+=a),h&&(p=`-`+p),e=p+(d&&u||``)+m,e}function w2(e){var t=e.decimalSeparator;t===void 0&&(t=`.`);var n=e.thousandSeparator,r=e.allowedDecimalSeparators;return n===!0&&(n=`,`),r||=[t,`.`],{decimalSeparator:t,thousandSeparator:n,allowedDecimalSeparators:r}}function T2(e,t){e===void 0&&(e=``);var n=RegExp(`(-)`),r=RegExp(`(-)(.)*(-)`),i=n.test(e),a=r.test(e);return e=e.replace(/-/g,``),i&&!a&&t&&(e=`-`+e),e}function E2(e,t){return RegExp(`(^-)|[0-9]|`+Q0(e),t?`g`:void 0)}function D2(e,t,n){return e===``||!t?.match(/\d/)&&!n?.match(/\d/)&&typeof e==`string`&&!isNaN(Number(e))}function O2(e,t,n){var r;t===void 0&&(t=m2(e));var i=n.allowNegative,a=n.prefix;a===void 0&&(a=``);var o=n.suffix;o===void 0&&(o=``);var s=n.decimalScale,c=t.from,l=t.to,u=l.start,d=l.end,f=w2(n),p=f.allowedDecimalSeparators,m=f.decimalSeparator,h=e[d]===m;if(J0(e)&&(e===a||e===o)&&t.lastValue===``)return e;if(d-u===1&&p.indexOf(e[u])!==-1){var g=s===0?``:m;e=e.substring(0,u)+g+e.substring(u+1,e.length)}var _=function(e,t,n){var r=!1,i=!1;a.startsWith(`-`)?r=!1:e.startsWith(`--`)?(r=!1,i=!0):o.startsWith(`-`)&&e.length===o.length?r=!1:e[0]===`-`&&(r=!0);var s=+!!r;return i&&(s=2),s&&(e=e.substring(s),t-=s,n-=s),{value:e,start:t,end:n,hasNegation:r}},v=_(e,u,d),y=v.hasNegation;r=v,e=r.value,u=r.start,d=r.end;var b=_(t.lastValue,c.start,c.end),x=b.start,S=b.end,C=b.value,w=e.substring(u,d);e.length&&C.length&&(x>C.length-o.length||S<a.length)&&!(w&&o.startsWith(w))&&(e=C);var T=0;e.startsWith(a)?T+=a.length:u<a.length&&(T=u),e=e.substring(T),d-=T;var E=e.length,D=e.length-o.length;e.endsWith(o)?E=D:(d>D||d>e.length-o.length)&&(E=d),e=e.substring(0,E),e=T2(y?`-`+e:e,i),e=(e.match(E2(m,!0))||[]).join(``);var O=e.indexOf(m);e=e.replace(new RegExp(Q0(m),`g`),function(e,t){return t===O?`.`:``});var k=n2(e,i),A=k.beforeDecimal,j=k.afterDecimal,M=k.addNegation;return l.end-l.start<c.end-c.start&&A===``&&h&&!parseFloat(j)&&(e=M?`-`:``),e}function k2(e,t){var n=t.prefix;n===void 0&&(n=``);var r=t.suffix;r===void 0&&(r=``);var i=Array.from({length:e.length+1}).map(function(){return!0}),a=e[0]===`-`;i.fill(!1,0,Math.min(n.length+ +!!a,e.length));var o=e.length;return i.fill(!1,o-r.length+1,o+1),i}function A2(e){var t=w2(e),n=t.thousandSeparator,r=t.decimalSeparator,i=e.prefix;i===void 0&&(i=``);var a=e.allowNegative;if(a===void 0&&(a=!0),n===r)throw Error(`
Decimal separator can't be same as thousand separator.
thousandSeparator: `+n+` (thousandSeparator = {true} is same as thousandSeparator = ",")
decimalSeparator: `+r+` (default value for decimalSeparator is .)
`);return i.startsWith(`-`)&&a&&(console.error(`
Prefix can't start with '-' when allowNegative is true.
prefix: `+i+`
allowNegative: `+a+`
`),a=!1),Object.assign(Object.assign({},e),{allowNegative:a})}function j2(e){e=A2(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,n=e.allowNegative,r=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=K0);var a=e.onBlur;a===void 0&&(a=K0);var o=e.thousandSeparator,s=e.decimalScale,c=e.fixedDecimalScale,l=e.prefix;l===void 0&&(l=``);var u=e.defaultValue,d=e.value,f=e.valueIsNumericString,p=e.onValueChange,m=W0(e,[`decimalSeparator`,`allowedDecimalSeparators`,`thousandsGroupStyle`,`suffix`,`allowNegative`,`allowLeadingZeros`,`onKeyDown`,`onBlur`,`thousandSeparator`,`decimalScale`,`fixedDecimalScale`,`prefix`,`defaultValue`,`value`,`valueIsNumericString`,`onValueChange`]),h=w2(e),g=h.decimalSeparator,_=h.allowedDecimalSeparators,v=function(t){return C2(t,e)},y=function(t,n){return O2(t,n,e)},b=Y0(d)?u:d,x=f??D2(b,l,t);Y0(d)?Y0(u)||(x||=typeof u==`number`):x||=typeof d==`number`;var S=function(e){return Z0(e)?e:(typeof e==`number`&&(e=o2(e)),x&&typeof s==`number`?s2(e,s,!!c):e)},C=y2(S(d),S(u),!!x,v,y,p),w=C[0],T=w.numAsString,E=w.formattedValue,D=C[1];return Object.assign(Object.assign({},m),{value:E,valueIsNumericString:!1,isValidInputCharacter:function(e){return e===g||J0(e)},isCharacterSame:function(e){var t=e.currentValue,n=e.lastValue,r=e.formattedValue,i=e.currentValueIndex,a=e.formattedValueIndex,o=t[i],u=r[a],f=l2(n,t).to,p=function(e){return y(e).indexOf(`.`)+l.length};return d===0&&c&&s&&t[f.start]===g&&p(t)<i&&p(r)>a?!1:i>=f.start&&i<f.end&&_&&_.includes(o)&&u===g?!0:o===u},onValueChange:D,format:v,removeFormatting:y,getCaretBoundary:function(t){return k2(t,e)},onKeyDown:function(e){var t=e.target,r=e.key,a=t.selectionStart,u=t.selectionEnd,d=t.value;if(d===void 0&&(d=``),(r===`Backspace`||r===`Delete`)&&u<l.length&&d!==`-`){e.preventDefault();return}if(a!==u){i(e);return}r===`Backspace`&&d[0]===`-`&&a===l.length+1&&n&&c2(t,1),s&&c&&(r===`Backspace`&&d[a-1]===g?(c2(t,a-1),e.preventDefault()):r===`Delete`&&d[a]===g&&e.preventDefault()),_?.includes(r)&&d[a]===g&&c2(t,a+1);var f=o===!0?`,`:o;r===`Backspace`&&d[a-1]===f&&c2(t,a-1),r===`Delete`&&d[a]===f&&c2(t,a+1),i(e)},onBlur:function(t){var n=T;n.match(/\d/g)||(n=``),r||(n=r2(n)),c&&s&&(n=s2(n,s,c)),n!==T&&D({formattedValue:C2(n,e),value:n,floatValue:parseFloat(n)},{event:t,source:G0.event}),a(t)}})}function M2(e){var t=j2(e);return Z.createElement(S2,Object.assign({},t))}var N2=(0,Z.forwardRef)(function({stepper:e,thousandSeparator:t,placeholder:n,defaultValue:r,min:i=-1/0,max:a=1/0,onValueChange:o,fixedDecimalScale:s=!1,decimalScale:c=0,suffix:l,prefix:u,value:d,hideControls:f=!1,onChange:p,...m},h){let[g,_]=(0,Z.useState)(d??r),v=(0,Z.useCallback)(()=>{_(t=>t===void 0?e??1:Math.min(t+(e??1),a))},[e,a]),y=(0,Z.useCallback)(()=>{_(t=>t===void 0?-(e??1):Math.max(t-(e??1),i))},[e,i]);return(0,Z.useEffect)(()=>{let e=e=>{document.activeElement===h?.current&&(e.key===`ArrowUp`?v():e.key===`ArrowDown`&&y())};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[v,y,h]),(0,Z.useEffect)(()=>{d!==void 0&&_(d)},[d]),(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(M2,{value:g,onValueChange:e=>{let t=e.floatValue===void 0?void 0:e.floatValue;_(t),o&&o(t),p?.(t??void 0)},thousandSeparator:t,decimalScale:c,fixedDecimalScale:s,allowNegative:i<0,valueIsNumericString:!0,onBlur:()=>{g!==void 0&&(g<i?(_(i),h.current.value=String(i)):g>a&&(_(a),h.current.value=String(a)))},max:a,min:i,suffix:l,prefix:u,customInput:bn,placeholder:n,className:`[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none relative ${f?``:` rounded-r-none`}`,getInputRef:h,...m}),f?null:(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Q.jsx)(q,{"aria-label":`Increase value`,className:`px-2 h-5 rounded-l-none rounded-br-none border-input border-l-0 border-b-[0.5px] focus-visible:relative`,variant:`outline`,onClick:v,disabled:g===a,children:(0,Q.jsx)(Zt,{size:15})}),(0,Q.jsx)(q,{"aria-label":`Decrease value`,className:`px-2 h-5 rounded-l-none rounded-tr-none border-input border-l-0 border-t-[0.5px] focus-visible:relative`,variant:`outline`,onClick:y,disabled:g===i,children:(0,Q.jsx)(_n,{size:15})})]})]})});function P2({options:e,value:t,onChange:n,search:r,onSearchChange:i,placeholder:a,empty:o}){let[c,l]=(0,Z.useState)(!1),u=(0,Z.useMemo)(()=>Object.fromEntries(e.map(e=>[e.value,e.label.toLowerCase()])),[e]);return(0,Q.jsx)(`div`,{className:`space-y-2 w-[300px]`,children:(0,Q.jsxs)(fX,{open:c,onOpenChange:l,children:[(0,Q.jsx)(pX,{asChild:!0,children:(0,Q.jsxs)(q,{variant:`outline`,role:`combobox`,"aria-expanded":c,className:`w-full justify-between bg-white px-3 font-normal outline-offset-0 hover:bg-white focus-visible:border-gray-950 focus-visible:outline-[3px] focus-visible:outline-ring/20 dark:bg-gray-950 dark:hover:bg-gray-950 dark:focus-visible:border-gray-300`,children:[(0,Q.jsx)(`span`,{className:s(`truncate`,!t&&`text-gray-500 dark:text-gray-400`),children:t?e.find(e=>e.value===t)?.label:`Select`}),(0,Q.jsx)(_n,{strokeWidth:2,className:`shrink-0 text-gray-500/80 dark:text-gray-400/80 size-4`,"aria-hidden":`true`})]})}),(0,Q.jsx)(mX,{className:`w-full min-w-[var(--radix-popper-anchor-width)] border-gray-200 p-0 dark:border-gray-800`,align:`start`,children:(0,Q.jsxs)(qJ,{filter:(e,t)=>{let n=t.toLowerCase();return+!!u[e]?.includes(n)},children:[(0,Q.jsx)(JJ,{placeholder:a||`Search...`,onValueChange:i,value:r||``}),(0,Q.jsxs)(YJ,{children:[(0,Q.jsx)(XJ,{children:o}),(0,Q.jsx)(ZJ,{children:e.map(e=>(0,Q.jsxs)($J,{value:e.value,onSelect:e=>{n(e===t?null:e),l(!1)},children:[e.label,t===e.value&&(0,Q.jsx)(dn,{strokeWidth:2,className:`ml-auto size-4`})]},e.value))})]})]})})]})})}var F2=({ownerId:e})=>{let[{data:t,fetching:n,error:r},i]=H({query:v,variables:{ownerId:e},pause:!e});r&&(console.error(`Error fetching sort codes: ${r}`),K.error(`Error`,{description:`Unable to fetch sort codes`}));let a=(0,Z.useMemo)(()=>t?.allSortCodesByBusiness?.sort((e,t)=>(e.name??``)>(t.name??``)?1:-1)??[],[t]);return{fetching:n,refresh:()=>i(),sortCodes:a,selectableSortCodes:(0,Z.useMemo)(()=>a.map(e=>({value:e.key.toString(),label:e.name??``})),[a])}};function I2({ownerId:e,value:t,onChange:n,disabled:r,placeholder:i=`Scroll to see all options`,formPart:a,error:o,triggerClassName:s,onFetchingChange:c}){let{sortCodes:l,fetching:u}=F2({ownerId:e});return(0,Z.useEffect)(()=>{c?.(u)},[c,u]),(0,Q.jsx)(hX,{data:(0,Z.useMemo)(()=>{let e=l.map(e=>({value:e.key.toString(),label:e.name?`${e.key} - ${e.name}`:e.key.toString()}));if(t!=null){let n=t.toString();e.some(e=>e.value===n)||e.push({value:n,label:n})}return e},[l,t]),value:t?.toString()??null,onChange:e=>{if(!e){n(null,null);return}let t=Number(e);n(t,l.find(e=>Number(e.key)===t)??null)},disabled:r||u,placeholder:i,formPart:a,error:o,triggerProps:s?{className:s}:void 0})}var L2=(0,Z.forwardRef)(({label:e,description:t,...n},r)=>(0,Q.jsx)(`div`,{ref:r,...n,children:(0,Q.jsx)(zw,{noWrap:!0,children:(0,Q.jsxs)(`div`,{children:[t&&(0,Q.jsx)(ai,{size:`xs`,opacity:.65,children:t}),(0,Q.jsx)(ai,{size:`sm`,children:e})]})})}));L2.displayName=`SelectTagItem`;var R2=`updateBusinessTripAccountantApproval`,z2=()=>{let[{fetching:e},t]=p(d);return{fetching:e,updateBusinessTripAccountantApproval:(0,Z.useCallback)(async e=>{let n=`Error toggling accountant approval for trip [${e.businessTripId}]`,r=`${R2}-${e.businessTripId}`;K.loading(`Updating accountant approval status`,{id:r});try{let i=Xe(await t(e),n,r);if(i)return K.success(`Success`,{id:r,description:`Accountant approval status updated`}),i.updateBusinessTripAccountantApproval}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}},B2=`updateChargeAccountantApproval`,V2=()=>{let[{fetching:e},t]=p(E);return{fetching:e,updateChargeAccountantApproval:(0,Z.useCallback)(async e=>{let n=`Error toggling accountant approval to ledger record ID [${e.chargeId}]`,r=`${B2}-${e.chargeId}`;K.loading(`Updating approval status`,{id:r});try{let i=Xe(await t(e),n,r,`updateChargeAccountantApproval`);if(i)return K.success(`Success`,{id:r,description:`Accountant approval was updated`}),i.updateChargeAccountantApproval}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}},H2={[qe.Approved]:{icon:dn,color:`text-green-600`,bgColor:`hover:bg-green-50`,label:`Approved`,value:qe.Approved},[qe.Pending]:{icon:Ri,color:`text-yellow-600`,bgColor:`hover:bg-yellow-50`,label:`Pending`,value:qe.Pending},[qe.Unapproved]:{icon:Yt,color:`text-red-600`,bgColor:`hover:bg-red-50`,label:`Unapproved`,value:qe.Unapproved}},U2=e=>H2[e];function W2(e){let{onChange:t,onStatusChange:n,value:r}=e,[i,a]=(0,Z.useState)(r??qe.Unapproved),{updateChargeAccountantApproval:o}=V2(),{updateBusinessTripAccountantApproval:s}=z2(),c=U2(i),l=c.icon,u=(0,Z.useCallback)(async r=>{let c=i;a(r);let l=null;e.chargeId?l=await o({chargeId:e.chargeId,status:r}):e.businessTripId&&(l=await s({businessTripId:e.businessTripId,status:r})),l?n?.(r):a(c),t?.()},[e.chargeId,o,e.businessTripId,s,i,t,n]);(0,Z.useEffect)(()=>{r&&a(r)},[r]);let d=!e.chargeId&&!e.businessTripId;return(0,Q.jsxs)(In,{children:[(0,Q.jsx)(Pn,{asChild:!0,disabled:d,children:(0,Q.jsx)(q,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 ${c.bgColor}`,title:c.label,disabled:d,children:(0,Q.jsx)(l,{className:`h-3.5 w-3.5 ${c.color}`})})}),(0,Q.jsxs)(jn,{align:`center`,children:[(0,Q.jsxs)(Mn,{onClick:()=>u(qe.Approved),children:[(0,Q.jsx)(dn,{className:`h-4 w-4 mr-2 text-green-600`}),`Approved`]}),(0,Q.jsxs)(Mn,{onClick:()=>u(qe.Pending),children:[(0,Q.jsx)(Ri,{className:`h-4 w-4 mr-2 text-yellow-600`}),`Pending`]}),(0,Q.jsxs)(Mn,{onClick:()=>u(qe.Unapproved),children:[(0,Q.jsx)(Yt,{className:`h-4 w-4 mr-2 text-red-600`}),`Unapproved`]})]})]})}var G2=({items:e,extraClassName:t=``})=>(0,Q.jsx)(`ul`,{className:[`text-sm font-medium text-gray-900 bg-white border border-gray-200 rounded-lg`,t].join(` `),children:e.map((t,n)=>(0,Q.jsx)(`li`,{className:[`w-full px-4 py-2`,n===e.length-1?`rounded-b-lg`:`border-b`,n===0?`rounded-t-lg`:``,`border-gray-200`,t&&typeof t==`object`&&`extraClassName`in t?t.extraClassName??``:``].join(` `),children:t&&typeof t==`object`&&`content`in t?t.content:t},n))});function K2({columns:e=5,rows:t=5,headerHeight:n=`h-10`,rowHeight:r=`h-8`,showHeader:i=!0,columnWidths:a,...o}){let s=a||Array(e).fill(`flex-1`);return(0,Q.jsxs)(`div`,{className:`space-y-2`,...o,children:[i&&(0,Q.jsx)(`div`,{className:`flex gap-2 border-b pb-2`,children:s.map((e,t)=>(0,Q.jsx)(Ls,{className:`${n} ${e}`},t))}),[...Array(t)].map((e,t)=>(0,Q.jsx)(`div`,{className:`flex gap-2 border-b py-2`,children:s.map((e,t)=>(0,Q.jsx)(Ls,{className:`${r} ${e}`},t))},t))]})}var q2=`mergeCharges`,J2=()=>{let[{fetching:e},t]=p($e);return{fetching:e,mergeCharges:(0,Z.useCallback)(async e=>{let n=`Error merging into charge ID [${e.baseChargeID}]`,r=`${q2}-${e.baseChargeID}`;K.loading(`Merging Charges`,{id:r});try{let i=Xe(await t(e),n,r,`mergeCharges`);if(i)return K.success(`Success`,{id:r,description:`Charges were merged`}),i.mergeCharges.charge}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}};function Y2({chargeIds:e,onDone:t,resetMerge:n}){let{mergeCharges:r,fetching:i}=J2(),a=Array.from(new Set(e)),[{data:o,fetching:s}]=H({query:at,variables:{chargeIds:a}}),[c,l]=(0,Z.useState)(o?.chargesByIDs[0]),[u,d]=(0,Z.useState)(void 0),[f,p]=(0,Z.useState)(void 0),[m,h]=(0,Z.useState)(void 0),[g,_]=(0,Z.useState)(void 0),[v,y]=(0,Z.useState)(void 0),[b,x]=(0,Z.useState)(void 0),[S,C]=(0,Z.useState)(void 0),w=o?.chargesByIDs.length!==a.length&&`Some charges were not Found`||void 0,T=o?.chargesByIDs||[],E=(0,Z.useCallback)(async()=>{if(!c){K.error(`Error`,{description:`No main charge selected`});return}if(a.length<2){K.error(`Error`,{description:`At least 2 charges are required to execute a merge`});return}let e;return u&&u.value!==c.userDescription&&(e??={},e={...e,userDescription:u.value}),g&&g.value!==c.__typename&&(e??={},e={...e,type:Sl(g.value)}),v&&v.value!==c.decreasedVAT&&(e??={},e={...e,isDecreasedVAT:v.value}),f&&f.value!==c.optionalVAT&&(e??={},e={...e,optionalVAT:f.value}),m&&m.value!==c.optionalDocuments&&(e??={},e={...e,optionalDocuments:m.value}),S&&S.value!==c.tags.map(e=>e.name).join(`,`)&&(e??={},e={...e,tags:S.value.split(`,`).filter(e=>e!==``).map(e=>({id:e}))}),b&&b.value!==c.isInvoicePaymentDifferentCurrency&&(e??={},e={...e,isInvoicePaymentDifferentCurrency:b.value}),await r({baseChargeID:c.id,chargeIdsToMerge:a.filter(e=>e!==c.id),fields:e}),n(),t()},[c,a,r,u,m,g,v,f,b,S,t,n]);return(0,Q.jsxs)(Q.Fragment,{children:[s&&(0,Q.jsx)(`div`,{className:`flex flex-col text-center w-full mb-1`,children:(0,Q.jsx)(Kr,{})}),!s&&w&&(0,Q.jsx)(`div`,{className:`flex flex-col text-center w-full mb-1`,children:(0,Q.jsx)(`h3`,{className:`sm:text-2xl text-xl font-medium title-font mb-6 text-gray-900`,children:w})}),!s&&!w&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`table`,{children:[(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{children:`Main`}),T.map(e=>(0,Q.jsx)(`td`,{children:(0,Q.jsx)(`div`,{className:`flex items-center justify-center mx-2 px-2 py-2 border-2 border-b-0 rounded-t-xl`,children:(0,Q.jsx)(zb,{checked:e.id===c?.id,size:`xl`,onClick:()=>{l(e),d({id:e.id,value:e.userDescription??``}),p({id:e.id,value:e.optionalVAT??!1}),h({id:e.id,value:e.optionalDocuments??!1}),x({id:e.id,value:e.isInvoicePaymentDifferentCurrency??!1}),_({id:e.id,value:e.__typename}),y({id:e.id,value:e.decreasedVAT??!1}),C({id:e.id,value:(e.tags.map(e=>e.name)??[]).join(`,`)})}})})},e.id))]}),(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{children:`Description`}),T.map(e=>(0,Q.jsx)(`td`,{children:(0,Q.jsx)(`button`,{className:`w-full px-2`,disabled:!e.userDescription||u?.value===e.userDescription,onClick:()=>d({id:e.id,value:e.userDescription??``}),children:(0,Q.jsx)(`div`,{className:`flex items-center justify-center px-2 py-2 border-x-2`,style:u?.id===e.id?{background:`#228be633`}:{},children:e.userDescription})})},e.id))]}),(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{children:`Type`}),T.map(e=>(0,Q.jsx)(`td`,{children:(0,Q.jsx)(`button`,{className:`w-full px-2`,disabled:e.__typename==null||e.__typename===g?.value,onClick:()=>{_({id:e.id,value:e.__typename})},children:(0,Q.jsx)(`div`,{className:`flex items-center justify-center px-2 py-2 border-x-2`,style:g?.id===e.id?{background:`#228be633`}:{},children:(0,Q.jsx)(FK,{content:yl(e.__typename),children:xl(e.__typename)})})})},e.id))]}),(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{children:`Is Decreased VAT`}),T.map(e=>(0,Q.jsx)(`td`,{children:(0,Q.jsx)(`button`,{className:`w-full px-2`,disabled:e.decreasedVAT==null||e.decreasedVAT===v?.value,onClick:()=>{y({id:e.id,value:e.decreasedVAT??!1})},children:(0,Q.jsx)(`div`,{className:`flex items-center justify-center px-2 py-2 border-x-2`,style:v?.id===e.id?{background:`#228be633`}:{},children:e.decreasedVAT?(0,Q.jsx)(ga,{size:20,color:`green`}):(0,Q.jsx)(va,{size:20,color:`red`})})})},e.id))]}),(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{children:`Optional VAT`}),T.map(e=>(0,Q.jsx)(`td`,{children:(0,Q.jsx)(`button`,{className:`w-full px-2`,disabled:e.optionalVAT==null||e.optionalVAT===f?.value,onClick:()=>{p({id:e.id,value:e.optionalVAT??!1})},children:(0,Q.jsx)(`div`,{className:`flex items-center justify-center px-2 py-2 border-x-2`,style:f?.id===e.id?{background:`#228be633`}:{},children:e.optionalVAT?(0,Q.jsx)(ga,{size:20,color:`green`}):(0,Q.jsx)(va,{size:20,color:`red`})})})},e.id))]}),(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{children:`Optional Documents`}),T.map(e=>(0,Q.jsx)(`td`,{children:(0,Q.jsx)(`button`,{className:`w-full px-2`,disabled:e.optionalDocuments==null||e.optionalDocuments===m?.value,onClick:()=>{h({id:e.id,value:e.optionalDocuments??!1})},children:(0,Q.jsx)(`div`,{className:`flex items-center justify-center px-2 py-2 border-x-2`,style:m?.id===e.id?{background:`#228be633`}:{},children:e.optionalDocuments?(0,Q.jsx)(ga,{size:20,color:`green`}):(0,Q.jsx)(va,{size:20,color:`red`})})})},e.id))]}),(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{children:`Invoice-Payment Currency Difference`}),T.map(e=>(0,Q.jsx)(`td`,{children:(0,Q.jsx)(`button`,{className:`w-full px-2`,disabled:e.isInvoicePaymentDifferentCurrency==null||e.isInvoicePaymentDifferentCurrency===b?.value,onClick:()=>{x({id:e.id,value:e.isInvoicePaymentDifferentCurrency??!1})},children:(0,Q.jsx)(`div`,{className:`flex items-center justify-center px-2 py-2 border-x-2`,style:b?.id===e.id?{background:`#228be633`}:{},children:e.isInvoicePaymentDifferentCurrency?(0,Q.jsx)(ga,{size:20,color:`green`}):(0,Q.jsx)(va,{size:20,color:`red`})})})},e.id))]}),(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{children:`Tags`}),T.map(e=>(0,Q.jsx)(`td`,{children:(0,Q.jsx)(`button`,{className:`w-full px-2`,disabled:e.tags==null||e.tags.map(e=>e.name).join(`,`)===S?.value,onClick:()=>{C({id:e.id,value:(e.tags.map(e=>e.name)??[]).join(`,`)})},children:(0,Q.jsx)(`div`,{className:`flex items-center justify-center px-2 py-2 border-x-2`,style:S?.id===e.id?{background:`#228be633`}:{},children:(0,Q.jsx)(G2,{items:e.tags.map(e=>(0,Q.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,Q.jsx)(`div`,{children:e.name}),e.namePath&&(0,Q.jsx)(`div`,{children:e.namePath.join(` > `)})]},e.id))})})})},e.id))]}),(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{children:`Transactions`}),T.map(e=>(0,Q.jsx)(`td`,{children:(0,Q.jsx)(`div`,{className:`flex items-center justify-center mx-2 px-2 py-2 border-x-2`,children:e.metadata?.transactionsCount??0})},e.id))]}),(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{children:`Invoices`}),T.map(e=>(0,Q.jsx)(`td`,{children:(0,Q.jsx)(`div`,{className:`flex items-center justify-center mx-2 px-2 py-2 border-2 border-t-0 rounded-b-xl`,children:e.metadata?.invoicesCount??0})},e.id))]})]}),(0,Q.jsxs)(`div`,{className:`flex justify-center gap-5 mt-5`,children:[(0,Q.jsx)(`button`,{type:`button`,className:` text-white bg-blue-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-blue-600 rounded-sm text-lg`,disabled:s||i,onClick:E,children:`Accept`}),(0,Q.jsx)(`button`,{type:`button`,className:` text-white bg-red-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-red-600 rounded-sm text-lg`,onClick:t,children:`Cancel`}),(0,Q.jsx)(`button`,{type:`button`,className:` text-white bg-red-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-red-600 rounded-sm text-lg`,onClick:()=>{n(),t()},children:`Reset Merge`})]})]})]})}function X2(e){let[t,n]=(0,Z.useState)(!1),{selected:r,resetMerge:i}=e,a=new Set(r.map(({id:e})=>e)),o=a.size>1,s=o?`default`:`outline`,c=(0,Z.useCallback)(()=>{n(!1),r.map(({onChange:e})=>e())},[r]),l=(0,Z.useMemo)(()=>o?`Merge ${a.size} selected charges`:`Select at least two different charges to merge`,[o,a.size]);return(0,Q.jsxs)(Jt,{open:t,onOpenChange:n,children:[(0,Q.jsx)(un,{disabled:!o,children:(0,Q.jsxs)(rr,{children:[(0,Q.jsx)(yr,{children:(0,Q.jsx)(q,{disabled:!o,variant:s,className:`size-7.5`,children:(0,Q.jsx)(ia,{className:`size-5`})})}),(0,Q.jsx)(or,{children:(0,Q.jsx)(`p`,{children:l})})]})}),(0,Q.jsxs)(cn,{className:`w-[90vw] sm:max-w-[95%] max-h-[90vh] overflow-y-auto`,children:[(0,Q.jsx)($t,{children:(0,Q.jsx)(gn,{children:`Merge Charges`})}),(0,Q.jsx)(Y2,{chargeIds:Array.from(a),onDone:c,resetMerge:i})]})]})}var Z2=`mergeBusinesses`,Q2=()=>{let[{fetching:e},t]=p(ge);return{fetching:e,mergeBusinesses:(0,Z.useCallback)(async e=>{let n=`Error merging into business ID [${e.targetBusinessId}]`,r=`${Z2}-${e.targetBusinessId}`;K.loading(`Merging Businesses`,{id:r});try{let i=Xe(await t(e),n,r);if(i)return K.success(`Success`,{id:r,description:`Businesses merged`}),i.mergeBusinesses.id}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}};function $2({businessIds:e,onDone:t,resetMerge:n}){let{mergeBusinesses:r,fetching:i}=Q2(),a=Array.from(new Set(e)),[{data:o,fetching:s}]=H({query:g,variables:{businessIds:a}}),[c,l]=(0,Z.useState)(o?.businesses[0]),u=o?.businesses.length!==a.length&&`Some businesses were not Found`||void 0,d=o?.businesses||[],f=(0,Z.useCallback)(async()=>{if(!c){K.error(`Error`,{description:`No main business selected`});return}if(a.length<2){K.error(`Error`,{description:`At least 2 businesses are required to execute a merge`});return}return await r({targetBusinessId:c.id,businessIdsToMerge:a.filter(e=>e!==c.id)}),n(),t()},[c,a,r,t,n]);return(0,Q.jsxs)(Q.Fragment,{children:[s&&(0,Q.jsx)(`div`,{className:`flex flex-col text-center w-full mb-1`,children:(0,Q.jsx)(Kr,{})}),!s&&u&&(0,Q.jsx)(`div`,{className:`flex flex-col text-center w-full mb-1`,children:(0,Q.jsx)(`h3`,{className:`sm:text-2xl text-xl font-medium title-font mb-6 text-gray-900`,children:u})}),!s&&!u&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`table`,{children:[(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{children:`Main`}),d.map(e=>(0,Q.jsx)(`td`,{children:(0,Q.jsx)(`div`,{className:`flex items-center justify-center mx-2 px-2 py-2 border-2 border-b-0 rounded-t-xl`,children:(0,Q.jsx)(zb,{checked:e.id===c?.id,size:`xl`,onClick:()=>{l(e)}})})},e.id))]}),(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{children:`Name`}),d.map(e=>(0,Q.jsx)(`td`,{children:e.name},e.id))]})]}),(0,Q.jsxs)(`div`,{className:`flex justify-center gap-5 mt-5`,children:[(0,Q.jsx)(`button`,{type:`button`,className:` text-white bg-blue-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-blue-600 rounded-sm text-lg`,disabled:s||i,onClick:f,children:`Accept`}),(0,Q.jsx)(`button`,{type:`button`,className:` text-white bg-red-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-red-600 rounded-sm text-lg`,onClick:t,children:`Cancel`}),(0,Q.jsx)(`button`,{type:`button`,className:` text-white bg-red-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-red-600 rounded-sm text-lg`,onClick:()=>{n(),t()},children:`Reset Merge`})]})]})]})}function e4(e){let[t,n]=(0,Z.useState)(!1),r=(0,Z.useCallback)(()=>n(!1),[]),{selected:i,resetMerge:a}=e,o=new Set(i.map(({id:e})=>e)),c=o.size>=1,l=c?`default`:`outline`,u=(0,Z.useCallback)(()=>{r(),i.map(({onChange:e})=>e())},[i,r]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(q,{onClick:()=>{c&&n(!0)},disabled:!c,variant:l,className:s(`size-7.5`,c?` bg-blue-500 hover:bg-blue-500/90`:``),size:`icon`,children:(0,Q.jsx)(ia,{className:`size-5`})}),(0,Q.jsx)(fO,{opened:t,onClose:r,size:`auto`,centered:!0,children:(0,Q.jsx)($2,{businessIds:Array.from(o),onDone:u,resetMerge:a})})]})}function t4({labels:e={cancel:`Cancel`,confirm:`Confirm`},title:t,onConfirm:n,onClose:r,children:i,open:a,setOpen:o}){let[s,c]=(0,Z.useState)(!1),l=o??c;return(0,Q.jsxs)(Jt,{open:a??s,onOpenChange:l,children:[i&&(0,Q.jsx)(un,{asChild:!0,onClick:e=>{e.stopPropagation(),l(e=>!e)},children:i}),(0,Q.jsxs)(cn,{className:`sm:max-w-[425px]`,children:[(0,Q.jsx)($t,{children:t&&(0,Q.jsx)(gn,{children:t})}),(0,Q.jsxs)(Xt,{children:[(0,Q.jsx)(q,{onClick:()=>{l(!1),r?.()},variant:`secondary`,children:e.cancel}),(0,Q.jsx)(q,{onClick:()=>{l(!1),n()},variant:`default`,children:e.confirm})]})]})]})}var n4=({children:e,position:t,title:n,withOverlay:r=!1,withCloseButton:i=!0,opened:a=!1,onClose:o=()=>{}})=>{let[s,c]=(0,Z.useState)(null);return(0,Q.jsx)(aX,{direction:t,open:a,onClose:o,modal:!1,children:(0,Q.jsx)(lX,{asChild:!0,withOverlay:r,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(uX,{className:`flex flex-row justify-start`,children:[(0,Q.jsx)(dX,{}),(0,Q.jsxs)(`div`,{className:`flex flex-row justify-between w-full`,children:[n,i&&(0,Q.jsx)(q,{size:`icon`,className:`size-6`,variant:`ghost`,onClick:o,children:(0,Q.jsx)(Yt,{className:`size-4 text-gray-500`})})]})]}),(0,Q.jsx)(`div`,{className:`mx-auto w-full px-4 pb-4`,ref:c,children:(0,Q.jsx)(xA.Provider,{value:s,children:e})})]})})})},r4=({chargeId:e,close:t,onChange:n})=>{let[{data:r,fetching:i}]=H({query:Ce,variables:{chargeId:e},pause:!e}),a=r?.charge;return e?(0,Q.jsx)(n4,{modalSize:`fit-content`,position:`bottom`,title:(0,Q.jsxs)(`div`,{className:`flex flex-row mx-3 pt-3 sm:text-1xl gap-10`,children:[(0,Q.jsx)(`h1`,{className:`sm:text-2xl font-small text-gray-900`,children:`Edit Charge:`}),(0,Q.jsxs)(`div`,{className:`flex flex-row gap-2`,children:[`ID: `,e,(0,Q.jsx)(BA,{isLink:!0,content:`${window.location.origin}${yt.CHARGES.DETAIL(e)}`})]})]}),opened:!!e,onClose:t,children:i||!a?(0,Q.jsx)(hi,{className:`flex self-center my-5`,color:`dark`,size:`xl`,variant:`dots`}):(0,Q.jsx)(rB,{charge:a,close:t,onChange:n??(()=>{})})}):null},i4=({onDone:e,onChange:t,documentId:n})=>n?(0,Q.jsx)(n4,{modalSize:`fit-content`,position:`bottom`,opened:!!n,onClose:e,title:(0,Q.jsxs)(`div`,{className:`flex flex-row mx-3 pt-3 sm:text-1xl gap-5`,children:[(0,Q.jsx)(`h1`,{className:`sm:text-2xl font-small text-gray-900`,children:`Edit Document`}),(0,Q.jsxs)(`div`,{className:`flex flex-row gap-2`,children:[`ID: `,n,(0,Q.jsx)(FK,{content:`Copy ID`,children:(0,Q.jsx)(BA,{content:n})}),(0,Q.jsx)(Gz,{documentId:n}),(0,Q.jsx)(GA,{documentId:n})]})]}),children:(0,Q.jsx)(LG,{documentId:n,onDone:e,onChange:t})}):null,a4=({onDone:e,data:t})=>{let[n,r]=(0,Z.useState)(!1);function i(){r(!1),e?.()}return(0,Q.jsxs)(Jt,{open:n,onOpenChange:r,children:[(0,Q.jsx)(FK,{content:`Edit Misc Expense`,children:(0,Q.jsx)(un,{asChild:!0,children:(0,Q.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7.5`,children:(0,Q.jsx)(_a,{className:`size-5`})})})}),(0,Q.jsx)(cn,{className:`sm:max-w-[425px]`,children:(0,Q.jsx)(BG,{onDone:i,data:t})})]})},o4=`updateSalaryRecord`,s4=()=>{let[{fetching:e},t]=p(ke);return{fetching:e,updateSalaryRecord:(0,Z.useCallback)(async e=>{let n=`Error updating salary record [${e.salaryRecord.month}] employee [${e.salaryRecord.employeeId}]`,r=o4;K.loading(`Updating Salary Record`,{id:r});try{let i=Xe(await t(e),n,r,`updateSalaryRecord`);if(i)return K.success(`Success`,{id:r,description:`Salary record was updated`}),i.updateSalaryRecord.salaryRecord}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}},c4=({recordVariables:e,onDone:t})=>e?(0,Q.jsx)(l4,{recordVariables:e,onDone:t}):null,l4=({recordVariables:e,onDone:t})=>{let{updateSalaryRecord:n,fetching:r}=s4(),[{data:i,fetching:a}]=H({query:Oe,variables:{employeeIDs:[e.employeeId],month:dr(new Date(e.month),`yyyy-MM-dd`)}}),o=i?.salaryRecordsByDates?.[0],s=(0,Z.useCallback)(e=>{t(),e&&n({salaryRecord:e})},[t,n]);if(!o?.employer?.id||!o?.employee?.id)return(0,Q.jsx)(Q.Fragment,{});let c={addedVacationDays:o?.vacationDays?.added,baseSalary:o?.baseAmount?.raw,bonus:o?.bonus?.raw,chargeId:o?.charge?.id,compensationsEmployerAmount:o?.compensationsAmount?.raw,compensationsEmployerPercentage:o?.compensationsPercentage,directPaymentAmount:o?.directAmount?.raw,employer:o.employer.id,employeeId:o.employee.id,gift:o?.gift?.raw,globalAdditionalHours:o?.globalAdditionalHoursAmount?.raw,healthPaymentAmount:o?.healthInsuranceAmount?.raw,month:o?.month,pensionEmployeeAmount:o?.pensionEmployeeAmount?.raw,pensionEmployeePercentage:o?.pensionEmployeePercentage,pensionEmployerAmount:o?.pensionEmployerAmount?.raw,pensionEmployerPercentage:o?.pensionEmployerPercentage,pensionFundId:o?.pensionFund?.id,recovery:o?.recovery?.raw,sicknessDaysBalance:o?.sicknessDays?.balance,socialSecurityAmountEmployee:o?.socialSecurityEmployeeAmount?.raw,socialSecurityAmountEmployer:o?.socialSecurityEmployerAmount?.raw,taxAmount:o?.incomeTaxAmount?.raw,trainingFundEmployeeAmount:o?.trainingFundEmployeeAmount?.raw,trainingFundEmployeePercentage:o?.trainingFundEmployeePercentage,trainingFundEmployerAmount:o?.trainingFundEmployerAmount?.raw,trainingFundEmployerPercentage:o?.trainingFundEmployerPercentage,trainingFundId:o?.trainingFund?.id,travelAndSubsistence:o?.travelAndSubsistence?.raw,vacationDaysBalance:o?.vacationDays?.balance,vacationTakeout:o?.vacationTakeout?.raw,workDays:o?.workDays,zkufot:o?.notionalExpense?.raw};return(0,Q.jsx)(n4,{modalSize:`fit-content`,position:`bottom`,title:(0,Q.jsxs)(`div`,{className:`flex flex-row mx-3 pt-3 sm:text-1xl gap-10`,children:[(0,Q.jsx)(`h1`,{className:`sm:text-2xl font-small text-gray-900`,children:`Edit Salary Record:`}),(0,Q.jsxs)(`div`,{className:`flex flex-row gap-2`,children:[`month: `,e.month,` employeeId: `,e.employeeId]})]}),opened:!!e,onClose:t,children:a||!o?(0,Q.jsx)(hi,{className:`flex self-center my-5`,color:`dark`,size:`xl`,variant:`dots`}):(0,Q.jsx)(DK,{isNewInsert:!1,defaultValues:c,onDone:s,isModifying:r})})},u4=`updateSortCode`,d4=()=>{let[{fetching:e},t]=p(le);return{fetching:e,updateSortCode:(0,Z.useCallback)(async e=>{let n=`Error updating sort code ID [${e.key}]`,r=`${u4}-${e.key}`;K.loading(`Updating Sort Code...`,{id:r});try{let i=Xe(await t(e),n,r,`updateSortCode`);if(i)return K.success(`Success`,{id:r,description:`SortCode updated`}),i.updateSortCode}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}return!1},[t])}};function f4({sortCodeKey:e,ownerId:t,onAdd:n}){let[r,i]=(0,Z.useState)(!1);return(0,Q.jsxs)(Jt,{open:r,onOpenChange:i,children:[(0,Q.jsx)(un,{asChild:!0,children:(0,Q.jsx)(q,{variant:`outline`,size:`icon`,children:(0,Q.jsx)(_a,{})})}),(0,Q.jsxs)(cn,{className:`w-[400px] max-w-screen-md`,children:[(0,Q.jsx)($t,{children:(0,Q.jsx)(gn,{children:`Edit Sort Code`})}),(0,Q.jsx)(p4,{sortCodeKey:e,ownerId:t,close:()=>i(!1),onAdd:n})]})]})}function p4({sortCodeKey:e,ownerId:t,close:n,onAdd:r}){let[{data:i,fetching:a}]=H({query:Se,variables:{key:e,ownerId:t}}),o=i?.sortCode;return!o&&!a&&K.error(`Error`,{description:`Couldn't find sort code`}),a?(0,Q.jsx)(Tn,{className:`h-10 w-10 animate-spin`}):o?(0,Q.jsx)(m4,{sortCode:o,close:n,onAdd:r}):(0,Q.jsx)(`div`,{children:`Sort code not found`})}function m4({sortCode:e,close:t,onAdd:n}){let r=Xn({defaultValues:e}),{handleSubmit:i,formState:{dirtyFields:a}}=r,{updateSortCode:o,fetching:s}=d4(),c=({key:r,...i})=>{let s=gt(i,a);if(s&&Object.keys(s).length>0){let r;if(s.defaultIrsCode){let e=s.defaultIrsCode,t=Number(e);if(!Number.isInteger(t)||t<2||t>9999)throw Error(`Invalid IRS code: ${e}`);r=t}o({fields:{...s,defaultIrsCode:r},key:e.key}).then(r=>{r&&(n?.(e.key),t())})}};return(0,Q.jsx)(wr,{...r,children:(0,Q.jsxs)(`form`,{onSubmit:i(c),children:[(0,Q.jsx)(`div`,{className:`flex flex-col gap-4 my-4`,children:(0,Q.jsx)(OK,{isInsert:!1,formManager:r})}),(0,Q.jsx)(`div`,{className:`flex justify-end mt-4`,children:(0,Q.jsx)(q,{type:`submit`,disabled:s,children:`Update`})})]})})}var h4=({close:e,transactionID:t,onChange:n})=>t?(0,Q.jsx)(n4,{modalSize:`fit-content`,position:`bottom`,title:(0,Q.jsxs)(`div`,{className:`flex flex-row mx-3 pt-3 sm:text-1xl gap-10`,children:[(0,Q.jsx)(`h1`,{className:`sm:text-2xl font-small text-gray-900`,children:`Edit Transaction:`}),(0,Q.jsxs)(`div`,{className:`flex flex-row gap-2`,children:[`ID: `,t,(0,Q.jsx)(BA,{content:t}),(0,Q.jsx)(Jz,{transactionId:t})]})]}),opened:!!t,onClose:e,children:(0,Q.jsx)(VG,{transactionID:t,onDone:e,onChange:n})}):null,g4={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`};function _4(e){Sr({customError:e})}function v4(){return Sr().customError}var y4;y4||={};var b4=`insertClient`,x4=()=>{let[{fetching:e},t]=p(ee);return{fetching:e,insertClient:(0,Z.useCallback)(async e=>{let n=`Error creating client [${e.fields.businessId}]`,r=`${b4}-${e.fields.businessId}`;K.loading(`Creating Client...`,{id:r});try{let i=Xe(await t(e),n,r,`insertClient`);if(i)return K.success(`Success`,{id:r,description:`Client [${e.fields.businessId}] was created`}),i.insertClient}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}},S4=er({businessId:$r().optional(),emails:Cr(fi()).optional(),generatedDocumentType:gr(Object.values(G))});function C4({businessId:e,onDone:t,showTrigger:n=!0}){let[r,i]=(0,Z.useState)(!1),{insertClient:a}=x4(),[o,s]=(0,Z.useState)(``),c={businessId:e,generatedDocumentType:G.Proforma,emails:[]};(0,Z.useEffect)(()=>{!n&&e&&i(!0)},[e,n]);let l=Xn({resolver:Ur(S4),defaultValues:c}),u=()=>{l.reset(c),i(!0)},d=()=>{if(o.trim()){let e=l.getValues(`emails`);l.setValue(`emails`,[...e??[],o.trim()],{shouldDirty:!0}),s(``)}},f=e=>{let t=l.getValues(`emails`);l.setValue(`emails`,(t??[]).filter((t,n)=>n!==e),{shouldDirty:!0})},p=(0,Z.useCallback)(async n=>{a({fields:{...n,businessId:e}}),i(!1),t?.()},[t,e,a]);return(0,Q.jsxs)(Jt,{open:r,onOpenChange:e=>{i(e),e||t?.()},children:[n&&(0,Q.jsx)(un,{asChild:!0,children:(0,Q.jsxs)(q,{size:`sm`,onClick:u,children:[(0,Q.jsx)(ln,{className:`h-4 w-4 mr-2`}),`New Client`]})}),(0,Q.jsxs)(cn,{className:`max-w-2xl max-h-[90vh] overflow-y-auto`,children:[(0,Q.jsxs)($t,{children:[(0,Q.jsx)(gn,{children:`Create New Client`}),(0,Q.jsx)(wn,{children:`Add a new client with all required details`})]}),(0,Q.jsx)(wr,{...l,children:(0,Q.jsxs)(`form`,{onSubmit:l.handleSubmit(p),children:[(0,Q.jsx)(`div`,{className:`grid gap-4 py-4`,children:(0,Q.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Q.jsx)(li,{control:l.control,name:`emails`,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Emails`}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(bn,{placeholder:`Add email...`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d())}}),(0,Q.jsx)(q,{type:`button`,size:`sm`,onClick:d,children:(0,Q.jsx)(ln,{className:`h-4 w-4`})})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.value?.map((e,t)=>(0,Q.jsxs)(xr,{variant:`secondary`,className:`gap-1`,children:[e,(0,Q.jsx)(q,{variant:`ghost`,size:`icon`,className:`p-0 size-3`,onClick:()=>f(t),children:(0,Q.jsx)(Yt,{className:`size-3 cursor-pointer`})})]},t))}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{control:l.control,name:`generatedDocumentType`,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Default Document Type`}),(0,Q.jsxs)(Sn,{onValueChange:e.onChange,defaultValue:e.value,children:[(0,Q.jsx)(ir,{children:(0,Q.jsx)(rn,{children:(0,Q.jsx)(qt,{})})}),(0,Q.jsx)(fn,{children:Object.values(G).map(e=>(0,Q.jsx)(yn,{value:e,children:Il(e)},e))})]}),(0,Q.jsx)(Tr,{})]})})]})}),(0,Q.jsxs)(Xt,{children:[(0,Q.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>{i(!1),t?.()},children:`Cancel`}),(0,Q.jsx)(q,{type:`submit`,children:`Create Client`})]})]})})]})]})}var w4=`insertNewBusiness`,T4=()=>{let[{fetching:e},t]=p(m);return{fetching:e,insertBusiness:(0,Z.useCallback)(async e=>{let n=`Error creating business [${e.fields.name}]`,r=`${w4}-${e.fields.name}`;K.loading(`Creating Business...`,{id:r});try{let i=Xe(await t(e),n,r,`insertNewBusiness`);if(i)return K.success(`Success`,{id:r,description:`Business [${e.fields.name}] was created`}),i.insertNewBusiness}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}},E4=er({businessName:Qn().min(1,`Business name is required`),locality:Qn().min(1,`Locality is required`),localName:Qn().optional(),govId:Qn().optional(),address:Qn().optional(),city:Qn().optional(),zipCode:Qn().optional(),generalContacts:Cr(fi()),website:si().optional().or(nr(``)),phone:Qn().optional(),taxCategory:Qn().optional(),sortCode:Qn().optional(),pcn874RecordType:Qn().optional(),irsCode:Qr().optional(),defaultDescription:Qn().optional(),defaultTags:Cr(Qn()),isClient:ar().default(!1).optional(),transactionPhrases:Cr(Qn()),emailAddresses:Cr(fi())}).refine(e=>e.locality!==`Israel`||!!e.localName&&!!e.govId,{message:`Local name and company number are required for Israeli businesses`,path:[`localName`]});function D4(e){let t=e.defaultDescription||e.defaultTags?.length||e.transactionPhrases?.length||e.emailAddresses?.length?{description:e.defaultDescription,tags:e.defaultTags?.map(e=>({id:e})),phrases:e.transactionPhrases,emails:e.emailAddresses}:void 0;return{name:e.businessName,country:e.locality,hebrewName:e.localName,governmentId:e.govId,address:e.address,city:e.city,zipCode:e.zipCode,phoneNumber:e.phone,website:e.website,email:e.generalContacts.join(`, `)||void 0,sortCode:e.sortCode?parseInt(e.sortCode):void 0,taxCategory:e.taxCategory,pcn874RecordType:e.pcn874RecordType,irsCode:e.irsCode,suggestions:t}}function O4({description:e,onAdd:t}){let[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(null),{insertBusiness:o,fetching:s}=T4(),c=Xn({resolver:Ur(E4),defaultValues:{businessName:e,generalContacts:[],defaultTags:[],transactionPhrases:e?[e]:[],emailAddresses:[],locality:`GAB`}}),l=async e=>{let t=await o({fields:D4(e)});e.isClient&&t?.id?a({businessId:t.id,generatedDocumentType:G.Proforma,emails:[]}):u(t?.id)},u=(e=``)=>{a(null),r(!1),c.reset(),t?.(e)};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Jt,{open:n,onOpenChange:r,children:[(0,Q.jsx)(un,{asChild:!0,children:(0,Q.jsxs)(q,{children:[(0,Q.jsx)(ln,{className:`size-4 mr-2`}),`New Business`]})}),(0,Q.jsxs)(cn,{className:`max-w-3xl max-h-[90vh] overflow-y-auto`,children:[(0,Q.jsxs)($t,{children:[(0,Q.jsx)(gn,{children:`Create New Business`}),(0,Q.jsx)(wn,{children:`Add a new business to Accounter.`})]}),(0,Q.jsx)(wr,{...c,children:(0,Q.jsxs)(`form`,{onSubmit:c.handleSubmit(l),className:`space-y-6`,children:[(0,Q.jsx)(k4,{form:c}),(0,Q.jsx)(A4,{form:c}),(0,Q.jsx)(j4,{form:c}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-3 pt-4 border-t`,children:[(0,Q.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>r(!1),children:`Cancel`}),(0,Q.jsx)(q,{type:`submit`,disabled:s,children:`Create Business`})]})]})})]})]}),i?.businessId&&(0,Q.jsx)(C4,{businessId:i.businessId,showTrigger:!1,onDone:()=>{u(i.businessId)}})]})}function k4({form:e}){let[t,n]=(0,Z.useState)(``),{userContext:r}=(0,Z.useContext)(ni),{countries:i,fetching:a}=WG(),{watch:o,setValue:s,control:c}=e,l=o(`locality`),u=e=>{t.trim()&&(s(`generalContacts`,[...e,t.trim()],{shouldDirty:!0}),n(``))},d=(e,t)=>{s(`generalContacts`,e.filter((e,n)=>n!==t),{shouldDirty:!0})},f=l===r?.context.locality;return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Contact Information`}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,Q.jsx)(li,{control:c,name:`businessName`,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Business Name *`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...e,required:!0})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{control:c,name:`locality`,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Locality / Country *`}),(0,Q.jsx)(hX,{onChange:e.onChange,data:i.map(e=>({value:e.code,label:e.name})),value:e.value,disabled:a,placeholder:`Scroll to see all options`,formPart:!0}),(0,Q.jsx)(Tr,{})]})}),f&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(li,{control:c,name:`localName`,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Local Name *`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...e,placeholder:`Business name in local language`})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{control:c,name:`govId`,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Government ID *`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...e,placeholder:`Enter Government ID`})}),(0,Q.jsx)(Tr,{})]})})]}),(0,Q.jsx)(li,{control:c,name:`address`,render:({field:e})=>(0,Q.jsxs)(cr,{className:`md:col-span-2`,children:[(0,Q.jsxs)(Dr,{children:[(0,Q.jsx)(na,{className:`size-4`}),`Address`]}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(zn,{...e,rows:2,placeholder:`Enter business address`})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{control:c,name:`city`,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`City`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...e,placeholder:`Enter business city`})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{control:c,name:`zipCode`,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Zip Code`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...e,placeholder:`Enter business zip code`})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{control:c,name:`generalContacts`,render:({field:e})=>(0,Q.jsxs)(cr,{className:`md:col-span-2`,children:[(0,Q.jsxs)(Dr,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(ta,{className:`size-4`}),`General Contacts`]}),(0,Q.jsx)(ir,{children:(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[e.value?.map((t,n)=>(0,Q.jsxs)(xr,{variant:`secondary`,className:`gap-1 pr-1`,children:[t,(0,Q.jsx)(`button`,{type:`button`,onClick:()=>d(e.value??[],n),className:`ml-1 hover:bg-muted rounded-sm p-0.5`,children:(0,Q.jsx)(Yt,{className:`size-3`})})]},n)),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(bn,{value:t,onChange:e=>n(e.target.value),onKeyDown:t=>{t.key===`Enter`&&(t.preventDefault(),u(e.value??[]))},placeholder:`Add contact email`,type:`email`}),(0,Q.jsx)(q,{type:`button`,variant:`outline`,size:`icon`,disabled:!t.trim(),onClick:()=>u(e.value??[]),children:(0,Q.jsx)(ln,{className:`size-4`})})]})]})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{control:c,name:`website`,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsxs)(Dr,{children:[(0,Q.jsx)(Xi,{className:`size-4`}),`Website`]}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...e,type:`url`,placeholder:`https://example.com`})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{control:c,name:`phone`,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsxs)(Dr,{children:[(0,Q.jsx)(sa,{className:`size-4`}),`Phone`]}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...e,type:`tel`})}),(0,Q.jsx)(Tr,{})]})})]})]})}function A4({form:e}){let{userContext:t}=(0,Z.useContext)(ni),{selectableSortCodes:n,fetching:r,sortCodes:i}=F2({ownerId:t?.context.adminBusinessId}),{selectableTaxCategories:a,fetching:o}=Qz(),{selectableTags:s,fetching:c}=Zz(),{setValue:l,control:u}=e,d=(0,Z.useCallback)(e=>{if(e){let t=i.find(t=>Number(t.key)===Number(e));t&&(t.defaultIrsCode?l(`irsCode`,t.defaultIrsCode,{shouldDirty:!0}):l(`irsCode`,void 0,{shouldDirty:!0}))}},[l,i]);return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Defaults`}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,Q.jsx)(li,{control:u,name:`sortCode`,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Sort Code`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(hX,{onChange:t=>{d(t),e.onChange(t)},data:n,value:e.value,disabled:r,placeholder:`Scroll to see all options`,formPart:!0})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{control:u,name:`taxCategory`,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Tax Category`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(hX,{data:a,disabled:o,value:e.value,onChange:e.onChange,placeholder:`Scroll to see all options`,formPart:!0})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{control:u,name:`pcn874RecordType`,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`PCN874 Record Type`}),(0,Q.jsxs)(Sn,{value:e.value,onValueChange:e.onChange,children:[(0,Q.jsx)(ir,{children:(0,Q.jsx)(rn,{children:(0,Q.jsx)(qt,{placeholder:`Select record type`})})}),(0,Q.jsx)(fn,{children:Object.entries(Rl).map(([e,t])=>(0,Q.jsx)(yn,{value:e,children:`${t} (${e})`},e))})]}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{control:u,name:`irsCode`,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`IRS Code`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(N2,{value:e.value??void 0,onValueChange:t=>e.onChange(t??null),hideControls:!0,decimalScale:0})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{control:u,name:`defaultDescription`,render:({field:e})=>(0,Q.jsxs)(cr,{className:`md:col-span-2`,children:[(0,Q.jsx)(Dr,{children:`Default Description`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{placeholder:`Enter default charge description`,...e})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{control:u,name:`defaultTags`,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Tags`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(U0,{options:Object.values(s).map(({value:e,label:t})=>({label:t,value:e})),onValueChange:e.onChange,defaultValue:e.value,value:e.value,placeholder:`Select Default Tags`,variant:`default`,disabled:c,asChild:!0})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{control:e.control,name:`isClient`,render:({field:e})=>(0,Q.jsxs)(cr,{className:`flex flex-row items-center justify-between rounded-lg border p-3 shadow-sm`,children:[(0,Q.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Q.jsx)(Dr,{children:`Client`}),(0,Q.jsx)(ur,{children:`Business is a client`})]}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(tB,{checked:e.value,onCheckedChange:e.onChange})})]})})]})]})}function j4({form:e}){let[t,n]=(0,Z.useState)(``),[r,i]=(0,Z.useState)(``),{getValues:a,setValue:o,control:s}=e,c=()=>{if(t.trim()){let r=a(`transactionPhrases`);e.setValue(`transactionPhrases`,[...r,t.trim()],{shouldDirty:!0}),n(``)}},l=()=>{if(r.trim()){let e=a(`emailAddresses`);o(`emailAddresses`,[...e,r.trim()],{shouldDirty:!0}),i(``)}},u=e=>{let t=a(`transactionPhrases`);o(`transactionPhrases`,t.filter((t,n)=>n!==e),{shouldDirty:!0})},d=e=>{let t=a(`emailAddresses`);o(`emailAddresses`,t.filter((t,n)=>n!==e),{shouldDirty:!0})};return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Auto Matching`}),` `,(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Configure patterns for automatic matching of bank transactions and documents`}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 gap-4`,children:[(0,Q.jsx)(li,{control:s,name:`transactionPhrases`,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Transaction Phrases`}),!!e.value?.length&&(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.value.map((e,t)=>(0,Q.jsxs)(xr,{variant:`secondary`,className:`gap-1`,children:[e,(0,Q.jsx)(q,{variant:`ghost`,size:`icon`,className:`p-0 size-3`,onClick:()=>u(t),children:(0,Q.jsx)(Yt,{className:`size-3 cursor-pointer`,onClick:()=>u(t)})})]},t))}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(bn,{placeholder:`Add phrase...`,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),c())}}),(0,Q.jsx)(q,{type:`button`,size:`sm`,onClick:c,children:(0,Q.jsx)(ln,{className:`size-4`})})]}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{control:s,name:`emailAddresses`,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Email Addresses`}),!!e.value?.length&&(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.value.map((e,t)=>(0,Q.jsxs)(xr,{variant:`secondary`,className:`gap-1`,children:[e,(0,Q.jsx)(q,{variant:`ghost`,size:`icon`,className:`p-0 size-3`,onClick:()=>d(t),children:(0,Q.jsx)(Yt,{className:`size-3 cursor-pointer`})})]},t))}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(bn,{type:`email`,placeholder:`Add email...`,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),l())}}),(0,Q.jsx)(q,{type:`button`,size:`sm`,onClick:l,children:(0,Q.jsx)(ln,{className:`size-4`})})]}),(0,Q.jsx)(Tr,{})]})})]})]})}var M4=({onDone:e})=>{let[t,n]=(0,Z.useState)(!1),r=()=>n(!1);function i(){r(),e?.()}return(0,Q.jsxs)(Jt,{open:t,onOpenChange:n,children:[(0,Q.jsx)(un,{asChild:!0,children:(0,Q.jsx)(FK,{asChild:!0,content:`Add New Business Trip`,children:(0,Q.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7.5`,onClick:()=>n(!0),children:(0,Q.jsx)(ra,{className:`size-5`})})})}),(0,Q.jsxs)(cn,{onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)($t,{children:(0,Q.jsx)(gn,{children:`Add Business Trip`})}),(0,Q.jsx)(KG,{onDone:i})]})]})},N4=({chargeId:e,close:t,onChange:n=()=>{}})=>e?(0,Q.jsx)(n4,{modalSize:`40%`,position:`bottom`,title:(0,Q.jsxs)(`div`,{className:`flex flex-row mx-3 pt-3 sm:text-1xl gap-10`,children:[(0,Q.jsx)(`h1`,{className:`sm:text-2xl font-small text-gray-900`,children:`Insert Document:`}),(0,Q.jsxs)(`div`,{className:`flex flex-row gap-2`,children:[`Charge ID: `,e,(0,Q.jsx)(BA,{isLink:!0,content:`${window.location.origin}${yt.CHARGES.DETAIL(e)}`})]})]}),opened:!!e,onClose:t,children:(0,Q.jsx)(YG,{chargeId:e,closeModal:t,onChange:n})}):null,P4=({onDone:e,transactionId:t,chargeId:n})=>{let[r,i]=(0,Z.useState)(!1),[{data:a,fetching:o}]=H({query:ye,pause:!t,variables:{transactionId:t}}),s=a?.transactionsByIDs[0];function c(){i(!1),e?.()}return(0,Q.jsxs)(Jt,{open:r,onOpenChange:i,children:[(0,Q.jsx)(FK,{content:`Insert Related Misc Expense`,children:(0,Q.jsx)(un,{asChild:!0,children:(0,Q.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7.5`,disabled:o,children:(0,Q.jsx)(ea,{className:`size-5`})})})}),(0,Q.jsxs)(cn,{className:`sm:max-w-[425px]`,children:[(0,Q.jsx)($t,{children:(0,Q.jsx)(gn,{children:`Insert Misc Expense`})}),s&&(0,Q.jsx)(QG,{onDone:c,chargeId:n,defaultValues:{amount:s?.amount.raw?Math.abs(s?.amount.raw):void 0,currency:s?.amount.currency,invoiceDate:s?.eventDate,valueDate:s?.exactEffectiveDate||s?.effectiveDate?new Date(s.exactEffectiveDate??s.effectiveDate):void 0,creditorId:(s?.amount.raw??0)>0?s?.counterparty?.id:void 0,debtorId:(s?.amount.raw??0)<0?s?.counterparty?.id:void 0}})]})]})},F4=`insertSalaryRecords`,I4=()=>{let[{fetching:e},t]=p(oe);return{fetching:e,insertSalaryRecord:(0,Z.useCallback)(async e=>{let n=F4;if(K.loading(`Adding salary record`,{id:n}),!e.salaryRecords||Array.isArray(e.salaryRecords)&&e.salaryRecords.length===0){K.error(`Error`,{id:n,description:`No salary records to insert`,duration:1e5,closeButton:!0});return}let r=Array.isArray(e.salaryRecords)?e.salaryRecords[0]:e.salaryRecords;if(!r?.directPaymentAmount||!r?.employeeId||!r?.employer||!r?.month){K.error(`Error`,{id:n,description:`Missing required salary record fields`,duration:1e5,closeButton:!0});return}let i=`Error adding salary record [${r.month}] employee [${r.employeeId}]`;try{let r=Xe(await t(e),i,n,`insertSalaryRecords`);if(r)return K.success(`Success`,{id:n,description:`Salary record was added`}),r.insertSalaryRecords.salaryRecords[0]}catch(e){console.error(`${i}: ${e}`),K.error(`Error`,{id:n,description:i,duration:1e5,closeButton:!0})}},[t])}},L4=({insertSalaryRecordParams:e,setInsertSalaryRecord:t})=>{let{insertSalaryRecord:n,fetching:r}=I4(),i=(0,Z.useCallback)(e=>{e&&n({salaryRecords:[e]}),t(void 0)},[t,n]);return(0,Q.jsx)(n4,{modalSize:`40%`,position:`bottom`,title:(0,Q.jsx)(`div`,{className:`flex flex-row mx-3 pt-3 sm:text-1xl gap-10`,children:(0,Q.jsx)(`h1`,{className:`sm:text-2xl font-small text-gray-900`,children:`Insert Salary Record:`})}),opened:!!e,onClose:()=>t(void 0),children:(0,Q.jsx)(DK,{isNewInsert:!0,onDone:i,isModifying:r,month:e.month})})},R4=`addSortCode`,z4=()=>{let[{fetching:e},t]=p(Te);return{fetching:e,addSortCode:(0,Z.useCallback)(async e=>{let n=`Error adding new sort code [${e.name}]`,r=`${R4}-${e.name}`;K.loading(`Adding sort code`,{id:r});try{Xe(await t(e),n,r)&&K.success(`Success`,{id:r,description:`"${e.name}" sort code was successfully added`})}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}};function B4({onAdd:e}){let[t,n]=(0,Z.useState)(!1);return(0,Q.jsxs)(Jt,{open:t,onOpenChange:n,children:[(0,Q.jsx)(un,{asChild:!0,children:(0,Q.jsx)(q,{children:`Add Sort Code`})}),(0,Q.jsxs)(cn,{className:`w-[90vw] max-w-screen-md`,children:[(0,Q.jsx)($t,{children:(0,Q.jsx)(gn,{children:`Add New Sort Code`})}),(0,Q.jsx)(V4,{close:()=>n(!1),onAdd:e})]})]})}function V4({close:e,onAdd:t}){let n=Xn({}),{handleSubmit:r}=n,{addSortCode:i,fetching:a}=z4(),o=n=>{n.key&&=parseInt(n.key.toString()),n.defaultIrsCode&&=parseInt(n.defaultIrsCode.toString()),i(n).then(()=>{e(),t?.()})};return(0,Q.jsx)(wr,{...n,children:(0,Q.jsxs)(`form`,{onSubmit:r(o),children:[(0,Q.jsx)(`div`,{className:`flex flex-col gap-4 my-4`,children:(0,Q.jsx)(OK,{isInsert:!0,formManager:n})}),(0,Q.jsx)(`div`,{className:`flex justify-end mt-4`,children:(0,Q.jsx)(q,{type:`submit`,disabled:a,children:`Add Sort Code`})})]})})}var H4=`insertTaxCategory`,U4=()=>{let[{fetching:e},t]=p(U);return{fetching:e,insertTaxCategory:(0,Z.useCallback)(async e=>{let n=`Error creating tax category`,r=H4;K.loading(`Adding Tax Category`,{id:r});try{let i=Xe(await t(e),n,r);if(i)return K.success(`Success`,{id:r,description:`${i.insertTaxCategory.name} was created`}),i.insertTaxCategory}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}};function W4({formManager:e,setFetching:t,isInsert:n,ownerId:r}){let{control:i,setValue:a}=e;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(li,{name:`name`,control:i,rules:{required:`Required`,minLength:{value:2,message:`Must be at least 2 characters`}},render:({field:e,fieldState:t})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Name`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...e,value:e.value??void 0,required:!0,className:n?``:_t(t)})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`sortCode`,control:i,render:({field:e,fieldState:i})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Sort Code`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(I2,{ownerId:r,value:e.value,onChange:(t,n)=>{e.onChange(t),n?.defaultIrsCode&&a(`irsCode`,n.defaultIrsCode,{shouldDirty:!0})},onFetchingChange:t,formPart:!0,triggerClassName:n?void 0:_t(i)})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{name:`irsCode`,control:i,render:({field:e,fieldState:t})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`IRS Code`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(N2,{...e,className:n?``:_t(t),value:e.value??void 0,hideControls:!0,decimalScale:0})}),(0,Q.jsx)(Tr,{})]})}),(0,Q.jsx)(li,{control:i,name:`taxExcluded`,render:({field:e})=>(0,Q.jsxs)(cr,{className:`flex flex-row items-center justify-between`,children:[(0,Q.jsx)(`div`,{className:`space-y-0.5`,children:(0,Q.jsx)(Dr,{children:`Tax excluded category`})}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(tB,{onCheckedChange:e.onChange,checked:e.value??void 0})})]})})]})}function G4({onAdd:e}){let[t,n]=(0,Z.useState)(!1);return(0,Q.jsxs)(Jt,{open:t,onOpenChange:n,children:[(0,Q.jsx)(un,{asChild:!0,children:(0,Q.jsx)(q,{children:`Add Tax Category`})}),(0,Q.jsxs)(cn,{className:`w-[90vw] max-w-screen-md`,children:[(0,Q.jsx)($t,{children:(0,Q.jsx)(gn,{children:`Add New Tax Category`})}),(0,Q.jsx)(K4,{close:()=>n(!1),onAdd:e})]})]})}function K4({close:e,onAdd:t}){let n=Xn({}),{handleSubmit:r}=n,[i,a]=(0,Z.useState)(!1),{userContext:o}=(0,Z.useContext)(ni),{insertTaxCategory:s,fetching:c}=U4(),l=n=>{n.sortCode&&=parseInt(n.sortCode.toString()),s({fields:n}).then(n=>{n?.id&&(t?.(n.id),e())})};return(0,Q.jsx)(wr,{...n,children:(0,Q.jsxs)(`form`,{onSubmit:r(l),children:[(0,Q.jsx)(`div`,{className:`flex flex-col gap-4 my-4`,children:(0,Q.jsx)(W4,{isInsert:!0,formManager:n,setFetching:a,ownerId:o?.context.adminBusinessId})}),(0,Q.jsx)(`div`,{className:`flex justify-end mt-4`,children:(0,Q.jsx)(q,{type:`submit`,disabled:c||i,children:`Add Tax Category`})})]})})}var q4=`issueDocument`,J4=()=>{let[{fetching:e},t]=p(P);return{fetching:e,issueDocument:(0,Z.useCallback)(async e=>{let n=`Error issuing document`,r=q4;K.loading(`Issuing document...`,{id:r});try{let i=Xe(await t(e),n,r,`issueGreenInvoiceDocument`);if(i)return K.success(`Success`,{id:r,description:`Document issued successfully`,duration:3e3}),i.issueGreenInvoiceDocument}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}},Y4=`previewDocument`,X4=()=>{let[{fetching:e},t]=p(h);return{fetching:e,previewDocument:(0,Z.useCallback)(async e=>{let n=`Error generating document preview`,r=Y4;K.loading(`Generating document preview...`,{id:r});try{let i=Xe(await t(e),n,r,`previewDocument`);if(i)return K.success(`Success`,{id:r,description:`Document preview generated`,duration:3e3}),i.previewDocument}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}},[t])}};function Z4({className:e,...t}){return(0,Q.jsx)(La,{"data-slot":`checkbox`,className:s(`peer border-gray-200 dark:bg-gray-200/30 data-[state=checked]:bg-gray-900 data-[state=checked]:text-gray-50 dark:data-[state=checked]:bg-gray-900 data-[state=checked]:border-gray-900 focus-visible:border-gray-950 focus-visible:ring-gray-950/50 aria-invalid:ring-red-500/20 dark:aria-invalid:ring-red-500/40 aria-invalid:border-red-500 size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-800 dark:dark:bg-gray-800/30 dark:data-[state=checked]:bg-gray-50 dark:data-[state=checked]:text-gray-900 dark:dark:data-[state=checked]:bg-gray-50 dark:data-[state=checked]:border-gray-50 dark:focus-visible:border-gray-300 dark:focus-visible:ring-gray-300/50 dark:aria-invalid:ring-red-900/20 dark:dark:aria-invalid:ring-red-900/40 dark:aria-invalid:border-red-900`,e),...t,children:(0,Q.jsx)(za,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center text-current transition-none`,children:(0,Q.jsx)(dn,{className:`size-3.5`})})})}function Q4({isOpen:e,onClose:t,onIssue:n,clientName:r,clientEmails:i=[],documentType:a=G.Unprocessed}){let[o,s]=(0,Z.useState)({emailContent:``,attachment:!0,sendEmail:!1}),[c,l]=(0,Z.useState)(!1),u=(e,t)=>{s(n=>({...n,[e]:t}))},d=async e=>{e.preventDefault(),l(!0);try{await n(o),t(),s({emailContent:``,attachment:!0,sendEmail:!1})}catch(e){console.error(`Failed to issue document:`,e)}finally{l(!1)}},f=()=>{c||t()};return(0,Q.jsx)(Jt,{open:e,onOpenChange:f,children:(0,Q.jsxs)(cn,{className:`sm:max-w-[500px]`,children:[(0,Q.jsxs)($t,{children:[(0,Q.jsxs)(gn,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(ta,{className:`w-5 h-5`}),`Issue Document`]}),(0,Q.jsxs)(wn,{children:[`Configure email settings before sending the `,Il(a),` to the client.`]})]}),(0,Q.jsxs)(`form`,{onSubmit:d,className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,Q.jsx)(Z4,{id:`sendEmail`,checked:o.sendEmail,onCheckedChange:e=>u(`sendEmail`,e===!0),disabled:c}),(0,Q.jsx)(mn,{htmlFor:`sendEmail`,className:`text-sm font-medium`,children:`Send email to client`})]}),(0,Q.jsx)(`div`,{className:`text-xs text-gray-500 ml-6`,children:`When disabled, email will not be sent to the client.`}),r&&(0,Q.jsxs)(`div`,{className:`bg-gray-50 p-3 rounded-lg`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-gray-700`,children:`Sending to:`}),(0,Q.jsx)(`div`,{className:`text-sm text-gray-900`,children:r}),i.length>0&&(0,Q.jsx)(`div`,{className:`text-xs text-gray-600 mt-1`,children:i.join(`, `)})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(mn,{htmlFor:`emailContent`,children:`Email Message`}),(0,Q.jsx)(zn,{id:`emailContent`,value:o.emailContent,onChange:e=>u(`emailContent`,e.target.value),placeholder:`Add a custom message to include in the email (optional)`,className:`min-h-[100px]`,disabled:c||!o.sendEmail}),(0,Q.jsx)(`div`,{className:`text-xs text-gray-500`,children:`This message will be included in the email sent to the client along with the document.`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,Q.jsx)(Z4,{id:`attachment`,checked:o.attachment,onCheckedChange:e=>u(`attachment`,e===!0),disabled:c||!o.sendEmail}),(0,Q.jsx)(mn,{htmlFor:`attachment`,className:`text-sm font-medium`,children:`Attach document to email`})]}),(0,Q.jsx)(`div`,{className:`text-xs text-gray-500 ml-6`,children:`When enabled, the PDF document will be attached to the email sent to the client.`}),(0,Q.jsxs)(Xt,{className:`gap-2`,children:[(0,Q.jsx)(q,{type:`button`,variant:`outline`,onClick:f,disabled:c,children:`Cancel`}),(0,Q.jsx)(q,{type:`submit`,disabled:c,children:c?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Tn,{className:`w-4 h-4 mr-2 animate-spin`}),`Issuing...`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ma,{className:`w-4 h-4 mr-2`}),`Issue Document`]})})]})]})]})})}var $4={},e3={};e3.byteLength=c3,e3.toByteArray=u3,e3.fromByteArray=p3;for(var t3=[],n3=[],r3=typeof Uint8Array<`u`?Uint8Array:Array,i3=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a3=0,o3=i3.length;a3<o3;++a3)t3[a3]=i3[a3],n3[i3.charCodeAt(a3)]=a3;n3[45]=62,n3[95]=63;function s3(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c3(e){var t=s3(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l3(e,t,n){return(t+n)*3/4-n}function u3(e){var t,n=s3(e),r=n[0],i=n[1],a=new r3(l3(e,r,i)),o=0,s=i>0?r-4:r,c;for(c=0;c<s;c+=4)t=n3[e.charCodeAt(c)]<<18|n3[e.charCodeAt(c+1)]<<12|n3[e.charCodeAt(c+2)]<<6|n3[e.charCodeAt(c+3)],a[o++]=t>>16&255,a[o++]=t>>8&255,a[o++]=t&255;return i===2&&(t=n3[e.charCodeAt(c)]<<2|n3[e.charCodeAt(c+1)]>>4,a[o++]=t&255),i===1&&(t=n3[e.charCodeAt(c)]<<10|n3[e.charCodeAt(c+1)]<<4|n3[e.charCodeAt(c+2)]>>2,a[o++]=t>>8&255,a[o++]=t&255),a}function d3(e){return t3[e>>18&63]+t3[e>>12&63]+t3[e>>6&63]+t3[e&63]}function f3(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d3(r));return i.join(``)}function p3(e){for(var t,n=e.length,r=n%3,i=[],a=16383,o=0,s=n-r;o<s;o+=a)i.push(f3(e,o,o+a>s?s:o+a));return r===1?(t=e[n-1],i.push(t3[t>>2]+t3[t<<4&63]+`==`)):r===2&&(t=(e[n-2]<<8)+e[n-1],i.push(t3[t>>10]+t3[t>>4&63]+t3[t<<2&63]+`=`)),i.join(``)}var m3={};m3.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},m3.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128},(function(e){let t=e3,n=m3,r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=u,e.SlowBuffer=x,e.INSPECT_MAX_BYTES=50;let i=2147483647;e.kMaxLength=i;let{Uint8Array:a,ArrayBuffer:o,SharedArrayBuffer:s}=globalThis;u.TYPED_ARRAY_SUPPORT=c(),!u.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function c(){try{let e=new a(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,a.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function l(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new a(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return m(e)}return d(e,t,n)}u.poolSize=8192;function d(e,t,n){if(typeof e==`string`)return h(e,t);if(o.isView(e))return _(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(ge(e,o)||e&&ge(e.buffer,o)||s!==void 0&&(ge(e,s)||e&&ge(e.buffer,s)))return v(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return u.from(r,t,n);let i=y(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return u.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}u.from=function(e,t,n){return d(e,t,n)},Object.setPrototypeOf(u.prototype,a.prototype),Object.setPrototypeOf(u,a);function f(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function p(e,t,n){return f(e),e<=0||t===void 0?l(e):typeof n==`string`?l(e).fill(t,n):l(e).fill(t)}u.alloc=function(e,t,n){return p(e,t,n)};function m(e){return f(e),l(e<0?0:b(e)|0)}u.allocUnsafe=function(e){return m(e)},u.allocUnsafeSlow=function(e){return m(e)};function h(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!u.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=S(e,t)|0,r=l(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function g(e){let t=e.length<0?0:b(e.length)|0,n=l(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function _(e){if(ge(e,a)){let t=new a(e);return v(t.buffer,t.byteOffset,t.byteLength)}return g(e)}function v(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new a(e):n===void 0?new a(e,t):new a(e,t,n),Object.setPrototypeOf(r,u.prototype),r}function y(e){if(u.isBuffer(e)){let t=b(e.length)|0,n=l(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||_e(e.length)?l(0):g(e);if(e.type===`Buffer`&&Array.isArray(e.data))return g(e.data)}function b(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function x(e){return+e!=e&&(e=0),u.alloc(+e)}u.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==u.prototype},u.compare=function(e,t){if(ge(e,a)&&(e=u.from(e,e.offset,e.byteLength)),ge(t,a)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},u.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},u.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return u.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=u.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(ge(t,a))i+t.length>r.length?(u.isBuffer(t)||(t=u.from(t)),t.copy(r,i)):a.prototype.set.call(r,t,i);else if(u.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function S(e,t){if(u.isBuffer(e))return e.length;if(o.isView(e)||ge(e,o))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return de(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return me(e).length;default:if(i)return r?-1:de(e).length;t=(``+t).toLowerCase(),i=!0}}u.byteLength=S;function C(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return R(this,t,n);case`utf8`:case`utf-8`:return N(this,t,n);case`ascii`:return I(this,t,n);case`latin1`:case`binary`:return L(this,t,n);case`base64`:return M(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return z(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}u.prototype._isBuffer=!0;function w(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}u.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)w(this,t,t+1);return this},u.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)w(this,t,t+3),w(this,t+1,t+2);return this},u.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)w(this,t,t+7),w(this,t+1,t+6),w(this,t+2,t+5),w(this,t+3,t+4);return this},u.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?N(this,0,e):C.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(e){if(!u.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||u.compare(this,e)===0},u.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(u.prototype[r]=u.prototype.inspect),u.prototype.compare=function(e,t,n,r,i){if(ge(e,a)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let o=i-r,s=n-t,c=Math.min(o,s),l=this.slice(r,i),d=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==d[e]){o=l[e],s=d[e];break}return o<s?-1:+(s<o)};function T(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,_e(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=u.from(t,r)),u.isBuffer(t))return t.length===0?-1:E(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof a.prototype.indexOf==`function`?i?a.prototype.indexOf.call(e,t,n):a.prototype.lastIndexOf.call(e,t,n):E(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function E(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}u.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},u.prototype.indexOf=function(e,t,n){return T(this,e,t,n,!0)},u.prototype.lastIndexOf=function(e,t,n){return T(this,e,t,n,!1)};function D(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(_e(r))return o;e[n+o]=r}return o}function O(e,t,n,r){return he(de(t,e.length-n),e,n,r)}function k(e,t,n,r){return he(fe(t),e,n,r)}function A(e,t,n,r){return he(me(t),e,n,r)}function j(e,t,n,r){return he(pe(t,e.length-n),e,n,r)}u.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return D(this,e,t,n);case`utf8`:case`utf-8`:return O(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return k(this,e,t,n);case`base64`:return A(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return j(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},u.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function M(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function N(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return F(r)}let P=4096;function F(e){let t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=P));return n}function I(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function L(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function R(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=ve[e[r]];return i}function z(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}u.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,u.prototype),r};function B(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}u.prototype.readUintLE=u.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},u.prototype.readUintBE=u.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readBigUInt64LE=ye(function(e){e>>>=0,se(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ce(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),u.prototype.readBigUInt64BE=ye(function(e){e>>>=0,se(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ce(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),u.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},u.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},u.prototype.readInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||B(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},u.prototype.readInt16BE=function(e,t){e>>>=0,t||B(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readBigInt64LE=ye(function(e){e>>>=0,se(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ce(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),u.prototype.readBigInt64BE=ye(function(e){e>>>=0,se(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ce(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),u.prototype.readFloatLE=function(e,t){return e>>>=0,t||B(e,4,this.length),n.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||B(e,4,this.length),n.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||B(e,8,this.length),n.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||B(e,8,this.length),n.read(this,e,!1,52,8)};function V(e,t,n,r,i,a){if(!u.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;V(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;V(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,1,255,0),this[t]=e&255,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function ee(e,t,n,r,i){W(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function te(e,t,n,r,i){W(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}u.prototype.writeBigUInt64LE=ye(function(e,t=0){return ee(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),u.prototype.writeBigUInt64BE=ye(function(e,t=0){return te(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);V(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);V(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},u.prototype.writeBigInt64LE=ye(function(e,t=0){return ee(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),u.prototype.writeBigInt64BE=ye(function(e,t=0){return te(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function H(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function ne(e,t,r,i,a){return t=+t,r>>>=0,a||H(e,t,r,4),n.write(e,t,r,i,23,4),r+4}u.prototype.writeFloatLE=function(e,t,n){return ne(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return ne(this,e,t,!1,n)};function re(e,t,r,i,a){return t=+t,r>>>=0,a||H(e,t,r,8),n.write(e,t,r,i,52,8),r+8}u.prototype.writeDoubleLE=function(e,t,n){return re(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return re(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(!u.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof a.prototype.copyWithin==`function`?this.copyWithin(t,n,r):a.prototype.set.call(e,this.subarray(n,r),t),i},u.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!u.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=u.isBuffer(e)?e:u.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};let ie={};function U(e,t,n){ie[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}U(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),U(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),U(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=ae(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=ae(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function ae(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function oe(e,t,n){se(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&ce(t,e.length-(n+1))}function W(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new ie.ERR_OUT_OF_RANGE(`value`,i,e)}oe(r,i,a)}function se(e,t){if(typeof e!=`number`)throw new ie.ERR_INVALID_ARG_TYPE(t,`number`,e)}function ce(e,t,n){throw Math.floor(e)===e?t<0?new ie.ERR_BUFFER_OUT_OF_BOUNDS:new ie.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(se(e,n),new ie.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let le=/[^+/0-9A-Za-z-_]/g;function ue(e){if(e=e.split(`=`)[0],e=e.trim().replace(le,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function de(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function fe(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function pe(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function me(e){return t.toByteArray(ue(e))}function he(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function ge(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function _e(e){return e!==e}let ve=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function ye(e){return typeof BigInt>`u`?be:e}function be(){throw Error(`BigInt not supported`)}})($4);var h3=$4.Buffer;$4.Blob,$4.BlobOptions,$4.Buffer,$4.File,$4.FileOptions,$4.INSPECT_MAX_BYTES,$4.SlowBuffer,$4.TranscodeEncoding,$4.atob,$4.btoa,$4.constants,$4.isAscii,$4.isUtf8,$4.kMaxLength,$4.kStringMaxLength,$4.resolveObjectURL,$4.transcode,i();var g3=typeof t==`object`&&t+``==`[object process]`&&!t.versions.nw&&!(t.versions.electron&&t.type&&t.type!==`browser`),_3=[1/0,1/0,-1/0,-1/0],v3=new Float32Array(_3),y3=[.001,0,0,.001,0,0],b3=1.35,x3=`http://www.w3.org/2000/svg`,S3={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},C3={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},w3=`pdfjs_internal_id_`,T3=`pdfjs_internal_editor_`,E3={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},D3={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,INK_COLOR_AND_OPACITY:24,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},O3={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},k3={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},A3={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},j3={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26,RICHMEDIA:27},M3={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},N3={ERRORS:0,WARNINGS:1,INFOS:5},P3={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},F3={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},I3={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},L3=N3.WARNINGS;function R3(e){Number.isInteger(e)&&(L3=e)}function z3(){return L3}function B3(e){L3>=N3.INFOS&&console.info(`Info: ${e}`)}function V3(e){L3>=N3.WARNINGS&&console.warn(`Warning: ${e}`)}function H3(e){throw Error(e)}function U3(e,t){e||H3(t)}function W3(e){switch(e?.protocol){case`http:`:case`https:`:case`ftp:`:case`mailto:`:case`tel:`:return!0;default:return!1}}function G3(e,t=null,n=null){if(!e)return null;if(n&&typeof e==`string`&&(n.addDefaultProtocol&&e.startsWith(`www.`)&&e.match(/\./g)?.length>=2&&(e=`http://${e}`),n.tryConvertEncoding))try{e=a6(e)}catch{}let r=t?URL.parse(e,t):URL.parse(e);return W3(r)?r:null}function K3(e,t,n=!1){let r=URL.parse(e);return r?(r.hash=t,r.href):n&&G3(e,`http://example.com`)?e.split(`#`,1)[0]+`${t?`#${t}`:``}`:``}function q3(e){return e.substring(e.lastIndexOf(`/`)+1)}function J3(e,t,n,r=!1){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!0,writable:!1}),n}var Y3=function(){function e(e,t){this.message=e,this.name=t}return e.prototype=Error(),e.constructor=e,e}(),X3=class extends Y3{constructor(e,t){super(e,`PasswordException`),this.code=t}},Z3=class extends Y3{constructor(e,t){super(e,`UnknownErrorException`),this.details=t}},Q3=class extends Y3{constructor(e){super(e,`InvalidPDFException`)}},$3=class extends Y3{constructor(e,t,n){super(e,`ResponseException`),this.status=t,this.missing=n}},e6=class extends Y3{constructor(e){super(e,`FormatError`)}},t6=class extends Y3{constructor(e){super(e,`AbortException`)}};function n6(e){(typeof e!=`object`||e?.length===void 0)&&H3(`Invalid argument for bytesToString`);let t=e.length,n=8192;if(t<n)return String.fromCharCode.apply(null,e);let r=[];for(let i=0;i<t;i+=n){let a=Math.min(i+n,t),o=e.subarray(i,a);r.push(String.fromCharCode.apply(null,o))}return r.join(``)}function r6(e){typeof e!=`string`&&H3(`Invalid argument for stringToBytes`);let t=e.length,n=new Uint8Array(t);for(let r=0;r<t;++r)n[r]=e.charCodeAt(r)&255;return n}var i6=class{static get isLittleEndian(){let e=new Uint8Array(4);e[0]=1;let t=new Uint32Array(e.buffer,0,1);return J3(this,`isLittleEndian`,t[0]===1)}static get isOffscreenCanvasSupported(){return J3(this,`isOffscreenCanvasSupported`,typeof OffscreenCanvas<`u`)}static get isImageDecoderSupported(){return J3(this,`isImageDecoderSupported`,typeof ImageDecoder<`u`)}static get isFloat16ArraySupported(){return J3(this,`isFloat16ArraySupported`,typeof Float16Array<`u`)}static get isSanitizerSupported(){return J3(this,`isSanitizerSupported`,typeof Sanitizer<`u`)}static get platform(){let{platform:e,userAgent:t}=navigator;return J3(this,`platform`,{isAndroid:t.includes(`Android`),isLinux:e.includes(`Linux`),isMac:e.includes(`Mac`),isWindows:e.includes(`Win`),isFirefox:t.includes(`Firefox`)})}static get isCanvasFilterSupported(){let e;return this.isOffscreenCanvasSupported?e=new OffscreenCanvas(1,1).getContext(`2d`):typeof document<`u`&&(e=document.createElement(`canvas`).getContext(`2d`)),J3(this,`isCanvasFilterSupported`,e?.filter!==void 0)}static get isAlphaColorInputSupported(){if(typeof document>`u`)return J3(this,`isAlphaColorInputSupported`,!1);let e=document.createElement(`input`);return e.type=`color`,e.setAttribute(`alpha`,``),e.value=`#ff000080`,J3(this,`isAlphaColorInputSupported`,e.value!==`#ff0000`)}static get isBackdropFilterSupported(){return J3(this,`isBackdropFilterSupported`,typeof CSS<`u`&&CSS.supports(`backdrop-filter`,`blur(1px)`))}},$=class{static get hexNums(){return J3(this,`hexNums`,Array.from(Array(256).keys(),e=>e.toString(16).padStart(2,`0`)))}static makeHexColor(e,t,n){return`#${this.hexNums[e]}${this.hexNums[t]}${this.hexNums[n]}`}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static multiplyByDOMMatrix(e,t){return[e[0]*t.a+e[2]*t.b,e[1]*t.a+e[3]*t.b,e[0]*t.c+e[2]*t.d,e[1]*t.c+e[3]*t.d,e[0]*t.e+e[2]*t.f+e[4],e[1]*t.e+e[3]*t.f+e[5]]}static applyTransform(e,t,n=0){let r=e[n],i=e[n+1];e[n]=r*t[0]+i*t[2]+t[4],e[n+1]=r*t[1]+i*t[3]+t[5]}static applyTransformToBezier(e,t,n=0){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5];for(let t=0;t<6;t+=2){let l=e[n+t],u=e[n+t+1];e[n+t]=l*r+u*a+s,e[n+t+1]=l*i+u*o+c}}static applyInverseTransform(e,t){let n=e[0],r=e[1],i=t[0]*t[3]-t[1]*t[2];e[0]=(n*t[3]-r*t[2]+t[2]*t[5]-t[4]*t[3])/i,e[1]=(-n*t[1]+r*t[0]+t[4]*t[1]-t[5]*t[0])/i}static axialAlignedBoundingBox(e,t,n){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=e[0],u=e[1],d=e[2],f=e[3],p=r*l+s,m=p,h=r*d+s,g=h,_=o*u+c,v=_,y=o*f+c,b=y;if(i!==0||a!==0){let e=i*l,t=i*d,n=a*u,r=a*f;p+=n,g+=n,h+=r,m+=r,_+=e,b+=e,y+=t,v+=t}n[0]=Math.min(n[0],p,h,m,g),n[1]=Math.min(n[1],_,y,v,b),n[2]=Math.max(n[2],p,h,m,g),n[3]=Math.max(n[3],_,y,v,b)}static inverseTransform(e){let t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e,t){let n=e[0],r=e[1],i=e[2],a=e[3],o=n**2+r**2,s=n*i+r*a,c=i**2+a**2,l=(o+c)/2,u=Math.sqrt(l**2-(o*c-s**2));t[0]=Math.sqrt(l+u||1),t[1]=Math.sqrt(l-u||1)}static normalizeRect(e){let t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){let n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>r)return null;let i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>a?null:[n,i,r,a]}static pointBoundingBox(e,t,n){n[0]=Math.min(n[0],e),n[1]=Math.min(n[1],t),n[2]=Math.max(n[2],e),n[3]=Math.max(n[3],t)}static rectBoundingBox(e,t,n,r,i){i[0]=Math.min(i[0],e,n),i[1]=Math.min(i[1],t,r),i[2]=Math.max(i[2],e,n),i[3]=Math.max(i[3],t,r)}static#e(e,t,n,r,i,a,o,s,c,l){if(c<=0||c>=1)return;let u=1-c,d=c*c,f=d*c,p=u*(u*(u*e+3*c*t)+3*d*n)+f*r,m=u*(u*(u*i+3*c*a)+3*d*o)+f*s;l[0]=Math.min(l[0],p),l[1]=Math.min(l[1],m),l[2]=Math.max(l[2],p),l[3]=Math.max(l[3],m)}static#t(e,t,n,r,i,a,o,s,c,l,u,d){if(Math.abs(c)<1e-12){Math.abs(l)>=1e-12&&this.#e(e,t,n,r,i,a,o,s,-u/l,d);return}let f=l**2-4*u*c;if(f<0)return;let p=Math.sqrt(f),m=2*c;this.#e(e,t,n,r,i,a,o,s,(-l+p)/m,d),this.#e(e,t,n,r,i,a,o,s,(-l-p)/m,d)}static bezierBoundingBox(e,t,n,r,i,a,o,s,c){c[0]=Math.min(c[0],e,o),c[1]=Math.min(c[1],t,s),c[2]=Math.max(c[2],e,o),c[3]=Math.max(c[3],t,s),this.#t(e,n,i,o,t,r,a,s,3*(-e+3*(n-i)+o),6*(e-2*n+i),3*(n-e),c),this.#t(e,n,i,o,t,r,a,s,3*(-t+3*(r-a)+s),6*(t-2*r+a),3*(r-t),c)}};function a6(e){return decodeURIComponent(escape(e))}var o6=null,s6=null;function c6(e){return o6||(o6=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,s6=new Map([[`ſt`,`ſt`]])),e.replaceAll(o6,(e,t,n)=>t?t.normalize(`NFKC`):s6.get(n))}function l6(){if(typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=new Uint8Array(32);return crypto.getRandomValues(e),n6(e)}function u6(e,t,n){if(!Array.isArray(n)||n.length<2)return!1;let[r,i,...a]=n;if(!e(r)&&!Number.isInteger(r)||!t(i))return!1;let o=a.length,s=!0;switch(i.name){case`XYZ`:if(o<2||o>3)return!1;break;case`Fit`:case`FitB`:return o===0;case`FitH`:case`FitBH`:case`FitV`:case`FitBV`:if(o>1)return!1;break;case`FitR`:if(o!==4)return!1;s=!1;break;default:return!1}for(let e of a)if(!(typeof e==`number`||s&&e===null))return!1;return!0}var d6=()=>[],f6=()=>new Map,p6=()=>Object.create(null);function m6(e,t,n){return Math.min(Math.max(e,t),n)}var h6=class e{constructor({viewBox:e,userUnit:t,scale:n,rotation:r,offsetX:i=0,offsetY:a=0,dontFlip:o=!1}){this.viewBox=e,this.userUnit=t,this.scale=n,this.rotation=r,this.offsetX=i,this.offsetY=a,n*=t;let s=(e[2]+e[0])/2,c=(e[3]+e[1])/2,l,u,d,f;switch(r%=360,r<0&&(r+=360),r){case 180:l=-1,u=0,d=0,f=1;break;case 90:l=0,u=1,d=1,f=0;break;case 270:l=0,u=-1,d=-1,f=0;break;case 0:l=1,u=0,d=0,f=-1;break;default:throw Error(`PageViewport: Invalid rotation, must be a multiple of 90 degrees.`)}o&&(d=-d,f=-f);let p,m,h,g;l===0?(p=Math.abs(c-e[1])*n+i,m=Math.abs(s-e[0])*n+a,h=(e[3]-e[1])*n,g=(e[2]-e[0])*n):(p=Math.abs(s-e[0])*n+i,m=Math.abs(c-e[1])*n+a,h=(e[2]-e[0])*n,g=(e[3]-e[1])*n),this.transform=[l*n,u*n,d*n,f*n,p-l*n*s-d*n*c,m-u*n*s-f*n*c],this.width=h,this.height=g}get rawDims(){let e=this.viewBox;return J3(this,`rawDims`,{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:t=this.scale,rotation:n=this.rotation,offsetX:r=this.offsetX,offsetY:i=this.offsetY,dontFlip:a=!1}={}){return new e({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:n,offsetX:r,offsetY:i,dontFlip:a})}convertToViewportPoint(e,t){let n=[e,t];return $.applyTransform(n,this.transform),n}convertToPdfPoint(e,t){let n=[e,t];return $.applyInverseTransform(n,this.transform),n}},g6=class e{static textContent(t){let n=[],r={items:n,styles:Object.create(null)};function i(t){if(!t)return;let r=null,a=t.name;if(a===`#text`)r=t.value;else if(e.shouldBuildText(a))t?.attributes?.textContent?r=t.attributes.textContent:t.value&&(r=t.value);else return;if(r!==null&&n.push({str:r}),t.children)for(let e of t.children)i(e)}return i(t),r}static shouldBuildText(e){return!(e===`textarea`||e===`input`||e===`option`||e===`select`)}},_6=class{static setupStorage(e,t,n,r,i){let a=r.getValue(t,{value:null});switch(n.name){case`textarea`:if(a.value!==null&&(e.textContent=a.value),i===`print`)break;e.addEventListener(`input`,e=>{r.setValue(t,{value:e.target.value})});break;case`input`:if(n.attributes.type===`radio`||n.attributes.type===`checkbox`){if(a.value===n.attributes.xfaOn?e.setAttribute(`checked`,!0):a.value===n.attributes.xfaOff&&e.removeAttribute(`checked`),i===`print`)break;e.addEventListener(`change`,e=>{r.setValue(t,{value:e.target.checked?e.target.getAttribute(`xfaOn`):e.target.getAttribute(`xfaOff`)})})}else{if(a.value!==null&&e.setAttribute(`value`,a.value),i===`print`)break;e.addEventListener(`input`,e=>{r.setValue(t,{value:e.target.value})})}break;case`select`:if(a.value!==null){e.setAttribute(`value`,a.value);for(let e of n.children)e.attributes.value===a.value?e.attributes.selected=!0:Object.hasOwn(e.attributes,`selected`)&&delete e.attributes.selected}e.addEventListener(`input`,e=>{let n=e.target.options,i=n.selectedIndex===-1?``:n[n.selectedIndex].value;r.setValue(t,{value:i})});break}}static setAttributes({html:e,element:t,storage:n=null,intent:r,linkService:i}){let{attributes:a}=t,o=e instanceof HTMLAnchorElement;a.type===`radio`&&(a.name=`${a.name}-${r}`);for(let[t,n]of Object.entries(a))if(n!=null)switch(t){case`class`:n.length&&e.setAttribute(t,n.join(` `));break;case`dataId`:break;case`id`:e.setAttribute(`data-element-id`,n);break;case`style`:Object.assign(e.style,n);break;case`textContent`:e.textContent=n;break;default:(!o||t!==`href`&&t!==`newWindow`)&&e.setAttribute(t,n)}o&&i.addLinkAttributes(e,a.href,a.newWindow),n&&a.dataId&&this.setupStorage(e,a.dataId,t,n)}static render(e){let t=e.annotationStorage,n=e.linkService,r=e.xfaHtml,i=e.intent||`display`,a=document.createElement(r.name);r.attributes&&this.setAttributes({html:a,element:r,intent:i,linkService:n});let o=i!==`richText`,s=e.div;if(s.append(a),e.viewport){let t=`matrix(${e.viewport.transform.join(`,`)})`;s.style.transform=t}o&&s.setAttribute(`class`,`xfaLayer xfaFont`);let c=[];if(r.children.length===0){if(r.value){let e=document.createTextNode(r.value);a.append(e),o&&g6.shouldBuildText(r.name)&&c.push(e)}return{textDivs:c}}let l=[[r,-1,a]];for(;l.length>0;){let[e,r,a]=l.at(-1);if(r+1===e.children.length){l.pop();continue}let s=e.children[++l.at(-1)[1]];if(s===null)continue;let{name:u}=s;if(u===`#text`){let e=document.createTextNode(s.value);c.push(e),a.append(e);continue}let d=s?.attributes?.xmlns?document.createElementNS(s.attributes.xmlns,u):document.createElement(u);if(a.append(d),s.attributes&&this.setAttributes({html:d,element:s,storage:t,intent:i,linkService:n}),s.children?.length>0)l.push([s,-1,d]);else if(s.value){let e=document.createTextNode(s.value);o&&g6.shouldBuildText(u)&&c.push(e),d.append(e)}}for(let e of s.querySelectorAll(`.xfaNonInteractive input, .xfaNonInteractive textarea`))e.setAttribute(`readOnly`,!0);return{textDivs:c}}static update(e){let t=`matrix(${e.viewport.transform.join(`,`)})`;e.div.style.transform=t,e.div.hidden=!1}static getPageViewport(e,{scale:t=1,rotation:n=0}){let{width:r,height:i}=e.attributes.style;return new h6({viewBox:[0,0,parseInt(r,10),parseInt(i,10)],userUnit:1,scale:t,rotation:n})}},v6=class{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF};async function y6(e,t=`text`){if(E6(e,document.baseURI)){let n=await fetch(e);if(!n.ok)throw Error(n.statusText);switch(t){case`blob`:return n.blob();case`bytes`:return n.bytes();case`json`:return n.json()}return n.text()}return new Promise((n,r)=>{let i=new XMLHttpRequest;i.open(`GET`,e,!0),i.responseType=t===`bytes`?`arraybuffer`:t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case`bytes`:n(new Uint8Array(i.response));return;case`blob`:case`json`:n(i.response);return}n(i.responseText);return}r(Error(i.statusText))}},i.send(null)})}var b6=class extends Y3{constructor(e,t=0){super(e,`RenderingCancelledException`),this.extraDelay=t}};function x6(e){let t=e.length,n=0;for(;n<t&&e[n].trim()===``;)n++;return e.substring(n,n+5).toLowerCase()===`data:`}function S6(e){return typeof e==`string`&&/\.pdf$/i.test(e)}function C6(e){return[e]=e.split(/[#?]/,1),q3(e)}function w6(e,t=`document.pdf`){if(typeof e!=`string`)return t;if(x6(e))return V3(`getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.`),t;let n=(e=>{try{return new URL(e)}catch{}try{return new URL(decodeURIComponent(e))}catch{}try{return new URL(e,`https://foo.bar`)}catch{}try{return new URL(decodeURIComponent(e),`https://foo.bar`)}catch{}return null})(e);if(!n)return t;let r=e=>{try{let t=decodeURIComponent(e);return t.includes(`/`)&&(t=q3(t),t.length===4&&i.test(t))?e:t}catch{return e}},i=/\.pdf$/i,a=q3(n.pathname);if(i.test(a))return r(a);if(n.searchParams.size>0){let e=e=>[...e].findLast(e=>i.test(e)),t=e(n.searchParams.values())??e(n.searchParams.keys());if(t)return r(t)}if(n.hash){let e=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(n.hash);if(e)return r(e[0])}return t}var T6=class{#e=new Map;times=[];time(e){this.#e.has(e)&&V3(`Timer is already running for ${e}`),this.#e.set(e,Date.now())}timeEnd(e){this.#e.has(e)||V3(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.#e.get(e),end:Date.now()}),this.#e.delete(e)}toString(){let e=Math.max(...this.times.map(e=>e.name.length));return this.times.map(t=>`${t.name.padEnd(e)} ${t.end-t.start}ms\n`).join(``)}};function E6(e,t){let n=t?URL.parse(e,t):URL.parse(e);return/https?:/.test(n?.protocol??``)}function D6(e){e.preventDefault()}function O6(e){e.preventDefault(),e.stopPropagation()}var k6=class{static#e;static toDateObject(e){if(e instanceof Date)return e;if(!e||typeof e!=`string`)return null;this.#e||=RegExp(`^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+\\-])?(\\d{2})?'?(\\d{2})?'?`);let t=this.#e.exec(e);if(!t)return null;let n=parseInt(t[1],10),r=parseInt(t[2],10);r=r>=1&&r<=12?r-1:0;let i=parseInt(t[3],10);i=i>=1&&i<=31?i:1;let a=parseInt(t[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(t[5],10);o=o>=0&&o<=59?o:0;let s=parseInt(t[6],10);s=s>=0&&s<=59?s:0;let c=t[7]||`Z`,l=parseInt(t[8],10);l=l>=0&&l<=23?l:0;let u=parseInt(t[9],10)||0;return u=u>=0&&u<=59?u:0,c===`-`?(a+=l,o+=u):c===`+`&&(a-=l,o-=u),new Date(Date.UTC(n,r,i,a,o,s))}};function A6(e){if(e.startsWith(`#`)){let t=e.slice(1);return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),t.length>=8?parseInt(t.slice(6,8),16)/255:1]}if(e.startsWith(`rgb(`)){let[t,n,r]=e.slice(4,-1).split(`,`).map(e=>parseInt(e,10));return[t,n,r,1]}if(e.startsWith(`rgba(`)){let t=e.slice(5,-1).split(`,`);return[parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3])]}let t=e.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);return t?[Math.round(parseFloat(t[1])*255),Math.round(parseFloat(t[2])*255),Math.round(parseFloat(t[3])*255),t[4]!==void 0&&t[4]!==`none`?parseFloat(t[4]):1]:null}function j6(e){let t=A6(e);return t?t.slice(0,3):(V3(`Not a valid color format: "${e}"`),[0,0,0])}function M6(e){let t=document.createElement(`span`);t.style.visibility=`hidden`,t.style.colorScheme=`only light`,document.body.append(t);for(let n of e.keys()){t.style.color=n;let r=window.getComputedStyle(t).color;e.set(n,j6(r))}t.remove()}function N6(e){let{a:t,b:n,c:r,d:i,e:a,f:o}=e.getTransform();return[t,n,r,i,a,o]}function P6(e){let{a:t,b:n,c:r,d:i,e:a,f:o}=e.getTransform().invertSelf();return[t,n,r,i,a,o]}function F6(e,t,n=!1,r=!0){if(t instanceof h6){let{pageWidth:r,pageHeight:i}=t.rawDims,{style:a}=e,o=`round(down, var(--total-scale-factor) * ${r}px, var(--scale-round-x))`,s=`round(down, var(--total-scale-factor) * ${i}px, var(--scale-round-y))`;!n||t.rotation%180==0?(a.width=o,a.height=s):(a.width=s,a.height=o)}r&&e.setAttribute(`data-main-rotation`,t.rotation)}var I6=class e{constructor(){let{pixelRatio:t}=e;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(t,n,r,i,a=-1){let o=1/0,s=1/0,c=1/0;r=e.capPixels(r,a),r>0&&(o=Math.sqrt(r/(t*n))),i!==-1&&(s=i/t,c=i/n);let l=Math.min(o,s,c);return this.sx>l||this.sy>l?(this.sx=l,this.sy=l,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,t){if(t>=0){let n=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+t/100));return e>0?Math.min(e,n):n}return e}},L6=[`image/apng`,`image/avif`,`image/bmp`,`image/gif`,`image/jpeg`,`image/png`,`image/svg+xml`,`image/webp`,`image/x-icon`],R6=class{static get isDarkMode(){return J3(this,`isDarkMode`,!!window?.matchMedia?.(`(prefers-color-scheme: dark)`).matches)}},z6=class{static get commentForegroundColor(){let e=document.createElement(`span`);e.classList.add(`comment`,`sidebar`);let{style:t}=e;t.width=t.height=`0`,t.display=`none`,t.color=`var(--comment-fg-color)`,document.body.append(e);let{color:n}=window.getComputedStyle(e);return e.remove(),J3(this,`commentForegroundColor`,j6(n))}};function B6(e,t){t=m6(t??1,0,1);let n=255*(1-t);return e.map(e=>Math.round(e*t+n))}function V6(e,t){let n=e[0]/255,r=e[1]/255,i=e[2]/255,a=Math.max(n,r,i),o=Math.min(n,r,i),s=(a+o)/2;if(a===o)t[0]=t[1]=0;else{let e=a-o;switch(t[1]=s<.5?e/(a+o):e/(2-a-o),a){case n:t[0]=((r-i)/e+(r<i?6:0))*60;break;case r:t[0]=((i-n)/e+2)*60;break;case i:t[0]=((n-r)/e+4)*60;break}}t[2]=s}function H6(e,t){let n=e[0],r=e[1],i=e[2],a=(1-Math.abs(2*i-1))*r,o=a*(1-Math.abs(n/60%2-1)),s=i-a/2;switch(Math.floor(n/60)){case 0:t[0]=a+s,t[1]=o+s,t[2]=s;break;case 1:t[0]=o+s,t[1]=a+s,t[2]=s;break;case 2:t[0]=s,t[1]=a+s,t[2]=o+s;break;case 3:t[0]=s,t[1]=o+s,t[2]=a+s;break;case 4:t[0]=o+s,t[1]=s,t[2]=a+s;break;case 5:case 6:t[0]=a+s,t[1]=s,t[2]=o+s;break}}function U6(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}function W6(e,t,n){H6(e,n),n.map(U6);let r=.2126*n[0]+.7152*n[1]+.0722*n[2];H6(t,n),n.map(U6);let i=.2126*n[0]+.7152*n[1]+.0722*n[2];return r>i?(r+.05)/(i+.05):(i+.05)/(r+.05)}var G6=new Map;function K6(e,t){let n=e[0]+e[1]*256+e[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776,r=G6.get(n);if(r)return r;let i=new Float32Array(9),a=i.subarray(0,3),o=i.subarray(3,6);V6(e,o);let s=i.subarray(6,9);V6(t,s);let c=s[2]<.5,l=c?12:4.5;if(o[2]=c?Math.sqrt(o[2]):1-Math.sqrt(1-o[2]),W6(o,s,a)<l){let e,t;for(c?(e=o[2],t=1):(e=0,t=o[2]);t-e>.005;){let n=o[2]=(e+t)/2;c===W6(o,s,a)<l?e=n:t=n}o[2]=c?t:e}return H6(o,a),r=$.makeHexColor(Math.round(a[0]*255),Math.round(a[1]*255),Math.round(a[2]*255)),G6.set(n,r),r}function q6({html:e,dir:t,className:n},r){let i=document.createDocumentFragment();if(typeof e==`string`){let n=document.createElement(`p`);n.dir=t||`auto`;let r=e.split(/\r\n?|\n/);for(let e=0,t=r.length;e<t;++e){let i=r[e];n.append(document.createTextNode(i)),e<t-1&&n.append(document.createElement(`br`))}i.append(n)}else _6.render({xfaHtml:e,div:i,intent:`richText`});i.firstElementChild.classList.add(`richText`,n),r.append(i)}function J6(e){let t=new Path2D;if(!e)return t;for(let n=0,r=e.length;n<r;)switch(e[n++]){case F3.moveTo:t.moveTo(e[n++],e[n++]);break;case F3.lineTo:t.lineTo(e[n++],e[n++]);break;case F3.curveTo:t.bezierCurveTo(e[n++],e[n++],e[n++],e[n++],e[n++],e[n++]);break;case F3.quadraticCurveTo:t.quadraticCurveTo(e[n++],e[n++],e[n++],e[n++]);break;case F3.closePath:t.closePath();break;default:V3(`Unrecognized drawing path operator: ${e[n-1]}`);break}return t}var Y6=class e{#e=null;#t=null;#n;#r=null;#i=null;#a=null;#o=null;#s=null;static#c=null;constructor(t){this.#n=t,e.#c||=Object.freeze({freetext:`pdfjs-editor-remove-freetext-button`,highlight:`pdfjs-editor-remove-highlight-button`,ink:`pdfjs-editor-remove-ink-button`,stamp:`pdfjs-editor-remove-stamp-button`,signature:`pdfjs-editor-remove-signature-button`})}render(){let t=this.#e=document.createElement(`div`);t.classList.add(`editToolbar`,`hidden`),t.setAttribute(`role`,`toolbar`);let n=this.#n._uiManager._signal;n instanceof AbortSignal&&!n.aborted&&(t.addEventListener(`contextmenu`,D6,{signal:n}),t.addEventListener(`pointerdown`,e.#l,{signal:n}));let r=this.#r=document.createElement(`div`);r.className=`buttons`,t.append(r);let i=this.#n.toolbarPosition;if(i){let{style:e}=t;e.insetInlineEnd=`${100*(this.#n._uiManager.direction===`ltr`?1-i[0]:i[0])}%`,e.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return t}get div(){return this.#e}static#l(e){e.stopPropagation()}#u(e){this.#n._focusEventsAllowed=!1,O6(e)}#d(e){this.#n._focusEventsAllowed=!0,O6(e)}#f(e){let t=this.#n._uiManager._signal;return!(t instanceof AbortSignal)||t.aborted?!1:(e.addEventListener(`focusin`,this.#u.bind(this),{capture:!0,signal:t}),e.addEventListener(`focusout`,this.#d.bind(this),{capture:!0,signal:t}),e.addEventListener(`contextmenu`,D6,{signal:t}),!0)}hide(){this.#e.classList.add(`hidden`),this.#t?.hideDropdown()}show(){this.#e.classList.remove(`hidden`),this.#i?.shown(),this.#a?.shown()}addDeleteButton(){let{editorType:t,_uiManager:n}=this.#n,r=document.createElement(`button`);r.classList.add(`basic`,`deleteButton`),r.tabIndex=0,r.setAttribute(`data-l10n-id`,e.#c[t]),this.#f(r)&&r.addEventListener(`click`,e=>{n.delete()},{signal:n._signal}),this.#r.append(r)}get#p(){let e=document.createElement(`div`);return e.className=`divider`,e}async addAltText(e){let t=await e.render();this.#f(t),this.#r.append(t,this.#p),this.#i=e}addComment(e,t=null){if(this.#a)return;let n=e.renderForToolbar();if(!n)return;this.#f(n);let r=this.#o=this.#p;t?(this.#r.insertBefore(n,t),this.#r.insertBefore(r,t)):this.#r.append(n,r),this.#a=e,e.toolbar=this}addColorPicker(e){if(this.#t)return;this.#t=e;let t=e.renderButton();this.#f(t),this.#r.append(t,this.#p)}async addEditSignatureButton(e){let t=this.#s=await e.renderEditButton(this.#n);this.#f(t),this.#r.append(t,this.#p)}removeButton(e){switch(e){case`comment`:this.#a?.removeToolbarCommentButton(),this.#a=null,this.#o?.remove(),this.#o=null;break}}async addButton(e,t){switch(e){case`colorPicker`:t&&this.addColorPicker(t);break;case`altText`:t&&await this.addAltText(t);break;case`editSignature`:t&&await this.addEditSignatureButton(t);break;case`delete`:this.addDeleteButton();break;case`comment`:t&&this.addComment(t);break}}async addButtonBefore(e,t,n){if(!t&&e===`comment`)return;let r=this.#r.querySelector(n);r&&e===`comment`&&this.addComment(t,r)}updateEditSignatureButton(e){this.#s&&(this.#s.title=e)}remove(){this.#e.remove(),this.#t?.destroy(),this.#t=null}},X6=class{#e=null;#t=null;#n;constructor(e){this.#n=e}#r(){let e=this.#t=document.createElement(`div`);e.className=`editToolbar`,e.setAttribute(`role`,`toolbar`);let t=this.#n._signal;t instanceof AbortSignal&&!t.aborted&&e.addEventListener(`contextmenu`,D6,{signal:t});let n=this.#e=document.createElement(`div`);return n.className=`buttons`,e.append(n),this.#n.hasCommentManager()&&this.#a(`commentButton`,`pdfjs-comment-floating-button`,`pdfjs-comment-floating-button-label`,()=>{this.#n.commentSelection(`floating_button`)}),this.#a(`highlightButton`,`pdfjs-highlight-floating-button1`,`pdfjs-highlight-floating-button-label`,()=>{this.#n.highlightSelection(`floating_button`)}),e}#i(e,t){let n=0,r=0;for(let i of e){let e=i.y+i.height;if(e<n)continue;let a=i.x+(t?i.width:0);if(e>n){r=a,n=e;continue}t?a>r&&(r=a):a<r&&(r=a)}return[t?1-r:r,n]}show(e,t,n){let[r,i]=this.#i(t,n),{style:a}=this.#t||=this.#r();e.append(this.#t),a.insetInlineEnd=`${100*r}%`,a.top=`calc(${100*i}% + var(--editor-toolbar-vert-offset))`}hide(){this.#t.remove()}#a(e,t,n,r){let i=document.createElement(`button`);i.classList.add(`basic`,e),i.tabIndex=0,i.setAttribute(`data-l10n-id`,t);let a=document.createElement(`span`);i.append(a),a.className=`visuallyHidden`,a.setAttribute(`data-l10n-id`,n);let o=this.#n._signal;o instanceof AbortSignal&&!o.aborted&&(i.addEventListener(`contextmenu`,D6,{signal:o}),i.addEventListener(`click`,r,{signal:o})),this.#e.append(i)}},Z6=Object.freeze({internal:`068f09d6-5b37-4f77-a97a-f8ff4f253b68`});function Q6(e,t,n){for(let r of n)t.addEventListener(r,e[r].bind(e))}var $6=class e{static#e=NaN;static#t=null;static#n=NaN;static#r=null;static initializeAndAddPointerId(t){(e.#t||=new Set).add(t)}static setPointer(t,n){e.#e||=n,e.#r??=t}static setTimeStamp(t){e.#n=t}static isSamePointerId(t){return e.#e===t}static isSamePointerIdOrRemove(t){return e.#e===t?!0:(e.#t?.delete(t),!1)}static isSamePointerType(t){return e.#r===t}static isInitializedAndDifferentPointerType(t){return e.#r!==null&&!e.isSamePointerType(t)}static isSameTimeStamp(t){return e.#n===t}static isUsingMultiplePointers(){return e.#t?.size>=1}static clearPointerType(){e.#r=null}static clearPointerIds(){e.#e=NaN,e.#t=null}static clearTimeStamp(){e.#n=NaN}},e8=class{#e=0;get id(){return`${T3}${this.#e++}`}},t8=class e{#e=l6();#t=0;#n=null;static get _isSVGFittingCanvas(){let e=`data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="${x3}"><rect width="1" height="1" style="fill:red;"/></svg>`,t=new OffscreenCanvas(1,3).getContext(`2d`,{willReadFrequently:!0}),n=new Image;n.src=e;let r=n.decode().then(()=>(t.drawImage(n,0,0,1,1,0,0,1,3),new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0]===0));return J3(this,`_isSVGFittingCanvas`,r)}async#r(t,n){this.#n||=new Map;let r=this.#n.get(t);if(r===null)return null;if(r?.bitmap)return r.refCounter+=1,r;try{r||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let t;if(typeof n==`string`?(r.url=n,t=await y6(n,`blob`)):n instanceof File?t=r.file=n:n instanceof Blob&&(t=n),t.type===`image/svg+xml`){let n=e._isSVGFittingCanvas,i=new FileReader,a=new Image,o=new Promise((e,t)=>{a.onload=()=>{r.bitmap=a,r.isSvg=!0,e()},i.onload=async()=>{let e=r.svgUrl=i.result;a.src=await n?`${e}#svgView(preserveAspectRatio(none))`:e},a.onerror=i.onerror=t});i.readAsDataURL(t),await o}else r.bitmap=await createImageBitmap(t);r.refCounter=1}catch(e){V3(e),r=null}return this.#n.set(t,r),r&&this.#n.set(r.id,r),r}async getFromFile(e){let{lastModified:t,name:n,size:r,type:i}=e;return this.#r(`${t}_${n}_${r}_${i}`,e)}async getFromUrl(e){return this.#r(e,e)}async getFromBlob(e,t){let n=await t;return this.#r(e,n)}async getFromId(e){this.#n||=new Map;let t=this.#n.get(e);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){let{blobPromise:e}=t;return delete t.blobPromise,this.getFromBlob(t.id,e)}return this.getFromUrl(t.url)}getFromCanvas(e,t){this.#n||=new Map;let n=this.#n.get(e);if(n?.bitmap)return n.refCounter+=1,n;let r=new OffscreenCanvas(t.width,t.height);return r.getContext(`2d`).drawImage(t,0,0),n={bitmap:r.transferToImageBitmap(),id:`image_${this.#e}_${this.#t++}`,refCounter:1,isSvg:!1},this.#n.set(e,n),this.#n.set(n.id,n),n}getSvgUrl(e){let t=this.#n.get(e);return t?.isSvg?t.svgUrl:null}deleteId(e){this.#n||=new Map;let t=this.#n.get(e);if(!t||(--t.refCounter,t.refCounter!==0))return;let{bitmap:n}=t;if(!t.url&&!t.file){let e=new OffscreenCanvas(n.width,n.height);e.getContext(`bitmaprenderer`).transferFromImageBitmap(n),t.blobPromise=e.convertToBlob()}n.close?.(),t.bitmap=null}isValidId(e){return e.startsWith(`image_${this.#e}_`)}},n8=class{#e=[];#t=!1;#n;#r=-1;constructor(e=128){this.#n=e}add({cmd:e,undo:t,post:n,mustExec:r,type:i=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(r&&e(),this.#t)return;let s={cmd:e,undo:t,post:n,type:i};if(this.#r===-1){this.#e.length>0&&(this.#e.length=0),this.#r=0,this.#e.push(s);return}if(a&&this.#e[this.#r].type===i){o&&(s.undo=this.#e[this.#r].undo),this.#e[this.#r]=s;return}let c=this.#r+1;c===this.#n?this.#e.splice(0,1):(this.#r=c,c<this.#e.length&&this.#e.splice(c)),this.#e.push(s)}undo(){if(this.#r===-1)return;this.#t=!0;let{undo:e,post:t}=this.#e[this.#r];e(),t?.(),this.#t=!1,--this.#r}redo(){if(this.#r<this.#e.length-1){this.#r+=1,this.#t=!0;let{cmd:e,post:t}=this.#e[this.#r];e(),t?.(),this.#t=!1}}hasSomethingToUndo(){return this.#r!==-1}hasSomethingToRedo(){return this.#r<this.#e.length-1}cleanType(e){if(this.#r!==-1){for(let t=this.#r;t>=0;t--)if(this.#e[t].type!==e){this.#e.splice(t+1,this.#r-t),this.#r=t;return}this.#e.length=0,this.#r=-1}}destroy(){this.#e=null}},r8=class e{static ALT=1;static CTRL=2;static META=4;static SHIFT=8;constructor(t){this.callbacks=new Map;let{isMac:n}=i6.platform;for(let[r,i,a={}]of t){let t=r.some(e=>e.startsWith(`mac+`));for(let o of r){let r=o;if(t){let e=o.startsWith(`mac+`);if(n!==e)continue;e&&(r=o.slice(4))}let[s,c]=e.#e(r);s!==null&&this.callbacks.getOrInsertComputed(s,d6).push({callback:i,options:a,modifiers:c})}}}static#e(t){let n=null,r=0;for(let i of t.split(`+`)){if(i=i.trim(),!i)continue;let a=i.toUpperCase(),o=e[a];if(o){r|=o;continue}if(n!==null){V3(`KeyboardManager: multiple keys in shortcut "${t}"`);break}n=a===`SPACE`?` `:i}return n===null&&V3(`KeyboardManager: no key found in shortcut "${t}"`),[n,r]}static#t(e){let t=/^(?:Key([A-Z])|(?:Digit|Numpad)(\d))$/.exec(e);return t?t[1]?.toLowerCase()??t[2]:null}exec(t,n){let r=this.callbacks.get(n.key);if(!r){if(/^[a-z]$/i.test(n.key))return;let t=e.#t(n.code);if(t===null||t===n.key||(r=this.callbacks.get(t),!r))return}let i=(n.altKey?e.ALT:0)|(n.ctrlKey?e.CTRL:0)|(n.metaKey?e.META:0)|(n.shiftKey?e.SHIFT:0),a=r.find(e=>e.modifiers===i);if(!a)return;let{callback:o,options:{bubbles:s=!1,args:c=[],checker:l=null}}=a;l&&!l(t,n)||(o.bind(t,...c,n)(),s||O6(n))}},i8=class e{static _colorsMapping=new Map([[`CanvasText`,[0,0,0]],[`Canvas`,[255,255,255]]]);get _colors(){let e=new Map([[`CanvasText`,null],[`Canvas`,null]]);return M6(e),J3(this,`_colors`,e)}convert(t){let n=j6(t);if(!window.matchMedia(`(forced-colors: active)`).matches)return n;for(let[t,r]of this._colors)if(r.every((e,t)=>e===n[t]))return e._colorsMapping.get(t);return n}getHexCode(e){let t=this._colors.get(e);return t?$.makeHexColor(...t):e}},a8=class e{#e=new AbortController;#t=null;#n=null;#r=new Map;#i=new Map;#a=null;#o=null;#s=null;#c=null;#l=new n8;#u=null;#d=null;#f=null;#p=0;#m=new Set;#h=null;#g=null;#_=new Set;_editorUndoBar=null;#v=!1;#y=!1;#b=!1;#x=null;#S=null;#C=null;#w=null;#T=!1;#E=null;#D=new e8;#O=!1;#k=!1;#A=!1;#j=null;#M=null;#N=null;#P=null;#F=null;#I=E3.NONE;#L=new Set;#R=null;#z=null;#B=null;#V=null;#H=null;#U={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#W=[0,0];#G=null;#K=null;#q=null;#J=null;#Y=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let t=e.prototype,n=e=>e.#K.contains(document.activeElement)&&document.activeElement.tagName!==`BUTTON`&&e.hasSomethingToControl(),r=(e,{target:t})=>{if(t instanceof HTMLInputElement){let{type:e}=t;return e!==`text`&&e!==`number`}return!0},i=this.TRANSLATE_SMALL,a=this.TRANSLATE_BIG;return J3(this,`_keyboardManager`,new r8([[[`ctrl+a`,`mac+meta+a`],t.selectAll,{checker:r}],[[`ctrl+z`,`mac+meta+z`],t.undo,{checker:r}],[[`ctrl+y`,`ctrl+shift+z`,`mac+meta+shift+z`,`ctrl+shift+Z`,`mac+meta+shift+Z`],t.redo,{checker:r}],[[`Backspace`,`alt+Backspace`,`ctrl+Backspace`,`shift+Backspace`,`mac+Backspace`,`mac+alt+Backspace`,`mac+ctrl+Backspace`,`Delete`,`ctrl+Delete`,`shift+Delete`,`mac+Delete`],t.delete,{checker:r}],[[`Enter`],t.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&e.#K.contains(t)&&!e.isEnterHandled}],[[`Space`],t.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&e.#K.contains(document.activeElement)}],[[`Escape`],t.unselectAll],[[`ArrowLeft`],t.translateSelectedEditors,{args:[-i,0],checker:n}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],t.translateSelectedEditors,{args:[-a,0],checker:n}],[[`ArrowRight`],t.translateSelectedEditors,{args:[i,0],checker:n}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],t.translateSelectedEditors,{args:[a,0],checker:n}],[[`ArrowUp`],t.translateSelectedEditors,{args:[0,-i],checker:n}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],t.translateSelectedEditors,{args:[0,-a],checker:n}],[[`ArrowDown`],t.translateSelectedEditors,{args:[0,i],checker:n}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],t.translateSelectedEditors,{args:[0,a],checker:n}]]))}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this._signal=this.#e.signal;this.#K=e,this.#q=t,this.#J=n,this.#o=r,this.#u=i,this.#z=a,this.#H=s,this._eventBus=o;let _={signal:g,...Z6};o.on(`editingaction`,this.onEditingAction.bind(this),_),o.on(`pagechanging`,this.onPageChanging.bind(this),_),o.on(`scalechanging`,this.onScaleChanging.bind(this),_),o.on(`rotationchanging`,this.onRotationChanging.bind(this),_),o.on(`setpreference`,this.onSetPreference.bind(this),_),o.on(`switchannotationeditorparams`,e=>this.updateParams(e.type,e.value),_),window.addEventListener(`pointerdown`,()=>{this.#k=!0},{capture:!0,signal:g}),window.addEventListener(`pointerup`,()=>{this.#k=!1},{capture:!0,signal:g}),window.addEventListener(`beforeunload`,this.#Q.bind(this),{capture:!0,signal:g}),this.#ne(),this.#le(),this.#ae(),this.#s=s.annotationStorage,this.#x=s.filterFactory,this.#B=c,this.#w=l||null,this.#v=u,this.#y=d,this.#b=f,this.#F=p||null,this.viewParameters={realScale:v6.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=m||null,this._supportsPinchToZoom=h!==!1,i?.setSidebarUiManager(this)}destroy(){this.#Y?.resolve(),this.#Y=null,this.#e?.abort(),this.#e=null,this._signal=null;for(let e of this.#i.values())e.destroy();this.#i.clear(),this.#r.clear(),this.#_.clear(),this.#P?.clear(),this.#t=null,this.#L.clear(),this.#l.destroy(),this.#o?.destroy(),this.#u?.destroy(),this.#z?.destroy(),this.#E?.hide(),this.#E=null,this.#N?.destroy(),this.#N=null,this.#n=null,this.#S&&=(clearTimeout(this.#S),null),this.#G&&=(clearTimeout(this.#G),null),this._editorUndoBar?.destroy(),this.#H=null}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return this.#F}get useNewAltTextFlow(){return this.#y}get useNewAltTextWhenAddingImage(){return this.#b}get hcmFilter(){return J3(this,`hcmFilter`,this.#B?this.#x.addHCMFilter(this.#B.foreground,this.#B.background):`none`)}get direction(){return J3(this,`direction`,getComputedStyle(this.#K).direction)}get _highlightColors(){return J3(this,`_highlightColors`,this.#w?new Map(this.#w.split(`,`).map(e=>(e=e.split(`=`).map(e=>e.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){let{_highlightColors:e}=this;if(!e)return J3(this,`highlightColors`,null);let t=new Map,n=!!this.#B;for(let[r,i]of e){let e=r.endsWith(`_HCM`);if(n&&e){t.set(r.replace(`_HCM`,``),i);continue}!n&&!e&&t.set(r,i)}return J3(this,`highlightColors`,t)}get highlightColorNames(){return J3(this,`highlightColorNames`,this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;let t=this.highlightColorNames.get(e);return this._highlightColors.get(t)||e}getNonHCMColorName(e){return this.highlightColorNames.get(e)||e}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),this.#f=e}setMainHighlightColorPicker(e){this.#N=e}editAltText(e,t=!1){this.#o?.editAltText(this,e,t)}hasCommentManager(){return!!this.#u}editComment(e,t,n,r){this.#u?.showDialog(this,e,t,n,r)}selectComment(e,t){(this.#i.get(e)?.getEditorByUID(t))?.toggleComment(!0,!0)}updateComment(e){this.#u?.updateComment(e.getData())}updatePopupColor(e){this.#u?.updatePopupColor(e)}removeComment(e){this.#u?.removeComments([e.uid])}deleteComment(e,t){let n=()=>{e.comment=t};this.addCommands({cmd:()=>{this._editorUndoBar?.show(n,`comment`),this.toggleComment(null),e.comment=null},undo:n,mustExec:!0})}toggleComment(e,t,n=void 0){this.#u?.toggleCommentPopup(e,t,n)}makeCommentColor(e,t){return e&&this.#u?.makeCommentColor(e,t)||null}getCommentDialogElement(){return this.#u?.dialogElement||null}async waitForEditorsRendered(e){if(this.#i.has(e-1))return;let{resolve:t,promise:n}=Promise.withResolvers(),r=n=>{n.pageNumber===e&&(this._eventBus.off(`editorsrendered`,r),t())};this._eventBus.on(`editorsrendered`,r,Z6),await n}getSignature(e){this.#z?.getSignature({uiManager:this,editor:e})}get signatureManager(){return this.#z}switchToMode(e,t){this._eventBus.on(`annotationeditormodechanged`,t,{once:!0,signal:this._signal,...Z6}),this._eventBus.dispatch(`showannotationeditorui`,{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch(`setpreference`,{source:this,name:e,value:t})}onSetPreference({name:e,value:t}){switch(e){case`enableNewAltTextWhenAddingImage`:this.#b=t;break}}onPageChanging({pageNumber:e}){this.#p=e-1}deletePage(e){for(let t of this.getEditors(e))t.remove();this.#i.delete(e),this.#p===e&&(this.#p=0)}focusMainContainer(){this.#K.focus()}findParent(e,t){for(let n of this.#i.values()){let{x:r,y:i,width:a,height:o}=n.div.getBoundingClientRect();if(e>=r&&e<=r+a&&t>=i&&t<=i+o)return n}return null}disableUserSelect(e=!1){this.#q.classList.toggle(`noUserSelect`,e)}addShouldRescale(e){this.#_.add(e)}removeShouldRescale(e){this.#_.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*v6.PDF_TO_CSS_UNITS;for(let e of this.#_)e.onScaleChanging();this.#f?.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}#X({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e}#Z(e){let{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(let t of this.#i.values())if(t.hasTextLayer(e))return t;return null}highlightSelection(e=``,t=!1){let n=document.getSelection();if(!n||n.isCollapsed)return;let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=n,s=n.toString(),c=this.#X(n).closest(`.textLayer`),l=this.getSelectionBoxes(c);if(!l)return;n.empty();let u=this.#Z(c),d=this.#I===E3.NONE,f=()=>{let n=u?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:l,anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o,text:s});d&&this.showAllEditors(`highlight`,!0,!0),t&&n?.editComment()};if(d){this.switchToMode(E3.HIGHLIGHT,f);return}f()}commentSelection(e=``){this.highlightSelection(e,!0)}#Q(e){this.commitOrRemove(),this.currentLayer?.endDrawingSession(!1)}#$(){let e=document.getSelection();if(!e||e.isCollapsed)return;let t=this.#X(e).closest(`.textLayer`),n=this.getSelectionBoxes(t);n&&(this.#E||=new X6(this),this.#E.show(t,n,this.direction===`ltr`))}getAndRemoveDataFromAnnotationStorage(e){if(!this.#s)return null;let t=`${T3}${e}`,n=this.#s.getRawValue(t);return n&&this.#s.remove(t),n}addToAnnotationStorage(e){!e.isEmpty()&&this.#s&&!this.#s.has(e.id)&&this.#s.setValue(e.id,e)}a11yAlert(e,t=null){let n=this.#J;n&&(n.setAttribute(`data-l10n-id`,e),t?n.setAttribute(`data-l10n-args`,JSON.stringify(t)):n.removeAttribute(`data-l10n-args`))}#ee(){let e=document.getSelection();if(!e||e.isCollapsed){this.#R&&(this.#E?.hide(),this.#R=null,this.#ue({hasSelectedText:!1}));return}let{anchorNode:t}=e;if(t===this.#R)return;let n=this.#X(e).closest(`.textLayer`);if(!n){this.#R&&(this.#E?.hide(),this.#R=null,this.#ue({hasSelectedText:!1}));return}if(this.#E?.hide(),this.#R=t,this.#ue({hasSelectedText:!0}),!(this.#I!==E3.HIGHLIGHT&&this.#I!==E3.NONE)&&(this.#I===E3.HIGHLIGHT&&this.showAllEditors(`highlight`,!0,!0),this.#T=this.isShiftKeyDown,!this.isShiftKeyDown)){let e=this.#I===E3.HIGHLIGHT?this.#Z(n):null;if(e?.toggleDrawing(),this.#k){let t=new AbortController,n=this.combinedSignal(t),r=n=>{n.type===`pointerup`&&n.button!==0||(t.abort(),e?.toggleDrawing(!0),n.type===`pointerup`&&this.#te(`main_toolbar`))};window.addEventListener(`pointerup`,r,{signal:n}),window.addEventListener(`blur`,r,{signal:n})}else e?.toggleDrawing(!0),this.#te(`main_toolbar`)}}#te(e=``){this.#I===E3.HIGHLIGHT?this.highlightSelection(e):this.#v&&this.#$()}#ne(){document.addEventListener(`selectionchange`,this.#ee.bind(this),{signal:this._signal})}#re(){if(this.#C)return;this.#C=new AbortController;let e=this.combinedSignal(this.#C);window.addEventListener(`focus`,this.focus.bind(this),{signal:e}),window.addEventListener(`blur`,this.blur.bind(this),{signal:e})}#ie(){this.#C?.abort(),this.#C=null}blur(){if(this.isShiftKeyDown=!1,this.#T&&(this.#T=!1,this.#te(`main_toolbar`)),!this.hasSelection)return;let{activeElement:e}=document;for(let t of this.#L)if(t.div.contains(e)){this.#M=[t,e],t._focusEventsAllowed=!1;break}}focus(){if(!this.#M)return;let[e,t]=this.#M;this.#M=null,t.addEventListener(`focusin`,()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),t.focus()}#ae(){if(this.#j)return;this.#j=new AbortController;let e=this.combinedSignal(this.#j);window.addEventListener(`keydown`,this.keydown.bind(this),{signal:e}),window.addEventListener(`keyup`,this.keyup.bind(this),{signal:e})}#oe(){this.#j?.abort(),this.#j=null}#se(){if(this.#d)return;this.#d=new AbortController;let e=this.combinedSignal(this.#d);document.addEventListener(`copy`,this.copy.bind(this),{signal:e}),document.addEventListener(`cut`,this.cut.bind(this),{signal:e}),document.addEventListener(`paste`,this.paste.bind(this),{signal:e})}#ce(){this.#d?.abort(),this.#d=null}#le(){let e=this._signal;document.addEventListener(`dragover`,this.dragOver.bind(this),{signal:e}),document.addEventListener(`drop`,this.drop.bind(this),{signal:e})}addEditListeners(){this.#ae(),this.setEditingState(!0)}removeEditListeners(){this.#oe(),this.setEditingState(!1)}dragOver(e){for(let{type:t}of e.dataTransfer.items)for(let n of this.#g)if(n.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect=`copy`,e.preventDefault();return}}drop(e){for(let t of e.dataTransfer.items)for(let n of this.#g)if(n.isHandlingMimeForPasting(t.type)){n.paste(t,this.currentLayer),e.preventDefault();return}}copy(e){if(e.preventDefault(),this.#t?.commitOrRemove(),!this.hasSelection)return;let t=[];for(let e of this.#L){let n=e.serialize(!0);n&&t.push(n)}t.length!==0&&e.clipboardData.setData(`application/pdfjs`,JSON.stringify(t))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();let{clipboardData:t}=e;for(let e of t.items)for(let t of this.#g)if(t.isHandlingMimeForPasting(e.type)){t.paste(e,this.currentLayer);return}let n=t.getData(`application/pdfjs`);if(!n)return;try{n=JSON.parse(n)}catch(e){V3(`paste: "${e.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();let r=this.currentLayer;try{let e=[];for(let t of n){let n=await r.deserialize(t);if(!n)return;e.push(n)}this.addCommands({cmd:()=>{for(let t of e)this.#me(t);this.#_e(e)},undo:()=>{for(let t of e)t.remove()},mustExec:!0})}catch(e){V3(`paste: "${e.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key===`Shift`&&(this.isShiftKeyDown=!0),this.#I!==E3.NONE&&!this.isEditorHandlingKeyboard&&e._keyboardManager.exec(this,t)}keyup(e){this.isShiftKeyDown&&e.key===`Shift`&&(this.isShiftKeyDown=!1,this.#T&&(this.#T=!1,this.#te(`main_toolbar`)))}onEditingAction({name:e}){switch(e){case`undo`:case`redo`:case`delete`:case`selectAll`:this[e]();break;case`highlightSelection`:this.highlightSelection(`context_menu`);break;case`commentSelection`:this.commentSelection(`context_menu`);break}}updatePageIndex(e,t){for(let n of this.getEditors(e))n.pageIndex=t;let n=this.#a.get(e);n&&(n.pageIndex=t,this.#i.set(t,n),this.#O?n.enable():n.disable())}startUpdatePages(){this.#a=new Map(this.#i),this.#i.clear()}endUpdatePages(){this.#a=null}clonePage(e,t){for(let n of this.getEditors(e)){let e=n.serialize(n.mode!==E3.HIGHLIGHT);e&&(e.pageIndex=t,e.id=this.getId(),e.isClone=!0,delete e.popupRef,this.#s.setValue(e.id,e))}}findClonesForPage(e){let t=[],{pageIndex:n}=e;for(let[r,i]of this.#s)i.pageIndex===n&&i.isClone&&(this.#s.remove(r),t.push(e.deserialize(i).then(t=>{t&&(t.isClone=!0,e.addOrRebuild(t))})));return Promise.all(t)}#ue(e){Object.entries(e).some(([e,t])=>this.#U[e]!==t)&&(this._eventBus.dispatch(`editingstateschanged`,{source:this,details:Object.assign(this.#U,e)}),this.#I===E3.HIGHLIGHT&&e.hasSelectedEditor===!1&&this.#de([[D3.HIGHLIGHT_FREE,!0]]))}#de(e){this._eventBus.dispatch(`annotationeditorparamschanged`,{source:this,details:e})}setEditingState(e){e?(this.#re(),this.#se(),this.#ue({isEditing:this.#I!==E3.NONE,isEmpty:this.#ge(),hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:this.#l.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#ie(),this.#ce(),this.#ue({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!this.#g){this.#g=e;for(let e of this.#g)this.#de(e.defaultPropertiesToUpdate)}}getId(){return this.#D.id}get currentLayer(){return this.#i.get(this.#p)}getLayer(e){return this.#i.get(e)}get currentPageIndex(){return this.#p}addLayer(e){this.#i.set(e.pageIndex,e),this.#O?e.enable():e.disable()}removeLayer(e){this.#i.delete(e.pageIndex)}async updateMode(e,t=null,n=!1,r=!1,i=!1,a=!1){if(this.#I!==e&&!(this.#Y&&(await this.#Y.promise,!this.#Y))){if(this.#Y=Promise.withResolvers(),this.#f?.commitOrRemove(),this.#I===E3.POPUP&&this.#u?.hideSidebar(),this.#u?.destroyPopup(),this.#I=e,e===E3.NONE){this.setEditingState(!1),this.#pe();for(let e of this.#r.values())e.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),this.#Y.resolve();return}for(let e of this.#r.values())e.addStandaloneCommentButton();e===E3.SIGNATURE&&await this.#z?.loadSignatures(),n&&$6.clearPointerType(),this.setEditingState(!0),await this.#fe(),this.unselectAll();for(let t of this.#i.values())t.updateMode(e);if(e===E3.POPUP){this.#n||=await this.#H.getAnnotationsByType(new Set(this.#g.map(e=>e._editorType)));let e=new Set,t=[];for(let n of this.#r.values()){let{annotationElementId:r,hasComment:i,deleted:a}=n;r&&e.add(r),i&&!a&&t.push(n.getData())}for(let n of this.#n){let{id:r,popupRef:i,contentsObj:a}=n;i&&a?.str&&!e.has(r)&&!this.#m.has(r)&&t.push(n)}this.#u?.showSidebar(t)}if(!t){r&&this.addNewEditorFromKeyboard(),this.#Y.resolve();return}for(let e of this.#r.values())e.uid===t?(this.setSelected(e),a?e.editComment():i?e.enterInEditMode():e.focus()):e.unselect();this.#Y.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==this.#I&&this._eventBus.dispatch(`switchannotationeditormode`,{source:this,...e})}updateParams(e,t){if(this.#g){switch(e){case D3.CREATE:this.currentLayer.addNewEditor(t);return;case D3.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch(`reporttelemetry`,{source:this,details:{type:`editing`,data:{type:`highlight`,action:`toggle_visibility`}}}),(this.#V||=new Map).set(e,t),this.showAllEditors(`highlight`,t);break}if(this.hasSelection)for(let n of this.#L)n.updateParams(e,t);else for(let n of this.#g)n.updateDefaultParams(e,t)}}showAllEditors(e,t,n=!1){for(let n of this.#r.values())n.editorType===e&&n.show(t);(this.#V?.get(D3.HIGHLIGHT_SHOW_ALL)??!0)!==t&&this.#de([[D3.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(this.#A!==e){this.#A=e;for(let t of this.#i.values())e?t.disableClick():t.enableClick(),t.div.classList.toggle(`waiting`,e)}}async#fe(){if(!this.#O){this.#O=!0;let e=[];for(let t of this.#i.values())e.push(t.enable());await Promise.all(e);for(let e of this.#r.values())e.enable()}}#pe(){if(this.unselectAll(),this.#O){this.#O=!1;for(let e of this.#i.values())e.disable();for(let e of this.#r.values())e.disable()}}*getEditors(e){for(let t of this.#r.values())t.pageIndex===e&&(yield t)}getEditor(e){return this.#r.get(e)}addEditor(e){this.#r.set(e.id,e)}removeEditor(e){e.div.contains(document.activeElement)&&(this.#S&&clearTimeout(this.#S),this.#S=setTimeout(()=>{this.focusMainContainer(),this.#S=null},0)),this.#r.delete(e.id),e.annotationElementId&&this.#P?.delete(e.annotationElementId),this.unselect(e),(!e.annotationElementId||!this.#m.has(e.annotationElementId))&&this.#s?.remove(e.id)}addDeletedAnnotationElement(e){this.#m.add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return this.#m.has(e)}removeDeletedAnnotationElement(e){this.#m.delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}#me(e){let t=this.#i.get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))}setActiveEditor(e){this.#t!==e&&(this.#t=e,e&&this.#de(e.propertiesToUpdate))}get#he(){let e=null;for(e of this.#L);return e}updateUI(e){this.#he===e&&this.#de(e.propertiesToUpdate)}updateUIForDefaultProperties(e){this.#de(e.defaultPropertiesToUpdate)}toggleSelected(e){if(this.#L.has(e)){this.#L.delete(e),e.unselect(),this.#ue({hasSelectedEditor:this.hasSelection});return}this.#L.add(e),e.select(),this.#de(e.propertiesToUpdate),this.#ue({hasSelectedEditor:!0})}setSelected(e){this.updateToolbar({mode:e.mode,editId:e.uid}),this.#f?.commitOrRemove();for(let t of this.#L)t!==e&&t.unselect();this.#u?.destroyPopup(),this.#L.clear(),this.#L.add(e),e.select(),this.#de(e.propertiesToUpdate),this.#ue({hasSelectedEditor:!0})}get firstSelectedEditor(){return this.#L.values().next().value}unselect(e){e.unselect(),this.#L.delete(e),this.#ue({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#L.size!==0}get isEnterHandled(){return this.#L.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#l.undo(),this.#ue({hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#ge()}),this._editorUndoBar?.hide()}redo(){this.#l.redo(),this.#ue({hasSomethingToUndo:!0,hasSomethingToRedo:this.#l.hasSomethingToRedo(),isEmpty:this.#ge()})}addCommands(e){this.#l.add(e),this.#ue({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#ge()})}cleanUndoStack(e){this.#l.cleanType(e)}#ge(){if(this.#r.size===0)return!0;if(this.#r.size===1)for(let e of this.#r.values())return e.isEmpty();return!1}delete(){this.commitOrRemove();let e=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!e)return;let t=e?[e]:[...this.#L],n=()=>{this._editorUndoBar?.show(r,t.length===1?t[0].editorType:t.length);for(let e of t)e.remove()},r=()=>{for(let e of t)this.#me(e)};this.addCommands({cmd:n,undo:r,mustExec:!0})}commitOrRemove(){this.#t?.commitOrRemove()}hasSomethingToControl(){return this.#t||this.hasSelection}#_e(e){for(let e of this.#L)e.unselect();this.#L.clear();for(let t of e)t.isEmpty()||(this.#L.add(t),t.select());this.#ue({hasSelectedEditor:this.hasSelection})}selectAll(){for(let e of this.#L)e.commit();this.#_e(this.#r.values())}unselectAll(){if(!(this.#t&&(this.#t.commitOrRemove(),this.#I!==E3.NONE))&&!this.#f?.commitOrRemove()&&(this.#u?.destroyPopup(),this.hasSelection)){for(let e of this.#L)e.unselect();this.#L.clear(),this.#ue({hasSelectedEditor:!1})}}translateSelectedEditors(e,t,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;this.#W[0]+=e,this.#W[1]+=t;let[r,i]=this.#W,a=[...this.#L];this.#G&&clearTimeout(this.#G),this.#G=setTimeout(()=>{this.#G=null,this.#W[0]=this.#W[1]=0,this.addCommands({cmd:()=>{for(let e of a)this.#r.has(e.id)&&(e.translateInPage(r,i),e.translationDone())},undo:()=>{for(let e of a)this.#r.has(e.id)&&(e.translateInPage(-r,-i),e.translationDone())},mustExec:!1})},1e3);for(let n of a)n.translateInPage(e,t),n.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#h=new Map;for(let e of this.#L)this.#h.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#h)return!1;this.disableUserSelect(!1);let e=this.#h;this.#h=null;let t=!1;for(let[{x:n,y:r,pageIndex:i},a]of e)a.newX=n,a.newY=r,a.newPageIndex=i,t||=n!==a.savedX||r!==a.savedY||i!==a.savedPageIndex;if(!t)return!1;let n=(e,t,n,r)=>{if(this.#r.has(e.id)){let i=this.#i.get(r);i?e._setParentAndPosition(i,t,n):(e.pageIndex=r,e.x=t,e.y=n)}};return this.addCommands({cmd:()=>{for(let[t,{newX:r,newY:i,newPageIndex:a}]of e)n(t,r,i,a)},undo:()=>{for(let[t,{savedX:r,savedY:i,savedPageIndex:a}]of e)n(t,r,i,a)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(this.#h)for(let n of this.#h.keys())n.drag(e,t)}rebuild(e){if(e.parent===null){let t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#L.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return this.#t===e}getActive(){return this.#t}getMode(){return this.#I}isEditingMode(){return this.#I!==E3.NONE}get imageManager(){return J3(this,`imageManager`,new t8)}getSelectionBoxes(e){if(!e)return null;let t=document.getSelection();for(let n=0,r=t.rangeCount;n<r;n++)if(!e.contains(t.getRangeAt(n).commonAncestorContainer))return null;let{x:n,y:r,width:i,height:a}=e.getBoundingClientRect(),o;switch(e.getAttribute(`data-main-rotation`)){case`90`:o=(e,t,o,s)=>({x:(t-r)/a,y:1-(e+o-n)/i,width:s/a,height:o/i});break;case`180`:o=(e,t,o,s)=>({x:1-(e+o-n)/i,y:1-(t+s-r)/a,width:o/i,height:s/a});break;case`270`:o=(e,t,o,s)=>({x:1-(t+s-r)/a,y:(e-n)/i,width:s/a,height:o/i});break;default:o=(e,t,o,s)=>({x:(e-n)/i,y:(t-r)/a,width:o/i,height:s/a});break}let s=[];for(let e=0,n=t.rangeCount;e<n;e++){let n=t.getRangeAt(e);if(!n.collapsed)for(let{x:e,y:t,width:r,height:i}of n.getClientRects())r===0||i===0||s.push(o(e,t,r,i))}return s.length===0?null:s}addChangedExistingAnnotation({annotationElementId:e,id:t}){(this.#c||=new Map).set(e,t)}removeChangedExistingAnnotation({annotationElementId:e}){this.#c?.delete(e)}renderAnnotationElement(e){let t=this.#c?.get(e.data.id);if(!t)return;let n=this.#s.getRawValue(t);n&&(this.#I===E3.NONE&&!n.hasBeenModified||n.renderAnnotationElement(e))}setMissingCanvas(e,t,n){let r=this.#P?.get(e);r&&(r.setCanvas(t,n),this.#P.delete(e))}addMissingCanvas(e,t){(this.#P||=new Map).set(e,t)}},o8=class e{#e=null;#t=!1;#n=null;#r=null;#i=null;#a=null;#o=!1;#s=null;#c=null;#l=null;#u=null;#d=!1;static#f=null;static _l10n=null;constructor(t){this.#c=t,this.#d=t._uiManager.useNewAltTextFlow,e.#f||=Object.freeze({added:`pdfjs-editor-new-alt-text-added-button`,"added-label":`pdfjs-editor-new-alt-text-added-button-label`,missing:`pdfjs-editor-new-alt-text-missing-button`,"missing-label":`pdfjs-editor-new-alt-text-missing-button-label`,review:`pdfjs-editor-new-alt-text-to-review-button`,"review-label":`pdfjs-editor-new-alt-text-to-review-button-label`})}static initialize(t){e._l10n??=t}async render(){let t=this.#n=document.createElement(`button`);t.className=`altText`,t.tabIndex=`0`;let n=this.#r=document.createElement(`span`);t.append(n),this.#d?(t.classList.add(`new`),t.setAttribute(`data-l10n-id`,e.#f.missing),n.setAttribute(`data-l10n-id`,e.#f[`missing-label`])):(t.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-button`),n.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-button-label`));let r=this.#c._uiManager._signal;t.addEventListener(`contextmenu`,D6,{signal:r}),t.addEventListener(`pointerdown`,e=>e.stopPropagation(),{signal:r});let i=e=>{e.preventDefault(),this.#c._uiManager.editAltText(this.#c),this.#d&&this.#c._reportTelemetry({action:`pdfjs.image.alt_text.image_status_label_clicked`,data:{label:this.#p}})};return t.addEventListener(`click`,i,{capture:!0,signal:r}),t.addEventListener(`keydown`,e=>{e.target===t&&e.key===`Enter`&&(this.#o=!0,i(e))},{signal:r}),await this.#m(),t}get#p(){return this.#e&&`added`||this.#e===null&&this.guessedText&&`review`||`missing`}finish(){this.#n&&(this.#n.focus({focusVisible:this.#o}),this.#o=!1)}isEmpty(){return this.#d?this.#e===null:!this.#e&&!this.#t}hasData(){return this.#d?this.#e!==null||!!this.#l:this.isEmpty()}get guessedText(){return this.#l}async setGuessedText(t){this.#e===null&&(this.#l=t,this.#u=await e._l10n.get(`pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer`,{generatedAltText:t}),this.#m())}toggleAltTextBadge(e=!1){if(!this.#d||this.#e){this.#s?.remove(),this.#s=null;return}if(!this.#s){let e=this.#s=document.createElement(`div`);e.className=`noAltTextBadge`,this.#c.div.append(e)}this.#s.classList.toggle(`hidden`,!e)}serialize(e){let t=this.#e;return!e&&this.#l===t&&(t=this.#u),{altText:t,decorative:this.#t,guessedText:this.#l,textWithDisclaimer:this.#u}}get data(){return{altText:this.#e,decorative:this.#t}}set data({altText:e,decorative:t,guessedText:n,textWithDisclaimer:r,cancel:i=!1}){n&&(this.#l=n,this.#u=r),!(this.#e===e&&this.#t===t)&&(i||(this.#e=e,this.#t=t),this.#m())}toggle(e=!1){this.#n&&(!e&&this.#a&&(clearTimeout(this.#a),this.#a=null),this.#n.disabled=!e)}shown(){this.#c._reportTelemetry({action:`pdfjs.image.alt_text.image_status_label_displayed`,data:{label:this.#p}})}destroy(){this.#n?.remove(),this.#n=null,this.#r=null,this.#i=null,this.#s?.remove(),this.#s=null}async#m(){let t=this.#n;if(!t)return;if(this.#d){if(t.classList.toggle(`done`,!!this.#e),t.setAttribute(`data-l10n-id`,e.#f[this.#p]),this.#r?.setAttribute(`data-l10n-id`,e.#f[`${this.#p}-label`]),!this.#e){this.#i?.remove();return}}else{if(!this.#e&&!this.#t){t.classList.remove(`done`),this.#i?.remove();return}t.classList.add(`done`),t.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-edit-button`)}let n=this.#i;if(!n){this.#i=n=document.createElement(`span`),n.className=`tooltip`,n.setAttribute(`role`,`tooltip`),n.id=`alt-text-tooltip-${this.#c.id}`;let e=this.#c._uiManager._signal;e.addEventListener(`abort`,()=>{clearTimeout(this.#a),this.#a=null},{once:!0}),t.addEventListener(`mouseenter`,()=>{this.#a=setTimeout(()=>{this.#a=null,this.#i.classList.add(`show`),this.#c._reportTelemetry({action:`alt_text_tooltip`})},100)},{signal:e}),t.addEventListener(`mouseleave`,()=>{this.#a&&=(clearTimeout(this.#a),null),this.#i?.classList.remove(`show`)},{signal:e})}this.#t?n.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-decorative-tooltip`):(n.removeAttribute(`data-l10n-id`),n.textContent=this.#e),n.parentNode||t.append(n),this.#c.getElementForAltText()?.setAttribute(`aria-describedby`,n.id)}},s8=class{#e=null;#t=null;#n=!1;#r=null;#i=null;#a=null;#o=null;#s=null;#c=!1;#l=null;constructor(e){this.#r=e}renderForToolbar(){let e=this.#t=document.createElement(`button`);return e.className=`comment`,this.#u(e,!1)}renderForStandalone(){let e=this.#e=document.createElement(`button`);e.className=`annotationCommentButton`;let t=this.#r.commentButtonPosition;if(t){let{style:n}=e;n.insetInlineEnd=`calc(${100*(this.#r._uiManager.direction===`ltr`?1-t[0]:t[0])}% - var(--comment-button-dim))`,n.top=`calc(${100*t[1]}% - var(--comment-button-dim))`;let r=this.#r.commentButtonColor;r&&(n.backgroundColor=r)}return this.#u(e,!0)}focusButton(){setTimeout(()=>{(this.#e??this.#t)?.focus()},0)}onUpdatedColor(){if(!this.#e)return;let e=this.#r.commentButtonColor;e&&(this.#e.style.backgroundColor=e),this.#r._uiManager.updatePopupColor(this.#r)}get commentButtonWidth(){return(this.#e?.getBoundingClientRect().width??0)/this.#r.parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(this.#l)return this.#l;if(!this.#e)return null;let{x:e,y:t,height:n}=this.#e.getBoundingClientRect(),{x:r,y:i,width:a,height:o}=this.#r.parent.boundingClientRect;return[(e-r)/a,(t+n-i)/o]}set commentPopupPositionInLayer(e){this.#l=e}hasDefaultPopupPosition(){return this.#l===null}removeStandaloneCommentButton(){this.#e?.remove(),this.#e=null}removeToolbarCommentButton(){this.#t?.remove(),this.#t=null}setCommentButtonStates({selected:e,hasPopup:t}){this.#e&&(this.#e.classList.toggle(`selected`,e),this.#e.ariaExpanded=t)}#u(e,t){if(!this.#r._uiManager.hasCommentManager())return null;e.tabIndex=`0`,e.ariaHasPopup=`dialog`,t?(e.ariaControls=`commentPopup`,e.setAttribute(`data-l10n-id`,`pdfjs-show-comment-button`)):(e.ariaControlsElements=[this.#r._uiManager.getCommentDialogElement()],e.setAttribute(`data-l10n-id`,`pdfjs-editor-add-comment-button`));let n=this.#r._uiManager._signal;if(!(n instanceof AbortSignal)||n.aborted)return e;e.addEventListener(`contextmenu`,D6,{signal:n}),t&&(e.addEventListener(`focusin`,e=>{this.#r._focusEventsAllowed=!1,O6(e)},{capture:!0,signal:n}),e.addEventListener(`focusout`,e=>{this.#r._focusEventsAllowed=!0,O6(e)},{capture:!0,signal:n})),e.addEventListener(`pointerdown`,e=>e.stopPropagation(),{signal:n});let r=t=>{t.preventDefault(),e===this.#t?this.edit():this.#r.toggleComment(!0)};return e.addEventListener(`click`,r,{capture:!0,signal:n}),e.addEventListener(`keydown`,t=>{t.target===e&&t.key===`Enter`&&(this.#n=!0,r(t))},{signal:n}),e.addEventListener(`pointerenter`,()=>{this.#r.toggleComment(!1,!0)},{signal:n}),e.addEventListener(`pointerleave`,()=>{this.#r.toggleComment(!1,!1)},{signal:n}),e}edit(e){let t=this.commentPopupPositionInLayer,n,r;if(t)[n,r]=t;else{[n,r]=this.#r.commentButtonPosition;let{width:e,height:t,x:i,y:a}=this.#r;n=i+n*e,r=a+r*t}let i=this.#r.parent.boundingClientRect,{x:a,y:o,width:s,height:c}=i;this.#r._uiManager.editComment(this.#r,a+n*s,o+r*c,{...e,parentDimensions:i})}finish(){this.#t&&(this.#t.focus({focusVisible:this.#n}),this.#n=!1)}isDeleted(){return this.#c||this.#o===``}isEmpty(){return this.#o===null}hasBeenEdited(){return this.isDeleted()||this.#o!==this.#i}serialize(){return this.data}get data(){return{text:this.#o,richText:this.#a,date:this.#s,deleted:this.isDeleted()}}set data(e){if(e!==this.#o&&(this.#a=null),e===null){this.#o=``,this.#c=!0;return}this.#o=e,this.#s=new Date,this.#c=!1}restoreData({text:e,richText:t,date:n}){this.#o=e,this.#a=t,this.#s=n,this.#c=!1}setInitialText(e,t=null){this.#i=e,this.data=e,this.#s=null,this.#a=t}shown(){}destroy(){this.#t?.remove(),this.#t=null,this.#e?.remove(),this.#e=null,this.#o=``,this.#a=null,this.#s=null,this.#r=null,this.#n=!1,this.#c=!1}},c8=class e{#e;#t=!1;#n=null;#r;#i;#a;#o;#s=null;#c;#l=null;#u;#d=null;constructor({container:e,isPinchingDisabled:t=null,isPinchingStopped:n=null,onPinchStart:r=null,onPinching:i=null,onPinchEnd:a=null,signal:o}){this.#e=e,this.#n=n,this.#r=t,this.#i=r,this.#a=i,this.#o=a,this.#u=new AbortController,this.#c=AbortSignal.any([o,this.#u.signal]),e.addEventListener(`touchstart`,this.#f.bind(this),{passive:!1,signal:this.#c})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/I6.pixelRatio}#f(e){if(this.#r?.())return;if(e.touches.length===1){if(this.#s)return;let e=this.#s=new AbortController,t=AbortSignal.any([this.#c,e.signal]),n=this.#e,r={capture:!0,signal:t,passive:!1},i=e=>{e.pointerType===`touch`&&(this.#s?.abort(),this.#s=null)};n.addEventListener(`pointerdown`,e=>{e.pointerType===`touch`&&(O6(e),i(e))},r),n.addEventListener(`pointerup`,i,r),n.addEventListener(`pointercancel`,i,r);return}if(!this.#d){this.#d=new AbortController;let e=AbortSignal.any([this.#c,this.#d.signal]),t=this.#e,n={signal:e,capture:!1,passive:!1};t.addEventListener(`touchmove`,this.#p.bind(this),n);let r=this.#m.bind(this);t.addEventListener(`touchend`,r,n),t.addEventListener(`touchcancel`,r,n),n.capture=!0,t.addEventListener(`pointerdown`,O6,n),t.addEventListener(`pointermove`,O6,n),t.addEventListener(`pointercancel`,O6,n),t.addEventListener(`pointerup`,O6,n),this.#i?.()}if(O6(e),e.touches.length!==2||this.#n?.()){this.#l=null;return}let[t,n]=e.touches;t.identifier>n.identifier&&([t,n]=[n,t]),this.#l={touch0X:t.screenX,touch0Y:t.screenY,touch1X:n.screenX,touch1Y:n.screenY}}#p(t){if(!this.#l||t.touches.length!==2)return;O6(t);let[n,r]=t.touches;n.identifier>r.identifier&&([n,r]=[r,n]);let{screenX:i,screenY:a}=n,{screenX:o,screenY:s}=r,c=this.#l,{touch0X:l,touch0Y:u,touch1X:d,touch1Y:f}=c,p=d-l,m=f-u,h=o-i,g=s-a,_=Math.hypot(h,g)||1,v=Math.hypot(p,m)||1;if(!this.#t&&Math.abs(v-_)<=e.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(c.touch0X=i,c.touch0Y=a,c.touch1X=o,c.touch1Y=s,!this.#t){this.#t=!0;return}let y=[(i+o)/2,(a+s)/2];this.#a?.(y,v,_)}#m(e){e.touches.length>=2||(this.#d&&(this.#d.abort(),this.#d=null,this.#o?.()),this.#l&&(O6(e),this.#l=null,this.#t=!1))}destroy(){this.#u?.abort(),this.#u=null,this.#s?.abort(),this.#s=null}},l8=class e{#e=null;#t=null;#n=null;#r=null;#i=null;#a=!1;#o=null;#s=``;#c=null;#l=null;#u=null;#d=null;#f=null;#p=``;#m=!1;#h=null;#g=!1;#_=!1;#v=!1;#y=null;#b=0;#x=0;#S=null;#C=null;isSelected=!1;_isCopy=!1;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nAlert=null;static _l10nResizer=null;#w=!1;#T=e._zIndex++;static _borderLineWidth=-1;static _colorManager=new i8;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){let t=e.prototype._resizeWithKeyboard,n=a8.TRANSLATE_SMALL,r=a8.TRANSLATE_BIG;return J3(this,`_resizerKeyboardManager`,new r8([[[`ArrowLeft`],t,{args:[-n,0]}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],t,{args:[-r,0]}],[[`ArrowRight`],t,{args:[n,0]}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],t,{args:[r,0]}],[[`ArrowUp`],t,{args:[0,-n]}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],t,{args:[0,-r]}],[[`ArrowDown`],t,{args:[0,n]}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],t,{args:[0,r]}],[[`Escape`],e.prototype._stopResizingWithKeyboard]]))}constructor(e){this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null,this.annotationElementId=e.annotationElementId||null,this.creationDate=e.creationDate||new Date,this.modificationDate=e.modificationDate||null,this.canAddComment=!0;let{rotation:t,rawDims:{pageWidth:n,pageHeight:r,pageX:i,pageY:a}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,r],this.pageTranslation=[i,a];let[o,s]=this.parentDimensions;this.x=e.x/o,this.y=e.y/s,this.isAttachedToDOM=!1,this.deleted=!1}updatePageIndex(e){this.pageIndex=e}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return J3(this,`_defaultLineColor`,this._colorManager.getHexCode(`CanvasText`))}static deleteAnnotationElement(e){let t=new u8({id:e._uiManager.getId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(t,n){if(e._l10n??=t,e._l10nAlert??=Object.freeze({highlight:`pdfjs-editor-highlight-added-alert`,freetext:`pdfjs-editor-freetext-added-alert`,ink:`pdfjs-editor-ink-added-alert`,stamp:`pdfjs-editor-stamp-added-alert`,signature:`pdfjs-editor-signature-added-alert`}),e._l10nResizer??=Object.freeze({topLeft:`pdfjs-editor-resizer-top-left`,topMiddle:`pdfjs-editor-resizer-top-middle`,topRight:`pdfjs-editor-resizer-top-right`,middleRight:`pdfjs-editor-resizer-middle-right`,bottomRight:`pdfjs-editor-resizer-bottom-right`,bottomMiddle:`pdfjs-editor-resizer-bottom-middle`,bottomLeft:`pdfjs-editor-resizer-bottom-left`,middleLeft:`pdfjs-editor-resizer-middle-left`}),e._borderLineWidth!==-1)return;let r=getComputedStyle(document.documentElement);e._borderLineWidth=parseFloat(r.getPropertyValue(`--outline-width`))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){H3(`Not implemented`)}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#w}set _isDraggable(e){this.#w=e,this.div?.classList.toggle(`draggable`,e)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){let[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(e*2),this.y+=this.width*e/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(e*2),this.y-=this.width*e/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#T}setParent(e){e===null?(this.#W(),this.#d?.remove(),this.#d=null):(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions),this.parent=e}focusin(e){this._focusEventsAllowed&&(this.#m?this.#m=!1:this.parent.setSelected(this))}focusout(e){this._focusEventsAllowed&&this.isAttachedToDOM&&(e.relatedTarget?.closest(`#${this.id}`)||(e.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove()))}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,n,r){let[i,a]=this.parentDimensions;[n,r]=this.screenToPageTranslation(n,r),this.x=(e+n)/i,this.y=(t+r)/a,this.fixAndSetPosition()}_moveAfterPaste(e,t){if(this.isClone){delete this.isClone;return}let[n,r]=this.parentDimensions;this.setAt(e*n,t*r,this.width*n,this.height*r),this._onTranslated()}#E([e,t],n,r){[n,r]=this.screenToPageTranslation(n,r),this.x+=n/e,this.y+=r/t,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(e,t){this.#E(this.parentDimensions,e,t)}translateInPage(e,t){this.#h||=[this.x,this.y,this.width,this.height],this.#E(this.pageDimensions,e,t),this.div.scrollIntoView({block:`nearest`})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,t){this.#h||=[this.x,this.y,this.width,this.height];let{div:n,parentDimensions:[r,i]}=this;if(this.x+=e/r,this.y+=t/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:e,y:t}=this.div.getBoundingClientRect();this.parent.findNewParent(this,e,t)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:o}=this,[s,c]=this.getBaseTranslation();a+=s,o+=c;let{style:l}=n;l.left=`${(100*a).toFixed(2)}%`,l.top=`${(100*o).toFixed(2)}%`,this._onTranslating(a,o),n.scrollIntoView({block:`nearest`})}_onTranslating(e,t){}_onTranslated(e,t){}get _hasBeenMoved(){return!!this.#h&&(this.#h[0]!==this.x||this.#h[1]!==this.y)}get _hasBeenResized(){return!!this.#h&&(this.#h[2]!==this.width||this.#h[3]!==this.height)}getBaseTranslation(){let[t,n]=this.parentDimensions,{_borderLineWidth:r}=e,i=r/t,a=r/n;switch(this.rotation){case 90:return[-i,a];case 180:return[i,a];case 270:return[i,-a];default:return[-i,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){let{div:{style:t},pageDimensions:[n,r]}=this,{x:i,y:a,width:o,height:s}=this;if(o*=n,s*=r,i*=n,a*=r,this._mustFixPosition)switch(e){case 0:i=m6(i,0,n-o),a=m6(a,0,r-s);break;case 90:i=m6(i,0,n-s),a=m6(a,o,r);break;case 180:i=m6(i,o,n),a=m6(a,s,r);break;case 270:i=m6(i,s,n),a=m6(a,0,r-o);break}this.x=i/=n,this.y=a/=r;let[c,l]=this.getBaseTranslation();i+=c,a+=l,t.left=`${(100*i).toFixed(2)}%`,t.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}static#D(e,t,n){switch(n){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}screenToPageTranslation(t,n){return e.#D(t,n,this.parentRotation)}pageTranslationToScreen(t,n){return e.#D(t,n,360-this.parentRotation)}#O(e){switch(e){case 90:{let[e,t]=this.pageDimensions;return[0,-e/t,t/e,0]}case 180:return[-1,0,0,-1];case 270:{let[e,t]=this.pageDimensions;return[0,e/t,-t/e,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:e,pageDimensions:[t,n]}=this;return[t*e,n*e]}setDims(){let{div:{style:e},width:t,height:n}=this;e.width=`${(100*t).toFixed(2)}%`,e.height=`${(100*n).toFixed(2)}%`}getInitialTranslation(){return[0,0]}#k(){if(this.#c)return;this.#c=document.createElement(`div`),this.#c.classList.add(`resizers`);let e=this._willKeepAspectRatio?[`topLeft`,`topRight`,`bottomRight`,`bottomLeft`]:[`topLeft`,`topMiddle`,`topRight`,`middleRight`,`bottomRight`,`bottomMiddle`,`bottomLeft`,`middleLeft`],t=this._uiManager._signal;for(let n of e){let e=document.createElement(`div`);this.#c.append(e),e.classList.add(`resizer`,n),e.setAttribute(`data-resizer-name`,n),e.addEventListener(`pointerdown`,this.#A.bind(this,n),{signal:t}),e.addEventListener(`contextmenu`,D6,{signal:t}),e.tabIndex=-1}this.div.prepend(this.#c)}#A(e,t){t.preventDefault();let{isMac:n}=i6.platform;if(t.button!==0||t.ctrlKey&&n)return;this.#n?.toggle(!1);let r=this._isDraggable;this._isDraggable=!1,this.#l=[t.screenX,t.screenY];let i=new AbortController,a=this._uiManager.combinedSignal(i);this.parent.togglePointerEvents(!1),window.addEventListener(`pointermove`,this.#N.bind(this,e),{passive:!0,capture:!0,signal:a}),window.addEventListener(`touchmove`,O6,{passive:!1,signal:a}),window.addEventListener(`contextmenu`,D6,{signal:a}),this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let o=this.parent.div.style.cursor,s=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;let c=()=>{i.abort(),this.parent.togglePointerEvents(!0),this.#n?.toggle(!0),this._isDraggable=r,this.parent.div.style.cursor=o,this.div.style.cursor=s,this.#M()};window.addEventListener(`pointerup`,c,{signal:a}),window.addEventListener(`blur`,c,{signal:a})}#j(e,t,n,r){this.width=n,this.height=r,this.x=e,this.y=t,this.setDims(),this.fixAndSetPosition(),this._onResized()}_onResized(){}#M(){if(!this.#u)return;let{savedX:e,savedY:t,savedWidth:n,savedHeight:r}=this.#u;this.#u=null;let i=this.x,a=this.y,o=this.width,s=this.height;i===e&&a===t&&o===n&&s===r||this.addCommands({cmd:this.#j.bind(this,i,a,o,s),undo:this.#j.bind(this,e,t,n,r),mustExec:!0})}static _round(e){return Math.round(e*1e4)/1e4}#N(t,n){let[r,i]=this.parentDimensions,a=this.x,o=this.y,s=this.width,c=this.height,l=e.MIN_SIZE/r,u=e.MIN_SIZE/i,d=this.#O(this.rotation),f=(e,t)=>[d[0]*e+d[2]*t,d[1]*e+d[3]*t],p=this.#O(360-this.rotation),m=(e,t)=>[p[0]*e+p[2]*t,p[1]*e+p[3]*t],h,g,_=!1,v=!1;switch(t){case`topLeft`:_=!0,h=(e,t)=>[0,0],g=(e,t)=>[e,t];break;case`topMiddle`:h=(e,t)=>[e/2,0],g=(e,t)=>[e/2,t];break;case`topRight`:_=!0,h=(e,t)=>[e,0],g=(e,t)=>[0,t];break;case`middleRight`:v=!0,h=(e,t)=>[e,t/2],g=(e,t)=>[0,t/2];break;case`bottomRight`:_=!0,h=(e,t)=>[e,t],g=(e,t)=>[0,0];break;case`bottomMiddle`:h=(e,t)=>[e/2,t],g=(e,t)=>[e/2,0];break;case`bottomLeft`:_=!0,h=(e,t)=>[0,t],g=(e,t)=>[e,0];break;case`middleLeft`:v=!0,h=(e,t)=>[0,t/2],g=(e,t)=>[e,t/2];break}let y=h(s,c),b=g(s,c),x=f(...b),S=e._round(a+x[0]),C=e._round(o+x[1]),w=1,T=1,E,D;if(n.fromKeyboard)({deltaX:E,deltaY:D}=n);else{let{screenX:e,screenY:t}=n,[r,i]=this.#l;[E,D]=this.screenToPageTranslation(e-r,t-i),this.#l[0]=e,this.#l[1]=t}if([E,D]=m(E/r,D/i),_){let e=Math.hypot(s,c);w=T=Math.max(Math.min(Math.hypot(b[0]-y[0]-E,b[1]-y[1]-D)/e,1/s,1/c),l/s,u/c)}else v?w=m6(Math.abs(b[0]-y[0]-E),l,1)/s:T=m6(Math.abs(b[1]-y[1]-D),u,1)/c;let O=e._round(s*w),k=e._round(c*T);x=f(...g(O,k));let A=S-x[0],j=C-x[1];this.#h||=[this.x,this.y,this.width,this.height],this.width=O,this.height=k,this.x=A,this.y=j,this.setDims(),this.fixAndSetPosition(),this._onResizing()}_onResizing(){}altTextFinish(){this.#n?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||this.#_)return this._editToolbar;this._editToolbar=new Y6(this),this.div.append(this._editToolbar.render());let{toolbarButtons:e}=this;if(e)for(let[t,n]of e)await this._editToolbar.addButton(t,n);return this.hasComment||this._editToolbar.addButton(`comment`,this.addCommentButton()),this._editToolbar.addButton(`delete`),this._editToolbar}addCommentButtonInToolbar(){this._editToolbar?.addButtonBefore(`comment`,this.addCommentButton(),`.deleteButton`)}removeCommentButtonFromToolbar(){this._editToolbar?.removeButton(`comment`)}removeEditToolbar(){this._editToolbar?.remove(),this._editToolbar=null,this.#n?.destroy()}addContainer(e){let t=this._editToolbar?.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return this.#n||(o8.initialize(e._l10n),this.#n=new o8(this),this.#e&&=(this.#n.data=this.#e,null)),this.#n}get altTextData(){return this.#n?.data}set altTextData(e){this.#n&&(this.#n.data=e)}get guessedAltText(){return this.#n?.guessedText}async setGuessedAltText(e){await this.#n?.setGuessedText(e)}serializeAltText(e){return this.#n?.serialize(e)}hasAltText(){return!!this.#n&&!this.#n.isEmpty()}hasAltTextData(){return this.#n?.hasData()??!1}focusCommentButton(){this.#r?.focusButton()}addCommentButton(){return this.canAddComment?this.#r||=new s8(this):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(this.#i){this._uiManager.isEditingMode()&&this.#i.classList.remove(`hidden`);return}this.hasComment&&(this.#i=this.#r.renderForStandalone(),this.div.append(this.#i))}}removeStandaloneCommentButton(){this.#r.removeStandaloneCommentButton(),this.#i=null}hideStandaloneCommentButton(){this.#i?.classList.add(`hidden`)}get comment(){if(!this.#r)return null;let{data:{richText:e,text:t,date:n,deleted:r}}=this.#r;return{text:t,richText:e,date:n,deleted:r,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(e){this.#r||=new s8(this),typeof e==`object`&&e?this.#r.restoreData(e):this.#r.data=e,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:e,popupRef:t,richText:n}){if(!t||(this.#r||=new s8(this),this.#r.setInitialText(e,n),!this.annotationElementId))return;let r=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);r&&this.updateFromAnnotationLayer(r)}get hasEditedComment(){return this.#r?.hasBeenEdited()}get hasDeletedComment(){return this.#r?.isDeleted()}get hasComment(){return!!this.#r&&!this.#r.isEmpty()&&!this.#r.isDeleted()}async editComment(e){this.#r||=new s8(this),this.#r.edit(e)}toggleComment(e,t=void 0){this.hasComment&&this._uiManager.toggleComment(this,e,t)}setSelectedCommentButton(e){this.#r.setSelectedButton(e)}addComment(e){if(this.hasEditedComment){let[,,,t]=e.rect,[n]=this.pageDimensions,[r]=this.pageTranslation,i=r+n+1,a=t-100,o=i+180;e.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[i,a,o,t]}}}updateFromAnnotationLayer({popup:{contents:e,deleted:t}}){this.#r.data=t?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){let e=this.div=document.createElement(`div`);e.setAttribute(`data-editor-rotation`,(360-this.rotation)%360),e.className=this.name,e.setAttribute(`id`,this.id),e.tabIndex=this.#a?-1:0,e.setAttribute(`role`,`application`),this.defaultL10nId&&e.setAttribute(`data-l10n-id`,this.defaultL10nId),this._isVisible||e.classList.add(`hidden`),this.setInForeground(),this.#z();let[t,n]=this.parentDimensions;this.parentRotation%180!=0&&(e.style.maxWidth=`${(100*n/t).toFixed(2)}%`,e.style.maxHeight=`${(100*t/n).toFixed(2)}%`);let[r,i]=this.getInitialTranslation();return this.translate(r,i),Q6(this,e,[`keydown`,`pointerdown`,`dblclick`]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(this.#C||=new c8({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#P.bind(this),onPinching:this.#F.bind(this),onPinchEnd:this.#I.bind(this),signal:this._uiManager._signal})),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),e}#P(){this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#n?.toggle(!1),this.parent.togglePointerEvents(!1)}#F(t,n,r){let i=.7,a=r/n*i+1-i;if(a===1)return;let o=this.#O(this.rotation),s=(e,t)=>[o[0]*e+o[2]*t,o[1]*e+o[3]*t],[c,l]=this.parentDimensions,u=this.x,d=this.y,f=this.width,p=this.height,m=e.MIN_SIZE/c,h=e.MIN_SIZE/l;a=Math.max(Math.min(a,1/f,1/p),m/f,h/p);let g=e._round(f*a),_=e._round(p*a);if(g===f&&_===p)return;this.#h||=[u,d,f,p];let v=s(f/2,p/2),y=e._round(u+v[0]),b=e._round(d+v[1]),x=s(g/2,_/2);this.x=y-x[0],this.y=b-x[1],this.width=g,this.height=_,this.setDims(),this.fixAndSetPosition(),this._onResizing()}#I(){this.#n?.toggle(!0),this.parent.togglePointerEvents(!0),this.#M()}pointerdown(e){let{isMac:t}=i6.platform;if(e.button!==0||e.ctrlKey&&t){e.preventDefault();return}if(this.#m=!0,this._isDraggable){this.#R(e);return}this.#L(e)}#L(e){let{isMac:t}=i6.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)}#R(e){let{isSelected:t}=this;this._uiManager.setUpDragSession();let n=!1,r=new AbortController,i=this._uiManager.combinedSignal(r),a={capture:!0,passive:!1,signal:i},o=e=>{r.abort(),this.#o=null,this.#m=!1,this._uiManager.endDragSession()||this.#L(e),n&&this._onStopDragging()};t&&(this.#b=e.clientX,this.#x=e.clientY,this.#o=e.pointerId,this.#s=e.pointerType,window.addEventListener(`pointermove`,e=>{n||(n=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());let{clientX:t,clientY:r,pointerId:i}=e;if(i!==this.#o){O6(e);return}let[a,o]=this.screenToPageTranslation(t-this.#b,r-this.#x);this.#b=t,this.#x=r,this._uiManager.dragSelectedEditors(a,o)},a),window.addEventListener(`touchmove`,O6,a),window.addEventListener(`pointerdown`,e=>{e.pointerType===this.#s&&(this.#C||e.isPrimary)&&o(e),O6(e)},a));let s=e=>{if(!this.#o||this.#o===e.pointerId){o(e);return}O6(e)};window.addEventListener(`pointerup`,s,{signal:i}),window.addEventListener(`blur`,s,{signal:i})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){this.#y&&clearTimeout(this.#y),this.#y=setTimeout(()=>{this.#y=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(e,t,n){e.changeParent(this),this.x=t,this.y=n,this.fixAndSetPosition(),this._onTranslated()}getRect(e,t,n=this.rotation){let r=this.parentScale,[i,a]=this.pageDimensions,[o,s]=this.pageTranslation,c=e/r,l=t/r,u=this.x*i,d=this.y*a,f=this.width*i,p=this.height*a;switch(n){case 0:return[u+c+o,a-d-l-p+s,u+c+f+o,a-d-l+s];case 90:return[u+l+o,a-d+c+s,u+l+p+o,a-d+c+f+s];case 180:return[u-c-f+o,a-d+l+s,u-c+o,a-d+l+p+s];case 270:return[u-l-p+o,a-d-c-f+s,u-l+o,a-d-c+s];default:throw Error(`Invalid rotation`)}}getRectInCurrentCoords(e,t){let[n,r,i,a]=e,o=i-n,s=a-r;switch(this.rotation){case 0:return[n,t-a,o,s];case 90:return[n,t-r,s,o];case 180:return[i,t-r,o,s];case 270:return[i,t-a,s,o];default:throw Error(`Invalid rotation`)}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&e._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){this.#r?.onUpdatedColor()}getData(){let{comment:{text:e,color:t,date:n,opacity:r,deleted:i,richText:a},uid:o,pageIndex:s,creationDate:c,modificationDate:l}=this;return{id:o,pageIndex:s,rect:this.getPDFRect(),richText:a,contentsObj:{str:e},creationDate:c,modificationDate:n||l,popupRef:!i,color:t,opacity:r}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),this.#_=!0,!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),this.#_=!1,!0):!1}isInEditMode(){return this.#_}shouldGetKeyboardEvents(){return this.#v}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:e,left:t,bottom:n,right:r}=this.getClientDimensions(),{innerHeight:i,innerWidth:a}=window;return t<a&&r>0&&e<i&&n>0}#z(){if(this.#f||!this.div)return;this.#f=new AbortController;let e=this._uiManager.combinedSignal(this.#f);this.div.addEventListener(`focusin`,this.focusin.bind(this),{signal:e}),this.div.addEventListener(`focusout`,this.focusout.bind(this),{signal:e})}rebuild(){this.#z()}rotate(e){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||``}}serialize(e=!1,t=null){return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:this._initialData?.popupRef||``}}static async deserialize(e,t,n){let r=new this.prototype.constructor({parent:t,id:n.getId(),uiManager:n,annotationElementId:e.annotationElementId,creationDate:e.creationDate,modificationDate:e.modificationDate});r.rotation=e.rotation,r.#e=e.accessibilityData,r._isCopy=e.isCopy||!1;let[i,a]=r.pageDimensions,[o,s,c,l]=r.getRectInCurrentCoords(e.rect,a);return r.x=o/i,r.y=s/a,r.width=c/i,r.height=l/a,r}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.#f?.abort(),this.#f=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),this.#y&&=(clearTimeout(this.#y),null),this.#W(),this.removeEditToolbar(),this.#S){for(let e of this.#S.values())clearTimeout(e);this.#S=null}this.parent=null,this.#C?.destroy(),this.#C=null,this.#d?.remove(),this.#d=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#k(),this.#c.classList.remove(`hidden`))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction===`ltr`?[1,0]:[0,0]}get commentButtonPositionInPage(){let{commentButtonPosition:[t,n]}=this,[r,i,a,o]=this.getPDFRect();return[e._round(r+(a-r)*t),e._round(i+(o-i)*(1-n))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return this.#r.commentPopupPositionInLayer}set commentPopupPosition(e){this.#r.commentPopupPositionInLayer=e}hasDefaultPopupPosition(){return this.#r.hasDefaultPopupPosition()}get commentButtonWidth(){return this.#r.commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(e){this.#r?.setCommentButtonStates(e)}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!==`Enter`)return;this._uiManager.setSelected(this),this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let n=this.#c.children;if(!this.#t){this.#t=Array.from(n);let t=this.#B.bind(this),r=this.#V.bind(this),i=this._uiManager._signal;for(let n of this.#t){let a=n.getAttribute(`data-resizer-name`);n.setAttribute(`role`,`spinbutton`),n.addEventListener(`keydown`,t,{signal:i}),n.addEventListener(`blur`,r,{signal:i}),n.addEventListener(`focus`,this.#H.bind(this,a),{signal:i}),n.setAttribute(`data-l10n-id`,e._l10nResizer[a])}}let r=this.#t[0],i=0;for(let e of n){if(e===r)break;i++}let a=(360-this.rotation+this.parentRotation)%360/90*(this.#t.length/4);if(a!==i){if(a<i)for(let e=0;e<i-a;e++)this.#c.append(this.#c.firstElementChild);else if(a>i)for(let e=0;e<a-i;e++)this.#c.firstElementChild.before(this.#c.lastElementChild);let t=0;for(let r of n){let n=this.#t[t++].getAttribute(`data-resizer-name`);r.setAttribute(`data-l10n-id`,e._l10nResizer[n])}}this.#U(0),this.#v=!0,this.#c.firstElementChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#B(t){e._resizerKeyboardManager.exec(this,t)}#V(e){this.#v&&e.relatedTarget?.parentNode!==this.#c&&this.#W()}#H(e){this.#p=this.#v?e:``}#U(e){if(this.#t)for(let t of this.#t)t.tabIndex=e}_resizeWithKeyboard(e,t){this.#v&&this.#N(this.#p,{deltaX:e,deltaY:t,fromKeyboard:!0})}#W(){this.#v=!1,this.#U(-1),this.#M()}_stopResizingWithKeyboard(){this.#W(),this.div.focus()}select(){if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),this.div?.classList.add(`selectedEditor`),!this._editToolbar){this.addEditToolbar().then(()=>{this.div?.classList.contains(`selectedEditor`)&&this._editToolbar?.show()});return}this._editToolbar?.show(),this.#n?.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>this.div?.focus({preventScroll:!0}),0)}unselect(){this.isSelected&&(this.isSelected=!1,this.#c?.classList.add(`hidden`),this.div?.classList.remove(`selectedEditor`),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#n?.toggleAltTextBadge(!0),this.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(e,t){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){e.target.nodeName!==`BUTTON`&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return this.#g}set isEditing(e){this.#g=e,this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:`added`}}get telemetryFinalData(){return null}_reportTelemetry(t,n=!1){if(n){this.#S||=new Map;let{action:n}=t,r=this.#S.get(n);r&&clearTimeout(r),r=setTimeout(()=>{this._reportTelemetry(t),this.#S.delete(n),this.#S.size===0&&(this.#S=null)},e._telemetryTimeout),this.#S.set(n,r);return}t.type||=this.editorType,this._uiManager._eventBus.dispatch(`reporttelemetry`,{source:this,details:{type:`editing`,data:t}})}show(e=this._isVisible){this.div.classList.toggle(`hidden`,!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),this.#a=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#a=!0}updateFakeAnnotationElement(e){if(!this.#d&&!this.deleted){this.#d=e.addFakeAnnotation(this);return}if(this.deleted){this.#d.remove(),this.#d=null;return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&this.#d.updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let t=e.container.querySelector(`.annotationContent`);if(!t)t=document.createElement(`div`),t.classList.add(`annotationContent`,this.editorType),e.container.prepend(t);else if(t.nodeName===`CANVAS`){let e=t;t=document.createElement(`div`),t.classList.add(`annotationContent`,this.editorType),e.before(t)}return t}resetAnnotationElement(e){let{firstElementChild:t}=e.container;t?.nodeName===`DIV`&&t.classList.contains(`annotationContent`)&&t.remove()}},u8=class extends l8{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},d8=3285377520,f8=4294901760,p8=65535,m8=class{constructor(e){this.h1=e?e&4294967295:d8,this.h2=e?e&4294967295:d8}update(e){let t,n;if(typeof e==`string`){t=new Uint8Array(e.length*2),n=0;for(let r=0,i=e.length;r<i;r++){let i=e.charCodeAt(r);i<=255?t[n++]=i:(t[n++]=i>>>8,t[n++]=i&255)}}else if(ArrayBuffer.isView(e))t=e.slice(),n=t.byteLength;else throw Error(`Invalid data format, must be a string or TypedArray.`);let r=n>>2,i=n-r*4,a=new Uint32Array(t.buffer,0,r),o=0,s=0,c=this.h1,l=this.h2,u=3432918353,d=461845907,f=11601,p=13715;for(let e=0;e<r;e++)e&1?(o=a[e],o=o*u&f8|o*f&p8,o=o<<15|o>>>17,o=o*d&f8|o*p&p8,c^=o,c=c<<13|c>>>19,c=c*5+3864292196):(s=a[e],s=s*u&f8|s*f&p8,s=s<<15|s>>>17,s=s*d&f8|s*p&p8,l^=s,l=l<<13|l>>>19,l=l*5+3864292196);switch(o=0,i){case 3:o^=t[r*4+2]<<16;case 2:o^=t[r*4+1]<<8;case 1:o^=t[r*4],o=o*u&f8|o*f&p8,o=o<<15|o>>>17,o=o*d&f8|o*p&p8,r&1?c^=o:l^=o}this.h1=c,this.h2=l}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=e*3981806797&f8|e*36045&p8,t=t*4283543511&f8|((t<<16|e>>>16)*2950163797&f8)>>>16,e^=t>>>1,e=e*444984403&f8|e*60499&p8,t=t*3301882366&f8|((t<<16|e>>>16)*3120437893&f8)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,`0`)+(t>>>0).toString(16).padStart(8,`0`)}},h8=Object.freeze({map:null,hash:``,transfer:void 0}),g8=class{#e=!1;#t=null;#n=null;#r=new Map;onSetModified=null;onResetModified=null;onAnnotationEditor=null;getValue(e,t){let n=this.#r.get(e);return n===void 0?t:Object.assign(t,n)}getRawValue(e){return this.#r.get(e)}remove(e){let t=this.#r.get(e);t!==void 0&&(t instanceof l8&&this.#n.delete(t.annotationElementId),this.#r.delete(e),this.#r.size===0&&this.resetModified(),!this.#r.values().some(e=>e instanceof l8)&&this.onAnnotationEditor?.(null))}setValue(e,t){let n=this.#r.get(e),r=!1;if(n!==void 0)for(let[e,i]of Object.entries(t))n[e]!==i&&(r=!0,n[e]=i);else r=!0,this.#r.set(e,t);r&&this.#i(),t instanceof l8&&((this.#n||=new Map).set(t.annotationElementId,t),this.onAnnotationEditor?.(t.constructor._type))}has(e){return this.#r.has(e)}get size(){return this.#r.size}#i(){this.#e||(this.#e=!0,this.onSetModified?.())}resetModified(){this.#e&&(this.#e=!1,this.onResetModified?.())}get print(){return new _8(this)}get serializable(){if(this.#r.size===0)return h8;let e=new Map,t=new m8,n=[],r=Object.create(null),i=!1;for(let[n,a]of this.#r){let o=a instanceof l8?a.serialize(!1,r):a;a.page&&(a.pageIndex=a.page._pageIndex,delete a.page),o&&(e.set(n,o),t.update(`${n}:${JSON.stringify(o)}`),i||=!!o.bitmap)}if(i)for(let t of e.values())t.bitmap&&n.push(t.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:n}:h8}get editorStats(){let e=null,t=new Map,n=0,r=0;for(let i of this.#r.values()){if(!(i instanceof l8)){i.popup&&(i.popup.deleted?r+=1:n+=1);continue}i.isCommentDeleted?r+=1:i.hasEditedComment&&(n+=1);let a=i.telemetryFinalData;if(!a)continue;let{type:o}=a;t.getOrInsertComputed(o,()=>Object.getPrototypeOf(i).constructor),e||=Object.create(null);let s=e[o]||=new Map;for(let[e,t]of Object.entries(a)){if(e===`type`)continue;let n=s.getOrInsertComputed(e,f6);n.set(t,(n.get(t)??0)+1)}}if((r>0||n>0)&&(e||=Object.create(null),e.comments={deleted:r,edited:n}),!e)return null;for(let[n,r]of t)e[n]=r.computeTelemetryFinalData(e[n]);return e}resetModifiedIds(){this.#t=null}updateEditor(e,t){let n=this.#n?.get(e);return n?(n.updateFromAnnotationLayer(t),!0):!1}getEditor(e){return this.#n?.get(e)||null}get modifiedIds(){if(this.#t)return this.#t;let e=[];if(this.#n)for(let t of this.#n.values())t.serialize()&&e.push(t.annotationElementId);let t=``;if(e.length){let n=new m8;n.update(e.join(`,`)),t=n.hexdigest()}return this.#t={ids:new Set(e),hash:t}}[Symbol.iterator](){return this.#r.entries()}},_8=class extends g8{#e=h8;constructor(e){super();let{serializable:t}=e;if(t===h8)return;let{map:n,hash:r,transfer:i}=t,a=structuredClone(n,i?{transfer:i}:null);this.#e={map:a,hash:r,transfer:[]}}get print(){H3(`Should not call PrintAnnotationStorage.print`)}get serializable(){return this.#e}get modifiedIds(){return J3(this,`modifiedIds`,{ids:new Set,hash:``})}},v8=`__forcedDependency`,{floor:y8,ceil:b8}=Math;function x8(e,t,n,r,i,a){e[t*4+0]=Math.min(e[t*4+0],n),e[t*4+1]=Math.min(e[t*4+1],r),e[t*4+2]=Math.max(e[t*4+2],i),e[t*4+3]=Math.max(e[t*4+3],a)}function S8(e,t,n,r,i){let a;e?(e<0&&(a=i[0],i[0]=i[2],i[2]=a),i[0]*=e,i[2]*=e,t<0&&(a=i[1],i[1]=i[3],i[3]=a),i[1]*=t,i[3]*=t):i.fill(0),i[0]+=n,i[1]+=r,i[2]+=n,i[3]+=r}var C8=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0],w8=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get length(){return this.#e.length}isEmpty(e){return this.#e[e]===C8}minX(e){return this.#t[e*4+0]/256}minY(e){return this.#t[e*4+1]/256}maxX(e){return(this.#t[e*4+2]+1)/256}maxY(e){return(this.#t[e*4+3]+1)/256}},T8=(e,t)=>e?.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1})),E8=class{#e=[[1,0,0,1,0,0]];#t=[-1/0,-1/0,1/0,1/0];#n=new Float64Array(_3);_pendingBBoxIdx=-1;#r;#i;#a;#o;_savesStack=[];_markedContentStack=[];constructor(e,t){this.#r=e.width,this.#i=e.height,this.#s(t)}growOperationsCount(e){e>=this.#o.length&&this.#s(e,this.#o)}#s(e,t){let n=new ArrayBuffer(e*4);this.#a=new Uint8ClampedArray(n),this.#o=new Uint32Array(n),t&&t.length>0?(this.#o.set(t),this.#o.fill(C8,t.length)):this.#o.fill(C8)}get clipBox(){return this.#t}save(e){return this.#t={__proto__:this.#t},this._savesStack.push(e),this}restore(e,t){let n=Object.getPrototypeOf(this.#t);if(n===null)return this;this.#t=n;let r=this._savesStack.pop();return r!==void 0&&(t?.(r,e),this.#o[e]=this.#o[r]),this}recordOpenMarker(e){return this._savesStack.push(e),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(e,t){let n=this._savesStack.pop();return n!==void 0&&(t?.(n,e),this.#o[e]=this.#o[n]),this}beginMarkedContent(e){return this._markedContentStack.push(e),this}endMarkedContent(e,t){let n=this._markedContentStack.pop();return n!==void 0&&(t?.(n,e),this.#o[e]=this.#o[n]),this}pushBaseTransform(e){return this.#e.push($.multiplyByDOMMatrix(this.#e.at(-1),e.getTransform())),this}popBaseTransform(){return this.#e.length>1&&this.#e.pop(),this}resetBBox(e){return this._pendingBBoxIdx!==e&&(this._pendingBBoxIdx=e,this.#n.set(_3,0)),this}recordClipBox(e,t,n,r,i,a){let o=$.multiplyByDOMMatrix(this.#e.at(-1),t.getTransform()),s=_3.slice();$.axialAlignedBoundingBox([n,i,r,a],o,s);let c=$.intersect(this.#t,s);return c?(this.#t[0]=c[0],this.#t[1]=c[1],this.#t[2]=c[2],this.#t[3]=c[3]):(this.#t[0]=this.#t[1]=1/0,this.#t[2]=this.#t[3]=-1/0),this}recordBBox(e,t,n,r,i,a){let o=this.#t;if(o[0]===1/0)return this;let s=$.multiplyByDOMMatrix(this.#e.at(-1),t.getTransform());if(o[0]===-1/0)return $.axialAlignedBoundingBox([n,i,r,a],s,this.#n),this;let c=_3.slice();return $.axialAlignedBoundingBox([n,i,r,a],s,c),this.#n[0]=m6(c[0],o[0],this.#n[0]),this.#n[1]=m6(c[1],o[1],this.#n[1]),this.#n[2]=m6(c[2],this.#n[2],o[2]),this.#n[3]=m6(c[3],this.#n[3],o[3]),this}recordFullPageBBox(e){return this.#n[0]=Math.max(0,this.#t[0]),this.#n[1]=Math.max(0,this.#t[1]),this.#n[2]=Math.min(this.#r,this.#t[2]),this.#n[3]=Math.min(this.#i,this.#t[3]),this}recordOperation(e,t=!1,n){if(this._pendingBBoxIdx!==e)return this;let r=y8(this.#n[0]*256/this.#r),i=y8(this.#n[1]*256/this.#i),a=b8(this.#n[2]*256/this.#r),o=b8(this.#n[3]*256/this.#i);if(x8(this.#a,e,r,i,a,o),n)for(let t of n)for(let n of t)n!==e&&x8(this.#a,n,r,i,a,o);return t||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(e){return this._pendingBBoxIdx===e&&(this._pendingBBoxIdx=-1,this.#t[0]=Math.max(this.#t[0],this.#n[0]),this.#t[1]=Math.max(this.#t[1],this.#n[1]),this.#t[2]=Math.min(this.#t[2],this.#n[2]),this.#t[3]=Math.min(this.#t[3],this.#n[3])),this}take(){return new w8(this.#o,this.#a)}takeDebugMetadata(){throw Error(`Unreachable`)}recordSimpleData(e,t){return this}recordIncrementalData(e,t){return this}resetIncrementalData(e,t){return this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,n){return this}recordFutureForcedDependency(e,t){return this}inheritSimpleDataAsFutureForcedDependencies(e){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(e,t,n,r=1,i=0,a=0,o){return this}getSimpleIndex(e){}recordDependencies(e,t){return this}recordNamedDependency(e,t){return this}recordShowTextOperation(e,t=!1){return this}},D8=class{#e={__proto__:null};#t={__proto__:null,transform:[],moveText:[],sameLineText:[],[v8]:[]};#n=new Map;#r=new Set;#i=new Map;#a;#o;#s;constructor(e,t=!1){this.#s=e,t&&(this.#a=new Map,this.#o=(e,t)=>{T8(this.#a,t).dependencies.add(e)})}get clipBox(){return this.#s.clipBox}growOperationsCount(e){this.#s.growOperationsCount(e)}save(e){return this.#e={__proto__:this.#e},this.#t={__proto__:this.#t,transform:{__proto__:this.#t.transform},moveText:{__proto__:this.#t.moveText},sameLineText:{__proto__:this.#t.sameLineText},[v8]:{__proto__:this.#t[v8]}},this.#s.save(e),this}restore(e){this.#s.restore(e,this.#o);let t=Object.getPrototypeOf(this.#e);return t===null?this:(this.#e=t,this.#t=Object.getPrototypeOf(this.#t),this)}recordOpenMarker(e){return this.#s.recordOpenMarker(e,this.#o),this}getOpenMarker(){return this.#s.getOpenMarker()}recordCloseMarker(e){return this.#s.recordCloseMarker(e,this.#o),this}beginMarkedContent(e){return this.#s.beginMarkedContent(e),this}endMarkedContent(e){return this.#s.endMarkedContent(e,this.#o),this}pushBaseTransform(e){return this.#s.pushBaseTransform(e),this}popBaseTransform(){return this.#s.popBaseTransform(),this}recordSimpleData(e,t){return this.#e[e]=t,this}recordIncrementalData(e,t){return this.#t[e].push(t),this}resetIncrementalData(e,t){return this.#t[e].length=0,this}recordNamedData(e,t){return this.#n.set(e,t),this}recordSimpleDataFromNamed(e,t,n){this.#e[e]=this.#n.get(t)??n}recordFutureForcedDependency(e,t){return this.recordIncrementalData(v8,t),this}inheritSimpleDataAsFutureForcedDependencies(e){for(let t of e)t in this.#e&&this.recordFutureForcedDependency(t,this.#e[t]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let e of this.#r)this.recordFutureForcedDependency(v8,e);return this}resetBBox(e){return this.#s.resetBBox(e),this}recordClipBox(e,t,n,r,i,a){return this.#s.recordClipBox(e,t,n,r,i,a),this}recordBBox(e,t,n,r,i,a){return this.#s.recordBBox(e,t,n,r,i,a),this}recordCharacterBBox(e,t,n,r=1,i=0,a=0,o){let s=n.bbox,c,l;if(s&&(c=s[2]!==s[0]&&s[3]!==s[1]&&this.#i.get(n),c!==!1&&(l=[0,0,0,0],$.axialAlignedBoundingBox(s,n.fontMatrix,l),(r!==1||i!==0||a!==0)&&S8(r,-r,i,a,l),c)))return this.recordBBox(e,t,l[0],l[2],l[1],l[3]);if(!o)return this.recordFullPageBBox(e);let u=o();return s&&l&&c===void 0&&(c=l[0]<=i-u.actualBoundingBoxLeft&&l[2]>=i+u.actualBoundingBoxRight&&l[1]<=a-u.actualBoundingBoxAscent&&l[3]>=a+u.actualBoundingBoxDescent,this.#i.set(n,c),c)?this.recordBBox(e,t,l[0],l[2],l[1],l[3]):this.recordBBox(e,t,i-u.actualBoundingBoxLeft,i+u.actualBoundingBoxRight,a-u.actualBoundingBoxAscent,a+u.actualBoundingBoxDescent)}recordFullPageBBox(e){return this.#s.recordFullPageBBox(e),this}getSimpleIndex(e){return this.#e[e]}recordDependencies(e,t){let n=this.#r,r=this.#e,i=this.#t;for(let e of t)e in this.#e?n.add(r[e]):e in i&&i[e].forEach(n.add,n);return this}recordNamedDependency(e,t){return this.#n.has(t)&&this.#r.add(this.#n.get(t)),this}recordOperation(e,t=!1){if(this.recordDependencies(e,[v8]),this.#a){let t=T8(this.#a,e),{dependencies:n}=t;this.#r.forEach(n.add,n),this.#s._savesStack.forEach(n.add,n),this.#s._markedContentStack.forEach(n.add,n),n.delete(e),t.isRenderingOperation=!0}let n=!t&&e===this.#s._pendingBBoxIdx;return this.#s.recordOperation(e,t,[this.#r,this.#s._savesStack,this.#s._markedContentStack]),n&&this.#r.clear(),this}recordShowTextOperation(e,t=!1){let n=Array.from(this.#r);this.recordOperation(e,t),this.recordIncrementalData(`sameLineText`,e);for(let e of n)this.recordIncrementalData(`sameLineText`,e);return this}bboxToClipBoxDropOperation(e,t=!1){let n=!t&&e===this.#s._pendingBBoxIdx;return this.#s.bboxToClipBoxDropOperation(e),n&&this.#r.clear(),this}take(){return this.#i.clear(),this.#s.take()}takeDebugMetadata(){return this.#a}},O8=class e{#e;#t;#n;#r=0;#i=0;constructor(t,n,r){if(t instanceof e&&t.#n===!!r)return t;this.#e=t,this.#t=n,this.#n=!!r}get clipBox(){return this.#e.clipBox}growOperationsCount(){throw Error(`Unreachable`)}save(e){return this.#i++,this.#e.save(this.#t),this}restore(e){return this.#i>0&&(this.#e.restore(this.#t),this.#i--),this}recordOpenMarker(e){return this.#r++,this}getOpenMarker(){return this.#r>0?this.#t:this.#e.getOpenMarker()}recordCloseMarker(e){return this.#r--,this}beginMarkedContent(e){return this}endMarkedContent(e){return this}pushBaseTransform(e){return this.#e.pushBaseTransform(e),this}popBaseTransform(){return this.#e.popBaseTransform(),this}recordSimpleData(e,t){return this.#e.recordSimpleData(e,this.#t),this}recordIncrementalData(e,t){return this.#e.recordIncrementalData(e,this.#t),this}resetIncrementalData(e,t){return this.#e.resetIncrementalData(e,this.#t),this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,n){return this.#e.recordSimpleDataFromNamed(e,t,this.#t),this}recordFutureForcedDependency(e,t){return this.#e.recordFutureForcedDependency(e,this.#t),this}inheritSimpleDataAsFutureForcedDependencies(e){return this.#e.inheritSimpleDataAsFutureForcedDependencies(e),this}inheritPendingDependenciesAsFutureForcedDependencies(){return this.#e.inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(e){return this.#n||this.#e.resetBBox(this.#t),this}recordClipBox(e,t,n,r,i,a){return this.#n||this.#e.recordClipBox(this.#t,t,n,r,i,a),this}recordBBox(e,t,n,r,i,a){return this.#n||this.#e.recordBBox(this.#t,t,n,r,i,a),this}recordCharacterBBox(e,t,n,r,i,a,o){return this.#n||this.#e.recordCharacterBBox(this.#t,t,n,r,i,a,o),this}recordFullPageBBox(e){return this.#n||this.#e.recordFullPageBBox(this.#t),this}getSimpleIndex(e){return this.#e.getSimpleIndex(e)}recordDependencies(e,t){return this.#e.recordDependencies(this.#t,t),this}recordNamedDependency(e,t){return this.#e.recordNamedDependency(this.#t,t),this}recordOperation(e){return this.#e.recordOperation(this.#t,!0),this}recordShowTextOperation(e){return this.#e.recordShowTextOperation(this.#t,!0),this}bboxToClipBoxDropOperation(e){return this.#n||this.#e.bboxToClipBoxDropOperation(this.#t,!0),this}take(){throw Error(`Unreachable`)}takeDebugMetadata(){throw Error(`Unreachable`)}},k8={stroke:[`path`,`transform`,`filter`,`strokeColor`,`strokeAlpha`,`lineWidth`,`lineCap`,`lineJoin`,`miterLimit`,`dash`],fill:[`path`,`transform`,`filter`,`fillColor`,`fillAlpha`,`globalCompositeOperation`,`SMask`],imageXObject:[`transform`,`SMask`,`filter`,`fillAlpha`,`strokeAlpha`,`globalCompositeOperation`],rawFillPath:[`filter`,`fillColor`,`fillAlpha`],showText:[`transform`,`leading`,`charSpacing`,`wordSpacing`,`hScale`,`textRise`,`moveText`,`textMatrix`,`font`,`fontObj`,`filter`,`fillColor`,`textRenderingMode`,`SMask`,`fillAlpha`,`strokeAlpha`,`globalCompositeOperation`,`sameLineText`],transform:[`transform`],transformAndFill:[`transform`,`fillColor`]},A8=class e{#e;#t;#n=4;#r=0;#i=new e.#a(this.#n*6);static#a=i6.isFloat16ArraySupported?Float16Array:Float32Array;constructor(e){this.#e=e.width,this.#t=e.height}record(t,n,r,i){if(this.#r===this.#n){this.#n*=2;let t=new e.#a(this.#n*6);t.set(this.#i),this.#i=t}let a=N6(t),o;if(i[0]!==1/0){let e=_3.slice();$.axialAlignedBoundingBox([0,-r,n,0],a,e);let t=$.intersect(i,e);if(!t)return;let[s,c,l,u]=t;if(s!==e[0]||c!==e[1]||l!==e[2]||u!==e[3]){let e=Math.atan2(a[1],a[0]),t=Math.abs(Math.sin(e)),n=Math.abs(Math.cos(e));if(t<1e-6||n<1e-6||Math.abs(t-n)<1e-6)o=[s,c,s,u,l,c];else{let e=l-s,r=u-c,i=t*t,a=n*n,d=n*t,f=a-i,p=(r*a-e*d)/f;o=[s+(r*d-e*i)/f,c,s,c+p,l,u-p]}}}o||(o=[0,-r,0,0,n,-r],$.applyTransform(o,a,0),$.applyTransform(o,a,2),$.applyTransform(o,a,4)),o[0]/=this.#e,o[1]/=this.#t,o[2]/=this.#e,o[3]/=this.#t,o[4]/=this.#e,o[5]/=this.#t,this.#i.set(o,this.#r*6),this.#r++}take(){return this.#i.subarray(0,this.#r*6)}},j8=class{#e=new Set;#t=null;constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){let t=this.#n();t.insertRule(e,t.cssRules.length)}#n(){if(this.#t)return this.#t;let e=this._document.defaultView?.CSSStyleSheet||globalThis.CSSStyleSheet;if(!this.styleElement&&e){let{adoptedStyleSheets:t}=this._document;if(t){let n=new e;return t.push(n),this.#t=n}}return this.styleElement||(this.styleElement=this._document.createElement(`style`),this._document.documentElement.getElementsByTagName(`head`)[0].append(this.styleElement)),this.#t=this.styleElement.sheet}clear(){for(let e of this.nativeFontFaces)this._document.fonts.delete(e);if(this.nativeFontFaces.clear(),this.#e.clear(),this.#t){let{adoptedStyleSheets:e}=this._document;e?.includes(this.#t)&&(this._document.adoptedStyleSheets=e.filter(e=>e!==this.#t)),this.#t=null}this.styleElement&&=(this.styleElement.remove(),null)}async loadSystemFont({systemFontInfo:e,disableFontFace:t,_inspectFont:n}){if(!(!e||this.#e.has(e.loadedName))){if(U3(!t,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:t,src:r,style:i}=e,a=new FontFace(t,r,i);this.addNativeFontFace(a);try{await a.load(),this.#e.add(t),n?.(e)}catch{V3(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}return}H3(`Not implemented: loadSystemFont without the Font Loading API.`)}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){let t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(n){throw V3(`Failed to load font '${t.family}': '${n}'.`),e.disableFontFace=!0,n}}return}let t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(t=>{let n=this._queueLoadingCallback(t);this._prepareFontLoadEvent(e,n)})}}get isFontLoadingAPISupported(){let e=!!this._document?.fonts;return J3(this,`isFontLoadingAPISupported`,e)}get isSyncFontLoadingSupported(){return J3(this,`isSyncFontLoadingSupported`,g3||i6.platform.isFirefox)}_queueLoadingCallback(e){function t(){for(U3(!r.done,`completeRequest() cannot be called twice.`),r.done=!0;n.length>0&&n[0].done;){let e=n.shift();setTimeout(e.callback,0)}}let{loadingRequests:n}=this,r={done:!1,complete:t,callback:e};return n.push(r),r}get _loadTestFont(){let e=atob(`T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==`);return J3(this,`_loadTestFont`,e)}_prepareFontLoadEvent(e,t){function n(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3)&255}function r(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255)}function i(e,t,n,r){let i=e.substring(0,t),a=e.substring(t+n);return i+r+a}let a,o,s=this._document.createElement(`canvas`);s.width=1,s.height=1;let c=s.getContext(`2d`),l=0;function u(e,t){if(++l>30){V3(`Load test font never loaded.`),t();return}if(c.font=`30px `+e,c.fillText(`.`,0,20),c.getImageData(0,0,1,1).data[3]>0){t();return}setTimeout(u.bind(null,e,t))}let d=`lt${Date.now()}${this.loadTestFontId++}`,f=this._loadTestFont;f=i(f,976,d.length,d);let p=1482184792,m=n(f,16);for(a=0,o=d.length-3;a<o;a+=4)m=m-p+n(d,a)|0;a<d.length&&(m=m-p+n(d+`XXX`,a)|0),f=i(f,16,4,r(m));let h=`@font-face {font-family:"${d}";src:${`url(data:font/opentype;base64,${btoa(f)});`}}`;this.insertRule(h);let g=this._document.createElement(`div`);g.style.visibility=`hidden`,g.style.width=g.style.height=`10px`,g.style.position=`absolute`,g.style.top=g.style.left=`0px`;for(let t of[e.loadedName,d]){let e=this._document.createElement(`span`);e.textContent=`Hi`,e.style.fontFamily=t,g.append(e)}this._document.body.append(g),u(d,()=>{g.remove(),t.complete()})}},M8=class{compiledGlyphs=Object.create(null);#e;constructor(e,t=null,n,r){this.#e=e,this._inspectFont=t,n&&(this.charProcOperatorList=n),r&&Object.assign(this,r)}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{let t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;let e=`url(data:${this.mimetype};base64,${this.data.toBase64()});`,t;if(!this.cssFontInfo)t=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let n=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(n+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),t=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${n}src:${e}}`}return this._inspectFont?.(this,e),t}getPathGenerator(e,t){if(this.compiledGlyphs[t]!==void 0)return this.compiledGlyphs[t];let n=this.loadedName+`_path_`+t,r;try{r=e.get(n)}catch(e){V3(`getPathGenerator - ignoring character: "${e}".`)}let i=J6(r?.path);return this.fontExtraProperties||e.delete(n),this.compiledGlyphs[t]=i}get black(){return this.#e.black}get bold(){return this.#e.bold}get disableFontFace(){return this.#e.disableFontFace}set disableFontFace(e){J3(this,`disableFontFace`,!!e)}get fontExtraProperties(){return this.#e.fontExtraProperties}get isInvalidPDFjsFont(){return this.#e.isInvalidPDFjsFont}get isType3Font(){return this.#e.isType3Font}get italic(){return this.#e.italic}get missingFile(){return this.#e.missingFile}get remeasure(){return this.#e.remeasure}get vertical(){return this.#e.vertical}get ascent(){return this.#e.ascent}get defaultWidth(){return this.#e.defaultWidth}get descent(){return this.#e.descent}get bbox(){return this.#e.bbox}get fontMatrix(){return this.#e.fontMatrix}get fallbackName(){return this.#e.fallbackName}get loadedName(){return this.#e.loadedName}get mimetype(){return this.#e.mimetype}get name(){return this.#e.name}get data(){return this.#e.data}clearData(){this.#e.clearData()}get cssFontInfo(){return this.#e.cssFontInfo}get systemFontInfo(){return this.#e.systemFontInfo}get defaultVMetrics(){return this.#e.defaultVMetrics}},N8=class{static strings=[`fontFamily`,`fontWeight`,`italicAngle`]},P8=class{static strings=[`css`,`loadedName`,`baseFontName`,`src`]},F8=class{static bools=[`black`,`bold`,`disableFontFace`,`fontExtraProperties`,`isInvalidPDFjsFont`,`isType3Font`,`italic`,`missingFile`,`remeasure`,`vertical`];static numbers=[`ascent`,`defaultWidth`,`descent`];static strings=[`fallbackName`,`loadedName`,`mimetype`,`name`];static OFFSET_NUMBERS=Math.ceil(this.bools.length*2/8);static OFFSET_BBOX=this.OFFSET_NUMBERS+this.numbers.length*8;static OFFSET_FONT_MATRIX=this.OFFSET_BBOX+1+8;static OFFSET_DEFAULT_VMETRICS=this.OFFSET_FONT_MATRIX+1+48;static OFFSET_STRINGS=this.OFFSET_DEFAULT_VMETRICS+1+6},I8=class{static KIND=0;static HAS_BBOX=1;static HAS_BACKGROUND=2;static SHADING_TYPE=3;static N_COORD=4;static N_COLOR=8;static N_STOP=12;static N_FIGURES=16},L8=class{#e;#t=new TextDecoder;#n;constructor(e){this.#e=e,this.#n=new DataView(e)}#r(e){U3(e<N8.strings.length,`Invalid string index`);let t=0;for(let n=0;n<e;n++)t+=this.#n.getUint32(t)+4;let n=this.#n.getUint32(t);return this.#t.decode(new Uint8Array(this.#e,t+4,n))}get fontFamily(){return this.#r(0)}get fontWeight(){return this.#r(1)}get italicAngle(){return this.#r(2)}},R8=class{#e;#t=new TextDecoder;#n;constructor(e){this.#e=e,this.#n=new DataView(e)}get guessFallback(){return this.#n.getUint8(0)!==0}#r(e){U3(e<P8.strings.length,`Invalid string index`);let t=5;for(let n=0;n<e;n++)t+=this.#n.getUint32(t)+4;let n=this.#n.getUint32(t);return this.#t.decode(new Uint8Array(this.#e,t+4,n))}get css(){return this.#r(0)}get loadedName(){return this.#r(1)}get baseFontName(){return this.#r(2)}get src(){return this.#r(3)}get style(){let e=1;e+=4+this.#n.getUint32(e);let t=this.#n.getUint32(e),n=this.#t.decode(new Uint8Array(this.#e,e+4,t));e+=4+t;let r=this.#n.getUint32(e);return{style:n,weight:this.#t.decode(new Uint8Array(this.#e,e+4,r))}}},z8=class{#e;#t=new TextDecoder;#n;constructor({buffer:e,extra:t}){this.#e=e,this.#n=new DataView(e),t&&Object.assign(this,t)}#r(e){U3(e<F8.bools.length,`Invalid boolean index`);let t=Math.floor(e/4),n=e*2%8,r=this.#n.getUint8(t)>>n&3;return r===0?void 0:r===2}get black(){return this.#r(0)}get bold(){return this.#r(1)}get disableFontFace(){return this.#r(2)}get fontExtraProperties(){return this.#r(3)}get isInvalidPDFjsFont(){return this.#r(4)}get isType3Font(){return this.#r(5)}get italic(){return this.#r(6)}get missingFile(){return this.#r(7)}get remeasure(){return this.#r(8)}get vertical(){return this.#r(9)}#i(e){return U3(e<F8.numbers.length,`Invalid number index`),this.#n.getFloat64(F8.OFFSET_NUMBERS+e*8)}get ascent(){return this.#i(0)}get defaultWidth(){return this.#i(1)}get descent(){return this.#i(2)}#a(e,t,n,r){let i=this.#n.getUint8(e);if(i===0)return;U3(i===t,`Invalid array length.`),e+=1;let a=Array(i);for(let t=0;t<i;t++)a[t]=this.#n[n](e,!0),e+=r;return a}get bbox(){return this.#a(F8.OFFSET_BBOX,4,`getInt16`,2)}get fontMatrix(){return this.#a(F8.OFFSET_FONT_MATRIX,6,`getFloat64`,8)}get defaultVMetrics(){return this.#a(F8.OFFSET_DEFAULT_VMETRICS,3,`getInt16`,2)}#o(e){U3(e<F8.strings.length,`Invalid string index`);let t=F8.OFFSET_STRINGS+4;for(let n=0;n<e;n++)t+=this.#n.getUint32(t)+4;let n=this.#n.getUint32(t);return this.#t.decode(new Uint8Array(this.#e,t+4,n))}get fallbackName(){return this.#o(0)}get loadedName(){return this.#o(1)}get mimetype(){return this.#o(2)}get name(){return this.#o(3)}#s(){let e=F8.OFFSET_STRINGS,t=this.#n.getUint32(e);e+=4+t;let n=this.#n.getUint32(e);e+=4+n;let r=this.#n.getUint32(e);e+=4+r;let i=this.#n.getUint32(e);return{offset:e,length:i}}get data(){let{offset:e,length:t}=this.#s();return t===0?void 0:new Uint8Array(this.#e,e+4,t)}clearData(){let{offset:e,length:t}=this.#s();t!==0&&(this.#n.setUint32(e,0),this.#e=new Uint8Array(this.#e,0,e+4).slice().buffer,this.#n=new DataView(this.#e))}get cssFontInfo(){let e=F8.OFFSET_STRINGS,t=this.#n.getUint32(e);e+=4+t;let n=this.#n.getUint32(e);e+=4+n;let r=this.#n.getUint32(e);if(r===0)return null;let i=new Uint8Array(r);return i.set(new Uint8Array(this.#e,e+4,r)),new L8(i.buffer)}get systemFontInfo(){let e=F8.OFFSET_STRINGS,t=this.#n.getUint32(e);e+=4+t;let n=this.#n.getUint32(e);if(n===0)return null;let r=new Uint8Array(n);return r.set(new Uint8Array(this.#e,e+4,n)),new R8(r.buffer)}},B8=class{constructor(e){this.buffer=e,this.view=new DataView(e),this.data=new Uint8Array(e)}getIR(){let e=this.view,t=this.data[I8.KIND],n=!!this.data[I8.HAS_BBOX],r=!!this.data[I8.HAS_BACKGROUND],i=e.getUint32(I8.N_COORD,!0),a=e.getUint32(I8.N_COLOR,!0),o=e.getUint32(I8.N_STOP,!0),s=20,c=new Float32Array(this.buffer,s,i*2);s+=i*8;let l=new Uint8Array(this.buffer,s,a*4);s+=a*4;let u=[];for(let t=0;t<o;++t){let t=e.getFloat32(s,!0);s+=4;let n=e.getUint32(s,!0);s+=4,u.push([t,`#${n.toString(16).padStart(6,`0`)}`])}let d=null;if(n){d=[];for(let t=0;t<4;++t)d.push(e.getFloat32(s,!0)),s+=4}let f=null;if(r&&(f=new Uint8Array(this.buffer,s,3),s+=3),t===1)return[`RadialAxial`,`axial`,d,u,Array.from(c.slice(0,2)),Array.from(c.slice(2,4)),null,null];if(t===2)return[`RadialAxial`,`radial`,d,u,[c[0],c[1]],[c[3],c[4]],c[2],c[5]];if(t===3){let e=this.data[I8.SHADING_TYPE],t=null;if(c.length>0){t=_3.slice();for(let e=0,n=c.length;e<n;e+=2)$.pointBoundingBox(c[e],c[e+1],t)}return[`Mesh`,e,c,l,i,t,d,f]}throw Error(`Unsupported pattern kind: ${t}`)}},V8=class{#e;constructor(e){this.#e=e}get path(){return i6.isFloat16ArraySupported?new Float16Array(this.#e):new Float32Array(this.#e)}};function H8(e){if(e instanceof URL)return e;if(typeof e==`string`){if(g3){if(/^[a-z][a-z0-9\-+.]+:/i.test(e))return new URL(e);let n=t.getBuiltinModule(`url`);return new URL(n.pathToFileURL(e))}let n=URL.parse(e,window.location);if(n)return n}throw Error(`Invalid PDF url data: either string or URL-object is expected in the url property.`)}function U8(e){if(g3&&h3!==void 0&&e instanceof h3)throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if(typeof e==`string`)return r6(e);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof e==`object`&&!isNaN(e?.length))return new Uint8Array(e);throw Error(`Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.`)}function W8(e){if(typeof e!=`string`)return null;if(e.endsWith(`/`))return e;throw Error(`Invalid factory url: "${e}" must include trailing slash.`)}var G8=e=>typeof e==`object`&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0,K8=u6.bind(null,G8,e=>typeof e==`object`&&typeof e?.name==`string`),q8=class{#e=new Map;#t=Promise.resolve();postMessage(e,t){let n={data:structuredClone(e,t?{transfer:t}:null)};this.#t.then(()=>{for(let[e]of this.#e)e.call(this,n)})}addEventListener(e,t,n=null){let r=null;if(n?.signal instanceof AbortSignal){let{signal:i}=n;if(i.aborted){V3("LoopbackPort - cannot use an `aborted` signal.");return}let a=()=>this.removeEventListener(e,t);r=()=>i.removeEventListener(`abort`,a),i.addEventListener(`abort`,a)}this.#e.set(t,r)}removeEventListener(e,t){this.#e.get(t)?.(),this.#e.delete(t)}terminate(){for(let[,e]of this.#e)e?.();this.#e.clear()}},J8={DATA:1,ERROR:2},Y8={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function X8(){}function Z8(e){if(e instanceof t6||e instanceof Q3||e instanceof X3||e instanceof $3||e instanceof Z3)return e;switch(e instanceof Error||typeof e==`object`&&e||H3(`wrapReason: Expected "reason" to be a (possibly cloned) Error.`),e.name){case`AbortException`:return new t6(e.message);case`InvalidPDFException`:return new Q3(e.message);case`PasswordException`:return new X3(e.message,e.code);case`ResponseException`:return new $3(e.message,e.status,e.missing);case`UnknownErrorException`:return new Z3(e.message,e.details)}return new Z3(e.message,e.toString())}var Q8=class{#e=new AbortController;constructor(e,t,n){this.sourceName=e,this.targetName=t,this.comObj=n,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),n.addEventListener(`message`,this.#t.bind(this),{signal:this.#e.signal})}#t({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){this.#r(e);return}if(e.callback){let t=e.callbackId,n=this.callbackCapabilities[t];if(!n)throw Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],e.callback===J8.DATA)n.resolve(e.data);else if(e.callback===J8.ERROR)n.reject(Z8(e.reason));else throw Error(`Unexpected callback case`);return}let t=this.actionHandler[e.action];if(!t)throw Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){let n=this.sourceName,r=e.sourceName,i=this.comObj;Promise.try(t,e.data).then(function(t){i.postMessage({sourceName:n,targetName:r,callback:J8.DATA,callbackId:e.callbackId,data:t})},function(t){i.postMessage({sourceName:n,targetName:r,callback:J8.ERROR,callbackId:e.callbackId,reason:Z8(t)})});return}if(e.streamId){this.#n(e);return}t(e.data)}on(e,t){let n=this.actionHandler;if(n[e])throw Error(`There is already an actionName called "${e}"`);n[e]=t}send(e,t,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},n)}sendWithPromise(e,t,n){let r=this.callbackId++,i=Promise.withResolvers();this.callbackCapabilities[r]=i;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:r,data:t},n)}catch(e){i.reject(e)}return i.promise}sendWithStream(e,t,n,r){let i=this.streamId++,a=this.sourceName,o=this.targetName,s=this.comObj;return new ReadableStream({start:n=>{let c=Promise.withResolvers();return this.streamControllers[i]={controller:n,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},s.postMessage({sourceName:a,targetName:o,action:e,streamId:i,data:t,desiredSize:n.desiredSize},r),c.promise},pull:e=>{let t=Promise.withResolvers();return this.streamControllers[i].pullCall=t,s.postMessage({sourceName:a,targetName:o,stream:Y8.PULL,streamId:i,desiredSize:e.desiredSize}),t.promise},cancel:e=>{U3(e instanceof Error,`cancel must have a valid reason`);let t=Promise.withResolvers();return this.streamControllers[i].cancelCall=t,this.streamControllers[i].isClosed=!0,s.postMessage({sourceName:a,targetName:o,stream:Y8.CANCEL,streamId:i,reason:Z8(e)}),t.promise}},n)}#n(e){let t=e.streamId,n=this.sourceName,r=e.sourceName,i=this.comObj,a=this,o=this.actionHandler[e.action],s={enqueue(e,a=1,o){if(this.isCancelled)return;let s=this.desiredSize;this.desiredSize-=a,s>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),i.postMessage({sourceName:n,targetName:r,stream:Y8.ENQUEUE,streamId:t,chunk:e},o)},close(){this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:r,stream:Y8.CLOSE,streamId:t}),delete a.streamSinks[t])},error(e){U3(e instanceof Error,`error must have a valid reason`),!this.isCancelled&&(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:r,stream:Y8.ERROR,streamId:t,reason:Z8(e)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};s.sinkCapability.resolve(),s.ready=s.sinkCapability.promise,this.streamSinks[t]=s,Promise.try(o,e.data,s).then(function(){i.postMessage({sourceName:n,targetName:r,stream:Y8.START_COMPLETE,streamId:t,success:!0})},function(e){i.postMessage({sourceName:n,targetName:r,stream:Y8.START_COMPLETE,streamId:t,reason:Z8(e)})})}#r(e){let t=e.streamId,n=this.sourceName,r=e.sourceName,i=this.comObj,a=this.streamControllers[t],o=this.streamSinks[t];switch(e.stream){case Y8.START_COMPLETE:e.success?a.startCall.resolve():a.startCall.reject(Z8(e.reason));break;case Y8.PULL_COMPLETE:e.success?a.pullCall.resolve():a.pullCall.reject(Z8(e.reason));break;case Y8.PULL:if(!o){i.postMessage({sourceName:n,targetName:r,stream:Y8.PULL_COMPLETE,streamId:t,success:!0});break}o.desiredSize<=0&&e.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=e.desiredSize,Promise.try(o.onPull||X8).then(function(){i.postMessage({sourceName:n,targetName:r,stream:Y8.PULL_COMPLETE,streamId:t,success:!0})},function(e){i.postMessage({sourceName:n,targetName:r,stream:Y8.PULL_COMPLETE,streamId:t,reason:Z8(e)})});break;case Y8.ENQUEUE:if(U3(a,`enqueue should have stream controller`),a.isClosed)break;a.controller.enqueue(e.chunk);break;case Y8.CLOSE:if(U3(a,`close should have stream controller`),a.isClosed)break;a.isClosed=!0,a.controller.close(),this.#i(a,t);break;case Y8.ERROR:U3(a,`error should have stream controller`),a.controller.error(Z8(e.reason)),this.#i(a,t);break;case Y8.CANCEL_COMPLETE:e.success?a.cancelCall.resolve():a.cancelCall.reject(Z8(e.reason)),this.#i(a,t);break;case Y8.CANCEL:if(!o)break;let s=Z8(e.reason);Promise.try(o.onCancel||X8,s).then(function(){i.postMessage({sourceName:n,targetName:r,stream:Y8.CANCEL_COMPLETE,streamId:t,success:!0})},function(e){i.postMessage({sourceName:n,targetName:r,stream:Y8.CANCEL_COMPLETE,streamId:t,reason:Z8(e)})}),o.sinkCapability.reject(s),o.isCancelled=!0,delete this.streamSinks[t];break;default:throw Error(`Unexpected stream case`)}}async#i(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),delete this.streamControllers[t]}destroy(){this.#e?.abort(),this.#e=null}},$8=class{#e=Object.freeze({cMapUrl:`CMap`,standardFontDataUrl:`font`,wasmUrl:`wasm`});constructor({cMapUrl:e=null,standardFontDataUrl:t=null,wasmUrl:n=null}){this.cMapUrl=e,this.standardFontDataUrl=t,this.wasmUrl=n}async fetch({kind:e,filename:t}){switch(e){case`cMapUrl`:case`standardFontDataUrl`:case`wasmUrl`:break;default:H3(`Not implemented: ${e}`)}let n=this[e];if(!n)throw Error(`Ensure that the \`${e}\` API parameter is provided.`);let r=`${n}${t}`;return this._fetch(r,e).catch(t=>{throw Error(`Unable to load ${this.#e[e]} data at: ${r}`)})}async _fetch(e,t){H3("Abstract method `_fetch` called.")}},e5=class extends $8{async _fetch(e,t){let n=await y6(e,t===`cMapUrl`&&!e.endsWith(`.bcmap`)?`text`:`bytes`);return n instanceof Uint8Array?n:r6(n)}},t5=class{#e=!1;constructor({enableHWA:e=!1}){this.#e=e}create(e,t){if(e<=0||t<=0)throw Error(`Invalid canvas size`);let n=this._createCanvas(e,t);return{canvas:n,context:n.getContext(`2d`,{willReadFrequently:!this.#e})}}reset({canvas:e},t,n){if(!e)throw Error(`Canvas is not specified`);if(t<=0||n<=0)throw Error(`Invalid canvas size`);e.width=t,e.height=n}destroy(e){let{canvas:t}=e;if(!t)throw Error(`Canvas is not specified`);t.width=t.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){H3("Abstract method `_createCanvas` called.")}},n5=class extends t5{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){let n=this._document.createElement(`canvas`);return n.width=e,n.height=t,n}},r5=class{addFilter(e){return`none`}addHCMFilter(e,t){return`none`}addAlphaFilter(e){return`none`}addLuminosityFilter(e){return`none`}addKnockoutFilter(e=0){return`none`}addHighlightHCMFilter(e,t,n,r,i){return`none`}addSelectionHCMFilter(e,t){return`none`}addSelectionFilter(){return`none`}createSelectionStyle(e=null){return null}destroy(e=!1){}},i5=class extends r5{#e;#t;#n;#r;#i;#a;#o=0;constructor({docId:e,ownerDocument:t=globalThis.document}){super(),this.#r=e,this.#i=t}get#s(){return this.#t||=new Map}get#c(){return this.#a||=new Map}get#l(){if(!this.#n){let e=this.#i.createElement(`div`),{style:t}=e;t.colorScheme=`only light`,t.visibility=`hidden`,t.contain=`strict`,t.width=t.height=0,t.position=`absolute`,t.top=t.left=0,t.zIndex=-1;let n=this.#i.createElementNS(x3,`svg`);n.setAttribute(`width`,0),n.setAttribute(`height`,0),this.#n=this.#i.createElementNS(x3,`defs`),e.append(n),n.append(this.#n),this.#i.body.append(e)}return this.#n}#u(e){if(e.length===1){let t=e[0],n=Array(256);for(let e=0;e<256;e++)n[e]=t[e]/255;let r=n.join(`,`);return[r,r,r]}let[t,n,r]=e,i=Array(256),a=Array(256),o=Array(256);for(let e=0;e<256;e++)i[e]=t[e]/255,a[e]=n[e]/255,o[e]=r[e]/255;return[i.join(`,`),a.join(`,`),o.join(`,`)]}#d(e){if(this.#e===void 0){this.#e=``;let e=this.#i.URL;e!==this.#i.baseURI&&(x6(e)?V3(`#createUrl: ignore "data:"-URL for performance reasons.`):this.#e=K3(e,``))}return`url(${this.#e}#${e})`}addFilter(e){if(!e)return`none`;let t=this.#s.get(e);if(t)return t;let[n,r,i]=this.#u(e),a=e.length===1?n:`${n}${r}${i}`;if(t=this.#s.get(a),t)return this.#s.set(e,t),t;let o=`g_${this.#r}_transfer_map_${this.#o++}`,s=this.#d(o);this.#s.set(e,s),this.#s.set(a,s);let c=this.#m(o);return this.#g(n,r,i,c),s}addHCMFilter(e,t){let n=`${e}-${t}`,r=`base`,i=this.#c.get(r);if(i?.key===n||(i?(i.filter?.remove(),i.key=n,i.url=`none`,i.filter=null):(i={key:n,url:`none`,filter:null},this.#c.set(r,i)),!e||!t))return i.url;let a=this.#v(e);e=$.makeHexColor(...a);let o=this.#v(t);if(t=$.makeHexColor(...o),this.#l.style.color=``,e===`#000000`&&t===`#ffffff`||e===t)return i.url;let s=Array(256);for(let e=0;e<=255;e++){let t=e/255;s[e]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}let c=s.join(`,`),l=`g_${this.#r}_hcm_filter`,u=i.filter=this.#m(l);this.#g(c,c,c,u),this.#p(u);let d=(e,t)=>{let n=a[e]/255,r=o[e]/255,i=Array(t+1);for(let e=0;e<=t;e++)i[e]=n+e/t*(r-n);return i.join(`,`)};return this.#g(d(0,5),d(1,5),d(2,5),u),i.url=this.#d(l),i.url}addSelectionHCMFilter(e,t){return this.addHighlightHCMFilter(`selection`,e,t,`HighlightText`,`Highlight`)}addSelectionFilter(){return this.addHighlightHCMFilter(`selection_default`,`black`,`white`,`HighlightText`,`Highlight`)}createSelectionStyle(e=null){let t=e?this.addSelectionHCMFilter(e.foreground,e.background):this.addSelectionFilter();return t===`none`||!i6.platform.isFirefox?null:{"backdrop-filter":t,"background-color":`transparent`}}addAlphaFilter(e){let t=this.#s.get(e);if(t)return t;let[n]=this.#u([e]),r=`alpha_${n}`;if(t=this.#s.get(r),t)return this.#s.set(e,t),t;let i=`g_${this.#r}_alpha_map_${this.#o++}`,a=this.#d(i);this.#s.set(e,a),this.#s.set(r,a);let o=this.#m(i);return this.#_(n,o),a}addLuminosityFilter(e){let t=this.#s.get(e||`luminosity`);if(t)return t;let n,r;if(e?([n]=this.#u([e]),r=`luminosity_${n}`):r=`luminosity`,t=this.#s.get(r),t)return this.#s.set(e,t),t;let i=`g_${this.#r}_luminosity_map_${this.#o++}`,a=this.#d(i);this.#s.set(e,a),this.#s.set(r,a);let o=this.#m(i);return this.#f(o),e&&this.#_(n,o),a}addKnockoutFilter(e=0){let t=e>0?Math.min(1/e,1e6):1e6,n=`knockout_${t}`,r=this.#s.get(n);if(r)return r;let i=`g_${this.#r}_knockout_filter_${this.#o++}`,a=this.#d(i);this.#s.set(n,a);let o=this.#m(i),s=this.#i.createElementNS(x3,`feComponentTransfer`);o.append(s);let c=this.#i.createElementNS(x3,`feFuncA`);return c.setAttribute(`type`,`linear`),c.setAttribute(`slope`,`${t}`),c.setAttribute(`intercept`,`0`),s.append(c),a}addHighlightHCMFilter(e,t,n,r,i){let a=`${t}-${n}-${r}-${i}`,o=this.#c.get(e);if(o?.key===a||(o?(o.filter?.remove(),o.key=a,o.url=`none`,o.filter=null):(o={key:a,url:`none`,filter:null},this.#c.set(e,o)),!t||!n))return o.url;let[s,c]=[t,n].map(this.#v.bind(this)),l=Math.round(.2126*s[0]+.7152*s[1]+.0722*s[2]),u=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),[d,f]=[r,i].map(this.#b.bind(this));u<l&&([l,u,d,f]=[u,l,f,d]),this.#l.style.color=``;let p=(e,t,n)=>{let r=Array(256),i=(u-l)/n,a=e/255,o=(t-e)/(255*n),s=0;for(let e=0;e<=n;e++){let t=Math.round(l+e*i),n=a+e*o;for(let e=s;e<=t;e++)r[e]=n;s=t+1}for(let e=s;e<256;e++)r[e]=r[s-1];return r.join(`,`)},m=`g_${this.#r}_hcm_${e}_filter`,h=o.filter=this.#m(m);return this.#p(h),this.#g(p(d[0],f[0],5),p(d[1],f[1],5),p(d[2],f[2],5),h),o.url=this.#d(m),o.url}destroy(e=!1){e&&this.#a?.size||(this.#n?.parentNode.parentNode.remove(),this.#n=null,this.#t?.clear(),this.#t=null,this.#a?.clear(),this.#a=null,this.#o=0)}#f(e){let t=this.#i.createElementNS(x3,`feColorMatrix`);t.setAttribute(`type`,`matrix`),t.setAttribute(`values`,`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0`),e.append(t)}#p(e){let t=this.#i.createElementNS(x3,`feColorMatrix`);t.setAttribute(`type`,`matrix`),t.setAttribute(`values`,`0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0`),e.append(t)}#m(e){let t=this.#i.createElementNS(x3,`filter`);return t.setAttribute(`color-interpolation-filters`,`sRGB`),t.setAttribute(`id`,e),this.#l.append(t),t}#h(e,t,n){let r=this.#i.createElementNS(x3,t);r.setAttribute(`type`,`discrete`),r.setAttribute(`tableValues`,n),e.append(r)}#g(e,t,n,r){let i=this.#i.createElementNS(x3,`feComponentTransfer`);r.append(i),this.#h(i,`feFuncR`,e),this.#h(i,`feFuncG`,t),this.#h(i,`feFuncB`,n)}#_(e,t){let n=this.#i.createElementNS(x3,`feComponentTransfer`);t.append(n),this.#h(n,`feFuncA`,e)}#v(e){return this.#l.style.color=e,j6(getComputedStyle(this.#l).getPropertyValue(`color`))}#y(e){return this.#l.style.color=e,A6(getComputedStyle(this.#l).getPropertyValue(`color`))}#b(e){let[t,n,r,i]=this.#y(e);if(i===1)return[t,n,r];let[a,o,s]=this.#v(`Canvas`);return[a5(t,a,i),a5(n,o,i),a5(r,s,i)]}};function a5(e,t,n){return Math.round(n*e+(1-n)*t)}g3&&V3("Please use the `legacy` build in Node.js environments.");async function o5(e){let n=await t.getBuiltinModule(`fs/promises`).readFile(e);return new Uint8Array(n)}var s5=class extends r5{},c5=class extends t5{_createCanvas(e,n){return t.getBuiltinModule(`module`).createRequire(import.meta.url)(`@napi-rs/canvas`).createCanvas(e,n)}},l5=class extends $8{async _fetch(e,t){return o5(e)}};function u5({src:e,srcPos:t=0,dest:n,width:r,height:i,nonBlackColor:a=4294967295,inverseDecode:o=!1}){let s=i6.isLittleEndian?4278190080:255,[c,l]=o?[a,s]:[s,a],u=r>>3,d=r&7,f=c^l,p=e.length;n=new Uint32Array(n.buffer);let m=0;for(let r=0;r<i;++r){for(let r=t+u;t<r;++t,m+=8){let r=e[t];n[m]=c^-(r>>7&1)&f,n[m+1]=c^-(r>>6&1)&f,n[m+2]=c^-(r>>5&1)&f,n[m+3]=c^-(r>>4&1)&f,n[m+4]=c^-(r>>3&1)&f,n[m+5]=c^-(r>>2&1)&f,n[m+6]=c^-(r>>1&1)&f,n[m+7]=c^-(r&1)&f}if(d===0)continue;let r=t<p?e[t++]:255;for(let e=0;e<d;++e,++m)n[m]=c^-(r>>7-e&1)&f}return{srcPos:t,destPos:m}}function d5({src:e,srcPos:t=0,dest:n,destPos:r=0,width:i,height:a}){let o=0,s=i*a*3,c=s>>2,l=new Uint32Array(e.buffer,t,c),u=i6.isLittleEndian?4278190080:255;if(i6.isLittleEndian){for(;o<c-2;o+=3,r+=4){let e=l[o],t=l[o+1],i=l[o+2];n[r]=e|u,n[r+1]=e>>>24|t<<8|u,n[r+2]=t>>>16|i<<16|u,n[r+3]=i>>>8|u}for(let i=o*4,a=t+s;i<a;i+=3)n[r++]=e[i]|e[i+1]<<8|e[i+2]<<16|u}else{for(;o<c-2;o+=3,r+=4){let e=l[o],t=l[o+1],i=l[o+2];n[r]=e|u,n[r+1]=e<<24|t>>>8|u,n[r+2]=t<<16|i>>>16|u,n[r+3]=i<<8|u}for(let i=o*4,a=t+s;i<a;i+=3)n[r++]=e[i]<<24|e[i+1]<<16|e[i+2]<<8|u}return{srcPos:t+s,destPos:r}}var f5=`
struct Uniforms {
offsetX : f32,
offsetY : f32,
scaleX : f32,
scaleY : f32,
paddedWidth : f32,
paddedHeight : f32,
borderSize : f32,
_pad : f32,
};
@group(0) @binding(0) var<uniform> u : Uniforms;
struct VertexInput {
@location(0) position : vec2<f32>,
@location(1) color : vec4<f32>,
};
struct VertexOutput {
@builtin(position) position : vec4<f32>,
@location(0) color : vec3<f32>,
};
@vertex
fn vs_main(in : VertexInput) -> VertexOutput {
var out : VertexOutput;
let cx = (in.position.x + u.offsetX) * u.scaleX;
let cy = (in.position.y + u.offsetY) * u.scaleY;
out.position = vec4<f32>(
((cx + u.borderSize) / u.paddedWidth) * 2.0 - 1.0,
1.0 - ((cy + u.borderSize) / u.paddedHeight) * 2.0,
0.0,
1.0
);
out.color = in.color.rgb;
return out;
}
@fragment
fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
return vec4<f32>(in.color, 1.0);
}
`,p5=new class{#e=null;#t=null;#n=null;#r=null;async#i(){if(!globalThis.navigator?.gpu)return!1;try{let e=await navigator.gpu.requestAdapter();return e?(this.#r=navigator.gpu.getPreferredCanvasFormat(),this.#t=await e.requestDevice(),!0):!1}catch{return!1}}init(){return this.#e||=this.#i()}get isReady(){return this.#t!==null}loadMeshShader(){if(!this.#t||this.#n)return;let e=this.#t.createShaderModule({code:f5});this.#n=this.#t.createRenderPipeline({layout:`auto`,vertex:{module:e,entryPoint:`vs_main`,buffers:[{arrayStride:8,attributes:[{shaderLocation:0,offset:0,format:`float32x2`}]},{arrayStride:4,attributes:[{shaderLocation:1,offset:0,format:`unorm8x4`}]}]},fragment:{module:e,entryPoint:`fs_main`,targets:[{format:this.#r}]},primitive:{topology:`triangle-list`}})}draw(e,t,n,r,i,a,o,s){this.loadMeshShader();let c=this.#t,{offsetX:l,offsetY:u,scaleX:d,scaleY:f}=r,p=c.createBuffer({size:Math.max(e.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});e.byteLength>0&&c.queue.writeBuffer(p,0,e);let m=c.createBuffer({size:Math.max(t.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});t.byteLength>0&&c.queue.writeBuffer(m,0,t);let h=c.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});c.queue.writeBuffer(h,0,new Float32Array([l,u,d,f,a,o,s,0]));let g=c.createBindGroup({layout:this.#n.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:h}}]}),_=new OffscreenCanvas(a,o),v=_.getContext(`webgpu`);v.configure({device:c,format:this.#r,alphaMode:i?`opaque`:`premultiplied`});let y=i?{r:i[0]/255,g:i[1]/255,b:i[2]/255,a:1}:{r:0,g:0,b:0,a:0},b=c.createCommandEncoder(),x=b.beginRenderPass({colorAttachments:[{view:v.getCurrentTexture().createView(),clearValue:y,loadOp:`clear`,storeOp:`store`}]});return n>0&&(x.setPipeline(this.#n),x.setBindGroup(0,g),x.setVertexBuffer(0,p),x.setVertexBuffer(1,m),x.draw(n)),x.end(),c.queue.submit([b.finish()]),p.destroy(),m.destroy(),h.destroy(),_.transferToImageBitmap()}};function m5(){return p5.init()}function h5(){return p5.isReady}function g5(){p5.loadMeshShader()}function _5(e,t,n,r,i,a,o,s){return p5.draw(e,t,n,r,i,a,o,s)}var v5={FILL:`Fill`,STROKE:`Stroke`,SHADING:`Shading`};function y5(e,t){if(!t)return;let n=t[2]-t[0],r=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],n,r),e.clip(i)}var b5=class{isModifyingCurrentTransform(){return!1}getPattern(){H3("Abstract method `getPattern` called.")}},x5=class extends b5{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}isOriginBased(){return this._p0[0]===0&&this._p0[1]===0&&(!this.isRadial()||this._p1[0]===0&&this._p1[1]===0)}isRadial(){return this._type===`radial`}areConic(){if(!this.isRadial())return!1;let e=Math.hypot(this._p0[0]-this._p1[0],this._p0[1]-this._p1[1]);return e+this._r1>this._r0&&e+this._r0>this._r1}_createGradient(e,t=null){let n,r=this._p0,i=this._p1;if(t&&(r=r.slice(),i=i.slice(),$.applyTransform(r,t),$.applyTransform(i,t)),this._type===`axial`)n=e.createLinearGradient(r[0],r[1],i[0],i[1]);else if(this._type===`radial`){let a=this._r0,o=this._r1;if(t){let e=new Float32Array(2);$.singularValueDecompose2dScale(t,e),a*=e[0],o*=e[0]}n=e.createRadialGradient(r[0],r[1],a,i[0],i[1],o)}for(let e of this._colorStops)n.addColorStop(e[0],e[1]);return n}_createReversedGradient(e,t=null){let n=this._p1,r=this._p0;t&&(n=n.slice(),r=r.slice(),$.applyTransform(n,t),$.applyTransform(r,t));let i=this._r1,a=this._r0;if(t){let e=new Float32Array(2);$.singularValueDecompose2dScale(t,e),i*=e[0],a*=e[0]}let o=e.createRadialGradient(n[0],n[1],i,r[0],r[1],a),s=this._colorStops.map(([e,t])=>[1-e,t]).reverse();for(let[e,t]of s)o.addColorStop(e,t);return o}getPattern(e,t,n,r){let i;if(r===v5.STROKE||r===v5.FILL){if(this.isOriginBased()){let r=$.transform(n,t.baseTransform);this.matrix&&(r=$.transform(r,this.matrix));let i=.001,a=Math.hypot(r[0],r[1]),o=Math.hypot(r[2],r[3]),s=(r[0]*r[2]+r[1]*r[3])/(a*o);if(Math.abs(s)<i)if(this.isRadial()){if(Math.abs(a-o)<i)return this._createGradient(e,r)}else return this._createGradient(e,r)}let a=t.current.getClippedPathBoundingBox(r,N6(e))||[0,0,0,0],o=Math.ceil(a[2]-a[0])||1,s=Math.ceil(a[3]-a[1])||1,c=t.canvasFactory.create(o,s),l=c.context;l.clearRect(0,0,l.canvas.width,l.canvas.height),l.beginPath(),l.rect(0,0,l.canvas.width,l.canvas.height),l.translate(-a[0],-a[1]),n=$.transform(n,[1,0,0,1,a[0],a[1]]),l.transform(...t.baseTransform),this.matrix&&l.transform(...this.matrix),y5(l,this._bbox),this.areConic()&&(l.fillStyle=this._createReversedGradient(l),l.fill()),l.fillStyle=this._createGradient(l),l.fill(),i=e.createPattern(c.canvas,`no-repeat`),t.canvasFactory.destroy(c);let u=new DOMMatrix(n);i.setTransform(u)}else this.areConic()&&(e.save(),y5(e,this._bbox),e.fillStyle=this._createReversedGradient(e),e.fillRect(-1e10,-1e10,2e10,2e10),e.restore()),y5(e,this._bbox),i=this._createGradient(e);return i}};function S5(e,t,n,r,i,a,o,s){let c=t.coords,l=t.colors,u=e.data,d=e.width*4,f;c[n*2+1]>c[r*2+1]&&(f=n,n=r,r=f,f=a,a=o,o=f),c[r*2+1]>c[i*2+1]&&(f=r,r=i,i=f,f=o,o=s,s=f),c[n*2+1]>c[r*2+1]&&(f=n,n=r,r=f,f=a,a=o,o=f);let p=(c[n*2]+t.offsetX)*t.scaleX,m=(c[n*2+1]+t.offsetY)*t.scaleY,h=(c[r*2]+t.offsetX)*t.scaleX,g=(c[r*2+1]+t.offsetY)*t.scaleY,_=(c[i*2]+t.offsetX)*t.scaleX,v=(c[i*2+1]+t.offsetY)*t.scaleY;if(m>=v)return;let y=l[a*4],b=l[a*4+1],x=l[a*4+2],S=l[o*4],C=l[o*4+1],w=l[o*4+2],T=l[s*4],E=l[s*4+1],D=l[s*4+2],O=Math.round(m),k=Math.round(v),A,j,M,N,P,F,I,L;for(let e=O;e<=k;e++){if(e<g){let t=e<m?0:(m-e)/(m-g);A=p-(p-h)*t,j=y-(y-S)*t,M=b-(b-C)*t,N=x-(x-w)*t}else{let t;t=e>v?1:g===v?0:(g-e)/(g-v),A=h-(h-_)*t,j=S-(S-T)*t,M=C-(C-E)*t,N=w-(w-D)*t}let t;t=e<m?0:e>v?1:(m-e)/(m-v),P=p-(p-_)*t,F=y-(y-T)*t,I=b-(b-E)*t,L=x-(x-D)*t;let n=Math.round(Math.min(A,P)),r=Math.round(Math.max(A,P)),i=d*e+n*4;for(let e=n;e<=r;e++)t=(A-e)/(A-P),t<0?t=0:t>1&&(t=1),u[i++]=j-(j-F)*t|0,u[i++]=M-(M-I)*t|0,u[i++]=N-(N-L)*t|0,u[i++]=255}}var C5=class extends b5{constructor(e){super(),this._posData=e[2],this._colData=e[3],this._vertexCount=e[4],this._bounds=e[5],this._bbox=e[6],this._background=e[7],this.matrix=null,g5()}_createMeshCanvas(e,t,n){let r=1.1,i=3e3,a=Math.floor(this._bounds[0]),o=Math.floor(this._bounds[1]),s=Math.ceil(this._bounds[2])-a,c=Math.ceil(this._bounds[3])-o,l=Math.min(Math.ceil(Math.abs(s*e[0]*r)),i)||1,u=Math.min(Math.ceil(Math.abs(c*e[1]*r)),i)||1,d=s?s/l:1,f=c?c/u:1,p={coords:this._posData,colors:this._colData,offsetX:-a,offsetY:-o,scaleX:1/d,scaleY:1/f},m=l+4,h=u+4,g=n.create(m,h);if(h5()&&this._vertexCount>48)g.context.drawImage(_5(this._posData,this._colData,this._vertexCount,p,t,m,h,2),0,0);else{let e=g.context.createImageData(l,u);if(t){let n=e.data;for(let e=0,r=n.length;e<r;e+=4)n[e]=t[0],n[e+1]=t[1],n[e+2]=t[2],n[e+3]=255}for(let t=0,n=this._vertexCount;t<n;t+=3)S5(e,p,t,t+1,t+2,t,t+1,t+2);g.context.putImageData(e,2,2)}return{canvas:g.canvas,offsetX:a-2*d,offsetY:o-2*f,scaleX:d,scaleY:f}}isModifyingCurrentTransform(){return!0}getPattern(e,t,n,r){y5(e,this._bbox);let i=new Float32Array(2);if(r===v5.SHADING)$.singularValueDecompose2dScale(N6(e),i);else if(this.matrix){$.singularValueDecompose2dScale(this.matrix,i);let[e,n]=i;$.singularValueDecompose2dScale(t.baseTransform,i),i[0]*=e,i[1]*=n}else $.singularValueDecompose2dScale(t.baseTransform,i);let a=this._createMeshCanvas(i,r===v5.SHADING?null:this._background,t.canvasFactory);r!==v5.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(a.offsetX,a.offsetY),e.scale(a.scaleX,a.scaleY);let o=e.createPattern(a.canvas,`no-repeat`);return t.canvasFactory.destroy(a),o}},w5=class extends b5{getPattern(){return`hotpink`}};function T5(e){switch(e[0]){case`RadialAxial`:return new x5(e);case`Mesh`:return new C5(e);case`Dummy`:return new w5}throw Error(`Unknown IR type: ${e[0]}`)}var E5={COLORED:1,UNCOLORED:2},D5=class e{static MAX_PATTERN_SIZE=3e3;constructor(e,t,n,r){this.color=e[1],this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.needsIsolation=e[9]??!0,this.ctx=t,this.canvasGraphicsFactory=n,this.baseTransform=r,this.patternBaseMatrix=this.matrix?$.transform(r,this.matrix):r}canSkipPatternCanvas([e,t,n,r]){let[i,a,o,s]=this.bbox,c=Math.abs(this.xstep),l=Math.abs(this.ystep);if(e>c+1e-6||t>l+1e-6)return null;let u=Math.floor((n-o)/c)+1,d=Math.ceil((n+e-i)/c)-1,f=Math.floor((r-s)/l)+1,p=Math.ceil((r+t-a)/l)-1;return d<=u&&p<=f?[u,f]:null}updatePatternDims(e,t){let n=$.inverseTransform(this.patternBaseMatrix),r=[e[0],e[1]],i=[e[2],e[3]];$.applyTransform(r,n),$.applyTransform(i,n),t[0]=Math.abs(i[0]-r[0]),t[1]=Math.abs(i[1]-r[1]),t[2]=Math.min(r[0],i[0]),t[3]=Math.min(r[1],i[1])}_renderTileCanvas(e,t,n,r){let[i,a,o,s]=this.bbox,c=e.canvasFactory.create(n.size,r.size),l=c.context,u=this.canvasGraphicsFactory.createCanvasGraphics(l,t);return u.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(u,this.paintType,this.color),l.translate(-n.scale*i,-r.scale*a),u.transform(0,n.scale,0,0,r.scale,0,0),l.save(),u.dependencyTracker?.save(),this.clipBbox(u,i,a,o,s),u.baseTransform=N6(u.ctx),u.executeOperatorList(this.operatorList),u.endDrawing(),u.dependencyTracker?.restore(),l.restore(),c}_getCombinedScales(){let e=new Float32Array(2);$.singularValueDecompose2dScale(this.matrix,e);let[t,n]=e;return $.singularValueDecompose2dScale(this.baseTransform,e),[t*e[0],n*e[1]]}drawPattern(e,t,n=!1,[r,i],a){let[o,s,c,l]=this.bbox,u=e.dependencyTracker;if(u&&(e.dependencyTracker=new O8(u,a)),e.save(),n?e.ctx.clip(t,`evenodd`):e.ctx.clip(t),e.ctx.setTransform(...this.patternBaseMatrix),e.ctx.translate(r*this.xstep,i*this.ystep),this.needsIsolation||e.ctx.globalAlpha!==1||e.ctx.globalCompositeOperation!==`source-over`||e.inSMaskMode){let t=c-o,n=l-s,[r,i]=this._getCombinedScales(),u=this.getSizeAndScale(t,this.ctx.canvas.width,r),d=this.getSizeAndScale(n,this.ctx.canvas.height,i),f=this._renderTileCanvas(e,a,u,d);e.ctx.drawImage(f.canvas,o,s,t,n),e.canvasFactory.destroy(f)}else this.setFillAndStrokeStyleToContext(e,this.paintType,this.color),this.clipBbox(e,o,s,c,l),e.baseTransformStack.push(e.baseTransform),e.baseTransform=N6(e.ctx),e.executeOperatorList(this.operatorList),e.baseTransform=e.baseTransformStack.pop();e.restore(),u&&(e.dependencyTracker=u)}createPatternCanvas(e,t){let[n,r,i,a]=this.bbox,o=i-n,s=a-r,{xstep:c,ystep:l}=this;c=Math.abs(c),l=Math.abs(l),B3(`TilingType: `+this.tilingType);let[u,d]=this._getCombinedScales(),f=o,p=s,m=!1,h=!1;Math.ceil(c*u)>=Math.ceil(o*u)?f=c:m=!0,Math.ceil(l*d)>=Math.ceil(s*d)?p=l:h=!0;let g=this.getSizeAndScale(f,this.ctx.canvas.width,u),_=this.getSizeAndScale(p,this.ctx.canvas.height,d),v=this._renderTileCanvas(e,t,g,_);if(m||h){let t=v.canvas;m&&(f=c),h&&(p=l);let i=this.getSizeAndScale(f,this.ctx.canvas.width,u),a=this.getSizeAndScale(p,this.ctx.canvas.height,d),g=i.size,_=a.size,y=e.canvasFactory.create(g,_),b=y.context,x=m?Math.floor(o/c):0,S=h?Math.floor(s/l):0;for(let e=0;e<=x;e++)for(let n=0;n<=S;n++)b.drawImage(t,g*e,_*n,g,_,0,0,g,_);return e.canvasFactory.destroy(v),{canvas:y.canvas,canvasEntry:y,scaleX:i.scale,scaleY:a.scale,offsetX:n,offsetY:r}}return{canvas:v.canvas,canvasEntry:v,scaleX:g.scale,scaleY:_.scale,offsetX:n,offsetY:r}}getSizeAndScale(t,n,r){let i=Math.max(e.MAX_PATTERN_SIZE,n),a=Math.ceil(t*r);return a>=i?a=i:r=a/t,{scale:r,size:a}}clipBbox(e,t,n,r,i){let a=r-t,o=i-n,s=new Path2D;s.rect(t,n,a,o),$.axialAlignedBoundingBox([t,n,r,i],N6(e.ctx),e.current.minMax),e.ctx.clip(s),e.current.updateClipFromPath()}setFillAndStrokeStyleToContext(e,t,n){let r=e.ctx,i=e.current;switch(i.patternFill=i.patternStroke=!1,t){case E5.COLORED:let{fillStyle:e,strokeStyle:a}=this.ctx;r.fillStyle=i.fillColor=e,r.strokeStyle=i.strokeColor=a;break;case E5.UNCOLORED:r.fillStyle=r.strokeStyle=n,i.fillColor=i.strokeColor=n;break;default:throw new e6(`Unsupported paint type: ${t}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,t,n,r,i){let a=r===v5.SHADING?n:$.transform(n,this.patternBaseMatrix),o=this.createPatternCanvas(t,i),s=new DOMMatrix(a);s=s.translate(o.offsetX,o.offsetY),s=s.scale(1/o.scaleX,1/o.scaleY);let c=e.createPattern(o.canvas,`repeat`);return t.canvasFactory.destroy(o.canvasEntry),c.setTransform(s),c}},O5=16,k5=100,A5=15,j5=10,M5=16,N5=new DOMMatrix,P5=new Float32Array(2);function F5(e,t){if(e._removeMirroring)throw Error(`Context is already forwarding operations.`);let n=new Map;for(let r of[`save`,`restore`,`rotate`,`scale`,`translate`,`transform`,`setTransform`,`resetTransform`,`clip`,`moveTo`,`lineTo`,`bezierCurveTo`,`quadraticCurveTo`,`arc`,`arcTo`,`ellipse`,`rect`,`roundRect`,`closePath`,`beginPath`]){let i=e[r];typeof i!=`function`||typeof t[r]!=`function`||(n.set(r,i),e[r]=function(...e){return t[r](...e),i.apply(this,e)})}e._removeMirroring=()=>{for(let[t,r]of n)e[t]=r;delete e._removeMirroring}}function I5(e,t,n,r,i,a,o,s,c,l){let[u,d,f,p,m,h]=N6(e);if(d===0&&f===0){let g=o*u+m,_=Math.round(g),v=s*p+h,y=Math.round(v),b=(o+c)*u+m,x=Math.abs(Math.round(b)-_)||1,S=(s+l)*p+h,C=Math.abs(Math.round(S)-y)||1;return e.setTransform(Math.sign(u),0,0,Math.sign(p),_,y),e.drawImage(t,n,r,i,a,0,0,x,C),e.setTransform(u,d,f,p,m,h),[x,C]}if(u===0&&p===0){let g=s*f+m,_=Math.round(g),v=o*d+h,y=Math.round(v),b=(s+l)*f+m,x=Math.abs(Math.round(b)-_)||1,S=(o+c)*d+h,C=Math.abs(Math.round(S)-y)||1;return e.setTransform(0,Math.sign(d),Math.sign(f),0,_,y),e.drawImage(t,n,r,i,a,0,0,C,x),e.setTransform(u,d,f,p,m,h),[C,x]}e.drawImage(t,n,r,i,a,o,s,c,l);let g=Math.hypot(u,d),_=Math.hypot(f,p);return[g*c,_*l]}var L5=class{alphaIsShape=!1;fontSize=0;fontSizeScale=1;textMatrix=null;textMatrixScale=1;fontMatrix=y3;leading=0;x=0;y=0;lineX=0;lineY=0;charSpacing=0;wordSpacing=0;textHScale=1;textRenderingMode=k3.FILL;textRise=0;fillColor=`#000000`;strokeColor=`#000000`;tilingPatternDims=null;patternFill=!1;patternStroke=!1;fillAlpha=1;strokeAlpha=1;lineWidth=1;activeSMask=null;transferMaps=`none`;minMax=v3.slice();constructor(e,t){this.clipBox=new Float32Array([0,0,e,t])}clone(){let e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e.tilingPatternDims=this.tilingPatternDims?.slice(),e}getPathBoundingBox(e=v5.FILL,t=null){let n=this.minMax.slice();if(e===v5.STROKE){t||H3(`Stroke bounding box must include transform.`),$.singularValueDecompose2dScale(t,P5);let e=P5[0]*this.lineWidth/2,r=P5[1]*this.lineWidth/2;n[0]-=e,n[1]-=r,n[2]+=e,n[3]+=r}return n}updateClipFromPath(){let e=$.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(e){this.clipBox.set(e,0),this.minMax.set(v3,0)}getClippedPathBoundingBox(e=v5.FILL,t=null){return $.intersect(this.clipBox,this.getPathBoundingBox(e,t))}};function R5(e,t){let{width:n,height:r,kind:i}=t,a=r%M5,o=(r-a)/M5,s=a===0?o:o+1,c=e.createImageData(n,M5),l=0,u=t.data,d=c.data,f;if(i===A3.GRAYSCALE_1BPP)for(f=0;f<s;f++)({srcPos:l}=u5({src:u,srcPos:l,dest:d,width:n,height:f<o?M5:a})),e.putImageData(c,0,f*M5);else if(i===A3.RGBA_32BPP){let t=0,r=n*M5*4;for(f=0;f<o;f++)d.set(u.subarray(l,l+r)),l+=r,e.putImageData(c,0,t),t+=M5;f<s&&(r=n*a*4,d.set(u.subarray(l,l+r)),e.putImageData(c,0,t))}else if(i===A3.RGB_24BPP)for(f=0;f<s;f++)({srcPos:l}=d5({src:u,srcPos:l,dest:new Uint32Array(d.buffer),width:n,height:f<o?M5:a})),e.putImageData(c,0,f*M5);else throw Error(`bad image kind: ${i}`)}function z5(e,t){if(t.bitmap){e.drawImage(t.bitmap,0,0);return}let{width:n,height:r}=t,i=r%M5,a=(r-i)/M5,o=i===0?a:a+1,s=e.createImageData(n,M5),c=0,l=t.data,u=s.data;for(let t=0;t<o;t++)({srcPos:c}=u5({src:l,srcPos:c,dest:u,width:n,height:t<a?M5:i,nonBlackColor:0})),e.putImageData(s,0,t*M5)}function B5(e,t){for(let n of[`strokeStyle`,`fillStyle`,`fillRule`,`globalAlpha`,`lineWidth`,`lineCap`,`lineJoin`,`miterLimit`,`globalCompositeOperation`,`font`,`filter`])e[n]!==void 0&&(t[n]=e[n]);e.setLineDash!==void 0&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function V5(e){e.strokeStyle=e.fillStyle=`#000000`,e.fillRule=`nonzero`,e.globalAlpha=1,e.lineWidth=1,e.lineCap=`butt`,e.lineJoin=`miter`,e.miterLimit=10,e.globalCompositeOperation=`source-over`,e.font=`10px sans-serif`,e.setLineDash!==void 0&&(e.setLineDash([]),e.lineDashOffset=0);let{filter:t}=e;t!==`none`&&t!==``&&(e.filter=`none`)}function H5(e,t){if(t)return!0;$.singularValueDecompose2dScale(e,P5);let n=Math.fround(I6.pixelRatio*v6.PDF_TO_CSS_UNITS);return P5[0]<=n&&P5[1]<=n}var U5=[`butt`,`round`,`square`],W5=[`miter`,`round`,`bevel`],G5={},K5={},q5=class e{#e=0;#t=0;#n=null;#r=null;#i=null;#a=null;#o=1;#s;#c=null;#l=[];constructor(e,t,n,r,i,{optionalContentConfig:a,markedContentStack:o=null},s,c,l,u){this.ctx=e,this.current=new L5(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.commonObjs=t,this.objs=n,this.canvasFactory=r,this.filterFactory=i,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.tempSMask=null,this.smaskGroupCanvases=[],this.smaskPreparedEntry=null,this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=a,this.cachedPatterns=new Map,this.annotationCanvasMap=s,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=c,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=l??null,this.imagesTracker=u??null}getObject(e,t,n=null){return typeof t==`string`?(this.dependencyTracker?.recordNamedDependency(e,t),t.startsWith(`g_`)?this.commonObjs.get(t):this.objs.get(t)):n}beginDrawing({transform:e,viewport:t,transparency:n=!1,background:r=null}){let i=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=r||`#ffffff`,this.ctx.fillRect(0,0,i,a),this.ctx.fillStyle=o,n){let e=this.transparentCanvasEntry=this.canvasFactory.create(i,a);this.compositeCtx=this.ctx,{canvas:this.transparentCanvas,context:this.ctx}=e,this.ctx.save(),this.ctx.transform(...N6(this.compositeCtx))}this.ctx.save(),V5(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[3]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=N6(this.ctx)}executeOperatorList(e,t,n,r,i){let a=e.argsArray,o=e.fnArray,s=t||0,c=a.length;if(c===s)return s;let l=c-s>j5&&typeof n==`function`,u=l?Date.now()+A5:0,d=0,f=this.commonObjs,p=this.objs,m,h;for(;;){if(r!==void 0){if(s===r.nextBreakPoint)return r.breakIt(s,n),s;if(r.shouldSkip(s)){if(++s===c)return s;continue}}if(!i||i(s))if(m=o[s],h=a[s]??null,m!==P3.dependency)h===null?this[m](s):this[m](s,...h);else for(let e of h){this.dependencyTracker?.recordNamedData(e,s);let t=e.startsWith(`g_`)?f:p;if(!t.has(e))return t.get(e,n),s}if(s++,s===c)return s;if(l&&++d>j5){if(Date.now()>u)return n(),s;d=0}}}#u(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(this.transparentCanvasEntry),this.transparentCanvas=null,this.transparentCanvasEntry=null)}endDrawing(){this.#u();for(let e of this.smaskGroupCanvases)this.canvasFactory.destroy(e);this.smaskGroupCanvases.length=0,this._clearPreparedSMask(),this.tempSMask=null,this.smaskStack.length=0;for(let e of this.#l)this.#y(e);this.#l.length=0,this.#n=null,this.#r=null,this.#i=null,this.#a=null,this.#o=1,this.#c=null,this.#t=0,this.#e=0,this.cachedPatterns.clear();for(let e of this._cachedBitmapsMap.values()){for(let t of e.values())typeof HTMLCanvasElement<`u`&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),this.#d()}#d(){if(this.pageColors){let e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!==`none`){let t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}}_scaleImage(e,t){let n=e.width??e.displayWidth,r=e.height??e.displayHeight,i=Math.max(Math.hypot(t[0],t[1]),1),a=Math.max(Math.hypot(t[2],t[3]),1),o=[],s=i,c=a,l=n,u=r;for(;s>2&&l>1||c>2&&u>1;){let e=l,t=u;s>2&&l>1&&(e=Math.ceil(l/2),s/=l/e),c>2&&u>1&&(t=Math.ceil(u/2),c/=u/t),o.push({newWidth:e,newHeight:t}),l=e,u=t}if(o.length===0)return{img:e,paintWidth:n,paintHeight:r,tmpCanvas:null};if(o.length===1){let{newWidth:t,newHeight:i}=o[0],a=this.canvasFactory.create(t,i);return a.context.drawImage(e,0,0,n,r,0,0,t,i),{img:a.canvas,paintWidth:t,paintHeight:i,tmpCanvas:a}}let d=this.canvasFactory.create(1,1),f=this.canvasFactory.create(1,1),p=n,m=r,h=e;for(let{newWidth:e,newHeight:t}of o)this.canvasFactory.reset(f,e,t),f.context.drawImage(h,0,0,p,m,0,0,e,t),[d,f]=[f,d],h=d.canvas,p=e,m=t;return this.canvasFactory.destroy(f),{img:d.canvas,paintWidth:p,paintHeight:m,tmpCanvas:d}}_createMaskCanvas(e,t){let n=this.ctx,{width:r,height:i}=t,a=this.current.fillColor,o=this.current.patternFill,s=N6(n),c,l,u,d;if((t.bitmap||t.data)&&t.count>1){let n=t.bitmap||t.data.buffer;l=JSON.stringify(o?s:[s.slice(0,4),a]),c=this._cachedBitmapsMap.getOrInsertComputed(n,f6);let r=c.get(l);if(r&&!o){let t=Math.round(Math.min(s[0],s[2])+s[4]),n=Math.round(Math.min(s[1],s[3])+s[5]);return this.dependencyTracker?.recordDependencies(e,k8.transformAndFill),{canvas:r,offsetX:t,offsetY:n}}u=r}u||(d=this.canvasFactory.create(r,i),z5(d.context,t));let f=$.transform(s,[1/r,0,0,-1/i,0,0]);f=$.transform(f,[1,0,0,1,0,-i]);let p=v3.slice();$.axialAlignedBoundingBox([0,0,r,i],f,p);let[m,h,g,_]=p,v=Math.round(g-m)||1,y=Math.round(_-h)||1,b=this.canvasFactory.create(v,y),x=b.context,S=m,C=h;x.translate(-S,-C),x.transform(...f);let w=null;if(!u){let e=this._scaleImage(d.canvas,P6(x));u=e.img,w=e.tmpCanvas,u!==d.canvas&&(this.canvasFactory.destroy(d),d=null),c&&o&&(c.set(l,u),w=null,d=null)}x.imageSmoothingEnabled=H5(N6(x),t.interpolate),I5(x,u,0,0,u.width,u.height,0,0,r,i),w&&this.canvasFactory.destroy(w),d&&this.canvasFactory.destroy(d),x.globalCompositeOperation=`source-in`;let T=$.transform(P6(x),[1,0,0,1,-S,-C]);return x.fillStyle=o?a.getPattern(n,this,T,v5.FILL,e):a,x.fillRect(0,0,r,i),c&&!o&&c.set(l,b.canvas),this.dependencyTracker?.recordDependencies(e,k8.transformAndFill),{canvas:b.canvas,canvasEntry:c&&!o?null:b,offsetX:Math.round(S),offsetY:Math.round(C)}}setLineWidth(e,t){this.dependencyTracker?.recordSimpleData(`lineWidth`,e),t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(e,t){this.dependencyTracker?.recordSimpleData(`lineCap`,e),this.ctx.lineCap=U5[t]}setLineJoin(e,t){this.dependencyTracker?.recordSimpleData(`lineJoin`,e),this.ctx.lineJoin=W5[t]}setMiterLimit(e,t){this.dependencyTracker?.recordSimpleData(`miterLimit`,e),this.ctx.miterLimit=t}setDash(e,t,n){this.dependencyTracker?.recordSimpleData(`dash`,e);let r=this.ctx;r.setLineDash!==void 0&&(r.setLineDash(t),r.lineDashOffset=n)}setRenderingIntent(e,t){}setFlatness(e,t){}setGState(e,t){for(let[n,r]of t)switch(n){case`LW`:this.setLineWidth(e,r);break;case`LC`:this.setLineCap(e,r);break;case`LJ`:this.setLineJoin(e,r);break;case`ML`:this.setMiterLimit(e,r);break;case`D`:this.setDash(e,r[0],r[1]);break;case`RI`:this.setRenderingIntent(e,r);break;case`FL`:this.setFlatness(e,r);break;case`Font`:this.setFont(e,r[0],r[1]);break;case`CA`:this.dependencyTracker?.recordSimpleData(`strokeAlpha`,e),this.current.strokeAlpha=r;break;case`ca`:this.dependencyTracker?.recordSimpleData(`fillAlpha`,e),this.ctx.globalAlpha=this.current.fillAlpha=r;break;case`BM`:this.dependencyTracker?.recordSimpleData(`globalCompositeOperation`,e),this.ctx.globalCompositeOperation=r;break;case`SMask`:this.dependencyTracker?.recordSimpleData(`SMask`,e),this.current.activeSMask=r?this.tempSMask:null,this.current.activeSMask&&(this.current.activeSMask.blendMode=this.ctx.globalCompositeOperation),this.tempSMask=null,this.checkSMaskState(e);break;case`TR`:this.dependencyTracker?.recordSimpleData(`filter`,e),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(r);break}}get inSMaskMode(){return!!this.suspendedCtx}_clearPreparedSMask(){this.smaskPreparedEntry&&=(this.canvasFactory.destroy(this.smaskPreparedEntry),null),this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null}_ensurePreparedSMask(e){e!==this.smaskPreparedFor&&(this._clearPreparedSMask(),this._prepareSMaskCanvas(e))}checkSMaskState(e){let t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode(e):!this.current.activeSMask&&t?this.endSMaskMode():this.current.activeSMask&&t&&this._ensurePreparedSMask(this.current.activeSMask)}_prepareSMaskCanvas(e){let{canvas:t,subtype:n,backdrop:r,transferMap:i}=e,a=n===`Luminosity`||n===`Alpha`&&i;if(!a&&!(n===`Luminosity`&&r)){this.smaskPreparedFor=e;return}let o;if(n===`Luminosity`&&r){let[e,t,n]=A6(r),a=Math.round(.3*e+.59*t+.11*n);o=i?.[a]??a}else o=i?.[0]??0;let{width:s,height:c}=this.ctx.canvas,l=t.width*t.height,u=s*c<4*l,d=a?{url:n===`Alpha`?this.filterFactory.addAlphaFilter(i):this.filterFactory.addLuminosityFilter(i),subtype:n,transferMap:i}:null,f=n===`Luminosity`?r:null,p,m,h;u?(p=this._bakeSMaskCanvas(t,e.offsetX,e.offsetY,s,c,f,d),m=0,h=0):(p=this._bakeSMaskCanvas(t,0,0,t.width,t.height,f,d),m=e.offsetX,h=e.offsetY),this.smaskPreparedEntry=p,this.smaskPreparedFor=e,this.smaskPreparedOffsetX=m,this.smaskPreparedOffsetY=h,this.smaskPreparedOOBAlpha=!u&&o!==0?o:null}_bakeSMaskCanvas(e,t,n,r,i,a,o){!a&&!o&&H3(`_bakeSMaskCanvas with neither backdrop nor filter`);let s=this.canvasFactory.create(r,i),c=s.context;if(c.drawImage(e,t,n),a&&(c.globalCompositeOperation=`destination-atop`,c.fillStyle=a,c.fillRect(0,0,r,i)),!o)return s;let l=this.canvasFactory.create(r,i),u=l.context;u.filter=o.url;let d=i6.isCanvasFilterSupported&&u.filter!==`none`&&u.filter!==``;if(u.drawImage(s.canvas,0,0),i6.isCanvasFilterSupported&&(u.filter=`none`),!d){let e=u.getImageData(0,0,r,i),{data:t}=e,{transferMap:n}=o;if(o.subtype===`Luminosity`)for(let e=0,r=t.length;e<r;e+=4){let r=.3*t[e]+.59*t[e+1]+.11*t[e+2]+.5|0;t[e]=t[e+1]=t[e+2]=0,t[e+3]=n?.[r]??r}else for(let e=3,r=t.length;e<r;e+=4)t[e]=n[t[e]];u.putImageData(e,0,0)}return this.canvasFactory.destroy(s),l}beginSMaskMode(e){if(this.inSMaskMode)throw Error(`beginSMaskMode called while already in smask mode`);let{width:t,height:n}=this.ctx.canvas,r=this.canvasFactory.create(t,n);this.smaskScratchCanvas=r,this.suspendedCtx=this.ctx;let i=this.ctx=r.context;i.setTransform(this.suspendedCtx.getTransform()),B5(this.suspendedCtx,i),F5(i,this.suspendedCtx),this._ensurePreparedSMask(this.current.activeSMask),this.setGState(e,[[`BM`,`source-over`]])}endSMaskMode(){if(!this.inSMaskMode)throw Error(`endSMaskMode called while not in smask mode`);this.ctx._removeMirroring(),B5(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null,this.canvasFactory.destroy(this.smaskScratchCanvas),this.smaskScratchCanvas=null,this._clearPreparedSMask()}#f(e,t=null,n=1){let{width:r,height:i}=e,a=t??this.canvasFactory.create(r,i),o=a.context;n=Math.round(n*255)/255;let s=n<1;s&&this.#s===void 0&&(this.#s=i6.isCanvasFilterSupported?new Map:`none`);let c=`none`;if(s&&this.#s instanceof Map&&(c=this.#s.getOrInsertComputed(n,()=>this.filterFactory.addKnockoutFilter(n))),!s||c!==`none`)return t&&(o.save(),o.setTransform(1,0,0,1,0,0),o.clearRect(0,0,r,i),o.restore()),o.filter=c,o.drawImage(e,0,0),o.filter=`none`,a;let l=e.getContext(`2d`,{willReadFrequently:!0}).getImageData(0,0,r,i),u=o.createImageData(r,i),d=l.data,f=u.data,p=n>0?1/n:1e6;for(let e=3,t=d.length;e<t;e+=4)f[e]=Math.min(Math.round(d[e]*p),255);return o.putImageData(u,0,0),a}#p(e,t,n,r){let i=e?.[t]??null;if(i&&(i.canvas.width!==n||i.canvas.height!==r)&&(this.canvasFactory.destroy(i),i=null),!i)return i=this.canvasFactory.create(n,r),e&&(e[t]=i),i;let a=i.context;return a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,n,r),a.restore(),i}#m(e,t,n={}){let{backdropCanvas:r=null,destTransform:i=[1,0,0,1,0,0],backdropOffset:a=[0,0],reuseMaskEntry:o=null,poolMeta:s=null,sourceAlpha:c=1,sourceFilter:l=`none`,knockoutAlpha:u=1}=n,{width:d,height:f}=t,p=this.#f(t,o,u),m=e.globalCompositeOperation;if(e.save(),e.setTransform(...i),e.globalAlpha=1,i6.isCanvasFilterSupported&&(e.filter=`none`),e.globalCompositeOperation=`destination-out`,e.drawImage(p.canvas,0,0),r){let[t,n]=a,i=this.#p(s,`knockoutBackdropEntry`,d,f),o=i.context;o.drawImage(r,t,n,d,f,0,0,d,f),o.globalCompositeOperation=`destination-in`,o.drawImage(p.canvas,0,0),o.globalCompositeOperation=`source-over`,e.globalCompositeOperation=`destination-over`,e.drawImage(i.canvas,0,0),s||this.canvasFactory.destroy(i)}e.globalCompositeOperation=m,e.globalAlpha=c,i6.isCanvasFilterSupported&&(e.filter=l??`none`),e.drawImage(t,0,0),e.restore(),o||this.canvasFactory.destroy(p)}#h(e=1){if(this.#e===0||this.#t>0||!this.contentVisible)return!1;this.#t++,this.#o=e;let t=this.#l.at(-1),{canvas:n}=this.ctx,r=this.#p(t,`knockoutTempEntry`,n.width,n.height);this.#n=r;let i=r.context;return i.save(),i.setTransform(this.ctx.getTransform()),B5(this.ctx,i),this.#a=i.globalCompositeOperation,i.globalCompositeOperation=`source-over`,F5(i,this.ctx),this.#c=t,this.#r=this.ctx,this.#i=this.suspendedCtx,this.ctx=i,this.inSMaskMode&&(this.suspendedCtx=i),!0}#g(e){if(!e)return;let t=this.#n,n=this.#r,r=this.#i,i=t.context;this.#n=null,this.#r=null,this.#i=null,this.inSMaskMode&&this.suspendedCtx===i&&this.ctx!==i&&this.endSMaskMode(),this.inSMaskMode&&(this.suspendedCtx=r),this.ctx._removeMirroring(),this.ctx.globalCompositeOperation=this.#a,this.#a=null,B5(this.ctx,n),this.ctx=n;let a=this.#c;this.#c=null;let o=this.#o;this.#o=1;try{this.#m(r??n,t.canvas,{backdropCanvas:a?.backdropCtx?.canvas??null,backdropOffset:a?.backdropCtx?[a.offsetX,a.offsetY]:[0,0],reuseMaskEntry:a?.knockoutMaskEntry??null,poolMeta:a,knockoutAlpha:o})}finally{i.restore(),this.#t--,a||this.canvasFactory.destroy(t)}}compose(e){if(!this.current.activeSMask)return;e=e?[Math.floor(e[0]),Math.floor(e[1]),Math.ceil(e[2]),Math.ceil(e[3])]:[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let t=this.current.activeSMask,n=this.suspendedCtx,r=this.#t>0&&n===this.ctx;this.composeSMask(r?null:n,t,this.ctx,e),!r&&(this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore())}composeSMask(e,t,n,r){let i=r[0],a=r[1],o=r[2]-i,s=r[3]-a;if(o===0||s===0)return;let c=this.smaskPreparedEntry;if(c){let e=i,r=a,l=o,u=s,d=this.smaskPreparedOOBAlpha,f=d!==null;if(f){e=Math.max(i,t.offsetX),r=Math.max(a,t.offsetY);let n=Math.min(i+o,t.offsetX+t.canvas.width),c=Math.min(a+s,t.offsetY+t.canvas.height);l=n-e,u=c-r}if(l>0&&u>0){let t=e-this.smaskPreparedOffsetX,i=r-this.smaskPreparedOffsetY;n.save(),n.globalAlpha=1,n.setTransform(1,0,0,1,0,0);let a=new Path2D;a.rect(e,r,l,u),n.clip(a),n.globalCompositeOperation=`destination-in`,n.drawImage(c.canvas,t,i,l,u,e,r,l,u),n.restore()}f&&d<255&&this._applySMaskOOBAlpha(n,i,a,o,s,e,r,e+l,r+u,d)}else this.genericComposeSMask(t,n,o,s,i,a);e&&(e.save(),e.globalAlpha=1,e.globalCompositeOperation=t.blendMode||`source-over`,e.setTransform(1,0,0,1,0,0),e.drawImage(n.canvas,i,a,o,s,i,a,o,s),e.restore())}_applySMaskOOBAlpha(e,t,n,r,i,a,o,s,c,l){let u=a<s&&o<c;if(u&&a===t&&o===n&&s===t+r&&c===n+i)return;let d=new Path2D;d.rect(t,n,r,i),u&&d.rect(a,o,s-a,c-o),e.save(),e.globalAlpha=l/255,e.setTransform(1,0,0,1,0,0),e.clip(d,`evenodd`),e.globalCompositeOperation=`destination-in`,e.fillStyle=`#000000`,e.fillRect(t,n,r,i),e.restore()}genericComposeSMask(e,t,n,r,i,a){let{context:o,offsetX:s,offsetY:c}=e;t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);let l=new Path2D;l.rect(i,a,n,r),t.clip(l),t.globalCompositeOperation=`destination-in`,t.drawImage(o.canvas,i-s,a-c,n,r,i,a,n,r),t.restore()}save(e){this.inSMaskMode&&B5(this.ctx,this.suspendedCtx),this.ctx.save();let t=this.current;this.stateStack.push(t),this.current=t.clone(),this.dependencyTracker?.save(e)}restore(e){if(this.dependencyTracker?.restore(e),this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&(B5(this.suspendedCtx,this.ctx),this.ctx.setTransform(this.suspendedCtx.getTransform())),this.checkSMaskState(e),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(e,t,n,r,i,a,o){this.dependencyTracker?.recordIncrementalData(`transform`,e),this.ctx.transform(t,n,r,i,a,o),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,n,r){let[i]=n;if(!r){i||=n[0]=new Path2D,t!==P3.stroke&&t!==P3.closeStroke&&(this.current.tilingPatternDims=null),this[t](e,i);return}if(this.dependencyTracker!==null){let n=t===P3.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(e).recordBBox(e,this.ctx,r[0]-n,r[2]+n,r[1]-n,r[3]+n).recordDependencies(e,[`transform`])}i instanceof Path2D||(i=n[0]=J6(i)),$.axialAlignedBoundingBox(r,N6(this.ctx),this.current.minMax);let a=this.current.tilingPatternDims;if(a&&t!==P3.stroke&&t!==P3.closeStroke&&this.current.fillColor instanceof D5){let e=$.intersect(this.current.clipBox,this.current.minMax);e?this.current.fillColor.updatePatternDims(e,a):this.current.tilingPatternDims=null}this[t](e,i),this._pathStartIdx=e}closePath(e){this.ctx.closePath()}stroke(e,t,n=!0){let r=n&&this.#h(this.current.strokeAlpha),i=this.ctx,a=this.current.strokeColor;if(i.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof a==`object`&&a?.getPattern){let n=a.isModifyingCurrentTransform()?i.getTransform():null;if(i.save(),i.strokeStyle=a.getPattern(i,this,P6(i),v5.STROKE,e),n){let e=new Path2D;e.addPath(t,i.getTransform().invertSelf().multiplySelf(n)),t=e}this.rescaleAndStroke(t,!1),i.restore()}else this.rescaleAndStroke(t,!0);this.dependencyTracker?.recordDependencies(e,k8.stroke),n&&this.consumePath(e,t,this.current.getClippedPathBoundingBox(v5.STROKE,N6(this.ctx))),i.globalAlpha=this.current.fillAlpha,this.#g(r)}closeStroke(e,t){this.stroke(e,t)}fill(e,t,n=!0){let r=n&&this.#h(this.current.fillAlpha),i=this.ctx,a=this.current.fillColor,o=this.current.patternFill,s=!1,c=this.current.getClippedPathBoundingBox();if(this.dependencyTracker?.recordDependencies(e,k8.fill),o){let o=this.current.tilingPatternDims,l=o&&a.canSkipPatternCanvas(o);if(l){a.drawPattern(this,t,this.pendingEOFill,l,e),this.pendingEOFill=!1,n&&this.consumePath(e,t,c),this.current.tilingPatternDims=null,this.#g(r);return}let u=a.isModifyingCurrentTransform()?i.getTransform():null;if(this.dependencyTracker?.save(e),i.save(),i.fillStyle=a.getPattern(i,this,P6(i),v5.FILL,e),u){let e=new Path2D;e.addPath(t,i.getTransform().invertSelf().multiplySelf(u)),t=e}s=!0}this.contentVisible&&c!==null&&(this.pendingEOFill?(i.fill(t,`evenodd`),this.pendingEOFill=!1):i.fill(t)),s&&(i.restore(),this.dependencyTracker?.restore(e)),n&&this.consumePath(e,t,c),this.#g(r)}eoFill(e,t){this.pendingEOFill=!0,this.fill(e,t)}fillStroke(e,t){let n=this.#h(Math.min(this.current.fillAlpha,this.current.strokeAlpha));this.fill(e,t,!1),this.stroke(e,t,!1),this.consumePath(e,t),this.#g(n)}eoFillStroke(e,t){this.pendingEOFill=!0,this.fillStroke(e,t)}closeFillStroke(e,t){this.fillStroke(e,t)}closeEOFillStroke(e,t){this.pendingEOFill=!0,this.fillStroke(e,t)}endPath(e,t){this.consumePath(e,t)}rawFillPath(e,t){let n=this.#h(this.current.fillAlpha);this.ctx.fill(t),this.dependencyTracker?.recordDependencies(e,k8.rawFillPath).recordOperation(e),this.#g(n)}clip(e){this.dependencyTracker?.recordFutureForcedDependency(`clipMode`,e),this.pendingClip=G5}eoClip(e){this.dependencyTracker?.recordFutureForcedDependency(`clipMode`,e),this.pendingClip=K5}beginText(e){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,this.dependencyTracker?.recordOpenMarker(e).resetIncrementalData(`sameLineText`).resetIncrementalData(`moveText`,e)}endText(e){let t=this.pendingTextPaths,n=this.ctx;if(this.dependencyTracker){let{dependencyTracker:n}=this;t!==void 0&&n.recordFutureForcedDependency(`textClip`,n.getOpenMarker()).recordFutureForcedDependency(`textClip`,e),n.recordCloseMarker(e)}if(t!==void 0){let e=new Path2D,r=n.getTransform().invertSelf();for(let{transform:n,x:i,y:a,fontSize:o,path:s}of t)s&&e.addPath(s,new DOMMatrix(n).preMultiplySelf(r).translate(i,a).scale(o,-o));n.clip(e)}delete this.pendingTextPaths}setCharSpacing(e,t){this.dependencyTracker?.recordSimpleData(`charSpacing`,e),this.current.charSpacing=t}setWordSpacing(e,t){this.dependencyTracker?.recordSimpleData(`wordSpacing`,e),this.current.wordSpacing=t}setHScale(e,t){this.dependencyTracker?.recordSimpleData(`hScale`,e),this.current.textHScale=t/100}setLeading(e,t){this.dependencyTracker?.recordSimpleData(`leading`,e),this.current.leading=-t}setFont(e,t,n){this.dependencyTracker?.recordSimpleData(`font`,e).recordSimpleDataFromNamed(`fontObj`,t,e);let r=this.commonObjs.get(t),i=this.current;if(!r)throw Error(`Can't find font for ${t}`);if(i.fontMatrix=r.fontMatrix||y3,(i.fontMatrix[0]===0||i.fontMatrix[3]===0)&&V3(`Invalid font matrix for font `+t),n<0?(n=-n,i.fontDirection=-1):i.fontDirection=1,this.current.font=r,this.current.fontSize=n,r.isType3Font)return;let a=r.loadedName||`sans-serif`,o=r.systemFontInfo?.css||`"${a}", ${r.fallbackName}`,s=`normal`;r.black?s=`900`:r.bold&&(s=`bold`);let c=r.italic?`italic`:`normal`,l=m6(n,O5,k5);this.current.fontSizeScale=n/l,this.ctx.font=`${c} ${s} ${l}px ${o}`}setTextRenderingMode(e,t){this.dependencyTracker?.recordSimpleData(`textRenderingMode`,e),this.current.textRenderingMode=t}setTextRise(e,t){this.dependencyTracker?.recordSimpleData(`textRise`,e),this.current.textRise=t}moveText(e,t,n){this.dependencyTracker?.resetIncrementalData(`sameLineText`).recordIncrementalData(`moveText`,e),this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=n}setLeadingMoveText(e,t,n){this.setLeading(e,-n),this.moveText(e,t,n)}setTextMatrix(e,t){this.dependencyTracker?.resetIncrementalData(`sameLineText`).recordSimpleData(`textMatrix`,e);let{current:n}=this;n.textMatrix=t,n.textMatrixScale=Math.hypot(t[0],t[1]),n.x=n.lineX=0,n.y=n.lineY=0}nextLine(e){this.moveText(e,0,this.current.leading),this.dependencyTracker?.recordIncrementalData(`moveText`,this.dependencyTracker.getSimpleIndex(`leading`)??e)}#_(e,t,n){let r=new Path2D;return r.addPath(e,new DOMMatrix(n).invertSelf().multiplySelf(t)),r}paintChar(e,t,n,r,i,a){let o=this.ctx,s=this.current,c=s.font,l=s.textRenderingMode,u=s.fontSize/s.fontSizeScale,d=l&k3.FILL_STROKE_MASK,f=!!(l&k3.ADD_TO_PATH_FLAG),p=s.patternFill&&!c.missingFile,m=s.patternStroke&&!c.missingFile,h;if((c.disableFontFace||f||p||m)&&!c.missingFile&&(h=c.getPathGenerator(this.commonObjs,t)),h&&(c.disableFontFace||p||m)){o.save(),o.translate(n,r),o.scale(u,-u),this.dependencyTracker?.recordCharacterBBox(e,o,c);let t;if(d===k3.FILL||d===k3.FILL_STROKE)if(i){t=o.getTransform(),o.setTransform(...i);let e=this.#_(h,t,i);o.fill(e)}else o.fill(h);if(d===k3.STROKE||d===k3.FILL_STROKE)if(a){t||=o.getTransform(),o.setTransform(...a);let{a:e,b:n,c:r,d:i}=t,s=$.inverseTransform(a),c=$.transform([e,n,r,i,0,0],s);$.singularValueDecompose2dScale(c,P5),o.lineWidth*=Math.max(P5[0],P5[1])/u,o.stroke(this.#_(h,t,a))}else o.lineWidth/=u,o.stroke(h);o.restore()}else(d===k3.FILL||d===k3.FILL_STROKE)&&(o.fillText(t,n,r),this.dependencyTracker?.recordCharacterBBox(e,o,c,u,n,r,()=>o.measureText(t))),(d===k3.STROKE||d===k3.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(e,o,c,u,n,r,()=>o.measureText(t)).recordDependencies(e,k8.stroke),o.strokeText(t,n,r));f&&((this.pendingTextPaths||=[]).push({transform:N6(o),x:n,y:r,fontSize:u,path:h}),this.dependencyTracker?.recordCharacterBBox(e,o,c,u,n,r))}get isFontSubpixelAAEnabled(){let e=this.canvasFactory.create(10,10),t=e.context;t.scale(1.5,1),t.fillText(`I`,0,10);let n=t.getImageData(0,0,10,10).data;this.canvasFactory.destroy(e);let r=!1;for(let e=3;e<n.length;e+=4)if(n[e]>0&&n[e]<255){r=!0;break}return J3(this,`isFontSubpixelAAEnabled`,r)}showText(e,t){this.dependencyTracker&&(this.dependencyTracker.recordDependencies(e,k8.showText).resetBBox(e),this.current.textRenderingMode&k3.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency(`textClip`,e).inheritPendingDependenciesAsFutureForcedDependencies());let n=this.current,r=n.font;if(r.isType3Font){let r=this.#h(n.fillAlpha);this.showType3Text(e,t),this.dependencyTracker?.recordShowTextOperation(e),this.#g(r);return}let i=n.fontSize;if(i===0){this.dependencyTracker?.recordOperation(e);return}let a=this.#h(n.fillAlpha),o=this.ctx,s=n.fontSizeScale,c=n.charSpacing,l=n.wordSpacing,u=n.fontDirection,d=n.textHScale*u,f=t.length,p=r.vertical,m=p?1:-1,h=r.defaultVMetrics,g=i*n.fontMatrix[0],_=n.textRenderingMode===k3.FILL&&!r.disableFontFace&&!n.patternFill;o.save(),n.textMatrix&&o.transform(...n.textMatrix),o.translate(n.x,n.y+n.textRise),u>0?o.scale(d,-1):o.scale(d,1);let v,y,b=n.textRenderingMode&k3.FILL_STROKE_MASK,x=b===k3.FILL||b===k3.FILL_STROKE,S=b===k3.STROKE||b===k3.FILL_STROKE,C=n.lineWidth,w=n.textMatrixScale;if(w===0||C===0?S&&(C=this.getSinglePixelWidth()):C/=w,s!==1&&(o.scale(s,s),C/=s),o.lineWidth=C,x&&n.patternFill){o.save();let t=n.fillColor.getPattern(o,this,P6(o),v5.FILL,e);v=N6(o),o.restore(),o.fillStyle=t}if(S&&n.patternStroke){o.save();let t=n.strokeColor.getPattern(o,this,P6(o),v5.STROKE,e);y=N6(o),o.restore(),o.strokeStyle=t}if(r.isInvalidPDFjsFont){let r=[],i=0;for(let e of t)r.push(e.unicode),i+=e.width;let s=r.join(``);if(o.fillText(s,0,0),this.dependencyTracker!==null){let t=o.measureText(s);this.dependencyTracker.recordBBox(e,this.ctx,-t.actualBoundingBoxLeft,t.actualBoundingBoxRight,-t.actualBoundingBoxAscent,t.actualBoundingBoxDescent).recordShowTextOperation(e)}n.x+=i*g*d,o.restore(),this.compose(),this.#g(a);return}let T=0,E;for(E=0;E<f;++E){let n=t[E];if(typeof n==`number`){T+=m*n*i/1e3;continue}let a=!1,d=(n.isSpace?l:0)+c,f=n.fontChar,b=n.accent,x,S,C=n.width;if(p){let e=n.vmetric||h,t=-(n.vmetric?e[1]:C*.5)*g,r=e[2]*g;C=e?-e[0]:C,x=t/s,S=(T+r)/s}else x=T/s,S=0;let w;if(r.remeasure&&C>0){w=o.measureText(f);let e=w.width*1e3/i*s;if(C<e&&this.isFontSubpixelAAEnabled){let t=C/e;a=!0,o.save(),o.scale(t,1),x/=t}else C!==e&&(x+=(C-e)/2e3*i/s)}if(this.contentVisible&&(n.isInFont||r.missingFile)){if(_&&!b)o.fillText(f,x,S),this.dependencyTracker?.recordCharacterBBox(e,o,w?{bbox:null}:r,i/s,x,S,()=>w??o.measureText(f));else if(this.paintChar(e,f,x,S,v,y),b){let t=x+i*b.offset.x/s,n=S-i*b.offset.y/s;this.paintChar(e,b.fontChar,t,n,v,y)}}let D=p?C*g-d*u:C*g+d*u;T+=D,a&&o.restore()}p?n.y-=T:n.x+=T*d,o.restore(),this.compose(),this.dependencyTracker?.recordShowTextOperation(e),this.#g(a)}showType3Text(e,t){let n=this.ctx,r=this.current,i=r.font,a=r.fontSize,o=r.fontDirection,s=i.vertical?1:-1,c=r.charSpacing,l=r.wordSpacing,u=r.textHScale*o,d=r.fontMatrix||y3,f=t.length,p=r.textRenderingMode===k3.INVISIBLE,m,h,g,_;if(p||a===0)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,n.save(),r.textMatrix&&n.transform(...r.textMatrix),n.translate(r.x,r.y+r.textRise),n.scale(u,o);let v=this.dependencyTracker;for(this.dependencyTracker=v?new O8(v,e):null,m=0;m<f;++m){if(h=t[m],typeof h==`number`){_=s*h*a/1e3,this.ctx.translate(_,0),r.x+=_*u;continue}let e=(h.isSpace?l:0)+c,o=i.charProcOperatorList[h.operatorListId];o?this.contentVisible&&(this.save(),o.fnArray[0]===P3.setCharWidth&&(r.fillAlpha=r.strokeAlpha=1,n.globalAlpha=1),n.scale(a,a),n.transform(...d),this.executeOperatorList(o),this.restore()):V3(`Type3 character "${h.operatorListId}" is not available.`);let f=[h.width,0];$.applyTransform(f,d),g=f[0]*a+e,n.translate(g,0),r.x+=g*u}n.restore(),v&&(this.dependencyTracker=v)}setCharWidth(e,t,n){}setCharWidthAndBounds(e,t,n,r,i,a,o){let s=new Path2D;s.rect(r,i,a-r,o-i),this.ctx.clip(s),this.dependencyTracker?.recordBBox(e,this.ctx,r,a,i,o).recordClipBox(e,this.ctx,r,a,i,o),this.endPath(e)}getColorN_Pattern(t,n){let r;if(n[0]===`TilingPattern`){let t=this.baseTransform||N6(this.ctx);r=new D5(n,this.ctx,{createCanvasGraphics:(t,n)=>new e(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new O8(this.dependencyTracker,n,!0):null)},t)}else r=this._getPattern(t,n[1],n[2]);return r}setStrokeColorN(e,...t){this.dependencyTracker?.recordSimpleData(`strokeColor`,e),this.current.strokeColor=this.getColorN_Pattern(e,t),this.current.patternStroke=!0}setFillColorN(e,...t){this.dependencyTracker?.recordSimpleData(`fillColor`,e);let n=this.current.fillColor=this.getColorN_Pattern(e,t);this.current.patternFill=!0,this.current.tilingPatternDims=n instanceof D5?[0,0,0,0]:null}setStrokeRGBColor(e,t){this.dependencyTracker?.recordSimpleData(`strokeColor`,e),this.ctx.strokeStyle=this.current.strokeColor=t,this.current.patternStroke=!1}setStrokeTransparent(e){this.dependencyTracker?.recordSimpleData(`strokeColor`,e),this.ctx.strokeStyle=this.current.strokeColor=`transparent`,this.current.patternStroke=!1}setFillRGBColor(e,t){this.dependencyTracker?.recordSimpleData(`fillColor`,e),this.ctx.fillStyle=this.current.fillColor=t,this.current.patternFill=!1,this.current.tilingPatternDims=null}setFillTransparent(e){this.dependencyTracker?.recordSimpleData(`fillColor`,e),this.ctx.fillStyle=this.current.fillColor=`transparent`,this.current.patternFill=!1,this.current.tilingPatternDims=null}_getPattern(e,t,n=null){let r;return this.cachedPatterns.has(t)?r=this.cachedPatterns.get(t):(r=T5(this.getObject(e,t)),this.cachedPatterns.set(t,r)),n&&(r.matrix=n),r}shadingFill(e,t){if(!this.contentVisible)return;let n=this.#h(this.current.fillAlpha),r=this.ctx;this.save(e),r.fillStyle=this._getPattern(e,t).getPattern(r,this,P6(r),v5.SHADING,e);let i=P6(r);if(i){let{width:e,height:t}=r.canvas,n=v3.slice();$.axialAlignedBoundingBox([0,0,e,t],i,n);let[a,o,s,c]=n;this.ctx.fillRect(a,o,s-a,c-o)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.dependencyTracker?.resetBBox(e).recordFullPageBBox(e).recordDependencies(e,k8.transform).recordDependencies(e,k8.fill).recordOperation(e),this.compose(this.current.getClippedPathBoundingBox()),this.restore(e),this.#g(n)}beginInlineImage(){H3(`Should not call beginInlineImage`)}beginImageData(){H3(`Should not call beginImageData`)}paintFormXObjectBegin(e,t,n){if(this.contentVisible&&(this.save(e),this.baseTransformStack.push(this.baseTransform),t&&this.transform(e,...t),this.baseTransform=N6(this.ctx),n)){$.axialAlignedBoundingBox(n,this.baseTransform,this.current.minMax);let[t,r,i,a]=n,o=new Path2D;o.rect(t,r,i-t,a-r),this.ctx.clip(o),this.dependencyTracker?.recordClipBox(e,this.ctx,t,i,r,a),this.endPath(e)}}paintFormXObjectEnd(e){this.contentVisible&&(this.restore(e),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e,t){if(!this.contentVisible)return;this.save(e);let{inSMaskMode:n}=this;n&&(this.endSMaskMode(),this.current.activeSMask=null);let r=this.ctx;if((!t.needsIsolation||!t.isolated&&!t.hasSoftMask)&&!t.knockout&&!t.isGray&&this.#e===0&&r.globalAlpha===1&&r.globalCompositeOperation===`source-over`&&!n){if(t.bbox){let e=new Path2D,[n,i,a,o]=t.bbox;if(e.rect(n,i,a-n,o-i),t.matrix){let n=new Path2D;n.addPath(e,new DOMMatrix(t.matrix)),e=n}r.clip(e)}this.groupStack.push(null),this.#l.push(null),this.groupLevel++;return}!t.isolated&&!t.knockout&&this.#e===0&&B3(`TODO: Fully support non-isolated non-knockout groups.`);let i=N6(r);t.matrix&&r.transform(...t.matrix);let a=[0,0,r.canvas.width,r.canvas.height],o;t.bbox?(o=v3.slice(),$.axialAlignedBoundingBox(t.bbox,N6(r),o),o=$.intersect(o,a)||[0,0,0,0]):o=a;let s=Math.floor(o[0]),c=Math.floor(o[1]),l=Math.max(Math.ceil(o[2])-s,1),u=Math.max(Math.ceil(o[3])-c,1);this.current.startNewPathAndClipBox([0,0,l,u]);let d=this.canvasFactory.create(l,u);t.smask&&this.smaskGroupCanvases.push(d);let f=d.context,p=t.knockout&&!t.isolated?r:null,m=!t.isolated&&!t.knockout&&!t.smask&&t.needsIsolation&&this.#e>0,h=t.knockout?this.canvasFactory.create(l,u):null,g=this.#e;if(t.knockout?this.#e++:this.#e=0,f.translate(-s,-c),f.transform(...i),!t.isolated&&!t.smask&&n&&t.needsIsolation&&(f.save(),f.setTransform(1,0,0,1,0,0),f.drawImage(r.canvas,-s,-c),f.restore()),t.bbox){let e=new Path2D,[n,r,i,a]=t.bbox;if(e.rect(n,r,i-n,a-r),t.matrix){let n=new Path2D;n.addPath(e,new DOMMatrix(t.matrix)),e=n}f.clip(e)}t.smask&&this.smaskStack.push({canvas:d.canvas,context:f,offsetX:s,offsetY:c,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null}),(!t.smask||this.dependencyTracker)&&(r.setTransform(1,0,0,1,0,0),r.translate(s,c),r.save()),B5(r,f),this.ctx=f,this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies([`fillAlpha`,`strokeAlpha`,`globalCompositeOperation`]).pushBaseTransform(r),this.setGState(e,[[`BM`,`source-over`],[`ca`,1],[`CA`,1],[`TR`,null]]),this.groupStack.push(r),this.#l.push({backdropCtx:p,savedKnockoutLevel:g,offsetX:s,offsetY:c,hasInnerBackdrop:m,knockoutMaskEntry:h,knockoutTempEntry:null,knockoutBackdropEntry:null}),this.groupLevel++}endGroup(e,t){if(!this.contentVisible)return;this.groupLevel--;let n=this.ctx,r=this.groupStack.pop(),i=this.#l.pop();if(i&&(this.#e=i.savedKnockoutLevel),r===null){this.restore(e);return}if(t.isGray&&this.#v(n),this.ctx=r,this.ctx.imageSmoothingEnabled=!1,this.dependencyTracker?.popBaseTransform(),t.smask)this.tempSMask=this.smaskStack.pop(),this.restore(e),this.dependencyTracker&&(this.ctx.restore(),this.inSMaskMode&&this.ctx.setTransform(this.suspendedCtx.getTransform())),this.#y(i);else{this.ctx.restore();let t=N6(this.ctx);this.restore(e),this.ctx.save(),this.ctx.setTransform(...t);let a=v3.slice();$.axialAlignedBoundingBox([0,0,n.canvas.width,n.canvas.height],t,a);let o=this.#l.at(-1);if(this.#e>0)if(i.hasInnerBackdrop){let{width:e,height:a}=n.canvas,o=this.canvasFactory.create(e,a),s=o.context;s.drawImage(r.canvas,i.offsetX,i.offsetY,e,a,0,0,e,a),s.globalCompositeOperation=`source-over`,s.drawImage(n.canvas,0,0);let c=this.#f(n.canvas);s.globalCompositeOperation=`destination-in`,s.drawImage(c.canvas,0,0);let l=this.ctx.globalCompositeOperation,u=this.ctx.globalAlpha,d=this.ctx.filter;this.ctx.save(),this.ctx.setTransform(...t),this.ctx.globalAlpha=1,i6.isCanvasFilterSupported&&(this.ctx.filter=`none`),this.ctx.globalCompositeOperation=`destination-out`,this.ctx.drawImage(c.canvas,0,0),this.ctx.globalCompositeOperation=l,this.ctx.globalAlpha=u,i6.isCanvasFilterSupported&&(this.ctx.filter=d??`none`),this.ctx.drawImage(o.canvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(c),this.canvasFactory.destroy(o)}else{let e=o?.backdropCtx??null;this.#m(this.ctx,n.canvas,{backdropCanvas:e?.canvas??null,destTransform:t,backdropOffset:e?[o.offsetX+i.offsetX,o.offsetY+i.offsetY]:[0,0],sourceAlpha:this.ctx.globalAlpha,sourceFilter:this.ctx.filter})}else this.ctx.drawImage(n.canvas,0,0);this.ctx.restore(),this.canvasFactory.destroy({canvas:n.canvas,context:n}),this.#y(i),this.compose(a)}}#v(e){let{canvas:t}=e,{width:n,height:r}=t;if(i6.isCanvasFilterSupported){e.save(),e.setTransform(1,0,0,1,0,0),e.filter=`grayscale(1)`,e.globalAlpha=1,e.globalCompositeOperation=`copy`,e.drawImage(t,0,0),e.restore();return}let i=e.getImageData(0,0,n,r),{data:a}=i;for(let e=0,t=a.length;e<t;e+=4){let t=a[e]*.2126+a[e+1]*.7152+a[e+2]*.0722+.5|0;a[e]=a[e+1]=a[e+2]=t}e.putImageData(i,0,0)}#y(e){e&&(e.knockoutMaskEntry&&=(this.canvasFactory.destroy(e.knockoutMaskEntry),null),e.knockoutTempEntry&&=(this.canvasFactory.destroy(e.knockoutTempEntry),null),e.knockoutBackdropEntry&&=(this.canvasFactory.destroy(e.knockoutBackdropEntry),null))}beginAnnotation(e,t,n,r,i,a,o){if(this.#u(),V5(this.ctx),this.ctx.save(),this.save(e),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),n){let i=n[2]-n[0],s=n[3]-n[1];if(a&&this.annotationCanvasMap){r=r.slice(),r[4]-=n[0],r[5]-=n[1],n=n.slice(),n[0]=n[1]=0,n[2]=i,n[3]=s,$.singularValueDecompose2dScale(N6(this.ctx),P5);let{viewportScale:e}=this,a=Math.ceil(i*this.outputScaleX*e),c=Math.ceil(s*this.outputScaleY*e);this.annotationCanvas=this.canvasFactory.create(a,c);let{canvas:l,context:u}=this.annotationCanvas;if(o){let e=this.annotationCanvasMap.getOrInsertComputed(t,d6);l.setAttribute(`data-canvas-name`,o);let n=e.findIndex(e=>e.getAttribute(`data-canvas-name`)===o);n===-1?e.push(l):e[n]=l}else this.annotationCanvasMap.set(t,l);this.annotationCanvas.savedCtx=this.ctx,this.ctx=u,this.ctx.save(),this.ctx.setTransform(P5[0],0,0,-P5[1],0,s*P5[1]),V5(this.ctx)}else{V5(this.ctx),this.endPath(e);let t=new Path2D;t.rect(n[0],n[1],i,s),this.ctx.clip(t)}}this.current=new L5(this.ctx.canvas.width,this.ctx.canvas.height),this.baseTransformStack.push(this.baseTransform),this.transform(e,...r),this.transform(e,...i),this.baseTransform=N6(this.ctx)}endAnnotation(e){this.annotationCanvas&&(this.ctx.restore(),this.#d(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas),this.baseTransform=this.baseTransformStack.pop()}paintImageMaskXObject(e,t){if(!this.contentVisible)return;let n=t.count;t=this.getObject(e,t.data,t),t.count=n;let r=this.#h(this.current.fillAlpha),i=this.ctx,a=this._createMaskCanvas(e,t),o=a.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(o,a.offsetX,a.offsetY),this.dependencyTracker?.resetBBox(e).recordBBox(e,this.ctx,a.offsetX,a.offsetX+o.width,a.offsetY,a.offsetY+o.height).recordOperation(e),i.restore(),a.canvasEntry&&this.canvasFactory.destroy(a.canvasEntry),this.compose(),this.#g(r)}paintImageMaskXObjectRepeat(e,t,n,r=0,i=0,a,o){if(!this.contentVisible)return;t=this.getObject(e,t.data,t);let s=this.#h(this.current.fillAlpha),c=this.ctx;c.save();let l=N6(c);c.transform(n,r,i,a,0,0);let u=this._createMaskCanvas(e,t);c.setTransform(1,0,0,1,u.offsetX-l[4],u.offsetY-l[5]),this.dependencyTracker?.resetBBox(e);for(let t=0,s=o.length;t<s;t+=2){let s=$.transform(l,[n,r,i,a,o[t],o[t+1]]);c.drawImage(u.canvas,s[4],s[5]),this.dependencyTracker?.recordBBox(e,this.ctx,s[4],s[4]+u.canvas.width,s[5],s[5]+u.canvas.height)}c.restore(),u.canvasEntry&&this.canvasFactory.destroy(u.canvasEntry),this.compose(),this.dependencyTracker?.recordOperation(e),this.#g(s)}paintImageMaskXObjectGroup(e,t){if(!this.contentVisible)return;let n=this.#h(this.current.fillAlpha),r=this.ctx,i=this.current.fillColor,a=this.current.patternFill;this.dependencyTracker?.resetBBox(e).recordDependencies(e,k8.transformAndFill);for(let n of t){let{data:t,width:o,height:s,transform:c}=n,l=this.canvasFactory.create(o,s),u=l.context;u.save(),z5(u,this.getObject(e,t,n)),u.globalCompositeOperation=`source-in`,u.fillStyle=a?i.getPattern(u,this,P6(r),v5.FILL,e):i,u.fillRect(0,0,o,s),u.restore(),r.save(),r.transform(...c),r.scale(1,-1),I5(r,l.canvas,0,0,o,s,0,-1,1,1),this.canvasFactory.destroy(l),this.dependencyTracker?.recordBBox(e,r,0,o,0,s),r.restore()}this.compose(),this.dependencyTracker?.recordOperation(e),this.#g(n)}paintImageXObject(e,t){if(!this.contentVisible)return;let n=this.getObject(e,t);if(!n){V3(`Dependent image isn't ready yet`);return}this.paintInlineImageXObject(e,n)}paintImageXObjectRepeat(e,t,n,r,i){if(!this.contentVisible)return;let a=this.getObject(e,t);if(!a){V3(`Dependent image isn't ready yet`);return}let o=a.width,s=a.height,c=[];for(let e=0,t=i.length;e<t;e+=2)c.push({transform:[n,0,0,r,i[e],i[e+1]],x:0,y:0,w:o,h:s});this.paintInlineImageXObjectGroup(e,a,c)}applyTransferMapsToCanvas(e){return this.current.transferMaps!==`none`&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter=`none`),e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps===`none`)return{img:e.bitmap,canvasEntry:null};let{bitmap:t,width:n,height:r}=e,i=this.canvasFactory.create(n,r),a=i.context;return a.filter=this.current.transferMaps,a.drawImage(t,0,0),a.filter=`none`,{img:i.canvas,canvasEntry:i}}paintInlineImageXObject(e,t){if(!this.contentVisible)return;let n=t.width,r=t.height,i=this.#h(this.current.fillAlpha),a=this.ctx;this.save(e);let{filter:o}=a;o!==`none`&&o!==``&&(a.filter=`none`),a.scale(1/n,-1/r);let s,c=null;if(t.bitmap){let e=this.applyTransferMapsToBitmap(t);s=e.img,c=e.canvasEntry}else{let e=this.canvasFactory.create(n,r);R5(e.context,t),s=this.applyTransferMapsToCanvas(e.context),c=e}let l=this._scaleImage(s,P6(a));a.imageSmoothingEnabled=H5(N6(a),t.interpolate),this.dependencyTracker&&(this.dependencyTracker.resetBBox(e).recordBBox(e,a,0,n,-r,0).recordDependencies(e,k8.imageXObject).recordOperation(e),this.imagesTracker?.record(a,n,r,this.dependencyTracker.clipBox)),I5(a,l.img,0,0,l.paintWidth,l.paintHeight,0,-r,n,r),l.tmpCanvas&&this.canvasFactory.destroy(l.tmpCanvas),c&&this.canvasFactory.destroy(c),this.compose(),this.restore(e),this.#g(i)}paintInlineImageXObjectGroup(e,t,n){if(!this.contentVisible)return;let r=this.#h(this.current.fillAlpha),i=this.ctx,a,o=null;if(t.bitmap)a=t.bitmap;else{let e=t.width,n=t.height,r=this.canvasFactory.create(e,n);R5(r.context,t),a=this.applyTransferMapsToCanvas(r.context),o=r}this.dependencyTracker?.resetBBox(e);for(let t of n)i.save(),i.transform(...t.transform),i.scale(1,-1),I5(i,a,t.x,t.y,t.w,t.h,0,-1,1,1),this.dependencyTracker?.recordBBox(e,i,0,1,-1,0),i.restore();o&&this.canvasFactory.destroy(o),this.dependencyTracker?.recordOperation(e),this.compose(),this.#g(r)}paintSolidColorImageMask(e){if(!this.contentVisible)return;let t=this.#h(this.current.fillAlpha);this.dependencyTracker?.resetBBox(e).recordBBox(e,this.ctx,0,1,0,1).recordDependencies(e,k8.fill).recordOperation(e),this.ctx.fillRect(0,0,1,1),this.compose(),this.#g(t)}markPoint(e,t){}markPointProps(e,t,n){}beginMarkedContent(e,t){this.dependencyTracker?.beginMarkedContent(e),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t,n){this.dependencyTracker?.beginMarkedContent(e),t===`OC`?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(n)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(e){this.dependencyTracker?.endMarkedContent(e),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(e){}endCompat(e){}consumePath(e,t,n){let r=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(n);let i=this.ctx;this.pendingClip?(r||(this.pendingClip===K5?i.clip(t,`evenodd`):i.clip(t)),this.pendingClip=null,this.dependencyTracker?.bboxToClipBoxDropOperation(e).recordFutureForcedDependency(`clipPath`,e)):this.dependencyTracker?.recordOperation(e),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let e=N6(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{let t=Math.abs(e[0]*e[3]-e[2]*e[1]),n=Math.hypot(e[0],e[2]),r=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(n,r)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){let{lineWidth:e}=this.current,{a:t,b:n,c:r,d:i}=this.ctx.getTransform(),a,o;if(n===0&&r===0){let n=Math.abs(t),r=Math.abs(i);if(n===r)if(e===0)a=o=1/n;else{let t=n*e;a=o=t<1?1/t:1}else if(e===0)a=1/n,o=1/r;else{let t=n*e,i=r*e;a=t<1?1/t:1,o=i<1?1/i:1}}else{let s=Math.abs(t*i-n*r),c=Math.hypot(t,n),l=Math.hypot(r,i);if(e===0)a=l/s,o=c/s;else{let t=e*s;a=l>t?l/t:1,o=c>t?c/t:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(e,t){let{ctx:n,current:{lineWidth:r}}=this,[i,a]=this.getScaleForStroking();if(i===a){n.lineWidth=(r||1)*i,n.stroke(e);return}let o=n.getLineDash();t&&n.save(),n.scale(i,a),N5.a=1/i,N5.d=1/a;let s=new Path2D;if(s.addPath(e,N5),o.length>0){let e=Math.max(i,a);n.setLineDash(o.map(t=>t/e)),n.lineDashOffset/=e}n.lineWidth=r||1,n.stroke(s),t&&n.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};for(let e in P3)q5.prototype[e]!==void 0&&(q5.prototype[P3[e]]=q5.prototype[e]);var J5=class{#e=null;#t=null;_fullReader=null;_rangeReaders=new Set;_source=null;constructor(e,t,n){this._source=e,this.#e=t,this.#t=n}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){return U3(!this._fullReader,`BasePDFStream.getFullReader can only be called once.`),this._fullReader=new this.#e(this)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;let n=new this.#t(this,e,t);return this._rangeReaders.add(n),n}cancelAllRequests(e){this._fullReader?.cancel(e);for(let t of new Set(this._rangeReaders))t.cancel(e)}},Y5=class{onProgress=null;_contentLength=0;_filename=null;_headersCapability=Promise.withResolvers();_isRangeSupported=!1;_isStreamingSupported=!1;_loaded=0;_stream=null;constructor(e){this._stream=e}_callOnProgress(){this.onProgress?.({loaded:this._loaded,total:this._contentLength})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){H3("Abstract method `read` called")}cancel(e){H3("Abstract method `cancel` called")}},X5=class{_stream=null;constructor(e,t,n){this._stream=e}async read(){H3("Abstract method `read` called")}cancel(e){H3("Abstract method `cancel` called")}};function Z5(e){let t=!0,n=r(`filename\\*`,`i`).exec(e);if(n){n=n[1];let e=s(n);return e=unescape(e),e=c(e),e=l(e),a(e)}if(n=o(e),n)return a(l(n));if(n=r(`filename`,`i`).exec(e),n){n=n[1];let e=s(n);return e=l(e),a(e)}function r(e,t){return RegExp(`(?:^|;)\\s*`+e+`\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)`,t)}function i(e,n){if(e){if(!/^[\x00-\xFF]+$/.test(n))return n;try{let r=new TextDecoder(e,{fatal:!0}),i=r6(n);n=r.decode(i),t=!1}catch{}}return n}function a(e){return t&&/[\x80-\xff]/.test(e)&&(e=i(`utf-8`,e),t&&(e=i(`iso-8859-1`,e))),e}function o(e){let t=[],n,i=r(`filename\\*((?!0\\d)\\d+)(\\*?)`,`ig`);for(;(n=i.exec(e))!==null;){let[,e,r,i]=n;if(e=parseInt(e,10),e in t){if(e===0)break;continue}t[e]=[r,i]}let a=[];for(let e=0;e<t.length&&e in t;++e){let[n,r]=t[e];r=s(r),n&&(r=unescape(r),e===0&&(r=c(r))),a.push(r)}return a.join(``)}function s(e){if(e.startsWith(`"`)){let t=e.slice(1).split(`\\"`);for(let e=0;e<t.length;++e){let n=t[e].indexOf(`"`);n!==-1&&(t[e]=t[e].slice(0,n),t.length=e+1),t[e]=t[e].replaceAll(/\\(.)/g,`$1`)}e=t.join(`"`)}return e}function c(e){let t=e.indexOf(`'`);return t===-1?e:i(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,``))}function l(e){return!e.startsWith(`=?`)||/[\x00-\x19\x80-\xff]/.test(e)?e:e.replaceAll(/=\?([\w-]*)\?([QB])\?((?:[^?]|\?(?!=))*)\?=/gi,function(e,t,n,r){if(n===`q`||n===`Q`)return r=r.replaceAll(`_`,` `),r=r.replaceAll(/=([0-9a-f]{2})/gi,function(e,t){return String.fromCharCode(parseInt(t,16))}),i(t,r);try{r=atob(r)}catch{}return i(t,r)})}return``}function Q5(e,t){let n=new Headers;if(!e||!t||typeof t!=`object`)return n;for(let e in t){let r=t[e];r!==void 0&&n.append(e,r)}return n}function $5(e){return URL.parse(e)?.origin??null}function e7({responseHeaders:e,isHttp:t,rangeChunkSize:n,disableRange:r}){let i={contentLength:0,isRangeSupported:!1},a=parseInt(e.get(`Content-Length`),10);return!Number.isInteger(a)||(i.contentLength=a,a<=2*n)||r||!t||e.get(`Accept-Ranges`)!==`bytes`||(e.get(`Content-Encoding`)||`identity`)===`identity`&&(i.isRangeSupported=!0),i}function t7(e){let t=e.get(`Content-Disposition`);if(t){let e=Z5(t);if(e.includes(`%`))try{e=decodeURIComponent(e)}catch{}if(S6(e))return e}return null}function n7(e,t){return new $3(`Unexpected server response (${e}) while retrieving PDF "${t.href}".`,e,e===404||e===0&&t.protocol===`file:`)}function r7(e,t){if(e!==t)throw Error(`Expected range response-origin "${e}" to match "${t}".`)}function i7(e,t,n,r){return fetch(e,{method:`GET`,headers:t,signal:r.signal,mode:`cors`,credentials:n?`include`:`same-origin`,redirect:`follow`})}function a7(e,t){if(e!==200&&e!==206)throw n7(e,t)}function o7(e){if(e instanceof Uint8Array)return e.buffer;if(e instanceof ArrayBuffer)return e;throw Error(`getArrayBuffer - unexpected data: ${e}`)}var s7=class extends J5{_responseOrigin=null;constructor(e){super(e,c7,l7);let{httpHeaders:t,url:n}=e;U3(/https?:/.test(n.protocol),`PDFFetchStream only supports http(s):// URLs.`),this.headers=Q5(!0,t)}},c7=class extends Y5{_abortController=new AbortController;_reader=null;constructor(e){super(e);let{disableRange:t,disableStream:n,rangeChunkSize:r,url:i,withCredentials:a}=e._source;this._isStreamingSupported=!n,i7(i,new Headers(e.headers),a,this._abortController).then(n=>{e._responseOrigin=$5(n.url),a7(n.status,i),this._reader=n.body.getReader();let a=n.headers,{contentLength:o,isRangeSupported:s}=e7({responseHeaders:a,isHttp:!0,rangeChunkSize:r,disableRange:t});this._contentLength=o,this._isRangeSupported=s,this._filename=t7(a),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new t6(`Streaming is disabled.`)),this._headersCapability.resolve()}).catch(this._headersCapability.reject)}async read(){await this._headersCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this._callOnProgress(),{value:o7(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}},l7=class extends X5{_abortController=new AbortController;_readCapability=Promise.withResolvers();_reader=null;constructor(e,t,n){super(e,t,n);let{url:r,withCredentials:i}=e._source,a=new Headers(e.headers);a.append(`Range`,`bytes=${t}-${n-1}`),i7(r,a,i,this._abortController).then(t=>{r7($5(t.url),e._responseOrigin),a7(t.status,r),this._reader=t.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:{value:o7(e),done:!1}}cancel(e){this._reader?.cancel(e),this._abortController.abort()}};function u7(e){return e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer}function d7(){for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}var f7=class extends J5{_progressiveDone=!1;_queuedChunks=[];constructor(e){super(e,p7,m7);let{pdfDataRangeTransport:t}=e,{initialData:n,progressiveDone:r}=t;if(n?.length>0){let e=u7(n);this._queuedChunks.push(e)}this._progressiveDone=r,t.transportReady(e=>{switch(e.type){case`range`:case`progressiveRead`:this.#e(e.begin,e.chunk);break;case`progressiveDone`:this._fullReader?.progressiveDone(),this._progressiveDone=!0;break}})}#e(e,t){let n=u7(t);if(e===void 0)this._fullReader?this._fullReader._enqueue(n):this._queuedChunks.push(n);else{let t=this._rangeReaders.keys().find(t=>t._begin===e);U3(t,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),t._enqueue(n)}}getFullReader(){let e=super.getFullReader();return this._queuedChunks=null,e}getRangeReader(e,t){let n=super.getRangeReader(e,t);return n&&(n.onDone=()=>this._rangeReaders.delete(n),this._source.pdfDataRangeTransport.requestDataRange(e,t)),n}cancelAllRequests(e){super.cancelAllRequests(e),this._source.pdfDataRangeTransport.abort()}},p7=class extends Y5{#e=d7.bind(this);_done=!1;_queuedChunks=null;_requests=[];constructor(e){super(e);let{pdfDataRangeTransport:t,disableRange:n,disableStream:r}=e._source,{length:i,contentDispositionFilename:a}=t;this._queuedChunks=e._queuedChunks||[];for(let e of this._queuedChunks)this._loaded+=e.byteLength;this._done=e._progressiveDone,this._contentLength=i,this._isStreamingSupported=!r,this._isRangeSupported=!n,S6(a)&&(this._filename=a),this._headersCapability.resolve();let o=this._loaded;Promise.resolve().then(()=>{o>0&&this._loaded===o&&this._callOnProgress()})}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength,this._callOnProgress())}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this.#e()}progressiveDone(){this._done||=!0,this._queuedChunks.length===0&&this.#e()}},m7=class extends X5{#e=d7.bind(this);onDone=null;_begin=-1;_done=!1;_queuedChunk=null;_requests=[];constructor(e,t,n){super(e,t,n),this._begin=t}_enqueue(e){this._done||(this._requests.length===0?this._queuedChunk=e:(this._requests.shift().resolve({value:e,done:!1}),this.#e()),this._done=!0,this.onDone?.())}async read(){if(this._queuedChunk){let e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this.#e(),this.onDone?.()}},h7=200,g7=206;function _7(e){return typeof e==`string`?r6(e).buffer:e}var v7=class extends J5{#e=new WeakMap;_responseOrigin=null;constructor(e){super(e,y7,b7);let{httpHeaders:t,url:n}=e;this.url=n,this.isHttp=/https?:/.test(n.protocol),this.headers=Q5(this.isHttp,t)}_request(e){let t=new XMLHttpRequest,n={validateStatus:null,onHeadersReceived:e.onHeadersReceived,onDone:e.onDone,onError:e.onError,onProgress:e.onProgress};this.#e.set(t,n),t.open(`GET`,this.url),t.withCredentials=this._source.withCredentials;for(let[e,n]of this.headers)t.setRequestHeader(e,n);return this.isHttp&&`begin`in e&&`end`in e?(t.setRequestHeader(`Range`,`bytes=${e.begin}-${e.end-1}`),n.validateStatus=e=>e===g7||e===h7):n.validateStatus=e=>e===h7,t.responseType=`arraybuffer`,U3(e.onError,"Expected `onError` callback to be provided."),t.onerror=()=>e.onError(t.status),t.onreadystatechange=this.#n.bind(this,t),t.onprogress=this.#t.bind(this,t),t.send(null),t}#t(e,t){this.#e.get(e)?.onProgress?.(t)}#n(e,t){let n=this.#e.get(e);if(!n||(e.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),e.readyState!==4)||!this.#e.has(e))return;if(this.#e.delete(e),e.status===0&&this.isHttp){n.onError(e.status);return}let r=e.status||h7;if(!n.validateStatus(r)){n.onError(e.status);return}let i=_7(e.response);if(r===g7){let t=e.getResponseHeader(`Content-Range`);/bytes \d+-\d+\/\d+/.test(t)?n.onDone(i):(V3(`Missing or invalid "Content-Range" header.`),n.onError(0))}else i?n.onDone(i):n.onError(e.status)}_abortRequest(e){this.#e.has(e)&&(this.#e.delete(e),e.abort())}getRangeReader(e,t){let n=super.getRangeReader(e,t);return n&&(n.onClosed=()=>this._rangeReaders.delete(n)),n}},y7=class extends Y5{#e=d7.bind(this);_cachedChunks=[];_done=!1;_requests=[];_storedError=null;constructor(e){super(e),this._fullRequestXhr=e._request({onHeadersReceived:this.#t.bind(this),onDone:this.#n.bind(this),onError:this.#r.bind(this),onProgress:this.#i.bind(this)})}#t(){let e=this._stream,{disableRange:t,rangeChunkSize:n}=e._source,r=this._fullRequestXhr;e._responseOrigin=$5(r.responseURL);let i=r.getAllResponseHeaders(),a=new Headers(i?i.trimStart().replace(/[^\S ]+$/,``).split(/[\r\n]+/).map(e=>{let[t,...n]=e.split(`: `);return[t,n.join(`: `)]}):[]),{contentLength:o,isRangeSupported:s}=e7({responseHeaders:a,isHttp:e.isHttp,rangeChunkSize:n,disableRange:t});this._contentLength=o,this._isRangeSupported=s,this._filename=t7(a),this._isRangeSupported&&e._abortRequest(r),this._headersCapability.resolve()}#n(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._cachedChunks.push(e),this._done=!0,this._cachedChunks.length===0&&this.#e()}#r(e){this._storedError=n7(e,this._stream.url),this._headersCapability.reject(this._storedError);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}#i(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e),this.#e(),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}},b7=class extends X5{#e=d7.bind(this);onClosed=null;_done=!1;_queuedChunk=null;_requests=[];_storedError=null;constructor(e,t,n){super(e,t,n),this._requestXhr=e._request({begin:t,end:n,onHeadersReceived:this.#t.bind(this),onDone:this.#n.bind(this),onError:this.#r.bind(this),onProgress:null})}#t(){let e=$5(this._requestXhr?.responseURL);try{r7(e,this._stream._responseOrigin)}catch(e){this._storedError=e,this.#r(0)}}#n(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0,this.#e(),this.onClosed?.()}#r(e){this._storedError??=n7(e,this._stream.url);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){let e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this.#e(),this._stream._abortRequest(this._requestXhr),this.onClosed?.()}};function x7(e,n=null){let r=t.getBuiltinModule(`fs`),{Readable:i}=t.getBuiltinModule(`stream`),a=r.createReadStream(e,n);return i.toWeb(a)}var S7=class extends J5{constructor(e){super(e,C7,w7);let{url:t}=e;U3(t.protocol===`file:`,`PDFNodeStream only supports file:// URLs.`)}},C7=class extends Y5{_reader=null;constructor(e){super(e);let{disableRange:n,disableStream:r,rangeChunkSize:i,url:a}=e._source;this._isStreamingSupported=!r,t.getBuiltinModule(`fs/promises`).lstat(a).then(e=>{let t=x7(a);this._reader=t.getReader();let{size:r}=e;this._contentLength=r,this._isRangeSupported=!n&&r>2*i,!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new t6(`Streaming is disabled.`)),this._headersCapability.resolve()}).catch(e=>{e.code===`ENOENT`&&(e=n7(0,a)),this._headersCapability.reject(e)})}async read(){await this._headersCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this._callOnProgress(),{value:o7(e),done:!1})}cancel(e){this._reader?.cancel(e)}},w7=class extends X5{_readCapability=Promise.withResolvers();_reader=null;constructor(e,t,n){super(e,t,n);let{url:r}=e._source;try{let e=x7(r,{start:t,end:n-1});this._reader=e.getReader(),this._readCapability.resolve()}catch(e){this._readCapability.reject(e)}}async read(){await this._readCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:{value:o7(e),done:!1}}cancel(e){this._reader?.cancel(e)}};function T7(e){return E6(e)?s7:g3?S7:v7}var E7=class{static#e=null;static#t=``;static get workerPort(){return this.#e}static set workerPort(e){if(!(typeof Worker<`u`&&e instanceof Worker)&&e!==null)throw Error("Invalid `workerPort` type.");this.#e=e}static get workerSrc(){return this.#t}static set workerSrc(e){if(typeof e!=`string`)throw Error("Invalid `workerSrc` type.");this.#t=e}},D7=class{#e;#t;constructor({parsedData:e,rawData:t}){this.#e=e,this.#t=t}getRaw(){return this.#t}get(e){return this.#e.get(e)??null}[Symbol.iterator](){return this.#e.entries()}},O7=Symbol(`INTERNAL`),k7=class{#e=!1;#t=!1;#n=!1;#r=!0;constructor(e,{name:t,intent:n,usage:r,rbGroups:i}){this.#e=!!(e&S3.DISPLAY),this.#t=!!(e&S3.PRINT),this.name=t,this.intent=n,this.usage=r,this.rbGroups=i}get visible(){if(this.#n)return this.#r;if(!this.#r)return!1;let{print:e,view:t}=this.usage;return this.#e?t?.viewState!==`OFF`:!this.#t||e?.printState!==`OFF`}_setVisible(e,t,n=!1){e!==O7&&H3("Internal method `_setVisible` called."),this.#n=n,this.#r=t}get serializable(){return{userSet:this.#n,visible:this.#r}}},A7=class e{#e=null;#t=new Map;#n=null;#r=null;#i;creator=null;name=null;constructor(e,t=S3.DISPLAY,n=null){if(this.#i=e,this.renderingIntent=t,e!==null){this.name=e.name,this.creator=e.creator,this.#r=e.order;for(let n of e.groups)this.#t.set(n.id,new k7(t,n));if(n){n.size!==this.#t.size&&H3(`Incorrect serialized groupState.`);for(let[e,t]of n)this.#t.get(e)._setVisible(O7,t.visible,t.userSet)}else{if(e.baseState===`OFF`)for(let e of this.#t.values())e._setVisible(O7,!1);for(let t of e.on)this.#t.get(t)._setVisible(O7,!0);for(let t of e.off)this.#t.get(t)._setVisible(O7,!1)}this.#n=this.getHash()}}#a(e){let t=e.length;if(t<2)return!0;let n=e[0];for(let r=1;r<t;r++){let t=e[r],i;if(Array.isArray(t))i=this.#a(t);else if(this.#t.has(t))i=this.#t.get(t).visible;else return V3(`Optional content group not found: ${t}`),!0;switch(n){case`And`:if(!i)return!1;break;case`Or`:if(i)return!0;break;case`Not`:return!i;default:return!0}}return n===`And`}isVisible(e){if(this.#t.size===0)return!0;if(!e)return B3(`Optional content group not defined.`),!0;if(e.type===`OCG`)return this.#t.has(e.id)?this.#t.get(e.id).visible:(V3(`Optional content group not found: ${e.id}`),!0);if(e.type===`OCMD`){if(e.expression)return this.#a(e.expression);if(!e.policy||e.policy===`AnyOn`){for(let t of e.ids){if(!this.#t.has(t))return V3(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!0}return!1}else if(e.policy===`AllOn`){for(let t of e.ids){if(!this.#t.has(t))return V3(`Optional content group not found: ${t}`),!0;if(!this.#t.get(t).visible)return!1}return!0}else if(e.policy===`AnyOff`){for(let t of e.ids){if(!this.#t.has(t))return V3(`Optional content group not found: ${t}`),!0;if(!this.#t.get(t).visible)return!0}return!1}else if(e.policy===`AllOff`){for(let t of e.ids){if(!this.#t.has(t))return V3(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!1}return!0}return V3(`Unknown optional content policy ${e.policy}.`),!0}return V3(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0,n=!0){let r=this.#t.get(e);if(!r){V3(`Optional content group not found: ${e}`);return}if(n&&t&&r.rbGroups.length)for(let t of r.rbGroups)for(let n of t)n!==e&&this.#t.get(n)?._setVisible(O7,!1,!0);r._setVisible(O7,!!t,!0),this.#e=null}setOCGState({state:e,preserveRB:t}){let n;for(let r of e){switch(r){case`ON`:case`OFF`:case`Toggle`:n=r;continue}let e=this.#t.get(r);if(e)switch(n){case`ON`:this.setVisibility(r,!0,t);break;case`OFF`:this.setVisibility(r,!1,t);break;case`Toggle`:this.setVisibility(r,!e.visible,t);break}}this.#e=null}get hasInitialVisibility(){return this.#n===null||this.getHash()===this.#n}getOrder(){return this.#t.size?this.#r?this.#r.slice():[...this.#t.keys()]:null}getGroup(e){return this.#t.get(e)||null}getHash(){if(this.#e!==null)return this.#e;let e=new m8;for(let[t,n]of this.#t)e.update(`${t}:${n.visible}`);return this.#e=e.hexdigest()}[Symbol.iterator](){return this.#t.entries()}get serializable(){let e=new Map;for(let[t,n]of this.#t)e.set(t,n.serializable);return{data:this.#i,renderingIntent:this.renderingIntent,groupState:e}}static fromSerializable({data:t,renderingIntent:n,groupState:r}){return new e(t,n,r)}},j7=class{#e=null;#t=null;#n=0;#r=null;#i=null;get pagesNumber(){return this.#n}set pagesNumber(e){this.#n!==e&&(this.#n=e,this.#e=null,this.#t=null)}#a(){if(this.#e)return;let e=this.#n,t=this.#e=new Uint32Array(e);for(let n=0;n<e;n++)t[n]=n+1;this.#t=new Int32Array(t)}#o(){let e=new Map,t=this.#e;for(let n=0,r=this.#n;n<r;n++){let r=t[n],i=e.get(r);i?i.push(n+1):e.set(r,[n+1])}return e}movePages(e,t,n){this.#a();let r=this.#e,i=this.#o(),a=t.length,o=new Uint32Array(a),s=0;for(let e=0;e<a;e++){let i=t[e]-1;o[e]=r[i],i<n&&s++}let c=this.#n,l=c-a,u=m6(n-s,0,l);for(let t=0,n=0;t<c;t++)e.has(t+1)||(r[n++]=r[t]);r.copyWithin(u+a,u,l),r.set(o,u),this.#s(i),r.every((e,t)=>e===t+1)&&(this.#e=null)}deletePages(e){this.#a();let t=this.#e,n=this.#o();this.#i={pageNumberToId:t.slice(),pagesNumber:this.#n,prevPageNumbers:this.#t.slice()};let r=this.#n-e.length;this.#n=r;let i=this.#e=new Uint32Array(r);this.#t=new Int32Array(r);let a=0,o=0;for(let n of e){let e=n-1;e!==a&&(i.set(t.subarray(a,e),o),o+=e-a),a=e+1}a<t.length&&i.set(t.subarray(a),o),this.#s(n,new Set(e))}cancelDelete(){this.#i&&=(this.#e=this.#i.pageNumberToId,this.#n=this.#i.pagesNumber,this.#t=this.#i.prevPageNumbers,null)}cleanSavedData(){this.#i=null}copyPages(e){this.#a(),this.#r={pageNumbers:e,pageIds:e.map(e=>this.#e[e-1])}}cancelCopy(){this.#r=null}pastePages(e){this.#a();let t=this.#e,n=this.#o(),{pageNumbers:r,pageIds:i}=this.#r,a=this.#n+r.length;this.#n=a;let o=this.#e=new Uint32Array(a);this.#t=new Int32Array(a),o.set(t.subarray(0,e),0),o.set(i,e),o.set(t.subarray(e),e+r.length),this.#s(n,null,e,r),this.#r=null}#s(e,t=null,n=-1,r=null){let i=this.#t,a=this.#e,o=n+(r?.length??0),s=new Map;for(let c=0,l=this.#n;c<l;c++){if(c>=n&&c<o){i[c]=-r[c-n];continue}let l=a[c],u=e.get(l),d=s.get(l)||0;if(t&&u)for(;d<u.length&&t.has(u[d]);)d++;i[c]=u?.[d],s.set(l,d+1)}}hasBeenAltered(){return this.#e!==null}getPageMappingForSaving(e=null){e??=this.#o();let t=0;for(let n of e.values())t=Math.max(t,n.length);let n=Array(t);for(let e=0;e<t;e++)n[e]={document:null,pageIndices:[],includePages:[]};for(let[t,r]of e)for(let e=0,i=r.length;e<i;e++)n[e].includePages.push([t-1,r[e]-1]);for(let{includePages:e,pageIndices:t}of n){e.sort((e,t)=>e[0]-t[0]);for(let n=0,r=e.length;n<r;n++)t.push(e[n][1]),e[n]=e[n][0]}return n}extractPages(e){e=Array.from(e).sort((e,t)=>e-t);let t=new Map;for(let n=0,r=e.length;n<r;n++){let r=this.getPageId(e[n]);t.getOrInsertComputed(r,d6).push(n+1)}return this.getPageMappingForSaving(t)}getPrevPageNumber(e){return this.#t?.[e-1]??0}getPageNumber(e){if(!this.#e)return e;let t=this.#e;for(let n=0,r=this.#n;n<r;n++)if(t[n]===e)return n+1;return 0}getPageId(e){return this.#e?.[e-1]??e}getMapping(){return this.#e?.subarray(0,this.pagesNumber)}},M7=Symbol(`INITIAL_DATA`),N7=()=>({...Promise.withResolvers(),data:M7}),P7=class{#e=new Map;get(e,t=null){if(t){let n=this.#e.getOrInsertComputed(e,N7);return n.promise.then(()=>t(n.data)),null}let n=this.#e.get(e);if(!n||n.data===M7)throw Error(`Requesting object that isn't resolved yet ${e}.`);return n.data}has(e){let t=this.#e.get(e);return!!t&&t.data!==M7}delete(e){let t=this.#e.get(e);return!t||t.data===M7?!1:(this.#e.delete(e),!0)}resolve(e,t=null){let n=this.#e.getOrInsertComputed(e,N7);if(n.data!==M7)throw Error(`Object already resolved ${e}.`);n.data=t,n.resolve()}clear(){for(let{data:e}of this.#e.values())e?.bitmap?.close();this.#e.clear()}*[Symbol.iterator](){for(let[e,{data:t}]of this.#e)t!==M7&&(yield[e,t])}},Fte=1e5,F7=30,I7=class e{#e=Promise.withResolvers();#t=null;#n=!1;#r=!!globalThis.FontInspector?.enabled;#i=null;#a=null;#o=null;#s=0;#c=0;#l=null;#u=null;#d=0;#f=0;#p=Object.create(null);#m=[];#h=null;#g=[];#_=new WeakMap;#v=null;static#y=new Map;static#b=new Map;static#x=new WeakMap;static#S=null;static#C=new Set;constructor({textContentSource:t,images:n,container:r,viewport:i}){if(t instanceof ReadableStream)this.#h=t;else if(typeof t==`object`)this.#h=new ReadableStream({start(e){e.enqueue(t),e.close()}});else throw Error(`No "textContentSource" parameter specified.`);this.#t=this.#u=r,this.#i=n,this.#f=i.scale*I6.pixelRatio,this.#d=i.rotation,this.#o={div:null,properties:null,ctx:null};let{pageWidth:a,pageHeight:o,pageX:s,pageY:c}=i.rawDims;this.#v=[1,0,0,-1,-s,c+o],this.#c=a,this.#s=o,e.#k(),r.style.setProperty(`--min-font-size`,e.#S),F6(r,i),this.#e.promise.finally(()=>{e.#C.delete(this),this.#o=null,this.#p=null}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:e,isFirefox:t}=i6.platform;return J3(this,`fontFamilyMap`,new Map([[`sans-serif`,`${e&&t?`Calibri, `:``}sans-serif`],[`monospace`,`${e&&t?`Lucida Console, `:``}monospace`]]))}render(){this.#i&&this.#t.append(this.#i.render());let t=()=>{this.#l.read().then(({value:e,done:n})=>{if(n){this.#e.resolve();return}this.#a??=e.lang,Object.assign(this.#p,e.styles),this.#w(e.items),t()},this.#e.reject)};return this.#l=this.#h.getReader(),e.#C.add(this),t(),this.#e.promise}update({viewport:t,onBefore:n=null}){let r=t.scale*I6.pixelRatio,i=t.rotation;if(i!==this.#d&&(n?.(),this.#d=i,F6(this.#u,{rotation:i})),r!==this.#f){n?.(),this.#f=r;let t={div:null,properties:null,ctx:e.#D(this.#a)};for(let e of this.#g)t.properties=this.#_.get(e),t.div=e,this.#E(t)}}cancel(){let e=new t6(`TextLayer task cancelled.`);this.#l?.cancel(e).catch(()=>{}),this.#l=null,this.#e.reject(e)}get textDivs(){return this.#g}get textContentItemsStr(){return this.#m}#w(t){if(this.#n)return;this.#o.ctx??=e.#D(this.#a);let n=this.#g,r=this.#m;for(let e of t){if(n.length>Fte){V3(`Ignoring additional textDivs for performance reasons.`),this.#n=!0;return}if(e.str===void 0){if(e.type===`beginMarkedContentProps`||e.type===`beginMarkedContent`){let t=this.#t;this.#t=document.createElement(`span`),this.#t.classList.add(`markedContent`),e.id&&this.#t.setAttribute(`id`,`${e.id}`),e.tag===`Artifact`&&(this.#t.ariaHidden=!0),t.append(this.#t)}else e.type===`endMarkedContent`&&(this.#t=this.#t.parentNode);continue}r.push(e.str),this.#T(e)}}#T(t){let n=document.createElement(`span`),r={angle:0,canvasWidth:0,hasText:t.str!==``,hasEOL:t.hasEOL,fontSize:0};this.#g.push(n);let i=$.transform(this.#v,t.transform),a=Math.atan2(i[1],i[0]),o=this.#p[t.fontName];o.vertical&&(a+=Math.PI/2);let s=this.#r&&o.fontSubstitution||o.fontFamily;s=e.fontFamilyMap.get(s)||s;let c=Math.hypot(i[2],i[3]),l=c*e.#A(s,o,this.#a),u,d;a===0?(u=i[4],d=i[5]-l):(u=i[4]+l*Math.sin(a),d=i[5]-l*Math.cos(a));let f=n.style;f.left=`${(100*u/this.#c).toFixed(2)}%`,f.top=`${(100*d/this.#s).toFixed(2)}%`,f.setProperty(`--font-height`,`${c.toFixed(2)}px`),f.fontFamily=s,r.fontSize=c,n.setAttribute(`role`,`presentation`),n.textContent=t.str,n.dir=t.dir,this.#r&&(n.dataset.fontName=o.fontSubstitutionLoadedName||t.fontName),a!==0&&(r.angle=180/Math.PI*a);let p=!1;if(t.str.length>1)p=!0;else if(t.str!==` `&&t.transform[0]!==t.transform[3]){let e=Math.abs(t.transform[0]),n=Math.abs(t.transform[3]);e!==n&&Math.max(e,n)/Math.min(e,n)>1.5&&(p=!0)}if(p&&(r.canvasWidth=o.vertical?t.height:t.width),this.#_.set(n,r),this.#o.div=n,this.#o.properties=r,this.#E(this.#o),r.hasText&&this.#t.append(n),r.hasEOL){let e=document.createElement(`br`);e.setAttribute(`role`,`presentation`),this.#t.append(e)}}#E(t){let{div:n,properties:r,ctx:i}=t,{style:a}=n;if(r.canvasWidth!==0&&r.hasText){let{fontFamily:t}=a,{canvasWidth:o,fontSize:s}=r;e.#O(i,s*this.#f,t);let{width:c}=i.measureText(n.textContent);c>0&&a.setProperty(`--scale-x`,o*this.#f/c)}r.angle!==0&&a.setProperty(`--rotate`,`${r.angle}deg`)}static cleanup(){if(!(this.#C.size>0)){this.#y.clear();for(let{canvas:e}of this.#b.values())e.remove();this.#b.clear()}}static#D(e=null){let t=this.#b.get(e||=``);if(!t){let n=document.createElement(`canvas`);n.style.cssText=`position:absolute;top:0;left:0;width:0;height:0;display:none;letter-spacing:normal;word-spacing:normal`,n.lang=e,document.body.append(n),t=n.getContext(`2d`,{alpha:!1,willReadFrequently:!0}),this.#b.set(e,t),this.#x.set(t,{size:0,family:``})}return t}static#O(e,t,n){let r=this.#x.get(e);t===r.size&&n===r.family||(e.font=`${t}px ${n}`,r.size=t,r.family=n)}static#k(){if(this.#S!==null)return;let e=document.createElement(`div`);e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize=`1px`,e.style.position=`absolute`,e.textContent=`X`,document.body.append(e),this.#S=e.getBoundingClientRect().height,e.remove()}static#A(e,t,n){let r=this.#y.get(e);if(r)return r;let i=this.#D(n);i.canvas.width=i.canvas.height=F7,this.#O(i,F7,e);let a=i.measureText(``),o=a.fontBoundingBoxAscent,s=Math.abs(a.fontBoundingBoxDescent);i.canvas.width=i.canvas.height=0;let c=.8;return o?c=o/(o+s):(i6.platform.isFirefox&&V3("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),t.ascent?c=t.ascent:t.descent&&(c=1+t.descent)),this.#y.set(e,c),c}},Ite=100;function L7(e={}){let t=new Lte,{docId:n}=t,r=e.url?H8(e.url):null,i=e.data?U8(e.data):null,a=e.httpHeaders||null,o=e.withCredentials===!0,s=e.password??null,c=e.range instanceof R7?e.range:null,l=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:2**16,u=e.worker instanceof z7?e.worker:null,d=e.verbosity,f=typeof e.docBaseUrl==`string`&&!x6(e.docBaseUrl)?e.docBaseUrl:null,p=W8(e.cMapUrl),m=e.cMapPacked!==!1,h=W8(e.iccUrl),g=W8(e.standardFontDataUrl),_=W8(e.wasmUrl),v=e.stopAtErrors!==!0,y=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,b=typeof e.isOffscreenCanvasSupported==`boolean`?e.isOffscreenCanvasSupported:!g3,x=typeof e.isImageDecoderSupported==`boolean`?e.isImageDecoderSupported:!g3,S=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,C=typeof e.disableFontFace==`boolean`?e.disableFontFace:g3,w=e.fontExtraProperties===!0,T=e.enableXfa===!0,E=e.ownerDocument||globalThis.document,D=e.disableRange===!0,O=e.disableStream===!0,k=e.disableAutoFetch===!0,A=e.pdfBug===!0,j=e.CanvasFactory||(g3?c5:n5),M=e.FilterFactory||(g3?s5:i5),N=e.BinaryDataFactory||(g3?l5:e5),P=e.enableHWA===!0,F=e.enableWebGPU===!0?m5():Promise.resolve(!1),I=e.useWasm!==!1,L=e.pagesMapper||new j7,R=typeof e.useSystemFonts==`boolean`?e.useSystemFonts:!g3&&!C,z=typeof e.useWorkerFetch==`boolean`?e.useWorkerFetch:!!(N===e5&&p&&m&&g&&_&&E6(p,document.baseURI)&&E6(g,document.baseURI)&&E6(_,document.baseURI));R3(d);let B={canvasFactory:new j({ownerDocument:E,enableHWA:P}),filterFactory:new M({docId:n,ownerDocument:E}),binaryDataFactory:z?null:new N({cMapUrl:p,standardFontDataUrl:g,wasmUrl:_})};u||(u=z7.create({verbosity:d,port:E7.workerPort}),t._worker=u);let V={docId:n,apiVersion:`6.1.200`,data:i,password:s,disableAutoFetch:k,rangeChunkSize:l,docBaseUrl:f,enableXfa:T,evaluatorOptions:{maxImageSize:y,disableFontFace:C,ignoreErrors:v,isOffscreenCanvasSupported:b,isImageDecoderSupported:x,canvasMaxAreaInBytes:S,fontExtraProperties:w,useSystemFonts:R,useWasm:I,useWorkerFetch:z,cMapUrl:p,cMapPacked:m,iccUrl:h,standardFontDataUrl:g,wasmUrl:_,hasGPU:!1}},ee={ownerDocument:E,pdfBug:A,styleElement:null,enableHWA:P,loadingParams:{disableAutoFetch:k,enableXfa:T}};return Promise.all([u.promise,F]).then(function([,e]){if(u.destroyed)throw Error(`Worker was destroyed`);V.evaluatorOptions.hasGPU=e;let s=u.messageHandler.sendWithPromise(`GetDocRequest`,V,i?[i.buffer]:null),d;if(!i)if(c)d=new f7({pdfDataRangeTransport:c,disableRange:D,disableStream:O});else if(r)d=new(T7(r))({url:r,httpHeaders:a,withCredentials:o,rangeChunkSize:l,disableRange:D,disableStream:O});else throw Error("getDocument - expected either `data`, `range`, or `url` parameter.");return s.then(e=>{if(u.destroyed)throw Error(`Worker was destroyed`);let r=new Q8(n,e,u.port),i=new Bte(r,t,d,ee,B,L);if(t._transport=i,t.destroyed)throw Error(`Loading aborted`);r.send(`Ready`,null)})}).catch(t._capability.reject).finally(t._setupCapability.resolve),t}var Lte=class e{static#e=0;_capability=Promise.withResolvers();_setupCapability=Promise.withResolvers();_transport=null;_worker=null;docId=`d${e.#e++}`;destroyed=!1;onPassword=null;onProgress=null;get promise(){return this._capability.promise}async destroy(){this.destroyed=!0,this._capability.promise.catch(()=>{});try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._setupCapability.promise,await this._transport?.destroy()}catch(e){throw this._worker?.port&&delete this._worker._pendingDestroy,e}this._transport=null,this._worker?.destroy(),this._worker=null}async getData(){return this._transport.getData()}},R7=class{#e=Promise.withResolvers();#t=null;constructor(e,t,n=!1,r=null){this.length=e,this.initialData=t,this.progressiveDone=n,this.contentDispositionFilename=r}onDataRange(e,t){this.#t({type:`range`,begin:e,chunk:t})}onDataProgressiveRead(e){this.#e.promise.then(()=>{this.#t({type:`progressiveRead`,chunk:e})})}onDataProgressiveDone(){this.#e.promise.then(()=>{this.#t({type:`progressiveDone`})})}transportReady(e){this.#t=e,this.#e.resolve()}requestDataRange(e,t){H3(`Abstract method PDFDataRangeTransport.requestDataRange`)}abort(){}},Rte=class{constructor(e,t){this._pdfInfo=e,this._transport=t}get pagesMapper(){return this._transport.pagesMapper}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return J3(this,`isPureXfa`,!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAttachmentContent(e){return this._transport.getAttachmentContent(e)}getAnnotationsByType(e,t){return this._transport.getAnnotationsByType(e,t)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e=`display`}={}){let{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(t)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}extractPages(e){return this._transport.extractPages(e)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}getRawData(e){return this._transport.getRawData(e)}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}},zte=class e{#e=!1;#t=null;constructor(e,t,n,r,i=!1){this._pageIndex=e,this._pageInfo=t,this._transport=n,this._stats=i?new T6:null,this._pdfBug=i,this.commonObjs=n.commonObjs,this.objs=new P7,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,this.#t=r,this.imageCoordinates=null}clone(t){let n=new e(t,this._pageInfo,this._transport,this.#t,this._pdfBug);return n.clonedFromIndex=this.clonedFromIndex??this._pageIndex,this._transport.updatePage(n),n}get pageNumber(){return this._pageIndex+1}set pageNumber(e){this._pageIndex=e-1,this._transport.updatePage(this)}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:t=this.rotate,offsetX:n=0,offsetY:r=0,dontFlip:i=!1}={}){return new h6({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:t,offsetX:n,offsetY:r,dontFlip:i})}getAnnotations({intent:e=`display`}={}){let{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return J3(this,`isPureXfa`,!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,canvas:t=e.canvas,viewport:n,intent:r=`display`,annotationMode:i=C3.ENABLE,transform:a=null,background:o=null,optionalContentConfigPromise:s=null,annotationCanvasMap:c=null,pageColors:l=null,printAnnotationStorage:u=null,isEditing:d=!1,recordImages:f=!1,recordOperations:p=!1,operationsFilter:m=null}){this._stats?.time(`Overall`);let h=this._transport.getRenderingIntent(r,i,u,d),{renderingIntent:g,cacheKey:_}=h;this.#e=!1,s||=this._transport.getOptionalContentConfig(g);let v=this._intentStates.getOrInsertComputed(_,p6);v.streamReaderCancelTimeout&&=(clearTimeout(v.streamReaderCancelTimeout),null);let y=!!(g&S3.PRINT);v.displayReadyCapability||(v.displayReadyCapability=Promise.withResolvers(),v.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time(`Page Request`),this._pumpOperatorList(h));let b=!!(this._pdfBug&&globalThis.StepperManager?.enabled),x=!!t&&!this.recordedBBoxes&&(p||b),S=!!t&&!this.imageCoordinates&&f,C=e=>{if(v.renderTasks.delete(E),x){let e=E.gfx?.dependencyTracker.take();e&&(E.stepper?.setOperatorBBoxes(e,E.gfx.dependencyTracker.takeDebugMetadata()),p&&(this.recordedBBoxes=e))}S&&!e&&(this.imageCoordinates=E.gfx?.imagesTracker.take()),y&&(this.#e=!0),this.#n(),e?(E.capability.reject(e),this._abortOperatorList({intentState:v,reason:e instanceof Error?e:Error(e)})):E.capability.resolve(),this._stats&&(this._stats.timeEnd(`Rendering`),this._stats.timeEnd(`Overall`),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},w=null,T=null;(x||S)&&(T=new E8(t,v.operatorList.length)),x&&(w=new D8(T,b));let E=new Hte({callback:C,params:{canvas:t,canvasContext:e,dependencyTracker:w??T,imagesTracker:S?new A8(t):null,viewport:n,transform:a,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:v.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!y,pdfBug:this._pdfBug,pageColors:l,enableHWA:this._transport.enableHWA,operationsFilter:m});(v.renderTasks||=new Set).add(E);let D=E.task;return Promise.all([v.displayReadyCapability.promise,s]).then(([e,t])=>{if(this.destroyed){C();return}if(this._stats?.time(`Rendering`),!(t.renderingIntent&g))throw Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");E.initializeGraphics({transparency:e,optionalContentConfig:t}),E.operatorListChanged()}).catch(C),D}getOperatorList({intent:e=`display`,annotationMode:t=C3.ENABLE,printAnnotationStorage:n=null,isEditing:r=!1}={}){function i(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(s))}let a=this._transport.getRenderingIntent(e,t,n,r,!0),o=this._intentStates.getOrInsertComputed(a.cacheKey,p6),s;return o.opListReadCapability||(s=Object.create(null),s.operatorListChanged=i,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||=new Set).add(s),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time(`Page Request`),this._pumpOperatorList(a)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream(`GetTextContent`,{pageId:this.#t.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:t===!0},{highWaterMark:100,size(e){return e.items.length}})}async getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(e=>g6.textContent(e));let t=this.streamTextContent(e),n={items:[],styles:Object.create(null),lang:null};for await(let e of t)n.lang??=e.lang,Object.assign(n.styles,e.styles),n.items.push(...e.items);return n}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let e=[];for(let t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:Error(`Page was destroyed.`),force:!0}),!t.opListReadCapability)for(let n of t.renderTasks)e.push(n.completed),n.cancel();return this.objs.clear(),this.#e=!1,Promise.all(e)}cleanup(e=!1){this.#e=!0;let t=this.#n();return e&&t&&(this._stats&&=new T6),t}#n(){if(!this.#e||this.destroyed)return!1;for(let{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#e=!1,!0}_startRenderPage(e,t){let n=this._intentStates.get(t);n&&(this._stats?.timeEnd(`Page Request`),n.displayReadyCapability?.resolve(e))}_renderPageChunk(e,t){for(let n=0,r=e.length;n<r;n++)t.operatorList.fnArray.push(e.fnArray[n]),t.operatorList.argsArray.push(e.argsArray[n]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(let e of t.renderTasks)e.operatorListChanged();e.lastChunk&&this.#n()}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:n,modifiedIds:r}){let{map:i,transfer:a}=n,o=this._transport.messageHandler.sendWithStream(`GetOperatorList`,{pageId:this.#t.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:i,modifiedIds:r},void 0,a).getReader(),s=this._intentStates.get(t);s.streamReader=o;let c=()=>{o.read().then(({value:e,done:t})=>{if(t){s.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(e,s),c())},e=>{if(s.streamReader=null,!this._transport.destroyed){if(s.operatorList){s.operatorList.lastChunk=!0;for(let e of s.renderTasks)e.operatorListChanged();this.#n()}if(s.displayReadyCapability)s.displayReadyCapability.reject(e);else if(s.opListReadCapability)s.opListReadCapability.reject(e);else throw e}})};c()}_abortOperatorList({intentState:e,reason:t,force:n=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&=(clearTimeout(e.streamReaderCancelTimeout),null),!n){if(e.renderTasks.size>0)return;if(t instanceof b6){let n=Ite;t.extraDelay>0&&t.extraDelay<1e3&&(n+=t.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})},n);return}}if(e.streamReader.cancel(new t6(t.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(let[t,n]of this._intentStates)if(n===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}},z7=class e{#e=Promise.withResolvers();#t=null;#n=null;#r=null;static#i=0;static#a=!1;static#o=new WeakMap;static{g3&&(this.#a=!0,E7.workerSrc||=`./pdf.worker.mjs`),this._isSameOrigin=(e,t)=>{let n=URL.parse(e);if(!n?.origin||n.origin===`null`)return!1;let r=new URL(t,n);return n.origin===r.origin},this._createCDNWrapper=e=>{let t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:`text/javascript`}))}}constructor({name:t=null,port:n=null,verbosity:r=z3()}={}){if(this.name=t,this.destroyed=!1,this.verbosity=r,n){if(e.#o.has(n))throw Error(`Cannot use more than one PDFWorker per port.`);e.#o.set(n,this),this.#c(n)}else this.#l()}get promise(){return this.#e.promise}#s(){this.#e.resolve(),this.#t.send(`configure`,{verbosity:this.verbosity})}get port(){return this.#n}get messageHandler(){return this.#t}#c(e){this.#n=e,this.#t=new Q8(`main`,`worker`,e),this.#t.on(`ready`,()=>{}),this.#s()}#l(){if(e.#a||e.#d){this.#u();return}let{workerSrc:t}=e;try{e._isSameOrigin(window.location,t)||(t=e._createCDNWrapper(new URL(t,window.location).href));let n=new Worker(t,{type:`module`}),r=new Q8(`main`,`worker`,n),i=()=>{a.abort(),r.destroy(),n.terminate(),this.destroyed?this.#e.reject(Error(`Worker was destroyed`)):this.#u()},a=new AbortController;n.addEventListener(`error`,()=>{this.#r||i()},{signal:a.signal}),r.on(`test`,e=>{if(a.abort(),this.destroyed||!e){i();return}this.#t=r,this.#n=n,this.#r=n,this.#s()}),r.on(`ready`,e=>{if(a.abort(),this.destroyed){i();return}try{o()}catch{this.#u()}});let o=()=>{let e=new Uint8Array;r.send(`test`,e,[e.buffer])};o();return}catch{B3(`The worker has been disabled.`)}this.#u()}#u(){e.#a||=(V3(`Setting up fake worker.`),!0),e._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this.#e.reject(Error(`Worker was destroyed`));return}let n=new q8;this.#n=n;let r=`fake${e.#i++}`,i=new Q8(r+`_worker`,r,n);t.setup(i,n),this.#t=new Q8(r,r+`_worker`,n),this.#s()}).catch(e=>{this.#e.reject(Error(`Setting up fake worker failed: "${e.message}".`))})}destroy(){this.destroyed=!0,this.#r?.terminate(),this.#r=null,e.#o.delete(this.#n),this.#n=null,this.#t?.destroy(),this.#t=null}static create(t){let n=this.#o.get(t?.port);if(n){if(n._pendingDestroy)throw Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return n}return new e(t)}static get workerSrc(){if(E7.workerSrc)return E7.workerSrc;throw Error(`No "GlobalWorkerOptions.workerSrc" specified.`)}static get#d(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return J3(this,`_setupFakeWorkerGlobal`,(async()=>this.#d?this.#d:(await ht(()=>import(this.workerSrc),[])).WorkerMessageHandler)())}},Bte=class{downloadInfoCapability=Promise.withResolvers();#e=null;#t=new Map;#n=null;#r=new Map;#i=new Map;#a=new Map;#o=null;constructor(e,t,n,r,i,a){this.messageHandler=e,this.loadingTask=t,this.#n=n,this.commonObjs=new P7,this.fontLoader=new j8({ownerDocument:r.ownerDocument,styleElement:r.styleElement}),this.enableHWA=r.enableHWA,this.loadingParams=r.loadingParams,this._params=r,this.canvasFactory=i.canvasFactory,this.filterFactory=i.filterFactory,this.binaryDataFactory=i.binaryDataFactory,this.pagesMapper=a,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler()}updatePage(e){let{_pageIndex:t}=e;this.#r.set(t,e),this.#i.set(t,Promise.resolve(e))}#s(e,t=null){return this.#t.getOrInsertComputed(e,()=>this.messageHandler.sendWithPromise(e,t))}#c({loaded:e,total:t}){this.loadingTask.onProgress?.({loaded:e,total:t,percent:t?m6(Math.round(e/t*100),0,100):NaN})}get annotationStorage(){return J3(this,`annotationStorage`,new g8)}getRenderingIntent(e,t=C3.ENABLE,n=null,r=!1,i=!1){let a=S3.DISPLAY,o=h8;switch(e){case`any`:a=S3.ANY;break;case`display`:break;case`print`:a=S3.PRINT;break;default:V3(`getRenderingIntent - invalid intent: ${e}`)}let s=a&S3.PRINT&&n instanceof _8?n:this.annotationStorage;switch(t){case C3.DISABLE:a+=S3.ANNOTATIONS_DISABLE;break;case C3.ENABLE:break;case C3.ENABLE_FORMS:a+=S3.ANNOTATIONS_FORMS;break;case C3.ENABLE_STORAGE:a+=S3.ANNOTATIONS_STORAGE,o=s.serializable;break;default:V3(`getRenderingIntent - invalid annotationMode: ${t}`)}r&&(a+=S3.IS_EDITING),i&&(a+=S3.OPLIST);let{ids:c,hash:l}=s.modifiedIds,u=[a,o.hash,l];return{renderingIntent:a,cacheKey:u.join(`_`),annotationStorageSerializable:o,modifiedIds:c}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#o?.reject(Error(`Worker was destroyed during onPassword callback`));let e=[];for(let t of this.#r.values())e.push(t._destroy());this.#r.clear(),this.#i.clear(),this.#a.clear(),Object.hasOwn(this,`annotationStorage`)&&this.annotationStorage.resetModified();let t=this.messageHandler.sendWithPromise(`Terminate`,null);return e.push(t),Promise.all(e).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#t.clear(),this.filterFactory.destroy(),I7.cleanup(),this.#n?.cancelAllRequests(new t6(`Worker was terminated.`)),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:e,loadingTask:t}=this;e.on(`GetReader`,(e,t)=>{U3(this.#n,"GetReader - no `BasePDFStream` instance available."),this.#e=this.#n.getFullReader(),this.#e.onProgress=e=>this.#c(e),t.onPull=()=>{this.#e.read().then(function({value:e,done:n}){if(n){t.close();return}U3(e instanceof ArrayBuffer,`GetReader - expected an ArrayBuffer.`),t.enqueue(new Uint8Array(e),1,[e])}).catch(e=>{t.error(e)})},t.onCancel=e=>{this.#e.cancel(e),t.ready.catch(e=>{if(!this.destroyed)throw e})}}),e.on(`ReaderHeadersReady`,async e=>{await this.#e.headersReady;let{isStreamingSupported:t,isRangeSupported:n,contentLength:r}=this.#e;return t&&n&&(this.#e.onProgress=null),{isStreamingSupported:t,isRangeSupported:n,contentLength:r}}),e.on(`GetRangeReader`,(e,t)=>{U3(this.#n,"GetRangeReader - no `BasePDFStream` instance available.");let n=this.#n.getRangeReader(e.begin,e.end);if(!n){t.close();return}t.onPull=()=>{n.read().then(function({value:e,done:n}){if(n){t.close();return}U3(e instanceof ArrayBuffer,`GetRangeReader - expected an ArrayBuffer.`),t.enqueue(new Uint8Array(e),1,[e])}).catch(e=>{t.error(e)})},t.onCancel=e=>{n.cancel(e),t.ready.catch(e=>{if(!this.destroyed)throw e})}}),e.on(`GetDoc`,({pdfInfo:e})=>{this.pagesMapper.pagesNumber=e.numPages,this._numPages=e.numPages,this._htmlForXfa=e.htmlForXfa,delete e.htmlForXfa,t._capability.resolve(new Rte(e,this))}),e.on(`DocException`,e=>{t._capability.reject(Z8(e))}),e.on(`PasswordRequest`,e=>{this.#o=Promise.withResolvers();try{if(!t.onPassword)throw Z8(e);t.onPassword(e=>{e instanceof Error?this.#o.reject(e):this.#o.resolve({password:e})},e.code)}catch(e){this.#o.reject(e)}return this.#o.promise}),e.on(`DataLoaded`,e=>{this.#c({loaded:e.length,total:e.length}),this.downloadInfoCapability.resolve(e)}),e.on(`StartRenderPage`,e=>{this.destroyed||this.#r.get(e.pageIndex)._startRenderPage(e.transparency,e.cacheKey)}),e.on(`commonobj`,([t,n,r])=>{if(this.destroyed||this.commonObjs.has(t))return null;switch(n){case`Font`:if(`error`in r){let e=r.error;V3(`Error during font loading: ${e}`),this.commonObjs.resolve(t,e);break}let i=new M8(new z8(r),this._params.pdfBug&&globalThis.FontInspector?.enabled?(e,t)=>globalThis.FontInspector.fontAdded(e,t):null,r.charProcOperatorList,r.extra);this.fontLoader.bind(i).catch(()=>e.sendWithPromise(`FontFallback`,{id:t})).finally(()=>{i.fontExtraProperties||i.clearData(),this.commonObjs.resolve(t,i)});break;case`CopyLocalImage`:let{imageRef:a}=r;U3(a,`The imageRef must be defined.`);for(let e of this.#r.values())for(let[,n]of e.objs){if(n?.ref!==a)continue;if(!n.dataLen)return null;let e=structuredClone(n);return this.commonObjs.resolve(t,e),n.dataLen}break;case`FontPath`:this.commonObjs.resolve(t,new V8(r));break;case`Image`:this.commonObjs.resolve(t,r);break;case`Pattern`:let o=new B8(r);this.commonObjs.resolve(t,o.getIR());break;default:throw Error(`Got unknown common object type ${n}`)}return null}),e.on(`obj`,([e,t,n,r])=>{if(this.destroyed)return;let i=this.#r.get(t);if(!i.objs.has(e)){if(i._intentStates.size===0){r?.bitmap?.close();return}switch(n){case`Image`:case`Pattern`:i.objs.resolve(e,r);break;default:throw Error(`Got unknown object type ${n}`)}}}),e.on(`DocProgress`,e=>{this.destroyed||this.#c(e)}),e.on(`FetchBinaryData`,async e=>{if(this.destroyed)throw Error(`Worker was destroyed.`);if(!this.binaryDataFactory)throw Error("`BinaryDataFactory` not initialized, see the `useWorkerFetch` parameter.");return this.binaryDataFactory.fetch(e)})}getData(){return this.messageHandler.sendWithPromise(`GetData`,null)}saveDocument(){this.annotationStorage.size<=0&&V3("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:e,transfer:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise(`SaveDocument`,{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:this.#e?.filename??null},t).finally(()=>{this.annotationStorage.resetModified()})}extractPages(e){let t={pageInfos:e},n,r=globalThis.ImageBitmap;if(typeof r==`function`){let t=Array.isArray(e)?e:[e];for(let e of t)e?.image instanceof r&&(n||=[]).push(e.image)}if(this.annotationStorage.size>0){let e=this.annotationStorage.serializable,{map:r}=e;e.transfer?.length&&(n?n.push(...e.transfer):n=e.transfer);let i=this.pagesMapper.getMapping();if(i){let e=new Map;for(let[t,n]of r){if(n?.pageIndex!==void 0&&n.pageIndex>=0&&n.pageIndex<i.length){let r=i[n.pageIndex]-1;if(r!==n.pageIndex){e.set(t,{...n,pageIndex:r});continue}}e.set(t,n)}r=e}t.annotationStorage=r}return this.messageHandler.sendWithPromise(`ExtractPages`,t,n).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this.pagesMapper.pagesNumber)return Promise.reject(Error(`Invalid page request.`));let t=e-1,n=this.pagesMapper.getPageId(e)-1,r=this.#i.get(t);if(r)return r;let i=this.messageHandler.sendWithPromise(`GetPage`,{pageIndex:n}).then(e=>{if(this.destroyed)throw Error(`Transport destroyed`);e.refStr&&this.#a.set(e.refStr,n);let r=new zte(t,e,this,this.pagesMapper,this._params.pdfBug);return this.#r.set(t,r),r});return this.#i.set(t,i),i}async getPageIndex(e){if(!G8(e))throw Error(`Invalid pageIndex request.`);let t=await this.messageHandler.sendWithPromise(`GetPageIndex`,{num:e.num,gen:e.gen}),n=this.pagesMapper.getPageNumber(t+1);if(n===0)throw Error(`GetPageIndex: page has been removed.`);return n-1}getAnnotations(e,t){return this.messageHandler.sendWithPromise(`GetAnnotations`,{pageIndex:this.pagesMapper.getPageId(e+1)-1,intent:t})}getFieldObjects(){return this.#s(`GetFieldObjects`)}hasJSActions(){return this.#s(`HasJSActions`)}getCalculationOrderIds(){return this.messageHandler.sendWithPromise(`GetCalculationOrderIds`,null)}getDestinations(){return this.messageHandler.sendWithPromise(`GetDestinations`,null)}getDestination(e){return typeof e==`string`?this.messageHandler.sendWithPromise(`GetDestination`,{id:e}):Promise.reject(Error(`Invalid destination request.`))}getPageLabels(){return this.messageHandler.sendWithPromise(`GetPageLabels`,null)}getPageLayout(){return this.messageHandler.sendWithPromise(`GetPageLayout`,null)}getPageMode(){return this.messageHandler.sendWithPromise(`GetPageMode`,null)}getViewerPreferences(){return this.messageHandler.sendWithPromise(`GetViewerPreferences`,null)}getOpenAction(){return this.messageHandler.sendWithPromise(`GetOpenAction`,null)}getAttachments(){return this.messageHandler.sendWithPromise(`GetAttachments`,null)}getAttachmentContent(e){return this.messageHandler.sendWithPromise(`GetAttachmentContent`,e)}getAnnotationsByType(e,t){return this.messageHandler.sendWithPromise(`GetAnnotationsByType`,{types:e,pageIndexesToSkip:t})}getDocJSActions(){return this.#s(`GetDocJSActions`)}getPageJSActions(e){return this.messageHandler.sendWithPromise(`GetPageJSActions`,{pageIndex:this.pagesMapper.getPageId(e+1)-1})}getStructTree(e){return this.messageHandler.sendWithPromise(`GetStructTree`,{pageIndex:this.pagesMapper.getPageId(e+1)-1})}getOutline(){return this.messageHandler.sendWithPromise(`GetOutline`,null)}getOptionalContentConfig(e){return this.#s(`GetOptionalContentConfig`).then(t=>new A7(t,e))}getPermissions(){return this.messageHandler.sendWithPromise(`GetPermissions`,null)}getMetadata(){let e=`GetMetadata`;return this.#t.getOrInsertComputed(e,()=>this.messageHandler.sendWithPromise(e,null).then(e=>({info:e[0],metadata:e[1]?new D7(e[1]):null,contentDispositionFilename:this.#e?.filename??null,contentLength:this.#e?.contentLength??null,hasStructTree:e[2]})))}getMarkInfo(){return this.messageHandler.sendWithPromise(`GetMarkInfo`,null)}getRawData(e){return this.messageHandler.sendWithPromise(`GetRawData`,e)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise(`Cleanup`,null);for(let e of this.#r.values())if(!e.cleanup())throw Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),this.#t.clear(),this.filterFactory.destroy(!0),I7.cleanup()}}cachedPageNumber(e){if(!G8(e))return null;let t=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`,n=this.#a.get(t);if(n>=0){let e=this.pagesMapper.getPageNumber(n+1);if(e!==0)return e}return null}},Vte=class{_internalRenderTask=null;onContinue=null;onError=null;constructor(e){this._internalRenderTask=e}get promise(){return this._internalRenderTask.capability.promise}cancel(e=0){this._internalRenderTask.cancel(null,e)}get separateAnnots(){let{separateAnnots:e}=this._internalRenderTask.operatorList;if(!e)return!1;let{annotationCanvasMap:t}=this._internalRenderTask;return e.form||e.canvas&&t?.size>0}get imageCoordinates(){return this._internalRenderTask.imageCoordinates||null}},Hte=class e{#e=null;static#t=new WeakSet;constructor({callback:e,params:t,objs:n,commonObjs:r,annotationCanvasMap:i,operatorList:a,pageIndex:o,canvasFactory:s,filterFactory:c,useRequestAnimationFrame:l=!1,pdfBug:u=!1,pageColors:d=null,enableHWA:f=!1,operationsFilter:p=null}){this.callback=e,this.params=t,this.objs=n,this.commonObjs=r,this.annotationCanvasMap=i,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=s,this.filterFactory=c,this._pdfBug=u,this.pageColors=d,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=l===!0&&typeof window<`u`,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new Vte(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=t.canvas,this._canvasContext=t.canvas?null:t.canvasContext,this._enableHWA=f,this._dependencyTracker=t.dependencyTracker,this._imagesTracker=t.imagesTracker,this._operationsFilter=p}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:n}){if(this.cancelled)return;if(this._canvas){if(e.#t.has(this._canvas))throw Error(`Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.`);e.#t.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());let{viewport:r,transform:i,background:a,dependencyTracker:o,imagesTracker:s}=this.params,c=this._canvasContext||this._canvas.getContext(`2d`,{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new q5(c,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:n},this.annotationCanvasMap,this.pageColors,o,s),this.gfx.beginDrawing({transform:i,viewport:r,transparency:t,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,n=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#e&&=(window.cancelAnimationFrame(this.#e),null),e.#t.delete(this._canvas),t||=new b6(`Rendering cancelled, page ${this._pageIndex+1}`,n),this.callback(t),this.task.onError?.(t)}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.gfx.dependencyTracker?.growOperationsCount(this.operatorList.fnArray.length),this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#e=window.requestAnimationFrame(()=>{this.#e=null,this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),e.#t.delete(this._canvas),this.callback())))}},B7=`6.1.200`,Ute=`6353acefe`,V7=class e{#e=null;#t=null;#n;#r=null;#i=!1;#a=!1;#o=null;#s;#c=null;#l=null;static#u=null;static get _keyboardManager(){return J3(this,`_keyboardManager`,new r8([[[`Escape`],e.prototype._hideDropdownFromKeyboard],[[`Space`],e.prototype._colorSelectFromKeyboard],[[`ArrowDown`,`ArrowRight`],e.prototype._moveToNext],[[`ArrowUp`,`ArrowLeft`],e.prototype._moveToPrevious],[[`Home`],e.prototype._moveToBeginning],[[`End`],e.prototype._moveToEnd]]))}constructor({editor:t=null,uiManager:n=null}){t?(this.#a=!1,this.#o=t):this.#a=!0,this.#l=t?._uiManager||n,this.#s=this.#l._eventBus,this.#n=t?.color?.toUpperCase()||this.#l?.highlightColors.values().next().value||`#FFFF98`,e.#u||=Object.freeze({blue:`pdfjs-editor-colorpicker-blue`,green:`pdfjs-editor-colorpicker-green`,pink:`pdfjs-editor-colorpicker-pink`,red:`pdfjs-editor-colorpicker-red`,yellow:`pdfjs-editor-colorpicker-yellow`})}renderButton(){let e=this.#e=document.createElement(`button`);e.className=`colorPicker`,e.tabIndex=`0`,e.setAttribute(`data-l10n-id`,`pdfjs-editor-colorpicker-button`),e.ariaHasPopup=`true`,this.#o&&(e.ariaControls=`${this.#o.id}_colorpicker_dropdown`);let t=this.#l._signal;e.addEventListener(`click`,this.#m.bind(this),{signal:t}),e.addEventListener(`keydown`,this.#p.bind(this),{signal:t});let n=this.#t=document.createElement(`span`);return n.className=`swatch`,n.ariaHidden=`true`,n.style.backgroundColor=this.#n,e.append(n),e}renderMainDropdown(){let e=this.#r=this.#d();return e.ariaOrientation=`horizontal`,e.ariaLabelledBy=`highlightColorPickerLabel`,e}#d(){let t=document.createElement(`div`),n=this.#l._signal;t.addEventListener(`contextmenu`,D6,{signal:n}),t.className=`dropdown`,t.role=`listbox`,t.ariaMultiSelectable=`false`,t.ariaOrientation=`vertical`,t.setAttribute(`data-l10n-id`,`pdfjs-editor-colorpicker-dropdown`),this.#o&&(t.id=`${this.#o.id}_colorpicker_dropdown`);for(let[r,i]of this.#l.highlightColors){let a=document.createElement(`button`);a.tabIndex=`0`,a.role=`option`,a.setAttribute(`data-color`,i),a.title=r,a.setAttribute(`data-l10n-id`,e.#u[r]);let o=document.createElement(`span`);a.append(o),o.className=`swatch`,o.style.backgroundColor=i,a.ariaSelected=i===this.#n,a.addEventListener(`click`,this.#f.bind(this,i),{signal:n}),t.append(a)}return t.addEventListener(`keydown`,this.#p.bind(this),{signal:n}),t}#f(e,t){t.stopPropagation(),this.#s.dispatch(`switchannotationeditorparams`,{source:this,type:D3.HIGHLIGHT_COLOR,value:e}),this.updateColor(e)}_colorSelectFromKeyboard(e){if(e.target===this.#e){this.#m(e);return}let t=e.target.getAttribute(`data-color`);t&&this.#f(t,e)}_moveToNext(e){if(!this.#g){this.#m(e);return}if(e.target===this.#e){this.#r.firstElementChild?.focus();return}e.target.nextSibling?.focus()}_moveToPrevious(e){if(e.target===this.#r?.firstElementChild||e.target===this.#e){this.#g&&this._hideDropdownFromKeyboard();return}this.#g||this.#m(e),e.target.previousSibling?.focus()}_moveToBeginning(e){if(!this.#g){this.#m(e);return}this.#r.firstElementChild?.focus()}_moveToEnd(e){if(!this.#g){this.#m(e);return}this.#r.lastElementChild?.focus()}#p(t){e._keyboardManager.exec(this,t)}#m(e){if(this.#g){this.hideDropdown();return}if(this.#i=e.detail===0,this.#c||(this.#c=new AbortController,window.addEventListener(`pointerdown`,this.#h.bind(this),{signal:this.#l.combinedSignal(this.#c)})),this.#e.ariaExpanded=`true`,this.#r){this.#r.classList.remove(`hidden`);return}let t=this.#r=this.#d();this.#e.append(t)}#h(e){this.#r?.contains(e.target)||this.hideDropdown()}hideDropdown(){this.#r?.classList.add(`hidden`),this.#e.ariaExpanded=`false`,this.#c?.abort(),this.#c=null}get#g(){return this.#r&&!this.#r.classList.contains(`hidden`)}_hideDropdownFromKeyboard(){if(!this.#a){if(!this.#g){this.#o?.unselect();return}this.hideDropdown(),this.#e.focus({preventScroll:!0,focusVisible:this.#i})}}updateColor(e){if(this.#t&&(this.#t.style.backgroundColor=e),!this.#r)return;let t=this.#l.highlightColors.values();for(let n of this.#r.children)n.ariaSelected=t.next().value===e.toUpperCase()}destroy(){this.#e?.remove(),this.#e=null,this.#t=null,this.#r?.remove(),this.#r=null}},H7=class e{#e=null;#t=!1;#n=null;#r=null;static#i=null;constructor(t){this.#n=t,this.#r=t._uiManager,e.#i||=Object.freeze({freetext:`pdfjs-editor-color-picker-free-text-input`,ink:`pdfjs-editor-color-picker-ink-input`})}renderButton(){if(this.#e)return this.#e;let{editorType:t,colorType:n,colorAndOpacityType:r,opacityType:i,color:a,opacity:o}=this.#n,s=this.#t=i6.isAlphaColorInputSupported&&i!==void 0,c=this.#e=document.createElement(`input`);if(c.type=`color`,s){c.setAttribute(`alpha`,``);let e=$.hexNums[Math.round((o??1)*255)];c.value=(a||`#000000`)+e}else c.value=a||`#000000`;return c.className=`basicColorPicker`,c.tabIndex=0,c.setAttribute(`data-l10n-id`,e.#i[t]),c.addEventListener(`input`,()=>{if(s){let e=A6(c.value);if(!e)return;let[t,a,o,s]=e,l=$.makeHexColor(t,a,o);r===void 0?(this.#r.updateParams(n,l),this.#r.updateParams(i,s)):this.#r.updateParams(r,{color:l,opacity:s})}else this.#r.updateParams(n,c.value)},{signal:this.#r._signal}),c}update(e){if(this.#e)if(this.#t){let t=$.hexNums[Math.round(this.#n.opacity*255)];this.#e.value=e+t}else this.#e.value=e}updateOpacity(e){if(!this.#e||!this.#t)return;let t=$.hexNums[Math.round(e*255)];this.#e.value=this.#n.color+t}destroy(){this.#e?.remove(),this.#e=null}hideDropdown(){}};function U7(e){return Math.floor(m6(e,0,1)*255).toString(16).padStart(2,`0`)}function W7(e){return m6(e,0,1)*255}var G7=class{static CMYK_G([e,t,n,r]){return[`G`,1-Math.min(1,.3*e+.59*n+.11*t+r)]}static G_CMYK([e]){return[`CMYK`,0,0,0,1-e]}static G_RGB([e]){return[`RGB`,e,e,e]}static G_rgb([e]){return e=W7(e),[e,e,e]}static G_HTML([e]){let t=U7(e);return`#${t}${t}${t}`}static RGB_G([e,t,n]){return[`G`,.3*e+.59*t+.11*n]}static RGB_rgb(e){return e.map(W7)}static RGB_HTML(e){return`#${e.map(U7).join(``)}`}static T_HTML(){return`#00000000`}static T_rgb(){return[null]}static CMYK_RGB([e,t,n,r]){return[`RGB`,1-Math.min(1,e+r),1-Math.min(1,n+r),1-Math.min(1,t+r)]}static CMYK_rgb([e,t,n,r]){return[W7(1-Math.min(1,e+r)),W7(1-Math.min(1,n+r)),W7(1-Math.min(1,t+r))]}static CMYK_HTML(e){let t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,n]){let r=1-e,i=1-t,a=1-n;return[`CMYK`,r,i,a,Math.min(r,i,a)]}},Wte=class{create(e,t,n=!1){if(e<=0||t<=0)throw Error(`Invalid SVG dimensions`);let r=this._createSVG(`svg:svg`);return r.setAttribute(`version`,`1.1`),n||(r.setAttribute(`width`,`${e}px`),r.setAttribute(`height`,`${t}px`)),r.setAttribute(`preserveAspectRatio`,`none`),r.setAttribute(`viewBox`,`0 0 ${e} ${t}`),r}createElement(e){if(typeof e!=`string`)throw Error(`Invalid SVG element type`);return this._createSVG(e)}_createSVG(e){H3("Abstract method `_createSVG` called.")}},K7=class extends Wte{_createSVG(e){return document.createElementNS(x3,e)}},Gte=9,q7=new WeakSet,Kte=new Date().getTimezoneOffset()*60*1e3,J7=class{static create(e){switch(e.data.annotationType){case j3.LINK:return new X7(e);case j3.TEXT:return new Jte(e);case j3.WIDGET:switch(e.data.fieldType){case`Tx`:return new Yte(e);case`Btn`:return e.data.radioButton?new Qte(e):e.data.checkBox?new Zte(e):new $te(e);case`Ch`:return new ene(e);case`Sig`:return new Xte(e)}return new Z7(e);case j3.POPUP:return new Q7(e);case j3.FREETEXT:return new $7(e);case j3.LINE:return new nne(e);case j3.SQUARE:return new rne(e);case j3.CIRCLE:return new ine(e);case j3.POLYLINE:return new e9(e);case j3.CARET:return new one(e);case j3.INK:return new t9(e);case j3.POLYGON:return new ane(e);case j3.HIGHLIGHT:return new n9(e);case j3.UNDERLINE:return new sne(e);case j3.SQUIGGLY:return new cne(e);case j3.STRIKEOUT:return new lne(e);case j3.STAMP:return new r9(e);case j3.FILEATTACHMENT:return new une(e);case j3.RICHMEDIA:case j3.SCREEN:return new i9(e);default:return new Y7(e)}}},Y7=class e{#e=null;#t=!1;#n=null;constructor(e,{isRenderable:t=!1,ignoreBorder:n=!1,createQuadrilaterals:r=!1}={}){this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableComment=e.enableComment,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,this.hasOwnCommentButton=!1,t&&(this.contentElement=this.container=this._createContainer(n)),r&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:e,richText:t}){return!!(e?.str||t?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return e._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){let{data:e}=this,t=this.annotationStorage?.getEditor(e.id);return t?t.getData():e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){let e=this.annotationStorage?.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;let{quadPoints:t,inkLists:n,rect:r}=this.data,i=-1/0,a=-1/0;if(t?.length>=8){for(let e=0;e<t.length;e+=8)t[e+1]>a?(a=t[e+1],i=t[e+2]):t[e+1]===a&&(i=Math.max(i,t[e+2]));return[i,a]}if(n?.length>=1){for(let e of n)for(let t=0,n=e.length;t<n;t+=2)e[t+1]>a?(a=e[t+1],i=e[t]):e[t+1]===a&&(i=Math.max(i,e[t]));if(i!==1/0)return[i,a]}return r?[r[2],r[3]]:null}_normalizePoint(e){let{page:{view:t},viewport:{rawDims:{pageWidth:n,pageHeight:r,pageX:i,pageY:a}}}=this.parent;return e[1]=t[3]-e[1]+t[1],e[0]=100*(e[0]-i)/n,e[1]=100*(e[1]-a)/r,e}get commentText(){let{data:e}=this;return this.annotationStorage.getRawValue(`${T3}${e.id}`)?.popup?.contents||e.contentsObj?.str||``}set commentText(e){let{data:t}=this,n={deleted:!e,contents:e||``};this.annotationStorage.updateEditor(t.id,{popup:n})||this.annotationStorage.setValue(`${T3}${t.id}`,{id:t.id,annotationType:t.annotationType,page:this.parent.page,popup:n,popupRef:t.popupRef,modificationDate:new Date}),e||this.removePopup()}removePopup(){(this.#n?.popup||this.popup)?.remove(),this.#n=this.popup=null}updateEdited(e){if(!this.container)return;e.rect&&(this.#e||={rect:this.data.rect.slice(0)});let{rect:t,popup:n}=e;t&&this.#r(t);let r=this.#n?.popup||this.popup;!r&&n?.text&&(this._createPopup(n),r=this.#n.popup),r&&(r.updateEdited(e),n?.deleted&&(r.remove(),this.#n=null,this.popup=null))}resetEdited(){this.#e&&=(this.#r(this.#e.rect),this.#n?.popup.resetEdited(),null)}#r(e){let{container:{style:t},data:{rect:n,rotation:r},parent:{viewport:{rawDims:{pageWidth:i,pageHeight:a,pageX:o,pageY:s}}}}=this;n?.splice(0,4,...e),t.left=`${100*(e[0]-o)/i}%`,t.top=`${100*(a-e[3]+s)/a}%`,r===0?(t.width=`${100*(e[2]-e[0])/i}%`,t.height=`${100*(e[3]-e[1])/a}%`):this.setRotation(r)}_createContainer(e){let{data:t,parent:{page:n,viewport:r}}=this,i=document.createElement(`section`);i.setAttribute(`data-annotation-id`,t.id),!(this instanceof Z7)&&!(this instanceof X7)&&!(this instanceof i9)&&(i.tabIndex=0);let{style:a}=i;if(a.zIndex=this.parent.zIndex,this.parent.zIndex+=2,t.alternativeText&&(i.title=t.alternativeText),t.noRotate&&i.classList.add(`norotate`),!t.rect||this instanceof Q7){let{rotation:e}=t;return!t.hasOwnCanvas&&e!==0&&this.setRotation(e,i),i}let{width:o,height:s}=this;if(!e&&t.borderStyle.width>0){a.borderWidth=`${t.borderStyle.width}px`;let e=t.borderStyle.horizontalCornerRadius,n=t.borderStyle.verticalCornerRadius;switch((e>0||n>0)&&(a.borderRadius=`calc(${e}px * var(--total-scale-factor)) / calc(${n}px * var(--total-scale-factor))`),t.borderStyle.style){case M3.SOLID:a.borderStyle=`solid`;break;case M3.DASHED:a.borderStyle=`dashed`;break;case M3.BEVELED:V3(`Unimplemented border style: beveled`);break;case M3.INSET:V3(`Unimplemented border style: inset`);break;case M3.UNDERLINE:a.borderBottomStyle=`solid`;break;default:break}let r=t.borderColor||null;r?(this.#t=!0,a.borderColor=$.makeHexColor(...r)):a.borderWidth=0}let c=$.normalizeRect([t.rect[0],n.view[3]-t.rect[1]+n.view[1],t.rect[2],n.view[3]-t.rect[3]+n.view[1]]),{pageWidth:l,pageHeight:u,pageX:d,pageY:f}=r.rawDims;a.left=`${100*(c[0]-d)/l}%`,a.top=`${100*(c[1]-f)/u}%`;let{rotation:p}=t;return t.hasOwnCanvas||p===0?(a.width=`${100*o/l}%`,a.height=`${100*s/u}%`):this.setRotation(p,i),i}setRotation(e,t=this.container){if(!this.data.rect)return;let{pageWidth:n,pageHeight:r}=this.parent.viewport.rawDims,{width:i,height:a}=this;e%180!=0&&([i,a]=[a,i]),t.style.width=`${100*i/n}%`,t.style.height=`${100*a/r}%`,t.setAttribute(`data-main-rotation`,(360-e)%360)}get _commonActions(){let e=(e,t,n)=>{let r=n.detail[e],i=r[0],a=r.slice(1);n.target.style[t]=G7[`${i}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[t]:G7[`${i}_rgb`](a)})};return J3(this,`_commonActions`,{display:e=>{let{display:t}=e.detail,n=t%2==1;this.container.style.visibility=n?`hidden`:`visible`,this.annotationStorage.setValue(this.data.id,{noView:n,noPrint:t===1||t===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{let{hidden:t}=e.detail;this.container.style.visibility=t?`hidden`:`visible`,this.annotationStorage.setValue(this.data.id,{noPrint:t,noView:t})},focus:e=>{setTimeout(()=>e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:t=>{e(`bgColor`,`backgroundColor`,t)},fillColor:t=>{e(`fillColor`,`backgroundColor`,t)},fgColor:t=>{e(`fgColor`,`color`,t)},textColor:t=>{e(`textColor`,`color`,t)},borderColor:t=>{e(`borderColor`,`borderColor`,t)},strokeColor:t=>{e(`strokeColor`,`borderColor`,t)},rotation:e=>{let t=e.detail.rotation;this.setRotation(t),this.annotationStorage.setValue(this.data.id,{rotation:t})}})}_dispatchEventFromSandbox(e,t){let n=this._commonActions;for(let r of Object.keys(t.detail))(e[r]||n[r])?.(t)}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;let t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;let n=this._commonActions;for(let[r,i]of Object.entries(t)){let a=n[r];a&&(a({detail:{[r]:i},target:e}),delete t[r])}}_createQuadrilaterals(){if(!this.container)return;let{quadPoints:e}=this.data;if(!e)return;let[t,n,r,i]=this.data.rect.map(e=>Math.fround(e));if(e.length===8){let[a,o,s,c]=e.subarray(2,6);if(r===a&&i===o&&t===s&&n===c)return}let{style:a}=this.container,o;if(this.#t){let{borderColor:e,borderWidth:t}=a;a.borderWidth=0,o=[`url('data:image/svg+xml;utf8,`,`<svg xmlns="${x3}" preserveAspectRatio="none" viewBox="0 0 1 1">`,`<g fill="transparent" stroke="${e}" stroke-width="${t}">`],this.container.classList.add(`hasBorder`)}let s=r-t,c=i-n,{svgFactory:l}=this,u=l.createElement(`svg`);u.classList.add(`quadrilateralsContainer`),u.setAttribute(`width`,0),u.setAttribute(`height`,0),u.role=`none`;let d=l.createElement(`defs`);u.append(d);let f=l.createElement(`clipPath`),p=`clippath_${this.data.id}`;f.setAttribute(`id`,p),f.setAttribute(`clipPathUnits`,`objectBoundingBox`),d.append(f);for(let n=2,r=e.length;n<r;n+=8){let r=e[n],a=e[n+1],u=e[n+2],d=e[n+3],p=l.createElement(`rect`),m=(u-t)/s,h=(i-a)/c,g=(r-u)/s,_=(a-d)/c;p.setAttribute(`x`,m),p.setAttribute(`y`,h),p.setAttribute(`width`,g),p.setAttribute(`height`,_),f.append(p),o?.push(`<rect vector-effect="non-scaling-stroke" x="${m}" y="${h}" width="${g}" height="${_}"/>`)}this.#t&&(o.push(`</g></svg>')`),a.backgroundImage=o.join(``)),this.container.append(u),this.container.style.clipPath=`url(#${p})`}_createPopup(e=null){let{data:t}=this,n,r;e?(n={str:e.text},r=e.date):(n=t.contentsObj,r=t.modificationDate),this.#n=new Q7({data:{color:t.color,titleObj:t.titleObj,modificationDate:r,contentsObj:n,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]})}get hasPopupElement(){return!!(this.#n||this.popup||this.data.popupRef)}get extraPopupElement(){return this.#n}render(){H3("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){let n=[];if(this._fieldObjects){let r=this._fieldObjects[e];if(r)for(let{page:e,id:i,exportValues:a}of r){if(e===-1||i===t)continue;let r=typeof a==`string`?a:null,o=document.querySelector(`[data-element-id="${i}"]`);if(o&&!q7.has(o)){V3(`_getElementsByName - element not allowed: ${i}`);continue}n.push({id:i,exportValue:r,domElement:o})}return n}for(let r of document.getElementsByName(e)){let{exportValue:e}=r,i=r.getAttribute(`data-element-id`);i!==t&&q7.has(r)&&n.push({id:i,exportValue:e,domElement:r})}return n}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){let e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(let t of e)t.classList.add(`highlightArea`);else e.classList.add(`highlightArea`)}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener(`dblclick`,()=>{this.linkService.eventBus?.dispatch(`switchannotationeditormode`,{source:this,mode:e,editId:t,mustEnterInEditMode:!0})})}updateOC(e){!this.data.oc||!e||(e.isVisible(this.data.oc)?this.show():this.hide())}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}_setBackgroundColor(e){let t=this.data.backgroundColor||null;e.style.backgroundColor=t===null?`transparent`:$.makeHexColor(...t)}},qte=class extends Y7{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.editor=e.editor}render(){return this.container.className=`editorAnnotation`,this.container}createOrUpdatePopup(){let{editor:e}=this;e.hasComment&&this._createPopup(e.comment)}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(e){this.editor.comment=e,e||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.parent.removeAnnotation(this.data.id),this.container.remove(),this.container=null,this.removePopup()}},X7=class extends Y7{constructor(e,t=null){super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){let{data:e,linkService:t}=this,n=document.createElement(`a`);n.setAttribute(`data-element-id`,e.id);let r=!1;return e.url?(t.addLinkAttributes(n,e.url,e.newWindow),r=!0):e.action?(this._bindNamedAction(n,e.action,e.overlaidText),r=!0):e.attachment?(this.#t(n,e.attachmentId,e.attachment,e.overlaidText,e.attachmentDest),r=!0):e.setOCGState?(this.#n(n,e.setOCGState,e.overlaidText),r=!0):e.dest?(this._bindLink(n,e.dest,e.overlaidText),r=!0):(e.actions&&(e.actions.Action||e.actions[`Mouse Up`]||e.actions[`Mouse Down`])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,e),r=!0),e.resetForm?(this._bindResetFormAction(n,e.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(n,``),r=!0)),this.container.classList.add(`linkAnnotation`),r&&(this.contentElement=n,this.container.append(n)),this.container}#e(){this.container.setAttribute(`data-internal-link`,``)}_bindLink(e,t,n=``){e.href=this.linkService.getDestinationHash(t),e.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||t===``)&&this.#e(),n&&(e.title=n)}_bindNamedAction(e,t,n=``){e.href=this.linkService.getAnchorUrl(``),e.onclick=()=>(this.linkService.executeNamedAction(t),!1),n&&(e.title=n),this.#e()}#t(e,t,n,r=``,i=null){e.href=this.linkService.getAnchorUrl(``),n.description?e.title=n.description:r&&(e.title=r);let a=async()=>{let e=await this.linkService.getAttachmentContent(t);e&&this.downloadManager?.openOrDownloadData(e,n.filename,i)};e.onclick=()=>(a(),!1),this.#e()}#n(e,t,n=``){e.href=this.linkService.getAnchorUrl(``),e.onclick=()=>(this.linkService.executeSetOCGState(t),!1),n&&(e.title=n),this.#e()}_bindJSAction(e,t){e.href=this.linkService.getAnchorUrl(``);let n=new Map([[`Action`,`onclick`],[`Mouse Up`,`onmouseup`],[`Mouse Down`,`onmousedown`]]);for(let r of Object.keys(t.actions)){let i=n.get(r);i&&(e[i]=()=>(this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t.id,name:r}}),!1))}t.overlaidText&&(e.title=t.overlaidText),e.onclick||=()=>!1,this.#e()}_bindResetFormAction(e,t){let n=e.onclick;if(n||(e.href=this.linkService.getAnchorUrl(``)),this.#e(),!this._fieldObjects){V3('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),n||(e.onclick=()=>!1);return}e.onclick=()=>{n?.();let{fields:e,refs:r,include:i}=t,a=[];if(e.length!==0||r.length!==0){let t=new Set(r);for(let n of e){let e=this._fieldObjects[n]||[];for(let{id:n}of e)t.add(n)}for(let e of Object.values(this._fieldObjects))for(let n of e)t.has(n.id)===i&&a.push(n)}else for(let e of Object.values(this._fieldObjects))a.push(...e);let o=this.annotationStorage,s=[];for(let e of a){let{id:t}=e;switch(s.push(t),e.type){case`text`:{let n=e.defaultValue||``;o.setValue(t,{value:n});break}case`checkbox`:case`radiobutton`:{let n=e.defaultValue===e.exportValues;o.setValue(t,{value:n});break}case`combobox`:case`listbox`:{let n=e.defaultValue||``;o.setValue(t,{value:n});break}default:continue}let n=document.querySelector(`[data-element-id="${t}"]`);if(n){if(!q7.has(n)){V3(`_bindResetFormAction - element not allowed: ${t}`);continue}n.dispatchEvent(new Event(`resetform`))}}return this.enableScripting&&this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:`app`,ids:s,name:`ResetForm`}}),!1}}},Jte=class extends Y7{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add(`textAnnotation`);let e=document.createElement(`img`);return e.src=this.imageResourcesPath+`annotation-`+this.data.name.toLowerCase()+`.svg`,e.setAttribute(`data-l10n-id`,`pdfjs-text-annotation-type`),e.setAttribute(`data-l10n-args`,JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(e),this.container}},Z7=class extends Y7{render(){return this.container}_getKeyModifier(e){return i6.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,n,r,i){n.includes(`mouse`)?e.addEventListener(n,e=>{this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:this.data.id,name:r,value:i(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})}):e.addEventListener(n,e=>{if(n===`blur`){if(!t.focused||!e.relatedTarget)return;t.focused=!1}else if(n===`focus`){if(t.focused)return;t.focused=!0}i&&this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:this.data.id,name:r,value:i(e)}})})}_setEventListeners(e,t,n,r){for(let[i,a]of n)(a===`Action`||this.data.actions?.[a])&&((a===`Focus`||a===`Blur`)&&(t||={focused:!1}),this._setEventListener(e,t,i,a,r),a===`Focus`&&!this.data.actions?.Blur?this._setEventListener(e,t,`blur`,`Blur`,null):a===`Blur`&&!this.data.actions?.Focus&&this._setEventListener(e,t,`focus`,`Focus`,null))}_setTextStyle(e){let t=[`left`,`center`,`right`],{fontColor:n}=this.data.defaultAppearanceData,r=this.data.defaultAppearanceData.fontSize||Gte,i=e.style,a,o=e=>Math.round(10*e)/10;if(this.data.multiLine){let e=Math.abs(this.data.rect[3]-this.data.rect[1]-2),t=e/(Math.round(e/(b3*r))||1);a=Math.min(r,o(t/b3))}else{let e=Math.abs(this.data.rect[3]-this.data.rect[1]-2);a=Math.min(r,o(e/b3))}i.fontSize=`calc(${a}px * var(--total-scale-factor))`,i.color=$.makeHexColor(...n),this.data.textAlignment!==null&&!this.data.comb&&(i.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute(`required`,!0):e.removeAttribute(`required`),e.setAttribute(`aria-required`,t)}},Yte=class extends Z7{constructor(e){let t=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:t})}setPropertyOnSiblings(e,t,n,r){let i=this.annotationStorage;for(let a of this._getElementsByName(e.name,e.id))a.domElement&&(a.domElement[t]=n),i.setValue(a.id,{[r]:n})}render(){let e=this.annotationStorage,t=this.data.id;this.container.classList.add(`textWidgetAnnotation`);let n=null;if(this.renderForms){let r=e.getValue(t,{value:this.data.fieldValue}),i=r.value||``,a=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;a&&i.length>a&&(i=i.slice(0,a));let o=r.formattedValue||this.data.textContent?.join(`
`)||null;o&&this.data.comb&&(o=o.replaceAll(/\s+/g,``));let s={userValue:i,formattedValue:o,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement(`textarea`),n.textContent=o??i,this.data.doNotScroll&&(n.style.overflowY=`hidden`)):(n=document.createElement(`input`),n.type=this.data.password?`password`:`text`,n.setAttribute(`value`,o??i),this.data.doNotScroll&&(n.style.overflowX=`hidden`)),this.data.hasOwnCanvas&&(this.container.classList.add(`hasOwnCanvas`),e.has(t)&&this.container.classList.add(`sandboxModified`)),q7.add(n),this.contentElement=n,n.setAttribute(`data-element-id`,t),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=0;let{datetimeFormat:c,datetimeType:l,timeStep:u}=this.data,d=!!l&&this.enableScripting;c&&(n.title=c),this._setRequired(n,this.data.required),a&&(n.maxLength=a),n.addEventListener(`input`,r=>{e.setValue(t,{value:r.target.value}),this.setPropertyOnSiblings(n,`value`,r.target.value,`value`),s.formattedValue=null}),n.addEventListener(`resetform`,e=>{let t=this.data.defaultFieldValue??``;n.value=s.userValue=t,s.formattedValue=null});let f=e=>{let{formattedValue:t}=s;t!=null&&(e.target.value=t),e.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener(`focus`,e=>{if(s.focused)return;let{target:t}=e;if(d&&(t.type=l,u&&(t.step=u)),s.userValue){let e=s.userValue;if(d)if(l===`time`){let n=new Date(e);t.value=[n.getHours(),n.getMinutes(),n.getSeconds()].map(e=>e.toString().padStart(2,`0`)).join(`:`)}else t.value=new Date(e-Kte).toISOString().split(l===`date`?`T`:`.`,1)[0];else t.value=e}s.lastCommittedValue=t.value,s.commitKey=1,this.data.actions?.Focus||(s.focused=!0)}),n.addEventListener(`updatefromsandbox`,n=>{this.container.classList.add(`sandboxModified`),this._dispatchEventFromSandbox({value(n){s.userValue=n.detail.value??``,d||e.setValue(t,{value:s.userValue.toString()}),n.target.value=s.userValue},formattedValue(n){let{formattedValue:r}=n.detail;s.formattedValue=r,r!=null&&n.target!==document.activeElement&&(n.target.value=r);let i={formattedValue:r};d&&(i.value=r),e.setValue(t,i)},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:n=>{let{charLimit:r}=n.detail,{target:i}=n;if(r===0){i.removeAttribute(`maxLength`);return}i.setAttribute(`maxLength`,r);let a=s.userValue;!a||a.length<=r||(a=a.slice(0,r),i.value=s.userValue=a,e.setValue(t,{value:a}),this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:a,willCommit:!0,commitKey:1,selStart:i.selectionStart,selEnd:i.selectionEnd}}))}},n)}),n.addEventListener(`keydown`,e=>{s.commitKey=1;let n=-1;if(e.key===`Escape`?n=0:e.key===`Enter`&&!this.data.multiLine?n=2:e.key===`Tab`&&(s.commitKey=3),n===-1)return;let{value:r}=e.target;s.lastCommittedValue!==r&&(s.lastCommittedValue=r,s.userValue=r,this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:r,willCommit:!0,commitKey:n,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}))});let r=f;f=null,n.addEventListener(`blur`,e=>{if(!s.focused||!e.relatedTarget)return;this.data.actions?.Blur||(s.focused=!1);let{target:n}=e,{value:i}=n;if(d){if(i&&l===`time`){let e=i.split(`:`).map(e=>parseInt(e,10));i=new Date(2e3,0,1,e[0],e[1],e[2]||0).valueOf(),n.step=``}else i.includes(`T`)||(i=`${i}T00:00`),i=new Date(i).valueOf();n.type=`text`}s.userValue=i,s.lastCommittedValue!==i&&this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:i,willCommit:!0,commitKey:s.commitKey,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}),r(e)}),this.data.actions?.Keystroke&&n.addEventListener(`beforeinput`,e=>{s.lastCommittedValue=null;let{data:n,target:r}=e,{value:i,selectionStart:a,selectionEnd:o}=r,c=a,l=o;switch(e.inputType){case`deleteWordBackward`:{let e=i.substring(0,a).match(/\w*\W*$/);e&&(c-=e[0].length);break}case`deleteWordForward`:{let e=i.substring(a).match(/^\W*\w*/);e&&(l+=e[0].length);break}case`deleteContentBackward`:a===o&&--c;break;case`deleteContentForward`:a===o&&(l+=1);break}e.preventDefault(),this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:i,change:n||``,willCommit:!1,selStart:c,selEnd:l}})}),this._setEventListeners(n,s,[[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`]],e=>e.target.value)}if(f&&n.addEventListener(`blur`,f),this.data.comb){let e=(this.data.rect[2]-this.data.rect[0])/a;n.classList.add(`comb`),n.style.setProperty(`--comb-width`,`calc(${e}px * var(--total-scale-factor))`);let t=this.data.textAlignment;if(t===1||t===2){let e=()=>{let e=a-n.value.length;n.style.setProperty(`--comb-offset`,`${t===1?e>>1:e}`)};e();for(let t of[`input`,`blur`,`resetform`,`updatefromsandbox`])n.addEventListener(t,e)}}}else n=document.createElement(`div`),n.textContent=this.data.fieldValue,n.style.verticalAlign=`middle`,n.style.display=`table-cell`,this.data.hasOwnCanvas&&(n.hidden=!0);return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}},Xte=class extends Z7{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}},Zte=class extends Z7{constructor(e){super(e,{isRenderable:e.renderForms})}render(){let e=this.annotationStorage,t=this.data,n=t.id,r=e.getValue(n,{value:t.exportValue===t.fieldValue}).value;typeof r==`string`&&(r=r!==`Off`,e.setValue(n,{value:r})),this.container.classList.add(`buttonWidgetAnnotation`,`checkBox`);let i=document.createElement(`input`);return q7.add(i),i.setAttribute(`data-element-id`,n),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type=`checkbox`,i.name=t.fieldName,r&&i.setAttribute(`checked`,!0),i.setAttribute(`exportValue`,t.exportValue),i.tabIndex=0,i.addEventListener(`change`,r=>{let{name:i,checked:a}=r.target;for(let r of this._getElementsByName(i,n)){let n=a&&r.exportValue===t.exportValue;r.domElement&&(r.domElement.checked=n),e.setValue(r.id,{value:n})}e.setValue(n,{value:a})}),i.addEventListener(`resetform`,e=>{let n=t.defaultFieldValue||`Off`;e.target.checked=n===t.exportValue}),this.enableScripting&&this.hasJSActions&&(i.addEventListener(`updatefromsandbox`,t=>{this._dispatchEventFromSandbox({value(t){t.target.checked=t.detail.value!==`Off`,e.setValue(n,{value:t.target.checked})}},t)}),this._setEventListeners(i,null,[[`change`,`Validate`],[`change`,`Action`],[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`]],e=>e.target.checked)),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}},Qte=class extends Z7{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add(`buttonWidgetAnnotation`,`radioButton`);let e=this.annotationStorage,t=this.data,n=t.id,r=e.getValue(n,{value:t.buttonValue!==null&&t.fieldValue===t.buttonValue}).value;if(typeof r==`string`&&(r=r!==t.buttonValue,e.setValue(n,{value:r})),r)for(let r of this._getElementsByName(t.fieldName,n))e.setValue(r.id,{value:!1});let i=document.createElement(`input`);if(q7.add(i),i.setAttribute(`data-element-id`,n),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type=`radio`,i.name=t.fieldName,r&&i.setAttribute(`checked`,!0),i.tabIndex=0,i.addEventListener(`change`,t=>{let{name:r,checked:i}=t.target;for(let t of this._getElementsByName(r,n))e.setValue(t.id,{value:!1});e.setValue(n,{value:i})}),i.addEventListener(`resetform`,e=>{let n=t.defaultFieldValue;e.target.checked=n!=null&&n===t.buttonValue}),this.enableScripting&&this.hasJSActions){let r=t.buttonValue;i.addEventListener(`updatefromsandbox`,t=>{this._dispatchEventFromSandbox({value:t=>{let i=r===t.detail.value;for(let r of this._getElementsByName(t.target.name)){let t=i&&r.id===n;r.domElement&&(r.domElement.checked=t),e.setValue(r.id,{value:t})}}},t)}),this._setEventListeners(i,null,[[`change`,`Validate`],[`change`,`Action`],[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`]],e=>e.target.checked)}return this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}},$te=class extends X7{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){let e=super.render();e.classList.add(`buttonWidgetAnnotation`,`pushButton`);let t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener(`updatefromsandbox`,e=>{this._dispatchEventFromSandbox({},e)})),e}},ene=class extends Z7{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add(`choiceWidgetAnnotation`);let e=this.annotationStorage,t=this.data.id,n=e.getValue(t,{value:this.data.fieldValue}),r=document.createElement(`select`);q7.add(r),r.setAttribute(`data-element-id`,t),r.disabled=this.data.readOnly,this._setRequired(r,this.data.required),r.name=this.data.fieldName,r.tabIndex=0;let i=this.data.combo&&this.data.options.length>0;this.data.combo||(r.size=this.data.options.length,this.data.multiSelect&&(r.multiple=!0)),r.addEventListener(`resetform`,e=>{let t=this.data.defaultFieldValue;for(let e of r.options)e.selected=e.value===t});let a=(e,t)=>{let n=t.replaceAll(` `,`\xA0`);e.textContent=n,n!==t&&e.setAttribute(`display-value`,t)};for(let e of this.data.options){let t=document.createElement(`option`);a(t,e.displayValue),t.value=e.exportValue,n.value.includes(e.exportValue)&&(t.setAttribute(`selected`,!0),i=!1),r.append(t)}let o=null;if(i){let e=document.createElement(`option`);e.value=` `,e.setAttribute(`hidden`,!0),e.setAttribute(`selected`,!0),r.prepend(e),o=()=>{e.remove(),r.removeEventListener(`input`,o),o=null},r.addEventListener(`input`,o)}let s=e=>{let t=e?`value`:`textContent`,{options:n,multiple:i}=r;return i?Array.prototype.filter.call(n,e=>e.selected).map(e=>e[t]):n.selectedIndex===-1?null:n[n.selectedIndex][t]},c=s(!1),l=e=>{let t=e.target.options;return Array.prototype.map.call(t,e=>({displayValue:e.getAttribute(`display-value`)||e.textContent,exportValue:e.value}))};return this.enableScripting&&this.hasJSActions?(r.addEventListener(`updatefromsandbox`,n=>{this._dispatchEventFromSandbox({value(n){o?.();let i=n.detail.value,a=new Set(Array.isArray(i)?i:[i]);for(let e of r.options)e.selected=a.has(e.value);e.setValue(t,{value:s(!0)}),c=s(!1)},multipleSelection(e){r.multiple=!0},remove(n){let i=r.options,a=n.detail.remove;i[a].selected=!1,r.remove(a),i.length>0&&Array.prototype.findIndex.call(i,e=>e.selected)===-1&&(i[0].selected=!0),e.setValue(t,{value:s(!0),items:l(n)}),c=s(!1)},clear(n){for(;r.length!==0;)r.remove(0);e.setValue(t,{value:null,items:[]}),c=s(!1)},insert(n){let{index:i,displayValue:o,exportValue:u}=n.detail.insert,d=r.children[i],f=document.createElement(`option`);a(f,o),f.value=u,d?d.before(f):r.append(f),e.setValue(t,{value:s(!0),items:l(n)}),c=s(!1)},items(n){let{items:i}=n.detail;for(;r.length!==0;)r.remove(0);for(let e of i){let{displayValue:t,exportValue:n}=e,i=document.createElement(`option`);a(i,t),i.value=n,r.append(i)}r.options.length>0&&(r.options[0].selected=!0),e.setValue(t,{value:s(!0),items:l(n)}),c=s(!1)},indices(n){let r=new Set(n.detail.indices);for(let e of n.target.options)e.selected=r.has(e.index);e.setValue(t,{value:s(!0)}),c=s(!1)},editable(e){e.target.disabled=!e.detail.editable}},n)}),r.addEventListener(`input`,n=>{let r=s(!0),i=s(!1);e.setValue(t,{value:r}),n.preventDefault(),this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:c,change:i,changeEx:r,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(r,null,[[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`],[`input`,`Action`],[`input`,`Validate`]],e=>e.target.value)):r.addEventListener(`input`,function(n){e.setValue(t,{value:s(!0)})}),this.data.combo&&this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}},Q7=class extends Y7{constructor(e){let{data:t,elements:n,parent:r}=e,i=!!r._commentManager;if(super(e,{isRenderable:!i&&Y7._hasPopupData(t)}),this.elements=n,i&&Y7._hasPopupData(t)){let e=this.popup=this.#e();for(let t of n)t.popup=e}else this.popup=null}#e(){return new tne({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})}render(){let{container:e}=this;e.classList.add(`popupAnnotation`),e.role=`comment`;let t=this.popup=this.#e(),n=[];for(let e of this.elements)e.popup=t,e.container.ariaHasPopup=`dialog`,n.push(e.data.id),e.addHighlightArea();return this.container.setAttribute(`aria-controls`,n.map(e=>`${w3}${e}`).join(`,`)),this.container}},tne=class{#e=null;#t=this.#P.bind(this);#n=this.#R.bind(this);#r=this.#L.bind(this);#i=this.#I.bind(this);#a=null;#o=null;#s=null;#c=null;#l=null;#u=null;#d=null;#f=!1;#p=null;#m=null;#h=null;#g=null;#_=null;#v=null;#y=null;#b=null;#x=null;#S=null;#C=!1;#w=null;#T=null;constructor({container:e,color:t,elements:n,titleObj:r,modificationDate:i,contentsObj:a,richText:o,parent:s,rect:c,parentRect:l,open:u,commentManager:d=null}){this.#o=e,this.#x=r,this.#s=a,this.#b=o,this.#u=s,this.#a=t,this.#y=c,this.#d=l,this.#l=n,this.#e=d,this.#w=n[0],this.#c=k6.toDateObject(i),this.trigger=n.flatMap(e=>e.getElementsToTriggerPopup()),d||(this.#E(),this.#o.hidden=!0,u&&this.#I())}#E(){if(this.#m)return;this.#m=new AbortController;let{signal:e}=this.#m;for(let t of this.trigger)t.addEventListener(`click`,this.#i,{signal:e}),t.addEventListener(`pointerenter`,this.#r,{signal:e}),t.addEventListener(`pointerleave`,this.#n,{signal:e}),t.classList.add(`popupTriggerArea`);for(let t of this.#l)t.container?.addEventListener(`keydown`,this.#t,{signal:e})}#D(){let e=this.#l.find(e=>e.hasCommentButton);e&&(this.#_=e._normalizePoint(e.commentButtonPosition))}renderCommentButton(){if(this.#g){this.#g.parentNode||this.#w.container.after(this.#g);return}if(this.#_||this.#D(),!this.#_)return;let{signal:e}=this.#m=new AbortController,t=this.#w.hasOwnCommentButton,n=()=>{this.#e.toggleCommentPopup(this,!0,void 0,!t)},r=()=>{this.#e.toggleCommentPopup(this,!1,!0,!t)},i=()=>{this.#e.toggleCommentPopup(this,!1,!1)};if(t){this.#g=this.#w.container;for(let t of this.trigger)t.ariaHasPopup=`dialog`,t.ariaControls=`commentPopup`,t.addEventListener(`keydown`,this.#t,{signal:e}),t.addEventListener(`click`,n,{signal:e}),t.addEventListener(`pointerenter`,r,{signal:e}),t.addEventListener(`pointerleave`,i,{signal:e}),t.classList.add(`popupTriggerArea`)}else{let t=this.#g=document.createElement(`button`);t.className=`annotationCommentButton`;let a=this.#w.container;t.style.zIndex=parseInt(a.style.zIndex,10)+1,t.tabIndex=0,t.ariaHasPopup=`dialog`,t.ariaControls=`commentPopup`,t.setAttribute(`data-l10n-id`,`pdfjs-show-comment-button`),this.#k(),this.#O(),t.addEventListener(`keydown`,this.#t,{signal:e}),t.addEventListener(`click`,n,{signal:e}),t.addEventListener(`pointerenter`,r,{signal:e}),t.addEventListener(`pointerleave`,i,{signal:e}),a.after(t)}}#O(){if(this.#w.extraPopupElement&&!this.#w.editor)return;this.#g||this.renderCommentButton();let[e,t]=this.#_,{style:n}=this.#g;n.left=`calc(${e}%)`,n.top=`calc(${t}% - var(--comment-button-dim))`}#k(){this.#w.extraPopupElement||(this.#g||this.renderCommentButton(),this.#g.style.backgroundColor=this.commentButtonColor||``)}get commentButtonColor(){let{color:e,opacity:t}=this.#w.commentData;return e?this.#u._commentManager.makeCommentColor(e,t):null}focusCommentButton(){setTimeout(()=>{this.#g?.focus()},0)}getData(){let{richText:e,color:t,opacity:n,creationDate:r,modificationDate:i}=this.#w.commentData;return{contentsObj:{str:this.comment},richText:e,color:t,opacity:n,creationDate:r,modificationDate:i}}get elementBeforePopup(){return this.#g}get comment(){return this.#T||=this.#w.commentText,this.#T}set comment(e){e!==this.comment&&(this.#w.commentText=this.#T=e)}focus(){this.#w.container?.focus()}get parentBoundingClientRect(){return this.#w.layer.getBoundingClientRect()}setCommentButtonStates({selected:e,hasPopup:t}){this.#g&&(this.#g.classList.toggle(`selected`,e),this.#g.ariaExpanded=t)}setSelectedCommentButton(e){this.#g.classList.toggle(`selected`,e)}get commentPopupPosition(){if(this.#v)return this.#v;let{x:e,y:t,height:n}=this.#g.getBoundingClientRect(),{x:r,y:i,width:a,height:o}=this.#w.layer.getBoundingClientRect();return[(e-r)/a,(t+n-i)/o]}set commentPopupPosition(e){this.#v=e}hasDefaultPopupPosition(){return this.#v===null}get commentButtonPosition(){return this.#_}get commentButtonWidth(){return this.#g.getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(e){let[t,n]=this.#v||this.commentButtonPosition.map(e=>e/100),r=this.parentBoundingClientRect,{x:i,y:a,width:o,height:s}=r;this.#e.showDialog(null,this,i+t*o,a+n*s,{...e,parentDimensions:r})}render(){if(this.#p)return;let e=this.#p=document.createElement(`div`);if(e.className=`popup`,this.#a){let t=e.style.outlineColor=$.makeHexColor(...this.#a);e.style.backgroundColor=`color-mix(in srgb, ${t} 30%, white)`}let t=document.createElement(`span`);if(t.className=`header`,this.#x?.str){let e=document.createElement(`span`);e.className=`title`,t.append(e),{dir:e.dir,str:e.textContent}=this.#x}if(e.append(t),this.#c){let e=document.createElement(`time`);e.className=`popupDate`,e.setAttribute(`data-l10n-id`,`pdfjs-annotation-date-time-string`),e.setAttribute(`data-l10n-args`,JSON.stringify({dateObj:this.#c.valueOf()})),e.dateTime=this.#c.toISOString(),t.append(e)}q6({html:this.#A||this.#s.str,dir:this.#s?.dir,className:`popupContent`},e),this.#o.append(e)}get#A(){let e=this.#b,t=this.#s;return e?.str&&(!t?.str||t.str===e.str)&&this.#b.html||null}get#j(){return this.#A?.attributes?.style?.fontSize||0}get#M(){return this.#A?.attributes?.style?.color||null}#N(e){let t=[],n={str:e,html:{name:`div`,attributes:{dir:`auto`},children:[{name:`p`,children:t}]}},r={style:{color:this.#M,fontSize:this.#j?`calc(${this.#j}px * var(--total-scale-factor))`:``}};for(let n of e.split(`
`))t.push({name:`span`,value:n,attributes:r});return n}#P(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key===`Enter`||e.key===`Escape`&&this.#f)&&this.#I()}updateEdited({rect:e,popup:t,deleted:n}){if(this.#e){n?(this.remove(),this.#T=null):t&&(t.deleted?this.remove():(this.#k(),this.#T=t.text)),e&&(this.#_=null,this.#D(),this.#O());return}if(n||t?.deleted){this.remove();return}this.#E(),this.#S||={contentsObj:this.#s,richText:this.#b},e&&(this.#h=null),t&&t.text&&(this.#b=this.#N(t.text),this.#c=k6.toDateObject(t.date),this.#s=null),this.#p?.remove(),this.#p=null}resetEdited(){this.#S&&({contentsObj:this.#s,richText:this.#b}=this.#S,this.#S=null,this.#p?.remove(),this.#p=null,this.#h=null)}remove(){if(this.#m?.abort(),this.#m=null,this.#p?.remove(),this.#p=null,this.#C=!1,this.#f=!1,this.#g?.remove(),this.#g=null,this.trigger)for(let e of this.trigger)e.classList.remove(`popupTriggerArea`)}#F(){if(this.#h!==null)return;let{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:n,pageX:r,pageY:i}}}=this.#u,a=!!this.#d,o=a?this.#d:this.#y;for(let e of this.#l)if(!o||$.intersect(e.data.rect,o)!==null){o=e.data.rect,a=!0;break}let s=$.normalizeRect([o[0],e[3]-o[1]+e[1],o[2],e[3]-o[3]+e[1]]),c=a?o[2]-o[0]+5:0,l=s[0]+c,u=s[1];this.#h=[100*(l-r)/t,100*(u-i)/n];let{style:d}=this.#o;d.left=`${this.#h[0]}%`,d.top=`${this.#h[1]}%`}#I(){if(this.#e){this.#e.toggleCommentPopup(this,!1);return}this.#f=!this.#f,this.#f?(this.#L(),this.#o.addEventListener(`click`,this.#i),this.#o.addEventListener(`keydown`,this.#t)):(this.#R(),this.#o.removeEventListener(`click`,this.#i),this.#o.removeEventListener(`keydown`,this.#t))}#L(){this.#p||this.render(),this.isVisible?this.#f&&this.#o.classList.add(`focused`):(this.#F(),this.#o.hidden=!1,this.#o.style.zIndex=parseInt(this.#o.style.zIndex,10)+1e3)}#R(){this.#o.classList.remove(`focused`),!(this.#f||!this.isVisible)&&(this.#o.hidden=!0,this.#o.style.zIndex=parseInt(this.#o.style.zIndex,10)-1e3)}forceHide(){this.#C=this.isVisible,this.#C&&(this.#o.hidden=!0)}maybeShow(){this.#e||(this.#E(),this.#C&&(this.#p||this.#L(),this.#C=!1,this.#o.hidden=!1))}get isVisible(){return!this.#e&&this.#o.hidden===!1}},$7=class extends Y7{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=E3.FREETEXT}render(){if(this.container.classList.add(`freeTextAnnotation`),this.textContent){let e=this.contentElement=document.createElement(`div`);e.classList.add(`annotationTextContent`),e.setAttribute(`role`,`comment`);for(let t of this.textContent){let n=document.createElement(`span`);n.textContent=t,e.append(n)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}},nne=class extends Y7{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add(`lineAnnotation`);let{data:e,width:t,height:n}=this,r=this.svgFactory.create(t,n,!0),i=this.#e=this.svgFactory.createElement(`svg:line`);return i.setAttribute(`x1`,e.rect[2]-e.lineCoordinates[0]),i.setAttribute(`y1`,e.rect[3]-e.lineCoordinates[1]),i.setAttribute(`x2`,e.rect[2]-e.lineCoordinates[2]),i.setAttribute(`y2`,e.rect[3]-e.lineCoordinates[3]),i.setAttribute(`stroke-width`,e.borderStyle.width||1),i.setAttribute(`stroke`,`transparent`),i.setAttribute(`fill`,`transparent`),r.append(i),this.container.append(r),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}},rne=class extends Y7{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add(`squareAnnotation`);let{data:e,width:t,height:n}=this,r=this.svgFactory.create(t,n,!0),i=e.borderStyle.width,a=this.#e=this.svgFactory.createElement(`svg:rect`);return a.setAttribute(`x`,i/2),a.setAttribute(`y`,i/2),a.setAttribute(`width`,t-i),a.setAttribute(`height`,n-i),a.setAttribute(`stroke-width`,i||1),a.setAttribute(`stroke`,`transparent`),a.setAttribute(`fill`,`transparent`),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}},ine=class extends Y7{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add(`circleAnnotation`);let{data:e,width:t,height:n}=this,r=this.svgFactory.create(t,n,!0),i=e.borderStyle.width,a=this.#e=this.svgFactory.createElement(`svg:ellipse`);return a.setAttribute(`cx`,t/2),a.setAttribute(`cy`,n/2),a.setAttribute(`rx`,t/2-i/2),a.setAttribute(`ry`,n/2-i/2),a.setAttribute(`stroke-width`,i||1),a.setAttribute(`stroke`,`transparent`),a.setAttribute(`fill`,`transparent`),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}},e9=class extends Y7{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName=`polylineAnnotation`,this.svgElementName=`svg:polyline`}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,vertices:t,borderStyle:n,popupRef:r},width:i,height:a}=this;if(!t)return this.container;let o=this.svgFactory.create(i,a,!0),s=[];for(let n=0,r=t.length;n<r;n+=2){let r=t[n]-e[0],i=e[3]-t[n+1];s.push(`${r},${i}`)}s=s.join(` `);let c=this.#e=this.svgFactory.createElement(this.svgElementName);return c.setAttribute(`points`,s),c.setAttribute(`stroke-width`,n.width||1),c.setAttribute(`stroke`,`transparent`),c.setAttribute(`fill`,`transparent`),o.append(c),this.container.append(o),!r&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}},ane=class extends e9{constructor(e){super(e),this.containerClassName=`polygonAnnotation`,this.svgElementName=`svg:polygon`}},one=class extends Y7{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add(`caretAnnotation`),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}},t9=class extends Y7{#e=null;#t=[];constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName=`inkAnnotation`,this.svgElementName=`svg:polyline`,this.annotationEditorType=this.data.it===`InkHighlight`?E3.HIGHLIGHT:E3.INK}#n(e,t){switch(e){case 90:return{transform:`rotate(90) translate(${-t[0]},${t[1]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};case 180:return{transform:`rotate(180) translate(${-t[2]},${t[1]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]};case 270:return{transform:`rotate(270) translate(${-t[2]},${t[3]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};default:return{transform:`translate(${-t[0]},${t[3]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]}}}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,rotation:t,inkLists:n,borderStyle:r,popupRef:i}}=this,{transform:a,width:o,height:s}=this.#n(t,e),c=this.svgFactory.create(o,s,!0),l=this.#e=this.svgFactory.createElement(`svg:g`);c.append(l),l.setAttribute(`stroke-width`,r.width||1),l.setAttribute(`stroke-linecap`,`round`),l.setAttribute(`stroke-linejoin`,`round`),l.setAttribute(`stroke-miterlimit`,10),l.setAttribute(`stroke`,`transparent`),l.setAttribute(`fill`,`transparent`),l.setAttribute(`transform`,a);for(let e=0,t=n.length;e<t;e++){let t=this.svgFactory.createElement(this.svgElementName);this.#t.push(t),t.setAttribute(`points`,n[e].join(`,`)),l.append(t)}return!i&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(c),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);let{thickness:t,points:n,rect:r}=e,i=this.#e;if(t>=0&&i.setAttribute(`stroke-width`,t||1),n)for(let e=0,t=this.#t.length;e<t;e++)this.#t[e].setAttribute(`points`,n[e].join(`,`));if(r){let{transform:e,width:t,height:n}=this.#n(this.data.rotation,r);i.parentElement.setAttribute(`viewBox`,`0 0 ${t} ${n}`),i.setAttribute(`transform`,e)}}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add(`highlightArea`)}},n9=class extends Y7{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=E3.HIGHLIGHT}render(){let{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add(`highlightAnnotation`),this._editOnDoubleClick(),e){let t=document.createElement(`mark`);t.classList.add(`overlaidText`),t.textContent=e,this.container.append(t)}return this.container}},sne=class extends Y7{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add(`underlineAnnotation`),e){let t=document.createElement(`u`);t.classList.add(`overlaidText`),t.textContent=e,this.container.append(t)}return this.container}},cne=class extends Y7{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add(`squigglyAnnotation`),e){let t=document.createElement(`u`);t.classList.add(`overlaidText`),t.textContent=e,this.container.append(t)}return this.container}},lne=class extends Y7{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add(`strikeoutAnnotation`),e){let t=document.createElement(`s`);t.classList.add(`overlaidText`),t.textContent=e,this.container.append(t)}return this.container}},r9=class extends Y7{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=E3.STAMP}render(){return this.container.classList.add(`stampAnnotation`),this.container.setAttribute(`role`,`img`),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}},une=class extends Y7{#e=null;constructor(e){super(e,{isRenderable:!0});let{fileId:t,file:n}=this.data;this.filename=n.filename,this.content=n.content,this.fileId=t,this.linkService.eventBus?.dispatch(`fileattachmentannotation`,{source:this,attachmentId:this.fileId,...n})}render(){this.container.classList.add(`fileAttachmentAnnotation`);let{container:e,data:t}=this,n;t.hasAppearance||t.fillAlpha===0?n=document.createElement(`div`):(n=document.createElement(`img`),n.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(t.name)?`paperclip`:`pushpin`}.svg`,t.fillAlpha&&t.fillAlpha<1&&(n.style=`filter: opacity(${Math.round(t.fillAlpha*100)}%);`)),n.addEventListener(`dblclick`,this.#t.bind(this)),this.#e=n;let{isMac:r}=i6.platform;return e.addEventListener(`keydown`,e=>{e.key===`Enter`&&(r?e.metaKey:e.ctrlKey)&&this.#t()}),!t.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):n.classList.add(`popupTriggerArea`),e.append(n),e}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}async#t(){let{fileId:e,filename:t,content:n}=this,r=await this.linkService.getAttachmentContent(e)||n;r&&this.downloadManager?.openOrDownloadData(r,t)}},i9=class extends Y7{#e=new AbortController;#t=null;#n=null;constructor(e){super(e,{isRenderable:!!e.data.richMedia})}render(){this.container.classList.add(`mediaAnnotation`);let{filename:e}=this.data.richMedia,t=document.createElement(`button`);return t.className=`mediaPlayButton`,t.type=`button`,t.title=t.ariaLabel=e,t.addEventListener(`click`,()=>this.#r(t),{signal:this.#e.signal}),this.container.append(t),this.container}async#r(e){let{fileId:t,filename:n,contentType:r}=this.data.richMedia;e.disabled=!0;let i;try{i=await this.linkService.getAttachmentContent(t)}catch{return}finally{e.disabled=!1}if(!i||!e.isConnected)return;let{signal:a}=this.#e,o=URL.createObjectURL(new Blob([i],{type:r}));this.#t=o;let s=r.startsWith(`audio/`),c=document.createElement(s?`audio`:`video`);if(this.#n=c,c.className=`mediaContent`,this._setBackgroundColor(c),c.src=o,c.title=n,c.controls=!0,c.autoplay=!0,c.tabIndex=0,s){let e=!1,t=!1,n=()=>{c.controls=e||t};this.container.addEventListener(`pointerenter`,()=>{e=!0,n()},{signal:a}),this.container.addEventListener(`pointerleave`,()=>{e=!1,n()},{signal:a}),this.container.addEventListener(`focusin`,()=>{t=!0,n()},{signal:a}),this.container.addEventListener(`focusout`,()=>{t=!1,n()},{signal:a})}c.addEventListener(`emptied`,()=>this.#i(o),{once:!0,signal:a}),e.replaceWith(c),c.play().catch(()=>{})}#i(e=this.#t){e&&e===this.#t&&(URL.revokeObjectURL(e),this.#t=null)}destroy(){this.#e.abort(),this.#n&&=(this.#n.pause(),this.#n.removeAttribute(`src`),this.#n.load(),null),this.#i()}},dne=class e{#e=null;#t=null;#n=null;#r=new Map;#i=null;#a=null;#o=[];#s=!1;zIndex=0;constructor({div:e,accessibilityManager:t,annotationCanvasMap:n,annotationEditorUIManager:r,page:i,viewport:a,structTreeLayer:o,commentManager:s,linkService:c,annotationStorage:l}){this.div=e,this.#e=t,this.#t=n,this.#i=o||null,this.#a=c||null,this.#n=l||new g8,this.page=i,this.viewport=a,this._annotationEditorUIManager=r,this._commentManager=s||null}hasEditableAnnotations(){return this.#r.size>0}async render(e){let{annotations:t,optionalContentConfig:n}=e,r=this.div;F6(r,this.viewport);let i=new Map,a=[],o={data:null,layer:r,linkService:this.#a,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||``,renderForms:e.renderForms!==!1,svgFactory:new K7,annotationStorage:this.#n,enableComment:e.enableComment===!0,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(let e of t){if(e.noHTML)continue;let t=e.annotationType===j3.POPUP;if(t){let t=i.get(e.id);if(!t)continue;if(!this._commentManager){a.push(e);continue}o.elements=t}else if(e.rect[2]===e.rect[0]||e.rect[3]===e.rect[1])continue;o.data=e;let r=J7.create(o);if(!r.isRenderable)continue;t||(this.#o.push(r),e.popupRef&&i.getOrInsertComputed(e.popupRef,d6).push(r));let s=r.render();e.hidden&&(s.style.visibility=`hidden`),r.updateOC(n),r._isEditable&&(this.#r.set(r.data.id,r),this._annotationEditorUIManager?.renderAnnotationElement(r))}await this.#c();for(let e of a){let t=o.elements=i.get(e.id);o.data=e;let n=J7.create(o);if(!n.isRenderable)continue;let r=n.render();n.contentElement.id=`${w3}${e.id}`,e.hidden&&(r.style.visibility=`hidden`),t.at(-1).container.after(r)}this.#l()}async#c(){if(this.#o.length===0)return;this.div.replaceChildren();let e=[];if(!this.#s){this.#s=!0;for(let{contentElement:t,data:{id:n}}of this.#o){let r=t.id=`${w3}${n}`;e.push(this.#i?.getAriaAttributes(r).then(e=>{if(e)for(let[n,r]of e)t.setAttribute(n,r)}))}}this.#o.sort(({data:{rect:[e,t,n,r]}},{data:{rect:[i,a,o,s]}})=>{if(e===n&&t===r)return 1;if(i===o&&a===s)return-1;let c=r,l=t,u=(t+r)/2,d=s,f=a,p=(a+s)/2;return u>=d&&p<=l?-1:p>=c&&u<=f?1:(e+n)/2-(i+o)/2});let t=document.createDocumentFragment();for(let e of this.#o)t.append(e.container),this._commentManager?(e.extraPopupElement?.popup||e.popup)?.renderCommentButton():e.extraPopupElement&&t.append(e.extraPopupElement.render());if(this.div.append(t),await Promise.all(e),this.#e)for(let e of this.#o)this.#e.addPointerInTextLayer(e.contentElement,!1)}async addLinkAnnotations(t){let n={data:null,layer:this.div,linkService:this.#a,svgFactory:new K7,parent:this};for(let r of t){r.borderStyle||=e._defaultBorderStyle,n.data=r;let t=J7.create(n);t.isRenderable&&(t.render(),t.contentElement.id=`${w3}${r.id}`,this.#o.push(t))}await this.#c()}update({viewport:e,optionalContentConfig:t}){let n=this.div;this.viewport=e,F6(n,{rotation:e.rotation});for(let e of this.#o)e.updateOC(t);this.#l(),n.hidden=!1}destroy(){for(let e of this.#o)e.destroy?.(),this.#e?.removePointerInTextLayer(e.contentElement);this.#o.length=0,this.#r.clear(),this.div.replaceChildren()}#l(){if(!this.#t)return;let e=this.div;for(let[t,n]of this.#t){let r=e.querySelector(`[data-annotation-id="${t}"]`);if(!r)continue;if(Array.isArray(n))for(let e of n)e.className=`annotationContent`,e.ariaHidden=!0;else n.className=`annotationContent`,n.ariaHidden=!0;let i=[];for(let e of r.children)e.nodeName===`CANVAS`&&i.push(e);for(let e of i)e.remove();let a=Array.isArray(n)?n[0]:n,{firstChild:o}=r;if(o?o.classList.contains(`annotationContent`)?o.after(a):o.before(a):r.append(a),Array.isArray(n)){let e=a;for(let t=1,r=n.length;t<r;t++)e.after(n[t]),e=n[t]}this.#t.delete(t);let s=this.#r.get(t);s&&(s._hasNoCanvas?(this._annotationEditorUIManager?.setMissingCanvas(t,r.id,n),s._hasNoCanvas=!1):s.canvas=n)}}refreshCanvases(){this.#l()}getEditableAnnotations(){return this.#r.values()}getEditableAnnotation(e){return this.#r.get(e)}addFakeAnnotation(e){let{div:t}=this,{id:n,rotation:r}=e,i=new qte({data:{id:n,rect:e.getPDFRect(),rotation:r},editor:e,layer:t,parent:this,enableComment:!!this._commentManager,linkService:this.#a,annotationStorage:this.#n});return i.render(),i.contentElement.id=`${w3}${n}`,i.createOrUpdatePopup(),this.#o.push(i),i}removeAnnotation(e){let t=this.#o.findIndex(t=>t.data.id===e);if(t<0)return;let[n]=this.#o.splice(t,1);this.#e?.removePointerInTextLayer(n.contentElement)}updateFakeAnnotations(e){if(e.length!==0){for(let t of e)t.updateFakeAnnotationElement(this);this.#c()}}togglePointerEvents(e=!1){this.div.classList.toggle(`disabled`,!e)}static get _defaultBorderStyle(){return J3(this,`_defaultBorderStyle`,Object.freeze({width:1,rawWidth:1,style:M3.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},a9=/\r\n?|\n/g,fne=class e extends l8{#e=``;#t=`${this.id}-editor`;#n=null;#r;_colorPicker=null;static _freeTextDefaultContent=``;static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){let t=e.prototype,n=e=>e.isEmpty(),r=a8.TRANSLATE_SMALL,i=a8.TRANSLATE_BIG;return J3(this,`_keyboardManager`,new r8([[[`ctrl+s`,`mac+meta+s`,`ctrl+p`,`mac+meta+p`],t.commitOrRemove,{bubbles:!0}],[[`ctrl+Enter`,`mac+meta+Enter`],t.commitOrRemove],[[`Escape`],t.commitOrRemove],[[`ArrowLeft`],t._translateEmpty,{args:[-r,0],checker:n}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],t._translateEmpty,{args:[-i,0],checker:n}],[[`ArrowRight`],t._translateEmpty,{args:[r,0],checker:n}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],t._translateEmpty,{args:[i,0],checker:n}],[[`ArrowUp`],t._translateEmpty,{args:[0,-r],checker:n}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],t._translateEmpty,{args:[0,-i],checker:n}],[[`ArrowDown`],t._translateEmpty,{args:[0,r],checker:n}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],t._translateEmpty,{args:[0,i],checker:n}]]))}static _type=`freetext`;static _editorType=E3.FREETEXT;constructor(t){super({...t,name:`freeTextEditor`}),this.color=t.color||e._defaultColor||l8._defaultLineColor,this.#r=t.fontSize||e._defaultFontSize,this.annotationElementId||this._uiManager.a11yAlert(l8._l10nAlert.freetext),this.canAddComment=!1}static initialize(e,t){l8.initialize(e,t);let n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue(`--freetext-padding`))}static updateDefaultParams(t,n){switch(t){case D3.FREETEXT_SIZE:e._defaultFontSize=n;break;case D3.FREETEXT_COLOR:e._defaultColor=n;break}}updateParams(e,t){switch(e){case D3.FREETEXT_SIZE:this.#i(t);break;case D3.FREETEXT_COLOR:this.#a(t);break}}static get defaultPropertiesToUpdate(){return[[D3.FREETEXT_SIZE,e._defaultFontSize],[D3.FREETEXT_COLOR,e._defaultColor||l8._defaultLineColor]]}get propertiesToUpdate(){return[[D3.FREETEXT_SIZE,this.#r],[D3.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||=new H7(this),[[`colorPicker`,this._colorPicker]]}get colorType(){return D3.FREETEXT_COLOR}#i(e){let t=e=>{this.editorDiv.style.fontSize=`calc(${e}px * var(--total-scale-factor))`,this.translate(0,-(e-this.#r)*this.parentScale),this.#r=e,this.#s()},n=this.#r;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D3.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}onUpdatedColor(){this.editorDiv.style.color=this.color,this._colorPicker?.update(this.color),super.onUpdatedColor()}#a(e){let t=e=>{this.color=e,this.onUpdatedColor()},n=this.color;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D3.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(e,t){this._uiManager.translateSelectedEditors(e,t,!0)}getInitialTranslation(){let t=this.parentScale;return[-e._internalPadding*t,-(e._internalPadding+this.#r)*t]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove(`enabled`),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute(`aria-activedescendant`),this.#n=new AbortController;let e=this._uiManager.combinedSignal(this.#n);return this.editorDiv.addEventListener(`keydown`,this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener(`focus`,this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener(`blur`,this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener(`input`,this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener(`paste`,this.editorDivPaste.bind(this),{signal:e}),!0}disableEditMode(){return super.disableEditMode()?(this.overlayDiv.classList.add(`enabled`),this.editorDiv.contentEditable=!1,this.div.setAttribute(`aria-activedescendant`,this.#t),this._isDraggable=!0,this.#n?.abort(),this.#n=null,this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add(`freetextEditing`),!0):!1}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(e){this.width||(this.enableEditMode(),e&&this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===``}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add(`freetextEditing`)),super.remove()}#o(){let t=[];this.editorDiv.normalize();let n=null;for(let r of this.editorDiv.childNodes)n?.nodeType===Node.TEXT_NODE&&r.nodeName===`BR`||(t.push(e.#c(r)),n=r);return t.join(`
`)}#s(){let[e,t]=this.parentDimensions,n;if(this.isAttachedToDOM)n=this.div.getBoundingClientRect();else{let{currentLayer:e,div:t}=this,r=t.style.display,i=t.classList.contains(`hidden`);t.classList.remove(`hidden`),t.style.display=`hidden`,e.div.append(this.div),n=t.getBoundingClientRect(),t.remove(),t.style.display=r,t.classList.toggle(`hidden`,i)}this.rotation%180==this.parentRotation%180?(this.width=n.width/e,this.height=n.height/t):(this.width=n.height/e,this.height=n.width/t),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let e=this.#e,t=this.#e=this.#o().trimEnd();if(e===t)return;let n=e=>{if(this.#e=e,!e){this.remove();return}this.#l(),this._uiManager.rebuild(this),this.#s()};this.addCommands({cmd:()=>{n(t)},undo:()=>{n(e)},mustExec:!1}),this.#s()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(e){e.target===this.div&&e.key===`Enter`&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(t){e._keyboardManager.exec(this,t)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle(`freetextEditing`,this.isEmpty())}disableEditing(){this.editorDiv.setAttribute(`role`,`comment`),this.editorDiv.removeAttribute(`aria-multiline`)}enableEditing(){this.editorDiv.setAttribute(`role`,`textbox`),this.editorDiv.setAttribute(`aria-multiline`,!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let e,t;(this._isCopy||this.annotationElementId)&&(e=this.x,t=this.y),super.render(),this.editorDiv=document.createElement(`div`),this.editorDiv.className=`internal`,this.editorDiv.setAttribute(`id`,this.#t),this.editorDiv.setAttribute(`data-l10n-id`,`pdfjs-free-text2`),this.editorDiv.setAttribute(`data-l10n-attrs`,`default-content`),this.enableEditing(),this.editorDiv.contentEditable=!0;let{style:n}=this.editorDiv;if(n.fontSize=`calc(${this.#r}px * var(--total-scale-factor))`,n.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement(`div`),this.overlayDiv.classList.add(`overlay`,`enabled`),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){let[n,r]=this.parentDimensions;if(this.annotationElementId){let{position:i}=this._initialData,[a,o]=this.getInitialTranslation();[a,o]=this.pageTranslationToScreen(a,o);let[s,c]=this.pageDimensions,[l,u]=this.pageTranslation,d,f;switch(this.rotation){case 0:d=e+(i[0]-l)/s,f=t+this.height-(i[1]-u)/c;break;case 90:d=e+(i[0]-l)/s,f=t-(i[1]-u)/c,[a,o]=[o,-a];break;case 180:d=e-this.width+(i[0]-l)/s,f=t-(i[1]-u)/c,[a,o]=[-a,-o];break;case 270:d=e+(i[0]-l-this.height*c)/s,f=t+(i[1]-u-this.width*s)/c,[a,o]=[-o,a];break}this.setAt(d*n,f*r,a,o)}else this._moveAfterPaste(e,t);this.#l(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#c(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(a9,``)}editorDivPaste(t){let n=t.clipboardData||window.clipboardData,{types:r}=n;if(r.length===1&&r[0]===`text/plain`)return;t.preventDefault();let i=e.#d(n.getData(`text`)||``).replaceAll(a9,`
`);if(!i)return;let a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();let o=a.getRangeAt(0);if(!i.includes(`
`)){o.insertNode(document.createTextNode(i)),this.editorDiv.normalize(),a.collapseToStart();return}let{startContainer:s,startOffset:c}=o,l=[],u=[];if(s.nodeType===Node.TEXT_NODE){let t=s.parentElement;if(u.push(s.nodeValue.slice(c).replaceAll(a9,``)),t!==this.editorDiv){let n=l;for(let r of this.editorDiv.childNodes){if(r===t){n=u;continue}n.push(e.#c(r))}}l.push(s.nodeValue.slice(0,c).replaceAll(a9,``))}else if(s===this.editorDiv){let t=l,n=0;for(let r of this.editorDiv.childNodes)n++===c&&(t=u),t.push(e.#c(r))}this.#e=`${l.join(`
`)}${i}${u.join(`
`)}`,this.#l();let d=new Range,f=Math.sumPrecise(l.map(e=>e.length));for(let{firstChild:e}of this.editorDiv.childNodes)if(e.nodeType===Node.TEXT_NODE){let t=e.nodeValue.length;if(f<=t){d.setStart(e,f),d.setEnd(e,f);break}f-=t}a.removeAllRanges(),a.addRange(d)}#l(){if(this.editorDiv.replaceChildren(),this.#e)for(let e of this.#e.split(`
`)){let t=document.createElement(`div`);t.append(e?document.createTextNode(e):document.createElement(`br`)),this.editorDiv.append(t)}}#u(){return this.#e.replaceAll(`\xA0`,` `)}static#d(e){return e.replaceAll(` `,`\xA0`)}get contentDiv(){return this.editorDiv}getPDFRect(){let t=e._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,n,r){let i=null;if(t instanceof $7){let{data:{defaultAppearanceData:{fontSize:e,fontColor:n},rect:r,rotation:a,id:o,popupRef:s,richText:c,contentsObj:l,creationDate:u,modificationDate:d},textContent:f,textPosition:p,parent:{page:{pageNumber:m}}}=t;if(!f?.length)return null;i=t={annotationType:E3.FREETEXT,color:Array.from(n),fontSize:e,value:f.join(`
`),position:p,pageIndex:m-1,rect:r.slice(0),rotation:a,annotationElementId:o,id:o,deleted:!1,popupRef:s,comment:l?.str||null,richText:c,creationDate:u,modificationDate:d}}let a=await super.deserialize(t,n,r);return a.#r=t.fontSize,a.color=$.makeHexColor(...t.color),a.#e=e.#d(t.value),a._initialData=i,t.comment&&a.setCommentData(t),a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let t=l8._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),n=Object.assign(super.serialize(e),{color:t,fontSize:this.#r,value:this.#u()});return this.addComment(n),e?(n.isCopy=!0,n):this.annotationElementId&&!this.#f(n)?null:(n.id=this.annotationElementId,n)}#f(e){let{value:t,fontSize:n,color:r,pageIndex:i}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==t||e.fontSize!==n||e.color.some((e,t)=>e!==r[t])||e.pageIndex!==i}renderAnnotationElement(e){let t=super.renderAnnotationElement(e);if(!t)return null;let{style:n}=t;n.fontSize=`calc(${this.#r}px * var(--total-scale-factor))`,n.color=this.color,t.replaceChildren();for(let e of this.#e.split(`
`)){let n=document.createElement(`div`);n.append(e?document.createTextNode(e):document.createElement(`br`)),t.append(n)}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()}},o9=class{static PRECISION=1e-4;toSVGPath(){H3("Abstract method `toSVGPath` must be implemented.")}get box(){H3("Abstract getter `box` must be implemented.")}serialize(e,t){H3("Abstract method `serialize` must be implemented.")}static _rescale(e,t,n,r,i,a){a||=new Float32Array(e.length);for(let o=0,s=e.length;o<s;o+=2)a[o]=t+e[o]*r,a[o+1]=n+e[o+1]*i;return a}static _rescaleAndSwap(e,t,n,r,i,a){a||=new Float32Array(e.length);for(let o=0,s=e.length;o<s;o+=2)a[o]=t+e[o+1]*r,a[o+1]=n+e[o]*i;return a}static _translate(e,t,n,r){r||=new Float32Array(e.length);for(let i=0,a=e.length;i<a;i+=2)r[i]=t+e[i],r[i+1]=n+e[i+1];return r}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,t,n,r,i){switch(i){case 90:return[1-t/n,e/r];case 180:return[1-e/n,1-t/r];case 270:return[t/n,1-e/r];default:return[e/n,t/r]}}static createBezierPoints(e,t,n,r,i,a){return[(e+5*n)/6,(t+5*r)/6,(5*n+i)/6,(5*r+a)/6,(n+i)/2,(r+a)/2]}},s9=class e{#e;#t=[];#n;#r;#i=[];#a=new Float32Array(18);#o;#s;#c;#l;#u;#d;#f=[];static#p=8;static#m=2;static#h=e.#p+e.#m;constructor({x:t,y:n},r,i,a,o,s=0){this.#e=r,this.#d=a*i,this.#r=o,this.#a.set([NaN,NaN,NaN,NaN,t,n],6),this.#n=s,this.#l=e.#p*i,this.#c=e.#h*i,this.#u=i,this.#f.push(t,n)}isEmpty(){return isNaN(this.#a[8])}#g(){let e=this.#a.subarray(4,6),t=this.#a.subarray(16,18),[n,r,i,a]=this.#e;return[(this.#o+(e[0]-t[0])/2-n)/i,(this.#s+(e[1]-t[1])/2-r)/a,(this.#o+(t[0]-e[0])/2-n)/i,(this.#s+(t[1]-e[1])/2-r)/a]}add({x:e,y:t}){this.#o=e,this.#s=t;let[n,r,i,a]=this.#e,[o,s,c,l]=this.#a.subarray(8,12),u=e-c,d=t-l,f=Math.hypot(u,d);if(f<this.#c)return!1;let p=f-this.#l,m=p/f,h=m*u,g=m*d,_=o,v=s;o=c,s=l,c+=h,l+=g,this.#f?.push(e,t);let y=-g/p,b=h/p,x=y*this.#d,S=b*this.#d;return this.#a.set(this.#a.subarray(2,8),0),this.#a.set([c+x,l+S],4),this.#a.set(this.#a.subarray(14,18),12),this.#a.set([c-x,l-S],16),isNaN(this.#a[6])?(this.#i.length===0&&(this.#a.set([o+x,s+S],2),this.#i.push(NaN,NaN,NaN,NaN,(o+x-n)/i,(s+S-r)/a),this.#a.set([o-x,s-S],14),this.#t.push(NaN,NaN,NaN,NaN,(o-x-n)/i,(s-S-r)/a)),this.#a.set([_,v,o,s,c,l],6),!this.isEmpty()):(this.#a.set([_,v,o,s,c,l],6),Math.abs(Math.atan2(v-s,_-o)-Math.atan2(g,h))<Math.PI/2?([o,s,c,l]=this.#a.subarray(2,6),this.#i.push(NaN,NaN,NaN,NaN,((o+c)/2-n)/i,((s+l)/2-r)/a),[o,s,_,v]=this.#a.subarray(14,18),this.#t.push(NaN,NaN,NaN,NaN,((_+o)/2-n)/i,((v+s)/2-r)/a),!0):([_,v,o,s,c,l]=this.#a.subarray(0,6),this.#i.push(((_+5*o)/6-n)/i,((v+5*s)/6-r)/a,((5*o+c)/6-n)/i,((5*s+l)/6-r)/a,((o+c)/2-n)/i,((s+l)/2-r)/a),[c,l,o,s,_,v]=this.#a.subarray(12,18),this.#t.push(((_+5*o)/6-n)/i,((v+5*s)/6-r)/a,((5*o+c)/6-n)/i,((5*s+l)/6-r)/a,((o+c)/2-n)/i,((s+l)/2-r)/a),!0))}toSVGPath(){if(this.isEmpty())return``;let e=this.#i,t=this.#t;if(isNaN(this.#a[6])&&!this.isEmpty())return this.#_();let n=[];n.push(`M${e[4]} ${e[5]}`);for(let t=6;t<e.length;t+=6)isNaN(e[t])?n.push(`L${e[t+4]} ${e[t+5]}`):n.push(`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`);this.#y(n);for(let e=t.length-6;e>=6;e-=6)isNaN(t[e])?n.push(`L${t[e+4]} ${t[e+5]}`):n.push(`C${t[e]} ${t[e+1]} ${t[e+2]} ${t[e+3]} ${t[e+4]} ${t[e+5]}`);return this.#v(n),n.join(` `)}#_(){let[e,t,n,r]=this.#e,[i,a,o,s]=this.#g();return`M${(this.#a[2]-e)/n} ${(this.#a[3]-t)/r} L${(this.#a[4]-e)/n} ${(this.#a[5]-t)/r} L${i} ${a} L${o} ${s} L${(this.#a[16]-e)/n} ${(this.#a[17]-t)/r} L${(this.#a[14]-e)/n} ${(this.#a[15]-t)/r} Z`}#v(e){let t=this.#t;e.push(`L${t[4]} ${t[5]} Z`)}#y(e){let[t,n,r,i]=this.#e,a=this.#a.subarray(4,6),o=this.#a.subarray(16,18),[s,c,l,u]=this.#g();e.push(`L${(a[0]-t)/r} ${(a[1]-n)/i} L${s} ${c} L${l} ${u} L${(o[0]-t)/r} ${(o[1]-n)/i}`)}newFreeDrawOutline(e,t,n,r,i,a){return new c9(e,t,n,r,i,a)}getOutlines(){let e=this.#i,t=this.#t,n=this.#a,[r,i,a,o]=this.#e,s=new Float32Array((this.#f?.length??0)+2);for(let e=0,t=s.length-2;e<t;e+=2)s[e]=(this.#f[e]-r)/a,s[e+1]=(this.#f[e+1]-i)/o;if(s[s.length-2]=(this.#o-r)/a,s[s.length-1]=(this.#s-i)/o,isNaN(n[6])&&!this.isEmpty())return this.#b(s);let c=new Float32Array(this.#i.length+24+this.#t.length),l=e.length;for(let t=0;t<l;t+=2){if(isNaN(e[t])){c[t]=c[t+1]=NaN;continue}c[t]=e[t],c[t+1]=e[t+1]}l=this.#S(c,l);for(let e=t.length-6;e>=6;e-=6)for(let n=0;n<6;n+=2){if(isNaN(t[e+n])){c[l]=c[l+1]=NaN,l+=2;continue}c[l]=t[e+n],c[l+1]=t[e+n+1],l+=2}return this.#x(c,l),this.newFreeDrawOutline(c,s,this.#e,this.#u,this.#n,this.#r)}#b(e){let t=this.#a,[n,r,i,a]=this.#e,[o,s,c,l]=this.#g(),u=new Float32Array(36);return u.set([NaN,NaN,NaN,NaN,(t[2]-n)/i,(t[3]-r)/a,NaN,NaN,NaN,NaN,(t[4]-n)/i,(t[5]-r)/a,NaN,NaN,NaN,NaN,o,s,NaN,NaN,NaN,NaN,c,l,NaN,NaN,NaN,NaN,(t[16]-n)/i,(t[17]-r)/a,NaN,NaN,NaN,NaN,(t[14]-n)/i,(t[15]-r)/a],0),this.newFreeDrawOutline(u,e,this.#e,this.#u,this.#n,this.#r)}#x(e,t){let n=this.#t;return e.set([NaN,NaN,NaN,NaN,n[4],n[5]],t),t+=6}#S(e,t){let n=this.#a.subarray(4,6),r=this.#a.subarray(16,18),[i,a,o,s]=this.#e,[c,l,u,d]=this.#g();return e.set([NaN,NaN,NaN,NaN,(n[0]-i)/o,(n[1]-a)/s,NaN,NaN,NaN,NaN,c,l,NaN,NaN,NaN,NaN,u,d,NaN,NaN,NaN,NaN,(r[0]-i)/o,(r[1]-a)/s],t),t+=24}},c9=class extends o9{#e;#t=new Float32Array(4);#n;#r;#i;#a;#o;constructor(e,t,n,r,i,a){super(),this.#o=e,this.#i=t,this.#e=n,this.#a=r,this.#n=i,this.#r=a,this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],this.#s(a);let[o,s,c,l]=this.#t;for(let t=0,n=e.length;t<n;t+=2)e[t]=(e[t]-o)/c,e[t+1]=(e[t+1]-s)/l;for(let e=0,n=t.length;e<n;e+=2)t[e]=(t[e]-o)/c,t[e+1]=(t[e+1]-s)/l}toSVGPath(){let e=[`M${this.#o[4]} ${this.#o[5]}`];for(let t=6,n=this.#o.length;t<n;t+=6){if(isNaN(this.#o[t])){e.push(`L${this.#o[t+4]} ${this.#o[t+5]}`);continue}e.push(`C${this.#o[t]} ${this.#o[t+1]} ${this.#o[t+2]} ${this.#o[t+3]} ${this.#o[t+4]} ${this.#o[t+5]}`)}return e.push(`Z`),e.join(` `)}serialize([e,t,n,r],i){let a=n-e,o=r-t,s,c;switch(i){case 0:s=o9._rescale(this.#o,e,r,a,-o),c=o9._rescale(this.#i,e,r,a,-o);break;case 90:s=o9._rescaleAndSwap(this.#o,e,t,a,o),c=o9._rescaleAndSwap(this.#i,e,t,a,o);break;case 180:s=o9._rescale(this.#o,n,t,-a,o),c=o9._rescale(this.#i,n,t,-a,o);break;case 270:s=o9._rescaleAndSwap(this.#o,n,r,-a,-o),c=o9._rescaleAndSwap(this.#i,n,r,-a,-o);break}return{outline:Array.from(s),points:[Array.from(c)]}}#s(e){let t=this.#o,n=t[4],r=t[5],i=[n,r,n,r],a=n,o=r,s=n,c=r,l=e?Math.max:Math.min,u=new Float32Array(4);for(let e=6,d=t.length;e<d;e+=6){let d=t[e+4],f=t[e+5];isNaN(t[e])?($.pointBoundingBox(d,f,i),o>f?(a=d,o=f):o===f&&(a=l(a,d)),c<f?(s=d,c=f):c===f&&(s=l(s,d))):(u.set(_3,0),$.bezierBoundingBox(n,r,...t.slice(e,e+6),u),$.rectBoundingBox(...u,i),o>u[1]?(a=u[0],o=u[1]):o===u[1]&&(a=l(a,u[0])),c<u[3]?(s=u[2],c=u[3]):c===u[3]&&(s=l(s,u[2]))),n=d,r=f}let d=this.#t;d[0]=i[0]-this.#n,d[1]=i[1]-this.#n,d[2]=i[2]-i[0]+2*this.#n,d[3]=i[3]-i[1]+2*this.#n,this.firstPoint=[a,o],this.lastPoint=[s,c]}get box(){return this.#t}newOutliner(e,t,n,r,i,a=0){return new s9(e,t,n,r,i,a)}getNewOutline(e,t){let[n,r,i,a]=this.#t,[o,s,c,l]=this.#e,u=i*c,d=a*l,f=n*c+o,p=r*l+s,m=this.newOutliner({x:this.#i[0]*u+f,y:this.#i[1]*d+p},this.#e,this.#a,e,this.#r,t??this.#n);for(let e=2;e<this.#i.length;e+=2)m.add({x:this.#i[e]*u+f,y:this.#i[e+1]*d+p});return m.getOutlines()}},l9=class{#e;#t;#n;#r=[];#i=[];constructor(e,t=0,n=0,r=!0){let i=_3.slice(),a=10**-4;for(let{x:n,y:r,width:o,height:s}of e){let e=Math.floor((n-t)/a)*a,c=Math.ceil((n+o+t)/a)*a,l=Math.floor((r-t)/a)*a,u=Math.ceil((r+s+t)/a)*a,d=[e,l,u,!0],f=[c,l,u,!1];this.#r.push(d,f),$.rectBoundingBox(e,l,c,u,i)}let o=i[2]-i[0]+2*n,s=i[3]-i[1]+2*n,c=i[0]-n,l=i[1]-n,u=r?-1/0:1/0,d=1/0,f=this.#r.at(r?-1:-2),p=[f[0],f[2]];for(let e of this.#r){let[t,n,i,a]=e;!a&&r?n<d?(d=n,u=t):n===d&&(u=Math.max(u,t)):a&&!r&&(n<d?(d=n,u=t):n===d&&(u=Math.min(u,t))),e[0]=(t-c)/o,e[1]=(n-l)/s,e[2]=(i-l)/s}this.#e=new Float32Array([c,l,o,s]),this.#t=[u,d],this.#n=p}getOutlines(){this.#r.sort((e,t)=>e[0]-t[0]||e[1]-t[1]||e[2]-t[2]);let e=[];for(let t of this.#r)t[3]?(e.push(...this.#l(t)),this.#s(t)):(this.#c(t),e.push(...this.#l(t)));return this.#a(e)}#a(e){let t=[],n=new Set;for(let n of e){let[e,r,i]=n;t.push([e,r,n],[e,i,n])}t.sort((e,t)=>e[1]-t[1]||e[0]-t[0]);for(let e=0,r=t.length;e<r;e+=2){let r=t[e][2],i=t[e+1][2];r.push(i),i.push(r),n.add(r),n.add(i)}let r=[],i;for(;n.size>0;){let e=n.values().next().value,[t,a,o,s,c]=e;n.delete(e);let l=t,u=a;for(i=[t,o],r.push(i);;){let e;if(n.has(s))e=s;else if(n.has(c))e=c;else break;n.delete(e),[t,a,o,s,c]=e,l!==t&&(i.push(l,u,t,u===a?a:o),l=t),u=u===a?o:a}i.push(l,u)}return new pne(r,this.#e,this.#t,this.#n)}#o(e){let t=this.#i,n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i][0];if(a===e)return i;a<e?n=i+1:r=i-1}return r+1}#s([,e,t]){let n=this.#o(e);this.#i.splice(n,0,[e,t])}#c([,e,t]){let n=this.#o(e);for(let r=n;r<this.#i.length;r++){let[n,i]=this.#i[r];if(n!==e)break;if(n===e&&i===t){this.#i.splice(r,1);return}}for(let r=n-1;r>=0;r--){let[n,i]=this.#i[r];if(n!==e)break;if(n===e&&i===t){this.#i.splice(r,1);return}}}#l(e){let[t,n,r]=e,i=[[t,n,r]],a=this.#o(r);for(let e=0;e<a;e++){let[n,r]=this.#i[e];for(let e=0,a=i.length;e<a;e++){let[,o,s]=i[e];if(!(r<=o||s<=n)){if(o>=n){if(s>r)i[e][1]=r;else{if(a===1)return[];i.splice(e,1),e--,a--}continue}i[e][2]=n,s>r&&i.push([t,r,s])}}}return i}},pne=class extends o9{#e;#t;constructor(e,t,n,r){super(),this.#t=e,this.#e=t,this.firstPoint=n,this.lastPoint=r}toSVGPath(){let e=[];for(let t of this.#t){let[n,r]=t;e.push(`M${n} ${r}`);for(let i=2;i<t.length;i+=2){let a=t[i],o=t[i+1];a===n?(e.push(`V${o}`),r=o):o===r&&(e.push(`H${a}`),n=a)}e.push(`Z`)}return e.join(` `)}serialize([e,t,n,r],i){let a=[],o=n-e,s=r-t;for(let t of this.#t){let n=Array(t.length);for(let i=0;i<t.length;i+=2)n[i]=e+t[i]*o,n[i+1]=r-t[i+1]*s;a.push(n)}return a}get box(){return this.#e}},u9=class extends s9{newFreeDrawOutline(e,t,n,r,i,a){return new mne(e,t,n,r,i,a)}},mne=class extends c9{newOutliner(e,t,n,r,i,a=0){return new u9(e,t,n,r,i,a)}},d9=class e extends l8{#e=null;#t=0;#n;#r=null;#i=null;#a=null;#o=null;#s=0;#c=null;#l=null;#u=null;#d=!1;#f=null;#p=null;#m=null;#h=``;#g;#_=``;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type=`highlight`;static _editorType=E3.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId=``;static get _keyboardManager(){let t=e.prototype;return J3(this,`_keyboardManager`,new r8([[[`ArrowLeft`],t._moveCaret,{args:[0]}],[[`ArrowRight`],t._moveCaret,{args:[1]}],[[`ArrowUp`],t._moveCaret,{args:[2]}],[[`ArrowDown`],t._moveCaret,{args:[3]}]]))}constructor(t){super({...t,name:`highlightEditor`}),this.color=t.color||e._defaultColor,this.#g=t.thickness||e._defaultThickness,this.opacity=t.opacity||e._defaultOpacity,this.#n=t.boxes||null,this.#_=t.methodOfCreation||``,this.#h=t.text||``,this._isDraggable=!1,this.defaultL10nId=`pdfjs-editor-highlight-editor`,t.highlightId>-1?(this.#d=!0,this.#y(t),this.#w()):this.#n&&(this.#e=t.anchorNode,this.#t=t.anchorOffset,this.#o=t.focusNode,this.#s=t.focusOffset,this.#v(),this.#w(),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert(l8._l10nAlert.highlight)}get telemetryInitialData(){return{action:`added`,type:this.#d?`free_highlight`:`highlight`,color:this._uiManager.getNonHCMColorName(this.color),thickness:this.#g,methodOfCreation:this.#_}}get telemetryFinalData(){return{type:`highlight`,color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get(`color`).size}}#v(){let e=new l9(this.#n,.001);this.#l=e.getOutlines(),[this.x,this.y,this.width,this.height]=this.#l.box;let t=new l9(this.#n,.0025,.001,this._uiManager.direction===`ltr`);this.#a=t.getOutlines();let{firstPoint:n}=this.#l;this.#f=[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height];let{lastPoint:r}=this.#a;this.#p=[(r[0]-this.x)/this.width,(r[1]-this.y)/this.height]}#y({highlightOutlines:t,highlightId:n,clipPathId:r}){if(this.#l=t,this.#a=t.getNewOutline(this.#g/2+1.5,.0025),n>=0)this.#u=n,this.#r=r,this.parent.drawLayer.finalizeDraw(n,{bbox:t.box,path:{d:t.toSVGPath()}}),this.#m=this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:this.#a.box,path:{d:this.#a.toSVGPath()}},!0);else if(this.parent){let n=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(this.#u,{bbox:e.#T(this.#l.box,(n-this.rotation+360)%360),path:{d:t.toSVGPath()}}),this.parent.drawLayer.updateProperties(this.#m,{bbox:e.#T(this.#a.box,n),path:{d:this.#a.toSVGPath()}})}let[i,a,o,s]=t.box;switch(this.rotation){case 0:this.x=i,this.y=a,this.width=o,this.height=s;break;case 90:{let[e,t]=this.parentDimensions;this.x=a,this.y=1-i,this.width=o*t/e,this.height=s*e/t;break}case 180:this.x=1-i,this.y=1-a,this.width=o,this.height=s;break;case 270:{let[e,t]=this.parentDimensions;this.x=1-a,this.y=i,this.width=o*t/e,this.height=s*e/t;break}}let{firstPoint:c}=t;this.#f=[(c[0]-i)/o,(c[1]-a)/s];let{lastPoint:l}=this.#a;this.#p=[(l[0]-i)/o,(l[1]-a)/s]}static initialize(t,n){l8.initialize(t,n),e._defaultColor||=n.highlightColors?.values().next().value||`#fff066`}static updateDefaultParams(t,n){switch(t){case D3.HIGHLIGHT_COLOR:e._defaultColor=n;break;case D3.HIGHLIGHT_THICKNESS:e._defaultThickness=n;break}}translateInPage(e,t){}get toolbarPosition(){return this.#p}get commentButtonPosition(){return this.#f}updateParams(e,t){switch(e){case D3.HIGHLIGHT_COLOR:this.#b(t);break;case D3.HIGHLIGHT_THICKNESS:this.#x(t);break}}static get defaultPropertiesToUpdate(){return[[D3.HIGHLIGHT_COLOR,e._defaultColor],[D3.HIGHLIGHT_THICKNESS,e._defaultThickness]]}get propertiesToUpdate(){return[[D3.HIGHLIGHT_COLOR,this.color||e._defaultColor],[D3.HIGHLIGHT_THICKNESS,this.#g||e._defaultThickness],[D3.HIGHLIGHT_FREE,this.#d]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(this.#u,{root:{fill:this.color,"fill-opacity":this.opacity}}),this.#i?.updateColor(this.color),super.onUpdatedColor()}#b(t){let n=(e,t)=>{this.color=e,this.opacity=t,this.onUpdatedColor()},r=this.color,i=this.opacity;this.addCommands({cmd:n.bind(this,t,e._defaultOpacity),undo:n.bind(this,r,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D3.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:`color_changed`,color:this._uiManager.getNonHCMColorName(t)},!0)}#x(e){let t=this.#g,n=e=>{this.#g=e,this.#S(e)};this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,t),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D3.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:`thickness_changed`,thickness:e},!0)}get toolbarButtons(){return this._uiManager.highlightColors?[[`colorPicker`,this.#i=new V7({editor:this})]]: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.#O())}getBaseTranslation(){return[0,0]}getRect(e,t){return super.getRect(e,t,this.#O())}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){this.#C(),this._reportTelemetry({action:`deleted`}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#w(),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?this.#C():e&&(this.#w(e),t=!this.parent&&this.div?.classList.contains(`selectedEditor`)),super.setParent(e),this.show(this._isVisible),t&&this.select()}#S(e){this.#d&&(this.#y({highlightOutlines:this.#l.getNewOutline(e/2)}),this.fixAndSetPosition(),this.setDims())}#C(){this.#u===null||!this.parent||(this.parent.drawLayer.remove(this.#u),this.#u=null,this.parent.drawLayer.remove(this.#m),this.#m=null)}#w(e=this.parent){this.#u===null&&({id:this.#u,clipPathId:this.#r}=e.drawLayer.draw({bbox:this.#l.box,root:{viewBox:`0 0 1 1`,fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:this.#d},path:{d:this.#l.toSVGPath()}},!1,!0),this.#m=e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:this.#d},bbox:this.#a.box,path:{d:this.#a.toSVGPath()}},this.#d),this.#c&&(this.#c.style.clipPath=this.#r))}static#T([e,t,n,r],i){switch(i){case 90:return[1-t-r,e,r,n];case 180:return[1-e-n,1-t-r,n,r];case 270:return[t,1-e-n,r,n]}return[e,t,n,r]}rotate(t){let{drawLayer:n}=this.parent,r;this.#d?(t=(t-this.rotation+360)%360,r=e.#T(this.#l.box,t)):r=e.#T([this.x,this.y,this.width,this.height],t),n.updateProperties(this.#u,{bbox:r,root:{"data-main-rotation":t}}),n.updateProperties(this.#m,{bbox:e.#T(this.#a.box,t),root:{"data-main-rotation":t}})}render(){if(this.div)return this.div;let e=super.render();this.#h&&(e.setAttribute(`aria-label`,this.#h),e.setAttribute(`role`,`mark`)),this.#d?e.classList.add(`free`):this.div.addEventListener(`keydown`,this.#E.bind(this),{signal:this._uiManager._signal});let t=this.#c=document.createElement(`div`);return e.append(t),t.setAttribute(`aria-hidden`,`true`),t.className=`internal`,t.style.clipPath=this.#r,this.setDims(),Q6(this,this.#c,[`pointerover`,`pointerleave`]),this.enableEditing(),e}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#m,{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#m,{rootClass:{hovered:!1}})}#E(t){e._keyboardManager.exec(this,t)}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:this.#D(!0);break;case 1:case 3:this.#D(!1);break}}#D(e){if(!this.#e)return;let t=window.getSelection();e?t.setPosition(this.#e,this.#t):t.setPosition(this.#o,this.#s)}select(){super.select(),this.#m&&this.parent?.drawLayer.updateProperties(this.#m,{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),this.#m&&(this.parent?.drawLayer.updateProperties(this.#m,{rootClass:{selected:!1}}),this.#d||this.#D(!1))}get _mustFixPosition(){return!this.#d}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.updateProperties(this.#u,{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(this.#m,{rootClass:{hidden:!e}}))}#O(){return this.#d?this.rotation:0}#k(){if(this.#d)return null;let[e,t]=this.pageDimensions,[n,r]=this.pageTranslation,i=this.#n,a=new Float32Array(i.length*8),o=0;for(let{x:s,y:c,width:l,height:u}of i){let i=s*e+n,d=(1-c)*t+r;a[o]=a[o+4]=i,a[o+1]=a[o+3]=d,a[o+2]=a[o+6]=i+l*e,a[o+5]=a[o+7]=d-u*t,o+=8}return a}#A(e){return this.#l.serialize(e,this.#O())}static startHighlighting(e,t,{target:n,x:r,y:i}){let{x:a,y:o,width:s,height:c}=n.getBoundingClientRect(),l=new AbortController,u=e.combinedSignal(l),d=t=>{l.abort(),this.#M(e,t)};window.addEventListener(`blur`,d,{signal:u}),window.addEventListener(`pointerup`,d,{signal:u}),window.addEventListener(`pointerdown`,O6,{capture:!0,passive:!1,signal:u}),window.addEventListener(`contextmenu`,D6,{signal:u}),n.addEventListener(`pointermove`,this.#j.bind(this,e),{signal:u}),this._freeHighlight=new u9({x:r,y:i},[a,o,s,c],e.scale,this._defaultThickness/2,t,.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#j(e,t){this._freeHighlight.add(t)&&e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}static#M(e,t){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(t,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:`main_toolbar`}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=``}static async deserialize(e,t,n){let r=null;if(e instanceof n9){let{data:{quadPoints:t,rect:n,rotation:i,id:a,color:o,opacity:s,popupRef:c,richText:l,contentsObj:u,creationDate:d,modificationDate:f},parent:{page:{pageNumber:p}}}=e;r=e={annotationType:E3.HIGHLIGHT,color:Array.from(o),opacity:s,quadPoints:t,boxes:null,pageIndex:p-1,rect:n.slice(0),rotation:i,annotationElementId:a,id:a,deleted:!1,popupRef:c,richText:l,comment:u?.str||null,creationDate:d,modificationDate:f}}else if(e instanceof t9){let{data:{inkLists:t,rect:n,rotation:i,id:a,color:o,borderStyle:{rawWidth:s},popupRef:c,richText:l,contentsObj:u,creationDate:d,modificationDate:f},parent:{page:{pageNumber:p}}}=e;r=e={annotationType:E3.HIGHLIGHT,color:Array.from(o),thickness:s,inkLists:t,boxes:null,pageIndex:p-1,rect:n.slice(0),rotation:i,annotationElementId:a,id:a,deleted:!1,popupRef:c,richText:l,comment:u?.str||null,creationDate:d,modificationDate:f}}let{color:i,quadPoints:a,inkLists:o,outlines:s,opacity:c}=e,l=await super.deserialize(e,t,n);l.color=$.makeHexColor(...i),l.opacity=c||1,o&&(l.#g=e.thickness),l._initialData=r,e.comment&&l.setCommentData(e);let[u,d]=l.pageDimensions,[f,p]=l.pageTranslation;if(a){let e=l.#n=[];for(let t=0;t<a.length;t+=8)e.push({x:(a[t]-f)/u,y:1-(a[t+1]-p)/d,width:(a[t+2]-a[t])/u,height:(a[t+1]-a[t+5])/d});l.#v(),l.#w(),l.rotate(l.rotation)}else if(o||s){l.#d=!0;let e=(o||s.points)[0],n={x:e[0]-f,y:d-(e[1]-p)},r=new u9(n,[0,0,u,d],1,l.#g/2,!0,.001);for(let t=0,i=e.length;t<i;t+=2)n.x=e[t]-f,n.y=d-(e[t+1]-p),r.add(n);let{id:i,clipPathId:a}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:`0 0 1 1`,fill:l.color,"fill-opacity":l._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:r.toSVGPath()}},!0,!0);l.#y({highlightOutlines:r.getOutlines(),highlightId:i,clipPathId:a}),l.#w(),l.rotate(l.parentRotation)}return l}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();let t=l8._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),n=super.serialize(e);return Object.assign(n,{color:t,opacity:this.opacity,thickness:this.#g,quadPoints:this.#k(),outlines:this.#A(n.rect)}),this.addComment(n),this.annotationElementId&&!this.#N(n)?null:(n.id=this.annotationElementId,n)}#N(e){let{color:t}=this._initialData;return this.hasEditedComment||e.color.some((e,n)=>e!==t[n])}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}},f9=class{#e=Object.create(null);updateProperty(e,t){this[e]=t,this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(let[t,n]of Object.entries(e))t.startsWith(`_`)||this.updateProperty(t,n)}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(){H3(`Not implemented`)}},p9=class e extends l8{#e=null;#t;_colorPicker=null;_drawId=null;static _currentDrawId=-1;static _currentParent=null;static#n=null;static#r=null;static#i=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){e.drawOutlines&&(this.#a(e),this.#c())}#a({drawOutlines:e,drawId:t,drawingOptions:n}){this.#e=e,this._drawingOptions||=n,this.annotationElementId||this._uiManager.a11yAlert(l8._l10nAlert[this.editorType]),t>=0?(this._drawId=t,this.parent.drawLayer.finalizeDraw(t,e.defaultProperties)):this._drawId=this.#o(e,this.parent),this.#d(e.box)}#o(t,n){let{id:r}=n.drawLayer.draw(e._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1);return r}static _mergeSVGProperties(e,t){let n=new Set(Object.keys(e));for(let[r,i]of Object.entries(t))n.has(r)?Object.assign(e[r],i):e[r]=i;return e}static getDefaultDrawingOptions(e){H3(`Not implemented`)}static get typesMap(){H3(`Not implemented`)}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(t,n){let r=this.typesMap.get(t);r&&this._defaultDrawingOptions.updateProperty(r,n),this._currentParent&&(e.#n.updateProperty(r,n),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,t){let n=this.constructor.typesMap.get(e);n&&this._updateProperty(e,n,t)}static get defaultPropertiesToUpdate(){let e=[],t=this._defaultDrawingOptions;for(let[n,r]of this.typesMap)e.push([n,t[r]]);return e}get propertiesToUpdate(){let e=[],{_drawingOptions:t}=this;for(let[n,r]of this.constructor.typesMap)e.push([n,t[r]]);return e}_updateProperty(e,t,n){let r=this._drawingOptions,i=r[t],a=n=>{r.updateProperty(t,n);let i=this.#e.updateProperty(t,n);i&&this.#d(i),this.parent?.drawLayer.updateProperties(this._drawId,r.toSVGProperties()),e===this.colorType?this.onUpdatedColor():e===this.opacityType&&this.onUpdatedOpacity()};this.addCommands({cmd:a.bind(this,n),undo:a.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(e,t){let n=this.constructor.typesMap.get(this.colorType),r=this.constructor.typesMap.get(this.opacityType),i=this._drawingOptions,a=i[n],o=i[r],s=(e,t)=>{i.updateProperty(n,e),i.updateProperty(r,t),this.#e.updateProperty(n,e),this.#e.updateProperty(r,t),this.parent?.drawLayer.updateProperties(this._drawId,i.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:s.bind(this,e,t),undo:s.bind(this,a,o),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D3.INK_COLOR_AND_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this.#e.getPathResizingSVGProperties(this.#u()),{bbox:this.#f()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this.#e.getPathResizedSVGProperties(this.#u()),{bbox:this.#f()}))}_onTranslating(e,t){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#f()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this.#e.getPathTranslatedSVGProperties(this.#u(),this.parentDimensions),{bbox:this.#f()}))}_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){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,this.#t&&(this.#t=!1,this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){this.#s(),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#c(),this.#d(this.#e.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),this.#s()):e&&(this._uiManager.addShouldRescale(this),this.#c(e),t=!this.parent&&this.div?.classList.contains(`selectedEditor`)),super.setParent(e),t&&this.select()}#s(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}#c(e=this.parent){if(!(this._drawId!==null&&this.parent===e)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,e.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=this.#o(this.#e,e)}}#l([e,t,n,r]){let{parentDimensions:[i,a],rotation:o}=this;switch(o){case 90:return[t,1-e,a/i*n,i/a*r];case 180:return[1-e,1-t,n,r];case 270:return[1-t,e,a/i*n,i/a*r];default:return[e,t,n,r]}}#u(){let{x:e,y:t,width:n,height:r,parentDimensions:[i,a],rotation:o}=this;switch(o){case 90:return[1-t,e,i/a*n,a/i*r];case 180:return[1-e,1-t,n,r];case 270:return[t,1-e,i/a*n,a/i*r];default:return[e,t,n,r]}}#d(e){[this.x,this.y,this.width,this.height]=this.#l(e),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}#f(){let{x:e,y:t,width:n,height:r,rotation:i,parentRotation:a,parentDimensions:[o,s]}=this;switch((i*4+a)/90){case 1:return[1-t-r,e,r,n];case 2:return[1-e-n,1-t-r,n,r];case 3:return[t,1-e-n,r,n];case 4:return[e,t-o/s*n,s/o*r,o/s*n];case 5:return[1-t,e,o/s*n,s/o*r];case 6:return[1-e-s/o*r,1-t,s/o*r,o/s*n];case 7:return[t-o/s*n,1-e-s/o*r,o/s*n,s/o*r];case 8:return[e-n,t-r,n,r];case 9:return[1-t,e-n,r,n];case 10:return[1-e,1-t,n,r];case 11:return[t-r,1-e,r,n];case 12:return[e-s/o*r,t,s/o*r,o/s*n];case 13:return[1-t-o/s*n,e-s/o*r,o/s*n,s/o*r];case 14:return[1-e,1-t-o/s*n,s/o*r,o/s*n];case 15:return[t,1-e,o/s*n,s/o*r];default:return[e,t,n,r]}}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties({bbox:this.#f()},this.#e.updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&this.#d(this.#e.updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,t;this._isCopy&&(e=this.x,t=this.y);let n=super.render();n.classList.add(`draw`);let r=document.createElement(`div`);return n.append(r),r.setAttribute(`aria-hidden`,`true`),r.className=`internal`,this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,t),n}static createDrawerInstance(e,t,n,r,i){H3(`Not implemented`)}static startDrawing(t,n,r,i){let{target:a,offsetX:o,offsetY:s,pointerId:c,pointerType:l}=i;if($6.isInitializedAndDifferentPointerType(l))return;let{viewport:{rotation:u}}=t,{width:d,height:f}=a.getBoundingClientRect(),p=e.#r=new AbortController,m=t.combinedSignal(p);if($6.setPointer(l,c),window.addEventListener(`pointerup`,e=>{$6.isSamePointerIdOrRemove(e.pointerId)&&this._endDraw(e)},{signal:m}),window.addEventListener(`pointercancel`,e=>{$6.isSamePointerIdOrRemove(e.pointerId)&&this._currentParent.endDrawingSession()},{signal:m}),window.addEventListener(`pointerdown`,t=>{$6.isSamePointerType(t.pointerType)&&($6.initializeAndAddPointerId(t.pointerId),e.#n.isCancellable()&&(e.#n.removeLastElement(),e.#n.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:m}),window.addEventListener(`contextmenu`,D6,{signal:m}),a.addEventListener(`pointermove`,this._drawMove.bind(this),{signal:m}),a.addEventListener(`touchmove`,e=>{$6.isSameTimeStamp(e.timeStamp)&&O6(e)},{signal:m}),t.toggleDrawing(),n._editorUndoBar?.hide(),e.#n){t.drawLayer.updateProperties(this._currentDrawId,e.#n.startNew(o,s,d,f,u));return}n.updateUIForDefaultProperties(this),e.#n=this.createDrawerInstance(o,s,d,f,u),e.#i=this.getDefaultDrawingOptions(),this._currentParent=t,{id:this._currentDrawId}=t.drawLayer.draw(this._mergeSVGProperties(e.#i.toSVGProperties(),e.#n.defaultSVGProperties),!0,!1)}static _drawMove(t){if($6.isSameTimeStamp(t.timeStamp),!e.#n)return;let{offsetX:n,offsetY:r,pointerId:i}=t;if($6.isSamePointerId(i)){if($6.isUsingMultiplePointers()){this._endDraw(t);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,e.#n.add(n,r)),$6.setTimeStamp(t.timeStamp),O6(t)}}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,e.#n=null,e.#i=null,$6.clearTimeStamp()),e.#r&&(e.#r.abort(),e.#r=null,$6.clearPointerIds())}static _endDraw(t){let n=this._currentParent;if(n){if(n.toggleDrawing(!0),this._cleanup(!1),t?.target===n.div&&n.drawLayer.updateProperties(this._currentDrawId,e.#n.end(t.offsetX,t.offsetY)),this.supportMultipleDrawings){let t=e.#n,r=this._currentDrawId,i=t.getLastElement();n.addCommands({cmd:()=>{n.drawLayer.updateProperties(r,t.setLastElement(i))},undo:()=>{n.drawLayer.updateProperties(r,t.removeLastElement())},mustExec:!1,type:D3.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(t){let n=this._currentParent;if(!n)return null;if(n.toggleDrawing(!0),n.cleanUndoStack(D3.DRAW_STEP),!e.#n.isEmpty()){let{pageDimensions:[r,i],scale:a}=n,o=n.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:e.#n.getOutlines(r*a,i*a,a,this._INNER_MARGIN),drawingOptions:e.#i,mustBeCommitted:!t});return this._cleanup(!0),o}return n.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,t,n,r,i,a){H3(`Not implemented`)}static async deserialize(e,t,n){let{rawDims:{pageWidth:r,pageHeight:i,pageX:a,pageY:o}}=t.viewport,s=this.deserializeDraw(a,o,r,i,this._INNER_MARGIN,e),c=await super.deserialize(e,t,n);return c.createDrawingOptions(e),c.#a({drawOutlines:s}),c.#c(),c.onScaleChanging(),c.rotate(),c}serializeDraw(e){let[t,n]=this.pageTranslation,[r,i]=this.pageDimensions;return this.#e.serialize([t,n,r,i],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}},hne=class{#e=new Float64Array(6);#t;#n;#r;#i;#a;#o=``;#s=0;#c=new m9;#l;#u;constructor(e,t,n,r,i,a){this.#l=n,this.#u=r,this.#r=i,this.#i=a,[e,t]=this.#d(e,t);let o=this.#t=[NaN,NaN,NaN,NaN,e,t];this.#a=[e,t],this.#n=[{line:o,points:this.#a}],this.#e.set(o,0)}updateProperty(e,t){e===`stroke-width`&&(this.#i=t)}#d(e,t){return o9._normalizePoint(e,t,this.#l,this.#u,this.#r)}isEmpty(){return!this.#n?.length}isCancellable(){return this.#a.length<=10}add(e,t){[e,t]=this.#d(e,t);let[n,r,i,a]=this.#e.subarray(2,6),o=e-i,s=t-a;return Math.hypot(this.#l*o,this.#u*s)<=2?null:(this.#a.push(e,t),isNaN(n)?(this.#e.set([i,a,e,t],2),this.#t.push(NaN,NaN,NaN,NaN,e,t),{path:{d:this.toSVGPath()}}):(isNaN(this.#e[0])&&this.#t.splice(6,6),this.#e.set([n,r,i,a,e,t],0),this.#t.push(...o9.createBezierPoints(n,r,i,a,e,t)),{path:{d:this.toSVGPath()}}))}end(e,t){return this.add(e,t)||(this.#a.length===2?{path:{d:this.toSVGPath()}}:null)}startNew(e,t,n,r,i){this.#l=n,this.#u=r,this.#r=i,[e,t]=this.#d(e,t);let a=this.#t=[NaN,NaN,NaN,NaN,e,t];this.#a=[e,t];let o=this.#n.at(-1);return o&&(o.line=new Float32Array(o.line),o.points=new Float32Array(o.points)),this.#n.push({line:a,points:this.#a}),this.#e.set(a,0),this.#s=0,this.toSVGPath(),null}getLastElement(){return this.#n.at(-1)}setLastElement(e){return this.#n?(this.#n.push(e),this.#t=e.line,this.#a=e.points,this.#s=0,{path:{d:this.toSVGPath()}}):this.#c.setLastElement(e)}removeLastElement(){if(!this.#n)return this.#c.removeLastElement();this.#n.pop(),this.#o=``;for(let e=0,t=this.#n.length;e<t;e++){let{line:t,points:n}=this.#n[e];this.#t=t,this.#a=n,this.#s=0,this.toSVGPath()}return{path:{d:this.#o}}}toSVGPath(){let e=o9.svgRound(this.#t[4]),t=o9.svgRound(this.#t[5]);if(this.#a.length===2)return this.#o=`${this.#o} M ${e} ${t} Z`,this.#o;if(this.#a.length<=6){let n=this.#o.lastIndexOf(`M`);this.#o=`${this.#o.slice(0,n)} M ${e} ${t}`,this.#s=6}if(this.#a.length===4){let e=o9.svgRound(this.#t[10]),t=o9.svgRound(this.#t[11]);return this.#o=`${this.#o} L ${e} ${t}`,this.#s=12,this.#o}let n=[];this.#s===0&&(n.push(`M ${e} ${t}`),this.#s=6);for(let e=this.#s,t=this.#t.length;e<t;e+=6){let[t,r,i,a,o,s]=this.#t.slice(e,e+6).map(o9.svgRound);n.push(`C${t} ${r} ${i} ${a} ${o} ${s}`)}return this.#o+=n.join(` `),this.#s=this.#t.length,this.#o}getOutlines(e,t,n,r){let i=this.#n.at(-1);return i.line=new Float32Array(i.line),i.points=new Float32Array(i.points),this.#c.build(this.#n,e,t,n,this.#r,this.#i,r),this.#e=null,this.#t=null,this.#n=null,this.#o=null,this.#c}get defaultSVGProperties(){return{root:{viewBox:`0 0 10000 10000`},rootClass:{draw:!0},bbox:[0,0,1,1]}}},m9=class extends o9{#e;#t=0;#n;#r;#i;#a;#o;#s;#c;build(e,t,n,r,i,a,o){this.#i=t,this.#a=n,this.#o=r,this.#s=i,this.#c=a,this.#n=o??0,this.#r=e,this.#d()}get thickness(){return this.#c}setLastElement(e){return this.#r.push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#r.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let e=[];for(let{line:t}of this.#r){if(e.push(`M${o9.svgRound(t[4])} ${o9.svgRound(t[5])}`),t.length===6){e.push(`Z`);continue}if(t.length===12&&isNaN(t[6])){e.push(`L${o9.svgRound(t[10])} ${o9.svgRound(t[11])}`);continue}for(let n=6,r=t.length;n<r;n+=6){let[r,i,a,o,s,c]=t.subarray(n,n+6).map(o9.svgRound);e.push(`C${r} ${i} ${a} ${o} ${s} ${c}`)}}return e.join(``)}serialize([e,t,n,r],i){let a=[],o=[],[s,c,l,u]=this.#u(),d,f,p,m,h,g,_,v,y;switch(this.#s){case 0:y=o9._rescale,d=e,f=t+r,p=n,m=-r,h=e+s*n,g=t+(1-c-u)*r,_=e+(s+l)*n,v=t+(1-c)*r;break;case 90:y=o9._rescaleAndSwap,d=e,f=t,p=n,m=r,h=e+c*n,g=t+s*r,_=e+(c+u)*n,v=t+(s+l)*r;break;case 180:y=o9._rescale,d=e+n,f=t,p=-n,m=r,h=e+(1-s-l)*n,g=t+c*r,_=e+(1-s)*n,v=t+(c+u)*r;break;case 270:y=o9._rescaleAndSwap,d=e+n,f=t+r,p=-n,m=-r,h=e+(1-c-u)*n,g=t+(1-s-l)*r,_=e+(1-c)*n,v=t+(1-s)*r;break}for(let{line:e,points:t}of this.#r)a.push(y(e,d,f,p,m,i?Array(e.length):null)),o.push(y(t,d,f,p,m,i?Array(t.length):null));return{lines:a,points:o,rect:[h,g,_,v]}}static deserialize(e,t,n,r,i,{paths:{lines:a,points:o},rotation:s,thickness:c}){let l=[],u,d,f,p,m;switch(s){case 0:m=o9._rescale,u=-e/n,d=t/r+1,f=1/n,p=-1/r;break;case 90:m=o9._rescaleAndSwap,u=-t/r,d=-e/n,f=1/r,p=1/n;break;case 180:m=o9._rescale,u=e/n+1,d=-t/r,f=-1/n,p=1/r;break;case 270:m=o9._rescaleAndSwap,u=t/r+1,d=e/n+1,f=-1/r,p=-1/n;break}if(!a){a=[];for(let e of o){let t=e.length;if(t===2){a.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1]]));continue}if(t===4){a.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1],NaN,NaN,NaN,NaN,e[2],e[3]]));continue}let n=new Float32Array(3*(t-2));a.push(n);let[r,i,o,s]=e.subarray(0,4);n.set([NaN,NaN,NaN,NaN,r,i],0);for(let a=4;a<t;a+=2){let t=e[a],c=e[a+1];n.set(o9.createBezierPoints(r,i,o,s,t,c),(a-2)*3),[r,i,o,s]=[o,s,t,c]}}}for(let e=0,t=a.length;e<t;e++)l.push({line:m(a[e].map(e=>e??NaN),u,d,f,p),points:m(o[e].map(e=>e??NaN),u,d,f,p)});let h=new this.prototype.constructor;return h.build(l,n,r,1,s,c,i),h}#l(e=this.#c){let t=this.#n+e/2*this.#o;return this.#s%180==0?[t/this.#i,t/this.#a]:[t/this.#a,t/this.#i]}#u(){let[e,t,n,r]=this.#e,[i,a]=this.#l(0);return[e+i,t+a,n-2*i,r-2*a]}#d(){let e=this.#e=v3.slice();for(let{line:t}of this.#r){if(t.length<=12){for(let n=4,r=t.length;n<r;n+=6)$.pointBoundingBox(t[n],t[n+1],e);continue}let n=t[4],r=t[5];for(let i=6,a=t.length;i<a;i+=6){let[a,o,s,c,l,u]=t.subarray(i,i+6);$.bezierBoundingBox(n,r,a,o,s,c,l,u,e),n=l,r=u}}let[t,n]=this.#l();e[0]=m6(e[0]-t,0,1),e[1]=m6(e[1]-n,0,1),e[2]=m6(e[2]+t,0,1),e[3]=m6(e[3]+n,0,1),e[2]-=e[0],e[3]-=e[1]}get box(){return this.#e}updateProperty(e,t){return e===`stroke-width`?this.#f(t):null}#f(e){let[t,n]=this.#l();this.#c=e;let[r,i]=this.#l(),[a,o]=[r-t,i-n],s=this.#e;return s[0]-=a,s[1]-=o,s[2]+=2*a,s[3]+=2*o,s}updateParentDimensions([e,t],n){let[r,i]=this.#l();this.#i=e,this.#a=t,this.#o=n;let[a,o]=this.#l(),s=a-r,c=o-i,l=this.#e;return l[0]-=s,l[1]-=c,l[2]+=2*s,l[3]+=2*c,l}updateRotation(e){return this.#t=e,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#e.map(o9.svgRound).join(` `)}get defaultProperties(){let[e,t]=this.#e;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${o9.svgRound(e)} ${o9.svgRound(t)}`}}}get rotationTransform(){let[,,e,t]=this.#e,n=0,r=0,i=0,a=0,o=0,s=0;switch(this.#t){case 90:r=t/e,i=-e/t,o=e;break;case 180:n=-1,a=-1,o=e,s=t;break;case 270:r=-t/e,i=e/t,s=t;break;default:return``}return`matrix(${n} ${r} ${i} ${a} ${o9.svgRound(o)} ${o9.svgRound(s)})`}getPathResizingSVGProperties([e,t,n,r]){let[i,a]=this.#l(),[o,s,c,l]=this.#e;if(Math.abs(c-i)<=o9.PRECISION||Math.abs(l-a)<=o9.PRECISION){let i=e+n/2-(o+c/2),a=t+r/2-(s+l/2);return{path:{"transform-origin":`${o9.svgRound(e)} ${o9.svgRound(t)}`,transform:`${this.rotationTransform} translate(${i} ${a})`}}}let u=(n-2*i)/(c-2*i),d=(r-2*a)/(l-2*a),f=c/n,p=l/r;return{path:{"transform-origin":`${o9.svgRound(o)} ${o9.svgRound(s)}`,transform:`${this.rotationTransform} scale(${f} ${p}) translate(${o9.svgRound(i)} ${o9.svgRound(a)}) scale(${u} ${d}) translate(${o9.svgRound(-i)} ${o9.svgRound(-a)})`}}}getPathResizedSVGProperties([e,t,n,r]){let[i,a]=this.#l(),o=this.#e,[s,c,l,u]=o;if(o[0]=e,o[1]=t,o[2]=n,o[3]=r,Math.abs(l-i)<=o9.PRECISION||Math.abs(u-a)<=o9.PRECISION){let i=e+n/2-(s+l/2),a=t+r/2-(c+u/2);for(let{line:e,points:t}of this.#r)o9._translate(e,i,a,e),o9._translate(t,i,a,t);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${o9.svgRound(e)} ${o9.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let d=(n-2*i)/(l-2*i),f=(r-2*a)/(u-2*a),p=-d*(s+i)+e+i,m=-f*(c+a)+t+a;if(d!==1||f!==1||p!==0||m!==0)for(let{line:e,points:t}of this.#r)o9._rescale(e,p,m,d,f,e),o9._rescale(t,p,m,d,f,t);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${o9.svgRound(e)} ${o9.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,t],n){let[r,i]=n,a=this.#e,o=e-a[0],s=t-a[1];if(this.#i===r&&this.#a===i)for(let{line:e,points:t}of this.#r)o9._translate(e,o,s,e),o9._translate(t,o,s,t);else{let e=this.#i/r,t=this.#a/i;this.#i=r,this.#a=i;for(let{line:n,points:r}of this.#r)o9._rescale(n,o,s,e,t,n),o9._rescale(r,o,s,e,t,r);a[2]*=e,a[3]*=t}return a[0]=e,a[1]=t,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${o9.svgRound(e)} ${o9.svgRound(t)}`}}}get defaultSVGProperties(){let e=this.#e;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${o9.svgRound(e[0])} ${o9.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}},h9=class e extends f9{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:`none`,stroke:l8._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-miterlimit":10})}updateSVGProperty(e,t){e===`stroke-width`&&(t??=this[`stroke-width`],t*=this._viewParameters.realScale),super.updateSVGProperty(e,t)}clone(){let t=new e(this._viewParameters);return t.updateAll(this),t}},gne=class e extends p9{static _type=`ink`;static _editorType=E3.INK;static _defaultDrawingOptions=null;constructor(e){super({...e,name:`inkEditor`}),this._willKeepAspectRatio=!0,this.defaultL10nId=`pdfjs-editor-ink-editor`}static initialize(e,t){l8.initialize(e,t),this._defaultDrawingOptions=new h9(t.viewParameters)}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!0}static get typesMap(){return J3(this,`typesMap`,new Map([[D3.INK_THICKNESS,`stroke-width`],[D3.INK_COLOR,`stroke`],[D3.INK_OPACITY,`stroke-opacity`]]))}static createDrawerInstance(e,t,n,r,i){return new hne(e,t,n,r,i,this._defaultDrawingOptions[`stroke-width`])}static deserializeDraw(e,t,n,r,i,a){return m9.deserialize(e,t,n,r,i,a)}static async deserialize(e,t,n){let r=null;if(e instanceof t9){let{data:{inkLists:t,rect:n,rotation:i,id:a,color:o,opacity:s,borderStyle:{rawWidth:c},popupRef:l,richText:u,contentsObj:d,creationDate:f,modificationDate:p},parent:{page:{pageNumber:m}}}=e;r=e={annotationType:E3.INK,color:Array.from(o),thickness:c,opacity:s,paths:{points:t},boxes:null,pageIndex:m-1,rect:n.slice(0),rotation:i,annotationElementId:a,id:a,deleted:!1,popupRef:l,richText:u,comment:d?.str||null,creationDate:f,modificationDate:p}}let i=await super.deserialize(e,t,n);return i._initialData=r,e.comment&&i.setCommentData(e),i}get toolbarButtons(){return this._colorPicker||=new H7(this),[[`colorPicker`,this._colorPicker]]}get colorType(){return D3.INK_COLOR}get colorAndOpacityType(){return D3.INK_COLOR_AND_OPACITY}get opacityType(){return D3.INK_OPACITY}updateParams(e,t){if(e===D3.INK_COLOR_AND_OPACITY){this._updateColorAndOpacity(t.color,t.opacity);return}super.updateParams(e,t)}static updateDefaultParams(e,t){if(e===D3.INK_COLOR_AND_OPACITY){super.updateDefaultParams(D3.INK_COLOR,t.color),super.updateDefaultParams(D3.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:n}=this;t.updateSVGProperty(`stroke-width`),n.drawLayer.updateProperties(e,t.toSVGProperties())}static onScaleChangingWhenDrawing(){let e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty(`stroke-width`),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:t,thickness:n,opacity:r}){this._drawingOptions=e.getDefaultDrawingOptions({stroke:$.makeHexColor(...t),"stroke-width":n,"stroke-opacity":r})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:t,points:n}=this.serializeDraw(e),{_drawingOptions:{stroke:r,"stroke-opacity":i,"stroke-width":a}}=this,o=Object.assign(super.serialize(e),{color:l8._colorManager.convert(r),opacity:i,thickness:a,paths:{lines:t,points:n}});return this.addComment(o),e?(o.isCopy=!0,o):this.annotationElementId&&!this.#e(o)?null:(o.id=this.annotationElementId,o)}#e(e){let{color:t,thickness:n,opacity:r,pageIndex:i}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((e,n)=>e!==t[n])||e.thickness!==n||e.opacity!==r||e.pageIndex!==i}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let{points:t,rect:n}=this.serializeDraw(!1);return e.updateEdited({rect:n,thickness:this._drawingOptions[`stroke-width`],points:t,popup:this.comment}),null}},g9=class extends m9{toSVGPath(){let e=super.toSVGPath();return e.endsWith(`Z`)||(e+=`Z`),e}},_9=8,v9=3,y9=class{static#e={maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16};static#t(e,t,n,r){return n-=e,r-=t,n===0?r>0?0:4:n===1?r+6:2-r}static#n=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static#r(e,t,n,r,i,a,o){let s=this.#t(n,r,i,a);for(let i=0;i<8;i++){let a=(-i+s-o+16)%8,c=this.#n[2*a],l=this.#n[2*a+1];if(e[(n+c)*t+(r+l)]!==0)return a}return-1}static#i(e,t,n,r,i,a,o){let s=this.#t(n,r,i,a);for(let i=0;i<8;i++){let a=(i+s+o+16)%8,c=this.#n[2*a],l=this.#n[2*a+1];if(e[(n+c)*t+(r+l)]!==0)return a}return-1}static#a(e,t,n,r){let i=e.length,a=new Int32Array(i);for(let t=0;t<i;t++)a[t]=+(e[t]<=r);for(let e=1;e<n-1;e++)a[e*t]=a[e*t+t-1]=0;for(let e=0;e<t;e++)a[e]=a[t*n-1-e]=0;let o=1,s,c=[];for(let e=1;e<n-1;e++){s=1;for(let n=1;n<t-1;n++){let r=e*t+n,i=a[r];if(i===0)continue;let l=e,u=n;if(i===1&&a[r-1]===0)o+=1,--u;else if(i>=1&&a[r+1]===0)o+=1,u+=1,i>1&&(s=i);else{i!==1&&(s=Math.abs(i));continue}let d=[n,e],f=u===n+1,p={isHole:f,points:d,id:o,parent:0};c.push(p);let m;for(let e of c)if(e.id===s){m=e;break}m?m.isHole?p.parent=f?m.parent:s:p.parent=f?s:m.parent:p.parent=f?s:0;let h=this.#r(a,t,e,n,l,u,0);if(h===-1){a[r]=-o,a[r]!==1&&(s=Math.abs(a[r]));continue}let g=this.#n[2*h],_=this.#n[2*h+1],v=e+g,y=n+_;l=v,u=y;let b=e,x=n;for(;;){let i=this.#i(a,t,b,x,l,u,1);g=this.#n[2*i],_=this.#n[2*i+1];let c=b+g,f=x+_;d.push(f,c);let p=b*t+x;if(a[p+1]===0?a[p]=-o:a[p]===1&&(a[p]=o),c===e&&f===n&&b===v&&x===y){a[r]!==1&&(s=Math.abs(a[r]));break}else l=b,u=x,b=c,x=f}}}return c}static#o(e,t,n,r){if(n-t<=4){for(let i=t;i<n-2;i+=2)r.push(e[i],e[i+1]);return}let i=e[t],a=e[t+1],o=e[n-4]-i,s=e[n-3]-a,c=Math.hypot(o,s),l=o/c,u=s/c,d=l*a-u*i,f=s/o,p=1/c,m=Math.atan(f),h=Math.cos(m),g=Math.sin(m),_=p*(Math.abs(h)+Math.abs(g)),v=p*(1-_+_**2),y=Math.max(Math.atan(Math.abs(g+h)*v),Math.atan(Math.abs(g-h)*v)),b=0,x=t;for(let r=t+2;r<n-2;r+=2){let t=Math.abs(d-l*e[r+1]+u*e[r]);t>b&&(x=r,b=t)}b>(c*y)**2?(this.#o(e,t,x+2,r),this.#o(e,x,n,r)):r.push(i,a)}static#s(e){let t=[],n=e.length;return this.#o(e,0,n,t),t.push(e[n-2],e[n-1]),t.length<=4?null:t}static#c(e,t,n,r,i,a){let o=new Float32Array(a**2),s=-2*r**2,c=a>>1;for(let e=0;e<a;e++){let t=(e-c)**2;for(let n=0;n<a;n++)o[e*a+n]=Math.exp((t+(n-c)**2)/s)}let l=new Float32Array(256),u=-2*i**2;for(let e=0;e<256;e++)l[e]=Math.exp(e**2/u);let d=e.length,f=new Uint8Array(d),p=new Uint32Array(256);for(let r=0;r<n;r++)for(let i=0;i<t;i++){let s=r*t+i,u=e[s],d=0,m=0;for(let s=0;s<a;s++){let f=r+s-c;if(!(f<0||f>=n))for(let n=0;n<a;n++){let r=i+n-c;if(r<0||r>=t)continue;let p=e[f*t+r],h=o[s*a+n]*l[Math.abs(p-u)];d+=p*h,m+=h}}let h=f[s]=Math.round(d/m);p[h]++}return[f,p]}static#l(e){let t=new Uint32Array(256);for(let n of e)t[n]++;return t}static#u(e){let t=e.length,n=new Uint8ClampedArray(t>>2),r=-1/0,i=1/0;for(let t=0,a=n.length;t<a;t++){let a=n[t]=e[t<<2];r=Math.max(r,a),i=Math.min(i,a)}let a=255/(r-i);for(let e=0,t=n.length;e<t;e++)n[e]=(n[e]-i)*a;return n}static#d(e){let t,n=-1/0,r=-1/0,i=e.findIndex(e=>e!==0),a=i,o=i;for(t=i;t<256;t++){let i=e[t];i>n&&(t-a>r&&(r=t-a,o=t-1),n=i,a=t)}for(t=o-1;t>=0&&!(e[t]>e[t+1]);t--);return t}static#f(e){let t=e,{width:n,height:r}=e,{maxDim:i}=this.#e,a=n,o=r;if(n>i||r>i){let s=n,c=r,l=Math.log2(Math.max(n,r)/i),u=Math.floor(l);l=l===u?u-1:u;for(let n=0;n<l;n++){a=Math.ceil(s/2),o=Math.ceil(c/2);let n=new OffscreenCanvas(a,o);n.getContext(`2d`).drawImage(e,0,0,s,c,0,0,a,o),s=a,c=o,e!==t&&e.close(),e=n.transferToImageBitmap()}let d=Math.min(i/a,i/o);a=Math.round(a*d),o=Math.round(o*d)}let s=new OffscreenCanvas(a,o).getContext(`2d`,{willReadFrequently:!0});s.fillStyle=`white`,s.fillRect(0,0,a,o),s.filter=`grayscale(1)`,s.drawImage(e,0,0,e.width,e.height,0,0,a,o);let c=s.getImageData(0,0,a,o).data;return[this.#u(c),a,o]}static extractContoursFromText(e,{fontFamily:t,fontStyle:n,fontWeight:r},i,a,o,s){let c=new OffscreenCanvas(1,1),l=c.getContext(`2d`,{alpha:!1}),u=l.font=`${n} ${r} 200px ${t}`,{actualBoundingBoxLeft:d,actualBoundingBoxRight:f,actualBoundingBoxAscent:p,actualBoundingBoxDescent:m,fontBoundingBoxAscent:h,fontBoundingBoxDescent:g,width:_}=l.measureText(e),v=1.5,y=Math.ceil(Math.max(Math.abs(d)+Math.abs(f)||0,_)*v),b=Math.ceil(Math.max(Math.abs(p)+Math.abs(m)||200,Math.abs(h)+Math.abs(g)||200)*v);c=new OffscreenCanvas(y,b),l=c.getContext(`2d`,{alpha:!0,willReadFrequently:!0}),l.font=u,l.filter=`grayscale(1)`,l.fillStyle=`white`,l.fillRect(0,0,y,b),l.fillStyle=`black`,l.fillText(e,y*(v-1)/2,b*(3-v)/2);let x=this.#u(l.getImageData(0,0,y,b).data),S=this.#l(x),C=this.#d(S),w=this.#a(x,y,b,C);return this.processDrawnLines({lines:{curves:w,width:y,height:b},pageWidth:i,pageHeight:a,rotation:o,innerMargin:s,mustSmooth:!0,areContours:!0})}static process(e,t,n,r,i){let[a,o,s]=this.#f(e),[c,l]=this.#c(a,o,s,Math.hypot(o,s)*this.#e.sigmaSFactor,this.#e.sigmaR,this.#e.kernelSize),u=this.#d(l),d=this.#a(c,o,s,u);return this.processDrawnLines({lines:{curves:d,width:o,height:s},pageWidth:t,pageHeight:n,rotation:r,innerMargin:i,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:t,pageHeight:n,rotation:r,innerMargin:i,mustSmooth:a,areContours:o}){r%180!=0&&([t,n]=[n,t]);let{curves:s,width:c,height:l}=e,u=e.thickness??0,d=[],f=Math.min(t/c,n/l),p=f/t,m=f/n,h=[];for(let{points:e}of s){let t=a?this.#s(e):e;if(!t)continue;h.push(t);let n=t.length,r=new Float32Array(n),i=new Float32Array(3*(n===2?2:n-2));if(d.push({line:i,points:r}),n===2){r[0]=t[0]*p,r[1]=t[1]*m,i.set([NaN,NaN,NaN,NaN,r[0],r[1]],0);continue}let[o,s,c,l]=t;o*=p,s*=m,c*=p,l*=m,r.set([o,s,c,l],0),i.set([NaN,NaN,NaN,NaN,o,s],0);for(let e=4;e<n;e+=2){let n=r[e]=t[e]*p,a=r[e+1]=t[e+1]*m;i.set(o9.createBezierPoints(o,s,c,l,n,a),(e-2)*3),[o,s,c,l]=[c,l,n,a]}}if(d.length===0)return null;let g=o?new g9:new m9;return g.build(d,t,n,1,r,o?0:u,i),{outline:g,newCurves:h,areContours:o,thickness:u,width:c,height:l}}static async compressSignature({outlines:e,areContours:t,thickness:n,width:r,height:i}){let a=1/0,o=-1/0,s=0;for(let t of e){s+=t.length;for(let e=2,n=t.length;e<n;e++){let n=t[e]-t[e-2];a=Math.min(a,n),o=Math.max(o,n)}}let c;c=a>=-128&&o<=127?Int8Array:a>=-32768&&o<=32767?Int16Array:Int32Array;let l=e.length,u=_9+v9*l,d=new Uint32Array(u),f=0;d[f++]=u*Uint32Array.BYTES_PER_ELEMENT+(s-2*l)*c.BYTES_PER_ELEMENT,d[f++]=0,d[f++]=r,d[f++]=i,d[f++]=+!t,d[f++]=Math.max(0,Math.floor(n??0)),d[f++]=l,d[f++]=c.BYTES_PER_ELEMENT;for(let t of e)d[f++]=t.length-2,d[f++]=t[0],d[f++]=t[1];let p=new CompressionStream(`deflate-raw`),m=p.writable.getWriter();await m.ready,m.write(d);let h=c.prototype.constructor;for(let t of e){let e=new h(t.length-2);for(let n=2,r=t.length;n<r;n++)e[n-2]=t[n]-t[n-2];m.write(e)}return m.close(),(await new Response(p.readable).bytes()).toBase64()}static async decompressSignature(e){try{let t=Uint8Array.fromBase64(e),{readable:n,writable:r}=new DecompressionStream(`deflate-raw`),i=r.getWriter();await i.ready,i.write(t).then(async()=>{await i.ready,await i.close()}).catch(()=>{});let a=null,o=0;for await(let e of n)a||=new Uint8Array(new Uint32Array(e.buffer,0,4)[0]),a.set(e,o),o+=e.length;let s=new Uint32Array(a.buffer,0,a.length>>2),c=s[1];if(c!==0)throw Error(`Invalid version: ${c}`);let l=s[2],u=s[3],d=s[4]===0,f=s[5],p=s[6],m=s[7],h=[],g=(_9+v9*p)*Uint32Array.BYTES_PER_ELEMENT,_;switch(m){case Int8Array.BYTES_PER_ELEMENT:_=new Int8Array(a.buffer,g);break;case Int16Array.BYTES_PER_ELEMENT:_=new Int16Array(a.buffer,g);break;case Int32Array.BYTES_PER_ELEMENT:_=new Int32Array(a.buffer,g);break}o=0;for(let e=0;e<p;e++){let t=s[v9*e+_9],n=new Float32Array(t+2);h.push(n);for(let t=0;t<v9-1;t++)n[t]=s[v9*e+_9+t+1];for(let e=0;e<t;e++)n[e+2]=n[e]+_[o++]}return{areContours:d,thickness:f,outlines:h,width:l,height:u}}catch(e){return V3(`decompressSignature: ${e}`),null}}},_ne=class e extends f9{constructor(){super(),super.updateProperties({fill:l8._defaultLineColor,"stroke-width":0})}clone(){let t=new e;return t.updateAll(this),t}},vne=class e extends h9{constructor(e){super(e),super.updateProperties({stroke:l8._defaultLineColor,"stroke-width":1})}clone(){let t=new e(this._viewParameters);return t.updateAll(this),t}},yne=class e extends p9{#e=!1;#t=null;#n=null;#r=null;static _type=`signature`;static _editorType=E3.SIGNATURE;static _defaultDrawingOptions=null;constructor(e){super({...e,mustBeCommitted:!0,name:`signatureEditor`}),this._willKeepAspectRatio=!0,this.#n=e.signatureData||null,this.#t=null,this.defaultL10nId=`pdfjs-editor-signature-editor1`}static initialize(e,t){l8.initialize(e,t),this._defaultDrawingOptions=new _ne,this._defaultDrawnSignatureOptions=new vne(t.viewParameters)}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!1}static get typesMap(){return J3(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(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let t,n,{_isCopy:r}=this;if(r&&(this._isCopy=!1,t=this.x,n=this.y),super.render(),this._drawId===null)if(this.#n){let{lines:t,mustSmooth:n,areContours:r,description:i,uuid:a,heightInPage:o}=this.#n,{rawDims:{pageWidth:s,pageHeight:c},rotation:l}=this.parent.viewport,u=y9.processDrawnLines({lines:t,pageWidth:s,pageHeight:c,rotation:l,innerMargin:e._INNER_MARGIN,mustSmooth:n,areContours:r});this.addSignature(u,o,i,a)}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||``}));return r&&(this._isCopy=!0,this._moveAfterPaste(t,n)),this.div}setUuid(e){this.#r=e,this.addEditToolbar()}getUuid(){return this.#r}get description(){return this.#t}set description(e){this.#t=e,this.div&&(this.div.setAttribute(`data-l10n-args`,JSON.stringify({description:e})),super.addEditToolbar().then(t=>{t?.updateEditSignatureButton(e)}))}getSignaturePreview(){let{newCurves:e,areContours:t,thickness:n,width:r,height:i}=this.#n,a=Math.max(r,i);return{areContours:t,outline:y9.processDrawnLines({lines:{curves:e.map(e=>({points:e})),thickness:n,width:r,height:i},pageWidth:a,pageHeight:a,rotation:0,innerMargin:0,mustSmooth:!1,areContours:t}).outline}}get toolbarButtons(){return this._uiManager.signatureManager?[[`editSignature`,this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,n,r,i){let{x:a,y:o}=this,{outline:s}=this.#n=t;this.#e=s instanceof g9,this.description=r;let c;this.#e?c=e.getDefaultDrawingOptions():(c=e._defaultDrawnSignatureOptions.clone(),c.updateProperties({"stroke-width":s.thickness})),this._addOutlines({drawOutlines:s,drawingOptions:c});let[,l]=this.pageDimensions,u=n/l;u=u>=1?.5:u,this.width*=u/this.height,this.width>=1&&(u*=.9/this.width,this.width=.9),this.height=u,this.setDims(),this.x=a,this.y=o,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(i),this._reportTelemetry({action:`pdfjs.signature.inserted`,data:{hasBeenSaved:!!i,hasDescription:!!r}}),this.div.hidden=!1}getFromImage(t){let{rawDims:{pageWidth:n,pageHeight:r},rotation:i}=this.parent.viewport;return y9.process(t,n,r,i,e._INNER_MARGIN)}getFromText(t,n){let{rawDims:{pageWidth:r,pageHeight:i},rotation:a}=this.parent.viewport;return y9.extractContoursFromText(t,n,r,i,a,e._INNER_MARGIN)}getDrawnSignature(t){let{rawDims:{pageWidth:n,pageHeight:r},rotation:i}=this.parent.viewport;return y9.processDrawnLines({lines:t,pageWidth:n,pageHeight:r,rotation:i,innerMargin:e._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:n}){t?this._drawingOptions=e.getDefaultDrawingOptions():(this._drawingOptions=e._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":n}))}serialize(e=!1){if(this.isEmpty())return null;let{lines:t,points:n}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":r}}=this,i=Object.assign(super.serialize(e),{isSignature:!0,areContours:this.#e,color:[0,0,0],thickness:this.#e?0:r});return this.addComment(i),e?(i.paths={lines:t,points:n},i.uuid=this.#r,i.isCopy=!0):i.lines=t,this.#t&&(i.accessibilityData={type:`Figure`,alt:this.#t}),i}static deserializeDraw(e,t,n,r,i,a){return a.areContours?g9.deserialize(e,t,n,r,i,a):m9.deserialize(e,t,n,r,i,a)}static async deserialize(e,t,n){let r=await super.deserialize(e,t,n);return r.#e=e.areContours,r.description=e.accessibilityData?.alt||``,r.#r=e.uuid,r}},bne=class extends l8{#e=null;#t=null;#n=null;#r=null;#i=null;#a=``;#o=null;#s=!1;#c=null;#l=!1;#u=!1;static _type=`stamp`;static _editorType=E3.STAMP;constructor(e){super({...e,name:`stampEditor`}),this.#r=e.bitmapUrl,this.#i=e.bitmapFile,this.defaultL10nId=`pdfjs-editor-stamp-editor`}static initialize(e,t){l8.initialize(e,t)}static isHandlingMimeForPasting(e){return L6.includes(e)}static paste(e,t){t.pasteEditor({mode:E3.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){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}}#d(e,t=!1){if(!e){this.remove();return}this.#e=e.bitmap,t||(this.#t=e.id,this.#l=e.isSvg),e.file&&(this.#a=e.file.name),this.#m()}#f(){if(this.#n=null,this._uiManager.enableWaiting(!1),this.#o){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:n}=this._uiManager;if(!n)throw Error(`No ML.`);if(!await n.isEnabledFor(`altText`))throw Error(`ML isn't enabled for alt text.`);let{data:r,width:i,height:a}=e||this.copyCanvas(null,null,!0).imageData,o=await n.guess({name:`altText`,request:{data:r,width:i,height:a,channels:r.length/(i*a)}});if(!o)throw Error(`No response from the AI service.`);if(o.error)throw Error(`Error from the AI service.`);if(o.cancel)return null;if(!o.output)throw Error(`No valid response from the AI service.`);let s=o.output;return await this.setGuessedAltText(s),t&&!this.hasAltTextData()&&(this.altTextData={alt:s,decorative:!1}),s}#p(){if(this.#t){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#t).then(e=>this.#d(e,!0)).finally(()=>this.#f());return}if(this.#r){let e=this.#r;this.#r=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromUrl(e).then(e=>this.#d(e)).finally(()=>this.#f());return}if(this.#i){let e=this.#i;this.#i=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromFile(e).then(e=>this.#d(e)).finally(()=>this.#f());return}let e=document.createElement(`input`);e.type=`file`,e.accept=L6.join(`,`);let t=this._uiManager._signal;this.#n=new Promise(n=>{e.addEventListener(`change`,async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let t=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:`pdfjs.image.image_selected`,data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#d(t)}n()},{signal:t}),e.addEventListener(`cancel`,()=>{this.remove(),n()},{signal:t})}).finally(()=>this.#f()),e.click()}remove(){this.#t&&(this.#e=null,this._uiManager.imageManager.deleteId(this.#t),this.#o?.remove(),this.#o=null,this.#c&&=(clearTimeout(this.#c),null)),super.remove()}rebuild(){if(!this.parent){this.#t&&this.#p();return}super.rebuild(),this.div!==null&&(this.#t&&this.#o===null&&this.#p(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(this.#n||this.#e||this.#r||this.#i||this.#t||this.#s)}get toolbarButtons(){return[[`altText`,this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;return this._isCopy&&(e=this.x,t=this.y),super.render(),this.div.hidden=!0,this.createAltText(),this.#s||(this.#e?this.#m():this.#p()),this._isCopy&&this._moveAfterPaste(e,t),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,t){let{id:n,bitmap:r}=this._uiManager.imageManager.getFromCanvas(e,t);t.remove(),n&&this._uiManager.imageManager.isValidId(n)&&(this.#t=n,r&&(this.#e=r),this.#s=!1,this.#m())}_onResized(){this.onScaleChanging()}onScaleChanging(){this.parent&&(this.#c!==null&&clearTimeout(this.#c),this.#c=setTimeout(()=>{this.#c=null,this.#g()},200))}#m(){let{div:e}=this,{width:t,height:n}=this.#e,[r,i]=this.pageDimensions,a=.75;if(this.width)t=this.width*r,n=this.height*i;else if(t>a*r||n>a*i){let e=Math.min(a*r/t,a*i/n);t*=e,n*=e}this._uiManager.enableWaiting(!1);let o=this.#o=document.createElement(`canvas`);o.setAttribute(`role`,`img`),this.addContainer(o),this.width=t/r,this.height=n/i,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),this.#g(),this.#u||=(this.parent.addUndoableEditor(this),!0),this._reportTelemetry({action:`inserted_image`}),this.#a&&this.div.setAttribute(`aria-description`,this.#a),this.annotationElementId||this._uiManager.a11yAlert(l8._l10nAlert.stamp)}copyCanvas(e,t,n=!1){e||=224;let{width:r,height:i}=this.#e,a=new I6,o=this.#e,s=r,c=i,l=null;if(t){if(r>t||i>t){let e=Math.min(t/r,t/i);s=Math.floor(r*e),c=Math.floor(i*e)}l=document.createElement(`canvas`);let e=l.width=Math.ceil(s*a.sx),n=l.height=Math.ceil(c*a.sy);this.#l||(o=this.#h(e,n));let u=l.getContext(`2d`);u.filter=this._uiManager.hcmFilter;let d=`white`,f=`#cfcfd8`;this._uiManager.hcmFilter===`none`?R6.isDarkMode&&(d=`#8f8f9d`,f=`#42414d`):f=`black`;let p=15*a.sx,m=15*a.sy,h=new OffscreenCanvas(p*2,m*2),g=h.getContext(`2d`);g.fillStyle=d,g.fillRect(0,0,p*2,m*2),g.fillStyle=f,g.fillRect(0,0,p,m),g.fillRect(p,m,p,m),u.fillStyle=u.createPattern(h,`repeat`),u.fillRect(0,0,e,n),u.drawImage(o,0,0,o.width,o.height,0,0,e,n)}let u=null;if(n){let t,n;if(a.symmetric&&o.width<e&&o.height<e)t=o.width,n=o.height;else if(o=this.#e,r>e||i>e){let a=Math.min(e/r,e/i);t=Math.floor(r*a),n=Math.floor(i*a),this.#l||(o=this.#h(t,n))}let s=new OffscreenCanvas(t,n).getContext(`2d`,{willReadFrequently:!0});s.drawImage(o,0,0,o.width,o.height,0,0,t,n),u={width:t,height:n,data:s.getImageData(0,0,t,n).data}}return{canvas:l,width:s,height:c,imageData:u}}#h(e,t){let{width:n,height:r}=this.#e,i=n,a=r,o=this.#e;for(;i>2*e||a>2*t;){let n=i,r=a;i>2*e&&(i=Math.ceil(i/2)),a>2*t&&(a=Math.ceil(a/2));let s=new OffscreenCanvas(i,a);s.getContext(`2d`).drawImage(o,0,0,n,r,0,0,i,a),o=s.transferToImageBitmap()}return o}#g(){let[e,t]=this.parentDimensions,{width:n,height:r}=this,i=new I6,a=Math.ceil(n*e*i.sx),o=Math.ceil(r*t*i.sy),s=this.#o;if(!s||s.width===a&&s.height===o)return;s.width=a,s.height=o;let c=this.#l?this.#e:this.#h(a,o),l=s.getContext(`2d`);l.filter=this._uiManager.hcmFilter,l.drawImage(c,0,0,c.width,c.height,0,0,a,o)}#_(e){if(e){if(this.#l){let e=this._uiManager.imageManager.getSvgUrl(this.#t);if(e)return e}let e=document.createElement(`canvas`);return{width:e.width,height:e.height}=this.#e,e.getContext(`2d`).drawImage(this.#e,0,0),e.toDataURL()}if(this.#l){let[e,t]=this.pageDimensions,n=Math.round(this.width*e*v6.PDF_TO_CSS_UNITS),r=Math.round(this.height*t*v6.PDF_TO_CSS_UNITS),i=new OffscreenCanvas(n,r);return i.getContext(`2d`).drawImage(this.#e,0,0,this.#e.width,this.#e.height,0,0,n,r),i.transferToImageBitmap()}return structuredClone(this.#e)}static async deserialize(e,t,n){let r=null,i=!1;if(e instanceof r9){let{data:{rect:a,rotation:o,id:s,structParent:c,popupRef:l,richText:u,contentsObj:d,creationDate:f,modificationDate:p},container:m,parent:{page:{pageNumber:h}},canvas:g}=e,_,v;g?(delete e.canvas,{id:_,bitmap:v}=n.imageManager.getFromCanvas(m.id,g),g.remove()):(i=!0,e._hasNoCanvas=!0);let y=(await t._structTree.getAriaAttributes(`${w3}${s}`))?.get(`aria-label`)||``;r=e={annotationType:E3.STAMP,bitmapId:_,bitmap:v,pageIndex:h-1,rect:a.slice(0),rotation:o,annotationElementId:s,id:s,deleted:!1,accessibilityData:{decorative:!1,altText:y},isSvg:!1,structParent:c,popupRef:l,richText:u,comment:d?.str||null,creationDate:f,modificationDate:p}}let a=await super.deserialize(e,t,n),{rect:o,bitmap:s,bitmapUrl:c,bitmapId:l,isSvg:u,accessibilityData:d}=e;i?(n.addMissingCanvas(e.id,a),a.#s=!0):l&&n.imageManager.isValidId(l)?(a.#t=l,s&&(a.#e=s)):a.#r=c,a.#l=u;let[f,p]=a.pageDimensions;return a.width=(o[2]-o[0])/f,a.height=(o[3]-o[1])/p,d&&(a.altTextData=d),a._initialData=r,e.comment&&a.setCommentData(e),a.#u=!!r,a}serialize(e=!1,t=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let n=Object.assign(super.serialize(e),{bitmapId:this.#t,isSvg:this.#l});if(this.addComment(n),e)return n.bitmapUrl=this.#_(!0),n.accessibilityData=this.serializeAltText(!0),n.isCopy=!0,n;let{decorative:r,altText:i}=this.serializeAltText(!1);if(!r&&i&&(n.accessibilityData={type:`Figure`,alt:i}),this.annotationElementId){let e=this.#v(n);return e.isSame?null:(e.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=this._initialData.structParent??-1,n.id=this.annotationElementId,delete n.bitmapId,n)}if(t===null)return n;t.stamps||=new Map;let a=this.#l?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!t.stamps.has(this.#t))t.stamps.set(this.#t,{area:a,serialized:n}),n.bitmap=this.#_(!1);else if(this.#l){let e=t.stamps.get(this.#t);a>e.area&&(e.area=a,e.serialized.bitmap.close(),e.serialized.bitmap=this.#_(!1))}return n}#v(e){let{pageIndex:t,accessibilityData:{altText:n}}=this._initialData,r=e.pageIndex===t,i=(e.accessibilityData?.alt||``)===n;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&r&&i,isSameAltText:i}}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}},xne=class e{#e;#t=!1;#n=null;#r=null;#i=null;#a=new Map;#o=!1;#s=!1;#c=!1;#l=null;#u=null;#d=null;#f=null;#p=null;#m=-1;#h;static _initialized=!1;static#g=new Map([fne,gne,bne,d9,yne].map(e=>[e._editorType,e]));constructor({uiManager:t,pageIndex:n,div:r,structTreeLayer:i,accessibilityManager:a,annotationLayer:o,drawLayer:s,textLayer:c,viewport:l,l10n:u}){let d=[...e.#g.values()];if(!e._initialized){e._initialized=!0;for(let e of d)e.initialize(u,t)}t.registerEditorTypes(d),this.#h=t,this.pageIndex=n,this.div=r,this.#e=a,this.#n=o,this.viewport=l,this.#d=c,this.drawLayer=s,this._structTree=i,this.#h.addLayer(this)}get isEmpty(){return this.#a.size===0}get isInvisible(){return this.isEmpty&&this.#h.getMode()===E3.NONE}updateToolbar(e){this.#h.updateToolbar(e)}updateMode(t=this.#h.getMode()){switch(this.#S(),t){case E3.NONE:this.div.classList.toggle(`nonEditing`,!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case E3.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case E3.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:n}=this.div;if(n.toggle(`nonEditing`,!1),t===E3.POPUP)n.toggle(`commentEditing`,!0);else{n.toggle(`commentEditing`,!1);for(let r of e.#g.values())n.toggle(`${r._type}Editing`,t===r._editorType)}this.div.hidden=!1}hasTextLayer(e){return e===this.#d?.div}setEditingState(e){this.#h.setEditingState(e)}addCommands(e){this.#h.addCommands(e)}cleanUndoStack(e){this.#h.cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle(`drawing`,!e)}togglePointerEvents(e=!1){this.div.classList.toggle(`disabled`,!e)}toggleAnnotationLayerPointerEvents(e=!1){this.#n?.togglePointerEvents(e)}get#_(){return this.#a.size===0?this.#h.getEditors(this.pageIndex):this.#a.values()}async enable(){this.#c=!0,this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle(`nonEditing`,!1),this.#p?.abort(),this.#p=null;let e=new Set;for(let t of this.#_)t.enableEditing(),t.show(!0),t.annotationElementId&&(this.#h.removeChangedExistingAnnotation(t),e.add(t.annotationElementId));let t=this.#n;if(t)for(let n of t.getEditableAnnotations()){if(n.hide(),this.#h.isDeletedAnnotationElement(n.data.id)||e.has(n.data.id))continue;let t=await this.deserialize(n);t&&(this.addOrRebuild(t),t.enableEditing())}this.#c=!1,this.#h._eventBus.dispatch(`editorsrendered`,{source:this,pageNumber:this.pageIndex+1})}disable(){if(this.#s=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle(`nonEditing`,!0),this.#d&&!this.#p){this.#p=new AbortController;let e=this.#h.combinedSignal(this.#p);this.#d.div.addEventListener(`pointerdown`,e=>{let{clientX:t,clientY:n,timeStamp:r}=e;if(r-this.#m>500){this.#m=r;return}this.#m=-1;let{classList:i}=this.div;i.toggle(`getElements`,!0);let a=document.elementsFromPoint(t,n);if(i.toggle(`getElements`,!1),!this.div.contains(a[0]))return;let o,s=RegExp(`^${T3}[0-9]+$`);for(let e of a)if(s.test(e.id)){o=e.id;break}if(!o)return;let c=this.#a.get(o);c?.annotationElementId===null&&(O6(e),c.dblclick(e))},{signal:e,capture:!0})}let t=this.#n,n=[];if(t){let e=new Map,r=new Map;for(let t of this.#_){if(t.disableEditing(),!t.annotationElementId){n.push(t);continue}if(t.serialize()!==null){e.set(t.annotationElementId,t);continue}else r.set(t.annotationElementId,t);this.getEditableAnnotation(t.annotationElementId)?.show(),t.remove()}for(let n of t.getEditableAnnotations()){let{id:t}=n.data;if(this.#h.isDeletedAnnotationElement(t)){n.updateEdited({deleted:!0});continue}let i=r.get(t);if(i){i.resetAnnotationElement(n),i.show(!1),n.show();continue}i=e.get(t),i&&(this.#h.addChangedExistingAnnotation(i),i.renderAnnotationElement(n)&&i.show(!1)),n.show()}}this.#S(),this.isEmpty&&(this.div.hidden=!0);let{classList:r}=this.div;for(let t of e.#g.values())r.remove(`${t._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(n),this.#s=!1}getEditableAnnotation(e){return this.#n?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#h.getActive()!==e&&this.#h.setActiveEditor(e)}enableTextSelection(){if(this.div.tabIndex=-1,this.#d?.div&&!this.#f){this.#f=new AbortController;let e=this.#h.combinedSignal(this.#f);this.#d.div.addEventListener(`pointerdown`,this.#v.bind(this),{signal:e}),this.#d.div.classList.add(`highlighting`)}}disableTextSelection(){this.div.tabIndex=0,this.#d?.div&&this.#f&&(this.#f.abort(),this.#f=null,this.#d.div.classList.remove(`highlighting`))}#v(e){this.#h.unselectAll();let{target:t}=e;if(t===this.#d.div||(t.getAttribute(`role`)===`img`||t.classList.contains(`endOfContent`)||t.classList.contains(`textLayerImages`)||t.classList.contains(`textLayerImagePlaceholder`))&&this.#d.div.contains(t)){let{isMac:t}=i6.platform;if(e.button!==0||e.ctrlKey&&t)return;this.#h.showAllEditors(`highlight`,!0,!0),this.#d.div.classList.add(`free`),this.toggleDrawing(),d9.startHighlighting(this,this.#h.direction===`ltr`,{target:this.#d.div,x:e.x,y:e.y}),this.#d.div.addEventListener(`pointerup`,()=>{this.#d.div.classList.remove(`free`),this.toggleDrawing(!0)},{once:!0,signal:this.#h._signal}),e.preventDefault()}}enableClick(){if(this.#r)return;this.#r=new AbortController;let e=this.#h.combinedSignal(this.#r);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.#r?.abort(),this.#r=null}attach(e){this.#a.set(e.id,e);let{annotationElementId:t}=e;t&&this.#h.isDeletedAnnotationElement(t)&&this.#h.removeDeletedAnnotationElement(e)}detach(e){this.#a.delete(e.id),this.#e?.removePointerInTextLayer(e.contentDiv),!this.#s&&e.annotationElementId&&this.#h.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#h.removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){e.parent!==this&&(e.parent&&e.annotationElementId&&(this.#h.addDeletedAnnotationElement(e),l8.deleteAnnotationElement(e),e.annotationElementId=null),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)){if(this.changeParent(e),this.#h.addEditor(e),this.attach(e),!e.isAttachedToDOM){let t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!this.#c),this.#h.addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;let{activeElement:t}=document;e.div.contains(t)&&!this.#i&&(e._focusEventsAllowed=!1,this.#i=setTimeout(()=>{this.#i=null,e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener(`focusin`,()=>{e._focusEventsAllowed=!0},{once:!0,signal:this.#h._signal}),t.focus())},0)),e._structTreeParentId=this.#e?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||=this,e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){this.addCommands({cmd:()=>e._uiManager.rebuild(e),undo:()=>{e.remove()},mustExec:!1})}getEditorByUID(e){for(let t of this.#a.values())if(t.uid===e)return t;return null}get#y(){return e.#g.get(this.#h.getMode())}combinedSignal(e){return this.#h.combinedSignal(e)}#b(e){let t=this.#y;return t?new t.prototype.constructor(e):null}canCreateNewEmptyEditor(){return this.#y?.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e),await this.#h.updateMode(e.mode);let{offsetX:n,offsetY:r}=this.#x(),i=this.#h.getId(),a=this.#b({parent:this,id:i,x:n,y:r,uiManager:this.#h,isCentered:!0,...t});a&&this.add(a)}async deserialize(t){return await e.#g.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#h)||null}createAndAddNewEditor(e,t,n={}){let r=this.#h.getId(),i=this.#b({parent:this,id:r,x:e.offsetX,y:e.offsetY,uiManager:this.#h,isCentered:t,...n});return i&&this.add(i),i}get boundingClientRect(){return this.div.getBoundingClientRect()}#x(){let{x:e,y:t,width:n,height:r}=this.boundingClientRect,i=Math.max(0,e),a=Math.max(0,t),o=Math.min(window.innerWidth,e+n),s=Math.min(window.innerHeight,t+r),c=(i+o)/2-e,l=(a+s)/2-t,[u,d]=this.viewport.rotation%180==0?[c,l]:[l,c];return{offsetX:u,offsetY:d}}addNewEditor(e={}){this.createAndAddNewEditor(this.#x(),!0,e)}setSelected(e){this.#h.setSelected(e)}toggleSelected(e){this.#h.toggleSelected(e)}unselect(e){this.#h.unselect(e)}pointerup(e){let{isMac:t}=i6.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div||!this.#o||(this.#o=!1,this.#y?.isDrawer&&this.#y.supportMultipleDrawings))return;if(!this.#t){this.#t=!0;return}let n=this.#h.getMode();if(n===E3.STAMP||n===E3.POPUP||n===E3.SIGNATURE){this.#h.unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){if(this.#h.getMode()===E3.HIGHLIGHT&&this.enableTextSelection(),this.#o){this.#o=!1;return}let{isMac:t}=i6.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;if(this.#o=!0,this.#y?.isDrawer){this.startDrawingSession(e);return}let n=this.#h.getActive();this.#t=!n||n.isEmpty()}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),this.#l){this.#y.startDrawing(this,this.#h,!1,e);return}this.#h.setCurrentDrawingSession(this),this.#l=new AbortController;let t=this.#h.combinedSignal(this.#l);this.div.addEventListener(`blur`,({relatedTarget:e})=>{e&&!this.div.contains(e)&&(this.#u=null,this.commitOrRemove())},{signal:t}),this.#y.startDrawing(this,this.#h,!1,e)}pause(e){if(e){let{activeElement:e}=document;this.div.contains(e)&&(this.#u=e);return}this.#u&&setTimeout(()=>{this.#u?.focus(),this.#u=null},0)}endDrawingSession(e=!1){return this.#l?(this.#h.setCurrentDrawingSession(null),this.#l.abort(),this.#l=null,this.#u=null,this.#y.endDrawing(e)):null}findNewParent(e,t,n){let r=this.#h.findParent(t,n);return r===null||r===this?!1:(r.changeParent(e),!0)}commitOrRemove(){return this.#l?(this.endDrawingSession(),!0):!1}onScaleChanging(){this.#l&&this.#y.onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),this.#h.getActive()?.parent===this&&(this.#h.commitOrRemove(),this.#h.setActiveEditor(null)),this.#i&&=(clearTimeout(this.#i),null);for(let e of this.#a.values())this.#e?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#a.clear(),this.#h.removeLayer(this)}#S(){for(let e of this.#a.values())e.isEmpty()&&e.remove()}async render({viewport:e}){this.viewport=e,F6(this.div,e);for(let e of this.#h.getEditors(this.pageIndex))this.add(e),e.rebuild();await this.#h.findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:e}){this.#h.commitOrRemove(),this.#S();let t=this.viewport.rotation,n=e.rotation;if(this.viewport=e,F6(this.div,{rotation:n}),t!==n)for(let e of this.#a.values())e.rotate(n)}get pageDimensions(){let{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return this.#h.viewParameters.realScale}};function Sne(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function b9(e){return e?e.nodeType===Node.ELEMENT_NODE?e.closest(`.textLayer`):e.parentElement?.closest(`.textLayer`)||null:null}function Cne(e,t,n,r){if(e===n)return t<=r;let i=e.compareDocumentPosition(n);return i&Node.DOCUMENT_POSITION_FOLLOWING?!0:i&Node.DOCUMENT_POSITION_PRECEDING?!1:null}function x9(e,t,n){if(e.nodeType!==Node.ELEMENT_NODE||!e.classList.contains(`textLayer`)||t!==e.childNodes.length)return{container:e,offset:t};let r=e.lastChild;return r?.nodeType===Node.ELEMENT_NODE&&r.classList.contains(`endOfContent`)&&(r=r.previousSibling),!r||!n.contains(r)?null:r.nodeType===Node.TEXT_NODE?{container:r,offset:r.textContent.length}:{container:r,offset:r.childNodes.length}}var wne=class e{#e=null;#t=new Map;#n=null;#r=null;#i=null;#a=null;#o=new Map;static#s=0;static#c=0;static#l=null;static#u=new Set;static#d=!1;static#f=new Set;static#p=new WeakMap;constructor({filterFactory:t=null,pageColors:n=null,pageIndex:r,textLayer:i=null}){if(this.pageIndex=r,this.#r=t,this.#i=n,i){let t=e.#p.get(i);if(t?.selectionDiv&&(t.selectionDiv.remove(),e.#u.delete(t.selectionDiv)),e.#p.set(i,{drawLayer:this}),e.#f.add(i),this.#n=i,this.#a=new MutationObserver(t=>{if(!(!this.#e||!this.#n?.isConnected||!e.#h())){for(let{addedNodes:n}of t)for(let t of n)if(t.nodeType===Node.ELEMENT_NODE&&t.classList.contains(`endOfContent`)){e.#_();return}}}),this.#a.observe(i,{childList:!0}),e.#l===null){e.#l=new AbortController;let{signal:t}=e.#l;document.addEventListener(`selectionchange`,e.#_.bind(e),{signal:t}),document.addEventListener(`pointerdown`,()=>{e.#d=!0},{signal:t}),document.addEventListener(`pointerup`,()=>{e.#d=!1},{signal:t}),window.addEventListener(`blur`,()=>{e.#d=!1},{signal:t})}}}setParent(t){if(!this.#e){this.#e=t,this.#n?.isConnected&&e.#h()&&e.#_();return}if(this.#e!==t){if(this.#t.size>0)for(let e of this.#t.values())e.remove(),t.append(e);this.#e=t}}static#m(e){let t=this.#p.get(e);t?.selectionDiv&&(t.selectionDiv.remove(),this.#u.delete(t.selectionDiv),t.selectionDiv=null,t.path=null)}static#h(){let e=document.getSelection();return!!e&&!e.isCollapsed}static#g(){return[...this.#f].filter(e=>e.isConnected).sort(Sne)}static#_(){let t=document.getSelection();if(!t||t.isCollapsed){for(let e of this.#u)e.remove();this.#u.clear();return}let n=new WeakMap,r=this.#g(),i=[];for(let e=0,n=t.rangeCount;e<n;e++){let n=t.getRangeAt(e);if(n.collapsed)continue;let{startContainer:a,startOffset:o,endContainer:s,endOffset:c}=n,l=b9(a),u=b9(s),d=l===null,f=u===null;if(this.#d&&d!==f)return;if(t.rangeCount===1){let{anchorNode:e,anchorOffset:n,focusNode:r,focusOffset:i}=t,d=b9(e),f=b9(r),p=Cne(e,n,r,i);d&&f&&p!==null&&(p?(a=e,o=n,l=d,s=r,c=i,u=f):(a=r,o=i,l=f,s=e,c=n,u=d))}let p=r.filter(e=>n.intersectsNode(e));if(p.length===0)continue;let m=!1;if(l||(l=p[0],a=l,o=0,m=!0),u||(u=p.at(-1),s=u,c=u.childNodes.length,m=!0),s.nodeType===Node.ELEMENT_NODE){if(s.classList.contains(`endOfContent`)){let e=s.previousSibling;if(!e)continue;s=e,c=e.nodeType===Node.TEXT_NODE?e.textContent.length:e.childNodes.length}else if(s.classList.contains(`textLayer`)&&s.childNodes.length===c){let e=x9(s,c,u);if(!e)continue;s=e.container,c=e.offset}}if(a.nodeType===Node.ELEMENT_NODE){let e=x9(a,o,l);if(!e)continue;a=e.container,o=e.offset}if(l===u&&!m&&p.includes(l)){i.push([n,l]);continue}for(let e of p){let t=e.firstChild;if(!t)continue;let n=document.createRange();if(e===l?n.setStart(a,o):n.setStartBefore(t),e===u)n.setEnd(s,c);else{let t=e.lastChild;if(!t)continue;if(t.nodeType===Node.ELEMENT_NODE&&t.classList.contains(`endOfContent`)){let e=t.previousSibling;if(!e)continue;n.setEndAfter(e)}else n.setEndAfter(t)}n.collapsed||i.push([n,e])}}let a=new Set(i.map(e=>e[1]));for(let e of this.#f)a.has(e)||this.#m(e);for(let[t,r]of i){let i=e.#p.get(r);if(!i)continue;let a=n.get(r);if(!a){let e=r.getBoundingClientRect();a=(t,n,r,i)=>({x:(t-e.x)/e.width,y:(n-e.y)/e.height,width:r/e.width,height:i/e.height}),n.set(r,a)}let o=[];for(let{x:e,y:n,width:r,height:i}of t.getClientRects())r===0||i===0||({x:e,y:n,width:r,height:i}=a(e,n,r,i),!(r===1&&i===1)&&o.push(`M${e} ${n} h${r} v${i} h-${r} Z`));if(o.length===0)continue;let s=i.drawLayer,c=i.selectionDiv,l=i.path;if(!c){let t=`clip_selection_${e.#c++}`;c=document.createElement(`div`),c.className=`selection`,c.style.clipPath=`url(#${t})`;let n=s.#r?.createSelectionStyle(s.#i);if(n)for(let[e,t]of Object.entries(n))c.style.setProperty(e,t);let r=e._svgFactory.create(1,1,!0);r.setAttribute(`aria-hidden`,`true`),r.setAttribute(`width`,`100%`),r.setAttribute(`height`,`100%`);let a=e._svgFactory.createElement(`clipPath`);a.setAttribute(`id`,t),a.setAttribute(`clipPathUnits`,`objectBoundingBox`),l=e._svgFactory.createElement(`path`),a.append(l),r.append(a),c.append(r),i.path=l,i.selectionDiv=c}!c.parentNode&&s.#e&&(s.#e.append(c),this.#u.add(c)),l.setAttribute(`d`,o.join(` `))}}static get _svgFactory(){return J3(this,`_svgFactory`,new K7)}static#v(e,[t,n,r,i]){let{style:a}=e;a.top=`${100*n}%`,a.left=`${100*t}%`,a.width=`${100*r}%`,a.height=`${100*i}%`}#y(){let t=e._svgFactory.create(1,1,!0);return this.#e.append(t),t.setAttribute(`aria-hidden`,`true`),t}#b(t,n){let r=e._svgFactory.createElement(`clipPath`);t.append(r);let i=`clip_${n}`;r.setAttribute(`id`,i),r.setAttribute(`clipPathUnits`,`objectBoundingBox`);let a=e._svgFactory.createElement(`use`);return r.append(a),a.setAttribute(`href`,`#${n}`),a.classList.add(`clip`),i}#x(e,t){for(let[n,r]of Object.entries(t))r===null?e.removeAttribute(n):e.setAttribute(n,r)}draw(t,n=!1,r=!1){let i=e.#s++,a=this.#y(),o=e._svgFactory.createElement(`defs`);a.append(o);let s=e._svgFactory.createElement(`path`);o.append(s);let c=`path_${i}`;s.setAttribute(`id`,c),s.setAttribute(`vector-effect`,`non-scaling-stroke`),n&&this.#o.set(i,s);let l=r?this.#b(o,c):null,u=e._svgFactory.createElement(`use`);return a.append(u),u.setAttribute(`href`,`#${c}`),this.updateProperties(a,t),this.#t.set(i,a),{id:i,clipPathId:`url(#${l})`}}drawOutline(t,n){let r=e.#s++,i=this.#y(),a=e._svgFactory.createElement(`defs`);i.append(a);let o=e._svgFactory.createElement(`path`);a.append(o);let s=`path_${r}`;o.setAttribute(`id`,s),o.setAttribute(`vector-effect`,`non-scaling-stroke`);let c;if(n){let t=e._svgFactory.createElement(`mask`);a.append(t),c=`mask_${r}`,t.setAttribute(`id`,c),t.setAttribute(`maskUnits`,`objectBoundingBox`);let n=e._svgFactory.createElement(`rect`);t.append(n),n.setAttribute(`width`,`1`),n.setAttribute(`height`,`1`),n.setAttribute(`fill`,`white`);let i=e._svgFactory.createElement(`use`);t.append(i),i.setAttribute(`href`,`#${s}`),i.setAttribute(`stroke`,`none`),i.setAttribute(`fill`,`black`),i.setAttribute(`fill-rule`,`nonzero`),i.classList.add(`mask`)}let l=e._svgFactory.createElement(`use`);i.append(l),l.setAttribute(`href`,`#${s}`),c&&l.setAttribute(`mask`,`url(#${c})`);let u=l.cloneNode();return i.append(u),l.classList.add(`mainOutline`),u.classList.add(`secondaryOutline`),this.updateProperties(i,t),this.#t.set(r,i),r}finalizeDraw(e,t){this.#o.delete(e),this.updateProperties(e,t)}updateProperties(t,n){if(!n)return;let{root:r,bbox:i,rootClass:a,path:o}=n,s=typeof t==`number`?this.#t.get(t):t;if(s){if(r&&this.#x(s,r),i&&e.#v(s,i),a){let{classList:e}=s;for(let[t,n]of Object.entries(a))e.toggle(t,n)}if(o){let e=s.firstElementChild.firstElementChild;this.#x(e,o)}}}updateParent(e,t){if(t===this)return;let n=this.#t.get(e);n&&(t.#e.append(n),this.#t.delete(e),t.#t.set(e,n))}remove(e){this.#o.delete(e),this.#e!==null&&(this.#t.get(e).remove(),this.#t.delete(e))}destroy(){this.#e=null;for(let e of this.#t.values())e.remove();this.#t.clear(),this.#o.clear(),this.#a?.disconnect(),this.#a=null,this.#n&&=(e.#p.get(this.#n)?.drawLayer===this&&(e.#m(this.#n),e.#p.delete(this.#n),e.#f.delete(this.#n),e.#f.size===0&&(e.#l?.abort(),e.#l=null,e.#d=!1)),null)}};function S9(e){return`${(e*100).toFixed(2)}%`}var Tne=class e{#e=[];#t=new Map;#n=null;#r=0;#i=0;#a=0;static#o=null;constructor(e,t,n,r){this.#r=e,this.#e=t,this.#i=n.rawDims.pageWidth,this.#a=n.rawDims.pageHeight,this.#n=r}render(){let t=document.createElement(`div`);t.className=`textLayerImages`;for(let e=0;e<this.#e.length;e+=6){let n=this.#s(this.#e.subarray(e,e+6));n&&t.append(n)}return t.addEventListener(`contextmenu`,t=>{if(!(t.target instanceof HTMLCanvasElement))return;let n=t.target,r=this.#t.get(n);if(!r)return;let i=e.#o?.deref();if(i===n)return;i&&(i.width=0,i.height=0),e.#o=new WeakRef(n);let{inverseTransform:a,x1:o,y1:s,width:c,height:l}=r,u=this.#n(),d=Math.ceil(o*u.width),f=Math.ceil(s*u.height),p=Math.floor((o+c/this.#i)*u.width),m=Math.floor((s+l/this.#a)*u.height);n.width=p-d,n.height=m-f;let h=n.getContext(`2d`);h.setTransform(...a),h.translate(-d,-f),h.drawImage(u,0,0)}),t}#s([e,t,n,r,i,a]){let o=Math.hypot((i-e)*this.#i,(a-t)*this.#a),s=Math.hypot((n-e)*this.#i,(r-t)*this.#a);if(o<this.#r||s<this.#r)return null;let c=[(i-e)*this.#i/o,(a-t)*this.#a/o,(n-e)*this.#i/s,(r-t)*this.#a/s,0,0],l=$.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:S9(e),top:S9(t),width:S9(o/this.#i),height:S9(s/this.#a),transformOrigin:`0% 0%`,transform:`matrix(${c.join(`,`)})`}),this.#t.set(u,{inverseTransform:l,width:o,height:s,x1:e,y1:t}),u}};globalThis._pdfjsTestingUtils={HighlightOutliner:l9},globalThis.pdfjsLib={AbortException:t6,AnnotationEditorLayer:xne,AnnotationEditorParamsType:D3,AnnotationEditorType:E3,AnnotationEditorUIManager:a8,AnnotationLayer:dne,AnnotationMode:C3,AnnotationType:j3,applyOpacity:B6,build:Ute,ColorPicker:V7,createValidAbsoluteUrl:G3,CSSConstants:z6,DOMSVGFactory:K7,DrawLayer:wne,FeatureTest:i6,fetchData:y6,findContrastColor:K6,getDocument:L7,getFilenameFromUrl:C6,getPdfFilenameFromUrl:w6,getRGB:j6,getRGBA:A6,getUuid:l6,GlobalWorkerOptions:E7,ImageKind:A3,InvalidPDFException:Q3,isDataScheme:x6,isPdfFile:S6,isValidExplicitDest:K8,makeArr:d6,makeMap:f6,makeObj:p6,MathClamp:m6,noContextMenu:D6,normalizeUnicode:c6,OPS:P3,OutputScale:I6,PasswordException:X3,PasswordResponses:I3,PDFDataRangeTransport:R7,PDFDateString:k6,PDFWorker:z7,PermissionFlag:O3,PixelsPerInch:v6,RenderingCancelledException:b6,renderRichText:q6,ResponseException:$3,setLayerDimensions:F6,shadow:J3,SignatureExtractor:y9,stopEvent:O6,SupportedImageMimeTypes:L6,TextLayer:I7,TextLayerImages:Tne,TouchManager:c8,updateUrlHash:K3,Util:$,VerbosityLevel:N3,version:B7,XfaLayer:_6};function Ene(e){let t=atob(e),{length:n}=t,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return r}function C9(e){let{src:t}=e,n=(0,Z.useRef)(null),r=(0,Z.useRef)(null),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(),[c,l]=(0,Z.useState)(1),u=(0,Z.useRef)(null),d=(0,Z.useCallback)((e,t,n=o,r=1)=>{let i=e.current;!i||!n||(i.height=0,i.width=0,n.getPage(t).then(e=>{let t=e.getViewport({scale:r});i.height=t.height,i.width=t.width;let n={canvasContext:i.getContext(`2d`),viewport:t,canvas:i};try{return u.current&&u.current.cancel(),u.current=e.render(n),u.current.promise}catch(e){console.error(`Error rendering page:`,e);return}}).catch(e=>console.error(e)))},[o]);return(0,Z.useEffect)(()=>{d(n,c,o)},[o,c,d]),(0,Z.useEffect)(()=>{i&&new Promise(e=>setTimeout(e,100)).then(()=>{d(r,c,o,2)})},[i,o,c,d]),(0,Z.useEffect)(()=>{E7.workerSrc=`https://unpkg.com/pdfjs-dist@${B7}/build/pdf.worker.min.mjs`},[]),(0,Z.useEffect)(()=>{L7({data:Ene(t)}).promise.then(e=>{s(e)},e=>{console.error(e)})},[t]),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(q,{onClick:()=>c>1&&l(c-1),disabled:c<=1,children:`Previous`}),(0,Q.jsx)(q,{onClick:()=>o&&c<o.numPages&&l(c+1),disabled:c>=(o?.numPages??-1),children:`Next`}),(0,Q.jsx)(`canvas`,{ref:n,onClick:()=>a(!0)}),(0,Q.jsx)(aX,{open:i,onOpenChange:a,children:(0,Q.jsxs)(lX,{children:[(0,Q.jsx)($t,{children:(0,Q.jsx)(gn,{})}),(0,Q.jsx)(Bl,{className:`h-100 w-full rounded-md border p-4`,children:(0,Q.jsx)(`canvas`,{ref:r})})]})})]})}var w9=[G.Unprocessed,G.Other],Dne=({document:e,onChange:t})=>{let n=`creditor`in e?e.creditor:void 0,r=!e.documentType||!w9.includes(e.documentType),i=r&&!n?.id||G.Unprocessed===e.documentType,{selectableBusinesses:a,refresh:o}=EK(),s=(0,Z.useMemo)(()=>{if(n||!(`missingInfoSuggestions`in e)||!e.missingInfoSuggestions)return;let t=e.missingInfoSuggestions.owner,r=e.missingInfoSuggestions.counterparty;if(e.missingInfoSuggestions?.isIncome==null){if(e.debtor?.id){let n=e.debtor.id;if(t?.id===n&&r)return r;if(r?.id===n&&t)return t}}else if(e.missingInfoSuggestions.isIncome&&t)return t;else if(!e.missingInfoSuggestions.isIncome&&r)return r},[e,n]),c=!n&&!!s,{name:l=`Missing`,id:u}=(n??s)||{},{updateDocument:d,fetching:f}=Wz(),p=(0,Z.useCallback)(t=>{t!==void 0&&d({documentId:e.id,fields:{creditorId:t}}).then(e.onUpdate)},[e.id,d,e.onUpdate]),[m,h]=(0,Z.useState)(null),g=(0,Z.useCallback)(async e=>{await p(e),o(),t?.()},[p,t,o]);return(0,Q.jsxs)(`div`,{className:`flex flex-wrap`,children:[(0,Q.jsx)(`div`,{className:`flex flex-col justify-center whitespace-normal`,children:(0,Q.jsx)(sT,{inline:!0,size:12,disabled:!i,color:`red`,zIndex:`auto`,children:r&&(u?(0,Q.jsx)(vt,{to:yt.BUSINESSES.DETAIL(u),target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),className:`inline-flex items-center font-semibold`,children:l}):(0,Q.jsx)(P2,{options:a,value:u??null,onChange:e=>e&&p(e),search:m,onSearchChange:h,placeholder:`Choose or create a business`,empty:m?(0,Q.jsx)(O4,{description:m,onAdd:g}):null}))})}),c&&(0,Q.jsx)(zA,{onClick:()=>p(s.id),disabled:f})]})},One=({document:e})=>{let t=`amount`in e?e.amount:void 0,n=`missingInfoSuggestions`in e?e.missingInfoSuggestions?.amount:void 0,r=!t&&!!n,i=t??n,{updateDocument:a,fetching:o}=Wz(),s=(0,Z.useCallback)(t=>{t!==void 0&&a({documentId:e.id,fields:{amount:{raw:t.raw,currency:t.currency}}}).then(e.onUpdate)},[e.id,a,e.onUpdate]);return(0,Q.jsxs)(`div`,{className:`flex flex-wrap`,children:[(0,Q.jsx)(`div`,{className:`flex flex-col justify-center`,children:(0,Q.jsx)(sT,{inline:!0,size:12,disabled:!(G.Other!==e.documentType&&i?.formatted==null),color:`red`,zIndex:`auto`,children:(0,Q.jsx)(`p`,{className:[`whitespace-nowrap`,r?`bg-yellow-400`:``,Number(i?.raw)>0?`text-green-700`:`text-red-500`].join(` `),children:i?.formatted})})}),r&&(0,Q.jsx)(zA,{onClick:()=>s(n),disabled:o})]})},kne=({document:e})=>{let t=`date`in e?e.date:void 0,n=G.Other!==e.documentType,r=n&&!t,i=t?dr(new Date(t),`dd/MM/yy`):`Missing Data`;return(0,Q.jsx)(sT,{inline:!0,size:12,disabled:!r,color:`red`,zIndex:`auto`,children:(0,Q.jsx)(`div`,{children:n?i:null})})},Ane=({document:e,onChange:t})=>{let n=`debtor`in e?e.debtor:void 0,r=!e.documentType||!w9.includes(e.documentType),i=r&&!n?.id||G.Unprocessed===e.documentType,{selectableBusinesses:a,refresh:o}=EK(),s=(0,Z.useMemo)(()=>{if(n||!(`missingInfoSuggestions`in e)||!e.missingInfoSuggestions)return;let t=e.missingInfoSuggestions.owner,r=e.missingInfoSuggestions.counterparty;if(e.missingInfoSuggestions?.isIncome==null){if(e.creditor?.id){let n=e.creditor.id;if(t?.id===n&&r)return r;if(r?.id===n&&t)return t}}else if(e.missingInfoSuggestions.isIncome&&r)return r;else if(!e.missingInfoSuggestions.isIncome&&t)return t},[e,n]),c=!n&&!!s,{name:l=`Missing`,id:u}=(n??s)||{},{updateDocument:d,fetching:f}=Wz(),p=(0,Z.useCallback)(t=>{t!==void 0&&d({documentId:e.id,fields:{debtorId:t}}).then(e.onUpdate)},[e.id,d,e.onUpdate]),[m,h]=(0,Z.useState)(null),g=(0,Z.useCallback)(async e=>{await p(e),o(),t?.()},[p,t,o]);return(0,Q.jsxs)(`div`,{className:`flex flex-wrap`,children:[(0,Q.jsx)(`div`,{className:`flex flex-col justify-center whitespace-normal`,children:(0,Q.jsx)(sT,{inline:!0,size:12,disabled:!i,color:`red`,zIndex:`auto`,children:r&&(u?(0,Q.jsx)(vt,{to:yt.BUSINESSES.DETAIL(u),target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),className:`inline-flex items-center font-semibold`,children:l}):(0,Q.jsx)(P2,{options:a,value:u??null,onChange:e=>e&&p(e),search:m,onSearchChange:h,placeholder:`Choose or create a business`,empty:m?(0,Q.jsx)(O4,{description:m,onAdd:g}):null}))})}),c&&(0,Q.jsx)(zA,{onClick:()=>p(s.id),disabled:f})]})},jne=({document:e})=>{let t=``;if(e.description)t=e.description;else if(`issuedDocumentInfo`in e&&e.issuedDocumentInfo?.originalDocument?.income){let{income:n}=e.issuedDocumentInfo.originalDocument;t=n.map(e=>e.description).join(`, `)}return(0,Q.jsx)(`div`,{className:`flex flex-col justify-center whitespace-normal`,children:(0,Q.jsx)(`p`,{children:t})})},Mne=({document:{image:e,file:t}})=>{let[n,r]=(0,Z.useState)(!1);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap`,children:(0,Q.jsx)(`div`,{className:`flex flex-col justify-center`,children:(0,Q.jsxs)(Qk,{cols:1,children:[(0,Q.jsx)(FK,{disabled:!e,content:`Open Image`,children:(0,Q.jsx)(sT,{inline:!0,size:12,disabled:!!e,color:`red`,zIndex:`auto`,children:(0,Q.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7.5`,disabled:!e,onClick:()=>r(!!e),children:(0,Q.jsx)(Qi,{className:`size-5`})})})}),(0,Q.jsx)(FK,{disabled:!t,content:`Open File`,children:(0,Q.jsx)(sT,{inline:!0,size:12,disabled:!!t,color:`red`,zIndex:`auto`,children:t?(0,Q.jsx)(`a`,{href:typeof t==`string`?t:t.href,target:`_blank`,rel:`noreferrer`,children:(0,Q.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7.5`,children:(0,Q.jsx)(Ji,{className:`size-5`})})}):(0,Q.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7.5`,disabled:!0,children:(0,Q.jsx)(Ji,{className:`size-5`})})})})]})})}),e&&(0,Q.jsx)(gC,{classNames:{content:`overflow-y-auto drop-shadow-lg`},withCloseButton:!0,withOverlay:!1,position:`right`,opened:n,onClose:()=>r(!1),size:`30%`,children:(0,Q.jsx)(`div`,{className:`m-2`,children:(0,Q.jsx)(IK,{src:e.toString(),zoomLevel:3,magnifierHeight:300,magnifierWidth:300})})})]})},Nne=({document:e})=>(0,Q.jsx)(`div`,{className:`flex flex-col justify-center whitespace-normal`,children:(0,Q.jsx)(`p`,{children:e.remarks})}),Pne=({document:e})=>{let t=`serialNumber`in e?e.serialNumber:void 0,n=`allocationNumber`in e?e.allocationNumber:void 0;return(0,Q.jsxs)(`div`,{className:`flex flex-col align-center justify-center flex-wrap`,children:[(0,Q.jsx)(sT,{inline:!0,size:12,disabled:!(G.Other!==e.documentType&&!t),color:`red`,zIndex:`auto`,children:(0,Q.jsx)(`p`,{children:t})}),n&&(0,Q.jsxs)(`p`,{className:`text-xs`,children:[`(`,n,`)`]})]})},Fne=({document:{documentType:e},isOpen:t})=>{let n=!e||e===G.Unprocessed,r=e??G.Unprocessed;return(0,Q.jsx)(`div`,{className:`flex flex-wrap`,children:(0,Q.jsx)(`div`,{className:`flex flex-col justify-center whitespace-normal`,children:(0,Q.jsx)(sT,{inline:!0,size:12,disabled:!n&&!t,color:n?`red`:t?`orange`:`blue`,zIndex:`auto`,children:(0,Q.jsx)(`p`,{children:Il(r)})})})})},Ine=({document:e})=>{let t=`vat`in e?e.vat:void 0;return(0,Q.jsx)(sT,{inline:!0,size:12,disabled:!(G.Other!==e.documentType&&t?.formatted==null),color:`red`,zIndex:`auto`,children:(0,Q.jsx)(`div`,{style:{color:Number(t?.raw)>0?`green`:`red`,whiteSpace:`nowrap`},children:t?.formatted})})},T9=[{id:`date`,accessorKey:`date`,sortingFn:e=>`date`in e.original&&e.original.date?new Date(e.original.date).getTime():0,header:({column:e})=>(0,Q.jsxs)(q,{variant:`ghost`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Date`,e.getIsSorted()&&(e.getIsSorted()===`asc`?(0,Q.jsx)(Zt,{className:`ml-2 h-4 w-4`}):(0,Q.jsx)(_n,{className:`ml-2 h-4 w-4`}))]}),cell:({row:e})=>(0,Q.jsx)(kne,{document:e.original})},{id:`amount`,accessorKey:`amount.raw`,header:({column:e})=>(0,Q.jsxs)(q,{variant:`ghost`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Amount`,e.getIsSorted()&&(e.getIsSorted()===`asc`?(0,Q.jsx)(Zt,{className:`ml-2 h-4 w-4`}):(0,Q.jsx)(_n,{className:`ml-2 h-4 w-4`}))]}),cell:({row:e})=>(0,Q.jsx)(One,{document:e.original})},{id:`vat`,accessorKey:`vat.raw`,header:({column:e})=>(0,Q.jsxs)(q,{variant:`ghost`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`VAT`,e.getIsSorted()&&(e.getIsSorted()===`asc`?(0,Q.jsx)(Zt,{className:`ml-2 h-4 w-4`}):(0,Q.jsx)(_n,{className:`ml-2 h-4 w-4`}))]}),cell:({row:e})=>(0,Q.jsx)(Ine,{document:e.original})},{id:`type`,accessorKey:`documentType`,header:({column:e})=>(0,Q.jsxs)(q,{variant:`ghost`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Type`,e.getIsSorted()&&(e.getIsSorted()===`asc`?(0,Q.jsx)(Zt,{className:`ml-2 h-4 w-4`}):(0,Q.jsx)(_n,{className:`ml-2 h-4 w-4`}))]}),cell:({row:e})=>(0,Q.jsx)(Fne,{document:e.original,isOpen:`issuedDocumentInfo`in e.original&&e.original.issuedDocumentInfo?.status===`OPEN`})},{id:`serial`,accessorKey:`serialNumber`,header:({column:e})=>(0,Q.jsxs)(q,{variant:`ghost`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Serial`,e.getIsSorted()&&(e.getIsSorted()===`asc`?(0,Q.jsx)(Zt,{className:`ml-2 h-4 w-4`}):(0,Q.jsx)(_n,{className:`ml-2 h-4 w-4`}))]}),cell:({row:e})=>(0,Q.jsx)(Pne,{document:e.original})},{id:`description`,accessorKey:`description`,header:`Description`,cell:({row:e})=>(0,Q.jsx)(jne,{document:e.original})},{id:`remarks`,accessorKey:`remarks`,header:`Remarks`,cell:({row:e})=>(0,Q.jsx)(Nne,{document:e.original})},{id:`creditor`,accessorKey:`creditor.name`,header:({column:e})=>(0,Q.jsxs)(q,{variant:`ghost`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Creditor`,e.getIsSorted()&&(e.getIsSorted()===`asc`?(0,Q.jsx)(Zt,{className:`ml-2 h-4 w-4`}):(0,Q.jsx)(_n,{className:`ml-2 h-4 w-4`}))]}),cell:({row:e})=>(0,Q.jsx)(Dne,{document:e.original,onChange:e.original.onUpdate})},{id:`debtor`,accessorKey:`debtor.name`,header:({column:e})=>(0,Q.jsxs)(q,{variant:`ghost`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Debtor`,e.getIsSorted()&&(e.getIsSorted()===`asc`?(0,Q.jsx)(Zt,{className:`ml-2 h-4 w-4`}):(0,Q.jsx)(_n,{className:`ml-2 h-4 w-4`}))]}),cell:({row:e})=>(0,Q.jsx)(Ane,{document:e.original,onChange:e.original.onUpdate})},{id:`file`,accessorKey:`file`,header:({column:e})=>(0,Q.jsxs)(q,{variant:`ghost`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`files`,e.getIsSorted()&&(e.getIsSorted()===`asc`?(0,Q.jsx)(Zt,{className:`ml-2 h-4 w-4`}):(0,Q.jsx)(_n,{className:`ml-2 h-4 w-4`}))]}),cell:({row:e})=>(0,Q.jsx)(Mne,{document:e.original})},{id:`edit`,accessorKey:`id`,header:`Edit`,cell:({row:e})=>(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,Q.jsx)(JA,{onClick:e.original.editDocument,tooltip:`Edit Document`}),`issuedDocumentInfo`in e.original&&e.original.issuedDocumentInfo?.status===`OPEN`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(RA,{documentId:e.original.id,couldIssueCreditInvoice:e.original.documentType===G.Invoice||e.original.documentType===G.InvoiceReceipt}),(0,Q.jsx)(N9,{documentId:e.original.id,tooltip:`Issue Document out of This Document`})]})]})}];function E9({businessId:e,linkedDocumentIds:t,limit:n}){let[r,i]=(0,Z.useState)(void 0),[{data:a,fetching:o}]=H({query:Ne,variables:{businessId:e,limit:n}}),s=(0,Z.useMemo)(()=>a?.recentDocumentsByBusiness?.map(e=>{let t=Br(tt,e);return t?{...t,onUpdate:()=>{},editDocument:()=>i(t.id)}:null}).filter(e=>!!e)??[],[a?.recentDocumentsByBusiness]),c=[`date`,`amount`,`vat`,`type`,`serial`,`description`,`remarks`,`file`,`edit`],l=Fr({data:s,columns:T9.filter(e=>e.id&&c.includes(e.id)),getCoreRowModel:yi(),state:{}});return(0,Q.jsxs)(Ei,{children:[(0,Q.jsx)(Si,{children:(0,Q.jsx)(wi,{children:`Recent Client Documents`})}),(0,Q.jsx)(Ci,{children:o?(0,Q.jsx)(`div`,{children:`Loading...`}):(0,Q.jsxs)(_i,{children:[(0,Q.jsx)(Mr,{children:l.getHeaderGroups().map(e=>(0,Q.jsx)(ii,{children:e.headers.map(e=>(0,Q.jsx)(Gr,{colSpan:e.colSpan,children:e.isPlaceholder?null:mi(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,Q.jsx)(ti,{children:l.getRowModel().rows?.length?l.getRowModel().rows.map(e=>(0,Q.jsx)(ii,{"data-state":e.getIsSelected()&&`selected`,className:e.original.issuedDocumentInfo?.externalId&&t.includes(e.original.issuedDocumentInfo.externalId)?`bg-blue-100`:``,children:e.getVisibleCells().map(e=>(0,Q.jsx)(di,{children:mi(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,Q.jsx)(ii,{children:(0,Q.jsx)(di,{colSpan:l.options.columns.length,className:`h-24 text-center`,children:`No results.`})})})]})}),(0,Q.jsx)(i4,{documentId:r,onDone:()=>i(void 0),onChange:()=>{}})]})}var D9=({documentsProps:e,onChange:t,limited:n=!1})=>{let[r,i]=(0,Z.useState)(void 0),[a,o]=(0,Z.useState)([]),s=(0,Z.useMemo)(()=>e?.map(e=>{let n=Br(tt,e);return{...n,editDocument:()=>i(n.id),onUpdate:t??(()=>{})}}),[e,t]),[c,l]=(0,Z.useState)({}),u=[`date`,`amount`,`vat`,`type`,`serial`,`file`],d=Fr({data:s,columns:n?T9.filter(e=>e.id&&u.includes(e.id)):T9,getCoreRowModel:yi(),onSortingChange:o,getSortedRowModel:Xr(),onColumnVisibilityChange:l,state:{sorting:a,columnVisibility:c}});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(_i,{children:[(0,Q.jsx)(Mr,{children:d.getHeaderGroups().map(e=>(0,Q.jsx)(ii,{children:e.headers.map(e=>(0,Q.jsx)(Gr,{colSpan:e.colSpan,children:e.isPlaceholder?null:mi(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,Q.jsx)(ti,{children:d.getRowModel().rows?.length?d.getRowModel().rows.map(e=>(0,Q.jsx)(ii,{"data-state":e.getIsSelected()&&`selected`,children:e.getVisibleCells().map(e=>(0,Q.jsx)(di,{children:mi(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,Q.jsx)(ii,{children:(0,Q.jsx)(di,{colSpan:T9.length,className:`h-24 text-center`,children:`No results.`})})})]}),(0,Q.jsx)(i4,{documentId:r,onDone:()=>i(void 0),onChange:()=>t?.()})]})};function O9({documentType:e}){let[{data:t,fetching:n}]=H({query:u,variables:{documentType:e}}),r=t?.recentIssuedDocumentsByType??[];return(0,Q.jsxs)(Ei,{children:[(0,Q.jsx)(Si,{children:(0,Q.jsx)(wi,{children:`Recent Documents of the Same Type`})}),(0,Q.jsx)(Ci,{children:n?(0,Q.jsx)(`div`,{children:`Loading...`}):(0,Q.jsx)(D9,{documentsProps:r})})]})}var Lne=sK(),k9={type:G.Invoice,language:Ae.English,currency:f.Usd,vatType:Je.Default,date:dr(new Date,`yyyy-MM-dd`),rounding:!1,signed:!0,income:[],payment:[]};function A9({initialFormData:e,onDone:t,onClose:n,chargeId:r}){let[i,a]=(0,Z.useState)({...k9,...e}),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),{previewDocument:f,fetching:p}=X4(),{issueDocument:m}=J4(),[h,g]=(0,Z.useState)(!1),_=(0,Z.useCallback)((e,t)=>{a(n=>({...n,[e]:t}))},[]);(0,Z.useEffect)(()=>{d(!0),l(!1)},[i]),(0,Z.useEffect)(()=>{a({...k9,...e})},[(0,Z.useMemo)(()=>JSON.stringify(e||{}),[e])]);let v=(0,Z.useCallback)(async()=>{try{let e=await f({input:i});if(!e)throw Error(`No preview data returned`);s(e),l(!0),d(!1)}catch(e){console.error(`Failed to generate preview:`,e)}},[i,f]),y=(0,Z.useCallback)(()=>{t?t(i):g(!0)},[t,i]),b=(0,Z.useCallback)(async e=>{await m({input:i,chargeId:r,...e})},[i,r,m]),x=!c||p||u,S=(0,Z.useMemo)(()=>i.income?.reduce((e,t)=>{let n=t.price*t.quantity,r=n*((t.vatRate||0)/100);return e+n+r},0)||0,[i.income]);return(0,Q.jsx)(`div`,{className:`min-h-screen bg-gray-50 p-4`,children:(0,Q.jsxs)(`div`,{className:`max-w-7xl mx-auto`,children:[(0,Q.jsxs)(`div`,{className:`mb-6`,children:[(0,Q.jsx)(`h1`,{className:`text-3xl font-bold text-gray-900`,children:`Generate Document`}),(0,Q.jsx)(`p`,{className:`text-gray-600 mt-2`,children:`Create and preview your accounting document before issuing`})]}),(0,Q.jsxs)(`div`,{className:`grid lg:grid-cols-2 gap-6`,children:[(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(wK,{formData:i,updateFormData:_}),(0,Q.jsx)(Ei,{children:(0,Q.jsxs)(Ci,{className:`pt-6`,children:[(0,Q.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Q.jsx)(q,{onClick:v,disabled:p||c,variant:`outline`,className:`flex-1 bg-transparent`,children:p?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Tn,{className:`w-4 h-4 mr-2 animate-spin`}),`Generating...`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Gi,{className:`w-4 h-4 mr-2`}),`Preview`]})}),(0,Q.jsxs)(q,{onClick:y,disabled:x,className:`flex-1`,children:[(0,Q.jsx)(ma,{className:`w-4 h-4 mr-2`}),t?`Accept Changes`:`Issue Document`]})]}),u&&!p&&(0,Q.jsx)(`p`,{className:`text-sm text-amber-600 bg-amber-50 p-2 rounded mt-3`,children:`Form has been modified. Click Preview to update the document before issuing.`}),S>0&&(0,Q.jsx)(`div`,{className:`mt-4 p-3 bg-blue-50 rounded-lg`,children:(0,Q.jsxs)(`div`,{className:`flex justify-between items-center font-medium text-blue-900`,children:[(0,Q.jsx)(`span`,{children:`Total Document Amount:`}),(0,Q.jsxs)(`span`,{children:[S.toFixed(2),` `,i.currency]})]})})]})})]}),(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsxs)(Ei,{className:`h-fit`,children:[(0,Q.jsx)(Si,{children:(0,Q.jsx)(wi,{children:`Document Preview`})}),(0,Q.jsx)(Ci,{children:(0,Q.jsx)(`div`,{className:`border-2 border-dashed border-gray-200 rounded-lg min-h-[600px] flex items-center justify-center bg-gray-50`,children:p?(0,Q.jsxs)(`div`,{className:`text-center`,children:[(0,Q.jsx)(Tn,{className:`w-8 h-8 animate-spin mx-auto mb-4 text-gray-400`}),(0,Q.jsx)(`p`,{className:`text-gray-500`,children:`Generating document preview...`})]}):o?(0,Q.jsx)(`div`,{className:`w-full`,children:(0,Q.jsx)(`div`,{className:`bg-white shadow-lg rounded-lg overflow-hidden`,children:(0,Q.jsx)(`div`,{className:`aspect-[8.5/11] bg-white border`,children:(0,Q.jsx)(`div`,{className:`h-full flex items-center justify-center`,children:(0,Q.jsxs)(`div`,{className:`text-center p-6`,children:[(0,Q.jsx)(C9,{src:o}),!c&&(0,Q.jsx)(`p`,{className:`text-xs text-amber-600 mt-3 bg-amber-50 px-2 py-1 rounded`,children:`Preview may be outdated`})]})})})})}):(0,Q.jsxs)(`div`,{className:`text-center`,children:[(0,Q.jsx)(qi,{className:`w-16 h-16 mx-auto mb-4 text-gray-300`}),(0,Q.jsx)(`p`,{className:`text-gray-500 mb-2`,children:`No preview available`}),(0,Q.jsx)(`p`,{className:`text-sm text-gray-400`,children:`Click Preview to generate document`})]})})})]}),i.client?.id&&(0,Q.jsx)(E9,{businessId:i.client?.id,linkedDocumentIds:i.linkedDocumentIds??[]}),(0,Q.jsx)(O9,{documentType:i.type})]})]}),(0,Q.jsx)(Q4,{isOpen:h,onClose:()=>{g(!1),n()},onIssue:b,clientName:i.client?.name,clientEmails:i.client?.emails,documentType:Lne.find(e=>e.value===i.type)?.value})]})})}function j9(e){return{address:e.originalBusiness.address??void 0,city:e.originalBusiness.city??void 0,country:e.originalBusiness.country.code,emails:e.emails,id:e.id,name:e.originalBusiness.name,phone:e.originalBusiness.phoneNumber??void 0,taxId:e.originalBusiness.governmentId??void 0,zipCode:e.originalBusiness.zipCode??void 0}}function M9(e,t){let n;e.remarks&&(n=e.remarks,t===G.CreditInvoice&&(n=n.replace(Il(G.Receipt),Il(G.CreditInvoice))));let{currency:r}=e;return t===G.CreditInvoice&&(r=e.income?.[0]?.currency||r),{...e,currency:r,description:e.description||void 0,remarks:n,footer:e.footer||void 0,date:e.date||void 0,dueDate:e.dueDate||void 0,discount:e.discount||void 0,rounding:e.rounding||void 0,signed:e.signed||void 0,maxPayments:e.maxPayments||void 0,client:e.client?j9(Br(se,e.client)):void 0,income:e.income?.map(e=>({...e,currencyRate:e.currencyRate??void 0,itemId:e.itemId||void 0,vatRate:e.vatRate??void 0})),payment:e.payment?.map(e=>({...e,currencyRate:e.currencyRate||void 0,date:e.date||void 0,bankName:e.bankName||void 0,bankBranch:e.bankBranch||void 0,bankAccount:e.bankAccount||void 0,chequeNum:e.chequeNum||void 0,accountId:e.accountId||void 0,transactionId:e.transactionId||void 0,cardType:e.cardType||void 0,cardNum:e.cardNum||void 0,numPayments:e.numPayments||void 0,firstPayment:e.firstPayment||void 0})),linkedDocumentIds:e.linkedDocumentIds||void 0,linkedPaymentId:e.linkedPaymentId||void 0,type:t||e.type}}function N9({open:e=!1,setOpen:t,tooltip:n,chargeId:r,documentId:i,documentType:a,onDone:o,trigger:s,...c}){let[l,u]=(0,Z.useState)(!1),d=(0,Z.useMemo)(()=>t?e:l,[e,l,t]),f=(0,Z.useCallback)(e=>{t?t(e):u(e)},[t]),[{data:p,fetching:m,error:h},g]=H({query:nt,pause:!r||!d,variables:{chargeId:r||``}}),[{data:_,fetching:v,error:y},b]=H({query:lt,pause:!i||!d,variables:{documentId:i||``}});(0,Z.useEffect)(()=>{d&&(r&&!p&&!m&&!h?g():i&&!_&&!v&&!y&&b())},[r,p,m,h,g,i,_,v,y,b,d]);let x=(0,Z.useMemo)(()=>{if(p?.newDocumentDraftByCharge)return Br(me,p.newDocumentDraftByCharge);if(_?.newDocumentDraftByDocument)return Br(me,_.newDocumentDraftByDocument)},[_,p]),S=(0,Z.useMemo)(()=>{if(x)return M9(x,a);if(`initialFormData`in c&&c.initialFormData)return c.initialFormData},[x,a,c]);return(0,Q.jsxs)(Jt,{open:d,onOpenChange:f,children:[(!t||!!s)&&(0,Q.jsx)(un,{onClick:e=>e.stopPropagation(),children:(0,Q.jsxs)(rr,{children:[(0,Q.jsx)(yr,{children:s??(0,Q.jsx)(q,{className:`size-7.5`,variant:`ghost`,children:(0,Q.jsx)(da,{className:`size-5`})})}),(0,Q.jsx)(or,{children:(0,Q.jsx)(`p`,{children:n||`Issue new document`})})]})}),(0,Q.jsxs)(cn,{className:`w-[90vw] sm:max-w-[95%] max-h-[90vh] overflow-y-auto`,onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)($t,{children:(0,Q.jsx)(gn,{children:`Issue New Document`})}),m||v?(0,Q.jsx)(Tn,{className:`h-10 w-10 animate-spin`}):(0,Q.jsx)(A9,{initialFormData:S,onDone:o?e=>{o(e),f(!1)}:void 0,onClose:()=>f(!1),chargeId:r})]})]})}var P9=({content:e,title:t,opened:n=!1,onClose:r=()=>{},modalSize:i,withCloseButton:a=!1})=>(0,Q.jsx)(fO,{size:i,opened:n,onClose:r,title:t,withCloseButton:a,children:e}),F9=()=>{let[{data:e,fetching:t,error:n},r]=H({query:pe});(0,Z.useEffect)(()=>{n&&(console.error(`Error fetching admin businesses: ${n}`),K.error(`Error`,{description:`Unable to fetch admin businesses`}))},[n]);let i=(0,Z.useMemo)(()=>e?.allAdminBusinesses?.slice().sort((e,t)=>e.name.localeCompare(t.name))??[],[e]);return{fetching:t,refresh:()=>r(),adminBusinesses:i,selectableAdminBusinesses:(0,Z.useMemo)(()=>i.map(e=>({value:e.id,label:e.name})),[i])}},I9=`sync-green-invoice-documents`,Rne=()=>{let[{fetching:e},t]=p(Ee);return{fetching:e,syncGreenInvoiceDocuments:(0,Z.useCallback)(async e=>{let n=`Error syncing documents owned by [${e.ownerId}]`;K.loading(`Syncing Documents`,{id:I9});try{let r=Xe(await t(e),n,I9);if(r)return K.success(`Success`,{id:I9,description:r.syncGreenInvoiceDocuments.length>0?kK({data:r.syncGreenInvoiceDocuments}):`No new documents found`,duration:r.syncGreenInvoiceDocuments.length>0?1/0:5e3,closeButton:r.syncGreenInvoiceDocuments.length>0}),r.syncGreenInvoiceDocuments}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:I9,description:n,duration:1e5,closeButton:!0})}},[t])}};function zne({opened:e,close:t,setIsLoading:n}){let{selectableAdminBusinesses:r,fetching:i}=F9(),{control:a,handleSubmit:o}=Xn({defaultValues:{ownerId:`6a20aa69-57ff-446e-8d6a-1e96d095e988`}}),{syncGreenInvoiceDocuments:s,fetching:c}=Rne();return(0,Z.useEffect)(()=>{n?.(i||c)},[i,c,n]),(0,Q.jsxs)(fO,{opened:e,onClose:t,size:`auto`,centered:!0,children:[(0,Q.jsx)(fO.Title,{children:`Sync Green Invoice Documents`}),(0,Q.jsxs)(fO.Body,{children:[i?(0,Q.jsx)(`div`,{children:`Loading...`}):(0,Q.jsx)(`div`,{}),(0,Q.jsxs)(`form`,{onSubmit:o(e=>{s(e),t()}),children:[(0,Q.jsx)(kr,{name:`ownerId`,control:a,render:({field:e,fieldState:t})=>(0,Q.jsx)(Fk,{...e,data:r,value:e.value,disabled:i,label:`Owner:`,placeholder:`Scroll to see all options`,maxDropdownHeight:160,searchable:!0,error:t.error?.message})}),(0,Q.jsx)(`div`,{className:`flex justify-center mt-5 gap-3`,children:(0,Q.jsx)(`button`,{type:`submit`,className:`text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg`,children:`Sync`})})]})]})]})}var Bne=(0,Z.createContext)(null),L9={didCatch:!1,error:null},R9=class extends Z.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=L9}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;t!==null&&(this.props.onReset?.({args:e,reason:`imperative-api`}),this.setState(L9))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&t.error!==null&&Vne(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:`keys`}),this.setState(L9))}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof t==`function`)o=t(e);else if(n)o=(0,Z.createElement)(n,e);else if(r!==void 0)o=r;else throw a}return(0,Z.createElement)(Bne.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function Vne(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}var Hne=`batchUpdateCharges`,Une=()=>{let[{fetching:e},t]=p(fe);return{fetching:e,batchUpdateCharges:(0,Z.useCallback)(async e=>{let n=Array.isArray(e.chargeIds)?e.chargeIds:[e.chargeIds],r=`Error updating charge IDs [${n.join(`, `)}]`,i=`${Hne}-${n[0]}`;K.loading(`Updating charge`,{id:i});try{let a=Xe(await t(e),r,i,`batchUpdateCharges`);if(a)return K.success(`Success`,{id:i,description:`${n.length} charge${n.length>1?`s`:``} updated`}),a.batchUpdateCharges.charges}catch(e){console.error(`${r}: ${e}`),K.error(`Error`,{id:i,description:r,duration:1e5,closeButton:!0})}},[t])}},Wne=[{id:`select`,header:({table:e})=>(0,Q.jsx)(Z4,{checked:e.getIsAllPageRowsSelected()||e.getIsSomePageRowsSelected()&&`indeterminate`,onCheckedChange:t=>e.toggleAllPageRowsSelected(!!t),"aria-label":`Select all`}),cell:({row:e})=>(0,Q.jsx)(Z4,{checked:e.getIsSelected(),onCheckedChange:t=>e.toggleSelected(!!t),"aria-label":`Select row`}),enableSorting:!1,enableHiding:!1},{accessorKey:`chargeType`,header:`Type`,cell:({row:e})=>(0,Q.jsx)(`div`,{children:e.getValue(`chargeType`)})},{accessorKey:`counterpartyName`,header:`Counterparty`,cell:({row:e})=>(0,Q.jsx)(`div`,{children:e.getValue(`counterpartyName`)})},{accessorKey:`date`,header:`Date`,cell:({row:e})=>{let t=e.getValue(`date`);return(0,Q.jsx)(`div`,{children:t?dr(new Date(t),`yyyy-MM-dd`):`Missing`})}},{accessorKey:`amountRaw`,header:`Amount`,cell:({row:e})=>(0,Q.jsx)(`div`,{children:e.original.amountFormatted})},{accessorKey:`vatAmountRaw`,header:`VAT Amount`,cell:({row:e})=>(0,Q.jsx)(`div`,{children:e.original.vatAmountFormatted})},{accessorKey:`description`,header:`Description`,cell:({row:e})=>(0,Q.jsx)(`div`,{children:e.getValue(`description`)})},{accessorKey:`taxCategoryName`,header:`Tax Category`,cell:({row:e})=>(0,Q.jsx)(`div`,{children:e.getValue(`taxCategoryName`)})},{accessorKey:`tags`,header:`Tags`,cell:({row:e})=>{let t=e.getValue(`tags`);return!t||!Array.isArray(t)||t.length===0?(0,Q.jsx)(`div`,{children:`No tags`}):(0,Q.jsx)(`div`,{children:t.join(` | `)})}},{accessorKey:`businessTripName`,header:`Business Trip`,cell:({row:e})=>(0,Q.jsx)(`div`,{children:e.getValue(`businessTripName`)})},{accessorKey:`moreInfo`,header:`More Info`,cell:({row:e})=>{let t=e.original.transactions||0,n=e.original.documents||0,r=e.original.miscExpenses||0,i=e.original.ledgerRecords||0;return(0,Q.jsxs)(`div`,{className:`flex flex-col justify-center text-sm`,children:[t>0&&(0,Q.jsxs)(`div`,{children:[`Transactions: `,t]}),n>0&&(0,Q.jsxs)(`div`,{children:[`Documents: `,n]}),r>0&&(0,Q.jsxs)(`div`,{children:[`Misc Expenses: `,r]}),i>0&&(0,Q.jsxs)(`div`,{children:[`Ledger Records: `,i]})]})},enableSorting:!1}];function z9({data:e,tagIds:t,description:n,onOpenChange:r,title:i=`Similar Charges`}){let[a,o]=Z.useState([]),[s,c]=Z.useState({}),l=(0,Z.useMemo)(()=>e.map(e=>Br(Qe,e)),[e]),u=(0,Z.useMemo)(()=>l.map(e=>({id:e.id,chargeType:yl(e.__typename),counterpartyName:e.counterparty?.name,date:e.minEventDate||e.minDebitDate||e.minDocumentsDate||void 0,amountRaw:e.totalAmount?.raw,amountFormatted:e.totalAmount?.formatted,vatAmountRaw:e.vat?.raw,vatAmountFormatted:e.vat?.formatted,description:e.userDescription||void 0,tags:e.tags.map(e=>e.name),taxCategoryName:e.taxCategory?.name,businessTripName:e.__typename===`BusinessTripCharge`?e.businessTrip?.name:void 0,ledgerRecords:e.metadata?.ledgerCount??0,documents:e.metadata?.documentsCount??0,transactions:e.metadata?.transactionsCount??0,miscExpenses:e.metadata?.miscExpensesCount??0}))??[],[l]);(0,Z.useEffect)(()=>{e&&u.length===0&&r(!1)},[e,u.length,r]);let d=Fr({data:u,columns:Wne,onSortingChange:o,getCoreRowModel:yi(),getSortedRowModel:Xr(),onRowSelectionChange:c,state:{sorting:a,rowSelection:s}}),{batchUpdateCharges:f}=Une(),p=(0,Z.useCallback)(async()=>{let e=d.getSelectedRowModel().rows.map(e=>e.original.id);await f({chargeIds:e,fields:{...t?{tags:t}:{},...n?{userDescription:n}:{}}}),r(!1)},[f,r,d,t,n]);return(0,Z.useEffect)(()=>{e.length===0&&r(!1)},[e.length,r]),e.length?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)($t,{className:`flex flex-row items-center justify-between`,children:[(0,Q.jsx)(gn,{children:i}),(0,Q.jsx)(q,{onClick:p,children:`Approve selected`})]}),(0,Q.jsx)(Ei,{children:(0,Q.jsxs)(_i,{children:[(0,Q.jsx)(Mr,{children:d.getHeaderGroups().map(e=>(0,Q.jsx)(ii,{children:e.headers.map(e=>(0,Q.jsx)(Gr,{children:e.isPlaceholder?null:mi(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,Q.jsx)(ti,{children:d.getRowModel().rows.map(e=>(0,Q.jsx)(ii,{"data-state":e.getIsSelected()&&`selected`,children:e.getVisibleCells().map(e=>(0,Q.jsx)(di,{children:mi(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]})})]}):null}function B9({chargeId:e,tagIds:t,description:n,open:r,onOpenChange:i,onClose:a,showChargesWithExistingSuggestions:o=!1}){let[{data:s,fetching:c},l]=H({pause:!0,query:Fe,variables:{chargeId:e,withMissingTags:!o&&!!t,withMissingDescription:!o&&!!n,tagsDifferentThan:o&&t?t.map(e=>e.id):void 0,descriptionDifferentThan:o?n:void 0}});(0,Z.useEffect)(()=>{r&&(t||n)&&!s&&l()},[r,t,n,l,s]);let u=(0,Z.useCallback)(e=>{i(e),r&&!e&&a?.()},[i,a,r]);(0,Z.useEffect)(()=>{r&&!c&&s?.similarCharges.length===0&&a?.()},[r,c,s,a]);let d=(0,Z.useMemo)(()=>r&&(!!t||!!n)&&s&&s?.similarCharges.length>0,[r,t,n,s]);return(0,Z.useEffect)(()=>{r&&!t&&!n&&a?.()},[r,t,n,a]),(0,Q.jsx)(Jt,{open:d,onOpenChange:u,children:(0,Q.jsx)(cn,{className:`overflow-scroll max-h-screen w-full sm:max-w-[640px] md:max-w-[768px] lg:max-w-[900px]`,onClick:e=>e.stopPropagation(),children:(0,Q.jsx)(R9,{fallback:(0,Q.jsx)(`div`,{children:`Error fetching similar charges`}),children:c?(0,Q.jsx)(Kr,{}):t||n?(0,Q.jsx)(z9,{data:s?.similarCharges??[],tagIds:t,description:n,onOpenChange:u}):null})})})}function Gne({businessId:e,tagIds:t,description:n,open:r,onOpenChange:i,onClose:a}){let[{data:o,fetching:s},c]=H({pause:!0,query:he,variables:{businessId:e,tagsDifferentThan:t?t.map(e=>e.id):void 0,descriptionDifferentThan:n}});(0,Z.useEffect)(()=>{r&&(t||n)&&!o&&c()},[r,t,n,c,o]);let l=(0,Z.useCallback)(e=>{i(e),r&&!e&&a?.()},[i,a,r]);return(0,Q.jsx)(Jt,{open:(0,Z.useMemo)(()=>r&&(!!t||!!n)&&o&&o?.similarChargesByBusiness.length>0,[r,t,n,o]),onOpenChange:l,children:(0,Q.jsx)(cn,{className:`overflow-scroll max-h-screen w-full sm:max-w-[640px] md:max-w-[768px] lg:max-w-[900px]`,onClick:e=>e.stopPropagation(),children:(0,Q.jsx)(R9,{fallback:(0,Q.jsx)(`div`,{children:`Error fetching similar charges`}),children:s?(0,Q.jsx)(Kr,{}):t||n?(0,Q.jsx)(z9,{data:o?.similarChargesByBusiness??[],tagIds:t,description:n,onOpenChange:l,title:`Similar Charges by Business`}):null})})})}var Kne=`uploadDocumentsFromGoogleDrive`,qne=()=>{let[{fetching:e},t]=p(De);return{uploading:e,uploadDocumentsFromGoogleDrive:(0,Z.useCallback)(async e=>{let n=`Error uploading documents`,r=`${Kne}-${e.chargeId}`;K.loading(`Uploading Documents`,{id:r});try{let i=Xe(await t(e),n,r,`batchUploadDocumentsFromGoogleDrive`);if(i){let e=!1,t=i.batchUploadDocumentsFromGoogleDrive.filter(t=>`message`in t?(console.error(`Error uploading document: ${t.message}`),e=!0,!1):`document`in t).map(({document:e})=>e);return K.success(`Upload Successful`,{id:r,description:t.length>0?kK({data:t}):`No successful document uploads`,duration:t.length>0?1/0:5e3,dismissible:!0,closeButton:!0}),e&&K.error(`Some files failed to upload`,{duration:1e5,closeButton:!0}),t}}catch(e){console.error(`${n}: ${e}`),K.error(`Error`,{id:r,description:n,duration:1/0,closeButton:!0})}},[t])}};function V9({className:e,...t}){return(0,Q.jsx)(Ns,{"data-slot":`tabs`,className:s(`flex flex-col gap-2`,e),...t})}function H9({className:e,...t}){return(0,Q.jsx)(Ps,{"data-slot":`tabs-list`,className:s(`bg-gray-100 text-gray-500 inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px] dark:bg-gray-800 dark:text-gray-400`,e),...t})}function U9({className:e,...t}){return(0,Q.jsx)(Fs,{"data-slot":`tabs-trigger`,className:s(`data-[state=active]:bg-white dark:data-[state=active]:text-gray-950 focus-visible:border-gray-950 focus-visible:ring-gray-950/50 focus-visible:outline-ring dark:data-[state=active]:border-gray-200 dark:data-[state=active]:bg-gray-200/30 text-gray-950 dark:text-gray-500 inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-gray-200 border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 dark:data-[state=active]:bg-gray-950 dark:dark:data-[state=active]:text-gray-50 dark:focus-visible:border-gray-300 dark:focus-visible:ring-gray-300/50 dark:dark:data-[state=active]:border-gray-800 dark:dark:data-[state=active]:bg-gray-800/30 dark:text-gray-50 dark:dark:text-gray-400 dark:border-gray-800`,e),...t})}function W9({className:e,...t}){return(0,Q.jsx)(Is,{"data-slot":`tabs-content`,className:s(`flex-1 outline-none`,e),...t})}var Jne=10*1024*1024,Yne=sr(File).refine(e=>[`application/pdf`,`image/png`,`image/jpeg`,`image/jpg`,`image/svg+xml`,`image/gif`].includes(e.type),{message:`Invalid document file type`}).refine(e=>e.size<=Jne,{message:`File size should not exceed 5MB`}),Xne=er({googleDriveUrl:Qn().url({message:`Invalid url`}).includes(`drive.google.com`,{message:`Invalid url: origin must be "drive.google.com"`}).includes(`/folders/`,{message:`Invalid url: is this a folder link?`}).optional(),documents:Cr(Yne).optional(),method:gr([`local-files`,`google-drive`]),isSensitive:ar().optional()}).superRefine((e,t)=>{e.method===`local-files`&&(e.documents===void 0||e.documents.length===0)&&t.addIssue({code:g4.custom,message:`At least one document is required`}),e.method===`google-drive`&&e.googleDriveUrl===void 0&&t.addIssue({code:g4.custom,message:`The Google Drive URL is required`})});function Zne({open:e,onOpenChange:t,chargeId:n,onChange:r}){let[i,a]=(0,Z.useState)(`local-files`),{uploading:o,uploadDocumentsFromGoogleDrive:s}=qne(),{uploading:c,uploadMultipleDocuments:l}=jK(),u=Xn({resolver:Ur(Xne),defaultValues:{method:`local-files`,isSensitive:!1}}),d=e=>{u.setValue(`method`,e),e===`google-drive`?(u.clearErrors(`documents`),u.setValue(`documents`,void 0)):(u.clearErrors(`googleDriveUrl`),u.setValue(`googleDriveUrl`,void 0)),a(e)},f=(0,Z.useCallback)(async e=>{let i=Promise.resolve();switch(e.method){case`local-files`:e.documents?i=l({documents:e.documents,chargeId:n,isSensitive:e.isSensitive}):u.setError(`documents`,{message:`At least one document is required`});break;case`google-drive`:e.googleDriveUrl?i=s({sharedFolderUrl:e.googleDriveUrl,chargeId:n,isSensitive:e.isSensitive}):u.setError(`googleDriveUrl`,{message:`The Google Drive URL is required`});break}try{await i,r?.(),t(!1)}catch(e){u.setError(`root`,{message:e instanceof Error?e.message:`Failed to upload documents`})}},[n,u,r,t,s,l]),p=(0,Z.useMemo)(()=>o||c,[o,c]);return(0,Q.jsx)(Jt,{open:e,onOpenChange:t,children:(0,Q.jsx)(cn,{onClick:e=>e.stopPropagation(),className:`overflow-scroll max-h-screen`,children:(0,Q.jsxs)(R9,{fallback:(0,Q.jsx)(`div`,{children:`Error uploading files`}),children:[(0,Q.jsx)($t,{className:`flex flex-row items-center justify-between`,children:(0,Q.jsx)(gn,{children:`Upload Documents`})}),(0,Q.jsx)(wr,{...u,children:(0,Q.jsxs)(`form`,{onSubmit:u.handleSubmit(f),children:[(0,Q.jsxs)(V9,{value:i,onValueChange:e=>d(e),className:`my-4`,children:[(0,Q.jsxs)(H9,{className:`grid w-full grid-cols-2`,children:[(0,Q.jsx)(U9,{disabled:p,value:`local-files`,children:`Local Files`}),(0,Q.jsx)(U9,{disabled:p,value:`google-drive`,children:`Google Drive`})]}),(0,Q.jsx)(W9,{value:`local-files`,children:(0,Q.jsxs)(Ei,{children:[(0,Q.jsxs)(Si,{children:[(0,Q.jsx)(wi,{children:`Local Files`}),(0,Q.jsx)(Ti,{children:`Upload documents from your computer`})]}),(0,Q.jsx)(Ci,{className:`space-y-2`,children:(0,Q.jsx)(li,{control:u.control,name:`documents`,render:({field:{value:e,onChange:t,...n}})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`Files`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...n,required:!0,type:`file`,multiple:!0,accept:`.jpg, .jpeg, .gif, .png, .pdf`,onChange:e=>{t(e.target.files?Object.values(e.target.files):null)}})}),(0,Q.jsx)(Tr,{})]})})})]})}),(0,Q.jsx)(W9,{value:`google-drive`,children:(0,Q.jsxs)(Ei,{children:[(0,Q.jsxs)(Si,{children:[(0,Q.jsx)(wi,{children:`Google Shared Folder`}),(0,Q.jsx)(Ti,{children:`Upload documents from Google Drive shared folder`})]}),(0,Q.jsx)(Ci,{className:`space-y-2`,children:(0,Q.jsx)(li,{control:u.control,name:`googleDriveUrl`,render:({field:e})=>(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Dr,{children:`URL`}),(0,Q.jsx)(ir,{children:(0,Q.jsx)(bn,{...e,required:!0,placeholder:`Folder URL`})}),(0,Q.jsx)(Tr,{})]})})})]})})]}),(0,Q.jsx)(Tr,{}),(0,Q.jsx)(Xt,{children:(0,Q.jsxs)(`div`,{className:`flex w-full flex-row justify-between items-center`,children:[(0,Q.jsx)(li,{control:u.control,name:`isSensitive`,render:({field:{value:e,onChange:t,...n}})=>(0,Q.jsx)(fr,{delayDuration:0,children:(0,Q.jsxs)(rr,{children:[(0,Q.jsx)(yr,{asChild:!0,children:(0,Q.jsxs)(cr,{className:`flex flex-row gap-2 items-center`,children:[(0,Q.jsx)(ir,{children:(0,Q.jsx)(Z4,{...n,checked:e,onCheckedChange:e=>t(!!e),className:`mt-2`})}),(0,Q.jsx)(Dr,{children:`Is sensitive`})]})}),(0,Q.jsx)(or,{side:`right`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,Q.jsx)(`p`,{children:`Sensitive content will not be processed`}),(0,Q.jsx)(`p`,{children:`by OCR to protect confidential data`})]})})]})})}),(0,Q.jsx)(q,{disabled:p,type:`submit`,children:`Upload`})]})})]})})]})})})}var G9=({className:e,...t})=>(0,Q.jsx)(`nav`,{role:`navigation`,"aria-label":`pagination`,className:s(`mx-auto flex w-full justify-center`,e),...t});G9.displayName=`Pagination`;var K9=Z.forwardRef(({className:e,...t},n)=>(0,Q.jsx)(`ul`,{ref:n,className:s(`flex flex-row items-center gap-1`,e),...t}));K9.displayName=`PaginationContent`;var q9=Z.forwardRef(({className:e,...t},n)=>(0,Q.jsx)(`li`,{ref:n,className:s(``,e),...t}));q9.displayName=`PaginationItem`;var J9=({className:e,isActive:t,size:n=`icon`,children:r,...i})=>(0,Q.jsx)(q,{"aria-current":t?`page`:void 0,variant:t?`outline`:`ghost`,size:n,className:e,...i,children:r});J9.displayName=`PaginationLink`;var Y9=({className:e,...t})=>(0,Q.jsx)(J9,{"aria-label":`Go to previous page`,size:`default`,className:s(`gap-1 pl-2.5`,e),...t,children:(0,Q.jsx)(Ni,{className:`h-4 w-4`})});Y9.displayName=`PaginationPrevious`;var X9=({className:e,...t})=>(0,Q.jsx)(J9,{"aria-label":`Go to next page`,size:`default`,className:s(`gap-1 pr-2.5`,e),...t,children:(0,Q.jsx)(en,{className:`h-4 w-4`})});X9.displayName=`PaginationNext`;var Z9=({className:e,...t})=>(0,Q.jsxs)(`span`,{"aria-hidden":!0,className:s(`flex h-9 w-9 items-center justify-center`,e),...t,children:[(0,Q.jsx)(Un,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`More pages`})]});Z9.displayName=`PaginationEllipsis`;var Qne=(e,t)=>{let n=e-1;if(n<=0)return[];let r=[];return r.push(0),t>2&&r.push(`...`),t>1&&r.push(t-1),t>0&&t<n&&r.push(t),t<n-1&&r.push(t+1),t<n-2&&r.push(`...`),r.push(n),r},Q9=({onChange:e,totalPages:t,currentPageIndex:n,...r})=>{let i=Qne(t,n);return i.length?(0,Q.jsx)(G9,{...r,children:(0,Q.jsxs)(K9,{children:[(0,Q.jsx)(q9,{children:(0,Q.jsx)(Y9,{disabled:n<1,onClick:()=>e(n-1)})}),i.map((t,r)=>t===`...`?(0,Q.jsx)(q9,{children:(0,Q.jsx)(Z9,{})},`ellipsis-${r}`):(0,Q.jsx)(q9,{children:(0,Q.jsx)(J9,{onClick:()=>e(t),isActive:t===n,children:t+1})},`page-${t}`)),(0,Q.jsx)(q9,{children:(0,Q.jsx)(X9,{disabled:n>=t-1,onClick:()=>e(n+1)})})]})}):null};Q9.displayName=`Pagination`;var $9=({cols:e,spacing:t,children:n})=>(0,Q.jsx)(Qk,{cols:e,spacing:t,breakpoints:[{maxWidth:980,cols:3,spacing:`md`},{maxWidth:900,cols:2,spacing:`sm`},{maxWidth:755,cols:2,spacing:`sm`},{maxWidth:600,cols:1,spacing:`sm`}],children:n});function $ne(e){switch(e){case`xs`:return`size-8`;case`sm`:return`size-10`;case`md`:return`size-15`;case`lg`:return`size-25`;case`xl`:return`size-40`;default:return`size-10`}}function ere(e){switch(e){case`xs`:return`text-2xs`;case`sm`:return`text-base`;case`md`:return`text-2xl`;case`lg`:return`text-3xl`;case`xl`:return`text-5xl`;default:return`text-base`}}var tre=({value:e,size:t=`xl`})=>{let n=(e=>{let t=Math.max(0,Math.min(100,e));return`rgb(${Math.round(155*(1-t/100)+100)}, ${Math.round(t/100*155+0)}, 0)`})(e),r=e/100*75;return(0,Q.jsxs)(`div`,{className:`relative `+$ne(t),children:[(0,Q.jsxs)(`svg`,{className:`rotate-[135deg] size-full`,viewBox:`0 0 36 36`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,Q.jsx)(`circle`,{cx:`18`,cy:`18`,r:`16`,fill:`none`,className:`stroke-current text-gray-200 dark:text-neutral-700`,strokeWidth:`1`,strokeDasharray:`75 100`,strokeLinecap:`round`}),(0,Q.jsx)(`circle`,{cx:`18`,cy:`18`,r:`16`,fill:`none`,stroke:n,strokeWidth:`2`,strokeDasharray:`${r} 100`,strokeLinecap:`round`})]}),(0,Q.jsx)(`div`,{className:`absolute top-1/2 start-1/2 transform -translate-x-1/2 -translate-y-1/2 text-center`,children:(0,Q.jsx)(`span`,{className:`font-bold `+ere(t),style:{color:n},children:e.toFixed(0)})})]})};export{N2 as $,El as $n,Dw as $t,O4 as A,pd as An,Wi as Ar,ZA as At,i4 as B,nu as Bn,wA as Bt,G4 as C,Dp as Cn,$i as Cr,Hz as Ct,P4 as D,Hd as Dn,qi as Dr,Hj as Dt,L4 as E,Xd as En,Xi as Er,Lz as Et,_4 as F,Du as Fn,Ni as Fr,zA as Ft,K2 as G,Bl as Gn,Fk as Gt,t4 as H,ru as Hn,bA as Ht,h4 as I,Tu as In,Mi as Ir,FA as It,H2 as J,Il as Jn,fO as Jt,G2 as K,Rl as Kn,yk as Kt,f4 as L,wu as Ln,PA as Lt,y4 as M,fd as Mn,Hi as Mr,JA as Mt,g4 as N,cd as Nn,Vi as Nr,qA as Nt,N4 as O,yd as On,Ki as Or,Bj as Ot,v4 as P,Gu as Pn,Ri as Pr,HA as Pt,P2 as Q,Ol as Qn,zw as Qt,c4 as R,vu as Rn,NA as Rt,X4 as S,Fp as Sn,ea as Sr,qz as St,B4 as T,Af as Tn,Zi as Tr,Bz as Tt,e4 as U,tu as Un,Qk as Ut,r4 as V,lu as Vn,CA as Vt,X2 as W,Kl as Wn,Ik as Wt,I2 as X,kl as Xn,RT as Xt,L2 as Y,Dl as Yn,kD as Yt,F2 as Z,Al as Zn,sT as Zt,O9 as _,Gh as _n,sa as _r,eB as _t,W9 as a,z_ as an,Vs as ar,hX as at,C9 as b,gh as bn,na as br,Xz as bt,Gne as c,d_ as cn,Ls as cr,EK as ct,zne as d,Jh as dn,xa as dr,QG as dt,Sx as en,wl as er,U0 as et,F9 as f,Yh as fn,ya as fr,WG as ft,A9 as g,sg as gn,da as gr,tB as gt,M9 as h,lg as hn,pa as hr,pG as ht,V9 as i,_y as in,Qs as ir,bX as it,C4 as j,dd as jn,Ui as jr,YA as jt,M4 as k,md as kn,Gi as kr,zj as kt,B9 as l,Bg as ln,Ca as lr,wK as lt,N9 as m,og as mn,ha as mr,PG as mt,Q9 as n,zy as nn,xl as nr,r$ as nt,H9 as o,A_ as on,zs as or,FK as ot,P9 as p,qh as pn,_a as pr,FG as pt,W2 as q,Ll as qn,HO as qt,Zne as r,Ny as rn,yl as rr,$Q as rt,U9 as s,w_ as sn,Rs as sr,PK as st,tre as t,Gy as tn,Cl as tr,V0 as tt,R9 as u,fg as un,Sa as ur,rK as ut,D9 as v,dg as vn,oa as vr,Qz as vt,W4 as w,Yf as wn,Qi as wr,Vz as wt,Z4 as x,mh as xn,ta as xr,Yz as xt,E9 as y,cg as yn,aa as yr,Zz as yt,a4 as z,du as zn,kA as zt};