Presupuestador_web/dist/client/assets/index-DoA1j409.js
2026-09-25 13:19:08 +02:00

255 lines
278 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var R_=Object.defineProperty;var E_=(n,a,r)=>a in n?R_(n,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[a]=r;var we=(n,a,r)=>E_(n,typeof a!="symbol"?a+"":a,r);import{u as Ac,a as Jt,b as en,c as Mn,d as Ne,j as i,P as A_,e as F_,f as me,g as I_,N as Wi,R as Le,J as Nt,h as Oe,i as Jn,D as er,l as Ea,M as Tt,V as M_,r as L,k as Fc,m as Ic,n as Dr,o as Mc,B as H,C as T_,p as Lr,q as Or,s as Pr,S as to,t as kr,v as Bi,w as S,x as no,y as Yi,z as Qi,A as Xi,E as Ar,F as ro,G as io,H as so,I as ao,K as oo,L as D_,O as Fr,Q as L_,T as O_,U as P_,W as qe,X as yt,Y as Xe,Z as nt,_ as $e,$ as mn,a0 as lo,a1 as k_,a2 as uo,a3 as In,a4 as co,a5 as fo,a6 as Vi,a7 as kt,a8 as Tc,a9 as q_,aa as Ui,ab as rr,ac as go,ad as mo,ae as ho,af as po,ag as Dc,ah as xo,ai as vo,aj as _o,ak as Zi,al as $_,am as z_,an as B_,ao as fc,ap as V_,aq as U_,ar as gc,as as mc,at as Aa,au as G_,av as H_,aw as En,ax as hc,ay as K_,az as W_,aA as Y_,aB as bo,aC as zt,aD as xn,aE as Ji,aF as Lc,aG as An,aH as Q_,aI as Oc,aJ as X_,aK as le,aL as es,aM as pc,aN as Pc,aO as kc,aP as qc,aQ as Tn,aR as $c,aS as ts,aT as qr,aU as $r,aV as zr,aW as Tr,aX as Z_,aY as zc,aZ as Ge,a_ as He,a$ as Va,b0 as Ke,b1 as tr,b2 as ir,b3 as nr,b4 as J_,b5 as e0,b6 as t0,b7 as Ua,b8 as n0,b9 as r0,ba as Xn,bb as Bc,bc as Ga,bd as Vc,be as qt,bf as i0,bg as s0,bh as wo,bi as Br,bj as Uc,bk as a0,bl as o0,bm as Oi,bn as l0,bo as u0,bp as c0,bq as d0,br as f0,bs as g0,bt as m0,bu as h0,bv as p0,bw as x0,bx as v0,by as xc,bz as Gc,bA as Hc,bB as Kc,bC as Wc,bD as Yc,bE as Qc,bF as Xc,bG as _0,bH as Fa,bI as b0,bJ as w0,bK as S0,bL as C0,bM as j0,bN as y0,bO as N0,bP as R0,bQ as E0,bR as A0,bS as F0,bT as I0,bU as M0,bV as T0,bW as Zc,bX as Jc,bY as Ha,bZ as Ka,b_ as D0,b$ as Ia,c0 as L0,c1 as O0}from"./index-B09LVASt.js";const P0=n=>{const{onSuccess:a,...r}=n||{},o=Mn(),{login:l}=Ac(),c=Jt();return en({mutationKey:o().auth().action("login").get(),mutationFn:l,onSuccess:async(d,h,p)=>{d.success&&c.removeQueries({queryKey:o().auth().get()}),await(a==null?void 0:a(d,h,p))},...r})};/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ed=Ne("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const k0=Ne("ArrowDownUp",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const vc=Ne("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const _c=Ne("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const q0=Ne("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $0=Ne("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const td=Ne("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"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const z0=Ne("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const B0=Ne("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const V0=Ne("CopyPlus",[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["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"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const So=Ne("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"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nd=Ne("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const U0=Ne("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"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rd=Ne("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"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const G0=Ne("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"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const H0=Ne("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"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const id=Ne("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const K0=Ne("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Co=Ne("PackagePlus",[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const jo=Ne("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const W0=Ne("Scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Y0=Ne("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Q0=Ne("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const sd=Ne("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ad=Ne("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"}]]),X0=({className:n,...a})=>i.jsx(F_,{className:me("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",n),...a}),bc=A_,Z0=({withHandle:n,className:a,...r})=>i.jsx(I_,{className:me("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",a),...r,children:n&&i.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:i.jsx(id,{className:"h-2.5 w-2.5"})})});function ut({className:n,...a}){return i.jsx("div",{className:me("animate-pulse rounded-md bg-muted",n),...a})}const J0=n=>typeof n=="object"&&n!==null&&n.hasOwnProperty("total_items");let Pi;const eb=new Uint8Array(16);function tb(){if(!Pi&&(Pi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Pi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Pi(eb)}const Ue=[];for(let n=0;n<256;++n)Ue.push((n+256).toString(16).slice(1));function nb(n,a=0){return Ue[n[a+0]]+Ue[n[a+1]]+Ue[n[a+2]]+Ue[n[a+3]]+"-"+Ue[n[a+4]]+Ue[n[a+5]]+"-"+Ue[n[a+6]]+Ue[n[a+7]]+"-"+Ue[n[a+8]]+Ue[n[a+9]]+"-"+Ue[n[a+10]]+Ue[n[a+11]]+Ue[n[a+12]]+Ue[n[a+13]]+Ue[n[a+14]]+Ue[n[a+15]]}const rb=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),wc={randomUUID:rb};function ib(n,a,r){if(wc.randomUUID&&!n)return wc.randomUUID();n=n||{};const o=n.random||(n.rng||tb)();return o[6]=o[6]&15|64,o[8]=o[8]&63|128,nb(o)}class dn extends Wi{static validate(a,r){const o=Le.RULE_ALLOW_EMPTY.default(""),l=Nt.string().guid({version:["uuidv4"]}).label(r.label?r.label:"id"),c=Nt.alternatives(o,l);return Le.validate(c,a)}static sanitize(a){return a.trim()}static create(a,r={}){const o={label:"id",generateOnEmpty:!1,...r};if(!a&&!o.generateOnEmpty)return Oe.fail(Jn(er.INVALID_INPUT_DATA,"ID is null or empty"));if(a){const l=dn.validate(a,o);return l.isFailure?Oe.fail(Jn(er.INVALID_INPUT_DATA,l.error.message,o)):Oe.ok(new dn(dn.sanitize(l.object)))}return o.generateOnEmpty?dn.generateNewID():Oe.ok(new dn(null))}static generateNewID(){return Oe.ok(new dn(ib()))}get value(){return String(this.props)}toString(){return String(this.props)}toPrimitive(){return this.toString()}}const Ma={aa:{name:"Afar",nativeName:"Afaraf"},ab:{name:"Abkhaz",nativeName:"аҧсуа бызшәа"},ae:{name:"Avestan",nativeName:"avesta"},af:{name:"Afrikaans",nativeName:"Afrikaans"},ak:{name:"Akan",nativeName:"Akan"},am:{name:"Amharic",nativeName:"አማርኛ"},an:{name:"Aragonese",nativeName:"aragonés"},ar:{name:"Arabic",nativeName:"اَلْعَرَبِيَّةُ"},as:{name:"Assamese",nativeName:"অসমীয়া"},av:{name:"Avaric",nativeName:"авар мацӀ"},ay:{name:"Aymara",nativeName:"aymar aru"},az:{name:"Azerbaijani",nativeName:"azərbaycan dili"},ba:{name:"Bashkir",nativeName:"башҡорт теле"},be:{name:"Belarusian",nativeName:"беларуская мова"},bg:{name:"Bulgarian",nativeName:"български език"},bi:{name:"Bislama",nativeName:"Bislama"},bm:{name:"Bambara",nativeName:"bamanankan"},bn:{name:"Bengali",nativeName:"বাংলা"},bo:{name:"Tibetan",nativeName:"བོད་ཡིག"},br:{name:"Breton",nativeName:"brezhoneg"},bs:{name:"Bosnian",nativeName:"bosanski jezik"},ca:{name:"Catalan",nativeName:"Català"},ce:{name:"Chechen",nativeName:"нохчийн мотт"},ch:{name:"Chamorro",nativeName:"Chamoru"},co:{name:"Corsican",nativeName:"corsu"},cr:{name:"Cree",nativeName:"ᓀᐦᐃᔭᐍᐏᐣ"},cs:{name:"Czech",nativeName:"čeština"},cu:{name:"Old Church Slavonic",nativeName:"ѩзыкъ словѣньскъ"},cv:{name:"Chuvash",nativeName:"чӑваш чӗлхи"},cy:{name:"Welsh",nativeName:"Cymraeg"},da:{name:"Danish",nativeName:"dansk"},de:{name:"German",nativeName:"Deutsch"},dv:{name:"Divehi",nativeName:"ދިވެހި"},dz:{name:"Dzongkha",nativeName:"རྫོང་ཁ"},ee:{name:"Ewe",nativeName:"Eʋegbe"},el:{name:"Greek",nativeName:"Ελληνικά"},en:{name:"English",nativeName:"English"},eo:{name:"Esperanto",nativeName:"Esperanto"},es:{name:"Spanish",nativeName:"Español"},et:{name:"Estonian",nativeName:"eesti"},eu:{name:"Basque",nativeName:"euskara"},fa:{name:"Persian",nativeName:"فارسی"},ff:{name:"Fula",nativeName:"Fulfulde"},fi:{name:"Finnish",nativeName:"suomi"},fj:{name:"Fijian",nativeName:"vosa Vakaviti"},fo:{name:"Faroese",nativeName:"føroyskt"},fr:{name:"French",nativeName:"Français"},fy:{name:"Western Frisian",nativeName:"Frysk"},ga:{name:"Irish",nativeName:"Gaeilge"},gd:{name:"Scottish Gaelic",nativeName:"Gàidhlig"},gl:{name:"Galician",nativeName:"galego"},gn:{name:"Guaraní",nativeName:"Avañe'ẽ"},gu:{name:"Gujarati",nativeName:"ગુજરાતી"},gv:{name:"Manx",nativeName:"Gaelg"},ha:{name:"Hausa",nativeName:"هَوُسَ"},he:{name:"Hebrew",nativeName:"עברית"},hi:{name:"Hindi",nativeName:"हिन्दी"},ho:{name:"Hiri Motu",nativeName:"Hiri Motu"},hr:{name:"Croatian",nativeName:"Hrvatski"},ht:{name:"Haitian",nativeName:"Kreyòl ayisyen"},hu:{name:"Hungarian",nativeName:"magyar"},hy:{name:"Armenian",nativeName:"Հայերեն"},hz:{name:"Herero",nativeName:"Otjiherero"},ia:{name:"Interlingua",nativeName:"Interlingua"},id:{name:"Indonesian",nativeName:"Bahasa Indonesia"},ie:{name:"Interlingue",nativeName:"Interlingue"},ig:{name:"Igbo",nativeName:"Asụsụ Igbo"},ii:{name:"Nuosu",nativeName:"ꆈꌠ꒿ Nuosuhxop"},ik:{name:"Inupiaq",nativeName:"Iñupiaq"},io:{name:"Ido",nativeName:"Ido"},is:{name:"Icelandic",nativeName:"Íslenska"},it:{name:"Italian",nativeName:"Italiano"},iu:{name:"Inuktitut",nativeName:"ᐃᓄᒃᑎᑐᑦ"},ja:{name:"Japanese",nativeName:"日本語"},jv:{name:"Javanese",nativeName:"basa Jawa"},ka:{name:"Georgian",nativeName:"ქართული"},kg:{name:"Kongo",nativeName:"Kikongo"},ki:{name:"Kikuyu",nativeName:"Gĩkũyũ"},kj:{name:"Kwanyama",nativeName:"Kuanyama"},kk:{name:"Kazakh",nativeName:"қазақ тілі"},kl:{name:"Kalaallisut",nativeName:"kalaallisut"},km:{name:"Khmer",nativeName:"ខេមរភាសា"},kn:{name:"Kannada",nativeName:"ಕನ್ನಡ"},ko:{name:"Korean",nativeName:"한국어"},kr:{name:"Kanuri",nativeName:"Kanuri"},ks:{name:"Kashmiri",nativeName:"कश्मीरी"},ku:{name:"Kurdish",nativeName:"Kurdî"},kv:{name:"Komi",nativeName:"коми кыв"},kw:{name:"Cornish",nativeName:"Kernewek"},ky:{name:"Kyrgyz",nativeName:"Кыргызча"},la:{name:"Latin",nativeName:"latine"},lb:{name:"Luxembourgish",nativeName:"Lëtzebuergesch"},lg:{name:"Ganda",nativeName:"Luganda"},li:{name:"Limburgish",nativeName:"Limburgs"},ln:{name:"Lingala",nativeName:"Lingála"},lo:{name:"Lao",nativeName:"ພາສາລາວ"},lt:{name:"Lithuanian",nativeName:"lietuvių kalba"},lu:{name:"Luba-Katanga",nativeName:"Kiluba"},lv:{name:"Latvian",nativeName:"latviešu valoda"},mg:{name:"Malagasy",nativeName:"fiteny malagasy"},mh:{name:"Marshallese",nativeName:"Kajin M̧ajeļ"},mi:{name:"Māori",nativeName:"te reo Māori"},mk:{name:"Macedonian",nativeName:"македонски јазик"},ml:{name:"Malayalam",nativeName:"മലയാളം"},mn:{name:"Mongolian",nativeName:"Монгол хэл"},mr:{name:"Marathi",nativeName:"मराठी"},ms:{name:"Malay",nativeName:"Bahasa Melayu"},mt:{name:"Maltese",nativeName:"Malti"},my:{name:"Burmese",nativeName:"ဗမာစာ"},na:{name:"Nauru",nativeName:"Dorerin Naoero"},nb:{name:"Norwegian Bokmål",nativeName:"Norsk bokmål"},nd:{name:"Northern Ndebele",nativeName:"isiNdebele"},ne:{name:"Nepali",nativeName:"नेपाली"},ng:{name:"Ndonga",nativeName:"Owambo"},nl:{name:"Dutch",nativeName:"Nederlands"},nn:{name:"Norwegian Nynorsk",nativeName:"Norsk nynorsk"},no:{name:"Norwegian",nativeName:"Norsk"},nr:{name:"Southern Ndebele",nativeName:"isiNdebele"},nv:{name:"Navajo",nativeName:"Diné bizaad"},ny:{name:"Chichewa",nativeName:"chiCheŵa"},oc:{name:"Occitan",nativeName:"occitan"},oj:{name:"Ojibwe",nativeName:"ᐊᓂᔑᓈᐯᒧᐎᓐ"},om:{name:"Oromo",nativeName:"Afaan Oromoo"},or:{name:"Oriya",nativeName:"ଓଡ଼ିଆ"},os:{name:"Ossetian",nativeName:"ирон æвзаг"},pa:{name:"Panjabi",nativeName:"ਪੰਜਾਬੀ"},pi:{name:"Pāli",nativeName:"पाऴि"},pl:{name:"Polish",nativeName:"Polski"},ps:{name:"Pashto",nativeName:"پښتو"},pt:{name:"Portuguese",nativeName:"Português"},qu:{name:"Quechua",nativeName:"Runa Simi"},rm:{name:"Romansh",nativeName:"rumantsch grischun"},rn:{name:"Kirundi",nativeName:"Ikirundi"},ro:{name:"Romanian",nativeName:"Română"},ru:{name:"Russian",nativeName:"Русский"},rw:{name:"Kinyarwanda",nativeName:"Ikinyarwanda"},sa:{name:"Sanskrit",nativeName:"संस्कृतम्"},sc:{name:"Sardinian",nativeName:"sardu"},sd:{name:"Sindhi",nativeName:"सिन्धी"},se:{name:"Northern Sami",nativeName:"Davvisámegiella"},sg:{name:"Sango",nativeName:"yângâ tî sängö"},si:{name:"Sinhala",nativeName:"සිංහල"},sk:{name:"Slovak",nativeName:"slovenčina"},sl:{name:"Slovenian",nativeName:"slovenščina"},sm:{name:"Samoan",nativeName:"gagana fa'a Samoa"},sn:{name:"Shona",nativeName:"chiShona"},so:{name:"Somali",nativeName:"Soomaaliga"},sq:{name:"Albanian",nativeName:"Shqip"},sr:{name:"Serbian",nativeName:"српски језик"},ss:{name:"Swati",nativeName:"SiSwati"},st:{name:"Southern Sotho",nativeName:"Sesotho"},su:{name:"Sundanese",nativeName:"Basa Sunda"},sv:{name:"Swedish",nativeName:"Svenska"},sw:{name:"Swahili",nativeName:"Kiswahili"},ta:{name:"Tamil",nativeName:"தமிழ்"},te:{name:"Telugu",nativeName:"తెలుగు"},tg:{name:"Tajik",nativeName:"тоҷикӣ"},th:{name:"Thai",nativeName:"ไทย"},ti:{name:"Tigrinya",nativeName:"ትግርኛ"},tk:{name:"Turkmen",nativeName:"Türkmençe"},tl:{name:"Tagalog",nativeName:"Wikang Tagalog"},tn:{name:"Tswana",nativeName:"Setswana"},to:{name:"Tonga",nativeName:"faka Tonga"},tr:{name:"Turkish",nativeName:"Türkçe"},ts:{name:"Tsonga",nativeName:"Xitsonga"},tt:{name:"Tatar",nativeName:"татар теле"},tw:{name:"Twi",nativeName:"Twi"},ty:{name:"Tahitian",nativeName:"Reo Tahiti"},ug:{name:"Uyghur",nativeName:"ئۇيغۇرچە‎"},uk:{name:"Ukrainian",nativeName:"Українська"},ur:{name:"Urdu",nativeName:"اردو"},uz:{name:"Uzbek",nativeName:"Ўзбек"},ve:{name:"Venda",nativeName:"Tshivenḓa"},vi:{name:"Vietnamese",nativeName:"Tiếng Việt"},vo:{name:"Volapük",nativeName:"Volapük"},wa:{name:"Walloon",nativeName:"walon"},wo:{name:"Wolof",nativeName:"Wollof"},xh:{name:"Xhosa",nativeName:"isiXhosa"},yi:{name:"Yiddish",nativeName:"ייִדיש"},yo:{name:"Yoruba",nativeName:"Yorùbá"},za:{name:"Zhuang",nativeName:"Saɯ cueŋƅ"},zh:{name:"Chinese",nativeName:"中文"},zu:{name:"Zulu",nativeName:"isiZulu"}},fn=class fn extends Wi{constructor(){super(...arguments);we(this,"toString",()=>this.code)}static validate(r,o){const l=Nt.alternatives(Le.RULE_ALLOW_EMPTY.default(""),Nt.string().lowercase().valid(...Object.keys(Ma)).label(String(o.label)));return Le.validate(l,r)}static sanitize(r){return r?String(r).toLowerCase():void 0}static createFromCode(r,o={}){const l={...o,label:o.label?o.label:"lang_code"},c=fn.validate(r,l);if(c.isFailure)return Oe.fail(Jn(er.INVALID_INPUT_DATA,c.error.message,l));const d=fn.sanitize(c.object),h=d?{...Ma[c.object],code:d}:void 0;return Oe.ok(new fn(h))}static createDefaultCode(){return fn.createFromCode(this.DEFAULT_LANGUAGE_CODE)}get name(){return this.props?String(this.props.name):""}get nativeName(){return this.props?String(this.props.nativeName):""}get code(){return this.props?String(this.props.code):""}isEmpty(){return this.isNull()||this.props===void 0}toPrimitive(){return this.toString()}};we(fn,"DEFAULT_LANGUAGE_CODE","es"),we(fn,"LANGUAGES",Ma);let Ir=fn;class od{constructor(a){we(this,"_collection",[]);this._collection=a??[]}add(a){this._collection.push(a)}reset(){this._collection=[]}hasSomeFaultyResult(){return this._collection.some(a=>a.isFailure)}getFirstFaultyResult(){return this._collection.find(a=>a.isFailure)}getAllFaultyResults(){return this._collection.filter(a=>a.isFailure)}get objects(){return this._collection.filter(a=>a.isSuccess).map(a=>a.object)}get errors(){return this._collection.filter(a=>a.isFailure).map(a=>a.error)}}const ld=2,Ta={amount:0,scale:ld},xe=class xe extends Wi{constructor(r,o,l){super(r);we(this,"_isNull");we(this,"_options");we(this,"isEmpty",()=>this.isNull());we(this,"isNull",()=>this._isNull);this._isNull=Object.freeze(o),this._options=Object.freeze(l)}static validate(r,o,l){const c=Le.RULE_ALLOW_NULL_OR_UNDEFINED,d=Le.RULE_ALLOW_EMPTY,h=Le.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"amount"),p=Le.RULE_IS_TYPE_STRING.regex(/^[-]?\d+$/).label(l.label?l.label:"amount"),v=Nt.number().min(xe.MIN_SCALE).max(xe.MAX_SCALE).label(l.label?l.label:"scale"),x=new od([Le.validate(Nt.alternatives(c,d,h,p),r),Le.validate(Nt.alternatives(Le.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"scale"),v),o)]);if(x.hasSomeFaultyResult())return x.getFirstFaultyResult();let y=typeof r=="string"?parseInt(r,10):Number(r),C=Ea.isNull(o)?xe.DEFAULT_SCALE:Number(o);const b=y/Math.pow(10,C);return b<xe.MIN_VALUE||b>xe.MAX_VALUE?Oe.fail(new Error(`Value with scale is out of range: ${b}`)):Oe.ok()}static create(r=Ta,o={}){if(r===null)throw new Error("InvalidParams: props params is missing");const{amount:l=Ta.amount,scale:c=Ta.scale}=r,d={label:"percentage",...o},h=xe.validate(l,c,d);if(h.isFailure)return Oe.fail(Jn(er.INVALID_INPUT_DATA,h.error.message,d));let p=xe._sanitize(l);const v={amount:Ea.isNull(p)?0:p,scale:c};return Oe.ok(new this(v,Ea.isNull(p),o))}static createFromFormattedValue(r,o={}){if(r===null||r==="")return xe.create({amount:null,scale:xe.DEFAULT_SCALE});const l=String(r),[c,d]=l.split(",");let h=c,p=2;return d===void 0?p=0:(d===""&&(h=c+d.padEnd(1,"0"),p=1),d.length===1?(h=c+d.padEnd(1,"0"),p=1):d.length===2&&(h=c+d.padEnd(2,"0"),p=2)),xe.create({amount:h,scale:p},o)}static _sanitize(r){let o=null;return typeof r=="string"?o=parseInt(r,10):o=r,o}static _toString(r,o){if(r===null)return"";const l=Math.pow(10,o);return(Number(r)/l).toFixed(o)}static _isWithinRange(r,o){const l=Number(xe._toString(r,o));return l>=xe.MIN_VALUE&&l<=xe.MAX_VALUE}get amount(){var r;return this.isNull()?null:Number((r=this.props)==null?void 0:r.amount)}get scale(){var r;return Number((r=this.props)==null?void 0:r.scale)}getAmount(){var r;return this.isNull()?null:Number((r=this.props)==null?void 0:r.amount)}getScale(){var r;return this.isNull()?0:Number((r=this.props)==null?void 0:r.scale)}toString(){return xe._toString(this.amount,this.scale)}toNumber(){return this.isNull()?0:Number(this.toString())}toFormat(){return this._isNull?"":Intl.NumberFormat("es-ES",{maximumFractionDigits:2}).format(this.toNumber())}toPrimitive(){return this.scale!==xe.DEFAULT_SCALE?this.convertScale(xe.DEFAULT_SCALE).toPrimitive():this.amount}toPrimitives(){return this.toObject()}toObject(){return{amount:this.amount,scale:this.scale}}convertScale(r){if(r<xe.MIN_SCALE||r>xe.MAX_SCALE)throw new Error(`Scale out of range: ${r}`);if(this.isNull())return new xe({amount:null,scale:r},!0,this._options);const o=Math.pow(10,this.scale),l=Number(this.amount)/o,c=Math.pow(10,r),d=Math.round(l*c);if(!xe._isWithinRange(d,r))throw new Error(`Value out of range after conversion: ${d} ${r}`);return new xe({amount:d,scale:r},!1,this._options)}hasSameScale(r){return this.scale===r.scale}isWithinRange(){return xe._isWithinRange(this.amount,this.scale)}};we(xe,"DEFAULT_SCALE",ld),we(xe,"MIN_VALUE",0),we(xe,"MAX_VALUE",100),we(xe,"MIN_SCALE",0),we(xe,"MAX_SCALE",2);let $t=xe;const ud=2,Da={amount:0,scale:ud},ve=class ve extends Wi{constructor(r,o,l){super(r);we(this,"_isNull");we(this,"_options");we(this,"isEmpty",()=>this.isNull());we(this,"isNull",()=>this._isNull);this._isNull=Object.freeze(o),this._options=Object.freeze(l)}static validate(r,o,l={}){const c=Le.RULE_ALLOW_NULL_OR_UNDEFINED,d=Le.RULE_ALLOW_EMPTY,h=Le.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"amount"),p=Le.RULE_IS_TYPE_STRING.regex(/^[-]?\d+$/).label(l.label?l.label:"amount"),v=Nt.number().min(ve.MIN_SCALE).max(ve.MAX_SCALE).label(l.label?l.label:"scale"),x=new od([Le.validate(Nt.alternatives(c,d,h,p),r),Le.validate(Nt.alternatives(Le.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"scale"),v),o)]);return x.hasSomeFaultyResult()?x.getFirstFaultyResult():Oe.ok()}static create(r=Da,o={}){if(r===null)throw new Error("InvalidParams: props params is missing");const{amount:l=Da.amount,scale:c=Da.scale}=r,d={label:"quantity",...o},h=ve.validate(l,c,d);if(h.isFailure)return Oe.fail(Jn(er.INVALID_INPUT_DATA,h.error.message,d));let p=ve._sanitize(l);const v={amount:p===null?0:p,scale:c};return Oe.ok(new ve(v,p===null,o))}static createFromFormattedValue(r,o={}){if(r===null||r==="")return ve.create({amount:null,scale:ve.DEFAULT_SCALE});const l=String(r),[c,d]=l.split(",");let h=c,p=2;return d===void 0?p=0:(d===""&&(h=c+d.padEnd(1,"0"),p=1),d.length===1?(h=c+d.padEnd(1,"0"),p=1):d.length===2&&(h=c+d.padEnd(2,"0"),p=2)),ve.create({amount:h,scale:p},o)}static _sanitize(r){let o=null;return typeof r=="string"?o=parseInt(r,10):o=r,o}static _toString(r,o){if(r===null)return"";const l=Math.pow(10,o);return(Number(r)/l).toFixed(o)}get amount(){var r;return this.isNull()?null:Number((r=this.props)==null?void 0:r.amount)}get scale(){var r;return Number((r=this.props)==null?void 0:r.scale)}getAmount(){var r;return this.isNull()?null:Number((r=this.props)==null?void 0:r.amount)}getScale(){var r;return this.isNull()?0:Number((r=this.props)==null?void 0:r.scale)}toString(){return ve._toString(this.amount,this.scale)}toNumber(){return this.isNull()?0:Number(this.toString())}toFormat(){return this._isNull?"":Intl.NumberFormat("es-ES",{maximumFractionDigits:2}).format(this.toNumber())}toPrimitive(){return this.scale!==ve.DEFAULT_SCALE?this.convertScale(ve.DEFAULT_SCALE).toPrimitive():this.amount}toPrimitives(){return this.toObject()}toObject(){return{amount:this.amount,scale:this.scale}}convertScale(r){if(r<ve.MIN_SCALE||r>ve.MAX_SCALE)throw new Error(`Scale out of range: ${r}`);if(this.isNull())return new ve({amount:null,scale:r},!0,this._options);const o=Math.pow(10,this.scale),l=Number(this.amount)/o,c=Math.pow(10,r),d=Math.round(l*c);return new ve({amount:d,scale:r},!1,this._options)}hasSameScale(r){return this.scale===r.scale}increment(r){return this.isNull()?r?ve.create(r.toObject()):ve.create():r?this.hasSameScale(r)?ve.create({amount:Number(this.amount)+Number(r.amount),scale:this.scale},this._options):Oe.fail(Error("No se pueden sumar cantidades con diferentes escalas.")):ve.create({amount:Number(this.amount)+1,scale:this.scale},this._options)}decrement(r){return this.isNull()?r?ve.create(r.toObject()):ve.create():r?this.hasSameScale(r)?ve.create({amount:Number(this.amount)-Number(r.amount),scale:this.scale},this._options):Oe.fail(Error("No se pueden restar cantidades con diferentes escalas.")):ve.create({amount:Number(this.amount)-1,scale:this.scale},this._options)}};we(ve,"DEFAULT_SCALE",ud),we(ve,"MIN_SCALE",0),we(ve,"MAX_SCALE",2);let hn=ve;const Sc=2;class sb extends Tt{static create(a){const{amount:r,currencyCode:o,scale:l=Sc}=a,c=Tt.create({amount:r,currencyCode:o,scale:l});if(c.isFailure)return c;const d=c.object.convertScale(Sc);return Oe.ok(d)}}class Zn extends M_{constructor(){super(...arguments);we(this,"isValid",()=>!isNaN(this.props.valueOf())&&this.props.valueOf()!==0);we(this,"isEmpty",()=>!this.isValid());we(this,"toISO8601",()=>this.isValid()?this.props.toISOString():"");we(this,"toDateString",()=>this.isValid()?this.props.toDateString():"");we(this,"toLocaleDateString",(r,o)=>this.isValid()?this.props.toLocaleDateString(r,o):"");we(this,"toLocaleTimeString",()=>this.isValid()?this.props.toLocaleTimeString():"")}static validate(r,o){const l=Le.RULE_ALLOW_EMPTY.default(0),c=Nt.date().label(String(o.label)),d=Nt.alternatives(l,c);return Le.validate(d,r)}static createCurrentDate(){return Oe.ok(new Zn(new Date))}static create(r,o={}){const l={...o,dateFormat:o.dateFormat?o.dateFormat:"YYYY-MM-DD",label:o.label?o.label:"date"},c=Zn.validate(r,l);return c.isFailure?Oe.fail(Jn(er.INVALID_INPUT_DATA,c.error.message,l)):Oe.ok(new Zn(new Date(c.object)))}toString(){if(!this.isEmpty()){const r=this.props.getFullYear(),o=String(this.props.getMonth()+1).padStart(2,"0"),l=String(this.props.getDate()).padStart(2,"0");return`${r}-${o}-${l}`}return""}toPrimitive(){return this.toISO8601()}}const ab=({isPending:n,interval:a=1e3,onInterval:r})=>{const[o,l]=L.useState(void 0);return L.useEffect(()=>{let c;return n&&(c=setInterval(()=>{l(d=>d===void 0?a:d+a)},a)),()=>{clearInterval(c),l(void 0)}},[n,a]),L.useEffect(()=>{r&&o&&r(o)},[o]),{elapsedTime:o}},ob=2*60*1e3,lb=60*1e3,yo=({queryKey:n,queryFn:a,enabled:r,select:o,queryOptions:l={},overtimeOptions:c})=>{const[d,h]=L.useState(!1),p=Fc({queryKey:n,queryFn:a,placeholderData:Ic,staleTime:lb,refetchInterval:ob,refetchOnWindowFocus:!0,enabled:r&&!!a,select:o,...l});L.useEffect(()=>{p.isSuccess&&J0(p.data)&&h(p.data.total_items===0)},[p]);const{elapsedTime:v}=ab({isPending:p.isFetching,interval:c==null?void 0:c.interval,onInterval:c==null?void 0:c.onInterval});return{...p,overtime:{elapsedTime:v},isEmpty:d}},cd=n=>Fc({placeholderData:Ic,...n});function ub(n){return en({...n})}/**
* table-core
*
* Copyright (c) TanStack
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function cb(){return{accessor:(n,a)=>typeof n=="function"?{...a,accessorFn:n}:{...a,accessorKey:n},display:n=>n,group:n=>n}}function gn(n,a){return typeof n=="function"?n(a):n}function pt(n,a){return r=>{a.setState(o=>({...o,[n]:gn(r,o[n])}))}}function ns(n){return n instanceof Function}function db(n){return Array.isArray(n)&&n.every(a=>typeof a=="number")}function fb(n,a){const r=[],o=l=>{l.forEach(c=>{r.push(c);const d=a(c);d!=null&&d.length&&o(d)})};return o(n),r}function W(n,a,r){let o=[],l;return c=>{let d;r.key&&r.debug&&(d=Date.now());const h=n(c);if(!(h.length!==o.length||h.some((x,y)=>o[y]!==x)))return l;o=h;let v;if(r.key&&r.debug&&(v=Date.now()),l=a(...h),r==null||r.onChange==null||r.onChange(l),r.key&&r.debug&&r!=null&&r.debug()){const x=Math.round((Date.now()-d)*100)/100,y=Math.round((Date.now()-v)*100)/100,C=y/16,b=(E,R)=>{for(E=String(E);E.length<R;)E=" "+E;return E};console.info(`%c⏱ ${b(y,5)} /${b(x,5)} ms`,`
font-size: .6rem;
font-weight: bold;
color: hsl(${Math.max(0,Math.min(120-120*C,120))}deg 100% 31%);`,r==null?void 0:r.key)}return l}}function Y(n,a,r,o){return{debug:()=>{var l;return(l=n==null?void 0:n.debugAll)!=null?l:n[a]},key:!1,onChange:o}}function gb(n,a,r,o){const l=()=>{var d;return(d=c.getValue())!=null?d:n.options.renderFallbackValue},c={id:`${a.id}_${r.id}`,row:a,column:r,getValue:()=>a.getValue(o),renderValue:l,getContext:W(()=>[n,r,a,c],(d,h,p,v)=>({table:d,column:h,row:p,cell:v,getValue:v.getValue,renderValue:v.renderValue}),Y(n.options,"debugCells"))};return n._features.forEach(d=>{d.createCell==null||d.createCell(c,r,a,n)},{}),c}function mb(n,a,r,o){var l,c;const h={...n._getDefaultColumnDef(),...a},p=h.accessorKey;let v=(l=(c=h.id)!=null?c:p?typeof String.prototype.replaceAll=="function"?p.replaceAll(".","_"):p.replace(/\./g,"_"):void 0)!=null?l:typeof h.header=="string"?h.header:void 0,x;if(h.accessorFn?x=h.accessorFn:p&&(p.includes(".")?x=C=>{let b=C;for(const R of p.split(".")){var E;b=(E=b)==null?void 0:E[R]}return b}:x=C=>C[h.accessorKey]),!v)throw new Error;let y={id:`${String(v)}`,accessorFn:x,parent:o,depth:r,columnDef:h,columns:[],getFlatColumns:W(()=>[!0],()=>{var C;return[y,...(C=y.columns)==null?void 0:C.flatMap(b=>b.getFlatColumns())]},Y(n.options,"debugColumns")),getLeafColumns:W(()=>[n._getOrderColumnsFn()],C=>{var b;if((b=y.columns)!=null&&b.length){let E=y.columns.flatMap(R=>R.getLeafColumns());return C(E)}return[y]},Y(n.options,"debugColumns"))};for(const C of n._features)C.createColumn==null||C.createColumn(y,n);return y}const Qe="debugHeaders";function Cc(n,a,r){var o;let c={id:(o=r.id)!=null?o:a.id,column:a,index:r.index,isPlaceholder:!!r.isPlaceholder,placeholderId:r.placeholderId,depth:r.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const d=[],h=p=>{p.subHeaders&&p.subHeaders.length&&p.subHeaders.map(h),d.push(p)};return h(c),d},getContext:()=>({table:n,header:c,column:a})};return n._features.forEach(d=>{d.createHeader==null||d.createHeader(c,n)}),c}const hb={createTable:n=>{n.getHeaderGroups=W(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.left,n.getState().columnPinning.right],(a,r,o,l)=>{var c,d;const h=(c=o==null?void 0:o.map(y=>r.find(C=>C.id===y)).filter(Boolean))!=null?c:[],p=(d=l==null?void 0:l.map(y=>r.find(C=>C.id===y)).filter(Boolean))!=null?d:[],v=r.filter(y=>!(o!=null&&o.includes(y.id))&&!(l!=null&&l.includes(y.id)));return ki(a,[...h,...v,...p],n)},Y(n.options,Qe)),n.getCenterHeaderGroups=W(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.left,n.getState().columnPinning.right],(a,r,o,l)=>(r=r.filter(c=>!(o!=null&&o.includes(c.id))&&!(l!=null&&l.includes(c.id))),ki(a,r,n,"center")),Y(n.options,Qe)),n.getLeftHeaderGroups=W(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.left],(a,r,o)=>{var l;const c=(l=o==null?void 0:o.map(d=>r.find(h=>h.id===d)).filter(Boolean))!=null?l:[];return ki(a,c,n,"left")},Y(n.options,Qe)),n.getRightHeaderGroups=W(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.right],(a,r,o)=>{var l;const c=(l=o==null?void 0:o.map(d=>r.find(h=>h.id===d)).filter(Boolean))!=null?l:[];return ki(a,c,n,"right")},Y(n.options,Qe)),n.getFooterGroups=W(()=>[n.getHeaderGroups()],a=>[...a].reverse(),Y(n.options,Qe)),n.getLeftFooterGroups=W(()=>[n.getLeftHeaderGroups()],a=>[...a].reverse(),Y(n.options,Qe)),n.getCenterFooterGroups=W(()=>[n.getCenterHeaderGroups()],a=>[...a].reverse(),Y(n.options,Qe)),n.getRightFooterGroups=W(()=>[n.getRightHeaderGroups()],a=>[...a].reverse(),Y(n.options,Qe)),n.getFlatHeaders=W(()=>[n.getHeaderGroups()],a=>a.map(r=>r.headers).flat(),Y(n.options,Qe)),n.getLeftFlatHeaders=W(()=>[n.getLeftHeaderGroups()],a=>a.map(r=>r.headers).flat(),Y(n.options,Qe)),n.getCenterFlatHeaders=W(()=>[n.getCenterHeaderGroups()],a=>a.map(r=>r.headers).flat(),Y(n.options,Qe)),n.getRightFlatHeaders=W(()=>[n.getRightHeaderGroups()],a=>a.map(r=>r.headers).flat(),Y(n.options,Qe)),n.getCenterLeafHeaders=W(()=>[n.getCenterFlatHeaders()],a=>a.filter(r=>{var o;return!((o=r.subHeaders)!=null&&o.length)}),Y(n.options,Qe)),n.getLeftLeafHeaders=W(()=>[n.getLeftFlatHeaders()],a=>a.filter(r=>{var o;return!((o=r.subHeaders)!=null&&o.length)}),Y(n.options,Qe)),n.getRightLeafHeaders=W(()=>[n.getRightFlatHeaders()],a=>a.filter(r=>{var o;return!((o=r.subHeaders)!=null&&o.length)}),Y(n.options,Qe)),n.getLeafHeaders=W(()=>[n.getLeftHeaderGroups(),n.getCenterHeaderGroups(),n.getRightHeaderGroups()],(a,r,o)=>{var l,c,d,h,p,v;return[...(l=(c=a[0])==null?void 0:c.headers)!=null?l:[],...(d=(h=r[0])==null?void 0:h.headers)!=null?d:[],...(p=(v=o[0])==null?void 0:v.headers)!=null?p:[]].map(x=>x.getLeafHeaders()).flat()},Y(n.options,Qe))}};function ki(n,a,r,o){var l,c;let d=0;const h=function(C,b){b===void 0&&(b=1),d=Math.max(d,b),C.filter(E=>E.getIsVisible()).forEach(E=>{var R;(R=E.columns)!=null&&R.length&&h(E.columns,b+1)},0)};h(n);let p=[];const v=(C,b)=>{const E={depth:b,id:[o,`${b}`].filter(Boolean).join("_"),headers:[]},R=[];C.forEach(P=>{const T=[...R].reverse()[0],I=P.column.depth===E.depth;let F,$=!1;if(I&&P.column.parent?F=P.column.parent:(F=P.column,$=!0),T&&(T==null?void 0:T.column)===F)T.subHeaders.push(P);else{const B=Cc(r,F,{id:[o,b,F.id,P==null?void 0:P.id].filter(Boolean).join("_"),isPlaceholder:$,placeholderId:$?`${R.filter(q=>q.column===F).length}`:void 0,depth:b,index:R.length});B.subHeaders.push(P),R.push(B)}E.headers.push(P),P.headerGroup=E}),p.push(E),b>0&&v(R,b-1)},x=a.map((C,b)=>Cc(r,C,{depth:d,index:b}));v(x,d-1),p.reverse();const y=C=>C.filter(E=>E.column.getIsVisible()).map(E=>{let R=0,P=0,T=[0];E.subHeaders&&E.subHeaders.length?(T=[],y(E.subHeaders).forEach(F=>{let{colSpan:$,rowSpan:B}=F;R+=$,T.push(B)})):R=1;const I=Math.min(...T);return P=P+I,E.colSpan=R,E.rowSpan=P,{colSpan:R,rowSpan:P}});return y((l=(c=p[0])==null?void 0:c.headers)!=null?l:[]),p}const No=(n,a,r,o,l,c,d)=>{let h={id:a,index:o,original:r,depth:l,parentId:d,_valuesCache:{},_uniqueValuesCache:{},getValue:p=>{if(h._valuesCache.hasOwnProperty(p))return h._valuesCache[p];const v=n.getColumn(p);if(v!=null&&v.accessorFn)return h._valuesCache[p]=v.accessorFn(h.original,o),h._valuesCache[p]},getUniqueValues:p=>{if(h._uniqueValuesCache.hasOwnProperty(p))return h._uniqueValuesCache[p];const v=n.getColumn(p);if(v!=null&&v.accessorFn)return v.columnDef.getUniqueValues?(h._uniqueValuesCache[p]=v.columnDef.getUniqueValues(h.original,o),h._uniqueValuesCache[p]):(h._uniqueValuesCache[p]=[h.getValue(p)],h._uniqueValuesCache[p])},renderValue:p=>{var v;return(v=h.getValue(p))!=null?v:n.options.renderFallbackValue},subRows:[],getLeafRows:()=>fb(h.subRows,p=>p.subRows),getParentRow:()=>h.parentId?n.getRow(h.parentId,!0):void 0,getParentRows:()=>{let p=[],v=h;for(;;){const x=v.getParentRow();if(!x)break;p.push(x),v=x}return p.reverse()},getAllCells:W(()=>[n.getAllLeafColumns()],p=>p.map(v=>gb(n,h,v,v.id)),Y(n.options,"debugRows")),_getAllCellsByColumnId:W(()=>[h.getAllCells()],p=>p.reduce((v,x)=>(v[x.column.id]=x,v),{}),Y(n.options,"debugRows"))};for(let p=0;p<n._features.length;p++){const v=n._features[p];v==null||v.createRow==null||v.createRow(h,n)}return h},pb={createColumn:(n,a)=>{n._getFacetedRowModel=a.options.getFacetedRowModel&&a.options.getFacetedRowModel(a,n.id),n.getFacetedRowModel=()=>n._getFacetedRowModel?n._getFacetedRowModel():a.getPreFilteredRowModel(),n._getFacetedUniqueValues=a.options.getFacetedUniqueValues&&a.options.getFacetedUniqueValues(a,n.id),n.getFacetedUniqueValues=()=>n._getFacetedUniqueValues?n._getFacetedUniqueValues():new Map,n._getFacetedMinMaxValues=a.options.getFacetedMinMaxValues&&a.options.getFacetedMinMaxValues(a,n.id),n.getFacetedMinMaxValues=()=>{if(n._getFacetedMinMaxValues)return n._getFacetedMinMaxValues()}}},dd=(n,a,r)=>{var o,l;const c=r==null||(o=r.toString())==null?void 0:o.toLowerCase();return!!(!((l=n.getValue(a))==null||(l=l.toString())==null||(l=l.toLowerCase())==null)&&l.includes(c))};dd.autoRemove=n=>Dt(n);const fd=(n,a,r)=>{var o;return!!(!((o=n.getValue(a))==null||(o=o.toString())==null)&&o.includes(r))};fd.autoRemove=n=>Dt(n);const gd=(n,a,r)=>{var o;return((o=n.getValue(a))==null||(o=o.toString())==null?void 0:o.toLowerCase())===(r==null?void 0:r.toLowerCase())};gd.autoRemove=n=>Dt(n);const md=(n,a,r)=>{var o;return(o=n.getValue(a))==null?void 0:o.includes(r)};md.autoRemove=n=>Dt(n);const hd=(n,a,r)=>!r.some(o=>{var l;return!((l=n.getValue(a))!=null&&l.includes(o))});hd.autoRemove=n=>Dt(n)||!(n!=null&&n.length);const pd=(n,a,r)=>r.some(o=>{var l;return(l=n.getValue(a))==null?void 0:l.includes(o)});pd.autoRemove=n=>Dt(n)||!(n!=null&&n.length);const xd=(n,a,r)=>n.getValue(a)===r;xd.autoRemove=n=>Dt(n);const vd=(n,a,r)=>n.getValue(a)==r;vd.autoRemove=n=>Dt(n);const Ro=(n,a,r)=>{let[o,l]=r;const c=n.getValue(a);return c>=o&&c<=l};Ro.resolveFilterValue=n=>{let[a,r]=n,o=typeof a!="number"?parseFloat(a):a,l=typeof r!="number"?parseFloat(r):r,c=a===null||Number.isNaN(o)?-1/0:o,d=r===null||Number.isNaN(l)?1/0:l;if(c>d){const h=c;c=d,d=h}return[c,d]};Ro.autoRemove=n=>Dt(n)||Dt(n[0])&&Dt(n[1]);const Zt={includesString:dd,includesStringSensitive:fd,equalsString:gd,arrIncludes:md,arrIncludesAll:hd,arrIncludesSome:pd,equals:xd,weakEquals:vd,inNumberRange:Ro};function Dt(n){return n==null||n===""}const xb={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:n=>({columnFilters:[],...n}),getDefaultOptions:n=>({onColumnFiltersChange:pt("columnFilters",n),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(n,a)=>{n.getAutoFilterFn=()=>{const r=a.getCoreRowModel().flatRows[0],o=r==null?void 0:r.getValue(n.id);return typeof o=="string"?Zt.includesString:typeof o=="number"?Zt.inNumberRange:typeof o=="boolean"||o!==null&&typeof o=="object"?Zt.equals:Array.isArray(o)?Zt.arrIncludes:Zt.weakEquals},n.getFilterFn=()=>{var r,o;return ns(n.columnDef.filterFn)?n.columnDef.filterFn:n.columnDef.filterFn==="auto"?n.getAutoFilterFn():(r=(o=a.options.filterFns)==null?void 0:o[n.columnDef.filterFn])!=null?r:Zt[n.columnDef.filterFn]},n.getCanFilter=()=>{var r,o,l;return((r=n.columnDef.enableColumnFilter)!=null?r:!0)&&((o=a.options.enableColumnFilters)!=null?o:!0)&&((l=a.options.enableFilters)!=null?l:!0)&&!!n.accessorFn},n.getIsFiltered=()=>n.getFilterIndex()>-1,n.getFilterValue=()=>{var r;return(r=a.getState().columnFilters)==null||(r=r.find(o=>o.id===n.id))==null?void 0:r.value},n.getFilterIndex=()=>{var r,o;return(r=(o=a.getState().columnFilters)==null?void 0:o.findIndex(l=>l.id===n.id))!=null?r:-1},n.setFilterValue=r=>{a.setColumnFilters(o=>{const l=n.getFilterFn(),c=o==null?void 0:o.find(x=>x.id===n.id),d=gn(r,c?c.value:void 0);if(jc(l,d,n)){var h;return(h=o==null?void 0:o.filter(x=>x.id!==n.id))!=null?h:[]}const p={id:n.id,value:d};if(c){var v;return(v=o==null?void 0:o.map(x=>x.id===n.id?p:x))!=null?v:[]}return o!=null&&o.length?[...o,p]:[p]})}},createRow:(n,a)=>{n.columnFilters={},n.columnFiltersMeta={}},createTable:n=>{n.setColumnFilters=a=>{const r=n.getAllLeafColumns(),o=l=>{var c;return(c=gn(a,l))==null?void 0:c.filter(d=>{const h=r.find(p=>p.id===d.id);if(h){const p=h.getFilterFn();if(jc(p,d.value,h))return!1}return!0})};n.options.onColumnFiltersChange==null||n.options.onColumnFiltersChange(o)},n.resetColumnFilters=a=>{var r,o;n.setColumnFilters(a?[]:(r=(o=n.initialState)==null?void 0:o.columnFilters)!=null?r:[])},n.getPreFilteredRowModel=()=>n.getCoreRowModel(),n.getFilteredRowModel=()=>(!n._getFilteredRowModel&&n.options.getFilteredRowModel&&(n._getFilteredRowModel=n.options.getFilteredRowModel(n)),n.options.manualFiltering||!n._getFilteredRowModel?n.getPreFilteredRowModel():n._getFilteredRowModel())}};function jc(n,a,r){return(n&&n.autoRemove?n.autoRemove(a,r):!1)||typeof a>"u"||typeof a=="string"&&!a}const vb=(n,a,r)=>r.reduce((o,l)=>{const c=l.getValue(n);return o+(typeof c=="number"?c:0)},0),_b=(n,a,r)=>{let o;return r.forEach(l=>{const c=l.getValue(n);c!=null&&(o>c||o===void 0&&c>=c)&&(o=c)}),o},bb=(n,a,r)=>{let o;return r.forEach(l=>{const c=l.getValue(n);c!=null&&(o<c||o===void 0&&c>=c)&&(o=c)}),o},wb=(n,a,r)=>{let o,l;return r.forEach(c=>{const d=c.getValue(n);d!=null&&(o===void 0?d>=d&&(o=l=d):(o>d&&(o=d),l<d&&(l=d)))}),[o,l]},Sb=(n,a)=>{let r=0,o=0;if(a.forEach(l=>{let c=l.getValue(n);c!=null&&(c=+c)>=c&&(++r,o+=c)}),r)return o/r},Cb=(n,a)=>{if(!a.length)return;const r=a.map(c=>c.getValue(n));if(!db(r))return;if(r.length===1)return r[0];const o=Math.floor(r.length/2),l=r.sort((c,d)=>c-d);return r.length%2!==0?l[o]:(l[o-1]+l[o])/2},jb=(n,a)=>Array.from(new Set(a.map(r=>r.getValue(n))).values()),yb=(n,a)=>new Set(a.map(r=>r.getValue(n))).size,Nb=(n,a)=>a.length,La={sum:vb,min:_b,max:bb,extent:wb,mean:Sb,median:Cb,unique:jb,uniqueCount:yb,count:Nb},Rb={getDefaultColumnDef:()=>({aggregatedCell:n=>{var a,r;return(a=(r=n.getValue())==null||r.toString==null?void 0:r.toString())!=null?a:null},aggregationFn:"auto"}),getInitialState:n=>({grouping:[],...n}),getDefaultOptions:n=>({onGroupingChange:pt("grouping",n),groupedColumnMode:"reorder"}),createColumn:(n,a)=>{n.toggleGrouping=()=>{a.setGrouping(r=>r!=null&&r.includes(n.id)?r.filter(o=>o!==n.id):[...r??[],n.id])},n.getCanGroup=()=>{var r,o;return((r=n.columnDef.enableGrouping)!=null?r:!0)&&((o=a.options.enableGrouping)!=null?o:!0)&&(!!n.accessorFn||!!n.columnDef.getGroupingValue)},n.getIsGrouped=()=>{var r;return(r=a.getState().grouping)==null?void 0:r.includes(n.id)},n.getGroupedIndex=()=>{var r;return(r=a.getState().grouping)==null?void 0:r.indexOf(n.id)},n.getToggleGroupingHandler=()=>{const r=n.getCanGroup();return()=>{r&&n.toggleGrouping()}},n.getAutoAggregationFn=()=>{const r=a.getCoreRowModel().flatRows[0],o=r==null?void 0:r.getValue(n.id);if(typeof o=="number")return La.sum;if(Object.prototype.toString.call(o)==="[object Date]")return La.extent},n.getAggregationFn=()=>{var r,o;if(!n)throw new Error;return ns(n.columnDef.aggregationFn)?n.columnDef.aggregationFn:n.columnDef.aggregationFn==="auto"?n.getAutoAggregationFn():(r=(o=a.options.aggregationFns)==null?void 0:o[n.columnDef.aggregationFn])!=null?r:La[n.columnDef.aggregationFn]}},createTable:n=>{n.setGrouping=a=>n.options.onGroupingChange==null?void 0:n.options.onGroupingChange(a),n.resetGrouping=a=>{var r,o;n.setGrouping(a?[]:(r=(o=n.initialState)==null?void 0:o.grouping)!=null?r:[])},n.getPreGroupedRowModel=()=>n.getFilteredRowModel(),n.getGroupedRowModel=()=>(!n._getGroupedRowModel&&n.options.getGroupedRowModel&&(n._getGroupedRowModel=n.options.getGroupedRowModel(n)),n.options.manualGrouping||!n._getGroupedRowModel?n.getPreGroupedRowModel():n._getGroupedRowModel())},createRow:(n,a)=>{n.getIsGrouped=()=>!!n.groupingColumnId,n.getGroupingValue=r=>{if(n._groupingValuesCache.hasOwnProperty(r))return n._groupingValuesCache[r];const o=a.getColumn(r);return o!=null&&o.columnDef.getGroupingValue?(n._groupingValuesCache[r]=o.columnDef.getGroupingValue(n.original),n._groupingValuesCache[r]):n.getValue(r)},n._groupingValuesCache={}},createCell:(n,a,r,o)=>{n.getIsGrouped=()=>a.getIsGrouped()&&a.id===r.groupingColumnId,n.getIsPlaceholder=()=>!n.getIsGrouped()&&a.getIsGrouped(),n.getIsAggregated=()=>{var l;return!n.getIsGrouped()&&!n.getIsPlaceholder()&&!!((l=r.subRows)!=null&&l.length)}}};function Eb(n,a,r){if(!(a!=null&&a.length)||!r)return n;const o=n.filter(c=>!a.includes(c.id));return r==="remove"?o:[...a.map(c=>n.find(d=>d.id===c)).filter(Boolean),...o]}const Ab={getInitialState:n=>({columnOrder:[],...n}),getDefaultOptions:n=>({onColumnOrderChange:pt("columnOrder",n)}),createColumn:(n,a)=>{n.getIndex=W(r=>[Mr(a,r)],r=>r.findIndex(o=>o.id===n.id),Y(a.options,"debugColumns")),n.getIsFirstColumn=r=>{var o;return((o=Mr(a,r)[0])==null?void 0:o.id)===n.id},n.getIsLastColumn=r=>{var o;const l=Mr(a,r);return((o=l[l.length-1])==null?void 0:o.id)===n.id}},createTable:n=>{n.setColumnOrder=a=>n.options.onColumnOrderChange==null?void 0:n.options.onColumnOrderChange(a),n.resetColumnOrder=a=>{var r;n.setColumnOrder(a?[]:(r=n.initialState.columnOrder)!=null?r:[])},n._getOrderColumnsFn=W(()=>[n.getState().columnOrder,n.getState().grouping,n.options.groupedColumnMode],(a,r,o)=>l=>{let c=[];if(!(a!=null&&a.length))c=l;else{const d=[...a],h=[...l];for(;h.length&&d.length;){const p=d.shift(),v=h.findIndex(x=>x.id===p);v>-1&&c.push(h.splice(v,1)[0])}c=[...c,...h]}return Eb(c,r,o)},Y(n.options,"debugTable"))}},Oa=()=>({left:[],right:[]}),Fb={getInitialState:n=>({columnPinning:Oa(),...n}),getDefaultOptions:n=>({onColumnPinningChange:pt("columnPinning",n)}),createColumn:(n,a)=>{n.pin=r=>{const o=n.getLeafColumns().map(l=>l.id).filter(Boolean);a.setColumnPinning(l=>{var c,d;if(r==="right"){var h,p;return{left:((h=l==null?void 0:l.left)!=null?h:[]).filter(y=>!(o!=null&&o.includes(y))),right:[...((p=l==null?void 0:l.right)!=null?p:[]).filter(y=>!(o!=null&&o.includes(y))),...o]}}if(r==="left"){var v,x;return{left:[...((v=l==null?void 0:l.left)!=null?v:[]).filter(y=>!(o!=null&&o.includes(y))),...o],right:((x=l==null?void 0:l.right)!=null?x:[]).filter(y=>!(o!=null&&o.includes(y)))}}return{left:((c=l==null?void 0:l.left)!=null?c:[]).filter(y=>!(o!=null&&o.includes(y))),right:((d=l==null?void 0:l.right)!=null?d:[]).filter(y=>!(o!=null&&o.includes(y)))}})},n.getCanPin=()=>n.getLeafColumns().some(o=>{var l,c,d;return((l=o.columnDef.enablePinning)!=null?l:!0)&&((c=(d=a.options.enableColumnPinning)!=null?d:a.options.enablePinning)!=null?c:!0)}),n.getIsPinned=()=>{const r=n.getLeafColumns().map(h=>h.id),{left:o,right:l}=a.getState().columnPinning,c=r.some(h=>o==null?void 0:o.includes(h)),d=r.some(h=>l==null?void 0:l.includes(h));return c?"left":d?"right":!1},n.getPinnedIndex=()=>{var r,o;const l=n.getIsPinned();return l?(r=(o=a.getState().columnPinning)==null||(o=o[l])==null?void 0:o.indexOf(n.id))!=null?r:-1:0}},createRow:(n,a)=>{n.getCenterVisibleCells=W(()=>[n._getAllVisibleCells(),a.getState().columnPinning.left,a.getState().columnPinning.right],(r,o,l)=>{const c=[...o??[],...l??[]];return r.filter(d=>!c.includes(d.column.id))},Y(a.options,"debugRows")),n.getLeftVisibleCells=W(()=>[n._getAllVisibleCells(),a.getState().columnPinning.left],(r,o)=>(o??[]).map(c=>r.find(d=>d.column.id===c)).filter(Boolean).map(c=>({...c,position:"left"})),Y(a.options,"debugRows")),n.getRightVisibleCells=W(()=>[n._getAllVisibleCells(),a.getState().columnPinning.right],(r,o)=>(o??[]).map(c=>r.find(d=>d.column.id===c)).filter(Boolean).map(c=>({...c,position:"right"})),Y(a.options,"debugRows"))},createTable:n=>{n.setColumnPinning=a=>n.options.onColumnPinningChange==null?void 0:n.options.onColumnPinningChange(a),n.resetColumnPinning=a=>{var r,o;return n.setColumnPinning(a?Oa():(r=(o=n.initialState)==null?void 0:o.columnPinning)!=null?r:Oa())},n.getIsSomeColumnsPinned=a=>{var r;const o=n.getState().columnPinning;if(!a){var l,c;return!!((l=o.left)!=null&&l.length||(c=o.right)!=null&&c.length)}return!!((r=o[a])!=null&&r.length)},n.getLeftLeafColumns=W(()=>[n.getAllLeafColumns(),n.getState().columnPinning.left],(a,r)=>(r??[]).map(o=>a.find(l=>l.id===o)).filter(Boolean),Y(n.options,"debugColumns")),n.getRightLeafColumns=W(()=>[n.getAllLeafColumns(),n.getState().columnPinning.right],(a,r)=>(r??[]).map(o=>a.find(l=>l.id===o)).filter(Boolean),Y(n.options,"debugColumns")),n.getCenterLeafColumns=W(()=>[n.getAllLeafColumns(),n.getState().columnPinning.left,n.getState().columnPinning.right],(a,r,o)=>{const l=[...r??[],...o??[]];return a.filter(c=>!l.includes(c.id))},Y(n.options,"debugColumns"))}},qi={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Pa=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Ib={getDefaultColumnDef:()=>qi,getInitialState:n=>({columnSizing:{},columnSizingInfo:Pa(),...n}),getDefaultOptions:n=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:pt("columnSizing",n),onColumnSizingInfoChange:pt("columnSizingInfo",n)}),createColumn:(n,a)=>{n.getSize=()=>{var r,o,l;const c=a.getState().columnSizing[n.id];return Math.min(Math.max((r=n.columnDef.minSize)!=null?r:qi.minSize,(o=c??n.columnDef.size)!=null?o:qi.size),(l=n.columnDef.maxSize)!=null?l:qi.maxSize)},n.getStart=W(r=>[r,Mr(a,r),a.getState().columnSizing],(r,o)=>o.slice(0,n.getIndex(r)).reduce((l,c)=>l+c.getSize(),0),Y(a.options,"debugColumns")),n.getAfter=W(r=>[r,Mr(a,r),a.getState().columnSizing],(r,o)=>o.slice(n.getIndex(r)+1).reduce((l,c)=>l+c.getSize(),0),Y(a.options,"debugColumns")),n.resetSize=()=>{a.setColumnSizing(r=>{let{[n.id]:o,...l}=r;return l})},n.getCanResize=()=>{var r,o;return((r=n.columnDef.enableResizing)!=null?r:!0)&&((o=a.options.enableColumnResizing)!=null?o:!0)},n.getIsResizing=()=>a.getState().columnSizingInfo.isResizingColumn===n.id},createHeader:(n,a)=>{n.getSize=()=>{let r=0;const o=l=>{if(l.subHeaders.length)l.subHeaders.forEach(o);else{var c;r+=(c=l.column.getSize())!=null?c:0}};return o(n),r},n.getStart=()=>{if(n.index>0){const r=n.headerGroup.headers[n.index-1];return r.getStart()+r.getSize()}return 0},n.getResizeHandler=r=>{const o=a.getColumn(n.column.id),l=o==null?void 0:o.getCanResize();return c=>{if(!o||!l||(c.persist==null||c.persist(),ka(c)&&c.touches&&c.touches.length>1))return;const d=n.getSize(),h=n?n.getLeafHeaders().map(T=>[T.column.id,T.column.getSize()]):[[o.id,o.getSize()]],p=ka(c)?Math.round(c.touches[0].clientX):c.clientX,v={},x=(T,I)=>{typeof I=="number"&&(a.setColumnSizingInfo(F=>{var $,B;const q=a.options.columnResizeDirection==="rtl"?-1:1,re=(I-(($=F==null?void 0:F.startOffset)!=null?$:0))*q,te=Math.max(re/((B=F==null?void 0:F.startSize)!=null?B:0),-.999999);return F.columnSizingStart.forEach(fe=>{let[Se,ue]=fe;v[Se]=Math.round(Math.max(ue+ue*te,0)*100)/100}),{...F,deltaOffset:re,deltaPercentage:te}}),(a.options.columnResizeMode==="onChange"||T==="end")&&a.setColumnSizing(F=>({...F,...v})))},y=T=>x("move",T),C=T=>{x("end",T),a.setColumnSizingInfo(I=>({...I,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},b=r||typeof document<"u"?document:null,E={moveHandler:T=>y(T.clientX),upHandler:T=>{b==null||b.removeEventListener("mousemove",E.moveHandler),b==null||b.removeEventListener("mouseup",E.upHandler),C(T.clientX)}},R={moveHandler:T=>(T.cancelable&&(T.preventDefault(),T.stopPropagation()),y(T.touches[0].clientX),!1),upHandler:T=>{var I;b==null||b.removeEventListener("touchmove",R.moveHandler),b==null||b.removeEventListener("touchend",R.upHandler),T.cancelable&&(T.preventDefault(),T.stopPropagation()),C((I=T.touches[0])==null?void 0:I.clientX)}},P=Mb()?{passive:!1}:!1;ka(c)?(b==null||b.addEventListener("touchmove",R.moveHandler,P),b==null||b.addEventListener("touchend",R.upHandler,P)):(b==null||b.addEventListener("mousemove",E.moveHandler,P),b==null||b.addEventListener("mouseup",E.upHandler,P)),a.setColumnSizingInfo(T=>({...T,startOffset:p,startSize:d,deltaOffset:0,deltaPercentage:0,columnSizingStart:h,isResizingColumn:o.id}))}}},createTable:n=>{n.setColumnSizing=a=>n.options.onColumnSizingChange==null?void 0:n.options.onColumnSizingChange(a),n.setColumnSizingInfo=a=>n.options.onColumnSizingInfoChange==null?void 0:n.options.onColumnSizingInfoChange(a),n.resetColumnSizing=a=>{var r;n.setColumnSizing(a?{}:(r=n.initialState.columnSizing)!=null?r:{})},n.resetHeaderSizeInfo=a=>{var r;n.setColumnSizingInfo(a?Pa():(r=n.initialState.columnSizingInfo)!=null?r:Pa())},n.getTotalSize=()=>{var a,r;return(a=(r=n.getHeaderGroups()[0])==null?void 0:r.headers.reduce((o,l)=>o+l.getSize(),0))!=null?a:0},n.getLeftTotalSize=()=>{var a,r;return(a=(r=n.getLeftHeaderGroups()[0])==null?void 0:r.headers.reduce((o,l)=>o+l.getSize(),0))!=null?a:0},n.getCenterTotalSize=()=>{var a,r;return(a=(r=n.getCenterHeaderGroups()[0])==null?void 0:r.headers.reduce((o,l)=>o+l.getSize(),0))!=null?a:0},n.getRightTotalSize=()=>{var a,r;return(a=(r=n.getRightHeaderGroups()[0])==null?void 0:r.headers.reduce((o,l)=>o+l.getSize(),0))!=null?a:0}}};let $i=null;function Mb(){if(typeof $i=="boolean")return $i;let n=!1;try{const a={get passive(){return n=!0,!1}},r=()=>{};window.addEventListener("test",r,a),window.removeEventListener("test",r)}catch{n=!1}return $i=n,$i}function ka(n){return n.type==="touchstart"}const Tb={getInitialState:n=>({columnVisibility:{},...n}),getDefaultOptions:n=>({onColumnVisibilityChange:pt("columnVisibility",n)}),createColumn:(n,a)=>{n.toggleVisibility=r=>{n.getCanHide()&&a.setColumnVisibility(o=>({...o,[n.id]:r??!n.getIsVisible()}))},n.getIsVisible=()=>{var r,o;const l=n.columns;return(r=l.length?l.some(c=>c.getIsVisible()):(o=a.getState().columnVisibility)==null?void 0:o[n.id])!=null?r:!0},n.getCanHide=()=>{var r,o;return((r=n.columnDef.enableHiding)!=null?r:!0)&&((o=a.options.enableHiding)!=null?o:!0)},n.getToggleVisibilityHandler=()=>r=>{n.toggleVisibility==null||n.toggleVisibility(r.target.checked)}},createRow:(n,a)=>{n._getAllVisibleCells=W(()=>[n.getAllCells(),a.getState().columnVisibility],r=>r.filter(o=>o.column.getIsVisible()),Y(a.options,"debugRows")),n.getVisibleCells=W(()=>[n.getLeftVisibleCells(),n.getCenterVisibleCells(),n.getRightVisibleCells()],(r,o,l)=>[...r,...o,...l],Y(a.options,"debugRows"))},createTable:n=>{const a=(r,o)=>W(()=>[o(),o().filter(l=>l.getIsVisible()).map(l=>l.id).join("_")],l=>l.filter(c=>c.getIsVisible==null?void 0:c.getIsVisible()),Y(n.options,"debugColumns"));n.getVisibleFlatColumns=a("getVisibleFlatColumns",()=>n.getAllFlatColumns()),n.getVisibleLeafColumns=a("getVisibleLeafColumns",()=>n.getAllLeafColumns()),n.getLeftVisibleLeafColumns=a("getLeftVisibleLeafColumns",()=>n.getLeftLeafColumns()),n.getRightVisibleLeafColumns=a("getRightVisibleLeafColumns",()=>n.getRightLeafColumns()),n.getCenterVisibleLeafColumns=a("getCenterVisibleLeafColumns",()=>n.getCenterLeafColumns()),n.setColumnVisibility=r=>n.options.onColumnVisibilityChange==null?void 0:n.options.onColumnVisibilityChange(r),n.resetColumnVisibility=r=>{var o;n.setColumnVisibility(r?{}:(o=n.initialState.columnVisibility)!=null?o:{})},n.toggleAllColumnsVisible=r=>{var o;r=(o=r)!=null?o:!n.getIsAllColumnsVisible(),n.setColumnVisibility(n.getAllLeafColumns().reduce((l,c)=>({...l,[c.id]:r||!(c.getCanHide!=null&&c.getCanHide())}),{}))},n.getIsAllColumnsVisible=()=>!n.getAllLeafColumns().some(r=>!(r.getIsVisible!=null&&r.getIsVisible())),n.getIsSomeColumnsVisible=()=>n.getAllLeafColumns().some(r=>r.getIsVisible==null?void 0:r.getIsVisible()),n.getToggleAllColumnsVisibilityHandler=()=>r=>{var o;n.toggleAllColumnsVisible((o=r.target)==null?void 0:o.checked)}}};function Mr(n,a){return a?a==="center"?n.getCenterVisibleLeafColumns():a==="left"?n.getLeftVisibleLeafColumns():n.getRightVisibleLeafColumns():n.getVisibleLeafColumns()}const Db={createTable:n=>{n._getGlobalFacetedRowModel=n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,"__global__"),n.getGlobalFacetedRowModel=()=>n.options.manualFiltering||!n._getGlobalFacetedRowModel?n.getPreFilteredRowModel():n._getGlobalFacetedRowModel(),n._getGlobalFacetedUniqueValues=n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,"__global__"),n.getGlobalFacetedUniqueValues=()=>n._getGlobalFacetedUniqueValues?n._getGlobalFacetedUniqueValues():new Map,n._getGlobalFacetedMinMaxValues=n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,"__global__"),n.getGlobalFacetedMinMaxValues=()=>{if(n._getGlobalFacetedMinMaxValues)return n._getGlobalFacetedMinMaxValues()}}},Lb={getInitialState:n=>({globalFilter:void 0,...n}),getDefaultOptions:n=>({onGlobalFilterChange:pt("globalFilter",n),globalFilterFn:"auto",getColumnCanGlobalFilter:a=>{var r;const o=(r=n.getCoreRowModel().flatRows[0])==null||(r=r._getAllCellsByColumnId()[a.id])==null?void 0:r.getValue();return typeof o=="string"||typeof o=="number"}}),createColumn:(n,a)=>{n.getCanGlobalFilter=()=>{var r,o,l,c;return((r=n.columnDef.enableGlobalFilter)!=null?r:!0)&&((o=a.options.enableGlobalFilter)!=null?o:!0)&&((l=a.options.enableFilters)!=null?l:!0)&&((c=a.options.getColumnCanGlobalFilter==null?void 0:a.options.getColumnCanGlobalFilter(n))!=null?c:!0)&&!!n.accessorFn}},createTable:n=>{n.getGlobalAutoFilterFn=()=>Zt.includesString,n.getGlobalFilterFn=()=>{var a,r;const{globalFilterFn:o}=n.options;return ns(o)?o:o==="auto"?n.getGlobalAutoFilterFn():(a=(r=n.options.filterFns)==null?void 0:r[o])!=null?a:Zt[o]},n.setGlobalFilter=a=>{n.options.onGlobalFilterChange==null||n.options.onGlobalFilterChange(a)},n.resetGlobalFilter=a=>{n.setGlobalFilter(a?void 0:n.initialState.globalFilter)}}},Ob={getInitialState:n=>({expanded:{},...n}),getDefaultOptions:n=>({onExpandedChange:pt("expanded",n),paginateExpandedRows:!0}),createTable:n=>{let a=!1,r=!1;n._autoResetExpanded=()=>{var o,l;if(!a){n._queue(()=>{a=!0});return}if((o=(l=n.options.autoResetAll)!=null?l:n.options.autoResetExpanded)!=null?o:!n.options.manualExpanding){if(r)return;r=!0,n._queue(()=>{n.resetExpanded(),r=!1})}},n.setExpanded=o=>n.options.onExpandedChange==null?void 0:n.options.onExpandedChange(o),n.toggleAllRowsExpanded=o=>{o??!n.getIsAllRowsExpanded()?n.setExpanded(!0):n.setExpanded({})},n.resetExpanded=o=>{var l,c;n.setExpanded(o?{}:(l=(c=n.initialState)==null?void 0:c.expanded)!=null?l:{})},n.getCanSomeRowsExpand=()=>n.getPrePaginationRowModel().flatRows.some(o=>o.getCanExpand()),n.getToggleAllRowsExpandedHandler=()=>o=>{o.persist==null||o.persist(),n.toggleAllRowsExpanded()},n.getIsSomeRowsExpanded=()=>{const o=n.getState().expanded;return o===!0||Object.values(o).some(Boolean)},n.getIsAllRowsExpanded=()=>{const o=n.getState().expanded;return typeof o=="boolean"?o===!0:!(!Object.keys(o).length||n.getRowModel().flatRows.some(l=>!l.getIsExpanded()))},n.getExpandedDepth=()=>{let o=0;return(n.getState().expanded===!0?Object.keys(n.getRowModel().rowsById):Object.keys(n.getState().expanded)).forEach(c=>{const d=c.split(".");o=Math.max(o,d.length)}),o},n.getPreExpandedRowModel=()=>n.getSortedRowModel(),n.getExpandedRowModel=()=>(!n._getExpandedRowModel&&n.options.getExpandedRowModel&&(n._getExpandedRowModel=n.options.getExpandedRowModel(n)),n.options.manualExpanding||!n._getExpandedRowModel?n.getPreExpandedRowModel():n._getExpandedRowModel())},createRow:(n,a)=>{n.toggleExpanded=r=>{a.setExpanded(o=>{var l;const c=o===!0?!0:!!(o!=null&&o[n.id]);let d={};if(o===!0?Object.keys(a.getRowModel().rowsById).forEach(h=>{d[h]=!0}):d=o,r=(l=r)!=null?l:!c,!c&&r)return{...d,[n.id]:!0};if(c&&!r){const{[n.id]:h,...p}=d;return p}return o})},n.getIsExpanded=()=>{var r;const o=a.getState().expanded;return!!((r=a.options.getIsRowExpanded==null?void 0:a.options.getIsRowExpanded(n))!=null?r:o===!0||o!=null&&o[n.id])},n.getCanExpand=()=>{var r,o,l;return(r=a.options.getRowCanExpand==null?void 0:a.options.getRowCanExpand(n))!=null?r:((o=a.options.enableExpanding)!=null?o:!0)&&!!((l=n.subRows)!=null&&l.length)},n.getIsAllParentsExpanded=()=>{let r=!0,o=n;for(;r&&o.parentId;)o=a.getRow(o.parentId,!0),r=o.getIsExpanded();return r},n.getToggleExpandedHandler=()=>{const r=n.getCanExpand();return()=>{r&&n.toggleExpanded()}}}},Wa=0,Ya=10,qa=()=>({pageIndex:Wa,pageSize:Ya}),Pb={getInitialState:n=>({...n,pagination:{...qa(),...n==null?void 0:n.pagination}}),getDefaultOptions:n=>({onPaginationChange:pt("pagination",n)}),createTable:n=>{let a=!1,r=!1;n._autoResetPageIndex=()=>{var o,l;if(!a){n._queue(()=>{a=!0});return}if((o=(l=n.options.autoResetAll)!=null?l:n.options.autoResetPageIndex)!=null?o:!n.options.manualPagination){if(r)return;r=!0,n._queue(()=>{n.resetPageIndex(),r=!1})}},n.setPagination=o=>{const l=c=>gn(o,c);return n.options.onPaginationChange==null?void 0:n.options.onPaginationChange(l)},n.resetPagination=o=>{var l;n.setPagination(o?qa():(l=n.initialState.pagination)!=null?l:qa())},n.setPageIndex=o=>{n.setPagination(l=>{let c=gn(o,l.pageIndex);const d=typeof n.options.pageCount>"u"||n.options.pageCount===-1?Number.MAX_SAFE_INTEGER:n.options.pageCount-1;return c=Math.max(0,Math.min(c,d)),{...l,pageIndex:c}})},n.resetPageIndex=o=>{var l,c;n.setPageIndex(o?Wa:(l=(c=n.initialState)==null||(c=c.pagination)==null?void 0:c.pageIndex)!=null?l:Wa)},n.resetPageSize=o=>{var l,c;n.setPageSize(o?Ya:(l=(c=n.initialState)==null||(c=c.pagination)==null?void 0:c.pageSize)!=null?l:Ya)},n.setPageSize=o=>{n.setPagination(l=>{const c=Math.max(1,gn(o,l.pageSize)),d=l.pageSize*l.pageIndex,h=Math.floor(d/c);return{...l,pageIndex:h,pageSize:c}})},n.setPageCount=o=>n.setPagination(l=>{var c;let d=gn(o,(c=n.options.pageCount)!=null?c:-1);return typeof d=="number"&&(d=Math.max(-1,d)),{...l,pageCount:d}}),n.getPageOptions=W(()=>[n.getPageCount()],o=>{let l=[];return o&&o>0&&(l=[...new Array(o)].fill(null).map((c,d)=>d)),l},Y(n.options,"debugTable")),n.getCanPreviousPage=()=>n.getState().pagination.pageIndex>0,n.getCanNextPage=()=>{const{pageIndex:o}=n.getState().pagination,l=n.getPageCount();return l===-1?!0:l===0?!1:o<l-1},n.previousPage=()=>n.setPageIndex(o=>o-1),n.nextPage=()=>n.setPageIndex(o=>o+1),n.firstPage=()=>n.setPageIndex(0),n.lastPage=()=>n.setPageIndex(n.getPageCount()-1),n.getPrePaginationRowModel=()=>n.getExpandedRowModel(),n.getPaginationRowModel=()=>(!n._getPaginationRowModel&&n.options.getPaginationRowModel&&(n._getPaginationRowModel=n.options.getPaginationRowModel(n)),n.options.manualPagination||!n._getPaginationRowModel?n.getPrePaginationRowModel():n._getPaginationRowModel()),n.getPageCount=()=>{var o;return(o=n.options.pageCount)!=null?o:Math.ceil(n.getRowCount()/n.getState().pagination.pageSize)},n.getRowCount=()=>{var o;return(o=n.options.rowCount)!=null?o:n.getPrePaginationRowModel().rows.length}}},$a=()=>({top:[],bottom:[]}),kb={getInitialState:n=>({rowPinning:$a(),...n}),getDefaultOptions:n=>({onRowPinningChange:pt("rowPinning",n)}),createRow:(n,a)=>{n.pin=(r,o,l)=>{const c=o?n.getLeafRows().map(p=>{let{id:v}=p;return v}):[],d=l?n.getParentRows().map(p=>{let{id:v}=p;return v}):[],h=new Set([...d,n.id,...c]);a.setRowPinning(p=>{var v,x;if(r==="bottom"){var y,C;return{top:((y=p==null?void 0:p.top)!=null?y:[]).filter(R=>!(h!=null&&h.has(R))),bottom:[...((C=p==null?void 0:p.bottom)!=null?C:[]).filter(R=>!(h!=null&&h.has(R))),...Array.from(h)]}}if(r==="top"){var b,E;return{top:[...((b=p==null?void 0:p.top)!=null?b:[]).filter(R=>!(h!=null&&h.has(R))),...Array.from(h)],bottom:((E=p==null?void 0:p.bottom)!=null?E:[]).filter(R=>!(h!=null&&h.has(R)))}}return{top:((v=p==null?void 0:p.top)!=null?v:[]).filter(R=>!(h!=null&&h.has(R))),bottom:((x=p==null?void 0:p.bottom)!=null?x:[]).filter(R=>!(h!=null&&h.has(R)))}})},n.getCanPin=()=>{var r;const{enableRowPinning:o,enablePinning:l}=a.options;return typeof o=="function"?o(n):(r=o??l)!=null?r:!0},n.getIsPinned=()=>{const r=[n.id],{top:o,bottom:l}=a.getState().rowPinning,c=r.some(h=>o==null?void 0:o.includes(h)),d=r.some(h=>l==null?void 0:l.includes(h));return c?"top":d?"bottom":!1},n.getPinnedIndex=()=>{var r,o;const l=n.getIsPinned();if(!l)return-1;const c=(r=l==="top"?a.getTopRows():a.getBottomRows())==null?void 0:r.map(d=>{let{id:h}=d;return h});return(o=c==null?void 0:c.indexOf(n.id))!=null?o:-1}},createTable:n=>{n.setRowPinning=a=>n.options.onRowPinningChange==null?void 0:n.options.onRowPinningChange(a),n.resetRowPinning=a=>{var r,o;return n.setRowPinning(a?$a():(r=(o=n.initialState)==null?void 0:o.rowPinning)!=null?r:$a())},n.getIsSomeRowsPinned=a=>{var r;const o=n.getState().rowPinning;if(!a){var l,c;return!!((l=o.top)!=null&&l.length||(c=o.bottom)!=null&&c.length)}return!!((r=o[a])!=null&&r.length)},n._getPinnedRows=(a,r,o)=>{var l;return((l=n.options.keepPinnedRows)==null||l?(r??[]).map(d=>{const h=n.getRow(d,!0);return h.getIsAllParentsExpanded()?h:null}):(r??[]).map(d=>a.find(h=>h.id===d))).filter(Boolean).map(d=>({...d,position:o}))},n.getTopRows=W(()=>[n.getRowModel().rows,n.getState().rowPinning.top],(a,r)=>n._getPinnedRows(a,r,"top"),Y(n.options,"debugRows")),n.getBottomRows=W(()=>[n.getRowModel().rows,n.getState().rowPinning.bottom],(a,r)=>n._getPinnedRows(a,r,"bottom"),Y(n.options,"debugRows")),n.getCenterRows=W(()=>[n.getRowModel().rows,n.getState().rowPinning.top,n.getState().rowPinning.bottom],(a,r,o)=>{const l=new Set([...r??[],...o??[]]);return a.filter(c=>!l.has(c.id))},Y(n.options,"debugRows"))}},qb={getInitialState:n=>({rowSelection:{},...n}),getDefaultOptions:n=>({onRowSelectionChange:pt("rowSelection",n),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:n=>{n.setRowSelection=a=>n.options.onRowSelectionChange==null?void 0:n.options.onRowSelectionChange(a),n.resetRowSelection=a=>{var r;return n.setRowSelection(a?{}:(r=n.initialState.rowSelection)!=null?r:{})},n.toggleAllRowsSelected=a=>{n.setRowSelection(r=>{a=typeof a<"u"?a:!n.getIsAllRowsSelected();const o={...r},l=n.getPreGroupedRowModel().flatRows;return a?l.forEach(c=>{c.getCanSelect()&&(o[c.id]=!0)}):l.forEach(c=>{delete o[c.id]}),o})},n.toggleAllPageRowsSelected=a=>n.setRowSelection(r=>{const o=typeof a<"u"?a:!n.getIsAllPageRowsSelected(),l={...r};return n.getRowModel().rows.forEach(c=>{Qa(l,c.id,o,!0,n)}),l}),n.getPreSelectedRowModel=()=>n.getCoreRowModel(),n.getSelectedRowModel=W(()=>[n.getState().rowSelection,n.getCoreRowModel()],(a,r)=>Object.keys(a).length?za(n,r):{rows:[],flatRows:[],rowsById:{}},Y(n.options,"debugTable")),n.getFilteredSelectedRowModel=W(()=>[n.getState().rowSelection,n.getFilteredRowModel()],(a,r)=>Object.keys(a).length?za(n,r):{rows:[],flatRows:[],rowsById:{}},Y(n.options,"debugTable")),n.getGroupedSelectedRowModel=W(()=>[n.getState().rowSelection,n.getSortedRowModel()],(a,r)=>Object.keys(a).length?za(n,r):{rows:[],flatRows:[],rowsById:{}},Y(n.options,"debugTable")),n.getIsAllRowsSelected=()=>{const a=n.getFilteredRowModel().flatRows,{rowSelection:r}=n.getState();let o=!!(a.length&&Object.keys(r).length);return o&&a.some(l=>l.getCanSelect()&&!r[l.id])&&(o=!1),o},n.getIsAllPageRowsSelected=()=>{const a=n.getPaginationRowModel().flatRows.filter(l=>l.getCanSelect()),{rowSelection:r}=n.getState();let o=!!a.length;return o&&a.some(l=>!r[l.id])&&(o=!1),o},n.getIsSomeRowsSelected=()=>{var a;const r=Object.keys((a=n.getState().rowSelection)!=null?a:{}).length;return r>0&&r<n.getFilteredRowModel().flatRows.length},n.getIsSomePageRowsSelected=()=>{const a=n.getPaginationRowModel().flatRows;return n.getIsAllPageRowsSelected()?!1:a.filter(r=>r.getCanSelect()).some(r=>r.getIsSelected()||r.getIsSomeSelected())},n.getToggleAllRowsSelectedHandler=()=>a=>{n.toggleAllRowsSelected(a.target.checked)},n.getToggleAllPageRowsSelectedHandler=()=>a=>{n.toggleAllPageRowsSelected(a.target.checked)}},createRow:(n,a)=>{n.toggleSelected=(r,o)=>{const l=n.getIsSelected();a.setRowSelection(c=>{var d;if(r=typeof r<"u"?r:!l,n.getCanSelect()&&l===r)return c;const h={...c};return Qa(h,n.id,r,(d=o==null?void 0:o.selectChildren)!=null?d:!0,a),h})},n.getIsSelected=()=>{const{rowSelection:r}=a.getState();return Eo(n,r)},n.getIsSomeSelected=()=>{const{rowSelection:r}=a.getState();return Xa(n,r)==="some"},n.getIsAllSubRowsSelected=()=>{const{rowSelection:r}=a.getState();return Xa(n,r)==="all"},n.getCanSelect=()=>{var r;return typeof a.options.enableRowSelection=="function"?a.options.enableRowSelection(n):(r=a.options.enableRowSelection)!=null?r:!0},n.getCanSelectSubRows=()=>{var r;return typeof a.options.enableSubRowSelection=="function"?a.options.enableSubRowSelection(n):(r=a.options.enableSubRowSelection)!=null?r:!0},n.getCanMultiSelect=()=>{var r;return typeof a.options.enableMultiRowSelection=="function"?a.options.enableMultiRowSelection(n):(r=a.options.enableMultiRowSelection)!=null?r:!0},n.getToggleSelectedHandler=()=>{const r=n.getCanSelect();return o=>{var l;r&&n.toggleSelected((l=o.target)==null?void 0:l.checked)}}}},Qa=(n,a,r,o,l)=>{var c;const d=l.getRow(a,!0);r?(d.getCanMultiSelect()||Object.keys(n).forEach(h=>delete n[h]),d.getCanSelect()&&(n[a]=!0)):delete n[a],o&&(c=d.subRows)!=null&&c.length&&d.getCanSelectSubRows()&&d.subRows.forEach(h=>Qa(n,h.id,r,o,l))};function za(n,a){const r=n.getState().rowSelection,o=[],l={},c=function(d,h){return d.map(p=>{var v;const x=Eo(p,r);if(x&&(o.push(p),l[p.id]=p),(v=p.subRows)!=null&&v.length&&(p={...p,subRows:c(p.subRows)}),x)return p}).filter(Boolean)};return{rows:c(a.rows),flatRows:o,rowsById:l}}function Eo(n,a){var r;return(r=a[n.id])!=null?r:!1}function Xa(n,a,r){var o;if(!((o=n.subRows)!=null&&o.length))return!1;let l=!0,c=!1;return n.subRows.forEach(d=>{if(!(c&&!l)&&(d.getCanSelect()&&(Eo(d,a)?c=!0:l=!1),d.subRows&&d.subRows.length)){const h=Xa(d,a);h==="all"?c=!0:(h==="some"&&(c=!0),l=!1)}}),l?"all":c?"some":!1}const Za=/([0-9]+)/gm,$b=(n,a,r)=>_d(pn(n.getValue(r)).toLowerCase(),pn(a.getValue(r)).toLowerCase()),zb=(n,a,r)=>_d(pn(n.getValue(r)),pn(a.getValue(r))),Bb=(n,a,r)=>Ao(pn(n.getValue(r)).toLowerCase(),pn(a.getValue(r)).toLowerCase()),Vb=(n,a,r)=>Ao(pn(n.getValue(r)),pn(a.getValue(r))),Ub=(n,a,r)=>{const o=n.getValue(r),l=a.getValue(r);return o>l?1:o<l?-1:0},Gb=(n,a,r)=>Ao(n.getValue(r),a.getValue(r));function Ao(n,a){return n===a?0:n>a?1:-1}function pn(n){return typeof n=="number"?isNaN(n)||n===1/0||n===-1/0?"":String(n):typeof n=="string"?n:""}function _d(n,a){const r=n.split(Za).filter(Boolean),o=a.split(Za).filter(Boolean);for(;r.length&&o.length;){const l=r.shift(),c=o.shift(),d=parseInt(l,10),h=parseInt(c,10),p=[d,h].sort();if(isNaN(p[0])){if(l>c)return 1;if(c>l)return-1;continue}if(isNaN(p[1]))return isNaN(d)?-1:1;if(d>h)return 1;if(h>d)return-1}return r.length-o.length}const Rr={alphanumeric:$b,alphanumericCaseSensitive:zb,text:Bb,textCaseSensitive:Vb,datetime:Ub,basic:Gb},Hb={getInitialState:n=>({sorting:[],...n}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:n=>({onSortingChange:pt("sorting",n),isMultiSortEvent:a=>a.shiftKey}),createColumn:(n,a)=>{n.getAutoSortingFn=()=>{const r=a.getFilteredRowModel().flatRows.slice(10);let o=!1;for(const l of r){const c=l==null?void 0:l.getValue(n.id);if(Object.prototype.toString.call(c)==="[object Date]")return Rr.datetime;if(typeof c=="string"&&(o=!0,c.split(Za).length>1))return Rr.alphanumeric}return o?Rr.text:Rr.basic},n.getAutoSortDir=()=>{const r=a.getFilteredRowModel().flatRows[0];return typeof(r==null?void 0:r.getValue(n.id))=="string"?"asc":"desc"},n.getSortingFn=()=>{var r,o;if(!n)throw new Error;return ns(n.columnDef.sortingFn)?n.columnDef.sortingFn:n.columnDef.sortingFn==="auto"?n.getAutoSortingFn():(r=(o=a.options.sortingFns)==null?void 0:o[n.columnDef.sortingFn])!=null?r:Rr[n.columnDef.sortingFn]},n.toggleSorting=(r,o)=>{const l=n.getNextSortingOrder(),c=typeof r<"u"&&r!==null;a.setSorting(d=>{const h=d==null?void 0:d.find(b=>b.id===n.id),p=d==null?void 0:d.findIndex(b=>b.id===n.id);let v=[],x,y=c?r:l==="desc";if(d!=null&&d.length&&n.getCanMultiSort()&&o?h?x="toggle":x="add":d!=null&&d.length&&p!==d.length-1?x="replace":h?x="toggle":x="replace",x==="toggle"&&(c||l||(x="remove")),x==="add"){var C;v=[...d,{id:n.id,desc:y}],v.splice(0,v.length-((C=a.options.maxMultiSortColCount)!=null?C:Number.MAX_SAFE_INTEGER))}else x==="toggle"?v=d.map(b=>b.id===n.id?{...b,desc:y}:b):x==="remove"?v=d.filter(b=>b.id!==n.id):v=[{id:n.id,desc:y}];return v})},n.getFirstSortDir=()=>{var r,o;return((r=(o=n.columnDef.sortDescFirst)!=null?o:a.options.sortDescFirst)!=null?r:n.getAutoSortDir()==="desc")?"desc":"asc"},n.getNextSortingOrder=r=>{var o,l;const c=n.getFirstSortDir(),d=n.getIsSorted();return d?d!==c&&((o=a.options.enableSortingRemoval)==null||o)&&(!(r&&(l=a.options.enableMultiRemove)!=null)||l)?!1:d==="desc"?"asc":"desc":c},n.getCanSort=()=>{var r,o;return((r=n.columnDef.enableSorting)!=null?r:!0)&&((o=a.options.enableSorting)!=null?o:!0)&&!!n.accessorFn},n.getCanMultiSort=()=>{var r,o;return(r=(o=n.columnDef.enableMultiSort)!=null?o:a.options.enableMultiSort)!=null?r:!!n.accessorFn},n.getIsSorted=()=>{var r;const o=(r=a.getState().sorting)==null?void 0:r.find(l=>l.id===n.id);return o?o.desc?"desc":"asc":!1},n.getSortIndex=()=>{var r,o;return(r=(o=a.getState().sorting)==null?void 0:o.findIndex(l=>l.id===n.id))!=null?r:-1},n.clearSorting=()=>{a.setSorting(r=>r!=null&&r.length?r.filter(o=>o.id!==n.id):[])},n.getToggleSortingHandler=()=>{const r=n.getCanSort();return o=>{r&&(o.persist==null||o.persist(),n.toggleSorting==null||n.toggleSorting(void 0,n.getCanMultiSort()?a.options.isMultiSortEvent==null?void 0:a.options.isMultiSortEvent(o):!1))}}},createTable:n=>{n.setSorting=a=>n.options.onSortingChange==null?void 0:n.options.onSortingChange(a),n.resetSorting=a=>{var r,o;n.setSorting(a?[]:(r=(o=n.initialState)==null?void 0:o.sorting)!=null?r:[])},n.getPreSortedRowModel=()=>n.getGroupedRowModel(),n.getSortedRowModel=()=>(!n._getSortedRowModel&&n.options.getSortedRowModel&&(n._getSortedRowModel=n.options.getSortedRowModel(n)),n.options.manualSorting||!n._getSortedRowModel?n.getPreSortedRowModel():n._getSortedRowModel())}},Kb=[hb,Tb,Ab,Fb,pb,xb,Db,Lb,Hb,Rb,Ob,Pb,kb,qb,Ib];function Wb(n){var a,r;const o=[...Kb,...(a=n._features)!=null?a:[]];let l={_features:o};const c=l._features.reduce((C,b)=>Object.assign(C,b.getDefaultOptions==null?void 0:b.getDefaultOptions(l)),{}),d=C=>l.options.mergeOptions?l.options.mergeOptions(c,C):{...c,...C};let p={...{},...(r=n.initialState)!=null?r:{}};l._features.forEach(C=>{var b;p=(b=C.getInitialState==null?void 0:C.getInitialState(p))!=null?b:p});const v=[];let x=!1;const y={_features:o,options:{...c,...n},initialState:p,_queue:C=>{v.push(C),x||(x=!0,Promise.resolve().then(()=>{for(;v.length;)v.shift()();x=!1}).catch(b=>setTimeout(()=>{throw b})))},reset:()=>{l.setState(l.initialState)},setOptions:C=>{const b=gn(C,l.options);l.options=d(b)},getState:()=>l.options.state,setState:C=>{l.options.onStateChange==null||l.options.onStateChange(C)},_getRowId:(C,b,E)=>{var R;return(R=l.options.getRowId==null?void 0:l.options.getRowId(C,b,E))!=null?R:`${E?[E.id,b].join("."):b}`},getCoreRowModel:()=>(l._getCoreRowModel||(l._getCoreRowModel=l.options.getCoreRowModel(l)),l._getCoreRowModel()),getRowModel:()=>l.getPaginationRowModel(),getRow:(C,b)=>{let E=(b?l.getPrePaginationRowModel():l.getRowModel()).rowsById[C];if(!E&&(E=l.getCoreRowModel().rowsById[C],!E))throw new Error;return E},_getDefaultColumnDef:W(()=>[l.options.defaultColumn],C=>{var b;return C=(b=C)!=null?b:{},{header:E=>{const R=E.header.column.columnDef;return R.accessorKey?R.accessorKey:R.accessorFn?R.id:null},cell:E=>{var R,P;return(R=(P=E.renderValue())==null||P.toString==null?void 0:P.toString())!=null?R:null},...l._features.reduce((E,R)=>Object.assign(E,R.getDefaultColumnDef==null?void 0:R.getDefaultColumnDef()),{}),...C}},Y(n,"debugColumns")),_getColumnDefs:()=>l.options.columns,getAllColumns:W(()=>[l._getColumnDefs()],C=>{const b=function(E,R,P){return P===void 0&&(P=0),E.map(T=>{const I=mb(l,T,P,R),F=T;return I.columns=F.columns?b(F.columns,I,P+1):[],I})};return b(C)},Y(n,"debugColumns")),getAllFlatColumns:W(()=>[l.getAllColumns()],C=>C.flatMap(b=>b.getFlatColumns()),Y(n,"debugColumns")),_getAllFlatColumnsById:W(()=>[l.getAllFlatColumns()],C=>C.reduce((b,E)=>(b[E.id]=E,b),{}),Y(n,"debugColumns")),getAllLeafColumns:W(()=>[l.getAllColumns(),l._getOrderColumnsFn()],(C,b)=>{let E=C.flatMap(R=>R.getLeafColumns());return b(E)},Y(n,"debugColumns")),getColumn:C=>l._getAllFlatColumnsById()[C]};Object.assign(l,y);for(let C=0;C<l._features.length;C++){const b=l._features[C];b==null||b.createTable==null||b.createTable(l)}return l}function bd(){return n=>W(()=>[n.options.data],a=>{const r={rows:[],flatRows:[],rowsById:{}},o=function(l,c,d){c===void 0&&(c=0);const h=[];for(let v=0;v<l.length;v++){const x=No(n,n._getRowId(l[v],v,d),l[v],v,c,void 0,d==null?void 0:d.id);if(r.flatRows.push(x),r.rowsById[x.id]=x,h.push(x),n.options.getSubRows){var p;x.originalSubRows=n.options.getSubRows(l[v],v),(p=x.originalSubRows)!=null&&p.length&&(x.subRows=o(x.originalSubRows,c+1,x))}}return h};return r.rows=o(a),r},Y(n.options,"debugTable","getRowModel",()=>n._autoResetPageIndex()))}function wd(n,a,r){return r.options.filterFromLeafRows?Yb(n,a,r):Qb(n,a,r)}function Yb(n,a,r){var o;const l=[],c={},d=(o=r.options.maxLeafRowFilterDepth)!=null?o:100,h=function(p,v){v===void 0&&(v=0);const x=[];for(let C=0;C<p.length;C++){var y;let b=p[C];const E=No(r,b.id,b.original,b.index,b.depth,void 0,b.parentId);if(E.columnFilters=b.columnFilters,(y=b.subRows)!=null&&y.length&&v<d){if(E.subRows=h(b.subRows,v+1),b=E,a(b)&&!E.subRows.length){x.push(b),c[b.id]=b,l.push(b);continue}if(a(b)||E.subRows.length){x.push(b),c[b.id]=b,l.push(b);continue}}else b=E,a(b)&&(x.push(b),c[b.id]=b,l.push(b))}return x};return{rows:h(n),flatRows:l,rowsById:c}}function Qb(n,a,r){var o;const l=[],c={},d=(o=r.options.maxLeafRowFilterDepth)!=null?o:100,h=function(p,v){v===void 0&&(v=0);const x=[];for(let C=0;C<p.length;C++){let b=p[C];if(a(b)){var y;if((y=b.subRows)!=null&&y.length&&v<d){const R=No(r,b.id,b.original,b.index,b.depth,void 0,b.parentId);R.subRows=h(b.subRows,v+1),b=R}x.push(b),l.push(b),c[b.id]=b}}return x};return{rows:h(n),flatRows:l,rowsById:c}}function Xb(){return(n,a)=>W(()=>[n.getPreFilteredRowModel(),n.getState().columnFilters,n.getState().globalFilter,n.getFilteredRowModel()],(r,o,l)=>{if(!r.rows.length||!(o!=null&&o.length)&&!l)return r;const c=[...o.map(h=>h.id).filter(h=>h!==a),l?"__global__":void 0].filter(Boolean),d=h=>{for(let p=0;p<c.length;p++)if(h.columnFilters[c[p]]===!1)return!1;return!0};return wd(r.rows,d,n)},Y(n.options,"debugTable"))}function Zb(){return(n,a)=>W(()=>{var r;return[(r=n.getColumn(a))==null?void 0:r.getFacetedRowModel()]},r=>{if(!r)return new Map;let o=new Map;for(let c=0;c<r.flatRows.length;c++){const d=r.flatRows[c].getUniqueValues(a);for(let h=0;h<d.length;h++){const p=d[h];if(o.has(p)){var l;o.set(p,((l=o.get(p))!=null?l:0)+1)}else o.set(p,1)}}return o},Y(n.options,"debugTable"))}function Jb(){return n=>W(()=>[n.getPreFilteredRowModel(),n.getState().columnFilters,n.getState().globalFilter],(a,r,o)=>{if(!a.rows.length||!(r!=null&&r.length)&&!o){for(let C=0;C<a.flatRows.length;C++)a.flatRows[C].columnFilters={},a.flatRows[C].columnFiltersMeta={};return a}const l=[],c=[];(r??[]).forEach(C=>{var b;const E=n.getColumn(C.id);if(!E)return;const R=E.getFilterFn();R&&l.push({id:C.id,filterFn:R,resolvedValue:(b=R.resolveFilterValue==null?void 0:R.resolveFilterValue(C.value))!=null?b:C.value})});const d=(r??[]).map(C=>C.id),h=n.getGlobalFilterFn(),p=n.getAllLeafColumns().filter(C=>C.getCanGlobalFilter());o&&h&&p.length&&(d.push("__global__"),p.forEach(C=>{var b;c.push({id:C.id,filterFn:h,resolvedValue:(b=h.resolveFilterValue==null?void 0:h.resolveFilterValue(o))!=null?b:o})}));let v,x;for(let C=0;C<a.flatRows.length;C++){const b=a.flatRows[C];if(b.columnFilters={},l.length)for(let E=0;E<l.length;E++){v=l[E];const R=v.id;b.columnFilters[R]=v.filterFn(b,R,v.resolvedValue,P=>{b.columnFiltersMeta[R]=P})}if(c.length){for(let E=0;E<c.length;E++){x=c[E];const R=x.id;if(x.filterFn(b,R,x.resolvedValue,P=>{b.columnFiltersMeta[R]=P})){b.columnFilters.__global__=!0;break}}b.columnFilters.__global__!==!0&&(b.columnFilters.__global__=!1)}}const y=C=>{for(let b=0;b<d.length;b++)if(C.columnFilters[d[b]]===!1)return!1;return!0};return wd(a.rows,y,n)},Y(n.options,"debugTable","getFilteredRowModel",()=>n._autoResetPageIndex()))}function ew(){return n=>W(()=>[n.getState().sorting,n.getPreSortedRowModel()],(a,r)=>{if(!r.rows.length||!(a!=null&&a.length))return r;const o=n.getState().sorting,l=[],c=o.filter(p=>{var v;return(v=n.getColumn(p.id))==null?void 0:v.getCanSort()}),d={};c.forEach(p=>{const v=n.getColumn(p.id);v&&(d[p.id]={sortUndefined:v.columnDef.sortUndefined,invertSorting:v.columnDef.invertSorting,sortingFn:v.getSortingFn()})});const h=p=>{const v=p.map(x=>({...x}));return v.sort((x,y)=>{for(let b=0;b<c.length;b+=1){var C;const E=c[b],R=d[E.id],P=R.sortUndefined,T=(C=E==null?void 0:E.desc)!=null?C:!1;let I=0;if(P){const F=x.getValue(E.id),$=y.getValue(E.id),B=F===void 0,q=$===void 0;if(B||q){if(P==="first")return B?-1:1;if(P==="last")return B?1:-1;I=B&&q?0:B?P:-P}}if(I===0&&(I=R.sortingFn(x,y,E.id)),I!==0)return T&&(I*=-1),R.invertSorting&&(I*=-1),I}return x.index-y.index}),v.forEach(x=>{var y;l.push(x),(y=x.subRows)!=null&&y.length&&(x.subRows=h(x.subRows))}),v};return{rows:h(r.rows),flatRows:l,rowsById:r.rowsById}},Y(n.options,"debugTable","getSortedRowModel",()=>n._autoResetPageIndex()))}/**
* react-table
*
* Copyright (c) TanStack
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function Gi(n,a){return n?tw(n)?L.createElement(n,a):n:null}function tw(n){return nw(n)||typeof n=="function"||rw(n)}function nw(n){return typeof n=="function"&&(()=>{const a=Object.getPrototypeOf(n);return a.prototype&&a.prototype.isReactComponent})()}function rw(n){return typeof n=="object"&&typeof n.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(n.$$typeof.description)}function Sd(n){const a={state:{},onStateChange:()=>{},renderFallbackValue:null,...n},[r]=L.useState(()=>({current:Wb(a)})),[o,l]=L.useState(()=>r.current.initialState);return r.current.setOptions(c=>({...c,...n,state:{...o,...n.state},onStateChange:d=>{l(d),n.onStateChange==null||n.onStateChange(d)}})),r.current}const iw=({buttonText:n,title:a="",content:r,className:o=""})=>i.jsx("div",{className:`flex items-baseline justify-center mr-4 font-medium ${o}`,children:i.jsxs(Dr,{children:[i.jsx(Mc,{asChild:!0,children:i.jsxs(H,{variant:"link",className:"inline-flex items-center font-medium group",children:[i.jsx("span",{className:"underline-offset-4 group-hover:underline",children:n}),i.jsx(T_,{className:"w-4 h-4 ml-1 text-muted-foreground"})]})}),i.jsxs(Lr,{className:"sm:max-w-[425px]",children:[i.jsx(Or,{children:i.jsx(Pr,{children:a})}),i.jsxs(to,{className:"grid gap-4 py-2",children:[r,i.jsx(kr,{children:i.jsx(Bi,{asChild:!0,children:i.jsx(H,{type:"button",children:S("common.close")})})})]})]})]})});function sw(n){let o=0;for(let x=0;x<n.length;x++)o=n.charCodeAt(x)+((o<<5)-o);let l="#";for(let x=0;x<3;x++){const y=o>>x*8&255;l+=("00"+y.toString(16)).substr(-2)}const c=parseInt(l.substr(1,2),16),d=parseInt(l.substr(3,2),16),h=parseInt(l.substr(5,2),16),p=`#${(c*.7|0).toString(16).padStart(2,"0")}${(d*.7|0).toString(16).padStart(2,"0")}${(h*.7|0).toString(16).padStart(2,"0")}`,v=`#${Math.min(255,Math.floor(c+(255-c)*.7)).toString(16).padStart(2,"0")}${Math.min(255,Math.floor(d+(255-d)*.7)).toString(16).padStart(2,"0")}${Math.min(255,Math.floor(h+(255-h)*.7)).toString(16).padStart(2,"0")}`;return[p,v]}const Cd=({label:n,className:a})=>{const[r,o]=sw(n);return i.jsx(no,{className:a,style:a?{}:{backgroundColor:o,color:r},children:n})};function jd({table:n,header:a,className:r}){return a.column.getCanSort()?i.jsx("div",{className:me("flex items-center space-x-2",r),children:i.jsxs(Yi,{children:[i.jsx(Qi,{asChild:!0,children:i.jsxs(H,{"aria-label":a.column.getIsSorted()==="desc"?S("common.sort_desc_description"):a.column.getIsSorted()==="asc"?S("common.sort_asc_description"):S("sort_none_description"),size:"sm",variant:"ghost",className:"-ml-3 h-8 data-[state=open]:bg-accent font-bold text-muted-foreground",children:[Gi(a.column.columnDef.header,a.getContext()),a.column.getIsSorted()==="desc"?i.jsx(vc,{className:"w-4 h-4 ml-2","aria-hidden":"true"}):a.column.getIsSorted()==="asc"?i.jsx(_c,{className:"w-4 h-4 ml-2","aria-hidden":"true"}):i.jsx(k0,{className:"w-4 h-4 ml-2 text-muted-foreground/30","aria-hidden":"true"})]})}),i.jsxs(Xi,{align:"start",children:[a.column.getCanSort()&&i.jsxs(i.Fragment,{children:[i.jsxs(Ar,{onClick:()=>a.column.toggleSorting(!1),"aria-label":S("common.sort_asc"),children:[i.jsx(_c,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":"true"}),S("common.sort_asc")]}),i.jsxs(Ar,{onClick:()=>a.column.toggleSorting(!0),"aria-label":S("common.sort_desc"),children:[i.jsx(vc,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":"true"}),S("common.sort_desc")]})]}),a.column.getCanSort()&&a.column.getCanHide()&&i.jsx(ro,{}),a.column.getCanHide()&&i.jsxs(Ar,{onClick:()=>a.column.toggleVisibility(!1),"aria-label":S("Hide"),children:[i.jsx(rd,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":"true"}),S("Hide")]})]})]})}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:me("data-[state=open]:bg-accent tracking-wide text-ellipsis",r),children:a.isPlaceholder?null:Gi(a.column.columnDef.header,a.getContext())}),!1]})}function aw({table:n,className:a,enablePageSizeSelector:r=!0,visible:o="auto"}){const l=L.useMemo(()=>o===!0,[o]),c=L.useMemo(()=>o==="auto",[o]);return!l||c&&n.getPageCount()<1?null:i.jsxs("div",{className:a,children:[i.jsx("div",{className:"flex-1 text-base text-muted-foreground",children:n.getSelectedRowModel().rows.length>0&&i.jsx(i.Fragment,{children:S("common.rows_selected_of_total",{count:n.getFilteredSelectedRowModel().rows.length,total:n.getFilteredRowModel().rows.length})})}),i.jsxs("div",{className:"flex justify-between space-x-6 lg:space-x-8",children:[r&&i.jsxs("div",{className:"flex items-center space-x-2 grow",children:[i.jsx("p",{className:"text-sm font-medium",children:S("common.rows_per_page")}),i.jsxs(io,{value:`${n.getState().pagination.pageSize}`,onValueChange:d=>{n.setPageSize(Number(d))},children:[i.jsx(so,{className:"h-8 w-[70px]",children:i.jsx(ao,{placeholder:n.getState().pagination.pageSize})}),i.jsx(oo,{side:"top",children:D_.map(d=>i.jsx(Fr,{value:`${d}`,children:d},d))})]})]}),i.jsxs("div",{className:me("flex space-x-2 flex-1",r?"justify-end":"justify-between"),children:[i.jsx("div",{className:"flex w-[150px] items-center justify-start",children:i.jsx("p",{className:"text-sm font-medium ",children:S("common.num_page_of_total",{count:n.getState().pagination.pageIndex+1,total:n.getPageCount()})})}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsxs(H,{type:"button",variant:"outline",className:"hidden w-8 h-8 p-0 lg:flex",onClick:()=>n.setPageIndex(L_),disabled:!n.getCanPreviousPage(),children:[i.jsx("span",{className:"sr-only",children:S("common.go_to_first_page")}),i.jsx(q0,{className:"w-4 h-4"})]}),i.jsxs(H,{type:"button",variant:"outline",className:"w-8 h-8 p-0",onClick:()=>n.previousPage(),disabled:!n.getCanPreviousPage(),children:[i.jsx("span",{className:"sr-only",children:S("common.go_to_prev_page")}),i.jsx(O_,{className:"w-4 h-4"})]}),i.jsxs(H,{type:"button",variant:"outline",className:"w-8 h-8 p-0",onClick:()=>n.nextPage(),disabled:!n.getCanNextPage(),children:[i.jsx("span",{className:"sr-only",children:S("common.go_to_next_page")}),i.jsx(P_,{className:"w-4 h-4"})]}),i.jsxs(H,{type:"button",variant:"outline",className:"hidden w-8 h-8 p-0 lg:flex",onClick:()=>n.setPageIndex(n.getPageCount()+1),disabled:!n.getCanNextPage(),children:[i.jsx("span",{className:"sr-only",children:S("common.go_to_last_page")}),i.jsx($0,{className:"w-4 h-4"})]})]})]})]})]})}function rs({table:n,title:a,description:r,caption:o,paginationOptions:l,headerOptions:c={visible:!0},children:d,className:h,contentClassName:p,footerClassName:v,rowClassName:x,cellClassName:y,onRowClick:C,activeRowIndex:b}){var R;const E=c==null?void 0:c.visible;return i.jsxs(qe,{className:h,children:[(a||r)&&i.jsxs(yt,{className:"pb-0",children:[i.jsx(Xe,{children:a}),i.jsx(nt,{children:r})]}),i.jsxs($e,{className:me("pt-6",p),children:[d&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex space-x-2",children:d}),i.jsx(mn,{className:"my-4"})]}),i.jsxs(lo,{children:[typeof o<"u"&&i.jsx(k_,{children:o}),E&&n.getHeaderGroups().length&&i.jsx(uo,{children:n.getHeaderGroups().map(P=>i.jsx(In,{className:x,children:P.headers.map(T=>i.jsx(co,{colSpan:T.colSpan,style:{width:T.getSize()===Number.MAX_SAFE_INTEGER?"auto":T.getSize()},children:i.jsx(jd,{table:n,header:T})},T.id))},P.id))}),i.jsx(fo,{children:(R=n.getRowModel().rows)!=null&&R.length?n.getRowModel().rows.map(P=>i.jsx(In,{onClick:()=>{C&&C(P)},tabIndex:0,"data-state":P.getIsSelected()&&"selected",className:me(P.getIsSelected()||b===P.index?"bg-accent cursor-pointer hover:bg-accent":"cursor-pointer",x),children:P.getVisibleCells().map(T=>i.jsx(Vi,{className:y,style:{width:T.column.getSize()===Number.MAX_SAFE_INTEGER?"auto":T.column.getSize()},children:Gi(T.column.columnDef.cell,T.getContext())},T.id))},P.id)):i.jsx(In,{className:x,children:i.jsx(Vi,{className:me("h-24 text-center",y),colSpan:n.getAllColumns.length,children:"No hay datos para mostrar"})})})]})]}),i.jsx(kt,{className:v,children:i.jsx(aw,{className:"flex-1",table:n,...l})})]})}function ow({actions:n,rowContext:a}){return i.jsxs(Yi,{children:[i.jsx(Qi,{asChild:!0,children:i.jsxs(H,{size:"icon",variant:"outline",className:"w-8 h-8",children:[i.jsx(U0,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"sr-only",children:S("common.open_menu")})]})}),i.jsxs(Xi,{align:"end",children:[i.jsxs(Tc,{children:[S("common.actions")," "]}),n&&n(a).map((r,o)=>r.label==="-"?i.jsx(ro,{},o):i.jsxs(Ar,{onClick:l=>r.onClick?r.onClick(a,l):null,children:[r.icon&&i.jsx(i.Fragment,{children:r.icon}),r.label,r.shortcut&&i.jsx(q_,{children:r.shortcut})]},o))]})]})}function lw(){return{id:"select",header:({table:n})=>i.jsx(Ui,{id:"select-all",checked:n.getIsAllPageRowsSelected()||n.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:a=>n.toggleAllPageRowsSelected(!!a),"aria-label":"Seleccionar todo",className:"translate-y-[2px]"}),cell:({row:n})=>i.jsx(Ui,{id:`select-row-${n.id}`,checked:n.getIsSelected(),onCheckedChange:a=>{n.toggleSelected(!!a)},"aria-label":"Seleccionar file",className:"translate-y-[2px]"}),enableSorting:!1,enableHiding:!1}}function is({columnCount:n,rowCount:a=10,searchableColumnCount:r=0,filterableColumnCount:o=0,showViewOptions:l=!0,cellWidths:c=["auto"],withPagination:d=!0,shrinkZero:h=!1,className:p,...v}){return i.jsxs("div",{className:me("w-full space-y-2.5 overflow-auto",p),...v,children:[i.jsxs("div",{className:"flex items-center justify-between w-full p-1 space-x-2 overflow-auto",children:[i.jsxs("div",{className:"flex items-center flex-1 space-x-2",children:[r>0?Array.from({length:r}).map((x,y)=>i.jsx(ut,{className:"w-40 h-7 lg:w-60"},y)):null,o>0?Array.from({length:o}).map((x,y)=>i.jsx(ut,{className:"h-7 w-[4.5rem] border-dashed"},y)):null]}),l?i.jsx(ut,{className:"ml-auto hidden h-7 w-[4.5rem] lg:flex"}):null]}),i.jsx("div",{className:"border rounded-md",children:i.jsxs(lo,{children:[i.jsx(uo,{children:Array.from({length:1}).map((x,y)=>i.jsx(In,{className:"hover:bg-transparent",children:Array.from({length:n}).map((C,b)=>i.jsx(co,{style:{width:c[b],minWidth:h?c[b]:"auto"},children:i.jsx(ut,{className:"w-full h-6"})},b))},y))}),i.jsx(fo,{children:Array.from({length:a}).map((x,y)=>i.jsx(In,{className:"hover:bg-transparent",children:Array.from({length:n}).map((C,b)=>i.jsx(Vi,{style:{width:c[b],minWidth:h?c[b]:"auto"},children:i.jsx(ut,{className:"w-full h-6"})},b))},y))})]})}),d?i.jsxs("div",{className:"flex items-center justify-between w-full gap-4 p-1 overflow-auto sm:gap-8",children:[i.jsx(ut,{className:"w-40 h-7 shrink-0"}),i.jsxs("div",{className:"flex items-center gap-4 sm:gap-6 lg:gap-8",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(ut,{className:"w-24 h-7"}),i.jsx(ut,{className:"h-7 w-[4.5rem]"})]}),i.jsx("div",{className:"flex items-center justify-center text-sm font-medium",children:i.jsx(ut,{className:"w-20 h-7"})}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(ut,{className:"hidden size-7 lg:block"}),i.jsx(ut,{className:"size-7"}),i.jsx(ut,{className:"size-7"}),i.jsx(ut,{className:"hidden size-7 lg:block"})]})]})]}):null]})}const ss=({title:n="Esto está muy vacío",subtitle:a="Empieza solicitando la carga del catálogo",buttonText:r="Solicitar carga del catálogo",onButtonClick:o=()=>{},actions:l=()=>i.jsx(i.Fragment,{})})=>i.jsxs("div",{className:"text-center",children:[i.jsx("svg",{className:"w-12 h-12 mx-auto text-slate-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:i.jsx("path",{vectorEffect:"non-scaling-stroke",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 13h6m-3-3v6m-9 1V7a2 2 0 012-2h6l2 2h6a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2z"})}),i.jsx("h3",{className:"mt-2 text-lg font-semibold text-slate-900",children:n}),i.jsx("p",{className:"mt-1 text-base text-slate-500",children:a}),i.jsxs("div",{className:"items-center mt-6",children:[l&&i.jsx(i.Fragment,{children:l}),!l&&i.jsxs(H,{className:"my-4",onClick:o,children:[i.jsx(jo,{}),r]})]})]}),uw=xo("flex h-10 w-full rounded-md bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",{variants:{variant:{default:"border border-input ring-offset-background focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ",outline:"focus-visible:border focus-visible:border-input"}},defaultVariants:{variant:"default"}}),Hi=n=>{const{name:a,label:r,hint:o,description:l,placeholder:c,className:d,disabled:h,defaultValue:p,rules:v,readOnly:x,scale:y,variant:C}=n,{control:b}=rr(),[E,R]=L.useState(""),P={input:T=>{if(typeof T!="object")return T;const I=$t.create(T);if(I.isFailure)throw I.error;const F=I.object.toString();return E.endsWith(",")?F.replace(/.0$/,","):F},output:(T,I,F)=>{const{value:$}=F??{value:null};R($??"");const B=$t.createFromFormattedValue($);if(B.isFailure)throw B.error;return B.object.toObject()}};return i.jsx(go,{defaultValue:p,control:b,name:a,disabled:h,rules:{max:100,min:0,...v},render:({field:T})=>{const I=P.input(T.value),F=h||T.disabled,$=!!((v==null?void 0:v.required)??!1);return i.jsxs(mo,{className:me(d,"space-y-3"),children:[r&&i.jsx(ho,{label:r,hint:o,required:$}),i.jsx(po,{children:i.jsx(Dc,{name:T.name,ref:T.ref,onBlur:T.onBlur,disabled:F,readOnly:x,className:me(uw({variant:C,className:d})),groupSeparator:".",decimalSeparator:",",placeholder:c,allowDecimals:y!==0,decimalsLimit:y,decimalScale:y,step:1,value:I,onValueChange:(B,q,re)=>T.onChange(P.output(B,q,re))})}),l&&i.jsx(vo,{children:l}),i.jsx(_o,{})]})}})},cw=xo("flex h-10 w-full rounded-md bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",{variants:{variant:{default:"border border-input ring-offset-background focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ",outline:"focus-visible:border focus-visible:border-input"}},defaultVariants:{variant:"default"}}),dw=n=>{const{name:a,label:r,hint:o,description:l,placeholder:c,className:d,disabled:h,defaultValue:p,rules:v,readOnly:x,scale:y,variant:C}=n,{control:b}=rr(),[E,R]=L.useState(""),P={input:T=>{if(typeof T!="object")return T;const I=hn.create(T);if(I.isFailure)throw I.error;const F=I.object.toString();return E.endsWith(",")?F.replace(/.0$/,","):F},output:(T,I,F)=>{const{value:$}=F??{value:null};R($??"");const B=hn.createFromFormattedValue($);if(B.isFailure)throw B.error;return B.object.toObject()}};return i.jsx(go,{defaultValue:p,control:b,name:a,disabled:h,rules:v,render:({field:T})=>{const I=P.input(T.value),F=h||T.disabled,$=!!((v==null?void 0:v.required)??!1);return i.jsxs(mo,{className:me(d,"space-y-3"),children:[r&&i.jsx(ho,{label:r,hint:o,required:$}),i.jsx(po,{children:i.jsx(Dc,{name:T.name,ref:T.ref,onBlur:T.onBlur,disabled:F,readOnly:x,className:me(cw({variant:C,className:d})),groupSeparator:".",decimalSeparator:",",placeholder:c,allowDecimals:y!==0,decimalsLimit:y,decimalScale:y,step:1,value:I,onValueChange:(B,q,re)=>T.onChange(P.output(B,q,re))})}),l&&i.jsx(vo,{children:l}),i.jsx(_o,{})]})}})},fw=xo("",{variants:{variant:{default:"",ghost:"border-0 focus-visible:border focus-visible:border-input focus-visible:ring-0 focus-visible:ring-offset-0 "}},defaultVariants:{variant:"default"}}),Fn=n=>{const{name:a,label:r,hint:o,description:l,placeholder:c,className:d,disabled:h,rules:p,required:v,type:x,variant:y}=n,{control:C}=rr();return i.jsx(go,{control:C,name:a,disabled:h,rules:{required:v,...p},render:({field:b,fieldState:E})=>{const R=!!((p==null?void 0:p.required)??v);return i.jsxs(mo,{className:me(d,"space-y-3"),children:[r&&i.jsx(ho,{label:r,hint:o,required:R}),i.jsx(po,{className:"block",children:i.jsx(Zi,{type:x,placeholder:c,className:me(E.error?"border-destructive focus-visible:ring-destructive":"",fw({variant:y,className:d})),...b})}),l&&i.jsx(vo,{children:l}),i.jsx(_o,{})]})}})},gw=(n,a)=>{const r=L.useRef();return L.useEffect(()=>{r.current=n},[n,a]),r.current},yd=(n,a,r,o)=>n.getFixedT(a,r,o),mw=(n,a,r,o)=>L.useCallback(yd(n,a,r,o),[n,a,r,o]),Fo=(n,a={})=>{var $,B,q,re;const{i18n:r}=a,{i18n:o,defaultNS:l}=L.useContext($_)||{},c=r||o||z_();if(c&&!c.reportNamespaces&&(c.reportNamespaces=new B_),!c){fc(c,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const te=(Se,ue)=>Aa(ue)?ue:G_(ue)&&Aa(ue.defaultValue)?ue.defaultValue:Array.isArray(Se)?Se[Se.length-1]:Se,fe=[te,{},!1];return fe.t=te,fe.i18n={},fe.ready=!1,fe}($=c.options.react)!=null&&$.wait&&fc(c,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const d={...U_(),...c.options.react,...a},{useSuspense:h,keyPrefix:p}=d;let v=l||((B=c.options)==null?void 0:B.defaultNS);v=Aa(v)?[v]:v||["translation"],(re=(q=c.reportNamespaces).addUsedNamespaces)==null||re.call(q,v);const x=(c.isInitialized||c.initializedStoreOnce)&&v.every(te=>V_(te,c,d)),y=mw(c,a.lng||null,d.nsMode==="fallback"?v:v[0],p),C=()=>y,b=()=>yd(c,a.lng||null,d.nsMode==="fallback"?v:v[0],p),[E,R]=L.useState(C);let P=v.join();a.lng&&(P=`${a.lng}${P}`);const T=gw(P),I=L.useRef(!0);L.useEffect(()=>{const{bindI18n:te,bindI18nStore:fe}=d;I.current=!0,!x&&!h&&(a.lng?gc(c,a.lng,v,()=>{I.current&&R(b)}):mc(c,v,()=>{I.current&&R(b)})),x&&T&&T!==P&&I.current&&R(b);const Se=()=>{I.current&&R(b)};return te&&(c==null||c.on(te,Se)),fe&&(c==null||c.store.on(fe,Se)),()=>{I.current=!1,c&&(te==null||te.split(" ").forEach(ue=>c.off(ue,Se))),fe&&c&&fe.split(" ").forEach(ue=>c.store.off(ue,Se))}},[c,P]),L.useEffect(()=>{I.current&&x&&R(C)},[c,p,x]);const F=[E,c,x];if(F.t=E,F.i18n=c,F.ready=x,x||!x&&!h)return F;throw new Promise(te=>{a.lng?gc(c,a.lng,v,()=>te()):mc(c,v,()=>te())})};function hw(n=!1){const[a,r]=L.useState(n);return[a,()=>r(l=>!l)]}const Dn=()=>{const n=L.useContext(H_);if(n===null)throw new Error("useDataTableContext must be used within a DataTableProvider");return n};function as({data:n,columns:a,pageCount:r,enableSorting:o=!1,enableHiding:l=!1,enableRowSelection:c=!1,initialState:d,onPaginationChange:h,meta:p}){const{pagination:v,setPagination:x,sorting:y}=Dn(),[C,b]=En.useState({}),[E,R]=En.useState((d==null?void 0:d.columnVisibility)||{}),P=$=>{if(typeof $=="function"){const B=$(v);x(B)}h&&h($)},T=$=>{},I=L.useCallback(()=>{const $=a;return c&&$.unshift(lw()),$},[a,c]);return{table:Sd({data:n,columns:I(),pageCount:r??-1,meta:p,getCoreRowModel:bd(),initialState:d,state:{pagination:v,sorting:y,columnVisibility:E,rowSelection:C},enableRowSelection:c,onRowSelectionChange:b,manualSorting:!0,enableSorting:o,getSortedRowModel:ew(),onSortingChange:T,enableHiding:l,onColumnVisibilityChange:R,manualPagination:!0,onPaginationChange:P,manualFiltering:!0,getFilteredRowModel:Jb(),getFacetedRowModel:Xb(),getFacetedUniqueValues:Zb(),debugTable:!1,debugHeaders:!1,debugColumns:!1,defaultColumn:{minSize:0,size:Number.MAX_SAFE_INTEGER,maxSize:Number.MAX_SAFE_INTEGER}})}}const pw=({setSize:n,setControllerCallback:a,setPercentageCallback:r,setErrorCallback:o})=>l=>{if(!l.ok)throw Error(`${l.status} ${l.type} ${l.statusText}`);if(!l.body)throw Error("ReadableStream not yet supported in this browser.");const c=l.body,d=l.headers.get("content-encoding"),h=l.headers.get(d?"x-file-size":"content-length"),p=parseInt(h||"0",10);n(()=>p);let v=0;const x=new ReadableStream({start(y){a(y);const C=c.getReader();async function b(){return C.read().then(({done:E,value:R})=>E?y.close():(v+=(R==null?void 0:R.byteLength)||0,R&&y.enqueue(R),r({loaded:v,total:p}),b())).catch(E=>(o(E),C.cancel("Cancelled"),y.error(E)))}return b()}});return new Response(x)},yc=(n,a,r)=>{const o=[n],l=new Blob(o,{type:r||"application/octet-stream"});if(typeof window.navigator.msSaveBlob<"u")return window.navigator.msSaveBlob(l,a);const c=window.URL&&window.URL.createObjectURL?window.URL.createObjectURL(l):window.webkitURL.createObjectURL(l),d=document.createElement("a");return d.style.display="none",d.href=c,d.setAttribute("download",a),typeof d.download>"u"&&d.setAttribute("target","_blank"),document.body.appendChild(d),d.click(),setTimeout(()=>{document.body.removeChild(d),window.URL.revokeObjectURL(c)},200)};function Nc({customHandleDownload:n,...a}={}){var $;let r=!1;try{r=process?!!(($=process==null?void 0:process.env)!=null&&$.REACT_APP_DEBUG_MODE):!1}catch{r=!1}const[o,l]=L.useState(0),[c,d]=L.useState(0),[h,p]=L.useState(0),[v,x]=L.useState(null),[y,C]=L.useState(!1),b=L.useRef(null),E=L.useCallback(({loaded:B,total:q})=>{const re=Math.round(B/q*100);d(()=>re)},[]),R=L.useCallback(B=>{const q={"Failed to execute 'enqueue' on 'ReadableStreamDefaultController': Cannot enqueue a chunk into an errored readable stream":"Download canceled","The user aborted a request.":"Download timed out"};x(()=>({errorMessage:q[B.message]?q[B.message]:B.message}))},[]),P=L.useCallback(B=>{b.current=B},[]),T=L.useCallback(()=>{b.current&&b.current.error()},[]),I=L.useCallback(()=>{P(null),l(()=>0),d(()=>0),p(()=>0),C(()=>!1)},[P]),F=L.useCallback(async(B,q,re=0,te={})=>{if(y)return null;I(),x(()=>null),C(()=>!0);const fe=setInterval(()=>l(rt=>rt+1),r?1:1e3),Se=pw({setSize:p,setControllerCallback:P,setPercentageCallback:E,setErrorCallback:R}),ue=new AbortController,J=setTimeout(()=>{re>0&&ue.abort()},re),Re=n||yc;try{const rt=await fetch(B,{method:"GET",...a,...te,signal:ue.signal}),Ce=await Se(rt).blob();Re(Ce,q),I()}catch(rt){I(),x(Q=>{const{message:Ce}=rt;return Ce!=="Failed to fetch"?{errorMessage:Ce}:Q}),clearTimeout(J)}finally{clearInterval(fe)}},[y,I,r,P,E,R,a,n]);return L.useMemo(()=>({elapsed:o,percentage:c,size:h,download:F,cancel:T,error:v,isInProgress:y,jsDownload:yc}),[o,c,h,F,T,v,y])}const xw=()=>{const{i18n:n}=Fo();return Nd({locale:n.language})},Nd=n=>{const{locale:a}=n,r=L.useCallback(c=>{if(c==null)return"";const{amount:d,scale:h,currency_code:p}=c;return new Intl.NumberFormat(a??"ES",{style:"currency",currency:p,currencyDisplay:"symbol",useGrouping:!0,maximumFractionDigits:h}).format(d===null?0:hc({amount:d,scale:h}))},[a]),o=L.useCallback(c=>{if(c==null)return"";const{amount:d,scale:h}=c;return new Intl.NumberFormat("es",{minimumFractionDigits:h,useGrouping:!0}).format(d===null?0:hc({amount:d,scale:h}))},[a]),l=L.useCallback(c=>{if(c==null)return"";const{amount:d,scale:h}=c;return new Intl.NumberFormat(a,{style:"decimal",minimumFractionDigits:h}).format(d===null?0:d)},[a]);return{formatCurrency:r,formatNumber:o,formatPercentage:l}};function Rd(n){const[a,r]=L.useState(!1);return L.useEffect(()=>{function o(c){r(c.matches)}const l=matchMedia(n);return l.addEventListener("change",o),r(l.matches),()=>l.removeEventListener("change",o)},[n]),a}const vw=()=>{const n=L.useContext(K_);if(n===null)throw new Error("useWarnAboutChange must be used within a UnsavedWarnProvider");return n},Io=({isDirty:n=!1,title:a=S("hooks.use_unsaved_changes_notifier.title"),subtitle:r=S("hooks.use_unsaved_changes_notifier.subtitle"),confirmText:o=S("hooks.use_unsaved_changes_notifier.confirm_text"),cancelText:l=S("hooks.use_unsaved_changes_notifier.cancel_text"),onConfirm:c,onCancel:d,type:h="warning"})=>{const p=W_(n),{show:v}=vw(),x=L.useCallback(()=>n?new Promise(y=>{v({title:a,subtitle:r,confirmText:o,cancelText:l,type:h,onConfirm:()=>{y(!0),c==null||c()},onCancel:()=>{y(!1),d==null||d()}})}):Promise.resolve(!0),[l,o,n,d,c,v,r,a,h]);return L.useEffect(()=>{p.state==="blocked"&&x().then(y=>{y?p.proceed():p.reset()})},[p,x]),L.useEffect(()=>(n&&(window.onbeforeunload=()=>r),()=>{window.onbeforeunload=null}),[n,r]),{confirm:x}},Ed=n=>{const{isSubmitting:a,isLoading:r,isValidating:o}=Y_();return i.jsx(bo,{disabled:a||r||o,...n})};Ed.displayName="FormSubmitButton";const Ad={"any.unknown":"{{#label}}: no está permitido","any.invalid":"{{#label}}: contiene un valor invalido","any.empty":"{{#label}}: no está permitido que sea vacío","any.required":"{{#label}}: es un campo requerido","any.allowOnly":"{{#label}}: debería ser uno de las siguientes variantes: {{valids}}","any.default":"emitió un error cuando se ejecutó el metodo default","alternatives.base":"{{#label}}: no coincide con ninguna de las alternativas permitidas","array.base":"{{#label}}: debe ser un array","array.includes":"{{#label}}: en la posición {{pos}} no coincide con ninguno de los tipos permitidos","array.includesSingle":'{{#label}}: el valor de "{{!key}}" no coincide con ninguno de los tipos permitidos',"array.includesOne":"{{#label}}: en la posición {{pos}} falló porque {{reason}}","array.includesOneSingle":'{{#label}}: el valor "{{!key}}" falló porque {{reason}}',"array.includesRequiredUnknowns":"{{#label}}: no contiene valor/es requerido/s: {{unknownMisses}} ","array.includesRequiredKnowns":"{{#label}}: no contiene: {{knownMisses}}","array.includesRequiredBoth":"{{#label}}: no contiene {{knownMisses}} y {{unknownMisses}} otros valores requeridos","array.excludes":"{{#label}}: en la posición {{pos}} contiene un valor excluído","array.excludesSingle":'{{#label}}: el valor "{{!key}}" contiene un valor excluído',"array.min":"{{#label}}: debe contener al menos {{limit}} items","array.max":"{{#label}}: debe contener máximo {{limit}} items","array.length":"{{#label}}: debe contener exactamente {{limit}} items","array.ordered":"{{#label}}: en la posición {{pos}} falló porque {{reason}}","array.orderedLength":"{{#label}}: en la posición {{pos}} falló porque el array debre contener como máximo {{limit}} items","array.sparse":"{{#label}}: no debe ser un array esparcido","array.unique":"{{#label}}: posición {{pos}} contiene un valor duplicado","boolean.base":"{{#label}}: debe ser un valor verdadero/falso o si/no","binary.base":"{{#label}}: debe ser un buffer o un string","binary.min":"{{#label}}: debe ser como mínimo de {{limit}} bytes","binary.max":"{{#label}}: debe ser como máximo de {{limit}} bytes","binary.length":"{{#label}}: debe tener exactamente {{limit}} bytes","date.base":"{{#label}}: debe ser una cantidad de milisegundos o una fecha en cadena de texto válida","date.min":'{{#label}}: debe ser mayor o igual a "{{limit}}"',"date.max":'{{#label}}: debe ser menor o igual que "{{limit}}"',"date.isoDate":"{{#label}}: debe ser una fecha en formato ISO 8601","date.ref":'referencia a "{{ref}}", que no es una fecha válida',"function.base":"{{#label}}: debe ser una función","object.base":"{{#label}}: debe ser un objeto","object.child":'hijo "{{!key}}" falló porque {{reason}}',"object.min":"{{#label}}: debe tener como mínimo {{limit}} hijo","object.max":"{{#label}}: debe tener menos o a lo sumo {{limit}} hijo","object.length":"{{#label}}: debe tener máximo {{limit}} hijo/s","object.allowUnknown":"no está permitido","object.with":'peer faltante: "{{peer}}"',"object.without":'conflicto con peer prohibido: "{{peer}}"',"object.missing":"{{#label}}: debe contener al menos uno de: {{peers}}","object.xor":"{{#label}}: contiene un conflicto con alguno de: {{peers}}","object.or":"{{#label}}: debe contener al menos uno de: {{peers}}","object.and":"contiene {{present}} sin el requerido: {{missing}}","object.nand":'!!"{{main}}" no debe existir simultáneamente con {{peers}}',"object.assert":'!!"{{ref}}" falló validacion porque "{{ref}}" falló a {{message}}',"object.rename.multiple":'{{#label}}: no se puede renombrar el hijo "{{from}}" porque múltiples re-nombramientos estan deshabilitados y otra clave fue renombrada a "{{to}}"',"object.rename.override":'{{#label}}: no se puede renombrar el hijo "{{from}}" porque la sobre escritura esta deshabilitada y el target "{{to}}" existe',"object.type":'{{#label}}: debe ser una instancia de "{{type}}"',"number.base":"{{#label}}: debe ser un número","number.min":"{{#label}}: debe ser mayor o igual que {{limit}}","number.max":"{{#label}}: debe ser menor o igual que {{limit}}","number.less":"{{#label}}: debe ser menor a {{limit}}","number.greater":"{{#label}}: debe ser mayor a {{limit}}","number.float":"{{#label}}: debe ser un numero flotante","number.integer":"{{#label}}: debe ser un número entero","number.negative":"{{#label}}: debe ser un número negativo","number.positive":"{{#label}}: debe ser un número positivo","number.precision":"{{#label}}: no debe tener mas de {{limit}} decimales","number.ref":'{{#label}}: referencia a "{{ref}}" que no es un número',"number.multiple":"{{#label}}: debe ser un múltiplo de {{multiple}}","string.base":"{{#label}}: debe ser una cadena de texto","string.empty":"{{#label}}: no está permitido que sea vacío","string.min":"{{#label}}: debe ser mínimo de {{limit}} caracteres de largo","string.max":"{{#label}}: debe ser de máximo {{limit}} caracteres de largo","string.length":"{{#label}}: debe ser exactamente de {{limit}} caracteres de largo","string.alphanum":"{{#label}}: debe contener solo letras y números","string.token":"{{#label}}: debe contener solo letras, números y guines bajos","string.regex.base":'{{#label}}: el valor "{{!value}}" no coincide con el pattern requerido: {{pattern}}',"string.regex.name":'{{#label}}: el valor "{{!value}}" no coincide con el nombre de pattern {{name}}',"string.email":"{{#label}}: debe ser un email válido","string.uri":"{{#label}}: debe sre una uri válida","string.uriCustomScheme":"{{#label}}: debe ser una uri válida con el esquema concidiente con el patrón {{scheme}}","string.isoDate":"{{#label}}: debe ser una fecha en formato ISO 8601 válida","string.guid":"{{#label}}: debe ser un GUID valido","string.hex":"{{#label}}: debe contener solo caracteres hexadecimales","string.hostname":"{{#label}}: deber ser un hostname válido","string.lowercase":"{{#label}}: solo debe contener minúsculas","string.uppercase":"{{#label}}: solo debe contener mayúsculas","string.trim":"{{#label}}: no debe tener espacios en blanco delante o atrás","string.creditCard":"{{#label}}: debe ser una tarjeta de crédito","string.ref":'Referencia "{{ref}}" que no es un número',"string.ip":"{{#label}}: debe ser una dirección ip válida con un CDIR {{cidr}}","string.ipVersion":"{{#label}}: debe ser una dirección ip válida de una de las siguientes versiones {{version}} con un CDIR {{cidr}}","object.unknown":"{{#label}}: es un campo no es permitido","luxon.lt":"{{#label}}: must be before {{#date}}","luxon.gt":"{{#label}}: must be after {{#date}}","luxon.lte":"{{#label}}: must be same as or before {{#date}}","luxon.gte":"{{#label}}: must be same as or after {{#date}}"},zi=[{code:"en",name:"English",flag:()=>i.jsx("span",{className:"fi fi-gb"})},{code:"es",name:"Español",flag:()=>i.jsx("span",{className:"fi fi-es"})}],sS=()=>{var y,C,b,E;const{t:n,i18n:a}=Fo(),[r,o]=L.useState(a.language),l=zt(),{toast:c}=xn();L.useEffect(()=>{const R=navigator.language.split("-")[0],P=zi.find(T=>T.code===R);P&&d(P.code)},[]);const d=R=>{a.changeLanguage(R),o(R)},{mutate:h,status:p}=P0({onSuccess:R=>{const{success:P,error:T}=R;!P&&T&&v.setError("root",T),P&&l("/quotes",{replace:!0})},onError:R=>{const{message:P}=R;c({description:P,title:"Error"}),console.log(R)}}),v=Ji({mode:"onBlur",defaultValues:{email:"",password:""},resolver:Lc(An.object({email:An.string().email({tlds:{allow:!1}}).required(),password:An.string().min(4).alphanum().required()}),{messages:Ad})}),x=async R=>{h({email:R.email,password:R.password},{})};return i.jsxs(Q_,{variant:"full",className:"p-0 lg:grid lg:min-h-[600px] lg:grid-cols-2 xl:min-h-[800px] h-screen ",children:[i.jsx("div",{className:"flex items-center justify-center py-12 ",children:i.jsxs("div",{className:"mx-auto grid w-[650px] gap-6 relative ",children:[i.jsx("div",{className:"absolute flex space-x-2 top-4 right-4 ",children:i.jsxs(Yi,{children:[i.jsx(Qi,{asChild:!0,children:i.jsxs(H,{variant:"outline",className:"w-[140px] justify-start",children:[i.jsx("span",{className:"mr-2",children:(y=zi.find(R=>R.code===r))==null?void 0:y.flag()}),(C=zi.find(R=>R.code===r))==null?void 0:C.name,i.jsx(Oc,{className:"w-4 h-4 ml-auto opacity-50"})]})}),i.jsx(Xi,{className:"w-[140px]",children:zi.map(R=>i.jsxs(Ar,{onSelect:()=>d(R.code),children:[i.jsx("span",{className:"mr-2",children:R.flag()}),R.name]},R.code))})]})}),i.jsxs(qe,{className:"px-12 py-6 bg-muted/50",children:[i.jsxs(yt,{children:[i.jsx(X_,{className:"inline-block m-auto mb-6 align-middle max-w-32"}),i.jsx(Xe,{children:i.jsx(le,{i18nKey:"login_page.title"})}),i.jsx(nt,{children:i.jsx(le,{i18nKey:"login_page.description"})})]}),i.jsx($e,{children:i.jsx(es,{...v,children:i.jsx("form",{onSubmit:v.handleSubmit(x),children:i.jsxs("div",{className:"grid items-start gap-6",children:[i.jsx("div",{className:"grid gap-6",children:i.jsx(Fn,{required:!0,disabled:p==="pending",name:"email",label:n("login_page.email_label"),type:"email",placeholder:n("login_page.email_placeholder")})}),i.jsxs("div",{className:"grid gap-6",children:[i.jsx(Fn,{required:!0,disabled:p==="pending",name:"password",label:n("login_page.password_label"),type:"password"}),i.jsxs("div",{className:"mb-4 -mt-2 text-sm",children:[i.jsx(le,{i18nKey:"login_page.forgotten_password"}),i.jsx("br",{}),i.jsx(pc,{to:"https://uecko.com/distribuidores",className:"underline",children:i.jsx(le,{i18nKey:"login_page.contact_us"})})]})]}),((b=v.formState.errors.root)==null?void 0:b.message)&&i.jsxs(Pc,{variant:"destructive",children:[i.jsx(td,{className:"w-4 h-4"}),i.jsx(kc,{children:i.jsx(le,{i18nKey:"common.error"})}),i.jsx(qc,{children:(E=v.formState.errors.root)==null?void 0:E.message})]}),i.jsx(Ed,{className:"w-full",disabled:p==="pending"}),i.jsxs("div",{className:"mt-4 text-sm text-center",children:[i.jsx(le,{i18nKey:"login_page.become_dealer"}),i.jsx("br",{}),i.jsx(pc,{to:"https://uecko.com/distribuidores",className:"underline",children:i.jsx(le,{i18nKey:"login_page.contact_us"})}),i.jsx("br",{}),i.jsxs("p",{className:"mx-auto mt-4 -mb-6 text-xs text-muted-foreground/50",children:["v.","1.1.6"]})]})]})})})})]}),i.jsx("img",{className:"block w-11/12 mx-auto aspect-auto",src:"/img/uecko-footer_logos.jpg"})]})}),i.jsx("div",{className:"hidden bg-muted lg:block",children:i.jsx("img",{src:"/img/nara2.jpg",alt:"Image",width:"1920",height:"1080",className:"h-full w-full object-cover dark:brightness-[0.2] dark:grayscale"})})]})},_w=n=>{const{onSuccess:a,onError:r,...o}=n||{},l=Jt(),c=Mn(),{logout:d}=Ac(),h=zt(),{toast:p}=xn();return en({mutationKey:c().auth().action("logout").get(),mutationFn:d,onSuccess:async(v,x,y)=>{l.clear();const{success:C,redirectTo:b}=v;C&&b&&h(b||"/"),a&&a(v,x,y)},onError:(v,x,y)=>{const{message:C}=v;p({title:"Error",description:C,variant:"destructive"}),r&&r(v,x,y)},...o})},aS=()=>{const{mutate:n}=_w({});return L.useEffect(()=>n(),[n]),i.jsx(Tn,{})},bw=L.createContext(null),ww=({children:n})=>{const[a,r]=$c();return i.jsx(bw.Provider,{value:{pagination:a,setPagination:r},children:n})},oS=({children:n})=>i.jsx(ts,{children:i.jsx(ww,{children:i.jsxs(qr,{className:"catalog-layout",children:[i.jsx($r,{}),i.jsx(zr,{children:n})]})})}),Fd=n=>{const a=Tr(),r=Mn(),{pagination:o,searchTerm:l=[],enabled:c=!0,queryOptions:d}=n;return yo({queryKey:r().data().resource("catalog").action("list").params(n).get(),queryFn:()=>a.getList({resource:"catalog",quickSearchTerm:l,pagination:o}),enabled:c,queryOptions:d})};function Id({table:n,className:a,children:r,...o}){const{globalFilter:l,isFiltered:c,setGlobalFilter:d,resetGlobalFilter:h}=Dn(),p=En.useRef(null),[v,x]=En.useState(""),y=En.useCallback(E=>{E.key==="Enter"&&v.trim()&&(E.preventDefault(),d(R=>[...R,v.trim()]),x("")),E.key==="Backspace"&&!v&&l.length>0&&(E.preventDefault(),d(R=>R.slice(0,-1)))},[l,v]),C=En.useCallback(E=>{d(R=>R.filter(P=>P!==E))},[]),b=En.useCallback(()=>{var E;v.trim()&&(d(R=>[...R,v.trim()]),x(""),(E=p.current)==null||E.focus())},[v]);return i.jsx(Z_,{children:i.jsxs("div",{className:"w-full space-y-2",...o,children:[i.jsxs("div",{className:me("relative flex items-center flex-1 p-2 space-x-2 border rounded-md",c?"border-primary":"border-input"),children:[i.jsx(zc,{className:me("w-4 h-4 text-gray-500")}),i.jsxs("div",{className:"flex flex-wrap items-center flex-1 gap-2",children:[l&&l.map(E=>i.jsxs(no,{variant:"default",className:"px-1 text-base font-normal rounded-sm",children:[E,i.jsxs(H,{variant:"ghost",onClick:()=>C(E),className:"h-auto p-0 px-1 ml-1 hover:bg-transparent",children:[i.jsxs(Ge,{children:[i.jsx(He,{asChild:!0,children:i.jsx(Va,{className:"w-4 h-4"})}),i.jsx(Ke,{children:i.jsx("p",{children:S("catalog.filter.badget_remove_tooltip")})})]}),i.jsx("span",{className:"sr-only",children:S("catalog.filter.badget_remove_tooltip")})]})]},E)),i.jsxs("div",{className:"flex-1 flex items-center min-w-[300px]",children:[i.jsx("input",{ref:p,value:v,onChange:E=>x(E.target.value),onKeyDown:y,placeholder:S("common.filter.input_placeholder"),className:"flex-1 w-full h-8 bg-transparent outline-none placeholder:text-muted-foreground"}),i.jsxs(tr,{children:[c&&i.jsxs(Ge,{children:[i.jsx(He,{asChild:!0,children:i.jsxs(H,{variant:"ghost",onClick:()=>h(),className:"h-8 px-2 transition-all lg:px-3 text-primary",children:[i.jsx(Va,{className:"w-4 h-4 mr-2"}),S("common.filter.reset_filter")]})}),i.jsx(Ke,{children:i.jsx("p",{children:S("common.filter.reset_filter")})})]}),i.jsxs(Ge,{children:[i.jsx(He,{asChild:!0,children:i.jsxs(H,{variant:"default",size:"icon",disabled:!v,onClick:b,className:"w-8 h-8 p-0 transition-all",children:[i.jsx(jo,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:S("common.filter.button_add_term")})]})}),i.jsx(Ke,{children:i.jsx("p",{children:S("common.filter.button_add_term_tooltip")})})]})]})]})]})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:S("common.filter.help_text")})]})})}const Sw=()=>{const n=zt(),{pagination:a,globalFilter:r,isFiltered:o}=Dn(),{data:l,isPending:c,isError:d,error:h}=Fd({pagination:{pageIndex:a.pageIndex,pageSize:a.pageSize},searchTerm:r}),p=L.useMemo(()=>[{id:"id",accessorKey:"id"},{id:"id_article",accessorKey:"id_article"},{id:"catalog_name",accessorKey:"catalog_name"},{id:"description",accessorKey:"description",header:()=>i.jsx(i.Fragment,{children:S("catalog.list.columns.description")})},{id:"points",accessorKey:"points",header:()=>i.jsx("div",{className:"text-right",children:S("catalog.list.columns.points")}),cell:({renderValue:x})=>i.jsx("div",{className:"text-right",children:x()})},{id:"retail_price",accessorKey:"retail_price",header:()=>i.jsx("div",{className:"text-right",children:S("catalog.list.columns.retail_price")}),cell:({row:x})=>{const y=Tt.create(x.original.retail_price).object;return i.jsx("div",{className:"text-right",children:y.toFormat()})}}],[]),{table:v}=as({data:(l==null?void 0:l.items)??[],columns:p,pageCount:(l==null?void 0:l.total_pages)??-1,initialState:{columnVisibility:{id:!1,id_article:!1,catalog_name:!1}}});return d?i.jsx(ir,{subtitle:h.message}):c?i.jsx(qe,{children:i.jsx($e,{children:i.jsx(is,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0})})}):(l==null?void 0:l.total_items)===0&&!o?i.jsx(ss,{subtitle:"Empieza cargando los artículos del catálogo",buttonText:"",onButtonClick:()=>n("/catalog/add")}):i.jsx(rs,{table:v,paginationOptions:{visible:!0},children:i.jsx(Id,{table:v})})},lS=()=>i.jsxs(nr,{children:[i.jsx("div",{className:"flex items-center justify-between space-y-2",children:i.jsx("div",{children:i.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:i.jsx(le,{i18nKey:"catalog.list.title"})})})}),i.jsx(Sw,{})]}),uS=()=>{const{data:n,status:a}=J_();return i.jsxs(qr,{children:[i.jsx($r,{}),i.jsx(zr,{children:a==="success"?i.jsx("div",{className:"flex items-center",children:i.jsx("h1",{className:"text-lg font-semibold md:text-2xl",children:`${S("dashboard.welcome")}, ${n==null?void 0:n.name}`})}):i.jsx(ut,{className:"w-[100px] h-[20px] rounded-full"})})]})},cS=({children:n})=>i.jsx(ts,{children:i.jsxs(qr,{className:"dealers-layout",children:[i.jsx($r,{}),i.jsx(zr,{children:n})]})});function Cw({table:n}){return i.jsxs(Yi,{children:[i.jsx(Qi,{asChild:!0,children:i.jsxs(H,{variant:"outline",size:"sm",className:"hidden h-8 ml-auto lg:flex",children:[i.jsx(Q0,{className:"w-4 h-4 mr-2"}),"Columnas"]})}),i.jsxs(Xi,{align:"end",className:"w-[150px]",children:[i.jsx(Tc,{children:"Columnas"}),i.jsx(ro,{}),n.getAllColumns().filter(a=>typeof a.accessorFn<"u"&&a.getCanHide()).map(a=>i.jsx(e0,{className:"capitalize",checked:a.getIsVisible(),onCheckedChange:r=>a.toggleVisibility(!!r),children:i.jsx(i.Fragment,{children:a.columnDef.header})},a.id))]})]})}function Md({table:n,className:a,children:r,...o}){const{globalFilter:l,isFiltered:c,setGlobalFilter:d,resetGlobalFilter:h}=Dn(),p=v=>{const x=String(v.target.value);x===""?h():d([x])};return i.jsxs("div",{className:me("flex w-full items-center justify-between space-x-2 overflow-auto p-1",a),...o,children:[i.jsxs("div",{className:"flex items-center flex-1 space-x-2",children:[i.jsx(zc,{className:"w-4 h-4 text-gray-500"}),i.jsx(Zi,{placeholder:S("common.filter.input_placeholder"),value:l,onChange:p,className:me("h-8 w-full transition-all")},"global-filter"),c&&i.jsxs(H,{variant:"outline",onClick:()=>h(),className:"h-8 px-2 transition-all lg:px-3",children:[i.jsx(Va,{className:"w-4 h-4 mr-2"}),S("common.filter.reset_filter")]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[r,n.options.enableHiding&&i.jsx(Cw,{table:n})]})]})}const jw=n=>{const a=Tr(),r=Mn(),{pagination:o,searchTerm:l=void 0,enabled:c=!0,queryOptions:d}=n;return yo({queryKey:r().data().resource("dealer").action("list").params(n).get(),queryFn:()=>a.getList({resource:"dealers",quickSearchTerm:l,pagination:o}),enabled:c,queryOptions:d})},yw=()=>{const n=zt(),{pagination:a,globalFilter:r,isFiltered:o}=Dn(),{data:l,isPending:c,isError:d,error:h}=jw({pagination:{pageIndex:a.pageIndex,pageSize:a.pageSize},searchTerm:r}),p=L.useMemo(()=>[{id:"id",accessorKey:"id",enableResizing:!1,size:10},{id:"name",accessorKey:"name",enableResizing:!1,size:10}],[]),{table:v}=as({data:(l==null?void 0:l.items)??[],columns:p,pageCount:(l==null?void 0:l.total_pages)??-1});return d?i.jsx(ir,{subtitle:h.message}):c?i.jsx(qe,{children:i.jsx($e,{children:i.jsx(is,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0})})}):(l==null?void 0:l.total_items)===0&&!o?i.jsx(ss,{subtitle:"Empieza cargando los artículos del catálogo",buttonText:"",onButtonClick:()=>n("/catalog/add")}):i.jsx(i.Fragment,{children:i.jsx(rs,{table:v,paginationOptions:{visible:!0},children:i.jsx(Md,{table:v})})})},dS=()=>i.jsx(nr,{children:i.jsx(yw,{})}),fS=()=>i.jsx("div",{className:"flex min-h-[100dvh] flex-col items-center justify-center bg-background px-4 py-12 sm:px-6 lg:px-8",children:i.jsxs("div",{className:"max-w-md mx-auto text-center",children:[i.jsx("div",{className:"w-12 h-12 mx-auto text-primary"}),i.jsx("h1",{className:"mt-4 text-3xl font-bold tracking-tight text-foreground sm:text-4xl",children:"Oops, page not found!"}),i.jsx("p",{className:"mt-4 text-muted-foreground",children:"The page you're looking for doesn't exist or has been moved."}),i.jsx("div",{className:"mt-6",children:i.jsx(H,{className:"inline-flex items-center px-4 py-2 text-sm font-medium transition-colors rounded-md shadow-sm bg-primary text-primary-foreground hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",children:"Go to Homepage"})})]})}),Td=L.createContext({attributes:{role:"button",tabIndex:0,"aria-disabled":!1,"aria-pressed":void 0,"aria-roledescription":"sortable","aria-describedby":""},listeners:void 0,ref(){},isDragging:!1});function Nw(n){return n.isSorting||n.wasDragging?n0(n):!0}function Rw({id:n,children:a}){const{attributes:r,isDragging:o,listeners:l,setNodeRef:c,setActivatorNodeRef:d,transform:h,transition:p}=t0({animateLayoutChanges:Nw,id:n}),v={transform:Ua.Translate.toString(h),transition:p},x=L.useMemo(()=>({attributes:r,listeners:l,ref:d,isDragging:o}),[r,o,l,d]);return i.jsx(Td.Provider,{value:x,children:i.jsx(In,{id:String(n),className:me(o?"opacity-60":"opacity-100","m-0 hover:bg-muted hover:focus-within:bg-accent focus-within:bg-accent"),ref:c,style:v,children:a},n)})}const Ew=({className:n})=>{const{attributes:a,isDragging:r,listeners:o,ref:l}=L.useContext(Td);return i.jsxs(H,{ref:l,onClick:c=>{c.preventDefault()},size:"icon",variant:"link",className:me(r?"cursor-grabbing":"cursor-grab","w-4 h-4 mt-2 text-ring hover:text-muted-foreground",n),...a,...o,children:[i.jsx(id,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:S("common.move_row")})]})};function Aw(n,a={}){const{enableDragHandleColumn:r=!1,enableSelectionColumn:o=!1,enableActionsColumn:l=!1,rowActionFn:c=void 0}=a;return L.useMemo(()=>(r&&n.unshift({id:"row_drag_handle",header:()=>null,cell:()=>i.jsx(Ew,{}),enableSorting:!1,enableHiding:!1,size:40}),o&&n.unshift({id:"select",header:({table:d})=>i.jsx(Ui,{id:"select-all",checked:d.getIsAllPageRowsSelected()||d.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:h=>d.toggleAllPageRowsSelected(!!h),"aria-label":"Seleccionar todo",className:"translate-y-[0px]"}),cell:({row:d})=>i.jsx(Ui,{id:`select-row-${d.id}`,checked:d.getIsSelected(),disabled:!d.getCanSelect(),onCheckedChange:d.getToggleSelectedHandler(),"aria-label":"Seleccionar fila",className:"mt-2"}),enableSorting:!1,enableHiding:!1,size:40}),l&&n.push({id:"row_actions",cell:d=>i.jsx(ow,{rowContext:d,actions:c}),enableSorting:!1,enableHiding:!1,size:48}),n),[l,r,o])}var Dd={exports:{}};(function(n,a){(function(r,o,l){n.exports=l(),n.exports.default=l()})("slugify",Xn,function(){var r=JSON.parse(`{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","¢":"cent","£":"pound","¤":"currency","¥":"yen","©":"(c)","ª":"a","®":"(r)","º":"o","À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","þ":"th","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Č":"C","č":"c","Ď":"D","ď":"d","Đ":"DJ","đ":"dj","Ē":"E","ē":"e","Ė":"E","ė":"e","Ę":"e","ę":"e","Ě":"E","ě":"e","Ğ":"G","ğ":"g","Ģ":"G","ģ":"g","Ĩ":"I","ĩ":"i","Ī":"i","ī":"i","Į":"I","į":"i","İ":"I","ı":"i","Ķ":"k","ķ":"k","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ł":"L","ł":"l","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","Ō":"O","ō":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","Ŕ":"R","ŕ":"r","Ř":"R","ř":"r","Ś":"S","ś":"s","Ş":"S","ş":"s","Š":"S","š":"s","Ţ":"T","ţ":"t","Ť":"T","ť":"t","Ũ":"U","ũ":"u","Ū":"u","ū":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z","Ə":"E","ƒ":"f","Ơ":"O","ơ":"o","Ư":"U","ư":"u","Lj":"LJ","lj":"lj","Nj":"NJ","nj":"nj","Ș":"S","ș":"s","Ț":"T","ț":"t","ə":"e","˚":"o","Ά":"A","Έ":"E","Ή":"H","Ί":"I","Ό":"O","Ύ":"Y","Ώ":"W","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"H","Θ":"8","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"3","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"W","Ϊ":"I","Ϋ":"Y","ά":"a","έ":"e","ή":"h","ί":"i","ΰ":"y","α":"a","β":"b","γ":"g","δ":"d","ε":"e","ζ":"z","η":"h","θ":"8","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"3","ο":"o","π":"p","ρ":"r","ς":"s","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"w","ϊ":"i","ϋ":"y","ό":"o","ύ":"y","ώ":"w","Ё":"Yo","Ђ":"DJ","Є":"Ye","І":"I","Ї":"Yi","Ј":"J","Љ":"LJ","Њ":"NJ","Ћ":"C","Џ":"DZ","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ж":"Zh","З":"Z","И":"I","Й":"J","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"H","Ц":"C","Ч":"Ch","Ш":"Sh","Щ":"Sh","Ъ":"U","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya","а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ж":"zh","з":"z","и":"i","й":"j","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"c","ч":"ch","ш":"sh","щ":"sh","ъ":"u","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","ё":"yo","ђ":"dj","є":"ye","і":"i","ї":"yi","ј":"j","љ":"lj","њ":"nj","ћ":"c","ѝ":"u","џ":"dz","Ґ":"G","ґ":"g","Ғ":"GH","ғ":"gh","Қ":"KH","қ":"kh","Ң":"NG","ң":"ng","Ү":"UE","ү":"ue","Ұ":"U","ұ":"u","Һ":"H","һ":"h","Ә":"AE","ә":"ae","Ө":"OE","ө":"oe","Ա":"A","Բ":"B","Գ":"G","Դ":"D","Ե":"E","Զ":"Z","Է":"E'","Ը":"Y'","Թ":"T'","Ժ":"JH","Ի":"I","Լ":"L","Խ":"X","Ծ":"C'","Կ":"K","Հ":"H","Ձ":"D'","Ղ":"GH","Ճ":"TW","Մ":"M","Յ":"Y","Ն":"N","Շ":"SH","Չ":"CH","Պ":"P","Ջ":"J","Ռ":"R'","Ս":"S","Վ":"V","Տ":"T","Ր":"R","Ց":"C","Փ":"P'","Ք":"Q'","Օ":"O''","Ֆ":"F","և":"EV","ء":"a","آ":"aa","أ":"a","ؤ":"u","إ":"i","ئ":"e","ا":"a","ب":"b","ة":"h","ت":"t","ث":"th","ج":"j","ح":"h","خ":"kh","د":"d","ذ":"th","ر":"r","ز":"z","س":"s","ش":"sh","ص":"s","ض":"dh","ط":"t","ظ":"z","ع":"a","غ":"gh","ف":"f","ق":"q","ك":"k","ل":"l","م":"m","ن":"n","ه":"h","و":"w","ى":"a","ي":"y","ً":"an","ٌ":"on","ٍ":"en","َ":"a","ُ":"u","ِ":"e","ْ":"","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","پ":"p","چ":"ch","ژ":"zh","ک":"k","گ":"g","ی":"y","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","฿":"baht","ა":"a","ბ":"b","გ":"g","დ":"d","ე":"e","ვ":"v","ზ":"z","თ":"t","ი":"i","კ":"k","ლ":"l","მ":"m","ნ":"n","ო":"o","პ":"p","ჟ":"zh","რ":"r","ს":"s","ტ":"t","უ":"u","ფ":"f","ქ":"k","ღ":"gh","ყ":"q","შ":"sh","ჩ":"ch","ც":"ts","ძ":"dz","წ":"ts","ჭ":"ch","ხ":"kh","ჯ":"j","ჰ":"h","Ṣ":"S","ṣ":"s","Ẁ":"W","ẁ":"w","Ẃ":"W","ẃ":"w","Ẅ":"W","ẅ":"w","ẞ":"SS","Ạ":"A","ạ":"a","Ả":"A","ả":"a","Ấ":"A","ấ":"a","Ầ":"A","ầ":"a","Ẩ":"A","ẩ":"a","Ẫ":"A","ẫ":"a","Ậ":"A","ậ":"a","Ắ":"A","ắ":"a","Ằ":"A","ằ":"a","Ẳ":"A","ẳ":"a","Ẵ":"A","ẵ":"a","Ặ":"A","ặ":"a","Ẹ":"E","ẹ":"e","Ẻ":"E","ẻ":"e","Ẽ":"E","ẽ":"e","Ế":"E","ế":"e","Ề":"E","ề":"e","Ể":"E","ể":"e","Ễ":"E","ễ":"e","Ệ":"E","ệ":"e","Ỉ":"I","ỉ":"i","Ị":"I","ị":"i","Ọ":"O","ọ":"o","Ỏ":"O","ỏ":"o","Ố":"O","ố":"o","Ồ":"O","ồ":"o","Ổ":"O","ổ":"o","Ỗ":"O","ỗ":"o","Ộ":"O","ộ":"o","Ớ":"O","ớ":"o","Ờ":"O","ờ":"o","Ở":"O","ở":"o","Ỡ":"O","ỡ":"o","Ợ":"O","ợ":"o","Ụ":"U","ụ":"u","Ủ":"U","ủ":"u","Ứ":"U","ứ":"u","Ừ":"U","ừ":"u","Ử":"U","ử":"u","Ữ":"U","ữ":"u","Ự":"U","ự":"u","Ỳ":"Y","ỳ":"y","Ỵ":"Y","ỵ":"y","Ỷ":"Y","ỷ":"y","Ỹ":"Y","ỹ":"y","–":"-","‘":"'","’":"'","“":"\\"","”":"\\"","„":"\\"","†":"+","•":"*","…":"...","₠":"ecu","₢":"cruzeiro","₣":"french franc","₤":"lira","₥":"mill","₦":"naira","₧":"peseta","₨":"rupee","₩":"won","₪":"new shequel","₫":"dong","€":"euro","₭":"kip","₮":"tugrik","₯":"drachma","₰":"penny","₱":"peso","₲":"guarani","₳":"austral","₴":"hryvnia","₵":"cedi","₸":"kazakhstani tenge","₹":"indian rupee","₺":"turkish lira","₽":"russian ruble","₿":"bitcoin","℠":"sm","™":"tm","∂":"d","∆":"delta","∑":"sum","∞":"infinity","♥":"love","元":"yuan","円":"yen","﷼":"rial","ﻵ":"laa","ﻷ":"laa","ﻹ":"lai","ﻻ":"la"}`),o=JSON.parse('{"bg":{"Й":"Y","Ц":"Ts","Щ":"Sht","Ъ":"A","Ь":"Y","й":"y","ц":"ts","щ":"sht","ъ":"a","ь":"y"},"de":{"Ä":"AE","ä":"ae","Ö":"OE","ö":"oe","Ü":"UE","ü":"ue","ß":"ss","%":"prozent","&":"und","|":"oder","∑":"summe","∞":"unendlich","♥":"liebe"},"es":{"%":"por ciento","&":"y","<":"menor que",">":"mayor que","|":"o","¢":"centavos","£":"libras","¤":"moneda","₣":"francos","∑":"suma","∞":"infinito","♥":"amor"},"fr":{"%":"pourcent","&":"et","<":"plus petit",">":"plus grand","|":"ou","¢":"centime","£":"livre","¤":"devise","₣":"franc","∑":"somme","∞":"infini","♥":"amour"},"pt":{"%":"porcento","&":"e","<":"menor",">":"maior","|":"ou","¢":"centavo","∑":"soma","£":"libra","∞":"infinito","♥":"amor"},"uk":{"И":"Y","и":"y","Й":"Y","й":"y","Ц":"Ts","ц":"ts","Х":"Kh","х":"kh","Щ":"Shch","щ":"shch","Г":"H","г":"h"},"vi":{"Đ":"D","đ":"d"},"da":{"Ø":"OE","ø":"oe","Å":"AA","å":"aa","%":"procent","&":"og","|":"eller","$":"dollar","<":"mindre end",">":"større end"},"nb":{"&":"og","Å":"AA","Æ":"AE","Ø":"OE","å":"aa","æ":"ae","ø":"oe"},"it":{"&":"e"},"nl":{"&":"en"},"sv":{"&":"och","Å":"AA","Ä":"AE","Ö":"OE","å":"aa","ä":"ae","ö":"oe"}}');function l(c,d){if(typeof c!="string")throw new Error("slugify: string argument expected");d=typeof d=="string"?{replacement:d}:d||{};var h=o[d.locale]||{},p=d.replacement===void 0?"-":d.replacement,v=d.trim===void 0?!0:d.trim,x=c.normalize().split("").reduce(function(y,C){var b=h[C];return b===void 0&&(b=r[C]),b===void 0&&(b=C),b===p&&(b=" "),y+b.replace(d.remove||/[^\w\s$*_+~.()'"!\-:@]+/g,"")},"");return d.strict&&(x=x.replace(/[^A-Za-z0-9\s]/g,"")),v&&(x=x.trim()),x=x.replace(/\s+/g,p),d.lower&&(x=x.toLowerCase()),x}return l.extend=function(c){Object.assign(r,c)},l})})(Dd);var Fw=Dd.exports;const Iw=r0(Fw),Vr=()=>{const n=Tr(),a=Mn(),r=L.useCallback(c=>`${n.getApiUrl()}/quotes/${c}/report`,[n]),o=L.useCallback(c=>`quote-${Iw(c.reference,{lower:!0,strict:!0,locale:"en",trim:!0})}.pdf`,[]),l={useList:c=>{const d=Tr(),h=Mn(),{pagination:p,status:v="draft",quickSearchTerm:x=void 0,enabled:y=!0,queryOptions:C}=c;return yo({queryKey:h().data().resource("quotes").action("list").params(c).get(),queryFn:()=>d.getList({resource:"quotes",quickSearchTerm:x,filters:v!=="all"?[{field:"status",operator:"eq",value:v}]:[{field:"status",operator:"ne",value:"archived"}],pagination:p}),enabled:y,queryOptions:C})},useCreate:()=>{const c=Jt();return ub({mutationFn:d=>{const{date:h}=d,p=dn.generateNewID().object.toString();return n.createOne({resource:"quotes",data:{...d,date:new Date(h).toISOString().slice(0,10),status:"draft",id:p}})},onSuccess:()=>{c.invalidateQueries({queryKey:["data","default","quotes"]})}})},useUpdate:c=>{const d=Jt();return en({mutationKey:a().data().resource("quotes").action("one").id(c).params().get(),mutationFn:h=>n.updateOne({resource:"quotes",id:c,data:h}),onSuccess:()=>{d.invalidateQueries({queryKey:["data","default","quotes"]})}})},useSetStatus:()=>{const c=Jt();return en({mutationFn:d=>{const{id:h,newStatus:p}=d;return n.custom({url:`${n.getApiUrl()}/quotes/${h}/setStatus`,method:"put",data:{newStatus:p}})},onSuccess:()=>{c.invalidateQueries({queryKey:["data","default","quotes"]})}})},useDuplicate:()=>{const c=Jt();return en({mutationFn:d=>{const{id:h}=d;return n.custom({url:`${n.getApiUrl()}/quotes/${h}/duplicate`,method:"post"})},onSuccess:()=>{c.invalidateQueries({queryKey:["data","default","quotes"]})}})},useSentTo:c=>{const d=Jt();return en({mutationKey:a().data().resource("quotes").action("one").id(c).params().get(),mutationFn:h=>{const{sent_date:p}=h;return n.custom({url:`${n.getApiUrl()}/quotes/${c}/send`,method:"put",data:{sent_date:p}})},onSuccess:()=>{d.invalidateQueries({queryKey:["data","default","quotes"]})}})},useOne:(c,d)=>cd({queryKey:a().data().resource("quotes").action("one").id(c).params().get(),queryFn:()=>n.getOne({resource:"quotes",id:String(c)}),enabled:!!c,...d}),getQuotePDFDownloadURL:r,getQuotePDFFilename:o,useReport:()=>{const c=n.getApiAuthorization(),[d,h]=L.useState(void 0),{download:p,...v}=Nc({headers:{Authorization:c},customHandleDownload:L.useCallback(y=>{const C=[y],b=new Blob(C,{type:"application/octet-stream"});return h(b),!0},[h])}),x=L.useCallback(y=>p(l.getQuotePDFDownloadURL(y),""),[p]);return{...v,preview:x,report:d}},useDownloader:()=>{const c=n.getApiAuthorization(),d=Nc({headers:{Authorization:c}});return{...d,download:(p,v)=>{const x=l.getQuotePDFDownloadURL(p);return d.download(x,v)}}}};return l},gS=()=>{const n=zt(),{toast:a}=xn(),{useCreate:r}=Vr(),{mutate:o,isPending:l}=r(),c=L.useMemo(()=>({date:new Date(Date.now()).toUTCString(),customer_reference:"",customer_information:""}),[]),d=Ji({mode:"onBlur",defaultValues:c,resolver:Lc(An.object({customer_reference:An.string(),date:An.date().required(),customer_information:An.string().required()}),{messages:{es:Ad}})}),{formState:h,reset:p,getValues:v,handleSubmit:x}=d,{isSubmitting:y,isDirty:C}=h;Io({isDirty:C});const b=async E=>{try{o(E,{onError:R=>{console.debug(R),a({title:"Error",description:R.message,variant:"destructive"})},onSuccess:R=>{p(v()),a({title:"Cotización creada",variant:"default"}),n(`/quotes/edit/${R.id}`,{relative:"path"})}})}finally{}};return y?i.jsx(Tn,{title:"Guardando ajustes"}):l?i.jsx(Tn,{}):i.jsx(es,{...d,children:i.jsx("form",{onSubmit:x(b),children:i.jsxs("div",{className:"mx-auto grid max-w-[90rem] flex-1 auto-rows-max gap-6",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(Bc,{}),i.jsx("h1",{className:"flex-1 text-xl font-semibold tracking-tight shrink-0 whitespace-nowrap sm:grow-0",children:S("quotes.create.title")})]}),i.jsx("div",{className:"grid w-6/12 gap-6 mx-auto",children:i.jsxs(Ga,{className:"md:col-span-4",title:S("quotes.create.form_groups.general.title"),description:S("quotes.create.form_groups.general.desc"),footerActions:i.jsxs("div",{className:"flex items-stretch justify-between flex-1",children:[i.jsx(H,{size:"sm",variant:"outline",onClick:()=>n("/quotes"),children:S("common.discard")}),i.jsx(bo,{size:"sm",label:S("common.continue")})]}),children:[i.jsx(Fn,{required:!0,name:"customer_reference",label:S("quotes.form_fields.customer_reference.label"),description:S("quotes.form_fields.customer_reference.desc"),placeholder:S("quotes.form_fields.customer_reference.placeholder")}),i.jsx(Vc,{required:!0,label:S("quotes.form_fields.date.label"),description:S("quotes.form_fields.date.desc"),placeholder:S("quotes.form_fields.date.placeholder"),name:"date"}),i.jsx(mn,{}),i.jsx(qt,{rows:4,className:"row-span-2",name:"customer_information",required:!0,label:S("quotes.form_fields.customer_information.label"),description:S("quotes.form_fields.customer_information.desc"),placeholder:S("quotes.form_fields.customer_information.placeholder")})]})})]})})})},Ba=(n,a=!1)=>{const{discount:r,tax:o,subtotal_price:l}=n||{},c=$t.create(r||{amount:null,scale:2});if(c.isFailure)throw c.error;const d=c.object,h=$t.create(o||{amount:null,scale:2});if(h.isFailure)throw h.error;const p=h.object,v=Tt.create(l||{amount:null,scale:2});if(v.isFailure)throw v.error;const x=a?Mw(n.items).convertScale(2):v.object,y=x.percentage(d.toNumber()).convertScale(2),C=x.subtract(y).convertScale(2),b=C.percentage(p.toNumber()).convertScale(2),E=C.add(b).convertScale(2);return{subtotal_price:x,discount:n.discount,discount_price:y,before_tax_price:C,tax:p,tax_price:b,total_price:E}},Mw=n=>{let a=Tt.create({amount:0,scale:2}).object;return n&&n.map(r=>{const o=Ja(r);a=a.add(o.total_price)}),a},Ja=n=>{const{quantity:a,unit_price:r,discount:o}=n||{};if((!a||a&&a.amount===null)&&(!r||r&&r.amount===null)&&(!o||o&&o.amount===null))return{quantity:hn.create({amount:null,scale:0}).object,unit_price:Tt.create({amount:null,scale:2}).object,subtotal_price:Tt.create({amount:null,scale:2}).object,discount:$t.create({amount:null,scale:2}).object,total_price:Tt.create({amount:null,scale:2}).object};const l=hn.create(a);if(l.isFailure)throw l.error;const c=l.object,d=Tt.create(r);if(d.isFailure)throw d.error;const h=d.object,p=$t.create(o);if(p.isFailure)throw p.error;const v=p.object,x=h.multiply(c.toNumber()),y=x.subtract(x.percentage(v.toNumber()));return{quantity:c,unit_price:h,subtotal_price:x,discount:v,total_price:y}},Tw=()=>{const{id:n}=i0();return n};var Ki={exports:{}};/**
* @license
* Lodash <https://lodash.com/>
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/Ki.exports;(function(n,a){(function(){var r,o="4.17.21",l=200,c="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",d="Expected a function",h="Invalid `variable` option passed into `_.template`",p="__lodash_hash_undefined__",v=500,x="__lodash_placeholder__",y=1,C=2,b=4,E=1,R=2,P=1,T=2,I=4,F=8,$=16,B=32,q=64,re=128,te=256,fe=512,Se=30,ue="...",J=800,Re=16,rt=1,Q=2,Ce=3,Me=1/0,U=9007199254740991,_e=17976931348623157e292,Ze=NaN,it=4294967295,vn=it-1,qd=it>>>1,$d=[["ary",re],["bind",P],["bindKey",T],["curry",F],["curryRight",$],["flip",fe],["partial",B],["partialRight",q],["rearg",te]],Ln="[object Arguments]",Ur="[object Array]",zd="[object AsyncFunction]",sr="[object Boolean]",ar="[object Date]",Bd="[object DOMException]",Gr="[object Error]",Hr="[object Function]",Lo="[object GeneratorFunction]",Rt="[object Map]",or="[object Number]",Vd="[object Null]",Bt="[object Object]",Oo="[object Promise]",Ud="[object Proxy]",lr="[object RegExp]",Et="[object Set]",ur="[object String]",Kr="[object Symbol]",Gd="[object Undefined]",cr="[object WeakMap]",Hd="[object WeakSet]",dr="[object ArrayBuffer]",On="[object DataView]",os="[object Float32Array]",ls="[object Float64Array]",us="[object Int8Array]",cs="[object Int16Array]",ds="[object Int32Array]",fs="[object Uint8Array]",gs="[object Uint8ClampedArray]",ms="[object Uint16Array]",hs="[object Uint32Array]",Kd=/\b__p \+= '';/g,Wd=/\b(__p \+=) '' \+/g,Yd=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Po=/&(?:amp|lt|gt|quot|#39);/g,ko=/[&<>"']/g,Qd=RegExp(Po.source),Xd=RegExp(ko.source),Zd=/<%-([\s\S]+?)%>/g,Jd=/<%([\s\S]+?)%>/g,qo=/<%=([\s\S]+?)%>/g,ef=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,tf=/^\w*$/,nf=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ps=/[\\^$.*+?()[\]{}|]/g,rf=RegExp(ps.source),xs=/^\s+/,sf=/\s/,af=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,of=/\{\n\/\* \[wrapped with (.+)\] \*/,lf=/,? & /,uf=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,cf=/[()=,{}\[\]\/\s]/,df=/\\(\\)?/g,ff=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,$o=/\w*$/,gf=/^[-+]0x[0-9a-f]+$/i,mf=/^0b[01]+$/i,hf=/^\[object .+?Constructor\]$/,pf=/^0o[0-7]+$/i,xf=/^(?:0|[1-9]\d*)$/,vf=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Wr=/($^)/,_f=/['\n\r\u2028\u2029\\]/g,Yr="\\ud800-\\udfff",bf="\\u0300-\\u036f",wf="\\ufe20-\\ufe2f",Sf="\\u20d0-\\u20ff",zo=bf+wf+Sf,Bo="\\u2700-\\u27bf",Vo="a-z\\xdf-\\xf6\\xf8-\\xff",Cf="\\xac\\xb1\\xd7\\xf7",jf="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",yf="\\u2000-\\u206f",Nf=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Uo="A-Z\\xc0-\\xd6\\xd8-\\xde",Go="\\ufe0e\\ufe0f",Ho=Cf+jf+yf+Nf,vs="['’]",Rf="["+Yr+"]",Ko="["+Ho+"]",Qr="["+zo+"]",Wo="\\d+",Ef="["+Bo+"]",Yo="["+Vo+"]",Qo="[^"+Yr+Ho+Wo+Bo+Vo+Uo+"]",_s="\\ud83c[\\udffb-\\udfff]",Af="(?:"+Qr+"|"+_s+")",Xo="[^"+Yr+"]",bs="(?:\\ud83c[\\udde6-\\uddff]){2}",ws="[\\ud800-\\udbff][\\udc00-\\udfff]",Pn="["+Uo+"]",Zo="\\u200d",Jo="(?:"+Yo+"|"+Qo+")",Ff="(?:"+Pn+"|"+Qo+")",el="(?:"+vs+"(?:d|ll|m|re|s|t|ve))?",tl="(?:"+vs+"(?:D|LL|M|RE|S|T|VE))?",nl=Af+"?",rl="["+Go+"]?",If="(?:"+Zo+"(?:"+[Xo,bs,ws].join("|")+")"+rl+nl+")*",Mf="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Tf="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",il=rl+nl+If,Df="(?:"+[Ef,bs,ws].join("|")+")"+il,Lf="(?:"+[Xo+Qr+"?",Qr,bs,ws,Rf].join("|")+")",Of=RegExp(vs,"g"),Pf=RegExp(Qr,"g"),Ss=RegExp(_s+"(?="+_s+")|"+Lf+il,"g"),kf=RegExp([Pn+"?"+Yo+"+"+el+"(?="+[Ko,Pn,"$"].join("|")+")",Ff+"+"+tl+"(?="+[Ko,Pn+Jo,"$"].join("|")+")",Pn+"?"+Jo+"+"+el,Pn+"+"+tl,Tf,Mf,Wo,Df].join("|"),"g"),qf=RegExp("["+Zo+Yr+zo+Go+"]"),$f=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,zf=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Bf=-1,ye={};ye[os]=ye[ls]=ye[us]=ye[cs]=ye[ds]=ye[fs]=ye[gs]=ye[ms]=ye[hs]=!0,ye[Ln]=ye[Ur]=ye[dr]=ye[sr]=ye[On]=ye[ar]=ye[Gr]=ye[Hr]=ye[Rt]=ye[or]=ye[Bt]=ye[lr]=ye[Et]=ye[ur]=ye[cr]=!1;var je={};je[Ln]=je[Ur]=je[dr]=je[On]=je[sr]=je[ar]=je[os]=je[ls]=je[us]=je[cs]=je[ds]=je[Rt]=je[or]=je[Bt]=je[lr]=je[Et]=je[ur]=je[Kr]=je[fs]=je[gs]=je[ms]=je[hs]=!0,je[Gr]=je[Hr]=je[cr]=!1;var Vf={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Uf={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Gf={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Hf={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Kf=parseFloat,Wf=parseInt,sl=typeof Xn=="object"&&Xn&&Xn.Object===Object&&Xn,Yf=typeof self=="object"&&self&&self.Object===Object&&self,Be=sl||Yf||Function("return this")(),Cs=a&&!a.nodeType&&a,_n=Cs&&!0&&n&&!n.nodeType&&n,al=_n&&_n.exports===Cs,js=al&&sl.process,xt=function(){try{var j=_n&&_n.require&&_n.require("util").types;return j||js&&js.binding&&js.binding("util")}catch{}}(),ol=xt&&xt.isArrayBuffer,ll=xt&&xt.isDate,ul=xt&&xt.isMap,cl=xt&&xt.isRegExp,dl=xt&&xt.isSet,fl=xt&&xt.isTypedArray;function ct(j,M,A){switch(A.length){case 0:return j.call(M);case 1:return j.call(M,A[0]);case 2:return j.call(M,A[0],A[1]);case 3:return j.call(M,A[0],A[1],A[2])}return j.apply(M,A)}function Qf(j,M,A,V){for(var ee=-1,ge=j==null?0:j.length;++ee<ge;){var Pe=j[ee];M(V,Pe,A(Pe),j)}return V}function vt(j,M){for(var A=-1,V=j==null?0:j.length;++A<V&&M(j[A],A,j)!==!1;);return j}function Xf(j,M){for(var A=j==null?0:j.length;A--&&M(j[A],A,j)!==!1;);return j}function gl(j,M){for(var A=-1,V=j==null?0:j.length;++A<V;)if(!M(j[A],A,j))return!1;return!0}function tn(j,M){for(var A=-1,V=j==null?0:j.length,ee=0,ge=[];++A<V;){var Pe=j[A];M(Pe,A,j)&&(ge[ee++]=Pe)}return ge}function Xr(j,M){var A=j==null?0:j.length;return!!A&&kn(j,M,0)>-1}function ys(j,M,A){for(var V=-1,ee=j==null?0:j.length;++V<ee;)if(A(M,j[V]))return!0;return!1}function Ee(j,M){for(var A=-1,V=j==null?0:j.length,ee=Array(V);++A<V;)ee[A]=M(j[A],A,j);return ee}function nn(j,M){for(var A=-1,V=M.length,ee=j.length;++A<V;)j[ee+A]=M[A];return j}function Ns(j,M,A,V){var ee=-1,ge=j==null?0:j.length;for(V&&ge&&(A=j[++ee]);++ee<ge;)A=M(A,j[ee],ee,j);return A}function Zf(j,M,A,V){var ee=j==null?0:j.length;for(V&&ee&&(A=j[--ee]);ee--;)A=M(A,j[ee],ee,j);return A}function Rs(j,M){for(var A=-1,V=j==null?0:j.length;++A<V;)if(M(j[A],A,j))return!0;return!1}var Jf=Es("length");function eg(j){return j.split("")}function tg(j){return j.match(uf)||[]}function ml(j,M,A){var V;return A(j,function(ee,ge,Pe){if(M(ee,ge,Pe))return V=ge,!1}),V}function Zr(j,M,A,V){for(var ee=j.length,ge=A+(V?1:-1);V?ge--:++ge<ee;)if(M(j[ge],ge,j))return ge;return-1}function kn(j,M,A){return M===M?gg(j,M,A):Zr(j,hl,A)}function ng(j,M,A,V){for(var ee=A-1,ge=j.length;++ee<ge;)if(V(j[ee],M))return ee;return-1}function hl(j){return j!==j}function pl(j,M){var A=j==null?0:j.length;return A?Fs(j,M)/A:Ze}function Es(j){return function(M){return M==null?r:M[j]}}function As(j){return function(M){return j==null?r:j[M]}}function xl(j,M,A,V,ee){return ee(j,function(ge,Pe,be){A=V?(V=!1,ge):M(A,ge,Pe,be)}),A}function rg(j,M){var A=j.length;for(j.sort(M);A--;)j[A]=j[A].value;return j}function Fs(j,M){for(var A,V=-1,ee=j.length;++V<ee;){var ge=M(j[V]);ge!==r&&(A=A===r?ge:A+ge)}return A}function Is(j,M){for(var A=-1,V=Array(j);++A<j;)V[A]=M(A);return V}function ig(j,M){return Ee(M,function(A){return[A,j[A]]})}function vl(j){return j&&j.slice(0,Sl(j)+1).replace(xs,"")}function dt(j){return function(M){return j(M)}}function Ms(j,M){return Ee(M,function(A){return j[A]})}function fr(j,M){return j.has(M)}function _l(j,M){for(var A=-1,V=j.length;++A<V&&kn(M,j[A],0)>-1;);return A}function bl(j,M){for(var A=j.length;A--&&kn(M,j[A],0)>-1;);return A}function sg(j,M){for(var A=j.length,V=0;A--;)j[A]===M&&++V;return V}var ag=As(Vf),og=As(Uf);function lg(j){return"\\"+Hf[j]}function ug(j,M){return j==null?r:j[M]}function qn(j){return qf.test(j)}function cg(j){return $f.test(j)}function dg(j){for(var M,A=[];!(M=j.next()).done;)A.push(M.value);return A}function Ts(j){var M=-1,A=Array(j.size);return j.forEach(function(V,ee){A[++M]=[ee,V]}),A}function wl(j,M){return function(A){return j(M(A))}}function rn(j,M){for(var A=-1,V=j.length,ee=0,ge=[];++A<V;){var Pe=j[A];(Pe===M||Pe===x)&&(j[A]=x,ge[ee++]=A)}return ge}function Jr(j){var M=-1,A=Array(j.size);return j.forEach(function(V){A[++M]=V}),A}function fg(j){var M=-1,A=Array(j.size);return j.forEach(function(V){A[++M]=[V,V]}),A}function gg(j,M,A){for(var V=A-1,ee=j.length;++V<ee;)if(j[V]===M)return V;return-1}function mg(j,M,A){for(var V=A+1;V--;)if(j[V]===M)return V;return V}function $n(j){return qn(j)?pg(j):Jf(j)}function At(j){return qn(j)?xg(j):eg(j)}function Sl(j){for(var M=j.length;M--&&sf.test(j.charAt(M)););return M}var hg=As(Gf);function pg(j){for(var M=Ss.lastIndex=0;Ss.test(j);)++M;return M}function xg(j){return j.match(Ss)||[]}function vg(j){return j.match(kf)||[]}var _g=function j(M){M=M==null?Be:zn.defaults(Be.Object(),M,zn.pick(Be,zf));var A=M.Array,V=M.Date,ee=M.Error,ge=M.Function,Pe=M.Math,be=M.Object,Ds=M.RegExp,bg=M.String,_t=M.TypeError,ei=A.prototype,wg=ge.prototype,Bn=be.prototype,ti=M["__core-js_shared__"],ni=wg.toString,pe=Bn.hasOwnProperty,Sg=0,Cl=function(){var e=/[^.]+$/.exec(ti&&ti.keys&&ti.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ri=Bn.toString,Cg=ni.call(be),jg=Be._,yg=Ds("^"+ni.call(pe).replace(ps,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ii=al?M.Buffer:r,sn=M.Symbol,si=M.Uint8Array,jl=ii?ii.allocUnsafe:r,ai=wl(be.getPrototypeOf,be),yl=be.create,Nl=Bn.propertyIsEnumerable,oi=ei.splice,Rl=sn?sn.isConcatSpreadable:r,gr=sn?sn.iterator:r,bn=sn?sn.toStringTag:r,li=function(){try{var e=yn(be,"defineProperty");return e({},"",{}),e}catch{}}(),Ng=M.clearTimeout!==Be.clearTimeout&&M.clearTimeout,Rg=V&&V.now!==Be.Date.now&&V.now,Eg=M.setTimeout!==Be.setTimeout&&M.setTimeout,ui=Pe.ceil,ci=Pe.floor,Ls=be.getOwnPropertySymbols,Ag=ii?ii.isBuffer:r,El=M.isFinite,Fg=ei.join,Ig=wl(be.keys,be),ke=Pe.max,We=Pe.min,Mg=V.now,Tg=M.parseInt,Al=Pe.random,Dg=ei.reverse,Os=yn(M,"DataView"),mr=yn(M,"Map"),Ps=yn(M,"Promise"),Vn=yn(M,"Set"),hr=yn(M,"WeakMap"),pr=yn(be,"create"),di=hr&&new hr,Un={},Lg=Nn(Os),Og=Nn(mr),Pg=Nn(Ps),kg=Nn(Vn),qg=Nn(hr),fi=sn?sn.prototype:r,xr=fi?fi.valueOf:r,Fl=fi?fi.toString:r;function g(e){if(Fe(e)&&!ne(e)&&!(e instanceof ce)){if(e instanceof bt)return e;if(pe.call(e,"__wrapped__"))return Iu(e)}return new bt(e)}var Gn=function(){function e(){}return function(t){if(!Ae(t))return{};if(yl)return yl(t);e.prototype=t;var s=new e;return e.prototype=r,s}}();function gi(){}function bt(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}g.templateSettings={escape:Zd,evaluate:Jd,interpolate:qo,variable:"",imports:{_:g}},g.prototype=gi.prototype,g.prototype.constructor=g,bt.prototype=Gn(gi.prototype),bt.prototype.constructor=bt;function ce(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=it,this.__views__=[]}function $g(){var e=new ce(this.__wrapped__);return e.__actions__=st(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=st(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=st(this.__views__),e}function zg(){if(this.__filtered__){var e=new ce(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function Bg(){var e=this.__wrapped__.value(),t=this.__dir__,s=ne(e),u=t<0,f=s?e.length:0,m=eh(0,f,this.__views__),_=m.start,w=m.end,N=w-_,D=u?w:_-1,O=this.__iteratees__,k=O.length,z=0,G=We(N,this.__takeCount__);if(!s||!u&&f==N&&G==N)return eu(e,this.__actions__);var X=[];e:for(;N--&&z<G;){D+=t;for(var se=-1,Z=e[D];++se<k;){var oe=O[se],de=oe.iteratee,mt=oe.type,tt=de(Z);if(mt==Q)Z=tt;else if(!tt){if(mt==rt)continue e;break e}}X[z++]=Z}return X}ce.prototype=Gn(gi.prototype),ce.prototype.constructor=ce;function wn(e){var t=-1,s=e==null?0:e.length;for(this.clear();++t<s;){var u=e[t];this.set(u[0],u[1])}}function Vg(){this.__data__=pr?pr(null):{},this.size=0}function Ug(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function Gg(e){var t=this.__data__;if(pr){var s=t[e];return s===p?r:s}return pe.call(t,e)?t[e]:r}function Hg(e){var t=this.__data__;return pr?t[e]!==r:pe.call(t,e)}function Kg(e,t){var s=this.__data__;return this.size+=this.has(e)?0:1,s[e]=pr&&t===r?p:t,this}wn.prototype.clear=Vg,wn.prototype.delete=Ug,wn.prototype.get=Gg,wn.prototype.has=Hg,wn.prototype.set=Kg;function Vt(e){var t=-1,s=e==null?0:e.length;for(this.clear();++t<s;){var u=e[t];this.set(u[0],u[1])}}function Wg(){this.__data__=[],this.size=0}function Yg(e){var t=this.__data__,s=mi(t,e);if(s<0)return!1;var u=t.length-1;return s==u?t.pop():oi.call(t,s,1),--this.size,!0}function Qg(e){var t=this.__data__,s=mi(t,e);return s<0?r:t[s][1]}function Xg(e){return mi(this.__data__,e)>-1}function Zg(e,t){var s=this.__data__,u=mi(s,e);return u<0?(++this.size,s.push([e,t])):s[u][1]=t,this}Vt.prototype.clear=Wg,Vt.prototype.delete=Yg,Vt.prototype.get=Qg,Vt.prototype.has=Xg,Vt.prototype.set=Zg;function Ut(e){var t=-1,s=e==null?0:e.length;for(this.clear();++t<s;){var u=e[t];this.set(u[0],u[1])}}function Jg(){this.size=0,this.__data__={hash:new wn,map:new(mr||Vt),string:new wn}}function em(e){var t=Ni(this,e).delete(e);return this.size-=t?1:0,t}function tm(e){return Ni(this,e).get(e)}function nm(e){return Ni(this,e).has(e)}function rm(e,t){var s=Ni(this,e),u=s.size;return s.set(e,t),this.size+=s.size==u?0:1,this}Ut.prototype.clear=Jg,Ut.prototype.delete=em,Ut.prototype.get=tm,Ut.prototype.has=nm,Ut.prototype.set=rm;function Sn(e){var t=-1,s=e==null?0:e.length;for(this.__data__=new Ut;++t<s;)this.add(e[t])}function im(e){return this.__data__.set(e,p),this}function sm(e){return this.__data__.has(e)}Sn.prototype.add=Sn.prototype.push=im,Sn.prototype.has=sm;function Ft(e){var t=this.__data__=new Vt(e);this.size=t.size}function am(){this.__data__=new Vt,this.size=0}function om(e){var t=this.__data__,s=t.delete(e);return this.size=t.size,s}function lm(e){return this.__data__.get(e)}function um(e){return this.__data__.has(e)}function cm(e,t){var s=this.__data__;if(s instanceof Vt){var u=s.__data__;if(!mr||u.length<l-1)return u.push([e,t]),this.size=++s.size,this;s=this.__data__=new Ut(u)}return s.set(e,t),this.size=s.size,this}Ft.prototype.clear=am,Ft.prototype.delete=om,Ft.prototype.get=lm,Ft.prototype.has=um,Ft.prototype.set=cm;function Il(e,t){var s=ne(e),u=!s&&Rn(e),f=!s&&!u&&cn(e),m=!s&&!u&&!f&&Yn(e),_=s||u||f||m,w=_?Is(e.length,bg):[],N=w.length;for(var D in e)(t||pe.call(e,D))&&!(_&&(D=="length"||f&&(D=="offset"||D=="parent")||m&&(D=="buffer"||D=="byteLength"||D=="byteOffset")||Wt(D,N)))&&w.push(D);return w}function Ml(e){var t=e.length;return t?e[Ws(0,t-1)]:r}function dm(e,t){return Ri(st(e),Cn(t,0,e.length))}function fm(e){return Ri(st(e))}function ks(e,t,s){(s!==r&&!It(e[t],s)||s===r&&!(t in e))&&Gt(e,t,s)}function vr(e,t,s){var u=e[t];(!(pe.call(e,t)&&It(u,s))||s===r&&!(t in e))&&Gt(e,t,s)}function mi(e,t){for(var s=e.length;s--;)if(It(e[s][0],t))return s;return-1}function gm(e,t,s,u){return an(e,function(f,m,_){t(u,f,s(f),_)}),u}function Tl(e,t){return e&&Ot(t,ze(t),e)}function mm(e,t){return e&&Ot(t,ot(t),e)}function Gt(e,t,s){t=="__proto__"&&li?li(e,t,{configurable:!0,enumerable:!0,value:s,writable:!0}):e[t]=s}function qs(e,t){for(var s=-1,u=t.length,f=A(u),m=e==null;++s<u;)f[s]=m?r:_a(e,t[s]);return f}function Cn(e,t,s){return e===e&&(s!==r&&(e=e<=s?e:s),t!==r&&(e=e>=t?e:t)),e}function wt(e,t,s,u,f,m){var _,w=t&y,N=t&C,D=t&b;if(s&&(_=f?s(e,u,f,m):s(e)),_!==r)return _;if(!Ae(e))return e;var O=ne(e);if(O){if(_=nh(e),!w)return st(e,_)}else{var k=Ye(e),z=k==Hr||k==Lo;if(cn(e))return ru(e,w);if(k==Bt||k==Ln||z&&!f){if(_=N||z?{}:Su(e),!w)return N?Gm(e,mm(_,e)):Um(e,Tl(_,e))}else{if(!je[k])return f?e:{};_=rh(e,k,w)}}m||(m=new Ft);var G=m.get(e);if(G)return G;m.set(e,_),Xu(e)?e.forEach(function(Z){_.add(wt(Z,t,s,Z,e,m))}):Yu(e)&&e.forEach(function(Z,oe){_.set(oe,wt(Z,t,s,oe,e,m))});var X=D?N?sa:ia:N?ot:ze,se=O?r:X(e);return vt(se||e,function(Z,oe){se&&(oe=Z,Z=e[oe]),vr(_,oe,wt(Z,t,s,oe,e,m))}),_}function hm(e){var t=ze(e);return function(s){return Dl(s,e,t)}}function Dl(e,t,s){var u=s.length;if(e==null)return!u;for(e=be(e);u--;){var f=s[u],m=t[f],_=e[f];if(_===r&&!(f in e)||!m(_))return!1}return!0}function Ll(e,t,s){if(typeof e!="function")throw new _t(d);return yr(function(){e.apply(r,s)},t)}function _r(e,t,s,u){var f=-1,m=Xr,_=!0,w=e.length,N=[],D=t.length;if(!w)return N;s&&(t=Ee(t,dt(s))),u?(m=ys,_=!1):t.length>=l&&(m=fr,_=!1,t=new Sn(t));e:for(;++f<w;){var O=e[f],k=s==null?O:s(O);if(O=u||O!==0?O:0,_&&k===k){for(var z=D;z--;)if(t[z]===k)continue e;N.push(O)}else m(t,k,u)||N.push(O)}return N}var an=lu(Lt),Ol=lu(zs,!0);function pm(e,t){var s=!0;return an(e,function(u,f,m){return s=!!t(u,f,m),s}),s}function hi(e,t,s){for(var u=-1,f=e.length;++u<f;){var m=e[u],_=t(m);if(_!=null&&(w===r?_===_&&!gt(_):s(_,w)))var w=_,N=m}return N}function xm(e,t,s,u){var f=e.length;for(s=ie(s),s<0&&(s=-s>f?0:f+s),u=u===r||u>f?f:ie(u),u<0&&(u+=f),u=s>u?0:Ju(u);s<u;)e[s++]=t;return e}function Pl(e,t){var s=[];return an(e,function(u,f,m){t(u,f,m)&&s.push(u)}),s}function Ve(e,t,s,u,f){var m=-1,_=e.length;for(s||(s=sh),f||(f=[]);++m<_;){var w=e[m];t>0&&s(w)?t>1?Ve(w,t-1,s,u,f):nn(f,w):u||(f[f.length]=w)}return f}var $s=uu(),kl=uu(!0);function Lt(e,t){return e&&$s(e,t,ze)}function zs(e,t){return e&&kl(e,t,ze)}function pi(e,t){return tn(t,function(s){return Yt(e[s])})}function jn(e,t){t=ln(t,e);for(var s=0,u=t.length;e!=null&&s<u;)e=e[Pt(t[s++])];return s&&s==u?e:r}function ql(e,t,s){var u=t(e);return ne(e)?u:nn(u,s(e))}function Je(e){return e==null?e===r?Gd:Vd:bn&&bn in be(e)?Jm(e):fh(e)}function Bs(e,t){return e>t}function vm(e,t){return e!=null&&pe.call(e,t)}function _m(e,t){return e!=null&&t in be(e)}function bm(e,t,s){return e>=We(t,s)&&e<ke(t,s)}function Vs(e,t,s){for(var u=s?ys:Xr,f=e[0].length,m=e.length,_=m,w=A(m),N=1/0,D=[];_--;){var O=e[_];_&&t&&(O=Ee(O,dt(t))),N=We(O.length,N),w[_]=!s&&(t||f>=120&&O.length>=120)?new Sn(_&&O):r}O=e[0];var k=-1,z=w[0];e:for(;++k<f&&D.length<N;){var G=O[k],X=t?t(G):G;if(G=s||G!==0?G:0,!(z?fr(z,X):u(D,X,s))){for(_=m;--_;){var se=w[_];if(!(se?fr(se,X):u(e[_],X,s)))continue e}z&&z.push(X),D.push(G)}}return D}function wm(e,t,s,u){return Lt(e,function(f,m,_){t(u,s(f),m,_)}),u}function br(e,t,s){t=ln(t,e),e=Nu(e,t);var u=e==null?e:e[Pt(Ct(t))];return u==null?r:ct(u,e,s)}function $l(e){return Fe(e)&&Je(e)==Ln}function Sm(e){return Fe(e)&&Je(e)==dr}function Cm(e){return Fe(e)&&Je(e)==ar}function wr(e,t,s,u,f){return e===t?!0:e==null||t==null||!Fe(e)&&!Fe(t)?e!==e&&t!==t:jm(e,t,s,u,wr,f)}function jm(e,t,s,u,f,m){var _=ne(e),w=ne(t),N=_?Ur:Ye(e),D=w?Ur:Ye(t);N=N==Ln?Bt:N,D=D==Ln?Bt:D;var O=N==Bt,k=D==Bt,z=N==D;if(z&&cn(e)){if(!cn(t))return!1;_=!0,O=!1}if(z&&!O)return m||(m=new Ft),_||Yn(e)?_u(e,t,s,u,f,m):Xm(e,t,N,s,u,f,m);if(!(s&E)){var G=O&&pe.call(e,"__wrapped__"),X=k&&pe.call(t,"__wrapped__");if(G||X){var se=G?e.value():e,Z=X?t.value():t;return m||(m=new Ft),f(se,Z,s,u,m)}}return z?(m||(m=new Ft),Zm(e,t,s,u,f,m)):!1}function ym(e){return Fe(e)&&Ye(e)==Rt}function Us(e,t,s,u){var f=s.length,m=f,_=!u;if(e==null)return!m;for(e=be(e);f--;){var w=s[f];if(_&&w[2]?w[1]!==e[w[0]]:!(w[0]in e))return!1}for(;++f<m;){w=s[f];var N=w[0],D=e[N],O=w[1];if(_&&w[2]){if(D===r&&!(N in e))return!1}else{var k=new Ft;if(u)var z=u(D,O,N,e,t,k);if(!(z===r?wr(O,D,E|R,u,k):z))return!1}}return!0}function zl(e){if(!Ae(e)||oh(e))return!1;var t=Yt(e)?yg:hf;return t.test(Nn(e))}function Nm(e){return Fe(e)&&Je(e)==lr}function Rm(e){return Fe(e)&&Ye(e)==Et}function Em(e){return Fe(e)&&Ti(e.length)&&!!ye[Je(e)]}function Bl(e){return typeof e=="function"?e:e==null?lt:typeof e=="object"?ne(e)?Gl(e[0],e[1]):Ul(e):cc(e)}function Gs(e){if(!jr(e))return Ig(e);var t=[];for(var s in be(e))pe.call(e,s)&&s!="constructor"&&t.push(s);return t}function Am(e){if(!Ae(e))return dh(e);var t=jr(e),s=[];for(var u in e)u=="constructor"&&(t||!pe.call(e,u))||s.push(u);return s}function Hs(e,t){return e<t}function Vl(e,t){var s=-1,u=at(e)?A(e.length):[];return an(e,function(f,m,_){u[++s]=t(f,m,_)}),u}function Ul(e){var t=oa(e);return t.length==1&&t[0][2]?ju(t[0][0],t[0][1]):function(s){return s===e||Us(s,e,t)}}function Gl(e,t){return ua(e)&&Cu(t)?ju(Pt(e),t):function(s){var u=_a(s,e);return u===r&&u===t?ba(s,e):wr(t,u,E|R)}}function xi(e,t,s,u,f){e!==t&&$s(t,function(m,_){if(f||(f=new Ft),Ae(m))Fm(e,t,_,s,xi,u,f);else{var w=u?u(da(e,_),m,_+"",e,t,f):r;w===r&&(w=m),ks(e,_,w)}},ot)}function Fm(e,t,s,u,f,m,_){var w=da(e,s),N=da(t,s),D=_.get(N);if(D){ks(e,s,D);return}var O=m?m(w,N,s+"",e,t,_):r,k=O===r;if(k){var z=ne(N),G=!z&&cn(N),X=!z&&!G&&Yn(N);O=N,z||G||X?ne(w)?O=w:Te(w)?O=st(w):G?(k=!1,O=ru(N,!0)):X?(k=!1,O=iu(N,!0)):O=[]:Nr(N)||Rn(N)?(O=w,Rn(w)?O=ec(w):(!Ae(w)||Yt(w))&&(O=Su(N))):k=!1}k&&(_.set(N,O),f(O,N,u,m,_),_.delete(N)),ks(e,s,O)}function Hl(e,t){var s=e.length;if(s)return t+=t<0?s:0,Wt(t,s)?e[t]:r}function Kl(e,t,s){t.length?t=Ee(t,function(m){return ne(m)?function(_){return jn(_,m.length===1?m[0]:m)}:m}):t=[lt];var u=-1;t=Ee(t,dt(K()));var f=Vl(e,function(m,_,w){var N=Ee(t,function(D){return D(m)});return{criteria:N,index:++u,value:m}});return rg(f,function(m,_){return Vm(m,_,s)})}function Im(e,t){return Wl(e,t,function(s,u){return ba(e,u)})}function Wl(e,t,s){for(var u=-1,f=t.length,m={};++u<f;){var _=t[u],w=jn(e,_);s(w,_)&&Sr(m,ln(_,e),w)}return m}function Mm(e){return function(t){return jn(t,e)}}function Ks(e,t,s,u){var f=u?ng:kn,m=-1,_=t.length,w=e;for(e===t&&(t=st(t)),s&&(w=Ee(e,dt(s)));++m<_;)for(var N=0,D=t[m],O=s?s(D):D;(N=f(w,O,N,u))>-1;)w!==e&&oi.call(w,N,1),oi.call(e,N,1);return e}function Yl(e,t){for(var s=e?t.length:0,u=s-1;s--;){var f=t[s];if(s==u||f!==m){var m=f;Wt(f)?oi.call(e,f,1):Xs(e,f)}}return e}function Ws(e,t){return e+ci(Al()*(t-e+1))}function Tm(e,t,s,u){for(var f=-1,m=ke(ui((t-e)/(s||1)),0),_=A(m);m--;)_[u?m:++f]=e,e+=s;return _}function Ys(e,t){var s="";if(!e||t<1||t>U)return s;do t%2&&(s+=e),t=ci(t/2),t&&(e+=e);while(t);return s}function ae(e,t){return fa(yu(e,t,lt),e+"")}function Dm(e){return Ml(Qn(e))}function Lm(e,t){var s=Qn(e);return Ri(s,Cn(t,0,s.length))}function Sr(e,t,s,u){if(!Ae(e))return e;t=ln(t,e);for(var f=-1,m=t.length,_=m-1,w=e;w!=null&&++f<m;){var N=Pt(t[f]),D=s;if(N==="__proto__"||N==="constructor"||N==="prototype")return e;if(f!=_){var O=w[N];D=u?u(O,N,w):r,D===r&&(D=Ae(O)?O:Wt(t[f+1])?[]:{})}vr(w,N,D),w=w[N]}return e}var Ql=di?function(e,t){return di.set(e,t),e}:lt,Om=li?function(e,t){return li(e,"toString",{configurable:!0,enumerable:!1,value:Sa(t),writable:!0})}:lt;function Pm(e){return Ri(Qn(e))}function St(e,t,s){var u=-1,f=e.length;t<0&&(t=-t>f?0:f+t),s=s>f?f:s,s<0&&(s+=f),f=t>s?0:s-t>>>0,t>>>=0;for(var m=A(f);++u<f;)m[u]=e[u+t];return m}function km(e,t){var s;return an(e,function(u,f,m){return s=t(u,f,m),!s}),!!s}function vi(e,t,s){var u=0,f=e==null?u:e.length;if(typeof t=="number"&&t===t&&f<=qd){for(;u<f;){var m=u+f>>>1,_=e[m];_!==null&&!gt(_)&&(s?_<=t:_<t)?u=m+1:f=m}return f}return Qs(e,t,lt,s)}function Qs(e,t,s,u){var f=0,m=e==null?0:e.length;if(m===0)return 0;t=s(t);for(var _=t!==t,w=t===null,N=gt(t),D=t===r;f<m;){var O=ci((f+m)/2),k=s(e[O]),z=k!==r,G=k===null,X=k===k,se=gt(k);if(_)var Z=u||X;else D?Z=X&&(u||z):w?Z=X&&z&&(u||!G):N?Z=X&&z&&!G&&(u||!se):G||se?Z=!1:Z=u?k<=t:k<t;Z?f=O+1:m=O}return We(m,vn)}function Xl(e,t){for(var s=-1,u=e.length,f=0,m=[];++s<u;){var _=e[s],w=t?t(_):_;if(!s||!It(w,N)){var N=w;m[f++]=_===0?0:_}}return m}function Zl(e){return typeof e=="number"?e:gt(e)?Ze:+e}function ft(e){if(typeof e=="string")return e;if(ne(e))return Ee(e,ft)+"";if(gt(e))return Fl?Fl.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function on(e,t,s){var u=-1,f=Xr,m=e.length,_=!0,w=[],N=w;if(s)_=!1,f=ys;else if(m>=l){var D=t?null:Ym(e);if(D)return Jr(D);_=!1,f=fr,N=new Sn}else N=t?[]:w;e:for(;++u<m;){var O=e[u],k=t?t(O):O;if(O=s||O!==0?O:0,_&&k===k){for(var z=N.length;z--;)if(N[z]===k)continue e;t&&N.push(k),w.push(O)}else f(N,k,s)||(N!==w&&N.push(k),w.push(O))}return w}function Xs(e,t){return t=ln(t,e),e=Nu(e,t),e==null||delete e[Pt(Ct(t))]}function Jl(e,t,s,u){return Sr(e,t,s(jn(e,t)),u)}function _i(e,t,s,u){for(var f=e.length,m=u?f:-1;(u?m--:++m<f)&&t(e[m],m,e););return s?St(e,u?0:m,u?m+1:f):St(e,u?m+1:0,u?f:m)}function eu(e,t){var s=e;return s instanceof ce&&(s=s.value()),Ns(t,function(u,f){return f.func.apply(f.thisArg,nn([u],f.args))},s)}function Zs(e,t,s){var u=e.length;if(u<2)return u?on(e[0]):[];for(var f=-1,m=A(u);++f<u;)for(var _=e[f],w=-1;++w<u;)w!=f&&(m[f]=_r(m[f]||_,e[w],t,s));return on(Ve(m,1),t,s)}function tu(e,t,s){for(var u=-1,f=e.length,m=t.length,_={};++u<f;){var w=u<m?t[u]:r;s(_,e[u],w)}return _}function Js(e){return Te(e)?e:[]}function ea(e){return typeof e=="function"?e:lt}function ln(e,t){return ne(e)?e:ua(e,t)?[e]:Fu(he(e))}var qm=ae;function un(e,t,s){var u=e.length;return s=s===r?u:s,!t&&s>=u?e:St(e,t,s)}var nu=Ng||function(e){return Be.clearTimeout(e)};function ru(e,t){if(t)return e.slice();var s=e.length,u=jl?jl(s):new e.constructor(s);return e.copy(u),u}function ta(e){var t=new e.constructor(e.byteLength);return new si(t).set(new si(e)),t}function $m(e,t){var s=t?ta(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.byteLength)}function zm(e){var t=new e.constructor(e.source,$o.exec(e));return t.lastIndex=e.lastIndex,t}function Bm(e){return xr?be(xr.call(e)):{}}function iu(e,t){var s=t?ta(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.length)}function su(e,t){if(e!==t){var s=e!==r,u=e===null,f=e===e,m=gt(e),_=t!==r,w=t===null,N=t===t,D=gt(t);if(!w&&!D&&!m&&e>t||m&&_&&N&&!w&&!D||u&&_&&N||!s&&N||!f)return 1;if(!u&&!m&&!D&&e<t||D&&s&&f&&!u&&!m||w&&s&&f||!_&&f||!N)return-1}return 0}function Vm(e,t,s){for(var u=-1,f=e.criteria,m=t.criteria,_=f.length,w=s.length;++u<_;){var N=su(f[u],m[u]);if(N){if(u>=w)return N;var D=s[u];return N*(D=="desc"?-1:1)}}return e.index-t.index}function au(e,t,s,u){for(var f=-1,m=e.length,_=s.length,w=-1,N=t.length,D=ke(m-_,0),O=A(N+D),k=!u;++w<N;)O[w]=t[w];for(;++f<_;)(k||f<m)&&(O[s[f]]=e[f]);for(;D--;)O[w++]=e[f++];return O}function ou(e,t,s,u){for(var f=-1,m=e.length,_=-1,w=s.length,N=-1,D=t.length,O=ke(m-w,0),k=A(O+D),z=!u;++f<O;)k[f]=e[f];for(var G=f;++N<D;)k[G+N]=t[N];for(;++_<w;)(z||f<m)&&(k[G+s[_]]=e[f++]);return k}function st(e,t){var s=-1,u=e.length;for(t||(t=A(u));++s<u;)t[s]=e[s];return t}function Ot(e,t,s,u){var f=!s;s||(s={});for(var m=-1,_=t.length;++m<_;){var w=t[m],N=u?u(s[w],e[w],w,s,e):r;N===r&&(N=e[w]),f?Gt(s,w,N):vr(s,w,N)}return s}function Um(e,t){return Ot(e,la(e),t)}function Gm(e,t){return Ot(e,bu(e),t)}function bi(e,t){return function(s,u){var f=ne(s)?Qf:gm,m=t?t():{};return f(s,e,K(u,2),m)}}function Hn(e){return ae(function(t,s){var u=-1,f=s.length,m=f>1?s[f-1]:r,_=f>2?s[2]:r;for(m=e.length>3&&typeof m=="function"?(f--,m):r,_&&et(s[0],s[1],_)&&(m=f<3?r:m,f=1),t=be(t);++u<f;){var w=s[u];w&&e(t,w,u,m)}return t})}function lu(e,t){return function(s,u){if(s==null)return s;if(!at(s))return e(s,u);for(var f=s.length,m=t?f:-1,_=be(s);(t?m--:++m<f)&&u(_[m],m,_)!==!1;);return s}}function uu(e){return function(t,s,u){for(var f=-1,m=be(t),_=u(t),w=_.length;w--;){var N=_[e?w:++f];if(s(m[N],N,m)===!1)break}return t}}function Hm(e,t,s){var u=t&P,f=Cr(e);function m(){var _=this&&this!==Be&&this instanceof m?f:e;return _.apply(u?s:this,arguments)}return m}function cu(e){return function(t){t=he(t);var s=qn(t)?At(t):r,u=s?s[0]:t.charAt(0),f=s?un(s,1).join(""):t.slice(1);return u[e]()+f}}function Kn(e){return function(t){return Ns(lc(oc(t).replace(Of,"")),e,"")}}function Cr(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var s=Gn(e.prototype),u=e.apply(s,t);return Ae(u)?u:s}}function Km(e,t,s){var u=Cr(e);function f(){for(var m=arguments.length,_=A(m),w=m,N=Wn(f);w--;)_[w]=arguments[w];var D=m<3&&_[0]!==N&&_[m-1]!==N?[]:rn(_,N);if(m-=D.length,m<s)return hu(e,t,wi,f.placeholder,r,_,D,r,r,s-m);var O=this&&this!==Be&&this instanceof f?u:e;return ct(O,this,_)}return f}function du(e){return function(t,s,u){var f=be(t);if(!at(t)){var m=K(s,3);t=ze(t),s=function(w){return m(f[w],w,f)}}var _=e(t,s,u);return _>-1?f[m?t[_]:_]:r}}function fu(e){return Kt(function(t){var s=t.length,u=s,f=bt.prototype.thru;for(e&&t.reverse();u--;){var m=t[u];if(typeof m!="function")throw new _t(d);if(f&&!_&&yi(m)=="wrapper")var _=new bt([],!0)}for(u=_?u:s;++u<s;){m=t[u];var w=yi(m),N=w=="wrapper"?aa(m):r;N&&ca(N[0])&&N[1]==(re|F|B|te)&&!N[4].length&&N[9]==1?_=_[yi(N[0])].apply(_,N[3]):_=m.length==1&&ca(m)?_[w]():_.thru(m)}return function(){var D=arguments,O=D[0];if(_&&D.length==1&&ne(O))return _.plant(O).value();for(var k=0,z=s?t[k].apply(this,D):O;++k<s;)z=t[k].call(this,z);return z}})}function wi(e,t,s,u,f,m,_,w,N,D){var O=t&re,k=t&P,z=t&T,G=t&(F|$),X=t&fe,se=z?r:Cr(e);function Z(){for(var oe=arguments.length,de=A(oe),mt=oe;mt--;)de[mt]=arguments[mt];if(G)var tt=Wn(Z),ht=sg(de,tt);if(u&&(de=au(de,u,f,G)),m&&(de=ou(de,m,_,G)),oe-=ht,G&&oe<D){var De=rn(de,tt);return hu(e,t,wi,Z.placeholder,s,de,De,w,N,D-oe)}var Mt=k?s:this,Xt=z?Mt[e]:e;return oe=de.length,w?de=gh(de,w):X&&oe>1&&de.reverse(),O&&N<oe&&(de.length=N),this&&this!==Be&&this instanceof Z&&(Xt=se||Cr(Xt)),Xt.apply(Mt,de)}return Z}function gu(e,t){return function(s,u){return wm(s,e,t(u),{})}}function Si(e,t){return function(s,u){var f;if(s===r&&u===r)return t;if(s!==r&&(f=s),u!==r){if(f===r)return u;typeof s=="string"||typeof u=="string"?(s=ft(s),u=ft(u)):(s=Zl(s),u=Zl(u)),f=e(s,u)}return f}}function na(e){return Kt(function(t){return t=Ee(t,dt(K())),ae(function(s){var u=this;return e(t,function(f){return ct(f,u,s)})})})}function Ci(e,t){t=t===r?" ":ft(t);var s=t.length;if(s<2)return s?Ys(t,e):t;var u=Ys(t,ui(e/$n(t)));return qn(t)?un(At(u),0,e).join(""):u.slice(0,e)}function Wm(e,t,s,u){var f=t&P,m=Cr(e);function _(){for(var w=-1,N=arguments.length,D=-1,O=u.length,k=A(O+N),z=this&&this!==Be&&this instanceof _?m:e;++D<O;)k[D]=u[D];for(;N--;)k[D++]=arguments[++w];return ct(z,f?s:this,k)}return _}function mu(e){return function(t,s,u){return u&&typeof u!="number"&&et(t,s,u)&&(s=u=r),t=Qt(t),s===r?(s=t,t=0):s=Qt(s),u=u===r?t<s?1:-1:Qt(u),Tm(t,s,u,e)}}function ji(e){return function(t,s){return typeof t=="string"&&typeof s=="string"||(t=jt(t),s=jt(s)),e(t,s)}}function hu(e,t,s,u,f,m,_,w,N,D){var O=t&F,k=O?_:r,z=O?r:_,G=O?m:r,X=O?r:m;t|=O?B:q,t&=~(O?q:B),t&I||(t&=-4);var se=[e,t,f,G,k,X,z,w,N,D],Z=s.apply(r,se);return ca(e)&&Ru(Z,se),Z.placeholder=u,Eu(Z,e,t)}function ra(e){var t=Pe[e];return function(s,u){if(s=jt(s),u=u==null?0:We(ie(u),292),u&&El(s)){var f=(he(s)+"e").split("e"),m=t(f[0]+"e"+(+f[1]+u));return f=(he(m)+"e").split("e"),+(f[0]+"e"+(+f[1]-u))}return t(s)}}var Ym=Vn&&1/Jr(new Vn([,-0]))[1]==Me?function(e){return new Vn(e)}:ya;function pu(e){return function(t){var s=Ye(t);return s==Rt?Ts(t):s==Et?fg(t):ig(t,e(t))}}function Ht(e,t,s,u,f,m,_,w){var N=t&T;if(!N&&typeof e!="function")throw new _t(d);var D=u?u.length:0;if(D||(t&=-97,u=f=r),_=_===r?_:ke(ie(_),0),w=w===r?w:ie(w),D-=f?f.length:0,t&q){var O=u,k=f;u=f=r}var z=N?r:aa(e),G=[e,t,s,u,f,O,k,m,_,w];if(z&&ch(G,z),e=G[0],t=G[1],s=G[2],u=G[3],f=G[4],w=G[9]=G[9]===r?N?0:e.length:ke(G[9]-D,0),!w&&t&(F|$)&&(t&=-25),!t||t==P)var X=Hm(e,t,s);else t==F||t==$?X=Km(e,t,w):(t==B||t==(P|B))&&!f.length?X=Wm(e,t,s,u):X=wi.apply(r,G);var se=z?Ql:Ru;return Eu(se(X,G),e,t)}function xu(e,t,s,u){return e===r||It(e,Bn[s])&&!pe.call(u,s)?t:e}function vu(e,t,s,u,f,m){return Ae(e)&&Ae(t)&&(m.set(t,e),xi(e,t,r,vu,m),m.delete(t)),e}function Qm(e){return Nr(e)?r:e}function _u(e,t,s,u,f,m){var _=s&E,w=e.length,N=t.length;if(w!=N&&!(_&&N>w))return!1;var D=m.get(e),O=m.get(t);if(D&&O)return D==t&&O==e;var k=-1,z=!0,G=s&R?new Sn:r;for(m.set(e,t),m.set(t,e);++k<w;){var X=e[k],se=t[k];if(u)var Z=_?u(se,X,k,t,e,m):u(X,se,k,e,t,m);if(Z!==r){if(Z)continue;z=!1;break}if(G){if(!Rs(t,function(oe,de){if(!fr(G,de)&&(X===oe||f(X,oe,s,u,m)))return G.push(de)})){z=!1;break}}else if(!(X===se||f(X,se,s,u,m))){z=!1;break}}return m.delete(e),m.delete(t),z}function Xm(e,t,s,u,f,m,_){switch(s){case On:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case dr:return!(e.byteLength!=t.byteLength||!m(new si(e),new si(t)));case sr:case ar:case or:return It(+e,+t);case Gr:return e.name==t.name&&e.message==t.message;case lr:case ur:return e==t+"";case Rt:var w=Ts;case Et:var N=u&E;if(w||(w=Jr),e.size!=t.size&&!N)return!1;var D=_.get(e);if(D)return D==t;u|=R,_.set(e,t);var O=_u(w(e),w(t),u,f,m,_);return _.delete(e),O;case Kr:if(xr)return xr.call(e)==xr.call(t)}return!1}function Zm(e,t,s,u,f,m){var _=s&E,w=ia(e),N=w.length,D=ia(t),O=D.length;if(N!=O&&!_)return!1;for(var k=N;k--;){var z=w[k];if(!(_?z in t:pe.call(t,z)))return!1}var G=m.get(e),X=m.get(t);if(G&&X)return G==t&&X==e;var se=!0;m.set(e,t),m.set(t,e);for(var Z=_;++k<N;){z=w[k];var oe=e[z],de=t[z];if(u)var mt=_?u(de,oe,z,t,e,m):u(oe,de,z,e,t,m);if(!(mt===r?oe===de||f(oe,de,s,u,m):mt)){se=!1;break}Z||(Z=z=="constructor")}if(se&&!Z){var tt=e.constructor,ht=t.constructor;tt!=ht&&"constructor"in e&&"constructor"in t&&!(typeof tt=="function"&&tt instanceof tt&&typeof ht=="function"&&ht instanceof ht)&&(se=!1)}return m.delete(e),m.delete(t),se}function Kt(e){return fa(yu(e,r,Du),e+"")}function ia(e){return ql(e,ze,la)}function sa(e){return ql(e,ot,bu)}var aa=di?function(e){return di.get(e)}:ya;function yi(e){for(var t=e.name+"",s=Un[t],u=pe.call(Un,t)?s.length:0;u--;){var f=s[u],m=f.func;if(m==null||m==e)return f.name}return t}function Wn(e){var t=pe.call(g,"placeholder")?g:e;return t.placeholder}function K(){var e=g.iteratee||Ca;return e=e===Ca?Bl:e,arguments.length?e(arguments[0],arguments[1]):e}function Ni(e,t){var s=e.__data__;return ah(t)?s[typeof t=="string"?"string":"hash"]:s.map}function oa(e){for(var t=ze(e),s=t.length;s--;){var u=t[s],f=e[u];t[s]=[u,f,Cu(f)]}return t}function yn(e,t){var s=ug(e,t);return zl(s)?s:r}function Jm(e){var t=pe.call(e,bn),s=e[bn];try{e[bn]=r;var u=!0}catch{}var f=ri.call(e);return u&&(t?e[bn]=s:delete e[bn]),f}var la=Ls?function(e){return e==null?[]:(e=be(e),tn(Ls(e),function(t){return Nl.call(e,t)}))}:Na,bu=Ls?function(e){for(var t=[];e;)nn(t,la(e)),e=ai(e);return t}:Na,Ye=Je;(Os&&Ye(new Os(new ArrayBuffer(1)))!=On||mr&&Ye(new mr)!=Rt||Ps&&Ye(Ps.resolve())!=Oo||Vn&&Ye(new Vn)!=Et||hr&&Ye(new hr)!=cr)&&(Ye=function(e){var t=Je(e),s=t==Bt?e.constructor:r,u=s?Nn(s):"";if(u)switch(u){case Lg:return On;case Og:return Rt;case Pg:return Oo;case kg:return Et;case qg:return cr}return t});function eh(e,t,s){for(var u=-1,f=s.length;++u<f;){var m=s[u],_=m.size;switch(m.type){case"drop":e+=_;break;case"dropRight":t-=_;break;case"take":t=We(t,e+_);break;case"takeRight":e=ke(e,t-_);break}}return{start:e,end:t}}function th(e){var t=e.match(of);return t?t[1].split(lf):[]}function wu(e,t,s){t=ln(t,e);for(var u=-1,f=t.length,m=!1;++u<f;){var _=Pt(t[u]);if(!(m=e!=null&&s(e,_)))break;e=e[_]}return m||++u!=f?m:(f=e==null?0:e.length,!!f&&Ti(f)&&Wt(_,f)&&(ne(e)||Rn(e)))}function nh(e){var t=e.length,s=new e.constructor(t);return t&&typeof e[0]=="string"&&pe.call(e,"index")&&(s.index=e.index,s.input=e.input),s}function Su(e){return typeof e.constructor=="function"&&!jr(e)?Gn(ai(e)):{}}function rh(e,t,s){var u=e.constructor;switch(t){case dr:return ta(e);case sr:case ar:return new u(+e);case On:return $m(e,s);case os:case ls:case us:case cs:case ds:case fs:case gs:case ms:case hs:return iu(e,s);case Rt:return new u;case or:case ur:return new u(e);case lr:return zm(e);case Et:return new u;case Kr:return Bm(e)}}function ih(e,t){var s=t.length;if(!s)return e;var u=s-1;return t[u]=(s>1?"& ":"")+t[u],t=t.join(s>2?", ":" "),e.replace(af,`{
/* [wrapped with `+t+`] */
`)}function sh(e){return ne(e)||Rn(e)||!!(Rl&&e&&e[Rl])}function Wt(e,t){var s=typeof e;return t=t??U,!!t&&(s=="number"||s!="symbol"&&xf.test(e))&&e>-1&&e%1==0&&e<t}function et(e,t,s){if(!Ae(s))return!1;var u=typeof t;return(u=="number"?at(s)&&Wt(t,s.length):u=="string"&&t in s)?It(s[t],e):!1}function ua(e,t){if(ne(e))return!1;var s=typeof e;return s=="number"||s=="symbol"||s=="boolean"||e==null||gt(e)?!0:tf.test(e)||!ef.test(e)||t!=null&&e in be(t)}function ah(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function ca(e){var t=yi(e),s=g[t];if(typeof s!="function"||!(t in ce.prototype))return!1;if(e===s)return!0;var u=aa(s);return!!u&&e===u[0]}function oh(e){return!!Cl&&Cl in e}var lh=ti?Yt:Ra;function jr(e){var t=e&&e.constructor,s=typeof t=="function"&&t.prototype||Bn;return e===s}function Cu(e){return e===e&&!Ae(e)}function ju(e,t){return function(s){return s==null?!1:s[e]===t&&(t!==r||e in be(s))}}function uh(e){var t=Ii(e,function(u){return s.size===v&&s.clear(),u}),s=t.cache;return t}function ch(e,t){var s=e[1],u=t[1],f=s|u,m=f<(P|T|re),_=u==re&&s==F||u==re&&s==te&&e[7].length<=t[8]||u==(re|te)&&t[7].length<=t[8]&&s==F;if(!(m||_))return e;u&P&&(e[2]=t[2],f|=s&P?0:I);var w=t[3];if(w){var N=e[3];e[3]=N?au(N,w,t[4]):w,e[4]=N?rn(e[3],x):t[4]}return w=t[5],w&&(N=e[5],e[5]=N?ou(N,w,t[6]):w,e[6]=N?rn(e[5],x):t[6]),w=t[7],w&&(e[7]=w),u&re&&(e[8]=e[8]==null?t[8]:We(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=f,e}function dh(e){var t=[];if(e!=null)for(var s in be(e))t.push(s);return t}function fh(e){return ri.call(e)}function yu(e,t,s){return t=ke(t===r?e.length-1:t,0),function(){for(var u=arguments,f=-1,m=ke(u.length-t,0),_=A(m);++f<m;)_[f]=u[t+f];f=-1;for(var w=A(t+1);++f<t;)w[f]=u[f];return w[t]=s(_),ct(e,this,w)}}function Nu(e,t){return t.length<2?e:jn(e,St(t,0,-1))}function gh(e,t){for(var s=e.length,u=We(t.length,s),f=st(e);u--;){var m=t[u];e[u]=Wt(m,s)?f[m]:r}return e}function da(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var Ru=Au(Ql),yr=Eg||function(e,t){return Be.setTimeout(e,t)},fa=Au(Om);function Eu(e,t,s){var u=t+"";return fa(e,ih(u,mh(th(u),s)))}function Au(e){var t=0,s=0;return function(){var u=Mg(),f=Re-(u-s);if(s=u,f>0){if(++t>=J)return arguments[0]}else t=0;return e.apply(r,arguments)}}function Ri(e,t){var s=-1,u=e.length,f=u-1;for(t=t===r?u:t;++s<t;){var m=Ws(s,f),_=e[m];e[m]=e[s],e[s]=_}return e.length=t,e}var Fu=uh(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(nf,function(s,u,f,m){t.push(f?m.replace(df,"$1"):u||s)}),t});function Pt(e){if(typeof e=="string"||gt(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Nn(e){if(e!=null){try{return ni.call(e)}catch{}try{return e+""}catch{}}return""}function mh(e,t){return vt($d,function(s){var u="_."+s[0];t&s[1]&&!Xr(e,u)&&e.push(u)}),e.sort()}function Iu(e){if(e instanceof ce)return e.clone();var t=new bt(e.__wrapped__,e.__chain__);return t.__actions__=st(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function hh(e,t,s){(s?et(e,t,s):t===r)?t=1:t=ke(ie(t),0);var u=e==null?0:e.length;if(!u||t<1)return[];for(var f=0,m=0,_=A(ui(u/t));f<u;)_[m++]=St(e,f,f+=t);return _}function ph(e){for(var t=-1,s=e==null?0:e.length,u=0,f=[];++t<s;){var m=e[t];m&&(f[u++]=m)}return f}function xh(){var e=arguments.length;if(!e)return[];for(var t=A(e-1),s=arguments[0],u=e;u--;)t[u-1]=arguments[u];return nn(ne(s)?st(s):[s],Ve(t,1))}var vh=ae(function(e,t){return Te(e)?_r(e,Ve(t,1,Te,!0)):[]}),_h=ae(function(e,t){var s=Ct(t);return Te(s)&&(s=r),Te(e)?_r(e,Ve(t,1,Te,!0),K(s,2)):[]}),bh=ae(function(e,t){var s=Ct(t);return Te(s)&&(s=r),Te(e)?_r(e,Ve(t,1,Te,!0),r,s):[]});function wh(e,t,s){var u=e==null?0:e.length;return u?(t=s||t===r?1:ie(t),St(e,t<0?0:t,u)):[]}function Sh(e,t,s){var u=e==null?0:e.length;return u?(t=s||t===r?1:ie(t),t=u-t,St(e,0,t<0?0:t)):[]}function Ch(e,t){return e&&e.length?_i(e,K(t,3),!0,!0):[]}function jh(e,t){return e&&e.length?_i(e,K(t,3),!0):[]}function yh(e,t,s,u){var f=e==null?0:e.length;return f?(s&&typeof s!="number"&&et(e,t,s)&&(s=0,u=f),xm(e,t,s,u)):[]}function Mu(e,t,s){var u=e==null?0:e.length;if(!u)return-1;var f=s==null?0:ie(s);return f<0&&(f=ke(u+f,0)),Zr(e,K(t,3),f)}function Tu(e,t,s){var u=e==null?0:e.length;if(!u)return-1;var f=u-1;return s!==r&&(f=ie(s),f=s<0?ke(u+f,0):We(f,u-1)),Zr(e,K(t,3),f,!0)}function Du(e){var t=e==null?0:e.length;return t?Ve(e,1):[]}function Nh(e){var t=e==null?0:e.length;return t?Ve(e,Me):[]}function Rh(e,t){var s=e==null?0:e.length;return s?(t=t===r?1:ie(t),Ve(e,t)):[]}function Eh(e){for(var t=-1,s=e==null?0:e.length,u={};++t<s;){var f=e[t];u[f[0]]=f[1]}return u}function Lu(e){return e&&e.length?e[0]:r}function Ah(e,t,s){var u=e==null?0:e.length;if(!u)return-1;var f=s==null?0:ie(s);return f<0&&(f=ke(u+f,0)),kn(e,t,f)}function Fh(e){var t=e==null?0:e.length;return t?St(e,0,-1):[]}var Ih=ae(function(e){var t=Ee(e,Js);return t.length&&t[0]===e[0]?Vs(t):[]}),Mh=ae(function(e){var t=Ct(e),s=Ee(e,Js);return t===Ct(s)?t=r:s.pop(),s.length&&s[0]===e[0]?Vs(s,K(t,2)):[]}),Th=ae(function(e){var t=Ct(e),s=Ee(e,Js);return t=typeof t=="function"?t:r,t&&s.pop(),s.length&&s[0]===e[0]?Vs(s,r,t):[]});function Dh(e,t){return e==null?"":Fg.call(e,t)}function Ct(e){var t=e==null?0:e.length;return t?e[t-1]:r}function Lh(e,t,s){var u=e==null?0:e.length;if(!u)return-1;var f=u;return s!==r&&(f=ie(s),f=f<0?ke(u+f,0):We(f,u-1)),t===t?mg(e,t,f):Zr(e,hl,f,!0)}function Oh(e,t){return e&&e.length?Hl(e,ie(t)):r}var Ph=ae(Ou);function Ou(e,t){return e&&e.length&&t&&t.length?Ks(e,t):e}function kh(e,t,s){return e&&e.length&&t&&t.length?Ks(e,t,K(s,2)):e}function qh(e,t,s){return e&&e.length&&t&&t.length?Ks(e,t,r,s):e}var $h=Kt(function(e,t){var s=e==null?0:e.length,u=qs(e,t);return Yl(e,Ee(t,function(f){return Wt(f,s)?+f:f}).sort(su)),u});function zh(e,t){var s=[];if(!(e&&e.length))return s;var u=-1,f=[],m=e.length;for(t=K(t,3);++u<m;){var _=e[u];t(_,u,e)&&(s.push(_),f.push(u))}return Yl(e,f),s}function ga(e){return e==null?e:Dg.call(e)}function Bh(e,t,s){var u=e==null?0:e.length;return u?(s&&typeof s!="number"&&et(e,t,s)?(t=0,s=u):(t=t==null?0:ie(t),s=s===r?u:ie(s)),St(e,t,s)):[]}function Vh(e,t){return vi(e,t)}function Uh(e,t,s){return Qs(e,t,K(s,2))}function Gh(e,t){var s=e==null?0:e.length;if(s){var u=vi(e,t);if(u<s&&It(e[u],t))return u}return-1}function Hh(e,t){return vi(e,t,!0)}function Kh(e,t,s){return Qs(e,t,K(s,2),!0)}function Wh(e,t){var s=e==null?0:e.length;if(s){var u=vi(e,t,!0)-1;if(It(e[u],t))return u}return-1}function Yh(e){return e&&e.length?Xl(e):[]}function Qh(e,t){return e&&e.length?Xl(e,K(t,2)):[]}function Xh(e){var t=e==null?0:e.length;return t?St(e,1,t):[]}function Zh(e,t,s){return e&&e.length?(t=s||t===r?1:ie(t),St(e,0,t<0?0:t)):[]}function Jh(e,t,s){var u=e==null?0:e.length;return u?(t=s||t===r?1:ie(t),t=u-t,St(e,t<0?0:t,u)):[]}function ep(e,t){return e&&e.length?_i(e,K(t,3),!1,!0):[]}function tp(e,t){return e&&e.length?_i(e,K(t,3)):[]}var np=ae(function(e){return on(Ve(e,1,Te,!0))}),rp=ae(function(e){var t=Ct(e);return Te(t)&&(t=r),on(Ve(e,1,Te,!0),K(t,2))}),ip=ae(function(e){var t=Ct(e);return t=typeof t=="function"?t:r,on(Ve(e,1,Te,!0),r,t)});function sp(e){return e&&e.length?on(e):[]}function ap(e,t){return e&&e.length?on(e,K(t,2)):[]}function op(e,t){return t=typeof t=="function"?t:r,e&&e.length?on(e,r,t):[]}function ma(e){if(!(e&&e.length))return[];var t=0;return e=tn(e,function(s){if(Te(s))return t=ke(s.length,t),!0}),Is(t,function(s){return Ee(e,Es(s))})}function Pu(e,t){if(!(e&&e.length))return[];var s=ma(e);return t==null?s:Ee(s,function(u){return ct(t,r,u)})}var lp=ae(function(e,t){return Te(e)?_r(e,t):[]}),up=ae(function(e){return Zs(tn(e,Te))}),cp=ae(function(e){var t=Ct(e);return Te(t)&&(t=r),Zs(tn(e,Te),K(t,2))}),dp=ae(function(e){var t=Ct(e);return t=typeof t=="function"?t:r,Zs(tn(e,Te),r,t)}),fp=ae(ma);function gp(e,t){return tu(e||[],t||[],vr)}function mp(e,t){return tu(e||[],t||[],Sr)}var hp=ae(function(e){var t=e.length,s=t>1?e[t-1]:r;return s=typeof s=="function"?(e.pop(),s):r,Pu(e,s)});function ku(e){var t=g(e);return t.__chain__=!0,t}function pp(e,t){return t(e),e}function Ei(e,t){return t(e)}var xp=Kt(function(e){var t=e.length,s=t?e[0]:0,u=this.__wrapped__,f=function(m){return qs(m,e)};return t>1||this.__actions__.length||!(u instanceof ce)||!Wt(s)?this.thru(f):(u=u.slice(s,+s+(t?1:0)),u.__actions__.push({func:Ei,args:[f],thisArg:r}),new bt(u,this.__chain__).thru(function(m){return t&&!m.length&&m.push(r),m}))});function vp(){return ku(this)}function _p(){return new bt(this.value(),this.__chain__)}function bp(){this.__values__===r&&(this.__values__=Zu(this.value()));var e=this.__index__>=this.__values__.length,t=e?r:this.__values__[this.__index__++];return{done:e,value:t}}function wp(){return this}function Sp(e){for(var t,s=this;s instanceof gi;){var u=Iu(s);u.__index__=0,u.__values__=r,t?f.__wrapped__=u:t=u;var f=u;s=s.__wrapped__}return f.__wrapped__=e,t}function Cp(){var e=this.__wrapped__;if(e instanceof ce){var t=e;return this.__actions__.length&&(t=new ce(this)),t=t.reverse(),t.__actions__.push({func:Ei,args:[ga],thisArg:r}),new bt(t,this.__chain__)}return this.thru(ga)}function jp(){return eu(this.__wrapped__,this.__actions__)}var yp=bi(function(e,t,s){pe.call(e,s)?++e[s]:Gt(e,s,1)});function Np(e,t,s){var u=ne(e)?gl:pm;return s&&et(e,t,s)&&(t=r),u(e,K(t,3))}function Rp(e,t){var s=ne(e)?tn:Pl;return s(e,K(t,3))}var Ep=du(Mu),Ap=du(Tu);function Fp(e,t){return Ve(Ai(e,t),1)}function Ip(e,t){return Ve(Ai(e,t),Me)}function Mp(e,t,s){return s=s===r?1:ie(s),Ve(Ai(e,t),s)}function qu(e,t){var s=ne(e)?vt:an;return s(e,K(t,3))}function $u(e,t){var s=ne(e)?Xf:Ol;return s(e,K(t,3))}var Tp=bi(function(e,t,s){pe.call(e,s)?e[s].push(t):Gt(e,s,[t])});function Dp(e,t,s,u){e=at(e)?e:Qn(e),s=s&&!u?ie(s):0;var f=e.length;return s<0&&(s=ke(f+s,0)),Di(e)?s<=f&&e.indexOf(t,s)>-1:!!f&&kn(e,t,s)>-1}var Lp=ae(function(e,t,s){var u=-1,f=typeof t=="function",m=at(e)?A(e.length):[];return an(e,function(_){m[++u]=f?ct(t,_,s):br(_,t,s)}),m}),Op=bi(function(e,t,s){Gt(e,s,t)});function Ai(e,t){var s=ne(e)?Ee:Vl;return s(e,K(t,3))}function Pp(e,t,s,u){return e==null?[]:(ne(t)||(t=t==null?[]:[t]),s=u?r:s,ne(s)||(s=s==null?[]:[s]),Kl(e,t,s))}var kp=bi(function(e,t,s){e[s?0:1].push(t)},function(){return[[],[]]});function qp(e,t,s){var u=ne(e)?Ns:xl,f=arguments.length<3;return u(e,K(t,4),s,f,an)}function $p(e,t,s){var u=ne(e)?Zf:xl,f=arguments.length<3;return u(e,K(t,4),s,f,Ol)}function zp(e,t){var s=ne(e)?tn:Pl;return s(e,Mi(K(t,3)))}function Bp(e){var t=ne(e)?Ml:Dm;return t(e)}function Vp(e,t,s){(s?et(e,t,s):t===r)?t=1:t=ie(t);var u=ne(e)?dm:Lm;return u(e,t)}function Up(e){var t=ne(e)?fm:Pm;return t(e)}function Gp(e){if(e==null)return 0;if(at(e))return Di(e)?$n(e):e.length;var t=Ye(e);return t==Rt||t==Et?e.size:Gs(e).length}function Hp(e,t,s){var u=ne(e)?Rs:km;return s&&et(e,t,s)&&(t=r),u(e,K(t,3))}var Kp=ae(function(e,t){if(e==null)return[];var s=t.length;return s>1&&et(e,t[0],t[1])?t=[]:s>2&&et(t[0],t[1],t[2])&&(t=[t[0]]),Kl(e,Ve(t,1),[])}),Fi=Rg||function(){return Be.Date.now()};function Wp(e,t){if(typeof t!="function")throw new _t(d);return e=ie(e),function(){if(--e<1)return t.apply(this,arguments)}}function zu(e,t,s){return t=s?r:t,t=e&&t==null?e.length:t,Ht(e,re,r,r,r,r,t)}function Bu(e,t){var s;if(typeof t!="function")throw new _t(d);return e=ie(e),function(){return--e>0&&(s=t.apply(this,arguments)),e<=1&&(t=r),s}}var ha=ae(function(e,t,s){var u=P;if(s.length){var f=rn(s,Wn(ha));u|=B}return Ht(e,u,t,s,f)}),Vu=ae(function(e,t,s){var u=P|T;if(s.length){var f=rn(s,Wn(Vu));u|=B}return Ht(t,u,e,s,f)});function Uu(e,t,s){t=s?r:t;var u=Ht(e,F,r,r,r,r,r,t);return u.placeholder=Uu.placeholder,u}function Gu(e,t,s){t=s?r:t;var u=Ht(e,$,r,r,r,r,r,t);return u.placeholder=Gu.placeholder,u}function Hu(e,t,s){var u,f,m,_,w,N,D=0,O=!1,k=!1,z=!0;if(typeof e!="function")throw new _t(d);t=jt(t)||0,Ae(s)&&(O=!!s.leading,k="maxWait"in s,m=k?ke(jt(s.maxWait)||0,t):m,z="trailing"in s?!!s.trailing:z);function G(De){var Mt=u,Xt=f;return u=f=r,D=De,_=e.apply(Xt,Mt),_}function X(De){return D=De,w=yr(oe,t),O?G(De):_}function se(De){var Mt=De-N,Xt=De-D,dc=t-Mt;return k?We(dc,m-Xt):dc}function Z(De){var Mt=De-N,Xt=De-D;return N===r||Mt>=t||Mt<0||k&&Xt>=m}function oe(){var De=Fi();if(Z(De))return de(De);w=yr(oe,se(De))}function de(De){return w=r,z&&u?G(De):(u=f=r,_)}function mt(){w!==r&&nu(w),D=0,u=N=f=w=r}function tt(){return w===r?_:de(Fi())}function ht(){var De=Fi(),Mt=Z(De);if(u=arguments,f=this,N=De,Mt){if(w===r)return X(N);if(k)return nu(w),w=yr(oe,t),G(N)}return w===r&&(w=yr(oe,t)),_}return ht.cancel=mt,ht.flush=tt,ht}var Yp=ae(function(e,t){return Ll(e,1,t)}),Qp=ae(function(e,t,s){return Ll(e,jt(t)||0,s)});function Xp(e){return Ht(e,fe)}function Ii(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new _t(d);var s=function(){var u=arguments,f=t?t.apply(this,u):u[0],m=s.cache;if(m.has(f))return m.get(f);var _=e.apply(this,u);return s.cache=m.set(f,_)||m,_};return s.cache=new(Ii.Cache||Ut),s}Ii.Cache=Ut;function Mi(e){if(typeof e!="function")throw new _t(d);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function Zp(e){return Bu(2,e)}var Jp=qm(function(e,t){t=t.length==1&&ne(t[0])?Ee(t[0],dt(K())):Ee(Ve(t,1),dt(K()));var s=t.length;return ae(function(u){for(var f=-1,m=We(u.length,s);++f<m;)u[f]=t[f].call(this,u[f]);return ct(e,this,u)})}),pa=ae(function(e,t){var s=rn(t,Wn(pa));return Ht(e,B,r,t,s)}),Ku=ae(function(e,t){var s=rn(t,Wn(Ku));return Ht(e,q,r,t,s)}),ex=Kt(function(e,t){return Ht(e,te,r,r,r,t)});function tx(e,t){if(typeof e!="function")throw new _t(d);return t=t===r?t:ie(t),ae(e,t)}function nx(e,t){if(typeof e!="function")throw new _t(d);return t=t==null?0:ke(ie(t),0),ae(function(s){var u=s[t],f=un(s,0,t);return u&&nn(f,u),ct(e,this,f)})}function rx(e,t,s){var u=!0,f=!0;if(typeof e!="function")throw new _t(d);return Ae(s)&&(u="leading"in s?!!s.leading:u,f="trailing"in s?!!s.trailing:f),Hu(e,t,{leading:u,maxWait:t,trailing:f})}function ix(e){return zu(e,1)}function sx(e,t){return pa(ea(t),e)}function ax(){if(!arguments.length)return[];var e=arguments[0];return ne(e)?e:[e]}function ox(e){return wt(e,b)}function lx(e,t){return t=typeof t=="function"?t:r,wt(e,b,t)}function ux(e){return wt(e,y|b)}function cx(e,t){return t=typeof t=="function"?t:r,wt(e,y|b,t)}function dx(e,t){return t==null||Dl(e,t,ze(t))}function It(e,t){return e===t||e!==e&&t!==t}var fx=ji(Bs),gx=ji(function(e,t){return e>=t}),Rn=$l(function(){return arguments}())?$l:function(e){return Fe(e)&&pe.call(e,"callee")&&!Nl.call(e,"callee")},ne=A.isArray,mx=ol?dt(ol):Sm;function at(e){return e!=null&&Ti(e.length)&&!Yt(e)}function Te(e){return Fe(e)&&at(e)}function hx(e){return e===!0||e===!1||Fe(e)&&Je(e)==sr}var cn=Ag||Ra,px=ll?dt(ll):Cm;function xx(e){return Fe(e)&&e.nodeType===1&&!Nr(e)}function vx(e){if(e==null)return!0;if(at(e)&&(ne(e)||typeof e=="string"||typeof e.splice=="function"||cn(e)||Yn(e)||Rn(e)))return!e.length;var t=Ye(e);if(t==Rt||t==Et)return!e.size;if(jr(e))return!Gs(e).length;for(var s in e)if(pe.call(e,s))return!1;return!0}function _x(e,t){return wr(e,t)}function bx(e,t,s){s=typeof s=="function"?s:r;var u=s?s(e,t):r;return u===r?wr(e,t,r,s):!!u}function xa(e){if(!Fe(e))return!1;var t=Je(e);return t==Gr||t==Bd||typeof e.message=="string"&&typeof e.name=="string"&&!Nr(e)}function wx(e){return typeof e=="number"&&El(e)}function Yt(e){if(!Ae(e))return!1;var t=Je(e);return t==Hr||t==Lo||t==zd||t==Ud}function Wu(e){return typeof e=="number"&&e==ie(e)}function Ti(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=U}function Ae(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function Fe(e){return e!=null&&typeof e=="object"}var Yu=ul?dt(ul):ym;function Sx(e,t){return e===t||Us(e,t,oa(t))}function Cx(e,t,s){return s=typeof s=="function"?s:r,Us(e,t,oa(t),s)}function jx(e){return Qu(e)&&e!=+e}function yx(e){if(lh(e))throw new ee(c);return zl(e)}function Nx(e){return e===null}function Rx(e){return e==null}function Qu(e){return typeof e=="number"||Fe(e)&&Je(e)==or}function Nr(e){if(!Fe(e)||Je(e)!=Bt)return!1;var t=ai(e);if(t===null)return!0;var s=pe.call(t,"constructor")&&t.constructor;return typeof s=="function"&&s instanceof s&&ni.call(s)==Cg}var va=cl?dt(cl):Nm;function Ex(e){return Wu(e)&&e>=-9007199254740991&&e<=U}var Xu=dl?dt(dl):Rm;function Di(e){return typeof e=="string"||!ne(e)&&Fe(e)&&Je(e)==ur}function gt(e){return typeof e=="symbol"||Fe(e)&&Je(e)==Kr}var Yn=fl?dt(fl):Em;function Ax(e){return e===r}function Fx(e){return Fe(e)&&Ye(e)==cr}function Ix(e){return Fe(e)&&Je(e)==Hd}var Mx=ji(Hs),Tx=ji(function(e,t){return e<=t});function Zu(e){if(!e)return[];if(at(e))return Di(e)?At(e):st(e);if(gr&&e[gr])return dg(e[gr]());var t=Ye(e),s=t==Rt?Ts:t==Et?Jr:Qn;return s(e)}function Qt(e){if(!e)return e===0?e:0;if(e=jt(e),e===Me||e===-1/0){var t=e<0?-1:1;return t*_e}return e===e?e:0}function ie(e){var t=Qt(e),s=t%1;return t===t?s?t-s:t:0}function Ju(e){return e?Cn(ie(e),0,it):0}function jt(e){if(typeof e=="number")return e;if(gt(e))return Ze;if(Ae(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Ae(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=vl(e);var s=mf.test(e);return s||pf.test(e)?Wf(e.slice(2),s?2:8):gf.test(e)?Ze:+e}function ec(e){return Ot(e,ot(e))}function Dx(e){return e?Cn(ie(e),-9007199254740991,U):e===0?e:0}function he(e){return e==null?"":ft(e)}var Lx=Hn(function(e,t){if(jr(t)||at(t)){Ot(t,ze(t),e);return}for(var s in t)pe.call(t,s)&&vr(e,s,t[s])}),tc=Hn(function(e,t){Ot(t,ot(t),e)}),Li=Hn(function(e,t,s,u){Ot(t,ot(t),e,u)}),Ox=Hn(function(e,t,s,u){Ot(t,ze(t),e,u)}),Px=Kt(qs);function kx(e,t){var s=Gn(e);return t==null?s:Tl(s,t)}var qx=ae(function(e,t){e=be(e);var s=-1,u=t.length,f=u>2?t[2]:r;for(f&&et(t[0],t[1],f)&&(u=1);++s<u;)for(var m=t[s],_=ot(m),w=-1,N=_.length;++w<N;){var D=_[w],O=e[D];(O===r||It(O,Bn[D])&&!pe.call(e,D))&&(e[D]=m[D])}return e}),$x=ae(function(e){return e.push(r,vu),ct(nc,r,e)});function zx(e,t){return ml(e,K(t,3),Lt)}function Bx(e,t){return ml(e,K(t,3),zs)}function Vx(e,t){return e==null?e:$s(e,K(t,3),ot)}function Ux(e,t){return e==null?e:kl(e,K(t,3),ot)}function Gx(e,t){return e&&Lt(e,K(t,3))}function Hx(e,t){return e&&zs(e,K(t,3))}function Kx(e){return e==null?[]:pi(e,ze(e))}function Wx(e){return e==null?[]:pi(e,ot(e))}function _a(e,t,s){var u=e==null?r:jn(e,t);return u===r?s:u}function Yx(e,t){return e!=null&&wu(e,t,vm)}function ba(e,t){return e!=null&&wu(e,t,_m)}var Qx=gu(function(e,t,s){t!=null&&typeof t.toString!="function"&&(t=ri.call(t)),e[t]=s},Sa(lt)),Xx=gu(function(e,t,s){t!=null&&typeof t.toString!="function"&&(t=ri.call(t)),pe.call(e,t)?e[t].push(s):e[t]=[s]},K),Zx=ae(br);function ze(e){return at(e)?Il(e):Gs(e)}function ot(e){return at(e)?Il(e,!0):Am(e)}function Jx(e,t){var s={};return t=K(t,3),Lt(e,function(u,f,m){Gt(s,t(u,f,m),u)}),s}function ev(e,t){var s={};return t=K(t,3),Lt(e,function(u,f,m){Gt(s,f,t(u,f,m))}),s}var tv=Hn(function(e,t,s){xi(e,t,s)}),nc=Hn(function(e,t,s,u){xi(e,t,s,u)}),nv=Kt(function(e,t){var s={};if(e==null)return s;var u=!1;t=Ee(t,function(m){return m=ln(m,e),u||(u=m.length>1),m}),Ot(e,sa(e),s),u&&(s=wt(s,y|C|b,Qm));for(var f=t.length;f--;)Xs(s,t[f]);return s});function rv(e,t){return rc(e,Mi(K(t)))}var iv=Kt(function(e,t){return e==null?{}:Im(e,t)});function rc(e,t){if(e==null)return{};var s=Ee(sa(e),function(u){return[u]});return t=K(t),Wl(e,s,function(u,f){return t(u,f[0])})}function sv(e,t,s){t=ln(t,e);var u=-1,f=t.length;for(f||(f=1,e=r);++u<f;){var m=e==null?r:e[Pt(t[u])];m===r&&(u=f,m=s),e=Yt(m)?m.call(e):m}return e}function av(e,t,s){return e==null?e:Sr(e,t,s)}function ov(e,t,s,u){return u=typeof u=="function"?u:r,e==null?e:Sr(e,t,s,u)}var ic=pu(ze),sc=pu(ot);function lv(e,t,s){var u=ne(e),f=u||cn(e)||Yn(e);if(t=K(t,4),s==null){var m=e&&e.constructor;f?s=u?new m:[]:Ae(e)?s=Yt(m)?Gn(ai(e)):{}:s={}}return(f?vt:Lt)(e,function(_,w,N){return t(s,_,w,N)}),s}function uv(e,t){return e==null?!0:Xs(e,t)}function cv(e,t,s){return e==null?e:Jl(e,t,ea(s))}function dv(e,t,s,u){return u=typeof u=="function"?u:r,e==null?e:Jl(e,t,ea(s),u)}function Qn(e){return e==null?[]:Ms(e,ze(e))}function fv(e){return e==null?[]:Ms(e,ot(e))}function gv(e,t,s){return s===r&&(s=t,t=r),s!==r&&(s=jt(s),s=s===s?s:0),t!==r&&(t=jt(t),t=t===t?t:0),Cn(jt(e),t,s)}function mv(e,t,s){return t=Qt(t),s===r?(s=t,t=0):s=Qt(s),e=jt(e),bm(e,t,s)}function hv(e,t,s){if(s&&typeof s!="boolean"&&et(e,t,s)&&(t=s=r),s===r&&(typeof t=="boolean"?(s=t,t=r):typeof e=="boolean"&&(s=e,e=r)),e===r&&t===r?(e=0,t=1):(e=Qt(e),t===r?(t=e,e=0):t=Qt(t)),e>t){var u=e;e=t,t=u}if(s||e%1||t%1){var f=Al();return We(e+f*(t-e+Kf("1e-"+((f+"").length-1))),t)}return Ws(e,t)}var pv=Kn(function(e,t,s){return t=t.toLowerCase(),e+(s?ac(t):t)});function ac(e){return wa(he(e).toLowerCase())}function oc(e){return e=he(e),e&&e.replace(vf,ag).replace(Pf,"")}function xv(e,t,s){e=he(e),t=ft(t);var u=e.length;s=s===r?u:Cn(ie(s),0,u);var f=s;return s-=t.length,s>=0&&e.slice(s,f)==t}function vv(e){return e=he(e),e&&Xd.test(e)?e.replace(ko,og):e}function _v(e){return e=he(e),e&&rf.test(e)?e.replace(ps,"\\$&"):e}var bv=Kn(function(e,t,s){return e+(s?"-":"")+t.toLowerCase()}),wv=Kn(function(e,t,s){return e+(s?" ":"")+t.toLowerCase()}),Sv=cu("toLowerCase");function Cv(e,t,s){e=he(e),t=ie(t);var u=t?$n(e):0;if(!t||u>=t)return e;var f=(t-u)/2;return Ci(ci(f),s)+e+Ci(ui(f),s)}function jv(e,t,s){e=he(e),t=ie(t);var u=t?$n(e):0;return t&&u<t?e+Ci(t-u,s):e}function yv(e,t,s){e=he(e),t=ie(t);var u=t?$n(e):0;return t&&u<t?Ci(t-u,s)+e:e}function Nv(e,t,s){return s||t==null?t=0:t&&(t=+t),Tg(he(e).replace(xs,""),t||0)}function Rv(e,t,s){return(s?et(e,t,s):t===r)?t=1:t=ie(t),Ys(he(e),t)}function Ev(){var e=arguments,t=he(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var Av=Kn(function(e,t,s){return e+(s?"_":"")+t.toLowerCase()});function Fv(e,t,s){return s&&typeof s!="number"&&et(e,t,s)&&(t=s=r),s=s===r?it:s>>>0,s?(e=he(e),e&&(typeof t=="string"||t!=null&&!va(t))&&(t=ft(t),!t&&qn(e))?un(At(e),0,s):e.split(t,s)):[]}var Iv=Kn(function(e,t,s){return e+(s?" ":"")+wa(t)});function Mv(e,t,s){return e=he(e),s=s==null?0:Cn(ie(s),0,e.length),t=ft(t),e.slice(s,s+t.length)==t}function Tv(e,t,s){var u=g.templateSettings;s&&et(e,t,s)&&(t=r),e=he(e),t=Li({},t,u,xu);var f=Li({},t.imports,u.imports,xu),m=ze(f),_=Ms(f,m),w,N,D=0,O=t.interpolate||Wr,k="__p += '",z=Ds((t.escape||Wr).source+"|"+O.source+"|"+(O===qo?ff:Wr).source+"|"+(t.evaluate||Wr).source+"|$","g"),G="//# sourceURL="+(pe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Bf+"]")+`
`;e.replace(z,function(Z,oe,de,mt,tt,ht){return de||(de=mt),k+=e.slice(D,ht).replace(_f,lg),oe&&(w=!0,k+=`' +
__e(`+oe+`) +
'`),tt&&(N=!0,k+=`';
`+tt+`;
__p += '`),de&&(k+=`' +
((__t = (`+de+`)) == null ? '' : __t) +
'`),D=ht+Z.length,Z}),k+=`';
`;var X=pe.call(t,"variable")&&t.variable;if(!X)k=`with (obj) {
`+k+`
}
`;else if(cf.test(X))throw new ee(h);k=(N?k.replace(Kd,""):k).replace(Wd,"$1").replace(Yd,"$1;"),k="function("+(X||"obj")+`) {
`+(X?"":`obj || (obj = {});
`)+"var __t, __p = ''"+(w?", __e = _.escape":"")+(N?`, __j = Array.prototype.join;
function print() { __p += __j.call(arguments, '') }
`:`;
`)+k+`return __p
}`;var se=uc(function(){return ge(m,G+"return "+k).apply(r,_)});if(se.source=k,xa(se))throw se;return se}function Dv(e){return he(e).toLowerCase()}function Lv(e){return he(e).toUpperCase()}function Ov(e,t,s){if(e=he(e),e&&(s||t===r))return vl(e);if(!e||!(t=ft(t)))return e;var u=At(e),f=At(t),m=_l(u,f),_=bl(u,f)+1;return un(u,m,_).join("")}function Pv(e,t,s){if(e=he(e),e&&(s||t===r))return e.slice(0,Sl(e)+1);if(!e||!(t=ft(t)))return e;var u=At(e),f=bl(u,At(t))+1;return un(u,0,f).join("")}function kv(e,t,s){if(e=he(e),e&&(s||t===r))return e.replace(xs,"");if(!e||!(t=ft(t)))return e;var u=At(e),f=_l(u,At(t));return un(u,f).join("")}function qv(e,t){var s=Se,u=ue;if(Ae(t)){var f="separator"in t?t.separator:f;s="length"in t?ie(t.length):s,u="omission"in t?ft(t.omission):u}e=he(e);var m=e.length;if(qn(e)){var _=At(e);m=_.length}if(s>=m)return e;var w=s-$n(u);if(w<1)return u;var N=_?un(_,0,w).join(""):e.slice(0,w);if(f===r)return N+u;if(_&&(w+=N.length-w),va(f)){if(e.slice(w).search(f)){var D,O=N;for(f.global||(f=Ds(f.source,he($o.exec(f))+"g")),f.lastIndex=0;D=f.exec(O);)var k=D.index;N=N.slice(0,k===r?w:k)}}else if(e.indexOf(ft(f),w)!=w){var z=N.lastIndexOf(f);z>-1&&(N=N.slice(0,z))}return N+u}function $v(e){return e=he(e),e&&Qd.test(e)?e.replace(Po,hg):e}var zv=Kn(function(e,t,s){return e+(s?" ":"")+t.toUpperCase()}),wa=cu("toUpperCase");function lc(e,t,s){return e=he(e),t=s?r:t,t===r?cg(e)?vg(e):tg(e):e.match(t)||[]}var uc=ae(function(e,t){try{return ct(e,r,t)}catch(s){return xa(s)?s:new ee(s)}}),Bv=Kt(function(e,t){return vt(t,function(s){s=Pt(s),Gt(e,s,ha(e[s],e))}),e});function Vv(e){var t=e==null?0:e.length,s=K();return e=t?Ee(e,function(u){if(typeof u[1]!="function")throw new _t(d);return[s(u[0]),u[1]]}):[],ae(function(u){for(var f=-1;++f<t;){var m=e[f];if(ct(m[0],this,u))return ct(m[1],this,u)}})}function Uv(e){return hm(wt(e,y))}function Sa(e){return function(){return e}}function Gv(e,t){return e==null||e!==e?t:e}var Hv=fu(),Kv=fu(!0);function lt(e){return e}function Ca(e){return Bl(typeof e=="function"?e:wt(e,y))}function Wv(e){return Ul(wt(e,y))}function Yv(e,t){return Gl(e,wt(t,y))}var Qv=ae(function(e,t){return function(s){return br(s,e,t)}}),Xv=ae(function(e,t){return function(s){return br(e,s,t)}});function ja(e,t,s){var u=ze(t),f=pi(t,u);s==null&&!(Ae(t)&&(f.length||!u.length))&&(s=t,t=e,e=this,f=pi(t,ze(t)));var m=!(Ae(s)&&"chain"in s)||!!s.chain,_=Yt(e);return vt(f,function(w){var N=t[w];e[w]=N,_&&(e.prototype[w]=function(){var D=this.__chain__;if(m||D){var O=e(this.__wrapped__),k=O.__actions__=st(this.__actions__);return k.push({func:N,args:arguments,thisArg:e}),O.__chain__=D,O}return N.apply(e,nn([this.value()],arguments))})}),e}function Zv(){return Be._===this&&(Be._=jg),this}function ya(){}function Jv(e){return e=ie(e),ae(function(t){return Hl(t,e)})}var e_=na(Ee),t_=na(gl),n_=na(Rs);function cc(e){return ua(e)?Es(Pt(e)):Mm(e)}function r_(e){return function(t){return e==null?r:jn(e,t)}}var i_=mu(),s_=mu(!0);function Na(){return[]}function Ra(){return!1}function a_(){return{}}function o_(){return""}function l_(){return!0}function u_(e,t){if(e=ie(e),e<1||e>U)return[];var s=it,u=We(e,it);t=K(t),e-=it;for(var f=Is(u,t);++s<e;)t(s);return f}function c_(e){return ne(e)?Ee(e,Pt):gt(e)?[e]:st(Fu(he(e)))}function d_(e){var t=++Sg;return he(e)+t}var f_=Si(function(e,t){return e+t},0),g_=ra("ceil"),m_=Si(function(e,t){return e/t},1),h_=ra("floor");function p_(e){return e&&e.length?hi(e,lt,Bs):r}function x_(e,t){return e&&e.length?hi(e,K(t,2),Bs):r}function v_(e){return pl(e,lt)}function __(e,t){return pl(e,K(t,2))}function b_(e){return e&&e.length?hi(e,lt,Hs):r}function w_(e,t){return e&&e.length?hi(e,K(t,2),Hs):r}var S_=Si(function(e,t){return e*t},1),C_=ra("round"),j_=Si(function(e,t){return e-t},0);function y_(e){return e&&e.length?Fs(e,lt):0}function N_(e,t){return e&&e.length?Fs(e,K(t,2)):0}return g.after=Wp,g.ary=zu,g.assign=Lx,g.assignIn=tc,g.assignInWith=Li,g.assignWith=Ox,g.at=Px,g.before=Bu,g.bind=ha,g.bindAll=Bv,g.bindKey=Vu,g.castArray=ax,g.chain=ku,g.chunk=hh,g.compact=ph,g.concat=xh,g.cond=Vv,g.conforms=Uv,g.constant=Sa,g.countBy=yp,g.create=kx,g.curry=Uu,g.curryRight=Gu,g.debounce=Hu,g.defaults=qx,g.defaultsDeep=$x,g.defer=Yp,g.delay=Qp,g.difference=vh,g.differenceBy=_h,g.differenceWith=bh,g.drop=wh,g.dropRight=Sh,g.dropRightWhile=Ch,g.dropWhile=jh,g.fill=yh,g.filter=Rp,g.flatMap=Fp,g.flatMapDeep=Ip,g.flatMapDepth=Mp,g.flatten=Du,g.flattenDeep=Nh,g.flattenDepth=Rh,g.flip=Xp,g.flow=Hv,g.flowRight=Kv,g.fromPairs=Eh,g.functions=Kx,g.functionsIn=Wx,g.groupBy=Tp,g.initial=Fh,g.intersection=Ih,g.intersectionBy=Mh,g.intersectionWith=Th,g.invert=Qx,g.invertBy=Xx,g.invokeMap=Lp,g.iteratee=Ca,g.keyBy=Op,g.keys=ze,g.keysIn=ot,g.map=Ai,g.mapKeys=Jx,g.mapValues=ev,g.matches=Wv,g.matchesProperty=Yv,g.memoize=Ii,g.merge=tv,g.mergeWith=nc,g.method=Qv,g.methodOf=Xv,g.mixin=ja,g.negate=Mi,g.nthArg=Jv,g.omit=nv,g.omitBy=rv,g.once=Zp,g.orderBy=Pp,g.over=e_,g.overArgs=Jp,g.overEvery=t_,g.overSome=n_,g.partial=pa,g.partialRight=Ku,g.partition=kp,g.pick=iv,g.pickBy=rc,g.property=cc,g.propertyOf=r_,g.pull=Ph,g.pullAll=Ou,g.pullAllBy=kh,g.pullAllWith=qh,g.pullAt=$h,g.range=i_,g.rangeRight=s_,g.rearg=ex,g.reject=zp,g.remove=zh,g.rest=tx,g.reverse=ga,g.sampleSize=Vp,g.set=av,g.setWith=ov,g.shuffle=Up,g.slice=Bh,g.sortBy=Kp,g.sortedUniq=Yh,g.sortedUniqBy=Qh,g.split=Fv,g.spread=nx,g.tail=Xh,g.take=Zh,g.takeRight=Jh,g.takeRightWhile=ep,g.takeWhile=tp,g.tap=pp,g.throttle=rx,g.thru=Ei,g.toArray=Zu,g.toPairs=ic,g.toPairsIn=sc,g.toPath=c_,g.toPlainObject=ec,g.transform=lv,g.unary=ix,g.union=np,g.unionBy=rp,g.unionWith=ip,g.uniq=sp,g.uniqBy=ap,g.uniqWith=op,g.unset=uv,g.unzip=ma,g.unzipWith=Pu,g.update=cv,g.updateWith=dv,g.values=Qn,g.valuesIn=fv,g.without=lp,g.words=lc,g.wrap=sx,g.xor=up,g.xorBy=cp,g.xorWith=dp,g.zip=fp,g.zipObject=gp,g.zipObjectDeep=mp,g.zipWith=hp,g.entries=ic,g.entriesIn=sc,g.extend=tc,g.extendWith=Li,ja(g,g),g.add=f_,g.attempt=uc,g.camelCase=pv,g.capitalize=ac,g.ceil=g_,g.clamp=gv,g.clone=ox,g.cloneDeep=ux,g.cloneDeepWith=cx,g.cloneWith=lx,g.conformsTo=dx,g.deburr=oc,g.defaultTo=Gv,g.divide=m_,g.endsWith=xv,g.eq=It,g.escape=vv,g.escapeRegExp=_v,g.every=Np,g.find=Ep,g.findIndex=Mu,g.findKey=zx,g.findLast=Ap,g.findLastIndex=Tu,g.findLastKey=Bx,g.floor=h_,g.forEach=qu,g.forEachRight=$u,g.forIn=Vx,g.forInRight=Ux,g.forOwn=Gx,g.forOwnRight=Hx,g.get=_a,g.gt=fx,g.gte=gx,g.has=Yx,g.hasIn=ba,g.head=Lu,g.identity=lt,g.includes=Dp,g.indexOf=Ah,g.inRange=mv,g.invoke=Zx,g.isArguments=Rn,g.isArray=ne,g.isArrayBuffer=mx,g.isArrayLike=at,g.isArrayLikeObject=Te,g.isBoolean=hx,g.isBuffer=cn,g.isDate=px,g.isElement=xx,g.isEmpty=vx,g.isEqual=_x,g.isEqualWith=bx,g.isError=xa,g.isFinite=wx,g.isFunction=Yt,g.isInteger=Wu,g.isLength=Ti,g.isMap=Yu,g.isMatch=Sx,g.isMatchWith=Cx,g.isNaN=jx,g.isNative=yx,g.isNil=Rx,g.isNull=Nx,g.isNumber=Qu,g.isObject=Ae,g.isObjectLike=Fe,g.isPlainObject=Nr,g.isRegExp=va,g.isSafeInteger=Ex,g.isSet=Xu,g.isString=Di,g.isSymbol=gt,g.isTypedArray=Yn,g.isUndefined=Ax,g.isWeakMap=Fx,g.isWeakSet=Ix,g.join=Dh,g.kebabCase=bv,g.last=Ct,g.lastIndexOf=Lh,g.lowerCase=wv,g.lowerFirst=Sv,g.lt=Mx,g.lte=Tx,g.max=p_,g.maxBy=x_,g.mean=v_,g.meanBy=__,g.min=b_,g.minBy=w_,g.stubArray=Na,g.stubFalse=Ra,g.stubObject=a_,g.stubString=o_,g.stubTrue=l_,g.multiply=S_,g.nth=Oh,g.noConflict=Zv,g.noop=ya,g.now=Fi,g.pad=Cv,g.padEnd=jv,g.padStart=yv,g.parseInt=Nv,g.random=hv,g.reduce=qp,g.reduceRight=$p,g.repeat=Rv,g.replace=Ev,g.result=sv,g.round=C_,g.runInContext=j,g.sample=Bp,g.size=Gp,g.snakeCase=Av,g.some=Hp,g.sortedIndex=Vh,g.sortedIndexBy=Uh,g.sortedIndexOf=Gh,g.sortedLastIndex=Hh,g.sortedLastIndexBy=Kh,g.sortedLastIndexOf=Wh,g.startCase=Iv,g.startsWith=Mv,g.subtract=j_,g.sum=y_,g.sumBy=N_,g.template=Tv,g.times=u_,g.toFinite=Qt,g.toInteger=ie,g.toLength=Ju,g.toLower=Dv,g.toNumber=jt,g.toSafeInteger=Dx,g.toString=he,g.toUpper=Lv,g.trim=Ov,g.trimEnd=Pv,g.trimStart=kv,g.truncate=qv,g.unescape=$v,g.uniqueId=d_,g.upperCase=zv,g.upperFirst=wa,g.each=qu,g.eachRight=$u,g.first=Lu,ja(g,function(){var e={};return Lt(g,function(t,s){pe.call(g.prototype,s)||(e[s]=t)}),e}(),{chain:!1}),g.VERSION=o,vt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){g[e].placeholder=g}),vt(["drop","take"],function(e,t){ce.prototype[e]=function(s){s=s===r?1:ke(ie(s),0);var u=this.__filtered__&&!t?new ce(this):this.clone();return u.__filtered__?u.__takeCount__=We(s,u.__takeCount__):u.__views__.push({size:We(s,it),type:e+(u.__dir__<0?"Right":"")}),u},ce.prototype[e+"Right"]=function(s){return this.reverse()[e](s).reverse()}}),vt(["filter","map","takeWhile"],function(e,t){var s=t+1,u=s==rt||s==Ce;ce.prototype[e]=function(f){var m=this.clone();return m.__iteratees__.push({iteratee:K(f,3),type:s}),m.__filtered__=m.__filtered__||u,m}}),vt(["head","last"],function(e,t){var s="take"+(t?"Right":"");ce.prototype[e]=function(){return this[s](1).value()[0]}}),vt(["initial","tail"],function(e,t){var s="drop"+(t?"":"Right");ce.prototype[e]=function(){return this.__filtered__?new ce(this):this[s](1)}}),ce.prototype.compact=function(){return this.filter(lt)},ce.prototype.find=function(e){return this.filter(e).head()},ce.prototype.findLast=function(e){return this.reverse().find(e)},ce.prototype.invokeMap=ae(function(e,t){return typeof e=="function"?new ce(this):this.map(function(s){return br(s,e,t)})}),ce.prototype.reject=function(e){return this.filter(Mi(K(e)))},ce.prototype.slice=function(e,t){e=ie(e);var s=this;return s.__filtered__&&(e>0||t<0)?new ce(s):(e<0?s=s.takeRight(-e):e&&(s=s.drop(e)),t!==r&&(t=ie(t),s=t<0?s.dropRight(-t):s.take(t-e)),s)},ce.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},ce.prototype.toArray=function(){return this.take(it)},Lt(ce.prototype,function(e,t){var s=/^(?:filter|find|map|reject)|While$/.test(t),u=/^(?:head|last)$/.test(t),f=g[u?"take"+(t=="last"?"Right":""):t],m=u||/^find/.test(t);f&&(g.prototype[t]=function(){var _=this.__wrapped__,w=u?[1]:arguments,N=_ instanceof ce,D=w[0],O=N||ne(_),k=function(oe){var de=f.apply(g,nn([oe],w));return u&&z?de[0]:de};O&&s&&typeof D=="function"&&D.length!=1&&(N=O=!1);var z=this.__chain__,G=!!this.__actions__.length,X=m&&!z,se=N&&!G;if(!m&&O){_=se?_:new ce(this);var Z=e.apply(_,w);return Z.__actions__.push({func:Ei,args:[k],thisArg:r}),new bt(Z,z)}return X&&se?e.apply(this,w):(Z=this.thru(k),X?u?Z.value()[0]:Z.value():Z)})}),vt(["pop","push","shift","sort","splice","unshift"],function(e){var t=ei[e],s=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",u=/^(?:pop|shift)$/.test(e);g.prototype[e]=function(){var f=arguments;if(u&&!this.__chain__){var m=this.value();return t.apply(ne(m)?m:[],f)}return this[s](function(_){return t.apply(ne(_)?_:[],f)})}}),Lt(ce.prototype,function(e,t){var s=g[t];if(s){var u=s.name+"";pe.call(Un,u)||(Un[u]=[]),Un[u].push({name:t,func:s})}}),Un[wi(r,T).name]=[{name:"wrapper",func:r}],ce.prototype.clone=$g,ce.prototype.reverse=zg,ce.prototype.value=Bg,g.prototype.at=xp,g.prototype.chain=vp,g.prototype.commit=_p,g.prototype.next=bp,g.prototype.plant=Sp,g.prototype.reverse=Cp,g.prototype.toJSON=g.prototype.valueOf=g.prototype.value=jp,g.prototype.first=g.prototype.head,gr&&(g.prototype[gr]=wp),g},zn=_g();_n?((_n.exports=zn)._=zn,Cs._=zn):Be._=zn}).call(Xn)})(Ki,Ki.exports);var Ie=Ki.exports;const Dw=n=>{console.debug("calculateQuoteTotals",n);const a=$t.create(n[1]||{amount:null,scale:2});if(a.isFailure)throw a.error;const r=a.object,o=$t.create(n[2]||{amount:null,scale:2});if(o.isFailure)throw o.error;const l=o.object,c=Tt.create(n[0]||{amount:null,scale:2});if(c.isFailure)throw c.error;const d=c.object,h=d.percentage(r.toNumber()).convertScale(2),p=d.subtract(h).convertScale(2),v=p.percentage(l.toNumber()).convertScale(2),x=p.add(v).convertScale(2);return{subtotalPrice:d.toObject(),discount:r.toObject(),discountPrice:h.toObject(),priceBeforeTaxes:p.toObject(),tax:l.toObject(),taxesPrice:v.toObject(),totalPrice:x.toObject()}},Lw=({currency:n})=>{const{formState:a,control:r}=rr(),{formatNumber:o}=xw(),l=s0({control:r,name:["subtotal_price","discount","tax"]}),c=Dw(l),d=o(c.subtotalPrice),h=o(c.discountPrice),p=o(c.taxesPrice),v=o(c.totalPrice),x=L.useMemo(()=>n.symbol||"",[n]);return i.jsx(qe,{className:"w-full bg-muted",children:i.jsxs($e,{className:"flex flex-row items-end gap-2 p-4 border-t",children:[i.jsx("div",{className:"grid flex-1 h-16 grid-cols-1 auto-rows-max",children:i.jsxs("div",{className:"grid gap-1 font-semibold text-right text-muted-foreground",children:[i.jsx(nt,{className:"text-sm",children:S("quotes.form_fields.subtotal_price.label")}),i.jsxs(Xe,{className:"flex items-baseline justify-end text-2xl tabular-nums",children:[d,i.jsx("span",{className:"ml-1 text-lg tracking-normal",children:x})]})]})}),i.jsx(mn,{orientation:"vertical",className:"w-px h-16 mx-2"}),i.jsxs("div",{className:"grid flex-1 h-16 grid-cols-2 gap-6 auto-rows-max",children:[i.jsxs("div",{className:"grid gap-1 font-medium text-muted-foreground",children:[i.jsx(nt,{className:"text-sm",children:S("quotes.form_fields.discount.label")}),i.jsx(Hi,{scale:2,disabled:a.disabled,placeholder:S("quotes.form_fields.discount.placeholder"),name:"discount",onChange:y=>{console.log("discount",y)}})]}),i.jsxs("div",{className:"grid gap-1 font-semibold text-muted-foreground",children:[i.jsx(nt,{className:"text-sm text-right",children:S("quotes.form_fields.discount_price.label")}),i.jsxs(Xe,{className:"flex items-baseline justify-end text-2xl tabular-nums",children:[h,i.jsx("span",{className:"ml-1 text-lg tracking-normal",children:x})]})]})]}),i.jsx(mn,{orientation:"vertical",className:"w-px h-16 mx-2"}),i.jsxs("div",{className:"grid flex-1 h-16 grid-cols-2 gap-6 auto-rows-max",children:[i.jsxs("div",{className:"grid gap-1 font-medium text-muted-foreground",children:[i.jsx(nt,{className:"text-sm",children:S("quotes.form_fields.tax.label")}),i.jsx(Hi,{scale:2,disabled:a.disabled,placeholder:S("quotes.form_fields.tax.placeholder"),name:"tax"})]}),i.jsxs("div",{className:"grid gap-1 font-semibold text-muted-foreground",children:[i.jsx(nt,{className:"text-sm text-right",children:S("quotes.form_fields.tax_price.label")}),i.jsxs(Xe,{className:"flex items-baseline justify-end gap-1 text-2xl tabular-nums",children:[p,i.jsx("span",{className:"text-base font-medium tracking-normal",children:x})]})]})]})," ",i.jsx(mn,{orientation:"vertical",className:"w-px h-16 mx-2"}),i.jsx("div",{className:"grid flex-1 h-16 grid-cols-1 auto-rows-max",children:i.jsxs("div",{className:"grid gap-0",children:[i.jsx(nt,{className:"text-sm font-semibold text-right text-foreground",children:S("quotes.form_fields.total_price.label")}),i.jsxs(Xe,{className:"flex items-baseline justify-end gap-1 text-3xl tabular-nums",children:[v,i.jsx("span",{className:"ml-1 text-lg tracking-normal",children:x})]})]})})]})})},Ld=n=>{const{percentage:a,cancel:r,error:o,isInProgress:l,onFinishDownload:c}=n,d=L.useId();return L.useEffect(()=>{l&&!o&&a===100&&c&&c()},[a,l,o,c]),i.jsx(Dr,{open:l,children:i.jsxs(Lr,{className:"sm:max-w-md",children:[i.jsxs(Or,{children:[i.jsx(Pr,{children:S("quotes.downloading_dialog.title")}),i.jsx(wo,{children:S("quotes.downloading_dialog.description")})]}),i.jsxs("div",{className:"mb-4 space-y-2",id:d,children:[i.jsx(Br,{children:S("quotes.downloading_dialog.progress.label",{status:S(l?"quotes.downloading_dialog.progress.status_in_progress":"quotes.downloading_dialog.progress.status_stopped")})}),i.jsx(Uc,{value:a,max:100,getValueLabel:()=>S("quotes.downloading_dialog.progress.label",{})}),o&&i.jsxs("p",{children:["Error: ",JSON.stringify(o)]})]}),i.jsx(kr,{className:"sm:justify-end",children:i.jsx(Bi,{asChild:!0,children:i.jsx(H,{type:"button",variant:"secondary",onClick:()=>r(),children:S("quotes.downloading_dialog.cancel_button")})})})]})})},Ow=({isInProgress:n,percentage:a,elapsed:r,cancel:o,error:l,className:c})=>{const[d,h]=L.useState(10);return L.useEffect(()=>{if(n&&a>0){const p=r/a*100;h(Math.max(0,Math.round(p-r)))}},[n,a,r]),!n&&!(l!=null&&l.errorMessage)?null:i.jsxs(qe,{className:me("overflow-hidden",c),children:[i.jsx(yt,{children:i.jsxs(Xe,{className:"flex items-center justify-between",children:[l!=null&&l.errorMessage?"Error en la generación del PDF":"Generando PDF",n&&i.jsx(K0,{className:"w-4 h-4 animate-spin"}),(l==null?void 0:l.errorMessage)&&i.jsx(B0,{className:"w-4 h-4 text-destructive"})]})}),i.jsx($e,{children:l!=null&&l.errorMessage?i.jsx("div",{className:"text-destructive",children:l==null?void 0:l.errorMessage}):i.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[i.jsxs("div",{className:"relative w-32 h-40 overflow-hidden rounded-lg bg-muted",children:[i.jsx("div",{className:"absolute bottom-0 left-0 right-0 transition-all duration-1000 ease-out bg-primary",style:{height:`${a}%`}}),i.jsx(H0,{className:"absolute transform -translate-x-1/2 -translate-y-1/2 animate-pulse top-1/2 left-1/2 text-muted-foreground",size:48})]}),i.jsx(Uc,{value:a,className:"w-full"}),i.jsxs("div",{className:"text-sm text-center text-muted-foreground",children:[i.jsxs("p",{children:["Progreso: ",a,"%"]}),i.jsxs("div",{className:"hidden",children:[i.jsxs("p",{children:["Tiempo transcurrido: ",r," segundos"]}),d>0&&i.jsxs("p",{children:["Tiempo estimado restante: ",d," segundos"]})]})]}),i.jsx(H,{variant:"destructive",onClick:o,className:"hidden",children:"Cancelar generación"})]})})]})},Od=({quote:n,className:a})=>{const{useReport:r,getQuotePDFFilename:o,useDownloader:l}=Vr(),{download:c}=l(),{report:d,preview:h,isInProgress:p,...v}=r(),[x,y]=L.useState(void 0),C=L.useCallback(()=>{n&&c(n.id,o(n))},[n]);return L.useEffect(()=>{const b=setTimeout(()=>{n&&n.id&&h(n.id)},200);return()=>clearTimeout(b)},[n]),L.useEffect(()=>{if(!p&&d){const b=window.URL&&window.URL.createObjectURL?window.URL.createObjectURL(d):window.webkitURL.createObjectURL(d);return y(b),()=>{y(void 0),window.URL.revokeObjectURL(b)}}},[d,p]),n?p?i.jsx(Ow,{isInProgress:p,...v}):i.jsx(a0,{file:x,className:"object-contain",onThumbnailClick:C}):i.jsx(qe,{className:me("overflow-hidden",a),children:i.jsx($e,{className:"px-4 py-6 text-center",children:i.jsx("p",{className:"mx-auto",children:"Select a quote"})})})};Od.whyDidYouRender=!0;const Er=cb();function Pw({row:n,table:a}){var l;const r=(l=a.options.meta)==null?void 0:l.catalogPicker;if(!r)return null;const o=r.quantities[n.index]??1;return i.jsx(Zi,{type:"number",name:"quantity",min:1,className:"w-24",value:o,onChange:c=>{const d=c.target.value;r.setQuantity(n.index,d===""?"":Number(d))}})}function kw({row:n,table:a}){var o;const r=(o=a.options.meta)==null?void 0:o.catalogPicker;return i.jsxs(H,{size:"sm",variant:"outline",className:"h-8 gap-1",onClick:l=>{l.preventDefault(),r==null||r.selectArticle(n.original,n.index)},children:[i.jsx(Co,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"sr-only xl:not-sr-only xl:whitespace-nowrap",children:S("common.add")})]})}const eo=({onSelect:n})=>{const a=zt(),{pagination:r,globalFilter:o,isFiltered:l}=Dn(),[c,d]=L.useState([]),h=L.useCallback((P,T)=>{d(I=>{const F=[...I];return F[P]=T,F})},[]),p=()=>{d([])},{data:v,isPending:x,isError:y,error:C}=Fd({pagination:{pageIndex:r.pageIndex,pageSize:r.pageSize},searchTerm:o});L.useEffect(()=>{p()},[r,o,l]);const b=L.useMemo(()=>({catalogPicker:{quantities:c,setQuantity:h,selectArticle:(P,T)=>n(P,c[T]===""?1:c[T]??1)}}),[h,n,c]),E=L.useMemo(()=>[Er.accessor("description",{id:"description",header:()=>i.jsx(i.Fragment,{children:S("catalog.list.columns.description")})}),Er.accessor("points",{id:"points",header:()=>i.jsx("div",{className:"text-right",children:S("catalog.list.columns.points")}),cell:({renderValue:P})=>i.jsx("div",{className:"text-right",children:P()})}),Er.accessor("retail_price",{id:"retail_price",header:()=>i.jsx("div",{className:"text-right",children:S("catalog.list.columns.retail_price")}),cell:({row:P})=>{const T=Tt.create(P.original.retail_price).object;return i.jsx("div",{className:"text-right",children:T.toFormat()})}}),Er.display({id:"quantity",header:()=>i.jsx("div",{className:"font-medium text-right text-foreground",children:S("catalog.list.columns.quantity")}),cell:Pw}),Er.display({id:"row-actions",header:()=>null,cell:kw})],[]),{table:R}=as({data:[...(v==null?void 0:v.items)||[]],columns:E,pageCount:(v==null?void 0:v.total_pages)??-1,meta:b});return y?i.jsx(ir,{subtitle:C.message}):x?i.jsx(is,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0}):(v==null?void 0:v.total_items)===0&&!l?i.jsx(ss,{subtitle:"Empieza cargando los artículos del catálogo",buttonText:"",onButtonClick:()=>a("/catalog/add")}):i.jsx(rs,{className:"bg-transparent border-0 shadow-none",table:R,paginationOptions:{visible:!0,enablePageSizeSelector:!1},footerClassName:"px-10 pt-2 border-t",children:i.jsx(Id,{table:R})})},Mo=L.forwardRef(({label:n=S("common.append_block"),className:a,...r},o)=>i.jsxs(H,{type:"button",variant:"outline",ref:o,...r,children:[" ",i.jsx(Co,{className:n?"w-4 h-4 mr-2":"w-4 h-4"}),n&&i.jsx(i.Fragment,{children:n})]}));Mo.displayName="AppendBlockRowButton";const To=L.forwardRef(({label:n=S("common.append_article"),className:a,...r},o)=>i.jsxs(H,{type:"button",variant:"outline",ref:o,...r,children:[" ",i.jsx(Co,{className:n?"w-4 h-4 mr-2":"w-4 h-4"}),n&&i.jsx(i.Fragment,{children:n})]}));To.displayName="AppendCatalogArticleRowButton";const Do=L.forwardRef(({label:n=S("common.append_empty_row"),className:a,...r},o)=>i.jsxs(H,{type:"button",variant:"outline",ref:o,...r,children:[i.jsx(z0,{className:n?"w-4 h-4 mr-2":"w-4 h-4"}),n&&i.jsx(i.Fragment,{children:n})]}));Do.displayName="AppendEmptyRowButton";const qw=({table:n})=>{const a=n.getSelectedRowModel().rows.length;return a?i.jsx("nav",{className:"flex items-center h-12 p-1 rounded-md text-muted-foreground bg-muted ",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(Ge,{children:[i.jsx(He,{asChild:!0,children:i.jsxs(H,{type:"button",variant:"link",disabled:!n.getSelectedRowModel().rows.length,onClick:()=>{var r;return(r=n.options.meta)==null?void 0:r.duplicateItems()},children:[i.jsx(V0,{className:"w-4 h-4 sm:mr-2"}),i.jsx("span",{className:"sr-only sm:not-sr-only",children:S("common.duplicate_selected_rows")})]})}),i.jsx(Ke,{children:S("common.duplicate_selected_rows_tooltip")})]}),i.jsxs(Ge,{children:[i.jsx(He,{asChild:!0,children:i.jsxs(H,{type:"button",variant:"link",disabled:!n.getSelectedRowModel().rows.length,onClick:()=>{var r;return(r=n.options.meta)==null?void 0:r.deleteItems()},children:[i.jsx(ad,{className:"w-4 h-4 sm:mr-2"}),i.jsx("span",{className:"sr-only sm:not-sr-only",children:S("common.remove_selected_rows")})]})}),i.jsx(Ke,{children:S("common.remove_selected_rows_tooltip")})]}),i.jsxs(Ge,{children:[i.jsx(He,{asChild:!0,children:i.jsxs(H,{type:"button",variant:"link",disabled:!n.getSelectedRowModel().rows.length,onClick:()=>n.resetRowSelection(),children:[i.jsx(W0,{className:"w-4 h-4 sm:mr-2"}),i.jsx("span",{className:"sr-only sm:not-sr-only",children:S("common.reset_selected_rows")})]})}),i.jsx(Ke,{children:S("common.reset_selected_rows_tooltip")})]}),i.jsx(mn,{orientation:"vertical",className:"h-6 ml-1 mr-4"}),i.jsx("p",{className:"text-sm font-normal",children:S("common.rows_selected",{count:a})})]})}):i.jsxs("nav",{className:"flex items-center h-12 p-1 rounded-md bg-accent/75 text-muted-foreground",children:[i.jsxs("div",{className:"flex space-x-2",children:[i.jsxs(Ge,{children:[i.jsx(He,{asChild:!0,children:i.jsx(Do,{variant:"link",onClick:()=>{var r;return(r=n.options.meta)==null?void 0:r.appendItem()}})}),i.jsx(Ke,{children:S("common.append_empty_row_tooltip")})]}),i.jsxs(Ge,{children:[i.jsx(He,{asChild:!0,children:i.jsx(To,{variant:"link",onClick:()=>{var r;n.options.meta&&n.options.meta.pickCatalogArticle&&((r=n.options.meta)==null||r.pickCatalogArticle())}})}),i.jsx(Ke,{children:S("common.append_article_tooltip")})]}),i.jsxs(Ge,{children:[i.jsx(He,{asChild:!0,children:i.jsx(Mo,{variant:"link",onClick:()=>{var r;n.options.meta&&n.options.meta.pickBlock&&((r=n.options.meta)==null||r.pickBlock())}})}),i.jsx(Ke,{children:S("common.append_block_tooltip")})]})]}),i.jsx("div",{className:"flex items-center gap-2 ml-auto"})]})},$w={droppable:{strategy:c0.Always}},zw={keyframes({transform:n}){return[{opacity:1,transform:Ua.Transform.toString(n.initial)},{opacity:0,transform:Ua.Transform.toString({...n.final,x:n.final.x+5,y:n.final.y+5})}]},easing:"ease-out",sideEffects({active:n}){n.node.animate([{opacity:0},{opacity:1}],{duration:xc.duration,easing:xc.easing})}};function Rc({columns:n,data:a,defaultValues:r,initialState:o,actions:l}){const[c,d]=L.useState({}),[h,p]=L.useState(),[v,x]=L.useState((o==null?void 0:o.columnVisibility)||{}),y=L.useMemo(()=>a.map(I=>I.id),[a]),C=Sd({data:a,columns:n,enableColumnResizing:!1,columnResizeMode:"onChange",autoResetAll:!1,initialState:o,state:{rowSelection:c,columnVisibility:v},enableRowSelection:!0,enableMultiRowSelection:!0,enableSorting:!1,enableHiding:!0,onRowSelectionChange:d,getCoreRowModel:bd(),getRowId:I=>I==null?void 0:I.id,debugTable:!1,debugHeaders:!1,debugColumns:!1,defaultColumn:{minSize:0,size:Number.MAX_SAFE_INTEGER,maxSize:Number.MAX_SAFE_INTEGER},meta:{insertItem:(I,F)=>{l.insert(I,F||(r==null?void 0:r.items[0]),{shouldFocus:!0})},appendItem:I=>{l.append(I||(r==null?void 0:r.items[0]),{shouldFocus:!0})},pickCatalogArticle:()=>{l.pickCatalogArticle&&(l==null||l.pickCatalogArticle())},pickBlock:()=>{l.pickBlock&&(l==null||l.pickBlock())},duplicateItems:I=>{if(I!=null){const F=C.getRowModel().rows[I].original;l.insert(I+1,F,{shouldFocus:!0})}else if(C.getSelectedRowModel().rows.length){const F=C.getSelectedRowModel().rows[C.getSelectedRowModel().rows.length-1].index,$=C.getSelectedRowModel().rows.map(B=>({...B.original,id:void 0}));C.getRowModel().rows.length<F+1?l.append($):l.insert(F+1,$,{shouldFocus:!0}),C.resetRowSelection()}},deleteItems:I=>{if(I!=null)l.remove(I);else if(C.getSelectedRowModel().rows.length>0){let F=C.getSelectedRowModel().rows.length-1;for(;F>=0;F--){const $=y.indexOf(String(C.getSelectedRowModel().rows[F].id));l.remove($),y.splice($,1)}C.resetRowSelection()}else l.remove()},updateItem:(I,F,$,B)=>{l.update(I,{...F,[`${$}`]:B})}}}),b=o0(Oi(v0,{}),Oi(x0,{}),Oi(p0,{}),Oi(h0,{}));function E(I){var B;let F=I.active.id,$=(B=I.over)==null?void 0:B.id;if($!==void 0&&F!==$){let q=y.indexOf(String($));if(C.getSelectedRowModel().rows.length>1)C.getSelectedRowModel().rows.forEach((re,te)=>{const fe=y.indexOf(String(re.id));te>0&&(F=re.id,q=y.indexOf(String($)),q<fe&&(q=q+1)),l.move(fe,q),y.splice(q,0,y.splice(fe,1)[0]),$=re.id});else{const re=y.indexOf(String(F));l.move(re,q)}}p(null)}function R({active:I}){C.getSelectedRowModel().rowsById[I.id]||C.resetRowSelection(),p(I.id)}function P(){p(null)}function T(I){return h?I.filter(F=>{const $=typeof F=="string"?F:F.id;return $===h||!C.getSelectedRowModel().rowsById[$]}):I}return i.jsx(l0,{measuring:$w,sensors:b,onDragEnd:E,onDragStart:R,onDragCancel:P,collisionDetection:u0,children:i.jsxs(qe,{children:[i.jsx(yt,{className:"sticky z-10 top-16 bg-card/90",children:i.jsx(Xe,{children:i.jsx(qw,{table:C})})}),i.jsxs($e,{children:[i.jsxs(lo,{className:"table-fixed",children:[i.jsx(uo,{className:"sticky top-0 z-10 bg-background",children:C.getHeaderGroups().map(I=>i.jsx(In,{className:"hover:bg-transparent",children:I.headers.map(F=>i.jsx(co,{className:"px-2 py-1",style:{width:F.getSize()===Number.MAX_SAFE_INTEGER?"auto":F.getSize()},children:F.isPlaceholder?null:i.jsx(jd,{table:C,header:F})},F.id))},I.id))}),i.jsx(fo,{children:i.jsx(f0,{items:T(y),strategy:g0,children:T(C.getRowModel().rows).map(I=>i.jsx(Rw,{id:I.id,children:I.getVisibleCells().map(F=>i.jsx(Vi,{className:"px-2 py-2 align-top",style:{width:F.column.getSize()===Number.MAX_SAFE_INTEGER?"auto":F.column.getSize()},children:Gi(F.column.columnDef.cell,F.getContext())},F.id))},I.id))})})]}),d0.createPortal(i.jsx(m0,{dropAnimation:zw,className:"z-40 opacity-100",children:h&&i.jsx("div",{className:"relative flex flex-wrap",children:C.getSelectedRowModel().rows.length?i.jsx(no,{variant:"destructive",className:"absolute z-50 flex items-center justify-center w-2 h-2 p-3 rounded-full top left -left-2 -top-2",children:C.getSelectedRowModel().rows.length}):null})}),document.body),!1]}),i.jsx(kt,{children:i.jsxs(tr,{children:[i.jsx(Do,{onClick:()=>{var I;return(I=C.options.meta)==null?void 0:I.appendItem()}}),i.jsx(To,{onClick:()=>{var I;C.options.meta&&C.options.meta.pickCatalogArticle&&((I=C.options.meta)==null||I.pickCatalogArticle())}}),i.jsx(Mo,{onClick:()=>{var I;C.options.meta&&C.options.meta.pickBlock&&((I=C.options.meta)==null||I.pickBlock())}})]})})]})})}const Bw={en:[{id:2000000098,code:"CAP_CLA_SEMI_SUSPENDIDO_EN",title:"Finish: MELAMINE / colour: TO BE DETERMINED",body:`Thickness block: 19 mm / Thickness complements: 19 mm.\r
Hanging rods: CHROME/ BLACK\r
Glass drawer fronts: STRAIGHT / "U" - FLOAT BRONZE C-424 \r
Drawer handle: xxxxx / Drawers: 4 DE 180 MM.\r
Shoe rack door: YES/NO / Profile finish: BLACK LACQUER / SILVER MATTE\r
Shoe cabinet door glass finish: FLOAT BRONZE C-424\r
Composed of:`},{id:2000000084,code:"CAP_FRE_ARM_ABATIBLE_EN",title:"CHARACTERISTICS OF THE FRONT OF THE HINGED WARDROBE",body:`Size of opening: 2275x1390 mm.\r
Model: ARGO / Finish: LACQUER / Colour: TO BE DETERMINED\r
Door thickness: 22 or 19 mm\r
Door finish: SMOOTH \r
Handle: KNOB TO BE DETERMINED\r
Hardware finish: CHROME OR ANTHRACITE\r
Perimetral doorposts: VISIBLE, REMETED OR COMBI TO BE DETERMINED.\r
Number of doors: 2 \r
Composed of:`},{id:2000000089,code:"CAP_FRE_ARM_CORREDERA_EN",title:"Size of opening: 2440x5180mm. ",body:`Model: PANORAMIC P.O. / Finish: LACQUER / Colour: WHITE\r
No. of listers: NO LISTELS / Panels finish: LACQUERED PANEL \r
Handle: \r
Perimeter frame: \r
Nº of doors: \r
INCORPORATED HYDRAULIC BRAKE (not available in lower doors of 650 mm.) OR INCORPORATED MAGNETIC BRAKE. \r
Composed of:`},{id:2000000092,code:"CAP_INT_ARM_FORRADO_EN",title:"Finish: MELAMINE / colour: TO BE DETERMINED",body:`Thickness block: 19 mm / Thickness complements: 19 mm.\r
Hanging rods: CHROME/ BLACK\r
Glass drawer fronts: STRAIGHT / "U" - FLOAT BRONZE C-424 \r
Drawer handle: xxxxx / Drawers: 4 DE 180 MM.\r
Composed of:`},{id:2000000109,code:"CAP_INT_EST_CRISTAL_EN",title:"Frames finish: BLACK ANODIZED",body:`Side frame panel finish: BRONZE FLOAT BRONZE GLASS C-424\r
Rear panel finish: BRONZE FLOAT GLASS C-424\r
Complements finish: MELAMIN / Colour: DENBER OAK M-242\r
Thickness of accessories: 25 mm.\r
Hanging bars: BLACK\r
Glass drawer fronts: STRAIGHT / "U" - FLOAT BRONZE C-424 \r
Drawer handle: xxxxx / Drawers: 4 DE 180 MM.\r
Composed of:`},{id:2000000095,code:"CAP_SEP_AMBIENTES_EN",title:"CHARACTERISTICS SEPARATION OF ROOMS",body:`Size of opening: 2450x3000 mm.\r
Model: LYN / Finish: ANODISED / Colour: BLACK\r
No. of crosspieces: 2 HORIZONTAL CROSSBARS\r
Panel finish: TRANSPARENT TEMPLARED \r
Handle: DOUBLE PER DOOR\r
Brake: DOUBLE PER DOOR (OPENING AND CLOSING)\r
Guide: VISTA (DOUBLE EMBELLECEDOR)\r
Number of panels: 2 SLIDING + 2 FIXED`}],es:[{id:54,code:"CAP_CLA_SEMI_SUSPENDIDO_ES",title:"Acabado vestidor: MELAMINA / color: A DETERMINAR",body:`Espesor bloque: 25 mm. / Espesor complementos: 25 mm.\r
Barras de colgar: CROMO/ NEGRA/ BRONCE\r
Frentes cristal cajones: RECTO / “U” – FLOAT BRONCE C-424\r
Tirador cajones: FRENTE BAJO / Cajones: 4 DE 180 MM. A DETERMINAR\r
Baldas deslizantes: X DE 145 MM. A DETERMINAR\r
Compuesto por:`},{id:52,code:"CAP_FRE_ARM_ABATIBLE_ES",title:"CARACTERISTICAS FRENTE DE ARMARIO",body:`Medida de hueco: 2275x1390 mm.\r
Modelo: ARGO / Acabado: LACADO / Color: A DETERMINAR\r
Grosor hoja: 22 o 19 mm\r
Acabado de hojas: LISAS\r
Tirador: UÑERO A DETERMINAR\r
Acabado herrajes: CROMADO O ANTRACITA\r
Jambas perimetrales: VISTAS, REMETIDAS O COMBI A DETERMINAR.\r
Nº de hojas: 2\r
Compuesto por:`},{id:51,code:"CAP_FRE_ARM_CORREDERA_ES",title:"CARACTERISTICAS FRENTE DE ARMARIO CORREDERA",body:`Medida de Hueco:2440x5180mm.\r
Modelo: PANORAMIC P.O. / Acabado: LACADO / Color: BLANCO\r
Nº de lístelos: SIN LISTELOS / Acabado paneles: PANEL LACADO\r
Tirador:\r
Cerco perimetral: \r
Nº de hojas:\r
FRENO HIDRAULICO INCORPORADO O FRENO MAGNETICO INCORPORADO\r
Compuesto por:`},{id:53,code:"CAP_INT_ARM_FORRADO_ES",title:"CARACTERISTICAS INTERIOR DE ARMARIO",body:`Acabado: MELAMINA / color: A DETERMINAR\r
Espesor bloque: 19 mm. / Espesor complementos: 19 mm.\r
Barras de colgar: CROMO/ NEGRA/ BRONCE\r
Frentes cristal cajones: RECTO / “U” – FLOAT BRONCE C-424\r
Tirador cajones: FRENTE BAJO / Cajones: 4 DE 180 MM. A DETERMINAR\r
Baldas deslizantes: X DE 145 MM. A DETERMINAR\r
Compuesto por:`},{id:2000000108,code:"CAP_INT_EST_CRISTAL_ES",title:"Acabado bastidores: ANODIZADO NEGRO",body:`Acabado panel bastidores laterales: CRISTAL TEMPLADO FLOAT BRONCE C-424\r
Acabado trasera: CRISTAL TEMPLADO FLOAT BRONCE C-424\r
Acabado complementos: MELAMINA / Color: ROBLE DENBER M-242\r
Espesor complementos: 25 mm.\r
Barras de colgar: NEGRA\r
Frentes cristal cajones: RECTO / “U” – FLOAT BRONCE C-424 \r
Tirador cajones: xxxxx / Cajones: 4 DE 180 MM.\r
Compuesto por:`},{id:50,code:"CAP_SEP_AMBIENTES_ES",title:"CARACTERISTICAS SEPARACIÓN DE AMBIENTES",body:`Medida de Hueco: 2450x3000 mm.\r
Modelo: LYN / Acabado: ANODIZADO / Color: NEGRO\r
Nº de travesaños: 2 TRAVESAÑOS HORIZONTALES\r
Acabado paneles: TRANSPARENTE TEMPLADO \r
Tirador: DOBLE POR PUERTA\r
Freno: DOBLE POR PUERTA (APERTURA Y CIERRE)\r
Guía: VISTA (DOBLE EMBELLECEDOR)\r
Nº de hojas: 2 CORREDERAS + 2 FIJOS`}]},Ec=({onSelect:n})=>{const{i18n:a}=Fo(),[r]=L.useState(a.resolvedLanguage||"es"),[o]=L.useState(Bw[r.toLowerCase()]);return console.log(r),i.jsx(to,{className:"h-96",children:i.jsx("div",{className:"flex flex-col gap-2 p-4 pt-0",children:o&&o.sort((l,c)=>l.title.localeCompare(c.title)).map((l,c)=>i.jsx("button",{className:"flex flex-col items-start gap-2 p-3 text-sm text-left transition-all border rounded-lg hover:bg-accent",onClick:()=>n&&n(l,1),children:i.jsxs("div",{className:"flex flex-col w-full gap-1",children:[i.jsx("div",{className:"flex items-center",children:i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("div",{className:"font-semibold",children:l.title})})}),i.jsx("div",{className:"text-xs line-clamp-2 text-muted-foreground",children:i.jsx("p",{dangerouslySetInnerHTML:{__html:l.body.substring(0,300).replace(`\r
`,"<br>")}})})]})},l.id))})})},Vw=({isOpen:n,onOpenChange:a,onSelect:r})=>Rd("(min-width: 768px)")?i.jsx(Dr,{modal:!0,open:n,onOpenChange:a,children:i.jsxs(Lr,{className:"w-full max-w-full md:w-9/12 lg:w-10/12",children:[i.jsxs(Or,{children:[i.jsx(Pr,{children:S("quotes.blocks_picker_dialog.title")}),i.jsx(wo,{children:S("quotes.blocks_picker_dialog.description")})]}),i.jsx(Ec,{onSelect:r}),i.jsx(kr,{children:i.jsx(H,{type:"submit",onClick:()=>a(!1),children:S("common.close")})})]})}):i.jsx(Gc,{open:n,onOpenChange:a,children:i.jsxs(Hc,{children:[i.jsxs(Kc,{className:"text-left",children:[i.jsx(Wc,{children:S("quotes.blocks_picker_dialog.title")}),i.jsx(Yc,{children:S("quotes.blocks_picker_dialog.description")})]}),i.jsx(Ec,{onSelect:r}),i.jsx(Qc,{className:"pt-2",children:i.jsx(Xc,{asChild:!0,children:i.jsx(H,{variant:"outline",children:S("common.close")})})})]})}),Uw=({isOpen:n,onOpenChange:a,onSelect:r})=>Rd("(min-width: 768px)")?i.jsx(Dr,{modal:!0,open:n,onOpenChange:a,children:i.jsxs(Lr,{className:"w-full max-w-full md:w-9/12 lg:w-10/12",children:[i.jsxs(Or,{children:[i.jsx(Pr,{children:S("quotes.catalog_picker_dialog.title")}),i.jsx(wo,{children:S("quotes.catalog_picker_dialog.description")})]}),i.jsx(nr,{syncWithLocation:!1,initialPageSize:5,children:i.jsx(eo,{onSelect:r})}),i.jsx(kr,{children:i.jsx(H,{type:"submit",onClick:()=>a(!1),children:S("common.close")})})]})}):i.jsx(Gc,{open:n,onOpenChange:a,children:i.jsxs(Hc,{children:[i.jsxs(Kc,{className:"text-left",children:[i.jsx(Wc,{children:S("quotes.catalog_picker_dialog.title")}),i.jsx(Yc,{children:S("quotes.catalog_picker_dialog.description")})]}),i.jsx(nr,{syncWithLocation:!1,initialPageSize:5,children:i.jsx(eo,{onSelect:r})}),i.jsx(Qc,{className:"pt-2",children:i.jsx(Xc,{asChild:!0,children:i.jsx(H,{variant:"outline",children:S("common.close")})})})]})}),Gw=({currency:n,language:a,defaultValues:r})=>{const{toast:o}=xn(),{control:l}=rr(),[c]=L.useState("dialog"),[d,h]=L.useState(!1),[p,v]=L.useState(!1),{fields:x,...y}=_0({control:l,name:"items"}),C=Aw([{id:"description",accessorKey:"description",header:S("quotes.form_fields.items.description.label"),cell:({row:{index:F,original:$}})=>i.jsx(qt,{readOnly:$==null?void 0:$.id_article,autoSize:!0,name:`items.${F}.description`}),minSize:200,size:400},{id:"quantity",accessorKey:"quantity",header:()=>i.jsx("div",{className:"text-right",children:S("quotes.form_fields.items.quantity.label")}),cell:({row:{index:F}})=>i.jsx(dw,{scale:0,className:"text-right",name:`items.${F}.quantity`}),size:75},{id:"unit_price",accessorKey:"unit_price",header:()=>i.jsx("div",{className:"text-right",children:S("quotes.form_fields.items.unit_price.label")}),cell:({row:{index:F}})=>i.jsx(Fa,{currency:n,language:a,scale:2,className:"text-right",name:`items.${F}.unit_price`}),size:125},{id:"subtotal_price",accessorKey:"subtotal_price",header:()=>i.jsx("div",{className:"text-right",children:S("quotes.form_fields.items.subtotal_price.label")}),cell:({row:{index:F}})=>i.jsx(Fa,{variant:"ghost",currency:n,language:a,scale:2,readOnly:!0,className:"text-right",name:`items.${F}.subtotal_price`}),size:150},{id:"discount",accessorKey:"discount",header:()=>i.jsx("div",{className:"text-right",children:S("quotes.form_fields.items.discount.label")}),cell:({row:{index:F}})=>i.jsx(Hi,{scale:2,className:"text-right",name:`items.${F}.discount`}),size:100},{id:"total_price",accessorKey:"total_price",header:()=>i.jsx("div",{className:"text-right",children:S("quotes.form_fields.items.total_price.label")}),cell:({row:{index:F}})=>i.jsx(Fa,{variant:"ghost",currency:n,language:a,scale:2,readOnly:!0,className:"font-semibold text-right",name:`items.${F}.total_price`}),size:150}],{enableDragHandleColumn:!0,enableSelectionColumn:!0,enableActionsColumn:!0,rowActionFn:F=>{const{table:$,row:B}=F;return[{label:S("common.duplicate_row"),icon:i.jsx(So,{className:"w-4 h-4 mr-2"}),onClick:()=>{var q;return(q=$.options.meta)==null?void 0:q.duplicateItems(B.index)}},{label:S("common.insert_row_above"),icon:i.jsx(b0,{className:"w-4 h-4 mr-2"}),onClick:()=>{var q;return(q=$.options.meta)==null?void 0:q.insertItem(B.index)}},{label:S("common.insert_row_below"),icon:i.jsx(Oc,{className:"w-4 h-4 mr-2"}),onClick:()=>{var q;return(q=$.options.meta)==null?void 0:q.insertItem(B.index+1)}},{label:"-"},{label:S("common.remove_row"),icon:i.jsx(ad,{className:"w-4 h-4 mr-2"}),onClick:()=>{var q;(q=$.options.meta)==null||q.deleteItems(B.index)}}]}}),b=L.useCallback((F,$=1)=>{y.append({...F,quantity:{amount:100*$,scale:hn.DEFAULT_SCALE},unit_price:F.retail_price,discount:{amount:null,scale:2}}),o({title:S("quotes.catalog_picker_dialog.toast_article_added"),description:F.description})},[y]),E=L.useCallback(F=>{y.append({description:`${F.title}
${F.body}`,quantity:{amount:null,scale:hn.DEFAULT_SCALE},unit_price:{amount:null,scale:sb.DEFAULT_SCALE},discount:{amount:null,scale:2}}),o({title:S("quotes.blocks_picker_dialog.toast_article_added"),description:F.title})},[y]),[R,P]=L.useState(!1),T=[265,440,655],I=4;return c==="dialog"?i.jsxs("div",{className:"relative",children:[i.jsx(Rc,{actions:{...y,pickCatalogArticle:()=>h(!0),pickBlock:()=>v(!0)},columns:C,data:x,defaultValues:r}),i.jsx(Uw,{onSelect:b,isOpen:d,onOpenChange:h}),i.jsx(Vw,{onSelect:E,isOpen:p,onOpenChange:v})]}):i.jsxs(X0,{direction:"horizontal",autoSaveId:"uecko.quotes.details_layout",className:"items-stretch h-full",children:[i.jsx(bc,{defaultSize:T[0],collapsedSize:I,collapsible:!0,minSize:50,maxSize:90,onCollapse:()=>{P(!0)},onExpand:()=>{P(!1)},className:me(R&&"min-w-[50px] transition-all duration-300 ease-in-out"),children:i.jsx(Rc,{actions:y,columns:C,data:x,defaultValues:r})}),i.jsx(Z0,{withHandle:!0,className:"mx-3"}),i.jsx(bc,{defaultSize:T[1],minSize:10,children:i.jsx(nr,{syncWithLocation:!1,children:i.jsx(eo,{onSelect:b})})})]})},Hw=()=>{const{formState:n}=rr();return i.jsxs("div",{className:"grid gap-6 md:grid-cols-6",children:[i.jsxs(Ga,{className:"md:col-span-6",title:S("quotes.create.form_groups.general.title"),description:S("quotes.create.form_groups.general.desc"),children:[i.jsxs("div",{className:"grid grid-cols-6 gap-6",children:[i.jsx(Fn,{required:!0,className:"col-span-2",label:S("quotes.form_fields.customer_reference.label"),description:S("quotes.form_fields.customer_reference.desc"),disabled:n.disabled,placeholder:S("quotes.form_fields.customer_reference.placeholder"),name:"customer_reference"}),i.jsx(Vc,{required:!0,label:S("quotes.form_fields.date.label"),description:S("quotes.form_fields.date.desc"),disabled:n.disabled,placeholder:S("quotes.form_fields.date.placeholder"),name:"date"}),i.jsx(Fn,{label:S("quotes.form_fields.validity.label"),description:S("quotes.form_fields.validity.desc"),disabled:n.disabled,placeholder:S("quotes.form_fields.validity.placeholder"),name:"validity"}),i.jsx(qt,{className:"col-span-2",label:S("quotes.form_fields.payment_method.label"),description:S("quotes.form_fields.payment_method.desc"),disabled:n.disabled,placeholder:S("quotes.form_fields.payment_method.placeholder"),name:"payment_method"})]}),i.jsxs("div",{className:"grid grid-cols-6 gap-6",children:[i.jsx(qt,{className:"col-span-3",required:!0,label:S("quotes.form_fields.customer_information.label"),description:S("quotes.form_fields.customer_information.desc"),disabled:n.disabled,placeholder:S("quotes.form_fields.customer_information.placeholder"),name:"customer_information",errors:n.errors}),i.jsx(qt,{className:"col-span-3",label:S("quotes.form_fields.notes.label"),description:S("quotes.form_fields.notes.desc"),disabled:n.disabled,placeholder:S("quotes.form_fields.notes.placeholder"),name:"notes"})]})]}),i.jsx(Ga,{className:"hidden md:col-span-2",title:S("quotes.create.form_groups.status.title"),description:S("quotes.create.form_groups.status.desc"),children:i.jsxs("div",{className:"grid gap-6",children:[i.jsxs("div",{className:"grid gap-3",children:[i.jsx(Br,{htmlFor:"status",children:"Status"}),i.jsxs(io,{children:[i.jsx(so,{id:"status","aria-label":"Select status",children:i.jsx(ao,{placeholder:"Select status"})}),i.jsxs(oo,{children:[i.jsx(Fr,{value:"draft",children:"Draft"}),i.jsx(Fr,{value:"published",children:"Active"}),i.jsx(Fr,{value:"archived",children:"Archived"})]})]})]}),i.jsx(Fn,{required:!0,label:S("quotes.form_fields.lang_code.label"),description:S("quotes.form_fields.lang_code.desc"),placeholder:S("quotes.form_fields.lang_code.placeholder"),name:"lang_code"}),i.jsx(Fn,{required:!0,label:S("quotes.form_fields.currency_code.label"),description:S("quotes.form_fields.currency_code.desc"),placeholder:S("quotes.form_fields.currency_code.placeholder"),name:"currency_code"})]})})]})},Pd=({id:n,onSentTo:a,disabled:r})=>{const o=()=>{a(n)};return i.jsxs(w0,{children:[i.jsx(S0,{asChild:!0,disabled:r,children:i.jsxs(H,{variant:"ghost",className:"h-10 gap-1 text-primary disabled:text-secondary-foreground",children:[i.jsx(Y0,{className:"w-4 h-4"}),S("quotes.quote_sent_to_editor.trigger_button")]})}),i.jsxs(C0,{children:[i.jsxs(j0,{children:[i.jsx(y0,{children:S("quotes.quote_sent_to_editor.title")}),i.jsx(N0,{children:S("quotes.quote_sent_to_editor.description")})]}),i.jsxs(R0,{children:[i.jsx(E0,{children:S("common.cancel")}),i.jsx(A0,{asChild:!0,children:i.jsx(H,{onClick:o,children:S("common.continue")})})]})]})]})},Kw=["draft","ready","delivered","accepted","rejected","archived"],Ww={draft:["draft","ready","archived"],ready:["ready","delivered","archived"],delivered:["delivered","accepted","rejected","archived"],accepted:["accepted","rejected","archived"],rejected:["rejected","accepted","archived"],archived:["archived","draft","ready","delivered","accepted","rejected"]},kd=({type:n="button",status:a,onChangeStatus:r})=>{const[o,l]=L.useState(a),c=h=>l(h);L.useEffect(()=>{a&&l(a)},[a]);const d=()=>{o!==a&&r(o,a)};return i.jsxs(Dr,{children:[i.jsx(Mc,{asChild:!0,children:n==="button"?i.jsxs(H,{size:"sm",variant:"outline",className:"h-8 gap-1",children:[i.jsx(F0,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"sr-only md:not-sr-only md:whitespace-nowrap",children:S("quotes.quote_status_editor.trigger_button")})]}):i.jsx(I0,{status:a,isEditable:!0})}),i.jsxs(Lr,{children:[i.jsx(Or,{children:i.jsx(Pr,{children:S("quotes.quote_status_editor.title")})}),i.jsx(M0,{}),i.jsx("div",{className:"grid gap-4 py-4",children:Kw.map(h=>{const p=!Ww[a].includes(h);return i.jsxs("div",{className:"flex items-start space-x-4",children:[i.jsx(T0,{id:h,checked:o===h,onCheckedChange:()=>c(h),disabled:p}),i.jsxs("div",{className:"grid gap-1.5 leading-none",children:[i.jsx(Br,{htmlFor:h,className:me("font-medium",p?"text-input":"text-foreground"),children:S(`quotes.quote_status_editor.status.${h}.title`)}),i.jsx("p",{className:me("text-sm",p?"text-input":"text-muted-foreground"),children:S(`quotes.quote_status_editor.status.${h}.description`)})]})]},h)})}),i.jsxs(kr,{className:"pt-6 border-t",children:[i.jsx(Bi,{asChild:!0,children:i.jsx(H,{type:"button",variant:"secondary",children:S("common.cancel")})}),i.jsx(Bi,{asChild:!0,children:i.jsx(H,{onClick:d,disabled:o===a,children:S("quotes.quote_status_editor.submit_button")})})]})]})]})},Yw=({quoteId:n,className:a})=>{const r=zt(),{toast:o}=xn(),{useOne:l,useSetStatus:c,useSentTo:d,useDownloader:h,useDuplicate:p,getQuotePDFFilename:v}=Vr(),{data:x,status:y}=l(n),{mutate:C}=c(),{mutate:b}=d(n),{mutate:E}=p(),{download:R,...P}=h(),{formatCurrency:T,formatNumber:I}=Nd({locale:(x==null?void 0:x.lang_code)||"ES"}),F=L.useMemo(()=>x?{subtotal_price:T(x.subtotal_price),discount:I(x.discount),discount_price:T(x.discount_price),tax:I(x.tax),tax_price:T(x.tax_price),total_price:T(x.total_price)}:{subtotal_price:"0,00 €",discount:"0",discount_price:"0,00 €",tax:"0",tax_price:"0,00 €",total_price:"0,00 €"},[x]),$=L.useMemo(()=>(x==null?void 0:x.status)==="accepted"&&!(x!=null&&x.date_sent),[x]),B=L.useMemo(()=>(x==null?void 0:x.status)==="accepted"&&!!(x!=null&&x.date_sent),[x]),q=J=>{C({id:x.id,newStatus:J},{onSuccess:()=>{o({description:S("quotes.quote_status_editor.toast_status_changed"),variant:"success"})}})},re=J=>{b({sent_date:D0(new Date)},{onSuccess:()=>{o({description:S("quotes.quote_sent_to_editor.toast_status_changed"),variant:"success"})}})},te=L.useCallback(()=>{o({description:S("quotes.downloading_dialog.toast_success"),variant:"success"})},[o]),fe=L.useCallback(()=>{x&&R(x.id,v(x))},[x]);if(y==="error"||y!=="success")return null;if(!x)return i.jsx(qe,{className:me("overflow-hidden",a),children:i.jsx($e,{className:"px-4 py-6 text-center",children:i.jsx("p",{className:"mx-auto",children:"Select a quote"})})});const Se=J=>{E({id:J},{onSuccess(Re){o({description:S("quotes.duplicate_action.toast_success"),variant:"success"}),r(`/quotes/edit/${Re.id}`,{relative:"path"})}})},ue=J=>{C({id:J,newStatus:"archived"},{onSuccess:()=>{o({description:S("quotes.quote_status_editor.toast_status_changed",{newStatus:S("quotes.status.archived")}),variant:"success"})}})};return i.jsxs(i.Fragment,{children:[i.jsx(Ld,{...P,onFinishDownload:te}),i.jsx(Zc,{defaultValue:"resume",children:i.jsxs(qe,{className:"w-[390px] overflow-hidden",children:[i.jsxs(yt,{className:"gap-3 border-b bg-accent",children:[i.jsxs(Xe,{className:"flex items-center justify-between text-lg",children:[i.jsx("span",{children:S("quotes.list.resume.title")}),i.jsx(kd,{status:x.status,onChangeStatus:q,type:"badge"})]}),i.jsx("div",{className:"flex w-full mr-auto text-foreground",children:i.jsxs("div",{className:"flex justify-between w-full",children:[i.jsxs(tr,{className:"gap-0",children:[i.jsxs(Ge,{children:[i.jsx(He,{asChild:!0,children:i.jsxs(H,{variant:"outline",size:"icon",disabled:B,onClick:J=>{J.preventDefault(),r(`/quotes/edit/${x.id}`,{relative:"path"})},children:[i.jsx(sd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Editar"})]})}),i.jsx(Ke,{children:i.jsx("p",{children:"Editar"})})]}),i.jsxs(Ge,{children:[i.jsx(He,{asChild:!0,children:i.jsxs(H,{variant:"outline",size:"icon",onClick:J=>{J.preventDefault(),Se(x.id)},children:[i.jsx(So,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Duplicar"})]})}),i.jsx(Ke,{children:i.jsx("p",{children:"Duplicar"})})]}),i.jsxs(Ge,{children:[i.jsx(He,{asChild:!0,children:i.jsxs(H,{variant:"outline",size:"icon",onClick:fe,children:[i.jsx(nd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Descargar"})]})}),i.jsx(Ke,{children:i.jsx("p",{children:"Descargar"})})]}),i.jsxs(Ge,{children:[i.jsx(He,{asChild:!0,children:i.jsxs(H,{variant:"outline",size:"icon",disabled:B,onClick:J=>{J.preventDefault(),ue(x.id)},children:[i.jsx(ed,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Archivar"})]})}),i.jsx(Ke,{children:i.jsx("p",{children:"Archivar"})})]})]}),i.jsx(tr,{children:i.jsx(Pd,{disabled:B||!$,id:x.id,onSentTo:re})})]})})]}),i.jsxs($e,{className:"p-6 text-sm",children:[i.jsxs(Jc,{className:"grid w-full grid-cols-2",children:[i.jsx(Ha,{value:"resume",children:S("quotes.list.resume.tabs.resume")}),i.jsx(Ha,{value:"preview",children:S("quotes.list.resume.tabs.preview")})]}),i.jsx(Ka,{value:"resume",className:"pt-4",children:i.jsxs("div",{className:"grid gap-3",children:[i.jsxs("div",{className:"grid gap-3",children:[i.jsx("div",{className:"font-semibold",children:S("quotes.list.resume.quote_information")}),i.jsxs("dl",{className:"grid gap-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("dt",{className:"text-muted-foreground",children:S("quotes.form_fields.reference.label")}),i.jsx("dd",{className:"font-medium",children:x.reference})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("dt",{className:"text-muted-foreground",children:S("quotes.form_fields.date.label")}),i.jsx("dd",{className:"font-medium",children:new Date(x.date).toLocaleDateString()})]}),i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsx("dt",{className:"text-muted-foreground whitespace-nowrap",children:S("quotes.form_fields.customer_reference.label")}),i.jsx("dd",{className:"font-medium text-right whitespace-break-spaces",children:x.customer_reference})]})]})]}),i.jsx(mn,{className:"my-4"}),i.jsxs("div",{className:"grid gap-3",children:[i.jsx("div",{className:"font-semibold",children:S("quotes.list.resume.customer_information")}),i.jsx("div",{children:x.customer_information})]}),i.jsx(mn,{className:"my-4"}),i.jsx("div",{className:"font-semibold",children:S("quotes.list.resume.price_information")}),i.jsxs("ul",{className:"grid gap-3",children:[i.jsxs("li",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:S("quotes.form_fields.subtotal_price.label")}),i.jsx("span",{children:F.subtotal_price})]}),i.jsxs("li",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:S("quotes.form_fields.discount_value.label",{value:F.discount})}),i.jsx("span",{children:F.discount_price})]}),i.jsxs("li",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:S("quotes.form_fields.tax_value.label",{value:F.tax})}),i.jsx("span",{children:F.tax_price})]}),i.jsxs("li",{className:"flex items-center justify-between font-semibold",children:[i.jsx("span",{className:"text-muted-foreground",children:S("quotes.form_fields.total_price.label")}),i.jsx("span",{children:F.total_price})]})]})]})}),i.jsx(Ka,{value:"preview",children:i.jsx(Od,{quote:x})})]}),i.jsx(kt,{className:"flex flex-row items-center px-6 py-3 border-t bg-accent",children:i.jsx("div",{className:"text-xs text-muted-foreground"})})]})})]})},Qw=({status:n="all",preview:a=!1})=>{const r=zt(),{toast:o}=xn(),l=L.useId(),c=L.useId(),{pagination:d,globalFilter:h,isFiltered:p}=Dn(),[v,x]=L.useState(void 0),{useList:y,useDownloader:C,useSetStatus:b,useDuplicate:E,getQuotePDFFilename:R}=Vr(),{mutate:P}=b(),{mutate:T}=E(),{data:I,isPending:F,isError:$,error:B}=y({pagination:{pageIndex:d.pageIndex,pageSize:d.pageSize},status:n,quickSearchTerm:h}),{download:q,...re}=C(),te=Ce=>{x(Ce)},fe=L.useCallback(()=>{o({description:S("quotes.downloading_dialog.toast_success")})},[o]),Se=L.useCallback(Ce=>{r(`/quotes/edit/${Ce.id}`,{relative:"path"})},[r,o]),ue=Ce=>{T({id:Ce},{onSuccess(Me){o({description:S("quotes.duplicate_action.toast_success"),variant:"success"}),r(`/quotes/edit/${Me.id}`,{relative:"path"})}})},J=Ce=>{P({id:Ce,newStatus:"archived"},{onSuccess:()=>{o({description:S("quotes.quote_status_editor.toast_status_changed",{newStatus:S("quotes.status.archived")}),variant:"success"})}})},Re=(Ce,Me)=>{P({id:Ce,newStatus:Me},{onSuccess:()=>{o({description:S("quotes.quote_status_editor.toast_status_changed",{newStatus:S(`quotes.status.${Me}`)}),variant:"success"})}})},rt=L.useMemo(()=>{const Ce=[{id:"reference",accessorKey:"reference",header:()=>i.jsx(i.Fragment,{children:S("quotes.list.columns.reference")}),cell:({row:{original:U},renderValue:_e})=>{const Ze=!!((U==null?void 0:U.status)==="accepted"&&(U!=null&&U.date_sent));return i.jsx(H,{size:"sm",variant:"link",disabled:Ze,className:"h-8 gap-1 px-0 text-left text-ellipsis",onClick:it=>{it.preventDefault(),Se(U)},children:i.jsx("div",{className:"",children:_e()})})}},{id:"status",accessorKey:"status",header:()=>i.jsx(i.Fragment,{children:S("quotes.list.columns.status")}),cell:({row:{original:U}})=>i.jsx(kd,{type:"badge",status:U.status,onChangeStatus:_e=>Re(U.id,_e)})},{id:"date_sent",accessor:"date_sent",header:()=>i.jsx("div",{className:"text-left text-ellipsis",children:S("quotes.list.columns.date_sent")}),cell:({row:{original:U}})=>{const _e=Zn.create(U.date_sent),Ze=_e.isSuccess&&!_e.object.isEmpty();return i.jsx("div",{className:"text-left text-ellipsis",children:Ze?i.jsx(Cd,{label:_e.object.toLocaleDateString("es-ES"),className:"text-green-800 bg-green-100 hover:text-green-800 hover:bg-green-100"}):i.jsx(i.Fragment,{})})}},{id:"date",accessor:"date",header:()=>i.jsx("div",{className:"text-left text-ellipsis",children:S("quotes.list.columns.date")}),cell:({row:{original:U}})=>{const _e=Zn.create(U.date);return i.jsx("div",{className:"text-left text-ellipsis",children:_e.isSuccess?_e.object.toLocaleDateString("es-ES"):"-"})}},{id:"customer_reference",accessorKey:"customer_reference",header:()=>i.jsx(i.Fragment,{children:S("quotes.list.columns.customer_reference")}),cell:({renderValue:U})=>i.jsx("div",{className:"text-left text-ellipsis",children:U()})},{id:"customer_information",accessorKey:"customer_information",header:()=>i.jsx(i.Fragment,{children:S("quotes.list.columns.customer_information")}),cell:({row:{original:U}})=>i.jsx("div",{className:"text-left text-ellipsis",children:U.customer_information.split(`
`).map((_e,Ze)=>i.jsxs("span",{className:Ze===0?"font-medium":"hidden text-sm text-muted-foreground md:inline",children:[_e,i.jsx("br",{})]},Ze))}),size:500}],Me=[{id:"row-actions",header:()=>null,cell:({row:{original:U}})=>{const _e=(U==null?void 0:U.status)==="accepted"&&!(U!=null&&U.date_sent),Ze=(U==null?void 0:U.status)==="accepted"&&!!(U!=null&&U.date_sent),it=(U==null?void 0:U.status)==="archived";return i.jsxs("div",{className:"flex gap-1",children:[i.jsxs(tr,{className:"gap-0",children:[i.jsxs(Ge,{children:[i.jsx(He,{asChild:!0,children:i.jsxs(H,{variant:"ghost",size:"icon",disabled:Ze,onClick:vn=>{vn.preventDefault(),Se(U)},children:[i.jsx(sd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Editar"})]})}),i.jsx(Ke,{children:i.jsx("p",{children:"Editar"})})]}),i.jsxs(Ge,{children:[i.jsx(He,{asChild:!0,children:i.jsxs(H,{variant:"ghost",size:"icon",onClick:vn=>{vn.preventDefault(),ue(U.id)},children:[i.jsx(So,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Duplicar"})]})}),i.jsx(Ke,{children:i.jsx("p",{children:"Duplicar"})})]}),i.jsxs(Ge,{children:[i.jsx(He,{asChild:!0,children:i.jsxs(H,{variant:"ghost",size:"icon",onClick:()=>{q(U.id,R(U))},children:[i.jsx(nd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Descargar"})]})}),i.jsx(Ke,{children:i.jsx("p",{children:"Descargar"})})]}),i.jsxs(Ge,{children:[i.jsx(He,{asChild:!0,children:i.jsxs(H,{variant:"ghost",size:"icon",disabled:it||Ze,onClick:vn=>{vn.preventDefault(),J(U.id)},children:[i.jsx(ed,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Archivar"})]})}),i.jsx(Ke,{children:i.jsx("p",{children:"Archivar"})})]})]}),i.jsx(tr,{children:i.jsx(Pd,{id:U.id,onSentTo:()=>null,disabled:Ze||!_e})})]})}}];return a?Ce:[...Ce,...Me]},[a]),{table:Q}=as({data:(I==null?void 0:I.items)??[],columns:rt,pageCount:(I==null?void 0:I.total_pages)??-1});return L.useEffect(()=>{Q&&I&&(I==null?void 0:I.total_pages)>0&&x(Q.getRowModel().rows[0])},[I,Q]),$?i.jsx(ir,{subtitle:B.message}):F?i.jsxs("div",{className:"grid items-start flex-1 gap-4 sm:py-0 md:gap-8 lg:grid-cols-3 xl:grid-cols-3",children:[i.jsx(qe,{className:"grid items-start gap-4 auto-rows-max md:gap-8 lg:col-span-2",children:i.jsx($e,{children:i.jsx(is,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0})})}),i.jsx("div",{})]}):(I==null?void 0:I.total_items)===0&&!p?i.jsx(qe,{children:i.jsx($e,{children:i.jsx(ss,{subtitle:"Empieza creando alguna cotización",buttonText:S("quotes.create.title"),onButtonClick:()=>r("add",{relative:"path"})})})}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex flex-col items-stretch flex-1 gap-4 xl:flex-row",children:[i.jsx("div",{id:l,className:"flex items-stretch flex-1",children:i.jsx(rs,{table:Q,paginationOptions:{visible:!0},className:"grid items-start flex-1 gap-4 auto-rows-max md:gap-8 lg:col-span-2",onRowClick:te,activeRowIndex:v==null?void 0:v.index,children:i.jsx(Md,{table:Q})})}),a&&i.jsx("div",{id:c,className:"flex items-stretch ",children:i.jsx(Yw,{quoteId:v==null?void 0:v.original.id})})]}),i.jsx(Ld,{...re,onFinishDownload:fe})]})},mS=()=>{const n=zt(),a=Tw(),{toast:r}=xn(),[o,l]=L.useState(Ia.createDefaultCode().object),[c,d]=L.useState(Ir.createDefaultCode().object),h=L.useMemo(()=>({date:"",reference:"",customer_reference:"",customer_information:"",lang_code:"",currency_code:"",payment_method:"",notes:"",validity:"",subtotal_price:{amount:void 0,scale:2,currency_code:""},discount:{amount:0,scale:0},discount_price:{amount:0,scale:0,currency_code:""},before_tax_price:{amount:void 0,scale:2,currency_code:""},tax:{amount:void 0,scale:0},tax_price:{amount:void 0,scale:2,currency_code:""},total_price:{amount:void 0,scale:2,currency_code:""},items:[{id_article:"",description:"",quantity:{amount:null,scale:2},unit_price:{amount:null,scale:2,currency_code:o.code},subtotal_price:{amount:null,scale:2,currency_code:o.code},discount:{amount:null,scale:2},total_price:{amount:null,scale:2,currency_code:o.code}}]}),[o.code]),{useOne:p,useUpdate:v}=Vr(),{data:x,status:y,error:C}=p(a),{mutate:b,isPending:E}=v(String(a)),R=Ji({mode:"onBlur",defaultValues:h}),{getValues:P,reset:T,handleSubmit:I,formState:F,control:$,watch:B,setValue:q}=R,{isSubmitting:re,isDirty:te}=F;Io({isDirty:te}),L.useEffect(()=>{if(!te)return;const{unsubscribe:ue}=B((J,{name:Re,type:rt})=>{if(Re==="items"){J.items&&J.items.map((Ce,Me)=>{if(Ce){const U=Ja(Ce);Ie.isEqual(U.subtotal_price.toObject(),Ce.subtotal_price)||q(`items.${Me}.subtotal_price`,U.subtotal_price.toObject()),Ie.isEqual(U.total_price.toObject(),Ce.total_price)||q(`items.${Me}.total_price`,U.total_price.toObject())}});const Q=Ba(J,!0);Ie.isEqual(Q.subtotal_price.toObject(),J.total_price)||q("subtotal_price",Q.subtotal_price.toObject()),Ie.isEqual(Q.discount_price.toObject(),J.total_price)||q("discount_price",Q.discount_price.toObject()),Ie.isEqual(Q.before_tax_price.toObject(),J.before_tax_price)||q("before_tax_price",Q.before_tax_price.toObject()),Ie.isEqual(Q.tax_price.toObject(),J.tax_price)||q("tax_price",Q.tax_price.toObject()),Ie.isEqual(Q.total_price.toObject(),J.total_price)||q("total_price",Q.total_price.toObject())}else if(Re&&rt==="change"){if(Re==="currency_code"){const Q=Ia.createFromCode(J.currency_code??Ia.DEFAULT_CURRENCY_CODE);if(Q.isFailure)throw console.error(Q.error),Q.error;l(Q.object)}if(Re==="lang_code"){const Q=Ir.createFromCode(J.lang_code??Ir.DEFAULT_LANGUAGE_CODE);if(Q.isFailure)throw console.error(Q.error),Q.error;d(Q.object)}if(["discount","tax"].includes(Re)){const Q=Ba(J,!0);Ie.isEqual(Q.subtotal_price.toObject(),J.total_price)||q("subtotal_price",Q.subtotal_price.toObject()),Ie.isEqual(Q.discount_price.toObject(),J.total_price)||q("discount_price",Q.discount_price.toObject()),Ie.isEqual(Q.before_tax_price.toObject(),J.before_tax_price)||q("before_tax_price",Q.before_tax_price.toObject()),Ie.isEqual(Q.tax_price.toObject(),J.tax_price)||q("tax_price",Q.tax_price.toObject()),Ie.isEqual(Q.total_price.toObject(),J.total_price)||q("total_price",Q.total_price.toObject())}if(Re!=null&&Re.startsWith("items")){const Q=Number(Re.split(".")[1]),Ce=Re.split(".")[2];if(["quantity","unit_price","discount"].includes(Ce)&&J.items&&J.items[Q]){const Me=J.items[Q],U=Ja(Me);Ie.isEqual(U.quantity.toObject(),Me.quantity)||q(`items.${Q}.quantity`,U.quantity.toObject()),Ie.isEqual(U.unit_price.toObject(),Me.unit_price)||q(`items.${Q}.unit_price`,U.unit_price.toObject()),Ie.isEqual(U.discount.toObject(),Me.discount)||q(`items.${Q}.discount`,U.discount.toObject()),Ie.isEqual(U.subtotal_price.toObject(),Me.subtotal_price)||q(`items.${Q}.subtotal_price`,U.subtotal_price.toObject()),Ie.isEqual(U.total_price.toObject(),Me.total_price)||q(`items.${Q}.total_price`,U.total_price.toObject());const _e=Ba(J,!0);Ie.isEqual(_e.subtotal_price.toObject(),J.total_price)||q("subtotal_price",_e.subtotal_price.toObject()),Ie.isEqual(_e.discount_price.toObject(),J.total_price)||q("discount_price",_e.discount_price.toObject()),Ie.isEqual(_e.before_tax_price.toObject(),J.before_tax_price)||q("before_tax_price",_e.before_tax_price.toObject()),Ie.isEqual(_e.tax_price.toObject(),J.tax_price)||q("tax_price",_e.tax_price.toObject()),Ie.isEqual(_e.total_price.toObject(),J.total_price)||q("total_price",_e.total_price.toObject())}}}});return()=>ue()},[B,te,q]);const fe=async(ue,J)=>{b(ue,{onError:Re=>{console.error(Re),r({title:"Error",description:Re.message,variant:"destructive"})},onSuccess:()=>{T(P()),r({title:"Cotización guardada",variant:"success"}),J&&n("/quotes")}})},Se=L.useCallback(()=>{n("/quotes",{state:{id:a}})},[n,a]);return L.useEffect(()=>{y==="success"&&x&&T(x)},[y,x,T]),y==="error"?i.jsx(ir,{errorMessage:C.message}):y!=="success"?i.jsx(Tn,{}):i.jsxs(i.Fragment,{children:[(re||E)&&i.jsx(Tn,{title:"Guardando cotización"}),i.jsx(es,{...R,children:i.jsx("form",{onSubmit:I(ue=>fe(ue,!1)),children:i.jsxs("div",{className:"mx-auto grid max-w-[90rem] flex-1 auto-rows-max gap-6",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(Bc,{}),i.jsxs("h1",{className:"flex-1 text-xl font-semibold tracking-tight shrink-0 whitespace-nowrap sm:grow-0",children:[S("quotes.edit.title")," ",x.reference]}),i.jsx(Cd,{label:S(`quotes.status.${x.status}`),className:"ml-auto sm:ml-0"}),i.jsxs("div",{className:"items-center hidden gap-2 md:ml-auto md:flex",children:[i.jsx(L0,{label:S("common.close"),variant:"secondary",size:"sm",onClick:Se}),i.jsx(bo,{label:S("common.save"),size:"sm",disabled:F.isSubmitting||F.isLoading||F.isValidating}),i.jsx(H,{size:"sm",disabled:F.isSubmitting||F.isLoading||F.isValidating,onClick:I(ue=>fe(ue,!0)),children:S("common.save_close")})]})]}),i.jsx(Hw,{}),i.jsx(Lw,{currency:o}),i.jsx(Gw,{currency:o,language:c,defaultValues:h}),i.jsxs("div",{className:"flex items-center justify-center gap-2 md:hidden",children:[i.jsx(H,{variant:"outline",size:"sm",children:S("common.discard")}),i.jsx(H,{onClick:I(ue=>fe(ue,!1)),size:"sm",children:S("quotes.edit.buttons.save_quote")})]})]})})}),!1]})},Xw=L.createContext(null),Zw=({children:n})=>{const[a,r]=$c();return i.jsx(Xw.Provider,{value:{pagination:a,setPagination:r},children:n})},hS=({children:n})=>i.jsx(ts,{children:i.jsx(Zw,{children:i.jsxs(qr,{className:"quotes-layout",children:[i.jsx($r,{}),i.jsx(zr,{children:n})]})})}),pS=()=>{const n=zt(),[a,r]=L.useState("all"),[o,l]=hw(!0),c=[{value:"all",label:S("quotes.list.tabs.all")},{value:"draft",label:S("quotes.list.tabs.draft")},{value:"ready",label:S("quotes.list.tabs.ready")},{value:"delivered",label:S("quotes.list.tabs.delivered")},{value:"accepted",label:S("quotes.list.tabs.accepted")},{value:"rejected",label:S("quotes.list.tabs.rejected")},{value:"archived",label:S("quotes.list.tabs.archived")}];return i.jsxs(nr,{children:[i.jsxs("div",{className:"flex items-center justify-between space-y-2",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:i.jsx(le,{i18nKey:"quotes.list.title"})}),i.jsx("p",{className:"text-muted-foreground",children:i.jsx(le,{i18nKey:"quotes.list.subtitle"})})]}),i.jsx("div",{className:"flex items-center space-x-2",children:i.jsxs(H,{onClick:()=>n("/quotes/add"),children:[i.jsx(jo,{className:"w-4 h-4 mr-2"}),S("quotes.create.title")]})})]}),i.jsxs(Zc,{value:a,onValueChange:r,children:[i.jsxs("div",{className:"flex flex-col items-start justify-between mb-4 sm:flex-row sm:items-center",children:[i.jsxs("div",{className:"w-full mb-4 sm:w-auto sm:mb-0",children:[i.jsx(Jc,{className:"hidden sm:flex",children:c.map(d=>i.jsx(Ha,{value:d.value,children:d.label},d.value))}),i.jsxs("div",{className:"flex items-center w-full space-x-2 sm:hidden",children:[i.jsx(Br,{children:S("quotes.list.tabs_title")}),i.jsxs(io,{value:a,onValueChange:r,children:[i.jsx(so,{children:i.jsx(ao,{placeholder:"Seleccionar estado"})}),i.jsx(oo,{children:c.map(d=>i.jsx(Fr,{value:d.value,children:d.label},d.value))})]})]})]}),i.jsx("div",{className:"flex items-baseline justify-center mr-4 font-medium",children:i.jsx(iw,{buttonText:"Ayuda",title:"Ayuda sobre el Estado de Cotizaciones",content:Jw})}),i.jsx("div",{className:"flex items-center gap-2 ml-auto",children:i.jsx(O0,{"aria-label":"Show quote preview",variant:"outline",defaultPressed:!1,pressed:o,onPressedChange:l,children:o?i.jsxs(i.Fragment,{children:[i.jsx(rd,{className:"w-4 h-4 mr-2"}),S("common.disable_preview")]}):i.jsxs(i.Fragment,{children:[i.jsx(G0,{className:"w-4 h-4 mr-2"}),S("common.enable_preview")]})})})]}),c.map(d=>i.jsx(Ka,{value:d.value,children:i.jsx(Qw,{status:d.value,preview:o})},d.value))]})]})},Jw=i.jsxs(to,{className:"grid gap-4 py-4",children:[i.jsx("p",{children:"El estado de una cotización indica su posición actual en el proceso de negocio."}),i.jsx("p",{children:"Los estados posibles son:"}),i.jsxs("ul",{className:"pl-6 space-y-2 list-disc",children:[i.jsxs("li",{children:[i.jsx("strong",{children:"Borrador:"})," La cotización está en proceso de creación o edición."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Preparado:"})," La cotización está lista para ser enviada al cliente."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Entregado:"})," La cotización ha sido enviada al cliente."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Aceptado:"})," El cliente ha aprobado la cotización."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Rechazado:"})," El cliente no ha aceptado la cotización."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Arcivado:"})," La cotización ha sido guardada para referencia futura y ya no está activa."]})]}),i.jsxs("p",{children:["Utiliza estos estados para hacer un seguimiento eficiente de tus cotizaciones y optimizar tu proceso de ventas. El estado ",i.jsx("strong",{children:"Archivado"})," es útil para mantener un historial de cotizaciones pasadas sin que interfieran con las cotizaciones activas."]})]}),eS=n=>{const a=Tr(),r=Mn();return{useOne:()=>cd({queryKey:r().data().resource("settings").action("one").id("me").params().get(),queryFn:()=>a.getOne({resource:"profile",id:""}),...n}),useUpdate:()=>{const o=Jt();return en({mutationKey:r().data().resource("settings").action("one").id("me").params().get(),mutationFn:l=>a.updateOne({resource:"profile",data:l,id:""}),onSuccess:()=>{o.invalidateQueries({queryKey:["data","default","settings"]})}})},useUploadLogo:()=>{const o=Jt(),{mutate:l,mutateAsync:c,...d}=en({mutationKey:["data","default","settings"],mutationFn:h=>a.uploadFile({path:"profile/logo",file:h,key:"logo"}),onError:()=>o.invalidateQueries({queryKey:["data","default","settings"]}),onSuccess:()=>{o.invalidateQueries({queryKey:["data","default","settings"]})}});return{upload:l,uploadAsync:c,...d}}}},xS=()=>{var B,q;const[n,a]=L.useState("profile"),{useOne:r,useUpdate:o,useUploadLogo:l}=eS(),{toast:c}=xn(),{data:d,status:h,error:p}=r(),v=L.useMemo(()=>({contact_information:"",default_payment_method:"",default_notes:"",default_legal_terms:"",default_quote_validity:"",default_tax:{amount:void 0,scale:2}}),[]),{mutate:x}=o(),{upload:y}=l(),C=Ji({mode:"onBlur",values:d==null?void 0:d.dealer,defaultValues:v}),{formState:b,reset:E,getValues:R,handleSubmit:P}=C,{isSubmitting:T,isDirty:I}=b,F=re=>{var fe;const te=(fe=re.target.files)==null?void 0:fe[0];if(te){if(te.type!=="image/png"&&te.type!=="image/jpeg"){alert(S("settings.form_fields.logo.invalid_format"));return}const Se=new FileReader;Se.onloadend=()=>{const ue=new Image;ue.onload=()=>{const J=ue.width,Re=ue.height,rt=J/Re===2;J<200||Re<100||!rt?alert(S("settings.form_fields.logo.invalid_dimensions")):y(te)},ue.src=Se.result},Se.readAsDataURL(te)}};Io({isDirty:I});const $=async re=>{x(re,{onError:te=>{console.debug(te),c({title:"Error",description:te.message,variant:"destructive"})},onSuccess:()=>{E(R()),c({description:"Ajustes guardados",variant:"success"})}})};return T?i.jsx(Tn,{title:"Guardando ajustes"}):h==="error"?i.jsx(ir,{errorMessage:p.message}):h!=="success"?i.jsx(Tn,{}):i.jsx(es,{...C,children:i.jsx("form",{onSubmit:P($),children:i.jsxs("div",{className:"mx-auto grid w-full max-w-6xl items-start gap-6 md:grid-cols-[180px_1fr] lg:grid-cols-[250px_1fr]",children:[((B=C.formState.errors.root)==null?void 0:B.message)&&i.jsxs(Pc,{variant:"destructive",children:[i.jsx(td,{className:"w-4 h-4"}),i.jsx(kc,{children:i.jsx(le,{i18nKey:"common.error"})}),i.jsx(qc,{children:(q=C.formState.errors.root)==null?void 0:q.message})]}),i.jsxs("nav",{className:"grid gap-4 text-sm text-muted-foreground",children:[i.jsx("a",{onClick:()=>a("profile"),className:n==="profile"?"font-semibold text-primary":"cursor-pointer",children:i.jsx(le,{i18nKey:"settings.edit.tabs.profile"})}),i.jsx("a",{onClick:()=>a("quotes"),className:n==="quotes"?"font-semibold text-primary":"cursor-pointer ",children:i.jsx(le,{i18nKey:"settings.edit.tabs.quotes"})}),i.jsx("a",{onClick:()=>a("legal"),className:n==="legal"?"font-semibold text-primary":"cursor-pointer ",children:i.jsx(le,{i18nKey:"settings.edit.tabs.legal"})})]}),i.jsxs("div",{className:me("grid gap-6",n==="profile"?"visible":"hidden"),children:[i.jsxs(qe,{children:[i.jsxs(yt,{children:[i.jsx(Xe,{children:i.jsx(le,{i18nKey:"settings.form_fields.contact_information.label"})}),i.jsx(nt,{children:i.jsx(le,{i18nKey:"settings.form_fields.contact_information.desc"})})]}),i.jsx($e,{children:i.jsx(qt,{rows:8,placeholder:S("settings.form_fields.contact_information.placeholder"),name:"contact_information",required:!0})}),i.jsx(kt,{className:"px-6 py-4 border-t",children:i.jsx(H,{children:i.jsx(le,{i18nKey:"common.save"})})})]}),i.jsxs(qe,{children:[i.jsxs(yt,{children:[i.jsx(Xe,{children:i.jsx(le,{i18nKey:"settings.form_fields.logo.label"})}),i.jsx(nt,{children:i.jsx(le,{i18nKey:"settings.form_fields.logo.desc"})})]}),i.jsx($e,{children:i.jsxs("div",{className:"flex items-center space-x-4",children:[i.jsx("div",{className:"w-[400px] h-[200px] border border-gray-300 flex items-center justify-center overflow-hidden",children:i.jsx("img",{src:d.dealer.logo?d.dealer.logo:"https://via.placeholder.com/200x100",width:400,height:200,style:{objectFit:"contain"}})}),i.jsx("div",{children:i.jsx("p",{className:"mt-2 text-sm text-gray-500",children:i.jsx(le,{i18nKey:"settings.form_fields.logo.requirements"})})})]})}),i.jsxs(kt,{className:"px-6 py-4 border-t",children:[i.jsx(Br,{htmlFor:"logo-upload",className:"inline-flex items-center justify-center h-10 px-4 py-2 text-sm font-medium transition-colors rounded-md cursor-pointer bg-primary text-primary-foreground hover:bg-primary/90 whitespace-nowrap ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:i.jsx(le,{i18nKey:"settings.form_fields.logo.upload"})}),i.jsx(Zi,{id:"logo-upload",type:"file",accept:".png,.jpg,.jpeg",onChange:F,className:"hidden"})]})]})]}),i.jsxs("div",{className:me("grid gap-6",n==="quotes"?"visible":"hidden"),children:[i.jsxs(qe,{children:[i.jsxs(yt,{children:[i.jsx(Xe,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_tax.label"})}),i.jsx(nt,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_tax.desc"})})]}),i.jsx($e,{children:i.jsx(Hi,{scale:2,disabled:b.disabled,placeholder:S("settings.form_fields.default_tax.desc"),name:"default_tax",required:!0})}),i.jsx(kt,{className:"px-6 py-4 border-t",children:i.jsx(H,{children:i.jsx(le,{i18nKey:"common.save"})})})]}),i.jsxs(qe,{children:[i.jsxs(yt,{children:[i.jsx(Xe,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_payment_method.label"})}),i.jsx(nt,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_payment_method.desc"})})]}),i.jsx($e,{children:i.jsx(qt,{autoSize:!0,placeholder:S("settings.form_fields.default_payment_method.placeholder"),name:"default_payment_method",required:!0,errors:C.formState.errors})}),i.jsx(kt,{className:"px-6 py-4 border-t",children:i.jsx(H,{children:i.jsx(le,{i18nKey:"common.save"})})})]}),i.jsxs(qe,{children:[i.jsxs(yt,{children:[i.jsx(Xe,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_quote_validity.label"})}),i.jsx(nt,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_quote_validity.desc"})})]}),i.jsx($e,{children:i.jsx(qt,{autoSize:!0,placeholder:S("settings.form_fields.default_quote_validity.placeholder"),name:"default_quote_validity",required:!0})}),i.jsx(kt,{className:"px-6 py-4 border-t",children:i.jsx(H,{children:i.jsx(le,{i18nKey:"common.save"})})})]}),i.jsxs(qe,{children:[i.jsxs(yt,{children:[i.jsx(Xe,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_notes.label"})}),i.jsx(nt,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_notes.desc"})})]}),i.jsx($e,{children:i.jsx(qt,{autoSize:!0,placeholder:S("settings.form_fields.default_notes.placeholder"),name:"default_notes"})}),i.jsx(kt,{className:"px-6 py-4 border-t",children:i.jsx(H,{children:i.jsx(le,{i18nKey:"common.save"})})})]})]}),i.jsx("div",{className:me("grid gap-6",n==="legal"?"visible":"hidden"),children:i.jsxs(qe,{className:"h-",children:[i.jsxs(yt,{children:[i.jsx(Xe,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_legal_terms.label"})}),i.jsx(nt,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_legal_terms.desc"})})]}),i.jsx($e,{children:i.jsx(qt,{rows:25,placeholder:S("settings.form_fields.default_legal_terms.placeholder"),name:"default_legal_terms"})}),i.jsx(kt,{className:"px-6 py-4 border-t",children:i.jsx(H,{children:i.jsx(le,{i18nKey:"common.save"})})})]})})]})})})},tS=L.createContext(null),nS=({children:n})=>i.jsx(tS.Provider,{value:{},children:n}),vS=({children:n})=>i.jsx(ts,{children:i.jsx(nS,{children:i.jsxs(qr,{className:"settings-layout",children:[i.jsx($r,{}),i.jsxs(zr,{children:[i.jsx("div",{className:"grid w-full max-w-6xl gap-2 mx-auto",children:i.jsx("h1",{className:"text-2xl font-semibold md:text-3xl",children:i.jsx(le,{i18nKey:"settings.edit.title"})})}),n]})]})})});export{oS as CatalogLayout,lS as CatalogList,uS as DashboardPage,cS as DealerLayout,dS as DealersList,fS as ErrorPage,sS as LoginPageWithLanguageSelector,aS as LogoutPage,gS as QuoteCreate,mS as QuoteEdit,hS as QuotesLayout,pS as QuotesList,xS as SettingsEditor,vS as SettingsLayout};