1import{i as De,r as x,k as qo,a as c,P as Ve,l as jn,m as Ae,n as Zi,p as no,q as le,R as h0,s as Nt,t as xi,v as Es,w as EL,x as PL,V as TL,A as Wf,y as vE,z as yE,D as si,E as xE,F as bE,G as wE,H as _E,I as p0,J as SE,K as m0,M as g0,N as ML,u as Pr,Q as DL,T as RL,U as IL,W as $L,C as ve,d as Ce,e as ze,B as oe,c as be,L as ne,X as Bu,Y as v0,Z as jE,_ as OE,$ as NE,a0 as CE,a1 as Uo,a2 as kE,a3 as LL,a4 as BL,a5 as FL,a6 as AE,a7 as zL,a8 as qL,a9 as Zc,aa as at,ab as Le,ac as D,ad as gn,ae as vn,af as yn,ag as xn,ah as li,ai as dl,f as Fu,aj as UL,ak as et,al as HL,am as WL}from"./index-BNIZXS9X.js";import{u as VL}from"./react-router-dom-CNTZ-wWZ.js";import{s as Z}from"./supabase-CV5pr-z7.js";import{u as EE}from"./useAuth-BKUtz-rg.js";import{R as KL,I as GL,c as PE,C as Cu,S as YL,G as Jy,D as ip,a as ap,b as op,d as En,e as XL,A as JL,f as ZL,g as QL,h as TE,P as e4,i as t4,L as r4,j as n4,k as i4,l as a4,m as o4,n as s4,o as l4,p as c4,q as u4,r as d4,s as f4}from"./dropdown-menu-2XKpQ27e.js";import{u as y0}from"./index-CIQtW-3T.js";import{c as Zy,C as h4,S as Ei}from"./slider-BuO6Sc9H.js";import{C as Vf}from"./chevron-down-CGBDjqmg.js";import{C as $n}from"./check-46YfkBzA.js";import{D as Oc}from"./download-DBJlBNCS.js";import{I as fe}from"./input-D6mtPhVS.js";import{B as Ye}from"./badge-LO6eryVO.js";import{L as tt}from"./loader-circle-CiCh4c_6.js";import{t as He,c as qa,s as zu,a as El,g as qu,m as p4,d as Ln,b as ME,e as DE,f as P1,h as Qc,i as RE,j as IE,k as m4,l as x0,n as g4,o as v4,p as Ue,q as $E}from"./format-DPouvYOD.js";import{C as LE}from"./chevron-right-BtkGwMPu.js";import{U as b0}from"./index-Di2wm4Dk.js";import{C as oi}from"./calendar-PEVyNbCY.js";import{S as BE}from"./search-DLUYTJZ1.js";import{R as y4,C as x4,a as b4}from"./index-wacNcylH.js";import{T as w4,C as T1,P as FE}from"./trending-up-B7uSHhok.js";import{C as Pl}from"./clock-CuDQF1_i.js";import{C as _4}from"./circle-check-big-DTkeSFG6.js";import{P as Ze,A as S4,C as j4}from"./checkbox-DBA8Urls.js";import{C as sp}from"./circle-check-CVyqfPS9.js";import{R as Qy,C as zE,L as O4}from"./refresh-cw-DuAzMmG_.js";import{A as qE,a as UE,b as HE}from"./avatar-BIOAjU4q.js";import{U as WE}from"./upload-BrPFuClz.js";import{L as N4}from"./linkedin-8jHd5aY2.js";import{Q as C4}from"./quote-DuaIbpw-.js";import{M as k4}from"./minus-DteuVM2Z.js";import{I as A4}from"./image-CNcqcWdK.js";import{A as E4}from"./arrow-left-CfHZZXk-.js";import{S as P4}from"./SEOHead-DuWC-X_n.js";const VE=De("AlignCenter",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const T4=De("AlignLeft",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const M4=De("AlignRight",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const D4=De("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);const R4=De("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);const I4=De("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);const M1=De("CalendarPlus",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M19 16v6",key:"tddt3s"}]]);const w0=De("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const $4=De("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);const L4=De("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const B4=De("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);
1const F4=De("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"}]]);const lp=De("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);const ex=De("ExternalLink",[["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"}]]);const KE=De("EyeOff",[["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"}]]);const fl=De("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"}]]);const Uu=De("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const GE=De("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);const z4=De("Heading1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);const q4=De("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);const U4=De("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);const H4=De("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);const W4=De("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);const V4=De("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"}]]);const K4=De("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);const G4=De("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);const In=De("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);const Y4=De("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);const cp=De("MousePointerClick",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.
1074z",key:"s0h3yz"}]]);const Tl=De("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);const YE=De("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const X4=De("Redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);const J4=De("Ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]);const ku=De("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);const Z4=De("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"}]]);const tx=De("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);const Q4=De("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);const Ma=De("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const eB=De("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);const up=De("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const tB=De("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);const rB=De("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);const nB=De("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]),_0=()=>{const{user:t,loading:e}=EE(),[r,n]=x.useState(null),[i,a]=x.useState(!0);return x.useEffect(()=>{e||(async()=>{if(!t){n(null),a(!1);return}try{const{data:s,error:l}=await Z.from("user_roles").select("role").eq("user_id",t.id).maybeSingle();if(l)throw l;n(s?.role||"user")}catch(s){console.error("Error fetching role:",s),n("user")}finally{a(!1)}})()},[t,e]),{role:r,loading:e||i,isSuperAdmin:r==="super_admin",isAdmin:r==="admin"||r==="super_admin",isBusinessDeveloper:r==="business_developer"}};var Kf="Tabs",[iB]=no(Kf,[PE]),XE=PE(),[aB,S0]=iB(Kf),JE=x.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,onValueChange:i,defaultValue:a,orientation:o="horizontal",dir:s,activationMode:l="automatic",...u}=t,d=y0(s),[f,h]=qo({prop:n,onChange:i,defaultProp:a??"",caller:Kf});return c.jsx(aB,{scope:r,baseId:jn(),value:f,onValueChange:h,orientation:o,dir:d,activationMode:l,children:c.jsx(Ve.div,{dir:d,"data-orientation":o,...u,ref:e})})});JE.displayName=Kf;var ZE="TabsList",QE=x.forwardRef((t,e)=>{const{__scopeTabs:r,loop:n=!0,...i}=t,a=S0(ZE,r),o=XE(r);return c.jsx(KL,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:n,children:c.jsx(Ve.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:e})})});QE.displayName=ZE;var eP="TabsTrigger",tP=x.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,disabled:i=!1,...a}=t,o=S0(eP,r),s=XE(r),l=iP(o.baseId,n),u=aP(o.baseId,n),d=n===o.value;return c.jsx(GL,{asChild:!0,...s,focusable:!i,active:d,children:c.jsx(Ve.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...a,ref:e,onMouseDown:Ae(t.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?o.onValueChange(n):f.preventDefault()}),onKeyDown:Ae(t.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&o.onValueChange(n)}),onFocus:Ae(t.onFocus,()=>{const f=o.activationMode!=="manual";!d&&!i&&f&&o.onValueChange(n)})})})});tP.displayName=eP;var rP="TabsContent",nP=x.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,forceMount:i,children:a,...o}=t,s=S0(rP,r),l=iP(s.baseId,n),u=aP(s.baseId,n),d=n===s.value,f=x.useRef(d);return x.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),c.jsx(Zi,{present:i||d,children:({present:h})=>c.jsx(Ve.div,{"data-state":d?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:u,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:f.current?"0s":void 0},children:h&&a})})});nP.displayName=rP;function iP(t,e){return`${t}-trigger-${e}`}function aP(t,e){return`${t}-content-${e}`}var oB=JE,oP=QE,sP=tP,lP=nP;const Nc=oB,Ps=x.forwardRef(({className:t,...e},r)=>c.jsx(oP,{ref:r,className:le("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));Ps.displayName=oP.displayName;const gt=x.forwardRef(({className:t,...e},r)=>c.jsx(sP,{ref:r,className:le("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",t),...e}));gt.displayName=sP.displayName;const vt=x.forwardRef(({className:t,...e},r)=>c.jsx(lP,{ref:r,className:le("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));vt.displayName=lP.displayName;
vendor: 4,486 bytes, line 1
1var sB=[" ","Enter","ArrowUp","ArrowDown"],lB=[" ","Enter"],Ua="Select",[Gf,Yf,cB]=EL(Ua),[Ts]=no(Ua,[cB,Es]),Xf=Es(),[uB,Qi]=Ts(Ua),[dB,fB]=Ts(Ua),cP=t=>{const{__scopeSelect:e,children:r,open:n,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:h,required:p,form:m}=t,g=Xf(e),[v,y]=x.useState(null),[w,_]=x.useState(null),[j,b]=x.useState(!1),O=y0(u),[S,N]=qo({prop:n,defaultProp:i??!1,onChange:a,caller:Ua}),[C,T]=qo({prop:o,defaultProp:s,onChange:l,caller:Ua}),k=x.useRef(null),M=v?m||!!v.closest("form"):!0,[E,L]=x.useState(new Set),R=Array.from(E).map(I=>I.props.value).join(";");return c.jsx(h0,{...g,children:c.jsxs(uB,{required:p,scope:e,trigger:v,onTriggerChange:y,valueNode:w,onValueNodeChange:_,valueNodeHasChildren:j,onValueNodeHasChildrenChange:b,contentId:jn(),value:C,onValueChange:T,open:S,onOpenChange:N,dir:O,triggerPointerDownPosRef:k,disabled:h,children:[c.jsx(Gf.Provider,{scope:e,children:c.jsx(dB,{scope:t.__scopeSelect,onNativeOptionAdd:x.useCallback(I=>{L($=>new Set($).add(I))},[]),onNativeOptionRemove:x.useCallback(I=>{L($=>{const A=new Set($);return A.delete(I),A})},[]),children:r})}),M?c.jsxs(MP,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:C,onChange:I=>T(I.target.value),disabled:h,form:m,children:[C===void 0?c.jsx("option",{value:""}):null,Array.from(E)]},R):null]})})};cP.displayName=Ua;var uP="SelectTrigger",dP=x.forwardRef((t,e)=>{const{__scopeSelect:r,disabled:n=!1,...i}=t,a=Xf(r),o=Qi(uP,r),s=o.disabled||n,l=Nt(e,o.onTriggerChange),u=Yf(r),d=x.useRef("touch"),[f,h,p]=RP(g=>{const v=u().filter(_=>!_.disabled),y=v.find(_=>_.value===o.value),w=IP(v,g,y);w!==void 0&&o.onValueChange(w.value)}),m=g=>{s||(o.onOpenChange(!0),p()),g&&(o.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return c.jsx(Wf,{asChild:!0,...a,children:c.jsx(Ve.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":DP(o.value)?"":void 0,...i,ref:l,onClick:Ae(i.onClick,g=>{g.currentTarget.focus(),d.current!=="mouse"&&m(g)}),onPointerDown:Ae(i.onPointerDown,g=>{d.current=g.pointerType;const v=g.target;v.hasPointerCapture(g.pointerId)&&v.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(m(g),g.preventDefault())}),onKeyDown:Ae(i.onKeyDown,g=>{const v=f.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&h(g.key),!(v&&g.key===" ")&&sB.includes(g.key)&&(m(),g.preventDefault())})})})});dP.displayName=uP;var fP="SelectValue",hP=x.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:i,children:a,placeholder:o="",...s}=t,l=Qi(fP,r),{onValueNodeHasChildrenChange:u}=l,d=a!==void 0,f=Nt(e,l.onValueNodeChange);return xi(()=>{u(d)},[u,d]),c.jsx(Ve.span,{...s,ref:f,style:{pointerEvents:"none"},children:DP(l.value)?c.jsx(c.Fragment,{children:o}):a})});hP.displayName=fP;var hB="SelectIcon",pP=x.forwardRef((t,e)=>{const{__scopeSelect:r,children:n,...i}=t;return c.jsx(Ve.span,{"aria-hidden":!0,...i,ref:e,children:n||"â¼"})});pP.displayName=hB;var pB="SelectPortal",mP=t=>c.jsx(vE,{asChild:!0,...t});mP.displayName=pB;var Ha="SelectContent",gP=x.forwardRef((t,e)=>{const r=Qi(Ha,t.__scopeSelect),[n,i]=x.useState();if(xi(()=>{i(new DocumentFragment)},[]),!r.open){const a=n;return a?yE.createPortal(c.jsx(vP,{scope:t.__scopeSelect,children:c.jsx(Gf.Slot,{scope:t.__scopeSelect,children:c.jsx("div",{children:t.children})})}),a):null}return c.jsx(yP,{...t,ref:e})});gP.displayName=Ha;var hn=10,[vP,ea]=Ts(Ha),mB="SelectContentImpl",gB=SE("SelectContent.RemoveScroll"),yP=x.forwardRef((t,e)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:m,hideWhenDetached:g,avoidCollisions:v,...y}=t,w=Qi(Ha,r),[_,j]=x.useState(null),[b,O]=x.useState(null),S=Nt(e,re=>j(re)),[N,C]=x.useState(null),[T,k]=x.useState(null),M=Yf(r),[E,L]=x.useState(!1),R=x.useRef(!1);x.useEffect(()=>{if(_)return xE(_)},[_]),bE();const I=x.useCallback(re=>{const[ue,...Y]=M().map(U=>U.ref.current),[z]=Y.slice(-1),X=document.activeElement;for(const U of re)if(U===X||(U?.scrollIntoView({block:"nearest"}),U===ue&&b&&(b.scrollTop=0),U===z&&b&&(b.scrollTop=b.scrollHeight),U?.focu
vendor: 13,375 bytes, line 1
1s(),document.activeElement!==X))return},[M,b]),$=x.useCallback(()=>I([N,_]),[I,N,_]);x.useEffect(()=>{E&&$()},[E,$]);const{onOpenChange:A,triggerPointerDownPosRef:F}=w;x.useEffect(()=>{if(_){let re={x:0,y:0};const ue=z=>{re={x:Math.abs(Math.round(z.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(z.pageY)-(F.current?.y??0))}},Y=z=>{re.x<=10&&re.y<=10?z.preventDefault():_.contains(z.target)||A(!1),document.removeEventListener("pointermove",ue),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",ue),document.addEventListener("pointerup",Y,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ue),document.removeEventListener("pointerup",Y,{capture:!0})}}},[_,A,F]),x.useEffect(()=>{const re=()=>A(!1);return window.addEventListener("blur",re),window.addEventListener("resize",re),()=>{window.removeEventListener("blur",re),window.removeEventListener("resize",re)}},[A]);const[V,te]=RP(re=>{const ue=M().filter(X=>!X.disabled),Y=ue.find(X=>X.ref.current===document.activeElement),z=IP(ue,re,Y);z&&setTimeout(()=>z.ref.current.focus())}),B=x.useCallback((re,ue,Y)=>{const z=!R.current&&!Y;(w.value!==void 0&&w.value===ue||z)&&(C(re),z&&(R.current=!0))},[w.value]),G=x.useCallback(()=>_?.focus(),[_]),se=x.useCallback((re,ue,Y)=>{const z=!R.current&&!Y;(w.value!==void 0&&w.value===ue||z)&&k(re)},[w.value]),Q=n==="popper"?rx:xP,ye=Q===rx?{side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:m,hideWhenDetached:g,avoidCollisions:v}:{};return c.jsx(vP,{scope:r,content:_,viewport:b,onViewportChange:O,itemRefCallback:B,selectedItem:N,onItemLeave:G,itemTextRefCallback:se,focusSelectedItem:$,selectedItemText:T,position:n,isPositioned:E,searchRef:V,children:c.jsx(wE,{as:gB,allowPinchZoom:!0,children:c.jsx(_E,{asChild:!0,trapped:w.open,onMountAutoFocus:re=>{re.preventDefault()},onUnmountAutoFocus:Ae(i,re=>{w.trigger?.focus({preventScroll:!0}),re.preventDefault()}),children:c.jsx(p0,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:re=>re.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:c.jsx(Q,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:re=>re.preventDefault(),...y,...ye,onPlaced:()=>L(!0),ref:S,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:Ae(y.onKeyDown,re=>{const ue=re.ctrlKey||re.altKey||re.metaKey;if(re.key==="Tab"&&re.preventDefault(),!ue&&re.key.length===1&&te(re.key),["ArrowUp","ArrowDown","Home","End"].includes(re.key)){let z=M().filter(X=>!X.disabled).map(X=>X.ref.current);if(["ArrowUp","End"].includes(re.key)&&(z=z.slice().reverse()),["ArrowUp","ArrowDown"].includes(re.key)){const X=re.target,U=z.indexOf(X);z=z.slice(U+1)}setTimeout(()=>I(z)),re.preventDefault()}})})})})})})});yP.displayName=mB;var vB="SelectItemAlignedPosition",xP=x.forwardRef((t,e)=>{const{__scopeSelect:r,onPlaced:n,...i}=t,a=Qi(Ha,r),o=ea(Ha,r),[s,l]=x.useState(null),[u,d]=x.useState(null),f=Nt(e,S=>d(S)),h=Yf(r),p=x.useRef(!1),m=x.useRef(!0),{viewport:g,selectedItem:v,selectedItemText:y,focusSelectedItem:w}=o,_=x.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&u&&g&&v&&y){const S=a.trigger.getBoundingClientRect(),N=u.getBoundingClientRect(),C=a.valueNode.getBoundingClientRect(),T=y.getBoundingClientRect();if(a.dir!=="rtl"){const X=T.left-N.left,U=C.left-X,me=S.left-U,ge=S.width+me,Ee=Math.max(ge,N.width),We=window.innerWidth-hn,qe=Zy(U,[hn,Math.max(hn,We-Ee)]);s.style.minWidth=ge+"px",s.style.left=qe+"px"}else{const X=N.right-T.right,U=window.innerWidth-C.right-X,me=window.innerWidth-S.right-U,ge=S.width+me,Ee=Math.max(ge,N.width),We=window.innerWidth-hn,qe=Zy(U,[hn,Math.max(hn,We-Ee)]);s.style.minWidth=ge+"px",s.style.right=qe+"px"}const k=h(),M=window.innerHeight-hn*2,E=g.scrollHeight,L=window.getComputedStyle(u),R=parseInt(L.borderTopWidth,10),I=parseInt(L.paddingTop,10),$=parseInt(L.borderBottomWidth,10),A=parseInt(L.paddingBottom,10),F=R+I+E+A+$,V=Math.min(v.offsetHeight*5,F),te=window.getComputedStyle(g),B=parseInt(te.paddingTop,10),G=parseInt(te.paddingBottom,10),se=S.top+S.height/2-hn,Q=M-se,ye=v.offsetHeight/2,re=v.offsetTop+ye,ue=R+I+re,Y=F-ue;if(ue<=se){const X=k.length>0&&v===k[k.length-1].ref.current;s.style.bottom="0px";const U=u.clientHeight-g.offsetTop-g.offsetHeight,me=Math.max(Q,ye+(X?G:0)+U+$),ge=ue+me;s.style.height=ge+"px"}else{const X=k.length>0&&v===k[0].ref.current;s.style.top="0px";const me=Math.max(se,R+g.offsetTop+(X?B:0)+ye)+Y;s.style.height=me+"px",g.scrollTop=ue-se+g.offsetTop}s.style.margin=`${hn}px 0`,s.style.minHeight=V+"px",s.style.maxHeight=M+"px",n?.(),requestAnimationFrame(()=>p.current=!0)}},[h,a.trigger,a.valueNode,s,u,g,v,y,a.dir,n]);xi(()=>_(),[_]);const[j,b]=x.useState();xi(()=>{u&&b(window.getComputedStyle(u).zIndex)},[u]);const O=x.useCallback(S=>{S&&m.current===!0&&(_(),w?.(),m.current=!1)},[_,w]);return c.jsx(xB,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:O,children:c.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:j},children:c.jsx(Ve.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});xP.displayName=vB;var yB="SelectPopperPosition",rx=x.forwardRef((t,e)=>{const{__scopeSelect:r,align:n="start",collisionPadding:i=hn,...a}=t,o=Xf(r);return c.jsx(m0,{...o,...a,ref:e,align:n,collisionPadding:i,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});rx.displayName=yB;var[xB,j0]=Ts(Ha,{}),nx="SelectViewport",bP=x.forwardRef((t,e)=>{const{__scopeSelect:r,nonce:n,...i}=t,a=ea(nx,r),o=j0(nx,r),s=Nt(e,a.onViewportChange),l=x.useRef(0);return c.jsxs(c.Fragment,{children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),c.jsx(Gf.Slot,{scope:r,children:c.jsx(Ve.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Ae(i.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=o;if(h?.current&&f){const p=Math.abs(l.current-d.scrollTop);if(p>0){const m=window.innerHeight-hn*2,g=parseFloat(f.style.minHeight),v=parseFloat(f.style.height),y=Math.max(g,v);if(y<m){const w=y+p,_=Math.min(m,w),j=w-_;f.style.height=_+"px",f.style.bottom==="0px"&&(d.scrollTop=j>0?j:0,f.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});bP.displayName=nx;var wP="SelectGroup",[bB,wB]=Ts(wP),_B=x.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,i=jn();return c.jsx(bB,{scope:r,id:i,children:c.jsx(Ve.div,{role:"group","aria-labelledby":i,...n,ref:e})})});_B.displayName=wP;var _P="SelectLabel",SP=x.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,i=wB(_P,r);return c.jsx(Ve.div,{id:i.id,...n,ref:e})});SP.displayName=_P;var Hu="SelectItem",[SB,jP]=Ts(Hu),OP=x.forwardRef((t,e)=>{const{__scopeSelect:r,value:n,disabled:i=!1,textValue:a,...o}=t,s=Qi(Hu,r),l=ea(Hu,r),u=s.value===n,[d,f]=x.useState(a??""),[h,p]=x.useState(!1),m=Nt(e,w=>l.itemRefCallback?.(w,n,i)),g=jn(),v=x.useRef("touch"),y=()=>{i||(s.onValueChange(n),s.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return c.jsx(SB,{scope:r,value:n,disabled:i,textId:g,isSelected:u,onItemTextChange:x.useCallback(w=>{f(_=>_||(w?.textContent??"").trim())},[]),children:c.jsx(Gf.ItemSlot,{scope:r,value:n,disabled:i,textValue:d,children:c.jsx(Ve.div,{role:"option","aria-labelledby":g,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:Ae(o.onFocus,()=>p(!0)),onBlur:Ae(o.onBlur,()=>p(!1)),onClick:Ae(o.onClick,()=>{v.current!=="mouse"&&y()}),onPointerUp:Ae(o.onPointerUp,()=>{v.current==="mouse"&&y()}),onPointerDown:Ae(o.onPointerDown,w=>{v.current=w.pointerType}),onPointerMove:Ae(o.onPointerMove,w=>{v.current=w.pointerType,i?l.onItemLeave?.():v.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ae(o.onPointerLeave,w=>{w.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:Ae(o.onKeyDown,w=>{l.searchRef?.current!==""&&w.key===" "||(lB.includes(w.key)&&y(),w.key===" "&&w.preventDefault())})})})})});OP.displayName=Hu;var nl="SelectItemText",NP=x.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:i,...a}=t,o=Qi(nl,r),s=ea(nl,r),l=jP(nl,r),u=fB(nl,r),[d,f]=x.useState(null),h=Nt(e,y=>f(y),l.onItemTextChange,y=>s.itemTextRefCallback?.(y,l.value,l.disabled)),p=d?.textContent,m=x.useMemo(()=>c.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:g,onNativeOptionRemove:v}=u;return xi(()=>(g(m),()=>v(m)),[g,v,m]),c.jsxs(c.Fragment,{children:[c.jsx(Ve.span,{id:l.textId,...a,ref:h}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?yE.createPortal(a.children,o.valueNode):null]})});NP.displayName=nl;var CP="SelectItemIndicator",kP=x.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t;return jP(CP,r).isSelected?c.jsx(Ve.span,{"aria-hidden":!0,...n,ref:e}):null});kP.displayName=CP;var ix="SelectScrollUpButton",AP=x.forwardRef((t,e)=>{const r=ea(ix,t.__scopeSelect),n=j0(ix,t.__scopeSelect),[i,a]=x.useState(!1),o=Nt(e,n.onScrollButtonChange);return xi(()=>{if(r.viewport&&r.isPositioned){let s=function(){const u=l.scrollTop>0;a(u)};const l=r.viewport;return s(),l.addEventListener("scroll",s),()=>l.removeEventListener("scroll",s)}},[r.viewport,r.isPositioned]),i?c.jsx(PP,{...t,ref:o,onAutoScroll:()=>{const{viewport:s,selectedItem:l}=r;s&&l&&(s.scrollTop=s.scrollTop-l.offsetHeight)}}):null});AP.displayName=ix;var ax="SelectScrollDownButton",EP=x.forwardRef((t,e)=>{const r=ea(ax,t.__scopeSelect),n=j0(ax,t.__scopeSelect),[i,a]=x.useState(!1),o=Nt(e,n.onScrollButtonChange);return xi(()=>{if(r.viewport&&r.isPositioned){let s=function(){const u=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)<u;a(d)};const l=r.viewport;return s(),l.addEventListener("scroll",s),()=>l.removeEventListener("scroll",s)}},[r.viewport,r.isPositioned]),i?c.jsx(PP,{...t,ref:o,onAutoScroll:()=>{const{viewport:s,selectedItem:l}=r;s&&l&&(s.scrollTop=s.scrollTop+l.offsetHeight)}}):null});EP.displayName=ax;var PP=x.forwardRef((t,e)=>{const{__scopeSelect:r,onAutoScroll:n,...i}=t,a=ea("SelectScrollButton",r),o=x.useRef(null),s=Yf(r),l=x.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return x.useEffect(()=>()=>l(),[l]),xi(()=>{s().find(d=>d.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),c.jsx(Ve.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:Ae(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(n,50))}),onPointerMove:Ae(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(n,50))}),onPointerLeave:Ae(i.onPointerLeave,()=>{l()})})}),jB="SelectSeparator",TP=x.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t;return c.jsx(Ve.div,{"aria-hidden":!0,...n,ref:e})});TP.displayName=jB;var ox="SelectArrow",OB=x.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,i=Xf(r),a=Qi(ox,r),o=ea(ox,r);return a.open&&o.position==="popper"?c.jsx(g0,{...i,...n,ref:e}):null});OB.displayName=ox;var NB="SelectBubbleInput",MP=x.forwardRef(({__scopeSelect:t,value:e,...r},n)=>{const i=x.useRef(null),a=Nt(n,i),o=PL(e);return x.useEffect(()=>{const s=i.current;if(!s)return;const l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==e&&d){const f=new Event("change",{bubbles:!0});d.call(s,e),s.dispatchEvent(f)}},[o,e]),c.jsx(Ve.select,{...r,style:{...TL,...r.style},ref:a,defaultValue:e})});MP.displayName=NB;function DP(t){return t===""||t===void 0}function RP(t){const e=si(t),r=x.useRef(""),n=x.useRef(0),i=x.useCallback(o=>{const s=r.current+o;e(s),(function l(u){r.current=u,window.clearTimeout(n.current),u!==""&&(n.current=window.setTimeout(()=>l(""),1e3))})(s)},[e]),a=x.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return x.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,i,a]}function IP(t,e,r){const i=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,a=r?t.indexOf(r):-1;let o=CB(t,Math.max(a,0));i.length===1&&(o=o.filter(u=>u!==r));const l=o.find(u=>u.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==r?l:void 0}function CB(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var kB=cP,$P=dP,AB=hP,EB=pP,PB=mP,LP=gP,TB=bP,BP=SP,FP=OP,MB=NP,DB=kP,zP=AP,qP=EP,UP=TP;const Ht=kB,Wt=AB,It=x.forwardRef(({className:t,children:e,...r},n)=>c.jsxs($P,{ref:n,className:le("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...r,children:[e,c.jsx(EB,{asChild:!0,children:c.jsx(Vf,{className:"h-4 w-4 opacity-50"})})]}));It.displayName=$P.displayName;const HP=x.forwardRef(({className:t,...e},r)=>c.jsx(zP,{ref:r,className:le("flex cursor-default items-center justify-center py-1",t),...e,children:c.jsx(w0,{className:"h-4 w-4"})}));HP.displayName=zP.displayName;const WP=x.forwardRef(({className:t,...e},r)=>c.jsx(qP,{ref:r,className:le("flex cursor-default items-center justify-center py-1",t),...e,children:c.jsx(Vf,{className:"h-4 w-4"})}));WP.displayName=qP.displayName;const $t=x.forwardRef(({className:t,children:e,position:r="popper",...n},i)=>c.jsx(PB,{children:c.jsxs(LP,{ref:i,className:le("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,...n,children:[c.jsx(HP,{}),c.jsx(TB,{className:le("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),c.jsx(WP,{})]})}));$t.displayName=LP.displayName;const RB=x.forwardRef(({className:t,...e},r)=>c.jsx(BP,{ref:r,className:le("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));RB.displayName=BP.displayName;const pe=x.forwardRef(({className:t,children:e,...r},n)=>c.jsxs(FP,{ref:n,className:le("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),...r,children:[c.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:c.jsx(DB,{children:c.jsx($n,{className:"h-4 w-4"})})}),c.jsx(MB,{children:e})]}));pe.displayName=FP.displayName;const IB=x.forwardRef(({className:t,...e},r)=>c.jsx(UP,{ref:r,className:le("-mx-1 my-1 h-px bg-muted",t),...e}));IB.displayName=UP.displayName;const zn=x.forwardRef(({className:t,...e},r)=>c.jsx("textarea",{className:le("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:r,...e}));zn.displayName="Textarea";const $B=ML("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),O0=x.forwardRef(({className:t,variant:e,...r},n)=>c.jsx("div",{ref:n,role:"alert",className:le($B({variant:e}),t),...r}));O0.displayName="Alert";const VP=x.forwardRef(({className:t,...e},r)=>c.jsx("h5",{ref:r,className:le("mb-1 font-medium leading-none tracking-tight",t),...e}));VP.displayName="AlertTitle";const N0=x.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:le("text-sm [&_p]:leading-relaxed",t),...e}));N0.displayName="AlertDescription";const LB=()=>{const{toast:t}=Pr(),[e,r]=x.useState("en"),[n,i]=x.useState({en:JSON.stringify($L,null,2),fr:JSON.stringify(IL,null,2),de:JSON.stringify(RL,null,2),it:JSON.stringify(DL,null,2)}),[a,o]=x.useState({en:!1,fr:!1,de:!1,it:!1}),s=(h,p)=>{i(m=>({...m,[h]:p})),o(m=>({...m,[h]:!0}))},l=h=>{try{return JSON.parse(h),{valid:!0}}catch(p){return{valid:!1,error:p.message}}},u=async()=>{const h=n[e],p=l(h);if(!p.valid){t({title:"Invalid JSON",description:p.error,variant:"destructive"});return}try{const m=JSON.parse(h);t({title:"Saved Successfully",description:`${e.toUpperCase()} translations have been saved. Please download and update the file manually.`}),o(g=>({...g,[e]:!1}))}catch{t({title:"Error",description:"Failed to save translations",variant:"destructive"})}},d=()=>{if(!l(n[e]).valid){t({title:"Invalid JSON",description:"Please fix JSON errors before downloading",variant:"destructive"});return}const p=JSON.parse(n[e]),m=`export const ${e} = ${JSON.stringify(p,null,2)}; 2`,g=new Blob([m],{type:"text/typescript"}),v=URL.createObjectURL(g),y=document.createElement("a");y.href=v,y.download=`${e}.ts`,document.body.appendChild(y),y.click(),document.body.removeChild(y),URL.revokeObjectURL(v),t({title:"Downloaded",description:`${e}.ts file has been downloaded. Replace the file in src/locales/`})},f=[{value:"en",label:"English",flag:"ð¬ð§"},{value:"fr",label:"Français",flag:"ð«ð·"},{value:"de",label:"Deutsch",flag:"ð©ðª"},{value:"it",label:"Italiano",flag:"ð®ð¹"}];return c.jsxs("div",{className:"space-y-6",children:[c.jsx("div",{className:"flex justify-between items-center",children:c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-bold",children:"Locale File Editor"}),c.jsx("p",{className:"text-muted-foreground mt-1",children:"Edit translation files directly in JSON format"})]})}),c.jsxs(O0,{children:[c.jsx(L4,{className:"h-4 w-4"}),c.jsxs(N0,{children:["After editing and downloading, replace the file in ",c.jsx("code",{className:"bg-muted px-1 py-0.5 rounded",children:"src/locales/"})," directory to apply changes."]})]}),c.jsxs(Nc,{value:e,onValueChange:h=>r(h),children:[c.jsx(Ps,{className:"grid w-full grid-cols-4",children:f.map(h=>c.jsxs(gt,{value:h.value,className:"gap-2",children:[c.jsx("span",{children:h.flag}),c.jsx("span",{children:h.label}),a[h.value]&&c.jsx("span",{className:"h-2 w-2 rounded-full bg-yellow-500"})]},h.value))}),f.map(h=>c.jsx(vt,{value:h.value,className:"space-y-4",children:c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsxs(ze,{className:"flex items-center gap-2",children:[c.jsx("span",{children:h.flag}),c.jsxs("span",{children:[h.label," Translations"]})]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs(oe,{variant:"outline",size:"sm",onClick:d,children:[c.jsx(Oc,{className:"mr-2 h-4 w-4"}),"Download"]}),c.jsxs(oe,{size:"sm",onClick:u,disabled:!a[h.value],children:[c.jsx(ku,{className:"mr-2 h-4 w-4"}),"Save"]})]})]})}),c.jsxs(be,{children:[c.jsx(zn,{value:n[h.value],onChange:p=>s(h.value,p.target.value),className:"font-mono text-sm min-h-[600px]",placeholder:"Enter JSON content..."}),a[h.value]&&c.jsx("p",{className:"text-sm text-yellow-600 mt-2",children:"Unsaved changes"})]})]})},h.value))]})]})},BB={essential:{name:"Essential",color:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200"},advanced:{name:"Advanced",color:"bg-primary/10 text-primary"}
2,expert:{name:"Expert",color:"bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200"}},FB=()=>{const[t,e]=x.useState(null),[r,n]=x.useState(null),[i,a]=x.useState([]),[o,s]=x.useState([]),[l,u]=x.useState(!0),[d,f]=x.useState(!1),[h,p]=x.useState("CHF"),[m,g]=x.useState("per-reservation"),{toast:v}=Pr();x.useEffect(()=>{y();const S=Z.channel("pricing-config-changes").on("postgres_changes",{event:"*",schema:"public",table:"pricing_config"},()=>y()).subscribe(),N=Z.channel("pricing-modules-changes").on("postgres_changes",{event:"*",schema:"public",table:"pricing_modules"},()=>y()).subscribe(),C=Z.channel("pricing-tiers-changes").on("postgres_changes",{event:"*",schema:"public",table:"pricing_tiers"},()=>y()).subscribe();return()=>{Z.removeChannel(S),Z.removeChannel(N),Z.removeChannel(C)}},[h]);const y=async()=>{u(!0);try{const[S,N,C]=await Promise.all([Z.from("pricing_config").select("*").eq("currency",h),Z.from("pricing_modules").select("*").eq("currency",h).order("is_included_in_base",{ascending:!1}).order("name",{ascending:!0}),Z.from("pricing_tiers").select("*").eq("currency",h).order("display_order",{ascending:!0})]);if(S.error)throw S.error;if(N.error)throw N.error;if(C.error)throw C.error;const T=S.data||[];e(T.find(k=>k.config_type==="str")||null),n(T.find(k=>k.config_type==="hotel")||null),a(N.data||[]),s(C.data||[])}catch(S){console.error("Error:",S),v({title:"Error",description:"Failed to load config",variant:"destructive"})}finally{u(!1)}},w=async S=>{f(!0);try{const{error:N}=await Z.from("pricing_config").upsert(S);if(N)throw N;v({title:"Success",description:"Config saved"})}catch(N){console.error("Error:",N),v({title:"Error",description:"Failed to save",variant:"destructive"})}finally{f(!1)}},_=async()=>{f(!0);try{const S=i.map(T=>Z.from("pricing_modules").update({display_name:T.display_name,description:T.description,base_price:T.base_price}).eq("id",T.id));if((await Promise.all(S)).filter(T=>T.error).length>0)throw new Error("Failed to save some modules");v({title:"Success",description:"All modules updated"})}catch(S){console.error("Error:",S),v({title:"Error",description:"Failed to save modules",variant:"destructive"})}finally{f(!1)}},j=async()=>{f(!0);try{const S=o.map(T=>Z.from("pricing_tiers").update({price_per_reservation:T.price_per_reservation,free_reservations:T.free_reservations,minimum_reservations:T.minimum_reservations,cancelled_reservation_rate:T.cancelled_reservation_rate}).eq("id",T.id));if((await Promise.all(S)).filter(T=>T.error).length>0)throw new Error("Failed to save some tiers");v({title:"Success",description:"All tiers updated"})}catch(S){console.error("Error:",S),v({title:"Error",description:"Failed to save tiers",variant:"destructive"})}finally{f(!1)}},b=(S,N,C)=>{s(o.map(T=>T.id===S?{...T,[N]:C}:T))};if(l)return c.jsx("div",{className:"flex items-center justify-center py-12",children:c.jsx(tt,{className:"h-8 w-8 animate-spin"})});const O=(S,N,C)=>S?c.jsxs("div",{className:"space-y-6",children:[c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsxs(ze,{children:[C==="str"?"STR":"Hotel"," Pricing Formula"]})}),c.jsxs(be,{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsx(ne,{children:"Target Price"}),c.jsx(fe,{type:"number",value:S.target_price,onChange:T=>N({...S,target_price:parseFloat(T.target.value)})})]}),c.jsxs("div",{children:[c.jsx(ne,{children:"Yearly Discount (%)"}),c.jsx(fe,{type:"number",value:S.yearly_discount,onChange:T=>N({...S,yearly_discount:parseInt(T.target.value)})})]}),c.jsxs("div",{children:[c.jsx(ne,{children:"Trigger Low"}),c.jsx(fe,{type:"number",value:S.trigger_low,onChange:T=>N({...S,trigger_low:parseInt(T.target.value)})}),c.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Starter: 1-",S.trigger_low," units. Growth: ",S.trigger_low,"+."]})]}),c.jsxs("div",{children:[c.jsx(ne,{children:"Trigger High"}),c.jsx(fe,{type:"number",value:S.trigger_high,onChange:T=>N({...S,trigger_high:parseInt(T.target.value)})})]}),c.jsxs("div",{children:[c.jsx(ne,{children:"Base Price"}),c.jsx(fe,{type:"number",value:S.base_price,onChange:T=>N({...S,base_price:parseFloat(T.target.value)})})]})]})]}),c.jsxs(oe,{onClick:()=>w(S),disabled:d,children:[c.jsx(ku,{className:"mr-2 h-4 w-4"}),"Save Configuration"]})]}):c.jsxs("p",{className:"text-muted-foreground",children:["No ",C," config found for ",h,"."]});return c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h2",{className:"text-2xl font-bold",children:"Pricing Configuration"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Cu,{className:"h-5 w-5"}),c.jsxs(Ht,{value:h,onValueChange:p,children:[c.jsx(It,{className:"w-32",children:c.jsx(Wt,{})}),c.jsxs($t,{children:[c.jsx(pe,{value:"CHF",children:"CHF"}),c.jsx(pe,{value:"EUR",children:"EUR"}),c.jsx(pe,{value:"GBP",children:"GBP"}),c.jsx(pe,{value:"USD",children:"USD"})]})]})]})]}),c.jsxs(Nc,{value:m,onValueChange:g,children:[c.jsxs(Ps,{children:[c.jsxs(gt,{value:"per-reservation",className:"gap-1.5",children:[c.jsx(tx,{className:"h-3.5 w-3.5"}),"Per-Reservation (2026)"]}),c.jsx(gt,{value:"str",children:"STR Pricing (Legacy)"}),c.jsx(gt,{value:"hotel",children:"Hotel Pricing (Legacy)"}),c.jsx(gt,{value:"modules",children:"Modules (Legacy)"})]}),c.jsx(vt,{value:"per-reservation",className:"mt-6",children:c.jsxs("div",{className:"space-y-6",children:[c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:o.map(S=>{const N=BB[S.tier_key]||{name:S.tier_key,color:""};return c.jsxs(ve,{children:[c.jsx(Ce,{className:"pb-3",children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(ze,{className:"text-lg",children:N.name}),c.jsx(Ye,{className:N.color,variant:"secondary",children:S.tier_key})]})}),c.jsxs(be,{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsxs(ne,{className:"flex items-center gap-1.5",children:[c.jsx(tx,{className:"h-3.5 w-3.5"}),"Price per reservation (",h,")"]}),c.jsx(fe,{type:"number",step:"0.01",value:S.price_per_reservation,onChange:C=>b(S.id,"price_per_reservation",parseFloat(C.target.value)||0)})]}),c.jsxs("div",{children:[c.jsxs(ne,{className:"flex items-center gap-1.5",children:[c.jsx(GE,{className:"h-3.5 w-3.5"}),"Free reservations"]}),c.jsx(fe,{type:"number",value:S.free_reservations,onChange:C=>b(S.id,"free_reservations",parseInt(C.target.value)||0)})]}),c.jsxs("div",{children:[c.jsx(ne,{children:"Min. reservations/month"}),c.jsx(fe,{type:"number",step:"1",value:S.minimum_reservations,onChange:C=>b(S.id,"minimum_reservations",parseInt(C.target.value)||0)})]}),c.jsxs("div",{children:[c.jsx(ne,{children:"Cancelled rate (%)"}),c.jsx(fe,{type:"number",step:"0.01",min:"0",max:"1",value:S.cancelled_reservation_rate,onChange:C=>b(S.id,"cancelled_reservation_rate",parseFloat(C.target.value)||0)}),c.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Cancelled bookings billed at ",(S.cancelled_reservation_rate*100).toFixed(0),"% of rate"]})]})]})]},S.id)})}
2),o.length===0&&c.jsxs("p",{className:"text-center text-muted-foreground py-8",children:["No per-reservation tiers found for ",h,"."]}),o.length>0&&c.jsxs(oe,{onClick:j,disabled:d,children:[c.jsx(ku,{className:"mr-2 h-4 w-4"}),"Save All Tiers"]})]})}),c.jsx(vt,{value:"str",className:"mt-6",children:O(t,e,"str")}),c.jsx(vt,{value:"hotel",className:"mt-6",children:O(r,n,"hotel")}),c.jsx(vt,{value:"modules",className:"mt-6",children:c.jsxs("div",{className:"space-y-6",children:[c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:i.filter(S=>!S.is_included_in_base).map(S=>c.jsx(ve,{className:"p-4",children:c.jsxs("div",{className:"space-y-3",children:[c.jsx("div",{className:"font-semibold",children:S.display_name}),c.jsx(fe,{type:"number",value:S.base_price,onChange:N=>a(i.map(C=>C.id===S.id?{...C,base_price:parseFloat(N.target.value)}:C))})]})},S.id))}),c.jsxs(oe,{onClick:_,disabled:d,children:[c.jsx(ku,{className:"mr-2 h-4 w-4"}),"Save All Modules"]})]})})]})]})};function br(t,e){const r=He(t);return isNaN(e)?qa(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function Vr(t,e){const r=He(t);if(isNaN(e))return qa(t,NaN);if(!e)return r;const n=r.getDate(),i=qa(t,r.getTime());i.setMonth(r.getMonth()+e+1,0);const a=i.getDate();return n>=a?i:(r.setFullYear(i.getFullYear(),i.getMonth(),n),r)}function sx(t,e){const r=e*7;return br(t,r)}function zB(t,e){return Vr(t,e*12)}function qB(t){let e;return t.forEach(function(r){const n=He(r);(e===void 0||e<n||isNaN(Number(n)))&&(e=n)}),e||new Date(NaN)}function UB(t){let e;return t.forEach(r=>{const n=He(r);(!e||e>n||isNaN(+n))&&(e=n)}),e||new Date(NaN)}function Au(t,e){const r=He(t),n=He(e),i=r.getTime()-n.getTime();return i<0?-1:i>0?1:i}function HB(t){return qa(t,Date.now())}function kr(t,e){const r=zu(t),n=zu(e);return+r==+n}function Ho(t,e){const r=He(t),n=He(e),i=r.getFullYear()-n.getFullYear(),a=r.getMonth()-n.getMonth();return i*12+a}function WB(t,e,r){const n=El(t,r),i=El(e,r),a=+n-qu(n),o=+i-qu(i);return Math.round((a-o)/p4)}function VB(t,e){const r=He(t),n=He(e),i=D1(r,n),a=Math.abs(Ln(r,n));r.setDate(r.getDate()-i*a);const o=+(D1(r,n)===-i),s=i*(a-o);return s===0?0:s}function D1(t,e){const r=t.getFullYear()-e.getFullYear()||t.getMonth()-e.getMonth()||t.getDate()-e.getDate()||t.getHours()-e.getHours()||t.getMinutes()-e.getMinutes()||t.getSeconds()-e.getSeconds()||t.getMilliseconds()-e.getMilliseconds();return r<0?-1:r>0?1:r}function KB(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function GB(t,e){return+He(t)-+He(e)}function YB(t){const e=He(t);return e.setHours(23,59,59,999),e}function Jf(t){const e=He(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(23,59,59,999),e}function XB(t){const e=He(t);return+YB(e)==+Jf(e)}function JB(t,e){const r=He(t),n=He(e),i=Au(r,n),a=Math.abs(Ho(r,n));let o;if(a<1)o=0;else{r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*a);let s=Au(r,n)===-i;XB(He(t))&&a===1&&Au(t,n)===1&&(s=!1),o=i*(a-Number(s))}return o===0?0:o}function ZB(t,e,r){const n=GB(t,e)/1e3;return KB(r?.roundingMethod)(n)}function cr(t){const e=He(t);return e.setDate(1),e.setHours(0,0,0,0),e}function C0(t,e){const r=ME(),n=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,i=He(t),a=i.getDay(),o=(a<n?-7:0)+6-(a-n);return i.setDate(i.getDate()+o),i.setHours(23,59,59,999),i}function KP(t){return C0(t,{weekStartsOn:1})}function QB(t,e,r){const n=ME(),i=r?.locale??n.locale??DE,a=2520,o=Au(t,e);if(isNaN(o))throw new RangeError("Invalid time value");const s=Object.assign({},r,{addSuffix:r?.addSuffix,comparison:o});let l,u;o>0?(l=He(e),u=He(t)):(l=He(t),u=He(e));const d=ZB(u,l),f=(qu(u)-qu(l))/1e3,h=Math.round((d-f)/60);let p;if(h<2)return r?.includeSeconds?d<5?i.formatDistance("lessThanXSeconds",5,s):d<10?i.formatDistance("lessThanXSeconds",10,s):d<20?i.formatDistance("lessThanXSeconds",20,s):d<40?i.formatDistance("halfAMinute",0,s):d<60?i.formatDistance("lessThanXMinutes",1,s):i.formatDistance("xMinutes",1,s):h===0?i.formatDistance("lessThanXMinutes",1,s):i.formatDistance("xMinutes",h,s);if(h<45)return i.formatDistance("xMinutes",h,s);if(h<90)return i.formatDistance("aboutXHours",1,s);if(h<P1){const m=Math.round(h/60);return i.formatDistance("aboutXHours",m,s)}else{if(h<a)return i.formatDistance("xDays",1,s);if(h<Qc){const m=Math.round(h/P1);return i.formatDistance("xDays",m,s)}else if(h<Qc*2)return p=Math.round(h/Qc),i.formatDistance("aboutXMonths",p,s)}if(p=JB(u,l),p<12){const m=Math.round(h/Qc);return i.formatDistance("xMonths",m,s)}else{const m=p%12,g=Math.trunc(p/12);return m<3?i.formatDistance("aboutXYears",g,s):m<9?i.formatDistance("overXYears",g,s):i.formatDistance("almostXYears",g+1,s)}}function dp(t,e){return QB(t,HB(t),e)}function e3(t){const e=He(t),r=e.getFullYear(),n=e.getMonth(),i=qa(t,0);return i.setFullYear(r,n+1,0),i.setHours(0,0,0,0),i.getDate()}function t3(t){return Math.trunc(+He(t)/1e3)}function r3(t){const e=He(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(0,0,0,0),e}function n3(t,e){return WB(r3(t),cr(t),e)+1}function lx(t,e){const r=He(t),n=He(e);return r.getTime()>n.getTime()}function GP(t,e){const r=He(t),n=He(e);return+r<+n}function k0(t,e){const r=He(t),n=He(e);return r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()}function i3(t,e){const r=He(t),n=He(e);return r.getFullYear()===n.getFullYear()}function fp(t,e){return br(t,-e)}function go(t,e){const n=l3(t);let i;if(n.date){const l=c3(n.date,2);i=u3(l.restDateString,l.year)}if(!i||isNaN(i.getTime()))return new Date(NaN);const a=i.getTime();let o=0,s;if(n.time&&(o=d3(n.time),isNaN(o)))return new Date(NaN);if(n.timezone){if(s=f3(n.timezone),isNaN(s))return new Date(NaN)}else{const l=new Date(a+o),u=new Date(0);return u.setFullYear(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()),u.setHours(l.getUTCHours(),l.getUTCMinutes(),l.getUTCSeconds(),l.getUTCMilliseconds()),u}return new Date(a+o+s)}
vendor: 4,769 bytes, line 2
2const eu={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},a3=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,o3=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,s3=/^([+-])(\d{2})(?::?(\d{2}))?$/;function l3(t){const e={},r=t.split(eu.dateTimeDelimiter);let n;if(r.length>2)return e;if(/:/.test(r[0])?n=r[0]:(e.date=r[0],n=r[1],eu.timeZoneDelimiter.test(e.date)&&(e.date=t.split(eu.timeZoneDelimiter)[0],n=t.substr(e.date.length,t.length))),n){const i=eu.timezone.exec(n);i?(e.time=n.replace(i[1],""),e.timezone=i[1]):e.time=n}return e}function c3(t,e){const r=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),n=t.match(r);if(!n)return{year:NaN,restDateString:""};const i=n[1]?parseInt(n[1]):null,a=n[2]?parseInt(n[2]):null;return{year:a===null?i:a*100,restDateString:t.slice((n[1]||n[2]).length)}}function u3(t,e){if(e===null)return new Date(NaN);const r=t.match(a3);if(!r)return new Date(NaN);const n=!!r[4],i=Hs(r[1]),a=Hs(r[2])-1,o=Hs(r[3]),s=Hs(r[4]),l=Hs(r[5])-1;if(n)return v3(e,s,l)?h3(e,s,l):new Date(NaN);{const u=new Date(0);return!m3(e,a,o)||!g3(e,i)?new Date(NaN):(u.setUTCFullYear(e,a,Math.max(i,o)),u)}}function Hs(t){return t?parseInt(t):1}function d3(t){const e=t.match(o3);if(!e)return NaN;const r=hp(e[1]),n=hp(e[2]),i=hp(e[3]);return y3(r,n,i)?r*RE+n*IE+i*1e3:NaN}function hp(t){return t&&parseFloat(t.replace(",","."))||0}function f3(t){if(t==="Z")return 0;const e=t.match(s3);if(!e)return 0;const r=e[1]==="+"?-1:1,n=parseInt(e[2]),i=e[3]&&parseInt(e[3])||0;return x3(n,i)?r*(n*RE+i*IE):NaN}function h3(t,e,r){const n=new Date(0);n.setUTCFullYear(t,0,4);const i=n.getUTCDay()||7,a=(e-1)*7+r+1-i;return n.setUTCDate(n.getUTCDate()+a),n}const p3=[31,null,31,30,31,30,31,31,30,31,30,31];function YP(t){return t%400===0||t%4===0&&t%100!==0}function m3(t,e,r){return e>=0&&e<=11&&r>=1&&r<=(p3[e]||(YP(t)?29:28))}function g3(t,e){return e>=1&&e<=(YP(t)?366:365)}function v3(t,e,r){return e>=1&&e<=53&&r>=0&&r<=6}function y3(t,e,r){return t===24?e===0&&r===0:r>=0&&r<60&&e>=0&&e<60&&t>=0&&t<25}function x3(t,e){return e>=0&&e<=59}function pp(t,e){const r=He(t),n=r.getFullYear(),i=r.getDate(),a=qa(t,0);a.setFullYear(n,e,15),a.setHours(0,0,0,0);const o=e3(a);return r.setMonth(e,Math.min(i,o)),r}function R1(t,e){const r=He(t);return isNaN(+r)?qa(t,NaN):(r.setFullYear(e),r)}function I1(t,e){return Vr(t,-e)}var Ne=function(){return Ne=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},Ne.apply(this,arguments)};function b3(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function XP(t,e,r){for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return t.concat(a||Array.prototype.slice.call(e))}function Cc(t){return t.mode==="multiple"}function kc(t){return t.mode==="range"}function Zf(t){return t.mode==="single"}var w3={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function _3(t,e){return Ue(t,"LLLL y",e)}function S3(t,e){return Ue(t,"d",e)}function j3(t,e){return Ue(t,"LLLL",e)}function O3(t){return"".concat(t)}function N3(t,e){return Ue(t,"cccccc",e)}function C3(t,e){return Ue(t,"yyyy",e)}var k3=Object.freeze({__proto__:null,formatCaption:_3,formatDay:S3,formatMonthCaption:j3,formatWeekNumber:O3,formatWeekdayName:N3,formatYearC
2aption:C3}),A3=function(t,e,r){return Ue(t,"do MMMM (EEEE)",r)},E3=function(){return"Month: "},P3=function(){return"Go to next month"},T3=function(){return"Go to previous month"},M3=function(t,e){return Ue(t,"cccc",e)},D3=function(t){return"Week n. ".concat(t)},R3=function(){return"Year: "},I3=Object.freeze({__proto__:null,labelDay:A3,labelMonthDropdown:E3,labelNext:P3,labelPrevious:T3,labelWeekNumber:D3,labelWeekday:M3,labelYearDropdown:R3});function $3(){var t="buttons",e=w3,r=DE,n={},i={},a=1,o={},s=new Date;return{captionLayout:t,classNames:e,formatters:k3,labels:I3,locale:r,modifiersClassNames:n,modifiers:i,numberOfMonths:a,styles:o,today:s,mode:"default"}}function L3(t){var e=t.fromYear,r=t.toYear,n=t.fromMonth,i=t.toMonth,a=t.fromDate,o=t.toDate;return n?a=cr(n):e&&(a=new Date(e,0,1)),i?o=Jf(i):r&&(o=new Date(r,11,31)),{fromDate:a?zu(a):void 0,toDate:o?zu(o):void 0}}var JP=x.createContext(void 0);function B3(t){var e,r=t.initialProps,n=$3(),i=L3(r),a=i.fromDate,o=i.toDate,s=(e=r.captionLayout)!==null&&e!==void 0?e:n.captionLayout;s!=="buttons"&&(!a||!o)&&(s="buttons");var l;(Zf(r)||Cc(r)||kc(r))&&(l=r.onSelect);var u=Ne(Ne(Ne({},n),r),{captionLayout:s,classNames:Ne(Ne({},n.classNames),r.classNames),components:Ne({},r.components),formatters:Ne(Ne({},n.formatters),r.formatters),fromDate:a,labels:Ne(Ne({},n.labels),r.labels),mode:r.mode||n.mode,modifiers:Ne(Ne({},n.modifiers),r.modifiers),modifiersClassNames:Ne(Ne({},n.modifiersClassNames),r.modifiersClassNames),onSelect:l,styles:Ne(Ne({},n.styles),r.styles),toDate:o});return c.jsx(JP.Provider,{value:u,children:t.children})}function ct(){var t=x.useContext(JP);if(!t)throw new Error("useDayPicker must be used within a DayPickerProvider.");return t}function ZP(t){var e=ct(),r=e.locale,n=e.classNames,i=e.styles,a=e.formatters.formatCaption;return c.jsx("div",{className:n.caption_label,style:i.caption_label,"aria-live":"polite",role:"presentation",id:t.id,children:a(t.displayMonth,{locale:r})})}function F3(t){return c.jsx("svg",Ne({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},t,{children:c.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function QP(t){var e,r,n=t.onChange,i=t.value,a=t.children,o=t.caption,s=t.className,l=t.style,u=ct(),d=(r=(e=u.components)===null||e===void 0?void 0:e.IconDropdown)!==null&&r!==void 0?r:F3;return c.jsxs("div",{className:s,style:l,children:[c.jsx("span",{className:u.classNames.vhidden,children:t["aria-label"]}),c.jsx("select",{name:t.name,"aria-label":t["aria-label"],className:u.classNames.dropdown,style:u.styles.dropdown,value:i,onChange:n,children:a}),c.jsxs("div",{className:u.classNames.caption_label,style:u.styles.caption_label,"aria-hidden":"true",children:[o,c.jsx(d,{className:u.classNames.dropdown_icon,style:u.styles.dropdown_icon})]})]})}function z3(t){var e,r=ct(),n=r.fromDate,i=r.toDate,a=r.styles,o=r.locale,s=r.formatters.formatMonthCaption,l=r.classNames,u=r.components,d=r.labels.labelMonthDropdown;if(!n)return c.jsx(c.Fragment,{});if(!i)return c.jsx(c.Fragment,{});var f=[];if(i3(n,i))for(var h=cr(n),p=n.getMonth();p<=i.getMonth();p++)f.push(pp(h,p));else for(var h=cr(new Date),p=0;p<=11;p++)f.push(pp(h,p));var m=function(v){var y=Number(v.target.value),w=pp(cr(t.displayMonth),y);t.onChange(w)},g=(e=u?.Dropdown)!==null&&e!==void 0?e:QP;return c.jsx(g,{name:"months","aria-label":d(),className:l.dropdown_month,style:a.dropdown_month,onChange:m,value:t.displayMonth.getMonth(),caption:s(t.displayMonth,{locale:o}),children:f.map(function(v){return c.jsx("option",{value:v.getMonth(),children:s(v,{locale:o})},v.getMonth())})})}function q3(t){var e,r=t.displayMonth,n=ct(),i=n.fromDate,a=n.toDate,o=n.locale,s=n.styles,l=n.classNames,u=n.components,d=n.formatters.formatYearC
2aption,f=n.labels.labelYearDropdown,h=[];if(!i)return c.jsx(c.Fragment,{});if(!a)return c.jsx(c.Fragment,{});for(var p=i.getFullYear(),m=a.getFullYear(),g=p;g<=m;g++)h.push(R1(m4(new Date),g));var v=function(w){var _=R1(cr(r),Number(w.target.value));t.onChange(_)},y=(e=u?.Dropdown)!==null&&e!==void 0?e:QP;return c.jsx(y,{name:"years","aria-label":f(),className:l.dropdown_year,style:s.dropdown_year,onChange:v,value:r.getFullYear(),caption:d(r,{locale:o}),children:h.map(function(w){return c.jsx("option",{value:w.getFullYear(),children:d(w,{locale:o})},w.getFullYear())})})}function U3(t,e){var r=x.useState(t),n=r[0],i=r[1],a=e===void 0?n:e;return[a,i]}function H3(t){var e=t.month,r=t.defaultMonth,n=t.today,i=e||r||n||new Date,a=t.toDate,o=t.fromDate,s=t.numberOfMonths,l=s===void 0?1:s;if(a&&Ho(a,i)<0){var u=-1*(l-1);i=Vr(a,u)}return o&&Ho(i,o)<0&&(i=o),cr(i)}function W3(){var t=ct(),e=H3(t),r=U3(e,t.month),n=r[0],i=r[1],a=function(o){var s;if(!t.disableNavigation){var l=cr(o);i(l),(s=t.onMonthChange)===null||s===void 0||s.call(t,l)}};return[n,a]}function V3(t,e){for(var r=e.reverseMonths,n=e.numberOfMonths,i=cr(t),a=cr(Vr(i,n)),o=Ho(a,i),s=[],l=0;l<o;l++){var u=Vr(i,l);s.push(u)}return r&&(s=s.reverse()),s}function K3(t,e){if(!e.disableNavigation){var r=e.toDate,n=e.pagedNavigation,i=e.numberOfMonths,a=i===void 0?1:i,o=n?a:1,s=cr(t);if(!r)return Vr(s,o);var l=Ho(r,t);if(!(l<a))return Vr(s,o)}}function G3(t,e){if(!e.disableNavigation){var r=e.fromDate,n=e.pagedNavigation,i=e.numberOfMonths,a=i===void 0?1:i,o=n?a:1,s=cr(t);if(!r)return Vr(s,-o);var l=Ho(s,r);if(!(l<=0))return Vr(s,-o)}}var eT=x.createContext(void 0);function Y3(t){var e=ct(),r=W3(),n=r[0],i=r[1],a=V3(n,e),o=K3(n,e),s=G3(n,e),l=function(f){return a.some(function(h){return k0(f,h)})},u=function(f,h){l(f)||(h&&GP(f,h)?i(Vr(f,1+e.numberOfMonths*-1)):i(f))},d={currentMonth:n,displayMonths:a,goToMonth:i,goToDate:u,previousMonth:s,nextMonth:o,isDateDisplayed:l};return c.jsx(eT.Provider,{value:d,children:t.children})}function Ac(){var t=x.useContext(eT);if(!t)throw new Error("useNavigation must be used within a NavigationProvider");return t}function $1(t){var e,r=ct(),n=r.classNames,i=r.styles,a=r.components,o=Ac().goToMonth,s=function(d){o(Vr(d,t.displayIndex?-t.displayIndex:0))},l=(e=a?.CaptionLabel)!==null&&e!==void 0?e:ZP,u=c.jsx(l,{id:t.id,displayMonth:t.displayMonth});return c.jsxs("div",{className:n.caption_dropdowns,style:i.caption_dropdowns,children:[c.jsx("div",{className:n.vhidden,children:u}),c.jsx(z3,{onChange:s,displayMonth:t.displayMonth}),c.jsx(q3,{onChange:s,displayMonth:t.displayMonth})]})}function X3(t){return c.jsx("svg",Ne({width:"16px",height:"16px",viewBox:"0 0 120 120"},t,{children:c.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function J3(t){return c.jsx("svg",Ne({width:"16px",height:"16px",viewBox:"0 0 120 120"},t,{children:c.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var Wu=x.forwardRef(function(t,e){var r=ct(),n=r.classNames,i=r.styles,a=[n.button_reset,n.button];t.className&&a.push(t.className);var o=a.join(" "),s=Ne(Ne({},i.button_reset),i.button);return t.style&&Object.assign(s,t.style),c.jsx("button",Ne({},t,{ref:e,type:"button",className:o,style:s}))});function Z3(t){var e,r,n=ct(),i=n.dir,a=n.locale,o=n.classNames,s=n.styles,l=n.labels,u=l.labelPrevious,d=l.labelNext,f=n.components;if(!t.nextMonth&&!t.previousMonth)return c.jsx(c.Fragment,{});var h=u(t.previousMonth,{locale:a}),p=[o.nav_button,o.nav_button_previous].join(" "),m=d(t.nextMonth,{locale:a}),g=[o.nav_button,o.nav_button_next].join(" "),v=(e=f?.IconRight)!==null&&e!==void 0?e:J3,y=(r=f?.IconLeft)!==null&&r!==void 0?r:X3;return c.jsxs("div",{className:o.nav,style:s.nav,children:[!t.hidePrevious&&c.jsx(Wu,{name:"previous-month","aria-label":h,className:p,style:s.nav_button_previous,disabled:!t.previousMonth,onClick:t.onPreviousClick,children:i==="rtl"?c.jsx(v,{className:o.nav_icon,style:s.nav_icon}):c.jsx(y,{className:o.nav_icon,style:s.nav_icon})}),!t.hideNext&&c.jsx(Wu,{name:"next-month","aria-label":m,className:g,style:s.nav_button_next,disabled:!t.nextMonth,onClick:t.onNextClick,children:i==="rtl"?c.jsx(y,{className:o.nav_icon,style:s.nav_icon}):c.jsx(v,{className:o.nav_icon,style:s.nav_icon})})]})}function L1(t){var e=ct().numberOfMonths,r=Ac(),n=r.previousMonth,i=r.nextMonth,a=r.goToMonth,o=r.displayMonths,s=o.findIndex(function(m){return k0(t.displayMonth,m)}),l=s===0,u=s===o.length-1,d=e>1&&(l||!u),f=e>1&&(u||!l),h=function(){n&&a(n)},p=function(){i&&a(i)};return c.jsx(Z3,{displayMonth:t.displayMonth,hideNext:d,hidePrevious:f,nextMonth:i,previousMonth:n,onPreviousClick:h,onNextClick:p})}function Q3(t){var e,r=ct(),n=r.classNames,i=r.disableNavigation,a=r.styles,o=r.captionLayout,s=r.components,l=(e=s?.CaptionLabel)!==null&&e!==void 0?e:ZP,u;return i?u=c.jsx(l,{id:t.id,displayMonth:t.displayMonth}):o==="dropdown"?u=c.jsx($1,{displayMonth:t.displayMonth,id:t.id}):o==="dropdown-buttons"?u=c.jsxs(c.Fragment,{children:[c.jsx($1,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id}),c.jsx(L1,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id})]}):u=c.jsxs(c.Fragment,{children:[c.jsx(l,{id:t.id,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),c.jsx(L1,{displayMonth:t.displayMonth,id:t.id})]}),c.jsx("div",{className:n.caption,style:a.caption,children:u})}function eF(t){var e=ct(),r=e.footer,n=e.styles,i=e.classNames.tfoot;return r?c.jsx("tfoot",{className:i,style:n.tfoot,children:c.jsx("tr",{children:c.jsx("td",{colSpan:8,children:r})})}):c.jsx(c.Fragment,{})}function tF(t,e,r){for(var n=r?x0(new Date):El(new Date,{locale:t,weekStartsOn:e}),i=[],a=0;a<7;a++){var o=br(n,a);i.push(o)}return i}function rF(){var t=ct(),e=t.classNames,r=t.styles,n=t.showWeekNumber,i=t.locale,a=t.weekStartsOn,o=t.ISOWeek,s=t.formatters.formatWeekdayName,l=t.labels.labelWeekday,u=tF(i,a,o);return c.jsxs("tr",{style:r.head_row,className:e.head_row,children:[n&&c.jsx("td",{style:r.head_cell,className:e.head_cell}),u.map(function(d,f){return c.jsx("th",{scope:"col",className:e.head_cell,style:r.head_cell,"aria-label":l(d,{locale:i}),children:s(d,{locale:i})},f)})]})}
2function nF(){var t,e=ct(),r=e.classNames,n=e.styles,i=e.components,a=(t=i?.HeadRow)!==null&&t!==void 0?t:rF;return c.jsx("thead",{style:n.head,className:r.head,children:c.jsx(a,{})})}function iF(t){var e=ct(),r=e.locale,n=e.formatters.formatDay;return c.jsx(c.Fragment,{children:n(t.date,{locale:r})})}var A0=x.createContext(void 0);function aF(t){if(!Cc(t.initialProps)){var e={selected:void 0,modifiers:{disabled:[]}};return c.jsx(A0.Provider,{value:e,children:t.children})}return c.jsx(oF,{initialProps:t.initialProps,children:t.children})}function oF(t){var e=t.initialProps,r=t.children,n=e.selected,i=e.min,a=e.max,o=function(u,d,f){var h,p;(h=e.onDayClick)===null||h===void 0||h.call(e,u,d,f);var m=!!(d.selected&&i&&n?.length===i);if(!m){var g=!!(!d.selected&&a&&n?.length===a);if(!g){var v=n?XP([],n):[];if(d.selected){var y=v.findIndex(function(w){return kr(u,w)});v.splice(y,1)}else v.push(u);(p=e.onSelect)===null||p===void 0||p.call(e,v,u,d,f)}}},s={disabled:[]};n&&s.disabled.push(function(u){var d=a&&n.length>a-1,f=n.some(function(h){return kr(h,u)});return!!(d&&!f)});var l={selected:n,onDayClick:o,modifiers:s};return c.jsx(A0.Provider,{value:l,children:r})}function E0(){var t=x.useContext(A0);if(!t)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return t}function sF(t,e){var r=e||{},n=r.from,i=r.to;return n&&i?kr(i,t)&&kr(n,t)?void 0:kr(i,t)?{from:i,to:void 0}:kr(n,t)?void 0:lx(n,t)?{from:t,to:i}:{from:n,to:t}:i?lx(t,i)?{from:i,to:t}:{from:t,to:i}:n?GP(t,n)?{from:t,to:n}:{from:n,to:t}:{from:t,to:void 0}}var P0=x.createContext(void 0);function lF(t){if(!kc(t.initialProps)){var e={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return c.jsx(P0.Provider,{value:e,children:t.children})}return c.jsx(cF,{initialProps:t.initialProps,children:t.children})}function cF(t){var e=t.initialProps,r=t.children,n=e.selected,i=n||{},a=i.from,o=i.to,s=e.min,l=e.max,u=function(p,m,g){var v,y;(v=e.onDayClick)===null||v===void 0||v.call(e,p,m,g);var w=sF(p,n);(y=e.onSelect)===null||y===void 0||y.call(e,w,p,m,g)},d={range_start:[],range_end:[],range_middle:[],disabled:[]};if(a?(d.range_start=[a],o?(d.range_end=[o],kr(a,o)||(d.range_middle=[{after:a,before:o}])):d.range_end=[a]):o&&(d.range_start=[o],d.range_end=[o]),s&&(a&&!o&&d.disabled.push({after:fp(a,s-1),before:br(a,s-1)}),a&&o&&d.disabled.push({after:a,before:br(a,s-1)}),!a&&o&&d.disabled.push({after:fp(o,s-1),before:br(o,s-1)})),l){if(a&&!o&&(d.disabled.push({before:br(a,-l+1)}),d.disabled.push({after:br(a,l-1)})),a&&o){var f=Ln(o,a)+1,h=l-f;d.disabled.push({before:fp(a,h)}),d.disabled.push({after:br(o,h)})}!a&&o&&(d.disabled.push({before:br(o,-l+1)}),d.disabled.push({after:br(o,l-1)}))}return c.jsx(P0.Provider,{value:{selected:n,onDayClick:u,modifiers:d},children:r})}function T0(){var t=x.useContext(P0);if(!t)throw new Error("useSelectRange must be used within a SelectRangeProvider");return t}function Eu(t){return Array.isArray(t)?XP([],t):t!==void 0?[t]:[]}function uF(t){var e={};return Object.entries(t).forEach(function(r){var n=r[0],i=r[1];e[n]=Eu(i)}),e}var Nn;(function(t){t.Outside="outside",t.Disabled="disabled",t.Selected="selected",t.Hidden="hidden",t.Today="today",t.RangeStart="range_start",t.RangeEnd="range_end",t.RangeMiddle="range_middle"})(Nn||(Nn={}));var dF=Nn.Selected,Zn=Nn.Disabled,fF=Nn.Hidden,hF=Nn.Today,mp=Nn.RangeEnd,gp=Nn.RangeMiddle,vp=Nn.RangeStart,pF=Nn.Outside;function mF(t,e,r){var n,i=(n={},n[dF]=Eu(t.selected),n[Zn]=Eu(t.disabled),n[fF]=Eu(t.hidden),n[hF]=[t.today],n[mp]=[],n[gp]=[],n[vp]=[],n[pF]=[],n);return t.fromDate&&i[Zn].push({before:t.fromDate}),t.toDate&&i[Zn].push({after:t.toDate}),Cc(t)?i[Zn]=i[Zn].concat(e.modifiers[Zn]):kc(t)&&(i[Zn]=i[Zn].concat(r.modifiers[Zn]),i[vp]=r.modifiers[vp],i[gp]=r.modifiers[gp],i[mp]=r.modifiers[mp]),i}var tT=x.createContext(void 0);function gF(t){var e=ct(),r=E0(),n=T0(),i=mF(e,r,n),a=uF(e.modifiers),o=Ne(Ne({},i),a);return c.jsx(tT.Provider,{value:o,children:t.children})}function rT(){var t=x.useContext(tT);if(!t)throw new Error("useModifiers must be used within a ModifiersProvider");return t}function vF(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function yF(t){return!!(t&&typeof t=="object"&&"from"in t)}function xF(t){return!!(t&&typeof t=="object"&&"after"in t)}function bF(t){return!!(t&&typeof t=="object"&&"before"in t)}function wF(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function _F(t,e){var r,n=e.from,i=e.to;if(n&&i){var a=Ln(i,n)<0;a&&(r=[i,n],n=r[0],i=r[1]);var o=Ln(t,n)>=0&&Ln(i,t)>=0;return o}return i?kr(i,t):n?kr(n,t):!1}function SF(t){return $E(t)}function jF(t){return Array.isArray(t)&&t.every($E)}function OF(t,e){return e.some(function(r){if(typeof r=="boolean")return r;if(SF(r))return kr(t,r);
2if(jF(r))return r.includes(t);if(yF(r))return _F(t,r);if(wF(r))return r.dayOfWeek.includes(t.getDay());if(vF(r)){var n=Ln(r.before,t),i=Ln(r.after,t),a=n>0,o=i<0,s=lx(r.before,r.after);return s?o&&a:a||o}return xF(r)?Ln(t,r.after)>0:bF(r)?Ln(r.before,t)>0:typeof r=="function"?r(t):!1})}function M0(t,e,r){var n=Object.keys(e).reduce(function(a,o){var s=e[o];return OF(t,s)&&a.push(o),a},[]),i={};return n.forEach(function(a){return i[a]=!0}),r&&!k0(t,r)&&(i.outside=!0),i}function NF(t,e){for(var r=cr(t[0]),n=Jf(t[t.length-1]),i,a,o=r;o<=n;){var s=M0(o,e),l=!s.disabled&&!s.hidden;if(!l){o=br(o,1);continue}if(s.selected)return o;s.today&&!a&&(a=o),i||(i=o),o=br(o,1)}return a||i}var CF=365;function nT(t,e){var r=e.moveBy,n=e.direction,i=e.context,a=e.modifiers,o=e.retry,s=o===void 0?{count:0,lastFocused:t}:o,l=i.weekStartsOn,u=i.fromDate,d=i.toDate,f=i.locale,h={day:br,week:sx,month:Vr,year:zB,startOfWeek:function(v){return i.ISOWeek?x0(v):El(v,{locale:f,weekStartsOn:l})},endOfWeek:function(v){return i.ISOWeek?KP(v):C0(v,{locale:f,weekStartsOn:l})}},p=h[r](t,n==="after"?1:-1);n==="before"&&u?p=qB([u,p]):n==="after"&&d&&(p=UB([d,p]));var m=!0;if(a){var g=M0(p,a);m=!g.disabled&&!g.hidden}return m?p:s.count>CF?s.lastFocused:nT(p,{moveBy:r,direction:n,context:i,modifiers:a,retry:Ne(Ne({},s),{count:s.count+1})})}var iT=x.createContext(void 0);function kF(t){var e=Ac(),r=rT(),n=x.useState(),i=n[0],a=n[1],o=x.useState(),s=o[0],l=o[1],u=NF(e.displayMonths,r),d=i??(s&&e.isDateDisplayed(s))?s:u,f=function(){l(i),a(void 0)},h=function(v){a(v)},p=ct(),m=function(v,y){if(i){var w=nT(i,{moveBy:v,direction:y,context:p,modifiers:r});kr(i,w)||(e.goToDate(w,i),h(w))}},g={focusedDay:i,focusTarget:d,blur:f,focus:h,focusDayAfter:function(){return m("day","after")},focusDayBefore:function(){return m("day","before")},focusWeekAfter:function(){return m("week","after")},focusWeekBefore:function(){return m("week","before")},focusMonthBefore:function(){return m("month","before")},focusMonthAfter:function(){return m("month","after")},focusYearBefore:function(){return m("year","before")},focusYearAfter:function(){return m("year","after")},focusStartOfWeek:function(){return m("startOfWeek","before")},focusEndOfWeek:function(){return m("endOfWeek","after")}};return c.jsx(iT.Provider,{value:g,children:t.children})}function D0(){var t=x.useContext(iT);if(!t)throw new Error("useFocusContext must be used within a FocusProvider");return t}function AF(t,e){var r=rT(),n=M0(t,r,e);return n}var R0=x.createContext(void 0);function EF(t){if(!Zf(t.initialProps)){var e={selected:void 0};return c.jsx(R0.Provider,{value:e,children:t.children})}return c.jsx(PF,{initialProps:t.initialProps,children:t.children})}function PF(t){var e=t.initialProps,r=t.children,n=function(a,o,s){var l,u,d;if((l=e.onDayClick)===null||l===void 0||l.call(e,a,o,s),o.selected&&!e.required){(u=e.onSelect)===null||u===void 0||u.call(e,void 0,a,o,s);return}(d=e.onSelect)===null||d===void 0||d.call(e,a,a,o,s)},i={selected:e.selected,onDayClick:n};return c.jsx(R0.Provider,{value:i,children:r})}function aT(){var t=x.useContext(R0);if(!t)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return t}function TF(t,e){var r=ct(),n=aT(),i=E0(),a=T0(),o=D0(),s=o.focusDayAfter,l=o.focusDayBefore,u=o.focusWeekAfter,d=o.focusWeekBefore,f=o.blur,h=o.focus,p=o.focusMonthBefore,m=o.focusMonthAfter,g=o.focusYearBefore,v=o.focusYearAfter,y=o.focusStartOfWeek,w=o.focusEndOfWeek,_=function($){var A,F,V,te;Zf(r)?(A=n.onDayClick)===null||A===void 0||A.call(n,t,e,$):Cc(r)?(F=i.onDayClick)===null||F===void 0||F.call(i,t,e,$):kc(r)?(V=a.onDayClick)===null||V===void 0||V.call(a,t,e,$):(te=r.onDayClick)===null||te===void 0||te.call(r,t,e,$)},j=function($){var A;h(t),(A=r.onDayFocus)===null||A===void 0||A.call(r,t,e,$)},b=function($){var A;f(),(A=r.onDayBlur)===null||A===void 0||A.call(r,t,e,$)},O=function($){var A;(A=r.onDayMouseEnter)===null||A===void 0||A.call(r,t,e,$)},S=function($){var A;(A=r.onDayMouseLeave)===null||A===void 0||A.call(r,t,e,$)},N=function($){var A;(A=r.onDayPointerEnter)===null||A===void 0||A.call(r,t,e,$)},C=function($){var A;(A=r.onDayPointerLeave)===null||A===void 0||A.call(r,t,e,$)},T=function($){var A;(A=r.onDayTouchCancel)===null||A===void 0||A.call(r,t,e,$)},k=function($){var A;(A=r.onDayTouchEnd)===null||A===void 0||A.call(r,t,e,$)},M=function($){var A;(A=r.onDayTouchMove)===null||A===void 0||A.call(r,t,e,$)},E=function($){var A;(A=r.onDayTouchStart)===null||A===void 0||A.call(r,t,e,$)},L=function($){var A;(A=r.onDayKeyUp)===null||A===void 0||A.call(r,t,e,$)},R=function($){var A;switch($.key){case"ArrowLeft":$.preventDefault(),$.stopPropagation(),r.dir==="rtl"?s():l();break;case"ArrowRight":$.preventDefault(),$.stopPropagation(),r.dir==="rtl"?l(
2):s();break;case"ArrowDown":$.preventDefault(),$.stopPropagation(),u();break;case"ArrowUp":$.preventDefault(),$.stopPropagation(),d();break;case"PageUp":$.preventDefault(),$.stopPropagation(),$.shiftKey?g():p();break;case"PageDown":$.preventDefault(),$.stopPropagation(),$.shiftKey?v():m();break;case"Home":$.preventDefault(),$.stopPropagation(),y();break;case"End":$.preventDefault(),$.stopPropagation(),w();break}(A=r.onDayKeyDown)===null||A===void 0||A.call(r,t,e,$)},I={onClick:_,onFocus:j,onBlur:b,onKeyDown:R,onKeyUp:L,onMouseEnter:O,onMouseLeave:S,onPointerEnter:N,onPointerLeave:C,onTouchCancel:T,onTouchEnd:k,onTouchMove:M,onTouchStart:E};return I}function MF(){var t=ct(),e=aT(),r=E0(),n=T0(),i=Zf(t)?e.selected:Cc(t)?r.selected:kc(t)?n.selected:void 0;return i}function DF(t){return Object.values(Nn).includes(t)}function RF(t,e){var r=[t.classNames.day];return Object.keys(e).forEach(function(n){var i=t.modifiersClassNames[n];if(i)r.push(i);else if(DF(n)){var a=t.classNames["day_".concat(n)];a&&r.push(a)}}),r}function IF(t,e){var r=Ne({},t.styles.day);return Object.keys(e).forEach(function(n){var i;r=Ne(Ne({},r),(i=t.modifiersStyles)===null||i===void 0?void 0:i[n])}),r}function $F(t,e,r){var n,i,a,o=ct(),s=D0(),l=AF(t,e),u=TF(t,l),d=MF(),f=!!(o.onDayCl
2ick||o.mode!=="default");x.useEffect(function(){var O;l.outside||s.focusedDay&&f&&kr(s.focusedDay,t)&&((O=r.current)===null||O===void 0||O.focus())},[s.focusedDay,t,r,f,l.outside]);var h=RF(o,l).join(" "),p=IF(o,l),m=!!(l.outside&&!o.showOutsideDays||l.hidden),g=(a=(i=o.components)===null||i===void 0?void 0:i.DayContent)!==null&&a!==void 0?a:iF,v=c.jsx(g,{date:t,displayMonth:e,activeModifiers:l}),y={style:p,className:h,children:v,role:"gridcell"},w=s.focusTarget&&kr(s.focusTarget,t)&&!l.outside,_=s.focusedDay&&kr(s.focusedDay,t),j=Ne(Ne(Ne({},y),(n={disabled:l.disabled,role:"gridcell"},n["aria-selected"]=l.selected,n.tabIndex=_||w?0:-1,n)),u),b={isButton:f,isHidden:m,activeModifiers:l,selectedDays:d,buttonProps:j,divProps:y};return b}function LF(t){var e=x.useRef(null),r=$F(t.date,t.displayMonth,e);return r.isHidden?c.jsx("div",{role:"gridcell"}):r.isButton?c.jsx(Wu,Ne({name:"day",ref:e},r.buttonProps)):c.jsx("div",Ne({},r.divProps))}function BF(t){var e=t.number,r=t.dates,n=ct(),i=n.onWeekNumberClick,a=n.styles,o=n.classNames,s=n.locale,l=n.labels.labelWeekNumber,u=n.formatters.formatWeekNumber,d=u(Number(e),{locale:s});if(!i)return c.jsx("span",{className:o.weeknumber,style:a.weeknumber,children:d});var f=l(Number(e),{locale:s}),h=function(p){i(e,r,p)};return c.jsx(Wu,{name:"week-number","aria-label":f,className:o.weeknumber,style:a.weeknumber,onClick:h,children:d})}function FF(t){var e,r,n=ct(),i=n.styles,a=n.classNames,o=n.showWeekNumber,s=n.components,l=(e=s?.Day)!==null&&e!==void 0?e:LF,u=(r=s?.WeekNumber)!==null&&r!==void 0?r:BF,d;return o&&(d=c.jsx("td",{className:a.cell,style:i.cell,children:c.jsx(u,{number:t.weekNumber,dates:t.dates})})),c.jsxs("tr",{className:a.row,style:i.row,children:[d,t.dates.map(function(f){return c.jsx("td",{className:a.cell,style:i.cell,role:"presentation",children:c.jsx(l,{displayMonth:t.displayMonth,date:f})},t3(f))})]})}function B1(t,e,r){for(var n=r?.ISOWeek?KP(e):C0(e,r),i=r?.ISOWeek?x0(t):El(t,r),a=Ln(n,i),o=[],s=0;s<=a;s++)o.push(br(i,s));var l=o.reduce(function(u,d){var f=r?.ISOWeek?g4(d):v4(d,r),h=u.find(function(p){return p.weekNumber===f});return h?(h.dates.push(d),u):(u.push({weekNumber:f,dates:[d]}),u)},[]);return l}function zF(t,e){var r=B1(cr(t),Jf(t),e);if(e?.useFixedWeeks){var n=n3(t,e);if(n<6){var i=r[r.length-1],a=i.dates[i.dates.length-1],o=sx(a,6-n),s=B1(sx(a,1),o,e);r.push.apply(r,s)}}return r}function qF(t){var e,r,n,i=ct(),a=i.locale,o=i.classNames,s=i.styles,l=i.hideHead,u=i.fixedWeeks,d=i.components,f=i.weekStartsOn,h=i.firstWeekContainsDate,p=i.ISOWeek,m=zF(t.displayMonth,{useFixedWeeks:!!u,ISOWeek:p,locale:a,weekStartsOn:f,firstWeekContainsDate:h}),g=(e=d?.Head)!==null&&e!==void 0?e:nF,v=(r=d?.Row)!==null&&r!==void 0?r:FF,y=(n=d?.Footer)!==null&&n!==void 0?n:eF;return c.jsxs("table",{id:t.id,className:o.table,style:s.table,role:"grid","aria-labelledby":t["aria-labelledby"],children:[!l&&c.jsx(g,{}),c.jsx("tbody",{className:o.tbody,style:s.tbody,children:m.map(function(w){return c.jsx(v,{displayMonth:t.displayMonth,dates:w.dates,weekNumber:w.weekNumber},w.weekNumber)})}),c.jsx(y,{displayMonth:t.displayMonth})]})}function UF(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var HF=UF()?x.useLayoutEffect:x.useEffect,yp=!1,WF=0;function F1(){return"react-day-picker-".concat(++WF)}function VF(t){var e,r=t??(yp?F1():null),n=x.useState(r),i=n[0],a=n[1];return HF(function(){i===null&&a(F1())},[]),x.useEffect(function(){yp===!1&&(yp=!0)},[]),(e=t??i)!==null&&e!==void 0?e:void 0}function KF(t){var e,r,n=ct(),i=n.dir,a=n.classNames,o=n.styles,s=n.components,l=Ac().displayMonths,u=VF(n.id?"".concat(n.id,"-").concat(t.displayIndex):void 0),d=n.id?"".concat(n.id,"-grid-").concat(t.displayIndex):void 0,f=[a.month],h=o.month,p=t.displayIndex===0,m=t.displayIndex===l.length-1,g=!p&&!m;i==="rtl"&&(e=[p,m],m=e[0],p=e[1]),p&&(f.push(a.caption_start),h=Ne(Ne({},h),o.caption_start)),m&&(f.push(a.caption_end),h=Ne(Ne({},h),o.caption_end)),g&&(f.push(a.caption_between),h=Ne(Ne({},h),o.caption_between));var v=(r=s?.Caption)!==null&&r!==void 0?r:Q3;return c.jsxs("div",{className:f.join(" "),style:h,children:[c.jsx(v,{id:u,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),c.jsx(qF,{id:d,"aria-labelledby":u,displayMonth:t.displayMonth})]},t.displayIndex)}function GF(t){var e=ct(),r=e.classNames,n=e.styles;return c.jsx("div",{className:r.months,style:n.months,children:t.children})}function YF(t){var e,r,n=t.initialProps,i=ct(),a=D0(),o=Ac(),s=x.useState(!1),l=s[0],u=s[1];x.useEffect(function(){i.initialFocus&&a.focusTarget&&(l||(a.focus(a.focusTarget),u(!0)))},[i.initialFocus,l,a.focus,a.focusTarget,a]);var d=[i.classNames.root,i.className];i.numberOfMonths>1&&d.push(i.classNames.multiple_months),i.showWeekNumber&&d.push(i.classNames.with_weeknumber);var f=Ne(Ne({},i.styles.root),i.style),h=Object.keys(n).filter(function(m){return m.startsWith("data-")}).reduce(function(m,g){var v;return Ne(Ne({},m),(v={},v[g]=n[g],v))},{}),p=(r=(e=n.components)===null||e===void 0?void 0:e.Months)!==null&&r!==void 0?r:GF;return c.jsx("div",Ne({className:d.join(" "),style:f,dir:i.dir,id:i.id,nonce:n.nonce,title:n.title,lang:n.lang},h,{children:c.jsx(p,{children:o.displayMonths.map(function(m,g){return c.jsx(KF,{displayIndex:g,displayMonth:m},g)})})}))}function XF(t){var e=t.children,r=b3(t,["children"]);return c.jsx(B3,{initialProps:r,children:c.jsx(Y3,{children:c.jsx(EF,{initialProps:r,children:c.jsx(aF,{initialProps:r,children:c.jsx(lF,{initialProps:r,children:c.jsx(gF,{children:c.jsx(kF,{children:e})})})})})})})}function JF(t){return c.jsx(XF,Ne({},t,{children:c.jsx(YF,{initialProps:t})}))}function bn({className:t,classNames:e,showOutsideDays:r=!0,...n}){return c.jsx(JF,{showOutsideDays:r,className:le("p-3",t),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:sp
2ace-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:le(Bu({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:le(Bu({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...e},components:{IconLeft:({...i})=>c.jsx(h4,{className:"h-4 w-4"}),IconRight:({...i})=>c.jsx(LE,{className:"h-4 w-4"})},...n})}bn.displayName="Calendar";var Qf="Popover",[oT]=no(Qf,[Es]),Ec=Es(),[ZF,ta]=oT(Qf),sT=t=>{const{__scopePopover:e,children:r,open:n,defaultOpen:i,onOpenChange:a,modal:o=!1}=t,s=Ec(e),l=x.useRef(null),[u,d]=x.useState(!1),[f,h]=qo({prop:n,defaultProp:i??!1,onChange:a,caller:Qf});return c.jsx(h0,{...s,children:c.jsx(ZF,{scope:e,contentId:jn(),triggerRef:l,open:f,onOpenChange:h,onOpenToggle:x.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:u,onCustomAnchorAdd:x.useCallback(()=>d(!0),[]),onCustomAnchorRemove:x.useCallback(()=>d(!1),[]),modal:o,children:r})})};sT.displayName=Qf;var lT="PopoverAnchor",QF=x.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,i=ta(lT,r),a=Ec(r),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return x.useEffect(()=>(o(),()=>s()),[o,s]),c.jsx(Wf,{...a,...n,ref:e})});QF.displayName=lT;var cT="PopoverTrigger",uT=x.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,i=ta(cT,r),a=Ec(r),o=Nt(e,i.triggerRef),s=c.jsx(Ve.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":mT(i.open),...n,ref:o,onClick:Ae(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:c.jsx(Wf,{asChild:!0,...a,children:s})});uT.displayName=cT;var I0="PopoverPortal",[e5,t5]=oT(I0,{forceMount:void 0}),dT=t=>{const{__scopePopover:e,forceMount:r,children:n,container:i}=t,a=ta(I0,e);return c.jsx(e5,{scope:e,forceMount:r,children:c.jsx(Zi,{present:r||a.open,children:c.jsx(vE,{asChild:!0,container:i,children:n})})})};dT.displayName=I0;var Wo="PopoverContent",fT=x.forwardRef((t,e)=>{const r=t5(Wo,t.__scopePopover),{forceMount:n=r.forceMount,...i}=t,a=ta(Wo,t.__scopePopover);return c.jsx(Zi,{present:n||a.open,children:a.modal?c.jsx(n5,{...i,ref:e}):c.jsx(i5,{...i,ref:e})})});fT.displayName=Wo;var r5=SE("PopoverContent.RemoveScroll"),n5=x.forwardRef((t,e)=>{const r=ta(Wo,t.__scopePopover),n=x.useRef(null),i=Nt(e,n),a=x.useRef(!1);return x.useEffect(()=>{const o=n.current;if(o)return xE(o)},[]),c.jsx(wE,{as:r5,allowPinchZoom:!0,children:c.jsx(hT,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ae(t.onCloseAutoFocus,o=>{o.preventDefault(),a.current||r.triggerRef.current?.focus()}),onPointerDownOutside:Ae(t.onPointerDownOutside,o=>{const s=o.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0,u=s.button===2||l;a.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:Ae(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),i5=x.forwardRef((t,e)=>{const r=ta(Wo,t.__scopePopover),n=x.useRef(!1),i=x.useRef(!1);return c.jsx(hT,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{t.onCloseAutoFocus?.(a),a.defaultPrevented||(n.current||r.triggerRef.current?.focus(),a.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:a=>
2{t.onInteractOutside?.(a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=a.target;r.triggerRef.current?.contains(o)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})}),hT=x.forwardRef((t,e)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,...f}=t,h=ta(Wo,r),p=Ec(r);return bE(),c.jsx(_E,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:a,children:c.jsx(p0,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>h.onOpenChange(!1),children:c.jsx(m0,{"data-state":mT(h.open),role:"dialog",id:h.contentId,...p,...f,ref:e,style:{...f.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)"}})})})}),pT="PopoverClose",a5=x.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,i=ta(pT,r);return c.jsx(Ve.button,{type:"button",...n,ref:e,onClick:Ae(t.onClick,()=>i.onOpenChange(!1))})});a5.displayName=pT;var o5="PopoverArrow",s5=x.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,i=Ec(r);return c.jsx(g0,{...i,...n,ref:e})});s5.displayName=o5;function mT(t){return t?"open":"closed"}var l5=sT,c5=uT,u5=dT,gT=fT;const Dn=l5,Rn=c5,wn=x.forwardRef(({className:t,align:e="center",sideOffset:r=4,...n},i)=>c.jsx(u5,{children:c.jsx(gT,{ref:i,align:e,sideOffset:r,className:le("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",t),...n})}));wn.displayName=gT.displayName;const ma={essential:{name:"Essential",color:"border-blue-500 bg-blue-50 dark:bg-blue-950",description:"Core features for getting started"},advanced:{name:"Advanced",color:"border-primary bg-primary/5",description:"Enhanced automation & AI"},expert:{name:"Expert",color:"border-amber-500 bg-amber-50 dark:bg-amber-950",description:"Full suite with premium modules"}},d5={essential:["Guest messaging (WhatsApp, SMS, Email)","AI-powered auto-replies","Task management","Integrations: PMS, Smart Keylocks*, Payment Providers","Digital guestbook","Multi-language support"],advanced:["Everything in Essential","KYC analysis via AI","Sentiment analysis","Advanced workflow automation","Priority support"],expert:["Everything in Advanced, plus:","Complete orchestration of your operations via AI","Client Relationship Management","Reporting & Analytics","Dedicated account manager","Custom integrations","2 additional expert modules included"]},z1=[{key:"deposit_management",name:"Deposit Management (Stripe or Swikly)",description:"Automated security deposit collection and refund"},{key:"upselling",name:"Upselling",description:"AI-driven guest upsell offers and revenue optimization"},{key:"owner_management",name:"Owner Management",description:"Property owner reporting and communication"}],q1=["igloohome_keybox"],f5={igloohome_keybox:"box"},h5={crm:"Client Relationship Management"},p5=({onOrderCreated:t,editOrderId:e})=>{const[r,n]=x.useState([]),[i,a]=x.useState([]),[o,s]=x.useState([]),[l,u]=x.useState([]),[d,f]=x.useState(!0),[h,p]=x.useState(!1),{toast:m}=Pr(),[g,v]=x.useState("per_reservation"),[y,w]=x.useState("str"),[_,j]=x.useState("en"),[b,O]=x.useState(""),[S,N]=x.useState({company_name:"",first_name:"",last_name:"",email:"",phone:"",vat_number:"",billing_email:"",billing_address_line1:"",billing_address_line2:"",billing_postal_code:"",billing_city:"",b
2illing_country:""}),[C,T]=x.useState({vat_number:"",billing_email:"",billing_address_line1:"",billing_address_line2:"",billing_postal_code:"",billing_city:"",billing_country:""}),[k,M]=x.useState(!1),[E,L]=x.useState(1),[R,I]=x.useState("CHF"),[$,A]=x.useState(0),[F,V]=x.useState(!1),[te,B]=x.useState(0),[G,se]=x.useState([]),[Q,ye]=x.useState(0),[re,ue]=x.useState(null),[Y,z]=x.useState(0),[X,U]=x.useState(0),[me,ge]=x.useState(),[Ee,We]=x.useState(),[qe,ar]=x.useState(),[Zt,Rr]=x.useState(""),[pt,mr]=x.useState(!1),[gr,Kr]=x.useState("per_unit"),[Ct,ca]=x.useState(1),[Oe,ua]=x.useState(0),[wt,da]=x.useState(0),[Mt,qs]=x.useState(0),[uo,fo]=x.useState(""),[ut,Hc]=x.useState("essential"),[ho,Wc]=x.useState(0),[fa,Vc]=x.useState(0),[kn,ha]=x.useState([]),[pa,np]=x.useState(500),[Kc,Gc]=x.useState([]),[po,Yc]=x.useState(0),[mo,Xc]=x.useState(0),[Gr,Ai]=x.useState([{months:0,discount_pct:0},{months:12,discount_pct:0},{months:24,discount_pct:0}]),[vr,W]=x.useState({});x.useEffect(()=>{q()},[R]),x.useEffect(()=>{if(g==="per_reservation"){const P=l.find(H=>H.tier_key===ut);P&&Wc(P.price_per_reservation)}},[ut,l,g]),x.useEffect(()=>{if(g==="per_reservation"&&l.length>0){const P=["essential","advanced","expert"],H=P.indexOf(ut),ae={};P.forEach((xe,xt)=>{if(xt>=H){const Qt=vr[xe],Ot=l.find(Jn=>Jn.tier_key===xe);ae[xe]={price_per_reservation:Qt?.price_per_reservation??Ot?.price_per_reservation??0,onboarding_fee:Qt?.onboarding_fee??pa}}}),W(ae)}},[ut,l,g]),x.useEffect(()=>{(async()=>{if(!(!e||d))try{const{data:H,error:ae}=await Z.from("orders").select("*").eq("id",e).single();if(ae)throw ae;if(!H)return;const xe=H.pricing_model||"legacy";if(v(xe),w(H.business_type),j(H.language),O(H.client_id),I(H.currency),Rr(H.notes||""),H.start_date&&ge(new Date(H.start_date)),H.estimated_golive_date&&We(new Date(H.estimated_golive_date)),H.validity_date&&ar(new Date(H.validity_date)),xe==="per_reservation"){if(Hc(H.tier_key||"essential"),Wc(H.price_per_reservation||0),Vc(H.free_credits||0),ua(H.onboarding_base_price||0),np(H.onboarding_base_price||500),da(H.onboarding_discount_percentage||0),fo(H.onboarding_notes||""),Yc(H.indicative_units||0),Xc(H.indicative_annual_reservations||0),H.packages&&Array.isArray(H.packages)){const xt=H.packages;xt.length>0&&"discount_pct"in xt[0]&&Ai(xt)}H.tier_pricing&&typeof H.tier_pricing=="object"&&W(H.tier_pricing),Array.isArray(H.selected_modules)&&ha(H.selected_modules),Array.isArray(H.add_on_modules)&&Gc(H.add_on_modules)}else L(H.units),A(H.discount_percentage||0),V(H.annual_billing||!1),B(H.free_trial_months||0),ue(H.base_monthly_price),se(Array.isArray(H.selected_modules)?H.selected_modules:[]),Kr(H.onboarding_type||"per_unit"),ca(H.onboarding_quantity||1),ua(H.onboarding_base_price||0),da(H.onboarding_discount_percentage||0),fo(H.onboarding_notes||"");m({title:"Order Loaded",description:"Editing existing order"})}catch(H){console.error("Error loading order:",H),m({title:"Error",description:"Failed to load order data",variant:"destructive"})}})()},[e,d]),x.useEffect(()=>{g==="legacy"&&(Te(),ue(null))},[E,y,R,o,g]),x.useEffect(()=>{g==="legacy"&&Xe()},[Q,re,$,F,G,i,E,g]),x.useEffect(()=>{g==="legacy"&&gr==="per_unit"&&ca(E)},[E,gr,g]),x.useEffect(()=>{g==="legacy"&&je()},[Oe,wt,Ct,g]),x.useEffect(()=>{if(g==="per_reservation"){let P=pa;wt>0&&(P=P*(1-wt/100)),qs(Math.round(P))}},[pa,wt,g]);const q=async()=>{try{const[P,H,ae,xe]=await Promise.all([Z.from("clients").select("*"),Z.from("pricing_modules").select("*").eq("currency",R),Z.from("pricing_config").select("*").eq("currency",R),Z.from("pricing_tiers").select("*").eq("currency",R).order("display_order",{ascending:!0})]);if(P.error)throw P.error;if(H.error)throw H.error;if(ae.error)throw ae.error;if(xe.error)throw xe.error;n(P.data||[]),a(H.data||[]),s(ae.data||[]),u(xe.data||[])}catch(P){console.error("Error:",P),m({title:"Error",description:"Failed to load data",variant:"destructive"})}finally{f(!1)}},Te=()=>{const P=o.find(ae=>ae.config_type===y);if(!P)return;let H;if(E<=3)H=P.starter_price;else if(E>=P.trigger_low){const xe=(Math.max(Math.min(E,P.trigger_high),P.trigger_low)-P.trigger_low)/(P.trigger_high-P.trigger_low);H=P.base_price-(P.base_price-P.target_price)*xe,H=Math.floor(H)}else H=P.base_price;ye(H),ue(H)},je=()=>{if(Oe<=0||Ct<=0){qs(0);return}let P=Oe*Ct;wt>0&&(P=P*(1-wt/100)),qs(Math.round(P))},Xe=()=>{let P=(re||Q)*E,H=0;G.forEach(Qt=>{const Ot=i.find(Jn=>Jn.id===Qt);Ot&&!Ot.is_included_in_base&&(H+=Ot.base_price)});const ae=P+H;let xe=ae;if($>0&&(xe=xe*(1-$/100)),F){const Qt=o.find(Ot=>Ot.config_type===y);Qt&&(xe=xe*(1-Qt.yearly_discount/100))}const xt=ae>0?(ae-xe)/ae*100:0;U(Math.round(xt)),z(Math.round(xe))},Je=P=>{se(H=>H.includes(P)?H.filter(ae=>ae!==P):[...H,P])},qt=P=>{ha(H=>H.includes(P)?H.filter(ae=>ae!==P):H.length>=2?H:[...H,P])},An=P=>{ue(Math.max(0,P))},mt=async()=>{let P=null;if(b){const H=r.find(ae=>ae.id===b);H&&(P={company_name:H.company_name,first_name:H.first_name,last_name:H.last_name})}else S.company_name&&S.first_name&&S.email&&(P={company_name:S.company_name,first_name:S.first_name,last_name:S.last_name});if(!P){m({title:"Error",description:"Please select or create a client first",variant:"destructive"});return}mr(!0);try{const{data:H,error:ae}=await Z.functions.invoke("generate-order-notes",{body:{companyName:P.company_name,firstName:P.first_name,lastName:P.last_name||"",businessType:y,units:g==="per_reservation"?0:E,currency:R,language:_,selectedModules:g==="per_reservation"?[ma[ut]?.name||ut]:i.filter(xe=>G.includes(xe.id)).map(xe=>xe.display_name)}});if(ae)throw ae;Rr(H.notes),m({title:"Success",description:"Notes generated successfully"})}catch(H){console.error("Error generating notes:",H),m({title:"Error",description:H.message||"Failed to generate notes",variant:"destructive"})}finally{mr(!1)}};x.useEffect(()=>{const P=r.find(H=>H.id===b);P&&T({vat_number:P.vat_number??"",billing_email:P.billing_email??"",billing_address_line1:P.billing_address_line1??"",billing_address_line2:P.billing_address_line2??"",billing_postal_code:P.billing_postal_code??"",billing_city:P.billing_city??"",billing_country:P.billing_country??""})},[b,r]);const yr=async()=>
2{if(b){M(!0);try{const P={vat_number:C.vat_number.trim()||null,billing_email:C.billing_email.trim()||null,billing_address_line1:C.billing_address_line1.trim()||null,billing_address_line2:C.billing_address_line2.trim()||null,billing_postal_code:C.billing_postal_code.trim()||null,billing_city:C.billing_city.trim()||null,billing_country:C.billing_country.trim()||null},{data:H,error:ae}=await Z.from("clients").update(P).eq("id",b).select().single();if(ae)throw ae;n(r.map(xe=>xe.id===b?{...xe,...H}:xe)),m({title:"Saved",description:"Billing details updated"})}catch(P){console.error(P),m({title:"Error",description:P.message||"Failed to save",variant:"destructive"})}finally{M(!1)}}},dt=async()=>{if(!S.company_name||!S.first_name||!S.email){m({title:"Error",description:"Fill required fields (Company Name, First Name, Email)",variant:"destructive"});return}p(!0);try{const{data:P,error:H}=await Z.from("clients").insert({...S,business_type:y,source:"order_form"}).select().single();if(H)throw H;n([...r,P]),O(P.id),N({company_name:"",first_name:"",last_name:"",email:"",phone:"",vat_number:"",billing_email:"",billing_address_line1:"",billing_address_line2:"",billing_postal_code:"",billing_city:"",billing_country:""}),m({title:"Success",description:"Client created"})}catch(P){console.error("Error:",P),m({title:"Error",description:"Failed to create client",variant:"destructive"})}finally{p(!1)}},Us=async()=>{if(!b){m({title:"Error",description:"Select a client",variant:"destructive"});return}if(!Zt.trim()){m({title:"Error",description:"Notes are required. Please add notes or generate them using AI.",variant:"destructive"});return}p(!0);try{const P=r.find(bt=>bt.id===b);if(!P)throw new Error("Client not found");const{data:{user:H}}=await Z.auth.getUser();let ae;if(g==="per_reservation"){let bt=pa;wt>0&&(bt=bt*(1-wt/100)),bt=Math.round(bt),ae={client_id:b,business_type:y,pricing_model:"per_reservation",tier_key:ut,price_per_reservation:vr[ut]?.price_per_reservation??ho,free_credits:fa,units:0,base_monthly_price:0,discount_percentage:0,final_monthly_price:0,annual_billing:!1,free_trial_months:0,currency:R,language:_,selected_modules:ut==="expert"?kn:[],add_on_modules:Kc,status:"draft",start_date:me?Ue(me,"yyyy-MM-dd"):null,estimated_golive_date:Ee?Ue(Ee,"yyyy-MM-dd"):null,validity_date:qe?Ue(qe,"yyyy-MM-dd"):null,notes:Zt.trim(),onboarding_type:"flat_fee",onboarding_quantity:1,onboarding_base_price:vr[ut]?.onboarding_fee??pa,onboarding_discount_percentage:wt,onboarding_final_price:bt,onboarding_notes:uo,indicative_units:po,indicative_annual_reservations:mo,packages:Gr,tier_pricing:vr,selected_package:null,selected_tier:null}}else ae={client_id:b,business_type:y,pricing_model:"legacy",units:E,base_monthly_price:re||Q,discount_percentage:$,final_monthly_price:Y,annual_billing:F,free_trial_months:te,currency:R,language:_,selected_modules:G,status:"draft",start_date:me?Ue(me,"yyyy-MM-dd"):null,estimated_golive_date:Ee?Ue(Ee,"yyyy-MM-dd"):null,validity_date:qe?Ue(qe,"yyyy-MM-dd"):null,notes:Zt.trim(),onboarding_type:gr,onboarding_quantity:Ct,onboarding_base_price:Oe,onboarding_discount_percentage:wt,onboarding_final_price:Mt,onboarding_notes:uo};let xe,xt;if(e){const bt=await Z.from("orders").update(ae).eq("id",e).select().single();xe=bt.data,xt=bt.error}else{const bt=await Z.from("orders").insert({...ae,created_by:H?.id||null}).select().single();xe=bt.data,xt=bt.error}if(xt)throw xt;const{data:Qt,error:Ot}=await Z.rpc("generate_order_signing_token",{p_order_id:xe.id});if(Ot)throw console.error("Failed to generate signing token:",Ot),new Error("Failed to generate secure signing link");const Jn=`${window.location.origin}/order/${xe.id}?token=${encodeURIComponent(Qt)}`;let Nr=!1;try{await navigator.clipboard.writeText(Jn),Nr=!0}catch(bt){console.warn("Clipboard access denied or unavailable:",bt)}try{const{data:bt}=await Z.from("profiles").select("first_name, last_name, sender_email").eq("user_id",H?.id).single(),kL=bt?.first_name?`${bt.first_name}${bt.last_name?" "+bt.last_name:""}`:"Smartiz Team",AL=bt?.sender_email||H?.email||"[email protected]";await Z.functions.invoke("send-order-confirmation",{body:{orderId:xe.id,firstName:P.first_name,userEmail:P.email,subscriptionUrl:Jn,language:_,replyToEmail:AL,replyToName:kL}})}catch(bt){console.error("Failed to send order confirmation email:",bt)}m({title:Nr?"Secure link copied to clipboard":"Order created successfully",description:Nr?"Order created with secure signing token and confirmation email sent":`Link: ${Jn}`}),t&&t()}catch(P){console.error("Error:",P),m({title:"Error",description:"Failed to create order",variant:"destructive"})}finally{p(!1)}};if(d)return c.jsx("div",{className:"flex items-center justify-center py-12",children:c.jsx(tt,{className:"h-8 w-8 animate-spin"})});const CL=i.filter(P=>P.is_included_in_base),Jc=i.filter(P=>!P.is_included_in_base);return c.jsxs("div",{className:"space-y-6",children:[c.jsx("h2",{className:"text-2xl font-bold",children:e?"Edit Order":"Order Form Builder"}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{children:"Pricing Model"})}),c.jsx(be,{children:c.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[c.jsxs("div",{onClick:()=>v("per_reservation"),className:le("p-4 rounded-lg border-2 cursor-pointer transition-all text-center",g==="per_reservation"?"border-primary bg-primary/5 shadow-sm":"border-border hover:border-primary/50"),children:[c.jsx(tx,{className:"h-5 w-5 mx-auto mb-2"}),c.jsx("div",{className:"font-semibold",children:"Per-Reservation (2026)"}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"New tier-based pricing"})]}),c.jsxs("div",{onClick:()=>v("legacy"),className:le("p-4 rounded-lg border-2 cursor-pointer transition-all text-center",g==="legacy"?"border-primary bg-primary/5 shadow-sm":"border-border hover:border-primary/50"),children:[c.jsx(Cu,{className:"h-5 w-5 mx-auto mb-2"}),c.jsx("div",{className:"font-semibold",children:"Legacy (per-unit)"}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Volume-based monthly pricing"})]})]})})]}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{children:"Business Type & Language"})}),c.jsxs(be,{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsx(ne,{children:"Business Type"}),c.jsxs(Ht,{value:y,onValueChange:P=>w(P),children:[c.jsx(It,{children:c.jsx(Wt,{})}),c.jsxs($t,{children:[c.jsx(pe,{value:"str",children:"Short-Term Rentals (STR)"}),c.jsx(pe,{value:"hotel",children:"Hotel"})]})]})]}),c.jsxs("div",{children:[c.jsx(ne,{children:"Client Language"}),c.jsxs(Ht,{value:_,onValueChange:P=>j(P),children:[c.jsx(It,{children:c.jsx(Wt,{})}),c.jsxs($t,{children:[c.jsx(pe,{value:"en",children:"English"}),c.jsx(pe,{value:"fr",children:"Français"}),c.jsx(pe,{value:"de",children:"Deutsch"}),c.jsx(pe,{value:"it",children:"Italiano"})]})]})]})]})]}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{children:"Client"})}),c.jsxs(be,{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx(ne,{children:"Select Client"}),c.jsxs(Ht,{value:b,onValueChange:O,children:[c.jsx(It,{children:c.jsx(Wt,{placeholder:"Select"})}),c.jsx($t,{children:r.map(P=>c.jsx(pe,{value:P.id,children:P.company_name},P.id))})]})]}),b&&r.find(P=>P.id===b)&&c.jsxs("div",{className:"bg-muted/50 p-4 rounded-lg border",children:[c.jsx("h4",{className:"font-semibold mb-3",children:"Selected Client Details"}),c.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[c.jsxs("div",{children:[c.jsx("span",{className:"text-muted-foreground",children:"Company:"}),c.jsx("div",{className:"font-medium",children:r.find(P=>P.id===b)?.company_name})]}),c.jsxs("div",{children:[c.jsx("span",{className:"text-muted-foreground",children:"Contact:"}),c.jsxs("div",{className:"font-medium",children:[r.find(P=>P.id===b)?.first_name," ",r.find(P=>P.id===b)?.last_name]})]}),c.jsxs("div",{children:[c.jsx("span",{className:"text-muted-foreground",children:"Email:"}),c.jsx("div",{className:"font-medium",children:r.find(P=>P.id===b)?.email})]}),c.jsxs("div",{children:[c.jsx("span",{className:"text-muted-foreground",children:"Phone:"}),c.jsx("div",{className:"font-medium",children:r.find(P=>P.id===b)?.phone})]})]}),c.jsxs("div",{className:"mt-4 pt-4 border-t",children:[c.jsx("h5",{className:"font-semibold mb-3 text-sm",children:"Billing details"}),c.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[c.jsx(fe,{placeholder:"VAT number",value:C.vat_number,onChange:P=>T({...C,vat_number:P.target.value})}),c.jsx(fe,{type:"email",placeholder:"Billing / invoice email",value:C.billing_email,onChange:P=>T({...C,billing_email:P.target.value.trim()})}),c.jsx(fe,{placeholder:"Address line 1",value:C.billing_address_line1,onChange:P=>T({...C,billing_address_line1:P.target.value})}),c.jsx(fe,{placeholder:"Address line 2",value:C.billing_address_line2,onChange:P=>T({...C,billing_address_line2:P.target.value})}),c.jsx(fe,{placeholder:"Postal code",value:C.billing_postal_code,onChange:P=>T({...C,billing_postal_code:P.target.value})}),c.jsx(fe,{placeholder:"City",value:C.billing_city,onChange:P=>T({...C,billing_city:P.target.value})}),c.jsx(fe,{placeholder:"Country",value:C.billing_country,onChange:P=>T({...C,billing_country:P.target.value})})]}),c.jsx(oe,{variant:"outline",size:"sm",onClick:yr,disabled:k,className:"mt-3",children:k?"S
2avingâ¦":"Save billing details"})]})]}),c.jsxs("div",{className:"border-t pt-4",children:[c.jsx("h3",{className:"font-semibold mb-4",children:"Or Create New"}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsx(fe,{placeholder:"First Name *",value:S.first_name,onChange:P=>N({...S,first_name:P.target.value})}),c.jsx(fe,{placeholder:"Last Name",value:S.last_name,onChange:P=>N({...S,last_name:P.target.value})}),c.jsx(fe,{placeholder:"Email *",type:"email",value:S.email,onChange:P=>N({...S,email:P.target.value})}),c.jsx(fe,{placeholder:"Company Name *",value:S.company_name,onChange:P=>N({...S,company_name:P.target.value})}),c.jsxs("div",{children:[c.jsx(ne,{className:"text-xs text-muted-foreground mb-1 block",children:"Phone"}),c.jsx(b0,{defaultCountry:"ch",value:S.phone,onChange:P=>N({...S,phone:P}),inputClassName:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",countrySelectorStyleProps:{buttonClassName:"border border-input bg-background hover:bg-accent rounded-l-md"}})]})]}),c.jsxs("div",{className:"mt-4",children:[c.jsx("h5",{className:"font-semibold mb-2 text-sm",children:"Billing details (optional)"}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsx(fe,{placeholder:"VAT number",value:S.vat_number,onChange:P=>N({...S,vat_number:P.target.value})}),c.jsx(fe,{type:"email",placeholder:"Billing / invoice email",value:S.billing_email,onChange:P=>N({...S,billing_email:P.target.value.trim()})}),c.jsx(fe,{placeholder:"Address line 1",value:S.billing_address_line1,onChange:P=>N({...S,billing_address_line1:P.target.value})}),c.jsx(fe,{placeholder:"Address line 2",value:S.billing_address_line2,onChange:P=>N({...S,billing_address_line2:P.target.value})}),c.jsx(fe,{placeholder:"Postal code",value:S.billing_postal_code,onChange:P=>N({...S,billing_postal_code:P.target.value})}),c.jsx(fe,{placeholder:"City",value:S.billing_city,onChange:P=>N({...S,billing_city:P.target.value})}),c.jsx(fe,{placeholder:"Country",value:S.billing_country,onChange:P=>N({...S,billing_country:P.target.value})})]})]}),c.jsxs(oe,{onClick:dt,disabled:h,className:"mt-4",children:[c.jsx(YE,{className:"mr-2 h-4 w-4"}),"Create Client"]})]})]})]}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{children:"Message for the Client"})}),c.jsxs(be,{className:"space-y-4",children:[c.jsx("div",{className:"bg-primary/10 border border-primary/20 rounded-lg p-4 mb-4",children:c.jsxs("p",{className:"text-sm text-muted-foreground",children:[c.jsx("strong",{children:"Important:"})," This message will be the first thing your client sees when they open the offer. Make it personal and welcoming to set the right tone for your proposal."]})}),c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(ne,{htmlFor:"notes",children:"Message for the Client *"}),c.jsxs(oe,{type:"button",variant:"outline",size:"sm",onClick:mt,disabled:pt,children:[pt?c.jsx(tt,{className:"mr-2 h-4 w-4 animate-spin"}):c.jsx(YL,{className:"mr-2 h-4 w-4"}),Zt?"Regenerate with AI":"Generate with AI"]})]}),c.jsx(zn,{placeholder:"Add a personalized message for your client... or use AI to generate one",value:Zt,onChange:P=>Rr(P.target.value),className:"mt-2 min-h-[150px]",required:!0}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"AI will generate a personalized message based on the client information and selected configuration."})]})]})]}),g==="per_reservation"&&c.jsxs(c.Fragment,{children:[c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{children:"Configuration"})}),c.jsxs(be,{className:"space-y-6",children:[c.jsxs("div",{children:[c.jsx(ne,{className:"mb-3 block",children:"Select Tier"}),c.jsx("div",{className:"grid grid-cols-3 gap-3",children:["essential","advanced","expert"].map(P=>{const H=ma[P],ae=ut===P;return c.jsxs("div",{onClick:()=>{Hc(P),P!=="expert"&&ha([])},className:le("p-4 rounded-lg border-2 cursor-pointer transition-all",ae?`${H.color} border-opacity-100 shadow-md`:"border-border hover:border-primary/30"),children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsx("span",{className:"font-bold text-sm",children:H.name}),ae&&c.jsx($n,{className:"h-4 w-4 text-primary"})]}),c.jsx("p",{className:"text-xs text-muted-foreground",children:H.description})]},P)})})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-4 border-t",children:[c.jsxs("div",{children:[c.jsx(ne,{children:"Indicative Units / Rooms"}),c.jsx(fe,{type:"number",min:0,value:po||"",onChange:P=>Yc(parseInt(P.target.value)||0),placeholder:"e.g. 15",className:"mt-2"})]}),c.jsxs("div",{children:[c.jsx(ne,{children:"Indicative Annual Reservations"}),c.jsx(fe,{type:"number",min:0,value:mo||"",onChange:P=>Xc(parseInt(P.target.value)||0),placeholder:"e.g. 1000",className:"mt-2"})]})]}),c.jsx("div",{className:"grid grid-cols-2 gap-4",children:c.jsxs("div",{children:[c.jsxs(ne,{className:"flex items-center gap-2",children:[c.jsx(Cu,{className:"h-4 w-4"}),"Currency"]}),c.jsxs(Ht,{value:R,onValueChange:I,children:[c.jsx(It,{className:"mt-2",children:c.jsx(Wt,{})}),c.jsxs($t,{children:[c.jsx(pe,{value:"CHF",children:"CHF"}),c.jsx(pe,{value:"EUR",children:"EUR"}),c.jsx(pe,{value:"GBP",children:"GBP"}),c.jsx(pe,{value:"USD",children:"USD"})]})]})]})}),c.jsxs("div",{children:[c.jsxs(ne,{className:"flex items-center gap-2",children:[c.jsx(GE,{className:"h-4 w-4"}),"Free Credits: ",fa," reservations"]}
2),c.jsx(Ei,{value:[fa],onValueChange:P=>Vc(P[0]),min:0,max:500,step:10,className:"mt-2"}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Number of free reservation credits offered to the client"})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-4 border-t",children:[c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx(ne,{children:"Start Date"}),c.jsxs(Dn,{children:[c.jsx(Rn,{asChild:!0,children:c.jsxs(oe,{variant:"outline",className:le("justify-start text-left font-normal",!me&&"text-muted-foreground"),children:[c.jsx(oi,{className:"mr-2 h-4 w-4"}),me?Ue(me,"PPP"):c.jsx("span",{children:"Pick a date"})]})}),c.jsx(wn,{className:"w-auto p-0",align:"start",children:c.jsx(bn,{mode:"single",selected:me,onSelect:ge,initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx(ne,{children:"Estimated Go-Live Date"}),c.jsxs(Dn,{children:[c.jsx(Rn,{asChild:!0,children:c.jsxs(oe,{variant:"outline",className:le("justify-start text-left font-normal",!Ee&&"text-muted-foreground"),children:[c.jsx(oi,{className:"mr-2 h-4 w-4"}),Ee?Ue(Ee,"PPP"):c.jsx("span",{children:"Pick a date"})]})}),c.jsx(wn,{className:"w-auto p-0",align:"start",children:c.jsx(bn,{mode:"single",selected:Ee,onSelect:We,initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]})]}),c.jsx("div",{className:"grid grid-cols-2 gap-4",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx(ne,{children:"Offer Validity Date"}),c.jsxs(Dn,{children:[c.jsx(Rn,{asChild:!0,children:c.jsxs(oe,{variant:"outline",className:le("justify-start text-left font-normal",!qe&&"text-muted-foreground"),children:[c.jsx(oi,{className:"mr-2 h-4 w-4"}),qe?Ue(qe,"PPP"):c.jsx("span",{children:"Pick a date"})]})}),c.jsx(wn,{className:"w-auto p-0",align:"start",children:c.jsx(bn,{mode:"single",selected:qe,onSelect:ar,initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]})})]})]}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{children:"Commitment Options"})}),c.jsxs(be,{className:"space-y-6",children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:'Set discount percentages for contract commitments. The client will choose their preferred option. "No commitment" is always at full price.'}),[{idx:1,label:"12-month contract",months:12},{idx:2,label:"24-month contract",months:24}].map(({idx:P,label:H,months:ae})=>{const xe=Gr[P],xt=vr[ut]?.price_per_reservation??ho,Qt=Math.ceil(xt*(1-xe.discount_pct/100)*20-1e-10)/20;return c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs(ne,{children:[H," â Discount: ",xe.discount_pct,"%"]}),xe.discount_pct>0&&c.jsxs("span",{className:"text-sm text-muted-foreground",children:[Qt," ",R,"/reservation"]})]}),c.jsx(Ei,{value:[xe.discount_pct],onValueChange:Ot=>{Ai(Jn=>{const Nr=[...Jn];return Nr[P]={...Nr[P],discount_pct:Ot[0]},P===1&&Nr[2].discount_pct<Ot[0]&&(Nr[2]={...Nr[2],discount_pct:Ot[0]}),P===2&&Ot[0]<Nr[1].discount_pct&&(Nr[P]={...Nr[P],discount_pct:Nr[1].discount_pct}),Nr})},min:0,max:50,step:1,className:"mt-1"})]},ae)}),c.jsx("div",{className:"grid grid-cols-3 gap-3 pt-2",children:Gr.map(P=>{const H=vr[ut]?.price_per_reservation??ho,ae=P.discount_pct>0?Math.ceil(H*(1-P.discount_pct/100)*20-1e-10)/20:H;return c.jsxs("div",{className:"rounded-lg border-2 border-border p-4 text-center space-y-2",children:[c.jsx("div",{className:"text-sm font-medium",children:P.months===0?"No commitment":`${P.months} months`}),P.discount_pct>0&&c.jsxs(Ye,{variant:"secondary",children:["-",P.discount_pct,"%"]}),c.jsxs("div",{className:"text-xl font-bold",children:[ae," ",R]}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"per reservation"}),c.jsx("div",{className:"text-xs text-muted-foreground italic",children:P.months===0?"Pay as you go":"Monthly invoices in arrear"})]},P.months)})})]})]}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{children:"Tier Pricing Review"})}),c.jsxs(be,{className:"space-y-4",children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:"Set the price per reservation and onboarding fee for the selected tier and all higher tiers. The client can self-upgrade on the order page."}),(()=>{const P=["essential","advanced","expert"],H=P.indexOf(ut);return P.filter((ae,xe)=>xe>=H).map(ae=>{const xe=vr[ae]||{price_per_reservation:0,onboarding_fee:500},xt=ae===ut;return c.jsxs("div",{className:le("rounded-lg border-2 p-4 space-y-3",xt?"border-primary bg-primary/5":"border-border"),children:[c.jsx("div",{className:"flex items-center justify-between",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-bold",children:ma[ae]?.name}),xt&&c.jsx(Ye,{variant:"default",className:"text-xs",children:"Recommended"})]})}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsxs(ne,{className:"text-xs",children:["Price per Reservation (",R,")"]}),c.jsx(fe,{type:"number",step:"0.01",value:xe.price_per_reservation,onChange:Qt=>{W(Ot=>({...Ot,[ae]:{...Ot[ae],price_per_reservation:parseFloat(Qt.target.value)||0}}))},className:"mt-1"})]}),c.jsxs("div",{children:[c.jsxs(ne,{className:"text-xs",children:["Onboarding Fee (",R,"): ",xe.onboarding_fee]}),c.jsx(Ei,{value:[xe.onboarding_fee],onValueChange:Qt=>{W(Ot=>({...Ot,[ae]:{...Ot[ae],onboarding_fee:Qt[0]}}))},min:0,max:5e3,step:50,className:"mt-2"})]})]})]},ae)})})()]})]}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsxs(ze,{children:["What's Included â ",ma[ut]?.name]})}),c.jsxs(be,{className:"space-y-4",children:[c.jsx("div",{className:"space-y-2",children:(d5[ut]||[]).map((P,H)=>{const ae=P.startsWith("Everything in");return c.jsxs("div",{className:"flex items-start gap-2",children:[!ae&&c.jsx($n,{className:"h-4 w-4 text-green-600 mt-0.5 shrink-0"}),c.jsx("span",{className:le("text-sm",ae&&"font-bold"),children:P})]},H)})}),ut==="expert"&&c.jsxs("div",{className:"border-t pt-4 mt-4",children:[c.jsx(ne,{className:"mb-3 block",children:"Choose 2 Expert Modules"}),c.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Select up to 2 additional modules included with the Expert tier."}),c.jsx("div",{className:"grid grid-cols-1 gap-3",children:z1.map(P=>{const H=kn.includes(P.key),ae=!H&&kn.length>=2;return c.jsx("div",{onClick:()=>!ae&&qt(P.key),className:le("p-3 rounded-lg border-2 transition-all",H?"border-primary bg-primary/5 shadow-sm cursor-pointer":ae?"border-border opacity-50 cursor-not-allowed":"border-border hover:border-primary/50 cursor-pointer"),children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("div",{className:"font-medium text-sm",children:P.name}),c.jsx("div",{className:"text-xs text-muted-foreground",children:P.description})]}),c.jsx("div",{className:le("w-5 h-5 rounded-full border-2 flex items-center justify-center shrink-0",H?"border-primary bg-primary":"border-border"),children:H&&c.jsx($n,{className:"w-3 h-3 text-primary-foreground"})})]})},P.key)})}),kn.length<2&&c.jsxs("div",{className:"flex items-center gap-2 mt-2 p-2 bg-amber-50 dark:bg-amber-950 border border-amber-200 dark:border-amber-800 rounded-md",children:[c.jsx("span",{className:"text-amber-600 text-sm font-medium",children:"â ï¸"}),c.jsxs("p",{className:"text-xs text-amber-700 dark:text-amber-400 font-medium",children:[2-kn.length," more module",kn.length===1?"":"s"," must be selected before sending the order"]}
2)]})]})]})]}),Jc.filter(P=>q1.includes(P.name)).length>0&&c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{children:"Monthly Add-ons"})}),c.jsxs(be,{children:[c.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Recurring monthly options added on top of per-reservation billing."}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Jc.filter(P=>q1.includes(P.name)).map(P=>{const H=Kc.includes(P.name),ae=f5[P.name],xe=()=>{Gc(xt=>xt.includes(P.name)?xt.filter(Qt=>Qt!==P.name):[...xt,P.name])};return c.jsx("div",{className:le("p-3 rounded-lg border-2 transition-all",H?"border-primary bg-primary/5 shadow-sm":"border-border hover:border-primary/50 cursor-pointer"),onClick:H?void 0:xe,children:c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{className:"flex-1",children:[c.jsx("div",{className:"font-medium text-sm",children:P.display_name}),c.jsx("div",{className:"text-xs text-muted-foreground",children:P.name}),c.jsxs("div",{className:"text-sm font-semibold mt-1",children:[P.base_price," ",R,ae?` / ${ae}`:""," / month"]}),ae&&c.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Billed per ",ae," integrated via smartiz (usage-based, count not set at offer time)."]})]}),c.jsx("div",{onClick:xt=>{xt.stopPropagation(),xe()},className:le("w-5 h-5 rounded-full border-2 flex items-center justify-center shrink-0 cursor-pointer",H?"border-primary bg-primary":"border-border"),children:H&&c.jsx($n,{className:"w-3 h-3 text-primary-foreground"})})]})},P.id)})})]})]}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{children:"Onboarding Notes"})}),c.jsxs(be,{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsxs(ne,{children:["Onboarding Discount: ",wt,"%"]}),c.jsx(Ei,{value:[wt],onValueChange:P=>da(P[0]),min:0,max:100,step:1,className:"mt-2"}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Applied across all tier onboarding fees"})]}),c.jsxs("div",{children:[c.jsx(ne,{children:"Onboarding Notes (Optional)"}),c.jsx(zn,{placeholder:"Add any specific notes about onboarding...",value:uo,onChange:P=>fo(P.target.value),className:"mt-2",rows:3})]})]})]}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{children:"Order Summary"})}),c.jsxs(be,{children:[c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex justify-between text-sm",children:[c.jsx("span",{className:"text-muted-foreground",children:"Recommended Tier:"}),c.jsx(Ye,{variant:"secondary",children:ma[ut]?.name})]}),po>0&&c.jsxs("div",{className:"flex justify-between text-sm",children:[c.jsx("span",{className:"text-muted-foreground",children:"Indicative Units:"}),c.jsx("span",{className:"font-medium",children:po})]}),mo>0&&c.jsxs("div",{className:"flex justify-between text-sm",children:[c.jsx("span",{className:"text-muted-foreground",children:"Annual Reservations:"}),c.jsxs("span",{className:"font-medium",children:["~",mo]})]}),c.jsxs("div",{className:"flex justify-between text-sm",children:[c.jsxs("span",{className:"text-muted-foreground",children:["Price per reservation (",ma[ut]?.name,"):"]}),c.jsxs("span",{className:"font-medium",children:[vr[ut]?.price_per_reservation??ho," ",R]})]}),fa>0&&c.jsxs("div",{className:"flex justify-between text-sm text-green-600",children:[c.jsx("span",{children:"Free credits:"}),c.jsxs("span",{className:"font-medium",children:[fa," reservations"]})]}),ut==="expert"&&kn.length>0&&c.jsxs("div",{className:"flex justify-between text-sm",children:[c.jsx("span",{className:"text-muted-foreground",children:"Expert modules:"}),c.jsx("span",{className:"font-medium text-right",children:kn.map(P=>z1.find(H=>H.key===P)?.name||h5[P]||P).join(", ")})]}),(()=>{const P=l.find(H=>H.tier_key===ut);return P&&P.minimum_reservations>0?c.jsxs("div",{className:"flex justify-between text-sm",children:[c.jsx("span",{className:"text-muted-foreground",children:"Min. reservations/month:"}),c.jsx("span",{className:"font-medium",children:P.minimum_reservations})]}):null})(),c.jsxs("div",{className:"pt-3 border-t space-y-2",children:[c.jsx("h4",{className:"font-semibold",children:"Onboarding Fees by Tier"}),Object.entries(vr).map(([P,H])=>{let ae=H.onboarding_fee;return wt>0&&(ae=Math.round(ae*(1-wt/100))),c.jsxs("div",{className:"flex justify-between text-sm",children:[c.jsxs("span",{className:"text-muted-foreground",children:[ma[P]?.name,":"]}),c.jsxs("span",{className:"font-medium",children:[ae," ",R]})]},P)})]})]}),c.jsxs(oe,{onClick:Us,disabled:h||!b,size:"lg",className:"w-full mt-6",children:[c.jsx(ex,{className:"mr-2 h-4 w-4"}
2),e?"Update Order":"Create Order & Generate Link"]})]})]})]}),g==="legacy"&&c.jsxs(c.Fragment,{children:[c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{children:"Configuration"})}),c.jsxs(be,{className:"space-y-4",children:[c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsxs(ne,{children:["Number of Units: ",E]}),c.jsx(Ei,{value:[E],onValueChange:P=>L(P[0]),min:1,max:100,step:1,className:"mt-2"})]}),c.jsxs("div",{children:[c.jsxs(ne,{className:"flex items-center gap-2",children:[c.jsx(Cu,{className:"h-4 w-4"}),"Currency"]}),c.jsxs(Ht,{value:R,onValueChange:I,children:[c.jsx(It,{className:"mt-2",children:c.jsx(Wt,{})}),c.jsxs($t,{children:[c.jsx(pe,{value:"CHF",children:"CHF"}),c.jsx(pe,{value:"EUR",children:"EUR"}),c.jsx(pe,{value:"GBP",children:"GBP"}),c.jsx(pe,{value:"USD",children:"USD"})]})]})]})]}),c.jsxs("div",{children:[c.jsxs(ne,{children:["Base Monthly Price (Auto-calculated: ",Q," ",R,")"]}),c.jsx(fe,{type:"number",value:re||0,onChange:P=>An(Number(P.target.value)),min:0,placeholder:String(Q),className:"mt-2"}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Price calculated using volume-based formula. Edit to override."})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsxs(ne,{children:["Discount: ",$,"%"]}),c.jsx(Ei,{value:[$],onValueChange:P=>A(P[0]),min:0,max:100,step:1,className:"mt-2"})]}),c.jsxs("div",{children:[c.jsxs(ne,{children:["Free Trial: ",te," months"]}),c.jsx(Ei,{value:[te],onValueChange:P=>B(P[0]),min:0,max:12,step:1,className:"mt-2"})]})]}),c.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[c.jsx(v0,{checked:F,onCheckedChange:V}),c.jsx(ne,{children:"Annual Billing (12% discount)"})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-4 border-t",children:[c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx(ne,{children:"Start Date"}),c.jsxs(Dn,{children:[c.jsx(Rn,{asChild:!0,children:c.jsxs(oe,{variant:"outline",className:le("justify-start text-left font-normal",!me&&"text-muted-foreground"),children:[c.jsx(oi,{className:"mr-2 h-4 w-4"}),me?Ue(me,"PPP"):c.jsx("span",{children:"Pick a date"})]})}),c.jsx(wn,{className:"w-auto p-0",align:"start",children:c.jsx(bn,{mode:"single",selected:me,onSelect:ge,initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx(ne,{children:"Estimated Go-Live Date"}),c.jsxs(Dn,{children:[c.jsx(Rn,{asChild:!0,children:c.jsxs(oe,{variant:"outline",className:le("justify-start text-left font-normal",!Ee&&"text-muted-foreground"),children:[c.jsx(oi,{className:"mr-2 h-4 w-4"}),Ee?Ue(Ee,"PPP"):c.jsx("span",{children:"Pick a date"})]})}),c.jsx(wn,{className:"w-auto p-0",align:"start",children:c.jsx(bn,{mode:"single",selected:Ee,onSelect:We,initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]})]}),c.jsx("div",{className:"grid grid-cols-2 gap-4 pt-4",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx(ne,{children:"Offer Validity Date"}),c.jsxs(Dn,{children:[c.jsx(Rn,{asChild:!0,children:c.jsxs(oe,{variant:"outline",className:le("justify-start text-left font-normal",!qe&&"text-muted-foreground"),children:[c.jsx(oi,{className:"mr-2 h-4 w-4"}),qe?Ue(qe,"PPP"):c.jsx("span",{children:"Pick a date"})]})}),c.jsx(wn,{className:"w-auto p-0",align:"start",children:c.jsx(bn,{mode:"single",selected:qe,onSelect:ar,initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]})})]})]}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{children:"Modules"})}),c.jsxs(be,{className:"space-y-4",children:[c.jsx("div",{className:"bg-muted/50 p-4 rounded-lg",children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("div",{className:"font-semibold",children:"Smartiz Foundational Modules"}),c.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:CL.map(P=>P.display_name).join(", ")})]}),c.jsx("div",{className:"text-sm font-medium text-green-600",children:"Always Included"})]})}),Jc.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"border-t pt-4",children:c.jsx("h4",{className:"font-medium mb-3",children:"Premium Add-ons"})}),c.jsx("div",{className:"grid grid-cols-2 gap-3",children:Jc.map(P=>{const H=G.includes(P.id);return c.jsxs("div",{onClick:()=>Je(P.id),className:`p-3 rounded-lg border-2 cursor-pointer transition-all ${H?"border-primary bg-primary/5 shadow-sm":"border-border hover:border-primary/50 hover:bg-muted/50"}`,children:[c.jsxs("div",{className:"flex items-start justify-between mb-2",children:[c.jsx("div",{className:"font-medium text-sm",children:P.display_name}),c.jsx("div",{className:`w-5 h-5 rounded-full border-2 flex items-center justify-center ${H?"border-primary bg-primary":"border-border"}`,children:H&&c.jsx("svg",{className:"w-3 h-3 text-primary-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})]}),c.jsx("div",{className:"text-xs text-muted-foreground mb-2",children:P.name}),c.jsxs("div",{className:"text-sm font-semibold",children:["+",P.base_price," ",R,"/month"]})]},P.id)})})]})]})]}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{children:"Onboarding Fees"})}),c.jsxs(be,{className:"space-y-4",children:[c.jsx("div",{className:"bg-muted/50 p-4 rounded-lg mb-4",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"Set a one-time onboarding fee for this client. Choose between per property or per category pricing, and adjust the quantity as needed."})}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsx(ne,{children:"Calculation Type"}),c.jsxs(Ht,{value:gr,onValueChange:P=>{Kr(P),ca(P==="per_unit"?E:1)},children:[c.jsx(It,{className:"mt-2",children:c.jsx(Wt,{})}),c.jsxs($t,{children:[c.jsxs(pe,{value:"per_unit",children:["Per ",y==="str"?"Property":"Unit"]}),c.jsx(pe,{value:"per_category",children:"Per Category"})]})]})]}),c.jsxs("div",{children:[c.jsx(ne,{children:"Quantity"}),c.jsx(fe,{type:"number",value:Ct,onChange:P=>ca(Math.max(1,Number(P.target.value))),min:1,className:"mt-2"}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:gr==="per_unit"?"Defaults to number of units":"Number of categories"})]})]}),c.jsxs("div",{children:[c.jsxs(ne,{children:["Base Price per ",gr==="per_unit"?y==="str"?"Property":"Unit":"Category"]}),c.jsx(fe,{type:"number",value:Oe,onChange:P=>ua(Number(P.target.value)),min:0,placeholder:"0",className:"mt-2"}),c.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Price per ",gr==="per_unit"?"unit":"category","
2(before discount)"]})]}),Oe>0&&Ct>0&&c.jsx("div",{className:"bg-muted/50 p-3 rounded-lg border",children:c.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[c.jsx("span",{children:"Subtotal:"}),c.jsxs("span",{children:[Oe," ",R," Ã ",Ct," = ",Oe*Ct," ",R]})]})}),c.jsxs("div",{children:[c.jsxs(ne,{children:["Onboarding Discount: ",wt,"%"]}),c.jsx(Ei,{value:[wt],onValueChange:P=>da(P[0]),min:0,max:100,step:1,className:"mt-2"})]}),Oe>0&&Ct>0&&c.jsxs("div",{className:"bg-primary/10 p-4 rounded-lg border border-primary/20",children:[c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsx("span",{className:"font-semibold",children:"Onboarding Fee (One-time):"}),c.jsxs("span",{className:"text-xl font-bold",children:[Mt," ",R]})]}),wt>0&&c.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Original: ",Oe*Ct," ",R," (",wt,"% discount applied)"]})]}),c.jsxs("div",{children:[c.jsx(ne,{children:"Onboarding Notes (Optional)"}),c.jsx(zn,{placeholder:"Add any specific notes about onboarding...",value:uo,onChange:P=>fo(P.target.value),className:"mt-2",rows:3})]})]})]}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{children:"Final Price"})}),c.jsxs(be,{children:[te>0&&c.jsx("div",{className:"mb-6 p-4 bg-gradient-to-r from-green-50 to-emerald-50 dark:from-green-950 dark:to-emerald-950 border-2 border-green-500 rounded-lg",children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{className:"bg-green-500 text-white rounded-full p-2 mt-1",children:c.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),c.jsxs("div",{className:"flex-1",children:[c.jsxs("h3",{className:"font-bold text-lg text-green-700 dark:text-green-300 mb-2",children:["ð ",te," Month",te>1?"s":""," FREE Trial - No Strings Attached!"]}),c.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Start using Smartiz immediately at zero cost. After the trial, you'll pay the indicated price below or any lower future price - whichever is best for you. Cancel anytime during the trial with no obligation."}),c.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded p-3 border border-green-200 dark:border-green-800",children:[c.jsx("div",{className:"text-sm font-semibold text-green-700 dark:text-green-300 mb-1",children:"Indicative pricing after trial:"}),c.jsxs("div",{className:"flex items-baseline gap-2",children:[($>0||F)&&c.jsxs("span",{className:"text-lg line-through text-muted-foreground",children:[(re||Q)*E+G.reduce((P,H)=>{const ae=i.find(xe=>xe.id===H);return P+(ae&&!ae.is_included_in_base?ae.base_price:0)},0)," ",R]}),c.jsxs("span",{className:"text-2xl font-bold text-green-700 dark:text-green-300",children:[Y," ",R,"/month"]}),X>0&&c.jsxs("span",{className:"text-sm font-semibold text-green-600 dark:text-green-400",children:[X,"% OFF"]})]})]})]})]})}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex justify-between text-sm",children:[c.jsx("span",{className:"text-muted-foreground",children:"Base price (per unit per month):"}),c.jsxs("span",{className:"font-medium",children:[re||Q," ",R]})]}),c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{children:"Total base price (per month):"}),c.jsxs("div",{className:"text-right",children:[c.jsxs("div",{className:"font-medium",children:[(re||Q)*E," ",R]}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[re||Q," ",R," Ã ",E," ",E===1?y==="str"?"property":"room":y==="str"?"properties":"rooms"]})]})]}),G.filter(P=>{const H=i.find(ae=>ae.id===P);return H&&!H.is_included_in_base}).length>0&&c.jsxs("div",{className:"space-y-1",children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{children:"Modules (per month):"}),c.jsxs("span",{className:"font-medium",children:[G.reduce((P,H)=>{const ae=i.find(xe=>xe.id===H);return P+(ae&&!ae.is_included_in_base?ae.base_price:0)},0)," ",R]})]}),c.jsx("div",{className:"pl-4 space-y-1",children:G.map(P=>{const H=i.find(ae=>ae.id===P);return H&&!H.is_included_in_base?c.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[c.jsx("span",{children:H.display_name}),c.jsxs("span",{children:[H.base_price," ",R]})]},P):null})})]}),X>0&&c.jsxs("div",{className:"flex justify-between border-t pt-2",children:[c.jsx("span",{className:"text-muted-foreground",children:"Subtotal (before discount):"}),c.jsxs("span",{className:"font-medium",children:[(re||Q)*E+G.reduce((P,H)=>{const ae=i.find(xe=>xe.id===H);return P+(ae&&!ae.is_included_in_base?ae.base_price:0)},0)," ",R]})]}),X>0&&c.jsxs("div",{className:"flex justify-between text-green-600",children:[c.jsxs("span",{children:["Discount (",X,"%):"]}),c.jsxs("span",{className:"font-medium",children:["-",(re||Q)*E+G.reduce((P,H)=>{const ae=i.find(xe=>xe.id===H);return P+(ae&&!ae.is_included_in_base?ae.base_price:0)},0)-Y," ",R]})]}),c.jsxs("div",{className:"flex justify-between text-2xl font-bold border-t pt-3",children:[c.jsx("span",{children:"Total (per month):"}),c.jsxs("span",{children:[Y," ",R]})]}),F&&c.jsxs("div",{className:"flex justify-between text-lg font-semibold text-green-600 border-t pt-2",children:[c.jsx("span",{children:"Yearly Total:"}),c.jsxs("span",{children:[Y*12," ",R]})]})]}),Oe>0&&Ct>0&&c.jsxs("div",{className:"mt-6 pt-6 border-t-2 space-y-3",children:[c.jsx("h3",{className:"font-semibold text-lg",children:"One-Time Fees"}),c.jsxs("div",{className:"flex justify-between items-center bg-primary/10 p-4 rounded-lg border border-primary/20",children:[c.jsxs("div",{children:[c.jsx("div",{className:"font-semibold",children:"Onboarding Fee"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"Paid once at service initiation"})]}),c.jsxs("div",{className:"text-xl font-bold",children:[Mt," ",R]})]}),wt>0&&c.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["Original: ",Oe*Ct," ",R," (",wt,"% discount applied)"]})]}),c.jsxs(oe,{onClick:Us,disabled:h||!b,size:"lg",className:"w-full mt-6",children:[c.jsx(ex,{className:"mr-2 h-4 w-4"}
vendor: 11,028 bytes, line 2
2),e?"Update Order":"Create Order & Generate Link"]})]})]})]})]})};var U1=1,m5=.9,g5=.8,v5=.17,xp=.1,bp=.999,y5=.9999,x5=.99,b5=/[\\\/_+.#"@\[\(\{&]/,w5=/[\\\/_+.#"@\[\(\{&]/g,_5=/[\s-]/,vT=/[\s-]/g;function cx(t,e,r,n,i,a,o){if(a===e.length)return i===t.length?U1:x5;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var l=n.charAt(a),u=r.indexOf(l,i),d=0,f,h,p,m;u>=0;)f=cx(t,e,r,n,u+1,a+1,o),f>d&&(u===i?f*=U1:b5.test(t.charAt(u-1))?(f*=g5,p=t.slice(i,u-1).match(w5),p&&i>0&&(f*=Math.pow(bp,p.length))):_5.test(t.charAt(u-1))?(f*=m5,m=t.slice(i,u-1).match(vT),m&&i>0&&(f*=Math.pow(bp,m.length))):(f*=v5,i>0&&(f*=Math.pow(bp,u-i))),t.charAt(u)!==e.charAt(a)&&(f*=y5)),(f<xp&&r.charAt(u-1)===n.charAt(a+1)||n.charAt(a+1)===n.charAt(a)&&r.charAt(u-1)!==n.charAt(a))&&(h=cx(t,e,r,n,u+1,a+2,o),h*xp>f&&(f=h*xp)),f>d&&(d=f),u=r.indexOf(l,u+1);return o[s]=d,d}function H1(t){return t.toLowerCase().replace(vT," ")}function S5(t,e,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,cx(t,e,H1(t),H1(e),0,0,{})}var Ws='[cmdk-group=""]',wp='[cmdk-group-items=""]',j5='[cmdk-group-heading=""]',yT='[cmdk-item=""]',W1=`${yT}:not([aria-disabled="true"])`,ux="cmdk-item-select",So="data-value",O5=(t,e,r)=>S5(t,e,r),xT=x.createContext(void 0),Pc=()=>x.useContext(xT),bT=x.createContext(void 0),$0=()=>x.useContext(bT),wT=x.createContext(void 0),_T=x.forwardRef((t,e)=>{let r=jo(()=>{var B,G;return{search:"",value:(G=(B=t.value)!=null?B:t.defaultValue)!=null?G:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=jo(()=>new Set),i=jo(()=>new Map),a=jo(()=>new Map),o=jo(()=>new Set),s=ST(t),{label:l,children:u,value:d,onValueChange:f,filter:h,shouldFilter:p,loop:m,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=t,w=jn(),_=jn(),j=jn(),b=x.useRef(null),O=I5();Wa(()=>{if(d!==void 0){let B=d.trim();r.current.value=B,S.emit()}},[d]),Wa(()=>{O(6,E)},[]);let S=x.useMemo(()=>({subscribe:B=>(o.current.add(B),()=>o.current.delete(B)),snapshot:()=>r.current,setState:(B,G,se)=>{var Q,ye,re,ue;if(!Object.is(r.current[B],G)){if(r.current[B]=G,B==="search")M(),T(),O(1,k);else if(B==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Y=document.getElementById(j);Y?Y.focus():(Q=document.getElementById(w))==null||Q.focus()}if(O(7,()=>{var Y;r.current.selectedItemId=(Y=L())==null?void 0:Y.id,S.emit()}),se||O(5,E),((ye=s.current)==null?void 0:ye.value)!==void 0){let Y=G??"";(ue=(re=s.current).onValueChange)==null||ue.call(re,Y);return}}S.emit()}},emit:()=>{o.current.forEach(B=>B())}}),[]),N=x.useMemo(()=>({value:(B,G,se)=>{var Q;G!==((Q=a.current.get(B))==null?void 0:Q.value)&&(a.current.set(B,{value:G,keywords:se}),r.current.filtered.items.set(B,C(G,se)),O(2,()=>{T(),S.emit()}))},item:(B,G)=>(n.current.add(B),G&&(i.current.has(G)?i.current.get(G).add(B):i.current.set(G,new Set([B]))),O(3,()=>{M(),T(),r.current.value||k(),S.emit()}),()=>{a.current.delete(B),n.current.delete(B),r.current.filtered.items.delete(B);let se=L();O(4,()=>{M(),se?.getAttribute("id")===B&&k(),S.emit()})}),group:B=>(i.current.has(B)||i.current.set(B,new Set),()=>{a.current.delete(B),i.current.delete(B)}),filter:()=>s.current.shouldFilter,label:l||t["aria-label"],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:w,inputId:j,labelId:_,listInnerRef:b}),[]);function C(B,G){var se,Q;let ye=(Q=(se=s.current)==null?void 0:se.filter)!=null?Q:O5;return B?ye(B,r.current.search,G):0}function T(){if(!r.current.search||s.current.shouldFilter===!1)return;let B=r.current.filtered.items,G=[];r.current.filtered.groups.forEach(Q=>{let ye=i.current.get(Q),re=0;ye.forEach(ue=>{let Y=B.get(ue);re=Math.max(Y,re)}),G.push([Q,re])});let se=b.current;R().sort((Q,ye)=>{var re,ue;let Y=Q.getAttribute("id"),z=ye.getAttribute("id");return((re=B.get(z))!=null?re:0)-((ue=B.get(Y))!=null?ue:0)}).forEach(Q=>{let ye=Q.closest(wp);ye?ye.appendChild(Q.parentElement===ye?Q:Q.closest(`${wp} > *`)):se.appendChild(Q.parentElement===se?Q:Q.closest(`${wp} > *`))}),G.sort((Q,ye)=>ye[1]-Q[1]).forEach(Q=>{var ye;let re=(ye=b.current)==null?void 0:ye.querySelector(`${Ws}[${So}="${encodeURIComponent(Q[0])}"]`);re?.parentElement.appendChild(re)})}function k(){let B=R().find(se=>se.getAttribute("aria-disabled")!=="true"),G=B?.getAttribute(So);S.setState("value",G||void 0)}function M(){var B,G,se,Q;if(!r.current.search||s.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let ye=0;for(let re of n.current){let ue=(G=(B=a.current.get(re))==null?void 0:B.value)!=null?G:"",Y=(Q=(se=a.current.get(re))==null?void 0:se.keywords)!=null?Q:[],z=C(ue,Y);r.current.filtered.items.set(re,z),z>0&&ye++}for(let[re,ue]of i.current)for(let Y of ue)if(r.current.filtered.items.get(Y)>0){r.current.filtered.groups.add(re);break}r.current.filtered.count=ye}function E(){var B,G,se;let Q=L();Q&&(((B=Q.parentElement)==null?void 0:B.firstChild)===Q&&((se=(G=Q.closest(Ws))==null?void 0:G.querySelector(j5))==null||se.scrollIntoView({block:"nearest"})),Q.scrollIntoView({block:"nearest"}))}function L(){var B;return(B=b.current)==null?void 0:B.querySelector(`${yT}[aria-selected="true"]`)}function R(){var B;return Array.from(((B=b.current)==null?void 0:B.querySelectorAll(W1))||[])}function I(B){let G=R()[B];G&&S.setState("value",G.getAttribute(So))}function $(B){var G;let se=L(),Q=R(),ye=Q.findIndex(ue=>ue===se),re=Q[ye+B];(G=s.current)!=null&&G.loop&&(re=ye+B<0?Q[Q.length-1]:ye+B===Q.length?Q[0]:Q[ye+B]),re&&S.setState("value",re.getAttribute(So))}function A(B){let G=L(),se=G?.closest(Ws),Q;for(;se&&!Q;)se=B>0?D5(se,Ws):R5(se,Ws),Q=se?.querySelector(W1);Q?S.setState("value",Q.getAttribute(So)):$(B)}let F=()=>I(R().length-1),V=B=>{B.preventDefault(),B.metaKey?F():B.altKey?A(1):$(1)},te=B=>{B.preventDefault(),B.metaKey?I(0):B.altKey?A(-1):$(-1)};return x.createElement(Ve.div,{ref:e,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:B=>{var G;(G=y.onKeyDown)==null||G.call(y,B);let se=B.nativeEvent.isComposing||B.keyCode===229;if(!(B.defaultPrevented||se))switch(B.key){case"n":case"j":{v&&B.ctrlKey&&V(B);break}case"ArrowDown":{V(B);break}case"p":case"k":{v&&B.ctrlKey&&te(B);break}case"ArrowUp":{te(B);break}case"Home":{B.preventDefault(),I(0);break}case"End":{B.preventDefault(),F();break}case"Enter":{B.preventDefault();let Q=L();if(Q){let ye=new Event(ux);Q.dispatchEvent(ye)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:N.inputId,id:N.labelId,style:L5},l),eh(t,B=>x.createElement(bT.Provider,{value:S},x.createElement(xT.Provider,{value:N},B))))}),N5=x.forwardRef((t,e)=>{var r,n;let i=jn(),a=x.useRef(null),o=x.useContext(wT),s=Pc(),l=ST(t),u=(n=(r=l.current)==null?void 0:r.forceMount)!=null?n:o?.forceMount;Wa(()=>{if(!u)return s.item(i,o?.id)},[u]);let d=jT(i,a,[t.value,t.children,a],t.keywords),f=$0(),h=Xi(O=>O.value&&O.value===d.current),p=Xi(O=>u||s.filter()===!1?!0:O.search?O.filtered.items.get(i)>0:!0);x.useEffect(()=>{let O=a.current;if(!(!O||t.disabled))return O.addEventListener(ux,m),()=>O.removeEventListener(ux,m)},[p,t.onSelect,t.disabled]);function m(){var O,S;g(),(S=(O=l.current).onSelect)==null||S.call(O,d.current)}function g(){f.setState("value",d.current,!0)}if(!p)return null;let{disabled:v,value:y,onSelect:w,forceMount:_,keywords:j,...b}=t;return x.createElement(Ve.div,{ref:Uo(a,e),...b,id:i,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!h,"data-disabled":!!v,"data-selected":!!h,onPointerMove:v||s.getDisablePointerSelection()?void 0:g,onClick:v?void 0:m},t.children)}),C5=x.forwardRef((t,e)=>{let{heading:r,children:n,forceMount:i,...a}=t,o=jn(),s=x.useRef(null),l=x.useRef(null),u=jn(),d=Pc(),f=Xi(p=>i||d.filter()===!1?!0:p.search?p.filtered.groups.has(o):!0);Wa(()=>d.group(o),[]),jT(o,s,[t.value,t.heading,l]);let h=x.useMemo(()=>({id:o,forceMount:i}),[i]);return x.createElement(Ve.div,{ref:Uo(s,e),...a,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},r&&x.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:u},r),eh(t,p=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?u:void 0},x.createElement(wT.Provider,{value:h},p))))}),k5=x.forwardRef((t,e)=>{let{alwaysRender:r,...n}=t,i=x.useRef(null),a=Xi(o=>!o.search);return!r&&!a?null:x.createElement(Ve.div,{ref:Uo(i,e),...n,"cmdk-separator":"",role:"separator"})}),A5=x.forwardRef((t,e)=>{let{onValueChange:r,...n}=t,i=t.value!=null,a=$0(),o=Xi(u=>u.search),s=Xi(u=>u.selectedItemId),l=Pc();return x.useEffect(()=>{t.value!=null&&a.setState("search",t.value)},[t.value]),x.createElement(Ve.input,{ref:e,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":s,id:l.inputId,type:"text",value:i?t.value:o,onChange:u=>{i||a.setState("search",u.target.value),r?.(u.target.value)}})}),E5=x.forwardRef((t,e)=>{let{children:r,label:n="Suggestions",...i}=t,a=x.useRef(null),o=x.useRef(null),s=Xi(u=>u.selectedItemId),l=Pc();return x.useEffect(()=>{if(o.current&&a.current){let u=o.current,d=a.current,f,h=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let p=u.offsetHeight;d.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return h.observe(u),()=>{cancelAnimationFrame(f),h.unobserve(u)}}},[]),x.createElement(Ve.div,{ref:Uo(a,e),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":s,"aria-label":n,id:l.listId},eh(t,u=>x.createElement("div",{ref:Uo(o,l.listInnerRef),"cmdk-list-sizer":""},u)))}),P5=x.forwardRef((t,e)=>{let{open:r,onOpenChange:n,overlayClassName:i,contentClassName:a,container:o,...s}=t;return x.createElement(jE,{open:r,onOpenChange:n},x.createElement(OE,{container:o},x.createElement(NE,{"cmdk-overlay":"",className:i}),x.createElement(CE,{"aria-label":t.label,"cmdk-dialog":"",className:a},x.createElement(_T,{ref:e,...s}))))}),T5=x.forwardRef((t,e)=>Xi(r=>r.filtered.count===0)?x.createElement(Ve.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),M5=x.forwardRef((t,e)=>{let{progress:r,children:n,label:i="Loading...",...a}=t;return x.createElement(Ve.div,{ref:e,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},eh(t,o=>x.createElement("div",{"aria-hidden":!0},o)))}),Tr=Object.assign(_T,{List:E5,Item:N5,Input:A5,Group:C5,Separator:k5,Dialog:P5,Empty:T5,Loading:M5});function D5(t,e){let r=t.nextElementSibling;for(;r;){if(r.matches(e))return r;r=r.nextElementSibling}}function R5(t,e){let r=t.previousElementSibling;for(;r;){if(r.matches(e))return r;r=r.previousElementSibling}}function ST(t){let e=x.useRef(t);return Wa(()=>{e.current=t}),e}var Wa=typeof window>"u"?x.useEffect:x.useLayoutEffect;function jo(t){let e=x.useRef();return e.current===void 0&&(e.current=t()),e}function Xi(t){let e=$0(),r=()=>t(e.snapshot());return x.useSyncExternalStore(e.subscribe,r,r)}function jT(t,e,r,n=[]){let i=x.useRef(),a=Pc();return Wa(()=>{var o;let s=(()=>{var u;
2for(let d of r){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(u=d.current.textContent)==null?void 0:u.trim():i.current}})(),l=n.map(u=>u.trim());a.value(t,s,l),(o=e.current)==null||o.setAttribute(So,s),i.current=s}),i}var I5=()=>{let[t,e]=x.useState(),r=jo(()=>new Map);return Wa(()=>{r.current.forEach(n=>n()),r.current=new Map},[t]),(n,i)=>{r.current.set(n,i),e({})}};function $5(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function eh({asChild:t,children:e},r){return t&&x.isValidElement(e)?x.cloneElement($5(e),{ref:e.ref},r(e.props.children)):r(e)}var L5={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const OT=x.forwardRef(({className:t,...e},r)=>c.jsx(Tr,{ref:r,className:le("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));OT.displayName=Tr.displayName;const NT=x.forwardRef(({className:t,...e},r)=>c.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[c.jsx(BE,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),c.jsx(Tr.Input,{ref:r,className:le("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));NT.displayName=Tr.Input.displayName;const CT=x.forwardRef(({className:t,...e},r)=>c.jsx(Tr.List,{ref:r,className:le("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));CT.displayName=Tr.List.displayName;const kT=x.forwardRef((t,e)=>c.jsx(Tr.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));kT.displayName=Tr.Empty.displayName;const AT=x.forwardRef(({className:t,...e},r)=>c.jsx(Tr.Group,{ref:r,className:le("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...e}));AT.displayName=Tr.Group.displayName;const B5=x.forwardRef(({className:t,...e},r)=>c.jsx(Tr.Separator,{ref:r,className:le("-mx-1 h-px bg-border",t),...e}));B5.displayName=Tr.Separator.displayName;const ET=x.forwardRef(({className:t,...e},r)=>c.jsx(Tr.Item,{ref:r,className:le("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",t),...e}));ET.displayName=Tr.Item.displayName;const Vo=x.forwardRef(({className:t,...e},r)=>c.jsx("div",{className:"relative w-full overflow-auto",children:c.jsx("table",{ref:r,className:le("w-full caption-bottom text-sm",t),...e})}));Vo.displayName="Table";const Ko=x.forwardRef(({className:t,...e},r)=>c.jsx("thead",{ref:r,className:le("[&_tr]:border-b",t),...e}));Ko.displayName="TableHeader";const Go=x.forwardRef(({className:t,...e},r)=>c.jsx("tbody",{ref:r,className:le("[&_tr:last-child]:border-0",t),...e}));Go.displayName="TableBody";const F5=x.forwardRef(({className:t,...e},r)=>c.jsx("tfoot",{ref:r,className:le("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));F5.displayName="TableFooter";const an=x.forwardRef(({className:t,...e},r)=>c.jsx("tr",{ref:r,className:le("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",t),...e}));an.displayName="TableRow";const $e=x.forwardRef(({className:t,...e},r)=>c.jsx("th",{ref:r,className:le("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));$e.displayName="TableHead";const Re=x.forwardRef(({className:t,...e},r)=>c.jsx("td",{ref:r,className:le("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));Re.displayName="TableCell";const z5=x.forwardRef(({className:t,...e},r)=>c.jsx("caption",{ref:r,className:le("mt-4 text-sm text-muted-foreground",t),...e}));z5.displayName="TableCaption";var PT="AlertDialog",[q5]=no(PT,[kE]),ji=kE(),TT=t=>{const{__scopeAlertDialog:e,...r}=t,n=ji(e);return c.jsx(jE,{...n,...r,modal:!0})};TT.displayName=PT;var U5="AlertDialogTrigger",H5=x.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,i=ji(r);return c.jsx(qL,{...i,...n,ref:e})});H5.displayName=U5;var W5="AlertDialogPortal",MT=t=>{const{__scopeAlertDialog:e,...r}=t,n=ji(e);return c.jsx(OE,{...n,...r})};MT.displayName=W5;var V5="AlertDialogOverlay",DT=x.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,i=ji(r);return c.jsx(NE,{...i,...n,ref:e})});DT.displayName=V5;var Io="AlertDialogContent",[K5,G5]=q5(Io),Y5=zL("AlertDialogContent"),RT=x.forwardRef((t,e)=>{const{__scopeAlertDialog:r,children:n,...i}=t,a=ji(r),o=x.useRef(null),s=Nt(e,o),l=x.useRef(null);return c.jsx(LL,{contentName:Io,titleName:IT,docsSlug:"alert-dialog",children:c.jsx(K5,{scope:r,cancelRef:l,children:c.jsxs(CE,{role:"alertdialog",...a,...i,ref:s,onOpenAutoFocus:Ae(i.onOpenAutoFocus,u=>{u.preventDefault(),l.current?.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[c.jsx(Y5,{children:n}),c.jsx(J5,{contentRef:o})]})})})});RT.displayName=Io;var IT="AlertDialogTitle",$T=x.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,i=ji(r);return c.jsx(BL,{...i,...n,ref:e})});$T.displayName=IT;var LT="AlertDialogDescription",BT=x.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,i=ji(r);return c.jsx(FL,{...i,...n,ref:e})});BT.displayName=LT;var X5="AlertDialogAction",FT=x.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,i=ji(r);return c.jsx(AE,{...i,...n,ref:e})});FT.displayName=X5;var zT="AlertDialogCancel",qT=x.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,{cancelRef:i}=G5(zT,r),a=ji(r),o=Nt(e,i);return c.jsx(AE,{...a,...n,ref:o})});qT.displayName=zT;var J5=({contentRef:t})=>{const e=`\`${Io}\` requires a description for the component to be accessible for screen reader users. 3
4You can add a description to the \`${Io}\` by passing a \`${LT}\` component as a child, which also benefits sighted users by adding visible context to the dialog. 5 6Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Io}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. 7 8For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return x.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},Z5=TT,Q5=MT,UT=DT,HT=RT,WT=FT,VT=qT,KT=$T,GT=BT;const dx=Z5,ez=Q5,YT=x.forwardRef(({className:t,...e},r)=>c.jsx(UT,{className:le("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:r}));YT.displayName=UT.displayName;const Vu=x.forwardRef(({className:t,...e},r)=>c.jsxs(ez,{children:[c.jsx(YT,{}),c.jsx(HT,{ref:r,className:le("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));Vu.displayName=HT.displayName;const Ku=({className:t,...e})=>c.jsx("div",{className:le("flex flex-col space-y-2 text-center sm:text-left",t),...e});Ku.displayName="AlertDialogHeader";const Gu=({className:t,...e})=>c.jsx("div",{className:le("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Gu.displayName="AlertDialogFooter";const Yu=x.forwardRef(({className:t,...e},r)=>c.jsx(KT,{ref:r,className:le("text-lg font-semibold",t),...e}));Yu.displayName=KT.displayName;const Xu=x.forwardRef(({className:t,...e},r)=>c.jsx(GT,{ref:r,className:le("text-sm text-muted-foreground",t),...e}));Xu.displayName=GT.displayName;const Ju=x.forwardRef(({className:t,...e},r)=>c.jsx(WT,{ref:r,className:le(Bu(),t),...e}));Ju.displayName=WT.displayName;const Zu=x.forwardRef(({className:t,...e},r)=>c.jsx(VT,{ref:r,className:le(Bu({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));Zu.displayName=VT.displayName;const _p={en:{order_confirmation:"Order Confirmation",order_id:"Order ID",signed_on:"Signed on",at:"at",client_information:"Client Information",company:"Company",contact_person:"Contact Person",email:"Email",phone:"Phone",service_details:"Service Details",business_type:"Business Type",number_of_units:"Number of Units",indicative_properties:"Indicative Properties",indicative_annual_reservations:"Indicative Annual Reservations",start_date:"Start Date",estimated_golive:"Estimated Go-Live",notes:"Notes",subscription_details:"Subscription Details",selected_tier:"Selected Tier",upgraded_from:"Upgraded from",expert_modules:"Expert Modules",no_modules_selected:"No modules selected",engagement_period:"Engagement Period",monthly_invoices:"Monthly invoices in arrear",agreement_duration:"Agreement duration: {months} months",no_minimum_commitment:"No minimum commitment",pricing_summary:"Pricing Summary **",base_price_per_reservation:"Base price per reservation",commitment_discount:"Commitment discount",tariff_per_reservation:"Tariff per reservation",free_reservations_included:"Free reservations included",footnote_billing:"** Billing is per reservation, with a minimum of {min} reservations invoiced per month.",footnote_cancel_free:"Reservation cancelled within 72 hours of confirmation: no Smartiz charge applies.",footnote_cancel_after:"Cancellations made after the 72-hour grace period: 20% of the standard reservation tariff will be charged.",footnote_vat:"All prices are exclusive of applicable VAT.",onboarding_fee:"Onboarding Fee",base_onboarding_fee:"Base onboarding fee",onboarding_discount:"Onboarding discount",one_time_fee:"One-time fee paid at service initiation",included_features:"Included Features",foundational_modules:"Foundational Modules",included:"Included",addon_modules:"Add-on Modules",month:"month",signature:"Signature",signed_by:"Signed by",digital_signature:"Digital Signature",digitally_signed_on:"Digitally signed on",footer_official:"This is an official order
8confirmation from Smartiz",footer_contact:"For any questions, please contact your account manager",onboarding_fees:"Onboarding Fees",calculation_type:"Calculation Type",per_unit:"Per",per_category:"Per Category",property:"Property",unit:"Unit",base_price:"Base Price",recurring_monthly:"Recurring Monthly Fees",base_price_per_unit:"Base price (per unit per month)",total_base_price:"Total base price (per month)",modules_per_month:"Modules (per month)",subtotal:"Subtotal (before discounts)",discount:"Discount",annual_billing_discount:"Annual Billing Discount (12%)",additional_12:"Additional 12% on discounted price",free_trial_period:"Free Trial Period",months:"months",total_per_month:"Total (per month)",yearly_total:"Yearly Total",one_time_fees:"One-Time Fees",paid_once:"Paid once at service initiation",vat_note:"* All prices are exclusive of applicable VAT",commitment_0:"No commitment",commitment_12:"12-month contract",commitment_24:"24-month contract",deposit_management:"Deposit Management (Stripe or Swikly)",upselling:"Upselling",owner_management:"Owner Management",crm:"Client Relationship Management",igloohome_keybox:"igloohome Keybox Integration",monthly_addons:"Recurring monthly add-ons",monthly_subtotal:"Monthly subtotal"},fr:{order_confirmation:"Confirmation de commande",order_id:"N° de commande",signed_on:"Signé le",at:"à ",client_information:"Informations client",company:"Entreprise",contact_person:"Personne de contact",email:"E-mail",phone:"Téléphone",service_details:"Détails du service",business_type:"Type d'activité",number_of_units:"Nombre d'unités",indicative_properties:"Propriétés indicatives",indicative_annual_reservations:"Réservations annuelles indicatives",start_date:"Date de début",estimated_golive:"Mise en service estimée",notes:"Notes",subscription_details:"Détails de l'abonnement",selected_tier:"Offre sélectionnée",upgraded_from:"Surclassé depuis",expert_modules:"Modules Expert",no_modules_selected:"Aucun module sélectionné",engagement_period:"Période d'engagement",monthly_invoices:"Facturation mensuelle à terme échu",agreement_duration:"Durée d'engagement : {months} mois",no_minimum_commitment:"Sans engagement minimum",pricing_summary:"Résumé tarifaire **",base_price_per_reservation:"Tarif de base par réservation",commitment_discount:"Remise d'engagement",tariff_per_reservation:"Tarif par réservation",free_reservations_included:"Réservations offertes",footnote_billing:"** Facturation à la réservation, avec un minimum de {min} réservations facturées par mois.",footnote_cancel_free:"Réservation annulée dans les 72 heures suivant la confirmation : aucun frais Smartiz ne s'applique.",footnote_cancel_after:"Annulations effectuées après le délai de grâce de 72 heures : 20% du tarif standard de réservation sera facturé.",footnote_vat:"Tous les prix sont hors TVA applicable.",onboarding_fee:"Frais de mise en service",base_onboarding_fee:"Frais de mise en service de base",onboarding_discount:"Remise mise en service",one_time_fee:"Frais unique payé au démarrage du service",included_features:"Fonctionnalités incluses",foundational_modules:"Modules de base",included:"Inclus",addon_modules:"Modules complémentaires",month:"mois",signature:"Signature",signed_by:"Signé par",digital_signature:"Signature numérique",digitally_signed_on:"Signé numériquement le",footer_official:"Ceci est une confirmation officielle de commande de Smartiz",footer_contact:"Pour toute question, veuillez contacter votre chargé de compte",onboarding_fees:"Frais de mise en service",calculation_type:"Type de calcul",per_unit:"Par",per_category:"Par catégorie",property:"Propriété",unit:"Unité",base_price:"Prix de base",recurring_monthly:"Frais mensuels récurrents",base_price_per_unit:"Prix de base (par unité par mois)",total_base_price:"Prix de base total (par mois)",modules_per_month:"Modules (par mois)",subtotal:"Sous-total (avant remises)",discount:"Remise",annual_billing_discount:"Remise facturation annuelle (12%)",additional_12:"12% supplémentaire sur le prix remisé",free_trial_period:"Période d'essai gratuite",months:"mois",total_per_month:"Total (par mois)",yearly_total:"Total annuel",one_time_fees:"Frais uniques",paid_once:"Payé une fois au démarrage du service",vat_note:"* Tous les prix sont hors TVA applicable",commitment_0:"Sans engagement",commitment_12:"Contrat 12 mois",commitment_24:"Contrat 24 mois",deposit_management:"Gestion des cautions (Stripe ou Swikly)",upselling:"Upselling",owner_management:"Gestion des propriétaires",crm:"Gestion de la relation client",igloohome_keybox:"Intégration Keybox igloohome",monthly_addons:"Options mensuelles récurrentes",monthly_subtotal:"Sous-total mensuel"},de:{order_confirmation:"Auftragsbestätigung",order_id:"Auftrags-Nr.",signed_on:"Unterzeichnet am",at:"um",client_information:"Kundeninformationen",company:"Unternehmen",contact_person:"Ansprechpartner",email:"E-Mail",phone:"Telefon",service_details:"Servicedetails",business_type:"Geschäftsart",number_of_units:"Anzahl Einheiten",indicative_properties:"Indikative Objekte",indicative_annual_reservations:"Indikative jährliche Reservierungen",start_date:"Startdatum",estimated_golive:"Geschätzter Go-Live",n
8otes:"Notizen",subscription_details:"Abonnementdetails",selected_tier:"Gewähltes Paket",upgraded_from:"Upgrade von",expert_modules:"Expert-Module",no_modules_selected:"Keine Module ausgewählt",engagement_period:"Vertragslaufzeit",monthly_invoices:"Monatliche Rechnungsstellung im Nachhinein",agreement_duration:"Vertragslaufzeit: {months} Monate",no_minimum_commitment:"Keine Mindestvertragslaufzeit",pricing_summary:"Preisübersicht **",base_price_per_reservation:"Grundpreis pro Reservierung",commitment_discount:"Vertragslaufzeit-Rabatt",tariff_per_reservation:"Tarif pro Reservierung",free_reservations_included:"Kostenlose Reservierungen inklusive",footnote_billing:"** Abrechnung pro Reservierung, mit mindestens {min} Reservierungen pro Monat.",footnote_cancel_free:"Reservierung innerhalb von 72 Stunden nach Bestätigung storniert: keine Smartiz-Gebühr.",footnote_cancel_after:"Stornierungen nach der 72-Stunden-Frist: 20% des Standard-Reservierungstarifs werden berechnet.",footnote_vat:"Alle Preise verstehen sich exkl. MwSt.",onboarding_fee:"Einrichtungsgebühr",base_onboarding_fee:"Basis-Einrichtungsgebühr",onboarding_discount:"Einrichtungsrabatt",one_time_fee:"Einmalige Gebühr bei Servicebeginn",included_features:"Enthaltene Funktionen",foundational_modules:"Basismodule",included:"Inklusive",addon_modules:"Zusatzmodule",month:"Monat",signature:"Unterschrift",signed_by:"Unterschrieben von",digital_signature:"Digitale Unterschrift",digitally_signed_on:"Digital unterzeichnet am",footer_official:"Dies ist eine offizielle Auftragsbestätigung von Smartiz",footer_contact:"Bei Fragen wenden Sie sich bitte an Ihren Account Manager",onboarding_fees:"Einrichtungsgebühren",calculation_type:"Berechnungsart",per_unit:"Pro",per_category:"Pro Kategorie",property:"Objekt",unit:"Einheit",base_price:"Grundpreis",recurring_monthly:"Laufende monatliche Gebühren",base_price_per_unit:"Grundpreis (pro Einheit pro Monat)",total_base_price:"Gesamtgrundpreis (pro Monat)",modules_per_month:"Module (pro Monat)",subtotal:"Zwischensumme (vor Rabatten)",discount:"Rabatt",annual_billing_discount:"Jahresrechnungsrabatt (12%)",additional_12:"Zusätzlich 12% auf den reduzierten Preis",free_trial_period:"Kostenlose Testphase",months:"Monate",total_per_month:"Gesamt (pro Monat)",yearly_total:"Jahresgesamt",one_time_fees:"Einmalige Gebühren",paid_once:"Einmalig bei Servicebeginn bezahlt",vat_note:"* Alle Preise verstehen sich exkl. MwSt.",commitment_0:"Ohne Vertragsbindung",commitment_12:"12-Monats-Vertrag",commitment_24:"24-Monats-Vertrag",deposit_management:"Kautionsverwaltung (Stripe oder Swikly)",upselling:"Upselling",owner_management:"Eigentümerverwaltung",crm:"Kundenbeziehungsmanagement",igloohome_keybox:"igloohome Keybox-Integration",monthly_addons:"Wiederkehrende monatliche Add-ons",monthly_subtotal:"Monatliche Zwischensumme"},it:{order_confirmation:"Conferma d'ordine",order_id:"N° ordine",signed_on:"Firmato il",at:"alle",client_information:"Informazioni cliente",company:"Azienda",contact_person:"Persona di contatto",email:"E-mail",phone:"Telefono",service_details:"Dettagli del servizio",business_type:"Tipo di attività ",number_of_units:"Numero di unità ",indicative_properties:"Proprietà indicative",indicative_annual_reservations:"Prenotazioni annuali indicative",start_date:"Data di inizio",estimated_golive:"Go-Live stimato",notes:"Note",subscription_details:"Dettagli abbonamento",selected_tier:"Offerta selezionata",upgraded_from:"Upgrade da",expert_modules:"Moduli Expert",no_modules_selected:"Nessun modulo selezionato",engagement_period:"Periodo di impegno",monthly_invoices:"Fatturazione mensile posticipata",agreement_duration:"Durata dell'impegno: {months} mesi",no_minimum_commitment:"Senza impegno minimo",pricing_summary:"Riepilogo tariffario **",base_price_per_reservation:"Tariffa base per prenotazione",commitment_discount:"Sconto impegno",tariff_per_reservation:"Tariffa per prenotazione",free_reservations_included:"Prenotazioni gratuite incluse",footnote_billing:"** Fatturazione per prenotazione, con un minimo di {min} prenotazioni fatturate al mese.",footnote_cancel_free:"Prenotazione annullata entro 72 ore dalla conferma: nessun costo Smartiz.",footnote_cancel_after:"Cancellazioni dopo il periodo di grazia di 72 ore: verrà addebitato il 20% della tariffa standard.",footnote_vat:"Tutti i prezzi sono IVA esclusa.",onboarding_fee:"Costo di attivazione",base_onboarding_fee:"Costo base di attivazione",onboarding_discount:"Sconto attivazione",one_time_fee:"Costo una tantum all'avvio del servizio",included_features:"Funzionalità incluse",foundational_modules:"Moduli base",included:"Incluso",addon_modules:"Moduli aggiuntivi",month:"mese",signature:"Firma",signed_by:"Firmato da",digital_signature:"Firma digitale",digitally_signed_on:"Firmato digitalmente il",footer_official:"Questa è una conferma ufficiale d'ordine di Smartiz",footer_contact:"Per qualsiasi domanda, contattare il proprio account manager",onboarding_fees:"Costi di attivazione",calculation_type:"Tipo di calcolo",per_unit:"Per",per_category:"Per categoria",property:"Proprietà ",unit:"Unità ",base_price:"Prezzo base",recurring_monthly:"Canoni mensili ricorrenti",base_price_per_unit:"Prezzo base (per unità al mese)",total_base_price:"Prezzo base totale (al mese)",modules_per_month:"Moduli (al mese)",subtotal:"Subtotale (prima degli sconti)",discount:"Sconto",annual_billing_discount:"Sconto fatturazione annuale (12%)",additional_12:"12% aggiuntivo sul prezzo scontato",free_trial_period:"Periodo di prova gratuito",months:"mesi",total_per_month:"Totale (al mese)",yearly_total:"Totale annuale",one_time_fees:"Costi una tantum",paid_once:"Pagato una volta all'avvio del servizio",vat_note:"* Tutti i prezzi sono IVA esclusa",commitment_0:"Senza impegno",commitment_12:"Contratto 12 mesi",commitment_24:"Contratto 24 mesi",deposit_management:"Gestione delle c
8auzioni (Stripe o Swikly)",upselling:"Upselling",owner_management:"Gestione proprietari",crm:"Gestione relazioni clienti",igloohome_keybox:"Integrazione Keybox igloohome",monthly_addons:"Componenti aggiuntivi mensili ricorrenti",monthly_subtotal:"Subtotale mensile"}},tz=t=>{const e=_p[t]||_p.en;return(r,n)=>{let i=e[r]||_p.en[r]||r;return n&&Object.entries(n).forEach(([a,o])=>{i=i.replace(`{${a}}`,String(o))}),i}},ko={essential:{name:"Essential",color:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200"},advanced:{name:"Advanced",color:"bg-primary/10 text-primary"},expert:{name:"Expert",color:"bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200"}},V1=["essential","advanced","expert"],rz=({orderId:t})=>{const[e,r]=x.useState(null),[n,i]=x.useState([]),[a,o]=x.useState(!0),[s,l]=x.useState(!1),[u,d]=x.useState("en"),f=x.useRef(null);x.useEffect(()=>{h()},[t]);const h=async()=>{try{const{data:j,error:b}=await Z.from("orders").select("*, clients(*)").eq("id",t).maybeSingle();if(b)throw b;if(!j){r(null);return}const{data:O,error:S}=await Z.from("pricing_modules").select("*").eq("currency",j.currency);if(S)throw S;r(j),i(O||[])}catch(j){console.error("Error loading order:",j)}finally{o(!1)}},p=async()=>{if(!f.current||!e)return;const j=e.language||"en",b=u;d(j),l(!0);try{await new Promise(O=>setTimeout(O,100)),window.print()}catch(O){console.error("Error generating PDF:",O)}finally{d(b),l(!1)}};if(a)return c.jsx("div",{className:"flex items-center justify-center py-12",children:c.jsx(tt,{className:"h-8 w-8 animate-spin"})});if(!e)return c.jsx("div",{className:"text-center py-8",children:"Order not found"});const m=tz(u),g=e.language||"en",v=e.pricing_model==="per_reservation",y=n.filter(j=>e.selected_modules?.includes(j.id)),w=n.filter(j=>j.is_included_in_base),_=y.filter(j=>!j.is_included_in_base);return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex justify-between items-center",children:[g!=="en"&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Jy,{className:"h-4 w-4 text-muted-foreground"}),c.jsxs("div",{className:"flex rounded-md border overflow-hidden text-sm",children:[c.jsx("button",{onClick:()=>d("en"),className:`px-3 py-1 transition-colors ${u==="en"?"bg-primary text-primary-foreground":"bg-background hover:bg-muted"}`,children:"EN"}),c.jsx("button",{onClick:()=>d(g),className:`px-3 py-1 transition-colors ${u===g?"bg-primary text-primary-foreground":"bg-background hover:bg-muted"}`,children:g.toUpperCase()})]})]}),g==="en"&&c.jsx("div",{}),c.jsx(oe,{onClick:p,disabled:s,className:"gap-2",children:s?c.jsxs(c.Fragment,{children:[c.jsx(tt,{className:"h-4 w-4 animate-spin"}),"Generating PDF..."]}):c.jsxs(c.Fragment,{children:[c.jsx(Oc,{className:"h-4 w-4"}),"Download PDF"]})})]}),c.jsxs("div",{ref:f,className:"max-w-4xl mx-auto bg-background p-8 space-y-6",children:[c.jsxs("div",{className:"text-center space-y-2 pb-6 border-b",children:[c.jsx("h1",{className:"text-3xl font-bold",children:m("order_confirmation")}),c.jsxs("p",{className:"text-muted-foreground",children:[m("order_id"),": ",e.id.slice(0,8)]}),e.signed_at&&c.jsxs("p",{className:"text-sm text-muted-foreground",children:[m("signed_on")," ",Ue(new Date(e.signed_at),"PPP")," ",m("at")," ",Ue(new Date(e.signed_at),"p")]})]}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx("h2",{className:"text-xl font-semibold",children:m("client_information")})}),c.jsxs(be,{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:m("company")}),c.jsx("p",{className:"font-medium",children:e.clients.company_name})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:m("contact_person")}),c.jsxs("p",{className:"font-medium",children:[e.clients.first_name," ",e.clients.last_name]})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:m("email")}),c.jsx("p",{className:"font-medium",children:e.clients.email})]}),e.clients.phone&&c.jsxs("div",{children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:m("phone")}),c.jsx("p",{className:"font-medium",children:e.clients.phone})]})]})]}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx("h2",{className:"text-xl font-semibold",children:m("service_details")})}),c.jsxs(be,{className:"space-y-4",children:[c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:m("business_type")}),c.jsx("p",{className:"font-medium uppercase",children:e.business_type})]}),!v&&c.jsxs("div",{children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:m("number_of_units")}),c.jsx("p",{className:"font-medium",children:e.units})]}),v&&e.indicative_units!=null&&e.indicative_units>0&&c.jsxs("div",{children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:m("indicative_properties")}),c.jsx("p",{className:"font-medium",children:e.indicative_units})]}),v&&e.indicative_annual_reservations!=null&&e.indicative_annual_reservations>0&&c.jsxs("div",{children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:m("indicative_annual_reservations")}),c.jsx("p",{className:"font-medium",children:e.indicative_annual_reservations})]}),e.start_date&&c.jsxs("div",{children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:m("start_date")}),c.jsx("p",{className:"font-medium",children:Ue(new Date(e.start_date),"PPP")})]}),e.estimated_golive_date&&c.jsxs("div",{children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:m("estimated_golive")}),c.jsx("p",{className:"font-medium",children:Ue(new Date(e.estimated_golive_date),"PPP")})]})]}),e.notes&&e.notes.trim()&&c.jsxs("div",{className:"pt-4 border-t",children:[c.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:m("notes")}),c.jsx("p",{className:"text-sm whitespace-pre-wrap",children:e.notes})]})]})]}),v&&c.jsx(nz,{order:e,t:m}),!v&&c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx("h2",{className:"text-xl font-semibold",children:m("included_features")})}),c.jsxs(be,{className:"space-y-6",children:[c.jsxs("div",{children:[c.jsxs("h3",{className:"font-semibold mb-3 flex items-center gap-2",children:[m("foundational_modules"),c.jsx(Ye,{variant:"secondary",children:m("included")})]}),c.jsx("div",{className:"space-y-2",children:w.map(j=>c.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[c.jsx("span",{className:"text-primary mt-0.5",children:"â"}),c.jsxs("div",{children:[c.jsx("p",{className:"font-medium",children:j.display_name}),j.description&&c.jsx("p",{className:"text-muted-foreground text-xs",children:j.description})]})]},j.id))})]}),_.length>0&&c.jsxs("div",{className:"pt-4 border-t",children:[c.jsx("h3",{className:"font-semibold mb-3",children:m("addon_modules")}),c.jsx("div",{className:"space-y-2",children:_.map(j=>c.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[c.jsx("span",{className:"text-primary mt-0.5",children:"â"}),c.jsxs("div",{className:"flex-1",children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsx("p",{className:"font-medium",children:j.display_name}),c.jsxs("p",{className:"text-muted-foreground",children:["+",j.base_price," ",e.currency,"/",m("month")]})]}),j.description&&c.jsx("p",{className:"text-muted-foreground text-xs",children:j.description})]})]},j.id))})]})]})]}),v?c.jsx(az,{order:e,t:m}):e.onboarding_base_price!=null&&e.onboarding_base_price>0&&e.onboarding_quantity!=null&&e.onboarding_quantity>0&&c.jsx(oz,{order:e,t:m}),v?c.jsx(iz,{order:e,modules:n,t:m,viewLanguage:u}):c.jsx(sz,{order:e,addonModules:_,t:m}),e.signature_data&&c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx("h2",{className:"text-xl font-semibold",children:m("signature")})}),c.jsxs(be,{className:"space-y-4",children:[c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:m("signed_by")}),c.jsx("p",{className:"font-medium",children:e.signed_by_name})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:m("email")}),c.jsx("p",{className:"font-medium",children:e.signed_by_email})]})]}),c.jsxs("div",{className:"border rounded-lg p-4 bg-muted/30",children:[c.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:m("digital_signature")}),c.jsx("div",{className:"bg-background rounded border",children:c.jsx("img",{src:e.signature_data,alt:"Signature",className:"max-h-32 mx-auto"})})]}),e.signed_at&&c.jsxs("div",{className:"text-center text-sm text-muted-foreground pt-2",children:[m("digitally_signed_on")," ",Ue(new Date(e.signed_at),"PPPpp")]})]})]}),c.jsxs("div",{className:"text-center text-sm text-muted-foreground pt-6 border-t",children:[c.jsx("p",{children:m("footer_official")}),c.jsx("p",{className:"mt-1",children:m("footer_contact")})]})]})]})},nz=({order:t,t:e})=>{const r=t.selected_tier||t.tier_key||"essential",n=t.tier_key||"essential",i=r!==n&&V1.indexOf(r)>V1.indexOf(n),a=ko[r]||ko.essential,o=ko[n]||ko.essential,s=Array.isArray(t.selected_modules)?t.selected_modules:[],l=`commitment_${t.selected_package??0}`,u=e(l)!==l?e(l):`${t.selected_package}-${e("months")}`;return c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx("h2",{className:"text-xl font-semibold",children:e("subscription_details")})}),c.jsxs(be,{className:"space-y-5",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:e("selected_tier")}),c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx("span",{className:`inline-block rounded-full border px-2.5 py-0.5 text-xs font-semibold ${a.color}`,children:a.name}),i&&c.jsxs("span",{className:"inline-block rounded-full border border-green-500 text-green-700 dark:text-green-400 px-2.5 py-0.5 text-xs font-semibold",children:["â ",e("upgraded_from")," ",o.name]})]})]}),r==="expert"&&c.jsxs("div",{className:"pt-3 border-t",children:[c.jsxs("p",{className:"text-sm text-muted-foreground mb-2",children:[e("expert_modules")," (",s.length,"/2)"]}
8),s.length===0?c.jsx("p",{className:"text-sm text-amber-600 dark:text-amber-400 italic",children:e("no_modules_selected")}):c.jsx("div",{className:"space-y-1",children:s.map(d=>c.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[c.jsx("span",{className:"text-primary",children:"â"}),c.jsx("span",{className:"font-medium",children:e(d)})]},d))})]}),c.jsxs("div",{className:"pt-3 border-t",children:[c.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:e("engagement_period")}),c.jsx("p",{className:"font-medium",children:u}),t.selected_package!=null&&t.selected_package>0&&c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("monthly_invoices")}),c.jsx("p",{className:"text-xs italic text-muted-foreground mt-1",children:e("agreement_duration",{months:t.selected_package})})]}),(t.selected_package==null||t.selected_package===0)&&c.jsx("p",{className:"text-xs italic text-muted-foreground mt-1",children:e("no_minimum_commitment")})]})]})]})},iz=({order:t,modules:e,t:r,viewLanguage:n})=>{const i=t.selected_tier||t.tier_key||"essential",a=t.tier_pricing,o=a?.[i]?.price_per_reservation??t.price_per_reservation??0,s=a?.[i]?.minimum_reservations??(i==="essential"?10:i==="advanced"?6:4),d=(Array.isArray(t.packages)?t.packages:[]).find(g=>g.months===t.selected_package)?.discount_pct??0,f=d>0?Math.ceil(o*(1-d/100)*20-1e-10)/20:o,[h,p]=x.useState([]),m=JSON.stringify(t.add_on_modules??[]);return x.useEffect(()=>{const g=Array.isArray(t.add_on_modules)?t.add_on_modules:[];if(g.length===0){p([]);return}let v=!1;return(async()=>{const{data:y,error:w}=await Z.from("pricing_modules").select("*").eq("currency",t.currency).in("name",g);v||p(!w&&y?y:[])})(),()=>{v=!0}},[t.currency,m]),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx("h2",{className:"text-xl font-semibold",children:r("pricing_summary")})}),c.jsx(be,{className:"space-y-4",children:c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex justify-between text-sm",children:[c.jsxs("span",{className:"text-muted-foreground",children:[r("base_price_per_reservation")," (",ko[i]?.name,"):"]}),c.jsxs("span",{className:"font-medium",children:[o," ",t.currency]})]}),d>0&&c.jsxs("div",{className:"flex justify-between text-sm text-green-600",children:[c.jsxs("span",{children:[r("commitment_discount")," (",d,"%):"]}),c.jsxs("span",{children:["-",(o-f).toFixed(2)," ",t.currency]})]}),c.jsxs("div",{className:"border-t-2 pt-3",children:[c.jsxs("div",{className:"flex justify-between text-xl font-bold",children:[c.jsxs("span",{children:[r("tariff_per_reservation"),":"]}),c.jsxs("span",{children:[f," ",t.currency]})]}),t.selected_package!=null&&t.selected_package>0&&c.jsx("p",{className:"text-xs italic text-muted-foreground mt-1",children:r("agreement_duration",{months:t.selected_package})})]}),t.free_credits!=null&&t.free_credits>0&&c.jsxs("div",{className:"flex justify-between text-sm text-primary",children:[c.jsxs("span",{children:[r("free_reservations_included"),":"]}),c.jsx("span",{className:"font-medium",children:t.free_credits})]}),Array.isArray(t.add_on_modules)&&t.add_on_modules.length>0&&(()=>{const g={igloohome_keybox:{en:"box",fr:"boîte",de:"Box",it:"box"}},v={igloohome_keybox:{en:"Billed per keybox integrated via smartiz.",fr:"Facturé par boîte à clés intégrée via smartiz.",de:"Abrechnung pro über smartiz integrierter Schlüsselbox.",it:"Fatturato per keybox integrata tramite smartiz."}},y=n==="fr"||n==="de"||n==="it"?n:"en",w=y==="fr"?"mois":y==="de"?"Monat":y==="it"?"mese":"month",_=t.add_on_modules.map(j=>{const b=h.find(T=>T.name===j)||e.find(T=>T.name===j);if(!b)return null;const O=r(j),S=O!==j?O:b.display_name,N=g[j]?.[y]??null,C=v[j]?.[y]??null;return{name:j,unitPrice:b.base_price,label:S,unitWord:N,note:C}}).filter(Boolean);return _.length===0?null:c.jsxs("div",{className:"border-t pt-3 space-y-2",children:[c.jsx("div",{className:"text-sm font-semibold",children:r("monthly_addons")}),_.map(j=>c.jsxs("div",{className:"text-sm",children:[c.jsxs("div",{className:"flex justify-between gap-3",children:[c.jsx("span",{className:"text-muted-foreground",children:j.label}),c.jsxs("span",{className:"font-medium text-right",children:[j.unitPrice," ",t.currency,j.unitWord?` / ${j.unitWord}`:""," / ",w]})]}),j.note&&c.jsx("div",{className:"text-xs text-muted-foreground italic mt-0.5",children:j.note})]},j.name))]})})(),c.jsxs("div",{className:"bg-muted/50 p-3 rounded text-xs text-muted-foreground space-y-1",children:[c.jsx("p",{children:r("footnote_billing",{min:s})}),c.jsx("p",{children:r("footnote_cancel_free")}),c.jsx("p",{children:r("footnote_cancel_after")}),c.jsx("p",{children:r("footnote_vat")})]})]})})]})},az=({order:t,t:e})=>{const r=t.selected_tier||t.tier_key||"essential",n=t.tier_pricing,i=n?.[r]?.onboarding_fee??t.onboarding_final_price??0;if(i<=0)return null;const a=t.onboarding_discount_percentage??0,o=n?.[r]?.onboarding_fee??i,s=a>
80?Math.ceil(o*(1-a/100)*20-1e-10)/20:o;return c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx("h2",{className:"text-xl font-semibold",children:e("onboarding_fee")})}),c.jsxs(be,{className:"space-y-3",children:[c.jsxs("div",{className:"flex justify-between text-sm",children:[c.jsxs("span",{className:"text-muted-foreground",children:[e("base_onboarding_fee")," (",ko[r]?.name,"):"]}),c.jsxs("span",{className:"font-medium",children:[o," ",t.currency]})]}),a>0&&c.jsxs("div",{className:"flex justify-between text-sm text-green-600",children:[c.jsxs("span",{children:[e("onboarding_discount")," (",a,"%):"]}),c.jsxs("span",{children:["-",(o-s).toFixed(2)," ",t.currency]})]}),c.jsxs("div",{className:"border-t pt-3",children:[c.jsxs("div",{className:"flex justify-between text-lg font-bold",children:[c.jsx("span",{children:e("onboarding_fee")}),c.jsxs("span",{children:[s," ",t.currency]})]}),c.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:e("one_time_fee")})]}),t.onboarding_notes&&t.onboarding_notes.trim()&&c.jsxs("div",{className:"pt-3 border-t",children:[c.jsxs("p",{className:"text-sm text-muted-foreground mb-1",children:[e("notes"),":"]}),c.jsx("p",{className:"text-sm whitespace-pre-wrap",children:t.onboarding_notes})]})]})]})},oz=({order:t,t:e})=>c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx("h2",{className:"text-xl font-semibold",children:e("onboarding_fees")})}),c.jsxs(be,{className:"space-y-3",children:[c.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[c.jsxs("span",{children:[e("calculation_type"),":"]}),c.jsx("span",{className:"font-medium",children:t.onboarding_type==="per_unit"?`${e("per_unit")} ${t.business_type==="str"?e("property"):e("unit")}`:e("per_category")})]}),c.jsxs("div",{className:"flex justify-between",children:[c.jsxs("span",{className:"text-muted-foreground",children:[e("base_price")," (",t.onboarding_quantity," Ã ",t.onboarding_base_price," ",t.currency,")"]}),c.jsxs("span",{className:"font-medium",children:[(t.onboarding_base_price??0)*(t.onboarding_quantity??0)," ",t.currency]})]}),t.onboarding_discount_percentage!=null&&t.onboarding_discount_percentage>0&&c.jsxs("div",{className:"flex justify-between text-green-600",children:[c.jsxs("span",{children:[e("onboarding_discount")," (",t.onboarding_discount_percentage,"%)"]}),c.jsxs("span",{children:["-",((t.onboarding_base_price??0)*(t.onboarding_quantity??0)*t.onboarding_discount_percentage/100).toFixed(2)," ",t.currency]})]}),c.jsxs("div",{className:"border-t pt-3",children:[c.jsxs("div",{className:"flex justify-between text-lg font-bold",children:[c.jsx("span",{children:e("onboarding_fee")}),c.jsxs("span",{children:[t.onboarding_final_price," ",t.currency]})]}),c.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:e("one_time_fee")})]}),t.onboarding_notes&&t.onboarding_notes.trim()&&c.jsxs("div",{className:"pt-3 border-t",children:[c.jsxs("p",{className:"text-sm text-muted-foreground mb-1",children:[e("notes"),":"]}),c.jsx("p",{className:"text-sm whitespace-pre-wrap",children:t.onboarding_notes})]})]})]}),sz=({order:t,addonModules:e,t:r})=>c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx("h2",{className:"text-xl font-semibold",children:r("pricing_summary")})}),c.jsxs(be,{className:"space-y-6",children:[c.jsxs("div",{className:"space-y-3",children:[c.jsx("h3",{className:"font-semibold text-base border-b pb-2",children:r("recurring_monthly")}),c.jsxs("div",{className:"flex justify-between text-sm",children:[c.jsxs("span",{className:"text-muted-foreground",children:[r("base_price_per_unit"),":"]}),c.jsxs("span",{className:"font-medium",children:[t.base_monthly_price," ",t.currency]})]}),c.jsxs("div",{className:"flex justify-between",children:[c.jsxs("span",{children:[r("total_base_price"),":"]}),c.jsxs("div",{className:"text-right",children:[c.jsxs("div",{className:"font-medium",children:[Math.round(t.base_monthly_price*t.units)," ",t.currency]}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[t.base_monthly_price," ",t.currency," Ã ",t.units]})]})]}),e.length>0&&c.jsxs("div",{className:"flex justify-between",children:[c.jsxs("span",{children:[r("modules_per_month"),":"]}),c.jsxs("span",{className:"font-medium",children:[e.reduce((n,i)=>n+i.base_price,0)," ",t.currency]})]}),(t.discount_percentage>0||t.annual_billing)&&c.jsxs("div",{className:"flex justify-between border-t pt-2 text-sm text-muted-foreground",children:[c.jsxs("span",{children:[r("subtotal"),":"]}),c.jsxs("span",{children:[Math.round(t.base_monthly_price*t.units+e.reduce((n,i)=>n+i.base_price,0))," ",t.currency]})]}),t.discount_percentage>
80&&c.jsxs("div",{className:"flex justify-between text-green-600",children:[c.jsxs("span",{children:[r("discount")," (",t.discount_percentage,"%)"]}),c.jsxs("span",{children:["-",Math.round((t.base_monthly_price*t.units+e.reduce((n,i)=>n+i.base_price,0))*t.discount_percentage/100)," ",t.currency]})]}),t.annual_billing&&c.jsxs("div",{className:"flex justify-between text-green-600",children:[c.jsx("span",{children:r("annual_billing_discount")}),c.jsx("span",{children:t.discount_percentage>0?r("additional_12"):`-${Math.round((t.base_monthly_price*t.units+e.reduce((n,i)=>n+i.base_price,0))*.12)} ${t.currency}`})]}),t.free_trial_months>0&&c.jsxs("div",{className:"flex justify-between text-primary border-t pt-2",children:[c.jsx("span",{children:r("free_trial_period")}),c.jsxs("span",{className:"font-medium",children:[t.free_trial_months," ",r("months")]})]}),c.jsxs("div",{className:"border-t-2 pt-3",children:[c.jsxs("div",{className:"flex justify-between text-xl font-bold",children:[c.jsxs("span",{children:[r("total_per_month"),":"]}),c.jsxs("span",{children:[t.final_monthly_price," ",t.currency]})]}),t.annual_billing&&c.jsxs("div",{className:"flex justify-between text-lg font-semibold text-green-600 mt-2",children:[c.jsxs("span",{children:[r("yearly_total"),":"]}),c.jsxs("span",{children:[(t.final_monthly_price*12).toFixed(2)," ",t.currency]})]})]})]}),t.onboarding_final_price!=null&&t.onboarding_final_price>0&&c.jsxs("div",{className:"space-y-3 pt-4 border-t-2",children:[c.jsx("h3",{className:"font-semibold text-base border-b pb-2",children:r("one_time_fees")}),c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-muted-foreground",children:r("onboarding_fee")}),c.jsxs("span",{className:"font-medium",children:[t.onboarding_final_price," ",t.currency]})]}),c.jsx("p",{className:"text-xs text-muted-foreground",children:r("paid_once")})]}),c.jsx("div",{className:"bg-muted/50 p-3 rounded mt-4",children:c.jsx("p",{className:"text-xs text-muted-foreground text-center",children:r("vat_note")})})]})]});function lz(t,e){return x.useReducer((r,n)=>e[r][n]??r,t)}var L0="ScrollArea",[XT]=no(L0),[cz,un]=XT(L0),JT=x.forwardRef((t,e)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:a=600,...o}=t,[s,l]=x.useState(null),[u,d]=x.useState(null),[f,h]=x.useState(null),[p,m]=x.useState(null),[g,v]=x.useState(null),[y,w]=x.useState(0),[_,j]=x.useState(0),[b,O]=x.useState(!1),[S,N]=x.useState(!1),C=Nt(e,k=>l(k)),T=y0(i);return c.jsx(cz,{scope:r,type:n,dir:T,scrollHideDelay:a,scrollArea:s,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:b,onScrollbarXEnabledChange:O,scrollbarY:g,onScrollbarYChange:v,scrollbarYEnabled:S,onScrollbarYEnabledChange:N,onCornerWidthChange:w,onCornerHeightChange:j,children:c.jsx(Ve.div,{dir:T,...o,ref:C,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":_+"px",...t.style}})})});JT.displayName=L0;var ZT="ScrollAreaViewport",QT=x.forwardRef((t,e)=>{const{__scopeScrollArea:r,children:n,nonce:i,...a}=t,o=un(ZT,r),s=x.useRef(null),l=Nt(e,s,o.onViewportChange);return c.jsxs(c.Fragment,{children:[c.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:i}),c.jsx(Ve.div,{"data-radix-scroll-area-viewport":"",...a,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:c.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});QT.displayName=ZT;var Gn="ScrollAreaScrollbar",B0=x.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=un(Gn,t.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=t.orientation==="horizontal";return x.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type==="hover"?c.jsx(uz,{...n,ref:e,forceMount:r}):i.type==="scroll"?c.jsx(dz,{...n,ref:e,forceMount:r}):i.type==="auto"?c.jsx(eM,{...n,ref:e,forceMount:r}):i.type==="always"?c.jsx(F0,{...n,ref:e}):null});B0.displayName=Gn;var uz=x.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=un(Gn,t.__scopeScrollArea),[a,o]=x.useState(!1);return x.useEffect(()=>{const s=i.scrollArea;let l=0;if(s){const u=()=>{window.clearTimeout(l),o(!0)},d=()=>{l=window.setTimeout(()=>
vendor: 4,479 bytes, line 8
8o(!1),i.scrollHideDelay)};return s.addEventListener("pointerenter",u),s.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),s.removeEventListener("pointerenter",u),s.removeEventListener("pointerleave",d)}}},[i.scrollArea,i.scrollHideDelay]),c.jsx(Zi,{present:r||a,children:c.jsx(eM,{"data-state":a?"visible":"hidden",...n,ref:e})})}),dz=x.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=un(Gn,t.__scopeScrollArea),a=t.orientation==="horizontal",o=rh(()=>l("SCROLL_END"),100),[s,l]=lz("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 x.useEffect(()=>{if(s==="idle"){const u=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[s,i.scrollHideDelay,l]),x.useEffect(()=>{const u=i.viewport,d=a?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const p=u[d];f!==p&&(l("SCROLL"),o()),f=p};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[i.viewport,a,l,o]),c.jsx(Zi,{present:r||s!=="hidden",children:c.jsx(F0,{"data-state":s==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:Ae(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Ae(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),eM=x.forwardRef((t,e)=>{const r=un(Gn,t.__scopeScrollArea),{forceMount:n,...i}=t,[a,o]=x.useState(!1),s=t.orientation==="horizontal",l=rh(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,d=r.viewport.offsetHeight<r.viewport.scrollHeight;o(s?u:d)}},10);return Yo(r.viewport,l),Yo(r.content,l),c.jsx(Zi,{present:n||a,children:c.jsx(F0,{"data-state":a?"visible":"hidden",...i,ref:e})})}),F0=x.forwardRef((t,e)=>{const{orientation:r="vertical",...n}=t,i=un(Gn,t.__scopeScrollArea),a=x.useRef(null),o=x.useRef(0),[s,l]=x.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=aM(s.viewport,s.content),d={...n,sizes:s,onSizesChange:l,hasThumb:u>0&&u<1,onThumbChange:h=>a.current=h,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:h=>o.current=h};function f(h,p){return vz(h,o.current,s,p)}return r==="horizontal"?c.jsx(fz,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&a.current){const h=i.viewport.scrollLeft,p=K1(h,s,i.dir);a.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollLeft=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollLeft=f(h,i.dir))}}):r==="vertical"?c.jsx(hz,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&a.current){const h=i.viewport.scrollTop,p=K1(h,s);a.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollTop=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollTop=f(h))}}):null}),fz=x.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,a=un(Gn,t.__scopeScrollArea),[o,s]=x.useState(),l=x.useRef(null),u=Nt(e,l,a.onScrollbarXChange);return x.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),c.jsx(rM,{"data-orientation":"horizontal",...i,ref:u,sizes:r,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":th(r)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(a.viewport){const h=a.viewport.scrollLeft+d.deltaX;t.onWheelScroll(h),sM(h,f)&&d.preventDefault()}},onResize:()=>{l.current&&a.viewport&&o&&n({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:ed(o.paddingLeft),paddingEnd:ed(o.paddingRight)}})}})}),hz=x.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,a=un(Gn,t.__scopeScrollArea),[o,s]=x.useState(),l=x.useRef(null),u=Nt(e,l,a.onScrollbarYChange);return x.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),c.jsx(rM,{"data-orientation":"vertical",...i,ref:u,sizes:r,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":th(r)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(a.viewport){const h=a.viewport.scrollTop+d.deltaY;t.onWheelScroll(h),sM(h,f)&&d.preventDefault()}},onResize:()=>{l.current&&a.viewport&&o&&n({content:a.viewport.scrollHeight,viewport:
vendor: 5,499 bytes, line 8
8a.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:ed(o.paddingTop),paddingEnd:ed(o.paddingBottom)}})}})}),[pz,tM]=XT(Gn),rM=x.forwardRef((t,e)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:l,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=t,p=un(Gn,r),[m,g]=x.useState(null),v=Nt(e,C=>g(C)),y=x.useRef(null),w=x.useRef(""),_=p.viewport,j=n.content-n.viewport,b=si(d),O=si(l),S=rh(f,10);function N(C){if(y.current){const T=C.clientX-y.current.left,k=C.clientY-y.current.top;u({x:T,y:k})}}return x.useEffect(()=>{const C=T=>{const k=T.target;m?.contains(k)&&b(T,j)};return document.addEventListener("wheel",C,{passive:!1}),()=>document.removeEventListener("wheel",C,{passive:!1})},[_,m,j,b]),x.useEffect(O,[n,O]),Yo(m,S),Yo(p.content,S),c.jsx(pz,{scope:r,scrollbar:m,hasThumb:i,onThumbChange:si(a),onThumbPointerUp:si(o),onThumbPositionChange:O,onThumbPointerDown:si(s),children:c.jsx(Ve.div,{...h,ref:v,style:{position:"absolute",...h.style},onPointerDown:Ae(t.onPointerDown,C=>{C.button===0&&(C.target.setPointerCapture(C.pointerId),y.current=m.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),N(C))}),onPointerMove:Ae(t.onPointerMove,N),onPointerUp:Ae(t.onPointerUp,C=>{const T=C.target;T.hasPointerCapture(C.pointerId)&&T.releasePointerCapture(C.pointerId),document.body.style.webkitUserSelect=w.current,p.viewport&&(p.viewport.style.scrollBehavior=""),y.current=null})})})}),Qu="ScrollAreaThumb",nM=x.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=tM(Qu,t.__scopeScrollArea);return c.jsx(Zi,{present:r||i.hasThumb,children:c.jsx(mz,{ref:e,...n})})}),mz=x.forwardRef((t,e)=>{const{__scopeScrollArea:r,style:n,...i}=t,a=un(Qu,r),o=tM(Qu,r),{onThumbPositionChange:s}=o,l=Nt(e,f=>o.onThumbChange(f)),u=x.useRef(void 0),d=rh(()=>{u.current&&(u.current(),u.current=void 0)},100);return x.useEffect(()=>{const f=a.viewport;if(f){const h=()=>{if(d(),!u.current){const p=yz(f,s);u.current=p,s()}};return s(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[a.viewport,d,s]),c.jsx(Ve.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:Ae(t.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),m=f.clientX-p.left,g=f.clientY-p.top;o.onThumbPointerDown({x:m,y:g})}),onPointerUp:Ae(t.onPointerUp,o.onThumbPointerUp)})});nM.displayName=Qu;var z0="ScrollAreaCorner",iM=x.forwardRef((t,e)=>{const r=un(z0,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?c.jsx(gz,{...t,ref:e}):null});iM.displayName=z0;var gz=x.forwardRef((t,e)=>{const{__scopeScrollArea:r,...n}=t,i=un(z0,r),[a,o]=x.useState(0),[s,l]=x.useState(0),u=!!(a&&s);return Yo(i.scrollbarX,()=>{const d=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(d),l(d)}),Yo(i.scrollbarY,()=>{const d=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(d),o(d)}),u?c.jsx(Ve.div,{...n,ref:e,style:{width:a,height:s,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function ed(t){return t?parseInt(t,10):0}function aM(t,e){const r=t/e;return isNaN(r)?0:r}function th(t){const e=aM(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function vz(t,e,r,n="ltr"){const i=th(r),a=i/2,o=e||a,s=i-o,l=r.scrollbar.paddingStart+o,u=r.scrollbar.size-r.scrollbar.paddingEnd-s,d=r.content-r.viewport,f=n==="ltr"?[0,d]:[d*-1,0];return oM([l,u],f)(t)}function K1(t,e,r="ltr"){const n=th(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,a=e.scrollbar.size-i,o=e.content-e.viewport,s=a-n,l=r==="ltr"?[0,o]:[o*-1,0],u=Zy(t,l);return oM([0,o],[0,s])(u)}function oM(t,e){return r=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const n=(e[1]-e[0])/(t[1]-t[0]);return e[0]+n*(r-t[0])}}function sM(t,e){return t>0&&t<e}var yz=(t,e=()=>{})=>{let r={left:t.scrollLeft,top:t.scrollTop},n=0;return(function i(){const a={left:t.scrollLeft,top:t.scrollTop},o=r.left!==a.left,s=r.top!==a.top;(o||s)&&e(),r=a,n=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(n)};function rh(t,e){const r=si(t),n=x.useRef(0);return x.useEffect(()=>()=>window.clearTimeout(n.current),[]),x.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function Yo(t,e){const r=si(e);xi(()=>{let n=0;if(t){const i=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return i.observe(t),()=>{window.cancelAnimationFrame(n),i.unobserve(t)}}},[t,r])}var lM=JT,xz=QT,bz=iM;const Pu=x.forwardRef(({className:t,children:e,...r},n)=>c.jsxs(lM,{ref:n,className:le("relative overflow-hidden",t),...r,children:[c.jsx(xz,{className:"h-full w-full rounded-[inherit]",children:e}),c.jsx(cM,{}),c.jsx(bz,{})]}));Pu.displayName=lM.displayName;const cM=x.forwardRef(({className:t,orientation:e="vertical",...r},n)=>c.jsx(B0,{ref:n,orientation:e,className:le("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...r,children:c.jsx(nM,{className:"relative flex-1 rounded-full bg-border"})}));cM.displayName=B0.displayName;const uM=y4,dM=x4,fM=b4;var Sp,G1;
vendor: 5,393 bytes, line 8
8function Mr(){if(G1)return Sp;G1=1;var t=Array.isArray;return Sp=t,Sp}var jp,Y1;function hM(){if(Y1)return jp;Y1=1;var t=typeof Zc=="object"&&Zc&&Zc.Object===Object&&Zc;return jp=t,jp}var Op,X1;function Yn(){if(X1)return Op;X1=1;var t=hM(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return Op=r,Op}var Np,J1;function Tc(){if(J1)return Np;J1=1;var t=Yn(),e=t.Symbol;return Np=e,Np}var Cp,Z1;function wz(){if(Z1)return Cp;Z1=1;var t=Tc(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,i=t?t.toStringTag:void 0;function a(o){var s=r.call(o,i),l=o[i];try{o[i]=void 0;var u=!0}catch{}var d=n.call(o);return u&&(s?o[i]=l:delete o[i]),d}return Cp=a,Cp}var kp,Q1;function _z(){if(Q1)return kp;Q1=1;var t=Object.prototype,e=t.toString;function r(n){return e.call(n)}return kp=r,kp}var Ap,e_;function Oi(){if(e_)return Ap;e_=1;var t=Tc(),e=wz(),r=_z(),n="[object Null]",i="[object Undefined]",a=t?t.toStringTag:void 0;function o(s){return s==null?s===void 0?i:n:a&&a in Object(s)?e(s):r(s)}return Ap=o,Ap}var Ep,t_;function Ni(){if(t_)return Ep;t_=1;function t(e){return e!=null&&typeof e=="object"}return Ep=t,Ep}var Pp,r_;function Ms(){if(r_)return Pp;r_=1;var t=Oi(),e=Ni(),r="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&t(i)==r}return Pp=n,Pp}var Tp,n_;function q0(){if(n_)return Tp;n_=1;var t=Mr(),e=Ms(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(t(a))return!1;var s=typeof a;return s=="number"||s=="symbol"||s=="boolean"||a==null||e(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return Tp=i,Tp}var Mp,i_;function ra(){if(i_)return Mp;i_=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return Mp=t,Mp}var Dp,a_;function U0(){if(a_)return Dp;a_=1;var t=Oi(),e=ra(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(s){if(!e(s))return!1;var l=t(s);return l==n||l==i||l==r||l==a}return Dp=o,Dp}var Rp,o_;function Sz(){if(o_)return Rp;o_=1;var t=Yn(),e=t["__core-js_shared__"];return Rp=e,Rp}var Ip,s_;function jz(){if(s_)return Ip;s_=1;var t=Sz(),e=(function(){var n=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!e&&e in n}return Ip=r,Ip}var $p,l_;function pM(){if(l_)return $p;l_=1;var t=Function.prototype,e=t.toString;function r(n){if(n!=null){try{return e.call(n)}catch{}try{return n+""}catch{}}return""}return $p=r,$p}var Lp,c_;function Oz(){if(c_)return Lp;c_=1;var t=U0(),e=jz(),r=ra(),n=pM(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,l=o.toString,u=s.hasOwnProperty,d=RegExp("^"+l.call(u).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(h){if(!r(h)||e(h))return!1;var p=t(h)?d:a;return p.test(n(h))}return Lp=f,Lp}var Bp,u_;function Nz(){if(u_)return Bp;u_=1;function t(e,r){return e?.[r]}return Bp=t,Bp}var Fp,d_;function io(){if(d_)return Fp;d_=1;var t=Oz(),e=Nz();function r(n,i){var a=e(n,i);return t(a)?a:void 0}return Fp=r,Fp}var zp,f_;function nh(){if(f_)return zp;f_=1;var t=io(),e=t(Object,"create");return zp=e,zp}var qp,h_;function Cz(){if(h_)return qp;h_=1;var t=nh();function e(){this.__data__=t?t(null):{},this.size=0}return qp=e,qp}var Up,p_;function kz(){if(p_)return Up;p_=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return Up=t,Up}var Hp,m_;function Az(){if(m_)return Hp;m_=1;var t=nh(),e="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(t){var s=o[a];return s===e?void 0:s}return n.call(o,a)?o[a]:void 0}return Hp=i,Hp}var Wp,g_;function Ez(){if(g_)return Wp;g_=1;var t=nh(),e=Object.prototype,r=e.hasOwnProperty;function n(i){var a=this.__data__;return t?a[i]!==void 0:r.call(a,i)}return Wp=n,Wp}var Vp,v_;function Pz(){if(v_)return Vp;v_=1;var t=nh(),e="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=t&&i===void 0?e:i,this}return Vp=r,Vp}var Kp,y_;function Tz(){if(y_)return Kp;y_=1;var t=Cz(),e=kz(),r=Az(),n=Ez(),i=Pz();function a(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var u=o[s];this.set(u[0],u[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Kp=a,Kp}var Gp,x_;function Mz(){if(x_)return Gp;x_=1;function t(){this.__data__=[],this.size=0}return Gp=t,Gp}var Yp,b_;function H0(){if(b_)return Yp;b_=1;function t(e,r){return e===r||e!==e&&r!==r}return Yp=t,Yp}var Xp,w_;function ih(){if(w_)return Xp;w_=1;var t=H0();function e(r,n){for(var i=r.length;i--;)if(t(r[i][0],n))return i;return-1}return Xp=e,Xp}var Jp,__;function Dz(){if(__)return Jp;__=1;var t=ih(),e=Array.prototype,r=e.splice;function n(i){var a=this.__data__,o=t(a,i);if(o<0)return!1;var s=a.length-1;return o==s?a.pop():r.call(a,o,1),--this.size,!0}return Jp=n,Jp}var Zp,S_;function Rz(){if(S_)return Zp;S_=1;var t=ih();function e(r){var n=this.__data__,i=t(n,r);return i<0?void 0:n[i][1]}return Zp=e,Zp}var Qp,j_;function Iz(){if(j_)return Qp;j_=1;var t=ih();function e(r){return t(this.__data__,r)>-1}return Qp=e,Qp}var em,O_;function $z(){if(O_)return em;O_=1;var t=ih();function e(r,n){var i=this.__data__,a=t(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return em=e,em}var tm,N_;
vendor: 9,339 bytes, line 8
8function ah(){if(N_)return tm;N_=1;var t=Mz(),e=Dz(),r=Rz(),n=Iz(),i=$z();function a(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var u=o[s];this.set(u[0],u[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,tm=a,tm}var rm,C_;function W0(){if(C_)return rm;C_=1;var t=io(),e=Yn(),r=t(e,"Map");return rm=r,rm}var nm,k_;function Lz(){if(k_)return nm;k_=1;var t=Tz(),e=ah(),r=W0();function n(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return nm=n,nm}var im,A_;function Bz(){if(A_)return im;A_=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return im=t,im}var am,E_;function oh(){if(E_)return am;E_=1;var t=Bz();function e(r,n){var i=r.__data__;return t(n)?i[typeof n=="string"?"string":"hash"]:i.map}return am=e,am}var om,P_;function Fz(){if(P_)return om;P_=1;var t=oh();function e(r){var n=t(this,r).delete(r);return this.size-=n?1:0,n}return om=e,om}var sm,T_;function zz(){if(T_)return sm;T_=1;var t=oh();function e(r){return t(this,r).get(r)}return sm=e,sm}var lm,M_;function qz(){if(M_)return lm;M_=1;var t=oh();function e(r){return t(this,r).has(r)}return lm=e,lm}var cm,D_;function Uz(){if(D_)return cm;D_=1;var t=oh();function e(r,n){var i=t(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return cm=e,cm}var um,R_;function V0(){if(R_)return um;R_=1;var t=Lz(),e=Fz(),r=zz(),n=qz(),i=Uz();function a(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var u=o[s];this.set(u[0],u[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,um=a,um}var dm,I_;function mM(){if(I_)return dm;I_=1;var t=V0(),e="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(e);var a=function(){var o=arguments,s=i?i.apply(this,o):o[0],l=a.cache;if(l.has(s))return l.get(s);var u=n.apply(this,o);return a.cache=l.set(s,u)||l,u};return a.cache=new(r.Cache||t),a}return r.Cache=t,dm=r,dm}var fm,$_;function Hz(){if($_)return fm;$_=1;var t=mM(),e=500;function r(n){var i=t(n,function(o){return a.size===e&&a.clear(),o}),a=i.cache;return i}return fm=r,fm}var hm,L_;function Wz(){if(L_)return hm;L_=1;var t=Hz(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=t(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(e,function(o,s,l,u){a.push(l?u.replace(r,"$1"):s||o)}),a});return hm=n,hm}var pm,B_;function K0(){if(B_)return pm;B_=1;function t(e,r){for(var n=-1,i=e==null?0:e.length,a=Array(i);++n<i;)a[n]=r(e[n],n,e);return a}return pm=t,pm}var mm,F_;function Vz(){if(F_)return mm;F_=1;var t=Tc(),e=K0(),r=Mr(),n=Ms(),i=t?t.prototype:void 0,a=i?i.toString:void 0;function o(s){if(typeof s=="string")return s;if(r(s))return e(s,o)+"";if(n(s))return a?a.call(s):"";var l=s+"";return l=="0"&&1/s==-1/0?"-0":l}return mm=o,mm}var gm,z_;function gM(){if(z_)return gm;z_=1;var t=Vz();function e(r){return r==null?"":t(r)}return gm=e,gm}var vm,q_;function vM(){if(q_)return vm;q_=1;var t=Mr(),e=q0(),r=Wz(),n=gM();function i(a,o){return t(a)?a:e(a,o)?[a]:r(n(a))}return vm=i,vm}var ym,U_;function sh(){if(U_)return ym;U_=1;var t=Ms();function e(r){if(typeof r=="string"||t(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return ym=e,ym}var xm,H_;function G0(){if(H_)return xm;H_=1;var t=vM(),e=sh();function r(n,i){i=t(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[e(i[a++])];return a&&a==o?n:void 0}return xm=r,xm}var bm,W_;function yM(){if(W_)return bm;W_=1;var t=G0();function e(r,n,i){var a=r==null?void 0:t(r,n);return a===void 0?i:a}return bm=e,bm}var Kz=yM();const Ur=at(Kz);var wm,V_;function Gz(){if(V_)return wm;V_=1;function t(e){return e==null}return wm=t,wm}var Yz=Gz();const Me=at(Yz);var _m,K_;function Xz(){if(K_)return _m;K_=1;var t=Oi(),e=Mr(),r=Ni(),n="[object String]";function i(a){return typeof a=="string"||!e(a)&&r(a)&&t(a)==n}return _m=i,_m}var Jz=Xz();const Va=at(Jz);var Zz=U0();const ke=at(Zz);var Qz=ra();const Ds=at(Qz);var Sm={exports:{}},Qe={};var G_;function eq(){if(G_)return Qe;G_=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),s=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),m;m=Symbol.for("react.module.reference");function g(v){if(typeof v=="object"&&v!==null){var y=v.$$typeof;switch(y){case t:switch(v=v.type,v){case r:case i:case n:case u:case d:return v;default:switch(v=v&&v.$$typeof,v){case s:case o:case l:case h:case f:case a:return v;default:return y}}case e:return y}}}return Qe.ContextConsumer=o,Qe.ContextProvider=a,Qe.Element=t,Qe.ForwardRef=l,Qe.Fragment=r,Qe.Lazy=h,Qe.Memo=f,Qe.Portal=e,Qe.Profiler=i,Qe.StrictMode=n,Qe.Suspense=u,Qe.SuspenseList=d,Qe.isAsyncMode=function(){return!1},Qe.isConcurrentMode=function(){return!1},Qe.isContextConsumer=function(v){return g(v)===o},Qe.isContextProvider=function(v){return g(v)===a},Qe.isElement=function(v){return typeof v=="object"&&v!==null&&v.$$typeof===t},Qe.isForwardRef=function(v){return g(v)===l},Qe.isFragment=function(v){return g(v)===r},Qe.isLazy=function(v){return g(v)===h},Qe.isMemo=function(v){return g(v)===f},Qe.isPortal=function(v){return g(v)===e},Qe.isProfiler=function(v){return g(v)===i},Qe.isStrictMode=function(v){return g(v)===n},Qe.isSuspense=function(v){return g(v)===u},Qe.isSuspenseList=function(v){return g(v)===d},Qe.isValidElementType=function(v){return typeof v=="string"||typeof v=="function"||v===r||v===i||v===n||v===u||v===d||v===p||typeof v=="object"&&v!==null&&(v.$$typeof===h||v.$$typeof===f||v.$$typeof===a||v.$$typeof===o||v.$$typeof===l||v.$$typeof===m||v.getModuleId!==void 0)},Qe.typeOf=g,Qe}var Y_;function tq(){return Y_||(Y_=1,Sm.exports=eq()),Sm.exports}var rq=tq(),jm,X_;function xM(){if(X_)return jm;X_=1;var t=Oi(),e=Ni(),r="[object Number]";function n(i){return typeof i=="number"||e(i)&&t(i)==r}return jm=n,jm}var Om,J_;function nq(){if(J_)return Om;J_=1;var t=xM();function e(r){return t(r)&&r!=+r}return Om=e,Om}var iq=nq();const Mc=at(iq);var aq=xM();const oq=at(aq);var wr=function(e){return e===0?0:e>0?1:-1},Oa=function(e){return Va(e)&&e.indexOf("%")===e.length-1},ie=function(e){return oq(e)&&!Mc(e)},sq=function(e){return Me(e)},Bt=function(e){return ie(e)||Va(e)},lq=0,Rs=function(e){var r=++lq;return"".concat(e||"").concat(r)},_r=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!ie(e)&&!Va(e))return n;var a;if(Oa(e)){var o=e.indexOf("%");a=r*parseFloat(e.slice(0,o))/100}else a=+e;return Mc(a)&&(a=n),i&&a>r&&(a=r),a},$i=function(e){if(!e)return null;var r=Object.keys(e);return r&&r.length?e[r[0]]:null},cq=function(e){if(!Array.isArray(e))return!1;for(var r=e.length,n={},i=0;i<r;i++)if(!n[e[i]])n[e[i]]=!0;else return!0;return!1},Br=function(e,r){return ie(e)&&ie(r)?function(n){return e+n*(r-e)}:function(){return r}};function td(t,e,r){return!t||!t.length?null:t.find(function(n){return n&&(typeof e=="function"?e(n):Ur(n,e))===r})}var uq=function(e,r){return ie(e)&&ie(r)?e-r:Va(e)&&Va(r)?e.localeCompare(r):e instanceof Date&&r instanceof Date?e.getTime()-r.getTime():String(e).localeCompare(String(r))};function $o(t,e){for(var r in t)if({}.hasOwnProperty.call(t,r)&&(!{}.hasOwnProperty.call(e,r)||t[r]!==e[r]))return!1;for(var n in e)if({}.hasOwnProperty.call(e,n)&&!{}.hasOwnProperty.call(t,n))return!1;return!0}function fx(t){"@babel/helpers - typeof";return fx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fx(t)}var dq=["viewBox","children"],fq=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRen
8dering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],Z_=["points","pathLength"],Nm={svg:dq,polygon:Z_,polyline:Z_},Y0=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDrag
8Capture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],rd=function(e,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(x.isValidElement(e)&&(n=e.props),!Ds(n))return null;var i={};return Object.keys(n).forEach(function(a){Y0.includes(a)&&(i[a]=r||function(o){return n[a](n,o)})}),i},hq=function(e,r,n){return function(i){return e(r,n,i),null}},Ka=function(e,r,n){if(!Ds(e)||fx(e)!=="object")return null;var i=null;return Object.keys(e).forEach(function(a){var o=e[a];Y0.includes(a)&&typeof o=="function"&&(i||(i={}),i[a]=hq(o,r,n))}),i},pq=["children"],mq=["children"];function Q_(t,e){if(t==null)return{};var r=gq(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function gq(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function hx(t){"@babel/helpers - typeof";return hx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hx(t)}var eS={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},hi=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},tS=null,Cm=null,X0=function t(e){if(e===tS&&Array.isArray(Cm))return Cm;var r=[];return x.Children.forEach(e,function(n){Me(n)||(rq.isFragment(n)?r=r.concat(t(n.props.children)):r.push(n))}),Cm=r,tS=e,r};function Hr(t,e){var r=[],n=[];return Array.isArray(e)?n=e.map(function(i){return hi(i)}):n=[hi(e)],X0(t).forEach(function(i){var a=Ur(i,"type.displayName")||Ur(i,"type.name");n.indexOf(a)!==-1&&r.push(i)}),r}function Lr(t,e){var r=Hr(t,e);return r&&r[0]}var rS=function(e){if(!e||!e.props)return!1;var r=e.props,n=r.width,i=r.height;return!(!ie(n)||n<=0||!ie(i)||i<=0)},vq=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],yq=function(e){return e&&e.type&&Va(e.type)&&vq.indexOf(e.type)>=0},xq=function(e){return e&&hx(e)==="object"&&"clipDot"in e}
vendor: 4,526 bytes, line 8
8,bq=function(e,r,n,i){var a,o=(a=Nm?.[i])!==null&&a!==void 0?a:[];return r.startsWith("data-")||!ke(e)&&(i&&o.includes(r)||fq.includes(r))||n&&Y0.includes(r)},_e=function(e,r,n){if(!e||typeof e=="function"||typeof e=="boolean")return null;var i=e;if(x.isValidElement(e)&&(i=e.props),!Ds(i))return null;var a={};return Object.keys(i).forEach(function(o){var s;bq((s=i)===null||s===void 0?void 0:s[o],o,r,n)&&(a[o]=i[o])}),a},px=function t(e,r){if(e===r)return!0;var n=x.Children.count(e);if(n!==x.Children.count(r))return!1;if(n===0)return!0;if(n===1)return nS(Array.isArray(e)?e[0]:e,Array.isArray(r)?r[0]:r);for(var i=0;i<n;i++){var a=e[i],o=r[i];if(Array.isArray(a)||Array.isArray(o)){if(!t(a,o))return!1}else if(!nS(a,o))return!1}return!0},nS=function(e,r){if(Me(e)&&Me(r))return!0;if(!Me(e)&&!Me(r)){var n=e.props||{},i=n.children,a=Q_(n,pq),o=r.props||{},s=o.children,l=Q_(o,mq);return i&&s?$o(a,l)&&px(i,s):!i&&!s?$o(a,l):!1}return!1},iS=function(e,r){var n=[],i={};return X0(e).forEach(function(a,o){if(yq(a))n.push(a);else if(a){var s=hi(a.type),l=r[s]||{},u=l.handler,d=l.once;if(u&&(!d||!i[s])){var f=u(a,s,o);n.push(f),i[s]=!0}}}),n},wq=function(e){var r=e&&e.type;return r&&eS[r]?eS[r]:null},_q=function(e,r){return X0(r).indexOf(e)},Sq=["children","width","height","viewBox","className","style","title","desc"];function mx(){return mx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},mx.apply(this,arguments)}function jq(t,e){if(t==null)return{};var r=Oq(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Oq(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function gx(t){var e=t.children,r=t.width,n=t.height,i=t.viewBox,a=t.className,o=t.style,s=t.title,l=t.desc,u=jq(t,Sq),d=i||{width:r,height:n,x:0,y:0},f=Le("recharts-surface",a);return D.createElement("svg",mx({},_e(u,!0,"svg"),{className:f,width:r,height:n,style:o,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),D.createElement("title",null,s),D.createElement("desc",null,l),e)}var Nq=["children","className"];function vx(){return vx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},vx.apply(this,arguments)}function Cq(t,e){if(t==null)return{};var r=kq(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function kq(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var Ke=D.forwardRef(function(t,e){var r=t.children,n=t.className,i=Cq(t,Nq),a=Le("recharts-layer",n);return D.createElement("g",vx({className:a},_e(i,!0),{ref:e}),r)}),On=function(e,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a]},km,aS;function Aq(){if(aS)return km;aS=1;function t(e,r,n){var i=-1,a=e.length;r<0&&(r=-r>a?0:a+r),n=n>a?a:n,n<0&&(n+=a),a=r>n?0:n-r>>>0,r>>>=0;for(var o=Array(a);++i<a;)o[i]=e[i+r];return o}return km=t,km}var Am,oS;function Eq(){if(oS)return Am;oS=1;var t=Aq();function e(r,n,i){var a=r.length;return i=i===void 0?a:i,!n&&i>=a?r:t(r,n,i)}return Am=e,Am}var Em,sS;function bM(){if(sS)return Em;sS=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=e+r+n,a="\\ufe0e\\ufe0f",o="\\u200d",s=RegExp("["+o+t+i+a+"]");function l(u){return s.test(u)}return Em=l,Em}var Pm,lS;function Pq(){if(lS)return Pm;lS=1;function t(e){return e.split("")}return Pm=t,Pm}var Tm,cS;function Tq(){if(cS)return Tm;cS=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=e+r+n,a="\\ufe0e\\ufe0f",o="["+t+"]",s="["+i+"]",l="\\ud83c[\\udffb-\\udfff]",u="(?:"+s+"|"+l+")",d="[^"+t+"]",f="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",p="\\u200d",m=u+"?",g="["+a+"]?",v="(?:"+p+"(?:"+[d,f,h].join("|")+")"+g+m+")*",y=g+m+v,w="(?:"+[d+s+"?",s,f,h,o].join("|")+")",_=RegExp(l+"(?="+l+")|"+w+y,"g");function j(b){return b.match(_)||[]}return Tm=j,Tm}var Mm,uS;
8function Mq(){if(uS)return Mm;uS=1;var t=Pq(),e=bM(),r=Tq();function n(i){return e(i)?r(i):t(i)}return Mm=n,Mm}var Dm,dS;function Dq(){if(dS)return Dm;dS=1;var t=Eq(),e=bM(),r=Mq(),n=gM();function i(a){return function(o){o=n(o);var s=e(o)?r(o):void 0,l=s?s[0]:o.charAt(0),u=s?t(s,1).join(""):o.slice(1);return l[a]()+u}}return Dm=i,Dm}var Rm,fS;function Rq(){if(fS)return Rm;fS=1;var t=Dq(),e=t("toUpperCase");return Rm=e,Rm}var Iq=Rq();const lh=at(Iq);function st(t){return function(){return t}}const wM=Math.cos,nd=Math.sin,Cn=Math.sqrt,id=Math.PI,ch=2*id,yx=Math.PI,xx=2*yx,ba=1e-6,$q=xx-ba;function _M(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=arguments[e]+t[e]}function Lq(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return _M;const r=10**e;return function(n){this._+=n[0];for(let i=1,a=n.length;i<a;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}class Bq{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?_M:Lq(e)}moveTo(e,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,r){this._append`L${this._x1=+e},${this._y1=+r}`}quadraticCurveTo(e,r,n,i){this._append`Q${+e},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(e,r,n,i,a,o){this._append`C${+e},${+r},${+n},${+i},${this._x1=+a},${this._y1=+o}`}arcTo(e,r,n,i,a){if(e=+e,r=+r,n=+n,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let o=this._x1,s=this._y1,l=n-e,u=i-r,d=o-e,f=s-r,h=d*d+f*f;if(this._x1===null)this._append`M${this._x1=e},${this._y1=r}`;else if(h>ba)if(!(Math.abs(f*l-u*d)>ba)||!a)this._append`L${this._x1=e},${this._y1=r}`;else{let p=n-o,m=i-s,g=l*l+u*u,v=p*p+m*m,y=Math.sqrt(g),w=Math.sqrt(h),_=a*Math.tan((yx-Math.acos((g+h-v)/(2*y*w)))/2),j=_/w,b=_/y;Math.abs(j-1)>ba&&this._append`L${e+j*d},${r+j*f}`,this._append`A${a},${a},0,0,${+(f*p>d*m)},${this._x1=e+b*l},${this._y1=r+b*u}`}}arc(e,r,n,i,a,o){if(e=+e,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let s=n*Math.cos(i),l=n*Math.sin(i),u=e+s,d=r+l,f=1^o,h=o?i-a:a-i;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>ba||Math.abs(this._y1-d)>ba)&&this._append`L${u},${d}`,n&&(h<0&&(h=h%xx+xx),h>$q?this._append`A${n},${n},0,1,${f},${e-s},${r-l}A${n},${n},0,1,${f},${this._x1=u},${this._y1=d}`:h>ba&&this._append`A${n},${n},0,${+(h>=yx)},${f},${this._x1=e+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(e,r,n,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function J0(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(r==null)e=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);e=n}return t},()=>new Bq(e)}function Z0(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function SM(t){this._context=t}SM.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function uh(t){return new SM(t)}function jM(t){return t[0]}function OM(t){return t[1]}function NM(t,e){var r=st(!0),n=null,i=uh,a=null,o=J0(s);t=typeof t=="function"?t:t===void 0?jM:st(t),e=typeof e=="function"?e:e===void 0?OM:st(e);function s(l){var u,d=(l=Z0(l)).length,f,h=!1,p;for(n==null&&(a=i(p=o())),u=0;u<=d;++u)!(u<d&&r(f=l[u],u,l))===h&&((h=!h)?a.lineStart():a.lineEnd()),h&&a.point(+t(f,u,l),+e(f,u,l));if(p)return a=null,p+""||null}return s.x=function(l){return arguments.length?(t=typeof l=="function"?l:st(+l),s):t},s.y=function(l){return arguments.length?(e=typeof l=="function"?l:st(+l),s):e},s.defined=function(l){return arguments.length?(r=typeof l=="function"?l:st(!!l),s):r},s.curve=function(l){return arguments.length?(i=l,n!=null&&(a=i(n)),s):i},s.context=function(l){return arguments.length?(l==null?n=a=null:a=i(n=l),s):n},s}function tu(t,e,r){var n=null,i=st(!0),a=null,o=uh,s=null,l=J0(u);t=typeof t=="function"?t:t===void 0?jM:st(+t),e=typeof e=="function"?e:st(e===void 0?0:+e),r=typeof r=="function"?r:r===void 0?OM:st(+r);function u(f){var h,p,m,g=(f=Z0(f)).length,v,y=!1,w,_=new Array(g),j=new Array(g);for(a==null&&(s=o(w=l())),h=0;h<=g;++h){if(!(h<g&&i(v=f[h],h,f))===y)if(y=!y)p=h,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),m=h-1;m>=p;--m)s.point(_[m],j[m]);s.lineEnd(),s.areaEnd()}y&&(_[h]=+t(v,h,f),j[h]=+e(v,h,f),s.point(n?+n(v,h,f):_[h],r?+r(v,h,f):j[h]))}if(w)return s=null,w+""||null}function d(){return NM().defined(i).curve(o).context(a)}return u.x=function(f){return arguments.length?(t=typeof f=="function"?f:st(+f),n=null,u):t},u.x0=function(f){return arguments.length?(t=typeof f=="function"?f:st(+f),u):t},u.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:st(+f),u):n},u.y=function(f){return arguments.length?(e=typeof f=="function"?f:st(+f),r=null,u):e},u.y0=function(f){return arguments.length?(e=typeof f=="function"?f:st(+f),u):e},u.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:st(+f),u):r},u.lineX0=u.lineY0=function(){return d().x(t).y(e)},u.lineY1=function(){return d().x(t).y(r)},u.lineX1=function(){return d().x(n).y(e)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:st(!!f),u):i},u.curve=function(f){return arguments.length?(o=f,a!=null&&(s=o(a)),u):o},u.context=function(f){return arguments.length?(f==null?a=s=null:s=o(a=f),u):a},u}class CM{constructor(e,r){this._context=e,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,r){switch(e=+e,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,r,e,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,e,this._y0,e,r);break}}this._x0=e,this._y0=r}}function Fq(t){return new CM(t,!0)}function zq(t){return new CM(t,!1)}const Q0={draw(t,e){const r=Cn(e/id);t.moveTo(r,0),t.arc(0,0,r,0,ch)}}
8,qq={draw(t,e){const r=Cn(e/5)/2;t.moveTo(-3*r,-r),t.lineTo(-r,-r),t.lineTo(-r,-3*r),t.lineTo(r,-3*r),t.lineTo(r,-r),t.lineTo(3*r,-r),t.lineTo(3*r,r),t.lineTo(r,r),t.lineTo(r,3*r),t.lineTo(-r,3*r),t.lineTo(-r,r),t.lineTo(-3*r,r),t.closePath()}},kM=Cn(1/3),Uq=kM*2,Hq={draw(t,e){const r=Cn(e/Uq),n=r*kM;t.moveTo(0,-r),t.lineTo(n,0),t.lineTo(0,r),t.lineTo(-n,0),t.closePath()}},Wq={draw(t,e){const r=Cn(e),n=-r/2;t.rect(n,n,r,r)}},Vq=.8908130915292852,AM=nd(id/10)/nd(7*id/10),Kq=nd(ch/10)*AM,Gq=-wM(ch/10)*AM,Yq={draw(t,e){const r=Cn(e*Vq),n=Kq*r,i=Gq*r;t.moveTo(0,-r),t.lineTo(n,i);for(let a=1;a<5;++a){const o=ch*a/5,s=wM(o),l=nd(o);t.lineTo(l*r,-s*r),t.lineTo(s*n-l*i,l*n+s*i)}t.closePath()}},Im=Cn(3),Xq={draw(t,e){const r=-Cn(e/(Im*3));t.moveTo(0,r*2),t.lineTo(-Im*r,-r),t.lineTo(Im*r,-r),t.closePath()}},Yr=-.5,Xr=Cn(3)/2,bx=1/Cn(12),Jq=(bx/2+1)*3,Zq={draw(t,e){const r=Cn(e/Jq),n=r/2,i=r*bx,a=n,o=r*bx+r,s=-a,l=o;t.moveTo(n,i),t.lineTo(a,o),t.lineTo(s,l),t.lineTo(Yr*n-Xr*i,Xr*n+Yr*i),t.lineTo(Yr*a-Xr*o,Xr*a+Yr*o),t.lineTo(Yr*s-Xr*l,Xr*s+Yr*l),t.lineTo(Yr*n+Xr*i,Yr*i-Xr*n),t.lineTo(Yr*a+Xr*o,Yr*o-Xr*a),t.lineTo(Yr*s+Xr*l,Yr*l-Xr*s),t.closePath()}};function Qq(t,e){let r=null,n=J0(i);t=typeof t=="function"?t:st(t||Q0),e=typeof e=="function"?e:st(e===void 0?64:+e);function i(){let a;if(r||(r=a=n()),t.apply(this,arguments).draw(r,+e.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(t=typeof a=="function"?a:st(a),i):t},i.size=function(a){return arguments.length?(e=typeof a=="function"?a:st(+a),i):e},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function ad(){}function od(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function EM(t){this._context=t}EM.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:od(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:od(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function e6(t){return new EM(t)}function PM(t){this._context=t}PM.prototype={areaStart:ad,areaEnd:ad,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:od(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function t6(t){return new PM(t)}function TM(t){this._context=t}TM.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:od(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function r6(t){return new TM(t)}function MM(t){this._context=t}MM.prototype={areaStart:ad,areaEnd:ad,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function n6(t){return new MM(t)}function hS(t){return t<0?-1:1}function pS(t,e,r){var n=t._x1-t._x0,i=e-t._x1,a=(t._y1-t._y0)/(n||i<0&&-0),o=(r-t._y1)/(i||n<0&&-0),s=(a*i+o*n)/(n+i);
8return(hS(a)+hS(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function mS(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function $m(t,e,r){var n=t._x0,i=t._y0,a=t._x1,o=t._y1,s=(a-n)/3;t._context.bezierCurveTo(n+s,i+s*e,a-s,o-s*r,a,o)}function sd(t){this._context=t}sd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:$m(this,this._t0,mS(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var r=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,$m(this,mS(this,r=pS(this,t,e)),r);break;default:$m(this,this._t0,r=pS(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}}};function DM(t){this._context=new RM(t)}(DM.prototype=Object.create(sd.prototype)).point=function(t,e){sd.prototype.point.call(this,e,t)};function RM(t){this._context=t}RM.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,r,n,i,a){this._context.bezierCurveTo(e,t,n,r,a,i)}};function i6(t){return new sd(t)}function a6(t){return new DM(t)}function IM(t){this._context=t}IM.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,r=t.length;if(r)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),r===2)this._context.lineTo(t[1],e[1]);else for(var n=gS(t),i=gS(e),a=0,o=1;o<r;++a,++o)this._context.bezierCurveTo(n[0][a],i[0][a],n[1][a],i[1][a],t[o],e[o]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function gS(t){var e,r=t.length-1,n,i=new Array(r),a=new Array(r),o=new Array(r);for(i[0]=0,a[0]=2,o[0]=t[0]+2*t[1],e=1;e<r-1;++e)i[e]=1,a[e]=4,o[e]=4*t[e]+2*t[e+1];for(i[r-1]=2,a[r-1]=7,o[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=i[e]/a[e-1],a[e]-=n,o[e]-=n*o[e-1];for(i[r-1]=o[r-1]/a[r-1],e=r-2;e>=0;--e)i[e]=(o[e]-i[e+1])/a[e];for(a[r-1]=(t[r]+i[r-1])/2,e=0;e<r-1;++e)a[e]=2*t[e+1]-i[e+1];return[i,a]}function o6(t){return new IM(t)}function dh(t,e){this._context=t,this._t=e}dh.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}break}}this._x=t,this._y=e}};function s6(t){return new dh(t,.5)}function l6(t){return new dh(t,0)}function c6(t){return new dh(t,1)}function Xo(t,e){if((o=t.length)>1)for(var r=1,n,i,a=t[e[0]],o,s=a.length;r<o;++r)for(i=a,a=t[e[r]],n=0;n<s;++n)a[n][1]+=a[n][0]=isNaN(i[n][1])?i[n][0]:i[n][1]}function wx(t){for(var e=t.length,r=new Array(e);--e>=0;)r[e]=e;return r}function u6(t,e){return t[e]}function d6(t){const e=[];return e.key=t,e}function f6(){var t=st([]),e=wx,r=Xo,n=u6;function i(a){var o=Array.from(t.apply(this,arguments),d6),s,l=o.length,u=-1,d;for(const f of a)for(s=0,++u;s<l;++s)(o[s][u]=[0,+n(f,o[s].key,u,a)]).data=f;for(s=0,d=Z0(e(o));s<l;++s)o[d[s]].index=s;return r(o,d),o}return i.keys=function(a){return arguments.length?(t=typeof a=="function"?a:st(Array.from(a)),i):t},i.value=function(a){return arguments.length?(n=typeof a=="function"?a:st(+a),i):n},i.order=function(a){return arguments.length?(e=a==null?wx:typeof a=="function"?a:st(Array.from(a)),i):e},i.offset=function(a){return arguments.length?(r=a??Xo,i):r},i}function h6(t,e){if((n=t.length)>0){for(var r,n,i=0,a=t[0].length,o;i<a;++i){for(o=r=0;r<n;++r)o+=t[r][i][1]||0;if(o)for(r=0;r<n;++r)t[r][i][1]/=o}Xo(t,e)}}function p6(t,e){if((i=t.length)>0){for(var r=0,n=t[e[0]],i,a=n.length;r<a;++r){for(var o=0,s=0;o<i;++o)s+=t[o][r][1]||0;n[r][1]+=n[r][0]=-s/2}Xo(t,e)}}function m6(t,e){if(!(!((o=t.length)>0)||!((a=(i=t[e[0]]).length)>0))){for(var r=0,n=1,i,a,o;n<a;++n){for(var s=0,l=0,u=0;s<o;++s){for(var d=t[e[s]],f=d[n][1]||0,h=d[n-1][1]||0,p=(f-h)/2,m=0;m<s;++m){var g=t[e[m]],v=g[n][1]||0,y=g[n-1][1]||0;p+=v-y}l+=f,u+=p*f}i[n-1][1]+=i[n-1][0]=r,l&&(r-=u/l)}i[n-1][1]+=i[n-1][0]=r,Xo(t,e)}}function Ml(t){"@babel/helpers - typeof";
vendor: 62,844 bytes, lines 8-18
8return Ml=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ml(t)}var g6=["type","size","sizeType"];function _x(){return _x=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},_x.apply(this,arguments)}function vS(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function yS(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?vS(Object(r),!0).forEach(function(n){v6(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vS(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function v6(t,e,r){return e=y6(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function y6(t){var e=x6(t,"string");return Ml(e)=="symbol"?e:e+""}function x6(t,e){if(Ml(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Ml(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function b6(t,e){if(t==null)return{};var r=w6(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function w6(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var $M={symbolCircle:Q0,symbolCross:qq,symbolDiamond:Hq,symbolSquare:Wq,symbolStar:Yq,symbolTriangle:Xq,symbolWye:Zq},_6=Math.PI/180,S6=function(e){var r="symbol".concat(lh(e));return $M[r]||Q0},j6=function(e,r,n){if(r==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var i=18*_6;return 1.25*e*e*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},O6=function(e,r){$M["symbol".concat(lh(e))]=r},ew=function(e){var r=e.type,n=r===void 0?"circle":r,i=e.size,a=i===void 0?64:i,o=e.sizeType,s=o===void 0?"area":o,l=b6(e,g6),u=yS(yS({},l),{},{type:n,size:a,sizeType:s}),d=function(){var v=S6(n),y=Qq().type(v).size(j6(a,s,n));return y()},f=u.className,h=u.cx,p=u.cy,m=_e(u,!0);return h===+h&&p===+p&&a===+a?D.createElement("path",_x({},m,{className:Le("recharts-symbols",f),transform:"translate(".concat(h,", ").concat(p,")"),d:d()})):null};ew.registerSymbol=O6;function Jo(t){"@babel/helpers - typeof";return Jo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jo(t)}function Sx(){return Sx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Sx.apply(this,arguments)}function xS(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function N6(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?xS(Object(r),!0).forEach(function(n){Dl(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):xS(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function C6(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function k6(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,BM(n.key),n)}}function A6(t,e,r){return e&&k6(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function E6(t,e,r){return e=ld(e),P6(t,LM()?Reflect.construct(e,r||[],ld(t).constructor):e.apply(t,r))}function P6(t,e){if(e&&(Jo(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return T6(t)}function T6(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function LM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(LM=function(){return!!t})()}function ld(t){return ld=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ld(t)}function M6(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jx(t,e)}function jx(t,e){return jx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},jx(t,e)}function Dl(t,e,r){return e=BM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function BM(t){var e=D6(t,"string");return Jo(e)=="symbol"?e:e+""}function D6(t,e){if(Jo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Jo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Jr=32,tw=(function(t){function e(){return C6(this,e),E6(this,e,arguments)}return M6(e,t),A6(e,[{key:"renderIcon",value:function(n){var i=this.props.inactiveColor,a=Jr/2,o=Jr/6,s=Jr/3,l=n.inactive?i:n.color;if(n.type==="plainline")return D.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:n.payload.strokeDasharray,x1:0,y1:a,x2:Jr,y2:a,className:"recharts-legend-icon"});if(n.type==="line")return D.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(a,"h").concat(s,` 9 A`).concat(o,",").concat(o,",0,1,1,").concat(2*s,",").concat(a,` 10 H`).concat(Jr,"M").concat(2*s,",").concat(a,` 11 A`).concat(o,",").concat(o,",0,1,1,").concat(s,",").concat(a),className:"recharts-legend-icon"});if(n.type==="rect")return D.createElement("path",{stroke:"none",fill:l,d:"M0,".concat(Jr/8,"h").concat(Jr,"v").concat(Jr*3/4,"h").concat(-Jr,"z"),className:"recharts-legend-icon"});if(D.isValidElement(n.legendIcon)){var u=N6({},n);return delete u.legendIcon,D.cloneElement(n.legendIcon,u)}return D.createElement(ew,{fill:l,cx:a,cy:a,size:Jr,sizeType:"diameter",type:n.type})}},{key:"renderItems",value:function(){var n=this,i=this.props,a=i.payload,o=i.iconSize,s=i.layout,l=i.formatter,u=i.inactiveColor,d={x:0,y:0,width:Jr,height:Jr},f={display:s==="horizontal"?"inline-block":"block",marginRight:10},h={display:"inline-block",verticalAlign:"middle",marginRight:4};return a.map(function(p,m){var g=p.formatter||l,v=Le(Dl(Dl({"recharts-legend-item":!0},"legend-item-".concat(m),!0),"inactive",p.inactive));if(p.type==="none")return null;var y=ke(p.value)?null:p.value;On(!ke(p.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var w=p.inactive?u:p.color;return D.createElement("li",Sx({className:v,style:f,key:"legend-item-".concat(m)},Ka(n.props,p,m)),D.createElement(gx,{width:o,height:o,viewBox:d,style:h},n.renderIcon(p)),D.createElement("span",{className:"recharts-legend-item-text",style:{color:w}},g?g(y,p,m):y))})}},{key:"render",value:function(){var n=this.props,i=n.payload,a=n.layout,o=n.align;if(!i||!i.length)return null;var s={padding:0,margin:0,textAlign:a==="horizontal"?o:"left"};return D.createElement("ul",{className:"recharts-default-legend",style:s},this.renderItems())}}])})(x.PureComponent);Dl(tw,"displayName","Legend");Dl(tw,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var Lm,bS;function R6(){if(bS)return Lm;bS=1;var t=ah();function e(){this.__data__=new t,this.size=0}return Lm=e,Lm}var Bm,wS;function I6(){if(wS)return Bm;wS=1;function t(e){var r=this.__data__,n=r.delete(e);return this.size=r.size,n}return Bm=t,Bm}var Fm,_S;function $6(){if(_S)return Fm;_S=1;function t(e){return this.__data__.get(e)}return Fm=t,Fm}var zm,SS;function L6(){if(SS)return zm;SS=1;function t(e){return this.__data__.has(e)}return zm=t,zm}var qm,jS;function B6(){if(jS)return qm;jS=1;var t=ah(),e=W0(),r=V0(),n=200;function i(a,o){var s=this.__data__;if(s instanceof t){var l=s.__data__;if(!e||l.length<n-1)return l.push([a,o]),this.size=++s.size,this;s=this.__data__=new r(l)}return s.set(a,o),this.size=s.size,this}return qm=i,qm}var Um,OS;function FM(){if(OS)return Um;OS=1;var t=ah(),e=R6(),r=I6(),n=$6(),i=L6(),a=B6();function o(s){var l=this.__data__=new t(s);this.size=l.size}return o.prototype.clear=e,o.prototype.delete=r,o.prototype.get=n,o.prototype.has=i,o.prototype.set=a,Um=o,Um}var Hm,NS;function F6(){if(NS)return Hm;NS=1;var t="__lodash_hash_undefined__";function e(r){return this.__data__.set(r,t),this}return Hm=e,Hm}var Wm,CS;function z6(){if(CS)return Wm;CS=1;function t(e){return this.__data__.has(e)}return Wm=t,Wm}var Vm,kS;function zM(){if(kS)return Vm;kS=1;var t=V0(),e=F6(),r=z6();function n(i){var a=-1,o=i==null?0:i.length;for(this.__data__=new t;++a<o;)this.add(i[a])}return n.prototype.add=n.prototype.push=e,n.prototype.has=r,Vm=n,Vm}var Km,AS;function qM(){if(AS)return Km;AS=1;function t(e,r){for(var n=-1,i=e==null?0:e.length;++n<i;)if(r(e[n],n,e))return!0;return!1}return Km=t,Km}var Gm,ES;function UM(){if(ES)return Gm;ES=1;function t(e,r){return e.has(r)}return Gm=t,Gm}var Ym,PS;function HM(){if(PS)return Ym;PS=1;var t=zM(),e=qM(),r=UM(),n=1,i=2;function a(o,s,l,u,d,f){var h=l&n,p=o.length,m=s.length;if(p!=m&&!(h&&m>p))return!1;var g=f.get(o),v=f.get(s);if(g&&v)return g==s&&v==o;var y=-1,w=!0,_=l&i?new t:void 0;for(f.set(o,s),f.set(s,o);++y<p;){var j=o[y],b=s[y];if(u)var O=h?u(b,j,y,s,o,f):u(j,b,y,o,s,f);if(O!==void 0){if(O)continue;w=!1;break}if(_){if(!e(s,function(S,N){if(!r(_,N)&&(j===S||d(j,S,l,u,f)))return _.push(N)})){w=!1;break}}else if(!(j===b||d(j,b,l,u,f))){w=!1;break}}return f.delete(o),f.delete(s),w}return Ym=a,Ym}var Xm,TS;function q6(){if(TS)return Xm;TS=1;var t=Yn(),e=t.Uint8Array;return Xm=e,Xm}var Jm,MS;function U6(){if(MS)return Jm;MS=1;function t(e){var r=-1,n=Array(e.size);return e.forEach(function(i,a){n[++r]=[a,i]}),n}return Jm=t,Jm}var Zm,DS;function rw(){if(DS)return Zm;DS=1;function t(e){var r=-1,n=Array(e.size);return e.forEach(function(i){n[++r]=i}),n}return Zm=t,Zm}var Qm,RS;function H6(){if(RS)return Qm;RS=1;var t=Tc(),e=q6(),r=H0(),n=HM(),i=U6(),a=rw(),o=1,s=2,l="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Map]",h="[object Number]",p="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",y="[object ArrayBuffer]",w="[object DataView]",_=t?t.prototype:void 0,j=_?_.valueOf:void 0;function b(O,S,N,C,T,k,M){switch(N){case w:if(O.byteLength!=S.byteLength||O.byteOffset!=S.byteOffset)return!1;O=O.buffer,S=S.buffer;case y:return!(O.byteLength!=S.byteLength||!k(new e(O),new e(S)));case l:case u:case h:return r(+O,+S);case d:return O.name==S.name&&O.message==S.message;case p:case g:return O==S+"";case f:var E=i;case m:var L=C&o;if(E||(E=a),O.size!=S.size&&!L)return!1;var R=M.get(O);if(R)return R==S;C|=s,M.set(O,S);var I=n(E(O),E(S),C,T,k,M);return M.delete(O),I;case v:if(j)return j.call(O)==j.call(S)}return!1}return Qm=b,Qm}var eg,IS;function WM(){if(IS)return eg;IS=1;function t(e,r){for(var n=-1,i=r.length,a=e.length;++n<i;)e[a+n]=r[n];return e}return eg=t,eg}var tg,$S;function W6(){if($S)return tg;$S=1;var t=WM(),e=Mr();function r(n,i,a){var o=i(n);return e(n)?o:t(o,a(n))}return tg=r,tg}var rg,LS;function V6(){if(LS)return rg;LS=1;function t(e,r){for(var n=-1,i=e==null?0:e.length,a=0,o=[];++n<i;){var s=e[n];r(s,n,e)&&(o[a++]=s)}return o}return rg=t,rg}var ng,BS;function K6(){if(BS)return ng;BS=1;function t(){return[]}return ng=t,ng}var ig,FS;function G6(){if(FS)return ig;FS=1;var t=V6(),e=K6(),r=Object.prototype,n=r.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(o){return o==null?[]:(o=Object(o),t(i(o),function(s){return n.call(o,s)}))}:e;return ig=a,ig}var ag,zS;function Y6(){if(zS)return ag;zS=1;function t(e,r){for(var n=-1,i=Array(e);++n<e;)i[n]=r(n);return i}return ag=t,ag}var og,qS;function X6(){if(qS)return og;qS=1;var t=Oi(),e=Ni(),r="[object Arguments]";function n(i){return e(i)&&t(i)==r}return og=n,og}var sg,US;function nw(){if(US)return sg;US=1;var t=X6(),e=Ni(),r=Object.prototype,n=r.hasOwnProperty,i=r.propertyIsEnumerable,a=t((function(){return arguments})())?t:function(o){return e(o)&&n.call(o,"callee")&&!i.call(o,"callee")};return sg=a,sg}var il={exports:{}},lg,HS;function J6(){if(HS)return lg;HS=1;function t(){return!1}return lg=t,lg}il.exports;var WS;function VM(){return WS||(WS=1,(function(t,e){var r=Yn(),n=J6(),i=e&&!e.nodeType&&e,a=i&&!0&&t&&!t.nodeType&&t,o=a&&a.exports===i,s=o?r.Buffer:void 0,l=s?s.isBuffer:void 0,u=l||n;t.exports=u})(il,il.exports)),il.exports}var cg,VS;function iw(){if(VS)return cg;VS=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function r(n,i){var a=typeof n;return i=i??t,!!i&&(a=="number"||a!="symbol"&&e.test(n))&&n>-1&&n%1==0&&n<i}return cg=r,cg}var ug,KS;function aw(){if(KS)return ug;KS=1;var t=9007199254740991;function e(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=t}return ug=e,ug}var dg,GS;function Z6(){if(GS)return dg;GS=1;var t=Oi(),e=aw(),r=Ni(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",o="[object Date]",s="[object Error]",l="[object Function]",u="[object Map]",d="[object Number]",f="[object Object]",h="[object RegExp]",p="[object Set]",m="[object String]",g="[object WeakMap]",v="[object ArrayBuffer]",y="[object DataView]",w="[object Float32Array]",_="[object Float64Array]",j="[object Int8Array]",b="[object Int16Array]",O="[object Int32Array]",S="[object Uint8Array]",N="[object Uint8ClampedArray]",C="[object Uint16Array]",T="[object Uint32Array]",k={};k[w]=k[_]=k[j]=k[b]=k[O]=k[S]=k[N]=k[C]=k[T]=!0,k[n]=k[i]=k[v]=k[a]=k[y]=k[o]=k[s]=k[l]=k[u]=k[d]=k[f]=k[h]=k[p]=k[m]=k[g]=!1;function M(E){return r(E)&&e(E.length)&&!!k[t(E)]}return dg=M,dg}var fg,YS;function KM(){if(YS)return fg;YS=1;function t(e){return function(r){return e(r)}}return fg=t,fg}var al={exports:{}};al.exports;var XS;function Q6(){return XS||(XS=1,(function(t,e){var r=hM(),n=e&&!e.nodeType&&e,i=n&&!0&&t&&!t.nodeType&&t,a=i&&i.exports===n,o=a&&r.process,s=(function(){try{var l=i&&i.require&&i.require("util").types;return l||o&&o.binding&&o.binding("util")}catch{}})();t.exports=s})(al,al.exports)),al.exports}var hg,JS;function GM(){if(JS)return hg;JS=1;var t=Z6(),e=KM(),r=Q6(),n=r&&r.isTypedArray,i=n?e(n):t;return hg=i,hg}var pg,ZS;function eU(){if(ZS)return pg;ZS=1;var t=Y6(),e=nw(),r=Mr(),n=VM(),i=iw(),a=GM(),o=Object.prototype,s=o.hasOwnProperty;function l(u,d){var f=r(u),h=!f&&e(u),p=!f&&!h&&n(u),m=!f&&!h&&!p&&a(u),g=f||h||p||m,v=g?t(u.length,String):[],y=v.length;for(var w in u)(d||s.call(u,w))&&!(g&&(w=="length"||p&&(w=="offset"||w=="parent")||m&&(w=="buffer"||w=="byteLength"||w=="byteOffset")||i(w,y)))&&v.push(w);return v}return pg=l,pg}var mg,QS;function tU(){if(QS)return mg;QS=1;var t=Object.prototype;function e(r){var n=r&&r.constructor,i=typeof n=="function"&&n.prototype||t;return r===i}return mg=e,mg}var gg,ej;function YM(){if(ej)return gg;ej=1;function t(e,r){return function(n){return e(r(n))}}return gg=t,gg}var vg,tj;function rU(){if(tj)return vg;tj=1;var t=YM(),e=t(Object.keys,Object);return vg=e,vg}var yg,rj;function nU(){if(rj)return yg;rj=1;var t=tU(),e=rU(),r=Object.prototype,n=r.hasOwnProperty;function i(a){if(!t(a))return e(a);var o=[];for(var s in Object(a))n.call(a,s)&&s!="constructor"&&o.push(s);return o}return yg=i,yg}var xg,nj;function Dc(){if(nj)return xg;nj=1;var t=U0(),e=aw();function r(n){return n!=null&&e(n.length)&&!t(n)}return xg=r,xg}var bg,ij;function fh(){if(ij)return bg;ij=1;var t=eU(),e=nU(),r=Dc();function n(i){return r(i)?t(i):e(i)}return bg=n,bg}var wg,aj;function iU(){if(aj)return wg;aj=1;var t=W6(),e=G6(),r=fh();function n(i){return t(i,r,e)}return wg=n,wg}var _g,oj;function aU(){if(oj)return _g;oj=1;var t=iU(),e=1,r=Object.prototype,n=r.hasOwnProperty;function i(a,o,s,l,u,d){var f=s&e,h=t(a),p=h.length,m=t(o),g=m.length;if(p!=g&&!f)return!1;for(var v=p;v--;){var y=h[v];if(!(f?y in o:n.call(o,y)))return!1}var w=d.get(a),_=d.get(o);if(w&&_)return w==o&&_==a;var j=!0;d.set(a,o),d.set(o,a);for(var b=f;++v<p;){y=h[v];var O=a[y],S=o[y];if(l)var N=f?l(S,O,y,o,a,d):l(O,S,y,a,o,d);if(!(N===void 0?O===S||u(O,S,s,l,d):N)){j=!1;break}b||(b=y=="constructor")}if(j&&!b){var C=a.constructor,T=o.constructor;C!=T&&"constructor"in a&&"constructor"in o&&!(typeof C=="function"&&C instanceof C&&typeof T=="function"&&T instanceof T)&&(j=!1)}return d.delete(a),d.delete(o),j}return _g=i,_g}var Sg,sj;function oU(){if(sj)return Sg;sj=1;var t=io(),e=Yn(),r=t(e,"DataView");return Sg=r,Sg}var jg,lj;function sU(){if(lj)return jg;lj=1;var t=io(),e=Yn(),r=t(e,"Promise");return jg=r,jg}var Og,cj;function XM(){if(cj)return Og;cj=1;var t=io(),e=Yn(),r=t(e,"Set");return Og=r,Og}var Ng,uj;function lU(){if(uj)return Ng;uj=1;var t=io(),e=Yn(),r=t(e,"WeakMap");return Ng=r,Ng}var Cg,dj;function cU(){if(dj)return Cg;dj=1;var t=oU(),e=W0(),r=sU(),n=XM(),i=lU(),a=Oi(),o=pM(),s="[object Map]",l="[object Object]",u="[object Promise]",d="[object Set]",f="[object WeakMap]",h="[object DataView]",p=o(t),m=o(e),g=o(r),v=o(n),y=o(i),w=a;return(t&&w(new t(new ArrayBuffer(1)))!=h||e&&w(new e)!=s||r&&w(r.resolve())!=u||n&&w(new n)!=d||i&&w(new i)!=f)&&(w=function(_){var j=a(_),b=j==l?_.constructor:void 0,O=b?o(b):"";if(O)switch(O){case p:return h;case m:return s;case g:return u;case v:return d;case y:return f}return j}),Cg=w,Cg}var kg,fj;function uU(){if(fj)return kg;fj=1;var t=FM(),e=HM(),r=H6(),n=aU(),i=cU(),a=Mr(),o=VM(),s=GM(),l=1,u="[object Arguments]",d="[object Array]",f="[object Object]",h=Object.prototype,p=h.hasOwnProperty;function m(g,v,y,w,_,j){var b=a(g),O=a(v),S=b?d:i(g),N=O?d:i(v);S=S==u?f:S,N=N==u?f:N;var C=S==f,T=N==f,k=S==N;if(k&&o(g)){if(!o(v))return!1;b=!0,C=!1}if(k&&!C)return j||(j=new t),b||s(g)?e(g,v,y,w,_,j):r(g,v,S,y,w,_,j);if(!(y&l)){var M=C&&p.call(g,"__wrapped__"),E=T&&p.call(v,"__wrapped__");if(M||E){var L=M?g.value():g,R=E?v.value():v;return j||(j=new t),_(L,R,y,w,j)}}return k?(j||(j=new t),n(g,v,y,w,_,j)):!1}return kg=m,kg}var Ag,hj;function ow(){if(hj)return Ag;hj=1;var t=uU(),e=Ni();function r(n,i,a,o,s){return n===i?!0:n==null||i==null||!e(n)&&!e(i)?n!==n&&i!==i:t(n,i,a,o,r,s)}return Ag=r,Ag}var Eg,pj;function dU(){if(pj)return Eg;pj=1;var t=FM(),e=ow(),r=1,n=2;function i(a,o,s,l){var u=s.length,d=u,f=!l;if(a==null)return!d;for(a=Object(a);u--;){var h=s[u];if(f&&h[2]?h[1]!==a[h[0]]:!(h[0]in a))return!1}for(;++u<d;){h=s[u];var p=h[0],m=a[p],g=h[1];if(f&&h[2]){if(m===void 0&&!(p in a))return!1}else{var v=new t;if(l)var y=l(m,g,p,a,o,v);if(!(y===void 0?e(g,m,r|n,l,v):y))return!1}}return!0}return Eg=i,Eg}var Pg,mj;function JM(){if(mj)return Pg;mj=1;var t=ra();function e(r){return r===r&&!t(r)}return Pg=e,Pg}var Tg,gj;function fU(){if(gj)return Tg;gj=1;var t=JM(),e=fh();function r(n){for(var i=e(n),a=i.length;a--;){var o=i[a],s=n[o];i[a]=[o,s,t(s)]}return i}return Tg=r,Tg}var Mg,vj;function ZM(){if(vj)return Mg;vj=1;function t(e,r){return function(n){return n==null?!1:n[e]===r&&(r!==void 0||e in Object(n))}}return Mg=t,Mg}var Dg,yj;function hU(){if(yj)return Dg;yj=1;var t=dU(),e=fU(),r=ZM();function n(i){var a=e(i);return a.length==1&&a[0][2]?r(a[0][0],a[0][1]):function(o){return o===i||t(o,i,a)}}return Dg=n,Dg}var Rg,xj;function pU(){if(xj)return Rg;xj=1;function t(e,r){return e!=null&&r in Object(e)}return Rg=t,Rg}var Ig,bj;function mU(){if(bj)return Ig;bj=1;var t=vM(),e=nw(),r=Mr(),n=iw(),i=aw(),a=sh();function o(s,l,u){l=t(l,s);for(var d=-1,f=l.length,h=!1;++d<f;){var p=a(l[d]);if(!(h=s!=null&&u(s,p)))break;s=s[p]}return h||++d!=f?h:(f=s==null?0:s.length,!!f&&i(f)&&n(p,f)&&(r(s)||e(s)))}return Ig=o,Ig}var $g,wj;function gU(){if(wj)return $g;wj=1;var t=pU(),e=mU();function r(n,i){return n!=null&&e(n,i,t)}return $g=r,$g}var Lg,_j;function vU(){if(_j)return Lg;_j=1;var t=ow(),e=yM(),r=gU(),n=q0(),i=JM(),a=ZM(),o=sh(),s=1,l=2;function u(d,f){return n(d)&&i(f)?a(o(d),f):function(h){var p=e(h,d);return p===void 0&&p===f?r(h,d):t(f,p,s|l)}}return Lg=u,Lg}var Bg,Sj;function Is(){if(Sj)return Bg;Sj=1;function t(e){return e}return Bg=t,Bg}var Fg,jj;function yU(){if(jj)return Fg;jj=1;function t(e){return function(r){return r?.[e]}}return Fg=t,Fg}var zg,Oj;function xU(){if(Oj)return zg;Oj=1;var t=G0();function e(r){return function(n){return t(n,r)}}return zg=e,zg}var qg,Nj;function bU(){if(Nj)return qg;Nj=1;var t=yU(),e=xU(),r=q0(),n=sh();function i(a){return r(a)?t(n(a)):e(a)}return qg=i,qg}var Ug,Cj;function Xn(){if(Cj)return Ug;Cj=1;var t=hU(),e=vU(),r=Is(),n=Mr(),i=bU();function a(o){return typeof o=="function"?o:o==null?r:typeof o=="object"?n(o)?e(o[0],o[1]):t(o):i(o)}return Ug=a,Ug}var Hg,kj;function QM(){if(kj)return Hg;kj=1;function t(e,r,n,i){for(var a=e.length,o=n+(i?1:-1);i?o--:++o<a;)if(r(e[o],o,e))return o;return-1}return Hg=t,Hg}var Wg,Aj;function wU(){if(Aj)return Wg;Aj=1;function t(e){return e!==e}return Wg=t,Wg}var Vg,Ej;function _U(){if(Ej)return Vg;Ej=1;function t(e,r,n){for(var i=n-1,a=e.length;++i<a;)if(e[i]===r)return i;return-1}return Vg=t,Vg}var Kg,Pj;function SU(){if(Pj)return Kg;Pj=1;var t=QM(),e=wU(),r=_U();function n(i,a,o){return a===a?r(i,a,o):t(i,e,o)}return Kg=n,Kg}var Gg,Tj;function jU(){if(Tj)return Gg;Tj=1;var t=SU();function e(r,n){var i=r==null?0:r.length;return!!i&&t(r,n,0)>-1}return Gg=e,Gg}var Yg,Mj;function OU(){if(Mj)return Yg;Mj=1;function t(e,r,n){for(var i=-1,a=e==null?0:e.length;++i<a;)if(n(r,e[i]))return!0;return!1}return Yg=t,Yg}var Xg,Dj;function NU(){if(Dj)return Xg;Dj=1;function t(){}return Xg=t,Xg}var Jg,Rj;function CU(){if(Rj)return Jg;Rj=1;var t=XM(),e=NU(),r=rw(),n=1/0,i=t&&1/r(new t([,-0]))[1]==n?function(a){return new t(a)}:e;return Jg=i,Jg}var Zg,Ij;function kU(){if(Ij)return Zg;Ij=1;var t=zM(),e=jU(),r=OU(),n=UM(),i=CU(),a=rw(),o=200;function s(l,u,d){var f=-1,h=e,p=l.length,m=!0,g=[],v=g;if(d)m=!1,h=r;else if(p>=o){var y=u?null:i(l);if(y)return a(y);m=!1,h=n,v=new t}else v=u?[]:g;e:for(;++f<p;){var w=l[f],_=u?u(w):w;if(w=d||w!==0?w:0,m&&_===_){for(var j=v.length;j--;)if(v[j]===_)continue e;u&&v.push(_),g.push(w)}else h(v,_,d)||(v!==g&&v.push(_),g.push(w))}return g}return Zg=s,Zg}var Qg,$j;function AU(){if($j)return Qg;$j=1;var t=Xn(),e=kU();function r(n,i){return n&&n.length?e(n,t(i,2)):[]}return Qg=r,Qg}var EU=AU();const Lj=at(EU);function e2(t,e,r){return e===!0?Lj(t,r):ke(e)?Lj(t,e):t}function Zo(t){"@babel/helpers - typeof";return Zo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zo(t)}var PU=["ref"];function Bj(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Qn(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Bj(Object(r),!0).forEach(function(n){hh(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Bj(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function TU(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Fj(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,r2(n.key),n)}}function MU(t,e,r){return e&&Fj(t.prototype,e),r&&Fj(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function DU(t,e,r){return e=cd(e),RU(t,t2()?Reflect.construct(e,r||[],cd(t).constructor):e.apply(t,r))}function RU(t,e){if(e&&(Zo(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return IU(t)}function IU(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function t2(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(t2=function(){return!!t})()}function cd(t){return cd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},cd(t)}function $U(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ox(t,e)}function Ox(t,e){return Ox=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Ox(t,e)}function hh(t,e,r){return e=r2(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function r2(t){var e=LU(t,"string");return Zo(e)=="symbol"?e:e+""}function LU(t,e){if(Zo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Zo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function BU(t,e){if(t==null)return{};var r=FU(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function FU(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function zU(t){return t.value}function qU(t,e){if(D.isValidElement(t))return D.cloneElement(t,e);if(typeof t=="function")return D.createElement(t,e);e.ref;var r=BU(e,PU);return D.createElement(tw,r)}var zj=1,Da=(function(t){function e(){var r;TU(this,e);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return r=DU(this,e,[].concat(i)),hh(r,"lastBoundingBox",{width:-1,height:-1}),r}return $U(e,t),MU(e,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();return n.height=this.wrapperNode.offsetHeight,n.width=this.wrapperNode.offsetWidth,n}return null}},{key:"updateBBox",value:function(){var n=this.props.onBBoxUpdate,i=this.getBBox();i?(Math.abs(i.width-this.lastBoundingBox.width)>zj||Math.abs(i.height-this.lastBoundingBox.height)>zj)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,n&&n(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Qn({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var i=this.props,a=i.layout,o=i.align,s=i.verticalAlign,l=i.margin,u=i.chartWidth,d=i.chartHeight,f,h;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(o==="center"&&a==="vertical"){var p=this.getBBoxSnapshot();f={left:((u||0)-p.width)/2}}else f=o==="right"?{right:l&&l.right||0}:{left:l&&l.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(s==="middle"){var m=this.getBBoxSnapshot();h={top:((d||0)-m.height)/2}}else h=s==="bottom"?{bottom:l&&l.bottom||0}:{top:l&&l.top||0};return Qn(Qn({},f),h)}},{key:"render",value:function(){var n=this,i=this.props,a=i.content,o=i.width,s=i.height,l=i.wrapperStyle,u=i.payloadUniqBy,d=i.payload,f=Qn(Qn({position:"absolute",width:o||"auto",height:s||"auto"},this.getDefaultPosition(l)),l);return D.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(p){n.wrapperNode=p}},qU(a,Qn(Qn({},this.props),{},{payload:e2(d,u,zU)})))}}],[{key:"getWithHeight",value:function(n,i){var a=Qn(Qn({},this.defaultProps),n.props),o=a.layout;return o==="vertical"&&ie(n.props.height)?{height:n.props.height}:o==="horizontal"?{width:n.props.width||i}:null}}])})(x.PureComponent);hh(Da,"displayName","Legend");hh(Da,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var ev,qj;function UU(){if(qj)return ev;qj=1;var t=Tc(),e=nw(),r=Mr(),n=t?t.isConcatSpreadable:void 0;function i(a){return r(a)||e(a)||!!(n&&a&&a[n])}return ev=i,ev}var tv,Uj;function n2(){if(Uj)return tv;Uj=1;var t=WM(),e=UU();function r(n,i,a,o,s){var l=-1,u=n.length;for(a||(a=e),s||(s=[]);++l<u;){var d=n[l];i>0&&a(d)?i>1?r(d,i-1,a,o,s):t(s,d):o||(s[s.length]=d)}return s}return tv=r,tv}var rv,Hj;function HU(){if(Hj)return rv;Hj=1;function t(e){return function(r,n,i){for(var a=-1,o=Object(r),s=i(r),l=s.length;l--;){var u=s[e?l:++a];if(n(o[u],u,o)===!1)break}return r}}return rv=t,rv}var nv,Wj;function WU(){if(Wj)return nv;Wj=1;var t=HU(),e=t();return nv=e,nv}var iv,Vj;function i2(){if(Vj)return iv;Vj=1;var t=WU(),e=fh();function r(n,i){return n&&t(n,i,e)}return iv=r,iv}var av,Kj;function VU(){if(Kj)return av;Kj=1;var t=Dc();function e(r,n){return function(i,a){if(i==null)return i;if(!t(i))return r(i,a);for(var o=i.length,s=n?o:-1,l=Object(i);(n?s--:++s<o)&&a(l[s],s,l)!==!1;);return i}}return av=e,av}var ov,Gj;function sw(){if(Gj)return ov;Gj=1;var t=i2(),e=VU(),r=e(t);return ov=r,ov}var sv,Yj;function a2(){if(Yj)return sv;Yj=1;var t=sw(),e=Dc();function r(n,i){var a=-1,o=e(n)?Array(n.length):[];return t(n,function(s,l,u){o[++a]=i(s,l,u)}),o}return sv=r,sv}var lv,Xj;function KU(){if(Xj)return lv;Xj=1;function t(e,r){var n=e.length;for(e.sort(r);n--;)e[n]=e[n].value;return e}return lv=t,lv}var cv,Jj;function GU(){if(Jj)return cv;Jj=1;var t=Ms();function e(r,n){if(r!==n){var i=r!==void 0,a=r===null,o=r===r,s=t(r),l=n!==void 0,u=n===null,d=n===n,f=t(n);if(!u&&!f&&!s&&r>n||s&&l&&d&&!u&&!f||a&&l&&d||!i&&d||!o)return 1;if(!a&&!s&&!f&&r<n||f&&i&&o&&!a&&!s||u&&i&&o||!l&&o||!d)return-1}return 0}return cv=e,cv}var uv,Zj;function YU(){if(Zj)return uv;Zj=1;var t=GU();function e(r,n,i){for(var a=-1,o=r.criteria,s=n.criteria,l=o.length,u=i.length;++a<l;){var d=t(o[a],s[a]);if(d){if(a>=u)return d;var f=i[a];return d*(f=="desc"?-1:1)}}return r.index-n.index}return uv=e,uv}var dv,Qj;function XU(){if(Qj)return dv;Qj=1;var t=K0(),e=G0(),r=Xn(),n=a2(),i=KU(),a=KM(),o=YU(),s=Is(),l=Mr();function u(d,f,h){f.length?f=t(f,function(g){return l(g)?function(v){return e(v,g.length===1?g[0]:g)}:g}):f=[s];var p=-1;f=t(f,a(r));var m=n(d,function(g,v,y){var w=t(f,function(_){return _(g)});return{criteria:w,index:++p,value:g}});return i(m,function(g,v){return o(g,v,h)})}return dv=u,dv}var fv,eO;function JU(){if(eO)return fv;eO=1;function t(e,r,n){switch(n.length){case 0:return e.call(r);case 1:return e.call(r,n[0]);case 2:return e.call(r,n[0],n[1]);case 3:return e.call(r,n[0],n[1],n[2])}return e.apply(r,n)}return fv=t,fv}var hv,tO;function ZU(){if(tO)return hv;tO=1;var t=JU(),e=Math.max;function r(n,i,a){return i=e(i===void 0?n.length-1:i,0),function(){for(var o=arguments,s=-1,l=e(o.length-i,0),u=Array(l);++s<l;)u[s]=o[i+s];s=-1;for(var d=Array(i+1);++s<i;)d[s]=o[s];return d[i]=a(u),t(n,this,d)}}return hv=r,hv}var pv,rO;function QU(){if(rO)return pv;rO=1;function t(e){return function(){return e}}return pv=t,pv}var mv,nO;function o2(){if(nO)return mv;nO=1;var t=io(),e=(function(){try{var r=t(Object,"defineProperty");return r({},"",{}),r}catch{}})();return mv=e,mv}var gv,iO;function eH(){if(iO)return gv;iO=1;var t=QU(),e=o2(),r=Is(),n=e?function(i,a){return e(i,"toString",{configurable:!0,enumerable:!1,value:t(a),writable:!0})}:r;return gv=n,gv}var vv,aO;function tH(){if(aO)return vv;aO=1;var t=800,e=16,r=Date.now;function n(i){var a=0,o=0;return function(){var s=r(),l=e-(s-o);if(o=s,l>0){if(++a>=t)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return vv=n,vv}var yv,oO;function rH(){if(oO)return yv;oO=1;var t=eH(),e=tH(),r=e(t);return yv=r,yv}var xv,sO;function nH(){if(sO)return xv;sO=1;var t=Is(),e=ZU(),r=rH();function n(i,a){return r(e(i,a,t),i+"")}return xv=n,xv}var bv,lO;function ph(){if(lO)return bv;lO=1;var t=H0(),e=Dc(),r=iw(),n=ra();function i(a,o,s){if(!n(s))return!1;var l=typeof o;return(l=="number"?e(s)&&r(o,s.length):l=="string"&&o in s)?t(s[o],a):!1}return bv=i,bv}var wv,cO;function iH(){if(cO)return wv;cO=1;var t=n2(),e=XU(),r=nH(),n=ph(),i=r(function(a,o){if(a==null)return[];var s=o.length;return s>1&&n(a,o[0],o[1])?o=[]:s>2&&n(o[0],o[1],o[2])&&(o=[o[0]]),e(a,t(o,1),[])});return wv=i,wv}var aH=iH();const lw=at(aH);function Rl(t){"@babel/helpers - typeof";return Rl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Rl(t)}function Nx(){return Nx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Nx.apply(this,arguments)}function oH(t,e){return uH(t)||cH(t,e)||lH(t,e)||sH()}function sH(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 12In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lH(t,e){if(t){if(typeof t=="string")return uO(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return uO(t,e)}}function uO(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function cH(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}function uH(t){if(Array.isArray(t))return t}function dO(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function _v(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?dO(Object(r),!0).forEach(function(n){dH(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):dO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function dH(t,e,r){return e=fH(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fH(t){var e=hH(t,"string");return Rl(e)=="symbol"?e:e+""}function hH(t,e){if(Rl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Rl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function pH(t){return Array.isArray(t)&&Bt(t[0])&&Bt(t[1])?t.join(" ~ "):t}var mH=function(e){var r=e.separator,n=r===void 0?" : ":r,i=e.contentStyle,a=i===void 0?{}:i,o=e.itemStyle,s=o===void 0?{}:o,l=e.labelStyle,u=l===void 0?{}:l,d=e.payload,f=e.formatter,h=e.itemSorter,p=e.wrapperClassName,m=e.labelClassName,g=e.label,v=e.labelFormatter,y=e.accessibilityLayer,w=y===void 0?!1:y,_=function(){if(d&&d.length){var M={padding:0,margin:0},E=(h?lw(d,h):d).map(function(L,R){if(L.type==="none")return null;var I=_v({display:"block",paddingTop:4,paddingBottom:4,color:L.color||"#000"},s),$=L.formatter||f||pH,A=L.value,F=L.name,V=A,te=F;if($&&V!=null&&te!=null){var B=$(A,F,L,R,d);if(Array.isArray(B)){var G=oH(B,2);V=G[0],te=G[1]}else V=B}return D.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(R),style:I},Bt(te)?D.createElement("span",{className:"recharts-tooltip-item-name"},te):null,Bt(te)?D.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,D.createElement("span",{className:"recharts-tooltip-item-value"},V),D.createElement("span",{className:"recharts-tooltip-item-unit"},L.unit||""))});return D.createElement("ul",{className:"recharts-tooltip-item-list",style:M},E)}return null},j=_v({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},a),b=_v({margin:0},u),O=!Me(g),S=O?g:"",N=Le("recharts-default-tooltip",p),C=Le("recharts-tooltip-label",m);O&&v&&d!==void 0&&d!==null&&(S=v(g,d));var T=w?{role:"status","aria-live":"assertive"}:{};return D.createElement("div",Nx({className:N,style:j},T),D.createElement("p",{className:C,style:b},D.isValidElement(S)?S:"".concat(S)),_())};function Il(t){"@babel/helpers - typeof";return Il=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Il(t)}function ru(t,e,r){return e=gH(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function gH(t){var e=vH(t,"string");return Il(e)=="symbol"?e:e+""}function vH(t,e){if(Il(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Il(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Vs="recharts-tooltip-wrapper",yH={visibility:"hidden"};function xH(t){var e=t.coordinate,r=t.translateX,n=t.translateY;return Le(Vs,ru(ru(ru(ru({},"".concat(Vs,"-right"),ie(r)&&e&&ie(e.x)&&r>=e.x),"".concat(Vs,"-left"),ie(r)&&e&&ie(e.x)&&r<e.x),"".concat(Vs,"-bottom"),ie(n)&&e&&ie(e.y)&&n>=e.y),"".concat(Vs,"-top"),ie(n)&&e&&ie(e.y)&&n<e.y))}function fO(t){var e=t.allowEscapeViewBox,r=t.coordinate,n=t.key,i=t.offsetTopLeft,a=t.position,o=t.reverseDirection,s=t.tooltipDimension,l=t.viewBox,u=t.viewBoxDimension;if(a&&ie(a[n]))return a[n];var d=r[n]-s-i,f=r[n]+i;if(e[n])return o[n]?d:f;if(o[n]){var h=d,p=l[n];return h<p?Math.max(f,l[n]):Math.max(d,l[n])}var m=f+s,g=l[n]+u;return m>g?Math.max(d,l[n]):Math.max(f,l[n])}function bH(t){var e=t.translateX,r=t.translateY,n=t.useTranslate3d;return{transform:n?"translate3d(".concat(e,"px, ").concat(r,"px, 0)"):"translate(".concat(e,"px, ").concat(r,"px)")}}function wH(t){var e=t.allowEscapeViewBox,r=t.coordinate,n=t.offsetTopLeft,i=t.position,a=t.reverseDirection,o=t.tooltipBox,s=t.useTranslate3d,l=t.viewBox,u,d,f;return o.height>0&&o.width>0&&r?(d=fO({allowEscapeViewBox:e,coordinate:r,key:"x",offsetTopLeft:n,position:i,reverseDirection:a,tooltipDimension:o.width,viewBox:l,viewBoxDimension:l.width}),f=fO({allowEscapeViewBox:e,coordinate:r,key:"y",offsetTopLeft:n,position:i,reverseDirection:a,tooltipDimension:o.height,viewBox:l,viewBoxDimension:l.height}),u=bH({translateX:d,translateY:f,useTranslate3d:s})):u=yH,{cssProperties:u,cssClasses:xH({translateX:d,translateY:f,coordinate:r})}}function Qo(t){"@babel/helpers - typeof";return Qo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qo(t)}function hO(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function pO(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?hO(Object(r),!0).forEach(function(n){kx(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):hO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function _H(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function SH(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,l2(n.key),n)}}function jH(t,e,r){return e&&SH(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function OH(t,e,r){return e=ud(e),NH(t,s2()?Reflect.construct(e,r||[],ud(t).constructor):e.apply(t,r))}function NH(t,e){if(e&&(Qo(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return CH(t)}function CH(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function s2(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(s2=function(){return!!t})()}function ud(t){return ud=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ud(t)}function kH(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Cx(t,e)}function Cx(t,e){return Cx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Cx(t,e)}function kx(t,e,r){return e=l2(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function l2(t){var e=AH(t,"string");return Qo(e)=="symbol"?e:e+""}function AH(t,e){if(Qo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Qo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var mO=1,EH=(function(t){function e(){var r;_H(this,e);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return r=OH(this,e,[].concat(i)),kx(r,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),kx(r,"handleKeyDown",function(o){if(o.key==="Escape"){var s,l,u,d;r.setState({dismissed:!0,dismissedAtCoordinate:{x:(s=(l=r.props.coordinate)===null||l===void 0?void 0:l.x)!==null&&s!==void 0?s:0,y:(u=(d=r.props.coordinate)===null||d===void 0?void 0:d.y)!==null&&u!==void 0?u:0}})}}),r}return kH(e,t),jH(e,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();(Math.abs(n.width-this.state.lastBoundingBox.width)>mO||Math.abs(n.height-this.state.lastBoundingBox.height)>mO)&&this.setState({lastBoundingBox:{width:n.width,height:n.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var n,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var n=this,i=this.props,a=i.active,o=i.allowEscapeViewBox,s=i.animationDuration,l=i.animationEasing,u=i.children,d=i.coordinate,f=i.hasPayload,h=i.isAnimationActive,p=i.offset,m=i.position,g=i.reverseDirection,v=i.useTranslate3d,y=i.viewBox,w=i.wrapperStyle,_=wH({allowEscapeViewBox:o,coordinate:d,offsetTopLeft:p,position:m,reverseDirection:g,tooltipBox:this.state.lastBoundingBox,useTranslate3d:v,viewBox:y}),j=_.cssClasses,b=_.cssProperties,O=pO(pO({transition:h&&a?"transform ".concat(s,"ms ").concat(l):void 0},b),{},{pointerEvents:"none",visibility:!this.state.dismissed&&a&&f?"visible":"hidden",position:"absolute",top:0,left:0},w);return D.createElement("div",{tabIndex:-1,className:j,style:O,ref:function(N){n.wrapperNode=N}},u)}}])})(x.PureComponent),PH=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},ao={isSsr:PH()};function es(t){"@babel/helpers - typeof";return es=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},es(t)}function gO(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function vO(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?gO(Object(r),!0).forEach(function(n){cw(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function TH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function MH(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u2(n.key),n)}}function DH(t,e,r){return e&&MH(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function RH(t,e,r){return e=dd(e),IH(t,c2()?Reflect.construct(e,r||[],dd(t).constructor):e.apply(t,r))}function IH(t,e){if(e&&(es(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $H(t)}function $H(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function c2(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(c2=function(){return!!t})()}function dd(t){return dd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},dd(t)}function LH(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ax(t,e)}function Ax(t,e){return Ax=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Ax(t,e)}function cw(t,e,r){return e=u2(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u2(t){var e=BH(t,"string");return es(e)=="symbol"?e:e+""}function BH(t,e){if(es(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(es(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function FH(t){return t.dataKey}function zH(t,e){return D.isValidElement(t)?D.cloneElement(t,e):typeof t=="function"?D.createElement(t,e):D.createElement(mH,e)}var en=(function(t){function e(){return TH(this,e),RH(this,e,arguments)}return LH(e,t),DH(e,[{key:"render",value:function(){var n=this,i=this.props,a=i.active,o=i.allowEscapeViewBox,s=i.animationDuration,l=i.animationEasing,u=i.content,d=i.coordinate,f=i.filterNull,h=i.isAnimationActive,p=i.offset,m=i.payload,g=i.payloadUniqBy,v=i.position,y=i.reverseDirection,w=i.useTranslate3d,_=i.viewBox,j=i.wrapperStyle,b=m??[];f&&b.length&&(b=e2(m.filter(function(S){return S.value!=null&&(S.hide!==!0||n.props.includeHidden)}),g,FH));var O=b.length>0;return D.createElement(EH,{allowEscapeViewBox:o,animationDuration:s,animationEasing:l,isAnimationActive:h,active:a,coordinate:d,hasPayload:O,offset:p,position:v,reverseDirection:y,useTranslate3d:w,viewBox:_,wrapperStyle:j},zH(u,vO(vO({},this.props),{},{payload:b})))}}])})(x.PureComponent);cw(en,"displayName","Tooltip");cw(en,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!ao.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var Sv,yO;function qH(){if(yO)return Sv;yO=1;var t=Yn(),e=function(){return t.Date.now()};return Sv=e,Sv}var jv,xO;function UH(){if(xO)return jv;xO=1;var t=/\s/;function e(r){for(var n=r.length;n--&&t.test(r.charAt(n)););return n}return jv=e,jv}var Ov,bO;function HH(){if(bO)return Ov;bO=1;var t=UH(),e=/^\s+/;function r(n){return n&&n.slice(0,t(n)+1).replace(e,"")}return Ov=r,Ov}var Nv,wO;function d2(){if(wO)return Nv;wO=1;var t=HH(),e=ra(),r=Ms(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function l(u){if(typeof u=="number")return u;if(r(u))return n;if(e(u)){var d=typeof u.valueOf=="function"?u.valueOf():u;u=e(d)?d+"":d}if(typeof u!="string")return u===0?u:+u;u=t(u);var f=a.test(u);return f||o.test(u)?s(u.slice(2),f?2:8):i.test(u)?n:+u}return Nv=l,Nv}var Cv,_O;function WH(){if(_O)return Cv;_O=1;var t=ra(),e=qH(),r=d2(),n="Expected a function",i=Math.max,a=Math.min;function o(s,l,u){var d,f,h,p,m,g,v=0,y=!1,w=!1,_=!0;if(typeof s!="function")throw new TypeError(n);l=r(l)||0,t(u)&&(y=!!u.leading,w="maxWait"in u,h=w?i(r(u.maxWait)||0,l):h,_="trailing"in u?!!u.trailing:_);function j(E){var L=d,R=f;return d=f=void 0,v=E,p=s.apply(R,L),p}function b(E){return v=E,m=setTimeout(N,l),y?j(E):p}function O(E){var L=E-g,R=E-v,I=l-L;return w?a(I,h-R):I}function S(E){var L=E-g,R=E-v;return g===void 0||L>=l||L<0||w&&R>=h}function N(){var E=e();if(S(E))return C(E);m=setTimeout(N,O(E))}function C(E){return m=void 0,_&&d?j(E):(d=f=void 0,p)}function T(){m!==void 0&&clearTimeout(m),v=0,d=g=f=m=void 0}function k(){return m===void 0?p:C(e())}function M(){var E=e(),L=S(E);if(d=arguments,f=this,g=E,L){if(m===void 0)return b(g);if(w)return clearTimeout(m),m=setTimeout(N,l),j(g)}return m===void 0&&(m=setTimeout(N,l)),p}return M.cancel=T,M.flush=k,M}return Cv=o,Cv}var kv,SO;function VH(){if(SO)return kv;SO=1;var t=WH(),e=ra(),r="Expected a function";function n(i,a,o){var s=!0,l=!0;if(typeof i!="function")throw new TypeError(r);return e(o)&&(s="leading"in o?!!o.leading:s,l="trailing"in o?!!o.trailing:l),t(i,a,{leading:s,maxWait:a,trailing:l})}return kv=n,kv}var KH=VH();const f2=at(KH);function $l(t){"@babel/helpers - typeof";return $l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$l(t)}function jO(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function nu(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?jO(Object(r),!0).forEach(function(n){GH(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):jO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function GH(t,e,r){return e=YH(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function YH(t){var e=XH(t,"string");return $l(e)=="symbol"?e:e+""}function XH(t,e){if($l(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if($l(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function JH(t,e){return t8(t)||e8(t,e)||QH(t,e)||ZH()}function ZH(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 13In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function QH(t,e){if(t){if(typeof t=="string")return OO(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return OO(t,e)}}function OO(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function e8(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}function t8(t){if(Array.isArray(t))return t}var Av=x.forwardRef(function(t,e){var r=t.aspect,n=t.initialDimension,i=n===void 0?{width:-1,height:-1}:n,a=t.width,o=a===void 0?"100%":a,s=t.height,l=s===void 0?"100%":s,u=t.minWidth,d=u===void 0?0:u,f=t.minHeight,h=t.maxHeight,p=t.children,m=t.debounce,g=m===void 0?0:m,v=t.id,y=t.className,w=t.onResize,_=t.style,j=_===void 0?{}:_,b=x.useRef(null),O=x.useRef();O.current=w,x.useImperativeHandle(e,function(){return Object.defineProperty(b.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),b.current},configurable:!0})});var S=x.useState({containerWidth:i.width,containerHeight:i.height}),N=JH(S,2),C=N[0],T=N[1],k=x.useCallback(function(E,L){T(function(R){var I=Math.round(E),$=Math.round(L);return R.containerWidth===I&&R.containerHeight===$?R:{containerWidth:I,containerHeight:$}})},[]);x.useEffect(function(){var E=function(F){var V,te=F[0].contentRect,B=te.width,G=te.height;k(B,G),(V=O.current)===null||V===void 0||V.call(O,B,G)};g>0&&(E=f2(E,g,{trailing:!0,leading:!1}));var L=new ResizeObserver(E),R=b.current.getBoundingClientRect(),I=R.width,$=R.height;return k(I,$),L.observe(b.current),function(){L.disconnect()}},[k,g]);var M=x.useMemo(function(){var E=C.containerWidth,L=C.containerHeight;if(E<0||L<0)return null;On(Oa(o)||Oa(l),`The width(%s) and height(%s) are both fixed numbers, 14 maybe you don't need to use a ResponsiveContainer.`,o,l),On(!r||r>0,"The aspect(%s) must be greater than zero.",r);var R=Oa(o)?E:o,I=Oa(l)?L:l;r&&r>0&&(R?I=R/r:I&&(R=I*r),h&&I>h&&(I=h)),On(R>0||I>0,`The width(%s) and height(%s) of chart should be greater than 0, 15 please check the style of container, or the props width(%s) and height(%s), 16 or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the 17 height and width.`,R,I,o,l,d,f,r);var $=!Array.isArray(p)&&hi(p.type).endsWith("Chart");return D.Children.map(p,function(A){return D.isValidElement(A)?x.cloneElement(A,nu({width:R,height:I},$?{style:nu({height:"100%",width:"100%",maxHeight:I,maxWidth:R},A.props.style)}:{})):A})},[r,p,l,h,f,d,C,o]);return D.createElement("div",{id:v?"".concat(v):void 0,className:Le("recharts-responsive-container",y),style:nu(nu({},j),{},{width:o,height:l,minWidth:d,minHeight:f,maxHeight:h}),ref:b},M)}),mh=function(e){return null};mh.displayName="Cell";function Ll(t){"@babel/helpers - typeof";return Ll=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ll(t)}function NO(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Ex(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?NO(Object(r),!0).forEach(function(n){r8(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):NO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function r8(t,e,r){return e=n8(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function n8(t){var e=i8(t,"string");return Ll(e)=="symbol"?e:e+""}function i8(t,e){if(Ll(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Ll(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var vo={widthCache:{},cacheCount:0},a8=2e3,o8={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},CO="recharts_measurement_span";function s8(t){var e=Ex({},t);return Object.keys(e).forEach(function(r){e[r]||delete e[r]}),e}var hl=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||ao.isSsr)return{width:0,height:0};var n=s8(r),i=JSON.stringify({text:e,copyStyle:n});if(vo.widthCache[i])return vo.widthCache[i];try{var a=document.getElementById(CO);a||(a=document.createElement("span"),a.setAttribute("id",CO),a.setAttribute("aria-hidden","true"),document.body.appendChild(a));var o=Ex(Ex({},o8),n);Object.assign(a.style,o),a.textContent="".concat(e);var s=a.getBoundingClientRect(),l={width:s.width,height:s.height};return vo.widthCache[i]=l,++vo.cacheCount>a8&&(vo.cacheCount=0,vo.widthCache={}),l}catch{return{width:0,height:0}}},l8=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function Bl(t){"@babel/helpers - typeof";return Bl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bl(t)}function fd(t,e){return f8(t)||d8(t,e)||u8(t,e)||c8()}function c8(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 18In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function u8(t,e){if(t){if(typeof t=="string")return kO(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return kO(t,e)}}function kO(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function d8(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}function f8(t){if(Array.isArray(t))return t}function h8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function AO(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,m8(n.key),n)}}function p8(t,e,r){return e&&AO(t.prototype,e),r&&AO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function m8(t){var e=g8(t,"string");return Bl(e)=="symbol"?e:e+""}function g8(t,e){if(Bl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Bl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var EO=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,PO=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,v8=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,y8=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,h2={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},x8=Object.keys(h2),Ao="NaN";function b8(t,e){return t*h2[e]}var iu=(function(){function t(e,r){h8(this,t),this.num=e,this.unit=r,this.num=e,this.unit=r,Number.isNaN(e)&&(this.unit=""),r!==""&&!v8.test(r)&&(this.num=NaN,this.unit=""),x8.includes(r)&&(this.num=b8(e,r),this.unit="px")}return p8(t,[{key:"add",value:function(r){return this.unit!==r.unit?new t(NaN,""):new t(this.num+r.num,this.unit)}},{key:"subtract",value:function(r){return this.unit!==r.unit?new t(NaN,""):new t(this.num-r.num,this.unit)}},{key:"multiply",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new t(NaN,""):new t(this.num*r.num,this.unit||r.unit)}},{key:"divide",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new t(NaN,""):new t(this.num/r.num,this.unit||r.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(r){var n,i=(n=y8.exec(r))!==null&&n!==void 0?n:[],a=fd(i,3),o=a[1],s=a[2];return new t(parseFloat(o),s??"")}}])})();function p2(t){if(t.includes(Ao))return Ao;for(var e=t;e.includes("*")||e.includes("/");){var r,n=(r=EO.exec(e))!==null&&r!==void 0?r:[],i=fd(n,4),a=i[1],o=i[2],s=i[3],l=iu.parse(a??""),u=iu.parse(s??""),d=o==="*"?l.multiply(u):l.divide(u);if(d.isNaN())return Ao;e=e.replace(EO,d.toString())}for(;e.includes("+")||/.-\d+(?:\.\d+)?/.test(e);){var f,h=(f=PO.exec(e))!==null&&f!==void 0?f:[],p=fd(h,4),m=p[1],g=p[2],v=p[3],y=iu.parse(m??""),w=iu.parse(v??""),_=g==="+"?y.add(w):y.subtract(w);if(_.isNaN())return Ao;e=e.replace(PO,_.toString())}return e}var TO=/\(([^()]*)\)/;function w8(t){for(var e=t;e.includes("(");){var r=TO.exec(e),n=fd(r,2),i=n[1];e=e.replace(TO,p2(i))}return e}function _8(t){var e=t.replace(/\s+/g,"");return e=w8(e),e=p2(e),e}function S8(t){try{return _8(t)}catch{return Ao}}function Ev(t){var e=S8(t.slice(5,-1));return e===Ao?"":e}var j8=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],O8=["dx","dy","angle","className","breakAll"];function Px(){return Px=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];
18for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Px.apply(this,arguments)}function MO(t,e){if(t==null)return{};var r=N8(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function N8(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function DO(t,e){return E8(t)||A8(t,e)||k8(t,e)||C8()}function C8(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 19In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function k8(t,e){if(t){if(typeof t=="string")return RO(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return RO(t,e)}}function RO(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function A8(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}function E8(t){if(Array.isArray(t))return t}var m2=/[ \f\n\r\t\v\u2028\u2029]+/,g2=function(e){var r=e.children,n=e.breakAll,i=e.style;try{var a=[];Me(r)||(n?a=r.toString().split(""):a=r.toString().split(m2));var o=a.map(function(l){return{word:l,width:hl(l,i).width}}),s=n?0:hl(" ",i).width;return{wordsWithComputedWidth:o,spaceWidth:s}}catch{return null}},P8=function(e,r,n,i,a){var o=e.maxLines,s=e.children,l=e.style,u=e.breakAll,d=ie(o),f=s,h=function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return R.reduce(function(I,$){var A=$.word,F=$.width,V=I[I.length-1];if(V&&(i==null||a||V.width+F+n<Number(i)))V.words.push(A),V.width+=F+n;else{var te={words:[A],width:F};I.push(te)}return I},[])},p=h(r),m=function(R){return R.reduce(function(I,$){return I.width>$.width?I:$})};if(!d)return p;for(var g="â¦",v=function(R){var I=f.slice(0,R),$=g2({breakAll:u,style:l,children:I+g}).wordsWithComputedWidth,A=h($),F=A.length>o||m(A).width>Number(i);return[F,A]},y=0,w=f.length-1,_=0,j;y<=w&&_<=f.length-1;){var b=Math.floor((y+w)/2),O=b-1,S=v(O),N=DO(S,2),C=N[0],T=N[1],k=v(b),M=DO(k,1),E=M[0];if(!C&&!E&&(y=b+1),C&&E&&(w=b-1),!C&&E){j=T;break}_++}return j||p},IO=function(e){var r=Me(e)?[]:e.toString().split(m2);return[{words:r}]},T8=function(e){var r=e.width,n=e.scaleToFit,i=e.children,a=e.style,o=e.breakAll,s=e.maxLines;if((r||n)&&!ao.isSsr){var l,u,d=g2({breakAll:o,children:i,style:a});if(d){var f=d.wordsWithComputedWidth,h=d.spaceWidth;l=f,u=h}else return IO(i);return P8({breakAll:o,children:i,maxLines:s,style:a},l,u,r,n)}return IO(i)},$O="#808080",Ga=function(e){var r=e.x,n=r===void 0?0:r,i=e.y,a=i===void 0?0:i,o=e.lineHeight,s=o===void 0?"1em":o,l=e.capHeight,u=l===void 0?"0.71em":l,d=e.scaleToFit,f=d===void 0?!1:d,h=e.textAnchor,p=h===void 0?"start":h,m=e.verticalAnchor,g=m===void 0?"end":m,v=e.fill,y=v===void 0?$O:v,w=MO(e,j8),_=x.useMemo(function(){return T8({breakAll:w.breakAll,children:w.children,maxLines:w.maxLines,scaleToFit:f,style:w.style,width:w.width})},[w.breakAll,w.children,w.maxLines,f,w.style,w.width]),j=w.dx,b=w.dy,O=w.angle,S=w.className,N=w.breakAll,C=MO(w,O8);if(!Bt(n)||!Bt(a))return null;var T=n+(ie(j)?j:0),k=a+(ie(b)?b:0),M;switch(g){case"start":M=Ev("calc(".concat(u,")"));break;case"middle":M=Ev("calc(".concat((_.length-1)/2," * -").concat(s," + (").concat(u," / 2))"));break;default:M=Ev("calc(".concat(_.length-1," * -").concat(s,")"));break}var E=[];if(f){var L=_[0].width,R=w.width;E.push("scale(".concat((ie(R)?R/L:1)/L,")"))}return O&&E.push("rotate(".concat(O,", ").concat(T,", ").concat(k,")")),E.length&&(C.transform=E.join(" ")),D.createElement("text",Px({},_e(C,!0),{x:T,y:k,className:Le("recharts-text",S),textAnchor:p,fill:y.includes("url")?$O:y}),_.map(function(I,$){var A=I.words.join(N?"":" ");return D.createElement("tspan",{x:T,dy:$===0?M:s,key:"".concat(A,"-").concat($)},A)}))};function Hi(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function M8(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function uw(t){let e,r,n;t.length!==2?(e=Hi,r=(s,l)=>Hi(t(s),l),n=(s,l)=>t(s)-l):(e=t===Hi||t===M8?t:D8,r=t,n=t);function i(s,l,u=0,d=s.length){if(u<d){if(e(l,l)!==0)return d;do{const f=u+d>>>1;r(s[f],l)<0?u=f+1:d=f}while(u<d)}return u}function a(s,l,u=0,d=s.length){if(u<d){if(e(l,l)!==0)return d;do{const f=u+d>>>1;r(s[f],l)<=0?u=f+1:d=f}while(u<d)}return u}function o(s,l,u=0,d=s.length){const f=i(s,l,u,d-1);return f>u&&n(s[f-1],l)>-n(s[f],l)?f-1:f}return{left:i,center:o,right:a}}function D8(){return 0}function v2(t){return t===null?NaN:+t}function*R8(t,e){for(let r of t)r!=null&&(r=+r)>=r&&(yield r)}const I8=uw(Hi),Rc=I8.right;uw(v2).center;class LO extends Map{constructor(e,r=B8){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),e!=null)for(const[n,i]of e)this.set(n,i)}get(e){return super.get(BO(this,e))}has(e){return super.has(BO(this,e))}set(e,r){return super.set($8(this,e),r)}delete(e){return super.delete(L8(this,e))}}function BO({_intern:t,_key:e},r){const n=e(r);return t.has(n)?t.get(n):r}function $8({_intern:t,_key:e},r){const n=e(r);return t.has(n)?t.get(n):(t.set(n,r),r)}function L8({_intern:t,_key:e},r){const n=e(r);return t.has(n)&&(r=t.get(n),t.delete(n)),r}function B8(t){return t!==null&&typeof t=="object"?t.valueOf():t}function F8(t=Hi){if(t===Hi)return y2;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,r)=>{const n=t(e,r);return n||n===0?n:(t(r,r)===0)-(t(e,e)===0)}}function y2(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const z8=Math.sqrt(50),q8=Math.sqrt(10),U8=Math.sqrt(2);function hd(t,e,r){const n=(e-t)/Math.max(0,r),i=Math.floor(Math.log10(n)),a=n/Math.pow(10,i),o=a>=z8?10:a>=q8?5:a>=U8?2:1;let s,l,u;return i<0?(u=Math.pow(10,-i)/o,s=Math.round(t*u),l=Math.round(e*u),s/u<t&&++s,l/u>e&&--l,u=-u):(u=Math.pow(10,i)*o,s=Math.round(t/u),l=Math.round(e/u),s*u<t&&++s,l*u>e&&--l),l<s&&.5<=r&&r<2?hd(t,e,r*2):[s,l,u]}function Tx(t,e,r){if(e=+e,t=+t,r=+r,!(r>0))return[];if(t===e)return[t];const n=e<t,[i,a,o]=n?hd(e,t,r):hd(t,e,r);
19if(!(a>=i))return[];const s=a-i+1,l=new Array(s);if(n)if(o<0)for(let u=0;u<s;++u)l[u]=(a-u)/-o;else for(let u=0;u<s;++u)l[u]=(a-u)*o;else if(o<0)for(let u=0;u<s;++u)l[u]=(i+u)/-o;else for(let u=0;u<s;++u)l[u]=(i+u)*o;return l}function Mx(t,e,r){return e=+e,t=+t,r=+r,hd(t,e,r)[2]}function Dx(t,e,r){e=+e,t=+t,r=+r;const n=e<t,i=n?Mx(e,t,r):Mx(t,e,r);return(n?-1:1)*(i<0?1/-i:i)}function FO(t,e){let r;for(const n of t)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);return r}function zO(t,e){let r;for(const n of t)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function x2(t,e,r=0,n=1/0,i){if(e=Math.floor(e),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(t.length-1,n)),!(r<=e&&e<=n))return t;for(i=i===void 0?y2:F8(i);n>r;){if(n-r>600){const l=n-r+1,u=e-r+1,d=Math.log(l),f=.5*Math.exp(2*d/3),h=.5*Math.sqrt(d*f*(l-f)/l)*(u-l/2<0?-1:1),p=Math.max(r,Math.floor(e-u*f/l+h)),m=Math.min(n,Math.floor(e+(l-u)*f/l+h));x2(t,e,p,m,i)}const a=t[e];let o=r,s=n;for(Ks(t,r,e),i(t[n],a)>0&&Ks(t,r,n);o<s;){for(Ks(t,o,s),++o,--s;i(t[o],a)<0;)++o;for(;i(t[s],a)>0;)--s}i(t[r],a)===0?Ks(t,r,s):(++s,Ks(t,s,n)),s<=e&&(r=s+1),e<=s&&(n=s-1)}return t}function Ks(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function H8(t,e,r){if(t=Float64Array.from(R8(t)),!(!(n=t.length)||isNaN(e=+e))){if(e<=0||n<2)return zO(t);if(e>=1)return FO(t);var n,i=(n-1)*e,a=Math.floor(i),o=FO(x2(t,a).subarray(0,a+1)),s=zO(t.subarray(a+1));return o+(s-o)*(i-a)}}function W8(t,e,r=v2){if(!(!(n=t.length)||isNaN(e=+e))){if(e<=0||n<2)return+r(t[0],0,t);if(e>=1)return+r(t[n-1],n-1,t);var n,i=(n-1)*e,a=Math.floor(i),o=+r(t[a],a,t),s=+r(t[a+1],a+1,t);return o+(s-o)*(i-a)}}function V8(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((e-t)/r))|0,a=new Array(i);++n<i;)a[n]=t+n*r;return a}function dn(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function Ci(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}const Rx=Symbol("implicit");function dw(){var t=new LO,e=[],r=[],n=Rx;function i(a){let o=t.get(a);if(o===void 0){if(n!==Rx)return n;t.set(a,o=e.push(a)-1)}return r[o%r.length]}return i.domain=function(a){if(!arguments.length)return e.slice();e=[],t=new LO;for(const o of a)t.has(o)||t.set(o,e.push(o)-1);return i},i.range=function(a){return arguments.length?(r=Array.from(a),i):r.slice()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return dw(e,r).unknown(n)},dn.apply(i,arguments),i}function Fl(){var t=dw().unknown(void 0),e=t.domain,r=t.range,n=0,i=1,a,o,s=!1,l=0,u=0,d=.5;delete t.unknown;function f(){var h=e().length,p=i<n,m=p?i:n,g=p?n:i;a=(g-m)/Math.max(1,h-l+u*2),s&&(a=Math.floor(a)),m+=(g-m-a*(h-l))*d,o=a*(1-l),s&&(m=Math.round(m),o=Math.round(o));var v=V8(h).map(function(y){return m+a*y});return r(p?v.reverse():v)}return t.domain=function(h){return arguments.length?(e(h),f()):e()},t.range=function(h){return arguments.length?([n,i]=h,n=+n,i=+i,f()):[n,i]},t.rangeRound=function(h){return[n,i]=h,n=+n,i=+i,s=!0,f()},t.bandwidth=function(){return o},t.step=function(){return a},t.round=function(h){return arguments.length?(s=!!h,f()):s},t.padding=function(h){return arguments.length?(l=Math.min(1,u=+h),f()):l},t.paddingInner=function(h){return arguments.length?(l=Math.min(1,h),f()):l},t.paddingOuter=function(h){return arguments.length?(u=+h,f()):u},t.align=function(h){return arguments.length?(d=Math.max(0,Math.min(1,h)),f()):d},t.copy=function(){return Fl(e(),[n,i]).round(s).paddingInner(l).paddingOuter(u).align(d)},dn.apply(f(),arguments)}function b2(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return b2(e())},t}function pl(){return b2(Fl.apply(null,arguments).paddingInner(1))}function fw(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function w2(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function Ic(){}var zl=.7,pd=1/zl,Lo="\\s*([+-]?\\d+)\\s*",ql="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",qn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",K8=/^#([0-9a-f]{3,8}
vendor: 6,800 bytes, line 19
19)$/,G8=new RegExp(`^rgb\\(${Lo},${Lo},${Lo}\\)$`),Y8=new RegExp(`^rgb\\(${qn},${qn},${qn}\\)$`),X8=new RegExp(`^rgba\\(${Lo},${Lo},${Lo},${ql}\\)$`),J8=new RegExp(`^rgba\\(${qn},${qn},${qn},${ql}\\)$`),Z8=new RegExp(`^hsl\\(${ql},${qn},${qn}\\)$`),Q8=new RegExp(`^hsla\\(${ql},${qn},${qn},${ql}\\)$`),qO={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};fw(Ic,Ul,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:UO,formatHex:UO,formatHex8:eW,formatHsl:tW,formatRgb:HO,toString:HO});function UO(){return this.rgb().formatHex()}function eW(){return this.rgb().formatHex8()}function tW(){return _2(this).formatHsl()}function HO(){return this.rgb().formatRgb()}function Ul(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=K8.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?WO(e):r===3?new Ar(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?au(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?au(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=G8.exec(t))?new Ar(e[1],e[2],e[3],1):(e=Y8.exec(t))?new Ar(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=X8.exec(t))?au(e[1],e[2],e[3],e[4]):(e=J8.exec(t))?au(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Z8.exec(t))?GO(e[1],e[2]/100,e[3]/100,1):(e=Q8.exec(t))?GO(e[1],e[2]/100,e[3]/100,e[4]):qO.hasOwnProperty(t)?WO(qO[t]):t==="transparent"?new Ar(NaN,NaN,NaN,0):null}function WO(t){return new Ar(t>>16&255,t>>8&255,t&255,1)}function au(t,e,r,n){return n<=0&&(t=e=r=NaN),new Ar(t,e,r,n)}function rW(t){return t instanceof Ic||(t=Ul(t)),t?(t=t.rgb(),new Ar(t.r,t.g,t.b,t.opacity)):new Ar}function Ix(t,e,r,n){return arguments.length===1?rW(t):new Ar(t,e,r,n??1)}function Ar(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}fw(Ar,Ix,w2(Ic,{brighter(t){return t=t==null?pd:Math.pow(pd,t),new Ar(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?zl:Math.pow(zl,t),new Ar(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ar(Ra(this.r),Ra(this.g),Ra(this.b),md(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:VO,formatHex:VO,formatHex8:nW,formatRgb:KO,toString:KO}));function VO(){return`#${Na(this.r)}${Na(this.g)}${Na(this.b)}`}function nW(){return`#${Na(this.r)}${Na(this.g)}${Na(this.b)}${Na((isNaN(this.opacity)?1:this.opacity)*255)}`}function KO(){const t=md(this.opacity);return`${t===1?"rgb(":"rgba("}${Ra(this.r)}, ${Ra(this.g)}, ${Ra(this.b)}${t===1?")":`, ${t})`}`}function md(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Ra(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Na(t){return t=Ra(t),(t<16?"0":"")+t.toString(16)}function GO(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new _n(t,e,r,n)}function _2(t){if(t instanceof _n)return new _n(t.h,t.s,t.l,t.opacity);if(t instanceof Ic||(t=Ul(t)),!t)return new _n;if(t instanceof _n)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),a=Math.max(e,r,n),o=NaN,s=a-i,l=(a+i)/2;return s?(e===a?o=(r-n)/s+(r<n)*6:r===a?o=(n-e)/s+2:o=(e-r)/s+4,s/=l<.5?a+i:2-a-i,o*=60):s=l>0&&l<1?0:o,new _n(o,s,l,t.opacity)}function iW(t,e,r,n){return arguments.length===1?_2(t):new _n(t,e,r,n??1)}function _n(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}fw(_n,iW,w2(Ic,{brighter(t){return t=t==null?pd:Math.pow(pd,t),new _n(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?zl:Math.pow(zl,t),new _n(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new Ar(Pv(t>=240?t-240:t+120,i,n),Pv(t,i,n),Pv(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new _n(YO(this.h),ou(this.s),ou(this.l),md(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=md(this.opacity);return`${t===1?"hsl(":"hsla("}${YO(this.h)}, ${ou(this.s)*100}%, ${ou(this.l)*100}%${t===1?")":`, ${t})`}`}}));function YO(t){return t=(t||0)%360,t<0?t+360:t}
vendor: 11,376 bytes, line 19
19function ou(t){return Math.max(0,Math.min(1,t||0))}function Pv(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}const hw=t=>()=>t;function aW(t,e){return function(r){return t+r*e}}function oW(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function sW(t){return(t=+t)==1?S2:function(e,r){return r-e?oW(e,r,t):hw(isNaN(e)?r:e)}}function S2(t,e){var r=e-t;return r?aW(t,r):hw(isNaN(t)?e:t)}const XO=(function t(e){var r=sW(e);function n(i,a){var o=r((i=Ix(i)).r,(a=Ix(a)).r),s=r(i.g,a.g),l=r(i.b,a.b),u=S2(i.opacity,a.opacity);return function(d){return i.r=o(d),i.g=s(d),i.b=l(d),i.opacity=u(d),i+""}}return n.gamma=t,n})(1);function lW(t,e){e||(e=[]);var r=t?Math.min(e.length,t.length):0,n=e.slice(),i;return function(a){for(i=0;i<r;++i)n[i]=t[i]*(1-a)+e[i]*a;return n}}function cW(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function uW(t,e){var r=e?e.length:0,n=t?Math.min(r,t.length):0,i=new Array(n),a=new Array(r),o;for(o=0;o<n;++o)i[o]=$s(t[o],e[o]);for(;o<r;++o)a[o]=e[o];return function(s){for(o=0;o<n;++o)a[o]=i[o](s);return a}}function dW(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function gd(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function fW(t,e){var r={},n={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?r[i]=$s(t[i],e[i]):n[i]=e[i];return function(a){for(i in r)n[i]=r[i](a);return n}}var $x=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Tv=new RegExp($x.source,"g");function hW(t){return function(){return t}}function pW(t){return function(e){return t(e)+""}}function mW(t,e){var r=$x.lastIndex=Tv.lastIndex=0,n,i,a,o=-1,s=[],l=[];for(t=t+"",e=e+"";(n=$x.exec(t))&&(i=Tv.exec(e));)(a=i.index)>r&&(a=e.slice(r,a),s[o]?s[o]+=a:s[++o]=a),(n=n[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,l.push({i:o,x:gd(n,i)})),r=Tv.lastIndex;return r<e.length&&(a=e.slice(r),s[o]?s[o]+=a:s[++o]=a),s.length<2?l[0]?pW(l[0].x):hW(e):(e=l.length,function(u){for(var d=0,f;d<e;++d)s[(f=l[d]).i]=f.x(u);return s.join("")})}function $s(t,e){var r=typeof e,n;return e==null||r==="boolean"?hw(e):(r==="number"?gd:r==="string"?(n=Ul(e))?(e=n,XO):mW:e instanceof Ul?XO:e instanceof Date?dW:cW(e)?lW:Array.isArray(e)?uW:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?fW:gd)(t,e)}function pw(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}function gW(t,e){e===void 0&&(e=t,t=$s);for(var r=0,n=e.length-1,i=e[0],a=new Array(n<0?0:n);r<n;)a[r]=t(i,i=e[++r]);return function(o){var s=Math.max(0,Math.min(n-1,Math.floor(o*=n)));return a[s](o-s)}}function vW(t){return function(){return t}}function vd(t){return+t}var JO=[0,1];function Sr(t){return t}function Lx(t,e){return(e-=t=+t)?function(r){return(r-t)/e}:vW(isNaN(e)?NaN:.5)}function yW(t,e){var r;return t>e&&(r=t,t=e,e=r),function(n){return Math.max(t,Math.min(e,n))}}function xW(t,e,r){var n=t[0],i=t[1],a=e[0],o=e[1];return i<n?(n=Lx(i,n),a=r(o,a)):(n=Lx(n,i),a=r(a,o)),function(s){return a(n(s))}}function bW(t,e,r){var n=Math.min(t.length,e.length)-1,i=new Array(n),a=new Array(n),o=-1;for(t[n]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<n;)i[o]=Lx(t[o],t[o+1]),a[o]=r(e[o],e[o+1]);return function(s){var l=Rc(t,s,1,n)-1;return a[l](i[l](s))}}function $c(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function gh(){var t=JO,e=JO,r=$s,n,i,a,o=Sr,s,l,u;function d(){var h=Math.min(t.length,e.length);return o!==Sr&&(o=yW(t[0],t[h-1])),s=h>2?bW:xW,l=u=null,f}function f(h){return h==null||isNaN(h=+h)?a:(l||(l=s(t.map(n),e,r)))(n(o(h)))}return f.invert=function(h){return o(i((u||(u=s(e,t.map(n),gd)))(h)))},f.domain=function(h){return arguments.length?(t=Array.from(h,vd),d()):t.slice()},f.range=function(h){return arguments.length?(e=Array.from(h),d()):e.slice()},f.rangeRound=function(h){return e=Array.from(h),r=pw,d()},f.clamp=function(h){return arguments.length?(o=h?!0:Sr,d()):o!==Sr},f.interpolate=function(h){return arguments.length?(r=h,d()):r},f.unknown=function(h){return arguments.length?(a=h,f):a},function(h,p){return n=h,i=p,d()}}function mw(){return gh()(Sr,Sr)}function wW(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function yd(t,e){if((r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var r,n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}function ts(t){return t=yd(Math.abs(t)),t?t[1]:NaN}function _W(t,e){return function(r,n){for(var i=r.length,a=[],o=0,s=t[0],l=0;i>0&&s>0&&(l+s+1>n&&(s=Math.max(1,n-l)),a.push(r.substring(i-=s,i+s)),!((l+=s+1)>n));)s=t[o=(o+1)%t.length];return a.reverse().join(e)}}function SW(t){return function(e){return e.replace(/[0-9]/g,function(r){return t[+r]})}}var jW=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Hl(t){if(!(e=jW.exec(t)))throw new Error("invalid format: "+t);var e;return new gw({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Hl.prototype=gw.prototype;function gw(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}gw.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function OW(t){e:for(var e=t.length,r=1,n=-1,i;r<e;++r)switch(t[r]){case".":n=i=r;break;case"0":n===0&&(n=r),i=r;break;default:if(!+t[r])break e;n>0&&(n=0);break}return n>0?t.slice(0,n)+t.slice(i+1):t}var j2;function NW(t,e){var r=yd(t,e);if(!r)return t+"";var n=r[0],i=r[1],a=i-(j2=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=n.length;return a===o?n:a>o?n+new Array(a-o+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+yd(t,Math.max(0,e+a-1))[0]}function ZO(t,e){var r=yd(t,e);if(!r)return t+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const QO={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:wW,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>ZO(t*100,e),r:ZO,s:NW,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function eN(t){return t}var tN=Array.prototype.map,rN=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function CW(t){var e=t.grouping===void 0||t.thousands===void 0?eN:_W(tN.call(t.grouping,Number),t.thousands+""),r=t.currency===void 0?"":t.currency[0]+"",n=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",a=t.numerals===void 0?eN:SW(tN.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",s=t.minus===void 0?"â":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function u(f){f=Hl(f);var h=f.fill,p=f.align,m=f.sign,g=f.symbol,v=f.zero,y=f.width,w=f.comma,_=f.precision,j=f.trim,b=f.type;b==="n"?(w=!0,b="g"):QO[b]||(_===void 0&&(_=12),j=!0,b="g"),(v||h==="0"&&p==="=")&&(v=!0,h="0",p="=");var O=g==="$"?r:g==="#"&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",S=g==="$"?n:/[%p]/.test(b)?o:"",N=QO[b],C=/[defgprs%]/.test(b);_=_===void 0?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function T(k){var M=O,E=S,L,R,I;if(b==="c")E=N(k)+E,k="";else{k=+k;var $=k<0||1/k<0;if(k=isNaN(k)?l:N(Math.abs(k),_),j&&(k=OW(k)),$&&+k==0&&m!=="+"&&($=!1),M=($?m==="("?m:s:m==="-"||m==="("?"":m)+M,E=(b==="s"?rN[8+j2/3]:"")+E+($&&m==="("?")":""),C){for(L=-1,R=k.length;++L<R;)if(I=k.charCodeAt(L),48>I||I>57){E=(I===46?i+k.slice(L+1):k.slice(L))+E,k=k.slice(0,L);break}}}w&&!v&&(k=e(k,1/0));var A=M.length+k.length+E.length,F=A<y?new Array(y-A+1).join(h):"";switch(w&&v&&(k=e(F+k,F.length?y-E.length:1/0),F=""),p){case"<":k=M+k+E+F;break;case"=":k=M+F+k+E;break;case"^":k=F.slice(0,A=F.length>>1)+M+k+E+F.slice(A);break;default:k=F+M+k+E;break}return a(k)}return T.toString=function(){return f+""},T}function d(f,h){var p=u((f=Hl(f),f.type="f",f)),m=Math.max(-8,Math.min(8,Math.floor(ts(h)/3)))*3,g=Math.pow(10,-m),v=rN[8+m/3];return function(y){return p(g*y)+v}}return{format:u,formatPrefix:d}}var su,vw,O2;kW({thousands:",",grouping:[3],currency:["$",""]});function kW(t){return su=CW(t),vw=su.format,O2=su.formatPrefix,su}function AW(t){return Math.max(0,-ts(Math.abs(t)))}function EW(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ts(e)/3)))*3-ts(Math.abs(t)))}function PW(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,ts(e)-ts(t))+1}function N2(t,e,r,n){var i=Dx(t,e,r),a;switch(n=Hl(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return n.precision==null&&!isNaN(a=EW(i,o))&&(n.precision=a),O2(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=PW(i,Math.max(Math.abs(t),Math.abs(e))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=AW(i))&&(n.precision=a-(n.type==="%")*2);break}}return vw(n)}function na(t){var e=t.domain;return t.ticks=function(r){var n=e();return Tx(n[0],n[n.length-1],r??10)},t.tickFormat=function(r,n){var i=e();return N2(i[0],i[i.length-1],r??10,n)},t.nice=function(r){r==null&&(r=10);var n=e(),i=0,a=n.length-1,o=n[i],s=n[a],l,u,d=10;for(s<o&&(u=o,o=s,s=u,u=i,i=a,a=u);d-- >0;){if(u=Mx(o,s,r),u===l)return n[i]=o,n[a]=s,e(n);if(u>0)o=Math.floor(o/u)*u,s=Math.ceil(s/u)*u;else if(u<0)o=Math.ceil(o*u)/u,s=Math.floor(s*u)/u;else break;l=u}return t},t}function xd(){var t=mw();return t.copy=function(){return $c(t,xd())},dn.apply(t,arguments),na(t)}function C2(t){var e;function r(n){return n==null||isNaN(n=+n)?e:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(t=Array.from(n,vd),r):t.slice()},r.unknown=function(n){return arguments.length?(e=n,r):e},r.copy=function(){return C2(t).unknown(e)},t=arguments.length?Array.from(t,vd):[0,1],na(r)}function k2(t,e){t=t.slice();var r=0,n=t.length-1,i=t[r],a=t[n],o;return a<i&&(o=r,r=n,n=o,o=i,i=a,a=o),t[r]=e.floor(i),t[n]=e.ceil(a),t}function nN(t){return Math.log(t)}function iN(t){return Math.exp(t)}function TW(t){return-Math.log(-t)}function MW(t){return-Math.exp(-t)}function DW(t){return isFinite(t)?+("1e"+t):t<0?0:t}function RW(t){return t===10?DW:t===Math.E?Math.exp:e=>Math.pow(t,e)}function IW(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function aN(t){return(e,r)=>-t(-e,r)}function yw(t){const e=t(nN,iN),r=e.domain;let n=10,i,a;function o(){return i=IW(n),a=RW(n),r()[0]<0?(i=aN(i),a=aN(a),t(TW,MW)):t(nN,iN),e}return e.base=function(s){return arguments.length?(n=+s,o()):n},e.domain=function(s){return arguments.length?(r(s),o()):r()},e.ticks=s=>{const l=r();let u=l[0],d=l[l.length-1];const f=d<u;f&&([u,d]=[d,u]);let h=i(u),p=i(d),m,g;const v=s==null?10:+s;let y=[];if(!(n%1)&&p-h<v){if(h=Math.floor(h),p=Math.ceil(p),u>0){for(;h<=p;
vendor: 4,451 bytes, line 19
19++h)for(m=1;m<n;++m)if(g=h<0?m/a(-h):m*a(h),!(g<u)){if(g>d)break;y.push(g)}}else for(;h<=p;++h)for(m=n-1;m>=1;--m)if(g=h>0?m/a(-h):m*a(h),!(g<u)){if(g>d)break;y.push(g)}y.length*2<v&&(y=Tx(u,d,v))}else y=Tx(h,p,Math.min(p-h,v)).map(a);return f?y.reverse():y},e.tickFormat=(s,l)=>{if(s==null&&(s=10),l==null&&(l=n===10?"s":","),typeof l!="function"&&(!(n%1)&&(l=Hl(l)).precision==null&&(l.trim=!0),l=vw(l)),s===1/0)return l;const u=Math.max(1,n*s/e.ticks().length);return d=>{let f=d/a(Math.round(i(d)));return f*n<n-.5&&(f*=n),f<=u?l(d):""}},e.nice=()=>r(k2(r(),{floor:s=>a(Math.floor(i(s))),ceil:s=>a(Math.ceil(i(s)))})),e}function A2(){const t=yw(gh()).domain([1,10]);return t.copy=()=>$c(t,A2()).base(t.base()),dn.apply(t,arguments),t}function oN(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function sN(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function xw(t){var e=1,r=t(oN(e),sN(e));return r.constant=function(n){return arguments.length?t(oN(e=+n),sN(e)):e},na(r)}function E2(){var t=xw(gh());return t.copy=function(){return $c(t,E2()).constant(t.constant())},dn.apply(t,arguments)}function lN(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function $W(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function LW(t){return t<0?-t*t:t*t}function bw(t){var e=t(Sr,Sr),r=1;function n(){return r===1?t(Sr,Sr):r===.5?t($W,LW):t(lN(r),lN(1/r))}return e.exponent=function(i){return arguments.length?(r=+i,n()):r},na(e)}function ww(){var t=bw(gh());return t.copy=function(){return $c(t,ww()).exponent(t.exponent())},dn.apply(t,arguments),t}function BW(){return ww.apply(null,arguments).exponent(.5)}function cN(t){return Math.sign(t)*t*t}function FW(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function P2(){var t=mw(),e=[0,1],r=!1,n;function i(a){var o=FW(t(a));return isNaN(o)?n:r?Math.round(o):o}return i.invert=function(a){return t.invert(cN(a))},i.domain=function(a){return arguments.length?(t.domain(a),i):t.domain()},i.range=function(a){return arguments.length?(t.range((e=Array.from(a,vd)).map(cN)),i):e.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(r=!!a,i):r},i.clamp=function(a){return arguments.length?(t.clamp(a),i):t.clamp()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return P2(t.domain(),e).round(r).clamp(t.clamp()).unknown(n)},dn.apply(i,arguments),na(i)}function T2(){var t=[],e=[],r=[],n;function i(){var o=0,s=Math.max(1,e.length);for(r=new Array(s-1);++o<s;)r[o-1]=W8(t,o/s);return a}function a(o){return o==null||isNaN(o=+o)?n:e[Rc(r,o)]}return a.invertExtent=function(o){var s=e.indexOf(o);return s<0?[NaN,NaN]:[s>0?r[s-1]:t[0],s<r.length?r[s]:t[t.length-1]]},a.domain=function(o){if(!arguments.length)return t.slice();t=[];for(let s of o)s!=null&&!isNaN(s=+s)&&t.push(s);return t.sort(Hi),i()},a.range=function(o){return arguments.length?(e=Array.from(o),i()):e.slice()},a.unknown=function(o){return arguments.length?(n=o,a):n},a.quantiles=function(){return r.slice()},a.copy=function(){return T2().domain(t).range(e).unknown(n)},dn.apply(a,arguments)}function M2(){var t=0,e=1,r=1,n=[.5],i=[0,1],a;function o(l){return l!=null&&l<=l?i[Rc(n,l,0,r)]:a}function s(){var l=-1;for(n=new Array(r);++l<r;)n[l]=((l+1)*e-(l-r)*t)/(r+1);return o}return o.domain=function(l){return arguments.length?([t,e]=l,t=+t,e=+e,s()):[t,e]},o.range=function(l){return arguments.length?(r=(i=Array.from(l)).length-1,s()):i.slice()},o.invertExtent=function(l){var u=i.indexOf(l);return u<0?[NaN,NaN]:u<1?[t,n[0]]:u>=r?[n[r-1],e]:[n[u-1],n[u]]},o.unknown=function(l){return arguments.length&&(a=l),o},o.thresholds=function(){return n.slice()},o.copy=function(){return M2().domain([t,e]).range(i).unknown(a)},dn.apply(na(o),arguments)}function D2(){var t=[.5],e=[0,1],r,n=1;function i(a){return a!=null&&a<=a?e[Rc(t,a,0,n)]:r}return i.domain=function(a){return arguments.length?(t=Array.from(a),n=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(a){return arguments.length?(e=Array.from(a),n=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(a){var o=e.indexOf(a);return[t[o-1],t[o]]},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return D2().domain(t).range(e).unknown(r)},dn.apply(i,arguments)}const Mv=new Date,Dv=new Date;function zt(t,e,r,n){function i(a){return t(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>
vendor: 6,035 bytes, line 19
19(t(a=new Date(+a)),a),i.ceil=a=>(t(a=new Date(a-1)),e(a,1),t(a),a),i.round=a=>{const o=i(a),s=i.ceil(a);return a-o<s-a?o:s},i.offset=(a,o)=>(e(a=new Date(+a),o==null?1:Math.floor(o)),a),i.range=(a,o,s)=>{const l=[];if(a=i.ceil(a),s=s==null?1:Math.floor(s),!(a<o)||!(s>0))return l;let u;do l.push(u=new Date(+a)),e(a,s),t(a);while(u<a&&a<o);return l},i.filter=a=>zt(o=>{if(o>=o)for(;t(o),!a(o);)o.setTime(o-1)},(o,s)=>{if(o>=o)if(s<0)for(;++s<=0;)for(;e(o,-1),!a(o););else for(;--s>=0;)for(;e(o,1),!a(o););}),r&&(i.count=(a,o)=>(Mv.setTime(+a),Dv.setTime(+o),t(Mv),t(Dv),Math.floor(r(Mv,Dv))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(n?o=>n(o)%a===0:o=>i.count(0,o)%a===0):i)),i}const bd=zt(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);bd.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?zt(e=>{e.setTime(Math.floor(e/t)*t)},(e,r)=>{e.setTime(+e+r*t)},(e,r)=>(r-e)/t):bd);bd.range;const ci=1e3,on=ci*60,ui=on*60,bi=ui*24,_w=bi*7,uN=bi*30,Rv=bi*365,Ca=zt(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*ci)},(t,e)=>(e-t)/ci,t=>t.getUTCSeconds());Ca.range;const Sw=zt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*ci)},(t,e)=>{t.setTime(+t+e*on)},(t,e)=>(e-t)/on,t=>t.getMinutes());Sw.range;const jw=zt(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*on)},(t,e)=>(e-t)/on,t=>t.getUTCMinutes());jw.range;const Ow=zt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*ci-t.getMinutes()*on)},(t,e)=>{t.setTime(+t+e*ui)},(t,e)=>(e-t)/ui,t=>t.getHours());Ow.range;const Nw=zt(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*ui)},(t,e)=>(e-t)/ui,t=>t.getUTCHours());Nw.range;const Lc=zt(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*on)/bi,t=>t.getDate()-1);Lc.range;const vh=zt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/bi,t=>t.getUTCDate()-1);vh.range;const R2=zt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/bi,t=>Math.floor(t/bi));R2.range;function oo(t){return zt(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,r)=>{e.setDate(e.getDate()+r*7)},(e,r)=>(r-e-(r.getTimezoneOffset()-e.getTimezoneOffset())*on)/_w)}const yh=oo(0),wd=oo(1),zW=oo(2),qW=oo(3),rs=oo(4),UW=oo(5),HW=oo(6);yh.range;wd.range;zW.range;qW.range;rs.range;UW.range;HW.range;function so(t){return zt(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCDate(e.getUTCDate()+r*7)},(e,r)=>(r-e)/_w)}const xh=so(0),_d=so(1),WW=so(2),VW=so(3),ns=so(4),KW=so(5),GW=so(6);xh.range;_d.range;WW.range;VW.range;ns.range;KW.range;GW.range;const Cw=zt(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());Cw.range;const kw=zt(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());kw.range;const wi=zt(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());wi.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:zt(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,r)=>{e.setFullYear(e.getFullYear()+r*t)});wi.range;const _i=zt(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());_i.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:zt(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCFullYear(e.getUTCFullYear()+r*t)});_i.range;function I2(t,e,r,n,i,a){const o=[[Ca,1,ci],[Ca,5,5*ci],[Ca,15,15*ci],[Ca,30,30*ci],[a,1,on],[a,5,5*on],[a,15,15*on],[a,30,30*on],[i,1,ui],[i,3,3*ui],[i,6,6*ui],[i,12,12*ui],[n,1,bi],[n,2,2*bi],[r,1,_w],[e,1,uN],[e,3,3*uN],[t,1,Rv]];function s(u,d,f){const h=d<u;h&&([u,d]=[d,u]);const p=f&&typeof f.range=="function"?f:l(u,d,f),m=p?p.range(u,+d+1):[];return h?m.reverse():m}function l(u,d,f){const h=Math.abs(d-u)/f,p=uw(([,,v])=>v).right(o,h);if(p===o.length)return t.every(Dx(u/Rv,d/Rv,f));if(p===0)return bd.every(Math.max(Dx(u,d,f),1));const[m,g]=o[h/o[p-1][2]<o[p][2]/h?p-1:p];return m.every(g)}return[s,l]}const[YW,XW]=I2(_i,kw,xh,R2,Nw,jw),[JW,ZW]=I2(wi,Cw,yh,Lc,Ow,Sw);function Iv(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function $v(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Gs(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}function QW(t){var e=t.dateTime,r=t.date,n=t.time,i=t.periods,a=t.days,o=t.shortDays,s=t.months,l=t.shortMonths,u=Ys(i),d=Xs(i),f=Ys(a),h=Xs(a),p=Ys(o),m=Xs(o),g=Ys(s),v=Xs(s),y=Ys(l),w=Xs(l),_={a:$,A,b:F,B:V,c:null,d:gN,e:gN,f:_V,g:TV,G:DV,H:xV,I:bV,j:wV,L:$2,m:SV,M:jV,p:te,q:B,Q:xN,s:bN,S:OV,u:NV,U:CV,V:kV,w:AV,W:EV,x:null,X:null,y:PV,Y:MV,Z:RV,"%":yN},j={a:G,A:se,b:Q,B:ye,c:null,d:vN,e:vN,f:BV,g:YV,G:JV,H:IV,I:$V,j:LV,L:B2,m:FV,M:zV,p:re,q:ue,Q:xN,s:bN,S:qV,u:UV,U:HV,V:WV,w:VV,W:KV,x:null,X:null,y:GV,Y:XV,Z:ZV,"%":yN},b={a:T,A:k,b:M,B:E,c:L,d:pN,e:pN,f:mV,g:hN,G:fN,H:mN,I:mN,j:dV,L:pV,m:uV,M:fV,p:C,q:cV,Q:vV,s:yV,S:hV,u:iV,U:aV,V:oV,w:nV,W:sV,x:R,X:I,y:hN,Y:fN,Z:lV,"%":gV};_.x=O(r,_),_.X=O(n,_),_.c=O(e,_),j.x=O(r,j),j.X=O(n,j),j.c=O(e,j);function O(Y,z){return function(X){var U=[],me=-1,ge=0,Ee=Y.length,We,qe,ar;for(X instanceof Date||(X=new Date(+X));++me<Ee;)Y.charCodeAt(me)===37&&(U.push(Y.slice(ge,me)),(qe=dN[We=Y.charAt(++me)])!=null?We=Y.charAt(++me):qe=We==="e"?" ":"0",(ar=z[We])&&(We=ar(X,qe)),U.push(We),ge=me+1);return U.push(Y.slice(ge,me)),U.join("")}}function S(Y,z){return function(X){var U=Gs(1900,void 0,1),me=N(U,Y,X+="",0),ge,Ee;if(me!=X.length)return null;
vendor: 6,295 bytes, line 19
19if("Q"in U)return new Date(U.Q);if("s"in U)return new Date(U.s*1e3+("L"in U?U.L:0));if(z&&!("Z"in U)&&(U.Z=0),"p"in U&&(U.H=U.H%12+U.p*12),U.m===void 0&&(U.m="q"in U?U.q:0),"V"in U){if(U.V<1||U.V>53)return null;"w"in U||(U.w=1),"Z"in U?(ge=$v(Gs(U.y,0,1)),Ee=ge.getUTCDay(),ge=Ee>4||Ee===0?_d.ceil(ge):_d(ge),ge=vh.offset(ge,(U.V-1)*7),U.y=ge.getUTCFullYear(),U.m=ge.getUTCMonth(),U.d=ge.getUTCDate()+(U.w+6)%7):(ge=Iv(Gs(U.y,0,1)),Ee=ge.getDay(),ge=Ee>4||Ee===0?wd.ceil(ge):wd(ge),ge=Lc.offset(ge,(U.V-1)*7),U.y=ge.getFullYear(),U.m=ge.getMonth(),U.d=ge.getDate()+(U.w+6)%7)}else("W"in U||"U"in U)&&("w"in U||(U.w="u"in U?U.u%7:"W"in U?1:0),Ee="Z"in U?$v(Gs(U.y,0,1)).getUTCDay():Iv(Gs(U.y,0,1)).getDay(),U.m=0,U.d="W"in U?(U.w+6)%7+U.W*7-(Ee+5)%7:U.w+U.U*7-(Ee+6)%7);return"Z"in U?(U.H+=U.Z/100|0,U.M+=U.Z%100,$v(U)):Iv(U)}}function N(Y,z,X,U){for(var me=0,ge=z.length,Ee=X.length,We,qe;me<ge;){if(U>=Ee)return-1;if(We=z.charCodeAt(me++),We===37){if(We=z.charAt(me++),qe=b[We in dN?z.charAt(me++):We],!qe||(U=qe(Y,X,U))<0)return-1}else if(We!=X.charCodeAt(U++))return-1}return U}function C(Y,z,X){var U=u.exec(z.slice(X));return U?(Y.p=d.get(U[0].toLowerCase()),X+U[0].length):-1}function T(Y,z,X){var U=p.exec(z.slice(X));return U?(Y.w=m.get(U[0].toLowerCase()),X+U[0].length):-1}function k(Y,z,X){var U=f.exec(z.slice(X));return U?(Y.w=h.get(U[0].toLowerCase()),X+U[0].length):-1}function M(Y,z,X){var U=y.exec(z.slice(X));return U?(Y.m=w.get(U[0].toLowerCase()),X+U[0].length):-1}function E(Y,z,X){var U=g.exec(z.slice(X));return U?(Y.m=v.get(U[0].toLowerCase()),X+U[0].length):-1}function L(Y,z,X){return N(Y,e,z,X)}function R(Y,z,X){return N(Y,r,z,X)}function I(Y,z,X){return N(Y,n,z,X)}function $(Y){return o[Y.getDay()]}function A(Y){return a[Y.getDay()]}function F(Y){return l[Y.getMonth()]}function V(Y){return s[Y.getMonth()]}function te(Y){return i[+(Y.getHours()>=12)]}function B(Y){return 1+~~(Y.getMonth()/3)}function G(Y){return o[Y.getUTCDay()]}function se(Y){return a[Y.getUTCDay()]}function Q(Y){return l[Y.getUTCMonth()]}function ye(Y){return s[Y.getUTCMonth()]}function re(Y){return i[+(Y.getUTCHours()>=12)]}function ue(Y){return 1+~~(Y.getUTCMonth()/3)}return{format:function(Y){var z=O(Y+="",_);return z.toString=function(){return Y},z},parse:function(Y){var z=S(Y+="",!1);return z.toString=function(){return Y},z},utcFormat:function(Y){var z=O(Y+="",j);return z.toString=function(){return Y},z},utcParse:function(Y){var z=S(Y+="",!0);return z.toString=function(){return Y},z}}}var dN={"-":"",_:" ",0:"0"},Xt=/^\s*\d+/,eV=/^%/,tV=/[\\^$*+?|[\]().{}]/g;function Ge(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a<r?new Array(r-a+1).join(e)+i:i)}function rV(t){return t.replace(tV,"\\$&")}function Ys(t){return new RegExp("^(?:"+t.map(rV).join("|")+")","i")}function Xs(t){return new Map(t.map((e,r)=>[e.toLowerCase(),r]))}function nV(t,e,r){var n=Xt.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function iV(t,e,r){var n=Xt.exec(e.slice(r,r+1));return n?(t.u=+n[0],r+n[0].length):-1}function aV(t,e,r){var n=Xt.exec(e.slice(r,r+2));return n?(t.U=+n[0],r+n[0].length):-1}function oV(t,e,r){var n=Xt.exec(e.slice(r,r+2));return n?(t.V=+n[0],r+n[0].length):-1}function sV(t,e,r){var n=Xt.exec(e.slice(r,r+2));return n?(t.W=+n[0],r+n[0].length):-1}function fN(t,e,r){var n=Xt.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function hN(t,e,r){var n=Xt.exec(e.slice(r,r+2));return n?(t.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function lV(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function cV(t,e,r){var n=Xt.exec(e.slice(r,r+1));return n?(t.q=n[0]*3-3,r+n[0].length):-1}function uV(t,e,r){var n=Xt.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function pN(t,e,r){var n=Xt.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function dV(t,e,r){var n=Xt.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function mN(t,e,r){var n=Xt.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function fV(t,e,r){var n=Xt.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function hV(t,e,r){var n=Xt.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function pV(t,e,r){var n=Xt.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function mV(t,e,r){var n=Xt.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function gV(t,e,r){var n=eV.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function vV(t,e,r){var n=Xt.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function yV(t,e,r){var n=Xt.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function gN(t,e){return Ge(t.getDate(),e,2)}function xV(t,e){return Ge(t.getHours(),e,2)}function bV(t,e){return Ge(t.getHours()%12||12,e,2)}function wV(t,e){return Ge(1+Lc.count(wi(t),t),e,3)}function $2(t,e){return Ge(t.getMilliseconds(),e,3)}function _V(t,e){return $2(t,e)+"000"}function SV(t,e){return Ge(t.getMonth()+1,e,2)}function jV(t,e){return Ge(t.getMinutes(),e,2)}function OV(t,e){return Ge(t.getSeconds(),e,2)}function NV(t){var e=t.getDay();return e===0?7:e}function CV(t,e){return Ge(yh.count(wi(t)-1,t),e,2)}function L2(t){var e=t.getDay();return e>=4||e===0?rs(t):rs.ceil(t)}function kV(t,e){return t=L2(t),Ge(rs.count(wi(t),t)+(wi(t).getDay()===4),e,2)}function AV(t){return t.getDay()}function EV(t,e){return Ge(wd.count(wi(t)-1,t),e,2)}function PV(t,e){return Ge(t.getFullYear()%100,e,2)}function TV(t,e){return t=L2(t),Ge(t.getFullYear()%100,e,2)}function MV(t,e){return Ge(t.getFullYear()%1e4,e,4)}function DV(t,e){var r=t.getDay();return t=r>=4||r===0?rs(t):rs.ceil(t),Ge(t.getFullYear()%1e4,e,4)}function RV(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Ge(e/60|0,"0",2)+Ge(e%60,"0",2)}function vN(t,e){return Ge(t.getUTCDate(),e,2)}function IV(t,e){return Ge(t.getUTCHours(),e,2)}function $V(t,e){return Ge(t.getUTCHours()%12||12,e,2)}function LV(t,e){return Ge(1+vh.count(_i(t),t),e,3)}function B2(t,e){return Ge(t.getUTCMilliseconds(),e,3)}function BV(t,e){return B2(t,e)+"000"}function FV(t,e){return Ge(t.getUTCMonth()+1,e,2)}function zV(t,e){return Ge(t.getUTCMinutes(),e,2)}function qV(t,e){return Ge(t.getUTCSeconds(),e,2)}function UV(t){var e=t.getUTCDay();return e===0?7:e}
19function HV(t,e){return Ge(xh.count(_i(t)-1,t),e,2)}function F2(t){var e=t.getUTCDay();return e>=4||e===0?ns(t):ns.ceil(t)}function WV(t,e){return t=F2(t),Ge(ns.count(_i(t),t)+(_i(t).getUTCDay()===4),e,2)}function VV(t){return t.getUTCDay()}function KV(t,e){return Ge(_d.count(_i(t)-1,t),e,2)}function GV(t,e){return Ge(t.getUTCFullYear()%100,e,2)}function YV(t,e){return t=F2(t),Ge(t.getUTCFullYear()%100,e,2)}function XV(t,e){return Ge(t.getUTCFullYear()%1e4,e,4)}function JV(t,e){var r=t.getUTCDay();return t=r>=4||r===0?ns(t):ns.ceil(t),Ge(t.getUTCFullYear()%1e4,e,4)}function ZV(){return"+0000"}function yN(){return"%"}function xN(t){return+t}function bN(t){return Math.floor(+t/1e3)}var yo,z2,q2;QV({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function QV(t){return yo=QW(t),z2=yo.format,yo.parse,q2=yo.utcFormat,yo.utcParse,yo}function e9(t){return new Date(t)}function t9(t){return t instanceof Date?+t:+new Date(+t)}function Aw(t,e,r,n,i,a,o,s,l,u){var d=mw(),f=d.invert,h=d.domain,p=u(".%L"),m=u(":%S"),g=u("%I:%M"),v=u("%I %p"),y=u("%a %d"),w=u("%b %d"),_=u("%B"),j=u("%Y");function b(O){return(l(O)<O?p:s(O)<O?m:o(O)<O?g:a(O)<O?v:n(O)<O?i(O)<O?y:w:r(O)<O?_:j)(O)}return d.invert=function(O){return new Date(f(O))},d.domain=function(O){return arguments.length?h(Array.from(O,t9)):h().map(e9)},d.ticks=function(O){var S=h();return t(S[0],S[S.length-1],O??10)},d.tickFormat=function(O,S){return S==null?b:u(S)},d.nice=function(O){var S=h();return(!O||typeof O.range!="function")&&(O=e(S[0],S[S.length-1],O??10)),O?h(k2(S,O)):d},d.copy=function(){return $c(d,Aw(t,e,r,n,i,a,o,s,l,u))},d}function r9(){return dn.apply(Aw(JW,ZW,wi,Cw,yh,Lc,Ow,Sw,Ca,z2).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function n9(){return dn.apply(Aw(YW,XW,_i,kw,xh,vh,Nw,jw,Ca,q2).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function bh(){var t=0,e=1,r,n,i,a,o=Sr,s=!1,l;function u(f){return f==null||isNaN(f=+f)?l:o(i===0?.5:(f=(a(f)-r)*i,s?Math.max(0,Math.min(1,f)):f))}u.domain=function(f){return arguments.length?([t,e]=f,r=a(t=+t),n=a(e=+e),i=r===n?0:1/(n-r),u):[t,e]},u.clamp=function(f){return arguments.length?(s=!!f,u):s},u.interpolator=function(f){return arguments.length?(o=f,u):o};function d(f){return function(h){var p,m;return arguments.length?([p,m]=h,o=f(p,m),u):[o(0),o(1)]}}return u.range=d($s),u.rangeRound=d(pw),u.unknown=function(f){return arguments.length?(l=f,u):l},function(f){return a=f,r=f(t),n=f(e),i=r===n?0:1/(n-r),u}}function ia(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function U2(){var t=na(bh()(Sr));return t.copy=function(){return ia(t,U2())},Ci.apply(t,arguments)}function H2(){var t=yw(bh()).domain([1,10]);return t.copy=function(){return ia(t,H2()).base(t.base())},Ci.apply(t,arguments)}function W2(){var t=xw(bh());return t.copy=function(){return ia(t,W2()).constant(t.constant())},Ci.apply(t,arguments)}function Ew(){var t=bw(bh());return t.copy=function(){return ia(t,Ew()).exponent(t.exponent())},Ci.apply(t,arguments)}function i9(){return Ew.apply(null,arguments).exponent(.5)}function V2(){var t=[],e=Sr;function r(n){if(n!=null&&!isNaN(n=+n))return e((Rc(t,n,1)-1)/(t.length-1))}return r.domain=function(n){if(!arguments.length)return t.slice();t=[];for(let i of n)i!=null&&!isNaN(i=+i)&&t.push(i);return t.sort(Hi),r},r.interpolator=function(n){return arguments.length?(e=n,r):e},r.range=function(){return t.map((n,i)=>e(i/(t.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(i,a)=>H8(t,a/n))},r.copy=function(){return V2(e).domain(t)},Ci.apply(r,arguments)}function wh(){var t=0,e=.5,r=1,n=1,i,a,o,s,l,u=Sr,d,f=!1,h;
vendor: 64,881 bytes, lines 19-46
19function p(g){return isNaN(g=+g)?h:(g=.5+((g=+d(g))-a)*(n*g<n*a?s:l),u(f?Math.max(0,Math.min(1,g)):g))}p.domain=function(g){return arguments.length?([t,e,r]=g,i=d(t=+t),a=d(e=+e),o=d(r=+r),s=i===a?0:.5/(a-i),l=a===o?0:.5/(o-a),n=a<i?-1:1,p):[t,e,r]},p.clamp=function(g){return arguments.length?(f=!!g,p):f},p.interpolator=function(g){return arguments.length?(u=g,p):u};function m(g){return function(v){var y,w,_;return arguments.length?([y,w,_]=v,u=gW(g,[y,w,_]),p):[u(0),u(.5),u(1)]}}return p.range=m($s),p.rangeRound=m(pw),p.unknown=function(g){return arguments.length?(h=g,p):h},function(g){return d=g,i=g(t),a=g(e),o=g(r),s=i===a?0:.5/(a-i),l=a===o?0:.5/(o-a),n=a<i?-1:1,p}}function K2(){var t=na(wh()(Sr));return t.copy=function(){return ia(t,K2())},Ci.apply(t,arguments)}function G2(){var t=yw(wh()).domain([.1,1,10]);return t.copy=function(){return ia(t,G2()).base(t.base())},Ci.apply(t,arguments)}function Y2(){var t=xw(wh());return t.copy=function(){return ia(t,Y2()).constant(t.constant())},Ci.apply(t,arguments)}function Pw(){var t=bw(wh());return t.copy=function(){return ia(t,Pw()).exponent(t.exponent())},Ci.apply(t,arguments)}function a9(){return Pw.apply(null,arguments).exponent(.5)}const wN=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:Fl,scaleDiverging:K2,scaleDivergingLog:G2,scaleDivergingPow:Pw,scaleDivergingSqrt:a9,scaleDivergingSymlog:Y2,scaleIdentity:C2,scaleImplicit:Rx,scaleLinear:xd,scaleLog:A2,scaleOrdinal:dw,scalePoint:pl,scalePow:ww,scaleQuantile:T2,scaleQuantize:M2,scaleRadial:P2,scaleSequential:U2,scaleSequentialLog:H2,scaleSequentialPow:Ew,scaleSequentialQuantile:V2,scaleSequentialSqrt:i9,scaleSequentialSymlog:W2,scaleSqrt:BW,scaleSymlog:E2,scaleThreshold:D2,scaleTime:r9,scaleUtc:n9,tickFormat:N2},Symbol.toStringTag,{value:"Module"}));var Lv,_N;function _h(){if(_N)return Lv;_N=1;var t=Ms();function e(r,n,i){for(var a=-1,o=r.length;++a<o;){var s=r[a],l=n(s);if(l!=null&&(u===void 0?l===l&&!t(l):i(l,u)))var u=l,d=s}return d}return Lv=e,Lv}var Bv,SN;function X2(){if(SN)return Bv;SN=1;function t(e,r){return e>r}return Bv=t,Bv}var Fv,jN;function o9(){if(jN)return Fv;jN=1;var t=_h(),e=X2(),r=Is();function n(i){return i&&i.length?t(i,r,e):void 0}return Fv=n,Fv}var s9=o9();const Sh=at(s9);var zv,ON;function J2(){if(ON)return zv;ON=1;function t(e,r){return e<r}return zv=t,zv}var qv,NN;function l9(){if(NN)return qv;NN=1;var t=_h(),e=J2(),r=Is();function n(i){return i&&i.length?t(i,r,e):void 0}return qv=n,qv}var c9=l9();const jh=at(c9);var Uv,CN;function u9(){if(CN)return Uv;CN=1;var t=K0(),e=Xn(),r=a2(),n=Mr();function i(a,o){var s=n(a)?t:r;return s(a,e(o,3))}return Uv=i,Uv}var Hv,kN;function d9(){if(kN)return Hv;kN=1;var t=n2(),e=u9();function r(n,i){return t(e(n,i),1)}return Hv=r,Hv}var f9=d9();const h9=at(f9);var Wv,AN;function p9(){if(AN)return Wv;AN=1;var t=ow();function e(r,n){return t(r,n)}return Wv=e,Wv}var m9=p9();const Bc=at(m9);var Ls=1e9,g9={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},Mw,yt=!0,cn="[DecimalError] ",Ia=cn+"Invalid argument: ",Tw=cn+"Exponent out of range: ",Bs=Math.floor,wa=Math.pow,v9=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Fr,Ut=1e7,ht=7,Z2=9007199254740991,Sd=Bs(Z2/ht),de={};de.absoluteValue=de.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t};de.comparedTo=de.cmp=function(t){var e,r,n,i,a=this;if(t=new a.constructor(t),a.s!==t.s)return a.s||-t.s;if(a.e!==t.e)return a.e>t.e^a.s<0?1:-1;for(n=a.d.length,i=t.d.length,e=0,r=n<i?n:i;e<r;++e)if(a.d[e]!==t.d[e])return a.d[e]>t.d[e]^a.s<0?1:-1;return n===i?0:n>i^a.s<0?1:-1};de.decimalPlaces=de.dp=function(){var t=this,e=t.d.length-1,r=(e-t.e)*ht;if(e=t.d[e],e)for(;e%10==0;e/=10)r--;return r<0?0:r};de.dividedBy=de.div=function(t){return pi(this,new this.constructor(t))};de.dividedToIntegerBy=de.idiv=function(t){var e=this,r=e.constructor;return it(pi(e,new r(t),0,1),r.precision)};de.equals=de.eq=function(t){return!this.cmp(t)};de.exponent=function(){return Tt(this)};de.greaterThan=de.gt=function(t){return this.cmp(t)>0};de.greaterThanOrEqualTo=de.gte=function(t){return this.cmp(t)>=0};de.isInteger=de.isint=function(){return this.e>this.d.length-2};de.isNegative=de.isneg=function(){return this.s<0};de.isPositive=de.ispos=function(){return this.s>0};de.isZero=function(){return this.s===0};de.lessThan=de.lt=function(t){return this.cmp(t)<0};de.lessThanOrEqualTo=de.lte=function(t){return this.cmp(t)<1};de.logarithm=de.log=function(t){var e,r=this,n=r.constructor,i=n.precision,a=i+5;if(t===void 0)t=new n(10);else if(t=new n(t),t.s<1||t.eq(Fr))throw Error(cn+"NaN");if(r.s<1)throw Error(cn+(r.s?"NaN":"-Infinity"));return r.eq(Fr)?new n(0):(yt=!1,e=pi(Wl(r,a),Wl(t,a),a),yt=!0,it(e,i))};de.minus=de.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?tD(e,t):Q2(e,(t.s=-t.s,t))};de.modulo=de.mod=function(t){var e,r=this,n=r.constructor,i=n.precision;if(t=new n(t),!t.s)throw Error(cn+"NaN");return r.s?(yt=!1,e=pi(r,t,0,1).times(t),yt=!0,r.minus(e)):it(new n(r),i)};de.naturalExponential=de.exp=function(){return eD(this)};de.naturalLogarithm=de.ln=function(){return Wl(this)};de.negated=de.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};de.plus=de.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?Q2(e,t):tD(e,(t.s=-t.s,t))};de.precision=de.sd=function(t){var e,r,n,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Ia+t);if(e=Tt(i)+1,n=i.d.length-1,r=n*ht+1,n=i.d[n],n){for(;n%10==0;n/=10)r--;for(n=i.d[0];n>=10;n/=10)r++}return t&&e>r?e:r};de.squareRoot=de.sqrt=function(){var t,e,r,n,i,a,o,s=this,l=s.constructor;if(s.s<1){if(!s.s)return new l(0);throw Error(cn+"NaN")}for(t=Tt(s),yt=!1,i=Math.sqrt(+s),i==0||i==1/0?(e=Bn(s.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=Bs((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),n=new l(e)):n=new l(i.toString()),r=l.precision,i=o=r+3;;)if(a=n,n=a.plus(pi(s,a,o+2)).times(.5),Bn(a.d).slice(0,o)===(e=Bn(n.d)).slice(0,o)){if(e=e.slice(o-3,o+1),i==o&&e=="4999"){if(it(a,r+1,0),a.times(a).eq(s)){n=a;break}}else if(e!="9999")break;o+=4}return yt=!0,it(n,r)};de.times=de.mul=function(t){var e,r,n,i,a,o,s,l,u,d=this,f=d.constructor,h=d.d,p=(t=new f(t)).d;if(!d.s||!t.s)return new f(0);for(t.s*=d.s,r=d.e+t.e,l=h.length,u=p.length,l<u&&(a=h,h=p,p=a,o=l,l=u,u=o),a=[],o=l+u,n=o;n--;)a.push(0);for(n=u;--n>=0;){for(e=0,i=l+n;i>n;)s=a[i]+p[n]*h[i-n-1]+e,a[i--]=s%Ut|0,e=s/Ut|0;a[i]=(a[i]+e)%Ut|0}for(;!a[--o];)a.pop();return e?++r:a.shift(),t.d=a,t.e=r,yt?it(t,f.precision):t};de.toDecimalPlaces=de.todp=function(t,e){var r=this,n=r.constructor;return r=new n(r),t===void 0?r:(Hn(t,0,Ls),e===void 0?e=n.rounding:Hn(e,0,8),it(r,t+Tt(r)+1,e))};de.toExponential=function(t,e){var r,n=this,i=n.constructor;return t===void 0?r=Ya(n,!0):(Hn(t,0,Ls),e===void 0?e=i.rounding:Hn(e,0,8),n=it(new i(n),t+1,e),r=Ya(n,!0,t+1)),r};de.toFixed=function(t,e){var r,n,i=this,a=i.constructor;return t===void 0?Ya(i):(Hn(t,0,Ls),e===void 0?e=a.rounding:Hn(e,0,8),n=it(new a(i),t+Tt(i)+1,e),r=Ya(n.abs(),!1,t+Tt(n)+1),i.isneg()&&!i.isZero()?"-"+r:r)};de.toInteger=de.toint=function(){var t=this,e=t.constructor;return it(new e(t),Tt(t)+1,e.rounding)};de.toNumber=function(){return+this};de.toPower=de.pow=function(t){var e,r,n,i,a,o,s=this,l=s.constructor,u=12,d=+(t=new l(t));if(!t.s)return new l(Fr);if(s=new l(s),!s.s){if(t.s<1)throw Error(cn+"Infinity");return s}if(s.eq(Fr))return s;if(n=l.precision,t.eq(Fr))return it(s,n);if(e=t.e,r=t.d.length-1,o=e>=r,a=s.s,o){if((r=d<0?-d:d)<=Z2){for(i=new l(Fr),e=Math.ceil(n/ht+4),yt=!1;r%2&&(i=i.times(s),PN(i.d,e)),r=Bs(r/2),r!==0;)s=s.times(s),PN(s.d,e);return yt=!0,t.s<0?new l(Fr).div(i):it(i,n)}}else if(a<0)throw Error(cn+"NaN");return a=a<0&&t.d[Math.max(e,r)]&1?-1:1,s.s=1,yt=!1,i=t.times(Wl(s,n+u)),yt=!0,i=eD(i),i.s=a,i};de.toPrecision=function(t,e){var r,n,i=this,a=i.constructor;return t===void 0?(r=Tt(i),n=Ya(i,r<=a.toExpNeg||r>=a.toExpPos)):(Hn(t,1,Ls),e===void 0?e=a.rounding:Hn(e,0,8),i=it(new a(i),t,e),r=Tt(i),n=Ya(i,t<=r||r<=a.toExpNeg,t)),n};de.toSignificantDigits=de.tosd=function(t,e){var r=this,n=r.constructor;return t===void 0?(t=n.precision,e=n.rounding):(Hn(t,1,Ls),e===void 0?e=n.rounding:Hn(e,0,8)),it(new n(r),t,e)};de.toString=de.valueOf=de.val=de.toJSON=de[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=Tt(t),r=t.constructor;return Ya(t,e<=r.toExpNeg||e>=r.toExpPos)};function Q2(t,e){var r,n,i,a,o,s,l,u,d=t.constructor,f=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),yt?it(e,f):e;if(l=t.d,u=e.d,o=t.e,i=e.e,l=l.slice(),a=o-i,a){for(a<0?(n=l,a=-a,s=u.length):(n=u,i=o,s=l.length),o=Math.ceil(f/ht),s=o>s?o+1:s+1,a>s&&(a=s,n.length=1),n.reverse();a--;)n.push(0);n.reverse()}for(s=l.length,a=u.length,s-a<0&&(a=s,n=u,u=l,l=n),r=0;a;)r=(l[--a]=l[a]+u[a]+r)/Ut|0,l[a]%=Ut;for(r&&(l.unshift(r),++i),s=l.length;l[--s]==0;)l.pop();return e.d=l,e.e=i,yt?it(e,f):e}function Hn(t,e,r){if(t!==~~t||t<e||t>r)throw Error(Ia+t)}function Bn(t){var e,r,n,i=t.length-1,a="",o=t[0];if(i>0){for(a+=o,e=1;e<i;e++)n=t[e]+"",r=ht-n.length,r&&(a+=Mi(r)),a+=n;o=t[e],n=o+"",r=ht-n.length,r&&(a+=Mi(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return a+o}var pi=(function(){function t(n,i){var a,o=0,s=n.length;for(n=n.slice();s--;)a=n[s]*i+o,n[s]=a%Ut|0,o=a/Ut|0;return o&&n.unshift(o),n}function e(n,i,a,o){var s,l;if(a!=o)l=a>o?1:-1;else for(s=l=0;s<a;s++)if(n[s]!=i[s]){l=n[s]>i[s]?1:-1;break}return l}function r(n,i,a){for(var o=0;a--;)n[a]-=o,o=n[a]<i[a]?1:0,n[a]=o*Ut+n[a]-i[a];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,a,o){var s,l,u,d,f,h,p,m,g,v,y,w,_,j,b,O,S,N,C=n.constructor,T=n.s==i.s?1:-1,k=n.d,M=i.d;if(!n.s)return new C(n);if(!i.s)throw Error(cn+"Division by zero");for(l=n.e-i.e,S=M.length,b=k.length,p=new C(T),m=p.d=[],u=0;M[u]==(k[u]||0);)++u;if(M[u]>(k[u]||0)&&--l,a==null?w=a=C.precision:o?w=a+(Tt(n)-Tt(i))+1:w=a,w<0)return new C(0);if(w=w/ht+2|0,u=0,S==1)for(d=0,M=M[0],w++;(u<b||d)&&w--;u++)_=d*Ut+(k[u]||0),m[u]=_/M|0,d=_%M|0;else{for(d=Ut/(M[0]+1)|0,d>1&&(M=t(M,d),k=t(k,d),S=M.length,b=k.length),j=S,g=k.slice(0,S),v=g.length;v<S;)g[v++]=0;N=M.slice(),N.unshift(0),O=M[0],M[1]>=Ut/2&&++O;do d=0,s=e(M,g,S,v),s<0?(y=g[0],S!=v&&(y=y*Ut+(g[1]||0)),d=y/O|0,d>1?(d>=Ut&&(d=Ut-1),f=t(M,d),h=f.length,v=g.length,s=e(f,g,h,v),s==1&&(d--,r(f,S<h?N:M,h))):(d==0&&(s=d=1),f=M.slice()),h=f.length,h<v&&f.unshift(0),r(g,f,v),s==-1&&(v=g.length,s=e(M,g,S,v),s<1&&(d++,r(g,S<v?N:M,v))),v=g.length):s===0&&(d++,g=[0]),m[u++]=d,s&&g[0]?g[v++]=k[j]||0:(g=[k[j]],v=1);while((j++<b||g[0]!==void 0)&&w--)}return m[0]||m.shift(),p.e=l,it(p,o?a+Tt(p)+1:a)}})();function eD(t,e){var r,n,i,a,o,s,l=0,u=0,d=t.constructor,f=d.precision;if(Tt(t)>16)throw Error(Tw+Tt(t));if(!t.s)return new d(Fr);for(yt=!1,s=f,o=new d(.03125);t.abs().gte(.1);)t=t.times(o),u+=5;for(n=Math.log(wa(2,u))/Math.LN10*2+5|0,s+=n,r=i=a=new d(Fr),d.precision=s;;){if(i=it(i.times(t),s),r=r.times(++l),o=a.plus(pi(i,r,s)),Bn(o.d).slice(0,s)===Bn(a.d).slice(0,s)){for(;u--;)a=it(a.times(a),s);return d.precision=f,e==null?(yt=!0,it(a,f)):a}a=o}}function Tt(t){for(var e=t.e*ht,r=t.d[0];r>=10;r/=10)e++;return e}function Vv(t,e,r){if(e>t.LN10.sd())throw yt=!0,r&&(t.precision=r),Error(cn+"LN10 precision limit exceeded");return it(new t(t.LN10),e)}function Mi(t){for(var e="";t--;)e+="0";return e}function Wl(t,e){var r,n,i,a,o,s,l,u,d,f=1,h=10,p=t,m=p.d,g=p.constructor,v=g.precision;if(p.s<1)throw Error(cn+(p.s?"NaN":"-Infinity"));if(p.eq(Fr))return new g(0);if(e==null?(yt=!1,u=v):u=e,p.eq(10))return e==null&&(yt=!0),Vv(g,u);if(u+=h,g.precision=u,r=Bn(m),n=r.charAt(0),a=Tt(p),Math.abs(a)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)p=p.times(t),r=Bn(p.d),n=r.charAt(0),f++;a=Tt(p),n>1?(p=new g("0."+r),a++):p=new g(n+"."+r.slice(1))}else return l=Vv(g,u+2,v).times(a+""),p=Wl(new g(n+"."+r.slice(1)),u-h).plus(l),g.precision=v,e==null?(yt=!0,it(p,v)):p;for(s=o=p=pi(p.minus(Fr),p.plus(Fr),u),d=it(p.times(p),u),i=3;;){if(o=it(o.times(d),u),l=s.plus(pi(o,new g(i),u)),Bn(l.d).slice(0,u)===Bn(s.d).slice(0,u))return s=s.times(2),a!==0&&(s=s.plus(Vv(g,u+2,v).times(a+""))),s=pi(s,new g(f),u),g.precision=v,e==null?(yt=!0,it(s,v)):s;s=l,i+=2}}function EN(t,e){var r,n,i;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;e.charCodeAt(n)===48;)++n;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(n,i),e){if(i-=n,r=r-n-1,t.e=Bs(r/ht),t.d=[],n=(r+1)%ht,r<0&&(n+=ht),n<i){for(n&&t.d.push(+e.slice(0,n)),i-=ht;n<i;)t.d.push(+e.slice(n,n+=ht));e=e.slice(n),n=ht-e.length}else n-=i;for(;n--;)e+="0";if(t.d.push(+e),yt&&(t.e>Sd||t.e<-Sd))throw Error(Tw+r)}else t.s=0,t.e=0,t.d=[0];return t}function it(t,e,r){var n,i,a,o,s,l,u,d,f=t.d;for(o=1,a=f[0];a>=10;a/=10)o++;if(n=e-o,n<0)n+=ht,i=e,u=f[d=0];else{if(d=Math.ceil((n+1)/ht),a=f.length,d>=a)return t;for(u=a=f[d],o=1;a>=10;a/=10)o++;n%=ht,i=n-ht+o}if(r!==void 0&&(a=wa(10,o-i-1),s=u/a%10|0,l=e<0||f[d+1]!==void 0||u%a,l=r<4?(s||l)&&(r==0||r==(t.s<0?3:2)):s>5||s==5&&(r==4||l||r==6&&(n>0?i>0?u/wa(10,o-i):0:f[d-1])%10&1||r==(t.s<0?8:7))),e<1||!f[0])return l?(a=Tt(t),f.length=1,e=e-a-1,f[0]=wa(10,(ht-e%ht)%ht),t.e=Bs(-e/ht)||0):(f.length=1,f[0]=t.e=t.s=0),t;if(n==0?(f.length=d,a=1,d--):(f.length=d+1,a=wa(10,ht-n),f[d]=i>0?(u/wa(10,o-i)%wa(10,i)|0)*a:0),l)for(;;)if(d==0){(f[0]+=a)==Ut&&(f[0]=1,++t.e);break}else{if(f[d]+=a,f[d]!=Ut)break;f[d--]=0,a=1}for(n=f.length;f[--n]===0;)f.pop();if(yt&&(t.e>Sd||t.e<-Sd))throw Error(Tw+Tt(t));return t}function tD(t,e){var r,n,i,a,o,s,l,u,d,f,h=t.constructor,p=h.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new h(t),yt?it(e,p):e;if(l=t.d,f=e.d,n=e.e,u=t.e,l=l.slice(),o=u-n,o){for(d=o<0,d?(r=l,o=-o,s=f.length):(r=f,n=u,s=l.length),i=Math.max(Math.ceil(p/ht),s)+2,o>i&&(o=i,r.length=1),r.reverse(),i=o;i--;)r.push(0);r.reverse()}else{for(i=l.length,s=f.length,d=i<s,d&&(s=i),i=0;i<s;i++)if(l[i]!=f[i]){d=l[i]<f[i];break}o=0}for(d&&(r=l,l=f,f=r,e.s=-e.s),s=l.length,i=f.length-s;i>0;--i)l[s++]=0;for(i=f.length;i>o;){if(l[--i]<f[i]){for(a=i;a&&l[--a]===0;)l[a]=Ut-1;--l[a],l[i]+=Ut}l[i]-=f[i]}for(;l[--s]===0;)l.pop();for(;l[0]===0;l.shift())--n;return l[0]?(e.d=l,e.e=n,yt?it(e,p):e):new h(0)}function Ya(t,e,r){var n,i=Tt(t),a=Bn(t.d),o=a.length;return e?(r&&(n=r-o)>0?a=a.charAt(0)+"."+a.slice(1)+Mi(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+Mi(-i-1)+a,r&&(n=r-o)>0&&(a+=Mi(n))):i>=o?(a+=Mi(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+Mi(n))):((n=i+1)<o&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(a+="."),a+=Mi(n))),t.s<0?"-"+a:a}function PN(t,e){if(t.length>e)return t.length=e,!0}function rD(t){var e,r,n;function i(a){var o=this;if(!(o instanceof i))return new i(a);if(o.constructor=i,a instanceof i){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(Ia+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return EN(o,a.toString())}else if(typeof a!="string")throw Error(Ia+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,v9.test(a))EN(o,a);else throw Error(Ia+a)}if(i.prototype=de,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=rD,i.config=i.set=y9,t===void 0&&(t={}),t)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e<n.length;)t.hasOwnProperty(r=n[e++])||(t[r]=this[r]);return i.config(t),i}function y9(t){if(!t||typeof t!="object")throw Error(cn+"Object expected");var e,r,n,i=["precision",1,Ls,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e<i.length;e+=3)if((n=t[r=i[e]])!==void 0)if(Bs(n)===n&&n>=i[e+1]&&n<=i[e+2])this[r]=n;else throw Error(Ia+r+": "+n);if((n=t[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(Ia+r+": "+n);return this}var Mw=rD(g9);Fr=new Mw(1);const rt=Mw;function x9(t){return S9(t)||_9(t)||w9(t)||b9()}function b9(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 20In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w9(t,e){if(t){if(typeof t=="string")return Bx(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Bx(t,e)}}function _9(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function S9(t){if(Array.isArray(t))return Bx(t)}function Bx(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var j9=function(e){return e},nD={},iD=function(e){return e===nD},TN=function(e){return function r(){return arguments.length===0||arguments.length===1&&iD(arguments.length<=0?void 0:arguments[0])?r:e.apply(void 0,arguments)}},O9=function t(e,r){return e===1?r:TN(function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var o=i.filter(function(s){return s!==nD}).length;return o>=e?r.apply(void 0,i):t(e-o,TN(function(){for(var s=arguments.length,l=new Array(s),u=0;u<s;u++)l[u]=arguments[u];var d=i.map(function(f){return iD(f)?l.shift():f});return r.apply(void 0,x9(d).concat(l))}))})},Oh=function(e){return O9(e.length,e)},Fx=function(e,r){for(var n=[],i=e;i<r;++i)n[i-e]=i;return n},N9=Oh(function(t,e){return Array.isArray(e)?e.map(t):Object.keys(e).map(function(r){return e[r]}).map(t)}),C9=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];if(!r.length)return j9;var i=r.reverse(),a=i[0],o=i.slice(1);return function(){return o.reduce(function(s,l){return l(s)},a.apply(void 0,arguments))}},zx=function(e){return Array.isArray(e)?e.reverse():e.split("").reverse.join("")},aD=function(e){var r=null,n=null;return function(){for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return r&&a.every(function(s,l){return s===r[l]})||(r=a,n=e.apply(void 0,a)),n}};function k9(t){var e;return t===0?e=1:e=Math.floor(new rt(t).abs().log(10).toNumber())+1,e}function A9(t,e,r){for(var n=new rt(t),i=0,a=[];n.lt(e)&&i<1e5;)a.push(n.toNumber()),n=n.add(r),i++;return a}var E9=Oh(function(t,e,r){var n=+t,i=+e;return n+r*(i-n)}),P9=Oh(function(t,e,r){var n=e-+t;return n=n||1/0,(r-t)/n}),T9=Oh(function(t,e,r){var n=e-+t;return n=n||1/0,Math.max(0,Math.min(1,(r-t)/n))});const Nh={rangeStep:A9,getDigitCount:k9,interpolateNumber:E9,uninterpolateNumber:P9,uninterpolateTruncation:T9};function qx(t){return R9(t)||D9(t)||oD(t)||M9()}function M9(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 21In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function D9(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function R9(t){if(Array.isArray(t))return Ux(t)}function Vl(t,e){return L9(t)||$9(t,e)||oD(t,e)||I9()}function I9(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 22In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function oD(t,e){if(t){if(typeof t=="string")return Ux(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ux(t,e)}}function Ux(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function $9(t,e){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(t)))){var r=[],n=!0,i=!1,a=void 0;try{for(var o=t[Symbol.iterator](),s;!(n=(s=o.next()).done)&&(r.push(s.value),!(e&&r.length===e));n=!0);}catch(l){i=!0,a=l}finally{try{!n&&o.return!=null&&o.return()}finally{if(i)throw a}}return r}}function L9(t){if(Array.isArray(t))return t}function sD(t){var e=Vl(t,2),r=e[0],n=e[1],i=r,a=n;return r>n&&(i=n,a=r),[i,a]}function lD(t,e,r){if(t.lte(0))return new rt(0);var n=Nh.getDigitCount(t.toNumber()),i=new rt(10).pow(n),a=t.div(i),o=n!==1?.05:.1,s=new rt(Math.ceil(a.div(o).toNumber())).add(r).mul(o),l=s.mul(i);return e?l:new rt(Math.ceil(l))}function B9(t,e,r){var n=1,i=new rt(t);if(!i.isint()&&r){var a=Math.abs(t);a<1?(n=new rt(10).pow(Nh.getDigitCount(t)-1),i=new rt(Math.floor(i.div(n).toNumber())).mul(n)):a>1&&(i=new rt(Math.floor(t)))}else t===0?i=new rt(Math.floor((e-1)/2)):r||(i=new rt(Math.floor(t)));var o=Math.floor((e-1)/2),s=C9(N9(function(l){return i.add(new rt(l-o).mul(n)).toNumber()}),Fx);return s(0,e)}function cD(t,e,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((e-t)/(r-1)))return{step:new rt(0),tickMin:new rt(0),tickMax:new rt(0)};var a=lD(new rt(e).sub(t).div(r-1),n,i),o;t<=0&&e>=0?o=new rt(0):(o=new rt(t).add(e).div(2),o=o.sub(new rt(o).mod(a)));var s=Math.ceil(o.sub(t).div(a).toNumber()),l=Math.ceil(new rt(e).sub(o).div(a).toNumber()),u=s+l+1;return u>r?cD(t,e,r,n,i+1):(u<r&&(l=e>0?l+(r-u):l,s=e>0?s:s+(r-u)),{step:a,tickMin:o.sub(new rt(s).mul(a)),tickMax:o.add(new rt(l).mul(a))})}function F9(t){var e=Vl(t,2),r=e[0],n=e[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),s=sD([r,n]),l=Vl(s,2),u=l[0],d=l[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(qx(Fx(0,i-1).map(function(){return 1/0}))):[].concat(qx(Fx(0,i-1).map(function(){return-1/0})),[d]);return r>n?zx(f):f}if(u===d)return B9(u,i,a);var h=cD(u,d,o,a),p=h.step,m=h.tickMin,g=h.tickMax,v=Nh.rangeStep(m,g.add(new rt(.1).mul(p)),p);return r>n?zx(v):v}function z9(t,e){var r=Vl(t,2),n=r[0],i=r[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=sD([n,i]),s=Vl(o,2),l=s[0],u=s[1];if(l===-1/0||u===1/0)return[n,i];if(l===u)return[l];var d=Math.max(e,2),f=lD(new rt(u).sub(l).div(d-1),a,0),h=[].concat(qx(Nh.rangeStep(new rt(l),new rt(u).sub(new rt(.99).mul(f)),f)),[u]);return n>i?zx(h):h}var q9=aD(F9),U9=aD(z9),H9="Invariant failed";function Xa(t,e){throw new Error(H9)}var W9=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function is(t){"@babel/helpers - typeof";return is=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},is(t)}function jd(){return jd=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},jd.apply(this,arguments)}function V9(t,e){return X9(t)||Y9(t,e)||G9(t,e)||K9()}function K9(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 23In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function G9(t,e){if(t){if(typeof t=="string")return MN(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return MN(t,e)}}function MN(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Y9(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}function X9(t){if(Array.isArray(t))return t}function J9(t,e){if(t==null)return{};var r=Z9(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Z9(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function Q9(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e7(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,fD(n.key),n)}}function t7(t,e,r){return e&&e7(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function r7(t,e,r){return e=Od(e),n7(t,uD()?Reflect.construct(e,r||[],Od(t).constructor):e.apply(t,r))}function n7(t,e){if(e&&(is(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return i7(t)}function i7(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function uD(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(uD=function(){return!!t})()}function Od(t){return Od=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Od(t)}function a7(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Hx(t,e)}function Hx(t,e){return Hx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Hx(t,e)}function dD(t,e,r){return e=fD(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fD(t){var e=o7(t,"string");return is(e)=="symbol"?e:e+""}function o7(t,e){if(is(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(is(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Fc=(function(t){function e(){return Q9(this,e),r7(this,e,arguments)}return a7(e,t),t7(e,[{key:"render",value:function(){var n=this.props,i=n.offset,a=n.layout,o=n.width,s=n.dataKey,l=n.data,u=n.dataPointFormatter,d=n.xAxis,f=n.yAxis,h=J9(n,W9),p=_e(h,!1);this.props.direction==="x"&&d.type!=="number"&&Xa();var m=l.map(function(g){var v=u(g,s),y=v.x,w=v.y,_=v.value,j=v.errorVal;if(!j)return null;var b=[],O,S;if(Array.isArray(j)){var N=V9(j,2);O=N[0],S=N[1]}else O=S=j;if(a==="vertical"){var C=d.scale,T=w+i,k=T+o,M=T-o,E=C(_-O),L=C(_+S);b.push({x1:L,y1:k,x2:L,y2:M}),b.push({x1:E,y1:T,x2:L,y2:T}),b.push({x1:E,y1:k,x2:E,y2:M})}else if(a==="horizontal"){var R=f.scale,I=y+i,$=I-o,A=I+o,F=R(_-O),V=R(_+S);b.push({x1:$,y1:V,x2:A,y2:V}),b.push({x1:I,y1:F,x2:I,y2:V}),b.push({x1:$,y1:F,x2:A,y2:F})}return D.createElement(Ke,jd({className:"recharts-errorBar",key:"bar-".concat(b.map(function(te){return"".concat(te.x1,"-").concat(te.x2,"-").concat(te.y1,"-").concat(te.y2)}))},p),b.map(function(te){return D.createElement("line",jd({},te,{key:"line-".concat(te.x1,"-").concat(te.x2,"-").concat(te.y1,"-").concat(te.y2)}))}))});return D.createElement(Ke,{className:"recharts-errorBars"},m)}}])})(D.Component);dD(Fc,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});dD(Fc,"displayName","ErrorBar");function Kl(t){"@babel/helpers - typeof";return Kl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Kl(t)}function DN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ga(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?DN(Object(r),!0).forEach(function(n){s7(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):DN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function s7(t,e,r){return e=l7(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function l7(t){var e=c7(t,"string");return Kl(e)=="symbol"?e:e+""}function c7(t,e){if(Kl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Kl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var hD=function(e){var r=e.children,n=e.formattedGraphicalItems,i=e.legendWidth,a=e.legendContent,o=Lr(r,Da);if(!o)return null;var s=Da.defaultProps,l=s!==void 0?ga(ga({},s),o.props):{},u;return o.props&&o.props.payload?u=o.props&&o.props.payload:a==="children"?u=(n||[]).reduce(function(d,f){var h=f.item,p=f.props,m=p.sectors||p.data||[];return d.concat(m.map(function(g){return{type:o.props.iconType||h.props.legendType,value:g.name,color:g.fill,payload:g}}))},[]):u=(n||[]).map(function(d){var f=d.item,h=f.type.defaultProps,p=h!==void 0?ga(ga({},h),f.props):{},m=p.dataKey,g=p.name,v=p.legendType,y=p.hide;return{inactive:y,dataKey:m,type:l.iconType||v||"square",color:Dw(f),value:g||m,payload:p}}),ga(ga(ga({},l),Da.getWithHeight(o,i)),{},{payload:u,item:o})};function Gl(t){"@babel/helpers - typeof";return Gl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gl(t)}function RN(t){return h7(t)||f7(t)||d7(t)||u7()}function u7(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 24In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function d7(t,e){if(t){if(typeof t=="string")return Wx(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Wx(t,e)}}function f7(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function h7(t){if(Array.isArray(t))return Wx(t)}function Wx(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function IN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function St(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?IN(Object(r),!0).forEach(function(n){Bo(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):IN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Bo(t,e,r){return e=p7(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function p7(t){var e=m7(t,"string");return Gl(e)=="symbol"?e:e+""}function m7(t,e){if(Gl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Gl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Lt(t,e,r){return Me(t)||Me(e)?r:Bt(e)?Ur(t,e,r):ke(e)?e(t):r}function ml(t,e,r,n){var i=h9(t,function(s){return Lt(s,e)});if(r==="number"){var a=i.filter(function(s){return ie(s)||parseFloat(s)});return a.length?[jh(a),Sh(a)]:[1/0,-1/0]}var o=n?i.filter(function(s){return!Me(s)}):i;return o.map(function(s){return Bt(s)||s instanceof Date?s:""})}var g7=function(e){var r,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,o=-1,s=(r=n?.length)!==null&&r!==void 0?r:0;if(s<=1)return 0;if(a&&a.axisType==="angleAxis"&&Math.abs(Math.abs(a.range[1]-a.range[0])-360)<=1e-6)for(var l=a.range,u=0;u<s;u++){var d=u>0?i[u-1].coordinate:i[s-1].coordinate,f=i[u].coordinate,h=u>=s-1?i[0].coordinate:i[u+1].coordinate,p=void 0;if(wr(f-d)!==wr(h-f)){var m=[];if(wr(h-f)===wr(l[1]-l[0])){p=h;var g=f+l[1]-l[0];m[0]=Math.min(g,(g+d)/2),m[1]=Math.max(g,(g+d)/2)}else{p=d;var v=h+l[1]-l[0];m[0]=Math.min(f,(v+f)/2),m[1]=Math.max(f,(v+f)/2)}var y=[Math.min(f,(p+f)/2),Math.max(f,(p+f)/2)];if(e>y[0]&&e<=y[1]||e>=m[0]&&e<=m[1]){o=i[u].index;break}}else{var w=Math.min(d,h),_=Math.max(d,h);if(e>(w+f)/2&&e<=(_+f)/2){o=i[u].index;break}}}else for(var j=0;j<s;j++)if(j===0&&e<=(n[j].coordinate+n[j+1].coordinate)/2||j>0&&j<s-1&&e>(n[j].coordinate+n[j-1].coordinate)/2&&e<=(n[j].coordinate+n[j+1].coordinate)/2||j===s-1&&e>(n[j].coordinate+n[j-1].coordinate)/2){o=n[j].index;break}return o},Dw=function(e){var r,n=e,i=n.type.displayName,a=(r=e.type)!==null&&r!==void 0&&r.defaultProps?St(St({},e.type.defaultProps),e.props):e.props,o=a.stroke,s=a.fill,l;switch(i){case"Line":l=o;break;case"Area":case"Radar":l=o&&o!=="none"?o:s;break;default:l=s;break}return l},v7=function(e){var r=e.barSize,n=e.totalSize,i=e.stackGroups,a=i===void 0?{}:i;if(!a)return{};for(var o={},s=Object.keys(a),l=0,u=s.length;l<u;l++)for(var d=a[s[l]].stackGroups,f=Object.keys(d),h=0,p=f.length;h<p;h++){var m=d[f[h]],g=m.items,v=m.cateAxisId,y=g.filter(function(S){return hi(S.type).indexOf("Bar")>=0});if(y&&y.length){var w=y[0].type.defaultProps,_=w!==void 0?St(St({},w),y[0].props):y[0].props,j=_.barSize,b=_[v];o[b]||(o[b]=[]);var O=Me(j)?r:j;o[b].push({item:y[0],stackList:y.slice(1),barSize:Me(O)?void 0:_r(O,n,0)})}}return o},y7=function(e){var r=e.barGap,n=e.barCategoryGap,i=e.bandSize,a=e.sizeList,o=a===void 0?[]:a,s=e.maxBarSize,l=o.length;if(l<1)return null;var u=_r(r,i,0,!0),d,f=[];if(o[0].barSize===+o[0].barSize){var h=!1,p=i/l,m=o.reduce(function(j,b){return j+b.barSize||0},0);m+=(l-1)*u,m>=i&&(m-=(l-1)*u,u=0),m>=i&&p>0&&(h=!0,p*=.9,m=l*p);var g=(i-m)/2>>0,v={offset:g-u,size:0};d=o.reduce(function(j,b){var O={item:b.item,position:{offset:v.offset+v.size+u,size:h?p:b.barSize}},S=[].concat(RN(j),[O]);return v=S[S.length-1].position,b.stackList&&b.stackList.length&&b.stackList.forEach(function(N){S.push({item:N,position:v})}),S},f)}else{var y=_r(n,i,0,!0);i-2*y-(l-1)*u<=0&&(u=0);var w=(i-2*y-(l-1)*u)/l;w>1&&(w>>=0);var _=s===+s?Math.min(w,s):w;d=o.reduce(function(j,b,O){var S=[].concat(RN(j),[{item:b.item,position:{offset:y+(w+u)*O+(w-_)/2,size:_}}]);return b.stackList&&b.stackList.length&&b.stackList.forEach(function(N){S.push({item:N,position:S[S.length-1].position})}),S},f)}return d},x7=function(e,r,n,i){var a=n.children,o=n.width,s=n.margin,l=o-(s.left||0)-(s.right||0),u=hD({children:a,legendWidth:l});if(u){var d=i||{},f=d.width,h=d.height,p=u.align,m=u.verticalAlign,g=u.layout;if((g==="vertical"||g==="horizontal"&&m==="middle")&&p!=="center"&&ie(e[p]))return St(St({},e),{},Bo({},p,e[p]+(f||0)));if((g==="horizontal"||g==="vertical"&&p==="center")&&m!=="middle"&&ie(e[m]))return St(St({},e),{},Bo({},m,e[m]+(h||0)))}return e},b7=function(e,r,n){return Me(r)?!0:e==="horizontal"?r==="yAxis":e==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},pD=function(e,r,n,i,a){var o=r.props.children,s=Hr(o,Fc).filter(function(u){return b7(i,a,u.props.direction)});if(s&&s.length){var l=s.map(function(u){return u.props.dataKey});return e.reduce(function(u,d){var f=Lt(d,n);if(Me(f))return u;var h=Array.isArray(f)?[jh(f),Sh(f)]:[f,f],p=l.reduce(function(m,g){var v=Lt(d,g,0),y=h[0]-Math.abs(Array.isArray(v)?v[0]:v),w=h[1]+Math.abs(Array.isArray(v)?v[1]:v);return[Math.min(y,m[0]),Math.max(w,m[1])]},[1/0,-1/0]);return[Math.min(p[0],u[0]),Math.max(p[1],u[1])]},[1/0,-1/0])}return null},w7=function(e,r,n,i,a){var o=r.map(function(s){return pD(e,s,n,a,i)}).filter(function(s){return!Me(s)});return o&&o.length?o.reduce(function(s,l){return[Math.min(s[0],l[0]),Math.max(s[1],l[1])]},[1/0,-1/0]):null},mD=function(e,r,n,i,a){var o=r.map(function(l){var u=l.props.dataKey;return n==="number"&&u&&pD(e,l,u,i)||ml(e,u,n,a)});if(n==="number")return o.reduce(function(l,u){return[Math.min(l[0],u[0]),Math.max(l[1],u[1])]},[1/0,-1/0]);var s={};return o.reduce(function(l,u){for(var d=0,f=u.length;d<f;d++)s[u[d]]||(s[u[d]]=!0,l.push(u[d]));return l},[])},gD=function(e,r){return e==="horizontal"&&r==="xAxis"||e==="vertical"&&r==="yAxis"||e==="centric"&&r==="angleAxis"||e==="radial"&&r==="radiusAxis"},vD=function(e,r,n,i){if(i)return e.map(function(l){return l.coordinate});var a,o,s=e.map(function(l){return l.coordinate===r&&(a=!0),l.coordinate===n&&(o=!0),l.coordinate});return a||s.push(r),o||s.push(n),s},di=function(e,r,n){if(!e)return null;var i=e.scale,a=e.duplicateDomain,o=e.type,s=e.range,l=e.realScaleType==="scaleBand"?i.bandwidth()/2:2,u=(r||n)&&o==="category"&&i.bandwidth?i.bandwidth()/l:0;if(u=e.axisType==="angleAxis"&&s?.length>=2?wr(s[0]-s[1])*2*u:u,r&&(e.ticks||e.niceTicks)){var d=(e.ticks||e.niceTicks).map(function(f){var h=a?a.indexOf(f):f;return{coordinate:i(h)+u,value:f,offset:u}});return d.filter(function(f){return!Mc(f.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(f,h){return{coordinate:i(f)+u,value:f,index:h,offset:u}}):i.ticks&&!n?i.ticks(e.tickCount).map(function(f){return{coordinate:i(f)+u,value:f,offset:u}}):i.domain().map(function(f,h){return{coordinate:i(f)+u,value:a?a[f]:f,index:h,offset:u}})},Kv=new WeakMap,lu=function(e,r){if(typeof r!="function")return e;Kv.has(e)||Kv.set(e,new WeakMap);var n=Kv.get(e);if(n.has(r))return n.get(r);var i=function(){e.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,i),i},yD=function(e,r,n){var i=e.scale,a=e.type,o=e.layout,s=e.axisType;if(i==="auto")return o==="radial"&&s==="radiusAxis"?{scale:Fl(),realScaleType:"band"}:o==="radial"&&s==="angleAxis"?{scale:xd(),realScaleType:"linear"}:a==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:pl(),realScaleType:"point"}:a==="category"?{scale:Fl(),realScaleType:"band"}:{scale:xd(),realScaleType:"linear"};if(Va(i)){var l="scale".concat(lh(i));return{scale:(wN[l]||pl)(),realScaleType:wN[l]?l:"point"}}return ke(i)?{scale:i}:{scale:pl(),realScaleType:"point"}},$N=1e-4,xD=function(e){var r=e.domain();if(!(!r||r.length<=2)){var n=r.length,i=e.range(),a=Math.min(i[0],i[1])-$N,o=Math.max(i[0],i[1])+$N,s=e(r[0]),l=e(r[n-1]);(s<a||s>o||l<a||l>o)&&e.domain([r[0],r[n-1]])}},_7=function(e,r){if(!e)return null;for(var n=0,i=e.length;n<i;n++)if(e[n].item===r)return e[n].position;return null},S7=function(e,r){if(!r||r.length!==2||!ie(r[0])||!ie(r[1]))return e;var n=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]),a=[e[0],e[1]];return(!ie(e[0])||e[0]<n)&&(a[0]=n),(!ie(e[1])||e[1]>i)&&(a[1]=i),a[0]>i&&(a[0]=i),a[1]<n&&(a[1]=n),a},j7=function(e){var r=e.length;if(!(r<=0))for(var n=0,i=e[0].length;n<i;++n)for(var a=0,o=0,s=0;s<r;++s){var l=Mc(e[s][n][1])?e[s][n][0]:e[s][n][1];l>=0?(e[s][n][0]=a,e[s][n][1]=a+l,a=e[s][n][1]):(e[s][n][0]=o,e[s][n][1]=o+l,o=e[s][n][1])}},O7=function(e){var r=e.length;if(!(r<=0))for(var n=0,i=e[0].length;n<i;++n)for(var a=0,o=0;o<r;++o){var s=Mc(e[o][n][1])?e[o][n][0]:e[o][n][1];s>=0?(e[o][n][0]=a,e[o][n][1]=a+s,a=e[o][n][1]):(e[o][n][0]=0,e[o][n][1]=0)}},N7={sign:j7,expand:h6,none:Xo,silhouette:p6,wiggle:m6,positive:O7},C7=function(e,r,n){var i=r.map(function(s){return s.props.dataKey}),a=N7[n],o=f6().keys(i).value(function(s,l){return+Lt(s,l,0)}).order(wx).offset(a);return o(e)},k7=function(e,r,n,i,a,o){if(!e)return null;var s=o?r.reverse():r,l={},u=s.reduce(function(f,h){var p,m=(p=h.type)!==null&&p!==void 0&&p.defaultProps?St(St({},h.type.defaultProps),h.props):h.props,g=m.stackId,v=m.hide;if(v)return f;var y=m[n],w=f[y]||{hasStack:!1,stackGroups:{}};if(Bt(g)){var _=w.stackGroups[g]||{numericAxisId:n,cateAxisId:i,items:[]};_.items.push(h),w.hasStack=!0,w.stackGroups[g]=_}else w.stackGroups[Rs("_stackId_")]={numericAxisId:n,cateAxisId:i,items:[h]};return St(St({},f),{},Bo({},y,w))},l),d={};return Object.keys(u).reduce(function(f,h){var p=u[h];if(p.hasStack){var m={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(g,v){var y=p.stackGroups[v];return St(St({},g),{},Bo({},v,{numericAxisId:n,cateAxisId:i,items:y.items,stackedData:C7(e,y.items,a)}))},m)}return St(St({},f),{},Bo({},h,p))},d)},bD=function(e,r){var n=r.realScaleType,i=r.type,a=r.tickCount,o=r.originalDomain,s=r.allowDecimals,l=n||r.scale;if(l!=="auto"&&l!=="linear")return null;if(a&&i==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var u=e.domain();if(!u.length)return null;var d=q9(u,a,s);return e.domain([jh(d),Sh(d)]),{niceTicks:d}}if(a&&i==="number"){var f=e.domain(),h=U9(f,a,s);return{niceTicks:h}}return null};function LN(t){var e=t.axis,r=t.ticks,n=t.bandSize,i=t.entry,a=t.index,o=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Me(i[e.dataKey])){var s=td(r,"value",i[e.dataKey]);if(s)return s.coordinate+n/2}return r[a]?r[a].coordinate+n/2:null}var l=Lt(i,Me(o)?e.dataKey:o);return Me(l)?null:e.scale(l)}var BN=function(e){var r=e.axis,n=e.ticks,i=e.offset,a=e.bandSize,o=e.entry,s=e.index;if(r.type==="category")return n[s]?n[s].coordinate+i:null;var l=Lt(o,r.dataKey,r.domain[s]);return Me(l)?null:r.scale(l)-a/2+i},A7=function(e){var r=e.numericAxis,n=r.scale.domain();if(r.type==="number"){var i=Math.min(n[0],n[1]),a=Math.max(n[0],n[1]);return i<=0&&a>=0?0:a<0?a:i}return n[0]},E7=function(e,r){var n,i=(n=e.type)!==null&&n!==void 0&&n.defaultProps?St(St({},e.type.defaultProps),e.props):e.props,a=i.stackId;if(Bt(a)){var o=r[a];if(o){var s=o.items.indexOf(e);return s>=0?o.stackedData[s]:null}}return null},P7=function(e){return e.reduce(function(r,n){return[jh(n.concat([r[0]]).filter(ie)),Sh(n.concat([r[1]]).filter(ie))]},[1/0,-1/0])},wD=function(e,r,n){return Object.keys(e).reduce(function(i,a){var o=e[a],s=o.stackedData,l=s.reduce(function(u,d){var f=P7(d.slice(r,n+1));return[Math.min(u[0],f[0]),Math.max(u[1],f[1])]},[1/0,-1/0]);return[Math.min(l[0],i[0]),Math.max(l[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},FN=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,zN=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Vx=function(e,r,n){if(ke(e))return e(r,n);if(!Array.isArray(e))return r;var i=[];if(ie(e[0]))i[0]=n?e[0]:Math.min(e[0],r[0]);else if(FN.test(e[0])){var a=+FN.exec(e[0])[1];i[0]=r[0]-a}else ke(e[0])?i[0]=e[0](r[0]):i[0]=r[0];if(ie(e[1]))i[1]=n?e[1]:Math.max(e[1],r[1]);else if(zN.test(e[1])){var o=+zN.exec(e[1])[1];i[1]=r[1]+o}else ke(e[1])?i[1]=e[1](r[1]):i[1]=r[1];return i},Nd=function(e,r,n){if(e&&e.scale&&e.scale.bandwidth){var i=e.scale.bandwidth();if(!n||i>0)return i}if(e&&r&&r.length>=2){for(var a=lw(r,function(f){return f.coordinate}),o=1/0,s=1,l=a.length;s<l;s++){var u=a[s],d=a[s-1];o=Math.min((u.coordinate||0)-(d.coordinate||0),o)}return o===1/0?0:o}return n?void 0:0},qN=function(e,r,n){return!e||!e.length||Bc(e,Ur(n,"type.defaultProps.domain"))?r:e},_D=function(e,r){var n=e.type.defaultProps?St(St({},e.type.defaultProps),e.props):e.props,i=n.dataKey,a=n.name,o=n.unit,s=n.formatter,l=n.tooltipType,u=n.chartType,d=n.hide;return St(St({},_e(e,!1)),{},{dataKey:i,unit:o,formatter:s,name:a||i,color:Dw(e),value:Lt(r,i),type:l,payload:r,chartType:u,hide:d})};function Yl(t){"@babel/helpers - typeof";return Yl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Yl(t)}function UN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ii(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?UN(Object(r),!0).forEach(function(n){SD(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):UN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function SD(t,e,r){return e=T7(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function T7(t){var e=M7(t,"string");return Yl(e)=="symbol"?e:e+""}function M7(t,e){if(Yl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Yl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function D7(t,e){return L7(t)||$7(t,e)||I7(t,e)||R7()}function R7(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 25In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function I7(t,e){if(t){if(typeof t=="string")return HN(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return HN(t,e)}}function HN(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function $7(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}function L7(t){if(Array.isArray(t))return t}var Cd=Math.PI/180,B7=function(e){return e*180/Math.PI},lt=function(e,r,n,i){return{x:e+Math.cos(-Cd*i)*n,y:r+Math.sin(-Cd*i)*n}},jD=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},F7=function(e,r,n,i,a){var o=e.width,s=e.height,l=e.startAngle,u=e.endAngle,d=_r(e.cx,o,o/2),f=_r(e.cy,s,s/2),h=jD(o,s,n),p=_r(e.innerRadius,h,0),m=_r(e.outerRadius,h,h*.8),g=Object.keys(r);return g.reduce(function(v,y){var w=r[y],_=w.domain,j=w.reversed,b;if(Me(w.range))i==="angleAxis"?b=[l,u]:i==="radiusAxis"&&(b=[p,m]),j&&(b=[b[1],b[0]]);else{b=w.range;var O=b,S=D7(O,2);l=S[0],u=S[1]}var N=yD(w,a),C=N.realScaleType,T=N.scale;T.domain(_).range(b),xD(T);var k=bD(T,ii(ii({},w),{},{realScaleType:C})),M=ii(ii(ii({},w),k),{},{range:b,radius:m,realScaleType:C,scale:T,cx:d,cy:f,innerRadius:p,outerRadius:m,startAngle:l,endAngle:u});return ii(ii({},v),{},SD({},y,M))},{})},z7=function(e,r){var n=e.x,i=e.y,a=r.x,o=r.y;return Math.sqrt(Math.pow(n-a,2)+Math.pow(i-o,2))},q7=function(e,r){var n=e.x,i=e.y,a=r.cx,o=r.cy,s=z7({x:n,y:i},{x:a,y:o});if(s<=0)return{radius:s};var l=(n-a)/s,u=Math.acos(l);return i>o&&(u=2*Math.PI-u),{radius:s,angle:B7(u),angleInRadian:u}},U7=function(e){var r=e.startAngle,n=e.endAngle,i=Math.floor(r/360),a=Math.floor(n/360),o=Math.min(i,a);return{startAngle:r-o*360,endAngle:n-o*360}},H7=function(e,r){var n=r.startAngle,i=r.endAngle,a=Math.floor(n/360),o=Math.floor(i/360),s=Math.min(a,o);return e+s*360},WN=function(e,r){var n=e.x,i=e.y,a=q7({x:n,y:i},r),o=a.radius,s=a.angle,l=r.innerRadius,u=r.outerRadius;if(o<l||o>u)return!1;if(o===0)return!0;var d=U7(r),f=d.startAngle,h=d.endAngle,p=s,m;if(f<=h){for(;p>h;)p-=360;for(;p<f;)p+=360;m=p>=f&&p<=h}else{for(;p>f;)p-=360;for(;p<h;)p+=360;m=p>=h&&p<=f}return m?ii(ii({},r),{},{radius:o,angle:H7(p,r)}):null},OD=function(e){return!x.isValidElement(e)&&!ke(e)&&typeof e!="boolean"?e.className:""};function Xl(t){"@babel/helpers - typeof";return Xl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xl(t)}var W7=["offset"];function V7(t){return X7(t)||Y7(t)||G7(t)||K7()}function K7(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 26In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function G7(t,e){if(t){if(typeof t=="string")return Kx(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Kx(t,e)}}function Y7(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function X7(t){if(Array.isArray(t))return Kx(t)}function Kx(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function J7(t,e){if(t==null)return{};var r=Z7(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Z7(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function VN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Rt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?VN(Object(r),!0).forEach(function(n){Q7(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):VN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Q7(t,e,r){return e=eK(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function eK(t){var e=tK(t,"string");return Xl(e)=="symbol"?e:e+""}function tK(t,e){if(Xl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Xl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Jl(){return Jl=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Jl.apply(this,arguments)}var rK=function(e){var r=e.value,n=e.formatter,i=Me(e.children)?r:e.children;return ke(n)?n(i):i},nK=function(e,r){var n=wr(r-e),i=Math.min(Math.abs(r-e),360);return n*i},iK=function(e,r,n){var i=e.position,a=e.viewBox,o=e.offset,s=e.className,l=a,u=l.cx,d=l.cy,f=l.innerRadius,h=l.outerRadius,p=l.startAngle,m=l.endAngle,g=l.clockWise,v=(f+h)/2,y=nK(p,m),w=y>=0?1:-1,_,j;i==="insideStart"?(_=p+w*o,j=g):i==="insideEnd"?(_=m-w*o,j=!g):i==="end"&&(_=m+w*o,j=g),j=y<=0?j:!j;var b=lt(u,d,v,_),O=lt(u,d,v,_+(j?1:-1)*359),S="M".concat(b.x,",").concat(b.y,` 27 A`).concat(v,",").concat(v,",0,1,").concat(j?0:1,`, 28 `).concat(O.x,",").concat(O.y),N=Me(e.id)?Rs("recharts-radial-line-"):e.id;return D.createElement("text",Jl({},n,{dominantBaseline:"central",className:Le("recharts-radial-bar-label",s)}),D.createElement("defs",null,D.createElement("path",{id:N,d:S})),D.createElement("textPath",{xlinkHref:"#".concat(N)},r))},aK=function(e){var r=e.viewBox,n=e.offset,i=e.position,a=r,o=a.cx,s=a.cy,l=a.innerRadius,u=a.outerRadius,d=a.startAngle,f=a.endAngle,h=(d+f)/2;if(i==="outside"){var p=lt(o,s,u+n,h),m=p.x,g=p.y;return{x:m,y:g,textAnchor:m>=o?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:o,y:s,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:o,y:s,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:o,y:s,textAnchor:"middle",verticalAnchor:"end"};var v=(l+u)/2,y=lt(o,s,v,h),w=y.x,_=y.y;return{x:w,y:_,textAnchor:"middle",verticalAnchor:"middle"}},oK=function(e){var r=e.viewBox,n=e.parentViewBox,i=e.offset,a=e.position,o=r,s=o.x,l=o.y,u=o.width,d=o.height,f=d>=0?1:-1,h=f*i,p=f>0?"end":"start",m=f>0?"start":"end",g=u>=0?1:-1,v=g*i,y=g>0?"end":"start",w=g>0?"start":"end";if(a==="top"){var _={x:s+u/2,y:l-f*i,textAnchor:"middle",verticalAnchor:p};return Rt(Rt({},_),n?{height:Math.max(l-n.y,0),width:u}:{})}if(a==="bottom"){var j={x:s+u/2,y:l+d+h,textAnchor:"middle",verticalAnchor:m};return Rt(Rt({},j),n?{height:Math.max(n.y+n.height-(l+d),0),width:u}:{})}if(a==="left"){var b={x:s-v,y:l+d/2,textAnchor:y,verticalAnchor:"middle"};return Rt(Rt({},b),n?{width:Math.max(b.x-n.x,0),height:d}:{})}if(a==="right"){var O={x:s+u+v,y:l+d/2,textAnchor:w,verticalAnchor:"middle"};return Rt(Rt({},O),n?{width:Math.max(n.x+n.width-O.x,0),height:d}:{})}var S=n?{width:u,height:d}:{};return a==="insideLeft"?Rt({x:s+v,y:l+d/2,textAnchor:w,verticalAnchor:"middle"},S):a==="insideRight"?Rt({x:s+u-v,y:l+d/2,textAnchor:y,verticalAnchor:"middle"},S):a==="insideTop"?Rt({x:s+u/2,y:l+h,textAnchor:"middle",verticalAnchor:m},S):a==="insideBottom"?Rt({x:s+u/2,y:l+d-h,textAnchor:"middle",verticalAnchor:p},S):a==="insideTopLeft"?Rt({x:s+v,y:l+h,textAnchor:w,verticalAnchor:m},S):a==="insideTopRight"?Rt({x:s+u-v,y:l+h,textAnchor:y,verticalAnchor:m},S):a==="insideBottomLeft"?Rt({x:s+v,y:l+d-h,textAnchor:w,verticalAnchor:p},S):a==="insideBottomRight"?Rt({x:s+u-v,y:l+d-h,textAnchor:y,verticalAnchor:p},S):Ds(a)&&(ie(a.x)||Oa(a.x))&&(ie(a.y)||Oa(a.y))?Rt({x:s+_r(a.x,u),y:l+_r(a.y,d),textAnchor:"end",verticalAnchor:"end"},S):Rt({x:s+u/2,y:l+d/2,textAnchor:"middle",verticalAnchor:"middle"},S)},sK=function(e){return"cx"in e&&ie(e.cx)};function Vt(t){var e=t.offset,r=e===void 0?5:e,n=J7(t,W7),i=Rt({offset:r},n),a=i.viewBox,o=i.position,s=i.value,l=i.children,u=i.content,d=i.className,f=d===void 0?"":d,h=i.textBreakAll;if(!a||Me(s)&&Me(l)&&!x.isValidElement(u)&&!ke(u))return null;if(x.isValidElement(u))return x.cloneElement(u,i);var p;if(ke(u)){if(p=x.createElement(u,i),x.isValidElement(p))return p}else p=rK(i);var m=sK(a),g=_e(i,!0);if(m&&(o==="insideStart"||o==="insideEnd"||o==="end"))return iK(i,p,g);var v=m?aK(i):oK(i);return D.createElement(Ga,Jl({className:Le("recharts-label",f)},g,v,{breakAll:h}),p)}Vt.displayName="Label";var ND=function(e){var r=e.cx,n=e.cy,i=e.angle,a=e.startAngle,o=e.endAngle,s=e.r,l=e.radius,u=e.innerRadius,d=e.outerRadius,f=e.x,h=e.y,p=e.top,m=e.left,g=e.width,v=e.height,y=e.clockWise,w=e.labelViewBox;if(w)return w;if(ie(g)&&ie(v)){if(ie(f)&&ie(h))return{x:f,y:h,width:g,height:v};if(ie(p)&&ie(m))return{x:p,y:m,width:g,height:v}}return ie(f)&&ie(h)?{x:f,y:h,width:0,height:0}:ie(r)&&ie(n)?{cx:r,cy:n,startAngle:a||i||0,endAngle:o||i||0,innerRadius:u||0,outerRadius:d||l||s||0,clockWise:y}:e.viewBox?e.viewBox:{}},lK=function(e,r){return e?e===!0?D.createElement(Vt,{key:"label-implicit",viewBox:r}):Bt(e)?D.createElement(Vt,{key:"label-implicit",viewBox:r,value:e}):x.isValidElement(e)?e.type===Vt?x.cloneElement(e,{key:"label-implicit",viewBox:r}):D.createElement(Vt,{key:"label-implicit",content:e,viewBox:r}):ke(e)?D.createElement(Vt,{key:"label-implicit",content:e,viewBox:r}):Ds(e)?D.createElement(Vt,Jl({viewBox:r},e,{key:"label-implicit"})):null:null},cK=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var i=e.children,a=ND(e),o=Hr(i,Vt).map(function(l,u){return x.cloneElement(l,{viewBox:r||a,key:"label-".concat(u)})});if(!n)return o;var s=lK(e.label,r||a);return[s].concat(V7(o))};Vt.parseViewBox=ND;Vt.renderCallByParent=cK;var Gv,KN;function uK(){if(KN)return Gv;KN=1;function t(e){var r=e==null?0:e.length;return r?e[r-1]:void 0}return Gv=t,Gv}var dK=uK();const fK=at(dK);function Zl(t){"@babel/helpers - typeof";return Zl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zl(t)}var hK=["valueAccessor"],pK=["data","dataKey","clockWise","id","textBreakAll"];function mK(t){return xK(t)||yK(t)||vK(t)||gK()}function gK(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 29In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vK(t,e){if(t){if(typeof t=="string")return Gx(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Gx(t,e)}}function yK(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function xK(t){if(Array.isArray(t))return Gx(t)}function Gx(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function kd(){return kd=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},kd.apply(this,arguments)}function GN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function YN(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?GN(Object(r),!0).forEach(function(n){bK(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):GN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function bK(t,e,r){return e=wK(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wK(t){var e=_K(t,"string");return Zl(e)=="symbol"?e:e+""}function _K(t,e){if(Zl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Zl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function XN(t,e){if(t==null)return{};var r=SK(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function SK(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var jK=function(e){return Array.isArray(e.value)?fK(e.value):e.value};function mi(t){var e=t.valueAccessor,r=e===void 0?jK:e,n=XN(t,hK),i=n.data,a=n.dataKey,o=n.clockWise,s=n.id,l=n.textBreakAll,u=XN(n,pK);return!i||!i.length?null:D.createElement(Ke,{className:"recharts-label-list"},i.map(function(d,f){var h=Me(a)?r(d,f):Lt(d&&d.payload,a),p=Me(s)?{}:{id:"".concat(s,"-").concat(f)};return D.createElement(Vt,kd({},_e(d,!0),u,p,{parentViewBox:d.parentViewBox,value:h,textBreakAll:l,viewBox:Vt.parseViewBox(Me(o)?d:YN(YN({},d),{},{clockWise:o})),key:"label-".concat(f),index:f}))}))}mi.displayName="LabelList";function OK(t,e){return t?t===!0?D.createElement(mi,{key:"labelList-implicit",data:e}):D.isValidElement(t)||ke(t)?D.createElement(mi,{key:"labelList-implicit",data:e,content:t}):Ds(t)?D.createElement(mi,kd({data:e},t,{key:"labelList-implicit"})):null:null}function NK(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var n=t.children,i=Hr(n,mi).map(function(o,s){return x.cloneElement(o,{data:e,key:"labelList-".concat(s)})});if(!r)return i;var a=OK(t.label,e);return[a].concat(mK(i))}mi.renderCallByParent=NK;function Ql(t){"@babel/helpers - typeof";return Ql=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ql(t)}function Yx(){return Yx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Yx.apply(this,arguments)}function JN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ZN(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?JN(Object(r),!0).forEach(function(n){CK(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):JN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function CK(t,e,r){return e=kK(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function kK(t){var e=AK(t,"string");return Ql(e)=="symbol"?e:e+""}function AK(t,e){if(Ql(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Ql(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var EK=function(e,r){var n=wr(r-e),i=Math.min(Math.abs(r-e),359.999);return n*i},cu=function(e){var r=e.cx,n=e.cy,i=e.radius,a=e.angle,o=e.sign,s=e.isExternal,l=e.cornerRadius,u=e.cornerIsExternal,d=l*(s?1:-1)+i,f=Math.asin(l/d)/Cd,h=u?a:a+o*f,p=lt(r,n,d,h),m=lt(r,n,i,h),g=u?a-o*f:a,v=lt(r,n,d*Math.cos(f*Cd),g);return{center:p,circleTangency:m,lineTangency:v,theta:f}},CD=function(e){var r=e.cx,n=e.cy,i=e.innerRadius,a=e.outerRadius,o=e.startAngle,s=e.endAngle,l=EK(o,s),u=o+l,d=lt(r,n,a,o),f=lt(r,n,a,u),h="M ".concat(d.x,",").concat(d.y,` 30 A `).concat(a,",").concat(a,`,0, 31 `).concat(+(Math.abs(l)>180),",").concat(+(o>u),`, 32 `).concat(f.x,",").concat(f.y,` 33 `);if(i>0){var p=lt(r,n,i,o),m=lt(r,n,i,u);h+="L ".concat(m.x,",").concat(m.y,` 34 A `).concat(i,",").concat(i,`,0, 35 `).concat(+(Math.abs(l)>180),",").concat(+(o<=u),`, 36 `).concat(p.x,",").concat(p.y," Z")}else h+="L ".concat(r,",").concat(n," Z");return h},PK=function(e){var r=e.cx,n=e.cy,i=e.innerRadius,a=e.outerRadius,o=e.cornerRadius,s=e.forceCornerRadius,l=e.cornerIsExternal,u=e.startAngle,d=e.endAngle,f=wr(d-u),h=cu({cx:r,cy:n,radius:a,angle:u,sign:f,cornerRadius:o,cornerIsExternal:l}),p=h.circleTangency,m=h.lineTangency,g=h.theta,v=cu({cx:r,cy:n,radius:a,angle:d,sign:-f,cornerRadius:o,cornerIsExternal:l}),y=v.circleTangency,w=v.lineTangency,_=v.theta,j=l?Math.abs(u-d):Math.abs(u-d)-g-_;if(j<0)return s?"M ".concat(m.x,",").concat(m.y,` 37 a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0 38 a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0 39 `):CD({cx:r,cy:n,innerRadius:i,outerRadius:a,startAngle:u,endAngle:d});var b="M ".concat(m.x,",").concat(m.y,` 40 A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(p.x,",").concat(p.y,` 41 A`).concat(a,",").concat(a,",0,").concat(+(j>180),",").concat(+(f<0),",").concat(y.x,",").concat(y.y,` 42 A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(w.x,",").concat(w.y,` 43 `);if(i>0){var O=cu({cx:r,cy:n,radius:i,angle:u,sign:f,isExternal:!0,cornerRadius:o,cornerIsExternal:l}),S=O.circleTangency,N=O.lineTangency,C=O.theta,T=cu({cx:r,cy:n,radius:i,angle:d,sign:-f,isExternal:!0,cornerRadius:o,cornerIsExternal:l}),k=T.circleTangency,M=T.lineTangency,E=T.theta,L=l?Math.abs(u-d):Math.abs(u-d)-C-E;if(L<0&&o===0)return"".concat(b,"L").concat(r,",").concat(n,"Z");b+="L".concat(M.x,",").concat(M.y,` 44 A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(k.x,",").concat(k.y,` 45 A`).concat(i,",").concat(i,",0,").concat(+(L>180),",").concat(+(f>0),",").concat(S.x,",").concat(S.y,` 46 A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(N.x,",").concat(N.y,"Z")}else b+="L".concat(r,",").concat(n,"Z");return b},TK={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},kD=function(e){var r=ZN(ZN({},TK),e),n=r.cx,i=r.cy,a=r.innerRadius,o=r.outerRadius,s=r.cornerRadius,l=r.forceCornerRadius,u=r.cornerIsExternal,d=r.startAngle,f=r.endAngle,h=r.className;if(o<a||d===f)return null;var p=Le("recharts-sector",h),m=o-a,g=_r(s,m,0,!0),v;return g>0&&Math.abs(d-f)<360?v=PK({cx:n,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(g,m/2),forceCornerRadius:l,cornerIsExternal:u,startAngle:d,endAngle:f}):v=CD({cx:n,cy:i,innerRadius:a,outerRadius:o,startAngle:d,endAngle:f}),D.createElement("path",Yx({},_e(r,!0),{className:p,d:v,role:"img"}))};function ec(t){"@babel/helpers - typeof";return ec=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ec(t)}function Xx(){return Xx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];
46for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Xx.apply(this,arguments)}function QN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function eC(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?QN(Object(r),!0).forEach(function(n){MK(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):QN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function MK(t,e,r){return e=DK(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function DK(t){var e=RK(t,"string");return ec(e)=="symbol"?e:e+""}function RK(t,e){if(ec(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ec(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var tC={curveBasisClosed:t6,curveBasisOpen:r6,curveBasis:e6,curveBumpX:Fq,curveBumpY:zq,curveLinearClosed:n6,curveLinear:uh,curveMonotoneX:i6,curveMonotoneY:a6,curveNatural:o6,curveStep:s6,curveStepAfter:c6,curveStepBefore:l6},uu=function(e){return e.x===+e.x&&e.y===+e.y},Js=function(e){return e.x},Zs=function(e){return e.y},IK=function(e,r){if(ke(e))return e;var n="curve".concat(lh(e));return(n==="curveMonotone"||n==="curveBump")&&r?tC["".concat(n).concat(r==="vertical"?"Y":"X")]:tC[n]||uh},$K=function(e){var r=e.type,n=r===void 0?"linear":r,i=e.points,a=i===void 0?[]:i,o=e.baseLine,s=e.layout,l=e.connectNulls,u=l===void 0?!1:l,d=IK(n,s),f=u?a.filter(function(g){return uu(g)}):a,h;if(Array.isArray(o)){var p=u?o.filter(function(g){return uu(g)}):o,m=f.map(function(g,v){return eC(eC({},g),{},{base:p[v]})});return s==="vertical"?h=tu().y(Zs).x1(Js).x0(function(g){return g.base.x}):h=tu().x(Js).y1(Zs).y0(function(g){return g.base.y}),h.defined(uu).curve(d),h(m)}return s==="vertical"&&ie(o)?h=tu().y(Zs).x1(Js).x0(o):ie(o)?h=tu().x(Js).y1(Zs).y0(o):h=NM().x(Js).y(Zs),h.defined(uu).curve(d),h(f)},Ad=function(e){var r=e.className,n=e.points,i=e.path,a=e.pathRef;if((!n||!n.length)&&!i)return null;var o=n&&n.length?$K(e):i;return x.createElement("path",Xx({},_e(e,!1),rd(e),{className:Le("recharts-curve",r),d:o,ref:a}))},LK=Object.getOwnPropertyNames,BK=Object.getOwnPropertySymbols,FK=Object.prototype.hasOwnProperty;function rC(t,e){return function(n,i,a){return t(n,i,a)&&e(n,i,a)}}function du(t){return function(r,n,i){if(!r||!n||typeof r!="object"||typeof n!="object")return t(r,n,i);var a=i.cache,o=a.get(r),s=a.get(n);if(o&&s)return o===n&&s===r;a.set(r,n),a.set(n,r);var l=t(r,n,i);return a.delete(r),a.delete(n),l}}function nC(t){return LK(t).concat(BK(t))}var zK=Object.hasOwn||(function(t,e){return FK.call(t,e)});function lo(t,e){return t===e||!t&&!e&&t!==t&&e!==e}var qK="__v",UK="__o",HK="_owner",iC=Object.getOwnPropertyDescriptor,aC=Object.keys;function WK(t,e,r){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(!r.equals(t[n],e[n],n,n,t,e,r))return!1;return!0}function VK(t,e){return lo(t.getTime(),e.getTime())}function KK(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function GK(t,e){return t===e}function oC(t,e,r){var n=t.size;if(n!==e.size)return!1;if(!n)return!0;for(var i=new Array(n),a=t.entries(),o,s,l=0;(o=a.next())&&!o.done;){for(var u=e.entries(),d=!1,f=0;(s=u.next())&&!s.done;){if(i[f]){f++;continue}var h=o.value,p=s.value;if(r.equals(h[0],p[0],l,f,t,e,r)&&r.equals(h[1],p[1],h[0],p[0],t,e,r)){d=i[f]=!0;break}f++}if(!d)return!1;l++}return!0}var YK=lo;function XK(t,e,r){var n=aC(t),i=n.length;if(aC(e).length!==i)return!1;for(;i-- >0;)if(!AD(t,e,r,n[i]))return!1;return!0}function Qs(t,e,r){var n=nC(t),i=n.length;if(nC(e).length!==i)return!1;for(var a,o,s;i-- >0;)if(a=n[i],!AD(t,e,r,a)||(o=iC(t,a),s=iC(e,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function JK(t,e){return lo(t.valueOf(),e.valueOf())}function ZK(t,e){return t.source===e.source&&t.flags===e.flags}function sC(t,e,r){var n=t.size;if(n!==e.size)return!1;if(!n)return!0;for(var i=new Array(n),a=t.values(),o,s;(o=a.next())&&!o.done;){for(var l=e.values(),u=!1,d=0;(s=l.next())&&!s.done;){if(!i[d]&&r.equals(o.value,s.value,o.value,s.value,t,e,r)){u=i[d]=!0;break}d++}if(!u)return!1}return!0}function QK(t,e){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}function eG(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function AD(t,e,r,n){return(n===HK||n===UK||n===qK)&&(t.$$typeof||e.$$typeof)?!0:zK(e,n)&&r.equals(t[n],e[n],n,n,t,e,r)}var tG="[object Arguments]",rG="[object Boolean]",nG="[object Date]",iG="[object Error]",aG="[object Map]",oG="[object Number]",
46sG="[object Object]",lG="[object RegExp]",cG="[object Set]",uG="[object String]",dG="[object URL]",fG=Array.isArray,lC=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,cC=Object.assign,hG=Object.prototype.toString.call.bind(Object.prototype.toString);function pG(t){var e=t.areArraysEqual,r=t.areDatesEqual,n=t.areErrorsEqual,i=t.areFunctionsEqual,a=t.areMapsEqual,o=t.areNumbersEqual,s=t.areObjectsEqual,l=t.arePrimitiveWrappersEqual,u=t.areRegExpsEqual,d=t.areSetsEqual,f=t.areTypedArraysEqual,h=t.areUrlsEqual;return function(m,g,v){if(m===g)return!0;if(m==null||g==null)return!1;var y=typeof m;if(y!==typeof g)return!1;if(y!=="object")return y==="number"?o(m,g,v):y==="function"?i(m,g,v):!1;var w=m.constructor;if(w!==g.constructor)return!1;if(w===Object)return s(m,g,v);if(fG(m))return e(m,g,v);if(lC!=null&&lC(m))return f(m,g,v);if(w===Date)return r(m,g,v);if(w===RegExp)return u(m,g,v);if(w===Map)return a(m,g,v);if(w===Set)return d(m,g,v);var _=hG(m);return _===nG?r(m,g,v):_===lG?u(m,g,v):_===aG?a(m,g,v):_===cG?d(m,g,v):_===sG?typeof m.then!="function"&&typeof g.then!="function"&&s(m,g,v):_===dG?h(m,g,v):_===iG?n(m,g,v):_===tG?s(m,g,v):_===rG||_===oG||_===uG?l(m,g,v):!1}}function mG(t){var e=t.circular,r=t.createCustomConfig,n=t.strict,i={areArraysEqual:n?Qs:WK,areDatesEqual:VK,areErrorsEqual:KK,areFunctionsEqual:GK,areMapsEqual:n?rC(oC,Qs):oC,areNumbersEqual:YK,areObjectsEqual:n?Qs:XK,arePrimitiveWrappersEqual:JK,areRegExpsEqual:ZK,areSetsEqual:n?rC(sC,Qs):sC,areTypedArraysEqual:n?Qs:QK,areUrlsEqual:eG};if(r&&(i=cC({},i,r(i))),e){var a=du(i.areArraysEqual),o=du(i.areMapsEqual),s=du(i.areObjectsEqual),l=du(i.areSetsEqual);i=cC({},i,{areArraysEqual:a,areMapsEqual:o,areObjectsEqual:s,areSetsEqual:l})}return i}function gG(t){return function(e,r,n,i,a,o,s){return t(e,r,s)}}function vG(t){var e=t.circular,r=t.comparator,n=t.createState,i=t.equals,a=t.strict;if(n)return function(l,u){var d=n(),f=d.cache,h=f===void 0?e?new WeakMap:void 0:f,p=d.meta;return r(l,u,{cache:h,equals:i,meta:p,strict:a})};if(e)return function(l,u){return r(l,u,{cache:new WeakMap,equals:i,meta:void 0,strict:a})};var o={cache:void 0,equals:i,meta:void 0,strict:a};return function(l,u){return r(l,u,o)}}var yG=aa();aa({strict:!0});aa({circular:!0});aa({circular:!0,strict:!0});aa({createInternalComparator:function(){return lo}});aa({strict:!0,createInternalComparator:function(){return lo}});aa({circular:!0,createInternalComparator:function(){return lo}});aa({circular:!0,createInternalComparator:function(){return lo},strict:!0});function aa(t){t===void 0&&(t={});var e=t.circular,r=e===void 0?!1:e,n=t.createInternalComparator,i=t.createState,a=t.strict,o=a===void 0?!1:a,s=mG(t),l=pG(s),u=n?n(l):gG(l);return vG({circular:r,comparator:l,createState:i,equals:u,strict:o})}function xG(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function uC(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function i(a){r<0&&(r=a),a-r>e?(t(a),r=-1):xG(i)};requestAnimationFrame(n)}function Jx(t){"@babel/helpers - typeof";return Jx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jx(t)}function bG(t){return jG(t)||SG(t)||_G(t)||wG()}function wG(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 47In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _G(t,e){if(t){if(typeof t=="string")return dC(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return dC(t,e)}}function dC(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function SG(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function jG(t){if(Array.isArray(t))return t}function OG(){var t={},e=function(){return null},r=!1,n=function i(a){if(!r){if(Array.isArray(a)){if(!a.length)return;var o=a,s=bG(o),l=s[0],u=s.slice(1);if(typeof l=="number"){uC(i.bind(null,u),l);return}i(l),uC(i.bind(null,u));return}Jx(a)==="object"&&(t=a,e(t)),typeof a=="function"&&a()}};return{stop:function(){r=!0},start:function(a){r=!1,n(a)},subscribe:function(a){return e=a,function(){e=function(){return null}}}}}function tc(t){"@babel/helpers - typeof";return tc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tc(t)}function fC(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function hC(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};
vendor: 20,439 bytes, lines 47-56
47e%2?fC(Object(r),!0).forEach(function(n){ED(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):fC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ED(t,e,r){return e=NG(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function NG(t){var e=CG(t,"string");return tc(e)==="symbol"?e:String(e)}function CG(t,e){if(tc(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(tc(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var kG=function(e,r){return[Object.keys(e),Object.keys(r)].reduce(function(n,i){return n.filter(function(a){return i.includes(a)})})},AG=function(e){return e},EG=function(e){return e.replace(/([A-Z])/g,function(r){return"-".concat(r.toLowerCase())})},gl=function(e,r){return Object.keys(r).reduce(function(n,i){return hC(hC({},n),{},ED({},i,e(i,r[i])))},{})},pC=function(e,r,n){return e.map(function(i){return"".concat(EG(i)," ").concat(r,"ms ").concat(n)}).join(",")};function PG(t,e){return DG(t)||MG(t,e)||PD(t,e)||TG()}function TG(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 48In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function MG(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}function DG(t){if(Array.isArray(t))return t}function RG(t){return LG(t)||$G(t)||PD(t)||IG()}function IG(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 49In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function PD(t,e){if(t){if(typeof t=="string")return Zx(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Zx(t,e)}}function $G(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function LG(t){if(Array.isArray(t))return Zx(t)}function Zx(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Ed=1e-4,TD=function(e,r){return[0,3*e,3*r-6*e,3*e-3*r+1]},MD=function(e,r){return e.map(function(n,i){return n*Math.pow(r,i)}).reduce(function(n,i){return n+i})},mC=function(e,r){return function(n){var i=TD(e,r);return MD(i,n)}},BG=function(e,r){return function(n){var i=TD(e,r),a=[].concat(RG(i.map(function(o,s){return o*s}).slice(1)),[0]);return MD(a,n)}},gC=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i=r[0],a=r[1],o=r[2],s=r[3];if(r.length===1)switch(r[0]){case"linear":i=0,a=0,o=1,s=1;break;case"ease":i=.25,a=.1,o=.25,s=1;break;case"ease-in":i=.42,a=0,o=1,s=1;break;case"ease-out":i=.42,a=0,o=.58,s=1;break;case"ease-in-out":i=0,a=0,o=.58,s=1;break;default:{var l=r[0].split("(");if(l[0]==="cubic-bezier"&&l[1].split(")")[0].split(",").length===4){var u=l[1].split(")")[0].split(",").map(function(v){return parseFloat(v)}),d=PG(u,4);i=d[0],a=d[1],o=d[2],s=d[3]}}}var f=mC(i,o),h=mC(a,s),p=BG(i,o),m=function(y){return y>1?1:y<0?0:y},g=function(y){for(var w=y>1?1:y,_=w,j=0;j<8;++j){var b=f(_)-w,O=p(_);if(Math.abs(b-w)<Ed||O<Ed)return h(_);_=m(_-b/O)}return h(_)};return g.isStepper=!1,g},FG=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.stiff,n=r===void 0?100:r,i=e.damping,a=i===void 0?8:i,o=e.dt,s=o===void 0?17:o,l=function(d,f,h){var p=-(d-f)*n,m=h*a,g=h+(p-m)*s/1e3,v=h*s/1e3+d;return Math.abs(v-f)<Ed&&Math.abs(g)<Ed?[f,0]:[v,g]};return l.isStepper=!0,l.dt=s,l},zG=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i=r[0];if(typeof i=="string")switch(i){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return gC(i);case"spring":return FG();default:if(i.split("(")[0]==="cubic-bezier")return gC(i)}return typeof i=="function"?i:null};function rc(t){"@babel/helpers - typeof";return rc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rc(t)}function vC(t){return HG(t)||UG(t)||DD(t)||qG()}function qG(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 50In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UG(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function HG(t){if(Array.isArray(t))return eb(t)}function yC(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function er(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?yC(Object(r),!0).forEach(function(n){Qx(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):yC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Qx(t,e,r){return e=WG(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function WG(t){var e=VG(t,"string");return rc(e)==="symbol"?e:String(e)}function VG(t,e){if(rc(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(rc(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function KG(t,e){return XG(t)||YG(t,e)||DD(t,e)||GG()}function GG(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 51In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function DD(t,e){if(t){if(typeof t=="string")return eb(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eb(t,e)}}function eb(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function YG(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}function XG(t){if(Array.isArray(t))return t}var Pd=function(e,r,n){return e+(r-e)*n},tb=function(e){var r=e.from,n=e.to;return r!==n},JG=function t(e,r,n){var i=gl(function(a,o){if(tb(o)){var s=e(o.from,o.to,o.velocity),l=KG(s,2),u=l[0],d=l[1];return er(er({},o),{},{from:u,velocity:d})}return o},r);return n<1?gl(function(a,o){return tb(o)?er(er({},o),{},{velocity:Pd(o.velocity,i[a].velocity,n),from:Pd(o.from,i[a].from,n)}):o},r):t(e,i,n-1)};const ZG=(function(t,e,r,n,i){var a=kG(t,e),o=a.reduce(function(v,y){return er(er({},v),{},Qx({},y,[t[y],e[y]]))},{}),s=a.reduce(function(v,y){return er(er({},v),{},Qx({},y,{from:t[y],velocity:0,to:e[y]}))},{}),l=-1,u,d,f=function(){return null},h=function(){return gl(function(y,w){return w.from},s)},p=function(){return!Object.values(s).filter(tb).length},m=function(y){u||(u=y);var w=y-u,_=w/r.dt;s=JG(r,s,_),i(er(er(er({},t),e),h())),u=y,p()||(l=requestAnimationFrame(f))},g=function(y){d||(d=y);var w=(y-d)/n,_=gl(function(b,O){return Pd.apply(void 0,vC(O).concat([r(w)]))},o);if(i(er(er(er({},t),e),_)),w<1)l=requestAnimationFrame(f);else{var j=gl(function(b,O){return Pd.apply(void 0,vC(O).concat([r(1)]))},o);i(er(er(er({},t),e),j))}};return f=r.isStepper?m:g,function(){return requestAnimationFrame(f),function(){cancelAnimationFrame(l)}}});function as(t){"@babel/helpers - typeof";return as=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},as(t)}var QG=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function eY(t,e){if(t==null)return{};var r=tY(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function tY(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,a;for(a=0;a<n.length;a++)i=n[a],!(e.indexOf(i)>=0)&&(r[i]=t[i]);return r}function Yv(t){return aY(t)||iY(t)||nY(t)||rY()}function rY(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 52In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nY(t,e){if(t){if(typeof t=="string")return rb(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return rb(t,e)}}function iY(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function aY(t){if(Array.isArray(t))return rb(t)}function rb(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function xC(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function fn(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?xC(Object(r),!0).forEach(function(n){ol(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):xC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ol(t,e,r){return e=RD(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function oY(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function sY(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,RD(n.key),n)}}function lY(t,e,r){return e&&sY(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function RD(t){var e=cY(t,"string");return as(e)==="symbol"?e:String(e)}function cY(t,e){if(as(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(as(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function uY(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&nb(t,e)}function nb(t,e){return nb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},nb(t,e)}function dY(t){var e=fY();return function(){var n=Td(t),i;if(e){var a=Td(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return ib(this,i)}}function ib(t,e){if(e&&(as(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ab(t)}function ab(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function fY(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Td(t){return Td=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Td(t)}var Wn=(function(t){uY(r,t);var e=dY(r);function r(n,i){var a;oY(this,r),a=e.call(this,n,i);var o=a.props,s=o.isActive,l=o.attributeName,u=o.from,d=o.to,f=o.steps,h=o.children,p=o.duration;if(a.handleStyleChange=a.handleStyleChange.bind(ab(a)),a.changeStyle=a.changeStyle.bind(ab(a)),!s||p<=0)return a.state={style:{}},typeof h=="function"&&(a.state={style:d}),ib(a);if(f&&f.length)a.state={style:f[0].style};else if(u){if(typeof h=="function")return a.state={style:u},ib(a);a.state={style:l?ol({},l,u):u}}else a.state={style:{}};return a}return lY(r,[{key:"componentDidMount",value:function(){var i=this.props,a=i.isActive,o=i.canBegin;this.mounted=!0,!(!a||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var a=this.props,o=a.isActive,s=a.canBegin,l=a.attributeName,u=a.shouldReAnimate,d=a.to,f=a.from,h=this.state.style;if(s){if(!o){var p={style:l?ol({},l,d):d};this.state&&h&&(l&&h[l]!==d||!l&&h!==d)&&this.setState(p);return}if(!(yG(i.to,d)&&i.canBegin&&i.isActive)){var m=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var g=m||u?f:i.to;if(this.state&&h){var v={style:l?ol({},l,g):g};(l&&h[l]!==g||!l&&h!==g)&&this.setState(v)}this.runAnimation(fn(fn({},this.props),{},{from:g,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var a=this,o=i.from,s=i.to,l=i.duration,u=i.easing,d=i.begin,f=i.onAnimationEnd,h=i.onAnimationStart,p=ZG(o,s,zG(u),l,this.changeStyle),m=function(){a.stopJSAnimation=p()};this.manager.start([h,d,m,l,f])}},{key:"runStepAnimation",value:function(i){var a=this,o=i.steps,s=i.begin,l=i.onAnimationStart,u=o[0],d=u.style,f=u.duration,h=f===void 0?0:f,p=function(g,v,y){if(y===0)return g;var w=v.duration,_=v.easing,j=_===void 0?"ease":_,b=v.style,O=v.properties,S=v.onAnimationEnd,N=y>0?o[y-1]:v,C=O||Object.keys(b);if(typeof j=="function"||j==="spring")return[].concat(Yv(g),[a.runJSAnimation.bind(a,{from:N.style,to:b,duration:w,easing:j}),w]);var T=pC(C,w,j),k=fn(fn(fn({},N.style),b),{},{transition:T});return[].concat(Yv(g),[k,w,S]).filter(AG)};return this.manager.start([l].concat(Yv(o.reduce(p,[d,Math.max(h,s)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=OG());var a=i.begin,o=i.duration,s=i.attributeName,l=i.to,u=i.easing,d=i.onAnimationStart,f=i.onAnimationEnd,h=i.steps,p=i.children,m=this.manager;if(this.unSubscribe=m.subscribe(this.handleStyleChange),typeof u=="function"||typeof p=="function"||u==="spring"){this.runJSAnimation(i);return}if(h.length>1){this.runStepAnimation(i);return}var g=s?ol({},s,l):l,v=pC(Object.keys(g),o,u);m.start([d,a,fn(fn({},g),{},{transition:v}),o,f])}},{key:"render",value:function(){var i=this.props,a=i.children;i.begin;var o=i.duration;i.attributeName,i.easing;var s=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var l=eY(i,QG),u=x.Children.count(a),d=this.state.style;if(typeof a=="function")return a(d);if(!s||u===0||o<=0)return a;var f=function(p){var m=p.props,g=m.style,v=g===void 0?{}:g,y=m.className,w=x.cloneElement(p,fn(fn({},l),{},{style:fn(fn({},v),d),className:y}));return w};return u===1?f(x.Children.only(a)):D.createElement("div",null,x.Children.map(a,function(h){return f(h)}))}}]),r})(x.PureComponent);Wn.displayName="Animate";Wn.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Wn.propTypes={from:Ze.oneOfType([Ze.object,Ze.string]),to:Ze.oneOfType([Ze.object,Ze.string]),attributeName:Ze.string,duration:Ze.number,begin:Ze.number,easing:Ze.oneOfType([Ze.string,Ze.func]),steps:Ze.arrayOf(Ze.shape({duration:Ze.number.isRequired,style:Ze.object.isRequired,easing:Ze.oneOfType([Ze.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),Ze.func]),properties:Ze.arrayOf("string"),onAnimationEnd:Ze.func})),children:Ze.oneOfType([Ze.node,Ze.func]),isActive:Ze.bool,canBegin:Ze.bool,onAnimationEnd:Ze.func,shouldReAnimate:Ze.bool,onAnimationStart:Ze.func,onAnimationReStart:Ze.func};function nc(t){"@babel/helpers - typeof";return nc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nc(t)}function Md(){return Md=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Md.apply(this,arguments)}function hY(t,e){return vY(t)||gY(t,e)||mY(t,e)||pY()}function pY(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 53In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mY(t,e){if(t){if(typeof t=="string")return bC(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return bC(t,e)}}function bC(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function gY(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}function vY(t){if(Array.isArray(t))return t}function wC(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function _C(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?wC(Object(r),!0).forEach(function(n){yY(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):wC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function yY(t,e,r){return e=xY(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xY(t){var e=bY(t,"string");return nc(e)=="symbol"?e:e+""}function bY(t,e){if(nc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(nc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var SC=function(e,r,n,i,a){var o=Math.min(Math.abs(n)/2,Math.abs(i)/2),s=i>=0?1:-1,l=n>=0?1:-1,u=i>=0&&n>=0||i<0&&n<0?1:0,d;if(o>0&&a instanceof Array){for(var f=[0,0,0,0],h=0,p=4;h<p;h++)f[h]=a[h]>o?o:a[h];d="M".concat(e,",").concat(r+s*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(e+l*f[0],",").concat(r)),d+="L ".concat(e+n-l*f[1],",").concat(r),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`, 54 `).concat(e+n,",").concat(r+s*f[1])),d+="L ".concat(e+n,",").concat(r+i-s*f[2]),f[2]>0&&(d+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(u,`, 55 `).concat(e+n-l*f[2],",").concat(r+i)),d+="L ".concat(e+l*f[3],",").concat(r+i),f[3]>0&&(d+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(u,`, 56 `).concat(e,",").concat(r+i-s*f[3])),d+="Z"}else if(o>0&&a===+a&&a>0){var m=Math.min(o,a);d="M ".concat(e,",").concat(r+s*m,`
57 A `).concat(m,",").concat(m,",0,0,").concat(u,",").concat(e+l*m,",").concat(r,` 58 L `).concat(e+n-l*m,",").concat(r,` 59 A `).concat(m,",").concat(m,",0,0,").concat(u,",").concat(e+n,",").concat(r+s*m,` 60 L `).concat(e+n,",").concat(r+i-s*m,` 61 A `).concat(m,",").concat(m,",0,0,").concat(u,",").concat(e+n-l*m,",").concat(r+i,` 62 L `).concat(e+l*m,",").concat(r+i,` 63 A `).concat(m,",").concat(m,",0,0,").concat(u,",").concat(e,",").concat(r+i-s*m," Z")}else d="M ".concat(e,",").concat(r," h ").concat(n," v ").concat(i," h ").concat(-n," Z");return d},wY=function(e,r){if(!e||!r)return!1;var n=e.x,i=e.y,a=r.x,o=r.y,s=r.width,l=r.height;if(Math.abs(s)>0&&Math.abs(l)>0){var u=Math.min(a,a+s),d=Math.max(a,a+s),f=Math.min(o,o+l),h=Math.max(o,o+l);return n>=u&&n<=d&&i>=f&&i<=h}return!1},_Y={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Rw=function(e){var r=_C(_C({},_Y),e),n=x.useRef(),i=x.useState(-1),a=hY(i,2),o=a[0],s=a[1];x.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var j=n.current.getTotalLength();j&&s(j)}catch{}},[]);var l=r.x,u=r.y,d=r.width,f=r.height,h=r.radius,p=r.className,m=r.animationEasing,g=r.animationDuration,v=r.animationBegin,y=r.isAnimationActive,w=r.isUpdateAnimationActive;if(l!==+l||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var _=Le("recharts-rectangle",p);return w?D.createElement(Wn,{canBegin:o>0,from:{width:d,height:f,x:l,y:u},to:{width:d,height:f,x:l,y:u},duration:g,animationEasing:m,isActive:w},function(j){var b=j.width,O=j.height,S=j.x,N=j.y;return D.createElement(Wn,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:v,duration:g,isActive:y,easing:m},D.createElement("path",Md({},_e(r,!0),{className:_,d:SC(S,N,b,O,h),ref:n})))}):D.createElement("path",Md({},_e(r,!0),{className:_,d:SC(l,u,d,f,h)}))},SY=["points","className","baseLinePoints","connectNulls"];function Eo(){return Eo=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Eo.apply(this,arguments)}function jY(t,e){if(t==null)return{};var r=OY(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function OY(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function jC(t){return AY(t)||kY(t)||CY(t)||NY()}function NY(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 64In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function CY(t,e){if(t){if(typeof t=="string")return ob(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ob(t,e)}}function kY(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function AY(t){if(Array.isArray(t))return ob(t)}function ob(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var OC=function(e){return e&&e.x===+e.x&&e.y===+e.y},EY=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return e.forEach(function(n){OC(n)?r[r.length-1].push(n):r[r.length-1].length>0&&r.push([])}),OC(e[0])&&r[r.length-1].push(e[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},vl=function(e,r){var n=EY(e);r&&(n=[n.reduce(function(a,o){return[].concat(jC(a),jC(o))},[])]);var i=n.map(function(a){return a.reduce(function(o,s,l){return"".concat(o).concat(l===0?"M":"L").concat(s.x,",").concat(s.y)},"")}).join("");return n.length===1?"".concat(i,"Z"):i},PY=function(e,r,n){var i=vl(e,n);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(vl(r.reverse(),n).slice(1))}
vendor: 33,888 bytes, lines 64-65
64,TY=function(e){var r=e.points,n=e.className,i=e.baseLinePoints,a=e.connectNulls,o=jY(e,SY);if(!r||!r.length)return null;var s=Le("recharts-polygon",n);if(i&&i.length){var l=o.stroke&&o.stroke!=="none",u=PY(r,i,a);return D.createElement("g",{className:s},D.createElement("path",Eo({},_e(o,!0),{fill:u.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:u})),l?D.createElement("path",Eo({},_e(o,!0),{fill:"none",d:vl(r,a)})):null,l?D.createElement("path",Eo({},_e(o,!0),{fill:"none",d:vl(i,a)})):null)}var d=vl(r,a);return D.createElement("path",Eo({},_e(o,!0),{fill:d.slice(-1)==="Z"?o.fill:"none",className:s,d}))};function sb(){return sb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},sb.apply(this,arguments)}var Ch=function(e){var r=e.cx,n=e.cy,i=e.r,a=e.className,o=Le("recharts-dot",a);return r===+r&&n===+n&&i===+i?x.createElement("circle",sb({},_e(e,!1),rd(e),{className:o,cx:r,cy:n,r:i})):null};function ic(t){"@babel/helpers - typeof";return ic=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ic(t)}var MY=["x","y","top","left","width","height","className"];function lb(){return lb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},lb.apply(this,arguments)}function NC(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function DY(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?NC(Object(r),!0).forEach(function(n){RY(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):NC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function RY(t,e,r){return e=IY(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function IY(t){var e=$Y(t,"string");return ic(e)=="symbol"?e:e+""}function $Y(t,e){if(ic(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ic(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function LY(t,e){if(t==null)return{};var r=BY(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function BY(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var FY=function(e,r,n,i,a,o){return"M".concat(e,",").concat(a,"v").concat(i,"M").concat(o,",").concat(r,"h").concat(n)},zY=function(e){var r=e.x,n=r===void 0?0:r,i=e.y,a=i===void 0?0:i,o=e.top,s=o===void 0?0:o,l=e.left,u=l===void 0?0:l,d=e.width,f=d===void 0?0:d,h=e.height,p=h===void 0?0:h,m=e.className,g=LY(e,MY),v=DY({x:n,y:a,top:s,left:u,width:f,height:p},g);return!ie(n)||!ie(a)||!ie(f)||!ie(p)||!ie(s)||!ie(u)?null:D.createElement("path",lb({},_e(v,!0),{className:Le("recharts-cross",m),d:FY(n,a,f,p,s,u)}))},Xv,CC;function qY(){if(CC)return Xv;CC=1;var t=_h(),e=X2(),r=Xn();function n(i,a){return i&&i.length?t(i,r(a,2),e):void 0}return Xv=n,Xv}var UY=qY();const HY=at(UY);var Jv,kC;function WY(){if(kC)return Jv;kC=1;var t=_h(),e=Xn(),r=J2();function n(i,a){return i&&i.length?t(i,e(a,2),r):void 0}return Jv=n,Jv}var VY=WY();const KY=at(VY);var GY=["cx","cy","angle","ticks","axisLine"],YY=["ticks","tick","angle","tickFormatter","stroke"];function ss(t){"@babel/helpers - typeof";return ss=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ss(t)}function yl(){return yl=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},yl.apply(this,arguments)}function AC(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function va(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?AC(Object(r),!0).forEach(function(n){kh(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):AC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function EC(t,e){if(t==null)return{};var r=XY(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function XY(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function JY(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function PC(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,$D(n.key),n)}}function ZY(t,e,r){return e&&PC(t.prototype,e),r&&PC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function QY(t,e,r){return e=Dd(e),eX(t,ID()?Reflect.construct(e,r||[],Dd(t).constructor):e.apply(t,r))}function eX(t,e){if(e&&(ss(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return tX(t)}function tX(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ID(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ID=function(){return!!t})()}function Dd(t){return Dd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Dd(t)}function rX(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&cb(t,e)}function cb(t,e){return cb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},cb(t,e)}function kh(t,e,r){return e=$D(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $D(t){var e=nX(t,"string");return ss(e)=="symbol"?e:e+""}function nX(t,e){if(ss(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ss(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ah=(function(t){function e(){return JY(this,e),QY(this,e,arguments)}return rX(e,t),ZY(e,[{key:"getTickValueCoord",value:function(n){var i=n.coordinate,a=this.props,o=a.angle,s=a.cx,l=a.cy;return lt(s,l,i,o)}},{key:"getTickTextAnchor",value:function(){var n=this.props.orientation,i;switch(n){case"left":i="end";break;case"right":i="start";break;default:i="middle";break}return i}},{key:"getViewBox",value:function(){var n=this.props,i=n.cx,a=n.cy,o=n.angle,s=n.ticks,l=HY(s,function(d){return d.coordinate||0}),u=KY(s,function(d){return d.coordinate||0});return{cx:i,cy:a,startAngle:o,endAngle:o,innerRadius:u.coordinate||0,outerRadius:l.coordinate||0}}},{key:"renderAxisLine",value:function(){var n=this.props,i=n.cx,a=n.cy,o=n.angle,s=n.ticks,l=n.axisLine,u=EC(n,GY),d=s.reduce(function(m,g){return[Math.min(m[0],g.coordinate),Math.max(m[1],g.coordinate)]},[1/0,-1/0]),f=lt(i,a,d[0],o),h=lt(i,a,d[1],o),p=va(va(va({},_e(u,!1)),{},{fill:"none"},_e(l,!1)),{},{x1:f.x,y1:f.y,x2:h.x,y2:h.y});return D.createElement("line",yl({className:"recharts-polar-radius-axis-line"},p))}},{key:"renderTicks",value:function(){var n=this,i=this.props,a=i.ticks,o=i.tick,s=i.angle,l=i.tickFormatter,u=i.stroke,d=EC(i,YY),f=this.getTickTextAnchor(),h=_e(d,!1),p=_e(o,!1),m=a.map(function(g,v){var y=n.getTickValueCoord(g),w=va(va(va(va({textAnchor:f,transform:"rotate(".concat(90-s,", ").concat(y.x,", ").concat(y.y,")")},h),{},{stroke:"none",fill:u},p),{},{index:v},y),{},{payload:g});return D.createElement(Ke,yl({className:Le("recharts-polar-radius-axis-tick",OD(o)),key:"tick-".concat(g.coordinate)},Ka(n.props,g,v)),e.renderTickItem(o,w,l?l(g.value,v):g.value))});return D.createElement(Ke,{className:"recharts-polar-radius-axis-ticks"},m)}},{key:"render",value:function(){var n=this.props,i=n.ticks,a=n.axisLine,o=n.tick;return!i||!i.length?null:D.createElement(Ke,{className:Le("recharts-polar-radius-axis",this.props.className)},a&&this.renderAxisLine(),o&&this.renderTicks(),Vt.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(n,i,a){var o;return D.isValidElement(n)?o=D.cloneElement(n,i):ke(n)?o=n(i):o=D.createElement(Ga,yl({},i,{className:"recharts-polar-radius-axis-tick-value"}),a),o}}])})(x.PureComponent);kh(Ah,"displayName","PolarRadiusAxis");kh(Ah,"axisType","radiusAxis");kh(Ah,"defaultProps",{type:"number",radiusAxisId:0,cx:0,cy:0,angle:0,orientation:"right",stroke:"#ccc",axisLine:!0,tick:!0,tickCount:5,allowDataOverflow:!1,scale:"auto",allowDuplicatedCategory:!0});function ls(t){"@babel/helpers - typeof";return ls=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ls(t)}function _a(){return _a=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},_a.apply(this,arguments)}function TC(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ya(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?TC(Object(r),!0).forEach(function(n){Eh(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):TC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function iX(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function MC(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,BD(n.key),n)}}function aX(t,e,r){return e&&MC(t.prototype,e),r&&MC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function oX(t,e,r){return e=Rd(e),sX(t,LD()?Reflect.construct(e,r||[],Rd(t).constructor):e.apply(t,r))}function sX(t,e){if(e&&(ls(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return lX(t)}function lX(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function LD(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(LD=function(){return!!t})()}function Rd(t){return Rd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Rd(t)}function cX(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ub(t,e)}function ub(t,e){return ub=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ub(t,e)}function Eh(t,e,r){return e=BD(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function BD(t){var e=uX(t,"string");return ls(e)=="symbol"?e:e+""}function uX(t,e){if(ls(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ls(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var dX=Math.PI/180,DC=1e-5,Ph=(function(t){function e(){return iX(this,e),oX(this,e,arguments)}return cX(e,t),aX(e,[{key:"getTickLineCoord",value:function(n){var i=this.props,a=i.cx,o=i.cy,s=i.radius,l=i.orientation,u=i.tickSize,d=u||8,f=lt(a,o,s,n.coordinate),h=lt(a,o,s+(l==="inner"?-1:1)*d,n.coordinate);return{x1:f.x,y1:f.y,x2:h.x,y2:h.y}}},{key:"getTickTextAnchor",value:function(n){var i=this.props.orientation,a=Math.cos(-n.coordinate*dX),o;return a>DC?o=i==="outer"?"start":"end":a<-DC?o=i==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var n=this.props,i=n.cx,a=n.cy,o=n.radius,s=n.axisLine,l=n.axisLineType,u=ya(ya({},_e(this.props,!1)),{},{fill:"none"},_e(s,!1));if(l==="circle")return D.createElement(Ch,_a({className:"recharts-polar-angle-axis-line"},u,{cx:i,cy:a,r:o}));var d=this.props.ticks,f=d.map(function(h){return lt(i,a,o,h.coordinate)});return D.createElement(TY,_a({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var n=this,i=this.props,a=i.ticks,o=i.tick,s=i.tickLine,l=i.tickFormatter,u=i.stroke,d=_e(this.props,!1),f=_e(o,!1),h=ya(ya({},d),{},{fill:"none"},_e(s,!1)),p=a.map(function(m,g){var v=n.getTickLineCoord(m),y=n.getTickTextAnchor(m),w=ya(ya(ya({textAnchor:y},d),{},{stroke:"none",fill:u},f),{},{index:g,payload:m,x:v.x2,y:v.y2});return D.createElement(Ke,_a({className:Le("recharts-polar-angle-axis-tick",OD(o)),key:"tick-".concat(m.coordinate)},Ka(n.props,m,g)),s&&D.createElement("line",_a({className:"recharts-polar-angle-axis-tick-line"},h,v)),o&&e.renderTickItem(o,w,l?l(m.value,g):m.value))});return D.createElement(Ke,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var n=this.props,i=n.ticks,a=n.radius,o=n.axisLine;return a<=0||!i||!i.length?null:D.createElement(Ke,{className:Le("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,i,a){var o;return D.isValidElement(n)?o=D.cloneElement(n,i):ke(n)?o=n(i):o=D.createElement(Ga,_a({},i,{className:"recharts-polar-angle-axis-tick-value"}),a),o}}])})(x.PureComponent);Eh(Ph,"displayName","PolarAngleAxis");Eh(Ph,"axisType","angleAxis");Eh(Ph,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var Zv,RC;function fX(){if(RC)return Zv;RC=1;var t=YM(),e=t(Object.getPrototypeOf,Object);return Zv=e,Zv}var Qv,IC;function hX(){if(IC)return Qv;IC=1;var t=Oi(),e=fX(),r=Ni(),n="[object Object]",i=Function.prototype,a=Object.prototype,o=i.toString,s=a.hasOwnProperty,l=o.call(Object);function u(d){if(!r(d)||t(d)!=n)return!1;var f=e(d);if(f===null)return!0;var h=s.call(f,"constructor")&&f.constructor;return typeof h=="function"&&h instanceof h&&o.call(h)==l}return Qv=u,Qv}var pX=hX();const mX=at(pX);var ey,$C;function gX(){if($C)return ey;$C=1;var t=Oi(),e=Ni(),r="[object Boolean]";function n(i){return i===!0||i===!1||e(i)&&t(i)==r}return ey=n,ey}var vX=gX();const yX=at(vX);function ac(t){"@babel/helpers - typeof";return ac=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ac(t)}function Id(){return Id=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Id.apply(this,arguments)}function xX(t,e){return SX(t)||_X(t,e)||wX(t,e)||bX()}function bX(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 65In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wX(t,e){if(t){if(typeof t=="string")return LC(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return LC(t,e)}}function LC(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function _X(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}function SX(t){if(Array.isArray(t))return t}function BC(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function FC(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?BC(Object(r),!0).forEach(function(n){jX(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):BC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function jX(t,e,r){return e=OX(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function OX(t){var e=NX(t,"string");return ac(e)=="symbol"?e:e+""}function NX(t,e){if(ac(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ac(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var zC=function(e,r,n,i,a){var o=n-i,s;return s="M ".concat(e,",").concat(r),s+="L ".concat(e+n,",").concat(r),s+="L ".concat(e+n-o/2,",").concat(r+a),s+="L ".concat(e+n-o/2-i,",").concat(r+a),s+="L ".concat(e,",").concat(r," Z"),s},CX={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},kX=function(e){var r=FC(FC({},CX),e),n=x.useRef(),i=x.useState(-1),a=xX(i,2),o=a[0],s=a[1];x.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var _=n.current.getTotalLength();_&&s(_)}catch{}},[]);var l=r.x,u=r.y,d=r.upperWidth,f=r.lowerWidth,h=r.height,p=r.className,m=r.animationEasing,g=r.animationDuration,v=r.animationBegin,y=r.isUpdateAnimationActive;if(l!==+l||u!==+u||d!==+d||f!==+f||h!==+h||d===0&&f===0||h===0)return null;var w=Le("recharts-trapezoid",p);return y?D.createElement(Wn,{canBegin:o>0,from:{upperWidth:0,lowerWidth:0,height:h,x:l,y:u},to:{upperWidth:d,lowerWidth:f,height:h,x:l,y:u},duration:g,animationEasing:m,isActive:y},function(_){var j=_.upperWidth,b=_.lowerWidth,O=_.height,S=_.x,N=_.y;return D.createElement(Wn,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:v,duration:g,easing:m},D.createElement("path",Id({},_e(r,!0),{className:w,d:zC(S,N,j,b,O),ref:n})))}):D.createElement("g",null,D.createElement("path",Id({},_e(r,!0),{className:w,d:zC(l,u,d,f,h)})))},AX=["option","shapeType","propTransformer","activeClassName","isActive"];function oc(t){"@babel/helpers - typeof";return oc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},oc(t)}function EX(t,e){if(t==null)return{};var r=PX(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function PX(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function qC(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function $d(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?qC(Object(r),!0).forEach(function(n){TX(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function TX(t,e,r){return e=MX(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function MX(t){var e=DX(t,"string");return oc(e)=="symbol"?e:e+""}function DX(t,e){if(oc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(oc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function RX(t,e){return $d($d({},e),t)}function IX(t,e){return t==="symbols"}function UC(t){var e=t.shapeType,r=t.elementProps;switch(e){case"rectangle":return D.createElement(Rw,r);case"trapezoid":return D.createElement(kX,r);case"sector":return D.createElement(kD,r);case"symbols":if(IX(e))return D.createElement(ew,r);break;default:return null}}function $X(t){return x.isValidElement(t)?t.props:t}function FD(t){var e=t.option,r=t.shapeType,n=t.propTransformer,i=n===void 0?RX:n,a=t.activeClassName,o=a===void 0?"recharts-active-shape":a,s=t.isActive,l=EX(t,AX),u;if(x.isValidElement(e))u=x.cloneElement(e,$d($d({},l),$X(e)));else if(ke(e))u=e(l);else if(mX(e)&&!yX(e)){var d=i(e,l);u=D.createElement(UC,{shapeType:r,elementProps:d})}else{var f=l;u=D.createElement(UC,{shapeType:r,elementProps:f})}return s?D.createElement(Ke,{className:o},u):u}function Th(t,e){return e!=null&&"trapezoids"in t.props}function Mh(t,e){return e!=null&&"sectors"in t.props}function sc(t,e){return e!=null&&"points"in t.props}function LX(t,e){var r,n,i=t.x===(e==null||(r=e.labelViewBox)===null||r===void 0?void 0:r.x)||t.x===e.x,a=t.y===(e==null||(n=e.labelViewBox)===null||n===void 0?void 0:n.y)||t.y===e.y;return i&&a}function BX(t,e){var r=t.endAngle===e.endAngle,n=t.startAngle===e.startAngle;return r&&n}function FX(t,e){var r=t.x===e.x,n=t.y===e.y,i=t.z===e.z;return r&&n&&i}function zX(t,e){var r;return Th(t,e)?r=LX:Mh(t,e)?r=BX:sc(t,e)&&(r=FX),r}function qX(t,e){var r;return Th(t,e)?r="trapezoids":Mh(t,e)?r="sectors":sc(t,e)&&(r="points"),r}function UX(t,e){if(Th(t,e)){var r;return(r=e.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}if(Mh(t,e)){var n;return(n=e.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}return sc(t,e)?e.payload:{}}function HX(t){var e=t.activeTooltipItem,r=t.graphicalItem,n=t.itemData,i=qX(r,e),a=UX(r,e),o=n.filter(function(l,u){var d=Bc(a,l),f=r.props[i].filter(function(m){var g=zX(r,e);return g(m,e)}),h=r.props[i].indexOf(f[f.length-1]),p=u===h;return d&&p}),s=n.indexOf(o[o.length-1]);return s}var Tu;function cs(t){"@babel/helpers - typeof";return cs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cs(t)}function Po(){return Po=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Po.apply(this,arguments)}function HC(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ot(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?HC(Object(r),!0).forEach(function(n){rn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):HC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function WX(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function WC(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,qD(n.key),n)}}function VX(t,e,r){return e&&WC(t.prototype,e),r&&WC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function KX(t,e,r){return e=Ld(e),GX(t,zD()?Reflect.construct(e,r||[],Ld(t).constructor):e.apply(t,r))}function GX(t,e){if(e&&(cs(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return YX(t)}function YX(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function zD(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zD=function(){return!!t})()}function Ld(t){return Ld=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ld(t)}function XX(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&db(t,e)}function db(t,e){return db=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},db(t,e)}function rn(t,e,r){return e=qD(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function qD(t){var e=JX(t,"string");return cs(e)=="symbol"?e:e+""}function JX(t,e){if(cs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(cs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var ki=(function(t){function e(r){var n;return WX(this,e),n=KX(this,e,[r]),rn(n,"pieRef",null),rn(n,"sectorRefs",[]),rn(n,"id",Rs("recharts-pie-")),rn(n,"handleAnimationEnd",function(){var i=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),ke(i)&&i()}),rn(n,"handleAnimationStart",function(){var i=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),ke(i)&&i()}),n.state={isAnimationFinished:!r.isAnimationActive,prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,sectorToFocus:0},n}return XX(e,t),VX(e,[{key:"isActiveIndex",value:function(n){var i=this.props.activeIndex;return Array.isArray(i)?i.indexOf(n)!==-1:n===i}},{key:"hasActiveIndex",value:function(){var n=this.props.activeIndex;return Array.isArray(n)?n.length!==0:n||n===0}},{key:"renderLabels",value:function(n){var i=this.props.isAnimationActive;if(i&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.label,s=a.labelLine,l=a.dataKey,u=a.valueKey,d=_e(this.props,!1),f=_e(o,!1),h=_e(s,!1),p=o&&o.offsetRadius||20,m=n.map(function(g,v){var y=(g.startAngle+g.endAngle)/2,w=lt(g.cx,g.cy,g.outerRadius+p,y),_=ot(ot(ot(ot({},d),g),{},{stroke:"none"},f),{},{index:v,textAnchor:e.getTextAnchor(w.x,g.cx)},w),j=ot(ot(ot(ot({},d),g),{},{fill:"none",stroke:g.fill},h),{},{index:v,points:[lt(g.cx,g.cy,g.outerRadius,y),w]}),b=l;return Me(l)&&Me(u)?b="value":Me(l)&&(b=u),D.createElement(Ke,{key:"label-".concat(g.startAngle,"-").concat(g.endAngle,"-").concat(g.midAngle,"-").concat(v)},s&&e.renderLabelLineItem(s,j,"line"),e.renderLabelItem(o,_,Lt(g,b)))});return D.createElement(Ke,{className:"recharts-pie-labels"},m)}},{key:"renderSectorsStatically",value:function(n){var i=this,a=this.props,o=a.activeShape,s=a.blendStroke,l=a.inactiveShape;return n.map(function(u,d){if(u?.startAngle===0&&u?.endAngle===0&&n.length!==1)return null;var f=i.isActiveIndex(d),h=l&&i.hasActiveIndex()?l:null,p=f?o:h,m=ot(ot({},u),{},{stroke:s?u.fill:u.stroke,tabIndex:-1});return D.createElement(Ke,Po({ref:function(v){v&&!i.sectorRefs.includes(v)&&i.sectorRefs.push(v)},tabIndex:-1,className:"recharts-pie-sector"},Ka(i.props,u,d),{key:"sector-".concat(u?.startAngle,"-").concat(u?.endAngle,"-").concat(u.midAngle,"-").concat(d)}),D.createElement(FD,Po({option:p,isActive:f,shapeType:"sector"},m)))})}},{key:"renderSectorsWithAnimation",value:function(){var n=this,i=this.props,a=i.sectors,o=i.isAnimationActive,s=i.animationBegin,l=i.animationDuration,u=i.animationEasing,d=i.animationId,f=this.state,h=f.prevSectors,p=f.prevIsAnimationActive;return D.createElement(Wn,{begin:s,duration:l,isActive:o,easing:u,from:{t:0},to:{t:1},key:"pie-".concat(d,"-").concat(p),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(m){var g=m.t,v=[],y=a&&a[0],w=y.startAngle;return a.forEach(function(_,j){var b=h&&h[j],O=j>0?Ur(_,"paddingAngle",0):0;if(b){var S=Br(b.endAngle-b.startAngle,_.endAngle-_.startAngle),N=ot(ot({},_),{},{startAngle:w+O,endAngle:w+S(g)+O});v.push(N),w=N.endAngle}else{var C=_.endAngle,T=_.startAngle,k=Br(0,C-T),M=k(g),E=ot(ot({},_),{},{startAngle:w+O,endAngle:w+M+O});v.push(E),w=E.endAngle}}),D.createElement(Ke,null,n.renderSectorsStatically(v))})}},{key:"attachKeyboardHandlers",value:function(n){var i=this;n.onkeydown=function(a){if(!a.altKey)switch(a.key){case"ArrowLeft":{var o=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[o].focus(),i.setState({sectorToFocus:o});break}case"ArrowRight":{var s=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[s].focus(),i.setState({sectorToFocus:s});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var n=this.props,i=n.sectors,a=n.isAnimationActive,o=this.state.prevSectors;return a&&i&&i.length&&(!o||!Bc(o,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var n=this,i=this.props,a=i.hide,o=i.sectors,s=i.className,l=i.label,u=i.cx,d=i.cy,f=i.innerRadius,h=i.outerRadius,p=i.isAnimationActive,m=this.state.isAnimationFinished;if(a||!o||!o.length||!ie(u)||!ie(d)||!ie(f)||!ie(h))return null;var g=Le("recharts-pie",s);return D.createElement(Ke,{tabIndex:this.props.rootTabIndex,className:g,ref:function(y){n.pieRef=y}},this.renderSectors(),l&&this.renderLabels(o),Vt.renderCallByParent(this.props,null,!1),(!p||m)&&mi.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return i.prevIsAnimationActive!==n.isAnimationActive?{prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:[],isAnimationFinished:!0}:n.isAnimationActive&&n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:n.sectors!==i.curSectors?{curSectors:n.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(n,i){return n>i?"start":n<i?"end":"middle"}},{key:"renderLabelLineItem",value:function(n,i,a){if(D.isValidElement(n))return D.cloneElement(n,i);if(ke(n))return n(i);var o=Le("recharts-pie-label-line",typeof n!="boolean"?n.className:"");return D.createElement(Ad,Po({},i,{key:a,type:"linear",className:o}))}},{key:"renderLabelItem",value:function(n,i,a){if(D.isValidElement(n))return D.cloneElement(n,i);var o=a;if(ke(n)&&(o=n(i),D.isValidElement(o)))return o;var s=Le("recharts-pie-label-text",typeof n!="boolean"&&!ke(n)?n.className:"");return D.createElement(Ga,Po({},i,{alignmentBaseline:"middle",className:s}),o)}}])})(x.PureComponent);Tu=ki;rn(ki,"displayName","Pie");rn(ki,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!ao.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});rn(ki,"parseDeltaAngle",function(t,e){var r=wr(e-t),n=Math.min(Math.abs(e-t),360);return r*n});rn(ki,"getRealPieData",function(t){var e=t.data,r=t.children,n=_e(t,!1),i=Hr(r,mh);return e&&e.length?e.map(function(a,o){return ot(ot(ot({payload:a},n),a),i&&i[o]&&i[o].props)}):i&&i.length?i.map(function(a){return ot(ot({},n),a.props)}):[]});rn(ki,"parseCoordinateOfPie",function(t,e){var r=e.top,n=e.left,i=e.width,a=e.height,o=jD(i,a),s=n+_r(t.cx,i,i/2),l=r+_r(t.cy,a,a/2),u=_r(t.innerRadius,o,0),d=_r(t.outerRadius,o,o*.8),f=t.maxRadius||Math.sqrt(i*i+a*a)/2;return{cx:s,cy:l,innerRadius:u,outerRadius:d,maxRadius:f}});rn(ki,"getComposedData",function(t){var e=t.item,r=t.offset,n=e.type.defaultProps!==void 0?ot(ot({},e.type.defaultProps),e.props):e.props,i=Tu.getRealPieData(n);if(!i||!i.length)return null;var a=n.cornerRadius,o=n.startAngle,s=n.endAngle,l=n.paddingAngle,u=n.dataKey,d=n.nameKey,f=n.valueKey,h=n.tooltipType,p=Math.abs(n.minAngle),m=Tu.parseCoordinateOfPie(n,r),g=Tu.parseDeltaAngle(o,s),v=Math.abs(g),y=u;Me(u)&&Me(f)?(On(!1,`Use "dataKey" to specify the value of pie,
66 the props "valueKey" will be deprecated in 1.1.0`),y="value"):Me(u)&&(On(!1,`Use "dataKey" to specify the value of pie, 67 the props "valueKey" will be deprecated in 1.1.0`),y=f);var w=i.filter(function(N){return Lt(N,y,0)!==0}).length,_=(v>=360?w:w-1)*l,j=v-w*p-_,b=i.reduce(function(N,C){var T=Lt(C,y,0);return N+(ie(T)?T:0)},0),O;if(b>0){var S;O=i.map(function(N,C){var T=Lt(N,y,0),k=Lt(N,d,C),M=(ie(T)?T:0)/b,E;C?E=S.endAngle+wr(g)*l*(T!==0?1:0):E=o;var L=E+wr(g)*((T!==0?p:0)+M*j),R=(E+L)/2,I=(m.innerRadius+m.outerRadius)/2,$=[{name:k,value:T,payload:N,dataKey:y,type:h}],A=lt(m.cx,m.cy,I,R);return S=ot(ot(ot({percent:M,cornerRadius:a,name:k,tooltipPayload:$,midAngle:R,middleRadius:I,tooltipPosition:A},N),m),{},{value:Lt(N,y),startAngle:E,endAngle:L,payload:N,paddingAngle:wr(g)*l}),S})}return ot(ot({},m),{},{sectors:O,data:i})});var ty,VC;function ZX(){if(VC)return ty;VC=1;var t=Math.ceil,e=Math.max;function r(n,i,a,o){for(var s=-1,l=e(t((i-n)/(a||1)),0),u=Array(l);l--;)u[o?l:++s]=n,n+=a;return u}return ty=r,ty}var ry,KC;function UD(){if(KC)return ry;KC=1;var t=d2(),e=1/0,r=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=t(i),i===e||i===-e){var a=i<0?-1:1;return a*r}return i===i?i:0}return ry=n,ry}var ny,GC;function QX(){if(GC)return ny;GC=1;var t=ZX(),e=ph(),r=UD();function n(i){return function(a,o,s){return s&&typeof s!="number"&&e(a,o,s)&&(o=s=void 0),a=r(a),o===void 0?(o=a,a=0):o=r(o),s=s===void 0?a<o?1:-1:r(s),t(a,o,s,i)}}return ny=n,ny}var iy,YC;function eJ(){if(YC)return iy;YC=1;var t=QX(),e=t();return iy=e,iy}var tJ=eJ();const Bd=at(tJ);function lc(t){"@babel/helpers - typeof";return lc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lc(t)}function XC(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function JC(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?XC(Object(r),!0).forEach(function(n){HD(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):XC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function HD(t,e,r){return e=rJ(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function rJ(t){var e=nJ(t,"string");return lc(e)=="symbol"?e:e+""}function nJ(t,e){if(lc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(lc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var iJ=["Webkit","Moz","O","ms"],aJ=function(e,r){var n=e.replace(/(\w)/,function(a){return a.toUpperCase()}),i=iJ.reduce(function(a,o){return JC(JC({},a),{},HD({},o+n,r))},{});return i[e]=r,i};function us(t){"@babel/helpers - typeof";return us=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},us(t)}function Fd(){return Fd=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Fd.apply(this,arguments)}function ZC(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ay(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ZC(Object(r),!0).forEach(function(n){$r(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ZC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function oJ(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function QC(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,VD(n.key),n)}}function sJ(t,e,r){return e&&QC(t.prototype,e),r&&QC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function lJ(t,e,r){return e=zd(e),cJ(t,WD()?Reflect.construct(e,r||[],zd(t).constructor):e.apply(t,r))}function cJ(t,e){if(e&&(us(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return uJ(t)}function uJ(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function WD(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(WD=function(){return!!t})()}
vendor: 122,642 bytes, lines 67-72
67function zd(t){return zd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},zd(t)}function dJ(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&fb(t,e)}function fb(t,e){return fb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},fb(t,e)}function $r(t,e,r){return e=VD(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function VD(t){var e=fJ(t,"string");return us(e)=="symbol"?e:e+""}function fJ(t,e){if(us(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(us(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var hJ=function(e){var r=e.data,n=e.startIndex,i=e.endIndex,a=e.x,o=e.width,s=e.travellerWidth;if(!r||!r.length)return{};var l=r.length,u=pl().domain(Bd(0,l)).range([a,a+o-s]),d=u.domain().map(function(f){return u(f)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:u(n),endX:u(i),scale:u,scaleValues:d}},ek=function(e){return e.changedTouches&&!!e.changedTouches.length},ds=(function(t){function e(r){var n;return oJ(this,e),n=lJ(this,e,[r]),$r(n,"handleDrag",function(i){n.leaveTimer&&(clearTimeout(n.leaveTimer),n.leaveTimer=null),n.state.isTravellerMoving?n.handleTravellerMove(i):n.state.isSlideMoving&&n.handleSlideDrag(i)}),$r(n,"handleTouchMove",function(i){i.changedTouches!=null&&i.changedTouches.length>0&&n.handleDrag(i.changedTouches[0])}),$r(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=n.props,a=i.endIndex,o=i.onDragEnd,s=i.startIndex;o?.({endIndex:a,startIndex:s})}),n.detachDragEndListener()}),$r(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),$r(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),$r(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),$r(n,"handleSlideDragStart",function(i){var a=ek(i)?i.changedTouches[0]:i;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:a.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return dJ(e,t),sJ(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var i=n.startX,a=n.endX,o=this.state.scaleValues,s=this.props,l=s.gap,u=s.data,d=u.length-1,f=Math.min(i,a),h=Math.max(i,a),p=e.getIndexInRange(o,f),m=e.getIndexInRange(o,h);return{startIndex:p-p%l,endIndex:m===d?d:m-m%l}}},{key:"getTextOfTick",value:function(n){var i=this.props,a=i.data,o=i.tickFormatter,s=i.dataKey,l=Lt(a[n],s,n);return ke(o)?o(l,n):l}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(n){var i=this.state,a=i.slideMoveStartX,o=i.startX,s=i.endX,l=this.props,u=l.x,d=l.width,f=l.travellerWidth,h=l.startIndex,p=l.endIndex,m=l.onChange,g=n.pageX-a;g>0?g=Math.min(g,u+d-f-s,u+d-f-o):g<0&&(g=Math.max(g,u-o,u-s));var v=this.getIndex({startX:o+g,endX:s+g});(v.startIndex!==h||v.endIndex!==p)&&m&&m(v),this.setState({startX:o+g,endX:s+g,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,i){var a=ek(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:a.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var i=this.state,a=i.brushMoveStartX,o=i.movingTravellerId,s=i.endX,l=i.startX,u=this.state[o],d=this.props,f=d.x,h=d.width,p=d.travellerWidth,m=d.onChange,g=d.gap,v=d.data,y={startX:this.state.startX,endX:this.state.endX},w=n.pageX-a;w>0?w=Math.min(w,f+h-p-u):w<0&&(w=Math.max(w,f-u)),y[o]=u+w;var _=this.getIndex(y),j=_.startIndex,b=_.endIndex,O=function(){var N=v.length-1;return o==="startX"&&(s>l?j%g===0:b%g===0)||s<l&&b===N||o==="endX"&&(s>l?b%g===0:j%g===0)||s>l&&b===N};this.setState($r($r({},o,u+w),"brushMoveStartX",n.pageX),function(){m&&O()&&m(_)})}},{key:"handleTravellerMoveKeyboard",value:function(n,i){var a=this,o=this.state,s=o.scaleValues,l=o.startX,u=o.endX,d=this.state[i],f=s.indexOf(d);if(f!==-1){var h=f+n;if(!(h===-1||h>=s.length)){var p=s[h];i==="startX"&&p>=u||i==="endX"&&p<=l||this.setState($r({},i,p),function(){a.props.onChange(a.getIndex({startX:a.state.startX,endX:a.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,s=n.height,l=n.fill,u=n.stroke;return D.createElement("rect",{stroke:u,fill:l,x:i,y:a,width:o,height:s})}},{key:"renderPanorama",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,s=n.height,l=n.data,u=n.children,d=n.padding,f=x.Children.only(u);return f?D.cloneElement(f,{x:i,y:a,width:o,height:s,margin:d,compact:!0,data:l}):null}},{key:"renderTravellerLayer",value:function(n,i){var a,o,s=this,l=this.props,u=l.y,d=l.travellerWidth,f=l.height,h=l.traveller,p=l.ariaLabel,m=l.data,g=l.startIndex,v=l.endIndex,y=Math.max(n,this.props.x),w=ay(ay({},_e(this.props,!1)),{},{x:y,y:u,width:d,height:f}),_=p||"Min value: ".concat((a=m[g])===null||a===void 0?void 0:a.name,", Max value: ").concat((o=m[v])===null||o===void 0?void 0:o.name);return D.createElement(Ke,{tabIndex:0,role:"slider","aria-label":_,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(b){["ArrowLeft","ArrowRight"].includes(b.key)&&(b.preventDefault(),b.stopPropagation(),s.handleTravellerMoveKeyboard(b.key==="ArrowRight"?1:-1,i))},onFocus:function(){s.setState({isTravellerFocused:!0})},onBlur:function(){s.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(h,w))}},{key:"renderSlide",value:function(n,i){var a=this.props,o=a.y,s=a.height,l=a.stroke,u=a.travellerWidth,d=Math.min(n,i)+u,f=Math.max(Math.abs(i-n)-u,0);return D.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:l,fillOpacity:.2,x:d,y:o,width:f,height:s})}},{key:"renderText",value:function(){var n=this.props,i=n.startIndex,a=n.endIndex,o=n.y,s=n.height,l=n.travellerWidth,u=n.stroke,d=this.state,f=d.startX,h=d.endX,p=5,m={pointerEvents:"none",fill:u};return D.createElement(Ke,{className:"recharts-brush-texts"},D.createElement(Ga,Fd({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,h)-p,y:o+s/2},m),this.getTextOfTick(i)),D.createElement(Ga,Fd({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,h)+l+p,y:o+s/2},m),this.getTextOfTick(a)))}},{key:"render",value:function(){var n=this.props,i=n.data,a=n.className,o=n.children,s=n.x,l=n.y,u=n.width,d=n.height,f=n.alwaysShowText,h=this.state,p=h.startX,m=h.endX,g=h.isTextActive,v=h.isSlideMoving,y=h.isTravellerMoving,w=h.isTravellerFocused;if(!i||!i.length||!ie(s)||!ie(l)||!ie(u)||!ie(d)||u<=0||d<=0)return null;var _=Le("recharts-brush",a),j=D.Children.count(o)===1,b=aJ("userSelect","none");return D.createElement(Ke,{className:_,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:b},this.renderBackground(),j&&this.renderPanorama(),this.renderSlide(p,m),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(m,"endX"),(g||v||y||w||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var i=n.x,a=n.y,o=n.width,s=n.height,l=n.stroke,u=Math.floor(a+s/2)-1;return D.createElement(D.Fragment,null,D.createElement("rect",{x:i,y:a,width:o,height:s,fill:l,stroke:"none"}),D.createElement("line",{x1:i+1,y1:u,x2:i+o-1,y2:u,fill:"none",stroke:"#fff"}),D.createElement("line",{x1:i+1,y1:u+2,x2:i+o-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,i){var a;return D.isValidElement(n)?a=D.cloneElement(n,i):ke(n)?a=n(i):a=e.renderDefaultTraveller(i),a}},{key:"getDerivedStateFromProps",value:function(n,i){var a=n.data,o=n.width,s=n.x,l=n.travellerWidth,u=n.updateId,d=n.startIndex,f=n.endIndex;if(a!==i.prevData||u!==i.prevUpdateId)return ay({prevData:a,prevTravellerWidth:l,prevUpdateId:u,prevX:s,prevWidth:o},a&&a.length?hJ({data:a,width:o,x:s,travellerWidth:l,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(i.scale&&(o!==i.prevWidth||s!==i.prevX||l!==i.prevTravellerWidth)){i.scale.range([s,s+o-l]);var h=i.scale.domain().map(function(p){return i.scale(p)});return{prevData:a,prevTravellerWidth:l,prevUpdateId:u,prevX:s,prevWidth:o,startX:i.scale(n.startIndex),endX:i.scale(n.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(n,i){for(var a=n.length,o=0,s=a-1;s-o>1;){var l=Math.floor((o+s)/2);n[l]>i?s=l:o=l}return i>=n[s]?s:o}}])})(x.PureComponent);$r(ds,"displayName","Brush");$r(ds,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var oy,tk;function pJ(){if(tk)return oy;tk=1;var t=sw();function e(r,n){var i;return t(r,function(a,o,s){return i=n(a,o,s),!i}),!!i}return oy=e,oy}var sy,rk;function mJ(){if(rk)return sy;rk=1;var t=qM(),e=Xn(),r=pJ(),n=Mr(),i=ph();function a(o,s,l){var u=n(o)?t:r;return l&&i(o,s,l)&&(s=void 0),u(o,e(s,3))}return sy=a,sy}var gJ=mJ();const vJ=at(gJ);var Un=function(e,r){var n=e.alwaysShow,i=e.ifOverflow;return n&&(i="extendDomain"),i===r},ly,nk;function yJ(){if(nk)return ly;nk=1;var t=o2();function e(r,n,i){n=="__proto__"&&t?t(r,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[n]=i}return ly=e,ly}var cy,ik;function xJ(){if(ik)return cy;ik=1;var t=yJ(),e=i2(),r=Xn();function n(i,a){var o={};return a=r(a,3),e(i,function(s,l,u){t(o,l,a(s,l,u))}),o}return cy=n,cy}var bJ=xJ();const wJ=at(bJ);var uy,ak;function _J(){if(ak)return uy;ak=1;function t(e,r){for(var n=-1,i=e==null?0:e.length;++n<i;)if(!r(e[n],n,e))return!1;return!0}return uy=t,uy}var dy,ok;function SJ(){if(ok)return dy;ok=1;var t=sw();function e(r,n){var i=!0;return t(r,function(a,o,s){return i=!!n(a,o,s),i}),i}return dy=e,dy}var fy,sk;function jJ(){if(sk)return fy;sk=1;var t=_J(),e=SJ(),r=Xn(),n=Mr(),i=ph();function a(o,s,l){var u=n(o)?t:e;return l&&i(o,s,l)&&(s=void 0),u(o,r(s,3))}return fy=a,fy}var OJ=jJ();const KD=at(OJ);var NJ=["x","y"];function cc(t){"@babel/helpers - typeof";return cc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cc(t)}function hb(){return hb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},hb.apply(this,arguments)}function lk(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function el(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?lk(Object(r),!0).forEach(function(n){CJ(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):lk(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function CJ(t,e,r){return e=kJ(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function kJ(t){var e=AJ(t,"string");return cc(e)=="symbol"?e:e+""}function AJ(t,e){if(cc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(cc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function EJ(t,e){if(t==null)return{};var r=PJ(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function PJ(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function TJ(t,e){var r=t.x,n=t.y,i=EJ(t,NJ),a="".concat(r),o=parseInt(a,10),s="".concat(n),l=parseInt(s,10),u="".concat(e.height||i.height),d=parseInt(u,10),f="".concat(e.width||i.width),h=parseInt(f,10);return el(el(el(el(el({},e),i),o?{x:o}:{}),l?{y:l}:{}),{},{height:d,width:h,name:e.name,radius:e.radius})}function ck(t){return D.createElement(FD,hb({shapeType:"rectangle",propTransformer:TJ,activeClassName:"recharts-active-bar"},t))}var MJ=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,i){if(typeof e=="number")return e;var a=ie(n)||sq(n);return a?e(n,i):(a||Xa(),r)}},DJ=["value","background"],GD;function fs(t){"@babel/helpers - typeof";return fs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fs(t)}function RJ(t,e){if(t==null)return{};var r=IJ(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function IJ(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function qd(){return qd=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},qd.apply(this,arguments)}function uk(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function kt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?uk(Object(r),!0).forEach(function(n){Fi(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):uk(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function $J(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function dk(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,XD(n.key),n)}}function LJ(t,e,r){return e&&dk(t.prototype,e),r&&dk(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function BJ(t,e,r){return e=Ud(e),FJ(t,YD()?Reflect.construct(e,r||[],Ud(t).constructor):e.apply(t,r))}function FJ(t,e){if(e&&(fs(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zJ(t)}function zJ(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function YD(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(YD=function(){return!!t})()}function Ud(t){return Ud=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ud(t)}function qJ(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&pb(t,e)}function pb(t,e){return pb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},pb(t,e)}function Fi(t,e,r){return e=XD(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function XD(t){var e=UJ(t,"string");return fs(e)=="symbol"?e:e+""}function UJ(t,e){if(fs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(fs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var gi=(function(t){function e(){var r;$J(this,e);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return r=BJ(this,e,[].concat(i)),Fi(r,"state",{isAnimationFinished:!1}),Fi(r,"id",Rs("recharts-bar-")),Fi(r,"handleAnimationEnd",function(){var o=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),o&&o()}),Fi(r,"handleAnimationStart",function(){var o=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),o&&o()}),r}return qJ(e,t),LJ(e,[{key:"renderRectanglesStatically",value:function(n){var i=this,a=this.props,o=a.shape,s=a.dataKey,l=a.activeIndex,u=a.activeBar,d=_e(this.props,!1);return n&&n.map(function(f,h){var p=h===l,m=p?u:o,g=kt(kt(kt({},d),f),{},{isActive:p,option:m,index:h,dataKey:s,onAnimationStart:i.handleAnimationStart,onAnimationEnd:i.handleAnimationEnd});return D.createElement(Ke,qd({className:"recharts-bar-rectangle"},Ka(i.props,f,h),{key:"rectangle-".concat(f?.x,"-").concat(f?.y,"-").concat(f?.value,"-").concat(h)}),D.createElement(ck,g))})}},{key:"renderRectanglesWithAnimation",value:function(){var n=this,i=this.props,a=i.data,o=i.layout,s=i.isAnimationActive,l=i.animationBegin,u=i.animationDuration,d=i.animationEasing,f=i.animationId,h=this.state.prevData;return D.createElement(Wn,{begin:l,duration:u,isActive:s,easing:d,from:{t:0},to:{t:1},key:"bar-".concat(f),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(p){var m=p.t,g=a.map(function(v,y){var w=h&&h[y];if(w){var _=Br(w.x,v.x),j=Br(w.y,v.y),b=Br(w.width,v.width),O=Br(w.height,v.height);return kt(kt({},v),{},{x:_(m),y:j(m),width:b(m),height:O(m)})}if(o==="horizontal"){var S=Br(0,v.height),N=S(m);return kt(kt({},v),{},{y:v.y+v.height-N,height:N})}var C=Br(0,v.width),T=C(m);return kt(kt({},v),{},{width:T})});return D.createElement(Ke,null,n.renderRectanglesStatically(g))})}},{key:"renderRectangles",value:function(){var n=this.props,i=n.data,a=n.isAnimationActive,o=this.state.prevData;return a&&i&&i.length&&(!o||!Bc(o,i))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(i)}},{key:"renderBackground",value:function(){var n=this,i=this.props,a=i.data,o=i.dataKey,s=i.activeIndex,l=_e(this.props.background,!1);return a.map(function(u,d){u.value;var f=u.background,h=RJ(u,DJ);if(!f)return null;var p=kt(kt(kt(kt(kt({},h),{},{fill:"#eee"},f),l),Ka(n.props,u,d)),{},{onAnimationStart:n.handleAnimationStart,onAnimationEnd:n.handleAnimationEnd,dataKey:o,index:d,className:"recharts-bar-background-rectangle"});return D.createElement(ck,qd({key:"background-bar-".concat(d),option:n.props.background,isActive:d===s},p))})}},{key:"renderErrorBar",value:function(n,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.data,s=a.xAxis,l=a.yAxis,u=a.layout,d=a.children,f=Hr(d,Fc);if(!f)return null;var h=u==="vertical"?o[0].height/2:o[0].width/2,p=function(v,y){var w=Array.isArray(v.value)?v.value[1]:v.value;return{x:v.x,y:v.y,value:w,errorVal:Lt(v,y)}},m={clipPath:n?"url(#clipPath-".concat(i,")"):null};return D.createElement(Ke,m,f.map(function(g){return D.cloneElement(g,{key:"error-bar-".concat(i,"-").concat(g.props.dataKey),data:o,xAxis:s,yAxis:l,layout:u,offset:h,dataPointFormatter:p})}))}},{key:"render",value:function(){var n=this.props,i=n.hide,a=n.data,o=n.className,s=n.xAxis,l=n.yAxis,u=n.left,d=n.top,f=n.width,h=n.height,p=n.isAnimationActive,m=n.background,g=n.id;if(i||!a||!a.length)return null;var v=this.state.isAnimationFinished,y=Le("recharts-bar",o),w=s&&s.allowDataOverflow,_=l&&l.allowDataOverflow,j=w||_,b=Me(g)?this.id:g;return D.createElement(Ke,{className:y},w||_?D.createElement("defs",null,D.createElement("clipPath",{id:"clipPath-".concat(b)},D.createElement("rect",{x:w?u:u-f/2,y:_?d:d-h/2,width:w?f:f*2,height:_?h:h*2}))):null,D.createElement(Ke,{className:"recharts-bar-rectangles",clipPath:j?"url(#clipPath-".concat(b,")"):null},m?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(j,b),(!p||v)&&mi.renderCallByParent(this.props,a))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curData:n.data,prevData:i.curData}:n.data!==i.curData?{curData:n.data}:null}}])})(x.PureComponent);GD=gi;Fi(gi,"displayName","Bar");Fi(gi,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!ao.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});Fi(gi,"getComposedData",function(t){var e=t.props,r=t.item,n=t.barPosition,i=t.bandSize,a=t.xAxis,o=t.yAxis,s=t.xAxisTicks,l=t.yAxisTicks,u=t.stackedData,d=t.dataStartIndex,f=t.displayedData,h=t.offset,p=_7(n,r);if(!p)return null;var m=e.layout,g=r.type.defaultProps,v=g!==void 0?kt(kt({},g),r.props):r.props,y=v.dataKey,w=v.children,_=v.minPointSize,j=m==="horizontal"?o:a,b=u?j.scale.domain():null,O=A7({numericAxis:j}),S=Hr(w,mh),N=f.map(function(C,T){var k,M,E,L,R,I;u?k=S7(u[d+T],b):(k=Lt(C,y),Array.isArray(k)||(k=[O,k]));var $=MJ(_,GD.defaultProps.minPointSize)(k[1],T);if(m==="horizontal"){var A,F=[o.scale(k[0]),o.scale(k[1])],V=F[0],te=F[1];M=BN({axis:a,ticks:s,bandSize:i,offset:p.offset,entry:C,index:T}),E=(A=te??V)!==null&&A!==void 0?A:void 0,L=p.size;var B=V-te;if(R=Number.isNaN(B)?0:B,I={x:M,y:o.y,width:L,height:o.height},Math.abs($)>0&&Math.abs(R)<Math.abs($)){var G=wr(R||$)*(Math.abs($)-Math.abs(R));E-=G,R+=G}}else{var se=[a.scale(k[0]),a.scale(k[1])],Q=se[0],ye=se[1];if(M=Q,E=BN({axis:o,ticks:l,bandSize:i,offset:p.offset,entry:C,index:T}),L=ye-Q,R=p.size,I={x:a.x,y:E,width:a.width,height:R},Math.abs($)>0&&Math.abs(L)<Math.abs($)){var re=wr(L||$)*(Math.abs($)-Math.abs(L));L+=re}}return kt(kt(kt({},C),{},{x:M,y:E,width:L,height:R,value:u?k:k[1],payload:C,background:I},S&&S[T]&&S[T].props),{},{tooltipPayload:[_D(r,C)],tooltipPosition:{x:M+L/2,y:E+R/2}})});return kt({data:N,layout:m},h)});function uc(t){"@babel/helpers - typeof";return uc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},uc(t)}function HJ(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function fk(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,JD(n.key),n)}}function WJ(t,e,r){return e&&fk(t.prototype,e),r&&fk(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function hk(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function pn(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?hk(Object(r),!0).forEach(function(n){Dh(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):hk(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Dh(t,e,r){return e=JD(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function JD(t){var e=VJ(t,"string");return uc(e)=="symbol"?e:e+""}function VJ(t,e){if(uc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(uc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ZD=function(e,r,n,i,a){var o=e.width,s=e.height,l=e.layout,u=e.children,d=Object.keys(r),f={left:n.left,leftMirror:n.left,right:o-n.right,rightMirror:o-n.right,top:n.top,topMirror:n.top,bottom:s-n.bottom,bottomMirror:s-n.bottom},h=!!Lr(u,gi);return d.reduce(function(p,m){var g=r[m],v=g.orientation,y=g.domain,w=g.padding,_=w===void 0?{}:w,j=g.mirror,b=g.reversed,O="".concat(v).concat(j?"Mirror":""),S,N,C,T,k;if(g.type==="number"&&(g.padding==="gap"||g.padding==="no-gap")){var M=y[1]-y[0],E=1/0,L=g.categoricalDomain.sort(uq);if(L.forEach(function(se,Q){Q>0&&(E=Math.min((se||0)-(L[Q-1]||0),E))}),Number.isFinite(E)){var R=E/M,I=g.layout==="vertical"?n.height:n.width;if(g.padding==="gap"&&(S=R*I/2),g.padding==="no-gap"){var $=_r(e.barCategoryGap,R*I),A=R*I/2;S=A-$-(A-$)/I*$}}}i==="xAxis"?N=[n.left+(_.left||0)+(S||0),n.left+n.width-(_.right||0)-(S||0)]:i==="yAxis"?N=l==="horizontal"?[n.top+n.height-(_.bottom||0),n.top+(_.top||0)]:[n.top+(_.top||0)+(S||0),n.top+n.height-(_.bottom||0)-(S||0)]:N=g.range,b&&(N=[N[1],N[0]]);var F=yD(g,a,h),V=F.scale,te=F.realScaleType;V.domain(y).range(N),xD(V);var B=bD(V,pn(pn({},g),{},{realScaleType:te}));i==="xAxis"?(k=v==="top"&&!j||v==="bottom"&&j,C=n.left,T=f[O]-k*g.height):i==="yAxis"&&(k=v==="left"&&!j||v==="right"&&j,C=f[O]-k*g.width,T=n.top);var G=pn(pn(pn({},g),B),{},{realScaleType:te,x:C,y:T,scale:V,width:i==="xAxis"?n.width:g.width,height:i==="yAxis"?n.height:g.height});return G.bandSize=Nd(G,B),!g.hide&&i==="xAxis"?f[O]+=(k?-1:1)*G.height:g.hide||(f[O]+=(k?-1:1)*G.width),pn(pn({},p),{},Dh({},m,G))},{})},QD=function(e,r){var n=e.x,i=e.y,a=r.x,o=r.y;return{x:Math.min(n,a),y:Math.min(i,o),width:Math.abs(a-n),height:Math.abs(o-i)}},KJ=function(e){var r=e.x1,n=e.y1,i=e.x2,a=e.y2;return QD({x:r,y:n},{x:i,y:a})},eR=(function(){function t(e){HJ(this,t),this.scale=e}return WJ(t,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.bandAware,a=n.position;if(r!==void 0){if(a)switch(a){case"start":return this.scale(r);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+o}case"end":{var s=this.bandwidth?this.bandwidth():0;return this.scale(r)+s}default:return this.scale(r)}if(i){var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+l}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),i=n[0],a=n[n.length-1];return i<=a?r>=i&&r<=a:r>=a&&r<=i}}],[{key:"create",value:function(r){return new t(r)}}])})();Dh(eR,"EPS",1e-4);var Iw=function(e){var r=Object.keys(e).reduce(function(n,i){return pn(pn({},n),{},Dh({},i,eR.create(e[i])))},{});return pn(pn({},r),{},{apply:function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=a.bandAware,s=a.position;return wJ(i,function(l,u){return r[u].apply(l,{bandAware:o,position:s})})},isInRange:function(i){return KD(i,function(a,o){return r[o].isInRange(a)})}})};function GJ(t){return(t%180+180)%180}var YJ=function(e){var r=e.width,n=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=GJ(i),o=a*Math.PI/180,s=Math.atan(n/r),l=o>s&&o<Math.PI-s?n/Math.sin(o):r/Math.cos(o);return Math.abs(l)},hy,pk;function XJ(){if(pk)return hy;pk=1;var t=Xn(),e=Dc(),r=fh();function n(i){return function(a,o,s){var l=Object(a);if(!e(a)){var u=t(o,3);a=r(a),o=function(f){return u(l[f],f,l)}}var d=i(a,o,s);return d>-1?l[u?a[d]:d]:void 0}}return hy=n,hy}var py,mk;function JJ(){if(mk)return py;mk=1;var t=UD();function e(r){var n=t(r),i=n%1;return n===n?i?n-i:n:0}return py=e,py}var my,gk;function ZJ(){if(gk)return my;gk=1;var t=QM(),e=Xn(),r=JJ(),n=Math.max;function i(a,o,s){var l=a==null?0:a.length;if(!l)return-1;var u=s==null?0:r(s);return u<0&&(u=n(l+u,0)),t(a,e(o,3),u)}return my=i,my}var gy,vk;function QJ(){if(vk)return gy;vk=1;var t=XJ(),e=ZJ(),r=t(e);return gy=r,gy}var eZ=QJ();const tZ=at(eZ);var rZ=mM();const nZ=at(rZ);var iZ=nZ(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),$w=x.createContext(void 0),Lw=x.createContext(void 0),tR=x.createContext(void 0),rR=x.createContext({}),nR=x.createContext(void 0),iR=x.createContext(0),aR=x.createContext(0),yk=function(e){var r=e.state,n=r.xAxisMap,i=r.yAxisMap,a=r.offset,o=e.clipPathId,s=e.children,l=e.width,u=e.height,d=iZ(a);return D.createElement($w.Provider,{value:n},D.createElement(Lw.Provider,{value:i},D.createElement(rR.Provider,{value:a},D.createElement(tR.Provider,{value:d},D.createElement(nR.Provider,{value:o},D.createElement(iR.Provider,{value:u},D.createElement(aR.Provider,{value:l},s)))))))},aZ=function(){return x.useContext(nR)},oR=function(e){var r=x.useContext($w);r==null&&Xa();var n=r[e];return n==null&&Xa(),n},oZ=function(){var e=x.useContext($w);return $i(e)},sZ=function(){var e=x.useContext(Lw),r=tZ(e,function(n){return KD(n.domain,Number.isFinite)});return r||$i(e)},sR=function(e){var r=x.useContext(Lw);r==null&&Xa();var n=r[e];return n==null&&Xa(),n},lZ=function(){var e=x.useContext(tR);return e},cZ=function(){return x.useContext(rR)},Bw=function(){return x.useContext(aR)},Fw=function(){return x.useContext(iR)};function hs(t){"@babel/helpers - typeof";return hs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hs(t)}function uZ(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function dZ(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,cR(n.key),n)}}function fZ(t,e,r){return e&&dZ(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function hZ(t,e,r){return e=Hd(e),pZ(t,lR()?Reflect.construct(e,r||[],Hd(t).constructor):e.apply(t,r))}function pZ(t,e){if(e&&(hs(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mZ(t)}function mZ(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function lR(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(lR=function(){return!!t})()}function Hd(t){return Hd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Hd(t)}function gZ(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&mb(t,e)}function mb(t,e){return mb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},mb(t,e)}function xk(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function bk(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?xk(Object(r),!0).forEach(function(n){zw(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):xk(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function zw(t,e,r){return e=cR(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function cR(t){var e=vZ(t,"string");return hs(e)=="symbol"?e:e+""}function vZ(t,e){if(hs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(hs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function yZ(t,e){return _Z(t)||wZ(t,e)||bZ(t,e)||xZ()}function xZ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 68In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bZ(t,e){if(t){if(typeof t=="string")return wk(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return wk(t,e)}}function wk(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function wZ(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}function _Z(t){if(Array.isArray(t))return t}function gb(){return gb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},gb.apply(this,arguments)}var SZ=function(e,r){var n;return D.isValidElement(e)?n=D.cloneElement(e,r):ke(e)?n=e(r):n=D.createElement("line",gb({},r,{className:"recharts-reference-line-line"})),n},jZ=function(e,r,n,i,a,o,s,l,u){var d=a.x,f=a.y,h=a.width,p=a.height;if(n){var m=u.y,g=e.y.apply(m,{position:o});if(Un(u,"discard")&&!e.y.isInRange(g))return null;var v=[{x:d+h,y:g},{x:d,y:g}];return l==="left"?v.reverse():v}if(r){var y=u.x,w=e.x.apply(y,{position:o});if(Un(u,"discard")&&!e.x.isInRange(w))return null;var _=[{x:w,y:f+p},{x:w,y:f}];return s==="top"?_.reverse():_}if(i){var j=u.segment,b=j.map(function(O){return e.apply(O,{position:o})});return Un(u,"discard")&&vJ(b,function(O){return!e.isInRange(O)})?null:b}return null};function OZ(t){var e=t.x,r=t.y,n=t.segment,i=t.xAxisId,a=t.yAxisId,o=t.shape,s=t.className,l=t.alwaysShow,u=aZ(),d=oR(i),f=sR(a),h=lZ();if(!u||!h)return null;On(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var p=Iw({x:d.scale,y:f.scale}),m=Bt(e),g=Bt(r),v=n&&n.length===2,y=jZ(p,m,g,v,h,t.position,d.orientation,f.orientation,t);if(!y)return null;var w=yZ(y,2),_=w[0],j=_.x,b=_.y,O=w[1],S=O.x,N=O.y,C=Un(t,"hidden")?"url(#".concat(u,")"):void 0,T=bk(bk({clipPath:C},_e(t,!0)),{},{x1:j,y1:b,x2:S,y2:N});return D.createElement(Ke,{className:Le("recharts-reference-line",s)},SZ(o,T),Vt.renderCallByParent(t,KJ({x1:j,y1:b,x2:S,y2:N})))}var qw=(function(t){function e(){return uZ(this,e),hZ(this,e,arguments)}return gZ(e,t),fZ(e,[{key:"render",value:function(){return D.createElement(OZ,this.props)}}])})(D.Component);zw(qw,"displayName","ReferenceLine");zw(qw,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function vb(){return vb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},vb.apply(this,arguments)}function ps(t){"@babel/helpers - typeof";return ps=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ps(t)}function _k(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Sk(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?_k(Object(r),!0).forEach(function(n){Rh(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):_k(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function NZ(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function CZ(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,dR(n.key),n)}}function kZ(t,e,r){return e&&CZ(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function AZ(t,e,r){return e=Wd(e),EZ(t,uR()?Reflect.construct(e,r||[],Wd(t).constructor):e.apply(t,r))}function EZ(t,e){if(e&&(ps(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return PZ(t)}function PZ(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function uR(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(uR=function(){return!!t})()}function Wd(t){return Wd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Wd(t)}function TZ(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&yb(t,e)}function yb(t,e){return yb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},yb(t,e)}function Rh(t,e,r){return e=dR(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function dR(t){var e=MZ(t,"string");return ps(e)=="symbol"?e:e+""}function MZ(t,e){if(ps(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ps(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var DZ=function(e){var r=e.x,n=e.y,i=e.xAxis,a=e.yAxis,o=Iw({x:i.scale,y:a.scale}),s=o.apply({x:r,y:n},{bandAware:!0});return Un(e,"discard")&&!o.isInRange(s)?null:s},Ih=(function(t){function e(){return NZ(this,e),AZ(this,e,arguments)}return TZ(e,t),kZ(e,[{key:"render",value:function(){var n=this.props,i=n.x,a=n.y,o=n.r,s=n.alwaysShow,l=n.clipPathId,u=Bt(i),d=Bt(a);if(On(s===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!u||!d)return null;var f=DZ(this.props);if(!f)return null;var h=f.x,p=f.y,m=this.props,g=m.shape,v=m.className,y=Un(this.props,"hidden")?"url(#".concat(l,")"):void 0,w=Sk(Sk({clipPath:y},_e(this.props,!0)),{},{cx:h,cy:p});return D.createElement(Ke,{className:Le("recharts-reference-dot",v)},e.renderDot(g,w),Vt.renderCallByParent(this.props,{x:h-o,y:p-o,width:2*o,height:2*o}))}}])})(D.Component);Rh(Ih,"displayName","ReferenceDot");Rh(Ih,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});Rh(Ih,"renderDot",function(t,e){var r;return D.isValidElement(t)?r=D.cloneElement(t,e):ke(t)?r=t(e):r=D.createElement(Ch,vb({},e,{cx:e.cx,cy:e.cy,className:"recharts-reference-dot-dot"})),r});function xb(){return xb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},xb.apply(this,arguments)}function ms(t){"@babel/helpers - typeof";return ms=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ms(t)}function jk(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Ok(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?jk(Object(r),!0).forEach(function(n){$h(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):jk(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function RZ(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function IZ(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,hR(n.key),n)}}function $Z(t,e,r){return e&&IZ(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function LZ(t,e,r){return e=Vd(e),BZ(t,fR()?Reflect.construct(e,r||[],Vd(t).constructor):e.apply(t,r))}function BZ(t,e){if(e&&(ms(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return FZ(t)}function FZ(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function fR(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(fR=function(){return!!t})()}function Vd(t){return Vd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Vd(t)}function zZ(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&bb(t,e)}function bb(t,e){return bb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},bb(t,e)}function $h(t,e,r){return e=hR(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function hR(t){var e=qZ(t,"string");return ms(e)=="symbol"?e:e+""}function qZ(t,e){if(ms(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ms(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var UZ=function(e,r,n,i,a){var o=a.x1,s=a.x2,l=a.y1,u=a.y2,d=a.xAxis,f=a.yAxis;if(!d||!f)return null;var h=Iw({x:d.scale,y:f.scale}),p={x:e?h.x.apply(o,{position:"start"}):h.x.rangeMin,y:n?h.y.apply(l,{position:"start"}):h.y.rangeMin},m={x:r?h.x.apply(s,{position:"end"}):h.x.rangeMax,y:i?h.y.apply(u,{position:"end"}):h.y.rangeMax};return Un(a,"discard")&&(!h.isInRange(p)||!h.isInRange(m))?null:QD(p,m)},Lh=(function(t){function e(){return RZ(this,e),LZ(this,e,arguments)}return zZ(e,t),$Z(e,[{key:"render",value:function(){var n=this.props,i=n.x1,a=n.x2,o=n.y1,s=n.y2,l=n.className,u=n.alwaysShow,d=n.clipPathId;On(u===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var f=Bt(i),h=Bt(a),p=Bt(o),m=Bt(s),g=this.props.shape;if(!f&&!h&&!p&&!m&&!g)return null;var v=UZ(f,h,p,m,this.props);if(!v&&!g)return null;var y=Un(this.props,"hidden")?"url(#".concat(d,")"):void 0;return D.createElement(Ke,{className:Le("recharts-reference-area",l)},e.renderRect(g,Ok(Ok({clipPath:y},_e(this.props,!0)),v)),Vt.renderCallByParent(this.props,v))}}])})(D.Component);$h(Lh,"displayName","ReferenceArea");$h(Lh,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});$h(Lh,"renderRect",function(t,e){var r;return D.isValidElement(t)?r=D.cloneElement(t,e):ke(t)?r=t(e):r=D.createElement(Rw,xb({},e,{className:"recharts-reference-area-rect"})),r});function pR(t,e,r){if(e<1)return[];if(e===1&&r===void 0)return t;for(var n=[],i=0;i<t.length;i+=e)n.push(t[i]);return n}function HZ(t,e,r){var n={width:t.width+e.width,height:t.height+e.height};return YJ(n,r)}function WZ(t,e,r){var n=r==="width",i=t.x,a=t.y,o=t.width,s=t.height;return e===1?{start:n?i:a,end:n?i+o:a+s}:{start:n?i+o:a+s,end:n?i:a}}function Kd(t,e,r,n,i){if(t*e<t*n||t*e>t*i)return!1;var a=r();return t*(e-t*a/2-n)>=0&&t*(e+t*a/2-i)<=0}function VZ(t,e){return pR(t,e+1)}function KZ(t,e,r,n,i){for(var a=(n||[]).slice(),o=e.start,s=e.end,l=0,u=1,d=o,f=function(){var m=n?.[l];if(m===void 0)return{v:pR(n,u)};var g=l,v,y=function(){return v===void 0&&(v=r(m,g)),v},w=m.coordinate,_=l===0||Kd(t,w,y,d,s);_||(l=0,d=o,u+=1),_&&(d=w+t*(y()/2+i),l+=u)},h;u<=a.length;)if(h=f(),h)return h.v;return[]}function dc(t){"@babel/helpers - typeof";return dc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dc(t)}function Nk(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function or(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Nk(Object(r),!0).forEach(function(n){GZ(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Nk(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function GZ(t,e,r){return e=YZ(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function YZ(t){var e=XZ(t,"string");return dc(e)=="symbol"?e:e+""}function XZ(t,e){if(dc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(dc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function JZ(t,e,r,n,i){for(var a=(n||[]).slice(),o=a.length,s=e.start,l=e.end,u=function(h){var p=a[h],m,g=function(){return m===void 0&&(m=r(p,h)),m};if(h===o-1){var v=t*(p.coordinate+t*g()/2-l);a[h]=p=or(or({},p),{},{tickCoord:v>0?p.coordinate-v*t:p.coordinate})}else a[h]=p=or(or({},p),{},{tickCoord:p.coordinate});var y=Kd(t,p.tickCoord,g,s,l);y&&(l=p.tickCoord-t*(g()/2+i),a[h]=or(or({},p),{},{isShow:!0}))},d=o-1;d>=0;d--)u(d);return a}function ZZ(t,e,r,n,i,a){var o=(n||[]).slice(),s=o.length,l=e.start,u=e.end;if(a){var d=n[s-1],f=r(d,s-1),h=t*(d.coordinate+t*f/2-u);o[s-1]=d=or(or({},d),{},{tickCoord:h>0?d.coordinate-h*t:d.coordinate});var p=Kd(t,d.tickCoord,function(){return f},l,u);p&&(u=d.tickCoord-t*(f/2+i),o[s-1]=or(or({},d),{},{isShow:!0}))}for(var m=a?s-1:s,g=function(w){var _=o[w],j,b=function(){return j===void 0&&(j=r(_,w)),j};if(w===0){var O=t*(_.coordinate-t*b()/2-l);o[w]=_=or(or({},_),{},{tickCoord:O<0?_.coordinate-O*t:_.coordinate})}else o[w]=_=or(or({},_),{},{tickCoord:_.coordinate});var S=Kd(t,_.tickCoord,b,l,u);S&&(l=_.tickCoord+t*(b()/2+i),o[w]=or(or({},_),{},{isShow:!0}))},v=0;v<m;v++)g(v);return o}function Uw(t,e,r){var n=t.tick,i=t.ticks,a=t.viewBox,o=t.minTickGap,s=t.orientation,l=t.interval,u=t.tickFormatter,d=t.unit,f=t.angle;if(!i||!i.length||!n)return[];if(ie(l)||ao.isSsr)return VZ(i,typeof l=="number"&&ie(l)?l:0);var h=[],p=s==="top"||s==="bottom"?"width":"height",m=d&&p==="width"?hl(d,{fontSize:e,letterSpacing:r}):{width:0,height:0},g=function(_,j){var b=ke(u)?u(_.value,j):_.value;return p==="width"?HZ(hl(b,{fontSize:e,letterSpacing:r}),m,f):hl(b,{fontSize:e,letterSpacing:r})[p]},v=i.length>=2?wr(i[1].coordinate-i[0].coordinate):1,y=WZ(a,v,p);return l==="equidistantPreserveStart"?KZ(v,y,g,i,o):(l==="preserveStart"||l==="preserveStartEnd"?h=ZZ(v,y,g,i,o,l==="preserveStartEnd"):h=JZ(v,y,g,i,o),h.filter(function(w){return w.isShow}))}var QZ=["viewBox"],eQ=["viewBox"],tQ=["ticks"];function gs(t){"@babel/helpers - typeof";return gs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gs(t)}function To(){return To=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},To.apply(this,arguments)}function Ck(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Dt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ck(Object(r),!0).forEach(function(n){Hw(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ck(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function vy(t,e){if(t==null)return{};var r=rQ(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function rQ(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function nQ(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function kk(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,gR(n.key),n)}}function iQ(t,e,r){return e&&kk(t.prototype,e),r&&kk(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function aQ(t,e,r){return e=Gd(e),oQ(t,mR()?Reflect.construct(e,r||[],Gd(t).constructor):e.apply(t,r))}function oQ(t,e){if(e&&(gs(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return sQ(t)}function sQ(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function mR(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(mR=function(){return!!t})()}function Gd(t){return Gd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Gd(t)}function lQ(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&wb(t,e)}function wb(t,e){return wb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},wb(t,e)}function Hw(t,e,r){return e=gR(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function gR(t){var e=cQ(t,"string");return gs(e)=="symbol"?e:e+""}function cQ(t,e){if(gs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(gs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Fs=(function(t){function e(r){var n;return nQ(this,e),n=aQ(this,e,[r]),n.state={fontSize:"",letterSpacing:""},n}return lQ(e,t),iQ(e,[{key:"shouldComponentUpdate",value:function(n,i){var a=n.viewBox,o=vy(n,QZ),s=this.props,l=s.viewBox,u=vy(s,eQ);return!$o(a,l)||!$o(o,u)||!$o(i,this.state)}},{key:"componentDidMount",value:function(){var n=this.layerReference;if(n){var i=n.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];i&&this.setState({fontSize:window.getComputedStyle(i).fontSize,letterSpacing:window.getComputedStyle(i).letterSpacing})}}},{key:"getTickLineCoord",value:function(n){var i=this.props,a=i.x,o=i.y,s=i.width,l=i.height,u=i.orientation,d=i.tickSize,f=i.mirror,h=i.tickMargin,p,m,g,v,y,w,_=f?-1:1,j=n.tickSize||d,b=ie(n.tickCoord)?n.tickCoord:n.coordinate;switch(u){case"top":p=m=n.coordinate,v=o+ +!f*l,g=v-_*j,w=g-_*h,y=b;break;case"left":g=v=n.coordinate,m=a+ +!f*s,p=m-_*j,y=p-_*h,w=b;break;case"right":g=v=n.coordinate,m=a+ +f*s,p=m+_*j,y=p+_*h,w=b;break;default:p=m=n.coordinate,v=o+ +f*l,g=v+_*j,w=g+_*h,y=b;break}return{line:{x1:p,y1:g,x2:m,y2:v},tick:{x:y,y:w}}}},{key:"getTickTextAnchor",value:function(){var n=this.props,i=n.orientation,a=n.mirror,o;switch(i){case"left":o=a?"start":"end";break;case"right":o=a?"end":"start";break;default:o="middle";break}return o}},{key:"getTickVerticalAnchor",value:function(){var n=this.props,i=n.orientation,a=n.mirror,o="end";switch(i){case"left":case"right":o="middle";break;case"top":o=a?"start":"end";break;default:o=a?"end":"start";break}return o}},{key:"renderAxisLine",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,s=n.height,l=n.orientation,u=n.mirror,d=n.axisLine,f=Dt(Dt(Dt({},_e(this.props,!1)),_e(d,!1)),{},{fill:"none"});if(l==="top"||l==="bottom"){var h=+(l==="top"&&!u||l==="bottom"&&u);f=Dt(Dt({},f),{},{x1:i,y1:a+h*s,x2:i+o,y2:a+h*s})}else{var p=+(l==="left"&&!u||l==="right"&&u);f=Dt(Dt({},f),{},{x1:i+p*o,y1:a,x2:i+p*o,y2:a+s})}return D.createElement("line",To({},f,{className:Le("recharts-cartesian-axis-line",Ur(d,"className"))}))}},{key:"renderTicks",value:function(n,i,a){var o=this,s=this.props,l=s.tickLine,u=s.stroke,d=s.tick,f=s.tickFormatter,h=s.unit,p=Uw(Dt(Dt({},this.props),{},{ticks:n}),i,a),m=this.getTickTextAnchor(),g=this.getTickVerticalAnchor(),v=_e(this.props,!1),y=_e(d,!1),w=Dt(Dt({},v),{},{fill:"none"},_e(l,!1)),_=p.map(function(j,b){var O=o.getTickLineCoord(j),S=O.line,N=O.tick,C=Dt(Dt(Dt(Dt({textAnchor:m,verticalAnchor:g},v),{},{stroke:"none",fill:u},y),N),{},{index:b,payload:j,visibleTicksCount:p.length,tickFormatter:f});return D.createElement(Ke,To({className:"recharts-cartesian-axis-tick",key:"tick-".concat(j.value,"-").concat(j.coordinate,"-").concat(j.tickCoord)},Ka(o.props,j,b)),l&&D.createElement("line",To({},w,S,{className:Le("recharts-cartesian-axis-tick-line",Ur(l,"className"))})),d&&e.renderTickItem(d,C,"".concat(ke(f)?f(j.value,b):j.value).concat(h||"")))});return D.createElement("g",{className:"recharts-cartesian-axis-ticks"},_)}},{key:"render",value:function(){var n=this,i=this.props,a=i.axisLine,o=i.width,s=i.height,l=i.ticksGenerator,u=i.className,d=i.hide;if(d)return null;var f=this.props,h=f.ticks,p=vy(f,tQ),m=h;return ke(l)&&(m=h&&h.length>0?l(this.props):l(p)),o<=0||s<=0||!m||!m.length?null:D.createElement(Ke,{className:Le("recharts-cartesian-axis",u),ref:function(v){n.layerReference=v}},a&&this.renderAxisLine(),this.renderTicks(m,this.state.fontSize,this.state.letterSpacing),Vt.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,i,a){var o,s=Le(i.className,"recharts-cartesian-axis-tick-value");return D.isValidElement(n)?o=D.cloneElement(n,Dt(Dt({},i),{},{className:s})):ke(n)?o=n(Dt(Dt({},i),{},{className:s})):o=D.createElement(Ga,To({},i,{className:"recharts-cartesian-axis-tick-value"}),a),o}}])})(x.Component);Hw(Fs,"displayName","CartesianAxis");Hw(Fs,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var uQ=["x1","y1","x2","y2","key"],dQ=["offset"];function Ja(t){"@babel/helpers - typeof";return Ja=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ja(t)}function Ak(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function lr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ak(Object(r),!0).forEach(function(n){fQ(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ak(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function fQ(t,e,r){return e=hQ(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function hQ(t){var e=pQ(t,"string");return Ja(e)=="symbol"?e:e+""}function pQ(t,e){if(Ja(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Ja(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ka(){return ka=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},ka.apply(this,arguments)}function Ek(t,e){if(t==null)return{};var r=mQ(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function mQ(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var gQ=function(e){var r=e.fill;if(!r||r==="none")return null;var n=e.fillOpacity,i=e.x,a=e.y,o=e.width,s=e.height,l=e.ry;return D.createElement("rect",{x:i,y:a,ry:l,width:o,height:s,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function vR(t,e){var r;if(D.isValidElement(t))r=D.cloneElement(t,e);else if(ke(t))r=t(e);else{var n=e.x1,i=e.y1,a=e.x2,o=e.y2,s=e.key,l=Ek(e,uQ),u=_e(l,!1);u.offset;var d=Ek(u,dQ);r=D.createElement("line",ka({},d,{x1:n,y1:i,x2:a,y2:o,fill:"none",key:s}))}return r}function vQ(t){var e=t.x,r=t.width,n=t.horizontal,i=n===void 0?!0:n,a=t.horizontalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(s,l){var u=lr(lr({},t),{},{x1:e,y1:s,x2:e+r,y2:s,key:"line-".concat(l),index:l});return vR(i,u)});return D.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function yQ(t){var e=t.y,r=t.height,n=t.vertical,i=n===void 0?!0:n,a=t.verticalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(s,l){var u=lr(lr({},t),{},{x1:s,y1:e,x2:s,y2:e+r,key:"line-".concat(l),index:l});return vR(i,u)});return D.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function xQ(t){var e=t.horizontalFill,r=t.fillOpacity,n=t.x,i=t.y,a=t.width,o=t.height,s=t.horizontalPoints,l=t.horizontal,u=l===void 0?!0:l;if(!u||!e||!e.length)return null;var d=s.map(function(h){return Math.round(h+i-i)}).sort(function(h,p){return h-p});i!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var m=!d[p+1],g=m?i+o-h:d[p+1]-h;if(g<=0)return null;var v=p%e.length;return D.createElement("rect",{key:"react-".concat(p),y:h,x:n,height:g,width:a,stroke:"none",fill:e[v],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return D.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function bQ(t){var e=t.vertical,r=e===void 0?!0:e,n=t.verticalFill,i=t.fillOpacity,a=t.x,o=t.y,s=t.width,l=t.height,u=t.verticalPoints;if(!r||!n||!n.length)return null;var d=u.map(function(h){return Math.round(h+a-a)}).sort(function(h,p){return h-p});a!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var m=!d[p+1],g=m?a+s-h:d[p+1]-h;if(g<=0)return null;var v=p%n.length;return D.createElement("rect",{key:"react-".concat(p),x:h,y:o,width:g,height:l,stroke:"none",fill:n[v],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return D.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var wQ=function(e,r){var n=e.xAxis,i=e.width,a=e.height,o=e.offset;return vD(Uw(lr(lr(lr({},Fs.defaultProps),n),{},{ticks:di(n,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.left,o.left+o.width,r)},_Q=function(e,r){var n=e.yAxis,i=e.width,a=e.height,o=e.offset;return vD(Uw(lr(lr(lr({},Fs.defaultProps),n),{},{ticks:di(n,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.top,o.top+o.height,r)},xo={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function _b(t){var e,r,n,i,a,o,s=Bw(),l=Fw(),u=cZ(),d=lr(lr({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:xo.stroke,fill:(r=t.fill)!==null&&r!==void 0?r:xo.fill,horizontal:(n=t.horizontal)!==null&&n!==void 0?n:xo.horizontal,horizontalFill:(i=t.horizontalFill)!==null&&i!==void 0?i:xo.horizontalFill,vertical:(a=t.vertical)!==null&&a!==void 0?a:xo.vertical,verticalFill:(o=t.verticalFill)!==null&&o!==void 0?o:xo.verticalFill,x:ie(t.x)?t.x:u.left,y:ie(t.y)?t.y:u.top,width:ie(t.width)?t.width:u.width,height:ie(t.height)?t.height:u.height}),f=d.x,h=d.y,p=d.width,m=d.height,g=d.syncWithTicks,v=d.horizontalValues,y=d.verticalValues,w=oZ(),_=sZ();if(!ie(p)||p<=0||!ie(m)||m<=0||!ie(f)||f!==+f||!ie(h)||h!==+h)return null;var j=d.verticalCoordinatesGenerator||wQ,b=d.horizontalCoordinatesGenerator||_Q,O=d.horizontalPoints,S=d.verticalPoints;if((!O||!O.length)&&ke(b)){var N=v&&v.length,C=b({yAxis:_?lr(lr({},_),{},{ticks:N?v:_.ticks}):void 0,width:s,height:l,offset:u},N?!0:g);On(Array.isArray(C),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Ja(C),"]")),Array.isArray(C)&&(O=C)}if((!S||!S.length)&&ke(j)){var T=y&&y.length,k=j({xAxis:w?lr(lr({},w),{},{ticks:T?y:w.ticks}):void 0,width:s,height:l,offset:u},T?!0:g);On(Array.isArray(k),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Ja(k),"]")),Array.isArray(k)&&(S=k)}return D.createElement("g",{className:"recharts-cartesian-grid"},D.createElement(gQ,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),D.createElement(vQ,ka({},d,{offset:u,horizontalPoints:O,xAxis:w,yAxis:_})),D.createElement(yQ,ka({},d,{offset:u,verticalPoints:S,xAxis:w,yAxis:_})),D.createElement(xQ,ka({},d,{horizontalPoints:O})),D.createElement(bQ,ka({},d,{verticalPoints:S})))}_b.displayName="CartesianGrid";var SQ=["type","layout","connectNulls","ref"],jQ=["key"];function vs(t){"@babel/helpers - typeof";return vs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vs(t)}function Pk(t,e){if(t==null)return{};var r=OQ(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function OQ(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function xl(){return xl=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},xl.apply(this,arguments)}function Tk(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Ir(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Tk(Object(r),!0).forEach(function(n){mn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Tk(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function bo(t){return AQ(t)||kQ(t)||CQ(t)||NQ()}function NQ(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 69In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function CQ(t,e){if(t){if(typeof t=="string")return Sb(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Sb(t,e)}}function kQ(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function AQ(t){if(Array.isArray(t))return Sb(t)}function Sb(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function EQ(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Mk(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,xR(n.key),n)}}function PQ(t,e,r){return e&&Mk(t.prototype,e),r&&Mk(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function TQ(t,e,r){return e=Yd(e),MQ(t,yR()?Reflect.construct(e,r||[],Yd(t).constructor):e.apply(t,r))}function MQ(t,e){if(e&&(vs(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return DQ(t)}function DQ(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function yR(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yR=function(){return!!t})()}function Yd(t){return Yd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Yd(t)}function RQ(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jb(t,e)}function jb(t,e){return jb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},jb(t,e)}function mn(t,e,r){return e=xR(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xR(t){var e=IQ(t,"string");return vs(e)=="symbol"?e:e+""}function IQ(t,e){if(vs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(vs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var ys=(function(t){function e(){var r;EQ(this,e);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return r=TQ(this,e,[].concat(i)),mn(r,"state",{isAnimationFinished:!0,totalLength:0}),mn(r,"generateSimpleStrokeDasharray",function(o,s){return"".concat(s,"px ").concat(o-s,"px")}),mn(r,"getStrokeDasharray",function(o,s,l){var u=l.reduce(function(y,w){return y+w});if(!u)return r.generateSimpleStrokeDasharray(s,o);for(var d=Math.floor(o/u),f=o%u,h=s-o,p=[],m=0,g=0;m<l.length;g+=l[m],++m)if(g+l[m]>f){p=[].concat(bo(l.slice(0,m)),[f-g]);break}var v=p.length%2===0?[0,h]:[h];return[].concat(bo(e.repeat(l,d)),bo(p),v).map(function(y){return"".concat(y,"px")}).join(", ")}),mn(r,"id",Rs("recharts-line-")),mn(r,"pathRef",function(o){r.mainCurve=o}),mn(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),mn(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return RQ(e,t),PQ(e,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.points,s=a.xAxis,l=a.yAxis,u=a.layout,d=a.children,f=Hr(d,Fc);if(!f)return null;var h=function(g,v){return{x:g.x,y:g.y,value:g.value,errorVal:Lt(g.payload,v)}},p={clipPath:n?"url(#clipPath-".concat(i,")"):null};return D.createElement(Ke,p,f.map(function(m){return D.cloneElement(m,{key:"bar-".concat(m.props.dataKey),data:o,xAxis:s,yAxis:l,layout:u,dataPointFormatter:h})}))}},{key:"renderDots",value:function(n,i,a){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var s=this.props,l=s.dot,u=s.points,d=s.dataKey,f=_e(this.props,!1),h=_e(l,!0),p=u.map(function(g,v){var y=Ir(Ir(Ir({key:"dot-".concat(v),r:3},f),h),{},{index:v,cx:g.x,cy:g.y,value:g.value,dataKey:d,payload:g.payload,points:u});return e.renderDotItem(l,y)}),m={clipPath:n?"url(#clipPath-".concat(i?"":"dots-").concat(a,")"):null};return D.createElement(Ke,xl({className:"recharts-line-dots",key:"dots"},m),p)}},{key:"renderCurveStatically",value:function(n,i,a,o){var s=this.props,l=s.type,u=s.layout,d=s.connectNulls;s.ref;var f=Pk(s,SQ),h=Ir(Ir(Ir({},_e(f,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(a,")"):null,points:n},o),{},{type:l,layout:u,connectNulls:d});return D.createElement(Ad,xl({},h,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,i){var a=this,o=this.props,s=o.points,l=o.strokeDasharray,u=o.isAnimationActive,d=o.animationBegin,f=o.animationDuration,h=o.animationEasing,p=o.animationId,m=o.animateNewValues,g=o.width,v=o.height,y=this.state,w=y.prevPoints,_=y.totalLength;return D.createElement(Wn,{begin:d,duration:f,isActive:u,easing:h,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(j){var b=j.t;if(w){var O=w.length/s.length,S=s.map(function(M,E){var L=Math.floor(E*O);if(w[L]){var R=w[L],I=Br(R.x,M.x),$=Br(R.y,M.y);return Ir(Ir({},M),{},{x:I(b),y:$(b)})}if(m){var A=Br(g*2,M.x),F=Br(v/2,M.y);return Ir(Ir({},M),{},{x:A(b),y:F(b)})}return Ir(Ir({},M),{},{x:M.x,y:M.y})});return a.renderCurveStatically(S,n,i)}var N=Br(0,_),C=N(b),T;if(l){var k="".concat(l).split(/[,\s]+/gim).map(function(M){return parseFloat(M)});T=a.getStrokeDasharray(C,_,k)}else T=a.generateSimpleStrokeDasharray(_,C);return a.renderCurveStatically(s,n,i,{strokeDasharray:T})})}},{key:"renderCurve",value:function(n,i){var a=this.props,o=a.points,s=a.isAnimationActive,l=this.state,u=l.prevPoints,d=l.totalLength;return s&&o&&o.length&&(!u&&d>0||!Bc(u,o))?this.renderCurveWithAnimation(n,i):this.renderCurveStatically(o,n,i)}},{key:"render",value:function(){var n,i=this.props,a=i.hide,o=i.dot,s=i.points,l=i.className,u=i.xAxis,d=i.yAxis,f=i.top,h=i.left,p=i.width,m=i.height,g=i.isAnimationActive,v=i.id;if(a||!s||!s.length)return null;var y=this.state.isAnimationFinished,w=s.length===1,_=Le("recharts-line",l),j=u&&u.allowDataOverflow,b=d&&d.allowDataOverflow,O=j||b,S=Me(v)?this.id:v,N=(n=_e(o,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},C=N.r,T=C===void 0?3:C,k=N.strokeWidth,M=k===void 0?2:k,E=xq(o)?o:{},L=E.clipDot,R=L===void 0?!0:L,I=T*2+M;return D.createElement(Ke,{className:_},j||b?D.createElement("defs",null,D.createElement("clipPath",{id:"clipPath-".concat(S)},D.createElement("rect",{x:j?h:h-p/2,y:b?f:f-m/2,width:j?p:p*2,height:b?m:m*2})),!R&&D.createElement("clipPath",{id:"clipPath-dots-".concat(S)},D.createElement("rect",{x:h-I/2,y:f-I/2,width:p+I,height:m+I}))):null,!w&&this.renderCurve(O,S),this.renderErrorBar(O,S),(w||o)&&this.renderDots(O,R,S),(!g||y)&&mi.renderCallByParent(this.props,s))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:i.curPoints}:n.points!==i.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,i){for(var a=n.length%2!==0?[].concat(bo(n),[0]):n,o=[],s=0;s<i;++s)o=[].concat(bo(o),bo(a));return o}},{key:"renderDotItem",value:function(n,i){var a;if(D.isValidElement(n))a=D.cloneElement(n,i);else if(ke(n))a=n(i);else{var o=i.key,s=Pk(i,jQ),l=Le("recharts-line-dot",typeof n!="boolean"?n.className:"");a=D.createElement(Ch,xl({key:o},s,{className:l}))}return a}}])})(x.PureComponent);mn(ys,"displayName","Line");mn(ys,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!ao.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});mn(ys,"getComposedData",function(t){var e=t.props,r=t.xAxis,n=t.yAxis,i=t.xAxisTicks,a=t.yAxisTicks,o=t.dataKey,s=t.bandSize,l=t.displayedData,u=t.offset,d=e.layout,f=l.map(function(h,p){var m=Lt(h,o);return d==="horizontal"?{x:LN({axis:r,ticks:i,bandSize:s,entry:h,index:p}),y:Me(m)?null:n.scale(m),value:m,payload:h}:{x:Me(m)?null:r.scale(m),y:LN({axis:n,ticks:a,bandSize:s,entry:h,index:p}),value:m,payload:h}});return Ir({points:f,layout:d},u)});function xs(t){"@babel/helpers - typeof";return xs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xs(t)}function $Q(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function LQ(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,_R(n.key),n)}}function BQ(t,e,r){return e&&LQ(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function FQ(t,e,r){return e=Xd(e),zQ(t,bR()?Reflect.construct(e,r||[],Xd(t).constructor):e.apply(t,r))}function zQ(t,e){if(e&&(xs(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qQ(t)}function qQ(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function bR(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bR=function(){return!!t})()}function Xd(t){return Xd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Xd(t)}function UQ(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ob(t,e)}function Ob(t,e){return Ob=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Ob(t,e)}function wR(t,e,r){return e=_R(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _R(t){var e=HQ(t,"string");return xs(e)=="symbol"?e:e+""}function HQ(t,e){if(xs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(xs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function Nb(){return Nb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Nb.apply(this,arguments)}function WQ(t){var e=t.xAxisId,r=Bw(),n=Fw(),i=oR(e);return i==null?null:x.createElement(Fs,Nb({},i,{className:Le("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:r,height:n},ticksGenerator:function(o){return di(o,!0)}}))}var bs=(function(t){function e(){return $Q(this,e),FQ(this,e,arguments)}return UQ(e,t),BQ(e,[{key:"render",value:function(){return x.createElement(WQ,this.props)}}])})(x.Component);wR(bs,"displayName","XAxis");wR(bs,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function ws(t){"@babel/helpers - typeof";return ws=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ws(t)}function VQ(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function KQ(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,OR(n.key),n)}}function GQ(t,e,r){return e&&KQ(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function YQ(t,e,r){return e=Jd(e),XQ(t,SR()?Reflect.construct(e,r||[],Jd(t).constructor):e.apply(t,r))}function XQ(t,e){if(e&&(ws(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return JQ(t)}function JQ(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function SR(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(SR=function(){return!!t})()}function Jd(t){return Jd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Jd(t)}function ZQ(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Cb(t,e)}function Cb(t,e){return Cb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Cb(t,e)}function jR(t,e,r){return e=OR(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function OR(t){var e=QQ(t,"string");return ws(e)=="symbol"?e:e+""}function QQ(t,e){if(ws(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ws(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function kb(){return kb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},kb.apply(this,arguments)}var eee=function(e){var r=e.yAxisId,n=Bw(),i=Fw(),a=sR(r);return a==null?null:x.createElement(Fs,kb({},a,{className:Le("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:n,height:i},ticksGenerator:function(s){return di(s,!0)}}))},_s=(function(t){function e(){return VQ(this,e),YQ(this,e,arguments)}return ZQ(e,t),GQ(e,[{key:"render",value:function(){return x.createElement(eee,this.props)}}])})(x.Component);jR(_s,"displayName","YAxis");jR(_s,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function Dk(t){return iee(t)||nee(t)||ree(t)||tee()}function tee(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 70In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ree(t,e){if(t){if(typeof t=="string")return Ab(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ab(t,e)}}function nee(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function iee(t){if(Array.isArray(t))return Ab(t)}function Ab(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Eb=function(e,r,n,i,a){var o=Hr(e,qw),s=Hr(e,Ih),l=[].concat(Dk(o),Dk(s)),u=Hr(e,Lh),d="".concat(i,"Id"),f=i[0],h=r;if(l.length&&(h=l.reduce(function(g,v){if(v.props[d]===n&&Un(v.props,"extendDomain")&&ie(v.props[f])){var y=v.props[f];return[Math.min(g[0],y),Math.max(g[1],y)]}return g},h)),u.length){var p="".concat(f,"1"),m="".concat(f,"2");h=u.reduce(function(g,v){if(v.props[d]===n&&Un(v.props,"extendDomain")&&ie(v.props[p])&&ie(v.props[m])){var y=v.props[p],w=v.props[m];return[Math.min(g[0],y,w),Math.max(g[1],y,w)]}return g},h)}return a&&a.length&&(h=a.reduce(function(g,v){return ie(v)?[Math.min(g[0],v),Math.max(g[1],v)]:g},h)),h},yy={exports:{}},Rk;function aee(){return Rk||(Rk=1,(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(l,u,d){this.fn=l,this.context=u,this.once=d||!1}function a(l,u,d,f,h){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new i(d,f||l,h),m=r?r+u:u;return l._events[m]?l._events[m].fn?l._events[m]=[l._events[m],p]:l._events[m].push(p):(l._events[m]=p,l._eventsCount++),l}function o(l,u){--l._eventsCount===0?l._events=new n:delete l._events[u]}function s(){this._events=new n,this._eventsCount=0}s.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)e.call(d,f)&&u.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},s.prototype.listeners=function(u){var d=r?r+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var h=0,p=f.length,m=new Array(p);h<p;h++)m[h]=f[h].fn;return m},s.prototype.listenerCount=function(u){var d=r?r+u:u,f=this._events[d];return f?f.fn?1:f.length:0},s.prototype.emit=function(u,d,f,h,p,m){var g=r?r+u:u;if(!this._events[g])return!1;var v=this._events[g],y=arguments.length,w,_;if(v.fn){switch(v.once&&this.removeListener(u,v.fn,void 0,!0),y){case 1:return v.fn.call(v.context),!0;case 2:return v.fn.call(v.context,d),!0;case 3:return v.fn.call(v.context,d,f),!0;case 4:return v.fn.call(v.context,d,f,h),!0;case 5:return v.fn.call(v.context,d,f,h,p),!0;case 6:return v.fn.call(v.context,d,f,h,p,m),!0}for(_=1,w=new Array(y-1);_<y;_++)w[_-1]=arguments[_];v.fn.apply(v.context,w)}else{var j=v.length,b;for(_=0;_<j;_++)switch(v[_].once&&this.removeListener(u,v[_].fn,void 0,!0),y){case 1:v[_].fn.call(v[_].context);break;case 2:v[_].fn.call(v[_].context,d);break;case 3:v[_].fn.call(v[_].context,d,f);break;case 4:v[_].fn.call(v[_].context,d,f,h);break;default:if(!w)for(b=1,w=new Array(y-1);b<y;b++)w[b-1]=arguments[b];v[_].fn.apply(v[_].context,w)}}return!0},s.prototype.on=function(u,d,f){return a(this,u,d,f,!1)},s.prototype.once=function(u,d,f){return a(this,u,d,f,!0)},s.prototype.removeListener=function(u,d,f,h){var p=r?r+u:u;if(!this._events[p])return this;if(!d)return o(this,p),this;var m=this._events[p];if(m.fn)m.fn===d&&(!h||m.once)&&(!f||m.context===f)&&o(this,p);else{for(var g=0,v=[],y=m.length;g<y;g++)(m[g].fn!==d||h&&!m[g].once||f&&m[g].context!==f)&&v.push(m[g]);v.length?this._events[p]=v.length===1?v[0]:v:o(this,p)}return this},s.prototype.removeAllListeners=function(u){var d;return u?(d=r?r+u:u,this._events[d]&&o(this,d)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,t.exports=s})(yy)),yy.exports}var oee=aee();const see=at(oee);var xy=new see,by="recharts.syncMouseEvents";function fc(t){"@babel/helpers - typeof";return fc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fc(t)}function lee(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cee(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,NR(n.key),n)}}function uee(t,e,r){return e&&cee(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function wy(t,e,r){return e=NR(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function NR(t){var e=dee(t,"string");return fc(e)=="symbol"?e:e+""}function dee(t,e){if(fc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(fc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var fee=(function(){function t(){lee(this,t),wy(this,"activeIndex",0),wy(this,"coordinateList",[]),wy(this,"layout","horizontal")}return uee(t,[{key:"setDetails",value:function(r){var n,i=r.coordinateList,a=i===void 0?null:i,o=r.container,s=o===void 0?null:o,l=r.layout,u=l===void 0?null:l,d=r.offset,f=d===void 0?null:d,h=r.mouseHandlerCallback,p=h===void 0?null:h;this.coordinateList=(n=a??this.coordinateList)!==null&&n!==void 0?n:[],this.container=s??this.container,this.layout=u??this.layout,this.offset=f??this.offset,this.mouseHandlerCallback=p??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(r){if(this.coordinateList.length!==0)switch(r.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(r){this.activeIndex=r}},{key:"spoofMouse",value:function(){var r,n;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var i=this.container.getBoundingClientRect(),a=i.x,o=i.y,s=i.height,l=this.coordinateList[this.activeIndex].coordinate,u=((r=window)===null||r===void 0?void 0:r.scrollX)||0,d=((n=window)===null||n===void 0?void 0:n.scrollY)||0,f=a+l+u,h=o+this.offset.top+s/2+d;this.mouseHandlerCallback({pageX:f,pageY:h})}}}])})();function hee(t,e,r){if(r==="number"&&e===!0&&Array.isArray(t)){var n=t?.[0],i=t?.[1];if(n&&i&&ie(n)&&ie(i))return!0}return!1}function pee(t,e,r,n){var i=n/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-i:r.left+.5,y:t==="horizontal"?r.top+.5:e.y-i,width:t==="horizontal"?n:r.width-1,height:t==="horizontal"?r.height-1:n}}function CR(t){var e=t.cx,r=t.cy,n=t.radius,i=t.startAngle,a=t.endAngle,o=lt(e,r,n,i),s=lt(e,r,n,a);return{points:[o,s],cx:e,cy:r,radius:n,startAngle:i,endAngle:a}}function mee(t,e,r){var n,i,a,o;if(t==="horizontal")n=e.x,a=n,i=r.top,o=r.top+r.height;else if(t==="vertical")i=e.y,o=i,n=r.left,a=r.left+r.width;else if(e.cx!=null&&e.cy!=null)if(t==="centric"){var s=e.cx,l=e.cy,u=e.innerRadius,d=e.outerRadius,f=e.angle,h=lt(s,l,u,f),p=lt(s,l,d,f);n=h.x,i=h.y,a=p.x,o=p.y}else return CR(e);return[{x:n,y:i},{x:a,y:o}]}function hc(t){"@babel/helpers - typeof";return hc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hc(t)}function Ik(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function fu(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ik(Object(r),!0).forEach(function(n){gee(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ik(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function gee(t,e,r){return e=vee(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vee(t){var e=yee(t,"string");return hc(e)=="symbol"?e:e+""}function yee(t,e){if(hc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(hc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function xee(t){var e,r,n=t.element,i=t.tooltipEventType,a=t.isActive,o=t.activeCoordinate,s=t.activePayload,l=t.offset,u=t.activeTooltipIndex,d=t.tooltipAxisBandSize,f=t.layout,h=t.chartName,p=(e=n.props.cursor)!==null&&e!==void 0?e:(r=n.type.defaultProps)===null||r===void 0?void 0:r.cursor;if(!n||!p||!a||!o||h!=="ScatterChart"&&i!=="axis")return null;var m,g=Ad;if(h==="ScatterChart")m=o,g=zY;else if(h==="BarChart")m=pee(f,o,l,d),g=Rw;else if(f==="radial"){var v=CR(o),y=v.cx,w=v.cy,_=v.radius,j=v.startAngle,b=v.endAngle;m={cx:y,cy:w,startAngle:j,endAngle:b,innerRadius:_,outerRadius:_},g=kD}else m={points:mee(f,o,l)},g=Ad;var O=fu(fu(fu(fu({stroke:"#ccc",pointerEvents:"none"},l),m),_e(p,!1)),{},{payload:s,payloadIndex:u,className:Le("recharts-tooltip-cursor",p.className)});return x.isValidElement(p)?x.cloneElement(p,O):x.createElement(g,O)}var bee=["item"],wee=["children","className","width","height","style","compact","title","desc"];function Ss(t){"@babel/helpers - typeof";return Ss=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ss(t)}function Mo(){return Mo=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Mo.apply(this,arguments)}function $k(t,e){return jee(t)||See(t,e)||AR(t,e)||_ee()}function _ee(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 71In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function See(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}function jee(t){if(Array.isArray(t))return t}function Lk(t,e){if(t==null)return{};var r=Oee(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Oee(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function Nee(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Cee(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ER(n.key),n)}}function kee(t,e,r){return e&&Cee(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Aee(t,e,r){return e=Zd(e),Eee(t,kR()?Reflect.construct(e,r||[],Zd(t).constructor):e.apply(t,r))}function Eee(t,e){if(e&&(Ss(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Pee(t)}function Pee(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function kR(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kR=function(){return!!t})()}function Zd(t){return Zd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Zd(t)}function Tee(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pb(t,e)}function Pb(t,e){return Pb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Pb(t,e)}function js(t){return Ree(t)||Dee(t)||AR(t)||Mee()}function Mee(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 72In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function AR(t,e){if(t){if(typeof t=="string")return Tb(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Tb(t,e)}}function Dee(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Ree(t){if(Array.isArray(t))return Tb(t)}function Tb(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Bk(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function K(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Bk(Object(r),!0).forEach(function(n){Se(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Bk(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Se(t,e,r){return e=ER(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ER(t){var e=Iee(t,"string");return Ss(e)=="symbol"?e:e+""}function Iee(t,e){if(Ss(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Ss(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var $ee={xAxis:["bottom","top"],yAxis:["left","right"]},Lee={width:"100%",height:"100%"},PR={x:0,y:0};function hu(t){return t}var Bee=function(e,r){return r==="horizontal"?e.x:r==="vertical"?e.y:r==="centric"?e.angle:e.radius},Fee=function(e,r,n,i){var a=r.find(function(d){return d&&d.index===n});if(a){if(e==="horizontal")return{x:a.coordinate,y:i.y};if(e==="vertical")return{x:i.x,y:a.coordinate};if(e==="centric"){var o=a.coordinate,s=i.radius;return K(K(K({},i),lt(i.cx,i.cy,s,o)),{},{angle:o,radius:s})}var l=a.coordinate,u=i.angle;return K(K(K({},i),lt(i.cx,i.cy,l,u)),{},{angle:u,radius:l})}return PR},Bh=function(e,r){var n=r.graphicalItems,i=r.dataStartIndex,a=r.dataEndIndex,o=(n??[]).reduce(function(s,l){var u=l.props.data;return u&&u.length?[].concat(js(s),js(u)):s},[]);return o.length>0?o:e&&e.length&&ie(i)&&ie(a)?e.slice(i,a+1):[]};function TR(t){return t==="number"?[0,"auto"]:void 0}var Mb=function(e,r,n,i){var a=e.graphicalItems,o=e.tooltipAxis,s=Bh(r,e);return n<0||!a||!a.length||n>=s.length?null:a.reduce(function(l,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:r;f&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(f=f.slice(e.dataStartIndex,e.dataEndIndex+1));var h;if(o.dataKey&&!o.allowDuplicatedCategory){var p=f===void 0?s:f;h=td(p,o.dataKey,i)}else h=f&&f[n]||s[n];return h?[].concat(js(l),[_D(u,h)]):l},[])},Fk=function(e,r,n,i){var a=i||{x:e.chartX,y:e.chartY},o=Bee(a,n),s=e.orderedTooltipTicks,l=e.tooltipAxis,u=e.tooltipTicks,d=g7(o,s,u,l);if(d>=0&&u){var f=u[d]&&u[d].value,h=Mb(e,r,d,f),p=Fee(n,s,d,a);return{activeTooltipIndex:d,activeLabel:f,activePayload:h,activeCoordinate:p}}return null},zee=function(e,r){var n=r.axes,i=r.graphicalItems,a=r.axisType,o=r.axisIdKey,s=r.stackGroups,l=r.dataStartIndex,u=r.dataEndIndex,d=e.layout,f=e.children,h=e.stackOffset,p=gD(d,a);return n.reduce(function(m,g){var v,y=g.type.defaultProps!==void 0?K(K({},g.type.defaultProps),g.props):g.props,w=y.type,_=y.dataKey,j=y.allowDataOverflow,b=y.allowDuplicatedCategory,O=y.scale,S=y.ticks,N=y.includeHidden,C=y[o];if(m[C])return m;var T=Bh(e.data,{graphicalItems:i.filter(function(B){var G,se=o in B.props?B.props[o]:(G=B.type.defaultProps)===null||G===void 0?void 0:G[o];return se===C}),dataStartIndex:l,dataEndIndex:u}),k=T.length,M,E,L;hee(y.domain,j,w)&&(M=Vx(y.domain,null,j),p&&(w==="number"||O!=="auto")&&(L=ml(T,_,"category")));var R=TR(w);if(!M||M.length===0){var I,$=(I=y.domain)!==null&&I!==void 0?I:R;if(_){if(M=ml(T,_,w),w==="category"&&p){var A=cq(M);b&&A?(E=M,M=Bd(0,k)):b||(M=qN($,M,g).reduce(function(B,G){return B.indexOf(G)>=0?B:[].concat(js(B),[G])},[]))}else if(w==="category")b?M=M.filter(function(B){return B!==""&&!Me(B)}):M=qN($,M,g).reduce(function(B,G){return B.indexOf(G)>=0||G===""||Me(G)?B:[].concat(js(B),[G])},[]);else if(w==="number"){var F=w7(T,i.filter(function(B){var G,se,Q=o in B.props?B.props[o]:(G=B.type.defaultProps)===null||G===void 0?void 0:G[o],ye="hide"in B.props?B.props.hide:(se=B.type.defaultProps)===null||se===void 0?void 0:se.hide;return Q===C&&(N||!ye)}),_,a,d);F&&(M=F)}p&&(w==="number"||O!=="auto")&&(L=ml(T,_,"category"))}else p?M=Bd(0,k):s&&s[C]&&s[C].hasStack&&w==="number"?M=h==="expand"?[0,1]:wD(s[C].stackGroups,l,u):M=mD(T,i.filter(function(B){var G=o in B.props?B.props[o]:B.type.defaultProps[o],se="hide"in B.props?B.props.hide:B.type.defaultProps.hide;return G===C&&(N||!se)}),w,d,!0);if(w==="number")M=Eb(f,M,C,a,S),$&&(M=Vx($,M,j));else if(w==="category"&&$){var V=$,te=M.every(function(B){return V.indexOf(B)>=0});te&&(M=V)}}return K(K({},m),{},Se({},C,K(K({},y),{},{axisType:a,domain:M,categoricalDomain:L,duplicateDomain:E,originalDomain:(v=y.domain)!==null&&v!==void 0?v:R,isCategorical:p,layout:d})))},{})},qee=function(e,r){var n=r.graphicalItems,i=r.Axis,a=r.axisType,o=r.axisIdKey,s=r.stackGroups,l=r.dataStartIndex,u=r.dataEndIndex,d=e.layout,f=e.children,h=Bh(e.data,{graphicalItems:n,dataStartIndex:l,dataEndIndex:u}),p=h.length,m=gD(d,a),g=-1;return n.reduce(function(v,y){var w=y.type.defaultProps!==void 0?K(K({},y.type.defaultProps),y.props):y.props,_=w[o],j=TR("number");if(!v[_]){g++;var b;return m?b=Bd(0,p):s&&s[_]&&s[_].hasStack?(b=wD(s[_].stackGroups,l,u),b=Eb(f,b,_,a)):(b=Vx(j,mD(h,n.filter(function(O){var S,N,C=o in O.props?O.props[o]:(S=O.type.defaultProps)===null||S===void 0?void 0:S[o],T="hide"in O.props?O.props.hide:(N=O.type.defaultProps)===null||N===void 0?void 0:N.hide;return C===_&&!T}),"number",d),i.defaultProps.allowDataOverflow),b=Eb(f,b,_,a)),K(K({},v),{},Se({},_,K(K({axisType:a},i.defaultProps),{},{hide:!0,orientation:Ur($ee,"".concat(a,".").concat(g%2),null),domain:b,originalDomain:j,isCategorical:m,layout:d})))}return v},{})},Uee=function(e,r){var n=r.axisType,i=n===void 0?"xAxis":n,a=r.AxisComp,o=r.graphicalItems,s=r.stackGroups,l=r.dataStartIndex,u=r.dataEndIndex,d=e.children,f="".concat(i,"Id"),h=Hr(d,a),p={};return h&&h.length?p=zee(e,{axes:h,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:s,dataStartIndex:l,dataEndIndex:u}):o&&o.length&&(p=qee(e,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:s,dataStartIndex:l,dataEndIndex:u})),p},Hee=function(e){var r=$i(e),n=di(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:lw(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:Nd(r,n)}},zk=function(e){var r=e.children,n=e.defaultShowTooltip,i=Lr(r,ds),a=0,o=0;return e.data&&e.data.length!==0&&(o=e.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(a=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!n}},Wee=function(e){return!e||!e.length?!1:e.some(function(r){var n=hi(r&&r.type);return n&&n.indexOf("Bar")>=0})},qk=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Vee=function(e,r){var n=e.props,i=e.graphicalItems,a=e.xAxisMap,o=a===void 0?{}:a,s=e.yAxisMap,l=s===void 0?{}:s,u=n.width,d=n.height,f=n.children,h=n.margin||{},p=Lr(f,ds),m=Lr(f,Da),g=Object.keys(l).reduce(function(b,O){var S=l[O],N=S.orientation;return!S.mirror&&!S.hide?K(K({},b),{},Se({},N,b[N]+S.width)):b},{left:h.left||0,right:h.right||0}),v=Object.keys(o).reduce(function(b,O){var S=o[O],N=S.orientation;return!S.mirror&&!S.hide?K(K({},b),{},Se({},N,Ur(b,"".concat(N))+S.height)):b},{top:h.top||0,bottom:h.bottom||0}),y=K(K({},v),g),w=y.bottom;p&&(y.bottom+=p.props.height||ds.defaultProps.height),m&&r&&(y=x7(y,i,n,r));var _=u-y.left-y.right,j=d-y.top-y.bottom;return K(K({brushBottom:w},y),{},{width:Math.max(_,0),height:Math.max(j,0)})},Kee=function(e,r){if(r==="xAxis")return e[r].width;if(r==="yAxis")return e[r].height},Ww=function(e){var r=e.chartName,n=e.GraphicalChild,i=e.defaultTooltipEventType,a=i===void 0?"axis":i,o=e.validateTooltipEventTypes,s=o===void 0?["axis"]:o,l=e.axisComponents,u=e.legendContent,d=e.formatAxisMap,f=e.defaultProps,h=function(y,w){var _=w.graphicalItems,j=w.stackGroups,b=w.offset,O=w.updateId,S=w.dataStartIndex,N=w.dataEndIndex,C=y.barSize,T=y.layout,k=y.barGap,M=y.barCategoryGap,E=y.maxBarSize,L=qk(T),R=L.numericAxisName,I=L.cateAxisName,$=Wee(_),A=[];return _.forEach(function(F,V){var te=Bh(y.data,{graphicalItems:[F],dataStartIndex:S,dataEndIndex:N}),B=F.type.defaultProps!==void 0?K(K({},F.type.defaultProps),F.props):F.props,G=B.dataKey,se=B.maxBarSize,Q=B["".concat(R,"Id")],ye=B["".concat(I,"Id")],re={},ue=l.reduce(function(pt,mr){var gr=w["".concat(mr.axisType,"Map")],Kr=B["".concat(mr.axisType,"Id")];gr&&gr[Kr]||mr.axisType==="zAxis"||Xa();var Ct=gr[Kr];return K(K({},pt),{},Se(Se({},mr.axisType,Ct),"".concat(mr.axisType,"Ticks"),di(Ct)))},re),Y=ue[I],z=ue["".concat(I,"Ticks")],X=j&&j[Q]&&j[Q].hasStack&&E7(F,j[Q].stackGroups),U=hi(F.type).indexOf("Bar")>=0,me=Nd(Y,z),ge=[],Ee=$&&v7({barSize:C,stackGroups:j,totalSize:Kee(ue,I)});if(U){var We,qe,ar=Me(se)?E:se,Zt=(We=(qe=Nd(Y,z,!0))!==null&&qe!==void 0?qe:ar)!==null&&We!==void 0?We:0;ge=y7({barGap:k,barCategoryGap:M,bandSize:Zt!==me?Zt:me,sizeList:Ee[ye],maxBarSize:ar}),Zt!==me&&(ge=ge.map(function(pt){return K(K({},pt),{},{position:K(K({},pt.position),{},{offset:pt.position.offset-Zt/2})})}))}var Rr=F&&F.type&&F.type.getComposedData;Rr&&A.push({props:K(K({},Rr(K(K({},ue),{},{displayedData:te,props:y,dataKey:G,item:F,bandSize:me,barPosition:ge,offset:b,stackedData:X,layout:T,dataStartIndex:S,dataEndIndex:N}))),{},Se(Se(Se({key:F.key||"item-".concat(V)},R,ue[R]),I,ue[I]),"animationId",O)),childIndex:_q(F,y.children),item:F})}),A},p=function(y,w){var _=y.props,j=y.dataStartIndex,b=y.dataEndIndex,O=y.updateId;if(!rS({props:_}))return null;var S=_.children,N=_.layout,C=_.stackOffset,T=_.data,k=_.reverseStackOrder,M=qk(N),E=M.numericAxisName,L=M.cateAxisName,R=Hr(S,n),I=k7(T,R,"".concat(E,"Id"),"".concat(L,"Id"),C,k),$=l.reduce(function(B,G){var se="".concat(G.axisType,"Map");return K(K({},B),{},Se({},se,Uee(_,K(K({},G),{},{graphicalItems:R,stackGroups:G.axisType===E&&I,dataStartIndex:j,dataEndIndex:b}))))},{}),A=Vee(K(K({},$),{},{props:_,graphicalItems:R}),w?.legendBBox);Object.keys($).forEach(function(B){$[B]=d(_,$[B],A,B.replace("Map",""),r)});var F=$["".concat(L,"Map")],V=Hee(F),te=h(_,K(K({},$),{},{dataStartIndex:j,dataEndIndex:b,updateId:O,graphicalItems:R,stackGroups:I,offset:A}));return K(K({formattedGraphicalItems:te,graphicalItems:R,offset:A,stackGroups:I},V),$)},m=(function(v){function y(w){var _,j,b;return Nee(this,y),b=Aee(this,y,[w]),Se(b,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Se(b,"accessibilityManager",new fee),Se(b,"handleLegendBBoxUpdate",function(O){if(O){var S=b.state,N=S.dataStartIndex,C=S.dataEndIndex,T=S.updateId;b.setState(K({legendBBox:O},p({props:b.props,dataStartIndex:N,dataEndIndex:C,updateId:T},K(K({},b.state),{},{legendBBox:O}))))}}),Se(b,"handleReceiveSyncEvent",function(O,S,N){if(b.props.syncId===O){if(N===b.eventEmitterSymbol&&typeof b.props.syncMethod!="function")return;b.applySyncEvent(S)}}),Se(b,"handleBrushChange",function(O){var S=O.startIndex,N=O.endIndex;if(S!==b.state.dataStartIndex||N!==b.state.dataEndIndex){var C=b.state.updateId;b.setState(function(){return K({dataStartIndex:S,dataEndIndex:N},p({props:b.props,dataStartIndex:S,dataEndIndex:N,updateId:C},b.state))}),b.triggerSyncEvent({dataStartIndex:S,dataEndIndex:N})}}),Se(b,"handleMouseEnter",function(O){var S=b.getMouseInfo(O);if(S){var N=K(K({},S),{},{isTooltipActive:!0});b.setState(N),b.triggerSyncEvent(N);var C=b.props.onMouseEnter;ke(C)&&C(N,O)}}),Se(b,"triggeredAfterMouseMove",function(O){var S=b.getMouseInfo(O),N=S?K(K({},S),{},{isTooltipActive:!0}):{isTooltipActive:!1};b.setState(N),b.triggerSyncEvent(N);var C=b.props.onMouseMove;ke(C)&&C(N,O)}),Se(b,"handleItemMouseEnter",function(O){b.setState(function(){return{isTooltipActive:!0,activeItem:O,activePayload:O.tooltipPayload,activeCoordinate:O.tooltipPosition||{x:O.cx,y:O.cy}}})}),Se(b,"handleItemMouseLeave",function(){b.setState(function(){return{isTooltipActive:!1}})}),Se(b,"handleMouseMove",function(O){O.persist(),b.throttleTriggeredAfterMouseMove(O)}),Se(b,"handleMouseLeave",function(O){b.throttleTriggeredAfterMouseMove.cancel();var S={isTooltipActive:!1};b.setState(S),b.triggerSyncEvent(S);var N=b.props.onMouseLeave;ke(N)&&N(S,O)}),Se(b,"handleOuterEvent",function(O){var S=wq(O),N=Ur(b.props,"".concat(S));if(S&&ke(N)){var C,T;/.*touch.*/i.test(S)?T=b.getMouseInfo(O.changedTouches[0]):T=b.getMouseInfo(O),N((C=T)!==null&&C!==void 0?C:{},O)}}),Se(b,"handleClick",function(O){var S=b.getMouseInfo(O);if(S){var N=K(K({},S),{},{isTooltipActive:!0});b.setState(N),b.triggerSyncEvent(N);var C=b.props.onClick;ke(C)&&C(N,O)}}),Se(b,"handleMouseDown",function(O){var S=b.props.onMouseDown;if(ke(S)){var N=b.getMouseInfo(O);S(N,O)}}),Se(b,"handleMouseUp",function(O){var S=b.props.onMouseUp;if(ke(S)){var N=b.getMouseInfo(O);S(N,O)}}),Se(b,"handleTouchMove",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&b.throttleTriggeredAfterMouseMove(O.changedTouches[0])}),Se(b,"handleTouchStart",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&b.handleMouseDown(O.changedTouches[0])}),Se(b,"handleTouchEnd",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&b.handleMouseUp(O.changedTouches[0])}),Se(b,"handleDoubleClick",function(O){var S=b.props.onDoubleClick;if(ke(S)){var N=b.getMouseInfo(O);S(N,O)}}),Se(b,"handleContextMenu",function(O){var S=b.props.onContextMenu;if(ke(S)){var N=b.getMouseInfo(O);S(N,O)}}),Se(b,"triggerSyncEvent",function(O){b.props.syncId!==void 0&&xy.emit(by,b.props.syncId,O,b.eventEmitterSymbol)}),Se(b,"applySyncEvent",function(O){var S=b.props,N=S.layout,C=S.syncMethod,T=b.state.updateId,k=O.dataStartIndex,M=O.dataEndIndex;if(O.dataStartIndex!==void 0||O.dataEndIndex!==void 0)b.setState(K({dataStartIndex:k,dataEndIndex:M},p({props:b.props,dataStartIndex:k,dataEndIndex:M,updateId:T},b.state)));else if(O.activeTooltipIndex!==void 0){var E=O.chartX,L=O.chartY,R=O.activeTooltipIndex,I=b.state,$=I.offset,A=I.tooltipTicks;if(!$)return;if(typeof C=="function")R=C(A,O);else if(C==="value"){R=-1;for(var F=0;F<A.length;F++)if(A[F].value===O.activeLabel){R=F;break}}var V=K(K({},$),{},{x:$.left,y:$.top}),te=Math.min(E,V.x+V.width),B=Math.min(L,V.y+V.height),G=A[R]&&A[R].value,se=Mb(b.state,b.props.data,R),Q=A[R]?{x:N==="horizontal"?A[R].coordinate:te,y:N==="horizontal"?B:A[R].coordinate}:PR;b.setState(K(K({},O),{},{activeLabel:G,activeCoordinate:Q,activePayload:se,activeTooltipIndex:R}))}else b.setState(O)}),Se(b,"renderCursor",function(O){var S,N=b.state,C=N.isTooltipActive,T=N.activeCoordinate,k=N.activePayload,M=N.offset,E=N.activeTooltipIndex,L=N.tooltipAxisBandSize,R=b.getTooltipEventType(),I=(S=O.props.active)!==null&&S!==void 0?S:C,$=b.props.layout,A=O.key||"_recharts-cursor";return D.createElement(xee,{key:A,activeCoordinate:T,activePayload:k,activeTooltipIndex:E,chartName:r,element:O,isActive:I,layout:$,offset:M,tooltipAxisBandSize:L,tooltipEventType:R})}),Se(b,"renderPolarAxis",function(O,S,N){var C=Ur(O,"type.axisType"),T=Ur(b.state,"".concat(C,"Map")),k=O.type.defaultProps,M=k!==void 0?K(K({},k),O.props):O.props,E=T&&T[M["".concat(C,"Id")]];return x.cloneElement(O,K(K({},E),{},{className:Le(C,E.className),key:O.key||"".concat(S,"-").concat(N),ticks:di(E,!0)}))}),Se(b,"renderPolarGrid",function(O){var S=O.props,N=S.radialLines,C=S.polarAngles,T=S.polarRadius,k=b.state,M=k.radiusAxisMap,E=k.angleAxisMap,L=$i(M),R=$i(E),I=R.cx,$=R.cy,A=R.innerRadius,F=R.outerRadius;return x.cloneElement(O,{polarAngles:Array.isArray(C)?C:di(R,!0).map(function(V){return V.coordinate}),polarRadius:Array.isArray(T)?T:di(L,!0).map(function(V){return V.coordinate}),cx:I,cy:$,innerRadius:A,outerRadius:F,key:O.key||"polar-grid",radialLines:N})}),Se(b,"renderLegend",function(){var O=b.state.formattedGraphicalItems,S=b.props,N=S.children,C=S.width,T=S.height,k=b.props.margin||{},M=C-(k.left||0)-(k.right||0),E=hD({children:N,formattedGraphicalItems:O,legendWidth:M,legendContent:u});if(!E)return null;var L=E.item,R=Lk(E,bee);return x.cloneElement(L,K(K({},R),{},{chartWidth:C,chartHeight:T,margin:k,onBBoxUpdate:b.handleLegendBBoxUpdate}))}),Se(b,"renderTooltip",function(){var O,S=b.props,N=S.children,C=S.accessibilityLayer,T=Lr(N,en);if(!T)return null;var k=b.state,M=k.isTooltipActive,E=k.activeCoordinate,L=k.activePayload,R=k.activeLabel,I=k.offset,$=(O=T.props.active)!==null&&O!==void 0?O:M;return x.cloneElement(T,{viewBox:K(K({},I),{},{x:I.left,y:I.top}),active:$,label:R,payload:$?L:[],coordinate:E,accessibilityLayer:C})}),Se(b,"renderBrush",function(O){var S=b.props,N=S.margin,C=S.data,T=b.state,k=T.offset,M=T.dataStartIndex,E=T.dataEndIndex,L=T.updateId;return x.cloneElement(O,{key:O.key||"_recharts-brush",onChange:lu(b.handleBrushChange,O.props.onChange),data:C,x:ie(O.props.x)?O.props.x:k.left,y:ie(O.props.y)?O.props.y:k.top+k.height+k.brushBottom-(N.bottom||0),width:ie(O.props.width)?O.props.width:k.width,startIndex:M,endIndex:E,updateId:"brush-".concat(L)})}),Se(b,"renderReferenceElement",function(O,S,N){if(!O)return null;var C=b,T=C.clipPathId,k=b.state,M=k.xAxisMap,E=k.yAxisMap,L=k.offset,R=O.type.defaultProps||{},I=O.props,$=I.xAxisId,A=$===void 0?R.xAxisId:$,F=I.yAxisId,V=F===void 0?R.yAxisId:F;return x.cloneElement(O,{key:O.key||"".concat(S,"-").concat(N),xAxis:M[A],yAxis:E[V],viewBox:{x:L.left,y:L.top,width:L.width,height:L.height},clipPathId:T})}),Se(b,"renderActivePoints",function(O){var S=O.item,N=O.activePoint,C=O.basePoint,T=O.childIndex,k=O.isRange,M=[],E=S.props.key,L=S.item.type.defaultProps!==void 0?K(K({},S.item.type.defaultProps),S.item.props):S.item.props,R=L.activeDot,I=L.dataKey,$=K(K({index:T,dataKey:I,cx:N.x,cy:N.y,r:4,fill:Dw(S.item),strokeWidth:2,stroke:"#fff",payload:N.payload,value:N.value},_e(R,!1)),rd(R));return M.push(y.renderActiveDot(R,$,"".concat(E,"-activePoint-").concat(T))),C?M.push(y.renderActiveDot(R,K(K({},$),{},{cx:C.x,cy:C.y}),"".concat(E,"-basePoint-").concat(T))):k&&M.push(null),M}),Se(b,"renderGraphicChild",function(O,S,N){var C=b.filterFormatItem(O,S,N);if(!C)return null;var T=b.getTooltipEventType(),k=b.state,M=k.isTooltipActive,E=k.tooltipAxis,L=k.activeTooltipIndex,R=k.activeLabel,I=b.props.children,$=Lr(I,en),A=C.props,F=A.points,V=A.isRange,te=A.baseLine,B=C.item.type.defaultProps!==void 0?K(K({},C.item.type.defaultProps),C.item.props):C.item.props,G=B.activeDot,se=B.hide,Q=B.activeBar,ye=B.activeShape,re=!!(!se&&M&&$&&(G||Q||ye)),ue={};T!=="axis"&&$&&$.props.trigger==="click"?ue={onClick:lu(b.handleItemMouseEnter,O.props.onClick)}:T!=="axis"&&(ue={onMouseLeave:lu(b.handleItemMouseLeave,O.props.onMouseLeave),onMouseEnter:lu(b.handleItemMouseEnter,O.props.onMouseEnter)});var Y=x.cloneElement(O,K(K({},C.props),ue));function z(mr){return typeof E.dataKey=="function"?E.dataKey(mr.payload):null}if(re)if(L>=0){var X,U;if(E.dataKey&&!E.allowDuplicatedCategory){var me=typeof E.dataKey=="function"?z:"payload.".concat(E.dataKey.toString());X=td(F,me,R),U=V&&te&&td(te,me,R)}else X=F?.[L],U=V&&te&&te[L];if(ye||Q){var ge=O.props.activeIndex!==void 0?O.props.activeIndex:L;return[x.cloneElement(O,K(K(K({},C.props),ue),{},{activeIndex:ge})),null,null]}if(!Me(X))return[Y].concat(js(b.renderActivePoints({item:C,activePoint:X,basePoint:U,childIndex:L,isRange:V})))}else{var Ee,We=(Ee=b.getItemByXY(b.state.activeCoordinate))!==null&&Ee!==void 0?Ee:{graphicalItem:Y},qe=We.graphicalItem,ar=qe.item,Zt=ar===void 0?O:ar,Rr=qe.childIndex,pt=K(K(K({},C.props),ue),{},{activeIndex:Rr});return[x.cloneElement(Zt,pt),null,null]}return V?[Y,null,null]:[Y,null]}),Se(b,"renderCustomized",function(O,S,N){return x.cloneElement(O,K(K({key:"recharts-customized-".concat(N)},b.props),b.state))}),Se(b,"renderMap",{CartesianGrid:{handler:hu,once:!0},ReferenceArea:{handler:b.renderReferenceElement},ReferenceLine:{handler:hu},ReferenceDot:{handler:b.renderReferenceElement},XAxis:{handler:hu},YAxis:{handler:hu},Brush:{handler:b.renderBrush,once:!0},Bar:{handler:b.renderGraphicChild},Line:{handler:b.renderGraphicChild},Area:{handler:b.renderGraphicChild},Radar:{handler:b.renderGraphicChild},RadialBar:{handler:b.renderGraphicChild},Scatter:{handler:b.renderGraphicChild},Pie:{handler:b.renderGraphicChild},Funnel:{handler:b.renderGraphicChild},Tooltip:{handler:b.renderCursor,once:!0},PolarGrid:{handler:b.renderPolarGrid,once:!0},PolarAngleAxis:{handler:b.renderPolarAxis},PolarRadiusAxis:{handler:b.renderPolarAxis},Customized:{handler:b.renderCustomized}}),b.clipPathId="".concat((_=w.id)!==null&&_!==void 0?_:Rs("recharts"),"-clip"),b.throttleTriggeredAfterMouseMove=f2(b.triggeredAfterMouseMove,(j=w.throttleDelay)!==null&&j!==void 0?j:1e3/60),b.state={},b}return Tee(y,v),kee(y,[{key:"componentDidMount",value:function(){var _,j;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(_=this.props.margin.left)!==null&&_!==void 0?_:0,top:(j=this.props.margin.top)!==null&&j!==void 0?j:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var _=this.props,j=_.children,b=_.data,O=_.height,S=_.layout,N=Lr(j,en);if(N){var C=N.props.defaultIndex;if(!(typeof C!="number"||C<0||C>this.state.tooltipTicks.length-1)){var T=this.state.tooltipTicks[C]&&this.state.tooltipTicks[C].value,k=Mb(this.state,b,C,T),M=this.state.tooltipTicks[C].coordinate,E=(this.state.offset.top+O)/2,L=S==="horizontal",R=L?{x:M,y:E}:{y:M,x:E},I=this.state.formattedGraphicalItems.find(function(A){var F=A.item;return F.type.name==="Scatter"});I&&(R=K(K({},R),I.props.points[C].tooltipPosition),k=I.props.points[C].tooltipPayload);var $={activeTooltipIndex:C,isTooltipActive:!0,activeLabel:T,activePayload:k,activeCoordinate:R};this.setState($),this.renderCursor(N),this.accessibilityManager.setIndex(C)}}}},{key:"getSnapshotBeforeUpdate",value:function(_,j){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==j.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==_.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==_.margin){var b,O;this.accessibilityManager.setDetails({offset:{left:(b=this.props.margin.left)!==null&&b!==void 0?b:0,top:(O=this.props.margin.top)!==null&&O!==void 0?O:0}})}return null}},{key:"componentDidUpdate",value:function(_){px([Lr(_.children,en)],[Lr(this.props.children,en)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var _=Lr(this.props.children,en);if(_&&typeof _.props.shared=="boolean"){var j=_.props.shared?"axis":"item";return s.indexOf(j)>=0?j:a}return a}},{key:"getMouseInfo",value:function(_){if(!this.container)return null;var j=this.container,b=j.getBoundingClientRect(),O=l8(b),S={chartX:Math.round(_.pageX-O.left),chartY:Math.round(_.pageY-O.top)},N=b.width/j.offsetWidth||1,C=this.inRange(S.chartX,S.chartY,N);if(!C)return null;var T=this.state,k=T.xAxisMap,M=T.yAxisMap,E=this.getTooltipEventType(),L=Fk(this.state,this.props.data,this.props.layout,C);if(E!=="axis"&&k&&M){var R=$i(k).scale,I=$i(M).scale,$=R&&R.invert?R.invert(S.chartX):null,A=I&&I.invert?I.invert(S.chartY):null;return K(K({},S),{},{xValue:$,yValue:A},L)}return L?K(K({},S),L):null}},{key:"inRange",value:function(_,j){var b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,O=this.props.layout,S=_/b,N=j/b;if(O==="horizontal"||O==="vertical"){var C=this.state.offset,T=S>=C.left&&S<=C.left+C.width&&N>=C.top&&N<=C.top+C.height;return T?{x:S,y:N}:null}var k=this.state,M=k.angleAxisMap,E=k.radiusAxisMap;if(M&&E){var L=$i(M);return WN({x:S,y:N},L)}return null}},{key:"parseEventsOfWrapper",value:function(){var _=this.props.children,j=this.getTooltipEventType(),b=Lr(_,en),O={};b&&j==="axis"&&(b.props.trigger==="click"?O={onClick:this.handleClick}:O={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var S=rd(this.props,this.handleOuterEvent);return K(K({},S),O)}},{key:"addListener",value:function(){xy.on(by,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){xy.removeListener(by,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(_,j,b){for(var O=this.state.formattedGraphicalItems,S=0,N=O.length;S<N;S++){var C=O[S];if(C.item===_||C.props.key===_.key||j===hi(C.item.type)&&b===C.childIndex)return C}return null}},{key:"renderClipPath",value:function(){var _=this.clipPathId,j=this.state.offset,b=j.left,O=j.top,S=j.height,N=j.width;return D.createElement("defs",null,D.createElement("clipPath",{id:_},D.createElement("rect",{x:b,y:O,height:S,width:N})))}},{key:"getXScales",value:function(){var _=this.state.xAxisMap;return _?Object.entries(_).reduce(function(j,b){var O=$k(b,2),S=O[0],N=O[1];return K(K({},j),{},Se({},S,N.scale))},{}):null}},{key:"getYScales",value:function(){var _=this.state.yAxisMap;return _?Object.entries(_).reduce(function(j,b){var O=$k(b,2),S=O[0],N=O[1];return K(K({},j),{},Se({},S,N.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(_){var j;return(j=this.state.xAxisMap)===null||j===void 0||(j=j[_])===null||j===void 0?void 0:j.scale}},{key:"getYScaleByAxisId",value:function(_){var j;return(j=this.state.yAxisMap)===null||j===void 0||(j=j[_])===null||j===void 0?void 0:j.scale}},{key:"getItemByXY",value:function(_){var j=this.state,b=j.formattedGraphicalItems,O=j.activeItem;if(b&&b.length)for(var S=0,N=b.length;S<N;S++){var C=b[S],T=C.props,k=C.item,M=k.type.defaultProps!==void 0?K(K({},k.type.defaultProps),k.props):k.props,E=hi(k.type);if(E==="Bar"){var L=(T.data||[]).find(function(A){return wY(_,A)});if(L)return{graphicalItem:C,payload:L}}else if(E==="RadialBar"){var R=(T.data||[]).find(function(A){return WN(_,A)});if(R)return{graphicalItem:C,payload:R}}else if(Th(C,O)||Mh(C,O)||sc(C,O)){var I=HX({graphicalItem:C,activeTooltipItem:O,itemData:M.data}),$=M.activeIndex===void 0?I:M.activeIndex;return{graphicalItem:K(K({},C),{},{childIndex:$}),payload:sc(C,O)?M.data[I]:C.props.data[I]}}}return null}},{key:"render",value:function(){var _=this;if(!rS(this))return null;var j=this.props,b=j.children,O=j.className,S=j.width,N=j.height,C=j.style,T=j.compact,k=j.title,M=j.desc,E=Lk(j,wee),L=_e(E,!1);if(T)return D.createElement(yk,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},D.createElement(gx,Mo({},L,{width:S,height:N,title:k,desc:M}),this.renderClipPath(),iS(b,this.renderMap)));if(this.props.accessibilityLayer){var R,I;L.tabIndex=(R=this.props.tabIndex)!==null&&R!==void 0?R:0,L.role=(I=this.props.role)!==null&&I!==void 0?I:"application",L.onKeyDown=function(A){_.accessibilityManager.keyboardEvent(A)},L.onFocus=function(){_.accessibilityManager.focus()}}var $=this.parseEventsOfWrapper();return D.createElement(yk,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},D.createElement("div",Mo({className:Le("recharts-wrapper",O),style:K({position:"relative",cursor:"default",width:S,height:N},C)},$,{ref:function(F){_.container=F}}),D.createElement(gx,Mo({},L,{width:S,height:N,title:k,desc:M,style:Lee}),this.renderClipPath(),iS(b,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(x.Component);Se(m,"displayName",r),Se(m,"defaultProps",K({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),Se(m,"getDerivedStateFromProps",function(v,y){var w=v.dataKey,_=v.data,j=v.children,b=v.width,O=v.height,S=v.layout,N=v.stackOffset,C=v.margin,T=y.dataStartIndex,k=y.dataEndIndex;if(y.updateId===void 0){var M=zk(v);return K(K(K({},M),{},{updateId:0},p(K(K({props:v},M),{},{updateId:0}),y)),{},{prevDataKey:w,prevData:_,prevWidth:b,prevHeight:O,prevLayout:S,prevStackOffset:N,prevMargin:C,prevChildren:j})}if(w!==y.prevDataKey||_!==y.prevData||b!==y.prevWidth||O!==y.prevHeight||S!==y.prevLayout||N!==y.prevStackOffset||!$o(C,y.prevMargin)){var E=zk(v),L={chartX:y.chartX,chartY:y.chartY,isTooltipActive:y.isTooltipActive},R=K(K({},Fk(y,_,S)),{},{updateId:y.updateId+1}),I=K(K(K({},E),L),R);return K(K(K({},I),p(K({props:v},I),y)),{},{prevDataKey:w,prevData:_,prevWidth:b,prevHeight:O,prevLayout:S,prevStackOffset:N,prevMargin:C,prevChildren:j})}if(!px(j,y.prevChildren)){var $,A,F,V,te=Lr(j,ds),B=te&&($=(A=te.props)===null||A===void 0?void 0:A.startIndex)!==null&&$!==void 0?$:T,G=te&&(F=(V=te.props)===null||V===void 0?void 0:V.endIndex)!==null&&F!==void 0?F:k,se=B!==T||G!==k,Q=!Me(_),ye=Q&&!se?y.updateId:y.updateId+1;return K(K({updateId:ye},p(K(K({props:v},y),{},{updateId:ye,dataStartIndex:B,dataEndIndex:G}),y)),{},{prevChildren:j,dataStartIndex:B,dataEndIndex:G})}return null}),Se(m,"renderActiveDot",function(v,y,w){var _;return x.isValidElement(v)?_=x.cloneElement(v,y):ke(v)?_=v(y):_=D.createElement(Ch,y),D.createElement(Ke,{className:"recharts-active-dot",ke
72y:w},_)});var g=x.forwardRef(function(y,w){return D.createElement(m,Mo({},y,{ref:w}))});return g.displayName=m.displayName,g},Gee=Ww({chartName:"LineChart",GraphicalChild:ys,axisComponents:[{axisType:"xAxis",AxisComp:bs},{axisType:"yAxis",AxisComp:_s}],formatAxisMap:ZD}),Yee=Ww({chartName:"BarChart",GraphicalChild:gi,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:bs},{axisType:"yAxis",AxisComp:_s}],formatAxisMap:ZD}),Xee=Ww({chartName:"PieChart",GraphicalChild:ki,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:Ph},{axisType:"radiusAxis",AxisComp:Ah}],formatAxisMap:F7,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const Jee=()=>{const[t,e]=x.useState(!0),[r,n]=x.useState(null),[i,a]=x.useState([]),[o,s]=x.useState([]);x.useEffect(()=>{l();const d=Z.channel("order-analytics-changes").on("postgres_changes",{event:"*",schema:"public",table:"orders"},()=>{l()}).subscribe();return()=>{Z.removeChannel(d)}},[]);const l=async()=>{try{const{data:d,error:f}=await Z.from("orders").select("id, status, created_at, signed_at, final_monthly_price, currency, units, annual_billing").order("created_at",{ascending:!0});if(f)throw f;if(!d||d.length===0){e(!1);return}const h=d.filter(I=>I.status==="signed"),p=d.filter(I=>I.status==="rejected"),m=d.filter(I=>I.status==="draft"||I.status==="pending"||I.status==="sent"),g=h.filter(I=>I.signed_at).map(I=>VB(new Date(I.signed_at),new Date(I.created_at))),v=g.length>0?Math.round(g.reduce((I,$)=>I+$,0)/g.length):0,y=h.length+p.length,w=y>0?Math.round(h.length/y*100):0,_=h.reduce((I,$)=>I+Number($.final_monthly_price),0),j=h.length>0?Math.round(_/h.length):0,b={},O=new Date;for(let I=5;I>=0;I--){const $=I1(O,I),A=Ue(cr($),"yyyy-MM");b[A]={month:Ue($,"MMM yyyy"),signed:0,rejected:0,pending:0,revenue:0}}d.forEach(I=>{const $=new Date(I.created_at),A=Ue(cr($),"yyyy-MM");b[A]&&(I.status==="signed"?(b[A].signed++,b[A].revenue+=Number(I.final_monthly_price)):I.status==="rejected"?b[A].rejected++:(I.status==="draft"||I.status==="pending"||I.status==="sent")&&b[A].pending++)});const S=Object.values(b);a(S);const N=S.slice(-3),C=N.length>0?N.reduce((I,$)=>I+$.revenue,0)/N.length:0,T=1.05,k=[];let M=0;const E=Object.keys(b).sort(),L=I1(O,6);h.forEach(I=>{(I.signed_at?new Date(I.signed_at):new Date(I.created_at))<L&&(M+=Number(I.final_monthly_price))}),E.forEach(I=>{const $=b[I];M+=$.revenue,k.push({month:$.month,projected:Math.round(M),actual:Math.round(M)})});let R=M;for(let I=1;I<=12;I++){const $=Vr(O,I),A=Math.round(C*Math.pow(T,I));R+=A,k.push({month:Ue($,"MMM yyyy"),projected:Math.round(R)})}s(k),n({totalOrders:d.length,signedOrders:h.length,rejectedOrders:p.length,pendingOrders:m.length,avgTimeToSign:v,conversionRate:w,avgMonthlyValue:j,projectedMonthlyRevenue:k.slice(3).map(I=>I.projected)})}catch(d){console.error("Error fetching analytics:",d)}finally{e(!1)}};if(t)return c.jsx("div",{className:"flex items-center justify-center py-8",children:c.jsx(tt,{className:"h-6 w-6 animate-spin text-muted-foreground"})});if(!r)return null;const u=[{name:"Signed",value:r.signedOrders,color:"hsl(142, 76%, 36%)"},{name:"Rejected",value:r.rejectedOrders,color:"hsl(0, 84%, 60%)"},{name:"Pending",value:r.pendingOrders,color:"hsl(38, 92%, 50%)"}].filter(d=>d.value>0);return c.jsxs("div",{className:"space-y-4 mb-6",children:[c.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[c.jsx(ve,{children:c.jsxs(be,{className:"pt-4 pb-3",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Conversion Rate"}),c.jsxs("p",{className:"text-2xl font-bold",children:[r.conversionRate,"%"]})]}),c.jsx("div",{className:`p-2 rounded-full ${r.conversionRate>=50?"bg-green-100 dark:bg-green-900":"bg-amber-100 dark:bg-amber-900"}`,children:r.conversionRate>=50?c.jsx(w4,{className:"h-5 w-5 text-green-600 dark:text-green-400"}
72):c.jsx(eB,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"})})]}),c.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[r.signedOrders," signed / ",r.signedOrders+r.rejectedOrders," completed"]})]})}),c.jsx(ve,{children:c.jsxs(be,{className:"pt-4 pb-3",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Avg. Time to Sign"}),c.jsxs("p",{className:"text-2xl font-bold",children:[r.avgTimeToSign," days"]})]}),c.jsx("div",{className:"p-2 rounded-full bg-blue-100 dark:bg-blue-900",children:c.jsx(Pl,{className:"h-5 w-5 text-blue-600 dark:text-blue-400"})})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"From creation to signature"})]})}),c.jsx(ve,{children:c.jsxs(be,{className:"pt-4 pb-3",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Avg. Order Value"}),c.jsx("p",{className:"text-2xl font-bold",children:r.avgMonthlyValue})]}),c.jsx("div",{className:"p-2 rounded-full bg-purple-100 dark:bg-purple-900",children:c.jsx(Q4,{className:"h-5 w-5 text-purple-600 dark:text-purple-400"})})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Monthly recurring revenue"})]})}),c.jsx(ve,{children:c.jsxs(be,{className:"pt-4 pb-3",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Pipeline"}),c.jsx("p",{className:"text-2xl font-bold",children:r.pendingOrders})]}),c.jsx("div",{className:"p-2 rounded-full bg-orange-100 dark:bg-orange-900",children:c.jsx(_4,{className:"h-5 w-5 text-orange-600 dark:text-orange-400"})})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Orders awaiting signature"})]})})]}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[c.jsxs(ve,{className:"lg:col-span-2",children:[c.jsx(Ce,{className:"pb-2",children:c.jsx(ze,{className:"text-sm font-medium",children:"12-Month Revenue Projection"})}),c.jsx(be,{children:c.jsx("div",{className:"h-48",children:c.jsx(Av,{width:"100%",height:"100%",children:c.jsxs(Gee,{data:o,children:[c.jsx(_b,{strokeDasharray:"3 3",className:"stroke-muted"}),c.jsx(bs,{dataKey:"month",tick:{fontSize:10},tickFormatter:d=>d.split(" ")[0],className:"text-muted-foreground"}),c.jsx(_s,{tick:{fontSize:10},className:"text-muted-foreground"}),c.jsx(en,{contentStyle:{backgroundColor:"hsl(var(--background))",border:"1px solid hsl(var(--border))",borderRadius:"6px"},formatter:d=>[`${d.toLocaleString()}`,"MRR"]}),c.jsx(ys,{type:"monotone",dataKey:"actual",stroke:"hsl(var(--primary))",strokeWidth:2,dot:{fill:"hsl(var(--primary))"},name:"Actual"}),c.jsx(ys,{type:"monotone",dataKey:"projected",stroke:"hsl(var(--primary))",strokeWidth:2,strokeDasharray:"5 5",dot:!1,name:"Projected"})]})})})})]}),c.jsxs(ve,{children:[c.jsx(Ce,{className:"pb-2",children:c.jsx(ze,{className:"text-sm font-medium",children:"Order Status Distribution"})}),c.jsx(be,{children:c.jsxs("div",{className:"h-48",children:[c.jsx(Av,{width:"100%",height:"100%",children:c.jsxs(Xee,{children:[c.jsx(ki,{data:u,cx:"50%",cy:"50%",innerRadius:40,outerRadius:70,paddingAngle:2,dataKey:"value",children:u.map((d,f)=>c.jsx(mh,{fill:d.color},`cell-${f}`))}),c.jsx(en,{contentStyle:{backgroundColor:"hsl(var(--background))",border:"1px solid hsl(var(--border))",borderRadius:"6px"}})]})}),c.jsx("div",{className:"flex justify-center gap-4 -mt-2",children:u.map((d,f)=>c.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[c.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:d.color}}),c.jsxs("span",{className:"text-muted-foreground",children:[d.name,": ",d.value]})]},f))})]})})]})]}),c.jsxs(ve,{children:[c.jsx(Ce,{className:"pb-2",children:c.jsx(ze,{className:"text-sm font-medium",children:"Monthly Order Performance (Last 6 Months)"})}),c.jsx(be,{children:c.jsx("div",{className:"h-40",children:c.jsx(Av,{width:"100%",height:"100%",children:c.jsxs(Yee,{data:i,children:[c.jsx(_b,{strokeDasharray:"3 3",className:"stroke-muted"}),c.jsx(bs,{dataKey:"month",tick:{fontSize:10}
72,tickFormatter:d=>d.split(" ")[0]}),c.jsx(_s,{tick:{fontSize:10}}),c.jsx(en,{contentStyle:{backgroundColor:"hsl(var(--background))",border:"1px solid hsl(var(--border))",borderRadius:"6px"}}),c.jsx(Da,{wrapperStyle:{fontSize:"11px"}}),c.jsx(gi,{dataKey:"signed",name:"Signed",fill:"hsl(142, 76%, 36%)",radius:[2,2,0,0]}),c.jsx(gi,{dataKey:"rejected",name:"Rejected",fill:"hsl(0, 84%, 60%)",radius:[2,2,0,0]}),c.jsx(gi,{dataKey:"pending",name:"Pending",fill:"hsl(38, 92%, 50%)",radius:[2,2,0,0]})]})})})})]})]})},Zee=()=>{const[t,e]=x.useState([]),[r,n]=x.useState(!0),[i,a]=x.useState(!0),[o,s]=x.useState(null),[l,u]=x.useState(null),[d,f]=x.useState(null),{toast:h}=Pr();x.useEffect(()=>{p();const E=Z.channel("trial-conversions-changes").on("postgres_changes",{event:"*",schema:"public",table:"orders"},()=>p()).subscribe();return()=>{Z.removeChannel(E)}},[]);const p=async()=>{try{const{data:E,error:L}=await Z.from("orders").select("id, trial_end_date, conversion_email_scheduled_for, conversion_email_sent_at, client_id, signed_at, start_date, free_trial_months, pricing_model, status").eq("pricing_model","legacy").eq("status","signed").order("trial_end_date",{ascending:!0,nullsFirst:!1});if(L)throw L;const R=await Promise.all((E??[]).map(async I=>{const{data:$}=await Z.from("clients").select("company_name, email").eq("id",I.client_id).maybeSingle();return{...I,clients:$}}));e(R)}catch(E){console.error("TrialConversionsPanel fetch error:",E)}finally{n(!1)}},m=async(E,L)=>{if(L){s(E);try{const R=Ue(L,"yyyy-MM-dd"),$=!!t.find(F=>F.id===E)?.conversion_email_sent_at,{error:A}=await Z.from("orders").update({trial_end_date:R,conversion_email_sent_at:null}).eq("id",E);if(A)throw A;h({title:$?"Trial date updated & workflow reset":"Trial end date updated",description:$?`Set to ${R}. Previous send cleared â email will go out again 10 days before.`:`Set to ${R}. Email scheduled 10 days before.`}),f(null),p()}catch(R){console.error(R),h({title:"Error",description:"Failed to update trial end date",variant:"destructive"})}finally{s(null)}}},g=async E=>{u(E);try{const{data:L,error:R}=await Z.functions.invoke("process-trial-conversions",{body:{orderId:E}});if(R)throw R;(L?.sent??0)>0?h({title:"Email sent",description:"Conversion email dispatched."}):h({title:"Not sent",description:L?.results?.[0]?.reason??"Check trial end date or already-sent status.",variant:"destructive"}),p()}catch(L){console.error(L),h({title:"Error",description:"Failed to send conversion email",variant:"destructive"})}finally{u(null)}},v=async E=>{u(E);try{const{error:L}=await Z.from("orders").update({conversion_email_sent_at:null}).eq("id",E);if(L)throw L;h({title:"Reset",description:"Conversion email will be re-sent on the next scheduled run."}),p()}catch{h({title:"Error",description:"Failed to reset",variant:"destructive"})}finally{u(null)}},y=new Date;y.setHours(0,0,0,0);const w=new Date(y);w.setDate(w.getDate()+30);const _=t.filter(E=>!!E.conversion_email_sent_at),j=t.filter(E=>!E.conversion_email_sent_at&&E.conversion_email_scheduled_for&&go(E.conversion_email_scheduled_for)<y),b=t.filter(E=>!E.conversion_email_sent_at&&E.conversion_email_scheduled_for&&go(E.conversion_email_scheduled_for)>=y&&go(E.conversion_email_scheduled_for)<=w),O=t.filter(E=>!E.conversion_email_sent_at&&E.conversion_email_scheduled_for&&go(E.conversion_email_scheduled_for)>w),S=t.filter(E=>!E.trial_end_date);if(r)return null;const N=E=>E?Ue(go(E),"d MMM yyyy"):"â",C=E=>E?Ue(new Date(E),"d MMM yyyy, HH:mm"):"â",T=({label:E,value:L,mono:R})=>c.jsxs("div",{className:"flex flex-col leading-tight min-w-[110px]",children:[c.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:E}),c.jsx("span",{className:le("text-xs",R&&"tabular-nums"),children:L})]}),k=({r:E,danger:L})=>c.jsxs("div",{className:le("text-sm flex flex-wrap items-center gap-x-6 gap-y-3 py-3 border-b last:border-b-0"),children:[c.jsxs("div",{className:"flex-1 min-w-[200px]",children:[c.jsx("div",{className:le("font-medium",L&&"text-destructive"),children:E.clients?.company_name||"Unknown"}),E.clients?.email&&c.jsx("div",{className:"text-xs text-muted-foreground",children:E.clients.email})]}),c.jsx(T,{label:"Trial ends",value:N(E.trial_end_date),mono:!0}),c.jsx(T,{label:"Send date",value:N(E.conversion_email_scheduled_for),mono:!0}),E.conversion_email_sent_at?c.jsxs("div",{className:"flex flex-col leading-tight min-w-[140px]",children:[c.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Sent"}),c.jsxs(Ye,{variant:"secondary",className:"text-xs w-fit tabular-nums",children:[c.jsx(sp,{className:"h-3 w-3 mr-1"}),C(E.conversion_email_sent_at)]})]}):c.jsxs("div",{className:"flex flex-col leading-tight min-w-[140px]",children:[c.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Status"}),c.jsx("span",{className:"text-xs text-muted-foreground",children:"Not sent yet"})]}),c.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[c.jsxs(Dn,{open:d===E.id,onOpenChange:R=>f(R?E.id:null),children:[c.jsx(Rn,{asChild:!0,children:c.jsxs(oe,{size:"sm",variant:"outline",disabled:o===E.id,children:[c.jsx(Tl,{className:"h-3 w-3 mr-1.5"}),E.trial_end_date?"Edit date":"Set date"]})}),c.jsx(wn,{className:"w-auto p-0",align:"end",children:c.jsx(bn,{mode:"single",selected:E.trial_end_date?go(E.trial_end_date):void 0,onSelect:R=>m(E.id,R),initialFocus:!0,className:le("p-3 pointer-events-auto")})})]}),c.jsxs(oe,{size:"sm",variant:"outline",onClick:()=>
72g(E.id),disabled:l===E.id||!E.trial_end_date,children:[c.jsx(Z4,{className:"h-3 w-3 mr-1.5"}),"Send now"]}),E.conversion_email_sent_at&&c.jsxs(oe,{size:"sm",variant:"ghost",onClick:()=>v(E.id),disabled:l===E.id,title:"Clear sent timestamp so the email re-sends on the next scheduled run",children:[c.jsx(Qy,{className:"h-3 w-3 mr-1.5"}),"Reset"]})]})]}),M=({icon:E,title:L,items:R,empty:I})=>c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[E,c.jsxs("h4",{className:"text-sm font-semibold",children:[L," (",R.length,")"]})]}),R.length>0?c.jsx("div",{className:"pl-6",children:R.map($=>c.jsx(k,{r:$,danger:L.toLowerCase().includes("past")},$.id))}):c.jsx("p",{className:"text-xs text-muted-foreground pl-6",children:I})]});return c.jsxs("div",{className:"space-y-3 mb-4",children:[j.length>0&&c.jsxs(O0,{variant:"destructive",children:[c.jsx(up,{className:"h-4 w-4"}),c.jsxs(VP,{children:["Trial conversion emails past due (",j.length,")"]}),c.jsxs(N0,{children:[j.length," legacy client",j.length>1?"s":""," should have already received the billing-setup reminder. Make sure billing in ",c.jsx("code",{children:"app.smartiz.ai"})," is live and the daily processor is running."]})]}),c.jsx(uM,{open:i,onOpenChange:a,children:c.jsxs(ve,{children:[c.jsx(dM,{asChild:!0,children:c.jsx(Ce,{className:"cursor-pointer hover:bg-muted/50 transition-colors py-3",children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(ze,{className:"text-base",children:"Trial Conversions â Billing Activation Required"}),c.jsxs(Ye,{variant:"secondary",className:"text-xs",children:["Legacy clients only · ",t.length," total"]})]}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[_.length>0&&c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(sp,{className:"h-3 w-3 text-green-600"}),_.length," sent"]}),b.length>0&&c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(Pl,{className:"h-3 w-3 text-blue-600"}),b.length," upcoming"]}),j.length>0&&c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(up,{className:"h-3 w-3 text-destructive"}),j.length," past due"]}),S.length>0&&c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(T1,{className:"h-3 w-3 text-amber-600"}),S.length," missing date"]})]}),i?c.jsx(w0,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(Vf,{className:"h-4 w-4 text-muted-foreground"})]})]})})}),c.jsx(fM,{children:c.jsxs(be,{className:"pt-0 space-y-6",children:[c.jsxs("p",{className:"text-xs text-muted-foreground italic",children:["Manage trial end dates for all signed legacy-pricing clients. Click ",c.jsx("strong",{children:"Edit"})," to change a date â the conversion email will auto-reschedule for 10 days before. Per-reservation clients are excluded."]}),c.jsx(M,{icon:c.jsx(up,{className:"h-4 w-4 text-destructive"}),title:"Past Due â Not Yet Sent",items:j,empty:"No past-due conversion emails."}),c.jsx(M,{icon:c.jsx(In,{className:"h-4 w-4 text-blue-600"}),title:"Upcoming â Next 30 Days",items:b,empty:"No conversion emails scheduled in the next 30 days."}),c.jsx(M,{icon:c.jsx(Pl,{className:"h-4 w-4 text-muted-foreground"}),title:"Future â Beyond 30 Days",items:O,empty:"No future-scheduled emails."}),c.jsx(M,{icon:c.jsx(sp,{className:"h-4 w-4 text-green-600"}),title:"Already Sent",items:_,empty:"No emails sent yet."}),c.jsx(M,{icon:c.jsx(T1,{className:"h-4 w-4 text-amber-600"}),title:"Missing Trial End Date",items:S,empty:"All signed legacy clients have a trial end date."})]})})]})})]})},Qee=()=>{const[t,e]=x.useState([]),[r,n]=x.useState(!0),[i,a]=x.useState("pending"),[o,s]=x.useState(null),[l,u]=x.useState(!1),[d,f]=x.useState(null),[h,p]=x.useState(""),[m,g]=x.useState(""),[v,y]=x.useState(!1),[w,_]=x.useState(null),[j,b]=x.useState(!1),[O,S]=x.useState(null),[N,C]=x.useState(null),[T,k]=x.useState(void 0),[M,E]=x.useState(!1),[L,R]=x.useState(!0),[I,$]=x.useState(!1),[A,F]=x.useState(null),[V,te]=x.useState(void 0),[B,G]=x.use
72State(null),[se,Q]=x.useState(!1),[ye,re]=x.useState(!1),[ue,Y]=x.useState(null),[z,X]=x.useState(!1),[U,me]=x.useState([]),[ge,Ee]=x.useState(!1),[We,qe]=x.useState({}),[ar,Zt]=x.useState({}),[Rr,pt]=x.useState(null),[mr,gr]=x.useState({}),[Kr,Ct]=x.useState(null),{isSuperAdmin:ca}=_0(),{toast:Oe}=Pr(),ua=async W=>{re(!0),X(!W);try{const{data:q,error:Te}=await Z.functions.invoke("backfill-offer-billing-map",{body:{dry_run:W}});if(Te)throw Te;Y(q),W||Mt(),q?.ok===!1?Oe({title:"Backfill",description:q.error??"Failed",variant:"destructive"}):Oe({title:W?"Dry-run complete":"Backfill complete",description:`${q.mapped} mapped, ${q.already_mapped} already, ${q.needs_review} review, ${q.no_app_match} no match, ${q.errors} errors`})}catch(q){Oe({title:"Backfill failed",description:q?.message??String(q),variant:"destructive"})}finally{re(!1)}},wt=async()=>{Ee(!0);try{const{data:W,error:q}=await Z.functions.invoke("list-app-orgs",{body:{}});if(q)throw q;W?.ok===!1?(Oe({title:"Load orgs failed",description:W.error??"Failed",variant:"destructive"}),me([])):me(Array.isArray(W?.orgs)?W.orgs:[])}catch(W){Oe({title:"Load orgs failed",description:W?.message??String(W),variant:"destructive"})}finally{Ee(!1)}},da=async(W,q,Te)=>{pt(W);try{const{data:je,error:Xe}=await Z.functions.invoke("force-map-offer",{body:{order_id:W,target_organization_id:q,force_override:Te}});if(Xe)throw Xe;if(je?.ok&&je?.status==="mapped")gr(Je=>({...Je,[W]:{status:"mapped",organization_id:je.organization_id}})),Oe({title:"Mapped",description:`Order linked to org ${String(je.organization_id??"").slice(0,8)}â¦`}),Mt(),Ct(null);else if(je?.ok&&je?.status==="conflict")Ct({order_id:W,target_organization_id:q,existing_source_order_id:je.existing_source_order_id??null});else{const Je=je?.error??"force_map_failed";gr(qt=>({...qt,[W]:{status:"error",error:String(Je)}})),Oe({title:"Force map failed",description:String(Je),variant:"destructive"})}}catch(je){Oe({title:"Force map failed",description:je?.message??String(je),variant:"destructive"})}finally{pt(null)}};x.useEffect(()=>{Mt();const W=Z.channel("orders-changes").on("postgres_changes",{event:"*",schema:"public",table:"orders"},()=>{I||Mt()}).on("postgres_changes",{event:"*",schema:"public",table:"email_tracking"},()=>{I||Mt()}).subscribe();return()=>{Z.removeChannel(W)}},[I]);const Mt=async()=>{try{const{data:W,error:q}=await Z.from("orders").select("*").order("created_at",{ascending:!1});if(q)throw q;if(!W){e([]),n(!1);return}const Te=await Promise.all(W.map(async je=>{const{data:Xe,error:Je}=await Z.from("clients").select("*").eq("id",je.client_id).maybeSingle();if(Je)return console.error("Client fetch error:",Je),{...je,clients:{company_name:"Unknown",first_name:"Unknown",last_name:"",email:"Unknown"},email_opened:!1};const{data:qt}=await Z.from("email_tracking").select("event_type, timestamp").eq("order_id",je.id).order("timestamp",{ascending:!0});return{...je,clients:Xe||{company_name:"Unknown",first_name:"Unknown",last_name:"",email:"Unknown"},email_events:qt||[]}}));e(Te)}catch(W){console.error("Error:",W),Oe({title:"Error",description:"Failed to load orders",variant:"destructive"})}finally{n(!1)}},qs=async W=>{try{const{data:q,error:Te}=await Z.rpc("get_order_signing_token",{p_order_id:W});let je=q;if(!je){const{data:Je,error:qt}=await Z.rpc("generate_order_signing_token",{p_order_id:W});if(qt||!Je)throw new Error("Failed to generate secure signing link");je=Je}const Xe=`${window.location.origin}/order/${W}?token=${encodeURIComponent(je)}`;await navigator.clipboard.writeText(Xe),Oe({title:"Success",description:q?"Order link copied to clipboard":"New link generated and copied to clipboard"})}catch(q){console.error("Error copying order link:",q),Oe({title:"Error",description:"Failed to copy order link",variant:"destructive"})}},uo=async W=>{try{const{data:q}=await Z.rpc("get_order_signing_token",{p_order_id:W});let Te=q;if(!Te){const{data:je,error:Xe}=await Z.rpc("generate_order_signing_token",{p_order_id:W});if(Xe||!je)throw new Error("Failed to generate secure signing link");Te=je}window.open(`${window.location.origin}/order/${W}?token=${encodeURIComponent(Te)}`,"_blank")}catch(q){console.error("Error opening order link:",q),Oe({title:"Error",description:"Failed to open order link",variant:"destructive"})}},fo=async W=>{try{e(Te=>Te.filter(je=>je.id!==W));const{error:q}=await Z.from("orders").update({status:"archived"}).eq("id",W);if(q)throw q;Oe({title:"Success",description:"Order archived successfully"})}catch(q){console.error("Error archiving order:",q),Oe({title:"Error",description:"Failed to archive order",variant:"destructive"}),Mt()}},ut=async W=>{try{const q=t.find(Xe=>Xe.id===W),Te=q?.status==="archived"?"draft":q?.status;e(Xe=>Xe.filter(Je=>Je.id!==W));const{error:je}=await Z.from("orders").update({status:"draft"}).eq("id",W);if(je)throw je;Oe({title:"Success",description:"Order restored to pending"})}catch(q){console.error("Error unarchiving order:",q),Oe({title:"Error",description:"Failed to unarchive order",variant:"destructive"}),Mt()}},Hc=W=>{f(W),p(""),g(""),u(!0)},ho=async()=>
72{if(d)try{e(q=>q.filter(Te=>Te.id!==d));const{error:W}=await Z.from("orders").update({status:"rejected",rejection_client_notes:h||null,rejection_sales_notes:m||null}).eq("id",d);if(W)throw W;Oe({title:"Success",description:"Order marked as rejected"}),u(!1),f(null),p(""),g("")}catch(W){console.error("Error rejecting order:",W),Oe({title:"Error",description:"Failed to reject order",variant:"destructive"}),Mt()}},Wc=W=>{_(W),y(!0)},fa=async W=>{try{const{data:q,error:Te}=await Z.rpc("generate_order_signing_token",{p_order_id:W.id});if(Te)throw new Error("Failed to generate secure signing link");const je=`${window.location.origin}/order/${W.id}?token=${encodeURIComponent(q)}`,{data:{user:Xe}}=await Z.auth.getUser(),{data:Je}=await Z.from("profiles").select("first_name, last_name, sender_email").eq("user_id",Xe?.id).single(),qt=Je?.first_name?`${Je.first_name}${Je.last_name?" "+Je.last_name:""}`:"Smartiz Team",An=Je?.sender_email||Xe?.email||"[email protected]";await Z.functions.invoke("send-order-confirmation",{body:{orderId:W.id,firstName:W.clients.first_name,userEmail:W.clients.email,subscriptionUrl:je,language:W.language||"en",replyToEmail:An,replyToName:qt}}),Oe({title:"Success",description:"Reminder email sent to "+W.clients.email})}catch(q){console.error("Error sending reminder:",q),Oe({title:"Error",description:"Failed to send reminder email",variant:"destructive"})}},Vc=W=>{switch(W){case"draft":return c.jsx(Ye,{variant:"secondary",children:"Draft"});case"sent":return c.jsx(Ye,{className:"bg-blue-600 hover:bg-blue-700 text-white",children:"Sent"});case"signed":return c.jsx(Ye,{className:"bg-green-600 hover:bg-green-700",children:"Signed"});case"rejected":return c.jsx(Ye,{variant:"destructive",children:"Rejected"});case"expired":return c.jsx(Ye,{className:"bg-amber-600 hover:bg-amber-700",children:"Expired"});case"archived":return c.jsx(Ye,{variant:"outline",className:"bg-gray-200 dark:bg-gray-800",children:"Archived"});default:return c.jsx(Ye,{variant:"outline",children:W})}},kn=async W=>{try{e(Te=>Te.filter(je=>je.id!==W));const{error:q}=await Z.from("orders").update({status:"expired"}).eq("id",W);if(q)throw q;Oe({title:"Success",description:"Order marked as expired"})}catch(q){console.error("Error expiring order:",q),Oe({title:"Error",description:"Failed to expire order",variant:"destructive"}),Mt()}},ha=W=>{S(W),b(!0)},pa=async()=>{if(!O)return;const W=O;try{$(!0),e(Je=>Je.filter(qt=>qt.id!==W));const{error:q}=await Z.from("email_tracking").delete().eq("order_id",W);if(q)throw q;const{error:Te}=await Z.from("extension_requests").delete().eq("order_id",W);if(Te)throw Te;const{data:je,error:Xe}=await Z.from("orders").delete().eq("id",W).select("id");if(Xe)throw Xe;if(!je||je.length===0)throw new Error("Order could not be deleted. Please check your permissions and try again.");Oe({title:"Success",description:"Order deleted permanently"}),b(!1),S(null),Mt()}catch(q){console.error("Error deleting order:",q),Oe({title:"Error",description:q instanceof Error?q.message:"Failed to delete order",variant:"destructive"}),Mt()}finally{$(!1)}},np=(W,q)=>{C(W);const Te=new Date;Te.setDate(Te.getDate()+7),k(Te)},Kc=async()=>{if(!(!N||!T))try{const{error:W}=await Z.from("orders").update({validity_date:Ue(T,"yyyy-MM-dd"),status:"draft"}).eq("id",N);if(W)throw W;Oe({title:"Success",description:`Order validity extended to ${Ue(T,"PPP")}`}),C(null),k(void 0),Mt()}catch(W){console.error("Error extending validity:",W),Oe({title:"Error",description:"Failed to extend validity",variant:"destructive"})}},Gc=async()=>{const W=Gr("pending");if(W.length===0){Oe({title:"No orders",description:"No pending orders to regenerate tokens for"});return}if(!confirm(`This will regenerate tokens for ${W.length} pending orders. Old links will stop working. Continue?`))return;E(!0);let q=0,Te=0;for(const je of W)try{const{error:Xe}=await Z.rpc("generate_order_signing_token",{p_order_id:je.id});if(Xe){console.error(`Token generation failed for order ${je.id}:`,Xe),Te++;continue}q++}catch(Xe){console.error(`Failed to process order ${je.id}:`,Xe),Te++}E(!1),Oe({title:"Tokens regenerated",description:`${q} orders updated${Te>0?`, ${Te} failed`:""}. Use "Copy Link" to get the new links.`})},po=(W,q)=>{F(W),te(q?new Date(q):void 0)},Yc=async()=>
72{if(!(!A||!V))try{const W=Ue(V,"yyyy-MM-dd"),{error:q}=await Z.from("orders").update({trial_end_date:W}).eq("id",A);if(q)throw q;Oe({title:"Trial end date updated",description:`Set to ${W}. Conversion email is now scheduled for 10 days before.`}),F(null),te(void 0),Mt()}catch(W){console.error("saveTrialEndDate error:",W),Oe({title:"Error",description:"Failed to update trial end date",variant:"destructive"})}},mo=async W=>{G(W);try{const{data:q,error:Te}=await Z.functions.invoke("process-trial-conversions",{body:{orderId:W}});if(Te)throw Te;(q?.sent??0)>0?Oe({title:"Email sent",description:"Trial conversion email dispatched."}):Oe({title:"Not sent",description:q?.results?.[0]?.reason??"No email was sent. Check the order has a trial end date and has not already been sent.",variant:"destructive"}),Mt()}catch(q){console.error("sendConversionEmailNow error:",q),Oe({title:"Error",description:"Failed to send conversion email",variant:"destructive"})}finally{G(null)}},Xc=async W=>{try{const{error:q}=await Z.from("orders").update({conversion_email_sent_at:null}).eq("id",W);if(q)throw q;Oe({title:"Reset",description:"Conversion email will be re-sent on the next scheduled run."}),Mt()}catch(q){console.error("resetConversionEmail error:",q),Oe({title:"Error",description:"Failed to reset",variant:"destructive"})}},Gr=W=>W==="pending"?t.filter(q=>q.status==="draft"||q.status==="sent"):t.filter(q=>q.status===W),Ai=W=>{const q=Gr(W).length;return q>99?"99+":q.toString()};if(r)return c.jsx("div",{className:"flex items-center justify-center py-12",children:c.jsx(tt,{className:"h-8 w-8 animate-spin"})});const vr=W=>c.jsx(c.Fragment,{children:W.length===0?c.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No orders found"}):c.jsxs(Vo,{children:[c.jsx(Ko,{children:c.jsxs(an,{children:[c.jsx($e,{className:"w-32",children:"Email Tracking"}),c.jsx($e,{children:"Company"}),c.jsx($e,{children:"Contact"}),c.jsx($e,{children:"Type"}),c.jsx($e,{children:"Units"}),c.jsx($e,{children:"Price"}),c.jsx($e,{children:"Status"}),c.jsx($e,{children:"Created"}),c.jsx($e,{children:"Validity"}),c.jsx($e,{children:"Actions"})]})}),c.jsx(Go,{children:W.map(q=>{const Te=dt=>dt?new Date(dt).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):null,je=q.email_events||[],Xe=je.filter(dt=>dt.event_type==="delivered"),Je=je.filter(dt=>dt.event_type==="open"),qt=je.filter(dt=>dt.event_type==="click"),An=Xe[0]?.timestamp,mt=Je[0]?.timestamp,yr=qt[0]?.timestamp;return c.jsxs(an,{children:[c.jsx(Re,{className:"w-32",children:c.jsxs(Dn,{children:[c.jsx(Rn,{asChild:!0,children:c.jsxs("button",{className:"flex items-center gap-3 hover:opacity-80 transition-opacity cursor-pointer",children:[c.jsx("div",{title:An?`Delivered: ${Te(An)}`:"Not delivered yet",children:c.jsx(In,{className:`h-4 w-4 ${An?"text-blue-600":"text-gray-300"}`})}),c.jsx("div",{title:mt?`Opened: ${Te(mt)}`:"Not opened yet",children:c.jsx(fl,{className:`h-4 w-4 ${mt?"text-green-600":"text-gray-300"}`})}),c.jsx("div",{title:yr?`Clicked: ${Te(yr)}`:"Not clicked yet",children:c.jsx(cp,{className:`h-4 w-4 ${yr?"text-purple-600":"text-gray-300"}`})})]})}),c.jsx(wn,{className:"w-80",align:"start",children:c.jsxs("div",{className:"space-y-4",children:[c.jsx("h4",{className:"font-semibold text-sm",children:"Email Tracking Details"}),je.length===0?c.jsx("p",{className:"text-sm text-muted-foreground",children:"No tracking data available"}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[c.jsxs("div",{className:"bg-blue-50 dark:bg-blue-950 rounded-lg p-2",children:[c.jsx(In,{className:"h-4 w-4 text-blue-600 mx-auto mb-1"}),c.jsx("div",{className:"text-lg font-bold text-blue-600",children:Xe.length}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"Delivered"})]}),c.jsxs("div",{className:"bg-green-50 dark:bg-green-950 rounded-lg p-2",children:[c.jsx(fl,{className:"h-4 w-4 text-green-600 mx-auto mb-1"}),c.jsx("div",{className:"text-lg font-bold text-green-600",children:Je.length}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"Opens"})]}),c.jsxs("div",{className:"bg-purple-50 dark:bg-purple-950 rounded-lg p-2",children:[c.jsx(cp,{className:"h-4 w-4 text-purple-600 mx-auto mb-1"}),c.jsx("div",{className:"text-lg font-bold text-purple-600",children:qt.length}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"Clicks"})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("h5",{className:"text-xs font-medium text-muted-foreground uppercase",children:"Event Timeline"}),c.jsx(Pu,{className:"h-40",children:c.jsx("div",{className:"space-y-2",children:je.map((dt,Us)=>c.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[dt.event_type==="delivered"&&c.jsx(In,{className:"h-3 w-3 text-blue-600"}),dt.event_type==="open"&&c.jsx(fl,{className:"h-3 w-3 text-green-600"}),dt.event_type==="click"&&c.jsx(cp,{className:"h-3 w-3 text-purple-600"}),c.jsx("span",{className:"capitalize",children:dt.event_type}),c.jsx("span",{className:"text-muted-foreground ml-auto text-xs",children:Te(dt.timestamp)})]},Us))})})]})]})]})})]})}),c.jsxs(Re,{className:"font-medium",children:[c.jsx("div",{children:q.clients.company_name}),(()=>{const dt=q.clients.billing_provision_status;return dt?dt==="linked"||dt==="created"||dt==="mapped"||dt==="already_mapped"?c.jsxs("div",{className:"text-[10px] text-green-700 dark:text-green-400 mt-0.5",title:q.clients.billing_org_id??"",children:["â
Mapped ",q.clients.billing_org_id?`(${q.clients.billing_org_id.slice(0,8)}â¦)`:""]}):dt==="needs_review"?c.jsx("div",{className:"text-[10px] text-amber-700 dark:text-amber-400 mt-0.5",children:"â ï¸ Needs review"}):dt==="no_app_match"?c.jsx("div",{className:"text-[10px] text-slate-600 dar
72k:text-slate-400 mt-0.5",children:"â»ï¸ No app match"}):dt==="error"?c.jsx("div",{className:"text-[10px] text-red-700 dark:text-red-400 mt-0.5",children:"â ï¸ Bridge error"}):c.jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:"Pending"}):null})()]}),c.jsx(Re,{children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("span",{children:[q.clients.first_name," ",q.clients.last_name]}),c.jsxs("span",{className:"text-lg",title:q.language.toUpperCase(),children:[q.language==="en"&&"ð¬ð§",q.language==="fr"&&"ð«ð·",q.language==="de"&&"ð©ðª",q.language==="it"&&"ð®ð¹"]})]})}),c.jsx(Re,{className:"uppercase",children:q.business_type}),c.jsx(Re,{children:q.units}),c.jsxs(Re,{children:[q.final_monthly_price," ",q.currency]}),c.jsx(Re,{children:Vc(q.status)}),c.jsx(Re,{children:new Date(q.created_at).toLocaleDateString()}),c.jsx(Re,{children:q.validity_date?c.jsx("span",{className:new Date(q.validity_date)<new Date?"text-destructive font-medium":"",children:new Date(q.validity_date).toLocaleDateString()}):"-"}),c.jsx(Re,{children:c.jsxs("div",{className:"flex gap-2",children:[q.status==="signed"&&c.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>s(q.id),title:"View signed document",children:c.jsx(Uu,{className:"h-4 w-4"})}),(q.status==="draft"||q.status==="pending"||q.status==="sent")&&c.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>fa(q),title:"Send reminder email",children:c.jsx(In,{className:"h-4 w-4"})}),(q.status==="draft"||q.status==="pending"||q.status==="sent"||q.status==="expired")&&c.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>{window.location.href=`/admin?edit=${q.id}`},title:yr&&q.status!=="expired"?"Cannot edit - email clicked":"Edit order",disabled:!!yr&&q.status!=="expired",className:yr&&q.status!=="expired"?"opacity-30 cursor-not-allowed":"",children:c.jsx(Tl,{className:`h-4 w-4 ${yr&&q.status!=="expired"?"text-muted-foreground":""}`})}),c.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>qs(q.id),children:c.jsx(F4,{className:"h-4 w-4"})}),c.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>uo(q.id),children:c.jsx(ex,{className:"h-4 w-4"})}),q.status==="rejected"&&(q.rejection_client_notes||q.rejection_sales_notes)&&c.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>Wc(q),title:"View rejection notes",children:c.jsx(Uu,{className:"h-4 w-4"})}),(q.status==="draft"||q.status==="pending"||q.status==="sent"||q.status==="expired")&&c.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>np(q.id,q.validity_date),title:"Extend validity",children:c.jsx(M1,{className:"h-4 w-4"})}),(q.status==="draft"||q.status==="pending"||q.status==="sent")&&c.jsxs(ip,{children:[c.jsx(ap,{asChild:!0,children:c.jsx(oe,{variant:"ghost",size:"sm",children:c.jsx(lp,{className:"h-4 w-4"})})}),c.jsxs(op,{align:"end",className:"bg-background",children:[c.jsxs(En,{onClick:()=>fo(q.id),children:[c.jsx(S4,{className:"h-4 w-4 mr-2"}),"Archive"]}),c.jsxs(En,{onClick:()=>kn(q.id),className:"text-amber-600",children:[c.jsx(Pl,{className:"h-4 w-4 mr-2"}),"Mark as Expired"]}),c.jsxs(En,{onClick:()=>Hc(q.id),className:"text-destructive",children:[c.jsx(zE,{className:"h-4 w-4 mr-2"}),"Reject"]}),c.jsxs(En,{onClick:()=>ha(q.id),className:"text-destructive",children:[c.jsx(Ma,{className:"h-4 w-4 mr-2"}),"Delete permanently"]})]})]}),q.status==="archived"&&c.jsxs(ip,{children:[c.jsx(ap,{asChild:!0,children:c.jsx(oe,{variant:"ghost",size:"sm",children:c.jsx(lp,{className:"h-4 w-4"})})}),c.jsxs(op,{align:"end",className:"bg-background",children:[c.jsxs(En,{onClick:()=>ut(q.id),children:[c.jsx(D4,{className:"h-4 w-4 mr-2"}),"Unarchive"]}),c.jsxs(En,{onClick:()=>ha(q.id),className:"text-destructive",children:[c.jsx(Ma,{className:"h-4 w-4 mr-2"}),"Delete permanently"]})]})]}),(q.status==="rejected"||q.status==="expired"||q.status==="signed")&&c.jsxs(ip,{children:[c.jsx(ap,{asChild:!0,children:c.jsx(oe,{variant:"ghost",size:"sm",children:c.jsx(lp,{className:"h-4 w-4"})})}),c.jsxs(op,{align:"end",className:"bg-background",children:[q.status==="signed"&&(q.pricing_model??"legacy")==="legacy"&&c.jsxs(c.Fragment,{children:[c.jsxs(En,{onClick:()=>po(q.id,q.trial_end_date),children:[c.jsx(M1,{className:"h-4 w-4 mr-2"}),q.trial_end_date?`Edit trial end (${q.trial_end_date})`:"Set trial end date"]}),c.jsxs(En,{onClick:()=>mo(q.id),disabled:B===q.id||!q.trial_end_date,children:[c.jsx(In,{className:"h-4 w-4 mr-2"}),B===q.id?"Sendingâ¦":"Send conversion email now"]}),q.conversion_email_sent_at&&c.jsxs(En,{onClick:()=>Xc(q.id),children:[c.jsx(Qy,{className:"h-4 w-4 mr-2"}),"Reset (resend)"]})]}),c.jsxs(En,{onClick:()=>ha(q.id),className:"text-destructive",children:[c.jsx(Ma,{className:"h-4 w-4 mr-2"}),"Delete permanently"]})]})]})]})})]},q.id)})})]})});return c.jsxs(c.Fragment,{children:[c.jsx(uM,{open:L,onOpenChange:R,children:c.jsxs(ve,{className:"mb-4",children:[c.jsx(d
72M,{asChild:!0,children:c.jsx(Ce,{className:"cursor-pointer hover:bg-muted/50 transition-colors py-3",children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(ze,{className:"text-base",children:"Order Analytics & Projections"}),L?c.jsx(w0,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(Vf,{className:"h-4 w-4 text-muted-foreground"})]})})}),c.jsx(fM,{children:c.jsx(be,{className:"pt-0",children:c.jsx(Jee,{})})})]})}),c.jsx(Zee,{}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsxs("div",{className:"flex items-center justify-between gap-4",children:[c.jsx(ze,{children:"Orders"}),ca&&c.jsx(oe,{variant:"outline",size:"sm",onClick:()=>{Y(null),X(!1),qe({}),gr({}),Q(!0),ua(!0),wt()},children:"Backfill billing map"})]})}),c.jsx(be,{children:c.jsxs(Nc,{value:i,onValueChange:a,children:[c.jsxs(Ps,{children:[c.jsxs(gt,{value:"pending",children:["Pending",c.jsx(Ye,{className:"ml-2 bg-orange-500 hover:bg-orange-600 text-white",children:Ai("pending")})]}),c.jsxs(gt,{value:"signed",children:["Signed",c.jsx(Ye,{className:"ml-2 bg-green-600 hover:bg-green-700 text-white",children:Ai("signed")})]}),c.jsxs(gt,{value:"rejected",children:["Rejected",c.jsx(Ye,{className:"ml-2 bg-red-600 hover:bg-red-700 text-white",children:Ai("rejected")})]}),c.jsxs(gt,{value:"expired",children:["Expired",c.jsx(Ye,{className:"ml-2 bg-amber-600 hover:bg-amber-700 text-white",children:Ai("expired")})]}),c.jsxs(gt,{value:"archived",children:["Archived",c.jsx(Ye,{className:"ml-2 bg-gray-500 hover:bg-gray-600 text-white",children:Ai("archived")})]})]}),c.jsxs(vt,{value:"pending",className:"mt-6",children:[c.jsx("div",{className:"flex justify-end mb-4",children:c.jsx(oe,{variant:"outline",size:"sm",onClick:Gc,disabled:M||Gr("pending").length===0,children:M?c.jsxs(c.Fragment,{children:[c.jsx(tt,{className:"h-4 w-4 mr-2 animate-spin"}),"Regenerating..."]}):c.jsxs(c.Fragment,{children:[c.jsx(Qy,{className:"h-4 w-4 mr-2"}),"Regenerate All Tokens"]})})}),vr(Gr("pending"))]}),c.jsx(vt,{value:"signed",className:"mt-6",children:vr(Gr("signed"))}),c.jsx(vt,{value:"rejected",className:"mt-6",children:vr(Gr("rejected"))}),c.jsx(vt,{value:"expired",className:"mt-6",children:vr(Gr("expired"))}),c.jsx(vt,{value:"archived",className:"mt-6",children:vr(Gr("archived"))})]})})]}),c.jsx(gn,{open:!!o,onOpenChange:W=>!W&&s(null),children:c.jsxs(vn,{className:"max-w-5xl max-h-[90vh] p-0",children:[c.jsx(yn,{className:"px-6 pt-6 pb-4",children:c.jsx(xn,{children:"Signed Order Document"})}),c.jsx(Pu,{className:"h-[calc(90vh-80px)] px-6 pb-6",children:o&&c.jsx(rz,{orderId:o})})]})}),c.jsx(gn,{open:l,onOpenChange:u,children:c.jsxs(vn,{className:"max-w-md",children:[c.jsx(yn,{children:c.jsx(xn,{children:"Reject Order"})}),c.jsxs("div",{className:"space-y-4 py-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{htmlFor:"client-notes",children:"Notes from Client"}),c.jsx(zn,{id:"client-notes",placeholder:"Why did the client reject? (optional)",value:h,onChange:W=>p(W.target.value),rows:3})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{htmlFor:"sales-notes",children:"Notes from Sales"}),c.jsx(zn,{id:"sales-notes",placeholder:"Internal sales notes (optional)",value:m,onChange:W=>g(W.target.value),rows:3})]})]}),c.jsxs(li,{children:[c.jsx(oe,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),c.jsx(oe,{variant:"destructive",onClick:ho,children:"Reject Order"})]})]})}),c.jsx(gn,{open:v,onOpenChange:y,children:c.jsxs(vn,{className:"max-w-md",children:[c.jsx(yn,{children:c.jsx(xn,{children:"Rejection Notes"})}),c.jsxs("div",{className:"space-y-4 py-4",children:[w?.rejection_client_notes&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{className:"text-muted-foreground",children:"Notes from Client"}),c.jsx("p",{className:"text-sm bg-muted p-3 rounded-md",children:w.rejection_client_notes})]}),w?.rejection_sales_notes&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{className:"text-muted-foreground",children:"Notes from Sales"}),c.jsx("p",{className:"text-sm bg-muted p-3 rounded-md",children:w.rejection_sales_notes})]}),!w?.rejection_client_notes&&!w?.rejection_sales_notes&&c.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No notes available"})]})]})}),c.jsx(dx,{open:j,onOpenChange:b,children:c.jsxs(Vu,{children:[c.jsxs(Ku,{children:[c.jsx(Yu,{children:"Delete Order"}),c.jsx(Xu,{children:"Are you sure you want to permanently delete this order? This action cannot be undone."})]}),c.jsxs(Gu,{children:[c.jsx(Zu,{onClick:()=>S(null),children:"Cancel"}),c.jsx(Ju,{onClick:pa,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),c.jsx(gn,{open:!!N,onOpenChange:W=>!W&&C(null),children:c.jsxs(vn,{className:"max-w-sm",children:[c.jsxs(yn,{children:[c.jsx(xn,{children:"Extend Order Validity"}),c.jsx(dl,{children:"Select a new validity date for this order."})]}),c.jsx("div",{className:"flex justify-center py-4",children:c.jsx(bn,{mode:"single",selected:T,onSelect:k,disabled:W=>W<new Date,initialFocus:!0,className:"pointer-events-auto"})}),c.jsxs(li,{children:[c.jsx(oe,{variant:"outline",onClick:()=>C(null),children:"Cancel"}),c.jsxs(oe,{onClick:Kc,disabled:!T,children:["Extend to ",T?Ue(T,"PP"):"..."]})]})]})}),c.jsx(gn,{open:!!A,onOpenChange:W=>{W||(F(null),te(void 0))},children:c.jsxs(vn,{className:"max-w-sm",children:[c.jsxs(yn,{children:[c.jsx(xn,{children:"Edit Trial End Date"}),c.jsx(dl,{children:"The conversion email will be scheduled to fire 10 days before this date."})]}),c.jsx("div",{className:"flex justify-center py-4",children:c.jsx(bn,{mode:"single",selected:V,onSelect:te,initialFocus:!0,className:"pointer-events-auto"})}),c.jsxs(li,{children:[c.jsx(oe,{variant:"outline",onClick:()=>{F(null),te(void 0)},children:"Cancel"}),c.jsxs(oe,{onClick:Yc,disabled:!V,children:["Save ",V?Ue(V,"PP"):""]})]})]})}),c.jsx(gn,{open:se,onOpenChange:Q,children:c.jsxs(vn,{className:"max-w-3xl",children:[c.jsxs(yn,{children:[c.jsxs(xn,{children:["Backfill billing map ",z?"(live)":"(dry-run)"]}),c.jsxs(dl,{children:["Maps existing signed offers to app orgs via ",c.jsx("code",{children:"provision-org-from-offer"})," in map_only mode. Never activates billing."]})]}),ye?c.jsxs("div",{className:"flex items-center gap-2 py-8 justify-center text-muted-foreground",children:[c.jsx(tt,{className:"h-4 w-4 animate-spin"})," Runningâ¦"]}):ue?c.jsx("div",{className:"space-y-3",children:ue.ok===!1?c.jsxs("div",{className:"text-sm text-red-600",children:["Error: ",ue.error]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"grid grid-cols-3 gap-2 text-sm",children:[c.jsxs("div",{children:["Total: ",c.jsx("b",{children:ue.total})]}),c.jsxs("div",{children:["Mapped: ",c.jsx("b",{className:"text-green-700",children:ue.mapped})]}),c.jsxs("div",{children:["Already: ",c.jsx("b",{className:"text-green-700",children:ue.already_mapped})]}),c.jsxs("div",{children:["Needs review: ",c.jsx("b",{className:"text-amber-700",children:ue.needs_review})]}),c.jsxs("div",{children:["No match: ",c.jsx("b",{className:"text-slate-600",children:ue.no_app_match})]}),c.jsxs("div",{children:["Errors: ",c.jsx("b",{className:"text-red-700",children:ue.errors})]})]}),c.jsx(Pu,{className:"h-96 border rounded p-2",children:c.jsx("div",{className:"space-y-1 text-xs font-mono",children:(ue.details??[]).map(W=>
72{const q=mr[W.order_id],Te=q?.status==="mapped"?"mapped":W.status,Xe=(!q||q.status!=="mapped")&&["no_app_match","needs_review","error"].includes(W.status),Je=We[W.order_id]??"",qt=U.find(mt=>mt.id===Je),An=new Set(U.filter(mt=>mt.source_order_id).map(mt=>mt.id));return c.jsxs("div",{className:"border-b py-1.5",children:[c.jsxs("div",{children:[c.jsx("b",{children:W.company_name})," â ",Te," ",q?.status==="mapped"&&q.organization_id?c.jsxs("span",{className:"text-green-700",children:["â
â ",String(q.organization_id).slice(0,8),"â¦"]}):W.organization_id?`â ${String(W.organization_id).slice(0,8)}â¦`:"",W.matched_by?` (${W.matched_by})`:""]}),W.candidates&&c.jsxs("div",{className:"text-muted-foreground",children:["candidates: ",JSON.stringify(W.candidates).slice(0,200)]}),W.error&&c.jsxs("div",{className:"text-red-600",children:["error: ",W.error]}),q?.error&&c.jsxs("div",{className:"text-red-600",children:["force map error: ",q.error]}),Xe&&c.jsxs("div",{className:"flex items-center gap-2 mt-1.5 font-sans",children:[c.jsxs(Dn,{open:ar[W.order_id]??!1,onOpenChange:mt=>Zt(yr=>({...yr,[W.order_id]:mt})),children:[c.jsx(Rn,{asChild:!0,children:c.jsxs(oe,{variant:"outline",size:"sm",role:"combobox",className:"h-7 min-w-[240px] justify-between text-xs",children:[qt?`${qt.name}${An.has(qt.id)?" (linked)":""}`:ge?"Loading orgsâ¦":"Select app organisationâ¦",c.jsx($4,{className:"ml-2 h-3 w-3 opacity-50"})]})}),c.jsx(wn,{className:"w-[320px] p-0",align:"start",children:c.jsxs(OT,{children:[c.jsx(NT,{placeholder:"Search orgsâ¦",className:"h-8"}),c.jsxs(CT,{children:[c.jsx(kT,{children:"No orgs found."}),c.jsx(AT,{children:U.map(mt=>c.jsxs(ET,{value:`${mt.name} ${mt.legal_vat??""} ${mt.id}`,onSelect:()=>{qe(yr=>({...yr,[W.order_id]:mt.id})),Zt(yr=>({...yr,[W.order_id]:!1}))},children:[c.jsx($n,{className:le("mr-2 h-3 w-3",Je===mt.id?"opacity-100":"opacity-0")}),c.jsxs("div",{className:"flex flex-col",children:[c.jsxs("span",{className:"text-xs",children:[mt.name,An.has(mt.id)?" · linked":""]}),c.jsx("span",{className:"text-[10px] text-muted-foreground",children:mt.legal_vat??mt.id.slice(0,8)})]})]},mt.id))})]})]})})]}),c.jsx(oe,{size:"sm",className:"h-7 text-xs",disabled:!Je||Rr===W.order_id,onClick:()=>da(W.order_id,Je,!1),children:Rr===W.order_id?c.jsx(tt,{className:"h-3 w-3 animate-spin"}):"Force map"})]})]},W.order_id)})})})]})}):null,c.jsxs(li,{children:[c.jsx(oe,{variant:"outline",onClick:()=>Q(!1),children:"Close"}),ue?.ok!==!1&&!z&&c.jsx(oe,{onClick:()=>ua(!1),disabled:ye,children:"Apply live"}),!ye&&c.jsx(oe,{variant:"secondary",onClick:()=>ua(z),children:"Re-run"})]})]})}),c.jsx(dx,{open:!!Kr,onOpenChange:W=>{W||Ct(null)},children:c.jsxs(Vu,{children:[c.jsxs(Ku,{children:[c.jsx(Yu,{children:"Override existing mapping?"}),c.jsxs(Xu,{children:["That app organisation is already linked to another offer",Kr?.existing_source_order_id?` (source_order_id: ${Kr.existing_source_order_id.slice(0,8)}â¦)`:"",". Override and re-point it to this order?"]})]}),c.jsxs(Gu,{children:[c.jsx(Zu,{onClick:()=>Ct(null),children:"Cancel"}),c.jsx(Ju,{onClick:()=>{Kr&&da(Kr.order_id,Kr.target_organization_id,!0)},children:"Override"})]})]})})]})},ete=({isOpen:t,onClose:e,userId:r,userEmail:n,userProfile:i,onSaved:a})=>{const[o,s]=x.useState({}),[l,u]=x.useState(!1),[d,f]=x.useState(!1),h=x.useRef(null),{toast:p}=Pr();x.useEffect(()=>{if(!t)return;s({avatar_url:i?.avatar_url??"",job_title:i?.job_title??"",whatsapp_phone:i?.whatsapp_phone??"",first_name:i?.first_name??"",last_name:i?.last_name??"",sender_email:i?.sender_email??""});let v=!1;return(async()=>{const{data:y,error:w}=await Z.from("profiles").select("avatar_url, job_title, whatsapp_phone, first_name, last_name, sender_email").eq("user_id",r).maybeSingle();v||w||y&&s({avatar_url:y.avatar_url??"",job_title:y.job_title??"",whatsapp_phone:y.whatsapp_phone??"",first_name:y.first_name??"",last_name:y.last_name??"",sender_email:y.sender_email??""})})(),()=>{v=!0}},[t,r]);const m=async v=>{const y=v.target.files?.[0];if(y){if(!y.type.startsWith("image/")){p({title:"Error",description:"Please upload an image file",variant:"destructive"});return}if(y.size>5*1024*1024){p({title:"Error",description:"Image must be less than 5MB",variant:"destructive"});return}f(!0);try{if(o.avatar_url){const S=o.avatar_url.split("/").pop();S&&await Z.storage.from("avatars").remove([`${r}/${S}`])}const w=y.name.split(".").pop(),_=`${Date.now()}.${w}`,j=`${r}/${_}`,{error:b}=await Z.storage.from("avatars").upload(j,y);if(b)throw b;const{data:{publicUrl:O}}=Z.storage.from("avatars").getPublicUrl(j);s({...o,avatar_url:O}),p({title:"Success",description:"Avatar uploaded successfully"})}catch(w){console.error("Error uploading avatar:",w),p({title:"Error",description:w.message||"Failed to upload avatar",variant:"destructive"})}finally{f(!1),h.current&&(h.current.value="")}}},g=async()=>{u(!0);try{const{error:v}=await Z.from("profiles").upsert({user_id:r,avatar_url:o.avatar_url||null,job_title:o.job_title||null,whatsapp_phone:o.whatsapp_phone||null,first_name:o.first_name||null,last_name:o.last_name||null,sender_email:o.sender_email||null},{onConflict:"user_id"});if(v)throw v;p({title:"Success",description:"Profile updated successfully"}),a(),e()}catch(v){console.error("Error updating profile:",v),p({title:"Error",description:v.message||"Failed to update profile",variant:"destructive"})}finally{u(!1)}};return c.jsx(gn,{open:t,onOpenChange:v=>!v&&e(),children:c.jsxs(vn,{className:"sm:max-w-[500px]",children:[c.jsxs(yn,{children:[c.jsx(xn,{children:"Edit User Profile"}),c.jsx(dl,{children:n})]}),c.jsxs("div",{className:"space-y-4 py-4",children:[c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsxs(qE,{className:"h-20 w-20",children:[c.jsx(UE,{src:o.avatar_url}),c.jsx(HE,{className:"text-2xl",children:o.first_name?.charAt(0)?.toUpperCase()||n?.charAt(0)?.toUpperCase()||"?"})]}),c.jsxs("div",{children:[c.jsx("input",{ref:h,type:"file",accept:"image/*",onChange:m,className:"hidden"}),c.jsxs(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>h.current?.click(),disabled:d,children:[d?c.jsx(tt,{className:"h-4 w-4 animate-spin mr-2"}):c.jsx(WE,{className:"h-4 w-4 mr-2"}),"Upload Avatar"]})]})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsx(ne,{htmlFor:"firstName",children:"First Name"}),c.jsx(fe,{id:"firstName",placeholder:"First Name",value:o.first_name||"",onChange:v=>s({...o,first_name:v.target.value})})]}),c.jsxs("div",{children:[c.jsx(ne,{htmlFor:"lastName",children:"Last Name"}),c.jsx(fe,{id:"lastName",placeholder:"Last Name",value:o.last_name||"",onChange:v=>s({...o,last_name:v.target.value})})]})]}),c.jsxs("div",{children:[c.jsx(ne,{htmlFor:"jobTitle",children:"Job Title"}),c.jsx(fe,{id:"jobTitle",placeholder:"Job Title",value:o.job_title||"",onChange:v=>s({...o,job_title:v.target.value})})]}),c.jsxs("div",{children:[c.jsx(ne,{htmlFor:"phone",children:"WhatsApp Phone"}),c.jsx(b0,{defaultCountry:"ch",value:o.whatsapp_phone||"",onChange:v=>s({...o,whatsapp_phone:v}),inputClassName:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
72ing-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",countrySelectorStyleProps:{buttonClassName:"border border-input bg-background hover:bg-accent rounded-l-md"}})]}),c.jsxs("div",{children:[c.jsx(ne,{htmlFor:"senderEmail",children:"Sender Email"}),c.jsx(fe,{id:"senderEmail",type:"email",placeholder:"[email protected] (optional, defaults to login email)",value:o.sender_email||"",onChange:v=>s({...o,sender_email:v.target.value})}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Leave blank to use login email as sender"})]})]}),c.jsxs(li,{children:[c.jsx(oe,{variant:"outline",onClick:e,disabled:l,children:"Cancel"}),c.jsx(oe,{onClick:g,disabled:l,children:l?c.jsxs(c.Fragment,{children:[c.jsx(tt,{className:"h-4 w-4 animate-spin mr-2"}),"Saving..."]}):"Save Changes"})]})]})})};var _y,Fh="HoverCard",[MR]=no(Fh,[Es]),zh=Es(),[tte,Vw]=MR(Fh),DR=t=>{const{__scopeHoverCard:e,children:r,open:n,defaultOpen:i,onOpenChange:a,openDelay:o=700,closeDelay:s=300}=t,l=zh(e),u=x.useRef(0),d=x.useRef(0),f=x.useRef(!1),h=x.useRef(!1),[p,m]=qo({prop:n,defaultProp:i??!1,onChange:a,caller:Fh}),g=x.useCallback(()=>{clearTimeout(d.current),u.current=window.setTimeout(()=>m(!0),o)},[o,m]),v=x.useCallback(()=>{clearTimeout(u.current),!f.current&&!h.current&&(d.current=window.setTimeout(()=>m(!1),s))},[s,m]),y=x.useCallback(()=>m(!1),[m]);return x.useEffect(()=>()=>{clearTimeout(u.current),clearTimeout(d.current)},[]),c.jsx(tte,{scope:e,open:p,onOpenChange:m,onOpen:g,onClose:v,onDismiss:y,hasSelectionRef:f,isPointerDownOnContentRef:h,children:c.jsx(h0,{...l,children:r})})};DR.displayName=Fh;var RR="HoverCardTrigger",IR=x.forwardRef((t,e)=>{const{__scopeHoverCard:r,...n}=t,i=Vw(RR,r),a=zh(r);return c.jsx(Wf,{asChild:!0,...a,children:c.jsx(Ve.a,{"data-state":i.open?"open":"closed",...n,ref:e,onPointerEnter:Ae(t.onPointerEnter,ef(i.onOpen)),onPointerLeave:Ae(t.onPointerLeave,ef(i.onClose)),onFocus:Ae(t.onFocus,i.onOpen),onBlur:Ae(t.onBlur,i.onClose),onTouchStart:Ae(t.onTouchStart,o=>o.preventDefault())})})});IR.displayName=RR;var rte="HoverCardPortal",[Wce,nte]=MR(rte,{forceMount:void 0}),Qd="HoverCardContent",$R=x.forwardRef((t,e)=>{const r=nte(Qd,t.__scopeHoverCard),{forceMount:n=r.forceMount,...i}=t,a=Vw(Qd,t.__scopeHoverCard);return c.jsx(Zi,{present:n||a.open,children:c.jsx(ite,{"data-state":a.open?"open":"closed",...i,onPointerEnter:Ae(t.onPointerEnter,ef(a.onOpen)),onPointerLeave:Ae(t.onPointerLeave,ef(a.onClose)),ref:e})})});$R.displayName=Qd;var ite=x.forwardRef((t,e)=>{const{__scopeHoverCard:r,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,...s}=t,l=Vw(Qd,r),u=zh(r),d=x.useRef(null),f=Nt(e,d),[h,p]=x.useState(!1);return x.useEffect(()=>{if(h){const m=document.body;return _y=m.style.userSelect||m.style.webkitUserSelect,m.style.userSelect="none",m.style.webkitUserSelect="none",()=>{m.style.userSelect=_y,m.style.webkitUserSelect=_y}}},[h]),x.useEffect(()=>{if(d.current){const m=()=>{p(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",m),()=>{document.removeEventListener("pointerup",m),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),x.useEffect(()=>{d.current&&ste(d.current).forEach(g=>g.setAttribute("tabindex","-1"))}),c.jsx(p0,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:o,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:Ae(a,m=>{m.preventDefault()}),onDismiss:l.onDismiss,children:c.jsx(m0,{...u,...s,onPointerDown:Ae(s.onPointerDown,m=>{m.currentTarget.contains(m.target)&&p(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:f,style:{...s.style,userSelect:h?"text":void 0,WebkitUserSelect:h?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),ate="HoverCardArrow",ote=x.forwardRef((t,e)=>{const{__scopeHoverCard:r,...n}=t,i=zh(r);return c.jsx(g0,{...i,...n,ref:e})});ote.displayName=ate;function ef(t){return e=>e.pointerType==="touch"?void 0:t()}function ste(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;r.nextNode();)e.push(r.currentNode);return e}
72var lte=DR,cte=IR,LR=$R;const ute=lte,dte=cte,BR=x.forwardRef(({className:t,align:e="center",sideOffset:r=4,...n},i)=>c.jsx(LR,{ref:i,align:e,sideOffset:r,className:le("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",t),...n}));BR.displayName=LR.displayName;const fte=()=>{const[t,e]=x.useState([]),[r,n]=x.useState(!0),[i,a]=x.useState(""),[o,s]=x.useState(""),[l,u]=x.useState(""),[d,f]=x.useState(""),[h,p]=x.useState(""),[m,g]=x.useState(null),[v,y]=x.useState("admin"),[w,_]=x.useState(!0),[j,b]=x.useState(""),[O,S]=x.useState(!1),[N,C]=x.useState(!1),[T,k]=x.useState(null),[M,E]=x.useState(null),[L,R]=x.useState(null),[I,$]=x.useState(null),[A,F]=x.useState(null),[V,te]=x.useState(!1),{toast:B}=Pr(),{isSuperAdmin:G}=_0();x.useEffect(()=>{se();const z=Z.channel("user-roles-changes").on("postgres_changes",{event:"*",schema:"public",table:"user_roles"},()=>{console.log("User role change detected"),se()}).subscribe();return()=>{Z.removeChannel(z)}},[]);const se=async()=>{try{const{data:z,error:X}=await Z.from("user_roles").select("*").order("created_at",{ascending:!1});if(X)throw X;const U=(z||[]).map(pt=>pt.user_id);if(U.length===0){e([]),n(!1);return}const{data:me,error:ge}=await Z.functions.invoke("get-user-emails",{body:{userIds:U}});if(ge)throw console.error("Error fetching emails:",ge),ge;const Ee=me?.userEmails||{},We=me?.userProviders||{},qe=me?.userConfirmed||{},{data:ar}=await Z.from("profiles").select("*").in("user_id",U),Zt=(ar||[]).reduce((pt,mr)=>(pt[mr.user_id]=mr,pt),{}),Rr=(z||[]).map(pt=>({...pt,profiles:{email:Ee[pt.user_id]||"Unknown"},user_profile:Zt[pt.user_id],auth_provider:We[pt.user_id]||["email"],email_confirmed:qe[pt.user_id]??!1}));e(Rr)}catch(z){console.error("Error fetching users:",z),B({title:"Error",description:"Failed to load users",variant:"destructive"})}finally{n(!1)}},Q=async()=>{if(!i){B({title:"Error",description:"Please enter an email address",variant:"destructive"});return}if(!o){B({title:"Error",description:"Please enter a first name",variant:"destructive"});return}S(!0);try{let z=null;if(m){const me=`temp-${Date.now()}`,ge=m.name.split(".").pop(),Ee=`${me}.${ge}`,{error:We}=await Z.storage.from("avatars").upload(Ee,m);if(We)console.error("Avatar upload error:",We);else{const{data:{publicUrl:qe}}=Z.storage.from("avatars").getPublicUrl(Ee);z=qe}}const{data:X,error:U}=await Z.functions.invoke("create-admin-user",{body:{email:i,firstName:o,lastName:l||"",role:v,jobTitle:d||null,phone:h||null,avatarUrl:z||null,senderEmail:w?null:j||null}});if(U)throw U;if(!X?.success)throw new Error("Failed to create user");
72try{await Z.functions.invoke("send-user-invitation",{body:{firstName:o,userEmail:i,signupUrl:X.signupUrl}}),console.log("Invitation email sent successfully")}catch(me){console.error("Failed to send invitation email:",me)}B({title:"Success",description:`User invited successfully. An invitation email has been sent to ${i}`}),a(""),s(""),u(""),f(""),p(""),g(null),y("admin"),_(!0),b(""),se()}catch(z){console.error("Error inviting user:",z),B({title:"Error",description:z.message||"Failed to invite user",variant:"destructive"})}finally{S(!1)}},ye=async()=>{if(T)try{const{data:z,error:X}=await Z.functions.invoke("delete-user",{body:{userId:T}});if(X)throw X;if(!z.success)throw new Error(z.error||"Failed to delete user");B({title:"Success",description:"User deleted successfully"}),se()}catch(z){console.error("Error deleting user:",z),B({title:"Error",description:z.message||"Failed to delete user",variant:"destructive"})}finally{C(!1),k(null)}},re=async z=>{R(z);try{const X=t.find(Ee=>Ee.user_id===z);if(!X)throw new Error("User not found");if(!X.profiles?.email)throw new Error("User email not found");const{data:U,error:me}=await Z.functions.invoke("generate-magic-link",{body:{email:X.profiles.email,userId:z}});if(me)throw me;if(!U?.signupUrl)throw new Error("Failed to generate signup link");const{error:ge}
72=await Z.functions.invoke("send-user-invitation",{body:{firstName:X.user_profile?.first_name||"User",userEmail:X.profiles.email,signupUrl:U.signupUrl}});if(ge)throw ge;B({title:"Success",description:"Invitation email resent successfully"})}catch(X){console.error("Error resending invitation:",X),B({title:"Error",description:X.message||"Failed to resend invitation",variant:"destructive"})}finally{R(null)}},ue=async(z,X)=>{$(z);try{const{error:U}=await Z.from("profiles").update({approval_status:X}).eq("user_id",z);if(U)throw U;B({title:"Success",description:`User ${X==="approved"?"approved":"rejected"} successfully`}),se()}catch(U){console.error("Error updating approval status:",U),B({title:"Error",description:U.message||"Failed to update approval status",variant:"destructive"})}finally{$(null)}},Y=async(z,X)=>{te(!0);try{const{error:U}=await Z.from("user_roles").update({role:X}).eq("user_id",z);if(U)throw U;B({title:"Success",description:"User role updated successfully"}),F(null),se()}catch(U){console.error("Error updating role:",U),B({title:"Error",description:U.message||"Failed to update role",variant:"destructive"})}finally{te(!1)}};return r?c.jsx("div",{className:"flex items-center justify-center py-12",children:c.jsx(tt,{className:"h-8 w-8 animate-spin"})}):c.jsxs("div",{className:"space-y-6",children:[c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{children:"Invite New User"})}),c.jsxs(be,{children:[c.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[c.jsxs("div",{children:[c.jsx(ne,{htmlFor:"firstName",children:"First Name *"}),c.jsx(fe,{id:"firstName",placeholder:"John",value:o,onChange:z=>s(z.target.value)})]}),c.jsxs("div",{children:[c.jsx(ne,{htmlFor:"lastName",children:"Last Name"}),c.jsx(fe,{id:"lastName",placeholder:"Doe",value:l,onChange:z=>u(z.target.value)})]}),c.jsxs("div",{children:[c.jsx(ne,{htmlFor:"jobTitle",children:"Job Title"}),c.jsx(fe,{id:"jobTitle",placeholder:"Sales Manager",value:d,onChange:z=>f(z.target.value)})]}),c.jsxs("div",{children:[c.jsx(ne,{htmlFor:"phone",children:"WhatsApp Phone"}),c.jsx(b0,{defaultCountry:"ch",value:h,onChange:z=>p(z),inputClassName:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
72ing-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",countrySelectorStyleProps:{buttonClassName:"border border-input bg-background hover:bg-accent rounded-l-md"}})]}),c.jsxs("div",{className:"col-span-2",children:[c.jsx(ne,{htmlFor:"avatar",children:"Avatar"}),c.jsx(fe,{id:"avatar",type:"file",accept:"image/*",onChange:z=>g(z.target.files?.[0]||null)})]})]}),c.jsxs("div",{className:"flex gap-4 items-start",children:[c.jsxs("div",{className:"flex-1 space-y-2",children:[c.jsx(ne,{htmlFor:"email",children:"Email Address *"}),c.jsx(fe,{id:"email",type:"email",placeholder:"[email protected]",value:i,onChange:z=>a(z.target.value)}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(j4,{id:"useEmailAsSender",checked:w,onCheckedChange:z=>_(z===!0)}),c.jsx(ne,{htmlFor:"useEmailAsSender",className:"text-sm font-normal cursor-pointer",children:"Use as sender email"})]}),!w&&c.jsxs("div",{className:"pt-1",children:[c.jsx(ne,{htmlFor:"senderEmail",children:"Sender Email"}),c.jsx(fe,{id:"senderEmail",type:"email",placeholder:"[email protected]",value:j,onChange:z=>b(z.target.value)})]})]}),c.jsxs("div",{className:"w-40",children:[c.jsx(ne,{htmlFor:"role",children:"Role"}),c.jsxs(Ht,{value:v,onValueChange:z=>y(z),children:[c.jsx(It,{id:"role",className:"bg-background",children:c.jsx(Wt,{})}),c.jsxs($t,{className:"bg-background z-50",children:[c.jsx(pe,{value:"admin",children:"Admin"}),c.jsx(pe,{value:"business_developer",children:"Business Developer"}),c.jsx(pe,{value:"user",children:"User"})]})]})]}),c.jsx("div",{className:"flex items-start pt-6",children:c.jsxs(oe,{onClick:Q,disabled:O,children:[O?c.jsx(tt,{className:"h-4 w-4 animate-spin mr-2"}):c.jsx(rB,{className:"h-4 w-4 mr-2"}),"Invite"]})})]})]})]}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{children:"Users"})}),c.jsx(be,{children:t.length===0?c.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No users found"}):c.jsxs(Vo,{children:[c.jsx(Ko,{children:c.jsxs(an,{children:[c.jsx($e,{className:"w-14"}),c.jsx($e,{className:"w-10 text-center"}),c.jsx($e,{children:"First Name"}),c.jsx($e,{children:"Last Name"}),c.jsx($e,{children:"Sender Email"}),c.jsx($e,{children:"Job Title"}),c.jsx($e,{children:"Phone"}),c.jsx($e,{children:"Role"}),c.jsx($e,{children:"Status"}),c.jsx($e,{children:"Added"}),c.jsx($e,{className:"text-right",children:"Actions"})]})}),c.jsx(Go,{children:t.map(z=>c.jsxs(an,{children:[c.jsx(Re,{children:c.jsxs(ute,{children:[c.jsx(dte,{asChild:!0,children:c.jsxs(qE,{className:"cursor-pointer",children:[c.jsx(UE,{src:z.user_profile?.avatar_url}),c.jsx(HE,{children:z.profiles?.email?.charAt(0).toUpperCase()})]})}),c.jsx(BR,{className:"w-auto",children:c.jsx("p",{className:"text-sm",children:z.profiles?.email})})]})}),c.jsx(Re,{className:"text-center",children:c.jsx("div",{className:"flex items-center justify-center gap-1",children:(Array.isArray(z.auth_provider)?z.auth_provider:[z.auth_provider||"email"]).map((X,U)=>c.jsxs("span",{className:"flex items-center gap-1",children:[U>0&&c.jsx("span",{className:"text-muted-foreground",children:"/"}),X==="azure"?c.jsx("span",{title:"Microsoft",children:c.jsxs("svg",{className:"h-4 w-4 inline-block",viewBox:"0 0 21 21",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("rect",{x:"1",y:"1",width:"9",height:"9",fill:"#f25022"}),c.jsx("rect",{x:"11",y:"1",width:"9",height:"9",fill:"#7fba00"}),c.jsx("rect",{x:"1",y:"11",width:"9",height:"9",fill:"#00a4ef"}),c.jsx("rect",{x:"11",y:"11",width:"9",height:"9",fill:"#ffb900"})]})}):X==="google"?c.jsx("span",{title:"Google",children:c.jsxs("svg",{className:"h-4 w-4 inline-block",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),c.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),c.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),c.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]})}):c.jsx("span",{title:"Email",className:"text-muted-foreground",children:c.jsx(In,{className:"h-4 w-4 inline-block"})})]},X))})}),c.jsx(Re,{children:c.jsx("span",{children:z.user_profile?.first_name||"-"})}),c.jsx(Re,{children:c.jsx("span",{children:z.user_profile?.last_name||"-"})}),c.jsx(Re,{children:c.jsx("span",{children:z.user_profile?.sender_email||"-"})}),c.jsx(Re,{children:c.jsx("span",{children:z.user_profile?.job_title||"-"})}),c.jsx(Re,{children:c.jsx("span",{children:z.user_profile?.whatsapp_phone||"-"})}),c.jsx(Re,{children:G&&z.role!=="super_admin"&&A===z.user_id?c.jsxs(Ht,{defaultValue:z.role,onValueChange:X=>Y(z.user_id,X),disabled:V,children:[c.jsx(It,{className:"h-8 w-[160px]",children:c.jsx(Wt,{})}),c.jsxs($t,{children:[c.jsx(pe,{value:"admin",children:"Admin"}),c.jsx(pe,{value:"business_developer",children:"Business Developer"}),c.jsx(pe,{value:"user",children:"User"})]})]}):c.jsxs("div",{className:`inline-flex items-center gap-1 ${G&&z.role!=="super_admin"?"curs
72or-pointer hover:opacity-80":""}`,onClick:()=>{G&&z.role!=="super_admin"&&F(z.user_id)},title:G&&z.role!=="super_admin"?"Click to change role":void 0,children:[c.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${z.role==="super_admin"?"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200":z.role==="admin"?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200":z.role==="business_developer"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200"}`,children:z.role==="super_admin"?"Super Admin":z.role==="business_developer"?"Business Developer":z.role.charAt(0).toUpperCase()+z.role.slice(1)}),G&&z.role!=="super_admin"&&c.jsx(Tl,{className:"h-3 w-3 text-muted-foreground"})]})}),c.jsx(Re,{children:z.user_profile?.approval_status==="pending"?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-warning/20 text-warning",children:"Pending"}),G&&c.jsxs("div",{className:"flex gap-1 ml-1",children:[c.jsx(oe,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>ue(z.user_id,"approved"),disabled:I===z.user_id,title:"Approve",children:I===z.user_id?c.jsx(tt,{className:"h-3 w-3 animate-spin"}):c.jsx($n,{className:"h-3 w-3 text-green-600"})}),c.jsx(oe,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>ue(z.user_id,"rejected"),disabled:I===z.user_id,title:"Reject",children:c.jsx(zE,{className:"h-3 w-3 text-destructive"})})]})]}):z.user_profile?.approval_status==="rejected"?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-destructive/20 text-destructive",children:"Rejected"}),G&&c.jsx(oe,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 ml-1",onClick:()=>ue(z.user_id,"approved"),disabled:I===z.user_id,title:"Approve",children:I===z.user_id?c.jsx(tt,{className:"h-3 w-3 animate-spin"}):c.jsx($n,{className:"h-3 w-3 text-green-600"})})]}):c.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",children:"Approved"})}),c.jsx(Re,{children:new Date(z.created_at).toLocaleDateString()}),c.jsx(Re,{className:"text-right",children:c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>re(z.user_id),disabled:L===z.user_id||z.email_confirmed,title:z.email_confirmed?"User already active":"Resend Invite",className:z.email_confirmed?"opacity-30 cursor-not-allowed":"",children:L===z.user_id?c.jsx(tt,{className:"h-4 w-4 animate-spin"}):c.jsx(In,{className:`h-4 w-4 ${z.email_confirmed?"text-muted-foreground":""}`})}),c.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>E(z),title:"Edit Profile",children:c.jsx(Tl,{className:"h-4 w-4"})}),G&&c.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>{z.role!=="super_admin"&&(k(z.user_id),C(!0))},disabled:z.role==="super_admin",title:z.role==="super_admin"?"Cannot delete super admin":"Delete User",className:z.role==="super_admin"?"opacity-30 cursor-not-allowed":"",children:c.jsx(Ma,{className:`h-4 w-4 ${z.role==="super_admin"?"text-muted-foreground":"text-destructive"}`})})]})})]},z.id))})]})})]}),M&&c.jsx(ete,{isOpen:!!M,onClose:()=>E(null),userId:M.user_id,userEmail:M.profiles?.email||"",userProfile:M.user_profile||{first_name:"",last_name:"",job_title:"",whatsapp_phone:"",avatar_url:"",sender_email:""},onSaved:se}),c.jsx(dx,{open:N,onOpenChange:C,children:c.jsxs(Vu,{children:[c.jsxs(Ku,{children:[c.jsx(Yu,{children:"Are you sure?"}),c.jsx(Xu,{children:"This will permanently delete this user and remove their access to the system. This action cannot be undone."})]}),c.jsxs(Gu,{children:[c.jsx(Zu,{children:"Cancel"}),c.jsx(Ju,{onClick:ye,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})},hte=()=>{const[t,e]=x.useState([]),[r,n]=x.useState([]),[i,a]=x.useState(!0),[o,s]=x.useState("website"),[l,u]=x.useState(null),{toast:d}=Pr();x.useEffect(()=>{f(),h();const j=Z.channel("clients-changes").on("postgres_changes",{event:"INSERT",schema:"public",table:"clients"},O=>{console.log("New enquiry received:",O),e(S=>[O.new,...S])}).subscribe(),b=Z.channel("extensions-changes").on("postgres_changes",{event:"*",schema:"public",table:"extension_requests"},()=>{h()}).subscribe();return()=>{Z.removeChannel(j),Z.removeChannel(b)}},[]);const f=async()=>{try{a(!0);const{data:j,error:b}=await Z.from("clients").select("*").order("created_at",{ascending:!1});if(b)throw b;e(j||[])}catch(j){console.error("Error fetching clients:",j),d({title:"Error",description:"Failed to fetch enquiries",variant:"destructive"})}finally{a(!1)}},h=async()=>{try{const{data:j,error:b}=await Z.from("extension_requests").select("*").order("requested_at",{ascending:!1});if(b)throw b;n(j||[])}catch(j){console.error("Error fetching extension requests:",j)}},p=async(j,b,O)=>{u(j);try{if(O){const N=new Date(Date.now()+864e5),{error:C}=await Z.from("orders").update({status:"draft",validity_date:N.toISOString().split("T")[0]}).eq("id",b);if(C)throw C}const{error:S}=await Z.from("extension_requests").update({status:O?"approved":"rejected",processed_at:new Date().toISOString()}).eq("id",j);if(S)throw S;d({title:"Success",description:O?"Extension approved and order reactivated for 24 hours":"Extension request rejected"}),h()}catch(S){console.error("Error processing extension request:",S),d({title:"Error",description:"Failed to process extension request",variant:"destructive"})}finally{u(null)}};if(i)return c.jsx("div",{className:"flex items-center justify-center py-8",children:c.jsx(tt,{className:"h-8 w-8 animate-spin"})});const m=t.filter(j=>j.source===o),g=t.filter(j=>j.source==="website").length,v=t.filter(j=>j.source==="order_form").length,y=r.filter(j=>j.status==="pending").length,w=j=>j.length===0?c.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No enquiries yet"}):c.jsx("div",{className:"overflow-x-auto",children:c.jsxs(Vo,{children:[c.jsx(Ko,{children:c.jsxs(an,{children:[c.jsx($e,{children:"Contact Name"}),c.jsx($e,{children:"Company"}),c.jsx($e,{children:"Email"}),c.jsx($e,{children:"Phone"}),c.jsx($e,{children:"Business Type"}),c.jsx($e,{children:"Source"}),c.jsx($e,{children:"Received"})]})}),c.jsx(Go,{children:j.map(b=>c.jsxs(an,{children:[c.jsxs(Re,{className:"font-medium",children:[b.first_name," ",b.last_name||""]}),c.jsx(Re,{children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(I4,{className:"h-4 w-4 text-muted-foreground"}),b.company_name]})}),c.jsx(Re,{children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(In,{className:"h-4 w-4 text-muted-foreground"}),c.jsx("a",{href:`mailto:${b.email}`,className:"text-primary hover:underline",children:b.email})]})}),c.jsx(Re,{children:b.phone?c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(FE,{className:"h-4 w-4 text-muted-foreground"}),c.jsx("a",{href:`tel:${b.phone}`,className:"text-primary hover:underline",children:b.phone})]}):c.jsx("span",{className:"text-muted-foreground",children:"-"})}),c.jsx(Re,{children:c.jsx(Ye,{variant:"secondary",children:b.business_type==="str"?"Short-term Rental":"Hotel"})}),c.jsx(Re,{children:c.jsx(Ye,{variant:b.source==="website"?"default":"outline",children:b.source==="website"?c.jsxs(c.Fragment,{children:[c.jsx(Jy,{
72className:"h-3 w-3 mr-1"}),"Website"]}):c.jsxs(c.Fragment,{children:[c.jsx(Uu,{className:"h-3 w-3 mr-1"}),"Order Form"]})})}),c.jsx(Re,{children:c.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[c.jsx(oi,{className:"h-4 w-4"}),dp(new Date(b.created_at),{addSuffix:!0})]})})]},b.id))})]})}),_=()=>r.length===0?c.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No extension requests yet"}):c.jsx("div",{className:"overflow-x-auto",children:c.jsxs(Vo,{children:[c.jsx(Ko,{children:c.jsxs(an,{children:[c.jsx($e,{children:"Client"}),c.jsx($e,{children:"Email"}),c.jsx($e,{children:"Type"}),c.jsx($e,{children:"Status"}),c.jsx($e,{children:"Requested"}),c.jsx($e,{children:"Actions"})]})}),c.jsx(Go,{children:r.map(j=>c.jsxs(an,{children:[c.jsx(Re,{className:"font-medium",children:j.client_name}),c.jsx(Re,{children:c.jsx("a",{href:`mailto:${j.client_email}`,className:"text-primary hover:underline",children:j.client_email})}),c.jsx(Re,{children:c.jsx(Ye,{variant:j.request_type==="auto"?"secondary":"outline",children:j.request_type==="auto"?"Auto":"Manual"})}),c.jsx(Re,{children:c.jsx(Ye,{variant:j.status==="pending"?"default":j.status==="approved"?"secondary":"destructive",className:j.status==="approved"?"bg-green-600 hover:bg-green-700":"",children:j.status.charAt(0).toUpperCase()+j.status.slice(1)})}),c.jsx(Re,{children:c.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[c.jsx(oi,{className:"h-4 w-4"}),dp(new Date(j.requested_at),{addSuffix:!0})]})}),c.jsx(Re,{children:j.status==="pending"?c.jsxs("div",{className:"flex gap-2",children:[c.jsx(oe,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50",onClick:()=>p(j.id,j.order_id,!0),disabled:l===j.id,children:l===j.id?c.jsx(tt,{className:"h-4 w-4 animate-spin"}):c.jsx($n,{className:"h-4 w-4"})}),c.jsx(oe,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>p(j.id,j.order_id,!1),disabled:l===j.id,children:c.jsx(UL,{className:"h-4 w-4"})})]}):c.jsx("span",{className:"text-sm text-muted-foreground",children:j.processed_at?dp(new Date(j.processed_at),{addSuffix:!0}):"-"})})]},j.id))})]})});return c.jsxs(ve,{children:[c.jsxs(Ce,{children:[c.jsx(ze,{children:"Client Enquiries"}),c.jsxs(Fu,{children:["All signup enquiries from potential clients (",t.length," total)"]})]}),c.jsx(be,{children:c.jsxs(Nc,{value:o,onValueChange:s,children:[c.jsxs(Ps,{children:[c.jsxs(gt,{value:"website",children:[c.jsx(Jy,{className:"h-4 w-4 mr-2"}),"Website",c.jsx(Ye,{variant:"outline",className:"ml-2 bg-background",children:g})]}),c.jsxs(gt,{value:"order_form",children:[c.jsx(Uu,{className:"h-4 w-4 mr-2"}),"Order Form",c.jsx(Ye,{variant:"outline",className:"ml-2 bg-background",children:v})]}),c.jsxs(gt,{value:"extensions",children:[c.jsx(Pl,{className:"h-4 w-4 mr-2"}),"Extension Requests",y>0&&c.jsx(Ye,{className:"ml-2 bg-amber-600 hover:bg-amber-700 text-white",children:y})]})]}),c.jsx(vt,{value:"website",className:"mt-6",children:w(m)}),c.jsx(vt,{value:"order_form",className:"mt-6",children:w(m)}),c.jsx(vt,{value:"extensions",className:"mt-6",children:_()})]})})]})};function pte({className:t,...e}){return c.jsx("div",{className:le("animate-pulse rounded-md bg-muted",t),...e})}const mte=()=>{const{toast:t}=Pr(),[e,r]=x.useState([]),[n,i]=x.useState(!0);x.useEffect(()=>{a();const l=et.channel("candidates_changes").on("postgres_changes",{event:"*",schema:"public",table:"candidates"},()=>a()).subscribe();return()=>{l.unsubscribe()}},[]);const a=async()=>{try{const{data:l,error:u}=await et.from("candidates").select("*").order("created_at",{ascending:!1});if(u)throw u;r(l||[])}catch(l){console.error("Error fetching candidates:",l),t({title:"Failed to load candidates",variant:"destructive"})}finally{i(!1)}},o=async(l,u)=>{try{const{error:d}=await et.from("candidates").update({status:u}).eq("id",l);if(d)throw d;t({title:"Status updated successfully"})}catch(d){console.error("Error updating status:",d),t({title:"Failed to update status",variant:"destructive"})}},s=async l=>{try{const u=l.split("/cvs/");if(u.length<2)throw new Error("Invalid CV URL");const d=u[1],{data:f,error:h}=await et.storage.from("cvs").createSignedUrl(d,60);if(h)throw h;if(!f?.signedUrl)throw new Error("Failed to generate signed URL");window.open(f.signedUrl,"_blank")}catch(u){console.error("Error viewing CV:",u),t({title:"Failed to view CV",de
72scription:"Unable to access the CV file",variant:"destructive"})}};return n?c.jsx("div",{className:"space-y-4",children:[1,2,3].map(l=>c.jsx(ve,{children:c.jsx(be,{className:"pt-6",children:c.jsx(pte,{className:"h-32 w-full"})})},l))}):c.jsxs("div",{className:"space-y-6",children:[c.jsx("div",{className:"flex items-center justify-between",children:c.jsxs("h2",{className:"text-2xl font-bold",children:["Candidates (",e.length,")"]})}),e.length===0?c.jsx(ve,{children:c.jsx(be,{className:"pt-6 text-center text-muted-foreground",children:"No candidates yet"})}):c.jsx("div",{className:"space-y-4",children:e.map(l=>c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsxs("div",{className:"flex items-start justify-between",children:[c.jsxs("div",{children:[c.jsxs(ze,{className:"text-xl",children:[l.first_name," ",l.last_name]}),l.current_position&&c.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[l.current_position,l.years_of_experience&&` ⢠${l.years_of_experience} years exp.`]})]}),c.jsx(Ye,{variant:l.status==="new"?"default":"secondary",children:l.status})]})}),c.jsxs(be,{className:"space-y-4",children:[c.jsxs("div",{className:"flex flex-wrap gap-4 text-sm",children:[c.jsxs("a",{href:`mailto:${l.email}`,className:"flex items-center gap-1 text-primary hover:underline",children:[c.jsx(In,{className:"h-4 w-4"}),l.email]}),l.phone&&c.jsxs("a",{href:`tel:${l.phone}`,className:"flex items-center gap-1 text-primary hover:underline",children:[c.jsx(FE,{className:"h-4 w-4"}),l.phone]}),l.linkedin_url&&c.jsxs("a",{href:l.linkedin_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-primary hover:underline",children:[c.jsx(N4,{className:"h-4 w-4"}),"LinkedIn"]})]}),l.summary&&c.jsx("p",{className:"text-sm text-muted-foreground",children:l.summary}),l.skills&&l.skills.length>0&&c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-medium mb-2",children:"Skills:"}),c.jsx("div",{className:"flex flex-wrap gap-2",children:l.skills.map((u,d)=>c.jsx(Ye,{variant:"outline",children:u},d))})]}),l.education&&c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-medium",children:"Education:"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:l.education})]}),c.jsxs("div",{className:"flex flex-wrap gap-2 pt-4 border-t",children:[c.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>s(l.cv_file_url),children:[c.jsx(Oc,{className:"h-4 w-4 mr-1"}),"View CV"]}),l.status==="new"&&c.jsxs(c.Fragment,{children:[c.jsx(oe,{variant:"default",size:"sm",onClick:()=>o(l.id,"interview"),children:"Schedule Interview"}),c.jsx(oe,{variant:"outline",size:"sm",onClick:()=>o(l.id,"rejected"),children:"Reject"})]}),l.status==="interview"&&c.jsxs(c.Fragment,{children:[c.jsx(oe,{variant:"default",size:"sm",onClick:()=>o(l.id,"hired"),children:"Mark as Hired"}),c.jsx(oe,{variant:"outline",size:"sm",onClick:()=>o(l.id,"rejected"),children:"Reject"})]})]}),c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Applied: ",new Date(l.created_at).toLocaleDateString()]})]})]},l.id))})]})};function gte(t,e=[]){let r=[];function n(a,o){const s=x.createContext(o);s.displayName=a+"Context";const l=r.length;r=[...r,o];const u=f=>{const{scope:h,children:p,...m}=f,g=h?.[t]?.[l]||s,v=x.useMemo(()=>m,Object.values(m));return c.jsx(g.Provider,{value:v,children:p})};u.displayName=a+"Provider";function d(f,h){const p=h?.[t]?.[l]||s,m=x.useContext(p);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[u,d]}const i=()=>{const a=r.map(o=>x.createContext(o));return function(s){const l=s?.[t]||a;return x.useMemo(()=>({[`__scope${t}`]:{...s,[t]:l}}),[s,l])}};return i.scopeName=t,[n,vte(i,...e)]}function vte(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const o=n.reduce((s,{useScope:l,scopeName:u})=>{const f=l(a)[`__scope${u}`];return{...s,...f}},{});return x.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}var yte=Symbol.for("react.lazy"),tf=HL[" use ".trim().toString()];function xte(t){return typeof t=="object"&&t!==null&&"then"in t}function FR(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===yte&&"_payload"in t&&xte(t._payload)}function bte(t){const e=wte(t),r=x.forwardRef((n,i)=>{let{children:a,...o}=n;FR(a)&&typeof tf=="function"&&(a=tf(a._payload));
72const s=x.Children.toArray(a),l=s.find(Ste);if(l){const u=l.props.children,d=s.map(f=>f===l?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:f);return c.jsx(e,{...o,ref:i,children:x.isValidElement(u)?x.cloneElement(u,void 0,d):null})}return c.jsx(e,{...o,ref:i,children:a})});return r.displayName=`${t}.Slot`,r}function wte(t){const e=x.forwardRef((r,n)=>{let{children:i,...a}=r;if(FR(i)&&typeof tf=="function"&&(i=tf(i._payload)),x.isValidElement(i)){const o=Ote(i),s=jte(a,i.props);return i.type!==x.Fragment&&(s.ref=n?Uo(n,o):o),x.cloneElement(i,s)}return x.Children.count(i)>1?x.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var _te=Symbol("radix.slottable");function Ste(t){return x.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===_te}function jte(t,e){const r={...e};for(const n in e){const i=t[n],a=e[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...s)=>{const l=a(...s);return i(...s),l}:i&&(r[n]=i):n==="style"?r[n]={...i,...a}:n==="className"&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...t,...r}}function Ote(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Nte=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],zR=Nte.reduce((t,e)=>{const r=bte(`Primitive.${e}`),n=x.forwardRef((i,a)=>{const{asChild:o,...s}=i,l=o?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...s,ref:a})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{}),Kw="Progress",Gw=100,[Cte]=gte(Kw),[kte,Ate]=Cte(Kw),qR=x.forwardRef((t,e)=>{const{__scopeProgress:r,value:n=null,max:i,getValueLabel:a=Ete,...o}=t;(i||i===0)&&!Uk(i)&&console.error(Pte(`${i}`,"Progress"));const s=Uk(i)?i:Gw;n!==null&&!Hk(n,s)&&console.error(Tte(`${n}`,"Progress"));const l=Hk(n,s)?n:null,u=rf(l)?a(l,s):void 0;return c.jsx(kte,{scope:r,value:l,max:s,children:c.jsx(zR.div,{"aria-valuemax":s,"aria-valuemin":0,"aria-valuenow":rf(l)?l:void 0,"aria-valuetext":u,role:"progressbar","data-state":WR(l,s),"data-value":l??void 0,"data-max":s,...o,ref:e})})});qR.displayName=Kw;var UR="ProgressIndicator",HR=x.forwardRef((t,e)=>{const{__scopeProgress:r,...n}=t,i=Ate(UR,r);return c.jsx(zR.div,{"data-state":WR(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...n,ref:e})});HR.displayName=UR;function Ete(t,e){return`${Math.round(t/e*100)}%`}function WR(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function rf(t){return typeof t=="number"}function Uk(t){return rf(t)&&!isNaN(t)&&t>0}function Hk(t,e){return rf(t)&&!isNaN(t)&&t<=e&&t>=0}function Pte(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Gw}\`.`}function Tte(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: 73 - a positive number 74 - less than the value passed to \`max\` (or ${Gw} if no \`max\` prop is set) 75 - \`null\` or \`undefined\` if the progress is indeterminate. 76 77Defaulting to \`null\`.`}var VR=qR,Mte=HR;const KR=x.forwardRef(({className:t,value:e,...r},n)=>c.jsx(VR,{ref:n,className:le("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...r,children:c.jsx(Mte,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));KR.displayName=VR.displayName;const Dte=()=>{const[t,e]=x.useState([]),[r,n]=x.useState(!0),[i,a]=x.useState(!1),[o,s]=x.useState(0),{toast:l}=Pr(),[u,d]=x.useState({content_type:"demo_video",language:"en",title:"",description:"",display_order:0,is_active:!0}),[f,h]=x.useState(null);x.useEffect(()=>{p()},[]);const p=async()=>{try{const{data:_,error:j}=await et.from("website_content").select("*").order("display_order",{ascending:!0});if(j)throw j;e(_||[])}catch(_){l({title:"Error",description:_.message,variant:"destructive"})}finally{n(!1)}},m=_=>{const j=_.target.files?.[0];if(j){if(j.size>200*1024*1024){l({title:"File too large",description:"Please select a video file smaller than 200MB",variant:"destructive"});return}h(j)}},g=async _=>{const j=_.name.split(".").pop(),O=`videos/${`${Date.now()}-${Math.random().toString(36).substring(7)}.${j}`}`,{error:S}=await et.storage.from("videos").upload(O,_,{cacheControl:"3600",upsert:!1});if(S)throw S;const{data:{publicUrl:N}}=et.storage.from("videos").getPublicUrl(O);return N},v=async _=>{if(_.preventDefault(),!f){l({title:"Error",description:"Please select a video file",variant:"destructive"});return}a(!0),s(0);try{const j=setInterval(()=>{s(N=>Math.min(N+10,90))},500),b=await g(f);clearInterval(j),s(95);const{data:{user:O}}=await et.auth.getUser(),{error:S}=await et.from("website_content").insert({...u,video_url:b,created_by:O?.id,updated_by:O?.id});if(S)throw S;s(100),l({title:"Success",description:"Video uploaded successfully"}),d({content_type:"demo_video",language:"en",title:"",description:"",display_order:0,is_active:!0}),h(null),s(0),p()}catch(j){l({title:"Error",description:j.message,variant:"destructive"})}finally{a(!1)}},y=async(_,j)=>{try{const{data:{user:b}}=await et.auth.getUser(),{error:O}=await et.from("website_content").update({is_active:!j,updated_by:b?.id}).eq("id",_);if(O)throw O;l({title:"Success",description:`Video ${j?"deactivated":"activated"}`}),p()}catch(b){l({title:"Error",description:b.message,variant:"destructive"})}},w=async(_,j)=>{if(confirm("Are you sure you want to delete this video?"))try{const b=j.split("/videos/");if(b.length>1){const S=`videos/${b[1]}`;await et.storage.from("videos").remove([S])}const{error:O}=await et.from("website_content").delete().eq("id",_);if(O)throw O;l({title:"Success",description:"Video deleted successfully"}),p()}catch(b){l({title:"Error",description:b.message,variant:"destructive"})}};return r?c.jsx("div",{className:"flex items-center justify-center p-12",children:c.jsx(tt,{className:"w-8 h-8 animate-spin"})}):c.jsxs("div",{className:"space-y-6",children:[c.jsxs(ve,{children:[c.jsxs(Ce,{children:[c.jsx(ze,{children:"Upload New Video"}),c.jsx(Fu,{children:"Upload demo videos and other website content. Max file size: 200MB"})]}),c.jsx(be,{children:c.jsxs("form",{onSubmit:v,className:"space-y-4",children:[c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{htmlFor:"content_type",children:"Content Type"}),c.jsxs(Ht,{value:u.content_type,onValueChange:_=>d({...u,content_type:_}),children:[c.jsx(It,{children:c.jsx(Wt,{})}),c.jsxs($t,{children:[c.jsx(pe,{value:"demo_video",children:"Demo Video"}),c.jsx(pe,{value:"tutorial",children:"Tutorial"}),c.jsx(pe,{value:"testimonial",children:"Testimonial"})]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{htmlFor:"language",children:"Language"}),c.jsxs(Ht,{value:u.language,onValueChange:_=>d({...u,language:_}),children:[c.jsx(It,{children:c.jsx(Wt,{})}),c.jsxs($t,{children:[c.jsx(pe,{value:"en",children:"English"}),c.jsx(pe,{value:"fr",children:"Français"}),c.jsx(pe,{value:"de",children:"Deutsch"}),c.jsx(pe,{value:"it",children:"Italiano"})]})]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{htmlFor:"title",children:"Title"}),c.jsx(fe,{id:"title",value:u.title,onChange:_=>d({...u,title:_.target.value}),required:!0})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{htmlFor:"description",children:"Description"}),c.jsx(zn,{id:"description",value:u.description,onChange:_=>d({...u,description:_.target.value}),rows:3})]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{htmlFor:"display_order",children:"Display Order"}),c.jsx(fe,{id:"display_order",type:"number",value:u.display_order,onChange:_=>d({...u,display_order:parseInt(_.target.value)})})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{htmlFor:"is_active",children:"Active"}),c.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[c.jsx(v0,{id:"is_active",checked:u.is_active,onCheckedChange:_=>d({...u,is_active:_})}),c.jsx(ne,{htmlFor:"is_active",className:"font-normal",children:u.is_active?"Active":"Inactive"})]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{htmlFor:"video",children:"Video File"}),c.jsx(fe,{id:"video",type:"file",accept:"video/*",onChange:m,disabled:i}),f&&c.jsxs("p",{className:"text-sm text-muted-foreground",children:["Selected: ",f.name," (",(f.size/1024/1024).toFixed(2)," MB)"]})]}),i&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(KR,{value:o}),c.jsxs("p",{className:"text-sm text-muted-foreground text-center",children:["Uploading... ",o,"%"]})]}),c.jsx(oe,{type:"submit",disabled:i||!f,children:i?c.jsxs(c.Fragment,{children:[c.jsx(tt,{className:"w-4 h-4 mr-2 animate-spin"}),"Uploading..."]}):c.jsxs(c.Fragment,{children:[c.jsx(WE,{className:"w-4 h-4 mr-2"}),"Upload Video"]})})]})})]}),c.jsxs(ve,{children:[c.jsxs(Ce,{children:[c.jsx(ze,{children:"Existing Content"}),c.jsx(Fu,{children:"Manage your uploaded videos and website content"})]}),c.jsx(be,{children:c.jsx("div",{className:"space-y-4",children:t.length===0?c.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No content uploaded yet"}):t.map(_=>c.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[c.jsxs("div",{className:"flex-1",children:[c.jsx("h3",{className:"font-semibold",children:_.title}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:[_.content_type," ⢠",_.language.toUpperCase()," ⢠Order: ",_.display_order]}),_.description&&c.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:_.description})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>y(_.id,_.is_active),children:_.is_active?c.jsx(fl,{className:"w-4 h-4"}):c.jsx(KE,{className:"w-4 h-4"})}),c.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>w(_.id,_.video_url),children:c.jsx(Ma,{className:"w-4 h-4"})})]})]},_.id))})})]})]})};function tr(t){this.content=t}tr.prototype={constructor:tr,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,r){var n=r&&r!=t?this.remove(r):this,i=n.find(t),a=n.content.slice();return i==-1?a.push(r||t,e):(a[i+1]=e,r&&(a[i]=r)),new tr(a)},remove:function(t){var e=this.find(t);if(e==-1)return this;var r=this.content.slice();return r.splice(e,2),new tr(r)},addToStart:function(t,e){return new tr([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var r=this.remove(t).content.slice();return r.push(t,e),new tr(r)},addBefore:function(t,e,r){var n=this.remove(e),i=n.content.slice(),a=n.find(t);return i.splice(a==-1?i.length:a,0,e,r),new tr(i)}
vendor: 13,220 bytes, line 77
77,forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=tr.from(t),t.size?new tr(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=tr.from(t),t.size?new tr(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=tr.from(t);for(var r=0;r<t.content.length;r+=2)e=e.remove(t.content[r]);return e},toObject:function(){var t={};return this.forEach(function(e,r){t[e]=r}),t},get size(){return this.content.length>>1}};tr.from=function(t){if(t instanceof tr)return t;var e=[];if(t)for(var r in t)e.push(r,t[r]);return new tr(e)};function GR(t,e,r){for(let n=0;;n++){if(n==t.childCount||n==e.childCount)return t.childCount==e.childCount?null:r;let i=t.child(n),a=e.child(n);if(i==a){r+=i.nodeSize;continue}if(!i.sameMarkup(a))return r;if(i.isText&&i.text!=a.text){for(let o=0;i.text[o]==a.text[o];o++)r++;return r}if(i.content.size||a.content.size){let o=GR(i.content,a.content,r+1);if(o!=null)return o}r+=i.nodeSize}}function YR(t,e,r,n){for(let i=t.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:r,b:n};let o=t.child(--i),s=e.child(--a),l=o.nodeSize;if(o==s){r-=l,n-=l;continue}if(!o.sameMarkup(s))return{a:r,b:n};if(o.isText&&o.text!=s.text){let u=0,d=Math.min(o.text.length,s.text.length);for(;u<d&&o.text[o.text.length-u-1]==s.text[s.text.length-u-1];)u++,r--,n--;return{a:r,b:n}}if(o.content.size||s.content.size){let u=YR(o.content,s.content,r-1,n-1);if(u)return u}r-=l,n-=l}}class J{constructor(e,r){if(this.content=e,this.size=r||0,r==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,r,n,i=0,a){for(let o=0,s=0;s<r;o++){let l=this.content[o],u=s+l.nodeSize;if(u>e&&n(l,i+s,a||null,o)!==!1&&l.content.size){let d=s+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,r-d),n,i+d)}s=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,r,n,i){let a="",o=!0;return this.nodesBetween(e,r,(s,l)=>{let u=s.isText?s.text.slice(Math.max(e,l)-l,r-l):s.isLeaf?i?typeof i=="function"?i(s):i:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&u||s.isTextblock)&&n&&(o?o=!1:a+=n),a+=u},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let r=this.lastChild,n=e.firstChild,i=this.content.slice(),a=0;for(r.isText&&r.sameMarkup(n)&&(i[i.length-1]=r.withText(r.text+n.text),a=1);a<e.content.length;a++)i.push(e.content[a]);return new J(i,this.size+e.size)}cut(e,r=this.size){if(e==0&&r==this.size)return this;let n=[],i=0;if(r>e)for(let a=0,o=0;o<r;a++){let s=this.content[a],l=o+s.nodeSize;l>e&&((o<e||l>r)&&(s.isText?s=s.cut(Math.max(0,e-o),Math.min(s.text.length,r-o)):s=s.cut(Math.max(0,e-o-1),Math.min(s.content.size,r-o-1))),n.push(s),i+=s.nodeSize),o=l}return new J(n,i)}cutByIndex(e,r){return e==r?J.empty:e==0&&r==this.content.length?this:new J(this.content.slice(e,r))}replaceChild(e,r){let n=this.content[e];if(n==r)return this;let i=this.content.slice(),a=this.size+r.nodeSize-n.nodeSize;return i[e]=r,new J(i,a)}addToStart(e){return new J([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new J(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let r=0;r<this.content.length;r++)if(!this.content[r].eq(e.content[r]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let r=this.content[e];if(!r)throw new RangeError("Index "+e+" out of range for "+this);return r}maybeChild(e){return this.content[e]||null}forEach(e){for(let r=0,n=0;r<this.content.length;r++){let i=this.content[r];e(i,n,r),n+=i.nodeSize}}findDiffStart(e,r=0){return GR(this,e,r)}findDiffEnd(e,r=this.size,n=e.size){return YR(this,e,r,n)}findIndex(e){if(e==0)return pu(0,e);if(e==this.size)return pu(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,n=0;;r++){let i=this.child(r),a=n+i.nodeSize;if(a>=e)return a==e?pu(r+1,a):pu(r,n);n=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,r){if(!r)return J.empty;if(!Array.isArray(r))throw new RangeError("Invalid input for Fragment.fromJSON");return new J(r.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return J.empty;let r,n=0;for(let i=0;i<e.length;i++){let a=e[i];n+=a.nodeSize,i&&a.isText&&e[i-1].sameMarkup(a)?(r||(r=e.slice(0,i)),r[r.length-1]=a.withText(r[r.length-1].text+a.text)):r&&r.push(a)}return new J(r||e,n)}static from(e){if(!e)return J.empty;if(e instanceof J)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new J([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}J.empty=new J([],0);const Sy={index:0,offset:0};function pu(t,e){return Sy.index=t,Sy.offset=e,Sy}function nf(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let r=Array.isArray(t);if(Array.isArray(e)!=r)return!1;if(r){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!nf(t[n],e[n]))return!1}else{for(let n in t)if(!(n in e)||!nf(t[n],e[n]))return!1;for(let n in e)if(!(n in t))return!1}return!0}let nt=class Db{constructor(e,r){this.type=e,this.attrs=r}addToSet(e){let r,n=!1;for(let i=0;i<e.length;i++){let a=e[i];if(this.eq(a))return e;if(this.type.excludes(a.type))r||(r=e.slice(0,i));else{if(a.type.excludes(this.type))return e;!n&&a.type.rank>this.type.rank&&(r||(r=e.slice(0,i)),r.push(this),n=!0),r&&r.push(a)}}return r||(r=e.slice()),n||r.push(this),r}removeFromSet(e){for(let r=0;r<e.length;r++)if(this.eq(e[r]))return e.slice(0,r).concat(e.slice(r+1));return e}isInSet(e){for(let r=0;r<e.length;r++)if(this.eq(e[r]))return!0;return!1}eq(e){return this==e||this.type==e.type&&nf(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let r in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,r){if(!r)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[r.type];if(!n)throw new RangeError(`There is no mark type ${r.type} in this schema`);let i=n.create(r.attrs);return n.checkAttrs(i.attrs),i}static sameSet(e,r){if(e==r)return!0;if(e.length!=r.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(r[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Db.none;if(e instanceof Db)return[e];let r=e.slice();return r.sort((n,i)=>n.type.rank-i.type.rank),r}};nt.none=[];class af extends Error{}class ce{constructor(e,r,n){this.content=e,this.openStart=r,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,r){let n=JR(this.content,e+this.openStart,r);return n&&new ce(n,this.openStart,this.openEnd)}removeBetween(e,r){return new ce(XR(this.content,e+this.openStart,r+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,r){if(!r)return ce.empty;let n=r.openStart||0,i=r.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ce(J.fromJSON(e,r.content),n,i)}static maxOpen(e,r=!0){let n=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(r||!a.type.spec.isolating);a=a.firstChild)n++;for(let a=e.lastChild;a&&!a.isLeaf&&(r||!a.type.spec.isolating);a=a.lastChild)i++;return new ce(e,n,i)}}ce.empty=new ce(J.empty,0,0);function XR(t,e,r){let{index:n,offset:i}=t.findIndex(e),a=t.maybeChild(n),{index:o,offset:s}=t.findIndex(r);if(i==e||a.isText){if(s!=r&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(r))}if(n!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(n,a.copy(XR(a.content,e-i-1,r-i-1)))}function JR(t,e,r,n){let{index:i,offset:a}=t.findIndex(e),o=t.maybeChild(i);if(a==e||o.isText)return n&&!n.canReplace(i,i,r)?null:t.cut(0,e).append(r).append(t.cut(e));let s=JR(o.content,e-a-1,r,o);return s&&t.replaceChild(i,o.copy(s))}function Rte(t,e,r){if(r.openStart>t.depth)throw new af("Inserted content deeper than insertion position");if(t.depth-r.openStart!=e.depth-r.openEnd)throw new af("Inconsistent open depths");return ZR(t,e,r,0)}function ZR(t,e,r,n){let i=t.index(n),a=t.node(n);if(i==e.index(n)&&n<t.depth-r.openStart){let o=ZR(t,e,r,n+1);return a.copy(a.content.replaceChild(i,o))}else if(r.content.size)if(!r.openStart&&!r.openEnd&&t.depth==n&&e.depth==n){let o=t.parent,s=o.content;return La(o,s.cut(0,t.parentOffset).append(r.content).append(s.cut(e.parentOffset)))}else{let{start:o,end:s}=Ite(r,t);return La(a,eI(t,o,s,e,n))}else return La(a,of(t,e,n))}function QR(t,e){if(!e.type.compatibleContent(t.type))throw new af("Cannot join "+e.type.name+" onto "+t.type.name)}function Rb(t,e,r){let n=t.node(r);return QR(n,e.node(r)),n}function $a(t,e){let r=e.length-1;r>=0&&t.isText&&t.sameMarkup(e[r])?e[r]=t.withText(e[r].text+t.text):e.push(t)}function bl(t,e,r,n){let i=(e||t).node(r),a=0,o=e?e.index(r):i.childCount;t&&(a=t.index(r),t.depth>r?a++:t.textOffset&&($a(t.nodeAfter,n),a++));for(let s=a;s<o;s++)$a(i.child(s),n);e&&e.depth==r&&e.textOffset&&$a(e.nodeBefore,n)}function La(t,e){return t.type.checkContent(e),t.copy(e)}function eI(t,e,r,n,i){let a=t.depth>i&&Rb(t,e,i+1),o=n.depth>i&&Rb(r,n,i+1),s=[];return bl(null,t,i,s),a&&o&&e.index(i)==r.index(i)?(QR(a,o),$a(La(a,eI(t,e,r,n,i+1)),s)):(a&&$a(La(a,of(t,e,i+1)),s),bl(e,r,i,s),o&&$a(La(o,of(r,n,i+1)),s)),bl(n,null,i,s),new J(s)}function of(t,e,r){let n=[];if(bl(null,t,r,n),t.depth>r){let i=Rb(t,e,r+1);$a(La(i,of(t,e,r+1)),n)}return bl(e,null,r,n),new J(n)}function Ite(t,e){let r=e.depth-t.openStart,i=e.node(r).copy(t.content);for(let a=r-1;a>=0;a--)i=e.node(a).copy(J.from(i));return{start:i.resolveNoCache(t.openStart+r),end:i.resolveNoCache(i.content.size-t.openEnd-r)}}class pc{constructor(e,r,n){this.pos=e,this.path=r,this.parentOffset=n,this.depth=r.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,r=this.index(this.depth);if(r==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=e.child(r);return n?e.child(r).cut(n):i}get nodeBefore(){let e=this.index(this.depth),r=this.pos-this.path[this.path.length-1];return r?this.parent.child(e).cut(0,r):e==0?null:this.parent.child(e-1)}posAtIndex(e,r){r=this.resolveDepth(r);let n=this.path[r*3],i=r==0?0:this.path[r*3-1]+1;for(let a=0;a<e;a++)i+=n.child(a).nodeSize;return i}marks(){let e=this.parent,r=this.index();if(e.content.size==0)return nt.none;if(this.textOffset)return e.child(r).marks;let n=e.maybeChild(r-1),i=e.maybeChild(r);if(!n){let s=n;n=i,i=s}let a=n.marks;for(var o=0;o<a.length;o++)a[o].type.spec.inclusive===!1&&(!i||!a[o].isInSet(i.marks))&&(a=a[o--].removeFromSet(a));return a}marksAcross(e){let r=this.parent.maybeChild(this.index());if(!r||!r.isInline)return null;let n=r.marks,i=e.parent.maybeChild(e.index());for(var a=0;a<n.length;a++)n[a].type.spec.inclusive===!1&&(!i||!n[a].isInSet(i.marks))&&(n=n[a--].removeFromSet(n));return n}sharedDepth(e){for(let r=this.depth;r>0;r--)if(this.start(r)<=e&&this.end(r)>=e)return r;return 0}blockRange(e=this,r){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!r||r(this.node(n))))return new sf(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let r=1;r<=this.depth;r++)e+=(e?"/":"")+this.node(r).type.name+"_"+this.index(r-1);return e+":"+this.parentOffset}static resolve(e,r){if(!(r>=0&&r<=e.content.size))throw new RangeError("Position "+r+" out of range");let n=[],i=0,a=r;for(let o=e;;){let{index:s,offset:l}=o.content.findIndex(a),u=a-l;if(n.push(o,s,i+l),!u||(o=o.child(s),o.isText))break;a=u-1,i+=l+1}return new pc(r,n,a)}
vendor: 4,390 bytes, line 77
77static resolveCached(e,r){let n=Wk.get(e);if(n)for(let a=0;a<n.elts.length;a++){let o=n.elts[a];if(o.pos==r)return o}else Wk.set(e,n=new $te);let i=n.elts[n.i]=pc.resolve(e,r);return n.i=(n.i+1)%Lte,i}}class $te{constructor(){this.elts=[],this.i=0}}const Lte=12,Wk=new WeakMap;class sf{constructor(e,r,n){this.$from=e,this.$to=r,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Bte=Object.create(null);let Wi=class Ib{constructor(e,r,n,i=nt.none){this.type=e,this.attrs=r,this.marks=i,this.content=n||J.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,r,n,i=0){this.content.nodesBetween(e,r,n,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,r,n,i){return this.content.textBetween(e,r,n,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,r,n){return this.type==e&&nf(this.attrs,r||e.defaultAttrs||Bte)&&nt.sameSet(this.marks,n||nt.none)}copy(e=null){return e==this.content?this:new Ib(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ib(this.type,this.attrs,this.content,e)}cut(e,r=this.content.size){return e==0&&r==this.content.size?this:this.copy(this.content.cut(e,r))}slice(e,r=this.content.size,n=!1){if(e==r)return ce.empty;let i=this.resolve(e),a=this.resolve(r),o=n?0:i.sharedDepth(r),s=i.start(o),u=i.node(o).content.cut(i.pos-s,a.pos-s);return new ce(u,i.depth-o,a.depth-o)}replace(e,r,n){return Rte(this.resolve(e),this.resolve(r),n)}nodeAt(e){for(let r=this;;){let{index:n,offset:i}=r.content.findIndex(e);if(r=r.maybeChild(n),!r)return null;if(i==e||r.isText)return r;e-=i+1}}childAfter(e){let{index:r,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(r),index:r,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:r,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(r),index:r,offset:n};let i=this.content.child(r-1);return{node:i,index:r-1,offset:n-i.nodeSize}}resolve(e){return pc.resolveCached(this,e)}resolveNoCache(e){return pc.resolve(this,e)}rangeHasMark(e,r,n){let i=!1;return r>e&&this.nodesBetween(e,r,a=>(n.isInSet(a.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),tI(this.marks,e)}contentMatchAt(e){let r=this.type.contentMatch.matchFragment(this.content,0,e);if(!r)throw new Error("Called contentMatchAt on a node with invalid content");return r}canReplace(e,r,n=J.empty,i=0,a=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,a),s=o&&o.matchFragment(this.content,r);if(!s||!s.validEnd)return!1;for(let l=i;l<a;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(e,r,n,i){if(i&&!this.type.allowsMarks(i))return!1;let a=this.contentMatchAt(e).matchType(n),o=a&&a.matchFragment(this.content,r);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=nt.none;for(let r=0;r<this.marks.length;r++){let n=this.marks[r];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!nt.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(r=>r.type.name)}
77`);this.content.forEach(r=>r.check())}toJSON(){let e={type:this.type.name};for(let r in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(r=>r.toJSON())),e}static fromJSON(e,r){if(!r)throw new RangeError("Invalid input for Node.fromJSON");let n;if(r.marks){if(!Array.isArray(r.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=r.marks.map(e.markFromJSON)}if(r.type=="text"){if(typeof r.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(r.text,n)}let i=J.fromJSON(e,r.content),a=e.nodeType(r.type).create(r.attrs,i,n);return a.type.checkAttrs(a.attrs),a}};Wi.prototype.text=void 0;class lf extends Wi{constructor(e,r,n,i){if(super(e,r,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):tI(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,r){return this.text.slice(e,r)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new lf(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new lf(this.type,this.attrs,e,this.marks)}cut(e=0,r=this.text.length){return e==0&&r==this.text.length?this:this.withText(this.text.slice(e,r))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function tI(t,e){for(let r=t.length-1;r>=0;r--)e=t[r].type.name+"("+e+")";return e}class Za{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,r){let n=new Fte(e,r);if(n.next==null)return Za.empty;let i=rI(n);n.next&&n.err("Unexpected trailing text");let a=Kte(Vte(i));return Gte(a,n),a}matchType(e){for(let r=0;r<this.next.length;r++)if(this.next[r].type==e)return this.next[r].next;return null}matchFragment(e,r=0,n=e.childCount){let i=this;for(let a=r;i&&a<n;a++)i=i.matchType(e.child(a).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:r}=this.next[e];if(!(r.isText||r.hasRequiredAttrs()))return r}return null}compatible(e){for(let r=0;r<this.next.length;r++)for(let n=0;n<e.next.length;n++)if(this.next[r].type==e.next[n].type)return!0;return!1}fillBefore(e,r=!1,n=0){let i=[this];function a(o,s){let l=o.matchFragment(e,n);if(l&&(!r||l.validEnd))return J.from(s.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:d,next:f}=o.next[u];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let h=a(f,s.concat(d));if(h)return h}}return null}return a(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let r=this.computeWrapping(e);return this.wrapCache.push(e,r),r}computeWrapping(e){let r=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let i=n.shift(),a=i.match;if(a.matchType(e)){let o=[];for(let s=i;s.type;s=s.via)o.push(s.type);return o.reverse()}for(let o=0;o<a.next.length;o++){let{type:s,next:l}=a.next[o];!s.isLeaf&&!s.hasRequiredAttrs()&&!(s.name in r)&&(!i.type||l.validEnd)&&(n.push({match:s.contentMatch,type:s,via:i}),r[s.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function r(n){e.push(n);for(let i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&r(n.next[i].next)}return r(this),e.map((n,i)=>{let a=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)a+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return a}).join(` 78`)}}Za.empty=new Za(!0);class Fte{constructor(e,r){this.string=e,this.nodeTypes=r,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function rI(t){let e=[];do e.push(zte(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function zte(t){let e=[];do e.push(qte(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function qte(t){let e=Wte(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=Ute(t,e);else break;return e}function Vk(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");
vendor: 4,223 bytes, line 78
78let e=Number(t.next);return t.pos++,e}function Ute(t,e){let r=Vk(t),n=r;return t.eat(",")&&(t.next!="}"?n=Vk(t):n=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:r,max:n,expr:e}}function Hte(t,e){let r=t.nodeTypes,n=r[e];if(n)return[n];let i=[];for(let a in r){let o=r[a];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function Wte(t){if(t.eat("(")){let e=rI(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=Hte(t,t.next).map(r=>(t.inline==null?t.inline=r.isInline:t.inline!=r.isInline&&t.err("Mixing inline and block content"),{type:"name",value:r}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Vte(t){let e=[[]];return i(a(t,0),r()),e;function r(){return e.push([])-1}function n(o,s,l){let u={term:l,to:s};return e[o].push(u),u}function i(o,s){o.forEach(l=>l.to=s)}function a(o,s){if(o.type=="choice")return o.exprs.reduce((l,u)=>l.concat(a(u,s)),[]);if(o.type=="seq")for(let l=0;;l++){let u=a(o.exprs[l],s);if(l==o.exprs.length-1)return u;i(u,s=r())}else if(o.type=="star"){let l=r();return n(s,l),i(a(o.expr,l),l),[n(l)]}else if(o.type=="plus"){let l=r();return i(a(o.expr,s),l),i(a(o.expr,l),l),[n(l)]}else{if(o.type=="opt")return[n(s)].concat(a(o.expr,s));if(o.type=="range"){let l=s;for(let u=0;u<o.min;u++){let d=r();i(a(o.expr,l),d),l=d}if(o.max==-1)i(a(o.expr,l),l);else for(let u=o.min;u<o.max;u++){let d=r();n(l,d),i(a(o.expr,l),d),l=d}return[n(l)]}else{if(o.type=="name")return[n(s,void 0,o.value)];throw new Error("Unknown expr type")}}}}function nI(t,e){return e-t}function Kk(t,e){let r=[];return n(e),r.sort(nI);function n(i){let a=t[i];if(a.length==1&&!a[0].term)return n(a[0].to);r.push(i);for(let o=0;o<a.length;o++){let{term:s,to:l}=a[o];!s&&r.indexOf(l)==-1&&n(l)}}}function Kte(t){let e=Object.create(null);return r(Kk(t,0));function r(n){let i=[];n.forEach(o=>{t[o].forEach(({term:s,to:l})=>{if(!s)return;let u;for(let d=0;d<i.length;d++)i[d][0]==s&&(u=i[d][1]);Kk(t,l).forEach(d=>{u||i.push([s,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let a=e[n.join(",")]=new Za(n.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let s=i[o][1].sort(nI);a.next.push({type:i[o][0],next:e[s.join(",")]||r(s)})}return a}}function Gte(t,e){for(let r=0,n=[t];r<n.length;r++){let i=n[r],a=!i.validEnd,o=[];for(let s=0;s<i.next.length;s++){let{type:l,next:u}=i.next[s];o.push(l.name),a&&!(l.isText||l.hasRequiredAttrs())&&(a=!1),n.indexOf(u)==-1&&n.push(u)}a&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function iI(t){let e=Object.create(null);for(let r in t){let n=t[r];if(!n.hasDefault)return null;e[r]=n.default}return e}function aI(t,e){let r=Object.create(null);for(let n in t){let i=e&&e[n];if(i===void 0){let a=t[n];if(a.hasDefault)i=a.default;else throw new RangeError("No value supplied for attribute "+n)}r[n]=i}return r}function oI(t,e,r,n){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${r} of type ${i}`);for(let i in t){let a=t[i];a.validate&&a.validate(e[i])}}function sI(t,e){let r=Object.create(null);if(e)for(let n in e)r[n]=new Xte(t,n,e[n]);return r}let Gk=class lI{constructor(e,r,n){this.name=e,this.schema=r,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=sI(e,n.attrs),this.defaultAttrs=iI(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Za.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:aI(this.attrs,e)}create(e=null,r,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");
vendor: 11,001 bytes, lines 78-80
78return new Wi(this,this.computeAttrs(e),J.from(r),nt.setFrom(n))}createChecked(e=null,r,n){return r=J.from(r),this.checkContent(r),new Wi(this,this.computeAttrs(e),r,nt.setFrom(n))}createAndFill(e=null,r,n){if(e=this.computeAttrs(e),r=J.from(r),r.size){let o=this.contentMatch.fillBefore(r);if(!o)return null;r=o.append(r)}let i=this.contentMatch.matchFragment(r),a=i&&i.fillBefore(J.empty,!0);return a?new Wi(this,e,r.append(a),nt.setFrom(n)):null}validContent(e){let r=this.contentMatch.matchFragment(e);if(!r||!r.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){oI(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let r=0;r<e.length;r++)if(!this.allowsMarkType(e[r].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let r;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?r&&r.push(e[n]):r||(r=e.slice(0,n));return r?r.length?r:nt.none:e}static compile(e,r){let n=Object.create(null);e.forEach((a,o)=>n[a]=new lI(a,r,o));let i=r.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let a in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function Yte(t,e,r){let n=r.split("|");return i=>{let a=i===null?"null":typeof i;if(n.indexOf(a)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${t}, got ${a}`)}}class Xte{constructor(e,r,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?Yte(e,r,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class qh{constructor(e,r,n,i){this.name=e,this.rank=r,this.schema=n,this.spec=i,this.attrs=sI(e,i.attrs),this.excluded=null;let a=iI(this.attrs);this.instance=a?new nt(this,a):null}create(e=null){return!e&&this.instance?this.instance:new nt(this,aI(this.attrs,e))}static compile(e,r){let n=Object.create(null),i=0;return e.forEach((a,o)=>n[a]=new qh(a,i++,r,o)),n}removeFromSet(e){for(var r=0;r<e.length;r++)e[r].type==this&&(e=e.slice(0,r).concat(e.slice(r+1)),r--);return e}isInSet(e){for(let r=0;r<e.length;r++)if(e[r].type==this)return e[r]}checkAttrs(e){oI(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class cI{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let r=this.spec={};for(let i in e)r[i]=e[i];r.nodes=tr.from(e.nodes),r.marks=tr.from(e.marks||{}),this.nodes=Gk.compile(this.spec.nodes,this),this.marks=qh.compile(this.spec.marks,this);let n=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let a=this.nodes[i],o=a.spec.content||"",s=a.spec.marks;if(a.contentMatch=n[o]||(n[o]=Za.parse(o,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=s=="_"?null:s?Yk(this,s.split(" ")):s==""||!a.inlineContent?[]:null}for(let i in this.marks){let a=this.marks[i],o=a.spec.excludes;a.excluded=o==null?[a]:o==""?[]:Yk(this,o.split(" "))}this.nodeFromJSON=i=>Wi.fromJSON(this,i),this.markFromJSON=i=>nt.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,r=null,n,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Gk){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(r,n,i)}text(e,r){let n=this.nodes.text;return new lf(n,n.defaultAttrs,e,nt.setFrom(r))}mark(e,r){return typeof e=="string"&&(e=this.marks[e]),e.create(r)}nodeType(e){let r=this.nodes[e];if(!r)throw new RangeError("Unknown node type: "+e);return r}}function Yk(t,e){let r=[];for(let n=0;n<e.length;n++){let i=e[n],a=t.marks[i],o=a;if(a)r.push(a);else for(let s in t.marks){let l=t.marks[s];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&r.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return r}function Jte(t){return t.tag!=null}function Zte(t){return t.style!=null}class Vi{constructor(e,r){this.schema=e,this.rules=r,this.tags=[],this.styles=[];let n=this.matchedStyles=[];r.forEach(i=>{if(Jte(i))this.tags.push(i);else if(Zte(i)){let a=/[^=]*/.exec(i.style)[0];n.indexOf(a)<0&&n.push(a),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let a=e.nodes[i.node];return a.contentMatch.matchType(a)})}parse(e,r={}){let n=new Jk(this,r,!1);return n.addAll(e,nt.none,r.from,r.to),n.finish()}parseSlice(e,r={}){let n=new Jk(this,r,!0);return n.addAll(e,nt.none,r.from,r.to),ce.maxOpen(n.finish())}matchTag(e,r,n){for(let i=n?this.tags.indexOf(n)+1:0;i<this.tags.length;i++){let a=this.tags[i];if(tre(e,a.tag)&&(a.namespace===void 0||e.namespaceURI==a.namespace)&&(!a.context||r.matchesContext(a.context))){if(a.getAttrs){let o=a.getAttrs(e);if(o===!1)continue;a.attrs=o||void 0}return a}}}matchStyle(e,r,n,i){for(let a=i?this.styles.indexOf(i)+1:0;a<this.styles.length;a++){let o=this.styles[a],s=o.style;if(!(s.indexOf(e)!=0||o.context&&!n.matchesContext(o.context)||s.length>e.length&&(s.charCodeAt(e.length)!=61||s.slice(e.length+1)!=r))){if(o.getAttrs){let l=o.getAttrs(r);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let r=[];function n(i){let a=i.priority==null?50:i.priority,o=0;for(;o<r.length;o++){let s=r[o];if((s.priority==null?50:s.priority)<a)break}r.splice(o,0,i)}for(let i in e.marks){let a=e.marks[i].spec.parseDOM;a&&a.forEach(o=>{n(o=Zk(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let a=e.nodes[i].spec.parseDOM;a&&a.forEach(o=>{n(o=Zk(o)),o.node||o.ignore||o.mark||(o.node=i)})}return r}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Vi(e,Vi.schemaRules(e)))}}const uI={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Qte={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},dI={ol:!0,ul:!0},mc=1,$b=2,wl=4;function Xk(t,e,r){return e!=null?(e?mc:0)|(e==="full"?$b:0):t&&t.whitespace=="pre"?mc|$b:r&~wl}class mu{constructor(e,r,n,i,a,o){this.type=e,this.attrs=r,this.marks=n,this.solid=i,this.options=o,this.content=[],this.activeMarks=nt.none,this.match=a||(o&wl?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let r=this.type.contentMatch.fillBefore(J.from(e));if(r)this.match=this.type.contentMatch.matchFragment(r);else{let n=this.type.contentMatch,i;return(i=n.findWrapping(e.type))?(this.match=n,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&mc)){let n=this.content[this.content.length-1],i;if(n&&n.isText&&(i=/[ \t\r\n\u000c]+$/.exec(n.text))){let a=n;n.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-i[0].length))}}let r=J.from(this.content);return!e&&this.match&&(r=r.append(this.match.fillBefore(J.empty,!0))),this.type?this.type.create(this.attrs,r,this.marks):r}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!uI.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Jk{constructor(e,r,n){this.parser=e,this.options=r,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let i=r.topNode,a,o=Xk(null,r.preserveWhitespace,0)|(n?wl:0);i?a=new mu(i.type,i.attrs,nt.none,!0,r.topMatch||i.type.contentMatch,o):n?a=new mu(null,null,nt.none,!0,null,o):a=new mu(e.schema.topNodeType,null,nt.none,!0,null,o),this.nodes=[a],this.find=r.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,r){e.nodeType==3?this.addTextNode(e,r):e.nodeType==1&&this.addElement(e,r)}addTextNode(e,r){let n=e.nodeValue,i=this.top,a=i.options&$b?"full":this.localPreserveWS||(i.options&mc)>0,{schema:o}=this.parser;if(a==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(a)if(a==="full")n=n.replace(/\r\n?/g,` 79`);else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let s=n.split(/\r?\n|\r/);for(let l=0;l<s.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),r,!0),s[l]&&this.insertNode(o.text(s[l]),r,!/\S/.test(s[l]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let s=i.content[i.content.length-1],l=e.previousSibling;(!s||l&&l.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),r,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,r,n){let i=this.localPreserveWS,a=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),s;dI.hasOwnProperty(o)&&this.parser.normalizeLists&&ere(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,n));e:if(l?l.ignore:Qte.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,r);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let u,d=this.needsBlock;if(uI.hasOwnProperty(o))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),u=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,r);break e}let f=l&&l.skip?r:this.readStyles(e,r);f&&this.addAll(e,f),u&&this.sync(a),this.needsBlock=d}else{let u=this.readStyles(e,r);u&&this.addElementByRule(e,l,u,l.consuming===!1?s:void 0)}this.localPreserveWS=i}leafFallback(e,r){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(` 80`),r)}ignoreFallback(e,r){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),r,!0)}readStyles(e,r){let n=e.style;if(n&&n.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let a=this.parser.matchedStyles[i],o=n.getPropertyValue(a);if(o)for(let s=void 0;;){let l=this.parser.matchStyle(a,o,this,s);if(!l)break;if(l.ignore)return null;if(l.clearMark?r=r.filter(u=>!l.clearMark(u)):r=r.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)s=l;else break}}return r}addElementByRule(e,r,n,i){let a,o;
vendor: 4,119 bytes, line 80
80if(r.node)if(o=this.parser.schema.nodes[r.node],o.isLeaf)this.insertNode(o.create(r.attrs),n,e.nodeName=="BR")||this.leafFallback(e,n);else{let l=this.enter(o,r.attrs||null,n,r.preserveWhitespace);l&&(a=!0,n=l)}else{let l=this.parser.schema.marks[r.mark];n=n.concat(l.create(r.attrs))}let s=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,n,i);else if(r.getContent)this.findInside(e),r.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,n,!1));else{let l=e;typeof r.contentElement=="string"?l=e.querySelector(r.contentElement):typeof r.contentElement=="function"?l=r.contentElement(e):r.contentElement&&(l=r.contentElement),this.findAround(e,l,!0),this.addAll(l,n),this.findAround(e,l,!1)}a&&this.sync(s)&&this.open--}addAll(e,r,n,i){let a=n||0;for(let o=n?e.childNodes[n]:e.firstChild,s=i==null?null:e.childNodes[i];o!=s;o=o.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(o,r);this.findAtPoint(e,a)}findPlace(e,r,n){let i,a;for(let o=this.open,s=0;o>=0;o--){let l=this.nodes[o],u=l.findWrapping(e);if(u&&(!i||i.length>u.length+s)&&(i=u,a=l,!u.length))break;if(l.solid){if(n)break;s+=2}}if(!i)return null;this.sync(a);for(let o=0;o<i.length;o++)r=this.enterInner(i[o],null,r,!1);return r}insertNode(e,r,n){if(e.isInline&&this.needsBlock&&!this.top.type){let a=this.textblockFromContext();a&&(r=this.enterInner(a,null,r))}let i=this.findPlace(e,r,n);if(i){this.closeExtra();let a=this.top;a.match&&(a.match=a.match.matchType(e.type));let o=nt.none;for(let s of i.concat(e.marks))(a.type?a.type.allowsMarkType(s.type):Qk(s.type,e.type))&&(o=s.addToSet(o));return a.content.push(e.mark(o)),!0}return!1}enter(e,r,n,i){let a=this.findPlace(e.create(r),n,!1);return a&&(a=this.enterInner(e,r,n,!0,i)),a}enterInner(e,r,n,i=!1,a){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let s=Xk(e,a,o.options);o.options&wl&&o.content.length==0&&(s|=wl);let l=nt.none;return n=n.filter(u=>(o.type?o.type.allowsMarkType(u.type):Qk(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new mu(e,r,l,i,null,s)),this.open++,n}closeExtra(e=!1){let r=this.nodes.length-1;if(r>this.open){for(;r>this.open;r--)this.nodes[r-1].content.push(this.nodes[r].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let r=this.open;r>=0;r--){if(this.nodes[r]==e)return this.open=r,!0;this.localPreserveWS&&(this.nodes[r].options|=mc)}return!1}get currentPos(){this.closeExtra();let e=0;for(let r=this.open;r>=0;r--){let n=this.nodes[r].content;for(let i=n.length-1;i>=0;i--)e+=n[i].nodeSize;r&&e++}return e}findAtPoint(e,r){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==r&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&(this.find[r].pos=this.currentPos)}findAround(e,r,n){if(e!=r&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&r.compareDocumentPosition(this.find[i].node)&(n?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&(this.find[r].pos=this.currentPos-(e.nodeValue.length-this.find[r].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let r=e.split("/"),n=this.options.context,i=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),a=-(n?n.depth+1:0)+(i?0:1),o=(s,l)=>{for(;s>=0;s--){let u=r[s];if(u==""){if(s==r.length-1||s==0)continue;for(;l>=a;l--)if(o(s-1,l))return!0;return!1}else{let d=l>0||l==0&&i?this.nodes[l].type:n&&l>=a?n.node(l-a).type:null;if(!d||d.name!=u&&!d.isInGroup(u))return!1;l--}}return!0};return o(r.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let r=e.depth;r>=0;r--){let n=e.node(r).contentMatchAt(e.indexAfter(r)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let r in this.parser.schema.nodes){let n=this.parser.schema.nodes[r];
vendor: 8,773 bytes, line 80
80if(n.isTextblock&&n.defaultAttrs)return n}}}function ere(t){for(let e=t.firstChild,r=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&dI.hasOwnProperty(n)&&r?(r.appendChild(e),e=r):n=="li"?r=e:n&&(r=null)}}function tre(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Zk(t){let e={};for(let r in t)e[r]=t[r];return e}function Qk(t,e){let r=e.schema.nodes;for(let n in r){let i=r[n];if(!i.allowsMarkType(t))continue;let a=[],o=s=>{a.push(s);for(let l=0;l<s.edgeCount;l++){let{type:u,next:d}=s.edge(l);if(u==e||a.indexOf(d)<0&&o(d))return!0}};if(o(i.contentMatch))return!0}}class co{constructor(e,r){this.nodes=e,this.marks=r}serializeFragment(e,r={},n){n||(n=jy(r).createDocumentFragment());let i=n,a=[];return e.forEach(o=>{if(a.length||o.marks.length){let s=0,l=0;for(;s<a.length&&l<o.marks.length;){let u=o.marks[l];if(!this.marks[u.type.name]){l++;continue}if(!u.eq(a[s][0])||u.type.spec.spanning===!1)break;s++,l++}for(;s<a.length;)i=a.pop()[1];for(;l<o.marks.length;){let u=o.marks[l++],d=this.serializeMark(u,o.isInline,r);d&&(a.push([u,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(o,r))}),n}serializeNodeInner(e,r){let{dom:n,contentDOM:i}=Mu(jy(r),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,r,i)}return n}serializeNode(e,r={}){let n=this.serializeNodeInner(e,r);for(let i=e.marks.length-1;i>=0;i--){let a=this.serializeMark(e.marks[i],e.isInline,r);a&&((a.contentDOM||a.dom).appendChild(n),n=a.dom)}return n}serializeMark(e,r,n={}){let i=this.marks[e.type.name];return i&&Mu(jy(n),i(e,r),null,e.attrs)}static renderSpec(e,r,n=null,i){return Mu(e,r,n,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new co(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let r=eA(e.nodes);return r.text||(r.text=n=>n.text),r}static marksFromSchema(e){return eA(e.marks)}}function eA(t){let e={};for(let r in t){let n=t[r].spec.toDOM;n&&(e[r]=n)}return e}function jy(t){return t.document||window.document}const tA=new WeakMap;function rre(t){let e=tA.get(t);return e===void 0&&tA.set(t,e=nre(t)),e}function nre(t){let e=null;function r(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")e||(e=[]),e.push(n);else for(let i=0;i<n.length;i++)r(n[i]);else for(let i in n)r(n[i])}return r(t),e}function Mu(t,e,r,n){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],a;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(a=rre(n))&&a.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(r=i.slice(0,o),i=i.slice(o+1));let s,l=r?t.createElementNS(r,i):t.createElement(i),u=e[1],d=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){d=2;for(let f in u)if(u[f]!=null){let h=f.indexOf(" ");h>0?l.setAttributeNS(f.slice(0,h),f.slice(h+1),u[f]):f=="style"&&l.style?l.style.cssText=u[f]:l.setAttribute(f,u[f])}}for(let f=d;f<e.length;f++){let h=e[f];if(h===0){if(f<e.length-1||f>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:p,contentDOM:m}=Mu(t,h,r,n);if(l.appendChild(p),m){if(s)throw new RangeError("Multiple content holes");s=m}}}return{dom:l,contentDOM:s}}const fI=65535,hI=Math.pow(2,16);function ire(t,e){return t+e*hI}function rA(t){return t&fI}function are(t){return(t-(t&fI))/hI}const pI=1,mI=2,Du=4,gI=8;class Lb{constructor(e,r,n){this.pos=e,this.delInfo=r,this.recover=n}get deleted(){return(this.delInfo&gI)>0}get deletedBefore(){return(this.delInfo&(pI|Du))>0}get deletedAfter(){return(this.delInfo&(mI|Du))>0}get deletedAcross(){return(this.delInfo&Du)>0}}class zr{constructor(e,r=!1){if(this.ranges=e,this.inverted=r,!e.length&&zr.empty)return zr.empty}recover(e){let r=0,n=rA(e);if(!this.inverted)for(let i=0;i<n;i++)r+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[n*3]+r+are(e)}mapResult(e,r=1){return this._map(e,r,!1)}map(e,r=1){return this._map(e,r,!0)}_map(e,r,n){let i=0,a=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let l=this.ranges[s]-(this.inverted?i:0);if(l>e)break;let u=this.ranges[s+a],d=this.ranges[s+o],f=l+u;if(e<=f){let h=u?e==l?-1:e==f?1:r:r,p=l+i+(h<0?0:d);if(n)return p;let m=e==(r<0?l:f)?null:ire(s/3,e-l),g=e==l?mI:e==f?pI:Du;return(r<0?e!=l:e!=f)&&(g|=gI),new Lb(p,g,m)}i+=d-u}return n?e+i:new Lb(e+i,0,null)}touches(e,r){let n=0,i=rA(r),a=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let l=this.ranges[s]-(this.inverted?n:0);if(l>e)break;let u=this.ranges[s+a],d=l+u;if(e<=d&&s==i*3)return!0;n+=this.ranges[s+o]-u}return!1}forEach(e){let r=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,a=0;i<this.ranges.length;i+=3){let o=this.ranges[i],s=o-(this.inverted?a:0),l=o+(this.inverted?0:a),u=this.ranges[i+r],d=this.ranges[i+n];e(s,s+u,l,l+d),a+=d-u}}invert(){return new zr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?zr.empty:new zr(e<0?[0,-e,0]:[0,0,e])}}zr.empty=new zr([]);class gc{constructor(e,r,n=0,i=e?e.length:0){this.mirror=r,this.from=n,this.to=i,this._maps=e||[],this.ownData=!(e||r)}get maps(){return this._maps}slice(e=0,r=this.maps.length){return new gc(this._maps,this.mirror,e,r)}appendMap(e,r){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),r!=null&&this.setMirror(this._maps.length-1,r)}appendMapping(e){for(let r=0,n=this._maps.length;r<e._maps.length;r++){let i=e.getMirror(r);this.appendMap(e._maps[r],i!=null&&i<r?n+i:void 0)}}getMirror(e){if(this.mirror){for(let r=0;r<this.mirror.length;r++)if(this.mirror[r]==e)return this.mirror[r+(r%2?-1:1)]}}setMirror(e,r){this.mirror||(this.mirror=[]),this.mirror.push(e,r)}appendMappingInverted(e){for(let r=e.maps.length-1,n=this._maps.length+e._maps.length;r>=0;r--){let i=e.getMirror(r);this.appendMap(e._maps[r].invert(),i!=null&&i>r?n-i-1:void 0)}}invert(){let e=new gc;return e.appendMappingInverted(this),e}map(e,r=1){if(this.mirror)return this._map(e,r,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,r);return e}mapResult(e,r=1){return this._map(e,r,!1)}_map(e,r,n){let i=0;for(let a=this.from;a<this.to;a++){let o=this._maps[a],s=o.mapResult(e,r);if(s.recover!=null){let l=this.getMirror(a);if(l!=null&&l>a&&l<this.to){a=l,e=this._maps[l].recover(s.recover);continue}}i|=s.delInfo,e=s.pos}return n?e:new Lb(e,i,null)}}const Oy=Object.create(null);class hr{getMap(){return zr.empty}merge(e){return null}static fromJSON(e,r){if(!r||!r.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=Oy[r.stepType];if(!n)throw new RangeError(`No step type ${r.stepType} defined`);return n.fromJSON(e,r)}static jsonID(e,r){if(e in Oy)throw new RangeError("Duplicate use of step JSON ID "+e);return Oy[e]=r,r.prototype.jsonID=e,r}}class Pt{constructor(e,r){this.doc=e,this.failed=r}static ok(e){return new Pt(e,null)}static fail(e){return new Pt(null,e)}static fromReplace(e,r,n,i){try{return Pt.ok(e.replace(r,n,i))}catch(a){if(a instanceof af)return Pt.fail(a.message);throw a}}}function Yw(t,e,r){let n=[];for(let i=0;i<t.childCount;i++){let a=t.child(i);a.content.size&&(a=a.copy(Yw(a.content,e,a))),a.isInline&&(a=e(a,r,i)),n.push(a)}return J.fromArray(n)}class zi extends hr{constructor(e,r,n){super(),this.from=e,this.to=r,this.mark=n}apply(e){let r=e.slice(this.from,this.to),n=e.resolve(this.from),i=n.node(n.sharedDepth(this.to)),a=new ce(Yw(r.content,(o,s)=>!o.isAtom||!s.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),r.openStart,r.openEnd);return Pt.fromReplace(e,this.from,this.to,a)}invert(){return new Fn(this.from,this.to,this.mark)}map(e){let r=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return r.deleted&&n.deleted||r.pos>=n.pos?null:new zi(r.pos,n.pos,this.mark)}merge(e){return e instanceof zi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new zi(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,r){if(typeof r.from!="number"||typeof r.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new zi(r.from,r.to,e.markFromJSON(r.mark))}}hr.jsonID("addMark",zi);class Fn extends hr{constructor(e,r,n){super(),this.from=e,this.to=r,this.mark=n}
vendor: 6,540 bytes, line 80
80apply(e){let r=e.slice(this.from,this.to),n=new ce(Yw(r.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),r.openStart,r.openEnd);return Pt.fromReplace(e,this.from,this.to,n)}invert(){return new zi(this.from,this.to,this.mark)}map(e){let r=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return r.deleted&&n.deleted||r.pos>=n.pos?null:new Fn(r.pos,n.pos,this.mark)}merge(e){return e instanceof Fn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Fn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,r){if(typeof r.from!="number"||typeof r.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Fn(r.from,r.to,e.markFromJSON(r.mark))}}hr.jsonID("removeMark",Fn);class qi extends hr{constructor(e,r){super(),this.pos=e,this.mark=r}apply(e){let r=e.nodeAt(this.pos);if(!r)return Pt.fail("No node at mark step's position");let n=r.type.create(r.attrs,null,this.mark.addToSet(r.marks));return Pt.fromReplace(e,this.pos,this.pos+1,new ce(J.from(n),0,r.isLeaf?0:1))}invert(e){let r=e.nodeAt(this.pos);if(r){let n=this.mark.addToSet(r.marks);if(n.length==r.marks.length){for(let i=0;i<r.marks.length;i++)if(!r.marks[i].isInSet(n))return new qi(this.pos,r.marks[i]);return new qi(this.pos,this.mark)}}return new Qa(this.pos,this.mark)}map(e){let r=e.mapResult(this.pos,1);return r.deletedAfter?null:new qi(r.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,r){if(typeof r.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new qi(r.pos,e.markFromJSON(r.mark))}}hr.jsonID("addNodeMark",qi);class Qa extends hr{constructor(e,r){super(),this.pos=e,this.mark=r}apply(e){let r=e.nodeAt(this.pos);if(!r)return Pt.fail("No node at mark step's position");let n=r.type.create(r.attrs,null,this.mark.removeFromSet(r.marks));return Pt.fromReplace(e,this.pos,this.pos+1,new ce(J.from(n),0,r.isLeaf?0:1))}invert(e){let r=e.nodeAt(this.pos);return!r||!this.mark.isInSet(r.marks)?this:new qi(this.pos,this.mark)}map(e){let r=e.mapResult(this.pos,1);return r.deletedAfter?null:new Qa(r.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,r){if(typeof r.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Qa(r.pos,e.markFromJSON(r.mark))}}hr.jsonID("removeNodeMark",Qa);class At extends hr{constructor(e,r,n,i=!1){super(),this.from=e,this.to=r,this.slice=n,this.structure=i}apply(e){return this.structure&&Bb(e,this.from,this.to)?Pt.fail("Structure replace would overwrite content"):Pt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new zr([this.from,this.to-this.from,this.slice.size])}invert(e){return new At(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let r=e.mapResult(this.to,-1),n=this.from==this.to&&At.MAP_BIAS<0?r:e.mapResult(this.from,1);return n.deletedAcross&&r.deletedAcross?null:new At(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof At)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let r=this.slice.size+e.slice.size==0?ce.empty:new ce(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new At(this.from,this.to+(e.to-e.from),r,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let r=this.slice.size+e.slice.size==0?ce.empty:new ce(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new At(e.from,this.to,r,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,r){if(typeof r.from!="number"||typeof r.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new At(r.from,r.to,ce.fromJSON(e,r.slice),!!r.structure)}}At.MAP_BIAS=1;hr.jsonID("replace",At);class Kt extends hr{constructor(e,r,n,i,a,o,s=!1){super(),this.from=e,this.to=r,this.gapFrom=n,this.gapTo=i,this.slice=a,this.insert=o,this.structure=s}apply(e){if(this.structure&&(Bb(e,this.from,this.gapFrom)||Bb(e,this.gapTo,this.to)))return Pt.fail("Structure gap-replace would overwrite content");let r=e.slice(this.gapFrom,this.gapTo);if(r.openStart||r.openEnd)return Pt.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,r.content);return n?Pt.fromReplace(e,this.from,this.to,n):Pt.fail("Content does not fit in gap")}getMap(){return new zr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let r=this.gapTo-this.gapFrom;return new Kt(this.from,this.from+this.slice.size+r,this.from+this.insert,this.from+this.insert+r,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let r=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),i=this.from==this.gapFrom?r.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return r.deletedAcross&&n.deletedAcross||i<r.pos||a>n.pos?null:new Kt(r.pos,n.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,r){if(typeof r.from!="number"||typeof r.to!="number"||typeof r.gapFrom!="number"||typeof r.gapTo!="number"||typeof r.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Kt(r.from,r.to,r.gapFrom,r.gapTo,ce.fromJSON(e,r.slice),r.insert,!!r.structure)}}hr.jsonID("replaceAround",Kt);function Bb(t,e,r){let n=t.resolve(e),i=r-e,a=n.depth;for(;i>0&&a>0&&n.indexAfter(a)==n.node(a).childCount;)a--,i--;if(i>0){let o=n.node(a).maybeChild(n.indexAfter(a));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function ore(t,e,r,n){let i=[],a=[],o,s;t.doc.nodesBetween(e,r,(l,u,d)=>{if(!l.isInline)return;let f=l.marks;if(!n.isInSet(f)&&d.type.allowsMarkType(n.type)){let h=Math.max(u,e),p=Math.min(u+l.nodeSize,r),m=n.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(o&&o.to==h&&o.mark.eq(f[g])?o.to=p:i.push(o=new Fn(h,p,f[g])));s&&s.to==h?s.to=p:a.push(s=new zi(h,p,n))}}
vendor: 7,665 bytes, lines 80-81
80),i.forEach(l=>t.step(l)),a.forEach(l=>t.step(l))}function sre(t,e,r,n){let i=[],a=0;t.doc.nodesBetween(e,r,(o,s)=>{if(!o.isInline)return;a++;let l=null;if(n instanceof qh){let u=o.marks,d;for(;d=n.isInSet(u);)(l||(l=[])).push(d),u=d.removeFromSet(u)}else n?n.isInSet(o.marks)&&(l=[n]):l=o.marks;if(l&&l.length){let u=Math.min(s+o.nodeSize,r);for(let d=0;d<l.length;d++){let f=l[d],h;for(let p=0;p<i.length;p++){let m=i[p];m.step==a-1&&f.eq(i[p].style)&&(h=m)}h?(h.to=u,h.step=a):i.push({style:f,from:Math.max(s,e),to:u,step:a})}}}),i.forEach(o=>t.step(new Fn(o.from,o.to,o.style)))}function Xw(t,e,r,n=r.contentMatch,i=!0){let a=t.doc.nodeAt(e),o=[],s=e+1;for(let l=0;l<a.childCount;l++){let u=a.child(l),d=s+u.nodeSize,f=n.matchType(u.type);if(!f)o.push(new At(s,d,ce.empty));else{n=f;for(let h=0;h<u.marks.length;h++)r.allowsMarkType(u.marks[h].type)||t.step(new Fn(s,d,u.marks[h]));if(i&&u.isText&&r.whitespace!="pre"){let h,p=/\r?\n|\r/g,m;for(;h=p.exec(u.text);)m||(m=new ce(J.from(r.schema.text(" ",r.allowedMarks(u.marks))),0,0)),o.push(new At(s+h.index,s+h.index+h[0].length,m))}}s=d}if(!n.validEnd){let l=n.fillBefore(J.empty,!0);t.replace(s,s,new ce(l,0,0))}for(let l=o.length-1;l>=0;l--)t.step(o[l])}function lre(t,e,r){return(e==0||t.canReplace(e,t.childCount))&&(r==t.childCount||t.canReplace(0,r))}function zs(t){let r=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth,i=0,a=0;;--n){let o=t.$from.node(n),s=t.$from.index(n)+i,l=t.$to.indexAfter(n)-a;if(n<t.depth&&o.canReplace(s,l,r))return n;if(n==0||o.type.spec.isolating||!lre(o,s,l))break;s&&(i=1),l<o.childCount&&(a=1)}return null}function cre(t,e,r){let{$from:n,$to:i,depth:a}=e,o=n.before(a+1),s=i.after(a+1),l=o,u=s,d=J.empty,f=0;for(let m=a,g=!1;m>r;m--)g||n.index(m)>0?(g=!0,d=J.from(n.node(m).copy(d)),f++):l--;let h=J.empty,p=0;for(let m=a,g=!1;m>r;m--)g||i.after(m+1)<i.end(m)?(g=!0,h=J.from(i.node(m).copy(h)),p++):u++;t.step(new Kt(l,u,o,s,new ce(d.append(h),f,p),d.size-f,!0))}function Jw(t,e,r=null,n=t){let i=ure(t,e),a=i&&dre(n,e);return a?i.map(nA).concat({type:e,attrs:r}).concat(a.map(nA)):null}function nA(t){return{type:t,attrs:null}}function ure(t,e){let{parent:r,startIndex:n,endIndex:i}=t,a=r.contentMatchAt(n).findWrapping(e);if(!a)return null;let o=a.length?a[0]:e;return r.canReplaceWith(n,i,o)?a:null}function dre(t,e){let{parent:r,startIndex:n,endIndex:i}=t,a=r.child(n),o=e.contentMatch.findWrapping(a.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let u=n;l&&u<i;u++)l=l.matchType(r.child(u).type);return!l||!l.validEnd?null:o}function fre(t,e,r){let n=J.empty;for(let o=r.length-1;o>=0;o--){if(n.size){let s=r[o].type.contentMatch.matchFragment(n);if(!s||!s.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=J.from(r[o].type.create(r[o].attrs,n))}let i=e.start,a=e.end;t.step(new Kt(i,a,i,a,new ce(n,0,0),r.length,!0))}function hre(t,e,r,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=t.steps.length;t.doc.nodesBetween(e,r,(o,s)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(n,l)&&pre(t.doc,t.mapping.slice(a).map(s),n)){let u=null;if(n.schema.linebreakReplacement){let p=n.whitespace=="pre",m=!!n.contentMatch.matchType(n.schema.linebreakReplacement);p&&!m?u=!1:!p&&m&&(u=!0)}u===!1&&yI(t,o,s,a),Xw(t,t.mapping.slice(a).map(s,1),n,void 0,u===null);let d=t.mapping.slice(a),f=d.map(s,1),h=d.map(s+o.nodeSize,1);return t.step(new Kt(f,h,f+1,h-1,new ce(J.from(n.create(l,null,o.marks)),0,0),1,!0)),u===!0&&vI(t,o,s,a),!1}})}function vI(t,e,r,n){e.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let l=t.mapping.slice(n).map(r+1+a+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function yI(t,e,r,n){e.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(n).map(r+1+a);t.replaceWith(o,o+1,e.type.schema.text(` 81`))}})}function pre(t,e,r){let n=t.resolve(e),i=n.index();return n.parent.canReplaceWith(i,i+1,r)}function mre(t,e,r,n,i){let a=t.doc.nodeAt(e);if(!a)throw new RangeError("No node at given position");r||(r=a.type);let o=r.create(n,null,i||a.marks);if(a.isLeaf)return t.replaceWith(e,e+a.nodeSize,o);if(!r.validContent(a.content))throw new RangeError("Invalid content for node type "+r.name);t.step(new Kt(e,e+a.nodeSize,e+1,e+a.nodeSize-1,new ce(J.from(o),0,0),1,!0))}function vi(t,e,r=1,n){let i=t.resolve(e),a=i.depth-r,o=n&&n[n.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,d=r-2;u>a;u--,d--){let f=i.node(u),h=i.index(u);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),m=n&&n[d+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=n&&n[d]||f;if(!f.canReplace(h+1,f.childCount)||!g.type.validContent(p))return!1}let s=i.indexAfter(a),l=n&&n[0];return i.node(a).canReplaceWith(s,s,l?l.type:i.node(a+1).type)}function gre(t,e,r=1,n){let i=t.doc.resolve(e),a=J.empty,o=J.empty;for(let s=i.depth,l=i.depth-r,u=r-1;s>l;s--,u--){a=J.from(i.node(s).copy(a));let d=n&&n[u];o=J.from(d?d.type.create(d.attrs,o):i.node(s).copy(o))}t.step(new At(e,e,new ce(a.append(o),r,r),!0))}function oa(t,e){let r=t.resolve(e),n=r.index();return xI(r.nodeBefore,r.nodeAfter)&&r.parent.canReplace(n,n+1)}function vre(t,e){e.content.size||t.type.compatibleContent(e.type);let r=t.contentMatchAt(t.childCount),{linebreakReplacement:n}=t.type.schema;for(let i=0;i<e.childCount;i++){let a=e.child(i),o=a.type==n?t.type.schema.nodes.text:a.type;if(r=r.matchType(o),!r||!t.type.allowsMarks(a.marks))return!1}return r.validEnd}function xI(t,e){return!!(t&&e&&!t.isLeaf&&vre(t,e))}function Uh(t,e,r=-1){let n=t.resolve(e);for(let i=n.depth;;i--){let a,o,s=n.index(i);if(i==n.depth?(a=n.nodeBefore,o=n.nodeAfter):r>0?(a=n.node(i+1),s++,o=n.node(i).maybeChild(s)):(a=n.node(i).maybeChild(s-1),o=n.node(i+1)),a&&!a.isTextblock&&xI(a,o)&&n.node(i).canReplace(s,s+1))return e;if(i==0)break;e=r<0?n.before(i):n.after(i)}}function yre(t,e,r){let n=null,{linebreakReplacement:i}=t.doc.type.schema,a=t.doc.resolve(e-r),o=a.node().type;if(i&&o.inlineContent){let d=o.whitespace=="pre",f=!!o.contentMatch.matchType(i);d&&!f?n=!1:!d&&f&&(n=!0)}let s=t.steps.length;if(n===!1){let d=t.doc.resolve(e+r);yI(t,d.node(),d.before(),s)}o.inlineContent&&Xw(t,e+r-1,o,a.node().contentMatchAt(a.index()),n==null);let l=t.mapping.slice(s),u=l.map(e-r);if(t.step(new At(u,l.map(e+r,-1),ce.empty,!0)),n===!0){let d=t.doc.resolve(u);vI(t,d.node(),d.before(),t.steps.length)}return t}function xre(t,e,r){let n=t.resolve(e);if(n.parent.canReplaceWith(n.index(),n.index(),r))return e;if(n.parentOffset==0)for(let i=n.depth-1;i>=0;i--){let a=n.index(i);if(n.node(i).canReplaceWith(a,a,r))return n.before(i+1);if(a>0)return null}if(n.parentOffset==n.parent.content.size)for(let i=n.depth-1;i>=0;i--){let a=n.indexAfter(i);if(n.node(i).canReplaceWith(a,a,r))return n.after(i+1);if(a<n.node(i).childCount)return null}return null}function bI(t,e,r){let n=t.resolve(e);if(!r.content.size)return e;let i=r.content;for(let a=0;a<r.openStart;a++)i=i.firstChild.content;for(let a=1;a<=(r.openStart==0&&r.size?2:1);a++)for(let o=n.depth;o>=0;o--){let s=o==n.depth?0:n.pos<=(n.start(o+1)+n.end(o+1))/2?-1:1,l=n.index(o)+(s>0?1:0),u=n.node(o),d=!1;if(a==1)d=u.canReplace(l,l,i);else{let f=u.contentMatchAt(l).findWrapping(i.firstChild.type);d=f&&u.canReplaceWith(l,l,f[0])}if(d)return s==0?n.pos:s<0?n.before(o+1):n.after(o+1)}return null}
vendor: 6,689 bytes, line 81
81function Hh(t,e,r=e,n=ce.empty){if(e==r&&!n.size)return null;let i=t.resolve(e),a=t.resolve(r);return wI(i,a,n)?new At(e,r,n):new bre(i,a,n).fit()}function wI(t,e,r){return!r.openStart&&!r.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),r.content)}class bre{constructor(e,r,n){this.$from=e,this.$to=r,this.unplaced=n,this.frontier=[],this.placed=J.empty;for(let i=0;i<=e.depth;i++){let a=e.node(i);this.frontier.push({type:a.type,match:a.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=J.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),r=this.placed.size-this.depth-this.$from.depth,n=this.$from,i=this.close(e<0?this.$to:n.doc.resolve(e));if(!i)return null;let a=this.placed,o=n.depth,s=i.depth;for(;o&&s&&a.childCount==1;)a=a.firstChild.content,o--,s--;let l=new ce(a,o,s);return e>-1?new Kt(n.pos,e,this.$to.pos,this.$to.end(),l,r):l.size||n.pos!=this.$to.pos?new At(n.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let r=this.unplaced.content,n=0,i=this.unplaced.openEnd;n<e;n++){let a=r.firstChild;if(r.childCount>1&&(i=0),a.type.spec.isolating&&i<=n){e=n;break}r=a.content}for(let r=1;r<=2;r++)for(let n=r==1?e:this.unplaced.openStart;n>=0;n--){let i,a=null;n?(a=Ny(this.unplaced.content,n-1).firstChild,i=a.content):i=this.unplaced.content;let o=i.firstChild;for(let s=this.depth;s>=0;s--){let{type:l,match:u}=this.frontier[s],d,f=null;if(r==1&&(o?u.matchType(o.type)||(f=u.fillBefore(J.from(o),!1)):a&&l.compatibleContent(a.type)))return{sliceDepth:n,frontierDepth:s,parent:a,inject:f};if(r==2&&o&&(d=u.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:s,parent:a,wrap:d};if(a&&u.matchType(a.type))break}}}openMore(){let{content:e,openStart:r,openEnd:n}=this.unplaced,i=Ny(e,r);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new ce(e,r+1,Math.max(n,i.size+r>=e.size-n?r+1:0)),!0)}dropNode(){let{content:e,openStart:r,openEnd:n}=this.unplaced,i=Ny(e,r);if(i.childCount<=1&&r>0){let a=e.size-r<=r+i.size;this.unplaced=new ce(sl(e,r-1,1),r-1,a?r-1:n)}else this.unplaced=new ce(sl(e,r,1),r,n)}placeNodes({sliceDepth:e,frontierDepth:r,parent:n,inject:i,wrap:a}){for(;this.depth>r;)this.closeFrontierNode();if(a)for(let g=0;g<a.length;g++)this.openFrontierNode(a[g]);let o=this.unplaced,s=n?n.content:o.content,l=o.openStart-e,u=0,d=[],{match:f,type:h}=this.frontier[r];if(i){for(let g=0;g<i.childCount;g++)d.push(i.child(g));f=f.matchFragment(i)}let p=s.size+e-(o.content.size-o.openEnd);for(;u<s.childCount;){let g=s.child(u),v=f.matchType(g.type);if(!v)break;u++,(u>1||l==0||g.content.size)&&(f=v,d.push(_I(g.mark(h.allowedMarks(g.marks)),u==1?l:0,u==s.childCount?p:-1)))}let m=u==s.childCount;m||(p=-1),this.placed=ll(this.placed,r,J.from(d)),this.frontier[r].match=f,m&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,v=s;g<p;g++){let y=v.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),v=y.content}this.unplaced=m?e==0?ce.empty:new ce(sl(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new ce(sl(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],r;if(!e.type.isTextblock||!Cy(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(r=this.findCloseLevel(this.$to))&&r.depth==this.depth)return-1;let{depth:n}=this.$to,i=this.$to.after(n);for(;n>1&&i==this.$to.end(--n);)++i;return i}findCloseLevel(e){e:for(let r=Math.min(this.depth,e.depth);r>=0;r--){let{match:n,type:i}=this.frontier[r],a=r<e.depth&&e.end(r+1)==e.pos+(e.depth-(r+1)),o=Cy(e,r,i,n,a);if(o){for(let s=r-1;s>=0;s--){let{match:l,type:u}=this.frontier[s],d=Cy(e,s,u,l,!0);if(!d||d.childCount)continue e}return{depth:r,fit:o,move:a?e.doc.resolve(e.after(r+1)):e}}}}close(e){let r=this.findCloseLevel(e);if(!r)return null;for(;this.depth>r.depth;)this.closeFrontierNode();r.fit.childCount&&(this.placed=ll(this.placed,r.depth,r.fit)),e=r.move;for(let n=r.depth+1;n<=e.depth;n++){let i=e.node(n),a=i.type.contentMatch.fillBefore(i.content,!0,e.index(n));this.openFrontierNode(i.type,i.attrs,a)}return e}openFrontierNode(e,r=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=ll(this.placed,this.depth,J.from(e.create(r,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let r=this.frontier.pop().match.fillBefore(J.empty,!0);r.childCount&&(this.placed=ll(this.placed,this.frontier.length,r))}}function sl(t,e,r){return e==0?t.cutByIndex(r,t.childCount):t.replaceChild(0,t.firstChild.copy(sl(t.firstChild.content,e-1,r)))}function ll(t,e,r){return e==0?t.append(r):t.replaceChild(t.childCount-1,t.lastChild.copy(ll(t.lastChild.content,e-1,r)))}function Ny(t,e){for(let r=0;r<e;r++)t=t.firstChild.content;return t}function _I(t,e,r){if(e<=0)return t;let n=t.content;return e>1&&(n=n.replaceChild(0,_I(n.firstChild,e-1,n.childCount==1?r-1:0))),e>0&&(n=t.type.contentMatch.fillBefore(n).append(n),r<=0&&(n=n.append(t.type.contentMatch.matchFragment(n).fillBefore(J.empty,!0)))),t.copy(n)}function Cy(t,e,r,n,i){let a=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==a.childCount&&!r.compatibleContent(a.type))return null;let s=n.fillBefore(a.content,!0,o);return s&&!wre(r,a.content,o)?s:null}function wre(t,e,r){for(let n=r;n<e.childCount;n++)if(!t.allowsMarks(e.child(n).marks))return!0;return!1}function _re(t){return t.spec.defining||t.spec.definingForContent}function Sre(t,e,r,n){if(!n.size)return t.deleteRange(e,r);let i=t.doc.resolve(e),a=t.doc.resolve(r);if(wI(i,a,n))return t.step(new At(e,r,n));let o=jI(i,a);o[o.length-1]==0&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let h=i.depth,p=i.pos-1;h>0;h--,p--){let m=i.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(h)>-1?s=h:i.before(h)==p&&o.splice(1,0,-h)}let l=o.indexOf(s),u=[],d=n.openStart;for(let h=n.content,p=0;;p++){let m=h.firstChild;if(u.push(m),p==n.openStart)break;h=m.content}for(let h=d-1;h>=0;h--){let p=u[h],m=_re(p.type);if(m&&!p.sameMarkup(i.node(Math.abs(s)-1)))d=h;else if(m||!p.type.isTextblock)break}for(let h=n.openStart;h>=0;h--){let p=(h+d+1)%(n.openStart+1),m=u[p];if(m)for(let g=0;g<o.length;g++){let v=o[(g+l)%o.length],y=!0;v<0&&(y=!1,v=-v);let w=i.node(v-1),_=i.index(v-1);if(w.canReplaceWith(_,_,m.type,m.marks))return t.replace(i.before(v),y?a.after(v):r,new ce(SI(n.content,0,n.openStart,p),p,n.openEnd))}}let f=t.steps.length;for(let h=o.length-1;h>=0&&(t.replace(e,r,n),!(t.steps.length>f));h--){let p=o[h];
vendor: 13,174 bytes, line 81
81p<0||(e=i.before(p),r=a.after(p))}}function SI(t,e,r,n,i){if(e<r){let a=t.firstChild;t=t.replaceChild(0,a.copy(SI(a.content,e+1,r,n,a)))}if(e>n){let a=i.contentMatchAt(0),o=a.fillBefore(t).append(t);t=o.append(a.matchFragment(o).fillBefore(J.empty,!0))}return t}function jre(t,e,r,n){if(!n.isInline&&e==r&&t.doc.resolve(e).parent.content.size){let i=xre(t.doc,e,n.type);i!=null&&(e=r=i)}t.replaceRange(e,r,new ce(J.from(n),0,0))}function Ore(t,e,r){let n=t.doc.resolve(e),i=t.doc.resolve(r);if(n.parent.isTextblock&&i.parent.isTextblock&&n.start()!=i.start()&&n.parentOffset==0&&i.parentOffset==0){let o=n.sharedDepth(r),s=!1;for(let l=n.depth;l>o;l--)n.node(l).type.spec.isolating&&(s=!0);for(let l=i.depth;l>o;l--)i.node(l).type.spec.isolating&&(s=!0);if(!s){for(let l=n.depth;l>0&&e==n.start(l);l--)e=n.before(l);for(let l=i.depth;l>0&&r==i.start(l);l--)r=i.before(l);n=t.doc.resolve(e),i=t.doc.resolve(r)}}let a=jI(n,i);for(let o=0;o<a.length;o++){let s=a[o],l=o==a.length-1;if(l&&s==0||n.node(s).type.contentMatch.validEnd)return t.delete(n.start(s),i.end(s));if(s>0&&(l||n.node(s-1).canReplace(n.index(s-1),i.indexAfter(s-1))))return t.delete(n.before(s),i.after(s))}for(let o=1;o<=n.depth&&o<=i.depth;o++)if(e-n.start(o)==n.depth-o&&r>n.end(o)&&i.end(o)-r!=i.depth-o&&n.start(o-1)==i.start(o-1)&&n.node(o-1).canReplace(n.index(o-1),i.index(o-1)))return t.delete(n.before(o),r);t.delete(e,r)}function jI(t,e){let r=[],n=Math.min(t.depth,e.depth);for(let i=n;i>=0;i--){let a=t.start(i);if(a<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(a==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==a-1)&&r.push(i)}return r}class Fo extends hr{constructor(e,r,n){super(),this.pos=e,this.attr=r,this.value=n}apply(e){let r=e.nodeAt(this.pos);if(!r)return Pt.fail("No node at attribute step's position");let n=Object.create(null);for(let a in r.attrs)n[a]=r.attrs[a];n[this.attr]=this.value;let i=r.type.create(n,null,r.marks);return Pt.fromReplace(e,this.pos,this.pos+1,new ce(J.from(i),0,r.isLeaf?0:1))}getMap(){return zr.empty}invert(e){return new Fo(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let r=e.mapResult(this.pos,1);return r.deletedAfter?null:new Fo(r.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,r){if(typeof r.pos!="number"||typeof r.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Fo(r.pos,r.attr,r.value)}}hr.jsonID("attr",Fo);class vc extends hr{constructor(e,r){super(),this.attr=e,this.value=r}apply(e){let r=Object.create(null);for(let i in e.attrs)r[i]=e.attrs[i];r[this.attr]=this.value;let n=e.type.create(r,e.content,e.marks);return Pt.ok(n)}getMap(){return zr.empty}invert(e){return new vc(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,r){if(typeof r.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new vc(r.attr,r.value)}}hr.jsonID("docAttr",vc);let Os=class extends Error{};Os=function t(e){let r=Error.call(this,e);return r.__proto__=t.prototype,r};Os.prototype=Object.create(Error.prototype);Os.prototype.constructor=Os;Os.prototype.name="TransformError";class OI{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new gc}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let r=this.maybeStep(e);if(r.failed)throw new Os(r.failed);return this}maybeStep(e){let r=e.apply(this.doc);return r.failed||this.addStep(e,r.doc),r}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,r=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let i=this.mapping.maps[n];n&&(e=i.map(e,1),r=i.map(r,-1)),i.forEach((a,o,s,l)=>{e=Math.min(e,s),r=Math.max(r,l)})}return e==1e9?null:{from:e,to:r}}addStep(e,r){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=r}replace(e,r=e,n=ce.empty){let i=Hh(this.doc,e,r,n);return i&&this.step(i),this}replaceWith(e,r,n){return this.replace(e,r,new ce(J.from(n),0,0))}delete(e,r){return this.replace(e,r,ce.empty)}insert(e,r){return this.replaceWith(e,e,r)}replaceRange(e,r,n){return Sre(this,e,r,n),this}replaceRangeWith(e,r,n){return jre(this,e,r,n),this}deleteRange(e,r){return Ore(this,e,r),this}lift(e,r){return cre(this,e,r),this}join(e,r=1){return yre(this,e,r),this}wrap(e,r){return fre(this,e,r),this}setBlockType(e,r=e,n,i=null){return hre(this,e,r,n,i),this}setNodeMarkup(e,r,n=null,i){return mre(this,e,r,n,i),this}setNodeAttribute(e,r,n){return this.step(new Fo(e,r,n)),this}setDocAttribute(e,r){return this.step(new vc(e,r)),this}addNodeMark(e,r){return this.step(new qi(e,r)),this}removeNodeMark(e,r){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(r instanceof nt)r.isInSet(n.marks)&&this.step(new Qa(e,r));else{let i=n.marks,a,o=[];for(;a=r.isInSet(i);)o.push(new Qa(e,a)),i=a.removeFromSet(i);for(let s=o.length-1;s>=0;s--)this.step(o[s])}return this}split(e,r=1,n){return gre(this,e,r,n),this}addMark(e,r,n){return ore(this,e,r,n),this}removeMark(e,r,n){return sre(this,e,r,n),this}clearIncompatible(e,r,n){return Xw(this,e,r,n),this}}const ky=Object.create(null);class Fe{constructor(e,r,n){this.$anchor=e,this.$head=r,this.ranges=n||[new Nre(e.min(r),e.max(r))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let r=0;r<e.length;r++)if(e[r].$from.pos!=e[r].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,r=ce.empty){let n=r.content.lastChild,i=null;for(let s=0;s<r.openEnd;s++)i=n,n=n.lastChild;let a=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:l,$to:u}=o[s],d=e.mapping.slice(a);e.replaceRange(d.map(l.pos),d.map(u.pos),s?ce.empty:r),s==0&&oA(e,a,(n?n.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,r){let n=e.steps.length,i=this.ranges;for(let a=0;a<i.length;a++){let{$from:o,$to:s}=i[a],l=e.mapping.slice(n),u=l.map(o.pos),d=l.map(s.pos);a?e.deleteRange(u,d):(e.replaceRangeWith(u,d,r),oA(e,n,r.isInline?-1:1))}}static findFrom(e,r,n=!1){let i=e.parent.inlineContent?new Pe(e):Oo(e.node(0),e.parent,e.pos,e.index(),r,n);if(i)return i;for(let a=e.depth-1;a>=0;a--){let o=r<0?Oo(e.node(0),e.node(a),e.before(a+1),e.index(a),r,n):Oo(e.node(0),e.node(a),e.after(a+1),e.index(a)+1,r,n);if(o)return o}return null}static near(e,r=1){return this.findFrom(e,r)||this.findFrom(e,-r)||new Wr(e.node(0))}static atStart(e){return Oo(e,e,0,0,1)||new Wr(e)}static atEnd(e){return Oo(e,e,e.content.size,e.childCount,-1)||new Wr(e)}static fromJSON(e,r){if(!r||!r.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=ky[r.type];if(!n)throw new RangeError(`No selection type ${r.type} defined`);return n.fromJSON(e,r)}static jsonID(e,r){if(e in ky)throw new RangeError("Duplicate use of selection JSON ID "+e);return ky[e]=r,r.prototype.jsonID=e,r}getBookmark(){return Pe.between(this.$anchor,this.$head).getBookmark()}}Fe.prototype.visible=!0;class Nre{constructor(e,r){this.$from=e,this.$to=r}}let iA=!1;function aA(t){!iA&&!t.parent.inlineContent&&(iA=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Pe extends Fe{constructor(e,r=e){aA(e),aA(r),super(e,r)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,r){let n=e.resolve(r.map(this.head));if(!n.parent.inlineContent)return Fe.near(n);let i=e.resolve(r.map(this.anchor));return new Pe(i.parent.inlineContent?i:n,n)}replace(e,r=ce.empty){if(super.replace(e,r),r==ce.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof Pe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Wh(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,r){if(typeof r.anchor!="number"||typeof r.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Pe(e.resolve(r.anchor),e.resolve(r.head))}static create(e,r,n=r){let i=e.resolve(r);return new this(i,n==r?i:e.resolve(n))}static between(e,r,n){let i=e.pos-r.pos;if((!n||i)&&(n=i>=0?1:-1),!r.parent.inlineContent){let a=Fe.findFrom(r,n,!0)||Fe.findFrom(r,-n,!0);if(a)r=a.$head;else return Fe.near(r,n)}return e.parent.inlineContent||(i==0?e=r:(e=(Fe.findFrom(e,-n,!0)||Fe.findFrom(e,n,!0)).$anchor,e.pos<r.pos!=i<0&&(e=r))),new Pe(e,r)}}Fe.jsonID("text",Pe);class Wh{constructor(e,r){this.anchor=e,this.head=r}map(e){return new Wh(e.map(this.anchor),e.map(this.head))}resolve(e){return Pe.between(e.resolve(this.anchor),e.resolve(this.head))}}class we extends Fe{constructor(e){let r=e.nodeAfter,n=e.node(0).resolve(e.pos+r.nodeSize);super(e,n),this.node=r}map(e,r){let{deleted:n,pos:i}=r.mapResult(this.anchor),a=e.resolve(i);return n?Fe.near(a):new we(a)}content(){return new ce(J.from(this.node),0,0)}eq(e){return e instanceof we&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Zw(this.anchor)}static fromJSON(e,r){if(typeof r.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new we(e.resolve(r.anchor))}static create(e,r){return new we(e.resolve(r))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}we.prototype.visible=!1;Fe.jsonID("node",we);class Zw{constructor(e){this.anchor=e}map(e){let{deleted:r,pos:n}=e.mapResult(this.anchor);return r?new Wh(n,n):new Zw(n)}resolve(e){let r=e.resolve(this.anchor),n=r.nodeAfter;return n&&we.isSelectable(n)?new we(r):Fe.near(r)}}class Wr extends Fe{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,r=ce.empty){if(r==ce.empty){e.delete(0,e.doc.content.size);let n=Fe.atStart(e.doc);n.eq(e.selection)||e.setSelection(n)}else super.replace(e,r)}toJSON(){return{type:"all"}}static fromJSON(e){return new Wr(e)}map(e){return new Wr(e)}eq(e){return e instanceof Wr}getBookmark(){return Cre}}Fe.jsonID("all",Wr);const Cre={map(){return this},resolve(t){return new Wr(t)}};function Oo(t,e,r,n,i,a=!1){if(e.inlineContent)return Pe.create(t,r);for(let o=n-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let s=e.child(o);if(s.isAtom){if(!a&&we.isSelectable(s))return we.create(t,r-(i<0?s.nodeSize:0))}else{let l=Oo(t,s,r+i,i<0?s.childCount:0,i,a);if(l)return l}r+=s.nodeSize*i}return null}function oA(t,e,r){let n=t.steps.length-1;if(n<e)return;let i=t.steps[n];if(!(i instanceof At||i instanceof Kt))return;let a=t.mapping.maps[n],o;a.forEach((s,l,u,d)=>{o==null&&(o=d)}),t.setSelection(Fe.near(t.doc.resolve(o),r))}const sA=1,gu=2,lA=4;class kre extends OI{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|sA)&~gu,this.storedMarks=null,this}get selectionSet(){return(this.updated&sA)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=gu,this}ensureMarks(e){return nt.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&gu)>0}addStep(e,r){super.addStep(e,r),this.updated=this.updated&~gu,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,r=!0){let n=this.selection;return r&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||nt.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,r,n){let i=this.doc.type.schema;if(r==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(n==null&&(n=r),!e)return this.deleteRange(r,n);let a=this.storedMarks;if(!a){let o=this.doc.resolve(r);a=n==r?o.marks():o.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(r,n,i.text(e,a)),!this.selection.empty&&this.selection.to==r+e.length&&this.setSelection(Fe.near(this.selection.$to)),this}}setMeta(e,r){return this.meta[typeof e=="string"?e:e.key]=r,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=lA,this}get scrolledIntoView(){return(this.updated&lA)>0}}function cA(t,e){return!e||!t?t:t.bind(e)}
vendor: 4,490 bytes, line 81
81class cl{constructor(e,r,n){this.name=e,this.init=cA(r.init,n),this.apply=cA(r.apply,n)}}const Are=[new cl("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new cl("selection",{init(t,e){return t.selection||Fe.atStart(e.doc)},apply(t){return t.selection}}),new cl("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,r,n){return n.selection.$cursor?t.storedMarks:null}}),new cl("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Ay{constructor(e,r){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Are.slice(),r&&r.forEach(n=>{if(this.pluginsByKey[n.key])throw new RangeError("Adding different instances of a keyed plugin ("+n.key+")");this.plugins.push(n),this.pluginsByKey[n.key]=n,n.spec.state&&this.fields.push(new cl(n.key,n.spec.state,n))})}}class Do{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,r=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=r){let i=this.config.plugins[n];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let r=[e],n=this.applyInner(e),i=null;for(;;){let a=!1;for(let o=0;o<this.config.plugins.length;o++){let s=this.config.plugins[o];if(s.spec.appendTransaction){let l=i?i[o].n:0,u=i?i[o].state:this,d=l<r.length&&s.spec.appendTransaction.call(s,l?r.slice(l):r,u,n);if(d&&n.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<o?{state:n,n:r.length}:{state:this,n:0})}r.push(d),n=n.applyInner(d),a=!0}i&&(i[o]={state:n,n:r.length})}}if(!a)return{state:n,transactions:r}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let r=new Do(this.config),n=this.config.fields;for(let i=0;i<n.length;i++){let a=n[i];r[a.name]=a.apply(e,this[a.name],this,r)}return r}get tr(){return new kre(this)}static create(e){let r=new Ay(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new Do(r);for(let i=0;i<r.fields.length;i++)n[r.fields[i].name]=r.fields[i].init(e,n);return n}reconfigure(e){let r=new Ay(this.schema,e.plugins),n=r.fields,i=new Do(r);for(let a=0;a<n.length;a++){let o=n[a].name;i[o]=this.hasOwnProperty(o)?this[o]:n[a].init(e,i)}return i}toJSON(e){let r={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(r.storedMarks=this.storedMarks.map(n=>n.toJSON())),e&&typeof e=="object")for(let n in e){if(n=="doc"||n=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[n],a=i.spec.state;a&&a.toJSON&&(r[n]=a.toJSON.call(i,this[i.key]))}return r}static fromJSON(e,r,n){if(!r)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Ay(e.schema,e.plugins),a=new Do(i);return i.fields.forEach(o=>{if(o.name=="doc")a.doc=Wi.fromJSON(e.schema,r.doc);else if(o.name=="selection")a.selection=Fe.fromJSON(a.doc,r.selection);else if(o.name=="storedMarks")r.storedMarks&&(a.storedMarks=r.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let s in n){let l=n[s],u=l.spec.state;if(l.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(r,s)){a[o.name]=u.fromJSON.call(l,e,r[s],a);return}}a[o.name]=o.init(e,a)}}),a}}function NI(t,e,r){for(let n in t){let i=t[n];i instanceof Function?i=i.bind(e):n=="handleDOMEvents"&&(i=NI(i,e,{})),r[n]=i}return r}class Jt{constructor(e){this.spec=e,this.props={},e.props&&NI(e.props,this,this.props),this.key=e.key?e.key.key:CI("plugin")}getState(e){return e[this.key]}}const Ey=Object.create(null);function CI(t){return t in Ey?t+"$"+ ++Ey[t]:(Ey[t]=0,t+"$")}class Dr{constructor(e="key"){this.key=CI(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const rr=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ns=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Fb=null;const ai=function(t,e,r){let n=Fb||(Fb=document.createRange());return n.setEnd(t,r??t.nodeValue.length),n.setStart(t,e||0),n},Ere=function(){Fb=null},eo=function(t,e,r,n){return r&&(uA(t,e,r,n,-1)||uA(t,e,r,n,1))},Pre=/^(img|br|input|textarea|hr)$/i;function uA(t,e,r,n,i){for(var a;;){if(t==r&&e==n)return!0;
vendor: 17,893 bytes, lines 81-82
81if(e==(i<0?0:nn(t))){let o=t.parentNode;if(!o||o.nodeType!=1||zc(t)||Pre.test(t.nodeName)||t.contentEditable=="false")return!1;e=rr(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((a=o.pmViewDesc)===null||a===void 0)&&a.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?nn(t):0}else return!1}}function nn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Tre(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=nn(t)}else if(t.parentNode&&!zc(t))e=rr(t),t=t.parentNode;else return null}}function Mre(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!zc(t))e=rr(t)+1,t=t.parentNode;else return null}}function Dre(t,e,r){for(let n=e==0,i=e==nn(t);n||i;){if(t==r)return!0;let a=rr(t);if(t=t.parentNode,!t)return!1;n=n&&a==0,i=i&&a==nn(t)}}function zc(t){let e;for(let r=t;r&&!(e=r.pmViewDesc);r=r.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Vh=function(t){return t.focusNode&&eo(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Sa(t,e){let r=document.createEvent("Event");return r.initEvent("keydown",!0,!0),r.keyCode=t,r.key=r.code=e,r}function Rre(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Ire(t,e,r){if(t.caretPositionFromPoint)try{let n=t.caretPositionFromPoint(e,r);if(n)return{node:n.offsetNode,offset:Math.min(nn(n.offsetNode),n.offset)}}catch{}if(t.caretRangeFromPoint){let n=t.caretRangeFromPoint(e,r);if(n)return{node:n.startContainer,offset:Math.min(nn(n.startContainer),n.startOffset)}}}const Vn=typeof navigator<"u"?navigator:null,dA=typeof document<"u"?document:null,sa=Vn&&Vn.userAgent||"",zb=/Edge\/(\d+)/.exec(sa),kI=/MSIE \d/.exec(sa),qb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(sa),Er=!!(kI||qb||zb),Ki=kI?document.documentMode:qb?+qb[1]:zb?+zb[1]:0,sn=!Er&&/gecko\/(\d+)/i.test(sa);sn&&+(/Firefox\/(\d+)/.exec(sa)||[0,0])[1];const Ub=!Er&&/Chrome\/(\d+)/.exec(sa),ir=!!Ub,AI=Ub?+Ub[1]:0,ur=!Er&&!!Vn&&/Apple Computer/.test(Vn.vendor),Cs=ur&&(/Mobile\/\w+/.test(sa)||!!Vn&&Vn.maxTouchPoints>2),tn=Cs||(Vn?/Mac/.test(Vn.platform):!1),EI=Vn?/Win/.test(Vn.platform):!1,fi=/Android \d/.test(sa),qc=!!dA&&"webkitFontSmoothing"in dA.documentElement.style,$re=qc?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Lre(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function ei(t,e){return typeof t=="number"?t:t[e]}function Bre(t){let e=t.getBoundingClientRect(),r=e.width/t.offsetWidth||1,n=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*r,top:e.top,bottom:e.top+t.clientHeight*n}}function fA(t,e,r){let n=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,a=t.dom.ownerDocument;for(let o=r||t.dom;o;){if(o.nodeType!=1){o=Ns(o);continue}let s=o,l=s==a.body,u=l?Lre(a):Bre(s),d=0,f=0;if(e.top<u.top+ei(n,"top")?f=-(u.top-e.top+ei(i,"top")):e.bottom>u.bottom-ei(n,"bottom")&&(f=e.bottom-e.top>u.bottom-u.top?e.top+ei(i,"top")-u.top:e.bottom-u.bottom+ei(i,"bottom")),e.left<u.left+ei(n,"left")?d=-(u.left-e.left+ei(i,"left")):e.right>u.right-ei(n,"right")&&(d=e.right-u.right+ei(i,"right")),d||f)if(l)a.defaultView.scrollBy(d,f);else{let p=s.scrollLeft,m=s.scrollTop;f&&(s.scrollTop+=f),d&&(s.scrollLeft+=d);let g=s.scrollLeft-p,v=s.scrollTop-m;e={left:e.left-g,top:e.top-v,right:e.right-g,bottom:e.bottom-v}}let h=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:Ns(o)}}function Fre(t){let e=t.dom.getBoundingClientRect(),r=Math.max(0,e.top),n,i;for(let a=(e.left+e.right)/2,o=r+1;o<Math.min(innerHeight,e.bottom);o+=5){let s=t.root.elementFromPoint(a,o);if(!s||s==t.dom||!t.dom.contains(s))continue;let l=s.getBoundingClientRect();if(l.top>=r-20){n=s,i=l.top;break}}return{refDOM:n,refTop:i,stack:PI(t.dom)}}function PI(t){let e=[],r=t.ownerDocument;for(let n=t;n&&(e.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),t!=r);n=Ns(n));return e}function zre({refDOM:t,refTop:e,stack:r}){let n=t?t.getBoundingClientRect().top:0;TI(r,n==0?0:n-e)}function TI(t,e){for(let r=0;r<t.length;r++){let{dom:n,top:i,left:a}=t[r];n.scrollTop!=i+e&&(n.scrollTop=i+e),n.scrollLeft!=a&&(n.scrollLeft=a)}}let wo=null;function qre(t){if(t.setActive)return t.setActive();if(wo)return t.focus(wo);let e=PI(t);t.focus(wo==null?{get preventScroll(){return wo={preventScroll:!0},!0}}:void 0),wo||(wo=!1,TI(e,0))}function MI(t,e){let r,n=2e8,i,a=0,o=e.top,s=e.top,l,u;for(let d=t.firstChild,f=0;d;d=d.nextSibling,f++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=ai(d).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=o&&m.bottom>=s){o=Math.max(m.bottom,o),s=Math.min(m.top,s);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<n){r=d,n=g,i=g&&r.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.nodeType==1&&g&&(a=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=d,u={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!r&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(a=f+1)}}return!r&&l&&(r=l,i=u,n=0),r&&r.nodeType==3?Ure(r,i):!r||n&&r.nodeType==1?{node:t,offset:a}:MI(r,i)}function Ure(t,e){let r=t.nodeValue.length,n=document.createRange(),i;for(let a=0;a<r;a++){n.setEnd(t,a+1),n.setStart(t,a);let o=Ti(n,1);if(o.top!=o.bottom&&Qw(e,o)){i={node:t,offset:a+(e.left>=(o.left+o.right)/2?1:0)};break}}return n.detach(),i||{node:t,offset:0}}function Qw(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Hre(t,e){let r=t.parentNode;return r&&/^li$/i.test(r.nodeName)&&e.left<t.getBoundingClientRect().left?r:t}function Wre(t,e,r){let{node:n,offset:i}=MI(e,r),a=-1;if(n.nodeType==1&&!n.firstChild){let o=n.getBoundingClientRect();a=o.left!=o.right&&r.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(n,i,a)}function Vre(t,e,r,n){let i=-1;for(let a=e,o=!1;a!=t.dom;){let s=t.docView.nearestDesc(a,!0),l;if(!s)return null;if(s.dom.nodeType==1&&(s.node.isBlock&&s.parent||!s.contentDOM)&&((l=s.dom.getBoundingClientRect()).width||l.height)&&(s.node.isBlock&&s.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(s.dom.nodeName)&&(!o&&l.left>n.left||l.top>n.top?i=s.posBefore:(!o&&l.right<n.left||l.bottom<n.top)&&(i=s.posAfter),o=!0),!s.contentDOM&&i<0&&!s.node.isText))return(s.node.isBlock?n.top<(l.top+l.bottom)/2:n.left<(l.left+l.right)/2)?s.posBefore:s.posAfter;a=s.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,r,-1)}function DI(t,e,r){let n=t.childNodes.length;if(n&&r.top<r.bottom)for(let i=Math.max(0,Math.min(n-1,Math.floor(n*(e.top-r.top)/(r.bottom-r.top))-2)),a=i;;){let o=t.childNodes[a];if(o.nodeType==1){let s=o.getClientRects();for(let l=0;l<s.length;l++){let u=s[l];if(Qw(e,u))return DI(o,e,u)}}if((a=(a+1)%n)==i)break}return t}function Kre(t,e){let r=t.dom.ownerDocument,n,i=0,a=Ire(r,e.left,e.top);a&&({node:n,offset:i}=a);let o=(t.root.elementFromPoint?t.root:r).elementFromPoint(e.left,e.top),s;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let u=t.dom.getBoundingClientRect();if(!Qw(e,u)||(o=DI(t.dom,e,u),!o))return null}if(ur)for(let u=o;n&&u;u=Ns(u))u.draggable&&(n=void 0);if(o=Hre(o,e),n){if(sn&&n.nodeType==1&&(i=Math.min(i,n.childNodes.length),i<n.childNodes.length)){let d=n.childNodes[i],f;d.nodeName=="IMG"&&(f=d.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let u;qc&&i&&n.nodeType==1&&(u=n.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,n==t.dom&&i==n.childNodes.length-1&&n.lastChild.nodeType==1&&e.top>n.lastChild.getBoundingClientRect().bottom?s=t.state.doc.content.size:(i==0||n.nodeType!=1||n.childNodes[i-1].nodeName!="BR")&&(s=Vre(t,n,i,e))}s==null&&(s=Wre(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:s,inside:l?l.posAtStart-l.border:-1}}function hA(t){return t.top<t.bottom||t.left<t.right}function Ti(t,e){let r=t.getClientRects();if(r.length){let n=r[e<0?0:r.length-1];if(hA(n))return n}return Array.prototype.find.call(r,hA)||t.getBoundingClientRect()}const Gre=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function RI(t,e,r){let{node:n,offset:i,atom:a}=t.docView.domFromPos(e,r<0?-1:1),o=qc||sn;if(n.nodeType==3)if(o&&(Gre.test(n.nodeValue)||(r<0?!i:i==n.nodeValue.length))){let l=Ti(ai(n,i,i),r);if(sn&&i&&/\s/.test(n.nodeValue[i-1])&&i<n.nodeValue.length){let u=Ti(ai(n,i-1,i-1),-1);if(u.top==l.top){let d=Ti(ai(n,i,i+1),-1);if(d.top!=l.top)return tl(d,d.left<u.left)}}return l}else{let l=i,u=i,d=r<0?1:-1;return r<0&&!i?(u++,d=-1):r>=0&&i==n.nodeValue.length?(l--,d=1):r<0?l--:u++,tl(Ti(ai(n,l,u),d),d<0)}if(!t.state.doc.resolve(e-(a||0)).parent.inlineContent){if(a==null&&i&&(r<0||i==nn(n))){let l=n.childNodes[i-1];if(l.nodeType==1)return Py(l.getBoundingClientRect(),!1)}if(a==null&&i<nn(n)){let l=n.childNodes[i];if(l.nodeType==1)return Py(l.getBoundingClientRect(),!0)}return Py(n.getBoundingClientRect(),r>=0)}if(a==null&&i&&(r<0||i==nn(n))){let l=n.childNodes[i-1],u=l.nodeType==3?ai(l,nn(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(u)return tl(Ti(u,1),!1)}if(a==null&&i<nn(n)){let l=n.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let u=l?l.nodeType==3?ai(l,0,o?0:1):l.nodeType==1?l:null:null;if(u)return tl(Ti(u,-1),!0)}return tl(Ti(n.nodeType==3?ai(n):n,-r),r>=0)}function tl(t,e){if(t.width==0)return t;let r=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:r,right:r}}function Py(t,e){if(t.height==0)return t;let r=e?t.top:t.bottom;return{top:r,bottom:r,left:t.left,right:t.right}}function II(t,e,r){let n=t.state,i=t.root.activeElement;n!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return r()}finally{n!=e&&t.updateState(n),i!=t.dom&&i&&i.focus()}}function Yre(t,e,r){let n=e.selection,i=r=="up"?n.$from:n.$to;return II(t,e,()=>{let{node:a}=t.docView.domFromPos(i.pos,r=="up"?-1:1);for(;;){let s=t.docView.nearestDesc(a,!0);if(!s)break;if(s.node.isBlock){a=s.contentDOM||s.dom;break}a=s.dom.parentNode}let o=RI(t,i.pos,1);for(let s=a.firstChild;s;s=s.nextSibling){let l;if(s.nodeType==1)l=s.getClientRects();else if(s.nodeType==3)l=ai(s,0,s.nodeValue.length).getClientRects();else continue;for(let u=0;u<l.length;u++){let d=l[u];if(d.bottom>d.top+1&&(r=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const Xre=/[\u0590-\u08ac]/;function Jre(t,e,r){let{$head:n}=e.selection;if(!n.parent.isTextblock)return!1;let i=n.parentOffset,a=!i,o=i==n.parent.content.size,s=t.domSelection();return s?!Xre.test(n.parent.textContent)||!s.modify?r=="left"||r=="backward"?a:o:II(t,e,()=>{let{focusNode:l,focusOffset:u,anchorNode:d,anchorOffset:f}=t.domSelectionRange(),h=s.caretBidiLevel;s.modify("move",r,"character");let p=n.depth?t.docView.domAfterPos(n.before()):t.dom,{focusNode:m,focusOffset:g}=t.domSelectionRange(),v=m&&!p.contains(m.nodeType==1?m:m.parentNode)||l==m&&u==g;try{s.collapse(d,f),l&&(l!=d||u!=f)&&s.extend&&s.extend(l,u)}catch{}return h!=null&&(s.caretBidiLevel=h),v}):n.pos==n.start()||n.pos==n.end()}let pA=null,mA=null,gA=!1;function Zre(t,e,r){return pA==e&&mA==r?gA:(pA=e,mA=r,gA=r=="up"||r=="down"?Yre(t,e,r):Jre(t,e,r))}const ln=0,vA=1,Aa=2,Kn=3;class Uc{constructor(e,r,n,i){this.parent=e,this.children=r,this.dom=n,this.contentDOM=i,this.dirty=ln,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,r,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let r=0;r<this.children.length;r++)e+=this.children[r].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let r=0,n=this.posAtStart;;r++){let i=this.children[r];if(i==e)return n;n+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,r,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let a,o;if(e==this.contentDOM)a=e.childNodes[r-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;a=e.previousSibling}for(;a&&!((o=a.pmViewDesc)&&o.parent==this);)a=a.previousSibling;return a?this.posBeforeChild(o)+o.size:this.posAtStart}else{let a,o;if(e==this.contentDOM)a=e.childNodes[r];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;a=e.nextSibling}for(;a&&!((o=a.pmViewDesc)&&o.parent==this);)a=a.nextSibling;return a?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=r>rr(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(r==0)for(let a=e;;a=a.parentNode){if(a==this.dom){i=!1;break}if(a.previousSibling)break}if(i==null&&r==e.childNodes.length)for(let a=e;;a=a.parentNode){if(a==this.dom){i=!0;break}if(a.nextSibling)break}}return i??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,r=!1){for(let n=!0,i=e;i;i=i.parentNode){let a=this.getDesc(i),o;if(a&&(!r||a.node))if(n&&(o=a.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))n=!1;else return a}}getDesc(e){let r=e.pmViewDesc;for(let n=r;n;n=n.parent)if(n==this)return r}posFromDOM(e,r,n){for(let i=e;i;i=i.parentNode){let a=this.getDesc(i);if(a)return a.localPosFromDOM(e,r,n)}return-1}descAt(e){for(let r=0,n=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==e&&a!=n){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let s=i.children[o];if(s.size){i=s;break}}return i}if(e<a)return i.descAt(e-n-i.border);n=a}}domFromPos(e,r){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,i=0;for(let a=0;n<this.children.length;n++){let o=this.children[n],s=a+o.size;if(s>e||o instanceof LI){i=e-a;break}a=s}if(i)return this.children[n].domFromPos(i-this.children[n].border,r);for(let a;n&&!(a=this.children[n-1]).size&&a instanceof $I&&a.side>=0;n--);if(r<=0){let a,o=!0;for(;a=n?this.children[n-1]:null,!(!a||a.dom.parentNode==this.contentDOM);n--,o=!1);return a&&r&&o&&!a.border&&!a.domAtom?a.domFromPos(a.size,r):{node:this.contentDOM,offset:a?rr(a.dom)+1:0}}else{let a,o=!0;for(;a=n<this.children.length?this.children[n]:null,!(!a||a.dom.parentNode==this.contentDOM);n++,o=!1);return a&&o&&!a.border&&!a.domAtom?a.domFromPos(0,r):{node:this.contentDOM,offset:a?rr(a.dom):this.contentDOM.childNodes.length}}}parseRange(e,r,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:r,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,a=-1;for(let o=n,s=0;;s++){let l=this.children[s],u=o+l.size;if(i==-1&&e<=u){let d=o+l.border;if(e>=d&&r<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,r,d);e=o;for(let f=s;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=rr(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(u>r||s==this.children.length-1)){r=u;for(let d=s+1;d<this.children.length;d++){let f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){a=rr(f.dom);break}r+=f.size}a==-1&&(a=this.contentDOM.childNodes.length);break}o=u}return{node:this.contentDOM,from:e,to:r,fromOffset:i,toOffset:a}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let r=this.children[e<0?0:this.children.length-1];return r.size==0||r.emptyChildAt(e)}domAfterPos(e){let{node:r,offset:n}=this.domFromPos(e,0);if(r.nodeType!=1||n==r.childNodes.length)throw new RangeError("No node after pos "+e);return r.childNodes[n]}setSelection(e,r,n,i=!1){let a=Math.min(e,r),o=Math.max(e,r);for(let p=0,m=0;p<this.children.length;p++){let g=this.children[p],v=m+g.size;if(a>m&&o<v)return g.setSelection(e-m-g.border,r-m-g.border,n,i);m=v}let s=this.domFromPos(e,e?-1:1),l=r==e?s:this.domFromPos(r,r?-1:1),u=n.root.getSelection(),d=n.domSelectionRange(),f=!1;if((sn||ur)&&e==r){let{node:p,offset:m}=s;if(p.nodeType==3){if(f=!!(m&&p.nodeValue[m-1]==` 82`),f&&m==p.nodeValue.length)for(let g=p,v;g;g=g.parentNode){if(v=g.nextSibling){v.nodeName=="BR"&&(s=l={node:v.parentNode,offset:rr(v)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=p.childNodes[m-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(sn&&d.focusNode&&d.focusNode!=l.node&&d.focusNode.nodeType==1){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(i=!0)}if(!(i||f&&ur)&&eo(s.node,s.offset,d.anchorNode,d.anchorOffset)&&eo(l.node,l.offset,d.focusNode,d.focusOffset))return;let h=!1;if((u.extend||e==r)&&!(f&&sn)){u.collapse(s.node,s.offset);try{e!=r&&u.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(e>r){let m=s;s=l,l=m}let p=document.createRange();p.setEnd(l.node,l.offset),p.setStart(s.node,s.offset),u.removeAllRanges(),u.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,r){for(let n=0,i=0;i<this.children.length;i++){let a=this.children[i],o=n+a.size;if(n==o?e<=o&&r>=n:e<o&&r>n){let s=n+a.border,l=o-a.border;if(e>=s&&r<=l){this.dirty=e==n||r==o?Aa:vA,e==s&&r==l&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=Kn:a.markDirty(e-s,r-s);return}
vendor: 5,186 bytes, line 82
82else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?Aa:Kn}n=o}this.dirty=Aa}markParentsDirty(){let e=1;for(let r=this.parent;r;r=r.parent,e++){let n=e==1?Aa:vA;r.dirty<n&&(r.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class $I extends Uc{constructor(e,r,n,i){let a,o=r.type.toDOM;if(typeof o=="function"&&(o=o(n,()=>{if(!a)return i;if(a.parent)return a.parent.posBeforeChild(a)})),!r.type.spec.raw){if(o.nodeType!=1){let s=document.createElement("span");s.appendChild(o),o=s}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=r,this.widget=r,a=this}matchesWidget(e){return this.dirty==ln&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let r=this.widget.spec.stopEvent;return r?r(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Qre extends Uc{constructor(e,r,n,i){super(e,[],r,null),this.textDOM=n,this.text=i}get size(){return this.text.length}localPosFromDOM(e,r){return e!=this.textDOM?this.posAtStart+(r?this.size:0):this.posAtStart+r}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class to extends Uc{constructor(e,r,n,i,a){super(e,[],n,i),this.mark=r,this.spec=a}static create(e,r,n,i){let a=i.nodeViews[r.type.name],o=a&&a(r,i,n);return(!o||!o.dom)&&(o=co.renderSpec(document,r.type.spec.toDOM(r,n),null,r.attrs)),new to(e,r,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Kn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Kn&&this.mark.eq(e)}markDirty(e,r){if(super.markDirty(e,r),this.dirty!=ln){let n=this.parent;for(;!n.node;)n=n.parent;n.dirty<this.dirty&&(n.dirty=this.dirty),this.dirty=ln}}slice(e,r,n){let i=to.create(this.parent,this.mark,!0,n),a=this.children,o=this.size;r<o&&(a=Wb(a,r,o,n)),e>0&&(a=Wb(a,0,e,n));for(let s=0;s<a.length;s++)a[s].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Gi extends Uc{constructor(e,r,n,i,a,o,s,l,u){super(e,[],a,o),this.node=r,this.outerDeco=n,this.innerDeco=i,this.nodeDOM=s}static create(e,r,n,i,a,o){let s=a.nodeViews[r.type.name],l,u=s&&s(r,a,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},n,i),d=u&&u.dom,f=u&&u.contentDOM;if(r.isText){if(!d)d=document.createTextNode(r.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:f}=co.renderSpec(document,r.type.spec.toDOM(r),null,r.attrs));!f&&!r.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),r.type.spec.draggable&&(d.draggable=!0));let h=d;return d=zI(d,n,r),u?l=new ene(e,r,n,i,d,f||null,h,u,a,o+1):r.isText?new Kh(e,r,n,i,d,h,a):new Gi(e,r,n,i,d,f||null,h,a,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let n=this.children[r];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>J.empty)}return e}matchesNode(e,r,n){return this.dirty==ln&&e.eq(this.node)&&cf(r,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,r){let n=this.node.inlineContent,i=r,a=e.composing?this.localCompositionInfo(e,r):null,o=a&&a.pos>-1?a:null,s=a&&a.pos<0,l=new rne(this,o&&o.node,e);ane(this.node,this.innerDeco,(u,d,f)=>{u.spec.marks?l.syncToMarks(u.spec.marks,n,e,d):u.type.side>=0&&!f&&l.syncToMarks(d==this.node.childCount?nt.none:this.node.child(d).marks,n,e,d),l.placeWidget(u,e,i)},(u,d,f,h)=>{l.syncToMarks(u.marks,n,e,h);let p;l.findNodeMatch(u,d,f,h)||s&&e.state.selection.from>i&&e.state.selection.to<i+u.nodeSize&&(p=l.findIndexWithChild(a.node))>-1&&l.updateNodeAt(u,d,f,p,e)||l.updateNextNode(u,d,f,e,h,i)||l.addNode(u,d,f,e,i),i+=u.nodeSize}),l.syncToMarks([],n,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Aa)&&(o&&this.protectLocalComposition(e,o),BI(this.contentDOM,this.children,e),Cs&&one(this.dom))}localCompositionInfo(e,r){let{from:n,to:i}=e.state.selection;if(!(e.state.selection instanceof Pe)||n<r||i>r+this.node.content.size)return null;let a=e.input.compositionNode;if(!a||!this.dom.contains(a.parentNode))return null;if(this.node.inlineContent){let o=a.nodeValue,s=sne(this.node.content,o,n-r,i-r);return s<0?null:{node:a,pos:s,text:o}}else return{node:a,pos:-1,text:""}}
vendor: 4,961 bytes, line 82
82protectLocalComposition(e,{node:r,pos:n,text:i}){if(this.getDesc(r))return;let a=r;for(;a.parentNode!=this.contentDOM;a=a.parentNode){for(;a.previousSibling;)a.parentNode.removeChild(a.previousSibling);for(;a.nextSibling;)a.parentNode.removeChild(a.nextSibling);a.pmViewDesc&&(a.pmViewDesc=void 0)}let o=new Qre(this,a,r,i);e.input.compositionNodes.push(o),this.children=Wb(this.children,n,n+i.length,e,o)}update(e,r,n,i){return this.dirty==Kn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,r,n,i),!0)}updateInner(e,r,n,i){this.updateOuterDeco(r),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=ln}updateOuterDeco(e){if(cf(e,this.outerDeco))return;let r=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=FI(this.dom,this.nodeDOM,Hb(this.outerDeco,this.node,r),Hb(e,this.node,r)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function yA(t,e,r,n,i){zI(n,e,t);let a=new Gi(void 0,t,e,r,n,n,n,i,0);return a.contentDOM&&a.updateChildren(i,0),a}class Kh extends Gi{constructor(e,r,n,i,a,o,s){super(e,r,n,i,a,null,o,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,r,n,i){return this.dirty==Kn||this.dirty!=ln&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(r),(this.dirty!=ln||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=ln,!0)}inParent(){let e=this.parent.contentDOM;for(let r=this.nodeDOM;r;r=r.parentNode)if(r==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,r,n){return e==this.nodeDOM?this.posAtStart+Math.min(r,this.node.text.length):super.localPosFromDOM(e,r,n)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,r,n){let i=this.node.cut(e,r),a=document.createTextNode(i.text);return new Kh(this.parent,i,this.outerDeco,this.innerDeco,a,a,n)}markDirty(e,r){super.markDirty(e,r),this.dom!=this.nodeDOM&&(e==0||r==this.nodeDOM.nodeValue.length)&&(this.dirty=Kn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class LI extends Uc{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ln&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class ene extends Gi{constructor(e,r,n,i,a,o,s,l,u,d){super(e,r,n,i,a,o,s,u,d),this.spec=l}update(e,r,n,i){if(this.dirty==Kn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let a=this.spec.update(e,r,n);return a&&this.updateInner(e,r,n,i),a}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,r,n,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,r,n,i){this.spec.setSelection?this.spec.setSelection(e,r,n.root):super.setSelection(e,r,n,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function BI(t,e,r){let n=t.firstChild,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=o.dom;if(s.parentNode==t){for(;s!=n;)n=xA(n),i=!0;n=n.nextSibling}else i=!0,t.insertBefore(s,n);if(o instanceof to){let l=n?n.previousSibling:t.lastChild;BI(o.contentDOM,o.children,r),n=l?l.nextSibling:t.firstChild}}for(;n;)n=xA(n),i=!0;i&&r.trackWrites==t&&(r.trackWrites=null)}const _l=function(t){t&&(this.nodeName=t)};_l.prototype=Object.create(null);const Ea=[new _l];function Hb(t,e,r){if(t.length==0)return Ea;let n=r?Ea[0]:new _l,i=[n];for(let a=0;a<t.length;a++){let o=t[a].type.attrs;if(o){o.nodeName&&i.push(n=new _l(o.nodeName));for(let s in o){let l=o[s];l!=null&&(r&&i.length==1&&i.push(n=new _l(e.isInline?"span":"div")),s=="class"?n.class=(n.class?n.class+" ":"")+l:s=="style"?n.style=(n.style?n.style+";":"")+l:s!="nodeName"&&(n[s]=l))}}}return i}function FI(t,e,r,n){if(r==Ea&&n==Ea)return e;let i=e;for(let a=0;a<n.length;a++){let o=n[a],s=r[a];if(a){let l;s&&s.nodeName==o.nodeName&&i!=t&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),s=Ea[0]),i=l}tne(i,s||Ea[0],o)}return i}function tne(t,e,r){for(let n in e)n!="class"&&n!="style"&&n!="nodeName"&&!(n in r)&&t.removeAttribute(n);for(let n in r)n!="class"&&n!="style"&&n!="nodeName"&&r[n]!=e[n]&&t.setAttribute(n,r[n]);
vendor: 6,195 bytes, line 82
82if(e.class!=r.class){let n=e.class?e.class.split(" ").filter(Boolean):[],i=r.class?r.class.split(" ").filter(Boolean):[];for(let a=0;a<n.length;a++)i.indexOf(n[a])==-1&&t.classList.remove(n[a]);for(let a=0;a<i.length;a++)n.indexOf(i[a])==-1&&t.classList.add(i[a]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=r.style){if(e.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=n.exec(e.style);)t.style.removeProperty(i[1])}r.style&&(t.style.cssText+=r.style)}}function zI(t,e,r){return FI(t,t,Ea,Hb(e,r,t.nodeType!=1))}function cf(t,e){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].type.eq(e[r].type))return!1;return!0}function xA(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class rne{constructor(e,r,n){this.lock=r,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=nne(e.node.content,e)}destroyBetween(e,r){if(e!=r){for(let n=e;n<r;n++)this.top.children[n].destroy();this.top.children.splice(e,r-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,r,n,i){let a=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;a<s&&(a==o-1?this.top:this.stack[a+1<<1]).matchesMark(e[a])&&e[a].type.spec.spanning!==!1;)a++;for(;a<o;)this.destroyRest(),this.top.dirty=ln,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1,u=this.top.children.length;i<this.preMatch.index&&(u=Math.min(this.index+3,u));for(let d=this.index;d<u;d++){let f=this.top.children[d];if(f.matchesMark(e[o])&&!this.isLocked(f.dom)){l=d;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let d=to.create(this.top,e[o],r,n);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,o++}}findNodeMatch(e,r,n,i){let a=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,r,n))a=this.top.children.indexOf(o,this.index);else for(let s=this.index,l=Math.min(this.top.children.length,s+5);s<l;s++){let u=this.top.children[s];if(u.matchesNode(e,r,n)&&!this.preMatch.matched.has(u)){a=s;break}}return a<0?!1:(this.destroyBetween(this.index,a),this.index++,!0)}updateNodeAt(e,r,n,i,a){let o=this.top.children[i];return o.dirty==Kn&&o.dom==o.contentDOM&&(o.dirty=Aa),o.update(e,r,n,a)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let r=e.parentNode;if(!r)return-1;if(r==this.top.contentDOM){let n=e.pmViewDesc;if(n){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==n)return i}return-1}e=r}}updateNextNode(e,r,n,i,a,o){for(let s=this.index;s<this.top.children.length;s++){let l=this.top.children[s];if(l instanceof Gi){let u=this.preMatch.matched.get(l);if(u!=null&&u!=a)return!1;let d=l.dom,f,h=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Kn&&cf(r,l.outerDeco));if(!h&&l.update(e,r,n,i))return this.destroyBetween(this.index,s),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(f=this.recreateWrapper(l,e,r,n,i,o)))return this.destroyBetween(this.index,s),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=Aa,f.updateChildren(i,o+1),f.dirty=ln),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,r,n,i,a,o){if(e.dirty||r.isAtom||!e.children.length||!e.node.content.eq(r.content)||!cf(n,e.outerDeco)||!i.eq(e.innerDeco))return null;let s=Gi.create(this.top,r,n,i,a,o);if(s.contentDOM){s.children=e.children,e.children=[];for(let l of s.children)l.parent=s}return e.destroy(),s}addNode(e,r,n,i,a){let o=Gi.create(this.top,e,r,n,i,a);o.contentDOM&&o.updateChildren(i,a+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,r,n){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let a=new $I(this.top,e,r,n);this.top.children.splice(this.index++,0,a),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],r=this.top;for(;e instanceof to;)r=e,e=r.children[r.children.length-1];(!e||!(e instanceof Kh)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ur||ir)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",r),this.addHackNode("BR",this.top))}addHackNode(e,r){if(r==this.top&&this.index<r.children.length&&r.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e=="IMG"&&(n.className="ProseMirror-separator",n.alt=""),e=="BR"&&(n.className="ProseMirror-trailingBreak");let i=new LI(this.top,[],n,null);r!=this.top?r.children.push(i):r.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function nne(t,e){let r=e,n=r.children.length,i=t.childCount,a=new Map,o=[];e:for(;i>0;){let s;for(;;)if(n){let u=r.children[n-1];if(u instanceof to)r=u,n=u.children.length;else{s=u,n--;break}}else{if(r==e)break e;n=r.parent.children.indexOf(r),r=r.parent}let l=s.node;if(l){if(l!=t.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function ine(t,e){return t.type.side-e.type.side}function ane(t,e,r,n){let i=e.locals(t),a=0;if(i.length==0){for(let u=0;u<t.childCount;u++){let d=t.child(u);n(d,i,e.forChild(a,d),u),a+=d.nodeSize}return}let o=0,s=[],l=null;for(let u=0;;){let d,f;for(;o<i.length&&i[o].to==a;){let v=i[o++];v.widget&&(d?(f||(f=[d])).push(v):d=v)}if(d)if(f){f.sort(ine);for(let v=0;v<f.length;v++)r(f[v],u,!!l)}else r(d,u,!!l);let h,p;if(l)p=-1,h=l,l=null;else if(u<t.childCount)p=u,h=t.child(u++);else break;for(let v=0;v<s.length;v++)s[v].to<=a&&s.splice(v--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+h.nodeSize;if(h.isText){let v=m;o<i.length&&i[o].from<v&&(v=i[o].from);for(let y=0;y<s.length;y++)s[y].to<v&&(v=s[y].to);v<m&&(l=h.cut(v-a),h=h.cut(0,v-a),m=v,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let g=h.isInline&&!h.isLeaf?s.filter(v=>!v.inline):s.slice();n(h,g,e.forChild(a,h),p),a=m}}
vendor: 9,569 bytes, line 82
82function one(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function sne(t,e,r,n){for(let i=0,a=0;i<t.childCount&&a<=n;){let o=t.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<t.childCount;){let u=t.child(i++);if(a+=u.nodeSize,!u.isText)break;l+=u.text}if(a>=r){if(a>=n&&l.slice(n-e.length-s,n-s)==e)return n-e.length;let u=s<n?l.lastIndexOf(e,n-s-1):-1;if(u>=0&&u+e.length+s>=r)return s+u;if(r==n&&l.length>=n+e.length-s&&l.slice(n-s,n-s+e.length)==e)return n}}return-1}function Wb(t,e,r,n,i){let a=[];for(let o=0,s=0;o<t.length;o++){let l=t[o],u=s,d=s+=l.size;u>=r||d<=e?a.push(l):(u<e&&a.push(l.slice(0,e-u,n)),i&&(a.push(i),i=void 0),d>r&&a.push(l.slice(r-u,l.size,n)))}return a}function e1(t,e=null){let r=t.domSelectionRange(),n=t.state.doc;if(!r.focusNode)return null;let i=t.docView.nearestDesc(r.focusNode),a=i&&i.size==0,o=t.docView.posFromDOM(r.focusNode,r.focusOffset,1);if(o<0)return null;let s=n.resolve(o),l,u;if(Vh(r)){for(l=o;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&we.isSelectable(f)&&i.parent&&!(f.isInline&&Dre(r.focusNode,r.focusOffset,i.dom))){let h=i.posBefore;u=new we(o==h?s:n.resolve(h))}}else{if(r instanceof t.dom.ownerDocument.defaultView.Selection&&r.rangeCount>1){let f=o,h=o;for(let p=0;p<r.rangeCount;p++){let m=r.getRangeAt(p);f=Math.min(f,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),h=Math.max(h,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[l,o]=h==t.state.selection.anchor?[h,f]:[f,h],s=n.resolve(o)}else l=t.docView.posFromDOM(r.anchorNode,r.anchorOffset,1);if(l<0)return null}let d=n.resolve(l);if(!u){let f=e=="pointer"||t.state.selection.head<s.pos&&!a?1:-1;u=t1(t,d,s,f)}return u}function qI(t){return t.editable?t.hasFocus():HI(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function yi(t,e=!1){let r=t.state.selection;if(UI(t,r),!!qI(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ir){let n=t.domSelectionRange(),i=t.domObserver.currentSelection;if(n.anchorNode&&i.anchorNode&&eo(n.anchorNode,n.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)cne(t);else{let{anchor:n,head:i}=r,a,o;bA&&!(r instanceof Pe)&&(r.$from.parent.inlineContent||(a=wA(t,r.from)),!r.empty&&!r.$from.parent.inlineContent&&(o=wA(t,r.to))),t.docView.setSelection(n,i,t,e),bA&&(a&&_A(a),o&&_A(o)),r.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&lne(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const bA=ur||ir&&AI<63;function wA(t,e){let{node:r,offset:n}=t.docView.domFromPos(e,0),i=n<r.childNodes.length?r.childNodes[n]:null,a=n?r.childNodes[n-1]:null;if(ur&&i&&i.contentEditable=="false")return Ty(i);if((!i||i.contentEditable=="false")&&(!a||a.contentEditable=="false")){if(i)return Ty(i);if(a)return Ty(a)}}function Ty(t){return t.contentEditable="true",ur&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function _A(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function lne(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let r=t.domSelectionRange(),n=r.anchorNode,i=r.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(r.anchorNode!=n||r.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!qI(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function cne(t){let e=t.domSelection();if(!e)return;let r=t.cursorWrapper.dom,n=r.nodeName=="IMG";n?e.collapse(r.parentNode,rr(r)+1):e.collapse(r,0),!n&&!t.state.selection.visible&&Er&&Ki<=11&&(r.disabled=!0,r.disabled=!1)}function UI(t,e){if(e instanceof we){let r=t.docView.descAt(e.from);r!=t.lastSelectedViewDesc&&(SA(t),r&&r.selectNode(),t.lastSelectedViewDesc=r)}else SA(t)}function SA(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function t1(t,e,r,n){return t.someProp("createSelectionBetween",i=>i(t,e,r))||Pe.between(e,r,n)}function jA(t){return t.editable&&!t.hasFocus()?!1:HI(t)}function HI(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function une(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),r=t.domSelectionRange();return eo(e.node,e.offset,r.anchorNode,r.anchorOffset)}function Vb(t,e){let{$anchor:r,$head:n}=t.selection,i=e>0?r.max(n):r.min(n),a=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return a&&Fe.findFrom(a,e)}function Di(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function OA(t,e,r){let n=t.state.selection;if(n instanceof Pe)if(r.indexOf("s")>-1){let{$head:i}=n,a=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+a.nodeSize*(e<0?-1:1));return Di(t,new Pe(n.$anchor,o))}else if(n.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Vb(t.state,e);return i&&i instanceof we?Di(t,i):!1}else if(!(tn&&r.indexOf("m")>-1)){let i=n.$head,a=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!a||a.isText)return!1;let s=e<0?i.pos-a.nodeSize:i.pos;return a.isAtom||(o=t.docView.descAt(s))&&!o.contentDOM?we.isSelectable(a)?Di(t,new we(e<0?t.state.doc.resolve(i.pos-a.nodeSize):i)):qc?Di(t,new Pe(t.state.doc.resolve(e<0?s:s+a.nodeSize))):!1:!1}}else return!1;else{if(n instanceof we&&n.node.isInline)return Di(t,new Pe(e>0?n.$to:n.$from));{let i=Vb(t.state,e);return i?Di(t,i):!1}}}function uf(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Sl(t,e){let r=t.pmViewDesc;return r&&r.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function _o(t,e){return e<0?dne(t):fne(t)}function dne(t){let e=t.domSelectionRange(),r=e.focusNode,n=e.focusOffset;if(!r)return;let i,a,o=!1;for(sn&&r.nodeType==1&&n<uf(r)&&Sl(r.childNodes[n],-1)&&(o=!0);;)if(n>0){if(r.nodeType!=1)break;{let s=r.childNodes[n-1];if(Sl(s,-1))i=r,a=--n;else if(s.nodeType==3)r=s,n=r.nodeValue.length;else break}}else{if(WI(r))break;{let s=r.previousSibling;for(;s&&Sl(s,-1);)i=r.parentNode,a=rr(s),s=s.previousSibling;if(s)r=s,n=uf(r);else{if(r=r.parentNode,r==t.dom)break;n=0}}}o?Kb(t,r,n):i&&Kb(t,i,a)}function fne(t){let e=t.domSelectionRange(),r=e.focusNode,n=e.focusOffset;if(!r)return;let i=uf(r),a,o;for(;;)if(n<i){if(r.nodeType!=1)break;let s=r.childNodes[n];if(Sl(s,1))a=r,o=++n;else break}else{if(WI(r))break;{let s=r.nextSibling;for(;s&&Sl(s,1);)a=s.parentNode,o=rr(s)+1,s=s.nextSibling;if(s)r=s,n=0,i=uf(r);else{if(r=r.parentNode,r==t.dom)break;n=i=0}}}a&&Kb(t,a,o)}function WI(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function hne(t,e){for(;t&&e==t.childNodes.length&&!zc(t);)e=rr(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let r=t.childNodes[e];if(r.nodeType==3)return r;if(r.nodeType==1&&r.contentEditable=="false")break;t=r,e=0}}function pne(t,e){for(;t&&!e&&!zc(t);)e=rr(t),t=t.parentNode;for(;t&&e;){let r=t.childNodes[e-1];if(r.nodeType==3)return r;if(r.nodeType==1&&r.contentEditable=="false")break;t=r,e=t.childNodes.length}}function Kb(t,e,r){if(e.nodeType!=3){let a,o;(o=hne(e,r))?(e=o,r=0):(a=pne(e,r))&&(e=a,r=a.nodeValue.length)}let n=t.domSelection();if(!n)return;if(Vh(n)){let a=document.createRange();a.setEnd(e,r),a.setStart(e,r),n.removeAllRanges(),n.addRange(a)}else n.extend&&n.extend(e,r);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&yi(t)},50)}function NA(t,e){let r=t.state.doc.resolve(e);if(!(ir||EI)&&r.parent.inlineContent){let i=t.coordsAtPos(e);if(e>r.start()){let a=t.coordsAtPos(e-1),o=(a.top+a.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(a.left-i.left)>1)return a.left<i.left?"ltr":"rtl"}if(e<r.end()){let a=t.coordsAtPos(e+1),o=(a.top+a.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(a.left-i.left)>1)return a.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function CA(t,e,r){let n=t.state.selection;if(n instanceof Pe&&!n.empty||r.indexOf("s")>-1||tn&&r.indexOf("m")>-1)return!1;let{$from:i,$to:a}=n;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Vb(t.state,e);if(o&&o instanceof we)return Di(t,o)}if(!i.parent.inlineContent){let o=e<0?i:a,s=n instanceof Wr?Fe.near(o,e):Fe.findFrom(o,e);return s?Di(t,s):!1}return!1}function kA(t,e){if(!(t.state.selection instanceof Pe))return!0;let{$head:r,$anchor:n,empty:i}=t.state.selection;if(!r.sameParent(n))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let a=!r.textOffset&&(e<0?r.nodeBefore:r.nodeAfter);if(a&&!a.isText){let o=t.state.tr;return e<0?o.delete(r.pos-a.nodeSize,r.pos):o.delete(r.pos,r.pos+a.nodeSize),t.dispatch(o),!0}return!1}function AA(t,e,r){t.domObserver.stop(),e.contentEditable=r,t.domObserver.start()}function mne(t){if(!ur||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:r}=t.domSelectionRange();if(e&&e.nodeType==1&&r==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let n=e.firstChild;AA(t,n,"true"),setTimeout(()=>AA(t,n,"false"),20)}return!1}function gne(t){let e="";
vendor: 4,161 bytes, lines 82-85
82return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function vne(t,e){let r=e.keyCode,n=gne(e);if(r==8||tn&&r==72&&n=="c")return kA(t,-1)||_o(t,-1);if(r==46&&!e.shiftKey||tn&&r==68&&n=="c")return kA(t,1)||_o(t,1);if(r==13||r==27)return!0;if(r==37||tn&&r==66&&n=="c"){let i=r==37?NA(t,t.state.selection.from)=="ltr"?-1:1:-1;return OA(t,i,n)||_o(t,i)}else if(r==39||tn&&r==70&&n=="c"){let i=r==39?NA(t,t.state.selection.from)=="ltr"?1:-1:1;return OA(t,i,n)||_o(t,i)}else{if(r==38||tn&&r==80&&n=="c")return CA(t,-1,n)||_o(t,-1);if(r==40||tn&&r==78&&n=="c")return mne(t)||CA(t,1,n)||_o(t,1);if(n==(tn?"m":"c")&&(r==66||r==73||r==89||r==90))return!0}return!1}function r1(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let r=[],{content:n,openStart:i,openEnd:a}=e;for(;i>1&&a>1&&n.childCount==1&&n.firstChild.childCount==1;){i--,a--;let p=n.firstChild;r.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),n=p.content}let o=t.someProp("clipboardSerializer")||co.fromSchema(t.state.schema),s=JI(),l=s.createElement("div");l.appendChild(o.serializeFragment(n,{document:s}));let u=l.firstChild,d,f=0;for(;u&&u.nodeType==1&&(d=XI[u.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let m=s.createElement(d[p]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),f++}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${a}${f?` -${f}`:""} ${JSON.stringify(r)}`);let h=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,` 83 84`);return{dom:l,text:h,slice:e}}function VI(t,e,r,n,i){let a=i.parent.type.spec.code,o,s;if(!r&&!e)return null;let l=!!e&&(n||a||!r);if(l){if(t.someProp("transformPastedText",h=>{e=h(e,a||n,t)}),a)return s=new ce(J.from(t.state.schema.text(e.replace(/\r\n?/g,` 85`))),0,0),t.someProp("transformPasted",h=>{s=h(s,t,!0)}),s;let f=t.someProp("clipboardTextParser",h=>h(e,i,n,t));if(f)s=f;else{let h=i.marks(),{schema:p}=t.state,m=co.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let v=o.appendChild(document.createElement("p"));g&&v.appendChild(m.serializeNode(p.text(g,h)))})}}else t.someProp("transformPastedHTML",f=>{r=f(r,t)}),o=wne(r),qc&&_ne(o);let u=o&&o.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[3];f>0;f--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(s||(s=(t.someProp("clipboardParser")||t.someProp("domParser")||Vi.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||d),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!yne.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)s=Sne(EA(s,+d[1],+d[2]),d[4]);else if(s=ce.maxOpen(xne(s.content,i),!0),s.openStart||s.openEnd){let f=0,h=0;for(let p=s.content.firstChild;f<s.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=s.content.lastChild;h<s.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);s=EA(s,f,h)}return t.someProp("transformPasted",f=>{s=f(s,t,l)}),s}const yne=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function xne(t,e){if(t.childCount<2)return t;for(let r=e.depth;r>=0;r--){let i=e.node(r).contentMatchAt(e.index(r)),a,o=[];if(t.forEach(s=>{if(!o)return;let l=i.findWrapping(s.type),u;if(!l)return o=null;if(u=o.length&&a.length&&GI(l,a,s,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=YI(o[o.length-1],a.length));let d=KI(s,l);o.push(d),i=i.matchType(d.type),a=l}}),o)return J.from(o)}return t}function KI(t,e,r=0){for(let n=e.length-1;n>=r;n--)t=e[n].create(null,J.from(t));return t}function GI(t,e,r,n,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let a=GI(t,e,r,n.lastChild,i+1);if(a)return n.copy(n.content.replaceChild(n.childCount-1,a));if(n.contentMatchAt(n.childCount).matchType(i==t.length-1?r.type:t[i+1]))return n.copy(n.content.append(J.from(KI(r,t,i+1))))}}function YI(t,e){if(e==0)return t;let r=t.content.replaceChild(t.childCount-1,YI(t.lastChild,e-1)),n=t.contentMatchAt(t.childCount).fillBefore(J.empty,!0);return t.copy(r.append(n))}
vendor: 5,005 bytes, line 85
85function Gb(t,e,r,n,i,a){let o=e<0?t.firstChild:t.lastChild,s=o.content;return t.childCount>1&&(a=0),i<n-1&&(s=Gb(s,e,r,n,i+1,a)),i>=r&&(s=e<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(J.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(s))}function EA(t,e,r){return e<t.openStart&&(t=new ce(Gb(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),r<t.openEnd&&(t=new ce(Gb(t.content,1,r,t.openEnd,0,0),t.openStart,r)),t}const XI={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let PA=null;function JI(){return PA||(PA=document.implementation.createHTMLDocument("title"))}let My=null;function bne(t){let e=window.trustedTypes;return e?(My||(My=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:r=>r})),My.createHTML(t)):t}function wne(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let r=JI().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(t),i;if((i=n&&XI[n[1].toLowerCase()])&&(t=i.map(a=>"<"+a+">").join("")+t+i.map(a=>"</"+a+">").reverse().join("")),r.innerHTML=bne(t),i)for(let a=0;a<i.length;a++)r=r.querySelector(i[a])||r;return r}function _ne(t){let e=t.querySelectorAll(ir?"span:not([class]):not([style])":"span.Apple-converted-space");for(let r=0;r<e.length;r++){let n=e[r];n.childNodes.length==1&&n.textContent=="Â "&&n.parentNode&&n.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),n)}}function Sne(t,e){if(!t.size)return t;let r=t.content.firstChild.type.schema,n;try{n=JSON.parse(e)}catch{return t}let{content:i,openStart:a,openEnd:o}=t;for(let s=n.length-2;s>=0;s-=2){let l=r.nodes[n[s]];if(!l||l.hasRequiredAttrs())break;i=J.from(l.create(n[s+1],i)),a++,o++}return new ce(i,a,o)}const jr={},Or={},jne={touchstart:!0,touchmove:!0};class One{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Nne(t){for(let e in jr){let r=jr[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=n=>{kne(t,n)&&!n1(t,n)&&(t.editable||!(n.type in Or))&&r(t,n)},jne[e]?{passive:!0}:void 0)}ur&&t.dom.addEventListener("input",()=>null),Yb(t)}function Ui(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Cne(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Yb(t){t.someProp("handleDOMEvents",e=>{for(let r in e)t.input.eventHandlers[r]||t.dom.addEventListener(r,t.input.eventHandlers[r]=n=>n1(t,n))})}function n1(t,e){return t.someProp("handleDOMEvents",r=>{let n=r[e.type];return n?n(t,e)||e.defaultPrevented:!1})}function kne(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let r=e.target;r!=t.dom;r=r.parentNode)if(!r||r.nodeType==11||r.pmViewDesc&&r.pmViewDesc.stopEvent(e))return!1;return!0}function Ane(t,e){!n1(t,e)&&jr[e.type]&&(t.editable||!(e.type in Or))&&jr[e.type](t,e)}Or.keydown=(t,e)=>{let r=e;if(t.input.shiftKey=r.keyCode==16||r.shiftKey,!QI(t,r)&&(t.input.lastKeyCode=r.keyCode,t.input.lastKeyCodeTime=Date.now(),!(fi&&ir&&r.keyCode==13)))if(r.keyCode!=229&&t.domObserver.forceFlush(),Cs&&r.keyCode==13&&!r.ctrlKey&&!r.altKey&&!r.metaKey){let n=Date.now();t.input.lastIOSEnter=n,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==n&&(t.someProp("handleKeyDown",i=>i(t,Sa(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",n=>n(t,r))||vne(t,r)?r.preventDefault():Ui(t,"key")};Or.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Or.keypress=(t,e)=>{let r=e;if(QI(t,r)||!r.charCode||r.ctrlKey&&!r.altKey||tn&&r.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,r))){r.preventDefault();return}let n=t.state.selection;if(!(n instanceof Pe)||!n.$from.sameParent(n.$to)){let i=String.fromCharCode(r.charCode),a=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,n.$from.pos,n.$to.pos,i,a))&&t.dispatch(a()),r.preventDefault()}};function Gh(t){return{left:t.clientX,top:t.clientY}}function Ene(t,e){let r=e.x-t.clientX,n=e.y-t.clientY;return r*r+n*n<100}function i1(t,e,r,n,i){if(n==-1)return!1;let a=t.state.doc.resolve(n);for(let o=a.depth+1;o>0;o--)if(t.someProp(e,s=>o>a.depth?s(t,r,a.nodeAfter,a.before(o),i,!0):s(t,r,a.node(o),a.before(o),i,!1)))return!0;return!1}
vendor: 5,741 bytes, line 85
85function zo(t,e,r){if(t.focused||t.focus(),t.state.selection.eq(e))return;let n=t.state.tr.setSelection(e);n.setMeta("pointer",!0),t.dispatch(n)}function Pne(t,e){if(e==-1)return!1;let r=t.state.doc.resolve(e),n=r.nodeAfter;return n&&n.isAtom&&we.isSelectable(n)?(zo(t,new we(r)),!0):!1}function Tne(t,e){if(e==-1)return!1;let r=t.state.selection,n,i;r instanceof we&&(n=r.node);let a=t.state.doc.resolve(e);for(let o=a.depth+1;o>0;o--){let s=o>a.depth?a.nodeAfter:a.node(o);if(we.isSelectable(s)){n&&r.$from.depth>0&&o>=r.$from.depth&&a.before(r.$from.depth+1)==r.$from.pos?i=a.before(r.$from.depth):i=a.before(o);break}}return i!=null?(zo(t,we.create(t.state.doc,i)),!0):!1}function Mne(t,e,r,n,i){return i1(t,"handleClickOn",e,r,n)||t.someProp("handleClick",a=>a(t,e,n))||(i?Tne(t,r):Pne(t,r))}function Dne(t,e,r,n){return i1(t,"handleDoubleClickOn",e,r,n)||t.someProp("handleDoubleClick",i=>i(t,e,n))}function Rne(t,e,r,n){return i1(t,"handleTripleClickOn",e,r,n)||t.someProp("handleTripleClick",i=>i(t,e,n))||Ine(t,r,n)}function Ine(t,e,r){if(r.button!=0)return!1;let n=t.state.doc;if(e==-1)return n.inlineContent?(zo(t,Pe.create(n,0,n.content.size)),!0):!1;let i=n.resolve(e);for(let a=i.depth+1;a>0;a--){let o=a>i.depth?i.nodeAfter:i.node(a),s=i.before(a);if(o.inlineContent)zo(t,Pe.create(n,s+1,s+1+o.content.size));else if(we.isSelectable(o))zo(t,we.create(n,s));else continue;return!0}}function a1(t){return df(t)}const ZI=tn?"metaKey":"ctrlKey";jr.mousedown=(t,e)=>{let r=e;t.input.shiftKey=r.shiftKey;let n=a1(t),i=Date.now(),a="singleClick";i-t.input.lastClick.time<500&&Ene(r,t.input.lastClick)&&!r[ZI]&&t.input.lastClick.button==r.button&&(t.input.lastClick.type=="singleClick"?a="doubleClick":t.input.lastClick.type=="doubleClick"&&(a="tripleClick")),t.input.lastClick={time:i,x:r.clientX,y:r.clientY,type:a,button:r.button};let o=t.posAtCoords(Gh(r));o&&(a=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new $ne(t,o,r,!!n)):(a=="doubleClick"?Dne:Rne)(t,o.pos,o.inside,r)?r.preventDefault():Ui(t,"pointer"))};class $ne{constructor(e,r,n,i){this.view=e,this.pos=r,this.event=n,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[ZI],this.allowDefault=n.shiftKey;let a,o;if(r.inside>-1)a=e.state.doc.nodeAt(r.inside),o=r.inside;else{let d=e.state.doc.resolve(r.pos);a=d.parent,o=d.depth?d.before():0}const s=i?null:n.target,l=s?e.docView.nearestDesc(s,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:u}=e.state;n.button==0&&(a.type.spec.draggable&&a.type.spec.selectable!==!1||u instanceof we&&u.from<=o&&u.to>o)&&(this.mightDrag={node:a,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&sn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ui(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>yi(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let r=this.pos;this.view.state.doc!=this.startDoc&&(r=this.view.posAtCoords(Gh(e))),this.updateAllowDefault(e),this.allowDefault||!r?Ui(this.view,"pointer"):Mne(this.view,r.pos,r.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ur&&this.mightDrag&&!this.mightDrag.node.isAtom||ir&&!this.view.state.selection.visible&&Math.min(Math.abs(r.pos-this.view.state.selection.from),Math.abs(r.pos-this.view.state.selection.to))<=2)?(zo(this.view,Fe.near(this.view.state.doc.resolve(r.pos))),e.preventDefault()):Ui(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ui(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}jr.touchstart=t=>{t.input.lastTouch=Date.now(),a1(t),Ui(t,"pointer")};jr.touchmove=t=>{t.input.lastTouch=Date.now(),Ui(t,"pointer")};jr.contextmenu=t=>a1(t);function QI(t,e){return t.composing?!0:ur&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Lne=fi?5e3:-1;Or.compositionstart=Or.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,r=e.selection.$to;if(e.selection instanceof Pe&&(e.storedMarks||!r.textOffset&&r.parentOffset&&r.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)||ir&&EI&&Bne(t)))t.markCursor=t.state.storedMarks||r.marks(),df(t,!0),t.markCursor=null;else if(df(t,!e.selection.empty),sn&&e.selection.empty&&r.parentOffset&&!r.textOffset&&r.nodeBefore.marks.length){let n=t.domSelectionRange();for(let i=n.focusNode,a=n.focusOffset;i&&i.nodeType==1&&a!=0;){let o=a<0?i.lastChild:i.childNodes[a-1];if(!o)break;if(o.nodeType==3){let s=t.domSelection();s&&s.collapse(o,o.nodeValue.length);break}else i=o,a=-1}}t.input.composing=!0}e$(t,Lne)};function Bne(t){let{focusNode:e,focusOffset:r}=t.domSelectionRange();if(!e||e.nodeType!=1||r>=e.childNodes.length)return!1;let n=e.childNodes[r];
vendor: 3,573 bytes, line 85
85return n.nodeType==1&&n.contentEditable=="false"}Or.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,e$(t,20))};function e$(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>df(t),e))}function t$(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=zne());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Fne(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let r=Tre(e.focusNode,e.focusOffset),n=Mre(e.focusNode,e.focusOffset);if(r&&n&&r!=n){let i=n.pmViewDesc,a=t.domObserver.lastChangedTextNode;if(r==a||n==a)return a;if(!i||!i.isText(n.nodeValue))return n;if(t.input.compositionNode==n){let o=r.pmViewDesc;if(!(!o||!o.isText(r.nodeValue)))return n}}return r||n}function zne(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function df(t,e=!1){if(!(fi&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),t$(t),e||t.docView&&t.docView.dirty){let r=e1(t),n=t.state.selection;return r&&!r.eq(n)?t.dispatch(t.state.tr.setSelection(r)):(t.markCursor||e)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function qne(t,e){if(!t.dom.parentNode)return;let r=t.dom.parentNode.appendChild(document.createElement("div"));r.appendChild(e),r.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout(()=>{r.parentNode&&r.parentNode.removeChild(r),t.focus()},50)}const yc=Er&&Ki<15||Cs&&$re<604;jr.copy=Or.cut=(t,e)=>{let r=e,n=t.state.selection,i=r.type=="cut";if(n.empty)return;let a=yc?null:r.clipboardData,o=n.content(),{dom:s,text:l}=r1(t,o);a?(r.preventDefault(),a.clearData(),a.setData("text/html",s.innerHTML),a.setData("text/plain",l)):qne(t,s),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Une(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Hne(t,e){if(!t.dom.parentNode)return;let r=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,n=t.dom.parentNode.appendChild(document.createElement(r?"textarea":"div"));r||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),n.parentNode&&n.parentNode.removeChild(n),r?xc(t,n.value,null,i,e):xc(t,n.textContent,n.innerHTML,i,e)},50)}function xc(t,e,r,n,i){let a=VI(t,e,r,n,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,a||ce.empty)))return!0;if(!a)return!1;let o=Une(a),s=o?t.state.tr.replaceSelectionWith(o,n):t.state.tr.replaceSelection(a);return t.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function r$(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let r=t.getData("text/uri-list");return r?r.replace(/\r?\n/g," "):""}Or.paste=(t,e)=>{let r=e;if(t.composing&&!fi)return;let n=yc?null:r.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;n&&xc(t,r$(n),n.getData("text/html"),i,r)?r.preventDefault():Hne(t,r)};
vendor: 4,714 bytes, line 85
85class n${constructor(e,r,n){this.slice=e,this.move=r,this.node=n}}const Wne=tn?"altKey":"ctrlKey";function i$(t,e){let r;return t.someProp("dragCopies",n=>{r=r||n(e)}),r!=null?!r:!e[Wne]}jr.dragstart=(t,e)=>{let r=e,n=t.input.mouseDown;if(n&&n.done(),!r.dataTransfer)return;let i=t.state.selection,a=i.empty?null:t.posAtCoords(Gh(r)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof we?i.to-1:i.to))){if(n&&n.mightDrag)o=we.create(t.state.doc,n.mightDrag.pos);else if(r.target&&r.target.nodeType==1){let f=t.docView.nearestDesc(r.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(o=we.create(t.state.doc,f.posBefore))}}let s=(o||t.state.selection).content(),{dom:l,text:u,slice:d}=r1(t,s);(!r.dataTransfer.files.length||!ir||AI>120)&&r.dataTransfer.clearData(),r.dataTransfer.setData(yc?"Text":"text/html",l.innerHTML),r.dataTransfer.effectAllowed="copyMove",yc||r.dataTransfer.setData("text/plain",u),t.dragging=new n$(d,i$(t,r),o)};jr.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Or.dragover=Or.dragenter=(t,e)=>e.preventDefault();Or.drop=(t,e)=>{try{Vne(t,e,t.dragging)}finally{t.dragging=null}};function Vne(t,e,r){if(!e.dataTransfer)return;let n=t.posAtCoords(Gh(e));if(!n)return;let i=t.state.doc.resolve(n.pos),a=r&&r.slice;a?t.someProp("transformPasted",p=>{a=p(a,t,!1)}):a=VI(t,r$(e.dataTransfer),yc?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(r&&i$(t,e));if(t.someProp("handleDrop",p=>p(t,e,a||ce.empty,o))){e.preventDefault();return}if(!a)return;e.preventDefault();let s=a?bI(t.state.doc,i.pos,a):i.pos;s==null&&(s=i.pos);let l=t.state.tr;if(o){let{node:p}=r;p?p.replace(l):l.deleteSelection()}let u=l.mapping.map(s),d=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,f=l.doc;if(d?l.replaceRangeWith(u,u,a.content.firstChild):l.replaceRange(u,u,a),l.doc.eq(f))return;let h=l.doc.resolve(u);if(d&&we.isSelectable(a.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(a.content.firstChild))l.setSelection(new we(h));else{let p=l.mapping.map(s);l.mapping.maps[l.mapping.maps.length-1].forEach((m,g,v,y)=>p=y),l.setSelection(t1(t,h,l.doc.resolve(p)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}jr.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&yi(t)},20))};jr.blur=(t,e)=>{let r=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),r.relatedTarget&&t.dom.contains(r.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};jr.beforeinput=(t,e)=>{if(ir&&fi&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:n}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=n||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",a=>a(t,Sa(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Or)jr[t]=Or[t];function bc(t,e){if(t==e)return!0;for(let r in t)if(t[r]!==e[r])return!1;for(let r in e)if(!(r in t))return!1;return!0}class ff{constructor(e,r){this.toDOM=e,this.spec=r||Ba,this.side=this.spec.side||0}map(e,r,n,i){let{pos:a,deleted:o}=e.mapResult(r.from+i,this.side<0?-1:1);return o?null:new qr(a-n,a-n,this)}valid(){return!0}eq(e){return this==e||e instanceof ff&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&bc(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Yi{constructor(e,r){this.attrs=e,this.spec=r||Ba}map(e,r,n,i){let a=e.map(r.from+i,this.spec.inclusiveStart?-1:1)-n,o=e.map(r.to+i,this.spec.inclusiveEnd?1:-1)-n;return a>=o?null:new qr(a,o,this)}valid(e,r){return r.from<r.to}eq(e){return this==e||e instanceof Yi&&bc(this.attrs,e.attrs)&&bc(this.spec,e.spec)}static is(e){return e.type instanceof Yi}destroy(){}}class o1{constructor(e,r){this.attrs=e,this.spec=r||Ba}map(e,r,n,i){let a=e.mapResult(r.from+i,1);if(a.deleted)return null;let o=e.mapResult(r.to+i,-1);return o.deleted||o.pos<=a.pos?null:new qr(a.pos-n,o.pos-n,this)}valid(e,r){let{index:n,offset:i}=e.content.findIndex(r.from),a;return i==r.from&&!(a=e.child(n)).isText&&i+a.nodeSize==r.to}eq(e){return this==e||e instanceof o1&&bc(this.attrs,e.attrs)&&bc(this.spec,e.spec)}destroy(){}}class qr{constructor(e,r,n){this.from=e,this.to=r,this.type=n}copy(e,r){return new qr(e,r,this.type)}eq(e,r=0){return this.type.eq(e.type)&&this.from+r==e.from&&this.to+r==e.to}map(e,r,n){return this.type.map(e,this,r,n)}static widget(e,r,n){return new qr(e,e,new ff(r,n))}static inline(e,r,n,i){return new qr(e,r,new Yi(n,i))}
vendor: 4,946 bytes, line 85
85static node(e,r,n,i){return new qr(e,r,new o1(n,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Yi}get widget(){return this.type instanceof ff}}const No=[],Ba={};class Et{constructor(e,r){this.local=e.length?e:No,this.children=r.length?r:No}static create(e,r){return r.length?hf(r,e,0,Ba):sr}find(e,r,n){let i=[];return this.findInner(e??0,r??1e9,i,0,n),i}findInner(e,r,n,i,a){for(let o=0;o<this.local.length;o++){let s=this.local[o];s.from<=r&&s.to>=e&&(!a||a(s.spec))&&n.push(s.copy(s.from+i,s.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<r&&this.children[o+1]>e){let s=this.children[o]+1;this.children[o+2].findInner(e-s,r-s,n,i+s,a)}}map(e,r,n){return this==sr||e.maps.length==0?this:this.mapInner(e,r,0,0,n||Ba)}mapInner(e,r,n,i,a){let o;for(let s=0;s<this.local.length;s++){let l=this.local[s].map(e,n,i);l&&l.type.valid(r,l)?(o||(o=[])).push(l):a.onRemove&&a.onRemove(this.local[s].spec)}return this.children.length?Kne(this.children,o||[],e,r,n,i,a):o?new Et(o.sort(Fa),No):sr}add(e,r){return r.length?this==sr?Et.create(e,r):this.addInner(e,r,0):this}addInner(e,r,n){let i,a=0;e.forEach((s,l)=>{let u=l+n,d;if(d=o$(r,s,u)){for(i||(i=this.children.slice());a<i.length&&i[a]<l;)a+=3;i[a]==l?i[a+2]=i[a+2].addInner(s,d,u+1):i.splice(a,0,l,l+s.nodeSize,hf(d,s,u+1,Ba)),a+=3}});let o=a$(a?s$(r):r,-n);for(let s=0;s<o.length;s++)o[s].type.valid(e,o[s])||o.splice(s--,1);return new Et(o.length?this.local.concat(o).sort(Fa):this.local,i||this.children)}remove(e){return e.length==0||this==sr?this:this.removeInner(e,0)}removeInner(e,r){let n=this.children,i=this.local;for(let a=0;a<n.length;a+=3){let o,s=n[a]+r,l=n[a+1]+r;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>s&&f.to<l&&(e[d]=null,(o||(o=[])).push(f));if(!o)continue;n==this.children&&(n=this.children.slice());let u=n[a+2].removeInner(o,s+1);u!=sr?n[a+2]=u:(n.splice(a,3),a-=3)}if(i.length){for(let a=0,o;a<e.length;a++)if(o=e[a])for(let s=0;s<i.length;s++)i[s].eq(o,r)&&(i==this.local&&(i=this.local.slice()),i.splice(s--,1))}return n==this.children&&i==this.local?this:i.length||n.length?new Et(i,n):sr}forChild(e,r){if(this==sr)return this;if(r.isLeaf)return Et.empty;let n,i;for(let s=0;s<this.children.length;s+=3)if(this.children[s]>=e){this.children[s]==e&&(n=this.children[s+2]);break}let a=e+1,o=a+r.content.size;for(let s=0;s<this.local.length;s++){let l=this.local[s];if(l.from<o&&l.to>a&&l.type instanceof Yi){let u=Math.max(a,l.from)-a,d=Math.min(o,l.to)-a;u<d&&(i||(i=[])).push(l.copy(u,d))}}if(i){let s=new Et(i.sort(Fa),No);return n?new Li([s,n]):s}return n||sr}eq(e){if(this==e)return!0;if(!(e instanceof Et)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let r=0;r<this.local.length;r++)if(!this.local[r].eq(e.local[r]))return!1;for(let r=0;r<this.children.length;r+=3)if(this.children[r]!=e.children[r]||this.children[r+1]!=e.children[r+1]||!this.children[r+2].eq(e.children[r+2]))return!1;return!0}locals(e){return s1(this.localsInner(e))}localsInner(e){if(this==sr)return No;if(e.inlineContent||!this.local.some(Yi.is))return this.local;let r=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof Yi||r.push(this.local[n]);return r}forEachSet(e){e(this)}}Et.empty=new Et([],[]);Et.removeOverlap=s1;const sr=Et.empty;class Li{constructor(e){this.members=e}map(e,r){const n=this.members.map(i=>i.map(e,r,Ba));return Li.from(n)}forChild(e,r){if(r.isLeaf)return Et.empty;let n=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(e,r);a!=sr&&(a instanceof Li?n=n.concat(a.members):n.push(a))}return Li.from(n)}eq(e){if(!(e instanceof Li)||e.members.length!=this.members.length)return!1;for(let r=0;r<this.members.length;r++)if(!this.members[r].eq(e.members[r]))return!1;return!0}locals(e){let r,n=!0;for(let i=0;i<this.members.length;i++){let a=this.members[i].localsInner(e);if(a.length)if(!r)r=a;else{n&&(r=r.slice(),n=!1);for(let o=0;o<a.length;o++)r.push(a[o])}}return r?s1(n?r:r.sort(Fa)):No}static from(e){switch(e.length){case 0:return sr;case 1:return e[0];default:return new Li(e.every(r=>r instanceof Et)?e:e.reduce((r,n)=>r.concat(n instanceof Et?n:n.members),[]))}}forEachSet(e){for(let r=0;r<this.members.length;r++)this.members[r].forEachSet(e)}}function Kne(t,e,r,n,i,a,o){let s=t.slice();for(let u=0,d=a;u<r.maps.length;u++){let f=0;r.maps[u].forEach((h,p,m,g)=>{let v=g-m-(p-h);for(let y=0;y<s.length;y+=3){let w=s[y+1];if(w<0||h>w+d-f)continue;let _=s[y]+d-f;p>=_?s[y+1]=h<=_?-2:-1:h>=d&&v&&(s[y]+=v,s[y+1]+=v)}f+=v}),d=r.maps[u].map(d,-1)}let l=!1;for(let u=0;u<s.length;u+=3)if(s[u+1]<0){if(s[u+1]==-2){l=!0,s[u+1]=-1;continue}let d=r.map(t[u]+a),f=d-i;if(f<0||f>=n.content.size){l=!0;continue}let h=r.map(t[u+1]+a,-1),p=h-i,{index:m,offset:g}=n.content.findIndex(f),v=n.maybeChild(m);if(v&&g==f&&g+v.nodeSize==p){let y=s[u+2].mapInner(r,v,d+1,t[u]+a+1,o);y!=sr?(s[u]=f,s[u+1]=p,s[u+2]=y):(s[u+1]=-2,l=!0)}else l=!0}
vendor: 9,638 bytes, line 85
85if(l){let u=Gne(s,t,e,r,i,a,o),d=hf(u,n,0,o);e=d.local;for(let f=0;f<s.length;f+=3)s[f+1]<0&&(s.splice(f,3),f-=3);for(let f=0,h=0;f<d.children.length;f+=3){let p=d.children[f];for(;h<s.length&&s[h]<p;)h+=3;s.splice(h,0,d.children[f],d.children[f+1],d.children[f+2])}}return new Et(e.sort(Fa),s)}function a$(t,e){if(!e||!t.length)return t;let r=[];for(let n=0;n<t.length;n++){let i=t[n];r.push(new qr(i.from+e,i.to+e,i.type))}return r}function Gne(t,e,r,n,i,a,o){function s(l,u){for(let d=0;d<l.local.length;d++){let f=l.local[d].map(n,i,u);f?r.push(f):o.onRemove&&o.onRemove(l.local[d].spec)}for(let d=0;d<l.children.length;d+=3)s(l.children[d+2],l.children[d]+u+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&s(t[l+2],e[l]+a+1);return r}function o$(t,e,r){if(e.isLeaf)return null;let n=r+e.nodeSize,i=null;for(let a=0,o;a<t.length;a++)(o=t[a])&&o.from>r&&o.to<n&&((i||(i=[])).push(o),t[a]=null);return i}function s$(t){let e=[];for(let r=0;r<t.length;r++)t[r]!=null&&e.push(t[r]);return e}function hf(t,e,r,n){let i=[],a=!1;e.forEach((s,l)=>{let u=o$(t,s,l+r);if(u){a=!0;let d=hf(u,s,r+l+1,n);d!=sr&&i.push(l,l+s.nodeSize,d)}});let o=a$(a?s$(t):t,-r).sort(Fa);for(let s=0;s<o.length;s++)o[s].type.valid(e,o[s])||(n.onRemove&&n.onRemove(o[s].spec),o.splice(s--,1));return o.length||i.length?new Et(o,i):sr}function Fa(t,e){return t.from-e.from||t.to-e.to}function s1(t){let e=t;for(let r=0;r<e.length-1;r++){let n=e[r];if(n.from!=n.to)for(let i=r+1;i<e.length;i++){let a=e[i];if(a.from==n.from){a.to!=n.to&&(e==t&&(e=t.slice()),e[i]=a.copy(a.from,n.to),TA(e,i+1,a.copy(n.to,a.to)));continue}else{a.from<n.to&&(e==t&&(e=t.slice()),e[r]=n.copy(n.from,a.from),TA(e,i,n.copy(a.from,n.to)));break}}}return e}function TA(t,e,r){for(;e<t.length&&Fa(r,t[e])>0;)e++;t.splice(e,0,r)}function Dy(t){let e=[];return t.someProp("decorations",r=>{let n=r(t.state);n&&n!=sr&&e.push(n)}),t.cursorWrapper&&e.push(Et.create(t.state.doc,[t.cursorWrapper.deco])),Li.from(e)}const Yne={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Xne=Er&&Ki<=11;class Jne{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Zne{constructor(e,r){this.view=e,this.handleDOMChange=r,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Jne,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let i=0;i<n.length;i++)this.queue.push(n[i]);Er&&Ki<=11&&n.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():ur&&e.composing&&n.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Xne&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Yne)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let r=0;r<e.length;r++)this.queue.push(e[r]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(jA(this.view)){if(this.suppressingSelectionUpdates)return yi(this.view);if(Er&&Ki<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&eo(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let r=new Set,n;for(let a=e.focusNode;a;a=Ns(a))r.add(a);for(let a=e.anchorNode;a;a=Ns(a))if(r.has(a)){n=a;break}let i=n&&this.view.docView.nearestDesc(n);if(i&&i.ignoreMutation({type:"selection",target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let r=this.pendingRecords();r.length&&(this.queue=[]);let n=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&jA(e)&&!this.ignoreSelectionChange(n),a=-1,o=-1,s=!1,l=[];if(e.editable)for(let d=0;d<r.length;d++){let f=this.registerMutation(r[d],l);f&&(a=a<0?f.from:Math.min(f.from,a),o=o<0?f.to:Math.max(f.to,o),f.typeOver&&(s=!0))}if(l.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let d of l)if(d.nodeName=="BR"&&d.parentNode){let f=d.nextSibling;for(;f&&f.nodeType==1;){if(f.contentEditable=="false"){d.parentNode.removeChild(d);break}f=f.firstChild}}}else if(sn&&l.length){let d=l.filter(f=>f.nodeName=="BR");if(d.length==2){let[f,h]=d;f.parentNode&&f.parentNode.parentNode==h.parentNode?h.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let h of d){let p=h.parentNode;p&&p.nodeName=="LI"&&(!f||tie(e,f)!=p)&&h.remove()}}}let u=null;a<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Vh(n)&&(u=e1(e))&&u.eq(Fe.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,yi(e),this.currentSelection.set(n),e.scrollToSelection()):(a>-1||i)&&(a>-1&&(e.docView.markDirty(a,o),Qne(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,rie(e,l)),this.handleDOMChange(a,o,s,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||yi(e),this.currentSelection.set(n))}registerMutation(e,r){if(r.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(n==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let f=e.addedNodes[d];r.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let i=e.previousSibling,a=e.nextSibling;if(Er&&Ki<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:f,nextSibling:h}=e.addedNodes[d];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(a=h)}let o=i&&i.parentNode==e.target?rr(i)+1:0,s=n.localPosFromDOM(e.target,o,-1),l=a&&a.parentNode==e.target?rr(a):e.target.childNodes.length,u=n.localPosFromDOM(e.target,l,1);return{from:s,to:u}}else return e.type=="attributes"?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let MA=new WeakMap,DA=!1;function Qne(t){if(!MA.has(t)&&(MA.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=sn,DA)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),DA=!0}}function RA(t,e){let r=e.startContainer,n=e.startOffset,i=e.endContainer,a=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return eo(o.node,o.offset,i,a)&&([r,n,i,a]=[i,a,r,n]),{anchorNode:r,anchorOffset:n,focusNode:i,focusOffset:a}}function eie(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return RA(t,i)}let r;function n(i){i.preventDefault(),i.stopImmediatePropagation(),r=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",n,!0),r?RA(t,r):null}function tie(t,e){for(let r=e.parentNode;r&&r!=t.dom;r=r.parentNode){let n=t.docView.nearestDesc(r,!0);if(n&&n.node.isBlock)return r}return null}function rie(t,e){var r;let{focusNode:n,focusOffset:i}=t.domSelectionRange();for(let a of e)if(((r=a.parentNode)===null||r===void 0?void 0:r.nodeName)=="TR"){let o=a.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let s=o;for(;;){let l=s.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;s=l}s.insertBefore(a,s.firstChild),n==a&&t.domSelection().collapse(a,i)}else a.parentNode.removeChild(a)}}function nie(t,e,r){let{node:n,fromOffset:i,toOffset:a,from:o,to:s}=t.docView.parseRange(e,r),l=t.domSelectionRange(),u,d=l.anchorNode;
vendor: 4,461 bytes, line 85
85if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:l.anchorOffset}],Vh(l)||u.push({node:l.focusNode,offset:l.focusOffset})),ir&&t.input.lastKeyCode===8)for(let v=a;v>i;v--){let y=n.childNodes[v-1],w=y.pmViewDesc;if(y.nodeName=="BR"&&!w){a=v;break}if(!w||w.size)break}let f=t.state.doc,h=t.someProp("domParser")||Vi.fromSchema(t.state.schema),p=f.resolve(o),m=null,g=h.parse(n,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:a,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:iie,context:p});if(u&&u[0].pos!=null){let v=u[0].pos,y=u[1]&&u[1].pos;y==null&&(y=v),m={anchor:v+o,head:y+o}}return{doc:g,sel:m,from:o,to:s}}function iie(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(ur&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(t.parentNode.lastChild==t||ur&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const aie=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function oie(t,e,r,n,i){let a=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let S=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,N=e1(t,S);if(N&&!t.state.selection.eq(N)){if(ir&&fi&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",T=>T(t,Sa(13,"Enter"))))return;let C=t.state.tr.setSelection(N);S=="pointer"?C.setMeta("pointer",!0):S=="key"&&C.scrollIntoView(),a&&C.setMeta("composition",a),t.dispatch(C)}return}let o=t.state.doc.resolve(e),s=o.sharedDepth(r);e=o.before(s+1),r=t.state.doc.resolve(r).after(s+1);let l=t.state.selection,u=nie(t,e,r),d=t.state.doc,f=d.slice(u.from,u.to),h,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,p="end"):(h=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let m=cie(f.content,u.doc.content,u.from,h,p);if(m&&t.input.domChangeCount++,(Cs&&t.input.lastIOSEnter>Date.now()-225||fi)&&i.some(S=>S.nodeType==1&&!aie.test(S.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",S=>S(t,Sa(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(n&&l instanceof Pe&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let S=IA(t,t.state.doc,u.sel);if(S&&!S.eq(t.state.selection)){let N=t.state.tr.setSelection(S);a&&N.setMeta("composition",a),t.dispatch(N)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof Pe&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),Er&&Ki<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)==" Â "&&(m.start--,m.endA--,m.endB--);let g=u.doc.resolveNoCache(m.start-u.from),v=u.doc.resolveNoCache(m.endB-u.from),y=d.resolve(m.start),w=g.sameParent(v)&&g.parent.inlineContent&&y.end()>=m.endA;if((Cs&&t.input.lastIOSEnter>Date.now()-225&&(!w||i.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!w&&g.pos<u.doc.content.size&&(!g.sameParent(v)||!g.parent.inlineContent)&&g.pos<v.pos&&!/\S/.test(u.doc.textBetween(g.pos,v.pos,"","")))&&t.someProp("handleKeyDown",S=>S(t,Sa(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&lie(d,m.start,m.endA,g,v)&&t.someProp("handleKeyDown",S=>S(t,Sa(8,"Backspace")))){fi&&ir&&t.domObserver.suppressSelectionUpdates();return}ir&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),fi&&!w&&g.start()!=v.start()&&v.parentOffset==0&&g.depth==v.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,v=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(S){return S(t,Sa(13,"Enter"))})},20));let _=m.start,j=m.endA,b=S=>{let N=S||t.state.tr.replace(_,j,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let C=IA(t,N.doc,u.sel);
vendor: 6,750 bytes, line 85
85C&&!(ir&&t.composing&&C.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(C.head==_||C.head==N.mapping.map(j)-1)||Er&&C.empty&&C.head==_)&&N.setSelection(C)}return a&&N.setMeta("composition",a),N.scrollIntoView()},O;if(w)if(g.pos==v.pos){Er&&Ki<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>yi(t),20));let S=b(t.state.tr.delete(_,j)),N=d.resolve(m.start).marksAcross(d.resolve(m.endA));N&&S.ensureMarks(N),t.dispatch(S)}else if(m.endA==m.endB&&(O=sie(g.parent.content.cut(g.parentOffset,v.parentOffset),y.parent.content.cut(y.parentOffset,m.endA-y.start())))){let S=b(t.state.tr);O.type=="add"?S.addMark(_,j,O.mark):S.removeMark(_,j,O.mark),t.dispatch(S)}else if(g.parent.child(g.index()).isText&&g.index()==v.index()-(v.textOffset?0:1)){let S=g.parent.textBetween(g.parentOffset,v.parentOffset),N=()=>b(t.state.tr.insertText(S,_,j));t.someProp("handleTextInput",C=>C(t,_,j,S,N))||t.dispatch(N())}else t.dispatch(b());else t.dispatch(b())}function IA(t,e,r){return Math.max(r.anchor,r.head)>e.content.size?null:t1(t,e.resolve(r.anchor),e.resolve(r.head))}function sie(t,e){let r=t.firstChild.marks,n=e.firstChild.marks,i=r,a=n,o,s,l;for(let d=0;d<n.length;d++)i=n[d].removeFromSet(i);for(let d=0;d<r.length;d++)a=r[d].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o="add",l=d=>d.mark(s.addToSet(d.marks));else if(i.length==0&&a.length==1)s=a[0],o="remove",l=d=>d.mark(s.removeFromSet(d.marks));else return null;let u=[];for(let d=0;d<e.childCount;d++)u.push(l(e.child(d)));if(J.from(u).eq(t))return{mark:s,type:o}}function lie(t,e,r,n,i){if(r-e<=i.pos-n.pos||Ry(n,!0,!1)<i.pos)return!1;let a=t.resolve(e);if(!n.parent.isTextblock){let s=a.nodeAfter;return s!=null&&r==e+s.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=t.resolve(Ry(a,!0,!0));return!o.parent.isTextblock||o.pos>r||Ry(o,!0,!1)<r?!1:n.parent.content.cut(n.parentOffset).eq(o.parent.content)}function Ry(t,e,r){let n=t.depth,i=e?t.end():t.pos;for(;n>0&&(e||t.indexAfter(n)==t.node(n).childCount);)n--,i++,e=!1;if(r){let a=t.node(n).maybeChild(t.indexAfter(n));for(;a&&!a.isLeaf;)a=a.firstChild,i++}return i}function cie(t,e,r,n,i){let a=t.findDiffStart(e,r);if(a==null)return null;let{a:o,b:s}=t.findDiffEnd(e,r+t.size,r+e.size);if(i=="end"){let l=Math.max(0,a-Math.min(o,s));n-=o+l-a}if(o<a&&t.size<e.size){let l=n<=a&&n>=o?a-n:0;a-=l,a&&a<e.size&&$A(e.textBetween(a-1,a+1))&&(a+=l?1:-1),s=a+(s-o),o=a}else if(s<a){let l=n<=a&&n>=s?a-n:0;a-=l,a&&a<t.size&&$A(t.textBetween(a-1,a+1))&&(a+=l?1:-1),o=a+(o-s),s=a}return{start:a,endA:o,endB:s}}function $A(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),r=t.charCodeAt(1);return e>=56320&&e<=57343&&r>=55296&&r<=56319}class l${constructor(e,r){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new One,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=r,this.state=r.state,this.directPlugins=r.plugins||[],this.directPlugins.forEach(qA),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=FA(this),BA(this),this.nodeViews=zA(this),this.docView=yA(this.state.doc,LA(this),Dy(this),this.dom,this),this.domObserver=new Zne(this,(n,i,a,o)=>oie(this,n,i,a,o)),this.domObserver.start(),Nne(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let r in e)this._props[r]=e[r];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Yb(this);let r=this._props;this._props=e,e.plugins&&(e.plugins.forEach(qA),this.directPlugins=e.plugins),this.updateStateInner(e.state,r)}setProps(e){let r={};for(let n in this._props)r[n]=this._props[n];r.state=this.state;for(let n in e)r[n]=e[n];this.update(r)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,r){var n;let i=this.state,a=!1,o=!1;e.storedMarks&&this.composing&&(t$(this),o=!0),this.state=e;let s=i.plugins!=e.plugins||this._props.plugins!=r.plugins;if(s||this._props.plugins!=r.plugins||this._props.nodeViews!=r.nodeViews){let p=zA(this);die(p,this.nodeViews)&&(this.nodeViews=p,a=!0)}(s||r.handleDOMEvents!=this._props.handleDOMEvents)&&Yb(this),this.editable=FA(this),BA(this);let l=Dy(this),u=LA(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=a||!this.docView.matchesNode(e.doc,u,l);(f||!e.selection.eq(i.selection))&&(o=!0);let h=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Fre(this);if(o){this.domObserver.stop();let p=f&&(Er||ir)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&uie(i.selection,e.selection);if(f){let m=ir?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Fne(this)),(a||!this.docView.update(e.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=yA(e.doc,u,l,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&une(this))?yi(this,p):(UI(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((n=this.dragging)===null||n===void 0)&&n.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():h&&zre(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",r=>r(this)))if(this.state.selection instanceof we){let r=this.docView.domAfterPos(this.state.selection.from);r.nodeType==1&&fA(this,r.getBoundingClientRect(),e)}else fA(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let r=0;r<this.directPlugins.length;r++){let n=this.directPlugins[r];n.spec.view&&this.pluginViews.push(n.spec.view(this))}for(let r=0;r<this.state.plugins.length;r++){let n=this.state.plugins[r];n.spec.view&&this.pluginViews.push(n.spec.view(this))}}else for(let r=0;r<this.pluginViews.length;r++){let n=this.pluginViews[r];n.update&&n.update(this,e)}}updateDraggedNode(e,r){let n=e.node,i=-1;
vendor: 4,888 bytes, line 85
85if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)i=n.from;else{let a=n.from+(this.state.doc.content.size-r.doc.content.size);(a>0&&a<this.state.doc.content.size&&this.state.doc.nodeAt(a))==n.node&&(i=a)}this.dragging=new n$(e.slice,e.move,i<0?void 0:we.create(this.state.doc,i))}someProp(e,r){let n=this._props&&this._props[e],i;if(n!=null&&(i=r?r(n):n))return i;for(let o=0;o<this.directPlugins.length;o++){let s=this.directPlugins[o].props[e];if(s!=null&&(i=r?r(s):s))return i}let a=this.state.plugins;if(a)for(let o=0;o<a.length;o++){let s=a[o].props[e];if(s!=null&&(i=r?r(s):s))return i}}hasFocus(){if(Er){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&qre(this.dom),yi(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let r=this.dom.parentNode;r;r=r.parentNode)if(r.nodeType==9||r.nodeType==11&&r.host)return r.getSelection||(Object.getPrototypeOf(r).getSelection=()=>r.ownerDocument.getSelection()),this._root=r}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Kre(this,e)}coordsAtPos(e,r=1){return RI(this,e,r)}domAtPos(e,r=0){return this.docView.domFromPos(e,r)}nodeDOM(e){let r=this.docView.descAt(e);return r?r.nodeDOM:null}posAtDOM(e,r,n=-1){let i=this.docView.posFromDOM(e,r,n);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,r){return Zre(this,r||this.state,e)}pasteHTML(e,r){return xc(this,"",e,!1,r||new ClipboardEvent("paste"))}pasteText(e,r){return xc(this,e,null,!0,r||new ClipboardEvent("paste"))}serializeForClipboard(e){return r1(this,e)}destroy(){this.docView&&(Cne(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Dy(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Ere())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Ane(this,e)}domSelectionRange(){let e=this.domSelection();return e?ur&&this.root.nodeType===11&&Rre(this.dom.ownerDocument)==this.dom&&eie(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}l$.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function LA(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",r=>{if(typeof r=="function"&&(r=r(t.state)),r)for(let n in r)n=="class"?e.class+=" "+r[n]:n=="style"?e.style=(e.style?e.style+";":"")+r[n]:!e[n]&&n!="contenteditable"&&n!="nodeName"&&(e[n]=String(r[n]))}),e.translate||(e.translate="no"),[qr.node(0,t.state.doc.content.size,e)]}function BA(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:qr.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function FA(t){return!t.someProp("editable",e=>e(t.state)===!1)}function uie(t,e){let r=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(r)!=e.$anchor.start(r)}function zA(t){let e=Object.create(null);function r(n){for(let i in n)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=n[i])}return t.someProp("nodeViews",r),t.someProp("markViews",r),e}function die(t,e){let r=0,n=0;for(let i in t){if(t[i]!=e[i])return!0;r++}for(let i in e)n++;return r!=n}function qA(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Ji={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},pf={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},fie=typeof navigator<"u"&&/Mac/.test(navigator.platform),hie=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var nr=0;nr<10;nr++)Ji[48+nr]=Ji[96+nr]=String(nr);for(var nr=1;nr<=24;
vendor: 32,052 bytes, lines 85-88
85nr++)Ji[nr+111]="F"+nr;for(var nr=65;nr<=90;nr++)Ji[nr]=String.fromCharCode(nr+32),pf[nr]=String.fromCharCode(nr);for(var Iy in Ji)pf.hasOwnProperty(Iy)||(pf[Iy]=Ji[Iy]);function pie(t){var e=fie&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||hie&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",r=!e&&t.key||(t.shiftKey?pf:Ji)[t.keyCode]||t.key||"Unidentified";return r=="Esc"&&(r="Escape"),r=="Del"&&(r="Delete"),r=="Left"&&(r="ArrowLeft"),r=="Up"&&(r="ArrowUp"),r=="Right"&&(r="ArrowRight"),r=="Down"&&(r="ArrowDown"),r}const mie=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),gie=typeof navigator<"u"&&/Win/.test(navigator.platform);function vie(t){let e=t.split(/-(?!$)/),r=e[e.length-1];r=="Space"&&(r=" ");let n,i,a,o;for(let s=0;s<e.length-1;s++){let l=e[s];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))a=!0;else if(/^mod$/i.test(l))mie?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return n&&(r="Alt-"+r),i&&(r="Ctrl-"+r),o&&(r="Meta-"+r),a&&(r="Shift-"+r),r}function yie(t){let e=Object.create(null);for(let r in t)e[vie(r)]=t[r];return e}function $y(t,e,r=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),r&&e.shiftKey&&(t="Shift-"+t),t}function xie(t){return new Jt({props:{handleKeyDown:c$(t)}})}function c$(t){let e=yie(t);return function(r,n){let i=pie(n),a,o=e[$y(i,n)];if(o&&o(r.state,r.dispatch,r))return!0;if(i.length==1&&i!=" "){if(n.shiftKey){let s=e[$y(i,n,!1)];if(s&&s(r.state,r.dispatch,r))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(gie&&n.ctrlKey&&n.altKey)&&(a=Ji[n.keyCode])&&a!=i){let s=e[$y(a,n)];if(s&&s(r.state,r.dispatch,r))return!0}}return!1}}const l1=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function u$(t,e){let{$cursor:r}=t.selection;return!r||(e?!e.endOfTextblock("backward",t):r.parentOffset>0)?null:r}const d$=(t,e,r)=>{let n=u$(t,r);if(!n)return!1;let i=c1(n);if(!i){let o=n.blockRange(),s=o&&zs(o);return s==null?!1:(e&&e(t.tr.lift(o,s).scrollIntoView()),!0)}let a=i.nodeBefore;if(b$(t,i,e,-1))return!0;if(n.parent.content.size==0&&(ks(a,"end")||we.isSelectable(a)))for(let o=n.depth;;o--){let s=Hh(t.doc,n.before(o),n.after(o),ce.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(ks(a,"end")?Fe.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):we.create(l.doc,i.pos-a.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||n.node(o-1).childCount>1)break}return a.isAtom&&i.depth==n.depth-1?(e&&e(t.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},bie=(t,e,r)=>{let n=u$(t,r);if(!n)return!1;let i=c1(n);return i?f$(t,i,e):!1},wie=(t,e,r)=>{let n=p$(t,r);if(!n)return!1;let i=u1(n);return i?f$(t,i,e):!1};function f$(t,e,r){let n=e.nodeBefore,i=n,a=e.pos-1;for(;!i.isTextblock;a--){if(i.type.spec.isolating)return!1;let d=i.lastChild;if(!d)return!1;i=d}let o=e.nodeAfter,s=o,l=e.pos+1;for(;!s.isTextblock;l++){if(s.type.spec.isolating)return!1;let d=s.firstChild;if(!d)return!1;s=d}let u=Hh(t.doc,a,l,ce.empty);if(!u||u.from!=a||u instanceof At&&u.slice.size>=l-a)return!1;if(r){let d=t.tr.step(u);d.setSelection(Pe.create(d.doc,a)),r(d.scrollIntoView())}return!0}function ks(t,e,r=!1){for(let n=t;n;n=e=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(r&&n.childCount!=1)return!1}return!1}const h$=(t,e,r)=>{let{$head:n,empty:i}=t.selection,a=n;if(!i)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("backward",t):n.parentOffset>0)return!1;a=c1(n)}let o=a&&a.nodeBefore;return!o||!we.isSelectable(o)?!1:(e&&e(t.tr.setSelection(we.create(t.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function c1(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function p$(t,e){let{$cursor:r}=t.selection;return!r||(e?!e.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)?null:r}const m$=(t,e,r)=>{let n=p$(t,r);if(!n)return!1;let i=u1(n);if(!i)return!1;let a=i.nodeAfter;if(b$(t,i,e,1))return!0;if(n.parent.content.size==0&&(ks(a,"start")||we.isSelectable(a))){let o=Hh(t.doc,n.before(),n.after(),ce.empty);if(o&&o.slice.size<o.to-o.from){if(e){let s=t.tr.step(o);s.setSelection(ks(a,"start")?Fe.findFrom(s.doc.resolve(s.mapping.map(i.pos)),1):we.create(s.doc,s.mapping.map(i.pos))),e(s.scrollIntoView())}return!0}}return a.isAtom&&i.depth==n.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},g$=(t,e,r)=>{let{$head:n,empty:i}=t.selection,a=n;if(!i)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)return!1;a=u1(n)}let o=a&&a.nodeAfter;return!o||!we.isSelectable(o)?!1:(e&&e(t.tr.setSelection(we.create(t.doc,a.pos)).scrollIntoView()),!0)};function u1(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let r=t.node(e);if(t.index(e)+1<r.childCount)return t.doc.resolve(t.after(e+1));if(r.type.spec.isolating)break}return null}const _ie=(t,e)=>{let r=t.selection,n=r instanceof we,i;if(n){if(r.node.isTextblock||!oa(t.doc,r.from))return!1;i=r.from}else if(i=Uh(t.doc,r.from,-1),i==null)return!1;if(e){let a=t.tr.join(i);n&&a.setSelection(we.create(a.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(a.scrollIntoView())}return!0},Sie=(t,e)=>{let r=t.selection,n;if(r instanceof we){if(r.node.isTextblock||!oa(t.doc,r.to))return!1;n=r.to}else if(n=Uh(t.doc,r.to,1),n==null)return!1;return e&&e(t.tr.join(n).scrollIntoView()),!0},jie=(t,e)=>{let{$from:r,$to:n}=t.selection,i=r.blockRange(n),a=i&&zs(i);return a==null?!1:(e&&e(t.tr.lift(i,a).scrollIntoView()),!0)},v$=(t,e)=>{let{$head:r,$anchor:n}=t.selection;return!r.parent.type.spec.code||!r.sameParent(n)?!1:(e&&e(t.tr.insertText(` 86`).scrollIntoView()),!0)};function d1(t){for(let e=0;e<t.edgeCount;e++){let{type:r}=t.edge(e);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}const Oie=(t,e)=>{let{$head:r,$anchor:n}=t.selection;if(!r.parent.type.spec.code||!r.sameParent(n))return!1;let i=r.node(-1),a=r.indexAfter(-1),o=d1(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(e){let s=r.after(),l=t.tr.replaceWith(s,s,o.createAndFill());l.setSelection(Fe.near(l.doc.resolve(s),1)),e(l.scrollIntoView())}return!0},y$=(t,e)=>{let r=t.selection,{$from:n,$to:i}=r;if(r instanceof Wr||n.parent.inlineContent||i.parent.inlineContent)return!1;let a=d1(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(e){let o=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos,s=t.tr.insert(o,a.createAndFill());s.setSelection(Pe.create(s.doc,o+1)),e(s.scrollIntoView())}return!0},x$=(t,e)=>{let{$cursor:r}=t.selection;if(!r||r.parent.content.size)return!1;if(r.depth>1&&r.after()!=r.end(-1)){let a=r.before();if(vi(t.doc,a))return e&&e(t.tr.split(a).scrollIntoView()),!0}let n=r.blockRange(),i=n&&zs(n);return i==null?!1:(e&&e(t.tr.lift(n,i).scrollIntoView()),!0)};function Nie(t){return(e,r)=>{let{$from:n,$to:i}=e.selection;if(e.selection instanceof we&&e.selection.node.isBlock)return!n.parentOffset||!vi(e.doc,n.pos)?!1:(r&&r(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let a=[],o,s,l=!1,u=!1;for(let p=n.depth;;p--)if(n.node(p).isBlock){l=n.end(p)==n.pos+(n.depth-p),u=n.start(p)==n.pos-(n.depth-p),s=d1(n.node(p-1).contentMatchAt(n.indexAfter(p-1))),a.unshift(l&&s?{type:s}:null),o=p;break}else{if(p==1)return!1;a.unshift(null)}let d=e.tr;(e.selection instanceof Pe||e.selection instanceof Wr)&&d.deleteSelection();let f=d.mapping.map(n.pos),h=vi(d.doc,f,a.length,a);if(h||(a[0]=s?{type:s}:null,h=vi(d.doc,f,a.length,a)),!h)return!1;if(d.split(f,a.length,a),!l&&u&&n.node(o).type!=s){let p=d.mapping.map(n.before(o)),m=d.doc.resolve(p);s&&n.node(o-1).canReplaceWith(m.index(),m.index()+1,s)&&d.setNodeMarkup(d.mapping.map(n.before(o)),s)}return r&&r(d.scrollIntoView()),!0}}const Cie=Nie(),kie=(t,e)=>{let{$from:r,to:n}=t.selection,i,a=r.sharedDepth(n);return a==0?!1:(i=r.before(a),e&&e(t.tr.setSelection(we.create(t.doc,i))),!0)};function Aie(t,e,r){let n=e.nodeBefore,i=e.nodeAfter,a=e.index();return!n||!i||!n.type.compatibleContent(i.type)?!1:!n.content.size&&e.parent.canReplace(a-1,a)?(r&&r(t.tr.delete(e.pos-n.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(a,a+1)||!(i.isTextblock||oa(t.doc,e.pos))?!1:(r&&r(t.tr.join(e.pos).scrollIntoView()),!0)}function b$(t,e,r,n){let i=e.nodeBefore,a=e.nodeAfter,o,s,l=i.type.spec.isolating||a.type.spec.isolating;if(!l&&Aie(t,e,r))return!0;let u=!l&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(r){let p=e.pos+a.nodeSize,m=J.empty;for(let y=o.length-1;y>=0;y--)m=J.from(o[y].create(null,m));m=J.from(i.copy(m));let g=t.tr.step(new Kt(e.pos-1,p,e.pos,p,new ce(m,1,0),o.length,!0)),v=g.doc.resolve(p+2*o.length);v.nodeAfter&&v.nodeAfter.type==i.type&&oa(g.doc,v.pos)&&g.join(v.pos),r(g.scrollIntoView())}return!0}let d=a.type.spec.isolating||n>0&&l?null:Fe.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),h=f&&zs(f);if(h!=null&&h>=e.depth)return r&&r(t.tr.lift(f,h).scrollIntoView()),!0;if(u&&ks(a,"start",!0)&&ks(i,"end")){let p=i,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let g=a,v=1;for(;!g.isTextblock;g=g.firstChild)v++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(r){let y=J.empty;for(let _=m.length-1;_>=0;_--)y=J.from(m[_].copy(y));let w=t.tr.step(new Kt(e.pos-m.length,e.pos+a.nodeSize,e.pos+v,e.pos+a.nodeSize-v,new ce(y,m.length,0),0,!0));r(w.scrollIntoView())}return!0}}return!1}function w$(t){return function(e,r){let n=e.selection,i=t<0?n.$from:n.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(r&&r(e.tr.setSelection(Pe.create(e.doc,t<0?i.start(a):i.end(a)))),!0):!1}}const Eie=w$(-1),Pie=w$(1);function Tie(t,e=null){return function(r,n){let{$from:i,$to:a}=r.selection,o=i.blockRange(a),s=o&&Jw(o,t,e);return s?(n&&n(r.tr.wrap(o,s).scrollIntoView()),!0):!1}}function UA(t,e=null){return function(r,n){let i=!1;for(let a=0;a<r.selection.ranges.length&&!i;a++){let{$from:{pos:o},$to:{pos:s}}=r.selection.ranges[a];r.doc.nodesBetween(o,s,(l,u)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let d=r.doc.resolve(u),f=d.index();i=d.parent.canReplaceWith(f,f+1,t)}})}if(!i)return!1;if(n){let a=r.tr;for(let o=0;o<r.selection.ranges.length;o++){let{$from:{pos:s},$to:{pos:l}}=r.selection.ranges[o];a.setBlockType(s,l,t,e)}n(a.scrollIntoView())}return!0}}function f1(...t){return function(e,r,n){for(let i=0;i<t.length;i++)if(t[i](e,r,n))return!0;return!1}}f1(l1,d$,h$);f1(l1,m$,g$);f1(v$,y$,x$,Cie);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Mie(t,e=null){return function(r,n){let{$from:i,$to:a}=r.selection,o=i.blockRange(a);if(!o)return!1;let s=n?r.tr:null;return Die(s,o,t,e)?(n&&n(s.scrollIntoView()),!0):!1}}function Die(t,e,r,n=null){let i=!1,a=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(r)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);a=new sf(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new sf(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let s=Jw(a,r,n,e);return s?(t&&Rie(t,e,s,i,r),!0):!1}function Rie(t,e,r,n,i){let a=J.empty;for(let d=r.length-1;d>=0;d--)a=J.from(r[d].type.create(r[d].attrs,a));t.step(new Kt(e.start-(n?2:0),e.end,e.start,e.end,new ce(a,0,0),r.length,!0));let o=0;for(let d=0;d<r.length;d++)r[d].type==i&&(o=d+1);let s=r.length-o,l=e.start+r.length-(n?2:0),u=e.parent;for(let d=e.startIndex,f=e.endIndex,h=!0;d<f;d++,h=!1)!h&&vi(t.doc,l,s)&&(t.split(l,s),l+=2*s),l+=u.child(d).nodeSize;return t}function Iie(t){return function(e,r){let{$from:n,$to:i}=e.selection,a=n.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return a?r?n.node(a.depth-1).type==t?$ie(e,r,t,a):Lie(e,r,a):!0:!1}}function $ie(t,e,r,n){let i=t.tr,a=n.end,o=n.$to.end(n.depth);a<o&&(i.step(new Kt(a-1,o,a,o,new ce(J.from(r.create(null,n.parent.copy())),1,0),1,!0)),n=new sf(i.doc.resolve(n.$from.pos),i.doc.resolve(o),n.depth));const s=zs(n);if(s==null)return!1;i.lift(n,s);let l=i.doc.resolve(i.mapping.map(a,-1)-1);return oa(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function Lie(t,e,r){let n=t.tr,i=r.parent;for(let p=r.end,m=r.endIndex-1,g=r.startIndex;m>g;m--)p-=i.child(m).nodeSize,n.delete(p-1,p+1);let a=n.doc.resolve(r.start),o=a.nodeAfter;if(n.mapping.map(r.end)!=r.start+a.nodeAfter.nodeSize)return!1;let s=r.startIndex==0,l=r.endIndex==i.childCount,u=a.node(-1),d=a.index(-1);if(!u.canReplace(d+(s?0:1),d+1,o.content.append(l?J.empty:J.from(i))))return!1;let f=a.pos,h=f+o.nodeSize;return n.step(new Kt(f-(s?1:0),h+(l?1:0),f+1,h-1,new ce((s?J.empty:J.from(i.copy(J.empty))).append(l?J.empty:J.from(i.copy(J.empty))),s?0:1,l?0:1),s?0:1)),e(n.scrollIntoView()),!0}function Bie(t){return function(e,r){let{$from:n,$to:i}=e.selection,a=n.blockRange(i,u=>u.childCount>0&&u.firstChild.type==t);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,l=s.child(o-1);if(l.type!=t)return!1;if(r){let u=l.lastChild&&l.lastChild.type==s.type,d=J.from(u?t.create():null),f=new ce(J.from(t.create(null,J.from(s.type.create(null,d)))),u?3:1,0),h=a.start,p=a.end;r(e.tr.step(new Kt(h-(u?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}function Yh(t){const{state:e,transaction:r}=t;let{selection:n}=r,{doc:i}=r,{storedMarks:a}=r;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return a},get selection(){return n},get doc(){return i},get tr(){return n=r.selection,i=r.doc,a=r.storedMarks,r}}}class Xh{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:r,state:n}=this,{view:i}=r,{tr:a}=n,o=this.buildProps(a);return Object.fromEntries(Object.entries(e).map(([s,l])=>[s,(...d)=>{const f=l(...d)(o);return!a.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(a),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,r=!0){const{rawCommands:n,editor:i,state:a}=this,{view:o}=i,s=[],l=!!e,u=e||a.tr,d=()=>(!l&&r&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(u),s.every(h=>h===!0)),f={...Object.fromEntries(Object.entries(n).map(([h,p])=>[h,(...g)=>{const v=this.buildProps(u,r),y=p(...g)(v);return s.push(y),f}])),run:d};return f}createCan(e){const{rawCommands:r,state:n}=this,i=!1,a=e||n.tr,o=this.buildProps(a,i);return{...Object.fromEntries(Object.entries(r).map(([l,u])=>[l,(...d)=>u(...d)({...o,dispatch:void 0})])),chain:()=>this.createChain(a,i)}}buildProps(e,r=!0){const{rawCommands:n,editor:i,state:a}=this,{view:o}=i,s={tr:e,editor:i,view:o,state:Yh({state:a,transaction:e}),dispatch:r?()=>{}:void 0,chain:()=>this.createChain(e,r),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([l,u])=>[l,(...d)=>u(...d)(s)]))}};return s}}class Fie{constructor(){this.callbacks={}}on(e,r){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(r),this}emit(e,...r){const n=this.callbacks[e];return n&&n.forEach(i=>i.apply(this,r)),this}off(e,r){const n=this.callbacks[e];return n&&(r?this.callbacks[e]=n.filter(i=>i!==r):delete this.callbacks[e]),this}once(e,r){const n=(...i)=>{this.off(e,n),r.apply(this,i)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}}function he(t,e,r){return t.config[e]===void 0&&t.parent?he(t.parent,e,r):typeof t.config[e]=="function"?t.config[e].bind({...r,parent:t.parent?he(t.parent,e,r):null}):t.config[e]}function Jh(t){const e=t.filter(i=>i.type==="extension"),r=t.filter(i=>i.type==="node"),n=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:r,markExtensions:n}}function _$(t){const e=[],{nodeExtensions:r,markExtensions:n}=Jh(t),i=[...r,...n],a={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const s={name:o.name,options:o.options,storage:o.storage,extensions:i},l=he(o,"addGlobalAttributes",s);if(!l)return;l().forEach(d=>{d.types.forEach(f=>{Object.entries(d.attributes).forEach(([h,p])=>{e.push({type:f,name:h,attribute:{...a,...p}})})})})}),i.forEach(o=>{const s={name:o.name,options:o.options,storage:o.storage},l=he(o,"addAttributes",s);if(!l)return;const u=l();Object.entries(u).forEach(([d,f])=>{const h={...a,...f};typeof h?.default=="function"&&(h.default=h.default()),h?.isRequired&&h?.default===void 0&&delete h.default,e.push({type:o.name,name:d,attribute:h})})}),e}function Yt(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function Ft(...t){return t.filter(e=>!!e).reduce((e,r)=>{const n={...e};return Object.entries(r).forEach(([i,a])=>{if(!n[i]){n[i]=a;return}if(i==="class"){const s=a?String(a).split(" "):[],l=n[i]?n[i].split(" "):[],u=s.filter(d=>!l.includes(d));n[i]=[...l,...u].join(" ")}else if(i==="style"){const s=a?a.split(";").map(d=>d.trim()).filter(Boolean):[],l=n[i]?n[i].split(";").map(d=>d.trim()).filter(Boolean):[],u=new Map;l.forEach(d=>{const[f,h]=d.split(":").map(p=>p.trim());u.set(f,h)}),s.forEach(d=>{const[f,h]=d.split(":").map(p=>p.trim());u.set(f,h)}),n[i]=Array.from(u.entries()).map(([d,f])=>`${d}: ${f}`).join("; ")}else n[i]=a}),n},{})}function Xb(t,e){return e.filter(r=>r.type===t.type.name).filter(r=>r.attribute.rendered).map(r=>r.attribute.renderHTML?r.attribute.renderHTML(t.attrs)||{}:{[r.name]:t.attrs[r.name]}).reduce((r,n)=>Ft(r,n),{})}function S$(t){return typeof t=="function"}function Ie(t,e=void 0,...r){return S$(t)?e?t.bind(e)(...r):t(...r):t}function zie(t={}){return Object.keys(t).length===0&&t.constructor===Object}function qie(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function HA(t,e){return"style"in t?t:{...t,getAttrs:r=>{const n=t.getAttrs?t.getAttrs(r):t.attrs;if(n===!1)return!1;const i=e.reduce((a,o)=>{const s=o.attribute.parseHTML?o.attribute.parseHTML(r):qie(r.getAttribute(o.name));return s==null?a:{...a,[o.name]:s}},{});return{...n,...i}}}}function WA(t){return Object.fromEntries(Object.entries(t).filter(([e,r])=>e==="attrs"&&zie(r)?!1:r!=null))}function Uie(t,e){var r;const n=_$(t),{nodeExtensions:i,markExtensions:a}=Jh(t),o=(r=i.find(u=>he(u,"topNode")))===null||r===void 0?void 0:r.name,s=Object.fromEntries(i.map(u=>{const d=n.filter(y=>y.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},h=t.reduce((y,w)=>{const _=he(w,"extendNodeSchema",f);return{...y,..._?_(u):{}}},{}),p=WA({...h,content:Ie(he(u,"content",f)),marks:Ie(he(u,"marks",f)),group:Ie(he(u,"group",f)),inline:Ie(he(u,"inline",f)),atom:Ie(he(u,"atom",f)),selectable:Ie(he(u,"selectable",f)),draggable:Ie(he(u,"draggable",f)),code:Ie(he(u,"code",f)),whitespace:Ie(he(u,"whitespace",f)),linebreakReplacement:Ie(he(u,"linebreakReplacement",f)),defining:Ie(he(u,"defining",f)),isolating:Ie(he(u,"isolating",f)),attrs:Object.fromEntries(d.map(y=>{var w;return[y.name,{default:(w=y?.attribute)===null||w===void 0?void 0:w.default}]}))}),m=Ie(he(u,"parseHTML",f));m&&(p.parseDOM=m.map(y=>HA(y,d)));const g=he(u,"renderHTML",f);g&&(p.toDOM=y=>g({node:y,HTMLAttributes:Xb(y,d)}));const v=he(u,"renderText",f);return v&&(p.toText=v),[u.name,p]})),l=Object.fromEntries(a.map(u=>{const d=n.filter(v=>v.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},h=t.reduce((v,y)=>{const w=he(y,"extendMarkSchema",f);return{...v,...w?w(u):{}}},{}),p=WA({...h,inclusive:Ie(he(u,"inclusive",f)),excludes:Ie(he(u,"excludes",f)),group:Ie(he(u,"group",f)),spanning:Ie(he(u,"spanning",f)),code:Ie(he(u,"code",f)),attrs:Object.fromEntries(d.map(v=>{var y;return[v.name,{default:(y=v?.attribute)===null||y===void 0?void 0:y.default}]}))}),m=Ie(he(u,"parseHTML",f));m&&(p.parseDOM=m.map(v=>HA(v,d)));const g=he(u,"renderHTML",f);return g&&(p.toDOM=v=>g({mark:v,HTMLAttributes:Xb(v,d)})),[u.name,p]}));return new cI({topNode:o,nodes:s,marks:l})}function Ly(t,e){return e.nodes[t]||e.marks[t]||null}function VA(t,e){return Array.isArray(e)?e.some(r=>(typeof r=="string"?r:r.name)===t.name):e}function h1(t,e){const r=co.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(r),i.innerHTML}const Hie=(t,e=500)=>{let r="";const n=t.parentOffset;return t.parent.nodesBetween(Math.max(0,n-e),n,(i,a,o,s)=>{var l,u;const d=((u=(l=i.type.spec).toText)===null||u===void 0?void 0:u.call(l,{node:i,pos:a,parent:o,index:s}))||i.textContent||"%leaf%";r+=i.isAtom&&!i.isText?d:d.slice(0,Math.max(0,n-a))}),r};function p1(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Zh{constructor(e){this.find=e.find,this.handler=e.handler}}const Wie=(t,e)=>{if(p1(e))return e.exec(t);const r=e(t);if(!r)return null;const n=[r.text];return n.index=r.index,n.input=t,n.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(r.replaceWith)),n};function vu(t){var e;const{editor:r,from:n,to:i,text:a,rules:o,plugin:s}=t,{view:l}=r;if(l.composing)return!1;const u=l.state.doc.resolve(n);if(u.parent.type.spec.code||!((e=u.nodeBefore||u.nodeAfter)===null||e===void 0)&&e.marks.find(h=>h.type.spec.code))return!1;let d=!1;const f=Hie(u)+a;return o.forEach(h=>{if(d)return;const p=Wie(f,h.find);if(!p)return;const m=l.state.tr,g=Yh({state:l.state,transaction:m}),v={from:n-(p[0].length-a.length),to:i},{commands:y,chain:w,can:_}=new Xh({editor:r,state:g});h.handler({state:g,range:v,match:p,commands:y,chain:w,can:_})===null||!m.steps.length||(m.setMeta(s,{transform:m,from:n,to:i,text:a}),l.dispatch(m),d=!0)}),d}function Vie(t){const{editor:e,rules:r}=t,n=new Jt({state:{init(){return null},apply(i,a,o){const s=i.getMeta(n);if(s)return s;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:d}=l;typeof d=="string"?d=d:d=h1(J.from(d),o.schema);const{from:f}=l,h=f+d.length;vu({editor:e,from:f,to:h,text:d,rules:r,plugin:n})}),i.selectionSet||i.docChanged?null:a}},props:{handleTextInput(i,a,o,s){return vu({editor:e,from:a,to:o,text:s,rules:r,plugin:n})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:a}=i.state.selection;a&&vu({editor:e,from:a.pos,to:a.pos,text:"",rules:r,plugin:n})}),!1)},handleKeyDown(i,a){if(a.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?vu({editor:e,from:o.pos,to:o.pos,text:` 87`,rules:r,plugin:n}):!1}},isInputRules:!0});return n}function Kie(t){return Object.prototype.toString.call(t).slice(8,-1)}function yu(t){return Kie(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Qh(t,e){const r={...t};return yu(t)&&yu(e)&&Object.keys(e).forEach(n=>{yu(e[n])&&yu(t[n])?r[n]=Qh(t[n],e[n]):r[n]=e[n]}),r}class Si{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Ie(he(this,"addOptions",{name:this.name}))),this.storage=Ie(he(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Si(e)}configure(e={}){const r=this.extend({...this.config,addOptions:()=>Qh(this.options,e)});return r.name=this.name,r.parent=this.parent,r}extend(e={}){const r=new Si(e);return r.parent=this,this.child=r,r.name=e.name?e.name:r.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${r.name}".`),r.options=Ie(he(r,"addOptions",{name:r.name})),r.storage=Ie(he(r,"addStorage",{name:r.name,options:r.options})),r}static handleExit({editor:e,mark:r}){const{tr:n}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(u=>u?.type.name===r.name))return!1;const l=o.find(u=>u?.type.name===r.name);return l&&n.removeStoredMark(l),n.insertText(" ",i.pos),e.view.dispatch(n),!0}return!1}}function Gie(t){return typeof t=="number"}class j${constructor(e){this.find=e.find,this.handler=e.handler}}const Yie=(t,e,r)=>{if(p1(e))return[...t.matchAll(e)];const n=e(t,r);return n?n.map(i=>{const a=[i.text];return a.index=i.index,a.input=t,a.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),a.push(i.replaceWith)),a}):[]};function Xie(t){const{editor:e,state:r,from:n,to:i,rule:a,pasteEvent:o,dropEvent:s}=t,{commands:l,chain:u,can:d}=new Xh({editor:e,state:r}),f=[];return r.doc.nodesBetween(n,i,(p,m)=>{if(!p.isTextblock||p.type.spec.code)return;const g=Math.max(n,m),v=Math.min(i,m+p.content.size),y=p.textBetween(g-m,v-m,void 0,"");Yie(y,a.find,o).forEach(_=>{if(_.index===void 0)return;const j=g+_.index+1,b=j+_[0].length,O={from:r.tr.mapping.map(j),to:r.tr.mapping.map(b)},S=a.handler({state:r,range:O,match:_,commands:l,chain:u,can:d,pasteEvent:o,dropEvent:s});f.push(S)})}),f.every(p=>p!==null)}let xu=null;const Jie=t=>{var e;const r=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=r.clipboardData)===null||e===void 0||e.setData("text/html",t),r};function Zie(t){const{editor:e,rules:r}=t;let n=null,i=!1,a=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,s;try{s=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{s=null}const l=({state:d,from:f,to:h,rule:p,pasteEvt:m})=>{const g=d.tr,v=Yh({state:d,transaction:g});if(!(!Xie({editor:e,state:v,from:Math.max(f-1,0),to:h.b-1,rule:p,pasteEvent:m,dropEvent:s})||!g.steps.length)){try{s=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{s=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return r.map(d=>new Jt({view(f){const h=m=>{var g;n=!((g=f.dom.parentElement)===null||g===void 0)&&g.contains(m.target)?f.dom.parentElement:null,n&&(xu=e)},p=()=>{xu&&(xu=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(f,h)=>{if(a=n===f.dom.parentElement,s=h,!a){const p=xu;p&&setTimeout(()=>{const m=p.state.selection;m&&p.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,h)=>{var p;const m=(p=h.clipboardData)===null||p===void 0?void 0:p.getData("text/html");return o=h,i=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(f,h,p)=>{const m=f[0],g=m.getMeta("uiEvent")==="paste"&&!i,v=m.getMeta("uiEvent")==="drop"&&!a,y=m.getMeta("applyPasteRules"),w=!!y;if(!g&&!v&&!w)return;if(w){let{text:b}=y;typeof b=="string"?b=b:b=h1(J.from(b),p.schema);const{from:O}=y,S=O+b.length,N=Jie(b);return l({rule:d,state:p,from:O,to:{b:S},pasteEvt:N})}const _=h.doc.content.findDiffStart(p.doc.content),j=h.doc.content.findDiffEnd(p.doc.content);if(!(!Gie(_)||!j||_===j.b))return l({rule:d,state:p,from:_,to:j,pasteEvt:o})}}))}function Qie(t){const e=t.filter((r,n)=>t.indexOf(r)!==n);return Array.from(new Set(e))}class Ro{constructor(e,r){this.splittableMarks=[],this.editor=r,this.extensions=Ro.resolve(e),this.schema=Uie(this.extensions,r),this.setupExtensions()}static resolve(e){const r=Ro.sort(Ro.flatten(e)),n=Qie(r.map(i=>i.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),r}static flatten(e){return e.map(r=>{const n={name:r.name,options:r.options,storage:r.storage},i=he(r,"addExtensions",n);return i?[r,...this.flatten(i())]:r}).flat(10)}static sort(e){return e.sort((n,i)=>{const a=he(n,"priority")||100,o=he(i,"priority")||100;return a>o?-1:a<o?1:0})}get commands(){return this.extensions.reduce((e,r)=>{const n={name:r.name,options:r.options,storage:r.storage,editor:this.editor,type:Ly(r.name,this.schema)},i=he(r,"addCommands",n);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,r=Ro.sort([...this.extensions].reverse()),n=[],i=[],a=r.map(o=>{const s={name:o.name,options:o.options,storage:o.storage,editor:e,type:Ly(o.name,this.schema)},l=[],u=he(o,"addKeyboardShortcuts",s);let d={};if(o.type==="mark"&&he(o,"exitable",s)&&(d.ArrowRight=()=>Si.handleExit({editor:e,mark:o})),u){const g=Object.fromEntries(Object.entries(u()).map(([v,y])=>[v,()=>y({editor:e})]));d={...d,...g}}const f=xie(d);l.push(f);const h=he(o,"addInputRules",s);VA(o,e.options.enableInputRules)&&h&&n.push(...h());const p=he(o,"addPasteRules",s);VA(o,e.options.enablePasteRules)&&p&&i.push(...p());const m=he(o,"addProseMirrorPlugins",s);if(m){const g=m();l.push(...g)}return l}).flat();return[Vie({editor:e,rules:n}),...Zie({editor:e,rules:i}),...a]}get attributes(){return _$(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:r}=Jh(this.extensions);return Object.fromEntries(r.filter(n=>!!he(n,"addNodeView")).map(n=>{const i=this.attributes.filter(l=>l.type===n.name),a={name:n.name,options:n.options,storage:n.storage,editor:e,type:Yt(n.name,this.schema)},o=he(n,"addNodeView",a);if(!o)return[];const s=(l,u,d,f,h)=>{const p=Xb(l,i);return o()({node:l,view:u,getPos:d,decorations:f,innerDecorations:h,editor:e,extension:n,HTMLAttributes:p})};return[n.name,s]}))}setupExtensions(){this.extensions.forEach(e=>{var r;this.editor.extensionStorage[e.name]=e.storage;const n={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Ly(e.name,this.schema)};e.type==="mark"&&(!((r=Ie(he(e,"keepOnSplit",n)))!==null&&r!==void 0)||r)&&this.splittableMarks.push(e.name);const i=he(e,"onBeforeCreate",n),a=he(e,"onCreate",n),o=he(e,"onUpdate",n),s=he(e,"onSelectionUpdate",n),l=he(e,"onTransaction",n),u=he(e,"onFocus",n),d=he(e,"onBlur",n),f=he(e,"onDestroy",n);i&&this.editor.on("beforeCreate",i),a&&this.editor.on("create",a),o&&this.editor.on("update",o),s&&this.editor.on("selectionUpdate",s),l&&this.editor.on("transaction",l),u&&this.editor.on("focus",u),d&&this.editor.on("blur",d),f&&this.editor.on("destroy",f)})}}class dr{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Ie(he(this,"addOptions",{name:this.name}))),this.storage=Ie(he(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new dr(e)}configure(e={}){const r=this.extend({...this.config,addOptions:()=>Qh(this.options,e)});return r.name=this.name,r.parent=this.parent,r}extend(e={}){const r=new dr({...this.config,...e});return r.parent=this,this.child=r,r.name=e.name?e.name:r.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${r.name}".`),r.options=Ie(he(r,"addOptions",{name:r.name})),r.storage=Ie(he(r,"addStorage",{name:r.name,options:r.options})),r}}function O$(t,e,r){const{from:n,to:i}=e,{blockSeparator:a=` 88
89`,textSerializers:o={}}=r||{};let s="";return t.nodesBetween(n,i,(l,u,d,f)=>{var h;l.isBlock&&u>n&&(s+=a);const p=o?.[l.type.name];if(p)return d&&(s+=p({node:l,pos:u,parent:d,index:f,range:e})),!1;l.isText&&(s+=(h=l?.text)===null||h===void 0?void 0:h.slice(Math.max(n,u)-u,i-u))}),s}function N$(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,r])=>[e,r.spec.toText]))}const eae=dr.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Jt({key:new Dr("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:r}=t,{doc:n,selection:i}=e,{ranges:a}=i,o=Math.min(...a.map(d=>d.$from.pos)),s=Math.max(...a.map(d=>d.$to.pos)),l=N$(r);return O$(n,{from:o,to:s},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),tae=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var r;t.isDestroyed||(e.dom.blur(),(r=window?.getSelection())===null||r===void 0||r.removeAllRanges())}),!0),rae=(t=!1)=>({commands:e})=>e.setContent("",t),nae=()=>({state:t,tr:e,dispatch:r})=>{const{selection:n}=e,{ranges:i}=n;return r&&i.forEach(({$from:a,$to:o})=>{t.doc.nodesBetween(a.pos,o.pos,(s,l)=>{if(s.type.isText)return;const{doc:u,mapping:d}=e,f=u.resolve(d.map(l)),h=u.resolve(d.map(l+s.nodeSize)),p=f.blockRange(h);if(!p)return;const m=zs(p);if(s.type.isTextblock){const{defaultType:g}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(p.start,g)}(m||m===0)&&e.lift(p,m)})}),!0},iae=t=>e=>t(e),aae=()=>({state:t,dispatch:e})=>y$(t,e),oae=(t,e)=>({editor:r,tr:n})=>{const{state:i}=r,a=i.doc.slice(t.from,t.to);n.deleteRange(t.from,t.to);const o=n.mapping.map(e);return n.insert(o,a.content),n.setSelection(new Pe(n.doc.resolve(o-1))),!0},sae=()=>({tr:t,dispatch:e})=>{const{selection:r}=t,n=r.$anchor.node();if(n.content.size>0)return!1;const i=t.selection.$anchor;for(let a=i.depth;a>0;a-=1)if(i.node(a).type===n.type){if(e){const s=i.before(a),l=i.after(a);t.delete(s,l).scrollIntoView()}return!0}return!1},lae=t=>({tr:e,state:r,dispatch:n})=>{const i=Yt(t,r.schema),a=e.selection.$anchor;for(let o=a.depth;o>0;o-=1)if(a.node(o).type===i){if(n){const l=a.before(o),u=a.after(o);e.delete(l,u).scrollIntoView()}return!0}return!1},cae=t=>({tr:e,dispatch:r})=>{const{from:n,to:i}=t;return r&&e.delete(n,i),!0},uae=()=>({state:t,dispatch:e})=>l1(t,e),dae=()=>({commands:t})=>t.keyboardShortcut("Enter"),fae=()=>({state:t,dispatch:e})=>Oie(t,e);function mf(t,e,r={strict:!0}){const n=Object.keys(e);return n.length?n.every(i=>r.strict?e[i]===t[i]:p1(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function C$(t,e,r={}){return t.find(n=>n.type===e&&mf(Object.fromEntries(Object.keys(r).map(i=>[i,n.attrs[i]])),r))}function KA(t,e,r={}){return!!C$(t,e,r)}function m1(t,e,r){var n;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(d=>d.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(d=>d.type===e)||(r=r||((n=i.node.marks[0])===null||n===void 0?void 0:n.attrs),!C$([...i.node.marks],e,r)))return;let o=i.index,s=t.start()+i.offset,l=o+1,u=s+i.node.nodeSize;for(;o>0&&KA([...t.parent.child(o-1).marks],e,r);)o-=1,s-=t.parent.child(o).nodeSize;for(;l<t.parent.childCount&&KA([...t.parent.child(l).marks],e,r);)u+=t.parent.child(l).nodeSize,l+=1;return{from:s,to:u}}function la(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const hae=(t,e={})=>({tr:r,state:n,dispatch:i})=>{const a=la(t,n.schema),{doc:o,selection:s}=r,{$from:l,from:u,to:d}=s;if(i){const f=m1(l,a,e);if(f&&f.from<=u&&f.to>=d){const h=Pe.create(o,f.from,f.to);r.setSelection(h)}}return!0},pae=t=>e=>{const r=typeof t=="function"?t(e):t;for(let n=0;n<r.length;n+=1)if(r[n](e))return!0;return!1};function k$(t){return t instanceof Pe}function Pa(t=0,e=0,r=0){return Math.min(Math.max(t,e),r)}function A$(t,e=null){if(!e)return null;const r=Fe.atStart(t),n=Fe.atEnd(t);if(e==="start"||e===!0)return r;if(e==="end")return n;const i=r.from,a=n.to;return e==="all"?Pe.create(t,Pa(0,i,a),Pa(t.content.size,i,a)):Pe.create(t,Pa(e,i,a),Pa(e,i,a))}function mae(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function g1(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const gae=(t=null,e={})=>({editor:r,view:n,tr:i,dispatch:a})=>{e={scrollIntoView:!0,...e};const o=()=>{(g1()||mae())&&n.dom.focus(),requestAnimationFrame(()=>{r.isDestroyed||(n.focus(),e?.scrollIntoView&&r.commands.scrollIntoView())})};if(n.hasFocus()&&t===null||t===!1)return!0;
vendor: 36,417 bytes, lines 89-165
89if(a&&t===null&&!k$(r.state.selection))return o(),!0;const s=A$(i.doc,t)||r.state.selection,l=r.state.selection.eq(s);return a&&(l||i.setSelection(s),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},vae=(t,e)=>r=>t.every((n,i)=>e(n,{...r,index:i})),yae=(t,e)=>({tr:r,commands:n})=>n.insertContentAt({from:r.selection.from,to:r.selection.to},t,e),E$=t=>{const e=t.childNodes;for(let r=e.length-1;r>=0;r-=1){const n=e[r];n.nodeType===3&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?t.removeChild(n):n.nodeType===1&&E$(n)}return t};function bu(t){const e=`<body>${t}</body>`,r=new window.DOMParser().parseFromString(e,"text/html").body;return E$(r)}function gf(t,e,r){if(t instanceof Wi||t instanceof J)return t;r={slice:!0,parseOptions:{},...r};const n=typeof t=="object"&&t!==null,i=typeof t=="string";if(n)try{if(Array.isArray(t)&&t.length>0)return J.fromArray(t.map(s=>e.nodeFromJSON(s)));const o=e.nodeFromJSON(t);return r.errorOnInvalidContent&&o.check(),o}catch(a){if(r.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:a});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",a),gf("",e,r)}if(i){if(r.errorOnInvalidContent){let o=!1,s="";const l=new cI({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(o=!0,s=typeof u=="string"?u:u.outerHTML,null)}]}})});if(r.slice?Vi.fromSchema(l).parseSlice(bu(t),r.parseOptions):Vi.fromSchema(l).parse(bu(t),r.parseOptions),r.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${s}`)})}const a=Vi.fromSchema(e);return r.slice?a.parseSlice(bu(t),r.parseOptions).content:a.parse(bu(t),r.parseOptions)}return gf("",e,r)}function xae(t,e,r){const n=t.steps.length-1;if(n<e)return;const i=t.steps[n];if(!(i instanceof At||i instanceof Kt))return;const a=t.mapping.maps[n];let o=0;a.forEach((s,l,u,d)=>{o===0&&(o=d)}),t.setSelection(Fe.near(t.doc.resolve(o),r))}const bae=t=>!("type"in t),wae=(t,e,r)=>({tr:n,dispatch:i,editor:a})=>{var o;if(i){r={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...r};let s;try{s=gf(e,a.schema,{parseOptions:{preserveWhitespace:"full",...r.parseOptions},errorOnInvalidContent:(o=r.errorOnInvalidContent)!==null&&o!==void 0?o:a.options.enableContentCheck})}catch(m){return a.emit("contentError",{editor:a,error:m,disableCollaboration:()=>{a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}}),!1}let{from:l,to:u}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},d=!0,f=!0;if((bae(s)?s:[s]).forEach(m=>{m.check(),d=d?m.isText&&m.marks.length===0:!1,f=f?m.isBlock:!1}),l===u&&f){const{parent:m}=n.doc.resolve(l);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(l-=1,u+=1)}let p;if(d){if(Array.isArray(e))p=e.map(m=>m.text||"").join("");else if(e instanceof J){let m="";e.forEach(g=>{g.text&&(m+=g.text)}),p=m}else typeof e=="object"&&e&&e.text?p=e.text:p=e;n.insertText(p,l,u)}else p=s,n.replaceWith(l,u,p);r.updateSelection&&xae(n,n.steps.length-1,-1),r.applyInputRules&&n.setMeta("applyInputRules",{from:l,text:p}),r.applyPasteRules&&n.setMeta("applyPasteRules",{from:l,text:p})}return!0},_ae=()=>({state:t,dispatch:e})=>_ie(t,e),Sae=()=>({state:t,dispatch:e})=>Sie(t,e),jae=()=>({state:t,dispatch:e})=>d$(t,e),Oae=()=>({state:t,dispatch:e})=>m$(t,e),Nae=()=>({state:t,dispatch:e,tr:r})=>{try{const n=Uh(t.doc,t.selection.$from.pos,-1);return n==null?!1:(r.join(n,2),e&&e(r),!0)}catch{return!1}},Cae=()=>({state:t,dispatch:e,tr:r})=>{try{const n=Uh(t.doc,t.selection.$from.pos,1);return n==null?!1:(r.join(n,2),e&&e(r),!0)}catch{return!1}},kae=()=>({state:t,dispatch:e})=>bie(t,e),Aae=()=>({state:t,dispatch:e})=>wie(t,e);function P$(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Eae(t){const e=t.split(/-(?!$)/);let r=e[e.length-1];r==="Space"&&(r=" ");let n,i,a,o;for(let s=0;s<e.length-1;s+=1){const l=e[s];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))a=!0;else if(/^mod$/i.test(l))g1()||P$()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return n&&(r=`Alt-${r}`),i&&(r=`Ctrl-${r}`),o&&(r=`Meta-${r}`),a&&(r=`Shift-${r}`),r}const Pae=t=>({editor:e,view:r,tr:n,dispatch:i})=>{const a=Eae(t).split(/-(?!$)/),o=a.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),s=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{r.someProp("handleKeyDown",u=>u(r,s))});return l?.steps.forEach(u=>{const d=u.map(n.mapping);d&&i&&n.maybeStep(d)}),!0};function wc(t,e,r={}){const{from:n,to:i,empty:a}=t.selection,o=e?Yt(e,t.schema):null,s=[];t.doc.nodesBetween(n,i,(f,h)=>{if(f.isText)return;const p=Math.max(n,h),m=Math.min(i,h+f.nodeSize);s.push({node:f,from:p,to:m})});const l=i-n,u=s.filter(f=>o?o.name===f.node.type.name:!0).filter(f=>mf(f.node.attrs,r,{strict:!1}));return a?!!u.length:u.reduce((f,h)=>f+h.to-h.from,0)>=l}const Tae=(t,e={})=>({state:r,dispatch:n})=>{const i=Yt(t,r.schema);return wc(r,i,e)?jie(r,n):!1},Mae=()=>({state:t,dispatch:e})=>x$(t,e),Dae=t=>({state:e,dispatch:r})=>{const n=Yt(t,e.schema);return Iie(n)(e,r)},Rae=()=>({state:t,dispatch:e})=>v$(t,e);function ep(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function GA(t,e){const r=typeof e=="string"?[e]:e;return Object.keys(t).reduce((n,i)=>(r.includes(i)||(n[i]=t[i]),n),{})}const Iae=(t,e)=>({tr:r,state:n,dispatch:i})=>{let a=null,o=null;const s=ep(typeof t=="string"?t:t.name,n.schema);return s?(s==="node"&&(a=Yt(t,n.schema)),s==="mark"&&(o=la(t,n.schema)),i&&r.selection.ranges.forEach(l=>{n.doc.nodesBetween(l.$from.pos,l.$to.pos,(u,d)=>{a&&a===u.type&&r.setNodeMarkup(d,void 0,GA(u.attrs,e)),o&&u.marks.length&&u.marks.forEach(f=>{o===f.type&&r.addMark(d,d+u.nodeSize,o.create(GA(f.attrs,e)))})})}),!0):!1},$ae=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Lae=()=>({tr:t,dispatch:e})=>{if(e){const r=new Wr(t.doc);t.setSelection(r)}return!0},Bae=()=>({state:t,dispatch:e})=>h$(t,e),Fae=()=>({state:t,dispatch:e})=>g$(t,e),zae=()=>({state:t,dispatch:e})=>kie(t,e),qae=()=>({state:t,dispatch:e})=>Pie(t,e),Uae=()=>({state:t,dispatch:e})=>Eie(t,e);function Jb(t,e,r={},n={}){return gf(t,e,{slice:!1,parseOptions:r,errorOnInvalidContent:n.errorOnInvalidContent})}const Hae=(t,e=!1,r={},n={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{var l,u;const{doc:d}=a;if(r.preserveWhitespace!=="full"){const f=Jb(t,i.schema,r,{errorOnInvalidContent:(l=n.errorOnInvalidContent)!==null&&l!==void 0?l:i.options.enableContentCheck});return o&&a.replaceWith(0,d.content.size,f).setMeta("preventUpdate",!e),!0}return o&&a.setMeta("preventUpdate",!e),s.insertContentAt({from:0,to:d.content.size},t,{parseOptions:r,errorOnInvalidContent:(u=n.errorOnInvalidContent)!==null&&u!==void 0?u:i.options.enableContentCheck})};function T$(t,e){const r=la(e,t.schema),{from:n,to:i,empty:a}=t.selection,o=[];a?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(n,i,l=>{o.push(...l.marks)});const s=o.find(l=>l.type.name===r.name);return s?{...s.attrs}:{}}function Wae(t,e){const r=new OI(t);return e.forEach(n=>{n.steps.forEach(i=>{r.step(i)})}),r}function Vae(t){for(let e=0;e<t.edgeCount;e+=1){const{type:r}=t.edge(e);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}function Kae(t,e,r){const n=[];return t.nodesBetween(e.from,e.to,(i,a)=>{r(i)&&n.push({node:i,pos:a})}),n}function Gae(t,e){for(let r=t.depth;r>0;r-=1){const n=t.node(r);if(e(n))return{pos:r>0?t.before(r):0,start:t.start(r),depth:r,node:n}}}function v1(t){return e=>Gae(e.$from,t)}function Yae(t,e){const r={from:0,to:t.content.size};return O$(t,r,e)}function Xae(t,e){const r=Yt(e,t.schema),{from:n,to:i}=t.selection,a=[];t.doc.nodesBetween(n,i,s=>{a.push(s)});const o=a.reverse().find(s=>s.type.name===r.name);return o?{...o.attrs}:{}}function M$(t,e){const r=ep(typeof e=="string"?e:e.name,t.schema);return r==="node"?Xae(t,e):r==="mark"?T$(t,e):{}}function Jae(t,e=JSON.stringify){const r={};return t.filter(n=>{const i=e(n);return Object.prototype.hasOwnProperty.call(r,i)?!1:r[i]=!0})}function Zae(t){const e=Jae(t);return e.length===1?e:e.filter((r,n)=>!e.filter((a,o)=>o!==n).some(a=>r.oldRange.from>=a.oldRange.from&&r.oldRange.to<=a.oldRange.to&&r.newRange.from>=a.newRange.from&&r.newRange.to<=a.newRange.to))}function Qae(t){const{mapping:e,steps:r}=t,n=[];return e.maps.forEach((i,a)=>{const o=[];if(i.ranges.length)i.forEach((s,l)=>{o.push({from:s,to:l})});else{const{from:s,to:l}=r[a];if(s===void 0||l===void 0)return;o.push({from:s,to:l})}o.forEach(({from:s,to:l})=>{const u=e.slice(a).map(s,-1),d=e.slice(a).map(l),f=e.invert().map(u,-1),h=e.invert().map(d);n.push({oldRange:{from:f,to:h},newRange:{from:u,to:d}})})}),Zae(n)}function y1(t,e,r){const n=[];return t===e?r.resolve(t).marks().forEach(i=>{const a=r.resolve(t),o=m1(a,i.type);o&&n.push({mark:i,...o})}):r.nodesBetween(t,e,(i,a)=>{!i||i?.nodeSize===void 0||n.push(...i.marks.map(o=>({from:a,to:a+i.nodeSize,mark:o})))}),n}function Ru(t,e,r){return Object.fromEntries(Object.entries(r).filter(([n])=>{const i=t.find(a=>a.type===e&&a.name===n);return i?i.attribute.keepOnSplit:!1}))}function Zb(t,e,r={}){const{empty:n,ranges:i}=t.selection,a=e?la(e,t.schema):null;if(n)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>a?a.name===f.type.name:!0).find(f=>mf(f.attrs,r,{strict:!1}));let o=0;const s=[];if(i.forEach(({$from:f,$to:h})=>{const p=f.pos,m=h.pos;t.doc.nodesBetween(p,m,(g,v)=>{if(!g.isText&&!g.marks.length)return;const y=Math.max(p,v),w=Math.min(m,v+g.nodeSize),_=w-y;o+=_,s.push(...g.marks.map(j=>({mark:j,from:y,to:w})))})}),o===0)return!1;const l=s.filter(f=>a?a.name===f.mark.type.name:!0).filter(f=>mf(f.mark.attrs,r,{strict:!1})).reduce((f,h)=>f+h.to-h.from,0),u=s.filter(f=>a?f.mark.type!==a&&f.mark.type.excludes(a):!0).reduce((f,h)=>f+h.to-h.from,0);return(l>0?l+u:l)>=o}function eoe(t,e,r={}){if(!e)return wc(t,null,r)||Zb(t,null,r);const n=ep(e,t.schema);return n==="node"?wc(t,e,r):n==="mark"?Zb(t,e,r):!1}function YA(t,e){const{nodeExtensions:r}=Jh(e),n=r.find(o=>o.name===t);if(!n)return!1;const i={name:n.name,options:n.options,storage:n.storage},a=Ie(he(n,"group",i));return typeof a!="string"?!1:a.split(" ").includes("list")}function tp(t,{checkChildren:e=!0,ignoreWhitespace:r=!1}={}){var n;if(r){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((n=t.text)!==null&&n!==void 0?n:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(a=>{i!==!1&&(tp(a,{ignoreWhitespace:r,checkChildren:e})||(i=!1))}),i}return!1}function toe(t){return t instanceof we}function roe(t,e,r){var n;const{selection:i}=e;let a=null;if(k$(i)&&(a=i.$cursor),a){const s=(n=t.storedMarks)!==null&&n!==void 0?n:a.marks();return!!r.isInSet(s)||!s.some(l=>l.type.excludes(r))}const{ranges:o}=i;return o.some(({$from:s,$to:l})=>{let u=s.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(r):!1;return t.doc.nodesBetween(s.pos,l.pos,(d,f,h)=>{if(u)return!1;if(d.isInline){const p=!h||h.type.allowsMarkType(r),m=!!r.isInSet(d.marks)||!d.marks.some(g=>g.type.excludes(r));u=p&&m}return!u}),u})}const noe=(t,e={})=>({tr:r,state:n,dispatch:i})=>{const{selection:a}=r,{empty:o,ranges:s}=a,l=la(t,n.schema);if(i)if(o){const u=T$(n,l);r.addStoredMark(l.create({...u,...e}))}else s.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;n.doc.nodesBetween(d,f,(h,p)=>{const m=Math.max(p,d),g=Math.min(p+h.nodeSize,f);h.marks.find(y=>y.type===l)?h.marks.forEach(y=>{l===y.type&&r.addMark(m,g,l.create({...y.attrs,...e}))}):r.addMark(m,g,l.create(e))})});return roe(n,r,l)},ioe=(t,e)=>({tr:r})=>(r.setMeta(t,e),!0),aoe=(t,e={})=>({state:r,dispatch:n,chain:i})=>{const a=Yt(t,r.schema);let o;return r.selection.$anchor.sameParent(r.selection.$head)&&(o=r.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:s})=>UA(a,{...o,...e})(r)?!0:s.clearNodes()).command(({state:s})=>UA(a,{...o,...e})(s,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},ooe=t=>({tr:e,dispatch:r})=>{if(r){const{doc:n}=e,i=Pa(t,0,n.content.size),a=we.create(n,i);e.setSelection(a)}return!0},soe=t=>({tr:e,dispatch:r})=>{if(r){const{doc:n}=e,{from:i,to:a}=typeof t=="number"?{from:t,to:t}:t,o=Pe.atStart(n).from,s=Pe.atEnd(n).to,l=Pa(i,o,s),u=Pa(a,o,s),d=Pe.create(n,l,u);e.setSelection(d)}return!0},loe=t=>({state:e,dispatch:r})=>{const n=Yt(t,e.schema);return Bie(n)(e,r)};function XA(t,e){const r=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(r){const n=r.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(n)}}const coe=({keepMarks:t=!0}={})=>({tr:e,state:r,dispatch:n,editor:i})=>{const{selection:a,doc:o}=e,{$from:s,$to:l}=a,u=i.extensionManager.attributes,d=Ru(u,s.node().type.name,s.node().attrs);if(a instanceof we&&a.node.isBlock)return!s.parentOffset||!vi(o,s.pos)?!1:(n&&(t&&XA(r,i.extensionManager.splittableMarks),e.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;const f=l.parentOffset===l.parent.content.size,h=s.depth===0?void 0:Vae(s.node(-1).contentMatchAt(s.indexAfter(-1)));let p=f&&h?[{type:h,attrs:d}]:void 0,m=vi(e.doc,e.mapping.map(s.pos),1,p);if(!p&&!m&&vi(e.doc,e.mapping.map(s.pos),1,h?[{type:h}]:void 0)&&(m=!0,p=h?[{type:h,attrs:d}]:void 0),n){if(m&&(a instanceof Pe&&e.deleteSelection(),e.split(e.mapping.map(s.pos),1,p),h&&!f&&!s.parentOffset&&s.parent.type!==h)){const g=e.mapping.map(s.before()),v=e.doc.resolve(g);s.node(-1).canReplaceWith(v.index(),v.index()+1,h)&&e.setNodeMarkup(e.mapping.map(s.before()),h)}t&&XA(r,i.extensionManager.splittableMarks),e.scrollIntoView()}return m},uoe=(t,e={})=>({tr:r,state:n,dispatch:i,editor:a})=>{var o;const s=Yt(t,n.schema),{$from:l,$to:u}=n.selection,d=n.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(u))return!1;const f=l.node(-1);if(f.type!==s)return!1;const h=a.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==s||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let y=J.empty;const w=l.index(-1)?1:l.index(-2)?2:3;for(let N=l.depth-w;N>=l.depth-3;N-=1)y=J.from(l.node(N).copy(y));const _=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,j={...Ru(h,l.node().type.name,l.node().attrs),...e},b=((o=s.contentMatch.defaultType)===null||o===void 0?void 0:o.createAndFill(j))||void 0;y=y.append(J.from(s.createAndFill(null,b)||void 0));const O=l.before(l.depth-(w-1));r.replace(O,l.after(-_),new ce(y,4-w,0));let S=-1;r.doc.nodesBetween(O,r.doc.content.size,(N,C)=>{if(S>-1)return!1;N.isTextblock&&N.content.size===0&&(S=C+1)}),S>-1&&r.setSelection(Pe.near(r.doc.resolve(S))),r.scrollIntoView()}return!0}const p=u.pos===l.end()?f.contentMatchAt(0).defaultType:null,m={...Ru(h,f.type.name,f.attrs),...e},g={...Ru(h,l.node().type.name,l.node().attrs),...e};r.delete(l.pos,u.pos);const v=p?[{type:s,attrs:m},{type:p,attrs:g}]:[{type:s,attrs:m}];if(!vi(r.doc,l.pos,2))return!1;if(i){const{selection:y,storedMarks:w}=n,{splittableMarks:_}=a.extensionManager,j=w||y.$to.parentOffset&&y.$from.marks();if(r.split(l.pos,2,v).scrollIntoView(),!j||!i)return!0;const b=j.filter(O=>_.includes(O.type.name));r.ensureMarks(b)}return!0},By=(t,e)=>{const r=v1(o=>o.type===e)(t.selection);if(!r)return!0;const n=t.doc.resolve(Math.max(0,r.pos-1)).before(r.depth);if(n===void 0)return!0;const i=t.doc.nodeAt(n);return r.node.type===i?.type&&oa(t.doc,r.pos)&&t.join(r.pos),!0},Fy=(t,e)=>{const r=v1(o=>o.type===e)(t.selection);if(!r)return!0;const n=t.doc.resolve(r.start).after(r.depth);if(n===void 0)return!0;const i=t.doc.nodeAt(n);return r.node.type===i?.type&&oa(t.doc,n)&&t.join(n),!0},doe=(t,e,r,n={})=>({editor:i,tr:a,state:o,dispatch:s,chain:l,commands:u,can:d})=>{const{extensions:f,splittableMarks:h}=i.extensionManager,p=Yt(t,o.schema),m=Yt(e,o.schema),{selection:g,storedMarks:v}=o,{$from:y,$to:w}=g,_=y.blockRange(w),j=v||g.$to.parentOffset&&g.$from.marks();if(!_)return!1;const b=v1(O=>YA(O.type.name,f))(g);if(_.depth>=1&&b&&_.depth-b.depth<=1){if(b.node.type===p)return u.liftListItem(m);if(YA(b.node.type.name,f)&&p.validContent(b.node.content)&&s)return l().command(()=>(a.setNodeMarkup(b.pos,p),!0)).command(()=>By(a,p)).command(()=>Fy(a,p)).run()}return!r||!j||!s?l().command(()=>d().wrapInList(p,n)?!0:u.clearNodes()).wrapInList(p,n).command(()=>By(a,p)).command(()=>Fy(a,p)).run():l().command(()=>{const O=d().wrapInList(p,n),S=j.filter(N=>h.includes(N.type.name));return a.ensureMarks(S),O?!0:u.clearNodes()}).wrapInList(p,n).command(()=>By(a,p)).command(()=>Fy(a,p)).run()},foe=(t,e={},r={})=>({state:n,commands:i})=>{const{extendEmptyMarkRange:a=!1}=r,o=la(t,n.schema);return Zb(n,o,e)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,e)},hoe=(t,e,r={})=>({state:n,commands:i})=>{const a=Yt(t,n.schema),o=Yt(e,n.schema),s=wc(n,a,r);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),s?i.setNode(o,l):i.setNode(a,{...l,...r})},poe=(t,e={})=>({state:r,commands:n})=>{const i=Yt(t,r.schema);return wc(r,i,e)?n.lift(i):n.wrapIn(i,e)},moe=()=>({state:t,dispatch:e})=>{const r=t.plugins;for(let n=0;n<r.length;n+=1){const i=r[n];let a;if(i.spec.isInputRules&&(a=i.getState(t))){if(e){const o=t.tr,s=a.transform;for(let l=s.steps.length-1;l>=0;l-=1)o.step(s.steps[l].invert(s.docs[l]));if(a.text){const l=o.doc.resolve(a.from).marks();o.replaceWith(a.from,a.to,t.schema.text(a.text,l))}else o.delete(a.from,a.to)}return!0}}return!1},goe=()=>({tr:t,dispatch:e})=>{const{selection:r}=t,{empty:n,ranges:i}=r;return n||e&&i.forEach(a=>{t.removeMark(a.$from.pos,a.$to.pos)}),!0},voe=(t,e={})=>({tr:r,state:n,dispatch:i})=>{var a;const{extendEmptyMarkRange:o=!1}=e,{selection:s}=r,l=la(t,n.schema),{$from:u,empty:d,ranges:f}=s;if(!i)return!0;if(d&&o){let{from:h,to:p}=s;const m=(a=u.marks().find(v=>v.type===l))===null||a===void 0?void 0:a.attrs,g=m1(u,l,m);g&&(h=g.from,p=g.to),r.removeMark(h,p,l)}else f.forEach(h=>{r.removeMark(h.$from.pos,h.$to.pos,l)});return r.removeStoredMark(l),!0},yoe=(t,e={})=>({tr:r,state:n,dispatch:i})=>{let a=null,o=null;const s=ep(typeof t=="string"?t:t.name,n.schema);return s?(s==="node"&&(a=Yt(t,n.schema)),s==="mark"&&(o=la(t,n.schema)),i&&r.selection.ranges.forEach(l=>{const u=l.$from.pos,d=l.$to.pos;let f,h,p,m;r.selection.empty?n.doc.nodesBetween(u,d,(g,v)=>{a&&a===g.type&&(p=Math.max(v,u),m=Math.min(v+g.nodeSize,d),f=v,h=g)}):n.doc.nodesBetween(u,d,(g,v)=>{v<u&&a&&a===g.type&&(p=Math.max(v,u),m=Math.min(v+g.nodeSize,d),f=v,h=g),v>=u&&v<=d&&(a&&a===g.type&&r.setNodeMarkup(v,void 0,{...g.attrs,...e}),o&&g.marks.length&&g.marks.forEach(y=>{if(o===y.type){const w=Math.max(v,u),_=Math.min(v+g.nodeSize,d);r.addMark(w,_,o.create({...y.attrs,...e}))}}))}),h&&(f!==void 0&&r.setNodeMarkup(f,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(g=>{o===g.type&&r.addMark(p,m,o.create({...g.attrs,...e}))}))}),!0):!1},xoe=(t,e={})=>({state:r,dispatch:n})=>{const i=Yt(t,r.schema);return Tie(i,e)(r,n)},boe=(t,e={})=>({state:r,dispatch:n})=>{const i=Yt(t,r.schema);return Mie(i,e)(r,n)};var woe=Object.freeze({__proto__:null,blur:tae,clearContent:rae,clearNodes:nae,command:iae,createParagraphNear:aae,cut:oae,deleteCurrentNode:sae,deleteNode:lae,deleteRange:cae,deleteSelection:uae,enter:dae,exitCode:fae,extendMarkRange:hae,first:pae,focus:gae,forEach:vae,insertContent:yae,insertContentAt:wae,joinBackward:jae,joinDown:Sae,joinForward:Oae,joinItemBackward:Nae,joinItemForward:Cae,joinTextblockBackward:kae,joinTextblockForward:Aae,joinUp:_ae,keyboardShortcut:Pae,lift:Tae,liftEmptyBlock:Mae,liftListItem:Dae,newlineInCode:Rae,resetAttributes:Iae,scrollIntoView:$ae,selectAll:Lae,selectNodeBackward:Bae,selectNodeForward:Fae,selectParentNode:zae,selectTextblockEnd:qae,selectTextblockStart:Uae,setContent:Hae,setMark:noe,setMeta:ioe,setNode:aoe,setNodeSelection:ooe,setTextSelection:soe,sinkListItem:loe,splitBlock:coe,splitListItem:uoe,toggleList:doe,toggleMark:foe,toggleNode:hoe,toggleWrap:poe,undoInputRule:moe,unsetAllMarks:goe,unsetMark:voe,updateAttributes:yoe,wrapIn:xoe,wrapInList:boe});const _oe=dr.create({name:"commands",addCommands(){return{...woe}}}),Soe=dr.create({name:"drop",addProseMirrorPlugins(){return[new Jt({key:new Dr("tiptapDrop"),props:{handleDrop:(t,e,r,n)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:r,moved:n})}}})]}}),joe=dr.create({name:"editable",addProseMirrorPlugins(){return[new Jt({key:new Dr("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Ooe=new Dr("focusEvents"),Noe=dr.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Jt({key:Ooe,props:{handleDOMEvents:{focus:(e,r)=>{t.isFocused=!0;const n=t.state.tr.setMeta("focus",{event:r}).setMeta("addToHistory",!1);return e.dispatch(n),!1},blur:(e,r)=>{t.isFocused=!1;const n=t.state.tr.setMeta("blur",{event:r}).setMeta("addToHistory",!1);return e.dispatch(n),!1}}}})]}}),Coe=dr.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:s})=>{const{selection:l,doc:u}=s,{empty:d,$anchor:f}=l,{pos:h,parent:p}=f,m=f.parent.isTextblock&&h>0?s.doc.resolve(h-1):f,g=m.parent.type.spec.isolating,v=f.pos-f.parentOffset,y=g&&m.parent.childCount===1?v===f.pos:Fe.atStart(u).from===h;return!d||!p.type.isTextblock||p.textContent.length||!y||y&&f.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...n},a={...n,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return g1()||P$()?a:i},addProseMirrorPlugins(){return[new Jt({key:new Dr("clearDocument"),appendTransaction:(t,e,r)=>{if(t.some(g=>g.getMeta("composition")))return;const n=t.some(g=>g.docChanged)&&!e.doc.eq(r.doc),i=t.some(g=>g.getMeta("preventClearDocument"));if(!n||i)return;const{empty:a,from:o,to:s}=e.selection,l=Fe.atStart(e.doc).from,u=Fe.atEnd(e.doc).to;if(a||!(o===l&&s===u)||!tp(r.doc))return;const h=r.tr,p=Yh({state:r,transaction:h}),{commands:m}=new Xh({editor:this.editor,state:p});if(m.clearNodes(),!!h.steps.length)return h}})]}}),koe=dr.create({name:"paste",addProseMirrorPlugins(){return[new Jt({key:new Dr("tiptapPaste"),props:{handlePaste:(t,e,r)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:r})}}})]}}),Aoe=dr.create({name:"tabindex",addProseMirrorPlugins(){return[new Jt({key:new Dr("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class ja{get name(){return this.node.type.name}constructor(e,r,n=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=r,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let r=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You canât set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}r=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:r,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),r=this.resolvedPos.doc.resolve(e);return new ja(r,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new ja(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new ja(e,this.editor)}get children(){const e=[];return this.node.content.forEach((r,n)=>{const i=r.isBlock&&!r.isTextblock,a=r.isAtom&&!r.isText,o=this.pos+n+(a?0:1),s=this.resolvedPos.doc.resolve(o);if(!i&&s.depth<=this.depth)return;const l=new ja(s,this.editor,i,i?r:null);i&&(l.actualDepth=this.depth+1),e.push(new ja(s,this.editor,i,i?r:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,r={}){let n=null,i=this.parent;for(;i&&!n;){if(i.node.type.name===e)if(Object.keys(r).length>0){const a=i.node.attrs,o=Object.keys(r);for(let s=0;s<o.length;s+=1){const l=o[s];if(a[l]!==r[l])break}}else n=i;i=i.parent}return n}querySelector(e,r={}){return this.querySelectorAll(e,r,!0)[0]||null}querySelectorAll(e,r={},n=!1){let i=[];if(!this.children||this.children.length===0)return i;const a=Object.keys(r);return this.children.forEach(o=>{n&&i.length>0||(o.node.type.name===e&&a.every(l=>r[l]===o.node.attrs[l])&&i.push(o),!(n&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,r,n))))}),i}setAttribute(e){const{tr:r}=this.editor.state;r.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(r)}}const Eoe=`.ProseMirror { 90 position: relative; 91} 92 93.ProseMirror { 94 word-wrap: break-word; 95 white-space: pre-wrap; 96 white-space: break-spaces; 97 -webkit-font-variant-ligatures: none; 98 font-variant-ligatures: none; 99 font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ 100} 101 102.ProseMirror [contenteditable="false"] { 103 white-space: normal; 104} 105 106.ProseMirror [contenteditable="false"] [contenteditable="true"] { 107 white-space: pre-wrap; 108} 109 110.ProseMirror pre { 111 white-space: pre-wrap; 112} 113 114img.ProseMirror-separator { 115 display: inline !important; 116 border: none !important; 117 margin: 0 !important; 118 width: 0 !important; 119 height: 0 !important; 120} 121 122.ProseMirror-gapcursor { 123 display: none; 124 pointer-events: none; 125 position: absolute; 126 margin: 0; 127} 128 129.ProseMirror-gapcursor:after { 130 content: ""; 131 display: block; 132 position: absolute; 133 top: -2px; 134 width: 20px; 135 border-top: 1px solid black; 136 animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; 137} 138 139@keyframes ProseMirror-cursor-blink { 140 to { 141 visibility: hidden; 142 } 143} 144 145.ProseMirror-hideselection *::selection { 146 background: transparent; 147} 148 149.ProseMirror-hideselection *::-moz-selection { 150 background: transparent; 151} 152 153.ProseMirror-hideselection * { 154 caret-color: transparent; 155} 156 157.ProseMirror-focused .ProseMirror-gapcursor { 158 display: block; 159} 160 161.tippy-box[data-animation=fade][data-state=hidden] { 162 opacity: 0 163}`;function Poe(t,e,r){const n=document.querySelector("style[data-tiptap-style]");if(n!==null)return n;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}class Toe extends Fie{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:n,moved:i})=>this.options.onDrop(r,n,i)),this.on("paste",({event:r,slice:n})=>this.options.onPaste(r,n)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=Poe(Eoe,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,r=!0){this.setOptions({editable:e}),r&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,r){const n=S$(r)?r(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:n});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const r=this.state.plugins;let n=r;if([].concat(e).forEach(a=>{const o=typeof a=="string"?`${a}$`:a.key;n=n.filter(s=>!s.key.startsWith(o))}),r.length===n.length)return;const i=this.state.reconfigure({plugins:n});return this.view.updateState(i),i}createExtensionManager(){var e,r;const i=[...this.options.enableCoreExtensions?[joe,eae.configure({blockSeparator:(r=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||r===void 0?void 0:r.blockSeparator}),_oe,Noe,Coe,Aoe,Soe,koe].filter(a=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[a.name]!==!1:!0):[],...this.options.extensions].filter(a=>["extension","node","mark"].includes(a?.type));this.extensionManager=new Ro(i,this)}createCommandManager(){this.commandManager=new Xh({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let r;try{r=Jb(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(o){if(!(o instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(o.message))throw o;this.emit("contentError",{editor:this,error:o,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(s=>s.name!=="collaboration"),this.createExtensionManager()}}),r=Jb(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const n=A$(r,this.options.autofocus);this.view=new l$(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:Do.create({doc:r,selection:n||void 0})});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews(),this.prependClass();const a=this.view.dom;a.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const r=this.capturedTransaction;return this.capturedTransaction=null,r}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(o=>{var s;return(s=this.capturedTransaction)===null||s===void 0?void 0:s.step(o)});return}const r=this.state.apply(e),n=!this.state.selection.eq(r.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:r}),this.view.updateState(r),this.emit("transaction",{editor:this,transaction:e}),n&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),a=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),a&&this.emit("blur",{editor:this,event:a.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return M$(this.state,e)}isActive(e,r){const n=typeof e=="string"?e:null,i=typeof e=="string"?r:e;return eoe(this.state,n,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return h1(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:r=` 164 165`,textSerializers:n={}}=e||{};return Yae(this.state.doc,{blockSeparator:r,textSerializers:{...N$(this.schema),...n}})}get isEmpty(){return tp(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,r){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(e,r))||null}$nodes(e,r){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(e,r))||null}$pos(e){const r=this.state.doc.resolve(e);return new ja(r,this)}get $doc(){return this.$pos(0)}}function As(t){return new Zh({find:t.find,handler:({state:e,range:r,match:n})=>{const i=Ie(t.getAttributes,void 0,n);if(i===!1||i===null)return null;const{tr:a}=e,o=n[n.length-1],s=n[0];if(o){const l=s.search(/\S/),u=r.from+s.indexOf(o),d=u+o.length;if(y1(r.from,r.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===t.type&&g!==p.mark.type)).filter(p=>p.to>u).length)return null;d<r.to&&a.delete(d,r.to),u>r.from&&a.delete(r.from+l,u);const h=r.from+l+o.length;a.addMark(r.from+l,h,t.type.create(i||{})),a.removeStoredMark(t.type)}}})}function D$(t){return new Zh({find:t.find,handler:({state:e,range:r,match:n})=>{const i=Ie(t.getAttributes,void 0,n)||{},{tr:a}=e,o=r.from;let s=r.to;const l=t.type.create(i);if(n[1]){const u=n[0].lastIndexOf(n[1]);let d=o+u;d>s?d=s:s=d+n[1].length;const f=n[0][n[0].length-1];a.insertText(f,o+n[0].length-1),a.replaceWith(d,s,l)}else if(n[0]){const u=t.type.isInline?o:o-1;a.insert(u,t.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()}})}function Qb(t){return new Zh({find:t.find,handler:({state:e,range:r,match:n})=>{const i=e.doc.resolve(r.from),a=Ie(t.getAttributes,void 0,n)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(r.from,r.to).setBlockType(r.from,r.from,t.type,a)}})}function _c(t){return new Zh({find:t.find,handler:({state:e,range:r,match:n,chain:i})=>{const a=Ie(t.getAttributes,void 0,n)||{},o=e.tr.delete(r.from,r.to),l=o.doc.resolve(r.from).blockRange(),u=l&&Jw(l,t.type,a);if(!u)return null;if(o.wrap(l,u),t.keepMarks&&t.editor){const{selection:f,storedMarks:h}=e,{splittableMarks:p}=t.editor.extensionManager,m=h||f.$to.parentOffset&&f.$from.marks();if(m){const g=m.filter(v=>
165p.includes(v.type.name));o.ensureMarks(g)}}if(t.keepAttributes){const f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,a).run()}const d=o.doc.resolve(r.from-1).nodeBefore;d&&d.type===t.type&&oa(o.doc,r.from-1)&&(!t.joinPredicate||t.joinPredicate(n,d))&&o.join(r.from-1)}})}class fr{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Ie(he(this,"addOptions",{name:this.name}))),this.storage=Ie(he(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new fr(e)}configure(e={}){const r=this.extend({...this.config,addOptions:()=>Qh(this.options,e)});return r.name=this.name,r.parent=this.parent,r}extend(e={}){const r=new fr(e);return r.parent=this,this.child=r,r.name=e.name?e.name:r.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${r.name}".`),r.options=Ie(he(r,"addOptions",{name:r.name})),r.storage=Ie(he(r,"addStorage",{name:r.name,options:r.options})),r}}function ro(t){return new j$({find:t.find,handler:({state:e,range:r,match:n,pasteEvent:i})=>{const a=Ie(t.getAttributes,void 0,n,i);if(a===!1||a===null)return null;const{tr:o}=e,s=n[n.length-1],l=n[0];let u=r.to;if(s){const d=l.search(/\S/),f=r.from+l.indexOf(s),h=f+s.length;if(y1(r.from,r.to,e.doc).filter(m=>m.mark.type.excluded.find(v=>v===t.type&&v!==m.mark.type)).filter(m=>m.to>f).length)return null;h<r.to&&o.delete(h,r.to),f>r.from&&o.delete(r.from+d,f),u=r.from+d+s.length,o.addMark(r.from+d,u,t.type.create(a||{})),o.removeStoredMark(t.type)}}})}function Moe(t){return new j$({find:t.find,handler({match:e,chain:r,range:n,pasteEvent:i}){const a=Ie(t.getAttributes,void 0,e,i),o=Ie(t.getContent,void 0,a);if(a===!1||a===null)return null;const s={type:t.type.name,attrs:a};o&&(s.content=o),e.input&&r().deleteRange(n).insertContentAt(n.from,s)}})}function Doe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var R$={exports:{}},zy={};var JA;function Roe(){if(JA)return zy;JA=1;var t=D;function e(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var r=typeof Object.is=="function"?Object.is:e,n=t.useState,i=t.useEffect,a=t.useLayoutEffect,o=t.useDebugValue;function s(f,h){var p=h(),m=n({inst:{value:p,getSnapshot:h}}),g=m[0].inst,v=m[1];return a(function(){g.value=p,g.getSnapshot=h,l(g)&&v({inst:g})},[f,p,h]),i(function(){return l(g)&&v({inst:g}),f(function(){l(g)&&v({inst:g})})},[f]),o(p),p}function l(f){var h=f.getSnapshot;f=f.value;try{var p=h();return!r(f,p)}catch{return!0}}function u(f,h){return h()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:s;return zy.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,zy}R$.exports=Roe();var x1=R$.exports;const Ioe=(...t)=>e=>{t.forEach(r=>{typeof r=="function"?r(e):r&&(r.current=e)})},$oe=({contentComponent:t})=>{const e=x1.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return D.createElement(D.Fragment,null,Object.values(e))};function Loe(){const t=new Set;let e={};return{subscribe(r){return t.add(r),()=>{t.delete(r)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(r,n){e={...e,[r]:WL.createPortal(n.reactElement,n.element,r)},t.forEach(i=>i())},removeRenderer(r){const n={...e};delete n[r],e=n,t.forEach(i=>i())}}}class Boe extends D.Component{constructor(e){var r;super(e),this.editorContentRef=D.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((r=e.editor)===null||r===void 0)&&r.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const r=this.editorContentRef.current;r.append(...e.options.element.childNodes),e.setOptions({element:r}),e.contentComponent=Loe(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(n=>n.hasContentComponentInitialized?n:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null,!e.options.element.firstChild))return;const r=document.createElement("div");r.append(...e.options.element.childNodes),e.setOptions({element:r})}render(){const{editor:e,innerRef:r,...n}=this.props;return D.createElement(D.Fragment,null,D.createElement("div",{ref:Ioe(r,this.editorContentRef),...n}),e?.contentComponent&&D.createElement($oe,{contentComponent:e.contentComponent}))}}const Foe=x.forwardRef((t,e)=>{const r=D.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return D.createElement(Boe,{key:r,innerRef:e,...t})}),zoe=D.memo(Foe);var qoe=function t(e,r){if(e===r)return!0;
165if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,a;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e instanceof Map&&r instanceof Map){if(e.size!==r.size)return!1;for(i of e.entries())if(!r.has(i[0]))return!1;for(i of e.entries())if(!t(i[1],r.get(i[0])))return!1;return!0}if(e instanceof Set&&r instanceof Set){if(e.size!==r.size)return!1;for(i of e.entries())if(!r.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(r)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(e[i]!==r[i])return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(a=Object.keys(e),n=a.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,a[i]))return!1;for(i=n;i--!==0;){var o=a[i];if(!(o==="_owner"&&e.$$typeof)&&!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r},Uoe=Doe(qoe),I$={exports:{}},qy={};var ZA;function Hoe(){if(ZA)return qy;ZA=1;var t=D,e=x1;function r(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}var n=typeof Object.is=="function"?Object.is:r,i=e.useSyncExternalStore,a=t.useRef,o=t.useEffect,s=t.useMemo,l=t.useDebugValue;return qy.useSyncExternalStoreWithSelector=function(u,d,f,h,p){var m=a(null);if(m.current===null){var g={hasValue:!1,value:null};m.current=g}else g=m.current;m=s(function(){function y(O){if(!w){if(w=!0,_=O,O=h(O),p!==void 0&&g.hasValue){var S=g.value;if(p(S,O))return j=S}return j=O}if(S=j,n(_,O))return S;var N=h(O);return p!==void 0&&p(S,N)?S:(_=O,j=N)}var w=!1,_,j,b=f===void 0?null:f;return[function(){return y(d())},b===null?void 0:function(){return y(b())}]},[d,f,h,p]);var v=i(u,m[0],m[1]);return o(function(){g.hasValue=!0,g.value=v},[v]),l(v),v},qy}I$.exports=Hoe();var Woe=I$.exports;const Voe=typeof window<"u"?x.useLayoutEffect:x.useEffect;class Koe{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const r=()=>{this.transactionNumber+=1,this.subscribers.forEach(i=>i())},n=this.editor;return n.on("transaction",r),()=>{n.off("transaction",r)}}}}function Goe(t){var e;const[r]=x.useState(()=>new Koe(t.editor)),n=Woe.useSyncExternalStoreWithSelector(r.subscribe,r.getSnapshot,r.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:Uoe);return Voe(()=>r.watch(t.editor),[t.editor,r]),x.useDebugValue(n),n}const Yoe=!1,e0=typeof window>"u",Xoe=e0||!!(typeof window<"u"&&window.next);class b1{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(r=>r())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?e0||Xoe?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...n)=>{var i,a;return(a=(i=this.options.current).onBeforeCreate)===null||a===void 0?void 0:a.call(i,...n)},onBlur:(...n)=>{var i,a;return(a=(i=this.options.current).onBlur)===null||a===void 0?void 0:a.call(i,...n)},onCreate:(...n)=>{var i,a;return(a=(i=this.options.current).onCreate)===null||a===void 0?void 0:a.call(i,...n)},onDestroy:(...n)=>{var i,a;return(a=(i=this.options.current).onDestroy)===null||a===void 0?void 0:a.call(i,...n)},onFocus:(...n)=>{var i,a;return(a=(i=this.options.current).onFocus)===null||a===void 0?void 0:a.call(i,...n)},onSelectionUpdate:(...n)=>{var i,a;return(a=(i=this.options.current).onSelectionUpdate)===null||a===void 0?void 0:a.call(i,...n)},onTransaction:(...n)=>{var i,a;return(a=(i=this.options.current).onTransaction)===null||a===void 0?void 0:a.call(i,...n)},onUpdate:(...n)=>{var i,a;return(a=(i=this.options.current).onUpdate)===null||a===void 0?void 0:a.call(i,...n)},onContentError:(...n)=>{var i,a;return(a=(i=this.options.current).onContentError)===null||a===void 0?void 0:a.call(i,...n)},onDrop:(...n)=>{var i,a;return(a=(i=this.options.current).onDrop)===null||a===void 0?void 0:a.call(i,...n)},onPaste:(...n)=>{var i,a;return(a=(i=this.options.current).onPaste)===null||a===void 0?void 0:a.call(i,...n)}};return new Toe(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,r){return Object.keys(e).every(n=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)?!0:n==="extensions"&&e.extensions&&r.extensions?e.extensions.length!==r.extensions.length?!1:e.extensions.every((i,a)=>{var o;return i===((o=r.extensions)===null||o===void 0?void 0:o[a])}):e[n]===r[n])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?b1.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}
165):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((n,i)=>n===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,r=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){r&&r.setOptions(this.options.current);return}r&&!r.isDestroyed&&(r.destroy(),this.instanceId===e&&this.setEditor(null))},1)}}function Joe(t={},e=[]){const r=x.useRef(t);r.current=t;const[n]=x.useState(()=>new b1(r)),i=x1.useSyncExternalStore(n.subscribe,n.getEditor,n.getServerSnapshot);return x.useDebugValue(i),x.useEffect(n.onRender(e)),Goe({editor:i,selector:({transactionNumber:a})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&a===0?0:a+1}),i}const Zoe=x.createContext({editor:null});Zoe.Consumer;const Qoe=x.createContext({onDragStart:void 0}),ese=()=>x.useContext(Qoe);D.forwardRef((t,e)=>{const{onDragStart:r}=ese(),n=t.as||"div";return D.createElement(n,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:r,style:{whiteSpace:"normal",...t.style}})});const tse=/^\s*>\s$/,rse=fr.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Ft(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[_c({find:tse,type:this.type})]}}),nse=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,ise=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,ase=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,ose=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,sse=Si.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",Ft(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[As({find:nse,type:this.type}),As({find:ase,type:this.type})]},addPasteRules(){return[ro({find:ise,type:this.type}),ro({find:ose,type:this.type})]}}),lse="listItem",QA="textStyle",eE=/^\s*([-+*])\s$/,cse=fr.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Ft(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(lse,this.editor.getAttributes(QA)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}}
vendor: 12,541 bytes, lines 165-169
165,addInputRules(){let t=_c({find:eE,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=_c({find:eE,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(QA),editor:this.editor})),[t]}}),use=/(^|[^`])`([^`]+)`(?!`)/,dse=/(^|[^`])`([^`]+)`(?!`)/g,fse=Si.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Ft(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[As({find:use,type:this.type})]},addPasteRules(){return[ro({find:dse,type:this.type})]}}),hse=/^```([a-z]+)?[\s\n]$/,pse=/^~~~([a-z]+)?[\s\n]$/,mse=fr.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:r}=this.options,a=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(r)).map(o=>o.replace(r,""))[0];return a||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Ft(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,r=e.pos===1;return!t||e.parent.type.name!==this.name?!1:r||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:r}=e,{$from:n,empty:i}=r;if(!i||n.parent.type!==this.type)return!1;const a=n.parentOffset===n.parent.nodeSize-2,o=n.parent.textContent.endsWith(` 166 167`);return!a||!o?!1:t.chain().command(({tr:s})=>(s.delete(n.pos-2,n.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:r,doc:n}=e,{$from:i,empty:a}=r;if(!a||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const s=i.after();return s===void 0?!1:n.nodeAt(s)?t.commands.command(({tr:u})=>(u.setSelection(Fe.near(n.resolve(s))),!0)):t.commands.exitCode()}}},addInputRules(){return[Qb({find:hse,type:this.type,getAttributes:t=>({language:t[1]})}),Qb({find:pse,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Jt({key:new Dr("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const r=e.clipboardData.getData("text/plain"),n=e.clipboardData.getData("vscode-editor-data"),i=n?JSON.parse(n):void 0,a=i?.mode;if(!r||!a)return!1;const{tr:o,schema:s}=t.state,l=s.text(r.replace(/\r\n?/g,` 168`));return o.replaceSelectionWith(this.type.create({language:a},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(Pe.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),gse=fr.create({name:"doc",topNode:!0,content:"block+"});function vse(t={}){return new Jt({view(e){return new yse(e,t)}})}class yse{constructor(e,r){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=r.width)!==null&&n!==void 0?n:1,this.color=r.color===!1?void 0:r.color||"black",this.class=r.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let a=o=>{this[i](o)};return e.dom.addEventListener(i,a),{name:i,handler:a}})}destroy(){this.handlers.forEach(({name:e,handler:r})=>this.editorView.dom.removeEventListener(e,r))}update(e,r){this.cursorPos!=null&&r.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),r=!e.parent.inlineContent,n,i=this.editorView.dom,a=i.getBoundingClientRect(),o=a.width/i.offsetWidth,s=a.height/i.offsetHeight;if(r){let f=e.nodeBefore,h=e.nodeAfter;if(f||h){let p=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(p){let m=p.getBoundingClientRect(),g=f?m.bottom:m.top;f&&h&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*s;n={left:m.left,right:m.right,top:g-v,bottom:g+v}}}}if(!n){let f=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;n={left:f.left-h,right:f.left+h,top:f.top,bottom:f.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",r),this.element.classList.toggle("prosemirror-dropcursor-inline",!r);let u,d;if(!l||l==document.body&&getComputedStyle(l).position=="static")u=-pageXOffset,d=-pageYOffset;else{let f=l.getBoundingClientRect(),h=f.width/l.offsetWidth,p=f.height/l.offsetHeight;u=f.left-l.scrollLeft*h,d=f.top-l.scrollTop*p}this.element.style.left=(n.left-u)/o+"px",this.element.style.top=(n.top-d)/s+"px",this.element.style.width=(n.right-n.left)/o+"px",this.element.style.height=(n.bottom-n.top)/s+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let r=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=r&&r.inside>=0&&this.editorView.state.doc.nodeAt(r.inside),i=n&&n.type.spec.disableDropCursor,a=typeof i=="function"?i(this.editorView,r,e):i;if(r&&!a){let o=r.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let s=bI(this.editorView.state.doc,o,this.editorView.dragging.slice);s!=null&&(o=s)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const xse=dr.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[vse(this.options)]}});class jt extends Fe{constructor(e){super(e,e)}map(e,r){let n=e.resolve(r.map(this.head));return jt.valid(n)?new jt(n):Fe.near(n)}content(){return ce.empty}eq(e){return e instanceof jt&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,r){if(typeof r.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new jt(e.resolve(r.pos))}getBookmark(){return new w1(this.anchor)}static valid(e){let r=e.parent;if(r.inlineContent||!bse(e)||!wse(e))return!1;let n=r.type.spec.allowGapCursor;if(n!=null)return n;let i=r.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,r,n=!1){e:for(;;){if(!n&&jt.valid(e))return e;let i=e.pos,a=null;for(let o=e.depth;;o--){let s=e.node(o);if(r>0?e.indexAfter(o)<s.childCount:e.index(o)>0){a=s.child(r>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=r;let l=e.doc.resolve(i);if(jt.valid(l))return l}for(;;){let o=r>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!we.isSelectable(a)){e=e.doc.resolve(i+a.nodeSize*r),n=!1;continue e}break}a=o,i+=r;let s=e.doc.resolve(i);if(jt.valid(s))return s}return null}}}jt.prototype.visible=!1;jt.findFrom=jt.findGapCursorFrom;Fe.jsonID("gapcursor",jt);class w1{constructor(e){this.pos=e}map(e){return new w1(e.map(this.pos))}resolve(e){let r=e.resolve(this.pos);return jt.valid(r)?new jt(r):Fe.near(r)}}function $$(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function bse(t){for(let e=t.depth;e>=0;e--){let r=t.index(e),n=t.node(e);if(r==0){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(r-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||$$(i.type))return!0;if(i.inlineContent)return!1}}return!0}function wse(t){for(let e=t.depth;e>=0;e--){let r=t.indexAfter(e),n=t.node(e);if(r==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(r);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||$$(i.type))return!0;if(i.inlineContent)return!1}}return!0}function _se(){return new Jt({props:{decorations:Nse,createSelectionBetween(t,e,r){return e.pos==r.pos&&jt.valid(r)?new jt(r):null},handleClick:jse,handleKeyDown:Sse,handleDOMEvents:{beforeinput:Ose}}})}const Sse=c$({ArrowLeft:wu("horiz",-1),ArrowRight:wu("horiz",1),ArrowUp:wu("vert",-1),ArrowDown:wu("vert",1)});function wu(t,e){const r=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,i,a){let o=n.selection,s=e>0?o.$to:o.$from,l=o.empty;if(o instanceof Pe){if(!a.endOfTextblock(r)||s.depth==0)return!1;l=!1,s=n.doc.resolve(e>0?s.after():s.before())}let u=jt.findGapCursorFrom(s,e,l);return u?(i&&i(n.tr.setSelection(new jt(u))),!0):!1}}function jse(t,e,r){if(!t||!t.editable)return!1;let n=t.state.doc.resolve(e);if(!jt.valid(n))return!1;let i=t.posAtCoords({left:r.clientX,top:r.clientY});return i&&i.inside>-1&&we.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new jt(n))),!0)}function Ose(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof jt))return!1;let{$from:r}=t.state.selection,n=r.parent.contentMatchAt(r.index()).findWrapping(t.state.schema.nodes.text);if(!n)return!1;let i=J.empty;for(let o=n.length-1;o>=0;o--)i=J.from(n[o].createAndFill(null,i));let a=t.state.tr.replace(r.pos,r.pos,new ce(i,0,0));return a.setSelection(Pe.near(a.doc.resolve(r.pos+1))),t.dispatch(a),!1}function Nse(t){if(!(t.selection instanceof jt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Et.create(t.doc,[qr.widget(t.selection.head,e,{key:"gapcursor"})])}const Cse=dr.create({name:"gapCursor",addProseMirrorPlugins(){return[_se()]},extendNodeSchema(t){var e;const r={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Ie(he(t,"allowGapCursor",r)))!==null&&e!==void 0?e:null}}}),kse=fr.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Ft(this.options.HTMLAttributes,t)]},renderText(){return` 169`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:r,editor:n})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:a}=r;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:s}=n.extensionManager,l=a||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:d})=>{if(d&&l&&o){const f=l.filter(h=>s.includes(h.type.name));u.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Ase=fr.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Ft(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Qb({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}}
169)\\s$`),type:this.type,getAttributes:{level:t}}))}});var vf=200,Gt=function(){};Gt.prototype.append=function(e){return e.length?(e=Gt.from(e),!this.length&&e||e.length<vf&&this.leafAppend(e)||this.length<vf&&e.leafPrepend(this)||this.appendInner(e)):this};Gt.prototype.prepend=function(e){return e.length?Gt.from(e).append(this):this};Gt.prototype.appendInner=function(e){return new Ese(this,e)};Gt.prototype.slice=function(e,r){return e===void 0&&(e=0),r===void 0&&(r=this.length),e>=r?Gt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,r))};Gt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Gt.prototype.forEach=function(e,r,n){r===void 0&&(r=0),n===void 0&&(n=this.length),r<=n?this.forEachInner(e,r,n,0):this.forEachInvertedInner(e,r,n,0)};Gt.prototype.map=function(e,r,n){r===void 0&&(r=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(a,o){return i.push(e(a,o))},r,n),i};Gt.from=function(e){return e instanceof Gt?e:e&&e.length?new L$(e):Gt.empty};var L$=(function(t){function e(n){t.call(this),this.values=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,a){return i==0&&a==this.length?this:new e(this.values.slice(i,a))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,a,o,s){for(var l=a;l<o;l++)if(i(this.values[l],s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,a,o,s){for(var l=a-1;l>=o;l--)if(i(this.values[l],s+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=vf)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=vf)return new e(i.flatten().concat(this.values))},r.length.get=function(){return this.values.length},r.depth.get=function(){return 0},Object.defineProperties(e.prototype,r),e})(Gt);Gt.empty=new L$([]);var Ese=(function(t){function e(r,n){t.call(this),this.left=r,this.right=n,this.length=r.length+n.length,this.depth=Math.max(r.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,a,o){var s=this.left.length;if(i<s&&this.left.forEachInner(n,i,Math.min(a,s),o)===!1||a>s&&this.right.forEachInner(n,Math.max(i-s,0),Math.min(this.length,a)-s,o+s)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,a,o){var s=this.left.length;if(i>s&&this.right.forEachInvertedInner(n,i-s,Math.max(a,s)-s,o+s)===!1||a<s&&this.left.forEachInvertedInner(n,Math.min(i,s),a,o)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var a=this.left.length;return i<=a?this.left.slice(n,i):n>=a?this.right.slice(n-a,i-a):this.left.slice(n,a).append(this.right.slice(0,i-a))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(Gt);const Pse=500;class Sn{constructor(e,r){this.items=e,this.eventCount=r}popEvent(e,r){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,a;r&&(i=this.remapping(n,this.items.length),a=i.maps.length);let o=e.tr,s,l,u=[],d=[];return this.items.forEach((f,h)=>{if(!f.step){i||(i=this.remapping(n,h+1),a=i.maps.length),a--,d.push(f);return}if(i){d.push(new Pn(f.map));let p=f.step.map(i.slice(a)),m;p&&o.maybeStep(p).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],u.push(new Pn(m,void 0,void 0,u.length+d.length))),a--,m&&i.appendMap(m,a)}else o.maybeStep(f.step);if(f.selection)return s=i?f.selection.map(i.slice(a)):f.selection,l=new Sn(this.items.slice(0,n).append(d.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:s}}addTransform(e,r,n,i){let a=[],o=this.eventCount,s=this.items,l=!i&&s.length?s.get(s.length-1):null;for(let d=0;d<e.steps.length;d++){let f=e.steps[d].invert(e.docs[d]),h=new Pn(e.mapping.maps[d],f,r),p;(p=l&&l.merge(h))&&(h=p,d?a.pop():s=s.slice(0,s.length-1)),a.push(h),r&&(o++,r=void 0),i||(l=h)}let u=o-n.depth;return u>Mse&&(s=Tse(s,u),o-=u),new Sn(s.append(a),o)}remapping(e,r){let n=new gc;
vendor: 4,492 bytes, line 169
169return this.items.forEach((i,a)=>{let o=i.mirrorOffset!=null&&a-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,o)},e,r),n}addMaps(e){return this.eventCount==0?this:new Sn(this.items.append(e.map(r=>new Pn(r))),this.eventCount)}rebased(e,r){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-r),a=e.mapping,o=e.steps.length,s=this.eventCount;this.items.forEach(h=>{h.selection&&s--},i);let l=r;this.items.forEach(h=>{let p=a.getMirror(--l);if(p==null)return;o=Math.min(o,p);let m=a.maps[p];if(h.step){let g=e.steps[p].invert(e.docs[p]),v=h.selection&&h.selection.map(a.slice(l+1,p));v&&s++,n.push(new Pn(m,g,v))}else n.push(new Pn(m))},i);let u=[];for(let h=r;h<o;h++)u.push(new Pn(a.maps[h]));let d=this.items.slice(0,i).append(u).append(n),f=new Sn(d,s);return f.emptyItemCount()>Pse&&(f=f.compress(this.items.length-n.length)),f}emptyItemCount(){let e=0;return this.items.forEach(r=>{r.step||e++}),e}compress(e=this.items.length){let r=this.remapping(0,e),n=r.maps.length,i=[],a=0;return this.items.forEach((o,s)=>{if(s>=e)i.push(o),o.selection&&a++;else if(o.step){let l=o.step.map(r.slice(n)),u=l&&l.getMap();if(n--,u&&r.appendMap(u,n),l){let d=o.selection&&o.selection.map(r.slice(n));d&&a++;let f=new Pn(u.invert(),l,d),h,p=i.length-1;(h=i.length&&i[p].merge(f))?i[p]=h:i.push(f)}}else o.map&&n--},this.items.length,0),new Sn(Gt.from(i.reverse()),a)}}Sn.empty=new Sn(Gt.empty,0);function Tse(t,e){let r;return t.forEach((n,i)=>{if(n.selection&&e--==0)return r=i,!1}),t.slice(r)}class Pn{constructor(e,r,n,i){this.map=e,this.step=r,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let r=e.step.merge(this.step);if(r)return new Pn(r.getMap().invert(),r,this.selection)}}}class Ri{constructor(e,r,n,i,a){this.done=e,this.undone=r,this.prevRanges=n,this.prevTime=i,this.prevComposition=a}}const Mse=20;function Dse(t,e,r,n){let i=r.getMeta(za),a;if(i)return i.historyState;r.getMeta($se)&&(t=new Ri(t.done,t.undone,null,0,-1));let o=r.getMeta("appendedTransaction");if(r.steps.length==0)return t;if(o&&o.getMeta(za))return o.getMeta(za).redo?new Ri(t.done.addTransform(r,void 0,n,Iu(e)),t.undone,tE(r.mapping.maps),t.prevTime,t.prevComposition):new Ri(t.done,t.undone.addTransform(r,void 0,n,Iu(e)),null,t.prevTime,t.prevComposition);if(r.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let s=r.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=s&&(t.prevTime<(r.time||0)-n.newGroupDelay||!Rse(r,t.prevRanges)),u=o?Uy(t.prevRanges,r.mapping):tE(r.mapping.maps);return new Ri(t.done.addTransform(r,l?e.selection.getBookmark():void 0,n,Iu(e)),Sn.empty,u,r.time,s??t.prevComposition)}else return(a=r.getMeta("rebased"))?new Ri(t.done.rebased(r,a),t.undone.rebased(r,a),Uy(t.prevRanges,r.mapping),t.prevTime,t.prevComposition):new Ri(t.done.addMaps(r.mapping.maps),t.undone.addMaps(r.mapping.maps),Uy(t.prevRanges,r.mapping),t.prevTime,t.prevComposition)}function Rse(t,e){if(!e)return!1;if(!t.docChanged)return!0;let r=!1;return t.mapping.maps[0].forEach((n,i)=>{for(let a=0;a<e.length;a+=2)n<=e[a+1]&&i>=e[a]&&(r=!0)}),r}function tE(t){let e=[];for(let r=t.length-1;r>=0&&e.length==0;r--)t[r].forEach((n,i,a,o)=>e.push(a,o));return e}function Uy(t,e){if(!t)return null;let r=[];for(let n=0;n<t.length;n+=2){let i=e.map(t[n],1),a=e.map(t[n+1],-1);i<=a&&r.push(i,a)}return r}function Ise(t,e,r){let n=Iu(e),i=za.get(e).spec.config,a=(r?t.undone:t.done).popEvent(e,n);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(r?t.done:t.undone).addTransform(a.transform,e.selection.getBookmark(),i,n),l=new Ri(r?s:a.remaining,r?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(za,{redo:r,historyState:l})}let Hy=!1,rE=null;function Iu(t){let e=t.plugins;if(rE!=e){Hy=!1,rE=e;for(let r=0;r<e.length;r++)if(e[r].spec.historyPreserveItems){Hy=!0;break}}return Hy}const za=new Dr("history"),$se=new Dr("closeHistory");function Lse(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Jt({key:za,state:{init(){return new Ri(Sn.empty,Sn.empty,null,0,-1)},apply(e,r,n){return Dse(r,n,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,r){let n=r.inputType,i=n=="historyUndo"?F$:n=="historyRedo"?z$:null;return!i||!e.editable?!1:(r.preventDefault(),i(e.state,e.dispatch))}}}})}function B$(t,e){return(r,n)=>{let i=za.getState(r);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(n){let a=Ise(i,r,t);a&&n(e?a.scrollIntoView():a)}return!0}}
vendor: 4,047 bytes, line 169
169const F$=B$(!1,!0),z$=B$(!0,!0),Bse=dr.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>F$(t,e),redo:()=>({state:t,dispatch:e})=>z$(t,e)}},addProseMirrorPlugins(){return[Lse(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-Ñ":()=>this.editor.commands.undo(),"Shift-Mod-Ñ":()=>this.editor.commands.redo()}}}),Fse=fr.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Ft(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{selection:r}=e,{$from:n,$to:i}=r,a=t();return n.parentOffset===0?a.insertContentAt({from:Math.max(n.pos-1,0),to:i.pos},{type:this.name}):toe(r)?a.insertContentAt(i.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({tr:o,dispatch:s})=>{var l;if(s){const{$to:u}=o.selection,d=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(Pe.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(we.create(o.doc,u.pos)):o.setSelection(Pe.create(o.doc,u.pos));else{const f=(l=u.parent.type.contentMatch.defaultType)===null||l===void 0?void 0:l.create();f&&(o.insert(d,f),o.setSelection(Pe.create(o.doc,d+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[D$({find:/^(?:---|â-|___\s|\*\*\*\s)$/,type:this.type})]}}),zse=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,qse=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Use=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Hse=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Wse=Si.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Ft(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[As({find:zse,type:this.type}),As({find:Use,type:this.type})]},addPasteRules(){return[ro({find:qse,type:this.type}),ro({find:Hse,type:this.type})]}}),Vse=fr.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ft(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Kse="listItem",nE="textStyle",iE=/^(\d+)\.\s$/,Gse=fr.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...r}=t;return e===1?["ol",Ft(this.options.HTMLAttributes,r),0]:["ol",Ft(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Kse,this.editor.getAttributes(nE)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}}
169,addInputRules(){let t=_c({find:iE,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,r)=>r.childCount+r.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=_c({find:iE,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(nE)}),joinPredicate:(e,r)=>r.childCount+r.attrs.start===+e[1],editor:this.editor})),[t]}}),Yse=fr.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Ft(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Xse=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Jse=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Zse=Si.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Ft(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[As({find:Xse,type:this.type})]},addPasteRules(){return[ro({find:Jse,type:this.type})]}}),Qse=fr.create({name:"text",group:"inline"}),ele=dr.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(sse.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(rse.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(cse.configure(this.options.bulletList)),this.options.code!==!1&&t.push(fse.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(mse.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(gse.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(xse.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(Cse.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(kse.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(Ase.configure(this.options.heading)),this.options.history!==!1&&t.push(Bse.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(Fse.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(Wse.configure(this.options.italic)),this.options.listItem!==!1&&t.push(Vse.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(Gse.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(Yse.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(Zse.configure(this.options.strike)),this.options.text!==!1&&t.push(Qse.configure(this.options.text)),t}}),tle=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,rle=fr.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Ft(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[D$({find:tle,type:this.type,getAttributes:t=>{const[,,e,r,n]=t;return{src:r,alt:e,title:n}}})]}});function nle(t,e){const r=[];return t!=="100%"?r.push(`width:${t}`):r.push("width:100%"),r.push("max-width:100%"),r.push("height:auto"),e==="center"?r.push("display:block","margin-left:auto","margin-right:auto","float:none"):e==="right"?r.push("float:right","margin-left:1rem","margin-bottom:0.5rem"):e==="left"?r.push("float:left","margin-right:1rem","margin-bottom:0.5rem"):r.push("display:block"),r.join(";")}const ile=rle.extend({name:"customImage",addAttributes(){return{...this.parent?.(),width:{default:"100%",parseHTML:t=>{const r=(t.getAttribute("style")||"").match(/width:\s*(\d+(?:px|%))/);return r?r[1]:"100%"},renderHTML:()=>({})},align:{default:"center",parseHTML:t=>{const e=t.getAttribute("style")||"";return e.includes("float:right")||e.includes("float: right")?"right":e.includes("float:left")||e.includes("float: left")?"left":"center"},renderHTML:()=>({})}}},renderHTML({HTMLAttributes:t}){const{width:e,align:r,style:n,...i}=t,a=nle(e||"100%",r||"center");return["img",{...i,style:a,class:"editor-image rounded-lg"}]},addCommands(){return{...this.parent?.(),setImageSize:({width:t})=>({tr:e,state:r,dispatch:n})=>{const{selection:i}=r,a=r.doc.nodeAt(i.from);
169return a?.type.name===this.name?(n&&(e.setNodeMarkup(i.from,void 0,{...a.attrs,width:t}),n(e)),!0):!1},setImageAlign:({align:t})=>({tr:e,state:r,dispatch:n})=>{const{selection:i}=r,a=r.doc.nodeAt(i.from);return a?.type.name===this.name?(n&&(e.setNodeMarkup(i.from,void 0,{...a.attrs,align:t}),n(e)),!0):!1}}}});var _1="ContextMenu",[ale]=no(_1,[TE]),pr=TE(),[ole,q$]=ale(_1),U$=t=>{const{__scopeContextMenu:e,children:r,onOpenChange:n,dir:i,modal:a=!0}=t,[o,s]=x.useState(!1),l=pr(e),u=si(n),d=x.useCallback(f=>{s(f),u(f)},[u]);return c.jsx(ole,{scope:e,open:o,onOpenChange:d,modal:a,children:c.jsx(XL,{...l,dir:i,open:o,onOpenChange:d,modal:a,children:r})})};U$.displayName=_1;var H$="ContextMenuTrigger",W$=x.forwardRef((t,e)=>{const{__scopeContextMenu:r,disabled:n=!1,...i}=t,a=q$(H$,r),o=pr(r),s=x.useRef({x:0,y:0}),l=x.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...s.current})}),u=x.useRef(0),d=x.useCallback(()=>window.clearTimeout(u.current),[]),f=h=>{s.current={x:h.clientX,y:h.clientY},a.onOpenChange(!0)};return x.useEffect(()=>d,[d]),x.useEffect(()=>{n&&d()},[n,d]),c.jsxs(c.Fragment,{children:[c.jsx(JL,{...o,virtualRef:l}),c.jsx(Ve.span,{"data-state":a.open?"open":"closed","data-disabled":n?"":void 0,...i,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:n?t.onContextMenu:Ae(t.onContextMenu,h=>{d(),f(h),h.preventDefault()}),onPointerDown:n?t.onPointerDown:Ae(t.onPointerDown,_u(h=>{d(),u.current=window.setTimeout(()=>f(h),700)})),onPointerMove:n?t.onPointerMove:Ae(t.onPointerMove,_u(d)),onPointerCancel:n?t.onPointerCancel:Ae(t.onPointerCancel,_u(d)),onPointerUp:n?t.onPointerUp:Ae(t.onPointerUp,_u(d))})]})});W$.displayName=H$;var sle="ContextMenuPortal",V$=t=>{const{__scopeContextMenu:e,...r}=t,n=pr(e);return c.jsx(e4,{...n,...r})};V$.displayName=sle;var K$="ContextMenuContent",G$=x.forwardRef((t,e)=>{const{__scopeContextMenu:r,...n}=t,i=q$(K$,r),a=pr(r),o=x.useRef(!1);return c.jsx(t4,{...a,...n,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:s=>{t.onCloseAutoFocus?.(s),!s.defaultPrevented&&o.current&&s.preventDefault(),o.current=!1},onInteractOutside:s=>{t.onInteractOutside?.(s),!s.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});G$.displayName=K$;var lle="ContextMenuGroup",cle=x.forwardRef((t,e)=>{const{__scopeContextMenu:r,...n}=t,i=pr(r);return c.jsx(c4,{...i,...n,ref:e})});cle.displayName=lle;var ule="ContextMenuLabel",Y$=x.forwardRef((t,e)=>{const{__scopeContextMenu:r,...n}=t,i=pr(r);return c.jsx(r4,{...i,...n,ref:e})});Y$.displayName=ule;var dle="ContextMenuItem",X$=x.forwardRef((t,e)=>{const{__scopeContextMenu:r,...n}=t,i=pr(r);return c.jsx(l4,{...i,...n,ref:e})});X$.displayName=dle;var fle="ContextMenuCheckboxItem",J$=x.forwardRef((t,e)=>{const{__scopeContextMenu:r,...n}=t,i=pr(r);return c.jsx(u4,{...i,...n,ref:e})});J$.displayName=fle;var hle="ContextMenuRadioGroup",Z$=x.forwardRef((t,e)=>{const{__scopeContextMenu:r,...n}=t,i=pr(r);return c.jsx(QL,{...i,...n,ref:e})});Z$.displayName=hle;var ple="ContextMenuRadioItem",Q$=x.forwardRef((t,e)=>{const{__scopeContextMenu:r,...n}=t,i=pr(r);return c.jsx(o4,{...i,...n,ref:e})});Q$.displayName=ple;var mle="ContextMenuItemIndicator",eL=x.forwardRef((t,e)=>{const{__scopeContextMenu:r,...n}=t,i=pr(r);return c.jsx(s4,{...i,...n,ref:e})});eL.displayName=mle;var gle="ContextMenuSeparator",tL=x.forwardRef((t,e)=>{const{__scopeContextMenu:r,...n}=t,i=pr(r);return c.jsx(n4,{...i,...n,ref:e})});tL.displayName=gle;var vle="ContextMenuArrow",yle=x.forwardRef((t,e)=>{const{__scopeContextMenu:r,...n}=t,i=pr(r);return c.jsx(d4,{...i,...n,ref:e})});yle.displayName=vle;var rL="ContextMenuSub",nL=t=>{const{__scopeContextMenu:e,children:r,onOpenChange:n,open:i,defaultOpen:a}=t,o=pr(e),[s,l]=qo({prop:i,defaultProp:a??!1,onChange:n,caller:rL});return c.jsx(ZL,{...o,open:s,onOpenChange:l,children:r})};nL.displayName=rL;var xle="ContextMenuSubTrigger",iL=x.forwardRef((t,e)=>{const{__scopeContextMenu:r,...n}=t,i=pr(r);return c.jsx(i4,{...i,...n,ref:e})});iL.displayName=xle;var ble="ContextMenuSubContent",aL=x.forwardRef((t,e)=>{const{__scopeContextMenu:r,...n}=t,i=pr(r);return c.jsx(a4,{...i,...n,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});aL.displayName=ble;function _u(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var wle=U$,_le=W$,Sle=V$,oL=G$,sL=Y$,lL=X$,cL=J$,jle=Z$,uL=Q$,dL=eL,fL=tL,Ole=nL,hL=iL,pL=aL;const Nle=wle,Cle=_le,aE=Ole,oE=jle,t0=x.forwardRef(({className:t,inset:e,children:r,...n},i)=>c.jsxs(hL,{ref:i,className:le("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent data-[state=open]:text-accent-foreground focus:bg-accent focus:text-accent-foreground",e&&"pl-8",t),...n,children:[r,c.jsx(LE,{className:"ml-auto h-4 w-4"})]}));t0.displayName=hL.displayName;const r0=x.forwardRef(({className:t,...e},r)=>c.jsx(pL,{ref:r,className:le("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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]:sli
169de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));r0.displayName=pL.displayName;const mL=x.forwardRef(({className:t,...e},r)=>c.jsx(Sle,{children:c.jsx(oL,{ref:r,className:le("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 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",t),...e})}));mL.displayName=oL.displayName;const n0=x.forwardRef(({className:t,inset:e,...r},n)=>c.jsx(lL,{ref:n,className:le("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e&&"pl-8",t),...r}));n0.displayName=lL.displayName;const kle=x.forwardRef(({className:t,children:e,checked:r,...n},i)=>c.jsxs(cL,{ref:i,className:le("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),checked:r,...n,children:[c.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:c.jsx(dL,{children:c.jsx($n,{className:"h-4 w-4"})})}),e]}));kle.displayName=cL.displayName;const i0=x.forwardRef(({className:t,children:e,...r},n)=>c.jsxs(uL,{ref:n,className:le("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),...r,children:[c.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:c.jsx(dL,{children:c.jsx(f4,{className:"h-2 w-2 fill-current"})})}),e]}));i0.displayName=uL.displayName;const gL=x.forwardRef(({className:t,inset:e,...r},n)=>c.jsx(sL,{ref:n,className:le("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...r}));gL.displayName=sL.displayName;const $u=x.forwardRef(({className:t,...e},r)=>c.jsx(fL,{ref:r,className:le("-mx-1 my-1 h-px bg-border",t),...e}));$u.displayName=fL.displayName;const Ale=[{label:"100%",value:"100%"},{label:"75%",value:"75%"},{label:"50%",value:"50%"},{label:"25%",value:"25%"}],Ele=[{label:"Left",value:"left",icon:T4},{label:"Center",value:"center",icon:VE},{label:"Right",value:"right",icon:M4}],Ple=({editor:t,children:e})=>{const[r,n]=x.useState(null),[i,a]=x.useState(!1),[o,s]=x.useState(!1),[l,u]=x.useState(""),d=x.useRef(null),f=x.useCallback(y=>{const w=t.view,_=w.posAtDOM(y,0);if(_==null)return!1;const j=w.state.doc.resolve(_),b=j.parent.type.name==="customImage"?j.parent:w.state.doc.nodeAt(_);return b?.type.name==="customImage"?(t.commands.setNodeSelection(_),n({width:b.attrs.width||"100%",align:b.attrs.align||"center"}),a(!0),!0):!1},[t]);x.useEffect(()=>{const y=d.current;if(!y)return;const w=_=>{const j=_.target;j.tagName==="IMG"&&y.contains(j)?f(j):a(!1)};return y.addEventListener("contextmenu",w,!0),()=>y.removeEventListener("contextmenu",w,!0)},[f]);const h=y=>{t.chain().focus().setImageSize({width:y}).run(),n(w=>w?{...w,width:y}:null)},p=y=>{t.chain().focus().setImageAlign({align:y}).run(),n(w=>w?{...w,align:y}:null)},m=()=>{t.commands.deleteSelection()},g=()=>{const y=r?.width||"100%";y.endsWith("px")?u(y.replace("px","")):u(""),s(!0)},v=()=>{const y=parseInt(l,10);y>0&&h(`${y}px`),s(!1)};return c.jsxs("div",{ref:d,children:[c.jsxs(Nle,{children:[c.jsx(Cle,{asChild:!0,children:e}),i&&r&&c.jsxs(mL,{className:"w-48",children:[c.jsx(gL,{children:"Image"}),c.jsx($u,{}),c.jsxs(aE,{children:[c.jsxs(t0,{children:[c.jsx(Y4,{className:"mr-2 h-4 w-4"}),"Size"]}),c.jsxs(r0,{children:[c.jsx(oE,{value:r.width,onValueChange:h,children:Ale.map(y=>c.jsx(i0,{value:y.value,children:y.label},y.value))}),c.jsx($u,{}),c.jsxs(n0,{onClick:g,children:[c.jsx(J4,{className:"mr-2 h-4 w-4"}),"Custom (px)â¦"]})]})]}),c.jsxs(aE,{children:[c.jsxs(t0,{children:[c.jsx(VE,{className:"mr-2 h-4 w-4"}),"Align"]}),c.jsx(r0,{children:c.jsx(oE,{value:r.align,onValueChange:p,children:Ele.map(y=>c.jsxs(i0,{value:y.value,children:[c.jsx(y.icon,{className:"mr-2 h-4 w-4"}),y.label]},y.value))})})]}),c.jsx($u,{}),c.jsxs(n0,{onClick:m,className:"text-destructive",children:[c.jsx(Ma,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]}),c.jsx(gn,{open:o,onOpenChange:s,children:c.jsxs(vn,{className:"max-w-xs",children:[c.jsxs(yn,{children:[c.jsx(xn,{children:"Set Image Width"}),c.jsx(dl,{children:"Enter a width in pixels. On mobile, images will always be full-width."})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(ne,{htmlFor:"pixel-width",children:"Width"}),c.jsx(fe,{id:"pixel-width",type:"number",min:50,max:2e3,value:l,onCh
169ange:y=>u(y.target.value),onKeyDown:y=>y.key==="Enter"&&v(),placeholder:"e.g. 400"}),c.jsx("span",{className:"text-sm text-muted-foreground",children:"px"})]}),c.jsxs(li,{children:[c.jsx(oe,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),c.jsx(oe,{onClick:v,children:"Apply"})]})]})})]})},Tle="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yac
169hts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Mle="ελ1Ï 2бг1ел3деÑи4еÑ2каÑолик6ом3мкд2он1Ñква6онлайн5Ñг3ÑÑÑ2Ñ2ÑайÑ3Ñб3ÑкÑ3Òаз3Õ°Õ¡Õµ3×שר××5×§××3Ø§Ø¨ÙØ¸Ø¨Ù5را٠ÙÙ5ÙØ§Ø±Ø¯Ù4Ø¨ØØ±ÙÙ5جزائر5Ø³Ø¹ÙØ¯ÙØ©6عÙÙØ§Ù5٠غرب5٠ارات5ÛØ±Ø§Ù5بارت2زار4ÙØªÙ3ھارت5تÙÙØ³4Ø³ÙØ¯Ø§Ù3Ø±ÙØ©5Ø´Ø¨ÙØ©4عراÙ2ب2٠اÙ4ÙÙØ³Ø·ÙÙ6ÙØ·Ø±3ÙØ§Ø«ÙÙÙÙ6ÙÙ 3٠صر2ÙÙØ³Ùا5ÙØ±ÙتاÙÙØ§7ÙØ¹4Ù٠راÙ5پاکستاÙ7ÚØ§Ø±Øª4à¤à¥à¤®3नà¥à¤3à¤à¤¾à¤°à¤¤0मà¥3à¥à¤¤5सà¤à¤à¤ न5বাà¦à¦²à¦¾5à¦à¦¾à¦°à¦¤2ৰত4à¨à¨¾à¨°à¨¤4àªàª¾àª°àª¤4à¬à¬¾à¬°à¬¤4à®à®¨à¯à®¤à®¿à®¯à®¾6லà®à¯à®à¯6à®à®¿à®à¯à®à®ªà¯à®ªà¯à®°à¯11à°à°¾à°°à°¤à±5à²à²¾à²°à²¤4à´à´¾à´°à´¤à´5à¶½à¶à¶à·4à¸à¸à¸¡3à¹à¸à¸¢3ລາວ3áá2ã¿ããª3ã¢ãã¾ã³4ã¯ã©ã¦ã4ã°ã¼ã°ã«4ã³ã 2ã¹ãã¢3ã»ã¼ã«3ãã¡ãã·ã§ã³6ãã¤ã³ã4ä¸ç2ä¸ä¿¡1å½1å1æç½3äºé©¬é3ä¼ä¸2ä½å±±2ä¿¡æ¯2å¥åº·2å «å¦2å ¬å¸1ç2å°æ¹¾1ç£2åå1åº1æ 2åé0大é åº5å¨çº¿2大æ¿2天主æ3娱ä¹2å®¶é»2广ä¸2å¾®å2æ å2æç±ä½ 3ææº2æè2æ¿å¡1åº2æ°å å¡2é»2æ¶å°2æ¸ç±2æºæ2淡马é¡3游æ2æ¾³é2ç¹ç2ç§»å¨2ç»ç»æºæ4ç½å1åº1ç«1ç»2èé2è°·æ2è´ç©2é販2éå¢2é»è¨çç§4é£å©æµ¦3é£å2é¤å 2馿 ¼éæ3港2ë·ë·1ì»´2ì¼ì±2íêµ2",a0="numeric",o0="ascii",s0="alpha",jl="asciinumeric",ul="alphanumeric",l0="domain",vL="emoji",Dle="scheme",Rle="slashscheme",Wy="whitespace";function Ile(t,e){return t in e||(e[t]=[]),e[t]}function Ta(t,e,r){e[a0]&&(e[jl]=!0,e[ul]=!0),e[o0]&&(e[jl]=!0,e[s0]=!0),e[jl]&&(e[ul]=!0),e[s0]&&(e[ul]=!0),e[ul]&&(e[l0]=!0),e[vL]&&(e[l0]=!0);for(const n in e){const i=Ile(n,r);i.indexOf(t)<0&&i.push(t)}}function $le(t,e){const r={};for(const n in e)e[n].indexOf(t)>=0&&(r[n]=!0);return r}function Cr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Cr.groups={};Cr.prototype={accepts(){return!!this.t},go(t){const e=this,r=e.j[t];if(r)return r;for(let n=0;n<e.jr.length;n++){const i=e.jr[n][0],a=e.jr[n][1];if(a&&i.test(t))return a}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,r,n){for(let i=0;i<t.length;i++)this.tt(t[i],e,r,n)},tr(t,e,r,n){n=n||Cr.groups;let i;return e&&e.j?i=e:(i=new Cr(e),r&&n&&Ta(e,r,n)),this.jr.push([t,i]),i},ts(t,e,r,n){let i=this;const a=t.length;if(!a)return i;for(let o=0;o<a-1;o++)i=i.tt(t[o]);return i.tt(t[a-1],e,r,n)},tt(t,e,r,n){n=n||Cr.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const a=e;let o,s=i.go(t);if(s?(o=new Cr,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new Cr,a){if(n)if(o.t&&typeof o.t=="string"){const l=Object.assign($le(o.t,n),r);Ta(a,l,n)}else r&&Ta(a,r,n);o.t=a}return i.j[t]=o,o}};const Be=(t,e,r,n,i)=>t.ta(e,r,n,i),_t=(t,e,r,n,i)=>t.tr(e,r,n,i),sE=(t,e,r,n,i)=>t.ts(e,r,n,i),ee=(t,e,r,n,i)=>t.tt(e,r,n,i),ni="WORD",c0="UWORD",yL="ASCIINUMERICAL",xL="ALPHANUMERICAL",Sc="LOCALHOST",u0="TLD",d0="UTLD",Lu="SCHEME",Co="SLASH_SCHEME",S1="NUM",f0="WS",j1="NL",Ol="OPENBRACE",Nl="CLOSEBRACE",yf="OPENBRACKET",xf="CLOSEBRACKET",bf="OPENPAREN",wf="CLOSEPAREN",_f="OPENANGLEBRACKET",Sf="CLOSEANGLEBRACKET",jf="FULLWIDTHLEFTPAREN",Of="FULLWIDTHRIGHTPAREN",Nf="LEFTCORNERBRACKET",Cf="RIGHTCORNERBRACKET",kf="LEFTWHITECORNERBRACKET",Af="RIGHTWHITECORNERBRACKET",Ef="FULLWIDTHLESSTHAN",Pf="FULLWIDTHGREATERTHAN",Tf="AMPERSAND",Mf="APOSTROPHE",Df="ASTERISK",Ii="AT",Rf="BACKSLASH",If="BACKTICK",$f="CARET",Bi="COLON",O1="COMMA",Lf="DOLLAR",Tn="DOT",Bf="EQUALS",N1="EXCLAMATION",Qr="HYPHEN",Cl="PERCENT",Ff="PIPE",zf="PLUS",qf="POUND",kl="QUERY",C1="QUOTE",bL="FULLWIDTHMIDDLEDOT",k1="SEMI",Mn="SLASH",Al="TILDE",Uf="UNDERSCORE",wL="EMOJI",Hf="SYM";var _L=Object.freeze({__proto__:null,ALPHANUMERICAL:xL,AMPERSAND:Tf,APOSTROPHE:Mf,ASCIINUMERICAL:yL,ASTERISK:Df,AT:Ii,BACKSLASH:Rf,BACKTICK:If,CARET:$f,CLOSEANGLEBRACKET:Sf,CLOSEBRACE:Nl,CLOSEBRACKET:xf,CLOSEPAREN:wf,COLON:Bi,COMMA:O1,DOLLAR:Lf,DOT:Tn,EMOJI:wL,EQUALS:Bf,EXCLAMATION:N1,FULLWIDTHGREATERTHAN:Pf,FULLWIDTHLEFTPAREN:jf,FULLWIDTHLESSTHAN:Ef,FULLWIDTHMIDDLEDOT:bL,FULLWIDTHRIGHTPAREN:Of,HYPHEN:Qr,LEFTCORNERBRACKET:Nf,LEFTWHITECORNERBRACKET:kf,LOCALHOST:Sc,NL:j1,NUM:S1,OPENANGLEBRACKET:_f,OPENBRACE:Ol,OPENBRACKET:yf,OPENPAREN:bf,PERCENT:Cl,PIPE:Ff,PLUS:zf,POUND:qf,QUERY:kl,QUOTE:C1,RIGHTCORNERBRACKET:Cf,RIGHTWHITECORNERBRACKET:Af,SCHEME:Lu,SEMI:k1,SLASH:Mn,SLASH_SCHEME:Co,SYM:Hf,TILDE:Al,TLD:u0,UNDERSCORE:Uf,UTLD:d0,UWORD:c0,WORD:ni,WS:f0});const ti=/[a-z]/,rl=new RegExp("\\p{L}","u"),Vy=new RegExp("\\p{Emoji}","u"),ri=/\d/,Ky=/\s/,lE="\r",Gy=` 170`,Lle="ï¸",Ble="â",Yy="";let Su=null,ju=null;function Fle(t=[]){const e={};Cr.groups=e;const r=new Cr;Su==null&&(Su=cE(Tle)),ju==null&&(ju=cE(Mle)),ee(r,"'",Mf),ee(r,"{",Ol),ee(r,"}",Nl),ee(r,"[",yf),ee(r,"]",xf),ee(r,"(",bf),ee(r,")",wf),ee(r,"<",_f),ee(r,">",Sf),ee(r,"ï¼",jf),ee(r,"ï¼",Of),ee(r,"ã",Nf),ee(r,"ã",Cf),ee(r,"ã",kf),ee(r,"ã",Af),ee(r,"ï¼",Ef),ee(r,"ï¼",Pf),ee(r,"&",Tf),ee(r,"*",Df),ee(r,"@",Ii),ee(r,"`",If),ee(r,"^",$f),ee(r,":",Bi),ee(r,",",O1),ee(r,"$",Lf),ee(r,".",Tn),ee(r,"=",Bf),ee(r,"!",N1),ee(r,"-",Qr),ee(r,"%",Cl),ee(r,"|",Ff),ee(r,"+",zf),ee(r,"#",qf),ee(r,"?",kl),ee(r,'"',C1),ee(r,"/",Mn),ee(r,";",k1),ee(r,"~",Al),ee(r,"_",Uf),ee(r,"\\",Rf),ee(r,"ã»",bL);const n=_t(r,ri,S1,{[a0]:!0});_t(n,ri,n);const i=_t(n,ti,yL,{[jl]:!0}),a=_t(n,rl,xL,{[ul]:!0}),o=_t(r,ti,ni,{[o0]:!0});_t(o,ri,i),_t(o,ti,o),_t(i,ri,i),_t(i,ti,i);const s=_t(r,rl,c0,{[s0]:!0});_t(s,ti),_t(s,ri,a),_t(s,rl,s),_t(a,ri,a),_t(a,ti),_t(a,rl,a);const l=ee(r,Gy,j1,{[Wy]:!0}),u=ee(r,lE,f0,{[Wy]:!0}),d=_t(r,Ky,f0,{[Wy]:!0});ee(r,Yy,d),ee(u,Gy,l),ee(u,Yy,d),_t(u,Ky,d),ee(d,lE),ee(d,Gy),_t(d,Ky,d),ee(d,Yy,d);const f=_t(r,Vy,wL,{[vL]:!0});ee(f,"#"),_t(f,Vy,f),ee(f,Lle,f);const h=ee(f,Ble);ee(h,"#"),_t(h,Vy,f);const p=[[ti,o],[ri,i]],m=[[ti,null],[rl,s],[ri,a]];for(let g=0;g<Su.length;g++)Pi(r,Su[g],u0,ni,p);for(let g=0;g<ju.length;g++)Pi(r,ju[g],d0,c0,m);Ta(u0,{tld:!0,ascii:!0},e),Ta(d0,{utld:!0,alpha:!0},e),Pi(r,"file",Lu,ni,p),Pi(r,"mailto",Lu,ni,p),Pi(r,"http",Co,ni,p),Pi(r,"https",Co,ni,p),Pi(r,"ftp",Co,ni,p),Pi(r,"ftps",Co,ni,p),Ta(Lu,{scheme:!0,ascii:!0},e),Ta(Co,{slashscheme:!0,ascii:!0},e),t=t.sort((g,v)=>g[0]>v[0]?1:-1);for(let g=0;g<t.length;g++){const v=t[g][0],w=t[g][1]?{[Dle]:!0}:{[Rle]:!0};v.indexOf("-")>=0?w[l0]=!0:ti.test(v)?ri.test(v)?w[jl]=!0:w[o0]=!0:w[a0]=!0,sE(r,v,v,
vendor: 5,490 bytes, line 170
170w)}return sE(r,"localhost",Sc,{ascii:!0}),r.jd=new Cr(Hf),{start:r,tokens:Object.assign({groups:e},_L)}}function SL(t,e){const r=zle(e.replace(/[A-Z]/g,s=>s.toLowerCase())),n=r.length,i=[];let a=0,o=0;for(;o<n;){let s=t,l=null,u=0,d=null,f=-1,h=-1;for(;o<n&&(l=s.go(r[o]));)s=l,s.accepts()?(f=0,h=0,d=s):f>=0&&(f+=r[o].length,h++),u+=r[o].length,a+=r[o].length,o++;a-=f,o-=h,u-=f,i.push({t:d.t,v:e.slice(a-u,a),s:a-u,e:a})}return i}function zle(t){const e=[],r=t.length;let n=0;for(;n<r;){let i=t.charCodeAt(n),a,o=i<55296||i>56319||n+1===r||(a=t.charCodeAt(n+1))<56320||a>57343?t[n]:t.slice(n,n+2);e.push(o),n+=o.length}return e}function Pi(t,e,r,n,i){let a;const o=e.length;for(let s=0;s<o-1;s++){const l=e[s];t.j[l]?a=t.j[l]:(a=new Cr(n),a.jr=i.slice(),t.j[l]=a),t=a}return a=new Cr(r),a.jr=i.slice(),t.j[e[o-1]]=a,a}function cE(t){const e=[],r=[];let n=0,i="0123456789";for(;n<t.length;){let a=0;for(;i.indexOf(t[n+a])>=0;)a++;if(a>0){e.push(r.join(""));for(let o=parseInt(t.substring(n,n+a),10);o>0;o--)r.pop();n+=a}else r.push(t[n]),n++}return e}const jc={defaultProtocol:"http",events:null,format:uE,formatHref:uE,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function A1(t,e=null){let r=Object.assign({},jc);t&&(r=Object.assign(r,t instanceof A1?t.o:t));const n=r.ignoreTags,i=[];for(let a=0;a<n.length;a++)i.push(n[a].toUpperCase());this.o=r,e&&(this.defaultRender=e),this.ignoreTags=i}A1.prototype={o:jc,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,r){const n=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=r.t in i?i[r.t]:jc[t],typeof i=="function"&&n&&(i=i(e,r))):typeof i=="function"&&n&&(i=i(e,r.t,r)),i)},getObj(t,e,r){let n=this.o[t];return typeof n=="function"&&e!=null&&(n=n(e,r.t,r)),n},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function uE(t){return t}function jL(t,e){this.t="token",this.v=t,this.tk=e}jL.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),r=t.get("truncate",e,this),n=t.get("format",e,this);return r&&n.length>r?n.substring(0,r)+"â¦":n},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=jc.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,r=this.toHref(t.get("defaultProtocol")),n=t.get("formatHref",r,this),i=t.get("tagName",r,e),a=this.toFormattedString(t),o={},s=t.get("className",r,e),l=t.get("target",r,e),u=t.get("rel",r,e),d=t.getObj("attributes",r,e),f=t.getObj("events",r,e);return o.href=n,s&&(o.class=s),l&&(o.target=l),u&&(o.rel=u),d&&Object.assign(o,d),{tagName:i,attributes:o,content:a,eventListeners:f}}};function rp(t,e){class r extends jL{constructor(i,a){super(i,a),this.t=t}}for(const n in e)r.prototype[n]=e[n];return r.t=t,r}const dE=rp("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),fE=rp("text"),qle=rp("nl"),Ou=rp("url",{isLink:!0,toHref(t=jc.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Sc&&t[1].t===Bi}}),Zr=t=>new Cr(t);function Ule({groups:t}){const e=t.domain.concat([Tf,Df,Ii,Rf,If,$f,Lf,Bf,Qr,S1,Cl,Ff,zf,qf,Mn,Hf,Al,Uf]),r=[Mf,Bi,O1,Tn,N1,Cl,kl,C1,k1,_f,Sf,Ol,Nl,xf,yf,bf,wf,jf,Of,Nf,Cf,kf,Af,Ef,Pf],n=[Tf,Mf,Df,Rf,If,$f,Lf,Bf,Qr,Ol,Nl,Cl,Ff,zf,qf,kl,Mn,Hf,Al,Uf],i=Zr(),a=ee(i,Al);Be(a,n,a),Be(a,t.domain,a);const o=Zr(),s=Zr(),l=Zr();Be(i,t.domain,o),Be(i,t.scheme,s),Be(i,t.slashscheme,l),Be(o,n,a),Be(o,t.domain,o);const u=ee(o,Ii);ee(a,Ii,u),ee(s,Ii,u),ee(l,Ii,u);const d=ee(a,Tn);Be(d,n,a),Be(d,t.domain,a);const f=Zr();Be(u,t.domain,f),Be(f,t.domain,f);const h=ee(f,Tn);Be(h,t.domain,f);const p=Zr(dE);Be(h,t.tld,p),Be(h,t.utld,p),ee(u,Sc,p);const m=ee(f,Qr);ee(m,Qr,m),Be(m,t.domain,f),Be(p,t.domain,f),ee(p,Tn,h),ee(p,Qr,m);const g=ee(p,Bi);Be(g,t.numeric,dE);const v=ee(o,Qr),y=ee(o,Tn);ee(v,Qr,v),Be(v,t.domain,o),Be(y,n,a),Be(y,t.domain,o);const w=Zr(Ou);Be(y,t.tld,w),Be(y,t.utld,w),Be(w,t.domain,o),Be(w,n,a),ee(w,Tn,y),ee(w,Qr,v),ee(w,Ii,u);const _=ee(w,Bi),j=Zr(Ou);Be(_,t.numeric,j);const b=Zr(Ou),O=Zr();Be(b,e,b),Be(b,r,O),Be(O,e,b),Be(O,r,O),ee(w,Mn,b),ee(j,Mn,b);const S=ee(s,Bi),N=ee(l,Bi),C=ee(N,Mn),T=ee(C,Mn);Be(s,t.domain,o),ee(s,Tn,y),ee(s,Qr,v),Be(l,t.domain,o),ee(l,Tn,y),ee(l,Qr,v),Be(S,t.domain,b),ee(S,Mn,b),ee(S,kl,b),Be(T,t.domain,b),Be(T,e,b),ee(T,Mn,b);const k=[[Ol,Nl],[yf,xf],[bf,wf],[_f,Sf],[jf,Of],[Nf,Cf],[kf,Af],[Ef,Pf]];for(let M=0;M<k.length;M++){const[E,L]=k[M],R=ee(b,E);ee(O,E,R),ee(R,L,b);const I=Zr(Ou);Be(R,e,I);const $=Zr();Be(R,r),Be(I,e,I),Be(I,r,$),Be($,e,I),Be($,r,$),ee(I,L,b),ee($,L,b)}return ee(i,Sc,w),ee(i,j1,qle),{start:i,tokens:_L}}function Hle(t,e,r){let n=r.length,i=0,a=[],o=[];for(;i<n;){let s=t,l=null,u=null,d=0,f=null,h=-1;for(;i<n&&!(l=s.go(r[i].t));)o.push(r[i++]);for(;i<n&&(u=l||s.go(r[i].t));)l=null,s=u,s.accepts()?(h=0,f=s):h>=0&&h++,i++,d++;if(h<0)i-=d,i<n&&(o.push(r[i]),i++);else{o.length>
vendor: 4,200 bytes, lines 170-173
1700&&(a.push(Xy(fE,e,o)),o=[]),i-=h,d-=h;const p=f.t,m=r.slice(i-d,i);a.push(Xy(p,e,m))}}return o.length>0&&a.push(Xy(fE,e,o)),a}function Xy(t,e,r){const n=r[0].s,i=r[r.length-1].e,a=e.slice(n,i);return new t(a,r)}const Wle=typeof console<"u"&&console&&console.warn||(()=>{}),Vle="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ft={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Kle(){return Cr.groups={},ft.scanner=null,ft.parser=null,ft.tokenQueue=[],ft.pluginQueue=[],ft.customSchemes=[],ft.initialized=!1,ft}function hE(t,e=!1){if(ft.initialized&&Wle(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Vle}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. 1711. Must only contain digits, lowercase ASCII letters or "-" 1722. Cannot start or end with "-" 1733. "-" cannot repeat`);ft.customSchemes.push([t,e])}function Gle(){ft.scanner=Fle(ft.customSchemes);for(let t=0;t<ft.tokenQueue.length;t++)ft.tokenQueue[t][1]({scanner:ft.scanner});ft.parser=Ule(ft.scanner.tokens);for(let t=0;t<ft.pluginQueue.length;t++)ft.pluginQueue[t][1]({scanner:ft.scanner,parser:ft.parser});return ft.initialized=!0,ft}function E1(t){return ft.initialized||Gle(),Hle(ft.parser.start,t,SL(ft.scanner.start,t))}E1.scan=SL;function OL(t,e=null,r=null){if(e&&typeof e=="object"){if(r)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);r=e,e=null}const n=new A1(r),i=E1(t),a=[];for(let o=0;o<i.length;o++){const s=i[o];s.isLink&&(!e||s.t===e)&&n.check(s)&&a.push(s.toFormattedObject(n))}return a}function Yle(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Xle(t){return new Jt({key:new Dr("autolink"),appendTransaction:(e,r,n)=>{const i=e.some(u=>u.docChanged)&&!r.doc.eq(n.doc),a=e.some(u=>u.getMeta("preventAutolink"));if(!i||a)return;const{tr:o}=n,s=Wae(r.doc,[...e]);if(Qae(s).forEach(({newRange:u})=>{const d=Kae(n.doc,u,p=>p.isTextblock);let f,h;if(d.length>1?(f=d[0],h=n.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ")):d.length&&n.doc.textBetween(u.from,u.to," "," ").endsWith(" ")&&(f=d[0],h=n.doc.textBetween(f.pos,u.to,void 0," ")),f&&h){const p=h.split(" ").filter(y=>y!=="");if(p.length<=0)return!1;const m=p[p.length-1],g=f.pos+h.lastIndexOf(m);if(!m)return!1;const v=E1(m).map(y=>y.toObject(t.defaultProtocol));if(!Yle(v))return!1;v.filter(y=>y.isLink).map(y=>({...y,from:g+y.start+1,to:g+y.end+1})).filter(y=>n.schema.marks.code?!n.doc.rangeHasMark(y.from,y.to,n.schema.marks.code):!0).filter(y=>t.validate(y.value)).filter(y=>t.shouldAutoLink(y.value)).forEach(y=>{y1(y.from,y.to,n.doc).some(w=>w.mark.type===t.type)||o.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function Jle(t){return new Jt({key:new Dr("handleClickLink"),props:{handleClick:(e,r,n)=>{var i,a;if(n.button!==0||!e.editable)return!1;let o=n.target;const s=[];for(;o.nodeName!=="DIV";)s.push(o),o=o.parentNode;if(!s.find(h=>h.nodeName==="A"))return!1;const l=M$(e.state,t.type.name),u=n.target,d=(i=u?.href)!==null&&i!==void 0?i:l.href,f=(a=u?.target)!==null&&a!==void 0?a:l.target;return u&&d?(window.open(d,f),!0):!1}}})}function Zle(t){return new Jt({key:new Dr("handlePasteLink"),props:{handlePaste:(e,r,n)=>{const{state:i}=e,{selection:a}=i,{empty:o}=a;if(o)return!1;let s="";n.content.forEach(u=>{s+=u.textContent});const l=OL(s,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===s);return!s||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}const Qle=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function xa(t,e){const r=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(n=>{const i=typeof n=="string"?n:n.scheme;i&&r.push(i)}),!t||t.replace(Qle,"").match(new RegExp(`^(?:(?:${r.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const ece=Si.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `val
173idate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){hE(t);return}hE(t.scheme,t.optionalSlashes)})},onDestroy(){Kle()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!xa(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:r=>!!xa(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!xa(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ft(this.options.HTMLAttributes,t),0]:["a",Ft(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:r}=t;return this.options.isAllowedUri(r,{defaultValidate:n=>!!xa(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:r}=t;return this.options.isAllowedUri(r,{defaultValidate:n=>!!xa(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[ro({find:t=>{const e=[];if(t){const{protocols:r,defaultProtocol:n}=this.options,i=OL(t).filter(a=>a.isLink&&this.options.isAllowedUri(a.value,{defaultValidate:o=>!!xa(o,r),protocols:r,defaultProtocol:n}));i.length&&i.forEach(a=>e.push({text:a.value,data:{href:a.href},index:a.start}))}return e}
173,type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:r}=this.options;return this.options.autolink&&t.push(Xle({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:n=>this.options.isAllowedUri(n,{defaultValidate:i=>!!xa(i,e),protocols:e,defaultProtocol:r}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Jle({type:this.type})),this.options.linkOnPaste&&t.push(Zle({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),tce=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/,rce=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/g,NL=t=>t.match(tce),pE=(t,e)=>e?"https://www.youtube-nocookie.com/embed/videoseries?list=":t?"https://www.youtube-nocookie.com/embed/":"https://www.youtube.com/embed/",nce=t=>{const{url:e,allowFullscreen:r,autoplay:n,ccLanguage:i,ccLoadPolicy:a,controls:o,disableKBcontrols:s,enableIFrameApi:l,endTime:u,interfaceLanguage:d,ivLoadPolicy:f,loop:h,modestBranding:p,nocookie:m,origin:g,playlist:v,progressBarColor:y,startAt:w,rel:_}=t;if(!NL(e))return null;if(e.includes("/embed/"))return e;if(e.includes("youtu.be")){const N=e.split("/").pop();return N?`${pE(m)}${N}`:null}const b=/(?:(v|list)=|shorts\/)([-\w]+)/gm.exec(e);if(!b||!b[2])return null;let O=`${pE(m,b[1]==="list")}${b[2]}`;const S=[];return r===!1&&S.push("fs=0"),n&&S.push("autoplay=1"),i&&S.push(`cc_lang_pref=${i}`),a&&S.push("cc_load_policy=1"),o||S.push("controls=0"),s&&S.push("disablekb=1"),l&&S.push("enablejsapi=1"),u&&S.push(`end=${u}`),d&&S.push(`hl=${d}`),f&&S.push(`iv_load_policy=${f}`),h&&S.push("loop=1"),p&&S.push("modestbranding=1"),g&&S.push(`origin=${g}`),v&&S.push(`playlist=${v}`),w&&S.push(`start=${w}`),y&&S.push(`color=${y}`),_!==void 0&&S.push(`rel=${_}`),S.length&&(O+=`${b[1]==="v"?"?":"&"}${S.join("&")}`),O},ice=fr.create({name:"youtube",addOptions(){return{addPasteHandler:!0,allowFullscreen:!0,autoplay:!1,ccLanguage:void 0,ccLoadPolicy:void 0,controls:!0,disableKBcontrols:!1,enableIFrameApi:!1,endTime:0,height:480,interfaceLanguage:void 0,ivLoadPolicy:0,loop:!1,modestBranding:!1,HTMLAttributes:{},inline:!1,nocookie:!1,origin:"",playlist:"",progressBarColor:void 0,width:640,rel:1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},start:{default:0},width:{default:this.options.width},height:{default:this.options.height}}},parseHTML(){return[{tag:"div[data-youtube-video] iframe"}]},addCommands(){return{setYoutubeVideo:t=>({commands:e})=>NL(t.src)?e.insertContent({type:this.name,attrs:t}):!1}},addPasteRules(){return this.options.addPasteHandler?[Moe({find:rce,type:this.type,getAttributes:t=>({src:t.input})})]:[]},renderHTML({HTMLAttributes:t}){const e=nce({url:t.src,allowFullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,controls:this.options.controls,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,nocookie:this.options.nocookie,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,startAt:t.start||0,rel:this.options.rel});return t.src=e,["div",{"data-youtube-video":""},["iframe",Ft(this.options.HTMLAttributes,{width:this.options.width,height:this.options.height,allowfullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,rel:this.options.rel},t)]]}}),ace=dr.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something â¦",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Jt({key:new Dr("placeholder"),props:{decorations:({doc:t,selection:e})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=e,i=[];if(!r)return null;const a=this.editor.isEmpty;
173return t.descendants((o,s)=>{const l=n>=s&&n<=s+o.nodeSize,u=!o.isLeaf&&tp(o);if((l||!this.options.showOnlyCurrent)&&u){const d=[this.options.emptyNodeClass];a&&d.push(this.options.emptyEditorClass);const f=qr.node(s,s+o.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:s,hasAnchor:l}):this.options.placeholder});i.push(f)}return this.options.includeChildren}),Et.create(t,i)}}})]}}),oce=({content:t,onChange:e})=>{const{toast:r}=Pr(),n=x.useRef(null),[i,a]=x.useState(!1),[o,s]=x.useState(""),[l,u]=x.useState(!1),[d,f]=x.useState(""),h=Joe({extensions:[ele,ile.configure({inline:!1,allowBase64:!1}),ece.configure({openOnClick:!1}),ice.configure({width:640,height:480}),ace.configure({placeholder:"Write your article content here..."})],content:t,onUpdate:({editor:_})=>{e(_.getHTML())}});x.useEffect(()=>{h&&t!==h.getHTML()&&h.commands.setContent(t)},[t]);const p=x.useCallback(async _=>{if(_.size>10*1024*1024){r({title:"File too large",description:"Max 10MB",variant:"destructive"});return}try{const j=_.name.split(".").pop(),b=`articles/${Date.now()}-${Math.random().toString(36).substring(7)}.${j}`,{error:O}=await et.storage.from("content-media").upload(b,_);if(O)throw O;const{data:{publicUrl:S}}=et.storage.from("content-media").getPublicUrl(b);h?.chain().focus().setImage({src:S}).run()}catch(j){r({title:"Upload failed",description:j.message,variant:"destructive"})}},[h,r]),m=()=>n.current?.click(),g=()=>{const _=h?.getAttributes("link").href||"";s(_),a(!0)},v=()=>{o&&h?.chain().focus().setLink({href:o}).run(),a(!1),s("")},y=()=>{f(""),u(!0)},w=()=>{if(!d){u(!1);return}const _=d.match(/tella\.tv\/video\/([a-zA-Z0-9_-]+)/);_?h?.commands.insertContent(`<div data-tella-video><iframe src="https://www.tella.tv/video/${_[1]}/embed" width="640" height="360" frameborder="0" allowfullscreen></iframe></div>`):h?.chain().focus().setYoutubeVideo({src:d}).run(),u(!1),f("")};return h?c.jsxs("div",{className:"border rounded-md",children:[c.jsx("input",{type:"file",ref:n,className:"hidden",accept:"image/*",onChange:_=>{const j=_.target.files?.[0];j&&p(j),_.target.value=""}}),c.jsxs("div",{className:"flex flex-wrap gap-1 p-2 border-b bg-muted/30",children:[c.jsx(xr,{onClick:()=>h.chain().focus().toggleBold().run(),active:h.isActive("bold"),icon:R4}),c.jsx(xr,{onClick:()=>h.chain().focus().toggleItalic().run(),active:h.isActive("italic"),icon:H4}),c.jsx("div",{className:"w-px bg-border mx-1"}),c.jsx(xr,{onClick:()=>h.chain().focus().toggleHeading({level:1}).run(),active:h.isActive("heading",{level:1}),icon:z4}),c.jsx(xr,{onClick:()=>h.chain().focus().toggleHeading({level:2}).run(),active:h.isActive("heading",{level:2}),icon:q4}),c.jsx(xr,{onClick:()=>h.chain().focus().toggleHeading({level:3}).run(),active:h.isActive("heading",{level:3}),icon:U4}),c.jsx("div",{className:"w-px bg-border mx-1"}),c.jsx(xr,{onClick:()=>h.chain().focus().toggleBulletList().run(),active:h.isActive("bulletList"),icon:G4}),c.jsx(xr,{onClick:()=>h.chain().focus().toggleOrderedList().run(),active:h.isActive("orderedList"),icon:K4}),c.jsx(xr,{onClick:()=>h.chain().focus().toggleBlockquote().run(),active:h.isActive("blockquote"),icon:C4}),c.jsx(xr,{onClick:()=>h.chain().focus().toggleCodeBlock().run(),active:h.isActive("codeBlock"),icon:B4}),c.jsx(xr,{onClick:()=>h.chain().focus().setHorizontalRule().run(),icon:k4}),c.jsx("div",{className:"w-px bg-border mx-1"}),c.jsx(xr,{onClick:m,icon:A4}),c.jsx(xr,{onClick:g,active:h.isActive("link"),icon:V4}),c.jsx(xr,{onClick:y,icon:nB}),c.jsx("div",{className:"w-px bg-border mx-1"}),c.jsx(xr,{onClick:()=>h.chain().focus().undo().run(),icon:tB}),c.jsx(xr,{onClick:()=>h.chain().focus().redo().run(),icon:X4})]}),c.jsx(Ple,{editor:h,children:c.jsx(zoe,{editor:h,className:"prose prose-sm max-w-none p-4 min-h-[300px] focus:outline-none [&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[280px]"})}),c.jsx(gn,{open:i,onOpenChange:a,children:c.jsxs(vn,{className:"sm:max-w-md",children:[c.jsx(yn,{children:c.jsx(xn,{children:"Insert Link"})}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{htmlFor:"link-url",children:"URL"}),c.jsx(fe,{id:"link-url",placeholder:"https://example.com",value:o,onChange:_=>s(_.target.value),onKeyDown:_=>_.key==="Enter"&&v(),autoFocus:!0})]}),c.jsxs(li,{children:[c.jsx(oe,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),c.jsx(oe,{onClick:v,children:"Insert"})]})]})}),c.jsx(gn,{open:l,onOpenChange:u,children:c.jsxs(vn,{className:"sm:max-w-md",children:[c.jsx(yn,{children:c.jsx(xn,{children:"Embed Video"})}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{htmlFor:"video-url",children:"Video URL"}),c.jsx(fe,{id:"video-url",placeholder:"YouTube or Tella.tv URL",value:d,onChange:_=>f(_.target.value),onKeyDown:_=>_.key==="Enter"&&w(),autoFocus:!0}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"Supports YouTube and Tella.tv links"})]}),c.jsxs(li,{children:[c.jsx(oe,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),c.jsx(oe,{onClick:w,children:"Embed"})]})]})})]}):null},xr=({onClick:t,active:e,icon:r})=>c.jsx(oe,{type:"button",variant:e?"secondary":"ghost",size:"sm",onClick:t,className:"h-8 w-8 p-0",children:c.jsx(r,{className:"h-4 w-4"})}),mE=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),sce=({articleId:t,onBack:e,onSaved:r})=>{const{toast:n}=Pr(),[i,a]=x.useState(!1),[o,s]=x.useState(!1),[l,u]=x.useState([]),[d,f]=x.use
173State([]),[h,p]=x.useState(!1),[m,g]=x.useState(null),[v,y]=x.useState(!1),[w,_]=x.useState(""),[j,b]=x.useState(!1),O=["en","fr","de","it"],S={en:"English",fr:"Français",de:"Deutsch",it:"Italiano"},N=async A=>{if(!t){n({title:"Save first",description:"Please save the article before translating.",variant:"destructive"});return}g(A);try{const{data:F,error:V}=await et.functions.invoke("translate-article",{body:{articleId:t,targetLanguage:A}});if(V)throw V;if(F?.error)throw new Error(F.error);n({title:"Translated!",description:`Created/updated ${S[A]} version: "${F.title}"`})}catch(F){n({title:"Translation failed",description:F.message,variant:"destructive"})}finally{g(null)}},C=async()=>{if(!t){n({title:"Save first",description:"Please save the article before translating.",variant:"destructive"});return}const A=O.filter(F=>F!==k.language);for(const F of A){g(F);try{const{data:V,error:te}=await et.functions.invoke("translate-article",{body:{articleId:t,targetLanguage:F}});if(te)throw te;if(V?.error)throw new Error(V.error);n({title:`${S[F]} â`,description:`"${V.title}"`})}catch(V){n({title:`${S[F]} failed`,description:V.message,variant:"destructive"});break}}g(null)},T=async()=>{if(w.trim()){b(!0);try{const{data:A,error:F}=await et.functions.invoke("import-notion-page",{body:{url:w.trim()}});if(F)throw F;if(A?.error)throw new Error(A.error);M(V=>({...V,title:A.title||V.title,slug:A.title?mE(A.title):V.slug,content:A.content||V.content,cover_image_url:A.coverImageUrl||V.cover_image_url,excerpt:A.excerpt||V.excerpt,language:A.detectedLanguage||V.language})),y(!1),_(""),n({title:"Imported!",description:`"${A.title}" imported from Notion with images.`})}catch(A){n({title:"Import failed",description:A.message,variant:"destructive"})}finally{b(!1)}}},[k,M]=x.useState({type:"resource",title:"",subtitle:"",excerpt:"",slug:"",content:"",cover_image_url:"",language:"en",author_id:"",category:"",tags:[],publication_date:new Date,publish_after:null,expire_at:null,news_subtype:"",event_date:null,event_location:"",is_published:!1,display_order:0,seo_title:"",seo_description:""});x.useEffect(()=>{E()},[t]);const E=async()=>{a(!0);try{const[A,F]=await Promise.all([et.from("profiles").select("id, first_name, last_name, job_title"),et.from("article_categories").select("*").order("display_order")]);if(A.data&&u(A.data),F.data&&f(F.data),t){const{data:V,error:te}=await et.from("articles").select("*").eq("id",t).single();if(te)throw te;V&&M({type:V.type,title:V.title,subtitle:V.subtitle||"",excerpt:V.excerpt||"",slug:V.slug,content:V.content,cover_image_url:V.cover_image_url||"",language:V.language,author_id:V.author_id||"",category:V.category||"",tags:V.tags||[],publication_date:new Date(V.publication_date),publish_after:V.publish_after?new Date(V.publish_after):null,expire_at:V.expire_at?new Date(V.expire_at):null,news_subtype:V.news_subtype||"",event_date:V.event_date?new Date(V.event_date):null,event_location:V.event_location||"",is_published:V.is_published,display_order:V.display_order,seo_title:V.seo_title||"",seo_description:V.seo_description||""})}}catch(A){n({title:"Error",description:A.message,variant:"destructive"})}finally{a(!1)}},L=A=>{M(F=>({...F,title:A,slug:t?F.slug:mE(A)}))},R=async A=>{const F=A.target.files?.[0];if(F){if(F.size>10*1024*1024){n({title:"File too large",description:"Max 10MB",variant:"destructive"});return}p(!0);try{const V=F.name.split(".").pop(),te=`covers/${Date.now()}-${Math.random().toString(36).substring(7)}.${V}`,{error:B}=await et.storage.from("content-media").upload(te,F);if(B)throw B;const{data:{publicUrl:G}}=et.storage.from("content-media").getPublicUrl(te);M(se=>({...se,cover_image_url:G}))}catch(V){n({title:"Upload failed",description:V.message,variant:"destructive"})}finally{p(!1)}}},I=A=>{const V=A.replace(/<[^>]*>/g,"").split(/\s+/).filter(Boolean).length;return Math.max(1,Math.ceil(V/200))},$=async()=>{if(!k.title||!k.slug){n({title:"Error",description:"Title and slug are required",variant:"destructive"});return}s(!0);try{const{data:{user:A}}=await et.auth.getUser(),F=I(k.content),V={type:k.type,title:k.title,subtitle:k.subtitle||null,excerpt:k.excerpt||null,slug:k.slug,content:k.content,cover_image_url:k.cover_image_url||null,language:k.language,author_id:k.author_id||null,category:k.category||null,tags:k.tags.length>0?k.tags:null,reading_time_minutes:F,publication_date:k.publication_date.toISOString(),publish_after:k.publish_after?.toISOString()||null,expire_at:k.expire_at?.toISOString()||null,news_subtype:k.type==="news"&&k.news_subtype||null,event_date:k.event_date?.toISOString().split("T")[0]||null,event_location:k.event_location||null,is_published:k.is_published,display_order:k.display_order,seo_title:k.seo_title||null,seo_description:k.seo_description||null,updated_by:A?.id};if(t){const{error:te}=await et.from("articles").update(V).eq("id",t);if(te)throw te}else{const{error:te}=await et.from("articles").insert({...V,created_by:A?.id});if(te)throw te}n({title:"Success",description:`Article ${t?"updated":"created"} successfully`}),r()}catch(A){n({title:"Error",description:A.message,variant:"destructive"})}finally{s(!1)}};return i?c.jsx("div",{className:"flex items-center justify-center p-12",children:c.jsx(tt,{className:"w-8 h-8 animate-spin"})}):c.jsxs("div",{className:"space-y-6",children:[c.jsxs(oe,{variant:"ghost",onClick:e,className:"gap-2",children:[c.jsx(E4,{className:"w-4 h-4"})," Back to list"]}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[c.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[c.jsxs(ve,{children:[c.jsxs(Ce,{className:"flex flex-row items-center justify-between space-y-0",children:[c.jsx(ze,{children:t?"Edit Article":"New Art
173icle"}),c.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>y(!0),className:"gap-2",children:[c.jsx(Oc,{className:"w-4 h-4"})," Import from Notion"]})]}),c.jsxs(be,{className:"space-y-4",children:[c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{children:"Type"}),c.jsxs(Ht,{value:k.type,onValueChange:A=>M(F=>({...F,type:A})),children:[c.jsx(It,{children:c.jsx(Wt,{})}),c.jsxs($t,{children:[c.jsx(pe,{value:"resource",children:"Resource"}),c.jsx(pe,{value:"news",children:"News"})]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{children:"Language"}),c.jsxs(Ht,{value:k.language,onValueChange:A=>M(F=>({...F,language:A})),children:[c.jsx(It,{children:c.jsx(Wt,{})}),c.jsxs($t,{children:[c.jsx(pe,{value:"en",children:"English"}),c.jsx(pe,{value:"fr",children:"Français"}),c.jsx(pe,{value:"de",children:"Deutsch"}),c.jsx(pe,{value:"it",children:"Italiano"})]})]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{children:"Title"}),c.jsx(fe,{value:k.title,onChange:A=>L(A.target.value)})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{children:"Slug"}),c.jsx(fe,{value:k.slug,onChange:A=>M(F=>({...F,slug:A.target.value}))})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{children:"Subtitle"}),c.jsx(fe,{value:k.subtitle,onChange:A=>M(F=>({...F,subtitle:A.target.value}))})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{children:"Excerpt (used for cards & meta description)"}),c.jsx(zn,{value:k.excerpt,onChange:A=>M(F=>({...F,excerpt:A.target.value})),rows:3})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{children:"Content"}),c.jsx(oce,{content:k.content,onChange:A=>M(F=>({...F,content:A}))})]})]})]}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{children:"SEO Settings"})}),c.jsxs(be,{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{children:"SEO Title (overrides article title)"}),c.jsx(fe,{value:k.seo_title,onChange:A=>M(F=>({...F,seo_title:A.target.value})),placeholder:k.title}),c.jsxs("p",{className:"text-xs text-muted-foreground",children:[(k.seo_title||k.title).length,"/60 characters"]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{children:"SEO Description (overrides excerpt)"}),c.jsx(zn,{value:k.seo_description,onChange:A=>M(F=>({...F,seo_description:A.target.value})),placeholder:k.excerpt,rows:2}),c.jsxs("p",{className:"text-xs text-muted-foreground",children:[(k.seo_description||k.excerpt).length,"/160 characters"]})]})]})]})]}),c.jsxs("div",{className:"space-y-6",children:[c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{children:"Publishing"})}),c.jsxs(be,{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(ne,{children:"Published"}),c.jsx(v0,{checked:k.is_published,onCheckedChange:A=>M(F=>({...F,is_published:A}))})]}),c.jsx(Nu,{label:"Publication Date",value:k.publication_date,onChange:A=>M(F=>({...F,publication_date:A||new Date}))}),c.jsx(Nu,{label:"Do Not Publish Before",value:k.publish_after,onChange:A=>M(F=>({...F,publish_after:A})),clearable:!0}),c.jsx(Nu,{label:"Expires At",value:k.expire_at,onChange:A=>M(F=>({...F,expire_at:A})),clearable:!0}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{children:"Display Order"}),c.jsx(fe,{type:"number",value:k.display_order,onChange:A=>M(F=>({...F,display_order:parseInt(A.target.value)||0}))})]})]})]}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{children:"Cover Image"})}),c.jsxs(be,{className:"space-y-4",children:[k.cover_image_url&&c.jsx("img",{src:k.cover_image_url,alt:"Cover",className:"w-full h-40 object-cover rounded-md"}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(fe,{type:"file",accept:"image/*",onChange:R,disabled:h}),h&&c.jsx(tt,{className:"w-4 h-4 animate-spin"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{children:"Or paste URL"}),c.jsx(fe,{value:k.cover_image_url,onChange:A=>M(F=>({...F,cover_image_url:A.target.value})),placeholder:"https://..."})]})]})]}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{children:"Details"})}),c.jsxs(be,{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{children:"Author"}),c.jsxs(Ht,{value:k.author_id,onValueChange:A=>M(F=>({...F,author_id:A})),children:[c.jsx(It,{children:c.jsx(Wt,{placeholder:"Select author"})}),c.jsx($t,{children:l.map(A=>c.jsxs(pe,{value:A.id,children:[A.first_name," ",A.last_name]},A.id))})]})]}),k.type==="resource"&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{children:"Category"}),c.jsxs(Ht,{value:k.category,onValueChange:A=>M(F=>({...F,category:A})),children:[c.jsx(It,{children:c.jsx(Wt,{placeholder:"Select category"})}),c.jsx($t,{children:d.map(A=>c.jsx(pe,{value:A.slug,children:A.name},A.id))})]})]}),k.type==="news"&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{children:"News Subtype"}),c.jsxs(Ht,{value:k.news_subtype,onValueChange:A=>M(F=>({...F,news_subtype:A})),children:[c.jsx(It,{children:c.jsx(Wt,{placeholder:"Select subtype"})}),c.jsxs($t,{children:[c.jsx(pe,{value:"press_release",children:"Press Release"}),c.jsx(pe,{value:"article",children:"Article"}),c.jsx(pe,{value:"event",children:"Event"})]})]})]}),k.news_subtype==="event"&&c.jsxs(c.Fragment,{children:[c.jsx(Nu,{label:"Event Date",value:k.event_date,onChange:A=>M(F=>({...F,event_date:A})),clearable:!0}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{children:"Event Location"}),c.jsx(fe,{value:k.event_location,onChange:A=>M(F=>({...F,event_location:A.target.value}))})]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{children:"Tags (comma-separated)"}),c.jsx(fe,{defaultValue:k.tags.join(", "),onBlur:A=>M(F=>({...F,tags:A.target.value.split(",").map(V=>
173V.trim()).filter(Boolean)})),placeholder:"whatsapp, hospitality, ai"},k.tags.join(","))]})]})]}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsxs(ze,{className:"flex items-center gap-2",children:[c.jsx(W4,{className:"w-4 h-4"})," Auto Translate"]})}),c.jsxs(be,{className:"space-y-3",children:[c.jsx("p",{className:"text-xs text-muted-foreground",children:"Translate this article using AI into other languages. A new article will be created/updated for each language."}),c.jsx(oe,{variant:"outline",onClick:C,disabled:!!m||!t,className:"w-full",children:m?c.jsxs(c.Fragment,{children:[c.jsx(tt,{className:"w-4 h-4 mr-2 animate-spin"})," Translating to ",S[m],"..."]}):"Translate to All Languages"}),c.jsx("div",{className:"grid grid-cols-2 gap-2",children:O.filter(A=>A!==k.language).map(A=>c.jsxs(oe,{variant:"ghost",size:"sm",onClick:()=>N(A),disabled:!!m||!t,children:[m===A?c.jsx(tt,{className:"w-3 h-3 mr-1 animate-spin"}):null,S[A]]},A))})]})]}),c.jsxs(oe,{onClick:$,disabled:o,className:"w-full",children:[o?c.jsx(tt,{className:"w-4 h-4 mr-2 animate-spin"}):null,t?"Update Article":"Create Article"]})]})]}),c.jsx(gn,{open:v,onOpenChange:y,children:c.jsxs(vn,{children:[c.jsx(yn,{children:c.jsx(xn,{children:"Import from Notion"})}),c.jsxs("div",{className:"space-y-4 py-2",children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:"Paste a Notion page URL. The page must be shared with your Notion integration."}),c.jsx(fe,{placeholder:"https://www.notion.so/Your-Page-Title-abc123...",value:w,onChange:A=>_(A.target.value),disabled:j})]}),c.jsxs(li,{children:[c.jsx(oe,{variant:"outline",onClick:()=>y(!1),disabled:j,children:"Cancel"}),c.jsx(oe,{onClick:T,disabled:j||!w.trim(),children:j?c.jsxs(c.Fragment,{children:[c.jsx(tt,{className:"w-4 h-4 mr-2 animate-spin"})," Importing..."]}):"Import"})]})]})})]})},Nu=({label:t,value:e,onChange:r,clearable:n})=>c.jsxs("div",{className:"space-y-2",children:[c.jsx(ne,{children:t}),c.jsxs(Dn,{children:[c.jsx(Rn,{asChild:!0,children:c.jsxs(oe,{variant:"outline",className:le("w-full justify-start text-left font-normal",!e&&"text-muted-foreground"),children:[c.jsx(oi,{className:"mr-2 h-4 w-4"}),e?Ue(e,"PPP"):"Pick a date"]})}),c.jsxs(wn,{className:"w-auto p-0",align:"start",children:[c.jsx(bn,{mode:"single",selected:e||void 0,onSelect:i=>r(i||null),className:le("p-3 pointer-events-auto")}),n&&e&&c.jsx("div",{className:"p-2 border-t",children:c.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>r(null),className:"w-full",children:"Clear"})})]})]})]}),lce=()=>{const[t,e]=x.useState([]),[r,n]=x.useState(!0),[i,a]=x.useState(void 0),[o,s]=x.useState("all"),[l,u]=x.useState(""),{toast:d}=Pr();x.useEffect(()=>{i===void 0&&f()},[i]);const f=async()=>{n(!0);try{let m=et.from("articles").select("id, type, title, slug, language, category, news_subtype, is_published, publication_date, publish_after, expire_at, created_at").order("created_at",{ascending:!1});o!=="all"&&(m=m.eq("type",o)),l&&(m=m.ilike("title",`%${l}%`));const{data:g,error:v}=await m;if(v)throw v;e(g||[])}catch(m){d({title:"Error",description:m.message,variant:"destructive"})}finally{n(!1)}},h=async m=>{if(confirm("Delete this article?"))try{const{error:g}=await et.from("articles").delete().eq("id",m);if(g)throw g;d({title:"Deleted"}),f()}catch(g){d({title:"Error",description:g.message,variant:"destructive"})}},p=async(m,g)=>{try{const{error:v}=await et.from("articles").update({is_published:!g}).eq("id",m);if(v)throw v;f()}catch(v){d({title:"Error",description:v.message,variant:"destructive"})}};return i!==void 0?c.jsx(sce,{articleId:i,onBack:()=>a(void 0),onSaved:()=>a(void 0)}):c.jsx("div",{className:"space-y-6",children:c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx(ze,{children:"Articles & Content"}),c.jsx(Fu,{children:"Manage news and resource articles"})]}),c.jsxs(oe,{onClick:()=>a(null),className:"gap-2",children:[c.jsx(YE,{className:"w-4 h-4"})," New Article"]})]})}),c.jsxs(be,{children:[c.jsxs("div",{className:"flex gap-4 mb-4",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsx(BE,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}
173),c.jsx(fe,{placeholder:"Search articles...",value:l,onChange:m=>u(m.target.value),onKeyDown:m=>m.key==="Enter"&&f(),className:"pl-9"})]}),c.jsxs(Ht,{value:o,onValueChange:m=>{s(m)},children:[c.jsx(It,{className:"w-[150px]",children:c.jsx(Wt,{})}),c.jsxs($t,{children:[c.jsx(pe,{value:"all",children:"All Types"}),c.jsx(pe,{value:"news",children:"News"}),c.jsx(pe,{value:"resource",children:"Resources"})]})]}),c.jsx(oe,{variant:"outline",onClick:f,children:"Filter"})]}),r?c.jsx("div",{className:"flex justify-center p-8",children:c.jsx(tt,{className:"w-8 h-8 animate-spin"})}):t.length===0?c.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No articles found"}):c.jsx("div",{className:"space-y-3",children:t.map(m=>c.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[c.jsx("h3",{className:"font-semibold truncate",children:m.title}),c.jsx(Ye,{variant:m.type==="news"?"default":"secondary",children:m.type}),m.news_subtype&&c.jsx(Ye,{variant:"outline",children:m.news_subtype}),c.jsx(Ye,{variant:m.is_published?"default":"outline",children:m.is_published?"Published":"Draft"})]}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:[m.language.toUpperCase()," · /",m.type==="news"?"news":"resources","/",m.slug,m.category&&` · ${m.category}`," · ",Ue(new Date(m.publication_date),"MMM d, yyyy")]})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>p(m.id,m.is_published),children:m.is_published?c.jsx(fl,{className:"w-4 h-4"}):c.jsx(KE,{className:"w-4 h-4"})}),c.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>a(m.id),children:c.jsx(Tl,{className:"w-4 h-4"})}),c.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>h(m.id),children:c.jsx(Ma,{className:"w-4 h-4"})})]})]},m.id))})]})]})})},gE=(t,e)=>e?`${Math.round(t/e*100)}%`:"â",cce=[[1,9],[10,29],[30,49],[50,99],[100,199],[200,5e3]];function uce(){const[t,e]=x.useState([]),[r,n]=x.useState(!0),[i,a]=x.useState(""),[o,s]=x.useState(""),[l,u]=x.useState("");x.useEffect(()=>{(async()=>{n(!0);let y=et.from("calculator_events").select("*").order("created_at",{ascending:!1}).limit(1e3);o&&(y=y.gte("created_at",o)),l&&(y=y.lte("created_at",`${l}T23:59:59`));const{data:w}=await y;e(w??[]),n(!1)})()},[o,l]);const d=x.useMemo(()=>t.filter(y=>!i||(y.campaign??"").toLowerCase().includes(i.toLowerCase())),[t,i]),f=y=>d.filter(w=>w.event===y).length,h=f("page_view"),p=f("calculate"),m=f("cta_click"),g=d.filter(y=>y.event==="calculate"&&y.value).map(y=>y.value),v=()=>{const y="created_at,event,value,campaign,prospect,lang",w=O=>`"${String(O??"").replace(/"/g,'""')}"`,_=d.map(O=>[O.created_at,O.event,O.value,O.campaign,O.prospect,O.lang].map(w).join(",")),j=new Blob([[y,..._].join(` 174`)],{type:"text/csv"}),b=document.createElement("a");b.href=URL.createObjectURL(j),b.download=`calculator-events-${new Date().toISOString().slice(0,10)}.csv`,b.click()};return c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex flex-wrap gap-3 items-end",children:[c.jsxs("div",{children:[c.jsx("label",{className:"text-xs text-muted-foreground",children:"Campaign"}),c.jsx(fe,{value:i,onChange:y=>a(y.target.value),placeholder:"li-ch-sept26"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs text-muted-foreground",children:"From"}),c.jsx(fe,{type:"date",value:o,onChange:y=>s(y.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs text-muted-foreground",children:"To"}),c.jsx(fe,{type:"date",value:l,onChange:y=>u(y.target.value)})]}),c.jsxs(oe,{variant:"outline",onClick:v,children:[c.jsx(Oc,{className:"h-4 w-4 mr-2"}),"Export CSV"]})]}),c.jsx("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[["Page views",h],["Calculations",p],["CTA clicks",m],["Calc / view",gE(p,h)],["Click / calc",gE(m,p)]].map(([y,w])=>c.jsxs(ve,{children:[c.jsx(Ce,{className:"pb-2",children:c.jsx(ze,{className:"text-sm text-muted-foreground font-normal",children:y})}),c.jsx(be,{className:"text-2xl font-bold",children:w})]},y))}),c.jsxs(ve,{children:[c.jsx(Ce,{children:c.jsx(ze,{className:"text-base",children:"Units entered"})}),c.jsx(be,{className:"space-y-2",children:cce.map(([y,w])=>{const _=g.filter(j=>j>=y&&j<=w).length;return c.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[c.jsx("span",{className:"w-24",children:w===5e3?`${y}+`:`${y}â${w}`}),c.jsx("div",{className:"flex-1 h-3 bg-muted rounded",children:c.jsx("div",{className:"h-3 bg-primary rounded",style:{width:g.length?`${_/g.length*100}%`:0}})}),c.jsx("span",{className:"w-10 text-right tabular-nums",children:_})]},y)})})]}),c.jsx(ve,{children:c.jsx(be,{className:"p-0",children:r?c.jsx("div",{className:"p-8 flex justify-center",children:c.jsx(tt,{className:"h-6 w-6 animate-spin"})}):c.jsxs(Vo,{children:[c.jsx(Ko,{children:c.jsxs(an,{children:[c.jsx($e,{children:"Time"}),c.jsx($e,{children:"Event"}),c.jsx($e,{children:"Units"}),c.jsx($e,{children:"Campaign"}),c.jsx($e,{children:"Prospect"}),c.jsx($e,{children:"Lang"})]})}
174),c.jsxs(Go,{children:[d.length===0&&c.jsx(an,{children:c.jsx(Re,{colSpan:6,className:"text-center text-muted-foreground",children:"No events yet"})}),d.slice(0,300).map(y=>c.jsxs(an,{children:[c.jsx(Re,{className:"whitespace-nowrap",children:new Date(y.created_at).toLocaleString()}),c.jsx(Re,{children:y.event}),c.jsx(Re,{children:y.value??""}),c.jsx(Re,{children:y.campaign??""}),c.jsx(Re,{children:y.prospect??""}),c.jsx(Re,{children:y.lang})]},y.id))]})]})})})]})}const dce=()=>{const{isSuperAdmin:t,isAdmin:e,isBusinessDeveloper:r,loading:n}=_0(),{user:i}=EE(),a=VL(),{toast:o}=Pr(),[s,l]=x.useState("enquiries"),[u,d]=x.useState(!0),[f,h]=x.useState(null);x.useEffect(()=>{const v=new URLSearchParams(window.location.search).get("edit");v&&(h(v),l("orders"),window.history.replaceState({},"","/admin"))},[]),x.useEffect(()=>{const g=document.createElement("meta");return g.name="robots",g.content="noindex, nofollow",document.head.appendChild(g),()=>{document.head.removeChild(g)}},[]),x.useEffect(()=>{!n&&!i?a("/admin-login"):!n&&i&&!t&&!e&&!r?a("/"):!n&&i&&p()},[i,t,e,r,n,a]);const p=async()=>{try{if(!i)return;const{data:g,error:v}=await Z.from("profiles").select("first_name, last_name, job_title, whatsapp_phone, avatar_url").eq("user_id",i.id).maybeSingle();if(v)throw v;if(!g){a("/profile-completion");return}const y=[];if(g.first_name||y.push("first_name"),g.last_name||y.push("last_name"),g.job_title||y.push("job_title"),g.whatsapp_phone||y.push("whatsapp_phone"),g.avatar_url||y.push("avatar_url"),y.length>0){a("/profile-completion");return}d(!1)}catch(g){console.error("Error checking profile:",g),d(!1)}},m=async()=>{try{await Z.auth.signOut(),o({title:"Success",description:"Logged out successfully"}),a("/")}catch(g){console.error("Logout error:",g)}};return n||u?c.jsx("div",{className:"min-h-screen flex items-center justify-center",children:c.jsx(tt,{className:"h-8 w-8 animate-spin"})}):!i||!t&&!e&&!r?null:c.jsxs("div",{className:"min-h-screen bg-background",children:[c.jsx(P4,{title:"Admin â smartiz",description:"Admin dashboard.",noindex:!0}),c.jsxs("div",{className:"container mx-auto py-8 px-4",children:[c.jsxs("div",{className:"flex justify-between items-center mb-8",children:[c.jsxs("h1",{className:"text-4xl font-bold",children:[t?"Super Admin":r?"Business Developer":"Admin"," Dashboard"]}),c.jsxs(oe,{variant:"outline",onClick:m,children:[c.jsx(O4,{className:"mr-2 h-4 w-4"}),"Logout"]})]}),c.jsxs(Nc,{value:s,onValueChange:l,className:"w-full",children:[c.jsx("div",{className:"md:hidden mb-4",children:c.jsxs(Ht,{value:s,onValueChange:l,children:[c.jsx(It,{className:"w-full",children:c.jsx(Wt,{placeholder:"Select section"})}),c.jsxs($t,{children:[!r&&c.jsx(pe,{value:"enquiries",children:"Enquiries"}),c.jsx(pe,{value:"orders-list",children:"Orders List"}),c.jsx(pe,{value:"orders",children:"Create Order"}),e&&c.jsx(pe,{value:"articles",children:"Articles"}),t&&c.jsxs(c.Fragment,{children:[c.jsx(pe,{value:"users",children:"User Management"}),c.jsx(pe,{value:"pricing",children:"Pricing Config"}),c.jsx(pe,{value:"translations",children:"Translations"}),c.jsx(pe,{value:"candidates",children:"Candidates"}),c.jsx(pe,{value:"website-content",children:"Website Content"})]})]})]})}),c.jsxs(Ps,{className:`hidden md:grid w-full ${t?"grid-cols-9":r?"grid-cols-2":e?"grid-cols-4":"grid-cols-3"}`,children:[!r&&c.jsx(gt,{value:"enquiries",children:"Enquiries"}),c.jsx(gt,{value:"orders-list",children:"Orders List"}),c.jsx(gt,{value:"orders",children:"Create Order"}),e&&c.jsx(gt,{value:"articles",children:"Articles"}),e&&c.jsx(gt,{value:"calculator",children:"Calculator"}),t&&c.jsxs(c.Fragment,{children:[c.jsx(gt,{value:"users",children:"User Management"}),c.jsx(gt,{value:"pricing",children:"Pricing Config"}),c.jsx(gt,{value:"translations",children:"Translations"}),c.jsx(gt,{value:"candidates",children:"Candidates"}),c.jsx(gt,{value:"website-content",children:"Website Content"})]})]}),!r&&c.jsx(vt,{value:"enquiries",className:"mt-6",children:c.jsx(hte,{})}),c.jsx(vt,{value:"orders-list",className:"mt-6",children:c.jsx(Qee,{})}),c.jsx(vt,{value:"orders",className:"mt-6",children:c.jsx(p5,{editOrderId:f,onOrderCreated:()=>{l("orders-list"),h(null)}})}),e&&c.jsx(vt,{value:"calculator",className:"mt-6",children:c.jsx(uce,{})}),e&&c.jsx(vt,{value:"articles",className:"mt-6",children:c.jsx(lce,{})}),t&&c.jsxs(c.Fragment,{children:[c.jsx(vt,{value:"users",className:"mt-6",children:c.jsx(fte,{})}),c.jsx(vt,{value:"pricing",className:"mt-6",children:c.jsx(FB,{})}),c.jsx(vt,{value:"translations",className:"mt-6",children:c.jsx(LB,{})}),c.jsx(vt,{value:"candidates",className:"mt-6",children:c.jsx(mte,{})}),c.jsx(vt,{value:"website-content",className:"mt-6",children:c.jsx(Dte,{})})]})]})]})]})},Vce=dce;export{Vce as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.